diff --git "a/pdfpatcher/.github/ISSUE_TEMPLATE/\345\205\266\345\256\203\351\227\256\351\242\230.md" "b/pdfpatcher/.github/ISSUE_TEMPLATE/\345\205\266\345\256\203\351\227\256\351\242\230.md" deleted file mode 100644 index f65114ee6649eb9fd03d7a5f82a3ddc2df20e0b3..0000000000000000000000000000000000000000 --- "a/pdfpatcher/.github/ISSUE_TEMPLATE/\345\205\266\345\256\203\351\227\256\351\242\230.md" +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: 其它问题 -about: 对于其它事项,例如使用方法求助等,建议在 Discussion 中发起讨论 -title: '' -labels: 讨论 -assignees: '' - ---- - - diff --git "a/pdfpatcher/.github/ISSUE_TEMPLATE/\346\226\260\345\212\237\350\203\275\351\234\200\346\261\202.md" "b/pdfpatcher/.github/ISSUE_TEMPLATE/\346\226\260\345\212\237\350\203\275\351\234\200\346\261\202.md" deleted file mode 100644 index 4d340daad9721cdac34cdd7956503bca21a26202..0000000000000000000000000000000000000000 --- "a/pdfpatcher/.github/ISSUE_TEMPLATE/\346\226\260\345\212\237\350\203\275\351\234\200\346\261\202.md" +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: 新功能需求 -about: 告诉我们你希望增加的功能 -title: '' -labels: 改进 -assignees: '' - ---- - -**使用场景** -例如:在什么场合下会用到这个功能 - -**功能应该怎样实现** -例如:界面是怎样的,操作方式是怎样的 - -**类似软件** -是否有类似软件或程序能提供相同的功能 - -**其它内容** -与本需求相关的其它内容 diff --git "a/pdfpatcher/.github/ISSUE_TEMPLATE/\347\274\272\351\231\267\351\227\256\351\242\230\346\212\245\345\221\212.md" "b/pdfpatcher/.github/ISSUE_TEMPLATE/\347\274\272\351\231\267\351\227\256\351\242\230\346\212\245\345\221\212.md" deleted file mode 100644 index ee73aadb8bb90117045278036d68efc729468a5f..0000000000000000000000000000000000000000 --- "a/pdfpatcher/.github/ISSUE_TEMPLATE/\347\274\272\351\231\267\351\227\256\351\242\230\346\212\245\345\221\212.md" +++ /dev/null @@ -1,27 +0,0 @@ ---- -name: 缺陷问题报告 -about: 告诉我们你遇到的问题 -title: '' -labels: 缺陷 -assignees: '' - ---- - -**请简要描述你遇到的问题** -本来应该是怎样的,但实际上却出现了怎样的情形 - -**重现问题的步骤** -步骤如下: -1. 使用如下附件 '...' -2. 打开某功能 '....' -3. 选中哪些选项,点击哪些按钮 '....' -4. 出现的问题 - -**预期的结果或行为** -在完成上面的操作步骤后,您觉得程序应该是怎样工作的。 - -**相关截图或文件** -如果有必要,请附上截图或文件(最好能附上程序的界面截图,以便了解你现在使用的版本和操作选项等) - -**其它** -与本问题相关的信息 diff --git a/pdfpatcher/App/.editorconfig b/pdfpatcher/App/.editorconfig deleted file mode 100644 index 533fc30a29c93a15bb1be21d6ccd1e737edd462d..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/.editorconfig +++ /dev/null @@ -1,217 +0,0 @@ -# Remove the line below if you want to inherit .editorconfig settings from higher directories -root = true - -# C# files -[*.cs] - -#### Core EditorConfig Options #### - -# Indentation and spacing -indent_size = 4 -indent_style = tab -tab_width = 4 - -# New line preferences -end_of_line = crlf -insert_final_newline = false - -#### .NET Coding Conventions #### - -# Organize usings -dotnet_separate_import_directive_groups = false -dotnet_sort_system_directives_first = true -file_header_template = unset - -# this. and Me. preferences -dotnet_style_qualification_for_event = false -dotnet_style_qualification_for_field = false -dotnet_style_qualification_for_method = false -dotnet_style_qualification_for_property = false - -# Language keywords vs BCL types preferences -dotnet_style_predefined_type_for_locals_parameters_members = true -dotnet_style_predefined_type_for_member_access = true - -# Parentheses preferences -dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity -dotnet_style_parentheses_in_other_binary_operators = always_for_clarity -dotnet_style_parentheses_in_other_operators = never_if_unnecessary -dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity - -# Modifier preferences -dotnet_style_require_accessibility_modifiers = for_non_interface_members - -# Expression-level preferences -dotnet_style_coalesce_expression = true -dotnet_style_collection_initializer = true -dotnet_style_explicit_tuple_names = true -dotnet_style_namespace_match_folder = true -dotnet_style_null_propagation = true -dotnet_style_object_initializer = true -dotnet_style_operator_placement_when_wrapping = beginning_of_line -dotnet_style_prefer_auto_properties = true -dotnet_style_prefer_compound_assignment = true -dotnet_style_prefer_conditional_expression_over_assignment = true -dotnet_style_prefer_conditional_expression_over_return = true -dotnet_style_prefer_inferred_anonymous_type_member_names = true -dotnet_style_prefer_inferred_tuple_names = true -dotnet_style_prefer_is_null_check_over_reference_equality_method = true -dotnet_style_prefer_simplified_boolean_expressions = true -dotnet_style_prefer_simplified_interpolation = true - -# Field preferences -dotnet_style_readonly_field = true - -# Parameter preferences -dotnet_code_quality_unused_parameters = all - -# Suppression preferences -dotnet_remove_unnecessary_suppression_exclusions = none - -# New line preferences -dotnet_style_allow_multiple_blank_lines_experimental = true -dotnet_style_allow_statement_immediately_after_block_experimental = true - -#### C# Coding Conventions #### - -# var preferences -csharp_style_var_elsewhere = false -csharp_style_var_for_built_in_types = false -csharp_style_var_when_type_is_apparent = false - -# Expression-bodied members -csharp_style_expression_bodied_accessors = true -csharp_style_expression_bodied_constructors = false -csharp_style_expression_bodied_indexers = true -csharp_style_expression_bodied_lambdas = true -csharp_style_expression_bodied_local_functions = false -csharp_style_expression_bodied_methods = false -csharp_style_expression_bodied_operators = false -csharp_style_expression_bodied_properties = true - -# Pattern matching preferences -csharp_style_pattern_matching_over_as_with_null_check = true -csharp_style_pattern_matching_over_is_with_cast_check = true -csharp_style_prefer_not_pattern = true -csharp_style_prefer_pattern_matching = true -csharp_style_prefer_switch_expression = true - -# Null-checking preferences -csharp_style_conditional_delegate_call = true - -# Modifier preferences -csharp_prefer_static_local_function = true:silent -csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async - -# Code-block preferences -csharp_prefer_braces = true -csharp_prefer_simple_using_statement = true - -# Expression-level preferences -csharp_prefer_simple_default_expression = true -csharp_style_deconstructed_variable_declaration = true -csharp_style_implicit_object_creation_when_type_is_apparent = true -csharp_style_inlined_variable_declaration = true -csharp_style_pattern_local_over_anonymous_function = true -csharp_style_prefer_index_operator = true -csharp_style_prefer_range_operator = true -csharp_style_throw_expression = true -csharp_style_unused_value_assignment_preference = discard_variable:silent -csharp_style_unused_value_expression_statement_preference = discard_variable - -# 'using' directive preferences -csharp_using_directive_placement = outside_namespace - -# New line preferences -csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true -csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true -csharp_style_allow_embedded_statements_on_same_line_experimental = true - -#### C# Formatting Rules #### - -# New line preferences -csharp_new_line_before_catch = true -csharp_new_line_before_else = true -csharp_new_line_before_finally = true -csharp_new_line_before_members_in_anonymous_types = true -csharp_new_line_before_members_in_object_initializers = true -csharp_new_line_before_open_brace = types -csharp_new_line_between_query_expression_clauses = true - -# Indentation preferences -csharp_indent_block_contents = true -csharp_indent_braces = false -csharp_indent_case_contents = true -csharp_indent_case_contents_when_block = true -csharp_indent_labels = one_less_than_current -csharp_indent_switch_labels = true - -# Space preferences -csharp_space_after_cast = false -csharp_space_after_colon_in_inheritance_clause = true -csharp_space_after_comma = true -csharp_space_after_dot = false -csharp_space_after_keywords_in_control_flow_statements = true -csharp_space_after_semicolon_in_for_statement = true -csharp_space_around_binary_operators = before_and_after -csharp_space_around_declaration_statements = false -csharp_space_before_colon_in_inheritance_clause = true -csharp_space_before_comma = false -csharp_space_before_dot = false -csharp_space_before_open_square_brackets = false -csharp_space_before_semicolon_in_for_statement = false -csharp_space_between_empty_square_brackets = false -csharp_space_between_method_call_empty_parameter_list_parentheses = false -csharp_space_between_method_call_name_and_opening_parenthesis = false -csharp_space_between_method_call_parameter_list_parentheses = false -csharp_space_between_method_declaration_empty_parameter_list_parentheses = false -csharp_space_between_method_declaration_name_and_open_parenthesis = false -csharp_space_between_method_declaration_parameter_list_parentheses = false -csharp_space_between_parentheses = false -csharp_space_between_square_brackets = false - -# Wrapping preferences -csharp_preserve_single_line_blocks = true -csharp_preserve_single_line_statements = true - -#### Naming styles #### - -# Naming rules - -dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion -dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface -dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i - -dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion -dotnet_naming_rule.types_should_be_pascal_case.symbols = types -dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case - -dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion -dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members -dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case - -# Symbol specifications - -dotnet_naming_symbols.interface.applicable_kinds = interface -dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.interface.required_modifiers = - -dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum -dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.types.required_modifiers = - -dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method -dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.non_field_members.required_modifiers = - -# Naming styles - -dotnet_naming_style.pascal_case.required_prefix = -dotnet_naming_style.pascal_case.required_suffix = -dotnet_naming_style.pascal_case.word_separator = -dotnet_naming_style.pascal_case.capitalization = pascal_case - -dotnet_naming_style.begins_with_i.required_prefix = I -dotnet_naming_style.begins_with_i.required_suffix = -dotnet_naming_style.begins_with_i.word_separator = -dotnet_naming_style.begins_with_i.capitalization = pascal_case diff --git a/pdfpatcher/App/AppContext.cs b/pdfpatcher/App/AppContext.cs deleted file mode 100644 index 8066cb04c480b5fba25a7d083e3bc7a494b800d7..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/AppContext.cs +++ /dev/null @@ -1,291 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using System.Xml; -using MuPdfSharp; -using PDFPatcher.Common; -using PowerJson; - -namespace PDFPatcher -{ - internal static class AppContext - { - static readonly string AppConfigFilePath = FileHelper.CombinePath( - Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), - "AppConfig.json"); - - static readonly SerializationManager JsonSm = new SerializationManager(new JsonReflectionController(true)) { - UseExtensions = false, - SerializeEmptyCollections = false, - SerializeNullValues = false, - SerializeReadOnlyFields = false, - SerializeReadOnlyProperties = false, - CanSerializePrivateMembers = true - }; - - internal const int MaxHistoryItemCount = 16; - - internal static MainForm MainForm { get; set; } - - static AppContext() { - SaveAppSettings = true; - BookmarkFile = String.Empty; - TargetFile = String.Empty; - CheckUpdateDate = DateTime.Now; - CheckUpdateInterval = 14; - Exporter = new ExporterOptions(); - Importer = new ImporterOptions(); - Merger = new MergerOptions(); - Patcher = new PatcherOptions(); - Editor = new PatcherOptions(); - AutoBookmarker = new AutoBookmarkOptions(); - Encodings = new EncodingOptions(); - ImageExtracter = new ImageExtracterOptions(); - ImageRenderer = new ImageRendererOptions(); - ExtractPage = new ExtractPageOptions(); - Ocr = new OcrOptions(); - Toolbar = new ToolbarOptions(); - WindowStatus = new WindowStatus(); - Recent = new RecentItems(); - } - public static bool SaveAppSettings { get; set; } - - ///获取或指定是否在加载 PDF 文档时仅加载部分文档。 - public static bool LoadPartialPdfFile { get; set; } - - private static string[] _SourceFiles = new string[0]; - ///获取或指定要处理的源文件路径列表。 - public static string[] SourceFiles { - get => _SourceFiles; - set => _SourceFiles = value ?? new string[0]; - } - - ///获取或指定检查更新的日期。 - public static DateTime CheckUpdateDate { get; set; } - ///获取或指定检查更新的日期间隔。 - public static int CheckUpdateInterval { get; set; } - - ///获取或指定是否应取消批处理操作。 - public static bool Abort { get; set; } - - ///获取或指定书签文件的路径。 - public static string BookmarkFile { get; set; } - - ///获取或指定目标文件的路径。 - public static string TargetFile { get; set; } - - ///获取导出设置。 - public static ExporterOptions Exporter { get; internal set; } - ///获取导入设置。 - public static ImporterOptions Importer { get; internal set; } - ///获取生成文档的设置。 - public static MergerOptions Merger { get; internal set; } - ///获取生成文档的设置。 - public static PatcherOptions Patcher { get; internal set; } - ///获取文档编辑器的设置。 - public static PatcherOptions Editor { get; internal set; } - ///获取自动生成书签的设置。 - public static AutoBookmarkOptions AutoBookmarker { get; internal set; } - ///获取应用程序设置。 - public static EncodingOptions Encodings { get; internal set; } - ///获取导出图像的设置。 - public static ImageExtracterOptions ImageExtracter { get; internal set; } - ///获取转换为图片的设置。 - public static ImageRendererOptions ImageRenderer { get; internal set; } - ///获取提取页面的设置。 - public static ExtractPageOptions ExtractPage { get; internal set; } - ///获取光学字符识别功能的设置。 - public static OcrOptions Ocr { get; internal set; } - ///获取或指定自定义工具栏的项目。 - public static ToolbarOptions Toolbar { get; internal set; } - ///获取或指定窗口状态。 - public static WindowStatus WindowStatus { get; internal set; } - - public static RecentItems Recent { get; internal set; } - - [JsonSerializable] - public sealed class RecentItems - { - ///获取最近使用的 PDF 文件列表。 - [JsonField("源文件")] - public List SourcePdfFiles { get; } = new List(); - ///获取最近使用的 PDF 输出文件列表。 - [JsonField("输出文件")] - public List TargetPdfFiles { get; } = new List(); - ///获取最近使用的信息文件列表。 - [JsonField("信息文件")] - public List InfoDocuments { get; } = new List(); - ///获取最近使用的文件名模板列表。 - [JsonField("文件名模板")] - public List FileNameTemplates { get; } = new List(); - ///获取最近使用的文件夹列表。 - [JsonField("文件夹")] - public List Folders { get; } = new List(); - ///获取最近使用的查找字符串列表。 - [JsonField("查找项")] - public List SearchPatterns { get; } = new List(); - ///获取最近使用的替换字符串列表。 - [JsonField("替换项")] - public List ReplacePatterns { get; } = new List(); - - internal static void AddHistoryItem(IList list, string item) { - if (String.IsNullOrEmpty(item)) { - return; - } - var i = -1; - var m = false; - foreach (var li in list) { - i++; - if (String.Equals(li, item, StringComparison.OrdinalIgnoreCase)) { - m = true; - break; - } - } - if (m) { - if (i == 0) { - return; - } - if (i != -1) { - list.RemoveAt(i); - } - } - list.Insert(0, item); - while (list.Count > MaxHistoryItemCount) { - list.RemoveAt(list.Count - 1); - } - } - - } - - internal static void CleanUpInexistentFiles(List list) { - list.RemoveAll(item => FileHelper.HasFileNameMacro(item) == false && File.Exists(item) == false); - } - - internal static void CleanUpInexistentFolders(List list) { - list.RemoveAll(item => FileHelper.HasFileNameMacro(item) == false && Directory.Exists(item) == false); - } - - internal static bool Load(string path) { - return LoadJson(path); - } - - internal static bool LoadJson(string path) { - if (String.IsNullOrEmpty(path)) { - path = AppConfigFilePath; - } - if (File.Exists(path) == false) { - return false; - } - ConfigurationSerialization conf; - try { - conf = Json.ToObject(File.ReadAllText(path, Encoding.UTF8), JsonSm); - if (conf == null || conf.SaveAppSettings == false) { - SaveAppSettings = false; - return false; - } - } - catch (Exception) { - return false; - } - CheckUpdateDate = conf.CheckUpdateDate; - CheckUpdateInterval = conf.CheckUpdateInterval; - LoadPartialPdfFile = conf.PdfLoadMode == Configuration.OptimalMemoryUsage; - if (conf.Recent != null) { - Recent = conf.Recent; - } - if (conf.ExporterOptions != null) { - Exporter = conf.ExporterOptions; - } - if (conf.ImporterOptions != null) { - Importer = conf.ImporterOptions; - } - if (conf.MergerOptions != null) { - Merger = conf.MergerOptions; - } - if (conf.PatcherOptions != null) { - Patcher = conf.PatcherOptions; - } - if (conf.EditorOptions != null) { - Editor = conf.EditorOptions; - } - if (conf.AutoBookmarkOptions != null) { - AutoBookmarker = conf.AutoBookmarkOptions; - } - if (conf.Encodings != null) { - Encodings = conf.Encodings; - } - if (conf.ImageExporterOptions != null) { - ImageExtracter = conf.ImageExporterOptions; - } - if (conf.ImageRendererOptions != null) { - ImageRenderer = conf.ImageRendererOptions; - } - if (conf.OcrOptions != null) { - Ocr = conf.OcrOptions; - } - if (conf.ExtractPageOptions != null) { - ExtractPage = conf.ExtractPageOptions; - } - if (conf.ToolbarOptions != null) { - Toolbar = conf.ToolbarOptions; - } - if (conf.WindowStatus != null) { - WindowStatus = conf.WindowStatus; - } - return true; - } - - /// - /// 保存应用程序配置。 - /// - /// 保存路径。路径为空时,保存到默认位置。 - /// 是否保存历史文件列表。 - /// 是否跳过只读文件。 - internal static void Save(string path, bool saveHistoryFileList, bool skipReadonly) { - try { - SaveJson(path ?? AppConfigFilePath, saveHistoryFileList, skipReadonly); - } - catch (Exception ex) { - FormHelper.ErrorBox("在保存程序设置时出错" + ex.Message); - } - } - - static void SaveJson(FilePath path, bool saveHistoryFileList, bool skipReadonly) { - if (skipReadonly && path.ExistsFile && (path.ToFileInfo().Attributes & FileAttributes.ReadOnly) > 0) { - return; - } - var s = SaveAppSettings - ? new ConfigurationSerialization { - SaveAppSettings = true, - CheckUpdateDate = CheckUpdateDate, - CheckUpdateInterval = CheckUpdateInterval, - PdfLoadMode = LoadPartialPdfFile ? Configuration.OptimalMemoryUsage : Configuration.OptimalSpeed, - MergerOptions = Merger, - ExporterOptions = Exporter, - ImporterOptions = Importer, - PatcherOptions = Patcher, - EditorOptions = Editor, - AutoBookmarkOptions = AutoBookmarker, - Encodings = Encodings, - ImageExporterOptions = ImageExtracter, - ImageRendererOptions = ImageRenderer, - ExtractPageOptions = ExtractPage, - OcrOptions = Ocr, - ToolbarOptions = Toolbar, - WindowStatus = new WindowStatus(MainForm), - Recent = saveHistoryFileList ? Recent : null - } - : new ConfigurationSerialization { SaveAppSettings = false }; - path.WriteAllText(false, Encoding.UTF8, Json.ToJson(s, JsonSm)); - } - - private static void WriteRecentFiles(XmlWriter writer, IList list, string name) { - foreach (var item in list) { - writer.WriteStartElement(name); - writer.WriteAttributeString(Configuration.Path, item); - writer.WriteEndElement(); - } - } - } -} diff --git a/pdfpatcher/App/Commands.cs b/pdfpatcher/App/Commands.cs deleted file mode 100644 index 362c97a13c01c3b68e1f039be8619e3dc727f584..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Commands.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace PDFPatcher -{ - static class Commands - { - internal const string File = "_File"; - #region File menu - internal const string Open = "_Open"; - internal const string OpenFile = "OpenFile"; - internal const string LoadList = "_LoadList"; - internal const string RecentFiles = "_RecentFiles"; - internal const string ImportBookmark = "_ImportBookmark"; - internal const string Close = "_Close"; - internal const string Action = "_Action"; - internal const string SaveBookmark = "_SaveBookmark"; - internal const string SaveAsInfoFile = "_SaveAsInfoFile"; - internal const string DocumentProperties = "_Properties"; - internal const string Options = "_Options"; - internal const string ResetOptions = "_ResetOptions"; - internal const string AppOptions = "_AppOptions"; - internal const string RestoreOptions = "_RestoreOptions"; - internal const string SaveOptions = "_SaveOptions"; - internal const string SaveList = "_SaveList"; - internal const string CleanUpInexistentFiles = "_CleanUpInexistentFiles"; - internal const string Exit = "_Exit"; - #endregion - - internal const string Tools = "_ToolBox"; - #region Tools menu - internal const string LogWindow = "_LogWindow"; - internal const string ShowGeneralToolbar = "_ShowGeneralToolbar"; - internal const string CustomizeToolbar = "_CustomizeToolbar"; - #endregion - - internal const string Selection = "_Select"; - #region Selection menu - internal const string Copy = "_Copy"; - internal const string Delete = "_Delete"; - internal const string Paste = "_Paste"; - internal const string SelectAllPdf = "_SelectAllPdfFiles"; - internal const string SelectAllImages = "_SelectAllImages"; - internal const string SelectAllFolders = "_SelectAllFolders"; - internal const string SelectAllItems = "_SelectAll"; - internal const string InvertSelectItem = "_InvertSelect"; - internal const string SelectNone = "_SelectNone"; - internal const string ItemTypeSeparator = "_ItemTypeSeparator"; - internal const string ExpandAll = "_ExpandAll"; - internal const string CollapseAll = "_CollapseAll"; - internal const string CollapseChildren = "_CollapseChildren"; - #endregion - - #region Options menu - internal const string PatcherOptions = "_PatcherOptions"; - internal const string MergerOptions = "_MergerOptions"; - internal const string InfoFileOptions = "_InfoFileOptions"; - #endregion - - internal const string Help = "_Help"; - #region Help menu - internal const string CreateShortcut = "_CreateShortcut"; - internal const string VisitHomePage = "_VisitHomePage"; - internal const string CheckUpdate = "_CheckUpdate"; - #endregion - - #region Editor - internal const string EditorInsertBookmark = "_BookmarkHere"; - internal const string EditorSavePdf = "_SavePDF"; - internal const string EditorBookmarkLevelUp = "_LevelUp"; - internal const string EditorBookmarkLevelDown = "_LevelDown"; - internal const string EditorBookmarkDelete = "_DeleteBookmark"; - internal const string EditorBookmarkBold = "_BookmarkBoldButton"; - internal const string EditorBookmarkItalic = "_BookmarkItalicButton"; - internal const string EditorBookmarkPageNumberIncrement = "_IncrementPageNumber"; - internal const string EditorBookmarkPageNumberDecrement = "_DecrementPageNumber"; - internal const string EditorBookmarkPageNumberShift = "_ShiftMultiPageNumber"; - internal const string EditorOcrPage = "_OcrPage"; - internal const string EditorPageProperties = "_PageProperties"; - internal const string EditorSavePageImage = "_SavePageImage"; - #endregion - internal static readonly string[] TopMenuItems = { File, Tools, Selection }; - internal static readonly string[] CommonSelectionCommands = { SelectAllItems, SelectNone, InvertSelectItem }; - internal static readonly HashSet DefaultDisabledItems = new HashSet( - new string[] { - SelectAllItems, InvertSelectItem, SelectNone, - Copy, Delete, - Options - }); - internal static readonly HashSet DefaultHiddenItems = new HashSet( - new string[] { - ImportBookmark, SaveBookmark, SaveAsInfoFile, DocumentProperties, - SelectAllPdf, SelectAllImages, SelectAllFolders, ItemTypeSeparator - }); - - } -} diff --git a/pdfpatcher/App/Common/CommandRegistry.cs b/pdfpatcher/App/Common/CommandRegistry.cs deleted file mode 100644 index a14c57d305d5b9cbad820f4fcc993909387a42e2..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Common/CommandRegistry.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Common -{ - /// - /// 表示在指定上下文下执行的处理命令。 - /// - /// 处理命令时的上下文类型。 - interface ICommand

- { - void Process(P context, params string[] parameters); - } - - ///

- /// 不区分字符串大小写匹配的容器集合。用于编辑器命令模式。 - /// - /// 命令模式的处理参数类型。 - sealed class CommandRegistry

- { - readonly Dictionary> _container = new Dictionary>(StringComparer.OrdinalIgnoreCase); - - ///

- /// 注册执行处理的命令处理器。 - /// - /// 执行命令的处理器。 - /// 触发该命令的命令标识符。 - public void Register(ICommand

command, params string[] commandIDs) { - foreach (var cmd in commandIDs) { - _container.Add(cmd, command); - } - } - - ///

- /// 执行指定的命令。 - /// - /// 命令标识符。 - /// 处理命令时的上下文变量。 - /// 参数。 - /// 如找到对应的命令处理,则返回 true,否则返回 false。 - public bool Process(string commandID, P context, params string[] parameters) { - if (_container.TryGetValue(commandID, out ICommand

cmd)) { - cmd.Process(context, parameters); - return true; - } - return false; - } - } -} diff --git a/pdfpatcher/App/Common/DualKeyDictionary.cs b/pdfpatcher/App/Common/DualKeyDictionary.cs deleted file mode 100644 index b4e7a3997a9857c4880979aaf34f0be6ff4d4e54..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Common/DualKeyDictionary.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace PDFPatcher.Common -{ - public class DualKeyDictionary : IDictionary - { - private readonly Dictionary _keyDictionary = new Dictionary(); - private readonly Dictionary _reverseDictionary = new Dictionary(); - - public DualKeyDictionary() { - - } - - public K GetKeyByValue(V value) { - return _reverseDictionary[value]; - } - - #region IDictionary 成员 - - public void Add(K key, V value) { - _keyDictionary.Add(key, value); - _reverseDictionary.Add(value, key); - } - - public bool ContainsKey(K key) { - return _keyDictionary.ContainsKey(key); - } - public bool ContainsValue(V value) { - return _reverseDictionary.ContainsKey(value); - } - - public ICollection Keys => _keyDictionary.Keys; - - public bool Remove(K key) { - if (_keyDictionary.ContainsKey(key) == false) { - return false; - } - var value = _keyDictionary[key]; - _keyDictionary.Remove(key); - _reverseDictionary.Remove(value); - return true; - } - - public bool TryGetValue(K key, out V value) { - return TryGetValue(key, out value); - } - - public ICollection Values => _reverseDictionary.Keys; - - public V this[K key] { - get => _keyDictionary[key]; - set { - Remove(key); - Add(key, value); - } - } - - #endregion - - #region ICollection> 成员 - - public void Add(KeyValuePair item) { - Add(item.Key, item.Value); - } - - public void Clear() { - _keyDictionary.Clear(); - _reverseDictionary.Clear(); - } - - public bool Contains(KeyValuePair item) { - return _keyDictionary.ContainsKey(item.Key) && _reverseDictionary.ContainsKey(item.Value); - } - - public void CopyTo(KeyValuePair[] array, int arrayIndex) { - ((ICollection>)_keyDictionary).CopyTo(array, arrayIndex); - } - - public int Count => _keyDictionary.Count; - - public bool IsReadOnly => false; - - public bool Remove(KeyValuePair item) { - return Remove(item.Key); - } - - #endregion - - #region IEnumerable> 成员 - - public IEnumerator> GetEnumerator() { - return ((IEnumerable>)_keyDictionary).GetEnumerator(); - } - - #endregion - - #region IEnumerable 成员 - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { - return ((System.Collections.IEnumerable)_keyDictionary).GetEnumerator(); - } - - #endregion - } -} diff --git a/pdfpatcher/App/Common/FileHelper.cs b/pdfpatcher/App/Common/FileHelper.cs deleted file mode 100644 index 4eab5d37bfcf44942588e1b5cab6697d5e105517..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Common/FileHelper.cs +++ /dev/null @@ -1,267 +0,0 @@ -using System; -using System.IO; - -namespace PDFPatcher.Common -{ - static class FileHelper - { - enum OverwriteType - { - Prompt, Overwrite, Skip - } - static OverwriteType __OverwriteMode; - - public static bool HasExtension(FilePath fileName, string extension) { - return fileName.HasExtension(extension); - } - public static bool HasFileNameMacro(string fileName) { - var c = '<'; - foreach (var item in fileName) { - if (item == c) { - if (c == '>') { - return true; - } - c = '>'; - } - } - return false; - } - public static int NumericAwareComparePath(string path1, string path2) { - const char PathDot = '.'; - var l1 = path1?.Length ?? 0; - var l2 = path2?.Length ?? 0; - if (l1 == 0 || l2 == 0) { - return l1 - l2; - } - int n1 = 0, n2 = 0; - for (int i1 = 0, i2 = 0; i1 < l1 && i2 < l2; i1++, i2++) { - var x = path1[i1]; - var y = path2[i2]; - if (x < '0' || x > '9') { - // 不区分大小写的文字比较 - if (x != y) { - x = ToLowerAscii(x); - y = ToLowerAscii(y); - if (x == y) { - continue; - } - return x == PathDot ? -1 - : y == PathDot ? 1 - : y < '0' || y > '9' ? LocaleInfo.StringComparer(x.ToString(), y.ToString(), System.Globalization.CompareOptions.StringSort) - // path2 为数字,path1 不为数字,path2 排在前面 - : 1; - } - } - else if (IsPathSeparator(x)) { - if (IsPathSeparator(y)) { - continue; - } - return -1; - } - else if (IsPathSeparator(y)) { - return 1; - } - else { - // 数字比较 - if (y >= '0' && y <= '9') { - // 两组均为数字 - do { - if (x > '0' || n1 > 0) { - ++n1; - } - } while (++i1 < l1 && (x = path1[i1]) >= '0' && x <= '9'); - do { - if (y > '0' || n2 > 0) { - ++n2; - } - } while (++i2 < l2 && (y = path2[i2]) >= '0' && y <= '9'); - // 数字位数少的在前面 - if (n1 != n2) { - return n1 - n2; - } - // 全是 0,继续后面的比较 - if (n1 == 0 || n2 == 0) { - --i1; - --i2; - continue; - } - i1 -= n1; - i2 -= n2; - for (int i = 0; i < n1; i++, i1++, i2++) { - x = path1[i1]; - y = path2[i2]; - if (x != y) { - return x - y; - } - } - // 数值相等,比较下一组 - n1 = n2 = 0; - --i1; - --i2; - } - else { - // 仅 x 为数字,y 不为数字 - return y == PathDot ? 1 : x - y; - } - } - } - return path1.Length - path2.Length; - } - static char ToLowerAscii(char c) { - return c >= 'A' && c <= 'Z' ? (char)(c + ('a' - 'A')) : c; - } - - internal static bool CheckOverwrite(string targetFile) { - if (!File.Exists(targetFile)) { - return true; - } - - switch (__OverwriteMode) { - case OverwriteType.Prompt: - var r = Common.FormHelper.YesNoCancelBox(String.Join("\n", new string[] { - "是否覆盖目标文件?", targetFile, "\n按住 Shift 键重复此对话框的选择,本次操作不再弹出覆盖文件提示。" - })); - if (r == System.Windows.Forms.DialogResult.No) { - if (FormHelper.IsShiftKeyDown) { - __OverwriteMode = OverwriteType.Skip; - } - goto case OverwriteType.Skip; - } - else if (r == System.Windows.Forms.DialogResult.Cancel) { - throw new OperationCanceledException(); - } - if (FormHelper.IsShiftKeyDown) { - __OverwriteMode = OverwriteType.Overwrite; - } - break; - case OverwriteType.Overwrite: - return true; - case OverwriteType.Skip: - Tracker.TraceMessage(Tracker.Category.ImportantMessage, "取消覆盖文件:" + targetFile); - return false; - default: - goto case OverwriteType.Prompt; - } - - return true; - } - - public static string CombinePath(string path1, string path2) { - if (string.IsNullOrEmpty(path2)) { - return path1 ?? string.Empty; - } - if (string.IsNullOrEmpty(path1)) { - return path2; - } - var l2 = path2.Length; - if (l2 > 0) { - if (IsPathSeparator(path2[0]) || (l2 > 1 && path2[1] == Path.VolumeSeparatorChar)) { - return path2; - } - } - var ch = path1[path1.Length - 1]; - if (IsPathSeparator(ch) == false) { - return path1 + Path.DirectorySeparatorChar + path2; - } - return path1 + path2; - } - public static bool ComparePath(FilePath path1, FilePath path2) { - return path1.Equals(path2); - } - - public static bool IsPathValid(string filePath) { - return String.IsNullOrEmpty(filePath) == false && filePath.Trim().Length > 0 - && filePath.IndexOfAny(FilePath.InvalidPathChars) == -1; - } - static bool IsPathSeparator(char c) { - return c == Path.DirectorySeparatorChar || c == Path.AltDirectorySeparatorChar; - } - - internal static void ResetOverwriteMode() { - __OverwriteMode = OverwriteType.Prompt; - } - - internal static string MakePathRootedAndWithExtension(string path, string basePath, string extName, bool forceExt) { - var p = Path.Combine(Path.GetDirectoryName(basePath), path); - return Path.GetExtension(p).Length == 0 || forceExt ? (string)new FilePath(p).EnsureExtension(extName) : p; - } - - static FilePath AttachExtensionName(FilePath fileName, string extension) { - return fileName.EnsureExtension(extension); - } - - static string GetNewFileName(string fileName, string extName) { - var tmpName = AttachExtensionName(fileName, extName); - var n = 1; - while (tmpName.ExistsFile) { - tmpName = AttachExtensionName(fileName + "[" + (++n) + "]", extName); - } - return tmpName.ToString(); - } - public static string GetValidFileName(FilePath fileName) { - return fileName.SubstituteInvalidChars('_').ToString(); - } - internal static string GetNewFileNameFromSourceFile(string fileName, string extName) { - var d = Path.GetDirectoryName(fileName); - return GetNewFileName( - d + @"\" + Path.GetFileNameWithoutExtension(fileName), - extName) - .Replace(@"\\", @"\"); - } - internal static string GetTempNameFromFileDirectory(string fileName, string extName) { - var f = Path.GetDirectoryName(fileName); - var t = Path.GetTempFileName(); - return Path.Combine(f, t + extName); - } - public static string GetEllipticPath(string path, int length) { - if (length < 11) { - length = 11; - } - return path == null ? string.Empty - : path.Length > length ? (path.Substring(0, 7) + "..." + path.Substring(path.Length - (length - 10))) - : path; - } - - public static byte[] DumpBytes(this byte[] source, FilePath path) { - return source.DumpBytes(path, 0, source?.Length ?? 0); - } - public static byte[] DumpBytes(this byte[] source, FilePath path, int offset, int count) { - using (var f = new FileStream(path.ToFullPath(), FileMode.OpenOrCreate, FileAccess.Write)) { - if (source == null) { - return null; - } - f.Write(source, offset, count); - } - return source; - } - public static byte[] DumpHexBinBytes(this byte[] source, FilePath path) { - using (var f = new StreamWriter(path.ToFullPath())) { - if (source == null) { - return null; - } - byte t; - for (int i = 0; i < source.Length; i++) { - if (i > 0) { - if ((i & 0xF) == 0) { - f.WriteLine(); - } - if ((i & 0x1) == 0) { - f.Write(' '); - } - } - var b = source[i]; - t = (byte)(b >> 4); - f.Write((char)(t + (t > 9 ? ('A' - 10) : 0x30))); - t = (byte)(b & 0x0F); - f.Write((char)(t + (t > 9 ? ('A' - 10) : 0x30))); - } - } - return source; - } - - static class LocaleInfo - { - public static readonly Func StringComparer = System.Globalization.CultureInfo.CurrentCulture.CompareInfo.Compare; - } - } -} diff --git a/pdfpatcher/App/Common/FilePath.cs b/pdfpatcher/App/Common/FilePath.cs deleted file mode 100644 index 01b350a6017c391d9d6d62b999c93975b9ece408..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Common/FilePath.cs +++ /dev/null @@ -1,1051 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Reflection; -using System.Text; -using NameList = System.Collections.Generic.List; -using SysDirectory = System.IO.Directory; - -namespace PDFPatcher.Common -{ - ///

表示文件路径的结构。此结构可隐式转换为字符串、 - public readonly struct FilePath : IEquatable - { - internal static readonly char[] InvalidFileNameChars = Path.GetInvalidFileNameChars(); - internal static readonly char[] InvalidPathChars = Path.GetInvalidPathChars(); - internal static readonly Func __PathComparer = StringComparer.OrdinalIgnoreCase.Equals; - - /// 表示匹配任何文件的通配符。 - public const string Wildcard = "*"; - /// 表示匹配当前目录、递归子目录和任何文件的通配符。 - public const string RecursiveWildcard = "**"; - - /// 表示没有任何内容的路径。 - public static readonly FilePath Empty = new FilePath(string.Empty, false); - - /// 获取应用程序所在的目录路径。 - public static readonly FilePath AppRoot = ((FilePath)AppDomain.CurrentDomain.BaseDirectory).AppendPathSeparator(); - - /// 获取应用程序的文件路径(对于 Web 应用程序,返回 )。 - public static readonly FilePath AppPath = Assembly.GetEntryAssembly() != null ? (FilePath)Assembly.GetEntryAssembly().Location : Empty; - - static readonly char[] __PathSeparators = { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }; - static readonly string __CurrentPath = "." + Path.DirectorySeparatorChar; - readonly string _value; - - /// 传入文件路径的字符串形式,创建新的 实例。在创建实例时,删除传入字符串内所有的前导和尾随空白。 - /// 文件路径的字符串形式。 - public FilePath(string path) : this(path, true) { } - - internal FilePath(string path, bool trim) { - _value = string.IsNullOrEmpty(path) - ? string.Empty - : trim ? path.Trim() : path; - } - - /// 返回当前路径的目录部分。如目录为相对路径,则先转换为以当前程序所在目录路径为基准的绝对路径。 - /// 当前路径的目录部分。 - public FilePath Directory { - get { - const int None = 0, EndWithSep = 1, EndWithLetter = 2; - var p = AppRoot.Combine(_value)._value; - int s = None; - for (int i = p.Length - 1; i >= 0; i--) { - var c = p[i]; - bool d = IsDirectorySeparator(c); - switch (s) { - case None: - if (d) { - s = EndWithSep; - } - else if (Char.IsWhiteSpace(c) == false) { - s = EndWithLetter; - } - continue; - case EndWithSep: - if (d) { - continue; - } - else if (c == Path.VolumeSeparatorChar) { - return Empty; - } - else { - return p.Substring(0, i + 1); - } - case EndWithLetter: - if (d) { - return p.Substring(0, (i == 2 && p[1] == Path.VolumeSeparatorChar || i == 0) ? i + 1 : i); - } - else if (c == Path.VolumeSeparatorChar) { - return p.Substring(0, i + 1) + Path.DirectorySeparatorChar; - } - break; - } - } - return Empty; - } - } - - /// 返回当前路径是否以目录分隔符结束。 - public bool EndsWithPathSeparator { - get { - if (String.IsNullOrEmpty(_value)) { - return false; - } - for (int i = _value.Length - 1; i >= 0; i--) { - var c = _value[i]; - if (Char.IsWhiteSpace(c)) { - continue; - } - return IsDirectorySeparator(c); - } - return false; - } - } - - /// 检查当前路径对应的文件是否存在。 - public bool ExistsFile => File.Exists(ToFullPath()._value); - - /// 检查当前路径对应的目录是否存在。 - public bool ExistsDirectory => SysDirectory.Exists(ToFullPath()._value); - - /// 获取文件路径的文件名部分。 - public string FileName { - get { - if (IsEmpty) { - return string.Empty; - } - char c; - for (int i = _value.Length - 1; i >= 0; i--) { - c = _value[i]; - if (IsDirectorySeparator(c) || c == Path.VolumeSeparatorChar) { - return _value.Substring(++i); - } - } - return _value; - } - } - - /// 获取文件路径的文件名(不包含扩展名)部分。 - public string FileNameWithoutExtension { - get { - if (IsEmpty) { - return string.Empty; - } - char c; - var l = _value.Length; - var d = l; - for (int i = d - 1; i >= 0; i--) { - c = _value[i]; - if (c == '.') { - if (d == l) { - d = i; - } - } - else if (IsDirectorySeparator(c) || c == Path.VolumeSeparatorChar) { - return d != l ? _value.Substring(++i, d - i) : _value.Substring(++i); - } - } - return d != l ? _value.Substring(0, d) : _value; - } - } - - /// 获取文件路径的文件扩展名部分。 - public string FileExtension { - get { - if (IsEmpty) { - return string.Empty; - } - char c; - int i; - for (i = _value.Length - 1; i >= 0; i--) { - c = _value[i]; - if (IsDirectorySeparator(c)) { - i = -1; - break; - } - if (c == '.') { - break; - } - } - return i > -1 && i < _value.Length - 1 ? _value.Substring(i) : string.Empty; - } - } - - /// 返回当前路径是否为空。 - public bool IsEmpty => String.IsNullOrEmpty(_value); - - /// 返回当前文件路径是否有效。 - public bool IsValidPath => _value?.Trim().Length > 0 && _value.IndexOfAny(InvalidPathChars) == -1; - - /// 在路径后附加 字符。 - /// 附加了“\”字符的路径。 - public FilePath AppendPathSeparator() { - return IsEmpty == false && _value[_value.Length - 1] == Path.DirectorySeparatorChar - ? this - : (FilePath)(_value + Path.DirectorySeparatorChar); - } - /// 删除路径尾部的 字符。 - /// 删除了尾部“\”字符的路径。 - public FilePath TrimPathSeparator() { - if (_value == null) { - return Empty; - } - - string p = _value; - int i; - for (i = p.Length - 1; i >= 0; i--) { - char c = p[i]; - if (!Char.IsWhiteSpace(c) && IsDirectorySeparator(c) == false) { - return _value.Substring(0, i + 1); - } - } - return Empty; - } - - /// 替换文件路径的扩展名为新的扩展名。 - /// 新的扩展名。 - /// 替换扩展名后的路径。 - public FilePath ChangeExtension(string extension) { - if (IsEmpty) { - return Empty; - } - if (extension == null || (extension = extension.TrimEnd()).Length == 0) { - extension = String.Empty; - } - else if (extension[0] != '.') { - extension = "." + extension; - } - int i; - char c; - for (i = _value.Length - 1; i >= 0; i--) { - c = _value[i]; - if (IsDirectorySeparator(c)) { - i = -1; - break; - } - if (c == '.') { - break; - } - } - return new FilePath(i >= 0 ? _value.Substring(0, i) + extension : _value + extension, false); - } - - /// - public FilePath Combine(FilePath path) { - return Combine(path, false); - } - - /// 合并两个文件路径。如 为绝对路径,则返回该路径。 - /// 子路径。 - /// 对于 开头的情况,取值为 时,视为以当前目录为基础目录;否则将 视为从根目录开始,返回 。 - /// 合并后的路径。 - public FilePath Combine(FilePath path, bool rootAsRelative) { - if (path.IsEmpty) { - return _value != null ? this : Empty; - } - if (IsEmpty) { - return path._value != null ? path : Empty; - } - var p2 = path._value; - var ps = p2[0]; - bool p2r; - if ((p2r = IsDirectorySeparator(ps)) && rootAsRelative == false // note 不能调转 && 参数的顺序,p2r 在后面有用 - || p2.Length > 1 && (p2[1] == Path.VolumeSeparatorChar || p2[1] == ps)) { - return path; - } - - var p1 = _value/*.TrimEnd()*/; // _value 已在创建时 Trim 过,不需再 Trim - if (ps == '.') { // 合并扩展名到当前路径 - return p1 + p2; - } - return IsDirectorySeparator(p1[p1.Length - 1]) == false && p2r == false - ? new FilePath(p1 + Path.DirectorySeparatorChar + p2) - : new FilePath(p1 + p2, false); - } - - /// 为当前文件路径创建目录。如文件路径为空,则不创建路径。 - /// 所创建目录的路径。 - public FilePath CreateDirectory() { - if (IsEmpty) { - return Empty; - } - var p = ToFullPath(); - if (SysDirectory.Exists(p) == false) { - SysDirectory.CreateDirectory(p); - } - return p; - } - - /// 为当前文件路径创建其所属的目录。如文件路径为空,则不创建路径。 - /// 所创建目录的路径。 - public FilePath CreateContainingDirectory() { - if (IsEmpty) { - return Empty; - } - var f = Directory; - if (SysDirectory.Exists(f._value) == false) { - SysDirectory.CreateDirectory(f._value); - } - return f; - } - - /// 删除当前文件路径对应的文件。 - public void DeleteFile() { - var p = ToFullPath()._value; - File.Delete(p); - } - /// 删除当前文件路径对应的目录。如路径指向的目录不存在,不执行任何操作。 - /// 是否递归删除子目录的文件 - public void DeleteDirectory(bool recursive) { - var p = ToFullPath()._value; - SysDirectory.Delete(p, recursive); - } - - /// 返回附加指定扩展名的实例。如当前路径已包含指定的扩展名,则返回当前路径,否则返回附加扩展名的实例。 - /// 需要附加的文件扩展名。 - /// 附加指定扩展名的实例。 - public FilePath EnsureExtension(string extension) { - return HasExtension(extension) ? this : new FilePath(_value + extension); - } - - /// 创建以应用程序所在目录为基准的路径。 - /// 相对路径。 - /// 返回以应用程序所在目录为基准的路径。 - public static FilePath FromRoot(string path) { - return AppRoot.Combine(path); - } - - /// 返回与文件关联的版本说明信息。 - /// 文件 对应的 - public string GetDescription() { - return FileVersionInfo.GetVersionInfo(ToFullPath()).FileDescription; - } - - /// 获取当前 下符合匹配模式的文件。在执行匹配前,先将当前实例转换为完整路径。当前用户无权访问的目录将被忽略。 - /// 匹配文件用的模式。模式中的“\”用于分隔目录,“**”表示当前目录及其包含的所有目录,“*”匹配 0 到多个字符,“?”匹配 1 个字符。模式为空时,返回所有文件。 - /// 返回匹配模式的所有文件。 - public FilePath[] GetFiles(string pattern) { - return GetFiles(pattern, null); - } - - /// 获取当前 下符合匹配模式的目录。在执行匹配前,先将当前实例转换为完整路径。当前用户无权访问的目录将被忽略。 - /// 匹配目录用的模式。模式中的“\”用于分隔目录,“**”表示当前目录及其包含的所有目录,“*”匹配 0 到多个字符,“?”匹配 1 个字符。模式为空时,返回所有一级子目录。 - /// 返回匹配模式的所有目录。 - public FilePath[] GetDirectories(string pattern) { - return GetDirectories(pattern, null); - } - - /// 获取当前 下符合匹配模式和筛选条件的文件。在执行匹配前,先将当前实例转换为完整路径。当前用户无权访问的目录将被忽略。 - /// 匹配文件用的模式。模式中的“\”用于分隔目录,“**”表示当前目录及其包含的所有目录,“*”匹配 0 到多个字符,“?”匹配 1 个字符。 - /// 用于筛选文件名的委托。 - /// 返回匹配模式的所有文件。 - public FilePath[] GetFiles(string pattern, Predicate filter) { - var f = ToFullPath(); - if (String.IsNullOrEmpty(pattern)) { - return SysDirectory.Exists(f._value) - ? GetFiles(f._value, Wildcard, filter) - : new FilePath[0]; - } - - string fp; - bool rp = pattern == RecursiveWildcard; - var p = new FilePath(pattern).GetParts(false); - var pl = p.Length; - var t = GetDirectories(f._value, p, rp ? 1 : pl - 1); - if (rp) { - fp = Wildcard; - } - else { - if (t.Count == 0) { - return new FilePath[0]; - } - fp = p[pl - 1]; - } - var r = new List(); - foreach (var item in t) { - try { - r.AddRange(GetFiles(item, fp, filter)); - } - catch (UnauthorizedAccessException) { - // continue; - } - } - return r.ToArray(); - } - - static FilePath[] GetFiles(string directory, string filePattern, Predicate filter) { - return SysDirectory.Exists(directory) ? Array.ConvertAll( - filter != null ? Array.FindAll(SysDirectory.GetFiles(directory, filePattern), filter) : SysDirectory.GetFiles(directory, filePattern) - , i => (FilePath)i) - : new FilePath[0]; - } - - /// 获取当前 下符合匹配模式和筛选条件的目录。在执行匹配前,先将当前实例转换为完整路径。当前用户无权访问的目录将被忽略。 - /// 匹配目录用的模式。模式中的“\”用于分隔目录,“**”表示当前目录及其包含的所有目录,“*”匹配 0 到多个字符,“?”匹配 1 个字符。 - /// 用于筛选目录名的委托。 - /// 返回匹配模式的所有目录。 - public FilePath[] GetDirectories(string pattern, Predicate filter) { - var f = ToFullPath(); - if (String.IsNullOrEmpty(pattern)) { - return SysDirectory.Exists(f._value) - ? GetDirectories(f._value, Wildcard, filter) - : new FilePath[0]; - } - - string fp; - bool rp = pattern == RecursiveWildcard; - var p = new FilePath(pattern).GetParts(false); - var pl = p.Length; - var t = GetDirectories(f._value, p, rp ? 1 : pl - 1); - if (rp) { - fp = Wildcard; - } - else { - if (t.Count == 0) { - return new FilePath[0]; - } - fp = p[p.Length - 1]; - } - var r = new List(); - foreach (var item in t) { - try { - r.AddRange(GetDirectories(item, fp, filter)); - } - catch (UnauthorizedAccessException) { - // continue; - } - } - return r.ToArray(); - } - - static FilePath[] GetDirectories(string directory, string filePattern, Predicate filter) { - return SysDirectory.Exists(directory) - ? Array.ConvertAll(filter != null ? Array.FindAll(SysDirectory.GetDirectories(directory, filePattern), filter) : SysDirectory.GetDirectories(directory, filePattern), i => (FilePath)i) - : new FilePath[0]; - } - - static NameList GetDirectories(string path, string[] parts, int partCount) { - NameList r; - var t = new NameList(1) { path }; - for (int i = 0; i < partCount; i++) { - r = new NameList(10); - var pi = parts[i]; - if (pi.Length == 0) { - t = new NameList(1) { Path.GetPathRoot(path) }; - continue; - } - else if (pi == "..") { - foreach (var item in t) { - var n = IsDirectorySeparator(item[item.Length - 1]) - ? Path.GetDirectoryName(item.Substring(0, item.Length - 1)) - : Path.GetDirectoryName(item); - if (n != null && r.Contains(n) == false) { - r.Add(n); - } - } - } - else if (pi == RecursiveWildcard) { - foreach (var item in t) { - r.Add(item); - GetDirectoriesRecursively(item, ref r); - } - } - else { - foreach (var item in t) { - try { - r.AddRange(SysDirectory.GetDirectories(item, pi)); - } - catch (UnauthorizedAccessException) { - continue; - } - } - } - t = r; - } - return t; - } - - static void GetDirectoriesRecursively(string directoryPath, ref NameList results) { - try { - var r = SysDirectory.GetDirectories(directoryPath, "*"); - results.AddRange(r); - foreach (var item in r) { - GetDirectoriesRecursively(item, ref results); - } - } - catch (UnauthorizedAccessException) { - return; - } - } - - /// 将路径按目录拆分为多个部分,并删除其中的无效部分。 - /// 目录的各个部分。 - public string[] GetParts() { - return GetParts(true); - } - - /// 将路径按目录拆分为多个部分。 - /// 是否删除无效的部分。 - /// 目录的各个部分。 - public string[] GetParts(bool removeInvalidParts) { - if (IsEmpty) { - return new string[0]; - } - var p = _value.Split(__PathSeparators); - string s; - var r = false; - var v = 0; - for (int i = 0; i < p.Length; i++) { - s = p[i].Trim(); - if (s.Length == 0) { - // 保留第一个根目录引用 - if (i == 0) { - r = true; - ++v; - } - else if (i == 1 && r) { - ++v; - } - continue; - } - if (s.Length == 1 && s[0] == '.') { - continue; - } - if (s == ".." || (s.StartsWith("..", StringComparison.Ordinal) && s.TrimEnd('.').Length == 0)) { - // 前一级为根目录 - if (r && v == 1) { - // 删除根目录级的目录部分 - if (p[0].Length > 2) { - p[0] = p[0].Substring(0, 2); - } - continue; - } - // 保留0级或上一级为“..”的目录符 - if (v == 0 || p[v - 1] == "..") { - s = ".."; - p[v] = s; - ++v; - continue; - } - // 删除前一级 - --v; - continue; - } - s = s.TrimEnd('.'); - if (removeInvalidParts) { - if (i == 0) { - if (s.Length > 1) { - // 根目录 - if (s[1] == Path.VolumeSeparatorChar) { - if (Array.IndexOf(InvalidFileNameChars, s[0]) != -1 - || s.IndexOfAny(InvalidFileNameChars, 2) != -1) { - continue; - } - r = true; - } - else if (s.IndexOfAny(InvalidFileNameChars) != -1) { - continue; - } - } - } - else if (s.IndexOfAny(InvalidFileNameChars) != -1) { - continue; - } - } - p[v] = s; - ++v; - } - if (v < 1) { - return new string[0]; - } - if (v < p.Length) { - Array.Resize(ref p, v); - } - return p; - } - - /// - /// - /// 以当前路径的绝对路径为基准,返回 相对于当前路径的相对路径。 如果 - /// 与当前路径盘符不一致,返回 。 在计算相对路径前,将把当前路径和 使用 方法转换为绝对路径。 - /// - /// 如当前路径为目录,但不以 结束,应先调用 方法将目录结束符附加到路径末尾。 - /// - /// 要计算相对路径的路径。 - /// 对于当前路径的相对路径。 - public FilePath GetRelativePath(FilePath path) { - var p1 = ToFullPath()._value; - var p2 = path.ToFullPath()._value; - var p = -1; - var i = 0; - var l1 = p1.Length; - var l2 = p2.Length; - while (i < l1 && i < l2) { - var c1 = p1[i]; - var c2 = p2[i]; - if (c1 != c2 && Char.ToLowerInvariant(c1) != char.ToLowerInvariant(c2)) { - break; - } - if (c1 == Path.DirectorySeparatorChar) { - p = i; - } - i++; - } - if (i == 0) { - return p2; - } - if (i == l1 && i == l2) { - return string.Empty; - } - var sb = new StringBuilder(32); - while (i < l1) { - if (p1[i] == Path.DirectorySeparatorChar) { - sb.Append("..").Append(Path.DirectorySeparatorChar); - } - i++; - } - if (sb.Length == 0 && l2 - 1 == p) { - return __CurrentPath; - } - sb.Append(p2, p + 1, l2 - p - 1); - return sb.ToString(); - } - - - /// 检查当前路径是否以指定的扩展名结束(不区分大小写)。 - /// 文件扩展名。 - public bool HasExtension(string extension) { - return String.IsNullOrEmpty(extension) - || (IsEmpty == false && _value.EndsWith(extension, StringComparison.OrdinalIgnoreCase) - && (extension[0] == '.' || _value.Length > extension.Length && _value[_value.Length - extension.Length - 1] == '.') - ); - } - - /// 返回文件名是否以指定的任意一个扩展名结尾(不区分大小写)。 - /// 扩展名列表。 - public bool HasExtension(params string[] extensions) { - var ext = FileExtension; - if (extensions == null || extensions.Length == 0) { - return true; - } - if (ext.Length == 0) { - return false; - } - foreach (var item in extensions) { - if (string.IsNullOrEmpty(item)) { - continue; - } - if (ext.EndsWith(item, StringComparison.OrdinalIgnoreCase) - && (item[0] == '.' || ext.Length > item.Length && ext[ext.Length - item.Length - 1] == '.')) { - return true; - } - } - return false; - } - - /// 检查当前路径是否属于指定的路径(子目录或其下文件)。 - /// 上级目录。 - /// 是否将当前目录以 开头的情况视为相对路径。 - public bool IsInDirectory(FilePath containingPath, bool rootAsRelative) { - var p = containingPath.ToFullPath()._value; - var v = ToFullPath()._value; - return v.StartsWith(p, StringComparison.OrdinalIgnoreCase) - && (IsDirectorySeparator(p[p.Length - 1]) || v.Length > p.Length && IsDirectorySeparator(v[p.Length]) && new FilePath(v.Substring(p.Length)).IsSubPath(rootAsRelative)); - } - - /// 返回指定的字符是否 - /// 要检查的字符。 - static bool IsDirectorySeparator(char ch) { - return ch == Path.DirectorySeparatorChar || ch == Path.AltDirectorySeparatorChar; - } - - /// 返回当前路径是否为子路径(不会指向当前目录的上级目录)。 - /// 是否将目录以 开头的情况视为子路径。 - public bool IsSubPath(bool rootAsRelative) { - if (String.IsNullOrEmpty(_value)) { - return true; - } - int i, n; - if (IsDirectorySeparator(_value[i = 0])) { - // rooted - if (rootAsRelative) { - if (_value.Length == 1) { - return true; - } - i = 1; - } - else { - return false; - } - } - - if (_value.Length >= 2 && (_value[1] == Path.VolumeSeparatorChar || _value == ".." || _value.Contains("..."))) { - // rooted, or starts with "..", or contains "..." - return false; - } - int d = 0; - while ((n = _value.IndexOfAny(__PathSeparators, i)) >= 0) { - var p = _value.Substring(i, n - i).Trim(); - if (p.Length == 0 // treat double separators as rooted - || p == ".." && --d < 0) { // ".." points to parent folder - return false; - } - else if (p.Length != 1 || p[0] != '.') { // ignore "." - ++d; - } - i = n + 1; - } - return n != -1 - || _value.Substring(i).TrimStart() != ".." - || --d >= 0; // not end with ".." - } - - static readonly string __DirectorySeparator = Path.DirectorySeparatorChar.ToString(); - - /// 将文件路径转换为绝对定位路径,并删除目录名称中的空白。同时将 转换为 - /// 标准的绝对定位路径。 - public FilePath Normalize() { - if (_value.IsNullOrWhiteSpace()) { - return AppRoot; - } - if (_value.Length == 3 && _value[1] == Path.VolumeSeparatorChar && IsDirectorySeparator(_value[2])) { - return this; - } - var p = GetParts(); - // fixes "?:\" (where ? is active directory drive letter) becomes active directory - if (EndsWithPathSeparator && p.Length > 0) { - p[p.Length - 1] += Path.DirectorySeparatorChar; - } - return p.Length == 1 && p[0].Length == 3 && p[0][1] == Path.VolumeSeparatorChar - ? new FilePath(p[0] + Path.DirectorySeparatorChar) - : new FilePath(Path.GetFullPath(AppRoot.Combine(string.Join(__DirectorySeparator, p))._value)); - } - - /// 只读打开文件路径对应的文件,允许读写共享。 - public Stream OpenFileReader() { - return new FileStream(ToFullPath()._value, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); - } - /// 打开文件路径对应的文件以准备读写,允许读取共享。 - /// 指定如文件存在时是否创建新的文件(源文件将被 0 长度的文件覆盖)。 - public Stream OpenFileWriter(bool overwrite) { - return new FileStream(ToFullPath()._value, overwrite ? FileMode.Create : FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read); - } - - /// 返回读写文件的 - /// - public Stream OpenFile(FileMode mode, FileAccess access, FileShare share) { - return new FileStream(ToFullPath()._value, mode, access, share); - } - - /// 返回读写文件的 - /// 指定文件访问方式。 - /// 指定文件读写方式。 - /// 指定文件访问共享方式。 - /// 读写缓冲区的尺寸。 - public Stream OpenFile(FileMode mode, FileAccess access, FileShare share, int bufferSize) { - return new FileStream(ToFullPath()._value, mode, access, share, bufferSize); - } - - /// 创建以指定编码读取文件的 实例。 - /// 用于读取文件的编码。编码为 null 时采用 UTF-8 编码。 - /// 读取文件的 实例。 - public StreamReader OpenTextReader(Encoding encoding) { - return new StreamReader(ToFullPath()._value, encoding ?? Encoding.UTF8, true); - } - - /// 创建以指定编码写入文件的 实例。 - /// 是否追加到文件结尾。 - /// 用于写入文件的编码。编码为 null 时采用 UTF-8 编码。 - /// 写入文件的 实例。 - public StreamWriter OpenTextWriter(bool append, Encoding encoding) { - var fp = ToFullPath(); - fp.CreateContainingDirectory(); - return new StreamWriter(fp._value, append, encoding ?? Encoding.UTF8); - } - - /// 打开当前路径对应的文件并读取所有内容为字节数组。如文件不存在,返回 0 长度的字节数组。此方法使用 FileStream 读取文件,打开或读取文件过程中可能返回异常。 - /// 文件的字节数组。 - public byte[] ReadAllBytes() { return ReadAllBytes(-1); } - /// 打开当前路径对应的文件并读取所有内容为字节数组。如文件不存在,返回 0 长度的字节数组。此方法使用 FileStream 读取文件,打开或读取文件过程中可能返回异常。 - /// 允许读取的最大字节数。如此值非正整数,则按读取文件的大小读取最多 个字节。 - /// 文件的字节数组。 - public byte[] ReadAllBytes(int maxBytes) { - if (ExistsFile == false) { - return new byte[0]; - } - using (var s = new FileStream(ToFullPath()._value, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { - if (s.CanRead == false) { - return new byte[0]; - } - var l = s.Length; - var r = new byte[maxBytes < 1 || maxBytes > l ? l : maxBytes]; - s.Read(r, 0, r.Length); - return r; - } - } - - /// 打开当前路径对应的文件,并以指定编码逐行读取所有行。如文件不存在,返回 - /// 用于读取文件的编码。编码为 时采用 UTF-8 编码。 - /// 包含整个文本文件的字符串。 - /// 指定的路径、文件名或者两者都超出了系统定义的最大长度。例如,在基于 Windows 的平台上,路径必须小于 248 个字符,文件名必须小于 260 个字符。 - /// 调用方没有所要求的权限。 - /// 调用方没有所要求的权限。 - public string ReadTextFile(Encoding encoding) { - return ExistsFile ? File.ReadAllText(ToFullPath()._value, encoding ?? Encoding.UTF8) : String.Empty; - } - - /// 打开当前路径对应的文件,并以指定编码逐行读取所有内容为字符串集合。如文件不存在,返回 0 长度的字符串数组。 - /// 用于读取文件的编码。编码为 时采用 UTF-8 编码。 - /// 文件中每行对应一个字符串所构成的集合。 - public IEnumerable ReadLines(Encoding encoding) { - return ExistsFile == false - ? new string[0] - : File.ReadLines(ToFullPath()._value, encoding ?? Encoding.UTF8); - } - - /// 写入文件。 - /// 是否追加到文件结尾。 - /// 需要写入的字节数组。此参数为空时,不写入文件内容。 - public void WriteAllBytes(bool append, byte[] bytes) { - if (bytes == null) { - return; - } - var fp = ToFullPath(); - fp.CreateContainingDirectory(); - using (var s = new FileStream(fp._value, append ? FileMode.Append : FileMode.Create, FileAccess.Write, FileShare.Read)) { - s.Write(bytes, 0, bytes.Length); - } - } - - /// 以指定编码写入文件。 - /// 是否追加到文件结尾。 - /// 用于写入文件的编码。编码为 时采用 UTF-8 编码。 - /// 需要写入的文本。此参数为空时,不写入文件内容。 - public void WriteAllText(bool append, Encoding encoding, string text) { - if (text == null) { - return; - } - using (var w = OpenTextWriter(append, encoding)) { - w.Write(text); - } - } - - /// 的每项内容后附加换行,以指定编码写入文件。 - /// 是否追加到文件结尾。 - /// 用于写入文件的编码。编码为 时采用 UTF-8 编码。 - /// 需要写入的文本。此参数为 时,不写入文件内容。此参数的项为 时,写入对应的空行。 - public void WriteAllLines(bool append, Encoding encoding, IEnumerable lines) { - if (lines == null) { - return; - } - using (var w = OpenTextWriter(append, encoding)) { - foreach (var item in lines) { - w.WriteLine(item); - } - } - } - - /// - public void WriteAllLines(bool append, Encoding encoding, params string[] lines) { - WriteAllLines(append, encoding, (IEnumerable)lines); - } - - /// 使用关联的程序打开当前路径对应的文件或目录,返回对应的进程。 - /// 要传递的额外参数。 - /// 实例。 - public Process StartProcess(string arguments) { - return Process.Start(_value, arguments); - } - - /// 使用关联的程序打开当前路径对应的文件或目录,返回对应的进程。 - /// 实例。 - public Process StartProcess() { - return Process.Start(_value); - } - - /// 将路径中的无效字符替换为 - /// 用于替换无效字符的字符。 - /// 替换了无效字符的路径。 - public FilePath SubstituteInvalidChars(char substitution) { - if (IsEmpty) { - return Empty; - } - var a = _value.ToCharArray(); - var r = false; - for (int i = 0; i < a.Length; i++) { - ref var c = ref a[i]; - if (Array.IndexOf(InvalidFileNameChars, c) != -1) { - c = substitution; - r = true; - } - } - if (r) { - return new FilePath(new string(a)); - } - return this; - } - - /// 将路径转换为绝对定位的路径。路径的基准位置为 。执行此方法前,必须确保路径中不包含无效字符,否则将抛出异常。 - /// 采用绝对定位路径的实例。 - /// 路径无效。 - public FilePath ToFullPath() { - return Path.GetFullPath(Path.Combine(AppRoot._value, _value)); - } - - /// - /// 实例转换为完全路径,再隐式转换为 实例。路径的基准位置为 - /// 事实上, 实例可隐式转换为 实例。 - /// - /// 将当前路径转换为完全路径后对应的 实例。 - [DebuggerStepThrough] - public FileInfo ToFileInfo() { - return this; - } - - /// 实例转换为完全路径,再获取其对应的 - /// 与完全路径对应的文件版本信息。 - /// 路径无效。 - /// 找不到对应的文件。 - [DebuggerStepThrough] - public FileVersionInfo ToFileVersionInfo() { - return FileVersionInfo.GetVersionInfo(ToFullPath()); - } - - /// - /// 将 实例转换为完全路径,再隐式转换为 实例。路径的基准位置为 。 - /// 事实上, 实例可隐式转换为 实例。 - /// - /// 将当前路径转换为完全路径后对应的 实例。 - [DebuggerStepThrough] - public DirectoryInfo ToDirectoryInfo() { - return this; - } - - /// - /// 将 实例转换为 实例。 - /// 事实上, 实例可隐式转换为 实例。 - /// - /// 与当前路径对应的 实例。 - [DebuggerStepThrough] - public Uri ToUri() { return this; } - - #region 类型映射 - - /// 将字符串隐式转换为 实例,删除传入字符串内所有的前导和尾随空白。 - /// 需要转换的路径字符串。 - /// 实例。 - [DebuggerStepThrough] - public static implicit operator FilePath(string path) { - return new FilePath(path); - } - - /// 实例隐式转换为字符串。 - /// 需要转换的路径。 - /// 以字符串形式表示的实例。 - [DebuggerStepThrough] - public static implicit operator string(FilePath path) { - return path._value; - } - - /// 显式转换为 实例。 - /// 需要转换的路径。 - [DebuggerStepThrough] - public static explicit operator FilePath(FileInfo file) { - return file == null ? Empty : new FilePath(file.FullName, false); - } - - /// - /// 将 实例转换为完全路径,再隐式转换为 实例。路径的基准位置为 。 - /// - /// 需要转换的路径。 - /// 将当前路径转换为完全路径后对应的 实例。 - /// - [DebuggerStepThrough] - public static implicit operator FileInfo(FilePath path) { - return new FileInfo(path.ToFullPath()._value); - } - - /// 显式转换为 实例。 - /// 需要转换的路径。 - [DebuggerStepThrough] - public static explicit operator FilePath(DirectoryInfo directory) { - return directory == null ? Empty : new FilePath(directory.FullName, false); - } - - /// - /// 将 实例转换为完全路径,再隐式转换为 实例。路径的基准位置为 。 - /// - /// 需要转换的路径。 - /// 将当前路径转换为完全路径后对应的 实例。 - /// - [DebuggerStepThrough] - public static implicit operator DirectoryInfo(FilePath path) { - return new DirectoryInfo(path.ToFullPath()._value); - } - - /// 实例隐式转换为 实例。 - /// 需要转换的路径。 - [DebuggerStepThrough] - public static implicit operator Uri(FilePath path) { - return new Uri(path._value); - } - #endregion - - #region IEquatable 实现 - - /// 比较两个文件路径是否相同。 - /// 需要比较的第一个路径。 - /// 需要比较的第二个路径。 - /// 相同时,返回 true。 - [DebuggerStepThrough] - public static bool operator ==(FilePath path1, FilePath path2) { - return path1.Equals(path2); - } - - /// 比较两个文件路径是否不相同。 - /// 需要比较的第一个路径。 - /// 需要比较的第二个路径。 - /// 不相同时,返回 true。 - [DebuggerStepThrough] - public static bool operator !=(FilePath path1, FilePath path2) { - return !path1.Equals(path2); - } - - /// 指示当前文件路径是否等于同一类型的另一个文件路径。 - /// 与此对象进行比较的对象。 - /// 如果当前对象等于 参数,则为 ;否则为 - public bool Equals(FilePath other) { - return __PathComparer(_value, other._value) - || __PathComparer( - Path.Combine(AppRoot._value, _value ?? string.Empty), - Path.Combine(AppRoot._value, other._value ?? string.Empty)); - } - - /// 确定当前文件路径是否与另一个实例相等。 - /// 需要与当前实例比较的对象。 - /// 在两个文件路径相等时,返回 true。 - [DebuggerStepThrough] - public override bool Equals(object obj) { - return obj is FilePath && Equals((FilePath)obj); - } - - /// 返回路径字符串的散列值。 - /// 路径字符串的散列值。 - [DebuggerStepThrough] - public override int GetHashCode() { - return _value == null ? 0 : _value.GetHashCode(); - } - #endregion - - /// 返回表示当前文件路径的 实例。 - /// 表示当前文件路径的 实例。 - [DebuggerStepThrough] - public override string ToString() { - return _value ?? string.Empty; - } - } -} \ No newline at end of file diff --git a/pdfpatcher/App/Common/FontHelper.cs b/pdfpatcher/App/Common/FontHelper.cs deleted file mode 100644 index be488eab3404db503f1cc11bf2268354054e4140..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Common/FontHelper.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Collections.Generic; -using iTextSharp.text.pdf; -using CharSet = System.Runtime.InteropServices.CharSet; -using DllImport = System.Runtime.InteropServices.DllImportAttribute; -using Microsoft.Win32; - -namespace PDFPatcher.Common -{ - static class FontHelper - { - public static string FontDirectory { get; } = System.IO.Path.GetFullPath(Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\..\\fonts\\"); - - /// - /// 列出已安装的字体及其路径。 - /// - /// 是否包含字体组名称 - public static Dictionary GetInstalledFonts(bool includeFamilyName) { - var d = new Dictionary(50); - using (var k = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts")) { - GetFontsFromRegistryKey(includeFamilyName, d, k); - } - using (var k = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts")) { - GetFontsFromRegistryKey(includeFamilyName, d, k); - } - return d; - } - - static void GetFontsFromRegistryKey(bool includeFamilyName, Dictionary d, RegistryKey k) { - foreach (var name in k.GetValueNames()) { - var p = k.GetValue(name) as string; - if (String.IsNullOrEmpty(p)) { - continue; - } - if (p.IndexOf('\\') == -1) { - p = FontDirectory + p; - } - var fp = new FilePath(p); - try { - if (fp.HasExtension(Constants.FileExtensions.Ttf) - || fp.HasExtension(Constants.FileExtensions.Otf)) { - AddFontNames(d, p, includeFamilyName); - } - else if (fp.HasExtension(Constants.FileExtensions.Ttc)) { - var nl = BaseFont.EnumerateTTCNames(p).Length; - //Tracker.DebugMessage (p); - for (int i = 0; i < nl; i++) { - AddFontNames(d, p + "," + i.ToText(), includeFamilyName); - } - } - } - catch (System.IO.IOException) { - // ignore - } - catch (NullReferenceException) { - } - catch (iTextSharp.text.DocumentException) { - // ignore - } - } - } - - static void AddFontNames(Dictionary fontNames, string fontPath, bool includeFamilyName) { - var nl = BaseFont.GetAllFontNames(fontPath, "Cp936", null); - //Tracker.DebugMessage (fontPath); - if (includeFamilyName) { - fontNames[nl[0] as string] = fontPath; - } - var ffn = nl[2] as string[][]; - string n = null; - string nn = null, cn = null; - foreach (var fn in ffn) { - var enc = fn[2]; - n = fn[3]; - if ("2052" == enc) { - cn = n; - break; - } - if ("1033" == enc) { - nn = n; - } - else if ("0" == enc && nn == null) { - nn = n; - } - } - if (n != null) { - //Tracker.DebugMessage (cn ?? nn ?? n); - fontNames[cn ?? nn ?? n] = fontPath; - } - //foreach (string[] item in nl[1] as string[][]) { - // fontNames[item] = fontPath; - // Tracker.DebugMessage (item); - //} - } - - static class NativeMethods - { - [DllImport("Gdi32.dll", CharSet = CharSet.Unicode)] - private static extern int AddFontResourceEx(string fontPath, int flag, IntPtr preserved); - [DllImport("Gdi32.dll", CharSet = CharSet.Unicode)] - private static extern int RemoveFontResourceEx(string fontPath, int flag, IntPtr preserved); - - internal static int LoadFont(string path) { - return AddFontResourceEx(path, 0x10, IntPtr.Zero); - } - internal static int RemoveFont(string path) { - return RemoveFontResourceEx(path, 0x10, IntPtr.Zero); - } - } - } -} - - diff --git a/pdfpatcher/App/Common/FontUtility.cs b/pdfpatcher/App/Common/FontUtility.cs deleted file mode 100644 index 64d7266fe38f91d45293d672dddb6d1767a410bc..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Common/FontUtility.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace PDFPatcher.Common -{ - static class FontUtility - { - static readonly Regex _italic = new Regex(" (?:Italic|Oblique)$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - static readonly Regex _bold = new Regex(" Bold$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - static readonly Regex _boldItalic = new Regex(" Bold (?:Italic|Oblique)$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - static FriendlyFontName[] _Fonts; - - public static FriendlyFontName[] InstalledFonts { - get { - if (_Fonts == null) { - ListInstalledFonts(); - } - return _Fonts; - } - } - - private static void ListInstalledFonts() { - var uf = new List(); // 可能包含中文的字体 - var of = new List(); // 其他字体 - var fs = FontHelper.GetInstalledFonts(false); - string dn /*显示名称*/, fn /*字体名称*/; - foreach (var item in fs.Keys) { - fn = item; - dn = _boldItalic.Replace(fn, "(粗斜体)"); - dn = _italic.Replace(dn, "(斜体)"); - dn = _bold.Replace(dn, "(粗体)"); - if (dn[0] > 0xFF) { - uf.Add(new FriendlyFontName(fn, dn)); - } - else { - of.Add(new FriendlyFontName(fn, dn)); - } - } - uf.Sort(); - of.Sort(); - _Fonts = new FriendlyFontName[uf.Count + of.Count]; - uf.CopyTo(_Fonts); - of.CopyTo(_Fonts, uf.Count); - } - - internal struct FriendlyFontName : IComparable - { - public string OriginalName; - public string DisplayName; - public FriendlyFontName(string originalName, string displayName) { - OriginalName = originalName; - DisplayName = displayName != originalName ? displayName : null; - } - public override string ToString() { - return DisplayName ?? OriginalName; - } - - #region IComparable 成员 - - int IComparable.CompareTo(FriendlyFontName other) { - return OriginalName.CompareTo(other.OriginalName); - } - - #endregion - } - - } -} diff --git a/pdfpatcher/App/Common/FormHelper.cs b/pdfpatcher/App/Common/FormHelper.cs deleted file mode 100644 index 760d3fba8e1da6db7acad652745c389bfae82a6c..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Common/FormHelper.cs +++ /dev/null @@ -1,395 +0,0 @@ -using System; -using System.Drawing; -using System.Runtime.InteropServices; -using System.Windows.Forms; - -namespace PDFPatcher.Common -{ - static class FormHelper - { - public const int ProcMsg = NativeMethods.WM_COPYDATA; - - public static bool IsCtrlKeyDown => (Control.ModifierKeys & Keys.Control) != 0; - - public static bool IsShiftKeyDown => (Control.ModifierKeys & Keys.Shift) != 0; - - public static bool IsAltKeyDown => (Control.ModifierKeys & Keys.Alt) != 0; - - public static bool IsEmptyOrTransparent(this Color color) { - return color.IsEmpty || color.A == 0; - } - public static Point Round(this PointF point) { - return new Point(point.X.ToInt32(), point.Y.ToInt32()); - } - public static RectangleF Union(this RectangleF rectangle, RectangleF other) { - return RectangleF.FromLTRB( - rectangle.Left < other.Left ? rectangle.Left : other.Left, - rectangle.Top < other.Top ? rectangle.Top : other.Top, - rectangle.Right > other.Right ? rectangle.Right : other.Right, - rectangle.Bottom > other.Bottom ? rectangle.Bottom : other.Bottom - ); - } - public static Point Transpose(this Point point, int x, int y) { - return new Point(point.X + x, point.Y + y); - } - public static Point Transpose(this Point point, Point transpose) { - return new Point(point.X + transpose.X, point.Y + transpose.Y); - } - public static Size Scale(this Size size, float scale) { - return new Size((int)(size.Width * scale), (int)(size.Height * scale)); - } - public static void OnFirstLoad(this Form form, Action handler) { - new FormEventHandler(form, handler); - } - public static void SetIcon(this Form form, Bitmap bitmap) { - form.Icon = Icon.FromHandle(bitmap.GetHicon()); - } - public static void OnFirstLoad(this UserControl control, Action handler) { - new UserControlLoadHandler(control, handler); - } - public static ProgressBar SetValue(this ProgressBar control, int value) { - control.Value = value < control.Minimum ? control.Minimum - : value > control.Maximum ? control.Maximum - : value; - return control; - } - public static NumericUpDown SetValue(this NumericUpDown box, int value) { - return box.SetValue((decimal)value); - } - public static NumericUpDown SetValue(this NumericUpDown box, float value) { - return box.SetValue((decimal)value); - } - public static NumericUpDown SetValue(this NumericUpDown box, double value) { - return box.SetValue((decimal)value); - } - public static NumericUpDown SetValue(this NumericUpDown box, decimal value) { - box.Value = - value >= box.Minimum && value <= box.Maximum ? value - : value > box.Maximum ? box.Maximum - : box.Minimum; - return box; - } - public static ListBox Select(this ListBox control, string item) { - if (control.Items.Count == 0) { - return control; - } - var i = control.FindString(item); - if (i != -1) { - control.SelectedIndex = i; - } - return control; - } - public static ComboBox Select(this ComboBox control, string item) { - if (control.Items.Count == 0) { - return control; - } - var i = control.FindString(item); - if (i != -1) { - control.SelectedIndex = i; - } - return control; - } - public static ListBox Select(this ListBox control, int index) { - var items = control.Items; - if (items.Count == 0) { - return control; - } - control.SelectedIndex = index < 0 ? 0 - : index > items.Count - 1 ? items.Count - 1 - : index; - return control; - } - public static ComboBox Select(this ComboBox control, int index) { - var items = control.Items; - if (items.Count == 0) { - return control; - } - control.SelectedIndex = index < 0 ? 0 - : index > items.Count - 1 ? items.Count - 1 - : index; - return control; - } - public static ComboBox AddRange(this ComboBox view, params object[] values) { - view.Items.AddRange(values); - return view; - } - public static TTextBox AppendLine(this TTextBox box) where TTextBox : TextBoxBase { - box.AppendText(Environment.NewLine); - return box; - } - public static TTextBox AppendLine(this TTextBox box, string text) where TTextBox : TextBoxBase { - box.AppendText(text + Environment.NewLine); - return box; - } - public static void SetLocation(this FileDialog dialog, string path) { - if (FileHelper.IsPathValid(path) == false) { - return; - } - dialog.InitialDirectory = System.IO.Path.GetDirectoryName(path); - dialog.FileName = System.IO.Path.GetFileName(path); - } - public static ToolStrip ToggleEnabled(this ToolStrip toolStrip, bool enabled, params string[] names) { - foreach (ToolStripItem item in toolStrip.Items) { - if (Array.IndexOf(names, item.Name) != -1) { - item.Enabled = enabled; - } - } - return toolStrip; - } - - public static float GetDpiScale(this Control control) { - using (var g = control.CreateGraphics()) { - return g.DpiX / 96; - } - } - - public static void ScaleColumnWidths(this ListView listView, float scale) { - foreach (ColumnHeader column in listView.Columns) { - column.Width = (int)(column.Width * scale); - } - } - public static void ScaleColumnWidths(this ListView listView) { - float scale = GetDpiScale(listView); - foreach (ColumnHeader column in listView.Columns) { - column.Width = (int)(column.Width * scale); - } - } - - public static ToolStrip ScaleIcons(this ToolStrip toolStrip, int size) { - size = (int)(toolStrip.GetDpiScale() * size); - return toolStrip.ScaleIcons(new Size(size, size)); - } - public static ToolStrip ScaleIcons(this ToolStrip toolStrip, Size size) { - toolStrip.SuspendLayout(); - toolStrip.AutoSize = false; - toolStrip.ImageScalingSize = size; - toolStrip.ResumeLayout(); - toolStrip.AutoSize = true; - return toolStrip; - } - - internal static void InsertLinkedText(this RichTextBoxLinks.RichTextBoxEx textBox, string text) { - const int TokenLength = 2; - int p1 = text.IndexOf("<<"); - int p2 = text.IndexOf(">>"); - if (p1 != -1 && p2 != -1 && p2 > p1) { - textBox.AppendText(text.Substring(0, p1)); - var c = textBox.SelectionColor; - var f = textBox.SelectionFont; - textBox.InsertLink(text.Substring(p1 + TokenLength, p2 - p1 - TokenLength)); - if (p2 < text.Length - TokenLength) { - textBox.SelectionColor = c; - textBox.SelectionFont = f; - textBox.AppendText(text.Substring(p2 + TokenLength)); - } - } - else { - textBox.AppendText(text); - } - } - - public static void FeedbackDragFileOver(this DragEventArgs args, params string[] allowedFileExtension) { - if (args.Data.GetDataPresent(DataFormats.FileDrop)) { - var files = args.Data.GetData(DataFormats.FileDrop) as string[]; - if (Array.Exists(files, - f => { - return Array.Exists(allowedFileExtension, - ext => f.EndsWith(ext, StringComparison.InvariantCultureIgnoreCase)); - })) { - args.Effect = DragDropEffects.Copy; - } - } - } - public static string[] DropFileOver(this DragEventArgs args, params string[] allowedFileExtension) { - if (args.Data.GetDataPresent(DataFormats.FileDrop)) { - var files = (string[])args.Data.GetData(DataFormats.FileDrop); - return Array.FindAll(files, f => { - return Array.Exists(allowedFileExtension, - ext => f.EndsWith(ext, StringComparison.InvariantCultureIgnoreCase)); - }); - } - return new string[0]; - } - public static bool DropFileOver(this Control control, DragEventArgs args, params string[] allowedFileExtension) { - var files = DropFileOver(args, allowedFileExtension); - if (files.Length > 0) { - control.Text = files[0]; - return true; - } - return false; - } - - public static void HidePopupMenu(this ToolStripItem item) { - if (item is ToolStripDropDownItem mi && mi.HasDropDownItems) { - return; - } - var oo = item.Owner as ToolStripDropDownMenu; - oo?.Hide(); - var oi = item.OwnerItem as ToolStripDropDownItem; - while (oi != null) { - oi.DropDown.Close(); - oo = oi.Owner as ToolStripDropDownMenu; - oo?.Hide(); - oi = oi.OwnerItem as ToolStripDropDownItem; - } - } - public static void ClearDropDownItems(this ToolStripItemCollection items, int keepItems = 0) { - if (items.Count == 0) { - return; - } - keepItems--; - for (var i = items.Count - 1; i > keepItems; i--) { - items[i].Dispose(); - } - } - public static void ToggleVisibility(bool visible, params Control[] controls) { - foreach (var item in controls) { - item.Visible = visible; - } - } - public static DialogResult ShowDialog() where TForm : Form, new() { - using (var f = new TForm()) { - return f.ShowDialog(); - } - } - public static DialogResult ShowDialog(this IWin32Window form) where TForm : Form, new() { - using (var f = new TForm()) { - return f.ShowDialog(form); - } - } - public static DialogResult ShowDialog(this IWin32Window form, object formParameter) - where TForm : Form, new() { - using (var f = new TForm()) { - f.Tag = formParameter; - return f.ShowDialog(form); - } - } - public static DialogResult ShowDialog(this IWin32Window form, Action formConfigurator, Action formConfirmationHandler) where TForm : Form, new() { - using (var f = new TForm()) { - formConfigurator?.Invoke(f); - var r = f.ShowDialog(form); - if (formConfirmationHandler != null && (r == DialogResult.OK || r == DialogResult.Yes)) { - formConfirmationHandler(f); - } - return r; - } - } - public static DialogResult ShowCommonDialog(this IWin32Window form, Action formConfigurator, Action formConfirmationHandler) where TDialog : CommonDialog, new() { - using (var f = new TDialog()) { - formConfigurator?.Invoke(f); - var r = f.ShowDialog(form); - if (formConfirmationHandler != null && (r == DialogResult.OK || r == DialogResult.Yes)) { - formConfirmationHandler(f); - } - return r; - } - } - - internal static void ErrorBox(string text) { - MessageBox.Show(text, Constants.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error); - } - public static void ErrorBox(this Control control, string text) { - MessageBox.Show(text, control.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); - } - public static void ErrorBox(this Control control, string title, Exception exception) { - var s = new System.Text.StringBuilder(title); - s.AppendLine(); - s.AppendLine(exception.Message); - while ((exception = exception.InnerException) != null) { - s.AppendLine(); - s.Append(exception.Message); - } - MessageBox.Show(s.ToString(), control.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); - } - internal static void InfoBox(string text) { - MessageBox.Show(text, Constants.AppName, MessageBoxButtons.OK, MessageBoxIcon.Information); - } - internal static DialogResult YesNoBox(string text) { - return MessageBox.Show(text, Constants.AppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question); - } - internal static DialogResult YesNoCancelBox(string text) { - return MessageBox.Show(text, Constants.AppName, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); - } - public static bool ConfirmOKBox(string text) { - return MessageBox.Show(text, Constants.AppName, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK; - } - public static bool ConfirmOKBox(this Control control, string text) { - return MessageBox.Show(text, control.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK; - } - public static bool ConfirmYesBox(this Control control, string text) { - return MessageBox.Show(text, control.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes; - } - public static int SendCopyDataMessage(this System.Diagnostics.Process process, string text) { - var s = new CopyDataStruct(text); - var r = NativeMethods.SendMessage(process.MainWindowHandle, ProcMsg, 0, ref s); - s.Dispose(); - return r; - } - public static string GetCopyDataContent(ref Message message) { - if (message.Msg == ProcMsg) { - return Marshal.PtrToStringUni(((CopyDataStruct)Marshal.PtrToStructure(message.LParam, typeof(CopyDataStruct))).lpData); - } - return null; - } - - sealed class FormEventHandler - { - readonly Form _Form; - readonly Action _Handler; - - public FormEventHandler(Form form, Action handler) { - _Form = form; - _Handler = handler; - form.Load += OnLoadHandler; - } - public void OnLoadHandler(object s, EventArgs args) { - _Form.Load -= OnLoadHandler; - _Handler(); - } - } - sealed class UserControlLoadHandler - { - readonly UserControl _Control; - readonly Action _Handler; - - public UserControlLoadHandler(UserControl control, Action handler) { - _Control = control; - _Handler = handler; - control.Load += OnLoadHandler; - } - public void OnLoadHandler(object s, EventArgs args) { - _Control.Load -= OnLoadHandler; - _Handler(); - } - } - - static class NativeMethods - { - const string User32DLL = "User32.dll"; - internal const int WM_COPYDATA = 0x004A; - - [DllImport(User32DLL, SetLastError = false, CharSet = CharSet.Unicode)] - public static extern int SendMessage(IntPtr hWnd, int uMsg, int wParam, ref CopyDataStruct lParam); - [DllImport("kernel32.dll", SetLastError = true)] - public static extern IntPtr LocalFree(IntPtr p); - } - - struct CopyDataStruct : IDisposable - { - readonly IntPtr dwData; - readonly int cbData; - internal IntPtr lpData; - - public CopyDataStruct(string text) { - cbData = (text.Length + 1) * 2; - dwData = (IntPtr)1; - lpData = Marshal.StringToBSTR(text); - } - - public void Dispose() { - NativeMethods.LocalFree(lpData); - lpData = IntPtr.Zero; - } - } - } -} diff --git a/pdfpatcher/App/Common/ImageBox/DragHandle.cs b/pdfpatcher/App/Common/ImageBox/DragHandle.cs deleted file mode 100644 index e2677ae0ad22c8f5d04fbc50cdd79f89ebcfaa44..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Common/ImageBox/DragHandle.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System.Drawing; - -namespace Cyotek.Windows.Forms.Demo -{ - // Cyotek ImageBox - // Copyright (c) 2010-2015 Cyotek Ltd. - // http://cyotek.com - // http://cyotek.com/blog/tag/imagebox - - // Licensed under the MIT License. See license.txt for the full text. - - // If you use this control in your applications, attribution, donations or contributions are welcome. - - internal sealed class DragHandle - { - #region Public Constructors - - public DragHandle(DragHandleAnchor anchor) - : this() { - Anchor = anchor; - } - - #endregion - - #region Protected Constructors - - private DragHandle() { - Enabled = true; - Visible = true; - } - - #endregion - - #region Public Properties - - public DragHandleAnchor Anchor { get; set; } - - public Rectangle Bounds { get; set; } - - public bool Enabled { get; set; } - - public bool Visible { get; set; } - - #endregion - } -} diff --git a/pdfpatcher/App/Common/ImageBox/DragHandleAnchor.cs b/pdfpatcher/App/Common/ImageBox/DragHandleAnchor.cs deleted file mode 100644 index 9a283b3d11b8bf8e2eb5ee61bd8b1d0860a6808d..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Common/ImageBox/DragHandleAnchor.cs +++ /dev/null @@ -1,32 +0,0 @@ -namespace Cyotek.Windows.Forms.Demo -{ - // Cyotek ImageBox - // Copyright (c) 2010-2015 Cyotek Ltd. - // http://cyotek.com - // http://cyotek.com/blog/tag/imagebox - - // Licensed under the MIT License. See license.txt for the full text. - - // If you use this control in your applications, attribution, donations or contributions are welcome. - - internal enum DragHandleAnchor - { - None, - - TopLeft, - - TopCenter, - - TopRight, - - MiddleLeft, - - MiddleRight, - - BottomLeft, - - BottomCenter, - - BottomRight - } -} diff --git a/pdfpatcher/App/Common/ImageBox/DragHandleCollection.cs b/pdfpatcher/App/Common/ImageBox/DragHandleCollection.cs deleted file mode 100644 index 9c7465c9ab64cb4f8484b9333dc2d0a6b4843235..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Common/ImageBox/DragHandleCollection.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.Drawing; - -namespace Cyotek.Windows.Forms.Demo -{ - // Cyotek ImageBox - // Copyright (c) 2010-2015 Cyotek Ltd. - // http://cyotek.com - // http://cyotek.com/blog/tag/imagebox - - // Licensed under the MIT License. See license.txt for the full text. - - // If you use this control in your applications, attribution, donations or contributions are welcome. - - internal sealed class DragHandleCollection : IEnumerable - { - #region Instance Fields - - private readonly IDictionary _items; - - #endregion - - #region Public Constructors - - public DragHandleCollection() { - _items = new Dictionary { - { DragHandleAnchor.TopLeft, new DragHandle(DragHandleAnchor.TopLeft) }, - { DragHandleAnchor.TopCenter, new DragHandle(DragHandleAnchor.TopCenter) }, - { DragHandleAnchor.TopRight, new DragHandle(DragHandleAnchor.TopRight) }, - { DragHandleAnchor.MiddleLeft, new DragHandle(DragHandleAnchor.MiddleLeft) }, - { DragHandleAnchor.MiddleRight, new DragHandle(DragHandleAnchor.MiddleRight) }, - { DragHandleAnchor.BottomLeft, new DragHandle(DragHandleAnchor.BottomLeft) }, - { DragHandleAnchor.BottomCenter, new DragHandle(DragHandleAnchor.BottomCenter) }, - { DragHandleAnchor.BottomRight, new DragHandle(DragHandleAnchor.BottomRight) } - }; - } - - #endregion - - #region Public Properties - - public int Count => _items.Count; - - public DragHandle this[DragHandleAnchor index] => _items[index]; - - #endregion - - #region Public Members - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// - /// A that can be used to iterate through the collection. - /// - public IEnumerator GetEnumerator() { - return _items.Values.GetEnumerator(); - } - - public DragHandleAnchor HitTest(Point point) { - DragHandleAnchor result; - - result = DragHandleAnchor.None; - - foreach (DragHandle handle in this) { - if (handle.Visible && handle.Bounds.Contains(point)) { - result = handle.Anchor; - break; - } - } - - return result; - } - - #endregion - - #region IEnumerable Members - - /// - /// Returns an enumerator that iterates through a collection. - /// - /// - /// An object that can be used to iterate through the collection. - /// - IEnumerator IEnumerable.GetEnumerator() { - return GetEnumerator(); - } - - #endregion - } -} diff --git a/pdfpatcher/App/Common/ImageBox/ImageBoxEx.cs b/pdfpatcher/App/Common/ImageBox/ImageBoxEx.cs deleted file mode 100644 index 1c63c6e1174c6c454692bbbeff26ead44865ebb9..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Common/ImageBox/ImageBoxEx.cs +++ /dev/null @@ -1,807 +0,0 @@ -using System; -using System.ComponentModel; -using System.Drawing; -using System.Windows.Forms; - -namespace Cyotek.Windows.Forms.Demo -{ - // Cyotek ImageBox - // Copyright (c) 2010-2015 Cyotek Ltd. - // http://cyotek.com - // http://cyotek.com/blog/tag/imagebox - - // Licensed under the MIT License. See license.txt for the full text. - - // If you use this control in your applications, attribution, donations or contributions are welcome. - - internal class ImageBoxEx : ImageBox - { - #region Constants - - private readonly DragHandleCollection _dragHandles; - - private static readonly object _eventDragHandleSizeChanged = new object(); - - private static readonly object _eventMaximumSelectionSizeChanged = new object(); - - private static readonly object _eventMinimumSelectionSizeChanged = new object(); - - private static readonly object _eventSelectionMoved = new object(); - - private static readonly object _eventSelectionMoving = new object(); - - private static readonly object _eventSelectionResized = new object(); - - private static readonly object _eventSelectionResizing = new object(); - - #endregion - - #region Fields - - private int _dragHandleSize; - - private Point _dragOrigin; - - private Point _dragOriginOffset; - - private bool _isMoving; - - private bool _isResizing; - - private Size _maximumSelectionSize; - - private Size _minimumSelectionSize; - - private RectangleF _previousSelectionRegion; - - private DragHandleAnchor _resizeAnchor; - - #endregion - - #region Constructors - - public ImageBoxEx() { - _dragHandles = new DragHandleCollection(); - _dragHandleSize = 8; - _maximumSelectionSize = Size.Empty; - PositionDragHandles(); - } - - #endregion - - #region Events - - /// - /// Occurs when the DragHandleSize property value changes - /// - [Category("Property Changed")] - public event EventHandler DragHandleSizeChanged { - add { Events.AddHandler(_eventDragHandleSizeChanged, value); } - remove { Events.RemoveHandler(_eventDragHandleSizeChanged, value); } - } - - /// - /// Occurs when the MaximumSelectionSize property value changes - /// - [Category("Property Changed")] - public event EventHandler MaximumSelectionSizeChanged { - add { Events.AddHandler(_eventMaximumSelectionSizeChanged, value); } - remove { Events.RemoveHandler(_eventMaximumSelectionSizeChanged, value); } - } - - /// - /// Occurs when the MinimumSelectionSize property value changes - /// - [Category("Property Changed")] - public event EventHandler MinimumSelectionSizeChanged { - add { Events.AddHandler(_eventMinimumSelectionSizeChanged, value); } - remove { Events.RemoveHandler(_eventMinimumSelectionSizeChanged, value); } - } - - [Category("Action")] - public event EventHandler SelectionMoved { - add { Events.AddHandler(_eventSelectionMoved, value); } - remove { Events.RemoveHandler(_eventSelectionMoved, value); } - } - - [Category("Action")] - public event CancelEventHandler SelectionMoving { - add { Events.AddHandler(_eventSelectionMoving, value); } - remove { Events.RemoveHandler(_eventSelectionMoving, value); } - } - - [Category("Action")] - public event EventHandler SelectionResized { - add { Events.AddHandler(_eventSelectionResized, value); } - remove { Events.RemoveHandler(_eventSelectionResized, value); } - } - - [Category("Action")] - public event CancelEventHandler SelectionResizing { - add { Events.AddHandler(_eventSelectionResizing, value); } - remove { Events.RemoveHandler(_eventSelectionResizing, value); } - } - - #endregion - - #region Properties - - [Browsable(false)] - public DragHandleCollection DragHandles => _dragHandles; - - [Category("Appearance")] - [DefaultValue(8)] - public virtual int DragHandleSize { - get => _dragHandleSize; - set { - if (_dragHandleSize != value) { - _dragHandleSize = value; - - OnDragHandleSizeChanged(EventArgs.Empty); - } - } - } - - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public bool IsMoving { - get => _isMoving; - protected set => _isMoving = value; - } - - [Browsable(false)] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public bool IsResizing { - get => _isResizing; - protected set => _isResizing = value; - } - - [Category("Behavior")] - [DefaultValue(typeof(Size), "0, 0")] - public virtual Size MaximumSelectionSize { - get => _maximumSelectionSize; - set { - if (MaximumSelectionSize != value) { - _maximumSelectionSize = value; - - OnMaximumSelectionSizeChanged(EventArgs.Empty); - } - } - } - - [Category("Behavior")] - [DefaultValue(typeof(Size), "0, 0")] - public virtual Size MinimumSelectionSize { - get => _minimumSelectionSize; - set { - if (MinimumSelectionSize != value) { - _minimumSelectionSize = value; - - OnMinimumSelectionSizeChanged(EventArgs.Empty); - } - } - } - - [Browsable(false)] - public RectangleF PreviousSelectionRegion { - get => _previousSelectionRegion; - protected set => _previousSelectionRegion = value; - } - - protected Point DragOrigin { - get => _dragOrigin; - set => _dragOrigin = value; - } - - protected Point DragOriginOffset { - get => _dragOriginOffset; - set => _dragOriginOffset = value; - } - - protected DragHandleAnchor ResizeAnchor { - get => _resizeAnchor; - set => _resizeAnchor = value; - } - - #endregion - - #region Methods - - public void CancelResize() { - SelectionRegion = _previousSelectionRegion; - CompleteResize(); - } - - public void StartMove() { - CancelEventArgs e; - - if (_isMoving || _isResizing) { - throw new InvalidOperationException("A move or resize action is currently being performed."); - } - - e = new CancelEventArgs(); - - OnSelectionMoving(e); - - if (!e.Cancel) { - _previousSelectionRegion = SelectionRegion; - _isMoving = true; - } - } - - protected virtual void DrawDragHandle(Graphics graphics, DragHandle handle) { - int left; - int top; - int width; - int height; - Pen outerPen; - Brush innerBrush; - - left = handle.Bounds.Left; - top = handle.Bounds.Top; - width = handle.Bounds.Width; - height = handle.Bounds.Height; - - if (handle.Enabled) { - outerPen = SystemPens.WindowFrame; - innerBrush = SystemBrushes.Window; - } - else { - outerPen = SystemPens.ControlDark; - innerBrush = SystemBrushes.Control; - } - - graphics.FillRectangle(innerBrush, left + 1, top + 1, width - 2, height - 2); - graphics.DrawLine(outerPen, left + 1, top, left + width - 2, top); - graphics.DrawLine(outerPen, left, top + 1, left, top + height - 2); - graphics.DrawLine(outerPen, left + 1, top + height - 1, left + width - 2, top + height - 1); - graphics.DrawLine(outerPen, left + width - 1, top + 1, left + width - 1, top + height - 2); - } - - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void OnDragHandleSizeChanged(EventArgs e) { - EventHandler handler; - - PositionDragHandles(); - Invalidate(); - - handler = (EventHandler)Events[_eventDragHandleSizeChanged]; - - handler?.Invoke(this, e); - } - - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void OnMaximumSelectionSizeChanged(EventArgs e) { - EventHandler handler; - - handler = (EventHandler)Events[_eventMaximumSelectionSizeChanged]; - - handler?.Invoke(this, e); - } - - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void OnMinimumSelectionSizeChanged(EventArgs e) { - EventHandler handler; - - handler = (EventHandler)Events[_eventMinimumSelectionSizeChanged]; - - handler?.Invoke(this, e); - } - - /// - /// Raises the event. - /// - /// - /// A that contains the event data. - /// - protected override void OnMouseDown(MouseEventArgs e) { - Point imagePoint; - RectangleF selectionRegion; - - imagePoint = PointToImage(e.Location); - selectionRegion = SelectionRegion; - - if (e.Button == MouseButtons.Left && (selectionRegion.Contains(imagePoint) || HitTest(e.Location) != DragHandleAnchor.None)) { - _dragOrigin = e.Location; - _dragOriginOffset = new Point(imagePoint.X - (int)selectionRegion.X, imagePoint.Y - (int)selectionRegion.Y); - } - else { - _dragOriginOffset = Point.Empty; - _dragOrigin = Point.Empty; - } - - base.OnMouseDown(e); - } - - /// - /// Raises the event. - /// - /// - /// A that contains the event data. - /// - protected override void OnMouseMove(MouseEventArgs e) { - // start either a move or a resize operation - if (!IsSelecting && !_isMoving && !_isResizing && e.Button == MouseButtons.Left && !_dragOrigin.IsEmpty && IsOutsideDragZone(e.Location)) { - DragHandleAnchor anchor; - - anchor = HitTest(_dragOrigin); - - if (anchor == DragHandleAnchor.None) { - // move - StartMove(); - } - else if (_dragHandles[anchor]. - Enabled && _dragHandles[anchor]. - Visible) { - // resize - StartResize(anchor); - } - } - - // set the cursor - SetCursor(e.Location); - - // perform operations - ProcessSelectionMove(e.Location); - ProcessSelectionResize(e.Location); - - base.OnMouseMove(e); - } - - /// - /// Raises the event. - /// - /// - /// A that contains the event data. - /// - protected override void OnMouseUp(MouseEventArgs e) { - if (_isMoving) { - CompleteMove(); - } - else if (_isResizing) { - CompleteResize(); - } - - base.OnMouseUp(e); - } - - /// - /// Raises the event. - /// - /// - /// A that contains the event data. - /// - protected override void OnPaint(PaintEventArgs e) { - base.OnPaint(e); - - if (AllowPainting && !SelectionRegion.IsEmpty) { - foreach (DragHandle handle in _dragHandles) { - if (handle.Visible) { - DrawDragHandle(e.Graphics, handle); - } - } - } - } - - /// - /// Raises the event. - /// - /// - /// The instance containing the event data. - /// - protected override void OnPanStart(CancelEventArgs e) { - if (_isMoving || _isResizing || !_dragOrigin.IsEmpty) { - e.Cancel = true; - } - - base.OnPanStart(e); - } - - /// - /// Raises the event. - /// - /// - /// An that contains the event data. - /// - protected override void OnResize(EventArgs e) { - base.OnResize(e); - - PositionDragHandles(); - } - - /// - /// Raises the event. - /// - /// - /// A that contains the event data. - /// - protected override void OnScroll(ScrollEventArgs se) { - base.OnScroll(se); - - PositionDragHandles(); - } - - /// - /// Raises the event. - /// - /// - /// The instance containing the event data. - /// - protected override void OnSelecting(ImageBoxCancelEventArgs e) { - e.Cancel = _isMoving || _isResizing || SelectionRegion.Contains(PointToImage(e.Location)) || HitTest(e.Location) != DragHandleAnchor.None; - - base.OnSelecting(e); - } - - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void OnSelectionMoved(EventArgs e) { - EventHandler handler; - - handler = (EventHandler)Events[_eventSelectionMoved]; - - handler?.Invoke(this, e); - } - - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void OnSelectionMoving(CancelEventArgs e) { - CancelEventHandler handler; - - handler = (CancelEventHandler)Events[_eventSelectionMoving]; - - handler?.Invoke(this, e); - } - - /// - /// Raises the event. - /// - /// - /// The instance containing the event data. - /// - protected override void OnSelectionRegionChanged(EventArgs e) { - base.OnSelectionRegionChanged(e); - - PositionDragHandles(); - } - - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void OnSelectionResized(EventArgs e) { - EventHandler handler; - - handler = (EventHandler)Events[_eventSelectionResized]; - - handler?.Invoke(this, e); - } - - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void OnSelectionResizing(CancelEventArgs e) { - CancelEventHandler handler; - - handler = (CancelEventHandler)Events[_eventSelectionResizing]; - - handler?.Invoke(this, e); - } - - /// - /// Raises the event. - /// - /// - /// The instance containing the event data. - /// - protected override void OnZoomChanged(EventArgs e) { - base.OnZoomChanged(e); - - PositionDragHandles(); - } - - /// - /// Processes a dialog key. - /// - /// - /// true if the key was processed by the control; otherwise, false. - /// - /// One of the values that represents the key to process. - protected override bool ProcessDialogKey(Keys keyData) { - bool result; - - if (keyData == Keys.Escape && (_isResizing || _isMoving)) { - if (_isResizing) { - CancelResize(); - } - else { - CancelMove(); - } - - result = true; - } - else { - result = base.ProcessDialogKey(keyData); - } - - return result; - } - - protected virtual void SetCursor(Point point) { - // http://forums.cyotek.com/imagebox/cursor-issue-in-imageboxex/msg92/#msg92 - - if (!IsPanning) { - Cursor cursor; - - if (IsSelecting) { - cursor = Cursors.Default; - } - else { - DragHandleAnchor handleAnchor; - - handleAnchor = _isResizing ? _resizeAnchor : HitTest(point); - if (handleAnchor != DragHandleAnchor.None && _dragHandles[handleAnchor]. - Enabled) { - switch (handleAnchor) { - case DragHandleAnchor.TopLeft: - case DragHandleAnchor.BottomRight: - cursor = Cursors.SizeNWSE; - break; - case DragHandleAnchor.TopCenter: - case DragHandleAnchor.BottomCenter: - cursor = Cursors.SizeNS; - break; - case DragHandleAnchor.TopRight: - case DragHandleAnchor.BottomLeft: - cursor = Cursors.SizeNESW; - break; - case DragHandleAnchor.MiddleLeft: - case DragHandleAnchor.MiddleRight: - cursor = Cursors.SizeWE; - break; - default: - throw new ArgumentOutOfRangeException(); - } - } - else if (_isMoving || SelectionRegion.Contains(PointToImage(point))) { - cursor = Cursors.SizeAll; - } - else { - cursor = Cursors.Default; - } - } - - Cursor = cursor; - } - } - - private void CancelMove() { - SelectionRegion = _previousSelectionRegion; - CompleteMove(); - } - - private void CompleteMove() { - ResetDrag(); - OnSelectionMoved(EventArgs.Empty); - } - - private void CompleteResize() { - ResetDrag(); - OnSelectionResized(EventArgs.Empty); - } - - private DragHandleAnchor HitTest(Point cursorPosition) { - return _dragHandles.HitTest(cursorPosition); - } - - private bool IsOutsideDragZone(Point location) { - Rectangle dragZone; - int dragWidth; - int dragHeight; - - dragWidth = SystemInformation.DragSize.Width; - dragHeight = SystemInformation.DragSize.Height; - dragZone = new Rectangle(_dragOrigin.X - (dragWidth / 2), _dragOrigin.Y - (dragHeight / 2), dragWidth, dragHeight); - - return !dragZone.Contains(location); - } - - private void PositionDragHandles() { - if (_dragHandles != null && _dragHandleSize > 0) { - RectangleF selectionRegion; - - selectionRegion = SelectionRegion; - - if (selectionRegion.IsEmpty) { - foreach (DragHandle handle in _dragHandles) { - handle.Bounds = Rectangle.Empty; - } - } - else { - int left; - int top; - int right; - int bottom; - int halfWidth; - int halfHeight; - int halfDragHandleSize; - Rectangle viewport; - int offsetX; - int offsetY; - - viewport = GetImageViewPort(); - offsetX = viewport.Left + Padding.Left + AutoScrollPosition.X; - offsetY = viewport.Top + Padding.Top + AutoScrollPosition.Y; - halfDragHandleSize = _dragHandleSize / 2; - left = Convert.ToInt32((selectionRegion.Left * ZoomFactor) + offsetX); - top = Convert.ToInt32((selectionRegion.Top * ZoomFactor) + offsetY); - right = left + Convert.ToInt32(selectionRegion.Width * ZoomFactor); - bottom = top + Convert.ToInt32(selectionRegion.Height * ZoomFactor); - halfWidth = Convert.ToInt32(selectionRegion.Width * ZoomFactor) / 2; - halfHeight = Convert.ToInt32(selectionRegion.Height * ZoomFactor) / 2; - - _dragHandles[DragHandleAnchor.TopLeft]. - Bounds = new Rectangle(left - _dragHandleSize, top - _dragHandleSize, _dragHandleSize, _dragHandleSize); - _dragHandles[DragHandleAnchor.TopCenter]. - Bounds = new Rectangle(left + halfWidth - halfDragHandleSize, top - _dragHandleSize, _dragHandleSize, _dragHandleSize); - _dragHandles[DragHandleAnchor.TopRight]. - Bounds = new Rectangle(right, top - _dragHandleSize, _dragHandleSize, _dragHandleSize); - _dragHandles[DragHandleAnchor.MiddleLeft]. - Bounds = new Rectangle(left - _dragHandleSize, top + halfHeight - halfDragHandleSize, _dragHandleSize, _dragHandleSize); - _dragHandles[DragHandleAnchor.MiddleRight]. - Bounds = new Rectangle(right, top + halfHeight - halfDragHandleSize, _dragHandleSize, _dragHandleSize); - _dragHandles[DragHandleAnchor.BottomLeft]. - Bounds = new Rectangle(left - _dragHandleSize, bottom, _dragHandleSize, _dragHandleSize); - _dragHandles[DragHandleAnchor.BottomCenter]. - Bounds = new Rectangle(left + halfWidth - halfDragHandleSize, bottom, _dragHandleSize, _dragHandleSize); - _dragHandles[DragHandleAnchor.BottomRight]. - Bounds = new Rectangle(right, bottom, _dragHandleSize, _dragHandleSize); - } - } - } - - private void ProcessSelectionMove(Point cursorPosition) { - if (_isMoving) { - int x; - int y; - Point imagePoint; - Size viewSize; - RectangleF selectionRegion; - - imagePoint = PointToImage(cursorPosition, false); - viewSize = ViewSize; - selectionRegion = SelectionRegion; - - x = Math.Max(0, imagePoint.X - _dragOriginOffset.X); - if (x + selectionRegion.Width >= viewSize.Width) { - x = viewSize.Width - (int)selectionRegion.Width; - } - - y = Math.Max(0, imagePoint.Y - _dragOriginOffset.Y); - if (y + selectionRegion.Height >= viewSize.Height) { - y = viewSize.Height - (int)selectionRegion.Height; - } - - SelectionRegion = new RectangleF(x, y, selectionRegion.Width, selectionRegion.Height); - } - } - - private void ProcessSelectionResize(Point cursorPosition) { - if (_isResizing) { - Point imagePosition; - float left; - float top; - float right; - float bottom; - bool resizingTopEdge; - bool resizingBottomEdge; - bool resizingLeftEdge; - bool resizingRightEdge; - RectangleF selectionRegion; - Size viewSize; - - imagePosition = PointToImage(cursorPosition); - viewSize = ViewSize; - - // get the current selection - selectionRegion = SelectionRegion; - left = selectionRegion.Left; - top = selectionRegion.Top; - right = selectionRegion.Right; - bottom = selectionRegion.Bottom; - - // decide which edges we're resizing - resizingTopEdge = _resizeAnchor >= DragHandleAnchor.TopLeft && _resizeAnchor <= DragHandleAnchor.TopRight; - resizingBottomEdge = _resizeAnchor >= DragHandleAnchor.BottomLeft && _resizeAnchor <= DragHandleAnchor.BottomRight; - resizingLeftEdge = _resizeAnchor == DragHandleAnchor.TopLeft || _resizeAnchor == DragHandleAnchor.MiddleLeft || _resizeAnchor == DragHandleAnchor.BottomLeft; - resizingRightEdge = _resizeAnchor == DragHandleAnchor.TopRight || _resizeAnchor == DragHandleAnchor.MiddleRight || _resizeAnchor == DragHandleAnchor.BottomRight; - - // and resize! - if (resizingTopEdge) { - top = imagePosition.Y > 0 ? imagePosition.Y : 0; - - if (bottom - top < MinimumSelectionSize.Height) { - top = bottom - MinimumSelectionSize.Height; - } - else if (MaximumSelectionSize.Height > 0 && bottom - top > MaximumSelectionSize.Height) { - top = bottom - MaximumSelectionSize.Height; - } - } - else if (resizingBottomEdge) { - bottom = imagePosition.Y < viewSize.Height ? imagePosition.Y : viewSize.Height; - - if (bottom - top < MinimumSelectionSize.Height) { - bottom = top + MinimumSelectionSize.Height; - } - else if (MaximumSelectionSize.Height > 0 && bottom - top > MaximumSelectionSize.Height) { - bottom = top + MaximumSelectionSize.Height; - } - } - - if (resizingLeftEdge) { - left = imagePosition.X > 0 ? imagePosition.X : 0; - - if (right - left < MinimumSelectionSize.Width) { - left = right - MinimumSelectionSize.Width; - } - else if (MaximumSelectionSize.Width > 0 && right - left > MaximumSelectionSize.Width) { - left = right - MaximumSelectionSize.Width; - } - } - else if (resizingRightEdge) { - right = imagePosition.X < viewSize.Width ? imagePosition.X : viewSize.Width; - - if (right - left < MinimumSelectionSize.Width) { - right = left + MinimumSelectionSize.Width; - } - else if (MaximumSelectionSize.Width > 0 && right - left > MaximumSelectionSize.Width) { - right = left + MaximumSelectionSize.Width; - } - } - - SelectionRegion = new RectangleF(left, top, right - left, bottom - top); - } - } - - private void ResetDrag() { - _isResizing = false; - _isMoving = false; - _dragOrigin = Point.Empty; - _dragOriginOffset = Point.Empty; - } - - private void StartResize(DragHandleAnchor anchor) { - CancelEventArgs e; - - if (_isMoving || _isResizing) { - throw new InvalidOperationException("A move or resize action is currently being performed."); - } - - e = new CancelEventArgs(); - - OnSelectionResizing(e); - - if (!e.Cancel) { - _resizeAnchor = anchor; - _previousSelectionRegion = SelectionRegion; - _isResizing = true; - } - } - - #endregion - } -} diff --git a/pdfpatcher/App/Common/ObjectListViewHelper.cs b/pdfpatcher/App/Common/ObjectListViewHelper.cs deleted file mode 100644 index 1ee48a12d22a528f19c45f7a19b11ef8254a4c37..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Common/ObjectListViewHelper.cs +++ /dev/null @@ -1,218 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Drawing.Drawing2D; - -namespace BrightIdeasSoftware -{ - static class ObjectListViewHelper - { - /// 修复编辑控件太窄小的问题。 - public static void FixEditControlWidth(this ObjectListView view) { - view.CellEditStarting += View_CellEditStarting; - view.Disposed += View_Disposed; - } - - static void View_Disposed(object sender, EventArgs e) { - var view = (ObjectListView)sender; - view.CellEditStarting -= View_CellEditStarting; - view.Disposed -= View_Disposed; - } - - static void View_CellEditStarting(object sender, CellEditEventArgs e) { - var b = e.CellBounds; - if (b.Width < 60) { - b.Width = 60; - } - if (e.Control is System.Windows.Forms.Control c) { - c.Bounds = b; - c.Location = b.Location; - } - } - - public static void SetTreeViewLine(this TreeListView view) { - var tcr = view.TreeColumnRenderer as TreeListView.TreeRenderer; - tcr.LinePen = new Pen(SystemColors.ControlDark) { - DashCap = DashCap.Round, - DashStyle = DashStyle.Dash - }; - } - - public static void ExpandSelected(this TreeListView view) { - var so = view.SelectedObjects; - foreach (var item in so) { - view.Expand(item); - } - } - public static TypedObjectListView AsTyped(this ObjectListView view) where T : class { - return view.AsTyped(null); - } - - public static TypedObjectListView AsTyped(this ObjectListView view, Action> configurator) where T : class { - var v = new TypedObjectListView(view); - configurator?.Invoke(v); - return v; - } - public static TypedObjectListView ConfigColumn(this TypedObjectListView view, OLVColumn column, Action> configurator) where T : class { - var t = new TypedColumn(column); - configurator(t); - return view; - } - public static TypedColumn AsTyped(this OLVColumn column, Action> configurator) where T : class { - var t = new TypedColumn(column); - configurator(t); - return t; - } - public static T GetParentModel(this TreeListView view, T model) where T : class { - return view.GetParent(model) as T; - } - - public static List GetAncestorsOrSelf(this TreeListView view, T model) where T : class { - var r = new List(); - do { - r.Add(model); - } while ((model = view.GetParent(model) as T) != null); - return r; - } - - public static void CollapseSelected(this TreeListView view) { - var so = view.SelectedObjects; - foreach (var item in so) { - view.Collapse(item); - } - } - - public static void MoveUpSelection(this ObjectListView view) { - var si = view.GetFirstSelectedIndex(); - if (si < 1) { - return; - } - var so = view.SelectedObjects; - view.MoveObjects(--si, so); - view.SelectedObjects = so; - } - - public static void MoveDownSelection(this ObjectListView view) { - var ls = view.GetLastItemInDisplayOrder(); - if (ls == null || ls.Selected == true) { - return; - } - var si = view.GetFirstSelectedIndex(); - if (si < 0) { - return; - } - var so = view.SelectedObjects; - view.MoveObjects(si + 2, so); - view.SelectedObjects = so; - } - - public static T GetFirstSelectedModel(this ObjectListView view) where T : class { - return view.GetModelObject(view.GetFirstSelectedIndex()) as T; - } - - /// 树视图存在子节点且多选节点时,在 SelectedIndexChanged 事件中,SelectedIndices属性可能返回无内容的集合。 - public static int GetFirstSelectedIndex(this ObjectListView view) { - var c = view.GetItemCount(); - int i = c; - foreach (int item in view.SelectedIndices) { - if (item < i) { - i = item; - } - } - return i == c ? -1 : i; - } - - public static int GetLastSelectedIndex(this ObjectListView view) { - int i = -1; - foreach (int item in view.SelectedIndices) { - if (item > i) { - i = item; - } - } - return i; - } - - public static List GetSelectedModels(this ObjectListView view) where T : class { - var s = view.SelectedObjects; - var r = new List(s.Count); - foreach (T item in s) { - if (item != null) { - r.Add(item); - } - } - return r; - } - - /// 测试坐标点属于哪个单元格。 - public static GridTestResult GetGridAt(this ObjectListView view, int x, int y) { - OLVColumn c = null; - var cr = view.ContentRectangle; - var ic = view.GetItemCount(); - var ob = false; - if (x < cr.Left) { - x = cr.Left; - ob = true; - } - else if (x >= cr.Right) { - x = cr.Right - 1; - ob = true; - } - var cb = cr.Top + ic * view.RowHeightEffective; - if (y < cr.Top) { - y = cr.Top; - ob = true; - } - else if (y >= cb) { - y = cb; - ob = true; - } - var r = view.GetItemAt(x, y, out c); - if (r != null) { - return new GridTestResult(c.DisplayIndex, r.Index, ob); - } - // 当列表框滚动时,上述方法失效,使用此替补方法 - r = view.GetNthItemInDisplayOrder((y - 1 - cr.Top) / view.RowHeightEffective); - var w = cr.Left; - var cl = view.ColumnsInDisplayOrder; - for (int i = 0; i < cl.Count; i++) { - if (x >= w && x <= (w += cl[i].Width)) { - c = cl[i]; - break; - } - } - if (c == null) { - c = cl[cl.Count - 1]; - ob = true; - } - y = r.Index + view.TopItemIndex; - if (y >= view.GetItemCount()) { - y = view.GetItemCount() - 1; - } - return new GridTestResult(c.DisplayIndex, y, ob); - } - - public static void InvertSelect(this ObjectListView view) { - view.Freeze(); - var l = view.GetItemCount(); - for (int i = 0; i < l; i++) { - var oi = view.GetItem(i); - oi.Selected = !oi.Selected; - } - view.Unfreeze(); - } - - } - - public struct GridTestResult - { - public int ColumnIndex { get; private set; } - public int RowIndex { get; private set; } - public bool IsOutOfRange { get; private set; } - - public GridTestResult(int columnIndex, int rowIndex, bool isOutOfRange) { - ColumnIndex = columnIndex; - RowIndex = rowIndex; - IsOutOfRange = isOutOfRange; - } - } -} diff --git a/pdfpatcher/App/Common/PInvokeHelper.cs b/pdfpatcher/App/Common/PInvokeHelper.cs deleted file mode 100644 index f90dc0b4de44376a870990e66782b693a72512b0..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Common/PInvokeHelper.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; - -namespace PDFPatcher.Common -{ - static class PInvokeHelper - { - /// - /// 将 指针对应的数据转换为 类型实例。 - /// - /// 传出类型实例。 - /// 指向数据的指针。 - /// 指针封装后的托管实例。 - internal static T Unwrap(this IntPtr ptr) where T : class, new() { - var t = new T(); - Marshal.PtrToStructure(ptr, t); - return t; - } - - - } -} diff --git a/pdfpatcher/App/Common/ShortcutFile.cs b/pdfpatcher/App/Common/ShortcutFile.cs deleted file mode 100644 index 815de573c735509b2a78a9155d408e29d1402a4e..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Common/ShortcutFile.cs +++ /dev/null @@ -1,115 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Text; - -namespace PDFPatcher.Common -{ - /// 用于创建或管理快捷方式文件的类。 - public sealed class ShortcutFile - { - readonly IShellLink _link; - - /// 获取或设置快捷方式的目标路径。 - public string Destination { get; private set; } - /// 获取或设置快捷方式的工作目录。 - public string WorkingDirectory { get; set; } - /// 获取或设置快捷方式的描述文本。 - public string Description { get; set; } - /// 获取或设置快捷方式的启动参数。 - public string Arguments { get; set; } - /// 获取或设置快捷方式的图标文件位置。 - public string IconLocation { get; set; } - /// 获取或设置快捷方式的图标文件索引。 - public int IconIndex { get; set; } - - private ShortcutFile() { - _link = (IShellLink)new ShellLink(); - } - - /// 创建快捷方式。 - /// 快捷方式指向的目标文件路径。 - public ShortcutFile(string destination) { - _link = (IShellLink)new ShellLink(); - Destination = destination; - _link.SetPath(destination); - } - - /// 加载快捷方式。 - /// 快捷方式文件的位置。 - /// 实例。 - public static ShortcutFile Load(string shortcutFilePath) { - var s = new ShortcutFile(); - var l = s._link; - var file = (System.Runtime.InteropServices.ComTypes.IPersistFile)s._link; - file.Load(shortcutFilePath, 0); - s.Destination = shortcutFilePath; - var sb = new StringBuilder(); - l.GetDescription(sb, 512); - s.Description = sb.ToString(); - sb.Length = 0; - l.GetWorkingDirectory(sb, 256); - s.WorkingDirectory = sb.ToString(); - int ii; - sb.Length = 0; - l.GetIconLocation(sb, 256, out ii); - s.IconLocation = sb.ToString(); - sb.Length = 0; - l.GetArguments(sb, 256); - s.Arguments = sb.ToString(); - return s; - } - - /// 将快捷方式保存到目标位置。 - /// 快捷方式文件的位置。 - public void Save(string position) { - if (String.IsNullOrEmpty(WorkingDirectory) == false) { - _link.SetWorkingDirectory(WorkingDirectory); - } - if (String.IsNullOrEmpty(Description) == false) { - _link.SetDescription(Description); - } - if (String.IsNullOrEmpty(Arguments) == false) { - _link.SetArguments(Arguments); - } - if (String.IsNullOrEmpty(IconLocation) == false) { - _link.SetIconLocation(IconLocation, IconIndex >= 0 ? IconIndex : 0); - } - var file = (System.Runtime.InteropServices.ComTypes.IPersistFile)_link; - file.Save(position, false); - } - - #region COM Interops - [ComImport] - [Guid("00021401-0000-0000-C000-000000000046")] - class ShellLink - { - } - - [ComImport] - [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] - [Guid("000214F9-0000-0000-C000-000000000046")] - interface IShellLink - { - void GetPath([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszFile, int cchMaxPath, out IntPtr pfd, int fFlags); - void GetIDList(out IntPtr ppidl); - void SetIDList(IntPtr pidl); - void GetDescription([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszName, int cchMaxName); - void SetDescription([MarshalAs(UnmanagedType.LPWStr)] string pszName); - void GetWorkingDirectory([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszDir, int cchMaxPath); - void SetWorkingDirectory([MarshalAs(UnmanagedType.LPWStr)] string pszDir); - void GetArguments([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszArgs, int cchMaxPath); - void SetArguments([MarshalAs(UnmanagedType.LPWStr)] string pszArgs); - void GetHotkey(out short pwHotkey); - void SetHotkey(short wHotkey); - void GetShowCmd(out int piShowCmd); - void SetShowCmd(int iShowCmd); - void GetIconLocation([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszIconPath, int cchIconPath, out int piIcon); - void SetIconLocation([MarshalAs(UnmanagedType.LPWStr)] string pszIconPath, int iIcon); - void SetRelativePath([MarshalAs(UnmanagedType.LPWStr)] string pszPathRel, int dwReserved); - void Resolve(IntPtr hwnd, int fFlags); - void SetPath([MarshalAs(UnmanagedType.LPWStr)] string pszFile); - } - #endregion - } - -} diff --git a/pdfpatcher/App/Common/StringBuilderCache.cs b/pdfpatcher/App/Common/StringBuilderCache.cs deleted file mode 100644 index 1aeaf1fd69d4631271d759b64a81619ff212a8d0..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Common/StringBuilderCache.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Text; - -namespace PDFPatcher.Common -{ - internal static class StringBuilderCache - { - internal const int MaxBuilderSize = 360; - const int DefaultCapacity = 16; // == StringBuilder.DefaultCapacity - - [ThreadStatic] - static StringBuilder __CachedInstance; - - public static StringBuilder Acquire(int capacity = DefaultCapacity) { - if (capacity <= MaxBuilderSize) { - StringBuilder sb = __CachedInstance; - if (sb != null) { - // Avoid stringbuilder block fragmentation by getting a new StringBuilder - // when the requested size is larger than the current capacity - if (capacity <= sb.Capacity) { - __CachedInstance = null; - sb.Length = 0; - return sb; - } - } - } - - return new StringBuilder(capacity); - } - - public static void Release(StringBuilder sb) { - if (sb.Capacity <= MaxBuilderSize) { - __CachedInstance = sb; - } - } - - public static string GetStringAndRelease(StringBuilder sb) { - string result = sb.ToString(); - Release(sb); - return result; - } - } -} diff --git a/pdfpatcher/App/Common/StringHelper.cs b/pdfpatcher/App/Common/StringHelper.cs deleted file mode 100644 index e9f1c7b9e14f847a7b790aee6cf3f320675833a9..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Common/StringHelper.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Diagnostics; - -namespace PDFPatcher.Common -{ - static class StringHelper - { - [DebuggerStepThrough] - public static bool IsNullOrWhiteSpace(this string text) { - return String.IsNullOrWhiteSpace(text); - } - - public static string ReplaceControlAndBomCharacters(string source) { - if (String.IsNullOrEmpty(source)) { - return String.Empty; - } - var p = source.ToCharArray(); - var m = false; - for (int i = 0; i < source.Length; i++) { - ref var c = ref p[i]; - if ((Char.IsControl(c) && c != '\t' && c != '\r' && c != '\n') - || (c > 0xFFFD && (c == 0xFFFF || c == 0xFFFE || c == 0xFFEF)) - ) { - c = ' '; - m = true; - } - } - return m ? new String(p) : source; - } - - public static string Take(this string text, int startIndex, int count) { - if (String.IsNullOrEmpty(text) || startIndex >= text.Length) { - return String.Empty; - } - if (startIndex < 0) { - startIndex = text.Length + startIndex; - if (startIndex < 0) { - startIndex = 0; - } - } - return count <= 0 - ? String.Empty - : text.Substring(startIndex, startIndex + count > text.Length ? text.Length - startIndex : count); - } - - public static string ToDescription(this TEnum value) where TEnum : Enum { - return value.ToString(); - } - } -} diff --git a/pdfpatcher/App/Common/ValueHelper.cs b/pdfpatcher/App/Common/ValueHelper.cs deleted file mode 100644 index 93fe2459a11131c23d32edd84789ac4e427577ae..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Common/ValueHelper.cs +++ /dev/null @@ -1,541 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; -using System.Globalization; -using System.Text; - -namespace PDFPatcher.Common -{ - static class ValueHelper - { - [DebuggerStepThrough] - public static TValue CastOrDefault(this object value, TValue defaultValue) where TValue : struct { - return value is TValue v ? v : defaultValue; - } - [DebuggerStepThrough] - public static TValue CastOrDefault(this object value) where TValue : struct { - return value is TValue v ? v : default; - } - [DebuggerStepThrough] - public static bool HasContent(this ICollection collection) { - return collection?.Count > 0; - } - [DebuggerStepThrough] - public static T SubstituteDefault(this T value, T otherValue) { - return EqualityComparer.Default.Equals(value, default(T)) ? otherValue : value; - } - public static TDisposable TryDispose(this TDisposable disposable) - where TDisposable : IDisposable { - if (disposable != null) { - try { - disposable.Dispose(); - } - catch (Exception) { - // ignore - } - } - return disposable; - } - [DebuggerStepThrough] - public static bool IsInCollection(T input, params T[] values) { - return values != null && input != null && values.Length != 0 && Array.IndexOf(values, input) != -1; - } - [DebuggerStepThrough] - public static IComparer GetReverseComparer() - where TItem : IComparable { - return new ReverseComparer(); - } - public static T LimitInRange(this T value, T minValue, T maxValue) - where T : IComparable { - return - value.CompareTo(minValue) < 0 ? minValue - : value.CompareTo(maxValue) > 0 ? maxValue - : value; - } - public static TValue GetOrDefault(this IDictionary dictionary, TKey key) { - TValue r; - return dictionary == null ? default : dictionary.TryGetValue(key, out r) ? r : r; - } - public static TValue GetOrDefault(this IDictionary dictionary, TKey key, TValue defaultValue) { - TValue r; - return dictionary != null && dictionary.TryGetValue(key, out r) ? r : defaultValue; - } - - public static TMapped MapValue(TValue input, TValue[] fromValues, TMapped[] toValues) { - return MapValue(input, fromValues, toValues, default(TMapped)); - } - public static TMapped MapValue(TValue input, TValue[] fromValues, TMapped[] toValues, TMapped defaultValue) { - if (fromValues == null) { - return defaultValue; - } - if (toValues == null) { - return defaultValue; - } - var i = Array.IndexOf(fromValues, input); - if (i == -1 || i >= toValues.Length) { - return defaultValue; - } - return toValues[i]; - } - - public static TMapped MapValue(TValue input, IEnumerable fromValues, IEnumerable toValues, TMapped defaultValue) { - if (fromValues == null) { - return defaultValue; - } - if (toValues == null) { - return defaultValue; - } - var i = 0; - var j = 0; - var c = EqualityComparer.Default; - foreach (var x in fromValues) { - if (c.Equals(input, x)) { - foreach (var y in toValues) { - if (i == j) { - return y; - } - j++; - } - return defaultValue; - } - i++; - } - return defaultValue; - } - public static IEnumerable ForEach(this IEnumerable collection, Action itemHandler) { - if (collection == null || itemHandler == null) { - return collection; - } - foreach (var item in collection) { - if (item is TItem v) { - itemHandler(v); - } - } - return collection; - } - public static TCollection AddRange(this TCollection target, IEnumerable source) - where TCollection : ICollection { - if (source == null || target == null) { - return target; - } - if (target is List list) { - list.AddRange(source); - return target; - } - - foreach (T item in source) { - target.Add(item); - } - return target; - } - - [DebuggerStepThrough] - public static string ToText(this DateTimeOffset value) { - return value.ToString(NumberFormatInfo.InvariantInfo); - } - - [DebuggerStepThrough] - public static string ToText(this int value) { - return value.ToString(NumberFormatInfo.InvariantInfo); - } - - [DebuggerStepThrough] - public static string ToText(this float value) { - return Math.Abs(value) < 0.00001 ? "0" : value.ToString(NumberFormatInfo.InvariantInfo); - } - - [DebuggerStepThrough] - public static string ToText(this double value) { - return Math.Abs(value) < 0.000000000001 ? "0" : value.ToString(NumberFormatInfo.InvariantInfo); - } - - [DebuggerStepThrough] - public static string ToText(this long value) { - return value.ToString(CultureInfo.InvariantCulture); - } - - [DebuggerStepThrough] - public static string ToText(this decimal value) { - return value.ToString(NumberFormatInfo.InvariantInfo); - } - - [DebuggerStepThrough] - public static string ToText(this TFormattable value) - where TFormattable : IFormattable { - return value.ToString(null, NumberFormatInfo.InvariantInfo); - } - [DebuggerStepThrough] - public static string ToText(this TFormattable value, string format) - where TFormattable : IFormattable { - return value.ToString(format, NumberFormatInfo.InvariantInfo); - } - - public static bool ToBoolean(this string value, bool defaultValue) { - if (string.IsNullOrEmpty(value)) { - return defaultValue; - } - switch (ParseBoolean(value)) { - case 1: return true; - case 0: return false; - default: return defaultValue; - } - } - - static int ParseBoolean(string value) { - const int True = 1, False = 0, Invalid = -1; - var i = 0; - var l = value.Length; - do { - var c = value[i]; - switch (c) { - case 'T': - case 't': - if (i + 3 < l && ((c = value[++i]) == 'r' || c == 'R') && ((c = value[++i]) == 'u' || c == 'U') && ((c = value[++i]) == 'e' || c == 'E')) { - goto EndsWithWhitespaceTrue; - } - return Invalid; - case 'F': - case 'f': - if (i + 4 < l && ((c = value[++i]) == 'a' || c == 'A') && ((c = value[++i]) == 'l' || c == 'L') && ((c = value[++i]) == 's' || c == 'S') && ((c = value[++i]) == 'e' || c == 'E')) { - goto EndsWithWhitespaceFalse; - } - return Invalid; - case 'Y': - case 'y': - if (i + 2 < l && ((c = value[++i]) == 'e' || c == 'E') && ((c = value[++i]) == 's' || c == 'S')) { - goto EndsWithWhitespaceTrue; - } - return Invalid; - case 'N': - case 'n': - if (i + 1 < l && ((c = value[++i]) == 'o' || c == 'O')) { - goto EndsWithWhitespaceFalse; - } - return Invalid; - case 'O': - case 'o': - if (i + 2 < l && ((c = value[++i]) == 'f' || c == 'F') && ((c = value[++i]) == 'f' || c == 'F')) { - goto EndsWithWhitespaceFalse; - } - if (i + 1 < l && ((c = value[++i]) == 'n' || c == 'N' || c == 'k' || c == 'K')) { - goto EndsWithWhitespaceTrue; - } - return Invalid; - case '是': - case '对': - case '开': - goto EndsWithWhitespaceTrue; - case '否': - case '关': - goto EndsWithWhitespaceFalse; - case '正': - if (i + 1 < l && value[++i] == '确') { - goto EndsWithWhitespaceTrue; - } - goto EndsWithWhitespaceFalse; - case '错': - if (i + 1 < l && value[++i] == '误') { - goto EndsWithWhitespaceFalse; - } - goto EndsWithWhitespaceFalse; - default: - if (Char.IsWhiteSpace(c)) { - continue; - } - if (c >= '0' && c <= '9' || c == '-' || c == '+' || c == '.') { - bool notZero = c > '0' && c <= '9'; - var hasDot = false; - while (++i < l) { - c = value[i]; - if (Char.IsNumber(c) == false && Char.IsWhiteSpace(c) == false) { - if (c == '.') { - if (hasDot == false) { - hasDot = true; - continue; - } - else { - return Invalid; - } - } - return Invalid; - } - if (notZero == false) { - notZero = c > '0' && c <= '9'; - } - } - return notZero ? True : False; - } - return -1; - } - } while (++i < l); - EndsWithWhitespaceTrue: - while (++i < l && Char.IsWhiteSpace(value[i])) { } - return i == l ? True : Invalid; - EndsWithWhitespaceFalse: - while (++i < l && Char.IsWhiteSpace(value[i])) { } - return i == l ? False : Invalid; - } - - [DebuggerStepThrough] - public static int ToInt32(this float value) { - return (int)(value > 0 ? value + 0.5f : value - 0.5f); - } - - [DebuggerStepThrough] - public static int ToInt32(this double value) { - return (int)(value > 0 ? value + 0.5d : value - 0.5d); - } - - [DebuggerStepThrough] - public static long ToInt64(this float value) { - return (long)(value > 0 ? value + 0.5f : value - 0.5f); - } - - [DebuggerStepThrough] - public static long ToInt64(this double value) { - return (long)(value > 0 ? value + 0.5d : value - 0.5d); - } - - [DebuggerStepThrough] - public static int ToInt32(this string value) { - int i; - value.TryParse(out i); - return i; - } - [DebuggerStepThrough] - public static int ToInt32(this string value, int defaultValue) { - int i; - return value.TryParse(out i) ? i : defaultValue; - } - - [DebuggerStepThrough] - public static long ToInt64(this string value) { - long i; - value.TryParse(out i); - return i; - } - - [DebuggerStepThrough] - public static long ToInt64(this string value, long defaultValue) { - long i; - return value.TryParse(out i) ? i : defaultValue; - } - - [DebuggerStepThrough] - public static float ToSingle(this string value) { - float i; - value.TryParse(out i); - return i; - } - - [DebuggerStepThrough] - public static float ToSingle(this string value, float defaultValue) { - float i; - return value.TryParse(out i) ? i : defaultValue; - } - - [DebuggerStepThrough] - public static double ToDouble(this string value) { - double i; - value.TryParse(out i); - return i; - } - - [DebuggerStepThrough] - public static double ToDouble(this string value, double defaultValue) { - double i; - return value.TryParse(out i) ? i : defaultValue; - } - - [DebuggerStepThrough] - public static string ToText(this byte value) { - return value.ToString(CultureInfo.InvariantCulture); - } - public static bool TryParse(this string value, out int result) { - return Int32.TryParse(value, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out result) - || ParseFloatStringToInt32(value, ref result); - } - - static bool ParseFloatStringToInt32(string value, ref int result) { - if (double.TryParse(value, NumberStyles.Float, NumberFormatInfo.InvariantInfo, out var d)) { - result = d.ToInt32(); - return true; - } - return false; - } - - public static bool TryParse(this string value, out long result) { - return Int64.TryParse(value, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out result) - || ParseFloatStringToInt64(value, ref result); - } - - static bool ParseFloatStringToInt64(string value, ref long result) { - if (double.TryParse(value, NumberStyles.Float, NumberFormatInfo.InvariantInfo, out var d)) { - result = d.ToInt64(); - return true; - } - return false; - } - - [DebuggerStepThrough] - public static bool TryParse(this string value, out float result) { - return float.TryParse(value, NumberStyles.Float, NumberFormatInfo.InvariantInfo, out result); - } - - [DebuggerStepThrough] - public static bool TryParse(this string value, out double result) { - return double.TryParse(value, NumberStyles.Float, NumberFormatInfo.InvariantInfo, out result); - } - - [DebuggerStepThrough] - public static bool TryParse(this string value, out decimal result) { - return decimal.TryParse(value, NumberStyles.Float, NumberFormatInfo.InvariantInfo, out result); - } - - public static string ToRoman(this int value) { - if (value > 49999 || value < 1) { - return string.Empty; - } - var sb = new StringBuilder(); - do { - for (int i = value < 40 ? 5 : value < 400 ? 9 : Roman.Values.Length - 1; i >= 0; i--) { - var n = Roman.Values[i]; - if (value >= n) { - value -= n; - sb.Append(Roman.Chars[i]); - break; - } - } - } while (value > 0); - return sb.ToString(); - } - public static string ToAlphabet(this int value, bool upper) { - if (value <= 0) { - return string.Empty; - } - var stack = new char[7]; - var c = (upper ? 'A' : 'a') - 1; - var p = -1; - while (value > 0) { - var i = value % 26; - stack[++p] = (char)(c + (i == 0 ? 26 : i)); - value = --value / 26; - } - return new string(stack, 0, ++p); - } - public static string ToHexBinString(this byte value, bool upperCaseHex) { - return HexBinByteToString.ToString(value, upperCaseHex); - } - public static string ToHexBinString(this byte[] source) { - return InternalToHexBinString(source, true, '\0', 0, Int32.MaxValue); - } - public static string ToHexBinString(this byte[] source, bool upperCaseHex, char separator, int offset, int count) { - return InternalToHexBinString(source, upperCaseHex, separator, offset, count); - } - unsafe static string InternalToHexBinString(byte[] source, bool upperCaseHex, char separator, int offset, int count) { - if (source == null || offset < 0 || count < 1) { - return String.Empty; - } - var length = source.Length; - if (length == 0 || offset >= length) { - return String.Empty; - } - if (count > length - offset) { - count = length - offset; - } - if (count == 1) { - return source[offset].ToHexBinString(upperCaseHex); - } - var result = new string('0', (count << 1) + (separator > 0 ? count - 1 : 0)); - fixed (char* p = result) - fixed (byte* bp = &source[offset]) { - byte* b = bp; - byte* end = bp + count; - var mapper = HexBinByteValues.GetHexBinMapper(upperCaseHex); - if (separator == 0) { - int* h = (int*)p; - while (b < end) { - *(h++) = mapper[*(b++)]; - } - return result; - } - else { - char* c = p; - *(int*)(c) = mapper[*bp]; - while (++b < end) { - c += 2; - *c = separator; - *(int*)(++c) = mapper[*b]; - } - return result; - } - } - } - - static class HexBinByteToString - { - static readonly string[] __HexBins = InitHexBinStrings(true); - static readonly string[] __HexBinLower = InitHexBinStrings(false); - - public static string ToString(byte value, bool upperCase) { - return (upperCase ? __HexBins : __HexBinLower)[value]; - } - static string[] InitHexBinStrings(bool upperCase) { - var s = new string[Byte.MaxValue + 1]; - for (int i = 0; i < s.Length; i++) { - s[i] = ToHexBinString((byte)i, upperCase); - } - return s; - - string ToHexBinString(byte value, bool upperCaseHex) { - var h = (upperCaseHex ? 0x41 : 0x61) - 10; - var a = new char[2]; - var t = (byte)(value >> 4); - a[0] = (char)(t > 9 ? t + h : t + 0x30); - t = (byte)(value & 0x0F); - a[1] = (char)(t > 9 ? t + h : t + 0x30); - return new string(a); - } - } - } - static class HexBinByteValues - { - static readonly int[] __HexBins = InitHexBin(true); - static readonly int[] __HexBinLowerCase = InitHexBin(false); - - unsafe static int[] InitHexBin(bool upperCase) { - var v = new int[Byte.MaxValue + 1]; - var a = new char[2]; - var h = (upperCase ? 0x41 : 0x61) - 10; - for (int i = 0; i <= Byte.MaxValue; i++) { - var t = (byte)(i >> 4); - a[0] = (char)(t > 9 ? t + h : t + 0x30); - t = (byte)(i & 0x0F); - a[1] = (char)(t > 9 ? t + h : t + 0x30); - fixed (char* p = new string(a)) { - v[i] = *(int*)p; - } - } - return v; - } - public static int[] GetHexBinMapper(bool upperCase) { - return upperCase ? __HexBins : __HexBinLowerCase; - } - } - - static class Roman - { - internal static readonly int[] Values = { 1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000, 4000, 5000, 9000, 10000, 40000 }; - internal static readonly string[] Chars = { "I", "IV", "V", "IX", "X", "XL", "L", "XC", "C", "CD", "D", "CM", "M", "Mv", "v", "Mx", "x", "xl" }; - } - - sealed class ReverseComparer : IComparer - where T : IComparable - { - int IComparer.Compare(T x, T y) { - return y.CompareTo(x); - } - } - } -} diff --git a/pdfpatcher/App/Common/XmlHelper.cs b/pdfpatcher/App/Common/XmlHelper.cs deleted file mode 100644 index 11cd2bf4f58eef2c5843c44cf3f644283baa6889..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Common/XmlHelper.cs +++ /dev/null @@ -1,247 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Xml; - -namespace PDFPatcher.Common -{ - static class XmlHelper - { - const string BooleanYes = "yes"; - const string BooleanNo = "no"; - - [DebuggerStepThrough] - public static bool GetValue(this XmlElement element, string name, bool defaultValue) { - if (element == null) { - return defaultValue; - } - var a = element.GetAttributeNode(name); - return a != null ? a.Value.ToBoolean(defaultValue) : defaultValue; - } - - /// 获取 元素名称为 的属性值,如不存在该属性,或属性不能解析为整数值,则返回 - /// 需要获取属性值的元素。 - /// 属性的名称。 - /// 属性的默认值。 - /// 属性的值;如不存在该属性,返回默认值。 - [DebuggerStepThrough] - public static int GetValue(this XmlElement element, string name, int defaultValue) { - if (element == null) { - return defaultValue; - } - var a = element.GetAttributeNode(name); - return a != null ? a.Value.ToInt32(defaultValue) : defaultValue; - } - - [DebuggerStepThrough] - public static long GetValue(this XmlElement element, string name, long defaultValue) { - if (element == null) { - return defaultValue; - } - var a = element.GetAttributeNode(name); - return a != null ? a.Value.ToInt64(defaultValue) : defaultValue; - } - - [DebuggerStepThrough] - public static float GetValue(this XmlElement element, string name, float defaultValue) { - if (element == null) { - return defaultValue; - } - var a = element.GetAttributeNode(name); - return a != null ? a.Value.ToSingle(defaultValue) : defaultValue; - } - - [DebuggerStepThrough] - public static double GetValue(this XmlElement element, string name, double defaultValue) { - if (element == null) { - return defaultValue; - } - var a = element.GetAttributeNode(name); - if (a == null) { - return defaultValue; - } - return a.Value.ToDouble(defaultValue); - } - [DebuggerStepThrough] - public static bool GetValue(this XmlReader reader, string name, bool defaultValue) { - if (reader == null) { - return defaultValue; - } - var a = reader.GetAttribute(name); - return a?.ToBoolean(defaultValue) ?? defaultValue; - } - [DebuggerStepThrough] - public static int GetValue(this XmlReader reader, string name, int defaultValue) { - if (reader == null) { - return defaultValue; - } - var a = reader.GetAttribute(name); - return a?.ToInt32(defaultValue) ?? defaultValue; - } - [DebuggerStepThrough] - public static float GetValue(this XmlReader reader, string name, float defaultValue) { - if (reader == null) { - return defaultValue; - } - var a = reader.GetAttribute(name); - return a?.ToSingle(defaultValue) ?? defaultValue; - } - - [DebuggerStepThrough] - public static string GetValue(this XmlElement element, string name) { - return element?.GetAttributeNode(name)?.Value; - } - - [DebuggerStepThrough] - public static string GetValue(this XmlElement element, string name, string defaultValue) { - return element?.GetAttributeNode(name)?.Value ?? defaultValue; - } - [DebuggerStepThrough] - public static void SetValue(this XmlElement element, string name, bool value, bool defaultValue) { - if (element == null) { return; } - if (value == defaultValue) { - element.RemoveAttribute(name); - } - else { - element.SetAttribute(name, value ? BooleanYes : BooleanNo); - } - } - - [DebuggerStepThrough] - public static void SetValue(this XmlElement element, string name, int value, int defaultValue) { - if (element == null) { return; } - if (value == defaultValue) { - element.RemoveAttribute(name); - } - else { - element.SetAttribute(name, value.ToText()); - } - } - - [DebuggerStepThrough] - public static void SetValue(this XmlElement element, string name, float value, float defaultValue) { - if (element == null) { return; } - if (value == defaultValue) { - element.RemoveAttribute(name); - } - else { - element.SetAttribute(name, value.ToText()); - } - } - - [DebuggerStepThrough] - public static void SetValue(this XmlElement element, string name, string value) { - if (element == null) { return; } - if (string.IsNullOrEmpty(value)) { - element.RemoveAttribute(name); - } - else { - element.SetAttribute(name, value); - } - } - - [DebuggerStepThrough] - public static void SetValue(this XmlElement element, string name, string value, string defaultValue) { - if (element == null) { return; } - if (value == null || value == defaultValue) { - element.RemoveAttribute(name); - } - else { - element.SetAttribute(name, value); - } - } - [DebuggerStepThrough] - public static void WriteValue(this XmlWriter writer, string name, bool value) { - writer?.WriteAttributeString(name, value ? BooleanYes : BooleanNo); - } - - [DebuggerStepThrough] - public static void WriteValue(this XmlWriter writer, string name, bool value, bool defaultValue) { - if (writer != null && value != defaultValue) { - writer.WriteAttributeString(name, value ? BooleanYes : BooleanNo); - } - } - - [DebuggerStepThrough] - public static void WriteValue(this XmlWriter writer, string name, int value) { - writer?.WriteAttributeString(name, value.ToText()); - } - - [DebuggerStepThrough] - public static void WriteValue(this XmlWriter writer, string name, int value, int defaultValue) { - if (writer != null && value != defaultValue) { - writer.WriteAttributeString(name, value.ToText()); - } - } - - [DebuggerStepThrough] - public static void WriteValue(this XmlWriter writer, string name, float value) { - writer?.WriteAttributeString(name, value.ToText()); - } - - [DebuggerStepThrough] - public static void WriteValue(this XmlWriter writer, string name, string value, string defaultValue) { - if (writer != null && string.Equals(value, defaultValue, StringComparison.OrdinalIgnoreCase) == false) { - writer.WriteAttributeString(name, value); - } - } - - public static XmlElement GetOrCreateElement(this XmlNode parent, string name) { - return parent == null - ? null - : GetElement(parent, name) ?? parent.AppendElement(name); - } - public static XmlElement GetElement(this XmlNode parent, string name) { - if (parent == null) { - return null; - } - var n = parent.FirstChild; - while (n != null) { - if (n.NodeType == XmlNodeType.Element && n.Name == name) { - return n as XmlElement; - } - n = n.NextSibling; - } - return null; - } - [DebuggerStepThrough] - public static XmlElement AppendElement(this XmlNode element, string name) { - if (element == null) { - return null; - } - var d = element.NodeType != XmlNodeType.Document ? element.OwnerDocument : element as XmlDocument; - var e = d.CreateElement(name); - element.AppendChild(e); - return e; - } - - public static XmlNode[] ToXmlNodeArray(this XmlNodeList nodes) { - if (nodes == null) { - return Empty.Item; - } - var a = new XmlNode[nodes.Count]; - var i = -1; - foreach (XmlNode item in nodes) { - a[++i] = item; - } - return a; - } - public static IList ToNodeList(this XmlNodeList nodes) where TNode : XmlNode { - if (nodes == null) { - return Empty.Item; - } - var a = new List(7); - foreach (var item in nodes) { - if (item is TNode n) { - a.Add(n); - } - } - return a; - } - - static class Empty - { - public static readonly TNode[] Item = new TNode[0]; - } - } -} diff --git a/pdfpatcher/App/Common/app.manifest b/pdfpatcher/App/Common/app.manifest deleted file mode 100644 index 7cdf28d8526d421f243a0c8be5fdbf699b21bd4c..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Common/app.manifest +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - true - - - \ No newline at end of file diff --git a/pdfpatcher/App/CommonCommands.cs b/pdfpatcher/App/CommonCommands.cs deleted file mode 100644 index 8f0ca6bc4382fbf421537859e005b8dbac22bdd0..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/CommonCommands.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using PDFPatcher.Common; - -namespace PDFPatcher -{ - static class CommonCommands - { - internal static void CreateShortcut() { - var p = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath); - var s = new ShortcutFile(FileHelper.CombinePath(p, Constants.AppEngName + ".exe")) { - WorkingDirectory = p, - Description = Constants.AppName - }; - var desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); - s.Save(FileHelper.CombinePath(desktopPath, Constants.AppName + ".lnk")); - - FormHelper.InfoBox("已在桌面创建" + Constants.AppName + "的快捷方式。"); - } - - internal static void VisitHomePage() { - System.Diagnostics.Process.Start(Constants.AppHomePage); - } - } -} diff --git a/pdfpatcher/App/Configuration.Designer.cs b/pdfpatcher/App/Configuration.Designer.cs deleted file mode 100644 index dbbda48d2e4eabead2991e066760e60f6ef70459..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Configuration.Designer.cs +++ /dev/null @@ -1,252 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace PDFPatcher { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Configuration { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Configuration() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PDFPatcher.Configuration", typeof(Configuration).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to 书签文本. - /// - internal static string BookmarkText { - get { - return ResourceManager.GetString("BookmarkText", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 自定义工具栏按钮. - /// - internal static string CustomToolbarButtons { - get { - return ResourceManager.GetString("CustomToolbarButtons", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 文档属性. - /// - internal static string DocInfo { - get { - return ResourceManager.GetString("DocInfo", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 正文文本. - /// - internal static string DocText { - get { - return ResourceManager.GetString("DocText", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 编码方式. - /// - internal static string Encodings { - get { - return ResourceManager.GetString("Encodings", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 导出图片目录. - /// - internal static string Folders { - get { - return ResourceManager.GetString("Folders", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 信息文件. - /// - internal static string InfoFiles { - get { - return ResourceManager.GetString("InfoFiles", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 减少占用内存. - /// - internal static string OptimalMemoryUsage { - get { - return ResourceManager.GetString("OptimalMemoryUsage", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 优化处理效率. - /// - internal static string OptimalSpeed { - get { - return ResourceManager.GetString("OptimalSpeed", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 处理选项. - /// - internal static string Options { - get { - return ResourceManager.GetString("Options", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 路径. - /// - internal static string Path { - get { - return ResourceManager.GetString("Path", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to PDF读取方式. - /// - internal static string PdfLoadMode { - get { - return ResourceManager.GetString("PdfLoadMode", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to PDF阅读器路径. - /// - internal static string PdfReaderPath { - get { - return ResourceManager.GetString("PdfReaderPath", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 历史文件. - /// - internal static string RecentFiles { - get { - return ResourceManager.GetString("RecentFiles", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 替换文本. - /// - internal static string ReplaceItems { - get { - return ResourceManager.GetString("ReplaceItems", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 配置文件. - /// - internal static string Root { - get { - return ResourceManager.GetString("Root", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 保存程序配置. - /// - internal static string SaveAppSettings { - get { - return ResourceManager.GetString("SaveAppSettings", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 查找文本. - /// - internal static string SearchItems { - get { - return ResourceManager.GetString("SearchItems", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 输入文件. - /// - internal static string SourceFiles { - get { - return ResourceManager.GetString("SourceFiles", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 目标文件. - /// - internal static string TargetFiles { - get { - return ResourceManager.GetString("TargetFiles", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 版本. - /// - internal static string Version { - get { - return ResourceManager.GetString("Version", resourceCulture); - } - } - } -} diff --git a/pdfpatcher/App/Configuration.resx b/pdfpatcher/App/Configuration.resx deleted file mode 100644 index 26b31707cdd4f7da43a7c2fdcd73248fdf5e1e3b..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Configuration.resx +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 书签文本 - - - 自定义工具栏按钮 - - - 文档属性 - - - 正文文本 - - - 编码方式 - - - 导出图片目录 - - - 信息文件 - - - 减少占用内存 - - - 优化处理效率 - - - 处理选项 - - - 路径 - - - PDF读取方式 - - - PDF阅读器路径 - - - 历史文件 - - - 替换文本 - - - 配置文件 - - - 保存程序配置 - - - 查找文本 - - - 输入文件 - - - 目标文件 - - - 版本 - - \ No newline at end of file diff --git a/pdfpatcher/App/ConfigurationSerialization.cs b/pdfpatcher/App/ConfigurationSerialization.cs deleted file mode 100644 index cc3860499d645881d1a26419842e2068a9821a3e..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/ConfigurationSerialization.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Xml.Serialization; -using PowerJson; - -namespace PDFPatcher -{ - [XmlRoot("处理选项")] - public class ConfigurationSerialization - { - [XmlAttribute("检查更新时间")] - public DateTime CheckUpdateDate { get; set; } - [XmlAttribute("检查更新间隔")] - public int CheckUpdateInterval { get; set; } = 14; - - [XmlAttribute("保存程序设置")] - public bool SaveAppSettings { get; set; } - - [XmlAttribute("文档加载模式")] - public string PdfLoadMode { get; set; } - - [XmlElement("编码设置")] - public EncodingOptions Encodings { get; set; } - ///获取导出设置。 - [XmlElement("信息文件导出设置")] - public ExporterOptions ExporterOptions { get; set; } - ///获取导入设置。 - [XmlElement("信息文件导入设置")] - public ImporterOptions ImporterOptions { get; set; } - ///获取生成文档的设置。 - [XmlElement("PDF文件处理设置")] - public MergerOptions MergerOptions { get; set; } - [XmlElement("PDF文档设置")] - public PatcherOptions PatcherOptions { get; set; } - [XmlElement("PDF编辑器设置")] - public PatcherOptions EditorOptions { get; set; } - [XmlElement("自动生成书签设置")] - public AutoBookmarkOptions AutoBookmarkOptions { get; set; } - [XmlElement("导出图像设置")] - public ImageExtracterOptions ImageExporterOptions { get; set; } - [XmlElement("转为图片设置")] - public MuPdfSharp.ImageRendererOptions ImageRendererOptions { get; set; } - [XmlElement("提取页面设置")] - public ExtractPageOptions ExtractPageOptions { get; set; } - [XmlElement("文本识别设置")] - public OcrOptions OcrOptions { get; set; } - [XmlElement("工具栏设置")] - public ToolbarOptions ToolbarOptions { get; set; } - [XmlElement("窗口设置")] - public WindowStatus WindowStatus { get; set; } - - [JsonField("最近使用的文档")] - [JsonInclude] - [JsonSerializable] - internal AppContext.RecentItems Recent { get; set; } - } -} diff --git a/pdfpatcher/App/Constants.cs b/pdfpatcher/App/Constants.cs deleted file mode 100644 index 8c9b00c8706d9a7f5b833adc59e0b1a7db5aaf70..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Constants.cs +++ /dev/null @@ -1,515 +0,0 @@ -using System; -using System.Collections.Generic; -using iTextSharp.text.pdf; -using E = System.Text.Encoding; - -namespace PDFPatcher -{ - internal enum Function - { - FrontPage, InfoFileOptions, InfoExchanger, ExtractPages, ExtractImages, RenderPages, EditorOptions, Patcher, PatcherOptions, Merger, MergerOptions, About, Editor, Options, BookmarkGenerator, Ocr, Inspector, Rename, Log, Default, CustomizeToolbar - } - - internal static class Constants - { - internal const string AppName = "PDF 补丁丁"; - internal const string AppEngName = "PDFPatcher"; - internal const string AppHomePage = "http://pdfpatcher.cnblogs.com"; - internal const string AppRepository = "https://github.com/wmjordan/pdfpatcher"; - internal const string AppRepository2 = "https://gitee.com/wmjordan/pdfpatcher"; - internal const string AppUpdateFile = "http://files.cnblogs.com/pdfpatcher/pdfpatcher.update.xml"; - - /// - /// 信息文件根元素。 - /// - internal const string PdfInfo = "PDF信息"; - internal const string InfoDocVersion = "0.3.3"; - internal const string ContentPrefix = "pdf"; - internal const string ContentNamespace = "pdf:ContentXml"; - - internal static class FileExtensions - { - internal const string Json = ".json"; - internal const string JsonFilter = "程序配置文件 (*.json)|*.json"; - internal const string Pdf = ".pdf"; - internal const string PdfFilter = "PDF 文件 (*.pdf)|*.pdf"; - internal const string Txt = ".txt"; - internal const string TxtFilter = "简易文本书签文件 (*.txt)|*.txt"; - internal const string Xml = ".xml"; - internal const string XmlFilter = "PDF 信息文件 (*.xml)|*.xml"; - internal const string PdfOrXmlFilter = "PDF 文件或信息文件 (*.pdf, *.xml)|*.pdf;*.xml"; - internal const string XmlOrTxtFilter = "书签文件 (*.xml, *.txt)|*.xml;*.txt"; - internal const string AllEditableFilter = "所有包含 PDF 信息的文件(*.pdf,*.xml,*.txt)|*.pdf;*.xml;*.txt|" + PdfFilter + "|" + XmlFilter + "|" + TxtFilter; - internal const string AllFilter = "所有文件|*.*"; - internal const string ImageFilter = "图片文件 (*.jpg, *.jpeg, *.tiff, *.tif, *.png, *.gif)|*.jpg;*.jpeg;*.tiff;*.tif;*.png;*.gif"; - internal const string Tif = ".tif"; - internal const string Tiff = ".tiff"; - internal const string Jpg = ".jpg"; - internal const string Jpeg = ".jpeg"; - internal const string Png = ".png"; - internal const string Gif = ".gif"; - internal const string Jp2 = ".jp2"; - internal const string Bmp = ".bmp"; - internal const string Dat = ".dat"; - internal const string Tmp = ".tmp"; - internal const string Ttf = ".ttf"; - internal const string Ttc = ".ttc"; - internal const string Otf = ".otf"; - internal readonly static string[] AllBookmarkExtension = { ".xml", ".txt" }; - internal readonly static string[] PdfAndAllBookmarkExtension = { ".pdf", ".xml", ".txt" }; - internal readonly static string[] AllSupportedImageExtension = { Tif, Jpg, Png, Gif, Tiff, Jpeg, Bmp, Jp2 }; - } - - #region 功能名称 - static class Functions - { - internal const string FrontPage = "FrontPage"; - internal const string Patcher = "Patcher"; - internal const string Merger = "Merger"; - internal const string ImageExtractor = "ImageExtractor"; - internal const string PageExtractor = "PageExtractor"; - internal const string PageRenderer = "PageRenderer"; - internal const string BookmarkEditor = "BookmarkEditor"; - internal const string BookmarkGenerator = "BookmarkGenerator"; - internal const string Ocr = "Ocr"; - internal const string Inspector = "Inspector"; - internal const string Log = "Log"; - internal const string About = "About"; - } - #endregion - - #region PDF 对象类型 - internal static class ObjectTypes - { - internal static readonly string[] Names = { "字典", "名称", "数值", "文本", "数组", "布尔", "引用" }; - internal static readonly int[] IDs = { PdfObject.DICTIONARY, PdfObject.NAME, PdfObject.NUMBER, PdfObject.STRING, PdfObject.ARRAY, PdfObject.BOOLEAN, PdfObject.INDIRECT }; - } - #endregion - - #region 文件名替代符 - internal static class FileNameMacros - { - internal const string FileName = "<源文件名>"; - internal const string FolderName = "<源目录名>"; - internal const string PathName = "<源目录路径>"; - internal const string TitleProperty = "<" + Info.Title + ">"; - internal const string AuthorProperty = "<" + Info.Author + ">"; - internal const string SubjectProperty = "<" + Info.Subject + ">"; - internal const string KeywordsProperty = "<" + Info.Keywords + ">"; - internal const string PageCount = "<页数>"; - } - #endregion - - #region 度量单位 - internal static class Units - { - internal const string ThisName = "度量单位"; - internal const string Unit = "单位"; - internal const string Point = "点"; - internal const string CM = "厘米"; - internal const string MM = "毫米"; - internal const string Inch = "英寸"; - internal const float CmToPoint = 72f / 2.54f; - internal const float MmToPoint = 7.2f / 2.54f; - internal const float DefaultDpi = 72f; - internal static readonly string[] Names = { CM, MM, Inch, Point }; - internal static readonly float[] Factors = { CmToPoint, MmToPoint, DefaultDpi, 1 }; - } - #endregion - - #region 对齐方式 - internal static class Alignments - { - internal static readonly string[] HorizontalAlignments = { "左对齐", "水平居中", "右对齐" }; - internal static readonly string[] VerticalAlignments = { "置顶", "垂直居中", "置底" }; - } - #endregion - - #region 方位 - internal static class Coordinates - { - internal const string Left = "左"; - internal const string Right = "右"; - internal const string Top = "上"; - internal const string Bottom = "下"; - internal const string Width = "宽"; - internal const string Height = "高"; - internal const string Direction = "方向"; - internal const string Horizontal = "横向"; - internal const string Vertical = "纵向"; - internal const string ScaleFactor = "比例"; - internal const string Unchanged = "保持不变"; - } - #endregion - - #region 编码 - internal static class Encoding - { - internal const string SystemDefault = "系统默认"; - internal const string Automatic = "自动选择"; - internal static readonly string[] EncodingNames = { Automatic, - SystemDefault, - "UTF-16 Big Endian", - "UTF-16 Little Endian", - "UTF-8", - "GB18030", - "BIG5" }; - internal static readonly E[] Encodings = { null, - E.Default, - E.BigEndianUnicode, - E.Unicode, - E.UTF8, - E.GetEncoding ("gb18030"), - E.GetEncoding ("big5") }; - } - #endregion - - #region 文档信息 - internal static class Info - { - internal const string ThisName = "文档信息"; - - internal const string ProductName = "程序名称"; - internal const string ProductVersion = "程序版本"; - internal const string ExportDate = "导出时间"; - internal const string DocumentName = "PDF文件名"; - internal const string DocumentPath = "PDF文件位置"; - internal const string PageNumber = "页数"; - internal const string Title = "标题"; - internal const string Author = "作者"; - internal const string Subject = "主题"; - internal const string Keywords = "关键字"; - internal const string Creator = "创建程序"; - internal const string Producer = "处理程序"; - internal const string CreationDate = "创建日期"; - internal const string ModDate = "最近修改日期"; - internal const string MetaData = "XML元数据"; - } - internal const string Version = "PDF版本"; - internal const string Catalog = "文档编录"; - internal const string Body = "正文内容"; - internal const string DocumentBookmark = "文档书签"; - #endregion - - #region 阅读器设定 - internal const string PageLayout = "页面布局"; - internal static class PageLayoutType - { - internal static readonly string[] Names = { "保持不变", - "单页连续", "双页连续", "双页连续首页独置", - "单页", "双页", "双页首页独置" }; - internal static readonly PdfName[] PdfNames = { PdfName.NONE, - PdfName.ONECOLUMN, PdfName.TWOCOLUMNLEFT, PdfName.TWOCOLUMNRIGHT, - PdfName.SINGLEPAGE, PdfName.TWOPAGELEFT, PdfName.TWOPAGERIGHT }; - } - internal const string PageMode = "初始模式"; - internal static class PageModes - { - internal static readonly string[] Names = { "保持不变", - "不显示边栏", "显示文档书签", "显示页面缩略图", - "全屏显示", "显示可选内容组", "显示附件栏" }; - internal static readonly PdfName[] PdfNames = { PdfName.NONE, - PdfName.USENONE, PdfName.USEOUTLINES, PdfName.USETHUMBS, - PdfName.FULLSCREEN, PdfName.USEOC, PdfName.USEATTACHMENTS }; - } - internal const string ViewerPreferences = "阅读器设定"; - internal static class ViewerPreferencesType - { - internal static readonly string[] Names = { "隐藏菜单", "隐藏工具栏", - "只显示文档内容", "窗口适合文档首页", - "窗口居中", "显示文档标题" }; - internal static readonly PdfName[] PdfNames = { PdfName.HIDEMENUBAR, PdfName.HIDETOOLBAR, - PdfName.HIDEWINDOWUI, PdfName.FITWINDOW, - PdfName.CENTERWINDOW, PdfName.DISPLAYDOCTITLE }; - internal const string Direction = "阅读方向"; - internal static class DirectionType - { - internal static readonly string[] Names = { "保持不变", "从左到右", "从右到左" }; - internal static readonly PdfName[] PdfNames = { PdfName.NONE, PdfName.L2R, PdfName.R2L }; - } - } - #endregion - - #region 页码样式 - internal const string PageLabels = "页码样式"; - internal static class PageLabelStyles - { - internal static readonly string[] Names = { "数字", "大写罗马数字", "小写罗马数字", "大写英文字母", "小写英文字母", "无" }; - internal static readonly char[] PdfValues = { 'D', 'R', 'r', 'A', 'a', '-' }; - internal static readonly char[] SimpleInfoIdentifiers = { '0', 'I', 'i', 'A', 'a', '-' }; - internal static readonly int[] Values = { - PdfPageLabels.DECIMAL_ARABIC_NUMERALS, - PdfPageLabels.UPPERCASE_ROMAN_NUMERALS, - PdfPageLabels.LOWERCASE_ROMAN_NUMERALS, - PdfPageLabels.UPPERCASE_LETTERS, - PdfPageLabels.LOWERCASE_LETTERS, - PdfPageLabels.EMPTY, - }; - } - internal static class PageLabelsAttributes - { - internal const string PageNumber = "实际页码"; - internal const string StartPage = "起始页码"; - internal const string Prefix = "页码前缀"; - internal const string Style = "样式"; - } - #endregion - - #region 页面内容 - internal static class Content - { - internal const string Page = "页面"; - internal const string PageNumber = "页码"; - internal const string ResourceID = "资源编号"; - internal const string RefType = "引用对象类型"; - internal const string Texts = "文本内容"; - internal const string Operators = "命令"; - internal const string Operands = "参数"; - internal const string Name = "名称"; - internal const string Item = "项目"; - internal const string Path = "路径"; - internal const string Type = "类型"; - internal const string Length = "长度"; - internal const string Raw = "原始内容"; - internal const string Value = "值"; - internal static class PageSettings - { - internal const string ThisName = "页面设置"; - internal const string MediaBox = "页面边框"; - internal const string CropBox = "截取边框"; - internal const string TrimBox = "裁剪边框"; - internal const string ArtBox = "内容边框"; - internal const string BleedBox = "出血边框"; - internal const string Rotation = "旋转角度"; - } - internal static class OperandNames - { - internal const string Matrix = "矩阵"; - internal const string ResourceName = "资源名称"; - internal const string Size = "尺寸"; - internal const string Text = "文本"; - } - internal static class RotationDirections - { - internal const string ThisName = PageSettings.Rotation; - internal const string Zero = "保持不变"; - internal const string Right = "顺时针90度"; - internal const string HalfClock = "180度"; - internal const string Left = "逆时针90度"; - internal static readonly string[] Names = { Zero, Right, HalfClock, Left }; - internal static readonly int[] Values = { 0, 90, 180, 270 }; - } - } - #endregion - - #region 页码范围 - internal const string PageRange = "页码范围"; - internal static class PageFilterTypes - { - internal const string ThisName = "页码筛选"; - internal const string AllPages = "所有页"; - internal static readonly string[] Names = { AllPages, "单数页", "双数页" }; - internal static readonly int[] Values = { -1, 1, 0 }; - } - #endregion - - #region 目标 - internal const string NamedDestination = "命名位置"; - internal static class DestinationAttributes - { - internal const string Page = "页码"; - internal const string FirstPageNumber = "首页页码"; - internal const string Action = "动作"; - internal const string NewWindow = "新窗口"; - internal const string Path = "路径"; - internal const string Name = "名称"; - internal const string Named = "命名位置"; - internal const string NamedN = "PDF名称"; - internal const string View = "显示方式"; - internal const string ScriptContent = "脚本内容"; - internal static class ViewType - { - internal const string XYZ = "坐标缩放"; - internal const string Fit = "适合页面"; - internal const string FitH = "适合页宽"; - internal const string FitV = "适合页高"; - internal const string FitB = "适合窗口"; - internal const string FitBH = "适合窗口宽度"; - internal const string FitBV = "适合窗口高度"; - internal const string FitR = "适合区域"; - internal static readonly string[] Names = { XYZ, Fit, FitH, FitV, FitB, FitBH, FitBV, FitR }; - internal static readonly PdfName[] PdfNames = { PdfName.XYZ, PdfName.FIT, PdfName.FITH, PdfName.FITV, PdfName.FITB, PdfName.FITBH, PdfName.FITBV, PdfName.FITR }; - } - } - internal static class ActionType - { - internal const string Goto = "转到页面"; - internal const string GotoR = "打开外部PDF文档"; - internal const string Launch = "启动程序"; - internal const string Uri = "打开网址"; - internal const string Javascript = "执行脚本"; - internal static readonly string[] Names = { Goto, GotoR, Launch, Uri, Javascript }; - internal static readonly PdfName[] PdfNames = { PdfName.GOTO, PdfName.GOTOR, PdfName.LAUNCH, PdfName.URI, PdfName.JAVASCRIPT }; - } - #endregion - - #region 书签 - internal const string Bookmark = "书签"; - internal static class BookmarkAttributes - { - internal const string Title = "文本"; - internal const string Open = "默认打开"; - internal const string Style = "样式"; - internal static class StyleType - { - internal const string Normal = "常规"; - internal const string Bold = "粗体"; - internal const string BoldItalic = "粗斜体"; - internal const string Italic = "斜体"; - internal static readonly string[] Names = { Normal, Italic, Bold, BoldItalic }; - } - } - internal const string Color = "颜色"; - internal static class Colors - { - internal const string Red = "红"; - internal const string Green = "绿"; - internal const string Blue = "蓝"; - internal const string Gray = "灰度"; - internal const string Transparent = "透明"; - internal const string Cyan = "青"; - internal const string Magenta = "紫"; - internal const string Yellow = "黄"; - internal const string Black = "黑"; - } - internal static class Boolean - { - internal const string True = "是"; - internal const string False = "否"; - } - #endregion - - #region 页面链接 - internal const string PageLink = "页面链接"; - internal static class PageLinkAttributes - { - internal const string Link = "链接"; - internal const string LinkAction = "链接动作"; - internal const string PageNumber = "页码"; - internal const string Border = "边框"; - internal const string Style = "点击效果"; - internal const string QuadPoints = "四边形坐标"; - internal const string Contents = "文本"; - } - #endregion - - #region 光学字符识别 - internal static class Ocr - { - internal const int NoLanguage = 0; - internal const int SimplifiedChineseLangID = 2052; - internal const int TraditionalChineseLangID = 1028; - internal const int JapaneseLangID = 1041; - internal const int KoreanLangID = 1042; - internal const int EnglishLangID = 1033; - - internal const int DanishLangID = 1030; - internal const int DutchLangID = 1043; - internal const int FinnishLangID = 1035; - internal const int FrenchLangID = 1036; - internal const int GermanLangID = 1031; - internal const int ItalianLangID = 1040; - internal const int NorskLangID = 1044; - internal const int PortugueseLangID = 1046; - internal const int SpanishLangID = 3082; - internal const int SwedishLangID = 1053; - internal const int CzechLangID = 1029; - internal const int PolishLangID = 1045; - internal const int HungarianLangID = 1038; - internal const int GreekLangID = 1032; - internal const int RussianLangID = 1049; - internal const int TurkishLangID = 1055; - - internal static int[] LangIDs = { SimplifiedChineseLangID, TraditionalChineseLangID, EnglishLangID, JapaneseLangID, KoreanLangID, DanishLangID, DutchLangID, FinnishLangID, FrenchLangID, GermanLangID, ItalianLangID, NorskLangID, PortugueseLangID, SpanishLangID, SwedishLangID, CzechLangID, PolishLangID, HungarianLangID, GreekLangID, RussianLangID, TurkishLangID }; - internal static int[] OcrLangIDs = { SimplifiedChineseLangID, TraditionalChineseLangID, 9, 17, 18, 6, 19, 11, 12, 7, 16, 20, 22, 10, 29, 5, 21, 14, 8, 25, 31 }; - internal static string[] LangNames = { "简体中文", "繁体中文", "英文", "日文", "韩文", "丹麦文", "荷兰文", "芬兰文", "法文", "德文", "意大利文", "挪威文", "葡萄牙文", "西班牙文", "瑞典文", "捷克文", "波兰文", "匈牙利文", "希腊文", "俄文", "土耳其文" }; - internal const string Result = "识别结果"; - internal const string Text = "文本"; - internal const string Content = "内容"; - internal const string Image = "图片"; - } - #endregion - - #region 字体属性 - internal static class Font - { - internal const string ThisName = "字体"; - internal const string DocumentFont = "文档字体"; - internal const string ID = "编号"; - internal const string Name = "名称"; - internal const string Size = "文本尺寸"; - } - internal static class FontOccurrence - { - internal const string Count = "出现次数"; - internal const string FirstText = "首次出现文本"; - internal const string FirstPage = "首次出现页码"; - } - #endregion - - #region 导出为图片 - internal static class ColorSpaces - { - internal const string Rgb = "DeviceRGB"; - internal const string Bgr = "DeviceBGR"; - internal const string Cmyk = "DeviceCMYK"; - internal const string Gray = "DeviceGray"; - internal static string[] Names = { Rgb, Gray }; - } - #endregion - - #region 超星命名规则 - internal static class CajNaming - { - internal const string Cover = "cov"; - internal const string TitlePage = "bok"; - internal const string CopyrightPage = "leg"; - internal const string Foreword = "fow"; - internal const string Contents = "!"; - } - #endregion - - internal static class AutoBookmark - { - internal const string ThisName = "自动书签"; - internal const string Group = "条件集合"; - internal const string Name = "名称"; - internal const string Description = "说明"; - internal const string IsInclusive = "正向过滤"; - - } - - internal static class Chinese { - public const string Simplified = "皑蔼碍爱翱袄奥坝罢摆败颁办绊帮绑镑谤剥饱宝报鲍辈贝钡狈备惫绷笔毕毙闭边编贬变辩辫鳖瘪濒滨宾摈饼拨钵铂驳卜补参蚕残惭惨灿苍舱仓沧厕侧册测层诧搀掺蝉馋谗缠铲产阐颤场尝长偿肠厂畅钞车彻尘陈衬撑称惩诚骋痴迟驰耻齿炽冲虫宠畴踌筹绸丑橱厨锄雏础储触处传疮闯创锤纯绰辞词赐聪葱囱从丛凑窜错达带贷担单郸掸胆惮诞弹当挡党荡档捣岛祷导盗灯邓敌涤递缔点垫电淀钓调迭谍叠钉顶锭订东动栋冻斗犊独读赌镀锻断缎兑队对吨顿钝夺鹅额讹恶饿儿尔饵贰发罚阀珐矾钒烦范贩饭访纺飞废费纷坟奋愤粪丰枫锋风疯冯缝讽凤肤辐抚辅赋复负讣妇缚该钙盖干赶秆赣冈刚钢纲岗皋镐搁鸽阁铬个给龚宫巩贡钩沟构购够蛊顾剐关观馆惯贯广规硅归龟闺轨诡柜贵刽辊滚锅国过骇韩汉阂鹤贺横轰鸿红后壶护沪户哗华画划话怀坏欢环还缓换唤痪焕涣黄谎挥辉毁贿秽会烩汇讳诲绘荤浑伙获货祸击机积饥讥鸡绩缉极辑级挤几蓟剂济计记际继纪夹荚颊贾钾价驾歼监坚笺间艰缄茧检碱硷拣捡简俭减荐槛鉴践贱见键舰剑饯渐溅涧浆蒋桨奖讲酱胶浇骄娇搅铰矫侥脚饺缴绞轿较秸阶节茎惊经颈静镜径痉竞净纠厩旧驹举据锯惧剧鹃绢杰洁结诫届紧锦仅谨进晋烬尽劲荆觉决诀绝钧军骏开凯颗壳课垦恳抠库裤夸块侩宽矿旷况亏岿窥馈溃扩阔蜡腊莱来赖蓝栏拦篮阑兰澜谰揽览懒缆烂滥捞劳涝乐镭垒类泪篱离里鲤礼丽厉励砾历沥隶俩联莲连镰怜涟帘敛脸链恋炼练粮凉两辆谅疗辽镣猎临邻鳞凛赁龄铃凌灵岭领馏刘龙聋咙笼垄拢陇楼娄搂篓芦卢颅庐炉掳卤虏鲁赂禄录陆驴吕铝侣屡缕虑滤绿峦挛孪滦乱抡轮伦仑沦纶论萝罗逻锣箩骡骆络妈玛码蚂马骂吗买麦卖迈脉瞒馒蛮满谩猫锚铆贸么霉没镁门闷们锰梦谜弥觅绵缅庙灭悯闽鸣铭谬谋亩钠纳难挠脑恼闹馁腻撵捻酿鸟聂啮镊镍柠狞宁拧泞钮纽脓浓农疟诺欧鸥殴呕沤盘庞国爱赔喷鹏骗飘频贫苹凭评泼颇扑铺朴谱脐齐骑岂启气弃讫牵扦钎铅迁签谦钱钳潜浅谴堑枪呛墙蔷强抢锹桥乔侨翘窍窃钦亲轻氢倾顷请庆琼穷趋区躯驱龋颧权劝却鹊让饶扰绕热韧认纫荣绒软锐闰润洒萨鳃赛伞丧骚扫涩杀纱筛晒闪陕赡缮伤赏烧绍赊摄慑设绅审婶肾渗声绳胜圣师狮湿诗尸时蚀实识驶势释饰视试寿兽枢输书赎属术树竖数帅双谁税顺说硕烁丝饲耸怂颂讼诵擞苏诉肃虽绥岁孙损笋缩琐锁獭挞抬摊贪瘫滩坛谭谈叹汤烫涛绦腾誊锑题体屉条贴铁厅听烃铜统头图涂团颓蜕脱鸵驮驼椭洼袜弯湾顽万网韦违围为潍维苇伟伪纬谓卫温闻纹稳问瓮挝蜗涡窝呜钨乌诬无芜吴坞雾务误锡牺袭习铣戏细虾辖峡侠狭厦锨鲜纤咸贤衔闲显险现献县馅羡宪线厢镶乡详响项萧销晓啸蝎协挟携胁谐写泻谢锌衅兴汹锈绣虚嘘须许绪续轩悬选癣绚学勋询寻驯训讯逊压鸦鸭哑亚讶阉烟盐严颜阎艳厌砚彦谚验鸯杨扬疡阳痒养样瑶摇尧遥窑谣药爷页业叶医铱颐遗仪彝蚁艺亿忆义诣议谊译异绎荫阴银饮樱婴鹰应缨莹萤营荧蝇颖哟拥佣痈踊咏涌优忧邮铀犹游诱舆鱼渔娱与屿语吁御狱誉预驭鸳渊辕园员圆缘远愿约跃钥岳粤悦阅云郧匀陨运蕴酝晕韵杂灾载攒暂赞赃脏凿枣灶责择则泽贼赠扎札轧铡闸诈斋债毡盏斩辗崭栈战绽张涨帐账胀赵蛰辙锗这贞针侦诊镇阵挣睁狰帧郑证织职执纸挚掷帜质钟终种肿众诌轴皱昼骤猪诸诛烛瞩嘱贮铸筑驻专砖转赚桩庄装妆壮状锥赘坠缀谆浊兹资渍踪综总纵邹诅组钻致钟么为只凶准启板里雳余链泄"; - public const string Traditional = "皚藹礙愛翺襖奧壩罷擺敗頒辦絆幫綁鎊謗剝飽寶報鮑輩貝鋇狽備憊繃筆畢斃閉邊編貶變辯辮鼈癟瀕濱賓擯餅撥缽鉑駁蔔補參蠶殘慚慘燦蒼艙倉滄廁側冊測層詫攙摻蟬饞讒纏鏟産闡顫場嘗長償腸廠暢鈔車徹塵陳襯撐稱懲誠騁癡遲馳恥齒熾沖蟲寵疇躊籌綢醜櫥廚鋤雛礎儲觸處傳瘡闖創錘純綽辭詞賜聰蔥囪從叢湊竄錯達帶貸擔單鄲撣膽憚誕彈當擋黨蕩檔搗島禱導盜燈鄧敵滌遞締點墊電澱釣調叠諜疊釘頂錠訂東動棟凍鬥犢獨讀賭鍍鍛斷緞兌隊對噸頓鈍奪鵝額訛惡餓兒爾餌貳發罰閥琺礬釩煩範販飯訪紡飛廢費紛墳奮憤糞豐楓鋒風瘋馮縫諷鳳膚輻撫輔賦複負訃婦縛該鈣蓋幹趕稈贛岡剛鋼綱崗臯鎬擱鴿閣鉻個給龔宮鞏貢鈎溝構購夠蠱顧剮關觀館慣貫廣規矽歸龜閨軌詭櫃貴劊輥滾鍋國過駭韓漢閡鶴賀橫轟鴻紅後壺護滬戶嘩華畫劃話懷壞歡環還緩換喚瘓煥渙黃謊揮輝毀賄穢會燴彙諱誨繪葷渾夥獲貨禍擊機積饑譏雞績緝極輯級擠幾薊劑濟計記際繼紀夾莢頰賈鉀價駕殲監堅箋間艱緘繭檢堿鹼揀撿簡儉減薦檻鑒踐賤見鍵艦劍餞漸濺澗漿蔣槳獎講醬膠澆驕嬌攪鉸矯僥腳餃繳絞轎較稭階節莖驚經頸靜鏡徑痙競淨糾廄舊駒舉據鋸懼劇鵑絹傑潔結誡屆緊錦僅謹進晉燼盡勁荊覺決訣絕鈞軍駿開凱顆殼課墾懇摳庫褲誇塊儈寬礦曠況虧巋窺饋潰擴闊蠟臘萊來賴藍欄攔籃闌蘭瀾讕攬覽懶纜爛濫撈勞澇樂鐳壘類淚籬離裏鯉禮麗厲勵礫曆瀝隸倆聯蓮連鐮憐漣簾斂臉鏈戀煉練糧涼兩輛諒療遼鐐獵臨鄰鱗凜賃齡鈴淩靈嶺領餾劉龍聾嚨籠壟攏隴樓婁摟簍蘆盧顱廬爐擄鹵虜魯賂祿錄陸驢呂鋁侶屢縷慮濾綠巒攣孿灤亂掄輪倫侖淪綸論蘿羅邏鑼籮騾駱絡媽瑪碼螞馬罵嗎買麥賣邁脈瞞饅蠻滿謾貓錨鉚貿麽黴沒鎂門悶們錳夢謎彌覓綿緬廟滅憫閩鳴銘謬謀畝鈉納難撓腦惱鬧餒膩攆撚釀鳥聶齧鑷鎳檸獰甯擰濘鈕紐膿濃農瘧諾歐鷗毆嘔漚盤龐國愛賠噴鵬騙飄頻貧蘋憑評潑頗撲鋪樸譜臍齊騎豈啓氣棄訖牽扡釺鉛遷簽謙錢鉗潛淺譴塹槍嗆牆薔強搶鍬橋喬僑翹竅竊欽親輕氫傾頃請慶瓊窮趨區軀驅齲顴權勸卻鵲讓饒擾繞熱韌認紉榮絨軟銳閏潤灑薩鰓賽傘喪騷掃澀殺紗篩曬閃陝贍繕傷賞燒紹賒攝懾設紳審嬸腎滲聲繩勝聖師獅濕詩屍時蝕實識駛勢釋飾視試壽獸樞輸書贖屬術樹豎數帥雙誰稅順說碩爍絲飼聳慫頌訟誦擻蘇訴肅雖綏歲孫損筍縮瑣鎖獺撻擡攤貪癱灘壇譚談歎湯燙濤縧騰謄銻題體屜條貼鐵廳聽烴銅統頭圖塗團頹蛻脫鴕馱駝橢窪襪彎灣頑萬網韋違圍爲濰維葦偉僞緯謂衛溫聞紋穩問甕撾蝸渦窩嗚鎢烏誣無蕪吳塢霧務誤錫犧襲習銑戲細蝦轄峽俠狹廈鍁鮮纖鹹賢銜閑顯險現獻縣餡羨憲線廂鑲鄉詳響項蕭銷曉嘯蠍協挾攜脅諧寫瀉謝鋅釁興洶鏽繡虛噓須許緒續軒懸選癬絢學勳詢尋馴訓訊遜壓鴉鴨啞亞訝閹煙鹽嚴顔閻豔厭硯彥諺驗鴦楊揚瘍陽癢養樣瑤搖堯遙窯謠藥爺頁業葉醫銥頤遺儀彜蟻藝億憶義詣議誼譯異繹蔭陰銀飲櫻嬰鷹應纓瑩螢營熒蠅穎喲擁傭癰踴詠湧優憂郵鈾猶遊誘輿魚漁娛與嶼語籲禦獄譽預馭鴛淵轅園員圓緣遠願約躍鑰嶽粵悅閱雲鄖勻隕運蘊醞暈韻雜災載攢暫贊贓髒鑿棗竈責擇則澤賊贈紮劄軋鍘閘詐齋債氈盞斬輾嶄棧戰綻張漲帳賬脹趙蟄轍鍺這貞針偵診鎮陣掙睜猙幀鄭證織職執紙摯擲幟質鍾終種腫衆謅軸皺晝驟豬諸誅燭矚囑貯鑄築駐專磚轉賺樁莊裝妝壯狀錐贅墜綴諄濁茲資漬蹤綜總縱鄒詛組鑽緻鐘麼為隻兇準啟闆裡靂餘鍊洩"; - } - } - - internal static class Messages - { - internal const string Welcome = "PDF 补丁丁——解除 PDF 文档的烦恼"; - internal const string SourceFileNotFound = "源 PDF 文件不存在,请先指定有效的源 PDF 文件。"; - internal const string InfoDocNotFound = "信息文件不存在,请先指定有效的信息文件。"; - internal const string TargetFileNotSpecified = "请指定输出 PDF 文件的路径。"; - internal const string InfoDocNotSpecified = "请指定输出信息文件的路径。"; - internal const string SourceFileNameInvalid = "源 PDF 文件名无效。"; - internal const string TargetFileNameInvalid = "输出 PDF 文件名无效。"; - internal const string InfoFileNameInvalid = "信息文件的文件名无效。"; - internal const string SourceFileEqualsTargetFile = "输入 PDF 文件和输出 PDF 文件的文件名不能相同。"; - internal const string PasswordInvalid = "输入的密码错误,无法打开 PDF 文档。"; - internal const string UserRightRequired = "此 PDF 文件的作者设置了修改文件的权限控制。\n如果您继续操作,您必须得到创建者对该文档进行修改的授权。\n如果您不能保证自己有权修改此文档,请按“取消”键退出,否则您需要承担修改此文档带来的一切责任。\n\n按住 Ctrl 键点击“确定”按钮,在本次使用过程中将不再提示权限问题。"; - internal const string PageRanges = "在此输入需要处理的页码范围。\n如:“1-100”表示处理第1~100页。\n如有多个页码范围,可用空格、分号或逗号分开。\n如:“1-10;12;14-20”表示处理1~10、12和14~20页。"; - internal const string ReversePageRanges = "此外还可以输入逆序页码,如“100-1”表示从第100页开始倒序处理至第1页。"; - internal const string ModiNotAvailable = "本机尚未安装微软文本识别组件(MODI),无法使用识别文本功能。"; - } -} diff --git a/pdfpatcher/App/Functions/AboutControl.Designer.cs b/pdfpatcher/App/Functions/AboutControl.Designer.cs deleted file mode 100644 index 6a61cb1ba10d1d1009788a20059ae8dbb2064000..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AboutControl.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace PDFPatcher -{ - partial class AboutControl - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._FrontPageBox = new TheArtOfDev.HtmlRenderer.WinForms.HtmlPanel(); - this.SuspendLayout(); - // - // _FrontPageBox - // - this._FrontPageBox.AutoScroll = true; - this._FrontPageBox.BackColor = System.Drawing.SystemColors.Window; - this._FrontPageBox.BaseStylesheet = ""; - this._FrontPageBox.Dock = System.Windows.Forms.DockStyle.Fill; - this._FrontPageBox.IsContextMenuEnabled = false; - this._FrontPageBox.IsSelectionEnabled = false; - this._FrontPageBox.Location = new System.Drawing.Point(9, 8); - this._FrontPageBox.Name = "_FrontPageBox"; - this._FrontPageBox.Size = new System.Drawing.Size(433, 328); - this._FrontPageBox.TabIndex = 1; - this._FrontPageBox.Text = null; - this._FrontPageBox.LinkClicked += new System.EventHandler(this._FrontPageBox_LinkClicked); - this._FrontPageBox.ImageLoad += new System.EventHandler(this._FrontPageBox_ImageLoad); - // - // AboutControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this._FrontPageBox); - this.Name = "AboutControl"; - this.Padding = new System.Windows.Forms.Padding(9, 8, 9, 8); - this.Size = new System.Drawing.Size(451, 344); - this.ResumeLayout(false); - - } - - #endregion - - private TheArtOfDev.HtmlRenderer.WinForms.HtmlPanel _FrontPageBox; - - } -} diff --git a/pdfpatcher/App/Functions/AboutControl.cs b/pdfpatcher/App/Functions/AboutControl.cs deleted file mode 100644 index 261586e276bdb2bf0f5eb97aee24072347753f19..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AboutControl.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Reflection; -using System.Windows.Forms; - -namespace PDFPatcher -{ - [ToolboxItem(false)] - sealed partial class AboutControl : Functions.HtmlPageControl - { - public override string FunctionName => "关于 " + AssemblyTitle; - - public override Bitmap IconImage => Properties.Resources.About; - - public AboutControl() { - InitializeComponent(); - Text = $"关于 {AssemblyTitle}"; - _FrontPageBox.Text = Properties.Resources.AboutPage - .Replace("$AppName", Constants.AppName) - .Replace("$AssemblyCopyright", AssemblyCopyright) - .Replace("$AppHomePage", Constants.AppHomePage) - .Replace("$AppRepository1", Constants.AppRepository) - .Replace("$AppRepository2", Constants.AppRepository2) - .Replace("$AssemblyCompany", AssemblyCompany) - .Replace("$AssemblyVersion", AssemblyVersion); - } - - #region 程序集属性访问器 - - public string AssemblyTitle { - get { - var attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); - if (attributes.Length > 0) { - var titleAttribute = (AssemblyTitleAttribute)attributes[0]; - if (titleAttribute.Title != "") { - return titleAttribute.Title; - } - } - return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); - } - } - - public string AssemblyVersion => Application.ProductVersion; - - public string AssemblyDescription { - get { - var attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); - return attributes.Length == 0 ? String.Empty : ((AssemblyDescriptionAttribute)attributes[0]).Description; - } - } - - public string AssemblyProduct { - get { - var attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); - return attributes.Length == 0 ? String.Empty : ((AssemblyProductAttribute)attributes[0]).Product; - } - } - - public string AssemblyCopyright { - get { - var attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); - return attributes.Length == 0 ? String.Empty : ((AssemblyCopyrightAttribute)attributes[0]).Copyright; - } - } - - public string AssemblyCompany { - get { - var attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); - return attributes.Length == 0 ? String.Empty : ((AssemblyCompanyAttribute)attributes[0]).Company; - } - } - #endregion - - public override void ExecuteCommand(string commandName, params string[] parameters) { - if (commandName == Commands.CheckUpdate) { - AppContext.MainForm.ExecuteCommand(commandName); - } - else { - base.ExecuteCommand(commandName, parameters); - } - } - - private void _FrontPageBox_ImageLoad(object sender, TheArtOfDev.HtmlRenderer.Core.Entities.HtmlImageLoadEventArgs e) { - LoadResourceImage(e); - } - - private void _FrontPageBox_LinkClicked(object sender, TheArtOfDev.HtmlRenderer.Core.Entities.HtmlLinkClickedEventArgs e) { - HandleLinkClicked(e.Link); - e.Handled = true; - } - } -} diff --git a/pdfpatcher/App/Functions/AboutControl.resx b/pdfpatcher/App/Functions/AboutControl.resx deleted file mode 100644 index 1af7de150c99c12dd67a509fe57c10d63e4eeb04..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AboutControl.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/AboutPage.html b/pdfpatcher/App/Functions/AboutPage.html deleted file mode 100644 index c3dd87b8ea30e771dc52f339972f4adb23890704..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AboutPage.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - 关于 $AppName - - - -

关于 $AppName

-
- - - - - - - - - - - - - - - - - - - - - -
$AssemblyCopyright
软件版本:$AssemblyVersion 检查新版本
主页网址:$AppHomePage
源码网址: - - -
作者电邮:$AssemblyCompany
-

PDF 补丁丁是开放源代码的免费软件。在使用该软件之前,您必须同意此软件附带的使用协议。使用此软件表示您同意并遵守该软件使用协议的条款,并清楚使用该软件的责任。

-

本软件及源代码采用“良心授权”协议——用户每次使用本软件后如有所获益,应行一善事;如使用源代码开发了新的软件并获得收益,应将收益中不低于千分之一的金额捐赠给社会的弱势群体。对于因安装、复制、使用本软件而引致的任何损失,本软件及其著作权人不负任何责任。

-

本软件使用了如下开放源代码项目的成果,特此致谢:

-
    -
  1. PDF 组件:http://itextsharp.sourceforge.net
  2. -
  3. PDF 引擎:http://mupdf.com
  4. -
  5. 图像处理:http://freeimage.sourceforge.net
  6. -
  7. JBIG2 解码:http://artifex.com/
  8. -
  9. JBIG2 编码:Adam Langley,https://github.com/agl/jbig2enc
  10. -
  11. 数据编辑:Phillip Piper,http://objectlistview.sourceforge.net
  12. -
  13. 网页界面:ArthurHub,https://github.com/ArthurHub/HTML-Renderer
  14. -
  15. 标签页界面:The Man from U.N.C.L.E.,https://www.codeproject.com/Articles/91387/Painting-Your-Own-Tabs-Second-Edition-2
  16. -
  17. 界面图标:Yusuke Kamiyamane,http://p.yusukekamiyamane.com
  18. -
  19. 图像浏览:Cyotek ImageBox,http://www.cyotek.com/
  20. -
  21. 图像量化算法:武筱林,http://www.ece.mcmaster.ca/~xwu/cq.c
  22. -
-  
- - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/AppOptionForm.Designer.cs b/pdfpatcher/App/Functions/AppOptionForm.Designer.cs deleted file mode 100644 index dc7f03a0d7e8ed1c28d34844cb12960995b81e06..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AppOptionForm.Designer.cs +++ /dev/null @@ -1,260 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class AppOptionForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._DocInfoEncodingBox = new System.Windows.Forms.ComboBox(); - this.label11 = new System.Windows.Forms.Label(); - this._BookmarkEncodingBox = new System.Windows.Forms.ComboBox(); - this.label10 = new System.Windows.Forms.Label(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this._LoadPartialFileBox = new System.Windows.Forms.RadioButton(); - this._LoadEntireFileBox = new System.Windows.Forms.RadioButton(); - this.label12 = new System.Windows.Forms.Label(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.label2 = new System.Windows.Forms.Label(); - this._TextEncodingBox = new System.Windows.Forms.ComboBox(); - this._SaveAppSettingsBox = new System.Windows.Forms.CheckBox(); - this._CreateShortcutButton = new System.Windows.Forms.Button(); - this._FontNameEncodingBox = new System.Windows.Forms.ComboBox(); - this.label1 = new System.Windows.Forms.Label(); - this.groupBox1.SuspendLayout(); - this.groupBox2.SuspendLayout(); - this.SuspendLayout(); - // - // _DocInfoEncodingBox - // - this._DocInfoEncodingBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._DocInfoEncodingBox.FormattingEnabled = true; - this._DocInfoEncodingBox.Location = new System.Drawing.Point(103, 46); - this._DocInfoEncodingBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._DocInfoEncodingBox.Name = "_DocInfoEncodingBox"; - this._DocInfoEncodingBox.Size = new System.Drawing.Size(177, 23); - this._DocInfoEncodingBox.TabIndex = 3; - // - // label11 - // - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(8, 50); - this.label11.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(82, 15); - this.label11.TabIndex = 2; - this.label11.Text = "文档属性:"; - // - // _BookmarkEncodingBox - // - this._BookmarkEncodingBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._BookmarkEncodingBox.FormattingEnabled = true; - this._BookmarkEncodingBox.Location = new System.Drawing.Point(389, 46); - this._BookmarkEncodingBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._BookmarkEncodingBox.Name = "_BookmarkEncodingBox"; - this._BookmarkEncodingBox.Size = new System.Drawing.Size(177, 23); - this._BookmarkEncodingBox.TabIndex = 5; - // - // label10 - // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(295, 50); - this.label10.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(82, 15); - this.label10.TabIndex = 4; - this.label10.Text = "书签文本:"; - // - // groupBox1 - // - this.groupBox1.Controls.Add(this._LoadPartialFileBox); - this.groupBox1.Controls.Add(this._LoadEntireFileBox); - this.groupBox1.Location = new System.Drawing.Point(16, 42); - this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.groupBox1.Size = new System.Drawing.Size(573, 58); - this.groupBox1.TabIndex = 1; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "访问 PDF 文档"; - // - // _LoadPartialFileBox - // - this._LoadPartialFileBox.AutoSize = true; - this._LoadPartialFileBox.Location = new System.Drawing.Point(273, 25); - this._LoadPartialFileBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._LoadPartialFileBox.Name = "_LoadPartialFileBox"; - this._LoadPartialFileBox.Size = new System.Drawing.Size(268, 19); - this._LoadPartialFileBox.TabIndex = 1; - this._LoadPartialFileBox.TabStop = true; - this._LoadPartialFileBox.Text = "减少占用内存(仅加载需处理部分)"; - this._LoadPartialFileBox.UseVisualStyleBackColor = true; - // - // _LoadEntireFileBox - // - this._LoadEntireFileBox.AutoSize = true; - this._LoadEntireFileBox.Location = new System.Drawing.Point(11, 25); - this._LoadEntireFileBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._LoadEntireFileBox.Name = "_LoadEntireFileBox"; - this._LoadEntireFileBox.Size = new System.Drawing.Size(238, 19); - this._LoadEntireFileBox.TabIndex = 0; - this._LoadEntireFileBox.TabStop = true; - this._LoadEntireFileBox.Text = "优化处理效率(加载整个文件)"; - this._LoadEntireFileBox.UseVisualStyleBackColor = true; - // - // label12 - // - this.label12.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label12.Location = new System.Drawing.Point(8, 21); - this.label12.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(560, 21); - this.label12.TabIndex = 6; - this.label12.Text = "说明:当遇到 PDF 文档的文本为乱码时,可尝试使用此选项强制设定编码。"; - // - // groupBox2 - // - this.groupBox2.Controls.Add(this.label1); - this.groupBox2.Controls.Add(this.label2); - this.groupBox2.Controls.Add(this._FontNameEncodingBox); - this.groupBox2.Controls.Add(this._TextEncodingBox); - this.groupBox2.Controls.Add(this._DocInfoEncodingBox); - this.groupBox2.Controls.Add(this.label10); - this.groupBox2.Controls.Add(this.label12); - this.groupBox2.Controls.Add(this._BookmarkEncodingBox); - this.groupBox2.Controls.Add(this.label11); - this.groupBox2.Location = new System.Drawing.Point(13, 108); - this.groupBox2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.groupBox2.Size = new System.Drawing.Size(576, 114); - this.groupBox2.TabIndex = 9; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "读取文档所用的编码"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(8, 82); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(82, 15); - this.label2.TabIndex = 7; - this.label2.Text = "正文文本:"; - // - // _TextEncodingBox - // - this._TextEncodingBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._TextEncodingBox.FormattingEnabled = true; - this._TextEncodingBox.Location = new System.Drawing.Point(103, 79); - this._TextEncodingBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._TextEncodingBox.Name = "_TextEncodingBox"; - this._TextEncodingBox.Size = new System.Drawing.Size(177, 23); - this._TextEncodingBox.TabIndex = 3; - // - // _SaveAppSettingsBox - // - this._SaveAppSettingsBox.AutoSize = true; - this._SaveAppSettingsBox.Location = new System.Drawing.Point(16, 15); - this._SaveAppSettingsBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._SaveAppSettingsBox.Name = "_SaveAppSettingsBox"; - this._SaveAppSettingsBox.Size = new System.Drawing.Size(179, 19); - this._SaveAppSettingsBox.TabIndex = 11; - this._SaveAppSettingsBox.Text = "自动保存应用程序设置"; - this._SaveAppSettingsBox.UseVisualStyleBackColor = true; - // - // _CreateShortcutButton - // - this._CreateShortcutButton.Location = new System.Drawing.Point(311, 10); - this._CreateShortcutButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._CreateShortcutButton.Name = "_CreateShortcutButton"; - this._CreateShortcutButton.Size = new System.Drawing.Size(216, 29); - this._CreateShortcutButton.TabIndex = 12; - this._CreateShortcutButton.Text = "在桌面创建程序快捷方式"; - this._CreateShortcutButton.UseVisualStyleBackColor = true; - this._CreateShortcutButton.Click += new System.EventHandler(this._CreateShortcutButton_Click); - // - // _FontNameEncodingBox - // - this._FontNameEncodingBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._FontNameEncodingBox.FormattingEnabled = true; - this._FontNameEncodingBox.Location = new System.Drawing.Point(389, 79); - this._FontNameEncodingBox.Margin = new System.Windows.Forms.Padding(4); - this._FontNameEncodingBox.Name = "_FontNameEncodingBox"; - this._FontNameEncodingBox.Size = new System.Drawing.Size(177, 23); - this._FontNameEncodingBox.TabIndex = 3; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(294, 82); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(82, 15); - this.label1.TabIndex = 7; - this.label1.Text = "字体名称:"; - // - // AppOptionControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(631, 334); - this.Controls.Add(this._CreateShortcutButton); - this.Controls.Add(this._SaveAppSettingsBox); - this.Controls.Add(this.groupBox2); - this.Controls.Add(this.groupBox1); - this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "AppOptionControl"; - this.Text = "程序工作选项"; - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.groupBox2.ResumeLayout(false); - this.groupBox2.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.ComboBox _DocInfoEncodingBox; - private System.Windows.Forms.Label label11; - private System.Windows.Forms.ComboBox _BookmarkEncodingBox; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.Label label12; - private System.Windows.Forms.RadioButton _LoadEntireFileBox; - private System.Windows.Forms.RadioButton _LoadPartialFileBox; - private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.ComboBox _TextEncodingBox; - private System.Windows.Forms.CheckBox _SaveAppSettingsBox; - private System.Windows.Forms.Button _CreateShortcutButton; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.ComboBox _FontNameEncodingBox; - } -} diff --git a/pdfpatcher/App/Functions/AppOptionForm.cs b/pdfpatcher/App/Functions/AppOptionForm.cs deleted file mode 100644 index 450cac87387a491917cbfaa835e77f3d47931206..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AppOptionForm.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using System.ComponentModel; -using System.Windows.Forms; -using PDFPatcher.Common; - -namespace PDFPatcher.Functions -{ - [ToolboxItem(false)] - public partial class AppOptionForm : Form, IResettableControl - { - bool locked; - - public AppOptionForm() { - InitializeComponent(); - Reload(); - this.SetIcon(Properties.Resources.AppOptions); - _BookmarkEncodingBox.SelectedIndexChanged += ControlChanged; - _DocInfoEncodingBox.SelectedIndexChanged += ControlChanged; - _TextEncodingBox.SelectedIndexChanged += ControlChanged; - _FontNameEncodingBox.SelectedIndexChanged += ControlChanged; - _SaveAppSettingsBox.CheckedChanged += ControlChanged; - _LoadEntireFileBox.CheckedChanged += ControlChanged; - } - - public void Reset() { - AppContext.SaveAppSettings = true; - AppContext.LoadPartialPdfFile = false; - AppContext.Encodings = new EncodingOptions(); - Reload(); - } - - public void Reload() { - locked = true; - _SaveAppSettingsBox.Checked = AppContext.SaveAppSettings; - _LoadPartialFileBox.Checked = AppContext.LoadPartialPdfFile; - _LoadEntireFileBox.Checked = !AppContext.LoadPartialPdfFile; - - InitEncodingList(_BookmarkEncodingBox, AppContext.Encodings.BookmarkEncodingName); - InitEncodingList(_DocInfoEncodingBox, AppContext.Encodings.DocInfoEncodingName); - InitEncodingList(_TextEncodingBox, AppContext.Encodings.TextEncodingName); - InitEncodingList(_FontNameEncodingBox, AppContext.Encodings.FontNameEncodingName); - - locked = false; - } - - static void InitEncodingList(ComboBox list, string encodingName) { - list.Items.Clear(); - foreach (var item in Constants.Encoding.EncodingNames) { - list.Items.Add(item); - if (encodingName == item) { - list.SelectedIndex = list.Items.Count - 1; - } - } - if (list.SelectedIndex == -1) { - list.SelectedIndex = 0; - } - } - - void ControlChanged(object sender, EventArgs e) { - if (locked) { - return; - } - - if (sender == _DocInfoEncodingBox) { - AppContext.Encodings.DocInfoEncodingName = _DocInfoEncodingBox.SelectedItem.ToString(); - } - else if (sender == _BookmarkEncodingBox) { - AppContext.Encodings.BookmarkEncodingName = _BookmarkEncodingBox.SelectedItem.ToString(); - } - else if (sender == _TextEncodingBox) { - AppContext.Encodings.TextEncodingName = _TextEncodingBox.SelectedItem.ToString(); - } - else if (sender == _FontNameEncodingBox) { - AppContext.Encodings.FontNameEncodingName = _FontNameEncodingBox.SelectedItem.ToString(); - } - else if (sender == _SaveAppSettingsBox) { - AppContext.SaveAppSettings = _SaveAppSettingsBox.Checked; - } - else if (sender == _LoadEntireFileBox) { - AppContext.LoadPartialPdfFile = _LoadPartialFileBox.Checked; - } - } - - void _CreateShortcutButton_Click(object sender, EventArgs e) { - CommonCommands.CreateShortcut(); - } - - } -} diff --git a/pdfpatcher/App/Functions/AppOptionForm.resx b/pdfpatcher/App/Functions/AppOptionForm.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AppOptionForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/AutoBookmark/EditAdjustmentForm.Designer.cs b/pdfpatcher/App/Functions/AutoBookmark/EditAdjustmentForm.Designer.cs deleted file mode 100644 index a8fafc57654b20a944d9b453a9b846613e983bc0..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmark/EditAdjustmentForm.Designer.cs +++ /dev/null @@ -1,206 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class EditAdjustmentForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._AddFilterMenuItem = new System.Windows.Forms.ToolStripDropDownButton(); - this._OkButton = new System.Windows.Forms.Button(); - this._CancelButton = new System.Windows.Forms.Button(); - this._FilterBox = new BrightIdeasSoftware.ObjectListView(); - this._TypeColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._ConditionColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._IsInclusiveColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._MainToolbar = new System.Windows.Forms.ToolStrip(); - this._RemoveButton = new System.Windows.Forms.ToolStripButton(); - this._EditFilterBox = new System.Windows.Forms.GroupBox(); - this._EditFilterPanel = new System.Windows.Forms.Panel(); - ((System.ComponentModel.ISupportInitialize)(this._FilterBox)).BeginInit(); - this._MainToolbar.SuspendLayout(); - this._EditFilterBox.SuspendLayout(); - this.SuspendLayout(); - // - // _AddFilterMenuItem - // - this._AddFilterMenuItem.Image = global::PDFPatcher.Properties.Resources.Add; - this._AddFilterMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this._AddFilterMenuItem.Name = "_AddFilterMenuItem"; - this._AddFilterMenuItem.Size = new System.Drawing.Size(109, 22); - this._AddFilterMenuItem.Text = "添加匹配条件"; - this._AddFilterMenuItem.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._AddFilterMenuItem_DropDownItemClicked); - // - // _OkButton - // - this._OkButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._OkButton.Location = new System.Drawing.Point(267, 285); - this._OkButton.Name = "_OkButton"; - this._OkButton.Size = new System.Drawing.Size(75, 23); - this._OkButton.TabIndex = 0; - this._OkButton.Text = "确定(&Q)"; - this._OkButton.UseVisualStyleBackColor = true; - this._OkButton.Click += new System.EventHandler(this._OkButton_Click); - // - // _CancelButton - // - this._CancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this._CancelButton.Location = new System.Drawing.Point(348, 285); - this._CancelButton.Name = "_CancelButton"; - this._CancelButton.Size = new System.Drawing.Size(75, 23); - this._CancelButton.TabIndex = 1; - this._CancelButton.Text = "取消(&X)"; - this._CancelButton.UseVisualStyleBackColor = true; - this._CancelButton.Click += new System.EventHandler(this._CancelButton_Click); - // - // _FilterBox - // - this._FilterBox.AllColumns.Add(this._TypeColumn); - this._FilterBox.AllColumns.Add(this._ConditionColumn); - this._FilterBox.AllColumns.Add(this._IsInclusiveColumn); - this._FilterBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._FilterBox.CellEditUseWholeCell = false; - this._FilterBox.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this._TypeColumn, - this._ConditionColumn, - this._IsInclusiveColumn}); - this._FilterBox.Cursor = System.Windows.Forms.Cursors.Default; - this._FilterBox.FullRowSelect = true; - this._FilterBox.GridLines = true; - this._FilterBox.HideSelection = false; - this._FilterBox.IsSimpleDragSource = true; - this._FilterBox.IsSimpleDropSink = true; - this._FilterBox.Location = new System.Drawing.Point(12, 28); - this._FilterBox.MultiSelect = false; - this._FilterBox.Name = "_FilterBox"; - this._FilterBox.ShowGroups = false; - this._FilterBox.Size = new System.Drawing.Size(411, 141); - this._FilterBox.TabIndex = 3; - this._FilterBox.UseCompatibleStateImageBehavior = false; - this._FilterBox.View = System.Windows.Forms.View.Details; - this._FilterBox.SelectedIndexChanged += new System.EventHandler(this._FilterBox_SelectedIndexChanged); - // - // _TypeColumn - // - this._TypeColumn.IsEditable = false; - this._TypeColumn.Text = "筛选条件"; - this._TypeColumn.Width = 69; - // - // _ConditionColumn - // - this._ConditionColumn.FillsFreeSpace = true; - this._ConditionColumn.Text = "匹配条件"; - this._ConditionColumn.Width = 241; - // - // _IsInclusiveColumn - // - this._IsInclusiveColumn.IsEditable = false; - this._IsInclusiveColumn.Text = "包含筛选"; - this._IsInclusiveColumn.Width = 78; - // - // _MainToolbar - // - this._MainToolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._AddFilterMenuItem, - this._RemoveButton}); - this._MainToolbar.Location = new System.Drawing.Point(0, 0); - this._MainToolbar.Name = "_MainToolbar"; - this._MainToolbar.Size = new System.Drawing.Size(435, 25); - this._MainToolbar.TabIndex = 4; - this._MainToolbar.Text = "toolStrip1"; - // - // _RemoveButton - // - this._RemoveButton.Image = global::PDFPatcher.Properties.Resources.Delete; - this._RemoveButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._RemoveButton.Name = "_RemoveButton"; - this._RemoveButton.Size = new System.Drawing.Size(52, 22); - this._RemoveButton.Text = "删除"; - this._RemoveButton.Click += new System.EventHandler(this._RemoveButton_Click); - // - // _EditFilterBox - // - this._EditFilterBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._EditFilterBox.Controls.Add(this._EditFilterPanel); - this._EditFilterBox.Location = new System.Drawing.Point(12, 175); - this._EditFilterBox.Name = "_EditFilterBox"; - this._EditFilterBox.Size = new System.Drawing.Size(411, 104); - this._EditFilterBox.TabIndex = 5; - this._EditFilterBox.TabStop = false; - this._EditFilterBox.Text = "更改匹配条件"; - // - // _EditFilterPanel - // - this._EditFilterPanel.Location = new System.Drawing.Point(6, 20); - this._EditFilterPanel.Name = "_EditFilterPanel"; - this._EditFilterPanel.Size = new System.Drawing.Size(399, 78); - this._EditFilterPanel.TabIndex = 0; - // - // EditAdjustmentForm - // - this.AcceptButton = this._OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this._CancelButton; - this.ClientSize = new System.Drawing.Size(435, 320); - this.ControlBox = false; - this.Controls.Add(this._EditFilterBox); - this.Controls.Add(this._MainToolbar); - this.Controls.Add(this._FilterBox); - this.Controls.Add(this._CancelButton); - this.Controls.Add(this._OkButton); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(443, 318); - this.Name = "EditAdjustmentForm"; - this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "编辑标题文本筛选条件"; - ((System.ComponentModel.ISupportInitialize)(this._FilterBox)).EndInit(); - this._MainToolbar.ResumeLayout(false); - this._MainToolbar.PerformLayout(); - this._EditFilterBox.ResumeLayout(false); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Button _OkButton; - private System.Windows.Forms.Button _CancelButton; - private BrightIdeasSoftware.ObjectListView _FilterBox; - private BrightIdeasSoftware.OLVColumn _ConditionColumn; - private BrightIdeasSoftware.OLVColumn _TypeColumn; - private BrightIdeasSoftware.OLVColumn _IsInclusiveColumn; - private System.Windows.Forms.ToolStrip _MainToolbar; - private System.Windows.Forms.ToolStripButton _RemoveButton; - private System.Windows.Forms.GroupBox _EditFilterBox; - private System.Windows.Forms.Panel _EditFilterPanel; - private System.Windows.Forms.ToolStripDropDownButton _AddFilterMenuItem; - } -} - diff --git a/pdfpatcher/App/Functions/AutoBookmark/EditAdjustmentForm.cs b/pdfpatcher/App/Functions/AutoBookmark/EditAdjustmentForm.cs deleted file mode 100644 index a896ad0e57cb2df3d3ff5c0cc1611e271edcd418..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmark/EditAdjustmentForm.cs +++ /dev/null @@ -1,148 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Windows.Forms; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - sealed partial class EditAdjustmentForm : Form - { - internal static string[] FilterNames = new string[] { "字体名称", "文本尺寸", "文本位置", "页码范围", "文本内容" }; - internal static string[] FilterIDs = new string[] { "_FontNameFilter", "_FontSizeFilter", "_FontPositionFilter", "_PageRangeFilter", "_TextFilter" }; - - readonly Dictionary _filterEditors = new Dictionary(); - internal AutoBookmarkOptions.LevelAdjustmentOption Filter { get; private set; } - AutoBookmarkCondition.MultiCondition conditions; - - public EditAdjustmentForm() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - } - public EditAdjustmentForm(AutoBookmarkOptions.LevelAdjustmentOption filter) : this() { - int i = 0; - foreach (var item in FilterNames) { - _AddFilterMenuItem.DropDownItems.Add(item).Name = FilterIDs[i++]; - } - _FilterBox.BeforeSorting += (object sender, BrightIdeasSoftware.BeforeSortingEventArgs e) => e.Canceled = true; - _ConditionColumn.AspectGetter = (object x) => x is AutoBookmarkCondition f ? f.Description : (object)null; - _IsInclusiveColumn.AspectGetter = (object x) => { - if (x is AutoBookmarkCondition f) { - return f.IsInclusive ? "包含匹配项" : "过滤匹配项"; - } - return null; - }; - _TypeColumn.AspectGetter = (object x) => x is AutoBookmarkCondition f ? f.Name : null; - Filter = new AutoBookmarkOptions.LevelAdjustmentOption(); - if (filter != null) { - Filter.AdjustmentLevel = filter.AdjustmentLevel; - Filter.RelativeAdjustment = filter.RelativeAdjustment; - conditions = new AutoBookmarkCondition.MultiCondition(filter.Condition); - _FilterBox.Objects = conditions.Conditions; - } - if (_FilterBox.Items.Count > 0) { - _FilterBox.SelectedIndex = 0; - } - } - - void OnLoad() { - _MainToolbar.ScaleIcons(16); - _FilterBox.ScaleColumnWidths(); - } - - void _OkButton_Click(Object source, EventArgs args) { - DialogResult = DialogResult.OK; - conditions = new AutoBookmarkCondition.MultiCondition(); - foreach (ListViewItem item in _FilterBox.Items) { - conditions.Conditions.Add((AutoBookmarkCondition)_FilterBox.GetModelObject(item.Index)); - } - - Filter.Condition = conditions.Conditions.Count switch { - 1 => conditions.Conditions[0], - 0 => null, - _ => conditions - }; - Close(); - } - - void _CancelButton_Click(Object source, EventArgs args) { - DialogResult = DialogResult.Cancel; - Close(); - } - - private void _AddFilterMenuItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { - var c = CreateCondition(e.ClickedItem.Name); - if (c != null) { - _FilterBox.AddObject(c); - } - } - - private void _FilterBox_SelectedIndexChanged(object sender, EventArgs e) { - _EditFilterPanel.Controls.Clear(); - var o = _FilterBox.SelectedObject; - if (o == null) { - return; - } - var ed = GetFilterEditor(o as AutoBookmarkCondition); - if (ed == null) { - return; - } - _EditFilterPanel.Controls.Add(ed.EditorControl); - ed.EditorControl.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; - ed.EditorControl.Left = ed.EditorControl.Top = 0; - ed.EditorControl.Size = _EditFilterPanel.ClientSize; - } - - internal static AutoBookmarkCondition CreateCondition(string name) { - switch (name) { - case "_FontNameFilter": return new AutoBookmarkCondition.FontNameCondition("SimSun", false); - case "_FontSizeFilter": return new AutoBookmarkCondition.TextSizeCondition(0, 10); - case "_FontPositionFilter": return new AutoBookmarkCondition.TextPositionCondition(1, -9999, 9999); - case "_PageRangeFilter": return new AutoBookmarkCondition.PageRangeCondition(); - case "_TextFilter": return new AutoBookmarkCondition.TextCondition() { Pattern = new MatchPattern("筛选条件", false, false, false) }; - default: return null; - } - } - - internal static void UpdateFilter(IFilterConditionEditor filter) { - if (filter.EditorControl?.FindForm() is EditAdjustmentForm f) { - f._FilterBox.RefreshSelectedObjects(); - } - } - - private IFilterConditionEditor GetFilterEditor(AutoBookmarkCondition filter) { - var t = filter.GetType(); - if (_filterEditors.TryGetValue(t, out IFilterConditionEditor c)) { - goto SetEditor; - // return c; - } - else if (t == typeof(AutoBookmarkCondition.FontNameCondition)) { - c = new FontNameConditionEditor(); - } - else if (t == typeof(AutoBookmarkCondition.TextSizeCondition)) { - c = new TextSizeConditionEditor(); - } - else if (t == typeof(AutoBookmarkCondition.TextPositionCondition)) { - c = new TextPositionConditionEditor(); - } - else if (t == typeof(AutoBookmarkCondition.PageRangeCondition)) { - c = new PageRangeConditionEditor(); - } - else if (t == typeof(AutoBookmarkCondition.TextCondition)) { - c = new TextConditionEditor(); - } - else { - Common.FormHelper.ErrorBox("无法编辑选中的筛选条件。"); - return null; - } - SetEditor: - _filterEditors[t] = c; - c.Filter = filter; - return c; - } - - private void _RemoveButton_Click(object sender, EventArgs e) { - _FilterBox.RemoveObjects(_FilterBox.SelectedObjects); - } - } -} diff --git a/pdfpatcher/App/Functions/AutoBookmark/EditAdjustmentForm.resx b/pdfpatcher/App/Functions/AutoBookmark/EditAdjustmentForm.resx deleted file mode 100644 index e110332264cce335ffd48830765b096407246803..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmark/EditAdjustmentForm.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/AutoBookmark/FontFilterForm.Designer.cs b/pdfpatcher/App/Functions/AutoBookmark/FontFilterForm.Designer.cs deleted file mode 100644 index 8d6275f619be9aea1627031f4d0a6894211948da..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmark/FontFilterForm.Designer.cs +++ /dev/null @@ -1,219 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class FontFilterForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.components = new System.ComponentModel.Container (); - this._OkButton = new System.Windows.Forms.Button (); - this._CancelButton = new System.Windows.Forms.Button (); - this._MessageLabel = new System.Windows.Forms.Label (); - this._FontNameSizeColumn = new BrightIdeasSoftware.OLVColumn (); - this._FirstPageColumn = new BrightIdeasSoftware.OLVColumn (); - this._CountColumn = new BrightIdeasSoftware.OLVColumn (); - this._FontInfoBox = new BrightIdeasSoftware.TreeListView (); - this._AddFilterMenu = new System.Windows.Forms.ContextMenuStrip (this.components); - this._FilterBox = new BrightIdeasSoftware.ObjectListView (); - this._ConditionColumn = new BrightIdeasSoftware.OLVColumn (); - this._AddConditionButton = new System.Windows.Forms.Button (); - this._RemoveConditionButton = new System.Windows.Forms.Button (); - ((System.ComponentModel.ISupportInitialize)(this._FontInfoBox)).BeginInit (); - ((System.ComponentModel.ISupportInitialize)(this._FilterBox)).BeginInit (); - this.SuspendLayout (); - // - // _OkButton - // - this._OkButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._OkButton.Location = new System.Drawing.Point (368, 376); - this._OkButton.Name = "_OkButton"; - this._OkButton.Size = new System.Drawing.Size (75, 23); - this._OkButton.TabIndex = 5; - this._OkButton.Text = "确定(&Q)"; - this._OkButton.UseVisualStyleBackColor = true; - this._OkButton.Click += new System.EventHandler (this._OkButton_Click); - // - // _CancelButton - // - this._CancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this._CancelButton.Location = new System.Drawing.Point (449, 376); - this._CancelButton.Name = "_CancelButton"; - this._CancelButton.Size = new System.Drawing.Size (75, 23); - this._CancelButton.TabIndex = 6; - this._CancelButton.Text = "取消(&X)"; - this._CancelButton.UseVisualStyleBackColor = true; - this._CancelButton.Click += new System.EventHandler (this._CancelButton_Click); - // - // _MessageLabel - // - this._MessageLabel.AutoSize = true; - this._MessageLabel.Location = new System.Drawing.Point (12, 9); - this._MessageLabel.Name = "_MessageLabel"; - this._MessageLabel.Size = new System.Drawing.Size (407, 12); - this._MessageLabel.TabIndex = 0; - this._MessageLabel.Text = "下表列出了 PDF 文档中所使用的字体。右键点击项目可添加字体筛选条件。"; - // - // _FontNameSizeColumn - // - this._FontNameSizeColumn.Text = "字体名称/文本尺寸(首次出现文本)"; - this._FontNameSizeColumn.Width = 329; - // - // _FirstPageColumn - // - this._FirstPageColumn.HeaderTextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._FirstPageColumn.Text = "首次出现页码"; - this._FirstPageColumn.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._FirstPageColumn.Width = 51; - // - // _CountColumn - // - this._CountColumn.HeaderTextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._CountColumn.Text = "出现次数"; - this._CountColumn.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._CountColumn.Width = 52; - // - // _FontInfoBox - // - this._FontInfoBox.AllColumns.Add (this._FontNameSizeColumn); - this._FontInfoBox.AllColumns.Add (this._FirstPageColumn); - this._FontInfoBox.AllColumns.Add (this._CountColumn); - this._FontInfoBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._FontInfoBox.CheckBoxes = false; - this._FontInfoBox.Columns.AddRange (new System.Windows.Forms.ColumnHeader[] { - this._FontNameSizeColumn, - this._FirstPageColumn, - this._CountColumn}); - this._FontInfoBox.ContextMenuStrip = this._AddFilterMenu; - this._FontInfoBox.FullRowSelect = true; - this._FontInfoBox.GridLines = true; - this._FontInfoBox.HeaderWordWrap = true; - this._FontInfoBox.Location = new System.Drawing.Point (14, 36); - this._FontInfoBox.MultiSelect = false; - this._FontInfoBox.Name = "_FontInfoBox"; - this._FontInfoBox.OwnerDraw = true; - this._FontInfoBox.ShowGroups = false; - this._FontInfoBox.Size = new System.Drawing.Size (510, 206); - this._FontInfoBox.TabIndex = 1; - this._FontInfoBox.UseCompatibleStateImageBehavior = false; - this._FontInfoBox.View = System.Windows.Forms.View.Details; - this._FontInfoBox.VirtualMode = true; - // - // _AddFilterMenu - // - this._AddFilterMenu.Name = "_AddFilterMenu"; - this._AddFilterMenu.ShowImageMargin = false; - this._AddFilterMenu.Size = new System.Drawing.Size (36, 4); - this._AddFilterMenu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler (this._AddFilterMenu_ItemClicked); - this._AddFilterMenu.Opening += new System.ComponentModel.CancelEventHandler (this._AddFilterMenu_Opening); - // - // _FilterBox - // - this._FilterBox.AllColumns.Add (this._ConditionColumn); - this._FilterBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._FilterBox.Columns.AddRange (new System.Windows.Forms.ColumnHeader[] { - this._ConditionColumn}); - this._FilterBox.FullRowSelect = true; - this._FilterBox.GridLines = true; - this._FilterBox.Location = new System.Drawing.Point (14, 248); - this._FilterBox.Name = "_FilterBox"; - this._FilterBox.ShowGroups = false; - this._FilterBox.Size = new System.Drawing.Size (415, 122); - this._FilterBox.TabIndex = 2; - this._FilterBox.UseCompatibleStateImageBehavior = false; - this._FilterBox.View = System.Windows.Forms.View.Details; - // - // _ConditionColumn - // - this._ConditionColumn.Text = "筛选条件"; - this._ConditionColumn.Width = 330; - // - // _AddConditionButton - // - this._AddConditionButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._AddConditionButton.Location = new System.Drawing.Point (435, 248); - this._AddConditionButton.Name = "_AddConditionButton"; - this._AddConditionButton.Size = new System.Drawing.Size (89, 23); - this._AddConditionButton.TabIndex = 3; - this._AddConditionButton.Text = "添加筛选条件"; - this._AddConditionButton.UseVisualStyleBackColor = true; - this._AddConditionButton.Click += new System.EventHandler (this.ControlEvent); - // - // _RemoveConditionButton - // - this._RemoveConditionButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._RemoveConditionButton.Location = new System.Drawing.Point (435, 277); - this._RemoveConditionButton.Name = "_RemoveConditionButton"; - this._RemoveConditionButton.Size = new System.Drawing.Size (89, 23); - this._RemoveConditionButton.TabIndex = 4; - this._RemoveConditionButton.Text = "删除筛选条件"; - this._RemoveConditionButton.UseVisualStyleBackColor = true; - this._RemoveConditionButton.Click += new System.EventHandler (this.ControlEvent); - // - // FontFilterForm - // - this.AcceptButton = this._OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this._CancelButton; - this.ClientSize = new System.Drawing.Size (536, 411); - this.Controls.Add (this._RemoveConditionButton); - this.Controls.Add (this._AddConditionButton); - this.Controls.Add (this._FontInfoBox); - this.Controls.Add (this._MessageLabel); - this.Controls.Add (this._FilterBox); - this.Controls.Add (this._CancelButton); - this.Controls.Add (this._OkButton); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "FontFilterForm"; - this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "添加字体筛选条件"; - ((System.ComponentModel.ISupportInitialize)(this._FontInfoBox)).EndInit (); - ((System.ComponentModel.ISupportInitialize)(this._FilterBox)).EndInit (); - this.ResumeLayout (false); - this.PerformLayout (); - - } - - #endregion - - private System.Windows.Forms.Button _OkButton; - private System.Windows.Forms.Button _CancelButton; - private System.Windows.Forms.Label _MessageLabel; - private BrightIdeasSoftware.OLVColumn _FontNameSizeColumn; - private BrightIdeasSoftware.OLVColumn _FirstPageColumn; - private BrightIdeasSoftware.OLVColumn _CountColumn; - private BrightIdeasSoftware.TreeListView _FontInfoBox; - private System.Windows.Forms.ContextMenuStrip _AddFilterMenu; - private BrightIdeasSoftware.ObjectListView _FilterBox; - private BrightIdeasSoftware.OLVColumn _ConditionColumn; - private System.Windows.Forms.Button _AddConditionButton; - private System.Windows.Forms.Button _RemoveConditionButton; - } -} - diff --git a/pdfpatcher/App/Functions/AutoBookmark/FontFilterForm.cs b/pdfpatcher/App/Functions/AutoBookmark/FontFilterForm.cs deleted file mode 100644 index 1430a252bb1c0de0359bf9abdaf4ba65c59545f5..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmark/FontFilterForm.cs +++ /dev/null @@ -1,211 +0,0 @@ -using System; -using System.ComponentModel; -using System.Drawing; -using System.Windows.Forms; -using System.Xml; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - sealed partial class FontFilterForm : Form - { - sealed class FilterSetting - { - internal string FontName { get; } - internal bool FullMatch { get; } - internal float Size { get; } - public FilterSetting(string fontName, bool fullMatch, float size) { - FontName = fontName; - FullMatch = fullMatch; - Size = size; - } - } - - readonly XmlElement _fontInfo; - internal AutoBookmarkCondition[] FilterConditions { - get; - private set; - } - public FontFilterForm() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - } - public FontFilterForm(XmlNode fontInfo) : this() { - _fontInfo = fontInfo as XmlElement; - } - - void OnLoad() { - var tcr = _FontInfoBox.TreeColumnRenderer; - tcr.LinePen = new Pen(SystemColors.ControlDark) { - DashCap = System.Drawing.Drawing2D.DashCap.Round, - DashStyle = System.Drawing.Drawing2D.DashStyle.Dash - }; - - _FontInfoBox.CanExpandGetter = (object o) => o is XmlElement f && f.Name == Constants.Font.ThisName && f.HasChildNodes; - _FontInfoBox.ChildrenGetter = (object o) => o is XmlElement f ? (System.Collections.IEnumerable)f.SelectNodes(Constants.Font.Size) : null; - _FontInfoBox.RowFormatter = (BrightIdeasSoftware.OLVListItem o) => { - if (_FontInfoBox.GetParent(o.RowObject) == null) { - o.SubItems[0].Font = new Font(o.SubItems[0].Font, FontStyle.Bold); - o.SubItems[1].Text = String.Empty; - o.BackColor = Color.LightBlue; - } - }; - _FontNameSizeColumn.AspectGetter = (object o) => { - var f = o as XmlElement; - if (f == null) { - return null; - } - if (f.Name == Constants.Font.ThisName) { - return f.GetAttribute(Constants.Font.Name); - } - else if (f.ParentNode?.Name == Constants.Font.ThisName) { - f.GetAttribute(Constants.Font.Size).TryParse(out float p); - var t = f.GetAttribute(Constants.FontOccurrence.FirstText); - return String.Concat(p.ToText(), "(", t, ")"); - } - return null; - }; - _CountColumn.AspectGetter = (object o) => { - if (o is XmlElement f) { - f.GetAttribute(Constants.FontOccurrence.Count).TryParse(out int p); - return p; - } - return null; - }; - _FirstPageColumn.AspectGetter = (object o) => { - if (o is XmlElement f) { - f.GetAttribute(Constants.FontOccurrence.FirstPage).TryParse(out int p); - return p; - } - return null; - }; - _ConditionColumn.AspectGetter = (object o) => o is AutoBookmarkCondition c ? c.Description : (object)null; - - if (_fontInfo == null) { - FormHelper.ErrorBox("缺少字体信息。"); - _OkButton.Enabled = false; - return; - } - - var fonts = _fontInfo.SelectNodes(Constants.Font.ThisName + "[@" + Constants.Font.Name + " and " + Constants.Font.Size + "]"); - var fi = new XmlElement[fonts.Count]; - var i = 0; - foreach (XmlElement f in fonts) { - fi[i++] = f; - } - _FontInfoBox.AddObjects(fi); - foreach (XmlElement item in _FontInfoBox.Roots) { - _FontInfoBox.Expand(item); - } - if (_FontInfoBox.GetItemCount() > 0) { - _FontInfoBox.EnsureVisible(0); - _FontInfoBox.Sort(_CountColumn, SortOrder.Descending); - } - } - - void _OkButton_Click(Object source, EventArgs args) { - DialogResult = DialogResult.OK; - if (_FilterBox.Items.Count > 0) { - FilterConditions = new AutoBookmarkCondition[_FilterBox.Items.Count]; - for (int i = 0; i < FilterConditions.Length; i++) { - FilterConditions[i] = _FilterBox.GetModelObject(i) as AutoBookmarkCondition; - } - } - Close(); - } - - void _CancelButton_Click(Object source, EventArgs args) { - DialogResult = DialogResult.Cancel; - Close(); - } - - void _AddFilterMenu_Opening(object sender, CancelEventArgs e) { - if (_FontInfoBox.FocusedItem == null) { - if (_FontInfoBox.SelectedItem != null) { - _FontInfoBox.FocusedItem = _FontInfoBox.SelectedItem; - } - else { - e.Cancel = true; - return; - } - } - var f = _FontInfoBox.GetModelObject(_FontInfoBox.FocusedItem.Index) as XmlElement; - if (f == null) { - e.Cancel = true; - return; - } - var n = (f.ParentNode.Name == Constants.Font.ThisName ? (f.ParentNode as XmlElement) : f).GetAttribute(Constants.Font.Name); - if (String.IsNullOrEmpty(n)) { - e.Cancel = true; - return; - } - f.GetAttribute(Constants.Font.Size).TryParse(out float s); - - _AddFilterMenu.Items.Clear(); - var p = n.IndexOf('+'); - var m = n.IndexOfAny(new char[] { '-', ',' }, p != -1 ? p : 0); - string fn; - if (p != -1) { - if (m > p + 1) { - fn = n.Substring(p + 1, m - p - 1); - if (s > 0) { - _AddFilterMenu.Items.Add("筛选名称包含“" + fn + "”且尺寸为" + s.ToText() + "的字体").Tag = new FilterSetting(fn, false, s); - } - else { - _AddFilterMenu.Items.Add("筛选名称包含“" + fn + "”的字体").Tag = new FilterSetting(fn, false, 0); - } - } - fn = n.Substring(p + 1); - if (s > 0) { - _AddFilterMenu.Items.Add("筛选名称包含“" + fn + "”且尺寸为" + s.ToText() + "的字体").Tag = new FilterSetting(fn, false, s); - } - else { - _AddFilterMenu.Items.Add("筛选名称包含“" + fn + "”的字体").Tag = new FilterSetting(fn, false, 0); - } - } - else if (p == -1 && m != -1) { - fn = n.Substring(0, m); - if (s > 0) { - _AddFilterMenu.Items.Add("筛选名称包含“" + fn + "”且尺寸为" + s.ToText() + "的字体").Tag = new FilterSetting(fn, false, s); - } - else { - _AddFilterMenu.Items.Add("筛选名称包含“" + fn + "”的字体").Tag = new FilterSetting(fn, false, 0); - } - } - if (_AddFilterMenu.Items.Count > 0) { - _AddFilterMenu.Items.Add(new ToolStripSeparator()); - } - if (s > 0) { - _AddFilterMenu.Items.Add("筛选名称为“" + n + "”且尺寸为" + s.ToText() + "的字体").Tag = new FilterSetting(n, true, s); - } - else { - _AddFilterMenu.Items.Add("筛选名称为“" + n + "”的字体").Tag = new FilterSetting(n, true, 0); - } - e.Cancel = false; - } - - void _AddFilterMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { - var f = e.ClickedItem.Tag as FilterSetting; - if (f == null) { - return; - } - AutoBookmarkCondition fc = new AutoBookmarkCondition.FontNameCondition(f.FontName, f.FullMatch); - if (f.Size > 0) { - var m = new AutoBookmarkCondition.MultiCondition(fc); - m.Conditions.Add(new AutoBookmarkCondition.TextSizeCondition(f.Size)); - fc = m; - } - _FilterBox.AddObject(fc); - } - - void ControlEvent(object sender, EventArgs e) { - if (sender == _RemoveConditionButton) { - _FilterBox.RemoveObjects(_FilterBox.SelectedObjects); - } - else if (sender == _AddConditionButton) { - _AddFilterMenu.Show(_AddConditionButton, 0, _AddConditionButton.Height); - } - } - } -} diff --git a/pdfpatcher/App/Functions/AutoBookmark/FontFilterForm.resx b/pdfpatcher/App/Functions/AutoBookmark/FontFilterForm.resx deleted file mode 100644 index aecbf146ae251fd88464b8f6d8258ed42b2847a0..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmark/FontFilterForm.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 123, 17 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/AutoBookmark/FontNameConditionEditor.Designer.cs b/pdfpatcher/App/Functions/AutoBookmark/FontNameConditionEditor.Designer.cs deleted file mode 100644 index d293c117c959e5cce39ba0ae48bb5af85002c349..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmark/FontNameConditionEditor.Designer.cs +++ /dev/null @@ -1,83 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class FontNameConditionEditor - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.label1 = new System.Windows.Forms.Label (); - this._FontNameBox = new System.Windows.Forms.TextBox (); - this._FullMatchBox = new System.Windows.Forms.CheckBox (); - this.SuspendLayout (); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point (3, 9); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size (89, 12); - this.label1.TabIndex = 0; - this.label1.Text = "匹配字体名称:"; - // - // _FontNameBox - // - this._FontNameBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._FontNameBox.Location = new System.Drawing.Point (98, 6); - this._FontNameBox.Name = "_FontNameBox"; - this._FontNameBox.Size = new System.Drawing.Size (238, 21); - this._FontNameBox.TabIndex = 1; - this._FontNameBox.TextChanged += new System.EventHandler (this.ControlChanged); - // - // _FullMatchBox - // - this._FullMatchBox.AutoSize = true; - this._FullMatchBox.Location = new System.Drawing.Point (5, 33); - this._FullMatchBox.Name = "_FullMatchBox"; - this._FullMatchBox.Size = new System.Drawing.Size (120, 16); - this._FullMatchBox.TabIndex = 2; - this._FullMatchBox.Text = "完全匹配字体名称"; - this._FullMatchBox.UseVisualStyleBackColor = true; - this._FullMatchBox.CheckedChanged += new System.EventHandler (this.ControlChanged); - // - // FontNameFilterEditor - // - this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add (this._FullMatchBox); - this.Controls.Add (this._FontNameBox); - this.Controls.Add (this.label1); - this.Name = "FontNameFilterEditor"; - this.Size = new System.Drawing.Size (339, 80); - this.ResumeLayout (false); - this.PerformLayout (); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox _FontNameBox; - private System.Windows.Forms.CheckBox _FullMatchBox; - } -} diff --git a/pdfpatcher/App/Functions/AutoBookmark/FontNameConditionEditor.cs b/pdfpatcher/App/Functions/AutoBookmark/FontNameConditionEditor.cs deleted file mode 100644 index 4489431a8f9d2a2bb2506a4649aedfc6355430be..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmark/FontNameConditionEditor.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.ComponentModel; -using System.Windows.Forms; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - [ToolboxItem(false)] - sealed partial class FontNameConditionEditor : UserControl, IFilterConditionEditor - { - AutoBookmarkCondition.FontNameCondition _filter; - bool _lock; - - public FontNameConditionEditor() { - InitializeComponent(); - } - - #region ITextInfoFilterEditor 成员 - public UserControl EditorControl => this; - - public AutoBookmarkCondition Filter { - get => _filter; - set { - _filter = (AutoBookmarkCondition.FontNameCondition)value; - _lock = true; - _FontNameBox.Text = _filter.FontName; - _FullMatchBox.Checked = _filter.MatchFullName; - _lock = false; - } - } - - #endregion - - void ControlChanged(object sender, EventArgs e) { - if (_lock) { - return; - } - - if (sender == _FontNameBox) { - _filter.FontName = _FontNameBox.Text; - } - else if (sender == _FullMatchBox) { - _filter.MatchFullName = _FullMatchBox.Checked; - } - EditAdjustmentForm.UpdateFilter(this); - } - } -} diff --git a/pdfpatcher/App/Functions/AutoBookmark/FontNameConditionEditor.resx b/pdfpatcher/App/Functions/AutoBookmark/FontNameConditionEditor.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmark/FontNameConditionEditor.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/AutoBookmark/PageRangeConditionEditor.Designer.cs b/pdfpatcher/App/Functions/AutoBookmark/PageRangeConditionEditor.Designer.cs deleted file mode 100644 index 23176aca9e650e08aa11fdbc28856e4d43e6f592..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmark/PageRangeConditionEditor.Designer.cs +++ /dev/null @@ -1,71 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class PageRangeConditionEditor - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.label1 = new System.Windows.Forms.Label (); - this._PageRangeBox = new System.Windows.Forms.TextBox (); - this.SuspendLayout (); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point (3, 9); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size (89, 12); - this.label1.TabIndex = 0; - this.label1.Text = "匹配页码范围:"; - // - // _PageRangeBox - // - this._PageRangeBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._PageRangeBox.Location = new System.Drawing.Point (98, 6); - this._PageRangeBox.Name = "_PageRangeBox"; - this._PageRangeBox.Size = new System.Drawing.Size (237, 21); - this._PageRangeBox.TabIndex = 1; - this._PageRangeBox.TextChanged += new System.EventHandler (this.ControlChanged); - // - // PageNumberConditionEditor - // - this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add (this._PageRangeBox); - this.Controls.Add (this.label1); - this.Name = "PageNumberConditionEditor"; - this.Size = new System.Drawing.Size (338, 71); - this.ResumeLayout (false); - this.PerformLayout (); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox _PageRangeBox; - - - } -} diff --git a/pdfpatcher/App/Functions/AutoBookmark/PageRangeConditionEditor.cs b/pdfpatcher/App/Functions/AutoBookmark/PageRangeConditionEditor.cs deleted file mode 100644 index 9e7217aa300374f688e4e9b11a73307e72bb97fd..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmark/PageRangeConditionEditor.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Windows.Forms; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - sealed partial class PageRangeConditionEditor : UserControl, IFilterConditionEditor - { - AutoBookmarkCondition.PageRangeCondition _condition; - bool _lock; - - public PageRangeConditionEditor() { - InitializeComponent(); - } - - #region ITextInfoFilterEditor 成员 - - public AutoBookmarkCondition Filter { - get => _condition; - set { - _condition = (AutoBookmarkCondition.PageRangeCondition)value; - _lock = true; - _PageRangeBox.Text = _condition.PageRange; - _lock = false; - } - } - - public UserControl EditorControl => this; - - #endregion - - void ControlChanged(object sender, EventArgs e) { - if (_lock) { - return; - } - _condition.PageRange = _PageRangeBox.Text; - EditAdjustmentForm.UpdateFilter(this); - } - } -} diff --git a/pdfpatcher/App/Functions/AutoBookmark/PageRangeConditionEditor.resx b/pdfpatcher/App/Functions/AutoBookmark/PageRangeConditionEditor.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmark/PageRangeConditionEditor.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/AutoBookmark/TextConditionEditor.Designer.cs b/pdfpatcher/App/Functions/AutoBookmark/TextConditionEditor.Designer.cs deleted file mode 100644 index e74bbedca784aa02cc3f7246a36e5f68b1954e20..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmark/TextConditionEditor.Designer.cs +++ /dev/null @@ -1,111 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class TextConditionEditor - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.label1 = new System.Windows.Forms.Label (); - this._PatternBox = new System.Windows.Forms.TextBox (); - this._FullMatchBox = new System.Windows.Forms.CheckBox (); - this._MatchCaseBox = new System.Windows.Forms.CheckBox (); - this._UseRegexBox = new System.Windows.Forms.CheckBox (); - this.SuspendLayout (); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point (3, 9); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size (89, 12); - this.label1.TabIndex = 0; - this.label1.Text = "匹配文本内容:"; - // - // _PatternBox - // - this._PatternBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._PatternBox.Location = new System.Drawing.Point (98, 6); - this._PatternBox.Name = "_PatternBox"; - this._PatternBox.Size = new System.Drawing.Size (238, 21); - this._PatternBox.TabIndex = 1; - this._PatternBox.TextChanged += new System.EventHandler (this.ControlChanged); - // - // _FullMatchBox - // - this._FullMatchBox.AutoSize = true; - this._FullMatchBox.Location = new System.Drawing.Point (5, 33); - this._FullMatchBox.Name = "_FullMatchBox"; - this._FullMatchBox.Size = new System.Drawing.Size (72, 16); - this._FullMatchBox.TabIndex = 2; - this._FullMatchBox.Text = "完全匹配"; - this._FullMatchBox.UseVisualStyleBackColor = true; - this._FullMatchBox.CheckedChanged += new System.EventHandler (this.ControlChanged); - // - // _MatchCaseBox - // - this._MatchCaseBox.AutoSize = true; - this._MatchCaseBox.Location = new System.Drawing.Point (98, 33); - this._MatchCaseBox.Name = "_MatchCaseBox"; - this._MatchCaseBox.Size = new System.Drawing.Size (108, 16); - this._MatchCaseBox.TabIndex = 3; - this._MatchCaseBox.Text = "匹配英文大小写"; - this._MatchCaseBox.UseVisualStyleBackColor = true; - this._MatchCaseBox.CheckedChanged += new System.EventHandler (this.ControlChanged); - // - // _UseRegexBox - // - this._UseRegexBox.AutoSize = true; - this._UseRegexBox.Location = new System.Drawing.Point (212, 33); - this._UseRegexBox.Name = "_UseRegexBox"; - this._UseRegexBox.Size = new System.Drawing.Size (108, 16); - this._UseRegexBox.TabIndex = 4; - this._UseRegexBox.Text = "使用正则表达式"; - this._UseRegexBox.UseVisualStyleBackColor = true; - this._UseRegexBox.CheckedChanged += new System.EventHandler (this.ControlChanged); - // - // TextConditionEditor - // - this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add (this._UseRegexBox); - this.Controls.Add (this._MatchCaseBox); - this.Controls.Add (this._FullMatchBox); - this.Controls.Add (this._PatternBox); - this.Controls.Add (this.label1); - this.Name = "TextConditionEditor"; - this.Size = new System.Drawing.Size (339, 80); - this.ResumeLayout (false); - this.PerformLayout (); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox _PatternBox; - private System.Windows.Forms.CheckBox _FullMatchBox; - private System.Windows.Forms.CheckBox _MatchCaseBox; - private System.Windows.Forms.CheckBox _UseRegexBox; - } -} diff --git a/pdfpatcher/App/Functions/AutoBookmark/TextConditionEditor.cs b/pdfpatcher/App/Functions/AutoBookmark/TextConditionEditor.cs deleted file mode 100644 index 0e07173831f355ed220028d102c8215a1f5a1226..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmark/TextConditionEditor.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.ComponentModel; -using System.Windows.Forms; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - [ToolboxItem(false)] - sealed partial class TextConditionEditor : UserControl, IFilterConditionEditor - { - AutoBookmarkCondition.TextCondition _filter; - bool _lock; - - public TextConditionEditor() { - InitializeComponent(); - } - - #region ITextInfoFilterEditor 成员 - public UserControl EditorControl => this; - - public AutoBookmarkCondition Filter { - get => _filter; - set { - _filter = (AutoBookmarkCondition.TextCondition)value; - _lock = true; - _PatternBox.Text = _filter.Pattern.Text; - _FullMatchBox.Checked = _filter.Pattern.FullMatch; - _MatchCaseBox.Checked = _filter.Pattern.MatchCase; - _UseRegexBox.Checked = _filter.Pattern.UseRegularExpression; - _lock = false; - } - } - - #endregion - - void ControlChanged(object sender, EventArgs e) { - if (_lock) { - return; - } - - if (sender == _PatternBox) { - _filter.Pattern.Text = _PatternBox.Text; - } - else if (sender == _FullMatchBox) { - _filter.Pattern.FullMatch = _FullMatchBox.Checked; - } - else if (sender == _MatchCaseBox) { - _filter.Pattern.MatchCase = _MatchCaseBox.Checked; - } - else if (sender == _UseRegexBox) { - _filter.Pattern.UseRegularExpression = _UseRegexBox.Checked; - } - EditAdjustmentForm.UpdateFilter(this); - } - } -} diff --git a/pdfpatcher/App/Functions/AutoBookmark/TextConditionEditor.resx b/pdfpatcher/App/Functions/AutoBookmark/TextConditionEditor.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmark/TextConditionEditor.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/AutoBookmark/TextPositionConditionEditor.Designer.cs b/pdfpatcher/App/Functions/AutoBookmark/TextPositionConditionEditor.Designer.cs deleted file mode 100644 index 1908d7995d77a20c6f46a215805e48ee8321bad9..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmark/TextPositionConditionEditor.Designer.cs +++ /dev/null @@ -1,204 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class TextPositionConditionEditor - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.panel2 = new System.Windows.Forms.Panel (); - this.label2 = new System.Windows.Forms.Label (); - this._PositionBox = new System.Windows.Forms.ComboBox (); - this._RangeBox = new System.Windows.Forms.RadioButton (); - this._SpecificValueBox = new System.Windows.Forms.NumericUpDown (); - this._SpecificBox = new System.Windows.Forms.RadioButton (); - this._MinBox = new System.Windows.Forms.NumericUpDown (); - this.label1 = new System.Windows.Forms.Label (); - this._MaxBox = new System.Windows.Forms.NumericUpDown (); - this.panel2.SuspendLayout (); - ((System.ComponentModel.ISupportInitialize)(this._SpecificValueBox)).BeginInit (); - ((System.ComponentModel.ISupportInitialize)(this._MinBox)).BeginInit (); - ((System.ComponentModel.ISupportInitialize)(this._MaxBox)).BeginInit (); - this.SuspendLayout (); - // - // panel2 - // - this.panel2.Controls.Add (this.label2); - this.panel2.Controls.Add (this._PositionBox); - this.panel2.Controls.Add (this._RangeBox); - this.panel2.Controls.Add (this._SpecificValueBox); - this.panel2.Controls.Add (this._SpecificBox); - this.panel2.Controls.Add (this._MinBox); - this.panel2.Controls.Add (this.label1); - this.panel2.Controls.Add (this._MaxBox); - this.panel2.Location = new System.Drawing.Point (3, 0); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size (377, 88); - this.panel2.TabIndex = 5; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point (21, 6); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size (101, 12); - this.label2.TabIndex = 5; - this.label2.Text = "匹配文本块的坐标"; - // - // _PositionBox - // - this._PositionBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._PositionBox.FormattingEnabled = true; - this._PositionBox.Items.AddRange (new object[] { - "上坐标", - "下坐标", - "左坐标", - "右坐标"}); - this._PositionBox.Location = new System.Drawing.Point (135, 3); - this._PositionBox.Name = "_PositionBox"; - this._PositionBox.Size = new System.Drawing.Size (121, 20); - this._PositionBox.TabIndex = 4; - this._PositionBox.SelectedIndexChanged += new System.EventHandler (this.ControlChanged); - // - // _RangeBox - // - this._RangeBox.AutoSize = true; - this._RangeBox.Location = new System.Drawing.Point (23, 56); - this._RangeBox.Name = "_RangeBox"; - this._RangeBox.Size = new System.Drawing.Size (95, 16); - this._RangeBox.TabIndex = 3; - this._RangeBox.TabStop = true; - this._RangeBox.Text = "匹配坐标范围"; - this._RangeBox.UseVisualStyleBackColor = true; - this._RangeBox.CheckedChanged += new System.EventHandler (this.ControlChanged); - // - // _SpecificValueBox - // - this._SpecificValueBox.DecimalPlaces = 2; - this._SpecificValueBox.Location = new System.Drawing.Point (135, 29); - this._SpecificValueBox.Maximum = new decimal (new int[] { - 9999, - 0, - 0, - 0}); - this._SpecificValueBox.Minimum = new decimal (new int[] { - 9999, - 0, - 0, - -2147483648}); - this._SpecificValueBox.Name = "_SpecificValueBox"; - this._SpecificValueBox.Size = new System.Drawing.Size (67, 21); - this._SpecificValueBox.TabIndex = 1; - this._SpecificValueBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._SpecificValueBox.ValueChanged += new System.EventHandler (this.ControlChanged); - // - // _SpecificBox - // - this._SpecificBox.AutoSize = true; - this._SpecificBox.Location = new System.Drawing.Point (23, 29); - this._SpecificBox.Name = "_SpecificBox"; - this._SpecificBox.Size = new System.Drawing.Size (107, 16); - this._SpecificBox.TabIndex = 3; - this._SpecificBox.TabStop = true; - this._SpecificBox.Text = "匹配特定坐标值"; - this._SpecificBox.UseVisualStyleBackColor = true; - this._SpecificBox.CheckedChanged += new System.EventHandler (this.ControlChanged); - // - // _MinBox - // - this._MinBox.DecimalPlaces = 2; - this._MinBox.Location = new System.Drawing.Point (135, 56); - this._MinBox.Maximum = new decimal (new int[] { - 9999, - 0, - 0, - 0}); - this._MinBox.Minimum = new decimal (new int[] { - 9999, - 0, - 0, - -2147483648}); - this._MinBox.Name = "_MinBox"; - this._MinBox.Size = new System.Drawing.Size (67, 21); - this._MinBox.TabIndex = 1; - this._MinBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._MinBox.ValueChanged += new System.EventHandler (this.ControlChanged); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point (208, 58); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size (17, 12); - this.label1.TabIndex = 2; - this.label1.Text = "到"; - // - // _MaxBox - // - this._MaxBox.DecimalPlaces = 2; - this._MaxBox.Location = new System.Drawing.Point (231, 56); - this._MaxBox.Maximum = new decimal (new int[] { - 9999, - 0, - 0, - 0}); - this._MaxBox.Minimum = new decimal (new int[] { - 9999, - 0, - 0, - -2147483648}); - this._MaxBox.Name = "_MaxBox"; - this._MaxBox.Size = new System.Drawing.Size (67, 21); - this._MaxBox.TabIndex = 1; - this._MaxBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._MaxBox.ValueChanged += new System.EventHandler (this.ControlChanged); - // - // TextPositionConditionEditor - // - this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add (this.panel2); - this.Name = "TextPositionConditionEditor"; - this.Size = new System.Drawing.Size (383, 88); - this.panel2.ResumeLayout (false); - this.panel2.PerformLayout (); - ((System.ComponentModel.ISupportInitialize)(this._SpecificValueBox)).EndInit (); - ((System.ComponentModel.ISupportInitialize)(this._MinBox)).EndInit (); - ((System.ComponentModel.ISupportInitialize)(this._MaxBox)).EndInit (); - this.ResumeLayout (false); - - } - - #endregion - - private System.Windows.Forms.Panel panel2; - private System.Windows.Forms.RadioButton _RangeBox; - private System.Windows.Forms.NumericUpDown _SpecificValueBox; - private System.Windows.Forms.RadioButton _SpecificBox; - private System.Windows.Forms.NumericUpDown _MinBox; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.NumericUpDown _MaxBox; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.ComboBox _PositionBox; - - } -} diff --git a/pdfpatcher/App/Functions/AutoBookmark/TextPositionConditionEditor.cs b/pdfpatcher/App/Functions/AutoBookmark/TextPositionConditionEditor.cs deleted file mode 100644 index 012d0285248fbcad40ee08f8475ccfa1ed0147b7..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmark/TextPositionConditionEditor.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Windows.Forms; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - sealed partial class TextPositionConditionEditor : UserControl, IFilterConditionEditor - { - AutoBookmarkCondition.TextPositionCondition _condition; - bool _lock; - - public TextPositionConditionEditor() { - InitializeComponent(); - _lock = true; - _PositionBox.SelectedIndex = 0; - _lock = false; - } - - #region ITextInfoFilterEditor 成员 - - public AutoBookmarkCondition Filter { - get => _condition; - set { - _condition = (AutoBookmarkCondition.TextPositionCondition)value; - _lock = true; - _PositionBox.SelectedIndex = _condition.Position - 1; - if (_condition.MinValue == _condition.MaxValue) { - _SpecificBox.Checked = true; - _SpecificValueBox.Value = (decimal)_condition.MaxValue; - } - else { - _RangeBox.Checked = true; - _MaxBox.Value = (decimal)_condition.MaxValue; - _MinBox.Value = (decimal)_condition.MinValue; - } - ToggleControlState(); - _lock = false; - } - } - - public UserControl EditorControl => this; - - #endregion - - void ControlChanged(object sender, EventArgs e) { - ToggleControlState(); - if (_lock) { - return; - } - float min, max; - if (_SpecificBox.Checked) { - min = max = (float)_SpecificValueBox.Value; - } - else /*if (_YRangeBox.Checked)*/ { - min = (float)_MinBox.Value; - max = (float)_MaxBox.Value; - } - _condition.SetRange((byte)(_PositionBox.SelectedIndex + 1), min, max); - EditAdjustmentForm.UpdateFilter(this); - } - - void ToggleControlState() { - _MinBox.Enabled = _MaxBox.Enabled = _RangeBox.Checked; - _SpecificValueBox.Enabled = _SpecificBox.Checked; - } - } -} diff --git a/pdfpatcher/App/Functions/AutoBookmark/TextPositionConditionEditor.resx b/pdfpatcher/App/Functions/AutoBookmark/TextPositionConditionEditor.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmark/TextPositionConditionEditor.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/AutoBookmark/TextSizeConditionEditor.Designer.cs b/pdfpatcher/App/Functions/AutoBookmark/TextSizeConditionEditor.Designer.cs deleted file mode 100644 index 2ac566693bcc818b4978d6a5132d968959bdb80a..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmark/TextSizeConditionEditor.Designer.cs +++ /dev/null @@ -1,147 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class TextSizeConditionEditor - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._MinSizeBox = new System.Windows.Forms.NumericUpDown (); - this._MaxSizeBox = new System.Windows.Forms.NumericUpDown (); - this.label2 = new System.Windows.Forms.Label (); - this._SizeBox = new System.Windows.Forms.RadioButton (); - this._SpecificSizeBox = new System.Windows.Forms.NumericUpDown (); - this._SizeRangeBox = new System.Windows.Forms.RadioButton (); - ((System.ComponentModel.ISupportInitialize)(this._MinSizeBox)).BeginInit (); - ((System.ComponentModel.ISupportInitialize)(this._MaxSizeBox)).BeginInit (); - ((System.ComponentModel.ISupportInitialize)(this._SpecificSizeBox)).BeginInit (); - this.SuspendLayout (); - // - // _MinSizeBox - // - this._MinSizeBox.DecimalPlaces = 2; - this._MinSizeBox.Location = new System.Drawing.Point (128, 30); - this._MinSizeBox.Maximum = new decimal (new int[] { - 9999, - 0, - 0, - 0}); - this._MinSizeBox.Name = "_MinSizeBox"; - this._MinSizeBox.Size = new System.Drawing.Size (67, 21); - this._MinSizeBox.TabIndex = 1; - this._MinSizeBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._MinSizeBox.ValueChanged += new System.EventHandler (this.ControlChanged); - // - // _MaxSizeBox - // - this._MaxSizeBox.DecimalPlaces = 2; - this._MaxSizeBox.Location = new System.Drawing.Point (224, 30); - this._MaxSizeBox.Maximum = new decimal (new int[] { - 9999, - 0, - 0, - 0}); - this._MaxSizeBox.Name = "_MaxSizeBox"; - this._MaxSizeBox.Size = new System.Drawing.Size (67, 21); - this._MaxSizeBox.TabIndex = 1; - this._MaxSizeBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._MaxSizeBox.ValueChanged += new System.EventHandler (this.ControlChanged); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point (201, 32); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size (17, 12); - this.label2.TabIndex = 2; - this.label2.Text = "到"; - // - // _SizeBox - // - this._SizeBox.AutoSize = true; - this._SizeBox.Location = new System.Drawing.Point (3, 3); - this._SizeBox.Name = "_SizeBox"; - this._SizeBox.Size = new System.Drawing.Size (119, 16); - this._SizeBox.TabIndex = 3; - this._SizeBox.TabStop = true; - this._SizeBox.Text = "匹配特定文本尺寸"; - this._SizeBox.UseVisualStyleBackColor = true; - this._SizeBox.CheckedChanged += new System.EventHandler (this.ControlChanged); - // - // _SpecificSizeBox - // - this._SpecificSizeBox.DecimalPlaces = 2; - this._SpecificSizeBox.Location = new System.Drawing.Point (128, 3); - this._SpecificSizeBox.Maximum = new decimal (new int[] { - 9999, - 0, - 0, - 0}); - this._SpecificSizeBox.Name = "_SpecificSizeBox"; - this._SpecificSizeBox.Size = new System.Drawing.Size (67, 21); - this._SpecificSizeBox.TabIndex = 1; - this._SpecificSizeBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._SpecificSizeBox.ValueChanged += new System.EventHandler (this.ControlChanged); - // - // _SizeRangeBox - // - this._SizeRangeBox.AutoSize = true; - this._SizeRangeBox.Location = new System.Drawing.Point (3, 30); - this._SizeRangeBox.Name = "_SizeRangeBox"; - this._SizeRangeBox.Size = new System.Drawing.Size (119, 16); - this._SizeRangeBox.TabIndex = 3; - this._SizeRangeBox.TabStop = true; - this._SizeRangeBox.Text = "匹配文本尺寸范围"; - this._SizeRangeBox.UseVisualStyleBackColor = true; - this._SizeRangeBox.CheckedChanged += new System.EventHandler (this.ControlChanged); - // - // FontSizeFilterEditor - // - this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add (this._SizeRangeBox); - this.Controls.Add (this._SizeBox); - this.Controls.Add (this.label2); - this.Controls.Add (this._MaxSizeBox); - this.Controls.Add (this._SpecificSizeBox); - this.Controls.Add (this._MinSizeBox); - this.Name = "FontSizeFilterEditor"; - this.Size = new System.Drawing.Size (338, 71); - ((System.ComponentModel.ISupportInitialize)(this._MinSizeBox)).EndInit (); - ((System.ComponentModel.ISupportInitialize)(this._MaxSizeBox)).EndInit (); - ((System.ComponentModel.ISupportInitialize)(this._SpecificSizeBox)).EndInit (); - this.ResumeLayout (false); - this.PerformLayout (); - - } - - #endregion - - private System.Windows.Forms.NumericUpDown _MinSizeBox; - private System.Windows.Forms.NumericUpDown _MaxSizeBox; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.RadioButton _SizeBox; - private System.Windows.Forms.NumericUpDown _SpecificSizeBox; - private System.Windows.Forms.RadioButton _SizeRangeBox; - - } -} diff --git a/pdfpatcher/App/Functions/AutoBookmark/TextSizeConditionEditor.cs b/pdfpatcher/App/Functions/AutoBookmark/TextSizeConditionEditor.cs deleted file mode 100644 index ffa9e71ee3584f12762be9c4560e98c63e545b61..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmark/TextSizeConditionEditor.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.Windows.Forms; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - sealed partial class TextSizeConditionEditor : UserControl, IFilterConditionEditor - { - AutoBookmarkCondition.TextSizeCondition _condition; - bool _lock; - - public TextSizeConditionEditor() { - InitializeComponent(); - } - - #region ITextInfoFilterEditor 成员 - - public AutoBookmarkCondition Filter { - get => _condition; - set { - _condition = (AutoBookmarkCondition.TextSizeCondition)value; - _lock = true; - if (_condition.MinSize == _condition.MaxSize) { - _SizeBox.Checked = true; - _SpecificSizeBox.Value = (decimal)_condition.MaxSize; - } - else { - _SizeRangeBox.Checked = true; - _MaxSizeBox.Value = (decimal)_condition.MaxSize; - _MinSizeBox.Value = (decimal)_condition.MinSize; - } - ToggleControlState(); - _lock = false; - } - } - - public UserControl EditorControl => this; - - #endregion - - void ControlChanged(object sender, EventArgs e) { - ToggleControlState(); - if (_lock) { - return; - } - if (_SizeBox.Checked) { - _condition.SetRange((float)_SpecificSizeBox.Value, (float)_SpecificSizeBox.Value); - } - else if (_SizeRangeBox.Checked) { - _condition.SetRange((float)_MinSizeBox.Value, (float)_MaxSizeBox.Value); - } - EditAdjustmentForm.UpdateFilter(this); - } - - void ToggleControlState() { - _MinSizeBox.Enabled = _MaxSizeBox.Enabled = _SizeRangeBox.Checked; - _SpecificSizeBox.Enabled = _SizeBox.Checked; - } - } -} diff --git a/pdfpatcher/App/Functions/AutoBookmark/TextSizeConditionEditor.resx b/pdfpatcher/App/Functions/AutoBookmark/TextSizeConditionEditor.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmark/TextSizeConditionEditor.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/AutoBookmarkControl.Designer.cs b/pdfpatcher/App/Functions/AutoBookmarkControl.Designer.cs deleted file mode 100644 index b1b2680c20dbd710394c864af6ca78d5217d0812..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmarkControl.Designer.cs +++ /dev/null @@ -1,851 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class AutoBookmarkControl - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.components = new System.ComponentModel.Container(); - System.Windows.Forms.ToolStripDropDownButton _AddAdjustmentButton; - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - this._AddFilterMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._TitleSizeThresholdBox = new System.Windows.Forms.NumericUpDown(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this._PageRangeBox = new System.Windows.Forms.TextBox(); - this._MergeAdjacentTitlesBox = new System.Windows.Forms.CheckBox(); - this._MergeDifferentSizeTitlesBox = new System.Windows.Forms.CheckBox(); - this.tabControl1 = new System.Windows.Forms.TabControl(); - this.tabPage1 = new System.Windows.Forms.TabPage(); - this._FirstLineAsTitleBox = new System.Windows.Forms.CheckBox(); - this._IgnoreOverlappedTextBox = new System.Windows.Forms.CheckBox(); - this._CreateBookmarkForFirstPageBox = new System.Windows.Forms.CheckBox(); - this.label6 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this._WritingDirectionBox = new System.Windows.Forms.ComboBox(); - this._AutoHierarchicalArrangementBox = new System.Windows.Forms.CheckBox(); - this.label11 = new System.Windows.Forms.Label(); - this._MaxDistanceBetweenLinesBox = new System.Windows.Forms.NumericUpDown(); - this._GoToPageTopLevelBox = new System.Windows.Forms.NumericUpDown(); - this.label7 = new System.Windows.Forms.Label(); - this.label9 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this._YOffsetBox = new System.Windows.Forms.NumericUpDown(); - this._MergeDifferentFontTitlesBox = new System.Windows.Forms.CheckBox(); - this.tabPage2 = new System.Windows.Forms.TabPage(); - this._IgnoreNumericTitleBox = new System.Windows.Forms.CheckBox(); - this._IgnoreSingleCharacterTitleBox = new System.Windows.Forms.CheckBox(); - this._ClearTextFiltersButton = new System.Windows.Forms.Button(); - this._IgnorePatternsBox = new System.Windows.Forms.DataGridView(); - this._PatternColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this._MatchCaseColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this._FullMatchColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this._PatternTypeColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this._RemovePatternColumn = new System.Windows.Forms.DataGridViewLinkColumn(); - this.label10 = new System.Windows.Forms.Label(); - this.tabPage3 = new System.Windows.Forms.TabPage(); - this._FilterToolbar = new System.Windows.Forms.ToolStrip(); - this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel(); - this._AddFilterFromInfoFileButton = new System.Windows.Forms.ToolStripButton(); - this._DeleteAdjustmentButton = new System.Windows.Forms.ToolStripButton(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this._CopyFilterButton = new System.Windows.Forms.ToolStripButton(); - this._PasteButton = new System.Windows.Forms.ToolStripButton(); - this._LevelAdjustmentBox = new BrightIdeasSoftware.ObjectListView(); - this._AdvancedFilterColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._AdjustmentLevelColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._RelativeAdjustmentColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._FilterBeforeMergeColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this.label12 = new System.Windows.Forms.Label(); - this.tabPage5 = new System.Windows.Forms.TabPage(); - this._ExportTextCoordinateBox = new System.Windows.Forms.CheckBox(); - this._ShowAllFontsBox = new System.Windows.Forms.CheckBox(); - this._DisplayFontStatisticsBox = new System.Windows.Forms.CheckBox(); - this._BookmarkControl = new PDFPatcher.BookmarkControl(); - this._SourceFileControl = new PDFPatcher.SourceFileControl(); - this._ExportBookmarkButton = new EnhancedGlassButton.GlassButton(); - _AddAdjustmentButton = new System.Windows.Forms.ToolStripDropDownButton(); - ((System.ComponentModel.ISupportInitialize)(this._TitleSizeThresholdBox)).BeginInit(); - this.tabControl1.SuspendLayout(); - this.tabPage1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._MaxDistanceBetweenLinesBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this._GoToPageTopLevelBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this._YOffsetBox)).BeginInit(); - this.tabPage2.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._IgnorePatternsBox)).BeginInit(); - this.tabPage3.SuspendLayout(); - this._FilterToolbar.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._LevelAdjustmentBox)).BeginInit(); - this.tabPage5.SuspendLayout(); - this.SuspendLayout(); - // - // _AddAdjustmentButton - // - _AddAdjustmentButton.DropDown = this._AddFilterMenu; - _AddAdjustmentButton.Image = global::PDFPatcher.Properties.Resources.Add; - _AddAdjustmentButton.ImageTransparentColor = System.Drawing.Color.Magenta; - _AddAdjustmentButton.Name = "_AddAdjustmentButton"; - _AddAdjustmentButton.Size = new System.Drawing.Size(61, 22); - _AddAdjustmentButton.Text = "添加"; - // - // _AddFilterMenu - // - this._AddFilterMenu.Name = "_AddFilterMenu"; - this._AddFilterMenu.Size = new System.Drawing.Size(61, 4); - this._AddFilterMenu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._AddFilterMenu_ItemClicked); - // - // _TitleSizeThresholdBox - // - this._TitleSizeThresholdBox.DecimalPlaces = 2; - this._TitleSizeThresholdBox.Location = new System.Drawing.Point(98, 36); - this._TitleSizeThresholdBox.Maximum = new decimal(new int[] { - 9999, - 0, - 0, - 0}); - this._TitleSizeThresholdBox.Name = "_TitleSizeThresholdBox"; - this._TitleSizeThresholdBox.Size = new System.Drawing.Size(68, 21); - this._TitleSizeThresholdBox.TabIndex = 3; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(3, 38); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(89, 12); - this.label2.TabIndex = 2; - this.label2.Text = "标题文本尺寸:"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(3, 12); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(89, 12); - this.label3.TabIndex = 0; - this.label3.Text = "识别页码范围:"; - // - // _PageRangeBox - // - this._PageRangeBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._PageRangeBox.Location = new System.Drawing.Point(98, 9); - this._PageRangeBox.Name = "_PageRangeBox"; - this._PageRangeBox.Size = new System.Drawing.Size(321, 21); - this._PageRangeBox.TabIndex = 1; - // - // _MergeAdjacentTitlesBox - // - this._MergeAdjacentTitlesBox.AutoSize = true; - this._MergeAdjacentTitlesBox.Location = new System.Drawing.Point(6, 84); - this._MergeAdjacentTitlesBox.Name = "_MergeAdjacentTitlesBox"; - this._MergeAdjacentTitlesBox.Size = new System.Drawing.Size(132, 16); - this._MergeAdjacentTitlesBox.TabIndex = 10; - this._MergeAdjacentTitlesBox.Text = "合并连续出现的标题"; - this._MergeAdjacentTitlesBox.UseVisualStyleBackColor = true; - // - // _MergeDifferentSizeTitlesBox - // - this._MergeDifferentSizeTitlesBox.AutoSize = true; - this._MergeDifferentSizeTitlesBox.Location = new System.Drawing.Point(6, 105); - this._MergeDifferentSizeTitlesBox.Name = "_MergeDifferentSizeTitlesBox"; - this._MergeDifferentSizeTitlesBox.Size = new System.Drawing.Size(156, 16); - this._MergeDifferentSizeTitlesBox.TabIndex = 14; - this._MergeDifferentSizeTitlesBox.Text = "合并不同文本尺寸的标题"; - this._MergeDifferentSizeTitlesBox.UseVisualStyleBackColor = true; - // - // tabControl1 - // - this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tabControl1.Controls.Add(this.tabPage1); - this.tabControl1.Controls.Add(this.tabPage2); - this.tabControl1.Controls.Add(this.tabPage3); - this.tabControl1.Controls.Add(this.tabPage5); - this.tabControl1.Location = new System.Drawing.Point(12, 93); - this.tabControl1.Name = "tabControl1"; - this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(463, 229); - this.tabControl1.TabIndex = 4; - // - // tabPage1 - // - this.tabPage1.Controls.Add(this._FirstLineAsTitleBox); - this.tabPage1.Controls.Add(this._IgnoreOverlappedTextBox); - this.tabPage1.Controls.Add(this._CreateBookmarkForFirstPageBox); - this.tabPage1.Controls.Add(this.label6); - this.tabPage1.Controls.Add(this.label5); - this.tabPage1.Controls.Add(this._WritingDirectionBox); - this.tabPage1.Controls.Add(this._AutoHierarchicalArrangementBox); - this.tabPage1.Controls.Add(this.label11); - this.tabPage1.Controls.Add(this._MaxDistanceBetweenLinesBox); - this.tabPage1.Controls.Add(this._GoToPageTopLevelBox); - this.tabPage1.Controls.Add(this.label7); - this.tabPage1.Controls.Add(this.label9); - this.tabPage1.Controls.Add(this.label4); - this.tabPage1.Controls.Add(this._YOffsetBox); - this.tabPage1.Controls.Add(this._MergeDifferentFontTitlesBox); - this.tabPage1.Controls.Add(this._MergeDifferentSizeTitlesBox); - this.tabPage1.Controls.Add(this.label3); - this.tabPage1.Controls.Add(this._TitleSizeThresholdBox); - this.tabPage1.Controls.Add(this.label2); - this.tabPage1.Controls.Add(this._MergeAdjacentTitlesBox); - this.tabPage1.Controls.Add(this._PageRangeBox); - this.tabPage1.Location = new System.Drawing.Point(4, 22); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); - this.tabPage1.Size = new System.Drawing.Size(455, 203); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "标题识别"; - this.tabPage1.UseVisualStyleBackColor = true; - // - // _FirstLineAsTitleBox - // - this._FirstLineAsTitleBox.AutoSize = true; - this._FirstLineAsTitleBox.Location = new System.Drawing.Point(6, 170); - this._FirstLineAsTitleBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); - this._FirstLineAsTitleBox.Name = "_FirstLineAsTitleBox"; - this._FirstLineAsTitleBox.Size = new System.Drawing.Size(168, 16); - this._FirstLineAsTitleBox.TabIndex = 20; - this._FirstLineAsTitleBox.Text = "将每页第一行文本作为标题"; - this._FirstLineAsTitleBox.UseVisualStyleBackColor = true; - // - // _IgnoreOverlappedTextBox - // - this._IgnoreOverlappedTextBox.AutoSize = true; - this._IgnoreOverlappedTextBox.Location = new System.Drawing.Point(6, 149); - this._IgnoreOverlappedTextBox.Name = "_IgnoreOverlappedTextBox"; - this._IgnoreOverlappedTextBox.Size = new System.Drawing.Size(108, 16); - this._IgnoreOverlappedTextBox.TabIndex = 18; - this._IgnoreOverlappedTextBox.Text = "忽略重叠的文本"; - this._IgnoreOverlappedTextBox.UseVisualStyleBackColor = true; - // - // _CreateBookmarkForFirstPageBox - // - this._CreateBookmarkForFirstPageBox.AutoSize = true; - this._CreateBookmarkForFirstPageBox.Location = new System.Drawing.Point(200, 143); - this._CreateBookmarkForFirstPageBox.Name = "_CreateBookmarkForFirstPageBox"; - this._CreateBookmarkForFirstPageBox.Size = new System.Drawing.Size(132, 16); - this._CreateBookmarkForFirstPageBox.TabIndex = 19; - this._CreateBookmarkForFirstPageBox.Text = "文件名作为首页书签"; - this._CreateBookmarkForFirstPageBox.UseVisualStyleBackColor = true; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(198, 91); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(113, 12); - this.label6.TabIndex = 11; - this.label6.Text = "合并连续标题不大于"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(198, 66); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(89, 12); - this.label5.TabIndex = 8; - this.label5.Text = "文字排版方向:"; - // - // _WritingDirectionBox - // - this._WritingDirectionBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._WritingDirectionBox.FormattingEnabled = true; - this._WritingDirectionBox.Items.AddRange(new object[] { - "自动检测", - "横向", - "纵向"}); - this._WritingDirectionBox.Location = new System.Drawing.Point(293, 63); - this._WritingDirectionBox.Name = "_WritingDirectionBox"; - this._WritingDirectionBox.Size = new System.Drawing.Size(76, 20); - this._WritingDirectionBox.TabIndex = 9; - // - // _AutoHierarchicalArrangementBox - // - this._AutoHierarchicalArrangementBox.AutoSize = true; - this._AutoHierarchicalArrangementBox.Location = new System.Drawing.Point(6, 63); - this._AutoHierarchicalArrangementBox.Name = "_AutoHierarchicalArrangementBox"; - this._AutoHierarchicalArrangementBox.Size = new System.Drawing.Size(120, 16); - this._AutoHierarchicalArrangementBox.TabIndex = 7; - this._AutoHierarchicalArrangementBox.Text = "自动组织标题层次"; - this._AutoHierarchicalArrangementBox.UseVisualStyleBackColor = true; - // - // label11 - // - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(250, 118); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(101, 12); - this.label11.TabIndex = 17; - this.label11.Text = "层标题定位到页首"; - // - // _MaxDistanceBetweenLinesBox - // - this._MaxDistanceBetweenLinesBox.DecimalPlaces = 2; - this._MaxDistanceBetweenLinesBox.Location = new System.Drawing.Point(317, 89); - this._MaxDistanceBetweenLinesBox.Maximum = new decimal(new int[] { - 9, - 0, - 0, - 0}); - this._MaxDistanceBetweenLinesBox.Name = "_MaxDistanceBetweenLinesBox"; - this._MaxDistanceBetweenLinesBox.Size = new System.Drawing.Size(55, 21); - this._MaxDistanceBetweenLinesBox.TabIndex = 12; - // - // _GoToPageTopLevelBox - // - this._GoToPageTopLevelBox.Location = new System.Drawing.Point(200, 116); - this._GoToPageTopLevelBox.Maximum = new decimal(new int[] { - 9, - 0, - 0, - 0}); - this._GoToPageTopLevelBox.Name = "_GoToPageTopLevelBox"; - this._GoToPageTopLevelBox.Size = new System.Drawing.Size(41, 21); - this._GoToPageTopLevelBox.TabIndex = 16; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(378, 91); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(41, 12); - this.label7.TabIndex = 13; - this.label7.Text = "倍行距"; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(359, 38); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(41, 12); - this.label9.TabIndex = 6; - this.label9.Text = "倍行距"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(174, 38); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(113, 12); - this.label4.TabIndex = 4; - this.label4.Text = "定位位置向上偏移:"; - // - // _YOffsetBox - // - this._YOffsetBox.DecimalPlaces = 2; - this._YOffsetBox.Increment = new decimal(new int[] { - 1, - 0, - 0, - 65536}); - this._YOffsetBox.Location = new System.Drawing.Point(293, 36); - this._YOffsetBox.Maximum = new decimal(new int[] { - 10, - 0, - 0, - 0}); - this._YOffsetBox.Minimum = new decimal(new int[] { - 10, - 0, - 0, - -2147483648}); - this._YOffsetBox.Name = "_YOffsetBox"; - this._YOffsetBox.Size = new System.Drawing.Size(60, 21); - this._YOffsetBox.TabIndex = 5; - // - // _MergeDifferentFontTitlesBox - // - this._MergeDifferentFontTitlesBox.AutoSize = true; - this._MergeDifferentFontTitlesBox.Location = new System.Drawing.Point(6, 127); - this._MergeDifferentFontTitlesBox.Name = "_MergeDifferentFontTitlesBox"; - this._MergeDifferentFontTitlesBox.Size = new System.Drawing.Size(132, 16); - this._MergeDifferentFontTitlesBox.TabIndex = 15; - this._MergeDifferentFontTitlesBox.Text = "合并不同字体的标题"; - this._MergeDifferentFontTitlesBox.UseVisualStyleBackColor = true; - // - // tabPage2 - // - this.tabPage2.Controls.Add(this._IgnoreNumericTitleBox); - this.tabPage2.Controls.Add(this._IgnoreSingleCharacterTitleBox); - this.tabPage2.Controls.Add(this._ClearTextFiltersButton); - this.tabPage2.Controls.Add(this._IgnorePatternsBox); - this.tabPage2.Controls.Add(this.label10); - this.tabPage2.Location = new System.Drawing.Point(4, 22); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); - this.tabPage2.Size = new System.Drawing.Size(455, 203); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "文本过滤"; - this.tabPage2.UseVisualStyleBackColor = true; - // - // _IgnoreNumericTitleBox - // - this._IgnoreNumericTitleBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this._IgnoreNumericTitleBox.AutoSize = true; - this._IgnoreNumericTitleBox.Location = new System.Drawing.Point(170, 171); - this._IgnoreNumericTitleBox.Name = "_IgnoreNumericTitleBox"; - this._IgnoreNumericTitleBox.Size = new System.Drawing.Size(132, 16); - this._IgnoreNumericTitleBox.TabIndex = 22; - this._IgnoreNumericTitleBox.Text = "忽略只有数字的标题"; - this._IgnoreNumericTitleBox.UseVisualStyleBackColor = true; - // - // _IgnoreSingleCharacterTitleBox - // - this._IgnoreSingleCharacterTitleBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this._IgnoreSingleCharacterTitleBox.AutoSize = true; - this._IgnoreSingleCharacterTitleBox.Location = new System.Drawing.Point(8, 171); - this._IgnoreSingleCharacterTitleBox.Name = "_IgnoreSingleCharacterTitleBox"; - this._IgnoreSingleCharacterTitleBox.Size = new System.Drawing.Size(156, 16); - this._IgnoreSingleCharacterTitleBox.TabIndex = 21; - this._IgnoreSingleCharacterTitleBox.Text = "忽略只有一个字符的标题"; - this._IgnoreSingleCharacterTitleBox.UseVisualStyleBackColor = true; - // - // _ClearTextFiltersButton - // - this._ClearTextFiltersButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._ClearTextFiltersButton.Image = global::PDFPatcher.Properties.Resources.Delete; - this._ClearTextFiltersButton.Location = new System.Drawing.Point(369, 6); - this._ClearTextFiltersButton.Name = "_ClearTextFiltersButton"; - this._ClearTextFiltersButton.Size = new System.Drawing.Size(80, 23); - this._ClearTextFiltersButton.TabIndex = 2; - this._ClearTextFiltersButton.Text = "清空列表"; - this._ClearTextFiltersButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._ClearTextFiltersButton.UseVisualStyleBackColor = true; - this._ClearTextFiltersButton.Click += new System.EventHandler(this.ControlEvent); - // - // _IgnorePatternsBox - // - this._IgnorePatternsBox.AllowUserToResizeRows = false; - this._IgnorePatternsBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._IgnorePatternsBox.BackgroundColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.Font = new System.Drawing.Font("SimSun", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this._IgnorePatternsBox.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; - this._IgnorePatternsBox.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this._IgnorePatternsBox.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this._PatternColumn, - this._MatchCaseColumn, - this._FullMatchColumn, - this._PatternTypeColumn, - this._RemovePatternColumn}); - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle2.Font = new System.Drawing.Font("SimSun", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this._IgnorePatternsBox.DefaultCellStyle = dataGridViewCellStyle2; - this._IgnorePatternsBox.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter; - this._IgnorePatternsBox.Location = new System.Drawing.Point(8, 35); - this._IgnorePatternsBox.Name = "_IgnorePatternsBox"; - this._IgnorePatternsBox.RowHeadersVisible = false; - this._IgnorePatternsBox.Size = new System.Drawing.Size(441, 130); - this._IgnorePatternsBox.TabIndex = 1; - this._IgnorePatternsBox.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this._IgnorePatternsBox_CellContentClick); - // - // _PatternColumn - // - this._PatternColumn.Frozen = true; - this._PatternColumn.HeaderText = "忽略内容"; - this._PatternColumn.MinimumWidth = 50; - this._PatternColumn.Name = "_PatternColumn"; - this._PatternColumn.ToolTipText = "忽略匹配此内容的标题"; - this._PatternColumn.Width = 150; - // - // _MatchCaseColumn - // - this._MatchCaseColumn.HeaderText = "区分大小写"; - this._MatchCaseColumn.MinimumWidth = 70; - this._MatchCaseColumn.Name = "_MatchCaseColumn"; - this._MatchCaseColumn.ToolTipText = "是否区分大小写"; - this._MatchCaseColumn.Width = 70; - // - // _FullMatchColumn - // - this._FullMatchColumn.HeaderText = "匹配全标题"; - this._FullMatchColumn.MinimumWidth = 70; - this._FullMatchColumn.Name = "_FullMatchColumn"; - this._FullMatchColumn.ToolTipText = "是否匹配整个标题"; - this._FullMatchColumn.Width = 70; - // - // _PatternTypeColumn - // - this._PatternTypeColumn.HeaderText = "正则表达式"; - this._PatternTypeColumn.MinimumWidth = 70; - this._PatternTypeColumn.Name = "_PatternTypeColumn"; - this._PatternTypeColumn.ToolTipText = "是否使用正则表达式"; - this._PatternTypeColumn.Width = 70; - // - // _RemovePatternColumn - // - this._RemovePatternColumn.HeaderText = "删除"; - this._RemovePatternColumn.MinimumWidth = 35; - this._RemovePatternColumn.Name = "_RemovePatternColumn"; - this._RemovePatternColumn.Text = "删除"; - this._RemovePatternColumn.ToolTipText = "删除此忽略模板"; - this._RemovePatternColumn.UseColumnTextForLinkValue = true; - this._RemovePatternColumn.Width = 35; - // - // label10 - // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(3, 11); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(149, 12); - this.label10.TabIndex = 0; - this.label10.Text = "忽略匹配以下内容的文本:"; - // - // tabPage3 - // - this.tabPage3.Controls.Add(this._FilterToolbar); - this.tabPage3.Controls.Add(this._LevelAdjustmentBox); - this.tabPage3.Controls.Add(this.label12); - this.tabPage3.Location = new System.Drawing.Point(4, 22); - this.tabPage3.Name = "tabPage3"; - this.tabPage3.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); - this.tabPage3.Size = new System.Drawing.Size(455, 203); - this.tabPage3.TabIndex = 2; - this.tabPage3.Text = "高级筛选处理"; - this.tabPage3.UseVisualStyleBackColor = true; - // - // _FilterToolbar - // - this._FilterToolbar.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; - this._FilterToolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripLabel1, - _AddAdjustmentButton, - this._AddFilterFromInfoFileButton, - this._DeleteAdjustmentButton, - this.toolStripSeparator1, - this._CopyFilterButton, - this._PasteButton}); - this._FilterToolbar.Location = new System.Drawing.Point(3, 3); - this._FilterToolbar.Name = "_FilterToolbar"; - this._FilterToolbar.Size = new System.Drawing.Size(449, 25); - this._FilterToolbar.TabIndex = 0; - // - // toolStripLabel1 - // - this.toolStripLabel1.Name = "toolStripLabel1"; - this.toolStripLabel1.Size = new System.Drawing.Size(68, 22); - this.toolStripLabel1.Text = "筛选条件:"; - // - // _AddFilterFromInfoFileButton - // - this._AddFilterFromInfoFileButton.Image = global::PDFPatcher.Properties.Resources.BookmarkFile; - this._AddFilterFromInfoFileButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._AddFilterFromInfoFileButton.Name = "_AddFilterFromInfoFileButton"; - this._AddFilterFromInfoFileButton.Size = new System.Drawing.Size(112, 22); - this._AddFilterFromInfoFileButton.Text = "从信息文件添加"; - this._AddFilterFromInfoFileButton.Click += new System.EventHandler(this.ControlEvent); - // - // _DeleteAdjustmentButton - // - this._DeleteAdjustmentButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this._DeleteAdjustmentButton.Image = global::PDFPatcher.Properties.Resources.Delete; - this._DeleteAdjustmentButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._DeleteAdjustmentButton.Name = "_DeleteAdjustmentButton"; - this._DeleteAdjustmentButton.Size = new System.Drawing.Size(23, 22); - this._DeleteAdjustmentButton.Text = "删除"; - this._DeleteAdjustmentButton.Click += new System.EventHandler(this.ControlEvent); - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); - // - // _CopyFilterButton - // - this._CopyFilterButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this._CopyFilterButton.Image = global::PDFPatcher.Properties.Resources.Copy; - this._CopyFilterButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._CopyFilterButton.Name = "_CopyFilterButton"; - this._CopyFilterButton.Size = new System.Drawing.Size(23, 22); - this._CopyFilterButton.Text = "复制"; - this._CopyFilterButton.Click += new System.EventHandler(this.ControlEvent); - // - // _PasteButton - // - this._PasteButton.Image = global::PDFPatcher.Properties.Resources.Paste; - this._PasteButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._PasteButton.Name = "_PasteButton"; - this._PasteButton.Size = new System.Drawing.Size(52, 22); - this._PasteButton.Text = "粘贴"; - this._PasteButton.Click += new System.EventHandler(this.ControlEvent); - // - // _LevelAdjustmentBox - // - this._LevelAdjustmentBox.AllColumns.Add(this._AdvancedFilterColumn); - this._LevelAdjustmentBox.AllColumns.Add(this._AdjustmentLevelColumn); - this._LevelAdjustmentBox.AllColumns.Add(this._RelativeAdjustmentColumn); - this._LevelAdjustmentBox.AllColumns.Add(this._FilterBeforeMergeColumn); - this._LevelAdjustmentBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._LevelAdjustmentBox.CellEditActivation = BrightIdeasSoftware.ObjectListView.CellEditActivateMode.SingleClick; - this._LevelAdjustmentBox.CellEditUseWholeCell = false; - this._LevelAdjustmentBox.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this._AdvancedFilterColumn, - this._AdjustmentLevelColumn, - this._RelativeAdjustmentColumn, - this._FilterBeforeMergeColumn}); - this._LevelAdjustmentBox.Cursor = System.Windows.Forms.Cursors.Default; - this._LevelAdjustmentBox.GridLines = true; - this._LevelAdjustmentBox.HideSelection = false; - this._LevelAdjustmentBox.IsSimpleDragSource = true; - this._LevelAdjustmentBox.IsSimpleDropSink = true; - this._LevelAdjustmentBox.Location = new System.Drawing.Point(6, 50); - this._LevelAdjustmentBox.Name = "_LevelAdjustmentBox"; - this._LevelAdjustmentBox.ShowGroups = false; - this._LevelAdjustmentBox.Size = new System.Drawing.Size(443, 137); - this._LevelAdjustmentBox.TabIndex = 2; - this._LevelAdjustmentBox.UseCompatibleStateImageBehavior = false; - this._LevelAdjustmentBox.View = System.Windows.Forms.View.Details; - this._LevelAdjustmentBox.ItemActivate += new System.EventHandler(this._LevelAdjustmentBox_ItemActivate); - // - // _AdvancedFilterColumn - // - this._AdvancedFilterColumn.IsEditable = false; - this._AdvancedFilterColumn.Text = "筛选条件"; - this._AdvancedFilterColumn.Width = 273; - // - // _AdjustmentLevelColumn - // - this._AdjustmentLevelColumn.HeaderTextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._AdjustmentLevelColumn.Text = "调整级别"; - // - // _RelativeAdjustmentColumn - // - this._RelativeAdjustmentColumn.CheckBoxes = true; - this._RelativeAdjustmentColumn.HeaderTextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this._RelativeAdjustmentColumn.Text = "相对调整"; - this._RelativeAdjustmentColumn.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // _FilterBeforeMergeColumn - // - this._FilterBeforeMergeColumn.CheckBoxes = true; - this._FilterBeforeMergeColumn.Text = "合并文本前筛选"; - this._FilterBeforeMergeColumn.Width = 100; - // - // label12 - // - this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(3, 35); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(251, 12); - this.label12.TabIndex = 1; - this.label12.Text = "调整匹配字体的尺寸级别(级别为0时忽略):"; - // - // tabPage5 - // - this.tabPage5.Controls.Add(this._ExportTextCoordinateBox); - this.tabPage5.Controls.Add(this._ShowAllFontsBox); - this.tabPage5.Controls.Add(this._DisplayFontStatisticsBox); - this.tabPage5.Location = new System.Drawing.Point(4, 22); - this.tabPage5.Name = "tabPage5"; - this.tabPage5.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); - this.tabPage5.Size = new System.Drawing.Size(455, 203); - this.tabPage5.TabIndex = 4; - this.tabPage5.Text = "其它选项"; - this.tabPage5.UseVisualStyleBackColor = true; - // - // _ExportTextCoordinateBox - // - this._ExportTextCoordinateBox.AutoSize = true; - this._ExportTextCoordinateBox.Location = new System.Drawing.Point(6, 50); - this._ExportTextCoordinateBox.Name = "_ExportTextCoordinateBox"; - this._ExportTextCoordinateBox.Size = new System.Drawing.Size(120, 16); - this._ExportTextCoordinateBox.TabIndex = 2; - this._ExportTextCoordinateBox.Text = "导出文本位置信息"; - this._ExportTextCoordinateBox.UseVisualStyleBackColor = true; - // - // _ShowAllFontsBox - // - this._ShowAllFontsBox.AutoSize = true; - this._ShowAllFontsBox.Location = new System.Drawing.Point(6, 28); - this._ShowAllFontsBox.Name = "_ShowAllFontsBox"; - this._ShowAllFontsBox.Size = new System.Drawing.Size(120, 16); - this._ShowAllFontsBox.TabIndex = 1; - this._ShowAllFontsBox.Text = "列出被忽略的字体"; - this._ShowAllFontsBox.UseVisualStyleBackColor = true; - // - // _DisplayFontStatisticsBox - // - this._DisplayFontStatisticsBox.AutoSize = true; - this._DisplayFontStatisticsBox.Checked = true; - this._DisplayFontStatisticsBox.CheckState = System.Windows.Forms.CheckState.Checked; - this._DisplayFontStatisticsBox.Location = new System.Drawing.Point(6, 6); - this._DisplayFontStatisticsBox.Name = "_DisplayFontStatisticsBox"; - this._DisplayFontStatisticsBox.Size = new System.Drawing.Size(192, 16); - this._DisplayFontStatisticsBox.TabIndex = 0; - this._DisplayFontStatisticsBox.Text = "完成识别后统计用于标题的字体"; - this._DisplayFontStatisticsBox.UseVisualStyleBackColor = true; - // - // _BookmarkControl - // - this._BookmarkControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._BookmarkControl.LabelText = "P&DF 信息文件:"; - this._BookmarkControl.Location = new System.Drawing.Point(12, 33); - this._BookmarkControl.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._BookmarkControl.Name = "_BookmarkControl"; - this._BookmarkControl.Size = new System.Drawing.Size(463, 25); - this._BookmarkControl.TabIndex = 2; - this._BookmarkControl.UseForBookmarkExport = true; - // - // _SourceFileControl - // - this._SourceFileControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._SourceFileControl.Location = new System.Drawing.Point(12, 3); - this._SourceFileControl.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._SourceFileControl.Name = "_SourceFileControl"; - this._SourceFileControl.Size = new System.Drawing.Size(463, 24); - this._SourceFileControl.TabIndex = 1; - // - // _ExportBookmarkButton - // - this._ExportBookmarkButton.AlternativeFocusBorderColor = System.Drawing.SystemColors.Highlight; - this._ExportBookmarkButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._ExportBookmarkButton.AnimateGlow = true; - this._ExportBookmarkButton.BackColor = System.Drawing.SystemColors.Highlight; - this._ExportBookmarkButton.CornerRadius = 3; - this._ExportBookmarkButton.ForeColor = System.Drawing.SystemColors.ControlText; - this._ExportBookmarkButton.GlowColor = System.Drawing.Color.White; - this._ExportBookmarkButton.Image = global::PDFPatcher.Properties.Resources.Save; - this._ExportBookmarkButton.InnerBorderColor = System.Drawing.SystemColors.ControlDarkDark; - this._ExportBookmarkButton.Location = new System.Drawing.Point(349, 63); - this._ExportBookmarkButton.Name = "_ExportBookmarkButton"; - this._ExportBookmarkButton.OuterBorderColor = System.Drawing.SystemColors.ControlLightLight; - this._ExportBookmarkButton.ShowFocusBorder = true; - this._ExportBookmarkButton.Size = new System.Drawing.Size(123, 29); - this._ExportBookmarkButton.TabIndex = 15; - this._ExportBookmarkButton.Text = " 生成书签(&S)"; - this._ExportBookmarkButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._ExportBookmarkButton.Click += new System.EventHandler(this._ExportBookmarkButton_Click); - // - // AutoBookmarkControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this._ExportBookmarkButton); - this.Controls.Add(this._SourceFileControl); - this.Controls.Add(this._BookmarkControl); - this.Controls.Add(this.tabControl1); - this.Font = new System.Drawing.Font("SimSun", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.Name = "AutoBookmarkControl"; - this.Size = new System.Drawing.Size(487, 333); - ((System.ComponentModel.ISupportInitialize)(this._TitleSizeThresholdBox)).EndInit(); - this.tabControl1.ResumeLayout(false); - this.tabPage1.ResumeLayout(false); - this.tabPage1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this._MaxDistanceBetweenLinesBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this._GoToPageTopLevelBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this._YOffsetBox)).EndInit(); - this.tabPage2.ResumeLayout(false); - this.tabPage2.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this._IgnorePatternsBox)).EndInit(); - this.tabPage3.ResumeLayout(false); - this.tabPage3.PerformLayout(); - this._FilterToolbar.ResumeLayout(false); - this._FilterToolbar.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this._LevelAdjustmentBox)).EndInit(); - this.tabPage5.ResumeLayout(false); - this.tabPage5.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private SourceFileControl _SourceFileControl; - private BookmarkControl _BookmarkControl; - private System.Windows.Forms.NumericUpDown _TitleSizeThresholdBox; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox _PageRangeBox; - private System.Windows.Forms.CheckBox _MergeAdjacentTitlesBox; - private System.Windows.Forms.CheckBox _MergeDifferentSizeTitlesBox; - private System.Windows.Forms.TabControl tabControl1; - private System.Windows.Forms.TabPage tabPage1; - private System.Windows.Forms.TabPage tabPage2; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.Label label11; - private System.Windows.Forms.NumericUpDown _GoToPageTopLevelBox; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.NumericUpDown _YOffsetBox; - private System.Windows.Forms.DataGridView _IgnorePatternsBox; - private System.Windows.Forms.DataGridViewTextBoxColumn _PatternColumn; - private System.Windows.Forms.DataGridViewCheckBoxColumn _MatchCaseColumn; - private System.Windows.Forms.DataGridViewCheckBoxColumn _FullMatchColumn; - private System.Windows.Forms.DataGridViewCheckBoxColumn _PatternTypeColumn; - private System.Windows.Forms.DataGridViewLinkColumn _RemovePatternColumn; - private System.Windows.Forms.TabPage tabPage3; - private System.Windows.Forms.Label label12; - private System.Windows.Forms.Button _ClearTextFiltersButton; - private System.Windows.Forms.CheckBox _AutoHierarchicalArrangementBox; - private BrightIdeasSoftware.ObjectListView _LevelAdjustmentBox; - private BrightIdeasSoftware.OLVColumn _AdvancedFilterColumn; - private BrightIdeasSoftware.OLVColumn _AdjustmentLevelColumn; - private BrightIdeasSoftware.OLVColumn _RelativeAdjustmentColumn; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.ComboBox _WritingDirectionBox; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.TabPage tabPage5; - private System.Windows.Forms.CheckBox _ShowAllFontsBox; - private System.Windows.Forms.CheckBox _DisplayFontStatisticsBox; - private System.Windows.Forms.NumericUpDown _MaxDistanceBetweenLinesBox; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.CheckBox _ExportTextCoordinateBox; - private System.Windows.Forms.ContextMenuStrip _AddFilterMenu; - private System.Windows.Forms.ToolStrip _FilterToolbar; - private System.Windows.Forms.ToolStripButton _DeleteAdjustmentButton; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; - private System.Windows.Forms.ToolStripButton _CopyFilterButton; - private System.Windows.Forms.ToolStripButton _PasteButton; - private System.Windows.Forms.ToolStripLabel toolStripLabel1; - private System.Windows.Forms.ToolStripButton _AddFilterFromInfoFileButton; - private System.Windows.Forms.CheckBox _CreateBookmarkForFirstPageBox; - private System.Windows.Forms.CheckBox _MergeDifferentFontTitlesBox; - private System.Windows.Forms.CheckBox _IgnoreOverlappedTextBox; - private System.Windows.Forms.CheckBox _IgnoreNumericTitleBox; - private System.Windows.Forms.CheckBox _IgnoreSingleCharacterTitleBox; - private BrightIdeasSoftware.OLVColumn _FilterBeforeMergeColumn; - private EnhancedGlassButton.GlassButton _ExportBookmarkButton; - private System.Windows.Forms.CheckBox _FirstLineAsTitleBox; - - } -} diff --git a/pdfpatcher/App/Functions/AutoBookmarkControl.cs b/pdfpatcher/App/Functions/AutoBookmarkControl.cs deleted file mode 100644 index 1ce928b4be0c9b360d89b8fac1ab879d30772254..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmarkControl.cs +++ /dev/null @@ -1,336 +0,0 @@ -using System; -using System.ComponentModel; -using System.IO; -using System.Windows.Forms; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - [ToolboxItem(false)] - public partial class AutoBookmarkControl : FunctionControl, IResettableControl - { - AutoBookmarkOptions _options; - static AutoBookmarkOptions.LevelAdjustmentOption[] _copiedLevelAdjustments; - - public override string FunctionName => "自动生成书签"; - - public override System.Drawing.Bitmap IconImage => Properties.Resources.AutoBookmark; - - public override Button DefaultButton => _ExportBookmarkButton; - - public AutoBookmarkControl() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - } - - void OnLoad() { - _FilterToolbar.ScaleIcons(16); - _LevelAdjustmentBox.ScaleColumnWidths(); - AppContext.MainForm.SetTooltip(_SourceFileControl.FileList, "需要识别标题为书签的 PDF 源文件路径"); - AppContext.MainForm.SetTooltip(_BookmarkControl.FileList, "指定识别书签后生成的信息文件或简易文本书签文件路径"); - AppContext.MainForm.SetTooltip(_ExportBookmarkButton, "点击此按钮识别 PDF 文件的标题为信息文件"); - AppContext.MainForm.SetTooltip(_TitleSizeThresholdBox, "指定标题文本的最小尺寸,小于此尺寸的文本将被忽略"); - AppContext.MainForm.SetTooltip(_AutoHierarchicalArrangementBox, "根据标题文本的尺寸级别生成多层次的书签"); - AppContext.MainForm.SetTooltip(_YOffsetBox, "将标题的定位位置向上偏移的行距"); - AppContext.MainForm.SetTooltip(_MergeAdjacentTitlesBox, "将连续出现的标题合并为一个标题"); - AppContext.MainForm.SetTooltip(_MergeDifferentSizeTitlesBox, "合并不同尺寸的相邻标题"); - AppContext.MainForm.SetTooltip(_GoToPageTopLevelBox, "小于指定层数的标题定位到页首,而非所在精确位置"); - AppContext.MainForm.SetTooltip(_IgnoreOverlappedTextBox, "忽略用于制作粗体、阴影等效果的重叠文本"); - AppContext.MainForm.SetTooltip(_CreateBookmarkForFirstPageBox, "生成一个书签指向文档的第一页,书签文本为 PDF 文件的名称"); - AppContext.MainForm.SetTooltip(_PageRangeBox, Messages.PageRanges); - - int i = 0; - foreach (var item in EditAdjustmentForm.FilterNames) { - _AddFilterMenu.Items.Add(item).Name = EditAdjustmentForm.FilterIDs[i++]; - } - _LevelAdjustmentBox.CellEditUseWholeCell = true; - _LevelAdjustmentBox.BeforeSorting += (object sender, BrightIdeasSoftware.BeforeSortingEventArgs e) => { - e.Canceled = true; - }; - _LevelAdjustmentBox.DropSink = new BrightIdeasSoftware.RearrangingDropSink(false); - _AdvancedFilterColumn.AspectGetter = (object x) => { - var f = x as AutoBookmarkOptions.LevelAdjustmentOption; - if (f == null) { - return null; - } - return f.Condition.Description; - }; - _AdjustmentLevelColumn.AspectGetter = (object x) => { - var f = x as AutoBookmarkOptions.LevelAdjustmentOption; - return f?.AdjustmentLevel ?? 0; - }; - _AdjustmentLevelColumn.AspectPutter = (object x, object value) => { - var f = x as AutoBookmarkOptions.LevelAdjustmentOption; - if (f == null) { - return; - } - if ((value ?? "0").ToString().TryParse(out float a)) { - f.AdjustmentLevel = a; - } - }; - _RelativeAdjustmentColumn.AspectGetter = (object x) => (x as AutoBookmarkOptions.LevelAdjustmentOption)?.RelativeAdjustment == true; - _RelativeAdjustmentColumn.AspectPutter = (object x, object value) => { - var f = x as AutoBookmarkOptions.LevelAdjustmentOption; - if (f == null) { - return; - } - f.RelativeAdjustment = value is bool b && b; - }; - _FilterBeforeMergeColumn.AspectGetter = (object x) => ((x as AutoBookmarkOptions.LevelAdjustmentOption)?.FilterBeforeMergeTitle) ?? false; - _FilterBeforeMergeColumn.AspectPutter = (object x, object value) => { - if (x is AutoBookmarkOptions.LevelAdjustmentOption f) { - f.FilterBeforeMergeTitle = value is bool b && b; - } - }; - _IgnorePatternsBox.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders); - Reload(); - - var d = _BookmarkControl.FileDialog; - d.CheckFileExists = false; - d.CheckPathExists = false; - - var sd = d as SaveFileDialog; - if (sd != null) { - sd.OverwritePrompt = false; - } - } - - public void Reset() { - AppContext.AutoBookmarker = new AutoBookmarkOptions(); - Reload(); - } - - public void Reload() { - _options = AppContext.AutoBookmarker; - _CreateBookmarkForFirstPageBox.Checked = _options.CreateBookmarkForFirstPage; - _MergeAdjacentTitlesBox.Checked = _options.MergeAdjacentTitles; - _MergeDifferentSizeTitlesBox.Checked = _options.MergeDifferentSizeTitles; - _AutoHierarchicalArrangementBox.Checked = _options.AutoHierarchicalArrangement; - _IgnoreNumericTitleBox.Checked = _options.IgnoreNumericTitle; - _IgnoreOverlappedTextBox.Checked = _options.IgnoreOverlappedText; - _IgnoreSingleCharacterTitleBox.Checked = _options.IgnoreSingleCharacterTitle; - _ShowAllFontsBox.Checked = _options.DisplayAllFonts; - _DisplayFontStatisticsBox.Checked = _options.DisplayFontStatistics; - _WritingDirectionBox.SelectedIndex = (int)_options.WritingDirection; - _MergeDifferentFontTitlesBox.Checked = _options.MergeDifferentFontTitles; - _TitleSizeThresholdBox.SetValue(_options.TitleThreshold); - _YOffsetBox.SetValue(_options.YOffset); - _MaxDistanceBetweenLinesBox.SetValue(_options.MaxDistanceBetweenLines); - _FirstLineAsTitleBox.Checked = _options.FirstLineAsTitle; - - for (int i = _options.LevelAdjustment.Count - 1; i >= 0; i--) { - if (_options.LevelAdjustment[i].Condition == null) { - _options.LevelAdjustment.RemoveAt(i); - } - } - _LevelAdjustmentBox.SetObjects(_options.LevelAdjustment); - _IgnorePatternsBox.Rows.Clear(); - foreach (var item in _options.IgnorePatterns) { - if (String.IsNullOrEmpty(item.Text)) { - continue; - } - _IgnorePatternsBox.Rows.Add(item.Text, item.MatchCase, item.FullMatch, item.UseRegularExpression); - } - } - - private void _ExportBookmarkButton_Click(object sender, EventArgs e) { - if (File.Exists(_SourceFileControl.FirstFile) == false) { - FormHelper.ErrorBox(Messages.SourceFileNotFound); - return; - } - else if (String.IsNullOrEmpty(_BookmarkControl.Text)) { - FormHelper.ErrorBox(Messages.InfoDocNotSpecified); - return; - } - - AppContext.SourceFiles = _SourceFileControl.Files; - AppContext.BookmarkFile = _BookmarkControl.Text; - if (_SourceFileControl.Files.Length == 1) { - _SourceFileControl.FileList.AddHistoryItem(); - _BookmarkControl.FileList.AddHistoryItem(); - } - - AppContext.MainForm.ResetWorker(); - AppContext.MainForm.GetWorker().DoWork += new DoWorkEventHandler(ExportControl_DoWork); - SyncOptions(); - AppContext.MainForm.GetWorker().RunWorkerAsync(new object[] { - AppContext.SourceFiles, - AppContext.BookmarkFile, - _options - }); - } - - private void SyncOptions() { - _options.CreateBookmarkForFirstPage = _CreateBookmarkForFirstPageBox.Checked; - _options.PageRanges = _PageRangeBox.Text; - _options.TitleThreshold = (float)_TitleSizeThresholdBox.Value; - _options.MergeAdjacentTitles = _MergeAdjacentTitlesBox.Checked; - _options.IgnoreNumericTitle = _IgnoreNumericTitleBox.Checked; - _options.IgnoreOverlappedText = _IgnoreOverlappedTextBox.Checked; - _options.IgnoreSingleCharacterTitle = _IgnoreSingleCharacterTitleBox.Checked; - _options.MergeDifferentSizeTitles = _MergeDifferentSizeTitlesBox.Checked; - _options.MergeDifferentFontTitles = _MergeDifferentFontTitlesBox.Checked; - _options.YOffset = (float)_YOffsetBox.Value; - _options.ExportTextCoordinates = _ExportTextCoordinateBox.Checked; - _options.PageTopForLevel = (int)_GoToPageTopLevelBox.Value; - _options.AutoHierarchicalArrangement = _AutoHierarchicalArrangementBox.Checked; - _options.DisplayFontStatistics = _DisplayFontStatisticsBox.Checked; - _options.DisplayAllFonts = _ShowAllFontsBox.Checked; - _options.WritingDirection = (WritingDirection)_WritingDirectionBox.SelectedIndex; - _options.MaxDistanceBetweenLines = (float)_MaxDistanceBetweenLinesBox.Value; - _options.FirstLineAsTitle = _FirstLineAsTitleBox.Checked; - _options.IgnorePatterns.Clear(); - foreach (DataGridViewRow item in _IgnorePatternsBox.Rows) { - if (item.IsNewRow) { - continue; - } - var cells = item.Cells; - if (cells[0].Value == null) { - continue; - } - _options.IgnorePatterns.Add(new PDFPatcher.Model.MatchPattern( - cells[0].Value.ToString(), - (bool)(cells[_MatchCaseColumn.Index].Value ?? false), - (bool)(cells[_FullMatchColumn.Index].Value ?? false), - (bool)(cells[_PatternTypeColumn.Index].Value ?? false))); - } - _options.LevelAdjustment.Clear(); - if (_LevelAdjustmentBox.Items.Count > 0) { - foreach (ListViewItem item in _LevelAdjustmentBox.Items) { - _options.LevelAdjustment.Add(_LevelAdjustmentBox.GetModelObject(item.Index) as AutoBookmarkOptions.LevelAdjustmentOption); - } - } - } - - void ExportControl_DoWork(object sender, DoWorkEventArgs e) { - var a = e.Argument as object[]; - var files = a[0] as string[]; - var b = a[1] as string; - var options = a[2] as AutoBookmarkOptions; - if (files.Length > 1) { - var p = Path.GetDirectoryName(b); - var ext = Path.GetExtension(b); - foreach (var file in files) { - Processor.Worker.CreateBookmark(file, FileHelper.CombinePath(p, Path.GetFileNameWithoutExtension(file) + ext), options); - if (AppContext.Abort) { - return; - } - } - } - else { - Processor.Worker.CreateBookmark(files[0], b, options); - } - } - - private void _IgnorePatternsBox_CellContentClick(object sender, DataGridViewCellEventArgs e) { - if (e.ColumnIndex == _RemovePatternColumn.Index && e.RowIndex >= 0) { - _IgnorePatternsBox.Rows.RemoveAt(e.RowIndex); - } - } - - private void _ImportLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { - AppContext.MainForm.SelectFunctionList(Function.Patcher); - } - - private void ControlEvent(object sender, EventArgs e) { - if (sender == _DeleteAdjustmentButton && _LevelAdjustmentBox.Items.Count > 0 && FormHelper.YesNoBox("是否删除选中的项?") == DialogResult.Yes) { - _LevelAdjustmentBox.RemoveObjects(_LevelAdjustmentBox.SelectedObjects); - } - else if (sender == _ClearTextFiltersButton && _IgnorePatternsBox.Rows.Count > 0 && FormHelper.YesNoBox("是否清空文本过滤列表?") == DialogResult.Yes) { - _IgnorePatternsBox.Rows.Clear(); - } - else if (sender == _CopyFilterButton) { - var si = _LevelAdjustmentBox.SelectedObjects; - if (si.Count == 0) { - return; - } - _copiedLevelAdjustments = new AutoBookmarkOptions.LevelAdjustmentOption[si.Count]; - for (int i = 0; i < _copiedLevelAdjustments.Length; i++) { - var item = si[i] as AutoBookmarkOptions.LevelAdjustmentOption; - _copiedLevelAdjustments[i] = item; - } - } - else if (sender == _PasteButton) { - //var s = Clipboard.GetText (); - //if (String.IsNullOrEmpty (s) == false && s.Length < 100) { - // _LevelAdjustmentBox.AddObject (new AutoBookmarkOptions.LevelAdjustmentOption () { - // Condition = new AutoBookmarkCondition.FontNameCondition (s, false) - // }); - // return; - //} - if (_copiedLevelAdjustments.HasContent() == false) { - return; - } - foreach (var item in _copiedLevelAdjustments) { - _LevelAdjustmentBox.AddObject(item.Clone()); - } - } - else if (sender == _AddFilterFromInfoFileButton) { - if (String.IsNullOrEmpty(_BookmarkControl.Text)) { - if (_BookmarkControl.FileDialog.ShowDialog() != DialogResult.OK) { - FormHelper.InfoBox("请先指定信息文件的路径。"); - return; - } - _BookmarkControl.Text = _BookmarkControl.FileDialog.FileName; - } - var doc = new System.Xml.XmlDocument(); - System.Xml.XmlNode fontInfo; - try { - doc.Load(_BookmarkControl.Text); - fontInfo = doc.SelectSingleNode(Constants.PdfInfo + "/" + Constants.Font.DocumentFont); - } - catch (Exception ex) { - FormHelper.ErrorBox("无法从信息文件加载字体信息。" + ex.Message); - return; - } - if (fontInfo == null) { - FormHelper.ErrorBox("无法从信息文件加载字体信息。"); - return; - } - using (var f = new FontFilterForm(fontInfo)) { - if (f.ShowDialog() == DialogResult.OK && f.FilterConditions != null) { - foreach (var item in f.FilterConditions) { - _LevelAdjustmentBox.AddObject(new AutoBookmarkOptions.LevelAdjustmentOption() { - Condition = item, - AdjustmentLevel = 0, - RelativeAdjustment = false - }); - } - } - } - } - } - - private void _LevelAdjustmentBox_ItemActivate(object sender, EventArgs e) { - if (_LevelAdjustmentBox.FocusedItem == null) { - return; - } - var fi = _LevelAdjustmentBox.FocusedItem; - var i = fi.Index; - var o = _LevelAdjustmentBox.GetModelObject(i) as AutoBookmarkOptions.LevelAdjustmentOption; - using (var dialog = new EditAdjustmentForm(o)) { - if (dialog.ShowDialog() == DialogResult.OK) { - if (dialog.Filter.Condition != null) { - _LevelAdjustmentBox.InsertObjects(i, new AutoBookmarkOptions.LevelAdjustmentOption[] { dialog.Filter }); - _LevelAdjustmentBox.SelectedIndex = i; - } - _LevelAdjustmentBox.RemoveObject(o); - } - } - } - - private void _AddFilterMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { - var c = EditAdjustmentForm.CreateCondition(e.ClickedItem.Name); - if (c == null) { - return; - } - - using (var dialog = new EditAdjustmentForm(new AutoBookmarkOptions.LevelAdjustmentOption { Condition = c })) { - if (dialog.ShowDialog() == DialogResult.OK && dialog.Filter.Condition != null) { - _LevelAdjustmentBox.AddObject(dialog.Filter); - } - } - } - } -} diff --git a/pdfpatcher/App/Functions/AutoBookmarkControl.resx b/pdfpatcher/App/Functions/AutoBookmarkControl.resx deleted file mode 100644 index 1e63dd10ebb20b1fd8af5f875429b4fa76b2cf47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/AutoBookmarkControl.resx +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - False - - - 17, 17 - - - True - - - True - - - True - - - True - - - True - - - 160, 17 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/BookmarkControl.Designer.cs b/pdfpatcher/App/Functions/BookmarkControl.Designer.cs deleted file mode 100644 index 7c7cc86a41afe4efdf56c0937878a4cafe814136..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/BookmarkControl.Designer.cs +++ /dev/null @@ -1,122 +0,0 @@ -namespace PDFPatcher -{ - partial class BookmarkControl - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.label1 = new System.Windows.Forms.Label(); - this._BrowseBookmarkButton = new System.Windows.Forms.Button(); - this._OpenBookmarkBox = new System.Windows.Forms.OpenFileDialog(); - this._SaveBookmarkBox = new System.Windows.Forms.SaveFileDialog(); - this.panel1 = new System.Windows.Forms.Panel(); - this._BookmarkBox = new PDFPatcher.HistoryComboBox(); - this.panel1.SuspendLayout(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(3, 6); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(89, 12); - this.label1.TabIndex = 0; - this.label1.Text = "P&DF 信息文件:"; - // - // _BrowseBookmarkButton - // - this._BrowseBookmarkButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._BrowseBookmarkButton.Image = global::PDFPatcher.Properties.Resources.BookmarkFile; - this._BrowseBookmarkButton.Location = new System.Drawing.Point(391, 1); - this._BrowseBookmarkButton.Name = "_BrowseBookmarkButton"; - this._BrowseBookmarkButton.Size = new System.Drawing.Size(75, 23); - this._BrowseBookmarkButton.TabIndex = 2; - this._BrowseBookmarkButton.Text = "浏览..."; - this._BrowseBookmarkButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._BrowseBookmarkButton.UseVisualStyleBackColor = true; - this._BrowseBookmarkButton.Click += new System.EventHandler(this._BrowseSourcePdfButton_Click); - // - // _OpenBookmarkBox - // - this._OpenBookmarkBox.DefaultExt = "xml"; - this._OpenBookmarkBox.Filter = "支持的信息文件 (*.xml,*.txt)|*.xml;*.txt|XML 信息文件 (*.xml)|*.xml|简易文本书签文件(*.txt)|*.txt"; - this._OpenBookmarkBox.Title = "指定需要导入的信息文件的路径"; - // - // _SaveBookmarkBox - // - this._SaveBookmarkBox.DefaultExt = "xml"; - this._SaveBookmarkBox.Filter = "支持的信息文件 (*.xml,*.txt)|*.xml;*.txt|XML 信息文件 (*.xml)|*.xml|简易文本书签文件(*.txt)|*.txt"; - this._SaveBookmarkBox.Title = "指定导出的信息文件路径"; - // - // panel1 - // - this.panel1.Controls.Add(this._BookmarkBox); - this.panel1.Controls.Add(this.label1); - this.panel1.Controls.Add(this._BrowseBookmarkButton); - this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel1.Location = new System.Drawing.Point(0, 0); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(469, 26); - this.panel1.TabIndex = 3; - // - // _BookmarkBox - // - this._BookmarkBox.AllowDrop = true; - this._BookmarkBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._BookmarkBox.Contents = null; - this._BookmarkBox.FormattingEnabled = true; - this._BookmarkBox.Location = new System.Drawing.Point(104, 3); - this._BookmarkBox.MaxItemCount = 16; - this._BookmarkBox.Name = "_BookmarkBox"; - this._BookmarkBox.Size = new System.Drawing.Size(281, 20); - this._BookmarkBox.TabIndex = 1; - this._BookmarkBox.DragDrop += new System.Windows.Forms.DragEventHandler(this._BookmarkBox_DragDrop); - this._BookmarkBox.DragEnter += new System.Windows.Forms.DragEventHandler(this._BookmarkBox_DragEnter); - this._BookmarkBox.TextChanged += new System.EventHandler(this._BookmarkBox_TextChanged); - // - // BookmarkControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.Controls.Add(this.panel1); - this.Name = "BookmarkControl"; - this.Size = new System.Drawing.Size(469, 26); - this.Load += new System.EventHandler(this.BookmarkControl_Show); - this.VisibleChanged += new System.EventHandler(this.BookmarkControl_Show); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Button _BrowseBookmarkButton; - private System.Windows.Forms.OpenFileDialog _OpenBookmarkBox; - private System.Windows.Forms.SaveFileDialog _SaveBookmarkBox; - private PDFPatcher.HistoryComboBox _BookmarkBox; - private System.Windows.Forms.Panel panel1; - } -} diff --git a/pdfpatcher/App/Functions/BookmarkControl.cs b/pdfpatcher/App/Functions/BookmarkControl.cs deleted file mode 100644 index 2b3de4a71d6aa4af83c8e7cdd48cdfaa52fd1fe2..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/BookmarkControl.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using System.ComponentModel; -using System.Windows.Forms; -using PDFPatcher.Common; - -namespace PDFPatcher -{ - public partial class BookmarkControl : UserControl - { - //readonly string[] xmlBookmarkType = new string[] { ".xml" }; - //private string[] supportedBookmarkTypes; - internal event EventHandler BrowseForFile; - - public BookmarkControl() { - InitializeComponent(); - //supportedBookmarkTypes = defaultBookmarkTypes; - } - - ///获取或指定书签文件路径的下拉列表框。 - internal HistoryComboBox FileList => _BookmarkBox; - - internal FileDialog FileDialog => _UseForBookmarkExport ? (FileDialog)_SaveBookmarkBox : _OpenBookmarkBox; - - [Description("标签文本上显示的文本")] - public string LabelText { - get => label1.Text; - set => label1.Text = value; - } - - [DefaultValue(null)] - ///获取或指定书签文件路径的值。 - public override string Text { - get => _BookmarkBox.Text; - set => _BookmarkBox.Text = value; - } - - private bool _UseForBookmarkExport; - ///获取或指定是否用于导出书签。 - [DefaultValue(false)] - [Description("点击浏览按钮时是否打开保存对话框")] - public bool UseForBookmarkExport { - get => _UseForBookmarkExport; - set => - //supportedBookmarkTypes = value ? xmlBookmarkType : defaultBookmarkTypes; - _UseForBookmarkExport = value; - } - - private void _BrowseSourcePdfButton_Click(object sender, EventArgs e) { - BrowseForFile?.Invoke(sender, e); - var sourceFile = (AppContext.SourceFiles != null && AppContext.SourceFiles.Length > 0) ? AppContext.SourceFiles[0] : String.Empty; - if (FileHelper.IsPathValid(_BookmarkBox.Text) && System.IO.Path.GetFileName(_BookmarkBox.Text).Length > 0) { - var p = new FilePath(_BookmarkBox.Text); - _OpenBookmarkBox.SetLocation(p); - _SaveBookmarkBox.SetLocation(p); - } - else if (sourceFile.Length > 0) { - var p = new FilePath(sourceFile).ChangeExtension("xml"); - _SaveBookmarkBox.SetLocation(p); - _OpenBookmarkBox.SetLocation(p); - } - if (_UseForBookmarkExport) { - if (_SaveBookmarkBox.ShowDialog() == DialogResult.OK) { - _BookmarkBox.Text = _SaveBookmarkBox.FileName; - } - } - else if (_OpenBookmarkBox.ShowDialog() == DialogResult.OK) { - if (_OpenBookmarkBox.FileName == _BookmarkBox.Text) { - return; - } - _BookmarkBox.Text = _OpenBookmarkBox.FileName; - } - } - - private void _BookmarkBox_DragEnter(object sender, DragEventArgs e) { - //Common.Form.FeedbackDragFileOver (e, supportedBookmarkTypes); - e.FeedbackDragFileOver(Constants.FileExtensions.AllBookmarkExtension); - } - - private void _BookmarkBox_DragDrop(object sender, DragEventArgs e) { - //Common.Form.DropFileOver ((Control)sender, e, supportedBookmarkTypes); - ((Control)sender).DropFileOver(e, Constants.FileExtensions.AllBookmarkExtension); - } - - private void _BookmarkBox_TextChanged(object sender, EventArgs e) { - AppContext.BookmarkFile = _BookmarkBox.Text; - } - - private void BookmarkControl_Show(object sender, EventArgs e) { - var t = _BookmarkBox.Text; - if (Visible && AppContext.MainForm != null) { - // _BookmarkBox.DataSource = new BindingList (_UseForBookmarkExport ? ContextData.Recent.SavedInfoDocuments : ContextData.Recent.InfoDocuments); - _BookmarkBox.Contents = AppContext.Recent.InfoDocuments; - } - else if (Visible == false) { - _BookmarkBox.Contents = null; - } - _BookmarkBox.Text = t; - } - - } -} diff --git a/pdfpatcher/App/Functions/BookmarkControl.resx b/pdfpatcher/App/Functions/BookmarkControl.resx deleted file mode 100644 index 71c50d7144c68f30db14a6f34852ea7911306cd0..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/BookmarkControl.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 183, 17 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/CustomButton/GlassButton.cs b/pdfpatcher/App/Functions/CustomButton/GlassButton.cs deleted file mode 100644 index d8be14679b7f9332c05bccb0ef7d47811fb68629..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/CustomButton/GlassButton.cs +++ /dev/null @@ -1,1334 +0,0 @@ -/************************************************************************************************ - * GlassButton - How to create an animating glass button using only GDI+ (and not using WPF). * - * * - * Original developed by Łukasz Świątkowski - lukasz.swiatkowski@gmail.com * - * Form-/Perfomance-/Behavior-Improvements by Fink Christoph - fink.christoph@gmail.com * - * * - * Feel free to use this control in your application or to improve it in any way! * - ***********************************************************************************************/ - -using System; -using System.ComponentModel; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Windows.Forms; -using PushButtonState = System.Windows.Forms.VisualStyles.PushButtonState; - -namespace EnhancedGlassButton -{ - /// - /// Represents a glass button control. - /// - [ToolboxBitmap(typeof(System.Windows.Forms.Button)), ToolboxItem(true), ToolboxItemFilter("System.Windows.Forms"), Description("Raises an event when the user clicks it.")] - public partial class GlassButton : Button - { - #region " Global Vareables " - private System.ComponentModel.IContainer components = null; - private Timer timer; - - #region " Vareables for Drawing " - - GraphicsPath outerBorderPath; - GraphicsPath ContentPath; - GraphicsPath GlowClip; - GraphicsPath GlowBottomRadial; - GraphicsPath ShinePath; - GraphicsPath BorderPath; - - PathGradientBrush GlowRadialPath; - - LinearGradientBrush ShineBrush; - - Pen outerBorderPen; - Pen BorderPen; - - Color specialSymbolColor; - - Brush specialSymbolBrush; - Brush ContentBrush; - - Rectangle rect; - Rectangle rect2; - - #endregion - - /// - /// The ToolTip of the Control. - /// - readonly ToolTip toolTip = new ToolTip(); - - /// - /// If false, the shine isn't drawn (-> symbolizes an disabled control). - /// - bool drawShine = true; - - /// - /// Set the trynsperency of the special Symbols. - /// - readonly int transparencyFactor = 128; - - #endregion - - #region " Constructors " - - /// - /// Initializes a new instance of the class. - /// - public GlassButton() { - DoubleBuffered = true; - - InitializeComponent(); - - roundCorner = 6; - timer.Interval = animationLength / framesCount; - base.BackColor = Color.Transparent; - BackColor = Color.Black; - ForeColor = Color.White; - OuterBorderColor = Color.White; - InnerBorderColor = Color.Black; - ShineColor = Color.White; - GlowColor = Color.FromArgb(unchecked((int)(0xFF8DBDFF))); - alternativeForm = false; - showFocusBorder = false; - animateGlow = false; - showSpecialSymbol = false; - specialSymbol = SpecialSymbols.Play; - specialSymbolColor = Color.White; - toolTipText = ""; - specialSymbolBrush = new SolidBrush(Color.FromArgb(transparencyFactor, specialSymbolColor)); - alternativeFocusBorderColor = Color.Black; - alternativeFormDirection = Direction.Left; - - RecalcRect((float)currentFrame / (framesCount - 1f)); - - SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true); - SetStyle(ControlStyles.Opaque, false); - - SizeChanged += new EventHandler(GlassButton_SizeChanged); - MouseEnter += new EventHandler(GlassButton_MouseEnter); - MouseLeave += new EventHandler(GlassButton_MouseLeave); - GotFocus += new EventHandler(GlassButton_GotFocus); - LostFocus += new EventHandler(GlassButton_LostFocus); - } - - private void InitializeComponent() { - components = new System.ComponentModel.Container(); - timer = new System.Windows.Forms.Timer(components); - SuspendLayout(); - // - // timer - // - timer.Tick += new System.EventHandler(timer_Tick); - ResumeLayout(false); - - } - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) { - if (disposing) { - if (imageButton != null) { - imageButton.Parent.Dispose(); - imageButton.Parent = null; - imageButton.Dispose(); - imageButton = null; - } - - DisposeAll(outerBorderPath, ContentPath, GlowClip, GlowBottomRadial, ShinePath, BorderPath, GlowRadialPath, ShineBrush, outerBorderPen, BorderPen, specialSymbolBrush, ContentBrush, toolTip, components); - } - base.Dispose(disposing); - } - - private void DisposeAll(params IDisposable[] objects) { - foreach (var item in objects) { - item?.Dispose(); - } - } - #endregion - - #region " Fields and Properties " - - private Color backColor; - /// - /// Gets or sets the background color of the control. - /// - /// A value representing the background color. - [DefaultValue(typeof(Color), "Black")] - public new Color BackColor { - get => backColor; - set { - if (!backColor.Equals(value)) { - backColor = value; - UseVisualStyleBackColor = false; - - RecalcRect((float)currentFrame / (framesCount - 1f)); - - OnBackColorChanged(EventArgs.Empty); - } - } - } - - /// - /// Gets or sets the foreground color of the control. - /// - /// The foreground of the control. - [DefaultValue(typeof(Color), "White")] - public new Color ForeColor { - get => base.ForeColor; - set { - base.ForeColor = value; - - RecalcRect((float)currentFrame / (framesCount - 1f)); - } - } - - private Color innerBorderColor; - /// - /// Gets or sets the inner border color of the control. - /// - /// A value representing the color of the inner border. - [DefaultValue(typeof(Color), "Black"), Category("Appearance"), Description("The inner border color of the control.")] - public Color InnerBorderColor { - get => innerBorderColor; - set { - if (innerBorderColor != value) { - innerBorderColor = value; - - RecalcRect((float)currentFrame / (framesCount - 1f)); - - if (IsHandleCreated) { - Invalidate(); - } - } - } - } - - /// - /// Gets or sets the color of the special symbol. - /// - /// The color of the special symbol. - [DefaultValue(typeof(Color), "White"), Category("Appearance"), Description("The inner border color of the control.")] - public Color SpecialSymbolColor { - get => specialSymbolColor; - set { - if (specialSymbolColor != value) { - specialSymbolColor = value; - specialSymbolBrush = new SolidBrush(Color.FromArgb(transparencyFactor, specialSymbolColor)); - - if (IsHandleCreated) { - Invalidate(); - } - } - } - } - - private int roundCorner; - /// - /// Gets or sets the corner radius. - /// - /// The corner radius. - [DefaultValue(6), Category("Appearance"), Description("The radius of the corners.")] - public int CornerRadius { - get => roundCorner; - set { - if (roundCorner != value) { - roundCorner = value; - - RecalcRect((float)currentFrame / (framesCount - 1f)); - - if (IsHandleCreated) { - Invalidate(); - } - } - } - } - - string toolTipText; - /// - /// Gets or sets the tool tip text. - /// - /// The tool tip text. - [DefaultValue(""), Category("Appearance"), Description("The ToolTip-Text of the button. Leave blank to not show a ToolTip.")] - public string ToolTipText { - get => toolTipText; - set { - if (toolTipText != value) { - toolTipText = value; - - if (toolTipText.Length > 0) - toolTip.SetToolTip(this, toolTipText); - - if (IsHandleCreated) { - Invalidate(); - } - } - } - } - - private bool alternativeForm; - /// - /// Gets or sets the alternative form. - /// - /// The alternative form. - [DefaultValue(false), Category("Appearance"), Description("Draws the Button in an alternative Form.")] - public bool AlternativeForm { - get => alternativeForm; - set { - if (alternativeForm != value) { - alternativeForm = value; - - RecalcRect((float)currentFrame / (framesCount - 1f)); - - if (IsHandleCreated) { - Invalidate(); - } - } - } - } - - private bool animateGlow; - /// - /// Gets or sets a value indicating whether the glow is animated. - /// - /// true if glow is animated; otherwise, false. - [DefaultValue(false), Category("Appearance"), Description("If true the glow is animated.")] - public bool AnimateGlow { - get => animateGlow; - set { - if (animateGlow != value) { - animateGlow = value; - if (IsHandleCreated) { - Invalidate(); - } - } - } - } - - private bool showSpecialSymbol; - /// - /// Gets or sets a value indicating whether a special symbol is drawn. - /// - /// true if special symbol is drawn; otherwise, false. - [DefaultValue(false), Category("Appearance"), Description("If true, the selectet special symbol will be drawn on the button.")] - public bool ShowSpecialSymbol { - get => showSpecialSymbol; - set { - if (showSpecialSymbol != value) { - showSpecialSymbol = value; - - if (IsHandleCreated) { - Invalidate(); - } - } - } - } - - /// - /// List of all aviable special symbols. - /// - public enum SpecialSymbols - { - ArrowLeft, - ArrowRight, - ArrowUp, - ArrowDown, - Play, - Pause, - Stop, - FastForward, - Forward, - Backward, - FastBackward, - Speaker, - NoSpeaker, - Repeat, - RepeatAll, - Shuffle - } - - private SpecialSymbols specialSymbol; - /// - /// Gets or sets the special symbol. - /// - /// The special symbol. - [DefaultValue(typeof(SpecialSymbols), "Play"), Category("Appearance"), Description("Sets the type of the special symbol on the button.")] - public SpecialSymbols SpecialSymbol { - get => specialSymbol; - set { - if (specialSymbol != value) { - specialSymbol = value; - - if (IsHandleCreated) { - Invalidate(); - } - } - } - } - - public enum Direction - { - Left, - Right - } - - private Direction alternativeFormDirection; - /// - /// Gets or sets the alternative form direction. - /// - /// The alternative form direction. - [DefaultValue(typeof(Direction), "Left"), Category("Appearance"), Description("Sets the Direction of the alternative Form.")] - public Direction AlternativeFormDirection { - get => alternativeFormDirection; - set { - if (alternativeFormDirection != value) { - alternativeFormDirection = value; - - RecalcRect((float)currentFrame / (framesCount - 1f)); - - if (IsHandleCreated) { - Invalidate(); - } - } - } - } - - private bool showFocusBorder; - /// - /// Gets or sets a value indicating whether the focus border is shown. - /// - /// true if focus border shown; otherwise, false. - [DefaultValue(false), Category("Appearance"), Description("Draw the normal Focus-Border. Alternativ Focus-Border will be drawed if false.")] - public bool ShowFocusBorder { - get => showFocusBorder; - set { - if (showFocusBorder != value) { - showFocusBorder = value; - - RecalcRect((float)currentFrame / (framesCount - 1f)); - - if (IsHandleCreated) { - Invalidate(); - } - } - } - } - - private Color alternativeFocusBorderColor; - /// - /// Gets or sets the color of the alternative focus border. - /// - /// The color of the alternative focus border. - [DefaultValue(typeof(Color), "Black"), Category("Appearance"), Description("The color of the alternative Focus-Border.")] - public Color AlternativeFocusBorderColor { - get => alternativeFocusBorderColor; - set { - if (alternativeFocusBorderColor != value) { - alternativeFocusBorderColor = value; - - RecalcRect((float)currentFrame / (framesCount - 1f)); - - if (IsHandleCreated) { - Invalidate(); - } - } - } - } - - private Color outerBorderColor; - /// - /// Gets or sets the outer border color of the control. - /// - /// A value representing the color of the outer border. - [DefaultValue(typeof(Color), "White"), Category("Appearance"), Description("The outer border color of the control.")] - public Color OuterBorderColor { - get => outerBorderColor; - set { - if (outerBorderColor != value) { - outerBorderColor = value; - - RecalcRect((float)currentFrame / (framesCount - 1f)); - - if (IsHandleCreated) { - Invalidate(); - } - } - } - } - - private Color shineColor; - /// - /// Gets or sets the shine color of the control. - /// - /// A value representing the shine color. - [DefaultValue(typeof(Color), "White"), Category("Appearance"), Description("The shine color of the control.")] - public Color ShineColor { - get => shineColor; - set { - if (shineColor != value) { - shineColor = value; - - RecalcRect((float)currentFrame / (framesCount - 1f)); - - if (IsHandleCreated) { - Invalidate(); - } - } - } - } - - private Color glowColor; - /// - /// Gets or sets the glow color of the control. - /// - /// A value representing the glow color. - [DefaultValue(typeof(Color), "255,141,189,255"), Category("Appearance"), Description("The glow color of the control.")] - public Color GlowColor { - get => glowColor; - set { - if (glowColor != value) { - glowColor = value; - - RecalcRect((float)currentFrame / (framesCount - 1f)); - - if (IsHandleCreated) { - Invalidate(); - } - } - } - } - - private bool isHovered; - private bool isFocused; - private bool isFocusedByKey; - private bool isKeyDown; - private bool isMouseDown; - private bool isPressed => isKeyDown || (isMouseDown && isHovered); - - /// - /// Gets the state of the button control. - /// - /// The state of the button control. - [Browsable(false)] - public PushButtonState State { - get { - if (!Enabled) { - return PushButtonState.Disabled; - } - if (isPressed) { - return PushButtonState.Pressed; - } - if (isHovered) { - return PushButtonState.Hot; - } - if (isFocused || IsDefault) { - return PushButtonState.Default; - } - return PushButtonState.Normal; - } - } - - #endregion - - #region " Overrided Methods " - - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected override void OnClick(EventArgs e) { - isKeyDown = isMouseDown = false; - base.OnClick(e); - } - - /// - /// Raises the event. - /// - /// An that contains the event data. - protected override void OnEnter(EventArgs e) { - isFocused = isFocusedByKey = true; - base.OnEnter(e); - } - - /// - /// Raises the event. - /// - /// An that contains the event data. - protected override void OnLeave(EventArgs e) { - base.OnLeave(e); - isFocused = isFocusedByKey = isKeyDown = isMouseDown = false; - Invalidate(); - } - - /// - /// Raises the event. - /// - /// A that contains the event data. - protected override void OnKeyDown(KeyEventArgs kevent) { - if (kevent.KeyCode == Keys.Space) { - isKeyDown = true; - Invalidate(); - } - base.OnKeyDown(kevent); - } - - /// - /// Raises the event. - /// - /// A that contains the event data. - protected override void OnKeyUp(KeyEventArgs kevent) { - if (isKeyDown && kevent.KeyCode == Keys.Space) { - isKeyDown = false; - Invalidate(); - } - base.OnKeyUp(kevent); - } - - /// - /// Raises the event. - /// - /// A that contains the event data. - protected override void OnMouseDown(MouseEventArgs e) { - if (!isMouseDown && e.Button == MouseButtons.Left) { - isMouseDown = true; - isFocusedByKey = false; - Invalidate(); - } - base.OnMouseDown(e); - } - - /// - /// Raises the event. - /// - /// A that contains the event data. - protected override void OnMouseUp(MouseEventArgs e) { - if (isMouseDown) { - isMouseDown = false; - Invalidate(); - } - base.OnMouseUp(e); - } - - /// - /// Raises the event. - /// - /// A that contains the event data. - protected override void OnMouseMove(MouseEventArgs mevent) { - base.OnMouseMove(mevent); - if (mevent.Button == MouseButtons.None) { - return; - } - - if (!ClientRectangle.Contains(mevent.X, mevent.Y)) { - if (isHovered) { - isHovered = false; - Invalidate(); - } - } - else if (!isHovered) { - isHovered = true; - Invalidate(); - } - } - - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected override void OnMouseEnter(EventArgs e) { - isHovered = true; - FadeIn(); - Invalidate(); - base.OnMouseEnter(e); - } - - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected override void OnMouseLeave(EventArgs e) { - isHovered = false; - FadeOut(); - Invalidate(); - base.OnMouseLeave(e); - } - - #endregion - - #region " Painting " - - /// - /// Raises the event. - /// - /// A that contains the event data. - protected override void OnPaint(PaintEventArgs pevent) { - var sm = pevent.Graphics.SmoothingMode; - pevent.Graphics.SmoothingMode = SmoothingMode.AntiAlias; - - DrawButtonBackground(pevent.Graphics); - DrawForegroundFromButton(pevent); - DrawButtonForeground(pevent.Graphics); - - pevent.Graphics.SmoothingMode = sm; - } - - /// - /// Draws the button background. - /// - /// The graphics to draw on. - private void DrawButtonBackground(Graphics g) { - //white border - g.DrawPath(outerBorderPen, outerBorderPath); - - //content - g.FillPath(ContentBrush, ContentPath); - - //glow - if ((isHovered || isAnimating) && !isPressed) { - g.SetClip(GlowClip, CombineMode.Intersect); - g.FillPath(GlowRadialPath, GlowBottomRadial); - - g.ResetClip(); - } - - //shine - if (drawShine && Enabled) { - g.FillPath(ShineBrush, ShinePath); - } - - //black border - g.DrawPath(BorderPen, BorderPath); - - //Draws the special Symbol - if (showSpecialSymbol) - DrawSpecialSymbol(g); - } - - /// - /// Draws the special symbol. - /// - /// The graphics to draw on. - private void DrawSpecialSymbol(Graphics g) { - var offset = 15; - var LineWidth = Width / 15; - var pen = new Pen(specialSymbolBrush, Width / 8) { - EndCap = LineCap.ArrowAnchor - }; - var aPen = new Pen(specialSymbolBrush, Width / 4) { - EndCap = LineCap.ArrowAnchor - }; - var font = new Font("Arial", LineWidth * 4, FontStyle.Bold); - - switch (specialSymbol) { - #region " Arrow Left " - case SpecialSymbols.ArrowLeft: - g.DrawLine(aPen, Width - Width / 5, Height / 2, Width / 8, Height / 2); - break; - #endregion - #region " Arrow Right " - case SpecialSymbols.ArrowRight: - g.DrawLine(aPen, Width / 6, Height / 2, Width - Width / 8, Height / 2); - break; - #endregion - #region " Arrow Up " - case SpecialSymbols.ArrowUp: - g.DrawLine(aPen, Width / 2, Height - Height / 5, Width / 2, Height / 8); - break; - #endregion - #region " Arrow Down " - case SpecialSymbols.ArrowDown: - g.DrawLine(aPen, Width / 2, Height / 5, Width / 2, Height - Height / 8); - break; - #endregion - #region " Play " - case SpecialSymbols.Play: - g.FillPolygon(specialSymbolBrush, new Point[3]{ - new Point(Width / 4 + Width / 20, Height / 4), - new Point(Width - Width / 4 + Width / 20, Height / 2), - new Point(Width / 4 + Width / 20, Height - Height / 4)}); - break; - #endregion - #region " Pause " - case SpecialSymbols.Pause: - g.FillRectangle(specialSymbolBrush, new Rectangle(Width / 4, Height / 4, - (Width / 2 - Width / 10) / 2, Height / 2)); - g.FillRectangle(specialSymbolBrush, new Rectangle(Width / 2 + Width / 20, Height / 4, - (Width / 2 - Width / 10) / 2, Height / 2)); - break; - #endregion - #region " Stop " - case SpecialSymbols.Stop: - g.FillRectangle(specialSymbolBrush, new Rectangle(Width / 4 + Width / 20, Height / 4 + Height / 20, - Width / 2 - Width / 10, Height / 2 - Width / 10)); - break; - #endregion - #region " FastForward " - case SpecialSymbols.FastForward: - g.FillPolygon(specialSymbolBrush, new Point[3]{ - new Point(Width / 4, Height / 4), - new Point(Width / 2, Height / 2), - new Point(Width / 4, Height - Height / 4)}); - g.FillPolygon(specialSymbolBrush, new Point[3]{ - new Point(Width / 2, Height / 4), - new Point(3 * Width / 4, Height / 2), - new Point(Width / 2, Height - Height / 4)}); - g.FillRectangle(specialSymbolBrush, new Rectangle(3 * Width / 4, Height / 4, - Width / 12, Height / 2)); - break; - #endregion - #region " Forward " - case SpecialSymbols.Forward: - g.FillPolygon(specialSymbolBrush, new Point[3]{ - new Point(Width / 4 + Width / 12, Height / 4), - new Point(Width / 2 + Width / 12, Height / 2), - new Point(Width / 4 + Width / 12, Height - Height / 4)}); - g.FillPolygon(specialSymbolBrush, new Point[3]{ - new Point(Width / 2 + Width / 12, Height / 4), - new Point(3 * Width / 4 + Width / 12, Height / 2), - new Point(Width / 2 + Width / 12, Height - Height / 4)}); - break; - #endregion - #region " Backward " - case SpecialSymbols.Backward: - g.FillPolygon(specialSymbolBrush, new Point[3]{ - new Point(Width / 4 - Width / 12, Height / 2), - new Point(Width / 2 - Width / 12, Height / 4), - new Point(Width / 2 - Width / 12, Height - Height / 4)}); - g.FillPolygon(specialSymbolBrush, new Point[3]{ - new Point(Width / 2 - Width / 12, Height / 2), - new Point(3 * Width / 4 - Width / 12, Height / 4), - new Point(3 * Width / 4 - Width / 12, Height - Height / 4)}); - break; - #endregion - #region " FastBackward " - case SpecialSymbols.FastBackward: - g.FillPolygon(specialSymbolBrush, new Point[3]{ - new Point(Width / 4, Height / 2), - new Point(Width / 2, Height / 4), - new Point(Width / 2, Height - Height / 4)}); - g.FillPolygon(specialSymbolBrush, new Point[3]{ - new Point(Width / 2, Height / 2), - new Point(3 * Width / 4, Height / 4), - new Point(3 * Width / 4, Height - Height / 4)}); - g.FillRectangle(specialSymbolBrush, new Rectangle(Width / 4 - Width / 12, Height / 4, - Width / 12, Height / 2)); - break; - #endregion - #region " Speaker " - case SpecialSymbols.Speaker: - g.DrawPolygon(new Pen(specialSymbolBrush, Width / 20), new Point[6] { - new Point(Width / 2 - Width / 6 - Width / offset, Height / 4 + Height / 10), - new Point(Width / 2 - Width / offset, Height / 4 + Height / 10), - new Point(Width / 2 + Width / 5 - Width / offset, Height / 4), - new Point(Width / 2 + Width / 5 - Width / offset, 3 * Height / 4), - new Point(Width / 2 - Width / offset, 3 * Height / 4 - Height / 10), - new Point(Width / 2 - Width / 6 - Width / offset, 3 * Height / 4 - Height / 10)}); - g.DrawLine(new Pen(specialSymbolBrush, Width / 20), Width / 2 - Width / offset, - Height / 4 + Height / 10 + Width / 40, Width / 2 - Width / offset, Height - (Height / 4 + Height / 10 + Width / 40)); - break; - #endregion - #region " NoSpeaker " - case SpecialSymbols.NoSpeaker: - g.DrawPolygon(new Pen(specialSymbolBrush, Width / 20), new Point[6] { - new Point(Width / 2 - Width / 6 - Width / offset, Height / 4 + Height / 10), - new Point(Width / 2 - Width / offset, Height / 4 + Height / 10), - new Point(Width / 2 + Width / 5 - Width / offset, Height / 4), - new Point(Width / 2 + Width / 5 - Width / offset, 3 * Height / 4), - new Point(Width / 2 - Width / offset, 3 * Height / 4 - Height / 10), - new Point(Width / 2 - Width / 6 - Width / offset, 3 * Height / 4 - Height / 10)}); - g.DrawLine(new Pen(specialSymbolBrush, Width / 20), Width / 2 - Width / offset, - Height / 4 + Height / 10 + Width / 40, Width / 2 - Width / offset, Height - (Height / 4 + Height / 10 + Width / 40)); - g.DrawLine(new Pen(specialSymbolBrush, Width / 20), (int)(Width / 2 - Width / 3.5 - Width / offset), 3 * Height / 4 - Height / 10, - Width / 2 + Width / 3 - Width / offset, Height / 4 + Height / 12 + Width / 40); - break; - #endregion - #region " Repeat " - case SpecialSymbols.Repeat: - g.DrawLine(new Pen(specialSymbolBrush, LineWidth), - new Point((int)(Width / 4), (int)(Height / 3)), - new Point((int)(Width - Width / 2.4), (int)(Height / 3))); - g.DrawArc(new Pen(specialSymbolBrush, LineWidth), (int)(Width - Width * 0.6), (int)(Height / 3), - (int)(Width / 3), (int)(Height / 3), 270, 180); - g.DrawLine(new Pen(specialSymbolBrush, LineWidth), - new Point((int)(Width - Width / 2.4), (int)(Height - Height / 3)), - new Point((int)(Width / 3.2), (int)(Height - Height / 3))); - g.DrawLine(pen, - new Point((int)(Width / 3.2), (int)(Height - Height / 3)), - new Point((int)(Width / 4), (int)(Height - Height / 3))); - break; - #endregion - #region " RepeatAll " - case SpecialSymbols.RepeatAll: - g.DrawLine(new Pen(specialSymbolBrush, LineWidth), - new Point((int)(Width / 2.4), (int)(Height / 3)), - new Point((int)(Width - Width / 2.4), (int)(Height / 3))); - g.DrawArc(new Pen(specialSymbolBrush, LineWidth), (int)(Width - Width * 0.6), (int)(Height / 3), - (int)(Width / 3), (int)(Height / 3), 270, 180); - g.DrawLine(new Pen(specialSymbolBrush, LineWidth), - new Point((int)(Width - Width / 2.4), (int)(Height - Height / 3)), - new Point((int)(Width / 2.4), (int)(Height - Height / 3))); - g.DrawLine(pen, - new Point((int)(Width / 2.4), (int)(Height - Height / 3)), - new Point((int)(Width / 3), (int)(Height - Height / 3))); - g.DrawArc(new Pen(specialSymbolBrush, LineWidth), (int)(Width / 4), (int)(Height / 3), - (int)(Width / 3), (int)(Height / 3), 90, 180); - break; - #endregion - #region " Shuffle " - case SpecialSymbols.Shuffle: - g.DrawString("1", font, specialSymbolBrush, (Width / 2) / 4, Height / 2 - LineWidth * 2); - var sWidth = (int)g.MeasureString("2", font).Width; - var sHeigth = (int)g.MeasureString("2", font).Height; - g.DrawString("2", font, specialSymbolBrush, Width / 2 - sWidth / 2 - Width / (2 * offset), Height - LineWidth - sHeigth); - sWidth = (int)g.MeasureString("3", font).Width; - g.DrawString("3", font, specialSymbolBrush, Width - (Width / 2) / 4 - sWidth - Width / (2 * offset), Height / 2 - LineWidth * 2); - g.DrawArc(pen, (Width / 2) / 2, Height / 6, Width - (Width / 2), (int)(Height / 2.2), 170, 210); - break; - #endregion - default: - break; - } - } - - /// - /// Draws the button foreground. - /// - /// The graphics to draw on. - private void DrawButtonForeground(Graphics g) { - if (ShowFocusBorder && Focused && ShowFocusCues && !alternativeForm) { - var rect = ClientRectangle; - rect.Inflate(-4, -4); - ControlPaint.DrawFocusRectangle(g, rect); - } - } - - private Button imageButton; - /// - /// Draws the foreground from button. - /// - /// The instance containing the event data. - private void DrawForegroundFromButton(PaintEventArgs pevent) { - if (imageButton == null) { - imageButton = new Button { - Parent = new TransparentControl(), - BackColor = Color.Transparent - }; - imageButton.FlatAppearance.BorderSize = 0; - imageButton.FlatStyle = FlatStyle.Flat; - } - if (direction != 0) { - imageButton.SuspendLayout(); - } - imageButton.ForeColor = ForeColor; - imageButton.Font = Font; - imageButton.RightToLeft = RightToLeft; - imageButton.Image = Image; - imageButton.ImageAlign = ImageAlign; - imageButton.ImageIndex = ImageIndex; - imageButton.ImageKey = ImageKey; - imageButton.ImageList = ImageList; - imageButton.Padding = Padding; - imageButton.Size = Size; - imageButton.Text = Text; - imageButton.TextAlign = TextAlign; - imageButton.TextImageRelation = TextImageRelation; - imageButton.UseCompatibleTextRendering = UseCompatibleTextRendering; - imageButton.UseMnemonic = UseMnemonic; - if (direction != 0) { - imageButton.ResumeLayout(); - } - InvokePaint(imageButton, pevent); - } - - sealed class TransparentControl : Control - { - protected override void OnPaintBackground(PaintEventArgs pevent) { } - protected override void OnPaint(PaintEventArgs e) { } - } - - /// - /// Creates the round rectangle. - /// - /// The rectangle. - /// The radius. - /// - private GraphicsPath CreateRoundRectangle(Rectangle rectangle, int radius) { - var path = new GraphicsPath(); - var l = rectangle.Left; - var t = rectangle.Top; - var w = rectangle.Width; - var h = rectangle.Height; - var d = radius << 1; - - if (alternativeForm) { - if (alternativeFormDirection == Direction.Left) { - path.AddArc(l, t, h, h, 90, 180); - path.AddLine(l + h, t, l + w, t); - path.AddCurve(new Point[5] { - new Point(l + w, t), - new Point(l + w - h / 6, t + h / 4), - new Point((int)(l + w - (double)(h / 4.7)), t + h / 2), - new Point(l + w - h / 6, t + 3 * h / 4), - new Point(l + w, t + h) }); - path.AddLine(l + h, t + h, l + w, t + h); - } - else { - path.AddCurve(new Point[5] { - new Point(l, t), - new Point(l + h / 6, t + h / 4), - new Point((int)(l + (double)(h / 4.85)), t + h / 2), - new Point(l + h / 6, t + 3 * h / 4), - new Point(l, t + h) }); - path.AddLine(l, t + h, l + w - h, t + h); - path.AddArc(l + w - h, t, h, h, 90, -180); - path.AddLine(l + w - h, t, l, t); - } - } - else { - path.AddArc(l, t, d, d, 180, 90); // topleft - path.AddLine(l + radius, t, l + w - radius, t); // top - path.AddArc(l + w - d, t, d, d, 270, 90); // topright - path.AddLine(l + w, t + radius, l + w, t + h - radius); // right - path.AddArc(l + w - d, t + h - d, d, d, 0, 90); // bottomright - path.AddLine(l + w - radius, t + h, l + radius, t + h); // bottom - path.AddArc(l, t + h - d, d, d, 90, 90); // bottomleft - path.AddLine(l, t + h - radius, l, t + radius); // left - } - - path.CloseFigure(); - - return path; - } - - /// - /// Creates the top round rectangle. - /// - /// The rectangle. - /// The radius. - /// - private GraphicsPath CreateTopRoundRectangle(Rectangle rectangle, int radius) { - var path = new GraphicsPath(); - var l = rectangle.Left; - var t = rectangle.Top; - var w = rectangle.Width; - var h = rectangle.Height; - var d = radius << 1; - - if (alternativeForm) { - if (alternativeFormDirection == Direction.Left) { - path.AddArc(l, t, h * 2, h * 2, 180, 90); - path.AddLine(l + h, t, l + w, t); - path.AddCurve(new Point[3] { - new Point(l + w, t), - new Point(l + w - h / 3, t + h / 2), - new Point((int)(l + w - (double)(h / 2.35)), t + h)}); - } - else { - path.AddCurve(new Point[3] { - new Point(l, t), - new Point(l + h / 3, t + h / 2), - new Point((int)(l + (double)(h / 2.35)), t + h)}); - path.AddLine((int)(l + (double)(h / 2.35)), t + h, l + w - h, t + h); - path.AddArc(l + w - h * 2, t, h * 2, h * 2, 0, -90); - } - } - else { - path.AddArc(l, t, d, d, 180, 90); // topleft - path.AddLine(l + radius, t, l + w - radius, t); // top - path.AddArc(l + w - d, t, d, d, 270, 90); // topright - path.AddLine(l + w, t + radius, l + w, t + h); // right - path.AddLine(l + w, t + h, l, t + h); // bottom - path.AddLine(l, t + h, l, t + radius); // left - } - - path.CloseFigure(); - - return path; - } - - /// - /// Creates the bottom radial path. - /// - /// The rectangle. - /// - private GraphicsPath CreateBottomRadialPath(Rectangle rectangle) { - var path = new GraphicsPath(); - RectangleF rect = rectangle; - rect.X -= rectangle.Width * .35f; - rect.Y -= rectangle.Height * .15f; - rect.Width *= 1.7f; - rect.Height *= 2.3f; - path.AddEllipse(rect); - path.CloseFigure(); - return path; - } - - /// - /// Handles the SizeChanged event of the GlassButton control. - /// - /// The source of the event. - /// The instance containing the event data. - private void GlassButton_SizeChanged(object sender, EventArgs e) { - RecalcRect((float)currentFrame / (framesCount - 1f)); - } - - /// - /// Handles the MouseLeave event of the GlassButton control. - /// - /// The source of the event. - /// The instance containing the event data. - private void GlassButton_MouseLeave(object sender, EventArgs e) { - RecalcGlow((float)currentFrame / (framesCount - 1f)); - } - - /// - /// Handles the MouseEnter event of the GlassButton control. - /// - /// The source of the event. - /// The instance containing the event data. - private void GlassButton_MouseEnter(object sender, EventArgs e) { - RecalcGlow((float)currentFrame / (framesCount - 1f)); - } - - /// - /// Handles the LostFocus event of the GlassButton control. - /// - /// The source of the event. - /// The instance containing the event data. - private void GlassButton_LostFocus(object sender, EventArgs e) { - RecalcOuterBorder(); - } - - /// - /// Handles the GotFocus event of the GlassButton control. - /// - /// The source of the event. - /// The instance containing the event data. - private void GlassButton_GotFocus(object sender, EventArgs e) { - RecalcOuterBorder(); - } - - /// - /// Recalcs the rectangles for drawing. - /// - /// The glow opacity. - private void RecalcRect(float glowOpacity) { - try { - var rCorner = roundCorner; - - if (roundCorner > Height / 2) - rCorner = Height / 2; - - if (roundCorner > Width / 2) - rCorner = Width / 2; - - rect = RecalcOuterBorder(); - - rect = RecalcContent(rect, out rect2); - - RecalcGlow(glowOpacity); - - rect2 = RecalcShine(rect2); - - BorderPath = CreateRoundRectangle(rect, rCorner); - - BorderPen = new Pen(innerBorderColor); - } - catch { } - } - - /// - /// Recalcs the shine. - /// - /// The rect2. - /// - private Rectangle RecalcShine(Rectangle rect2) { - var rCorner = roundCorner; - - if (roundCorner > Height / 2) - rCorner = Height / 2; - - if (roundCorner > Width / 2) - rCorner = Width / 2; - - if (rect2.Width > 0 && rect2.Height > 0) { - rect2.Height++; - ShinePath = CreateTopRoundRectangle(rect2, rCorner); - - rect2.Height++; - var opacity = 0x99; - if (isPressed) - opacity = (int)(.4f * opacity + .5f); - ShineBrush = new LinearGradientBrush(rect2, Color.FromArgb(opacity, shineColor), Color.FromArgb(opacity / 3, shineColor), LinearGradientMode.Vertical); - - rect2.Height -= 2; - - drawShine = true; - } - else - drawShine = false; - return rect2; - } - - /// - /// Recalcs the glow. - /// - /// The glow opacity. - private void RecalcGlow(float glowOpacity) { - var rCorner = roundCorner; - - if (roundCorner > Height / 2) - rCorner = Height / 2; - - if (roundCorner > Width / 2) - rCorner = Width / 2; - - GlowClip = CreateRoundRectangle(rect, rCorner); - GlowBottomRadial = CreateBottomRadialPath(rect); - - GlowRadialPath = new PathGradientBrush(GlowBottomRadial); - - var opacity = (int)(0xB2 * glowOpacity + .5f); - - if (!animateGlow) { - if (isHovered) - opacity = 255; - else - opacity = 0; - } - - GlowRadialPath.CenterColor = Color.FromArgb(opacity, glowColor); - GlowRadialPath.SurroundColors = new Color[] { Color.FromArgb(0, glowColor) }; - } - - /// - /// Recalcs the content. - /// - /// The rect. - /// The rect2. - /// - private Rectangle RecalcContent(Rectangle rect, out Rectangle rect2) { - var rCorner = roundCorner; - - if (roundCorner > Height / 2) - rCorner = Height / 2; - - if (roundCorner > Width / 2) - rCorner = Width / 2; - - rect.X++; - rect.Y++; - rect.Width -= 2; - rect.Height -= 2; - - rect2 = rect; - rect2.Height >>= 1; - - ContentPath = CreateRoundRectangle(rect, rCorner); - var opacity = isPressed ? 0xcc : 0x7f; - ContentBrush = new SolidBrush(Color.FromArgb(opacity, backColor)); - return rect; - } - - /// - /// Recalcs the outer border. - /// - /// - private Rectangle RecalcOuterBorder() { - var rCorner = roundCorner; - - if (roundCorner > Height / 2) - rCorner = Height / 2; - - if (roundCorner > Width / 2) - rCorner = Width / 2; - - Rectangle rect; - rect = ClientRectangle; - rect.Width--; - rect.Height--; - outerBorderPath = CreateRoundRectangle(rect, rCorner); - rect.Inflate(1, 1); - var region = CreateRoundRectangle(rect, rCorner); - Region = new Region(region); - rect.Inflate(-1, -1); - - var col = outerBorderColor; - if (Focused && !ShowFocusBorder) - col = alternativeFocusBorderColor; - - outerBorderPen = new Pen(col); - return rect; - } - - #endregion - - #region " Unused Properties & Events " - - /// This property is not relevant for this class. - /// This property is not relevant for this class. - [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), EditorBrowsable(EditorBrowsableState.Never)] - public new FlatButtonAppearance FlatAppearance => base.FlatAppearance; - - /// This property is not relevant for this class. - /// This property is not relevant for this class. - [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), EditorBrowsable(EditorBrowsableState.Never)] - public new FlatStyle FlatStyle { - get => base.FlatStyle; - set => base.FlatStyle = value; - } - - /// This property is not relevant for this class. - /// This property is not relevant for this class. - [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), EditorBrowsable(EditorBrowsableState.Never)] - public new bool UseVisualStyleBackColor { - get => base.UseVisualStyleBackColor; - set => base.UseVisualStyleBackColor = value; - } - - #endregion - - #region " Animation Support " - - private const int animationLength = 300; - private const int framesCount = 10; - private int currentFrame; - private int direction; - - private bool isAnimating => direction != 0; - - private void FadeIn() { - direction = 1; - timer.Enabled = true; - } - - private void FadeOut() { - direction = -1; - timer.Enabled = true; - } - - private void timer_Tick(object sender, EventArgs e) { - if (!timer.Enabled || !animateGlow) { - return; - } - - RecalcRect((float)currentFrame / (framesCount - 1f)); - Refresh(); - currentFrame += direction; - if (currentFrame == -1) { - currentFrame = 0; - timer.Enabled = false; - direction = 0; - return; - } - if (currentFrame == framesCount) { - currentFrame = framesCount - 1; - timer.Enabled = false; - direction = 0; - } - } - - #endregion - } -} diff --git a/pdfpatcher/App/Functions/CustomizeToolbarForm.Designer.cs b/pdfpatcher/App/Functions/CustomizeToolbarForm.Designer.cs deleted file mode 100644 index f52f275d075c3ceb5b2c14f800978421ab6f4a9d..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/CustomizeToolbarForm.Designer.cs +++ /dev/null @@ -1,160 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class CustomizeToolbarForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent () { - this.components = new System.ComponentModel.Container(); - this._ItemListBox = new BrightIdeasSoftware.ObjectListView(); - this._NameColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._VisibleColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._ShowTextColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._DisplayTextColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._ButtonImageList = new System.Windows.Forms.ImageList(this.components); - this._OkButton = new System.Windows.Forms.Button(); - this._ResetButton = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); - ((System.ComponentModel.ISupportInitialize)(this._ItemListBox)).BeginInit(); - this.SuspendLayout(); - // - // _ItemListBox - // - this._ItemListBox.AllColumns.Add(this._NameColumn); - this._ItemListBox.AllColumns.Add(this._VisibleColumn); - this._ItemListBox.AllColumns.Add(this._ShowTextColumn); - this._ItemListBox.AllColumns.Add(this._DisplayTextColumn); - this._ItemListBox.CellEditActivation = BrightIdeasSoftware.ObjectListView.CellEditActivateMode.SingleClickAlways; - this._ItemListBox.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this._NameColumn, - this._VisibleColumn, - this._ShowTextColumn, - this._DisplayTextColumn}); - this._ItemListBox.Location = new System.Drawing.Point(12, 46); - this._ItemListBox.Name = "_ItemListBox"; - this._ItemListBox.OwnerDraw = true; - this._ItemListBox.ShowGroups = false; - this._ItemListBox.Size = new System.Drawing.Size(388, 263); - this._ItemListBox.SmallImageList = this._ButtonImageList; - this._ItemListBox.TabIndex = 0; - this._ItemListBox.UseCompatibleStateImageBehavior = false; - this._ItemListBox.View = System.Windows.Forms.View.Details; - // - // _NameColumn - // - this._NameColumn.IsEditable = false; - this._NameColumn.Text = "工具栏按钮"; - this._NameColumn.Width = 145; - // - // _VisibleColumn - // - this._VisibleColumn.CheckBoxes = true; - this._VisibleColumn.HeaderTextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this._VisibleColumn.Text = "显示"; - this._VisibleColumn.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this._VisibleColumn.Width = 54; - // - // _ShowTextColumn - // - this._ShowTextColumn.CheckBoxes = true; - this._ShowTextColumn.HeaderTextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this._ShowTextColumn.Text = "显示文本"; - this._ShowTextColumn.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this._ShowTextColumn.Width = 63; - // - // _DisplayTextColumn - // - this._DisplayTextColumn.AutoCompleteEditor = false; - this._DisplayTextColumn.AutoCompleteEditorMode = System.Windows.Forms.AutoCompleteMode.None; - this._DisplayTextColumn.Text = "按钮文本内容"; - this._DisplayTextColumn.Width = 120; - // - // _ButtonImageList - // - this._ButtonImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; - this._ButtonImageList.ImageSize = new System.Drawing.Size(16, 16); - this._ButtonImageList.TransparentColor = System.Drawing.Color.Transparent; - // - // _OkButton - // - this._OkButton.Location = new System.Drawing.Point(325, 315); - this._OkButton.Name = "_OkButton"; - this._OkButton.Size = new System.Drawing.Size(75, 23); - this._OkButton.TabIndex = 1; - this._OkButton.Text = "确定(&Q)"; - this._OkButton.UseVisualStyleBackColor = true; - this._OkButton.Click += new System.EventHandler(this._OkButton_Click); - // - // _ResetButton - // - this._ResetButton.Location = new System.Drawing.Point(12, 315); - this._ResetButton.Name = "_ResetButton"; - this._ResetButton.Size = new System.Drawing.Size(127, 23); - this._ResetButton.TabIndex = 2; - this._ResetButton.Text = "重置常用工具栏"; - this._ResetButton.UseVisualStyleBackColor = true; - this._ResetButton.Click += new System.EventHandler(this._ResetButton_Click); - // - // label1 - // - this.label1.Location = new System.Drawing.Point(12, 9); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(305, 34); - this.label1.TabIndex = 3; - this.label1.Text = "使用鼠标上下拖动项目可调整工具按钮的显示顺序。\r\n要隐藏按钮,请取消“是否显示”的选中状态。"; - // - // CustomizeToolbarForm - // - this.AcceptButton = this._OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(412, 350); - this.Controls.Add(this.label1); - this.Controls.Add(this._ResetButton); - this.Controls.Add(this._OkButton); - this.Controls.Add(this._ItemListBox); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "CustomizeToolbarForm"; - this.ShowInTaskbar = false; - this.Text = "自定义常用工具栏项目"; - this.Load += new System.EventHandler(this.CustomizeToolbarForm_Load); - ((System.ComponentModel.ISupportInitialize)(this._ItemListBox)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private BrightIdeasSoftware.ObjectListView _ItemListBox; - private System.Windows.Forms.Button _OkButton; - private BrightIdeasSoftware.OLVColumn _NameColumn; - private BrightIdeasSoftware.OLVColumn _VisibleColumn; - private BrightIdeasSoftware.OLVColumn _ShowTextColumn; - private System.Windows.Forms.Button _ResetButton; - private System.Windows.Forms.ImageList _ButtonImageList; - private System.Windows.Forms.Label label1; - private BrightIdeasSoftware.OLVColumn _DisplayTextColumn; - } -} \ No newline at end of file diff --git a/pdfpatcher/App/Functions/CustomizeToolbarForm.cs b/pdfpatcher/App/Functions/CustomizeToolbarForm.cs deleted file mode 100644 index 840cacc5182a132b41973ff713b1ba7e8d1ca253..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/CustomizeToolbarForm.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Windows.Forms; -using BrightIdeasSoftware; -using PDFPatcher.Common; -using BO = PDFPatcher.ToolbarOptions.ButtonOption; - -namespace PDFPatcher.Functions -{ - public partial class CustomizeToolbarForm : Form - { - public CustomizeToolbarForm() { - InitializeComponent(); - } - - void _ResetButton_Click(object sender, EventArgs e) { - AppContext.Toolbar.Reset(); - _ItemListBox.Objects = AppContext.Toolbar.Buttons; - } - - void CustomizeToolbarForm_Load(object sender, EventArgs e) { - foreach (var item in Toolkit.Toolkits) { - _ItemListBox.SmallImageList.Images.Add(item.Icon, Properties.Resources.ResourceManager.GetObject(item.Icon) as Image); - } - new TypedColumn(_NameColumn) { - AspectGetter = (o) => o.GetToolkit().Name, - ImageGetter = (o) => o.GetToolkit().Icon - }; - new TypedColumn(_ShowTextColumn) { - AspectGetter = (o) => o.ShowText, - AspectPutter = (o, v) => o.ShowText = (bool)v - }; - new TypedColumn(_VisibleColumn) { - AspectGetter = (o) => o.Visible, - AspectPutter = (o, v) => o.Visible = (bool)v - }; - new TypedColumn(_DisplayTextColumn) { - AspectGetter = (o) => o.DisplayName, - AspectPutter = (o, v) => o.DisplayName = v as string ?? o.GetToolkit().Name, - }; - AppContext.Toolbar.AddMissedButtons(); - _ItemListBox.IsSimpleDragSource = true; - _ItemListBox.IsSimpleDropSink = true; - _ItemListBox.DragSource = new SimpleDragSource(true); - _ItemListBox.DropSink = new RearrangingDropSink(false) { - CanDropBetween = true, - CanDropOnItem = false - }; - _ItemListBox.Objects = AppContext.Toolbar.Buttons; - _ItemListBox.FixEditControlWidth(); - _ItemListBox.ScaleColumnWidths(); - } - - void _OkButton_Click(object sender, EventArgs e) { - var l = new List(); - foreach (BO item in _ItemListBox.Objects) { - l.Add(item); - } - AppContext.Toolbar.Buttons.Clear(); - AppContext.Toolbar.Buttons.AddRange(l); - Close(); - } - } -} diff --git a/pdfpatcher/App/Functions/CustomizeToolbarForm.resx b/pdfpatcher/App/Functions/CustomizeToolbarForm.resx deleted file mode 100644 index b1a334ff148e02a86e9830a423b6569cde4899f6..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/CustomizeToolbarForm.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/DocumentInspector/AddPdfObjectForm.Designer.cs b/pdfpatcher/App/Functions/DocumentInspector/AddPdfObjectForm.Designer.cs deleted file mode 100644 index cdf1268ff1938845b09c1d4b12313f0cb9649216..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentInspector/AddPdfObjectForm.Designer.cs +++ /dev/null @@ -1,179 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class AddPdfObjectForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._OkButton = new System.Windows.Forms.Button(); - this._CancelButton = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); - this._ObjectNameBox = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); - this._TextValueBox = new System.Windows.Forms.TextBox(); - this._NumericValueBox = new System.Windows.Forms.TextBox(); - this._BooleanValueBox = new System.Windows.Forms.CheckBox(); - this._NameValueBox = new System.Windows.Forms.TextBox(); - this._CreateAsRefBox = new System.Windows.Forms.CheckBox(); - this.SuspendLayout(); - // - // _OkButton - // - this._OkButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._OkButton.Location = new System.Drawing.Point(111, 141); - this._OkButton.Name = "_OkButton"; - this._OkButton.Size = new System.Drawing.Size(75, 23); - this._OkButton.TabIndex = 0; - this._OkButton.Text = "确定(&Q)"; - this._OkButton.UseVisualStyleBackColor = true; - this._OkButton.Click += new System.EventHandler(this._OkButton_Click); - // - // _CancelButton - // - this._CancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this._CancelButton.Location = new System.Drawing.Point(192, 141); - this._CancelButton.Name = "_CancelButton"; - this._CancelButton.Size = new System.Drawing.Size(75, 23); - this._CancelButton.TabIndex = 1; - this._CancelButton.Text = "取消(&X)"; - this._CancelButton.UseVisualStyleBackColor = true; - this._CancelButton.Click += new System.EventHandler(this._CancelButton_Click); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 15); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(41, 12); - this.label1.TabIndex = 4; - this.label1.Text = "名称:"; - // - // _ObjectNameBox - // - this._ObjectNameBox.Location = new System.Drawing.Point(59, 12); - this._ObjectNameBox.Name = "_ObjectNameBox"; - this._ObjectNameBox.Size = new System.Drawing.Size(208, 21); - this._ObjectNameBox.TabIndex = 5; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(12, 42); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(41, 12); - this.label2.TabIndex = 6; - this.label2.Text = "取值:"; - // - // _TextValueBox - // - this._TextValueBox.AcceptsReturn = true; - this._TextValueBox.AcceptsTab = true; - this._TextValueBox.Location = new System.Drawing.Point(59, 39); - this._TextValueBox.Multiline = true; - this._TextValueBox.Name = "_TextValueBox"; - this._TextValueBox.Size = new System.Drawing.Size(208, 56); - this._TextValueBox.TabIndex = 7; - this._TextValueBox.Visible = false; - // - // _NumericValueBox - // - this._NumericValueBox.Location = new System.Drawing.Point(7, 123); - this._NumericValueBox.Name = "_NumericValueBox"; - this._NumericValueBox.Size = new System.Drawing.Size(100, 21); - this._NumericValueBox.TabIndex = 8; - this._NumericValueBox.Visible = false; - // - // _BooleanValueBox - // - this._BooleanValueBox.AutoSize = true; - this._BooleanValueBox.Location = new System.Drawing.Point(7, 79); - this._BooleanValueBox.Name = "_BooleanValueBox"; - this._BooleanValueBox.Size = new System.Drawing.Size(48, 16); - this._BooleanValueBox.TabIndex = 9; - this._BooleanValueBox.Text = "True"; - this._BooleanValueBox.UseVisualStyleBackColor = true; - this._BooleanValueBox.Visible = false; - // - // _NameValueBox - // - this._NameValueBox.Location = new System.Drawing.Point(7, 138); - this._NameValueBox.Name = "_NameValueBox"; - this._NameValueBox.Size = new System.Drawing.Size(100, 21); - this._NameValueBox.TabIndex = 10; - this._NameValueBox.Visible = false; - // - // _CreateAsRefBox - // - this._CreateAsRefBox.AutoSize = true; - this._CreateAsRefBox.Location = new System.Drawing.Point(59, 101); - this._CreateAsRefBox.Name = "_CreateAsRefBox"; - this._CreateAsRefBox.Size = new System.Drawing.Size(132, 16); - this._CreateAsRefBox.TabIndex = 11; - this._CreateAsRefBox.Text = "创建为间接引用节点"; - this._CreateAsRefBox.UseVisualStyleBackColor = true; - // - // AddPdfObjectForm - // - this.AcceptButton = this._OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this._CancelButton; - this.ClientSize = new System.Drawing.Size(279, 176); - this.Controls.Add(this._CreateAsRefBox); - this.Controls.Add(this._NameValueBox); - this.Controls.Add(this._BooleanValueBox); - this.Controls.Add(this._NumericValueBox); - this.Controls.Add(this._TextValueBox); - this.Controls.Add(this.label2); - this.Controls.Add(this._ObjectNameBox); - this.Controls.Add(this.label1); - this.Controls.Add(this._CancelButton); - this.Controls.Add(this._OkButton); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "AddPdfObjectForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "添加PDF对象"; - this.Load += new System.EventHandler(this.AddPdfObjectForm_Load); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Button _OkButton; - private System.Windows.Forms.Button _CancelButton; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox _ObjectNameBox; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox _TextValueBox; - private System.Windows.Forms.TextBox _NumericValueBox; - private System.Windows.Forms.CheckBox _BooleanValueBox; - private System.Windows.Forms.TextBox _NameValueBox; - private System.Windows.Forms.CheckBox _CreateAsRefBox; - } -} - diff --git a/pdfpatcher/App/Functions/DocumentInspector/AddPdfObjectForm.cs b/pdfpatcher/App/Functions/DocumentInspector/AddPdfObjectForm.cs deleted file mode 100644 index 08535e0c5b0ff5b074bc57fd66f56085df7aa300..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentInspector/AddPdfObjectForm.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Windows.Forms; -using iTextSharp.text.pdf; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - sealed partial class AddPdfObjectForm : Form - { - readonly Control[] _editBoxes; - public string ObjectName => _ObjectNameBox.Text; - int _PdfObjectType; - ///获取或指定Description的值。 - public int PdfObjectType { - get => _PdfObjectType; - set { - _PdfObjectType = value; - FormHelper.ToggleVisibility(false, _editBoxes); - switch (value) { - case PdfObject.ARRAY: break; - case PdfObject.BOOLEAN: _BooleanValueBox.Visible = true; break; - case PdfObject.DICTIONARY: break; - case PdfObject.NAME: _NameValueBox.Visible = true; break; - case PdfObject.NUMBER: _NumericValueBox.Visible = true; break; - case PdfObject.STRING: _TextValueBox.Visible = true; break; - } - } - } - public bool CreateAsIndirect => _CreateAsRefBox.Checked; - public PdfObject PdfValue { - get { - PdfObject o; - switch (_PdfObjectType) { - case PdfObject.NAME: o = new PdfName(String.IsNullOrEmpty(_NameValueBox.Text) ? "name" : _NameValueBox.Text); break; - case PdfObject.DICTIONARY: o = new PdfDictionary(); break; - case PdfObject.ARRAY: o = new PdfArray(); break; - case PdfObject.BOOLEAN: o = new PdfBoolean(_BooleanValueBox.Checked); break; - case PdfObject.STRING: o = _TextValueBox.Text.ToPdfString(); break; - case PdfObject.NUMBER: o = new PdfNumber(_NumericValueBox.Text.ToDouble()); break; - default: return null; - } - return o; - } - } - public AddPdfObjectForm() { - InitializeComponent(); - _editBoxes = new Control[] { _NameValueBox, _NumericValueBox, _BooleanValueBox, _TextValueBox }; - } - - void AddPdfObjectForm_Load(object sender, EventArgs e) { - _NameValueBox.Location = _NumericValueBox.Location = _BooleanValueBox.Location = _TextValueBox.Location; - } - - void _OkButton_Click(Object source, EventArgs args) { - DialogResult = DialogResult.OK; - Close(); - } - - void _CancelButton_Click(Object source, EventArgs args) { - DialogResult = DialogResult.Cancel; - Close(); - } - - } -} diff --git a/pdfpatcher/App/Functions/DocumentInspector/AddPdfObjectForm.resx b/pdfpatcher/App/Functions/DocumentInspector/AddPdfObjectForm.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentInspector/AddPdfObjectForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/DocumentInspector/ImageViewerForm.Designer.cs b/pdfpatcher/App/Functions/DocumentInspector/ImageViewerForm.Designer.cs deleted file mode 100644 index 172134f88799b4e7e0b59c3a54c7877c2d1120ae..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentInspector/ImageViewerForm.Designer.cs +++ /dev/null @@ -1,121 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class ImageViewerForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - System.Windows.Forms.ToolStripButton _Save; - System.Windows.Forms.ToolStripButton _ZoomReset; - this._MainToolbar = new System.Windows.Forms.ToolStrip (); - this._FitWindow = new System.Windows.Forms.ToolStripButton (); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator (); - this._ImageBox = new Cyotek.Windows.Forms.ImageBox (); - _Save = new System.Windows.Forms.ToolStripButton (); - _ZoomReset = new System.Windows.Forms.ToolStripButton (); - this._MainToolbar.SuspendLayout (); - this.SuspendLayout (); - // - // _MainToolbar - // - this._MainToolbar.Items.AddRange (new System.Windows.Forms.ToolStripItem[] { - _Save, - this.toolStripSeparator1, - _ZoomReset, - this._FitWindow}); - this._MainToolbar.Location = new System.Drawing.Point (0, 0); - this._MainToolbar.Name = "_MainToolbar"; - this._MainToolbar.Size = new System.Drawing.Size (539, 25); - this._MainToolbar.TabIndex = 1; - this._MainToolbar.Text = "toolStrip1"; - this._MainToolbar.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler (this._MainToolbar_ItemClicked); - // - // _Save - // - _Save.Image = global::PDFPatcher.Properties.Resources.Save; - _Save.ImageTransparentColor = System.Drawing.Color.Magenta; - _Save.Name = "_Save"; - _Save.Size = new System.Drawing.Size (90, 22); - _Save.Text = "保存图片(&B)"; - _Save.ToolTipText = "将显示的图片保存为文件"; - // - // _ZoomReset - // - _ZoomReset.Image = global::PDFPatcher.Properties.Resources.Zoom; - _ZoomReset.ImageTransparentColor = System.Drawing.Color.Magenta; - _ZoomReset.Name = "_ZoomReset"; - _ZoomReset.Size = new System.Drawing.Size (75, 22); - _ZoomReset.Text = "原图比例"; - // - // _FitWindow - // - this._FitWindow.Image = global::PDFPatcher.Properties.Resources.Image; - this._FitWindow.ImageTransparentColor = System.Drawing.Color.Magenta; - this._FitWindow.Name = "_FitWindow"; - this._FitWindow.Size = new System.Drawing.Size (75, 22); - this._FitWindow.Text = "适合窗口"; - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size (6, 25); - // - // _ImageBox - // - this._ImageBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ImageBox.ForeColor = System.Drawing.SystemColors.ControlText; - this._ImageBox.Location = new System.Drawing.Point (12, 28); - this._ImageBox.MinimumSize = new System.Drawing.Size (454, 145); - this._ImageBox.Name = "_ImageBox"; - this._ImageBox.Size = new System.Drawing.Size (515, 380); - this._ImageBox.TabIndex = 0; - this._ImageBox.TabStop = false; - // - // ImageViewerForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size (539, 420); - this.Controls.Add (this._MainToolbar); - this.Controls.Add (this._ImageBox); - this.Name = "ImageViewerForm"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.Text = "查看图片"; - this._MainToolbar.ResumeLayout (false); - this._MainToolbar.PerformLayout (); - this.ResumeLayout (false); - this.PerformLayout (); - - } - - #endregion - - private Cyotek.Windows.Forms.ImageBox _ImageBox; - private System.Windows.Forms.ToolStrip _MainToolbar; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; - private System.Windows.Forms.ToolStripButton _FitWindow; - } -} \ No newline at end of file diff --git a/pdfpatcher/App/Functions/DocumentInspector/ImageViewerForm.cs b/pdfpatcher/App/Functions/DocumentInspector/ImageViewerForm.cs deleted file mode 100644 index b0db2398f978aae382687ca12a02cddb4ce334ff..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentInspector/ImageViewerForm.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System.Windows.Forms; -using FreeImageAPI; -using PDFPatcher.Common; -using PDFPatcher.Processor; -using PDFPatcher.Processor.Imaging; - -namespace PDFPatcher.Functions -{ - sealed partial class ImageViewerForm : Form - { - public ImageViewerForm() { - InitializeComponent(); - } - internal ImageViewerForm(ImageInfo image, byte[] bytes) : this() { - this.SetIcon(Properties.Resources.ViewContent); - if (image.ExtName == Constants.FileExtensions.Png || image.ExtName == Constants.FileExtensions.Tif) { - using (FreeImageBitmap bmp = ImageExtractor.CreateFreeImageBitmap(image, ref bytes, false, true)) { - _ImageBox.Image = bmp.ToBitmap(); - } - } - else { - try { - using (var s = new System.IO.MemoryStream(bytes)) { - using (FreeImageBitmap bmp = new FreeImageBitmap(s)) { - _ImageBox.Image = bmp.ToBitmap(); - } - } - } - catch (System.Exception ex) { - this.ErrorBox("无法加载图片", ex); - } - } - } - - protected override void OnClosed(System.EventArgs e) { - _ImageBox.Image.TryDispose(); - base.OnClosed(e); - } - - void _MainToolbar_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { - var n = e.ClickedItem.Name; - switch (n) { - case "_Save": - using (var f = new SaveFileDialog { - Title = "保存图片文件", - DefaultExt = Constants.FileExtensions.Png, - FileName = "导出图片.png", - Filter = Constants.FileExtensions.ImageFilter - }) { - if (f.ShowDialog() == DialogResult.OK) { - try { - using (var fi = new FreeImageAPI.FreeImageBitmap(_ImageBox.Image)) { - fi.Save(f.FileName); - } - } - catch (System.Exception ex) { - FormHelper.ErrorBox(ex.Message); - } - } - } - break; - case "_ZoomReset": - _ImageBox.ActualSize(); break; - case "_FitWindow": - _ImageBox.ZoomToFit(); break; - default: - break; - } - } - } -} diff --git a/pdfpatcher/App/Functions/DocumentInspector/ImageViewerForm.resx b/pdfpatcher/App/Functions/DocumentInspector/ImageViewerForm.resx deleted file mode 100644 index 574da632cd89c649b5323d399bbb877aa4006cf0..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentInspector/ImageViewerForm.resx +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - False - - - False - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/DocumentInspector/TextViewerForm.Designer.cs b/pdfpatcher/App/Functions/DocumentInspector/TextViewerForm.Designer.cs deleted file mode 100644 index 4b9594fa7c6370f4b2cb894be45bdf92ec1729ba..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentInspector/TextViewerForm.Designer.cs +++ /dev/null @@ -1,87 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class TextViewerForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._TextBox = new System.Windows.Forms.RichTextBox (); - this._OkButton = new System.Windows.Forms.Button (); - this._CancelButton = new System.Windows.Forms.Button (); - this.SuspendLayout (); - // - // _TextBox - // - this._TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._TextBox.Location = new System.Drawing.Point (12, 12); - this._TextBox.Name = "_TextBox"; - this._TextBox.Size = new System.Drawing.Size (472, 219); - this._TextBox.TabIndex = 0; - this._TextBox.Text = ""; - // - // _OkButton - // - this._OkButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._OkButton.Location = new System.Drawing.Point (328, 240); - this._OkButton.Name = "_OkButton"; - this._OkButton.Size = new System.Drawing.Size (75, 23); - this._OkButton.TabIndex = 1; - this._OkButton.Text = "确定(&Q)"; - this._OkButton.UseVisualStyleBackColor = true; - // - // _CancelButton - // - this._CancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this._CancelButton.Location = new System.Drawing.Point (409, 240); - this._CancelButton.Name = "_CancelButton"; - this._CancelButton.Size = new System.Drawing.Size (75, 23); - this._CancelButton.TabIndex = 2; - this._CancelButton.Text = "取消(&X)"; - this._CancelButton.UseVisualStyleBackColor = true; - // - // TextViewerForm - // - this.AcceptButton = this._OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this._CancelButton; - this.ClientSize = new System.Drawing.Size (496, 275); - this.Controls.Add (this._CancelButton); - this.Controls.Add (this._OkButton); - this.Controls.Add (this._TextBox); - this.Name = "TextViewerForm"; - this.Text = "文本内容"; - this.ResumeLayout (false); - - } - - #endregion - - private System.Windows.Forms.RichTextBox _TextBox; - private System.Windows.Forms.Button _OkButton; - private System.Windows.Forms.Button _CancelButton; - } -} \ No newline at end of file diff --git a/pdfpatcher/App/Functions/DocumentInspector/TextViewerForm.cs b/pdfpatcher/App/Functions/DocumentInspector/TextViewerForm.cs deleted file mode 100644 index 5e5054c61dbc1ba8c80addeab4e886f76d5dc2fa..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentInspector/TextViewerForm.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Windows.Forms; - -namespace PDFPatcher.Functions -{ - sealed partial class TextViewerForm : Form - { - ///获取或指定文本内容是否只读。 - public bool IsTextReadOnly { - get => _TextBox.ReadOnly; - set { - _TextBox.ReadOnly = value; - _OkButton.Visible = !value; - } - } - - ///获取或指定文本内容。 - public string TextContent { - get => _TextBox.Text; - set => _TextBox.Text = value; - } - - public TextViewerForm() { - InitializeComponent(); - } - - public TextViewerForm(string textContent, bool isTextReadonly) : this() { - TextContent = textContent; - IsTextReadOnly = isTextReadonly; - } - } -} diff --git a/pdfpatcher/App/Functions/DocumentInspector/TextViewerForm.resx b/pdfpatcher/App/Functions/DocumentInspector/TextViewerForm.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentInspector/TextViewerForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/DocumentInspectorControl.Designer.cs b/pdfpatcher/App/Functions/DocumentInspectorControl.Designer.cs deleted file mode 100644 index 30008bbb9f196f48d12914bf79a269147b83fb34..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentInspectorControl.Designer.cs +++ /dev/null @@ -1,468 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class DocumentInspectorControl - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.components = new System.ComponentModel.Container(); - System.Windows.Forms.ToolStripMenuItem _ExportBinary; - System.Windows.Forms.ToolStripMenuItem _ExportHexText; - System.Windows.Forms.ToolStripMenuItem _ExportXml; - System.Windows.Forms.ToolStripMenuItem _ExportUncompressedBinary; - System.Windows.Forms.ToolStripMenuItem _ExportUncompressedHexText; - System.Windows.Forms.ToolStripMenuItem _ExportToUnicode; - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DocumentInspectorControl)); - this._Container = new System.Windows.Forms.SplitContainer(); - this._ObjectDetailBox = new BrightIdeasSoftware.TreeListView(); - this._NameColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._ValueColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._DescriptionColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._ObjectTypeIcons = new System.Windows.Forms.ImageList(this.components); - this._DescriptionBox = new RichTextBoxLinks.RichTextBoxEx(); - this._RecentFileMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._OpenButton = new System.Windows.Forms.ToolStripSplitButton(); - this._LoadDocumentWorker = new System.ComponentModel.BackgroundWorker(); - this._MainToolbar = new System.Windows.Forms.ToolStrip(); - this._SaveButton = new System.Windows.Forms.ToolStripButton(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this._ExportButton = new System.Windows.Forms.ToolStripDropDownButton(); - this._ViewButton = new System.Windows.Forms.ToolStripButton(); - this._AddObjectMenu = new System.Windows.Forms.ToolStripDropDownButton(); - this._AddArrayNode = new System.Windows.Forms.ToolStripMenuItem(); - this._AddDictNode = new System.Windows.Forms.ToolStripMenuItem(); - this._AddBooleanNode = new System.Windows.Forms.ToolStripMenuItem(); - this._AddStringNode = new System.Windows.Forms.ToolStripMenuItem(); - this._AddNumberNode = new System.Windows.Forms.ToolStripMenuItem(); - this._AddNameNode = new System.Windows.Forms.ToolStripMenuItem(); - this._DeleteButton = new System.Windows.Forms.ToolStripButton(); - this._ExpandButton = new System.Windows.Forms.ToolStripButton(); - this._CollapseButton = new System.Windows.Forms.ToolStripButton(); - _ExportBinary = new System.Windows.Forms.ToolStripMenuItem(); - _ExportHexText = new System.Windows.Forms.ToolStripMenuItem(); - _ExportXml = new System.Windows.Forms.ToolStripMenuItem(); - _ExportUncompressedBinary = new System.Windows.Forms.ToolStripMenuItem(); - _ExportUncompressedHexText = new System.Windows.Forms.ToolStripMenuItem(); - _ExportToUnicode = new System.Windows.Forms.ToolStripMenuItem(); - ((System.ComponentModel.ISupportInitialize)(this._Container)).BeginInit(); - this._Container.Panel1.SuspendLayout(); - this._Container.Panel2.SuspendLayout(); - this._Container.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._ObjectDetailBox)).BeginInit(); - this._MainToolbar.SuspendLayout(); - this.SuspendLayout(); - // - // _ExportBinary - // - _ExportBinary.Name = "_ExportBinary"; - _ExportBinary.Size = new System.Drawing.Size(244, 22); - _ExportBinary.Text = "二进制文件(&E)..."; - // - // _ExportHexText - // - _ExportHexText.Name = "_ExportHexText"; - _ExportHexText.Size = new System.Drawing.Size(244, 22); - _ExportHexText.Text = "二进制文本文件(&W)..."; - // - // _ExportXml - // - _ExportXml.Name = "_ExportXml"; - _ExportXml.Size = new System.Drawing.Size(244, 22); - _ExportXml.Text = "&XML信息文件..."; - // - // _ExportUncompressedBinary - // - _ExportUncompressedBinary.Name = "_ExportUncompressedBinary"; - _ExportUncompressedBinary.Size = new System.Drawing.Size(244, 22); - _ExportUncompressedBinary.Text = "原始流对象二进制文件(&Y)..."; - // - // _ExportUncompressedHexText - // - _ExportUncompressedHexText.Name = "_ExportUncompressedHexText"; - _ExportUncompressedHexText.Size = new System.Drawing.Size(244, 22); - _ExportUncompressedHexText.Text = "原始流对象二进制文本文件(&Y)..."; - // - // _ExportToUnicode - // - _ExportToUnicode.Name = "_ExportToUnicode"; - _ExportToUnicode.Size = new System.Drawing.Size(244, 22); - _ExportToUnicode.Text = "&ToUnicode 映射表"; - // - // _Container - // - this._Container.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._Container.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; - this._Container.Location = new System.Drawing.Point(3, 28); - this._Container.Name = "_Container"; - this._Container.Orientation = System.Windows.Forms.Orientation.Horizontal; - // - // _Container.Panel1 - // - this._Container.Panel1.Controls.Add(this._ObjectDetailBox); - // - // _Container.Panel2 - // - this._Container.Panel2.Controls.Add(this._DescriptionBox); - this._Container.Size = new System.Drawing.Size(487, 310); - this._Container.SplitterDistance = 229; - this._Container.TabIndex = 1; - // - // _ObjectDetailBox - // - this._ObjectDetailBox.AllColumns.Add(this._NameColumn); - this._ObjectDetailBox.AllColumns.Add(this._ValueColumn); - this._ObjectDetailBox.AllColumns.Add(this._DescriptionColumn); - this._ObjectDetailBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ObjectDetailBox.CellEditActivation = BrightIdeasSoftware.ObjectListView.CellEditActivateMode.SingleClick; - this._ObjectDetailBox.CellEditUseWholeCell = false; - this._ObjectDetailBox.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this._NameColumn, - this._ValueColumn, - this._DescriptionColumn}); - this._ObjectDetailBox.GridLines = true; - this._ObjectDetailBox.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this._ObjectDetailBox.HideSelection = false; - this._ObjectDetailBox.Location = new System.Drawing.Point(3, 3); - this._ObjectDetailBox.Name = "_ObjectDetailBox"; - this._ObjectDetailBox.RevealAfterExpand = false; - this._ObjectDetailBox.ShowGroups = false; - this._ObjectDetailBox.Size = new System.Drawing.Size(481, 223); - this._ObjectDetailBox.SmallImageList = this._ObjectTypeIcons; - this._ObjectDetailBox.TabIndex = 0; - this._ObjectDetailBox.UseCompatibleStateImageBehavior = false; - this._ObjectDetailBox.View = System.Windows.Forms.View.Details; - this._ObjectDetailBox.VirtualMode = true; - this._ObjectDetailBox.ItemActivate += new System.EventHandler(this.ControlEvent); - // - // _NameColumn - // - this._NameColumn.IsEditable = false; - this._NameColumn.Text = "名称"; - this._NameColumn.Width = 184; - // - // _ValueColumn - // - this._ValueColumn.Text = "值"; - this._ValueColumn.Width = 187; - // - // _DescriptionColumn - // - this._DescriptionColumn.IsEditable = false; - this._DescriptionColumn.Text = "说明"; - this._DescriptionColumn.Width = 93; - // - // _ObjectTypeIcons - // - this._ObjectTypeIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("_ObjectTypeIcons.ImageStream"))); - this._ObjectTypeIcons.TransparentColor = System.Drawing.Color.Transparent; - this._ObjectTypeIcons.Images.SetKeyName(0, "Current"); - this._ObjectTypeIcons.Images.SetKeyName(1, "Page"); - this._ObjectTypeIcons.Images.SetKeyName(2, "Dictionary"); - this._ObjectTypeIcons.Images.SetKeyName(3, "Array"); - this._ObjectTypeIcons.Images.SetKeyName(4, "Name"); - this._ObjectTypeIcons.Images.SetKeyName(5, "String"); - this._ObjectTypeIcons.Images.SetKeyName(6, "Number"); - this._ObjectTypeIcons.Images.SetKeyName(7, "Stream"); - this._ObjectTypeIcons.Images.SetKeyName(8, "Bool"); - this._ObjectTypeIcons.Images.SetKeyName(9, "Reference"); - this._ObjectTypeIcons.Images.SetKeyName(10, "Document"); - this._ObjectTypeIcons.Images.SetKeyName(11, "Pages"); - this._ObjectTypeIcons.Images.SetKeyName(12, "PageCommands"); - this._ObjectTypeIcons.Images.SetKeyName(13, "Outlines"); - this._ObjectTypeIcons.Images.SetKeyName(14, "Outline"); - this._ObjectTypeIcons.Images.SetKeyName(15, "Trailer"); - this._ObjectTypeIcons.Images.SetKeyName(16, "GoToPage"); - this._ObjectTypeIcons.Images.SetKeyName(17, "Image"); - this._ObjectTypeIcons.Images.SetKeyName(18, "Info"); - this._ObjectTypeIcons.Images.SetKeyName(19, "Font"); - this._ObjectTypeIcons.Images.SetKeyName(20, "Resources"); - this._ObjectTypeIcons.Images.SetKeyName(21, "Null"); - this._ObjectTypeIcons.Images.SetKeyName(22, "Hidden"); - this._ObjectTypeIcons.Images.SetKeyName(23, "op_q"); - this._ObjectTypeIcons.Images.SetKeyName(24, "op_cm"); - this._ObjectTypeIcons.Images.SetKeyName(25, "op_tm"); - this._ObjectTypeIcons.Images.SetKeyName(26, "op_cs"); - this._ObjectTypeIcons.Images.SetKeyName(27, "op_sc"); - this._ObjectTypeIcons.Images.SetKeyName(28, "op_g"); - this._ObjectTypeIcons.Images.SetKeyName(29, "op_s"); - this._ObjectTypeIcons.Images.SetKeyName(30, "op_TJ"); - this._ObjectTypeIcons.Images.SetKeyName(31, "op_tj_"); - this._ObjectTypeIcons.Images.SetKeyName(32, "op_f"); - this._ObjectTypeIcons.Images.SetKeyName(33, "op_Ts"); - this._ObjectTypeIcons.Images.SetKeyName(34, "op_BT"); - this._ObjectTypeIcons.Images.SetKeyName(35, "op_Td"); - this._ObjectTypeIcons.Images.SetKeyName(36, "op_Tr"); - this._ObjectTypeIcons.Images.SetKeyName(37, "op_BDC"); - this._ObjectTypeIcons.Images.SetKeyName(38, "op_re"); - this._ObjectTypeIcons.Images.SetKeyName(39, "op_W*"); - this._ObjectTypeIcons.Images.SetKeyName(40, "op_c"); - this._ObjectTypeIcons.Images.SetKeyName(41, "op_l"); - this._ObjectTypeIcons.Images.SetKeyName(42, "op_tc"); - this._ObjectTypeIcons.Images.SetKeyName(43, "op_Tz"); - this._ObjectTypeIcons.Images.SetKeyName(44, "op_Tl"); - this._ObjectTypeIcons.Images.SetKeyName(45, "op_gs"); - this._ObjectTypeIcons.Images.SetKeyName(46, "op_w"); - this._ObjectTypeIcons.Images.SetKeyName(47, "op_M_"); - this._ObjectTypeIcons.Images.SetKeyName(48, "op_d"); - this._ObjectTypeIcons.Images.SetKeyName(49, "op_b"); - this._ObjectTypeIcons.Images.SetKeyName(50, "op_m"); - this._ObjectTypeIcons.Images.SetKeyName(51, "op_h"); - // - // _DescriptionBox - // - this._DescriptionBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._DescriptionBox.Location = new System.Drawing.Point(3, 3); - this._DescriptionBox.Name = "_DescriptionBox"; - this._DescriptionBox.ReadOnly = true; - this._DescriptionBox.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical; - this._DescriptionBox.Size = new System.Drawing.Size(481, 71); - this._DescriptionBox.TabIndex = 1; - this._DescriptionBox.Text = ""; - // - // _RecentFileMenu - // - this._RecentFileMenu.Name = "_RecentFileMenu"; - this._RecentFileMenu.OwnerItem = this._OpenButton; - this._RecentFileMenu.Size = new System.Drawing.Size(61, 4); - // - // _OpenButton - // - this._OpenButton.DropDown = this._RecentFileMenu; - this._OpenButton.Image = global::PDFPatcher.Properties.Resources.OpenFile; - this._OpenButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._OpenButton.Name = "_OpenButton"; - this._OpenButton.Size = new System.Drawing.Size(81, 22); - this._OpenButton.Text = "打开(&D)"; - this._OpenButton.ToolTipText = "打开 PDF 文档"; - this._OpenButton.ButtonClick += new System.EventHandler(this.ControlEvent); - // - // _LoadDocumentWorker - // - this._LoadDocumentWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this._LoadDocumentWorker_DoWork); - this._LoadDocumentWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this._LoadDocumentWorker_RunWorkerCompleted); - // - // _MainToolbar - // - this._MainToolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._OpenButton, - this._SaveButton, - this.toolStripSeparator1, - this._ExportButton, - this._ViewButton, - this._AddObjectMenu, - this._DeleteButton, - this._ExpandButton, - this._CollapseButton}); - this._MainToolbar.Location = new System.Drawing.Point(0, 0); - this._MainToolbar.Name = "_MainToolbar"; - this._MainToolbar.Size = new System.Drawing.Size(495, 25); - this._MainToolbar.TabIndex = 0; - this._MainToolbar.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.ToolbarItemClicked); - // - // _SaveButton - // - this._SaveButton.Enabled = false; - this._SaveButton.Image = global::PDFPatcher.Properties.Resources.Save; - this._SaveButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._SaveButton.Name = "_SaveButton"; - this._SaveButton.Size = new System.Drawing.Size(68, 22); - this._SaveButton.Text = "保存(&B)"; - this._SaveButton.ToolTipText = "保存修改后的 PDF 文档"; - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); - // - // _ExportButton - // - this._ExportButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - _ExportBinary, - _ExportHexText, - _ExportXml, - _ExportUncompressedBinary, - _ExportUncompressedHexText, - _ExportToUnicode}); - this._ExportButton.Enabled = false; - this._ExportButton.Image = global::PDFPatcher.Properties.Resources.ExportFile; - this._ExportButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._ExportButton.Name = "_ExportButton"; - this._ExportButton.Size = new System.Drawing.Size(61, 22); - this._ExportButton.Text = "导出"; - this._ExportButton.ToolTipText = "导出流对象的内容"; - this._ExportButton.DropDownOpening += new System.EventHandler(this._ExportButton_DropDownOpening); - this._ExportButton.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.ToolbarItemClicked); - // - // _ViewButton - // - this._ViewButton.Enabled = false; - this._ViewButton.Image = global::PDFPatcher.Properties.Resources.ViewContent; - this._ViewButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._ViewButton.Name = "_ViewButton"; - this._ViewButton.Size = new System.Drawing.Size(52, 22); - this._ViewButton.Text = "查看"; - this._ViewButton.ToolTipText = "查看流对象"; - // - // _AddObjectMenu - // - this._AddObjectMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._AddArrayNode, - this._AddDictNode, - this._AddBooleanNode, - this._AddStringNode, - this._AddNumberNode, - this._AddNameNode}); - this._AddObjectMenu.Enabled = false; - this._AddObjectMenu.Image = global::PDFPatcher.Properties.Resources.AddChildNode; - this._AddObjectMenu.ImageTransparentColor = System.Drawing.Color.Magenta; - this._AddObjectMenu.Name = "_AddObjectMenu"; - this._AddObjectMenu.Size = new System.Drawing.Size(97, 22); - this._AddObjectMenu.Text = "插入子节点"; - this._AddObjectMenu.ToolTipText = "添加子节点对象"; - this._AddObjectMenu.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._AddObjectMenu_DropDownItemClicked); - // - // _AddArrayNode - // - this._AddArrayNode.Name = "_AddArrayNode"; - this._AddArrayNode.Size = new System.Drawing.Size(136, 22); - this._AddArrayNode.Text = "列表节点"; - // - // _AddDictNode - // - this._AddDictNode.Name = "_AddDictNode"; - this._AddDictNode.Size = new System.Drawing.Size(136, 22); - this._AddDictNode.Text = "字典节点"; - // - // _AddBooleanNode - // - this._AddBooleanNode.Name = "_AddBooleanNode"; - this._AddBooleanNode.Size = new System.Drawing.Size(136, 22); - this._AddBooleanNode.Text = "真假值节点"; - // - // _AddStringNode - // - this._AddStringNode.Name = "_AddStringNode"; - this._AddStringNode.Size = new System.Drawing.Size(136, 22); - this._AddStringNode.Text = "字符串节点"; - // - // _AddNumberNode - // - this._AddNumberNode.Name = "_AddNumberNode"; - this._AddNumberNode.Size = new System.Drawing.Size(136, 22); - this._AddNumberNode.Text = "数值节点"; - // - // _AddNameNode - // - this._AddNameNode.Name = "_AddNameNode"; - this._AddNameNode.Size = new System.Drawing.Size(136, 22); - this._AddNameNode.Text = "名称节点"; - // - // _DeleteButton - // - this._DeleteButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this._DeleteButton.Enabled = false; - this._DeleteButton.Image = global::PDFPatcher.Properties.Resources.Delete; - this._DeleteButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._DeleteButton.Name = "_DeleteButton"; - this._DeleteButton.Size = new System.Drawing.Size(23, 22); - this._DeleteButton.Text = "删除"; - this._DeleteButton.ToolTipText = "删除选中的对象"; - // - // _ExpandButton - // - this._ExpandButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this._ExpandButton.Enabled = false; - this._ExpandButton.Image = global::PDFPatcher.Properties.Resources.Expand; - this._ExpandButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._ExpandButton.Name = "_ExpandButton"; - this._ExpandButton.Size = new System.Drawing.Size(23, 22); - this._ExpandButton.Text = "展开"; - this._ExpandButton.ToolTipText = "展开选中的项目"; - // - // _CollapseButton - // - this._CollapseButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this._CollapseButton.Enabled = false; - this._CollapseButton.Image = global::PDFPatcher.Properties.Resources.Collapse; - this._CollapseButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._CollapseButton.Name = "_CollapseButton"; - this._CollapseButton.Size = new System.Drawing.Size(23, 22); - this._CollapseButton.Text = "收拢"; - this._CollapseButton.ToolTipText = "收拢选中的项目"; - // - // DocumentInspectorControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this._MainToolbar); - this.Controls.Add(this._Container); - this.Font = new System.Drawing.Font("SimSun", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.Name = "DocumentInspectorControl"; - this.Size = new System.Drawing.Size(495, 341); - this._Container.Panel1.ResumeLayout(false); - this._Container.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this._Container)).EndInit(); - this._Container.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this._ObjectDetailBox)).EndInit(); - this._MainToolbar.ResumeLayout(false); - this._MainToolbar.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.SplitContainer _Container; - private BrightIdeasSoftware.TreeListView _ObjectDetailBox; - private BrightIdeasSoftware.OLVColumn _NameColumn; - private BrightIdeasSoftware.OLVColumn _ValueColumn; - private RichTextBoxLinks.RichTextBoxEx _DescriptionBox; - private System.Windows.Forms.ContextMenuStrip _RecentFileMenu; - private System.Windows.Forms.ImageList _ObjectTypeIcons; - private BrightIdeasSoftware.OLVColumn _DescriptionColumn; - private System.ComponentModel.BackgroundWorker _LoadDocumentWorker; - private System.Windows.Forms.ToolStripSplitButton _OpenButton; - private System.Windows.Forms.ToolStrip _MainToolbar; - private System.Windows.Forms.ToolStripButton _SaveButton; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; - private System.Windows.Forms.ToolStripDropDownButton _ExportButton; - private System.Windows.Forms.ToolStripButton _ViewButton; - private System.Windows.Forms.ToolStripButton _DeleteButton; - private System.Windows.Forms.ToolStripButton _ExpandButton; - private System.Windows.Forms.ToolStripButton _CollapseButton; - private System.Windows.Forms.ToolStripDropDownButton _AddObjectMenu; - private System.Windows.Forms.ToolStripMenuItem _AddNameNode; - private System.Windows.Forms.ToolStripMenuItem _AddNumberNode; - private System.Windows.Forms.ToolStripMenuItem _AddStringNode; - private System.Windows.Forms.ToolStripMenuItem _AddBooleanNode; - private System.Windows.Forms.ToolStripMenuItem _AddDictNode; - private System.Windows.Forms.ToolStripMenuItem _AddArrayNode; - } -} diff --git a/pdfpatcher/App/Functions/DocumentInspectorControl.cs b/pdfpatcher/App/Functions/DocumentInspectorControl.cs deleted file mode 100644 index 66b52c3c751a78678dd93480a4cf2f9c1864f0c4..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentInspectorControl.cs +++ /dev/null @@ -1,860 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Security.Permissions; -using System.Windows.Forms; -using System.Xml; -using BrightIdeasSoftware; -using iTextSharp.text.pdf; -using PDFPatcher.Common; -using PDFPatcher.Model; -using PDFPatcher.Processor; - -namespace PDFPatcher.Functions -{ - [ToolboxItem(false)] - public sealed partial class DocumentInspectorControl : FunctionControl, IDocumentEditor - { - static readonly PdfObjectType[] __XmlExportableTypes = new PdfObjectType[] { PdfObjectType.Page, PdfObjectType.Pages, PdfObjectType.Trailer }; - static Dictionary __OpNameIcons; - static Dictionary __PdfObjectIcons; - - PdfPathDocument _pdf; - ImageExtractor _imgExp; - string _fileName; - ToolStripItem[] _addPdfObjectMenuItems; - int[] _pdfTypeForAddObjectMenuItems; - - static readonly ImageExtracterOptions _imgExpOption = new ImageExtracterOptions() { - OutputPath = Path.GetTempPath(), - MergeImages = false - }; - - public override string FunctionName => "结构探查器"; - - public override Bitmap IconImage => Properties.Resources.DocumentInspector; - - public event EventHandler DocumentChanged; - public string DocumentPath { - get => _fileName; - set { - if (_fileName != value) { - _fileName = value; - DocumentChanged?.Invoke(this, new DocumentChangedEventArgs(value)); - } - } - } - - public DocumentInspectorControl() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - } - - void OnLoad() { - _MainToolbar.ScaleIcons(16); - _ObjectDetailBox.ScaleColumnWidths(); - - _ObjectDetailBox.EmptyListMsg = "请使用“打开”按钮加载需要检查结构的 PDF 文件,或从资源管理器拖放文件到本列表框"; - - if (__OpNameIcons == null || __OpNameIcons.Count == 0) { - __OpNameIcons = InitOpNameIcons(); - } - if (__PdfObjectIcons == null || __PdfObjectIcons.Count == 0) { - __PdfObjectIcons = InitPdfObjectIcons(); - } - #region TreeListView init - _ObjectDetailBox.SetTreeViewLine(); - _ObjectDetailBox.FixEditControlWidth(); - new TypedColumn(_NameColumn) { - AspectGetter = (DocumentObject d) => { - return d.FriendlyName ?? d.Name; - }, - ImageGetter = (DocumentObject d) => { - if (d.ImageKey != null) { - return d.ImageKey; - } - - if (d.Type == PdfObjectType.Normal) { - return GetImageKey(d); - } - - switch (d.Type) { - case PdfObjectType.Trailer: - return __OpNameIcons["Document"]; - case PdfObjectType.Root: - break; - case PdfObjectType.Pages: - return __OpNameIcons["Pages"]; - case PdfObjectType.Page: - return __OpNameIcons["Page"]; - case PdfObjectType.Image: - return __OpNameIcons["Image"]; - case PdfObjectType.Outline: - return __OpNameIcons["Outline"]; - case PdfObjectType.PageCommands: - return __OpNameIcons["PageCommands"]; - case PdfObjectType.PageCommand: - if (d.ImageKey == null) { - var n = d.ExtensiveObject as string; - if ((n != null && __OpNameIcons.TryGetValue(n, out int ic)) - || (d.Name.StartsWith(Constants.ContentPrefix + ":") && __OpNameIcons.TryGetValue(d.Name, out ic)) - ) { - d.ImageKey = ic; - } - else { - d.ImageKey = __OpNameIcons["Null"]; - } - } - return d.ImageKey; - case PdfObjectType.Hidden: - return __OpNameIcons["Hidden"]; - } - return GetImageKey(d); - } - }; - new TypedColumn(_ValueColumn) { - AspectGetter = (DocumentObject d) => { - return d.FriendlyValue ?? d.LiteralValue; - }, - AspectPutter = (DocumentObject d, object value) => { - if (d.UpdateDocumentObject(value)) { - var r = d.FindReferenceAncestor(); - if (r != null) { - RefreshReferences(r); - } - } - else if (d.Parent != null && d.Parent.Type == PdfObjectType.Outline && d.Name == "Title") { - d.Parent.Description = (string)value; - _ObjectDetailBox.RefreshObject(d.Parent); - } - } - }; - _DescriptionColumn.AspectGetter = (object o) => { - return ((DocumentObject)o).Description; - }; - _ObjectDetailBox.PrimarySortColumn = null; - _ObjectDetailBox.CopySelectionOnControlC = true; - _ObjectDetailBox.CellEditStarting += (s, args) => { - var d = args.RowObject as DocumentObject; - var po = d.Value as PdfObject; - if (po == null) { - args.Cancel = true; - return; - } - if (po.Type == PdfObject.BOOLEAN) { - args.Control = new CheckBox() { Checked = (po as PdfBoolean).BooleanValue, Bounds = args.CellBounds }; - } - else if (po.Type == PdfObject.NUMBER) { - args.Control = new TextBox() { Text = (po as PdfNumber).DoubleValue.ToText(), Bounds = args.CellBounds }; - } - else if (po.Type == PdfObject.INDIRECT || PdfHelper.CompoundTypes.Contains(po.Type)) { - args.Cancel = true; - } - }; - _ObjectDetailBox.CanExpandGetter = (object o) => { - var d = o as DocumentObject; - if (d == null) { - return false; - } - if (d.Type == PdfObjectType.GoToPage) { - d.ImageKey = __OpNameIcons["GoToPage"]; - } - return d.HasChildren; - }; - _ObjectDetailBox.ChildrenGetter = delegate (object o) { - var d = o as DocumentObject; - if (d == null) { - return null; - } - return d.Children; - }; - _ObjectDetailBox.RowFormatter = (OLVListItem olvItem) => { - var o = olvItem.RowObject as DocumentObject; - if (o == null) { - return; - } - if (o.Type == PdfObjectType.Normal) { - var po = o.Value; - if (po == null) { - return; - } - if (po.Type == PdfObject.INDIRECT) { - olvItem.UseItemStyleForSubItems = false; - olvItem.SubItems[_ValueColumn.Index].ForeColor = SystemColors.HotTrack; - } - else if (PdfHelper.CompoundTypes.Contains(po.Type)) { - olvItem.UseItemStyleForSubItems = false; - olvItem.SubItems[_ValueColumn.Index].ForeColor = SystemColors.GrayText; - } - } - else if (o.Type == PdfObjectType.Page) { - olvItem.ForeColor = Color.DarkRed; - } - else if (o.Type == PdfObjectType.Pages) { - olvItem.Font = new Font(olvItem.Font, FontStyle.Bold); - olvItem.ForeColor = Color.DarkRed; - olvItem.BackColor = Color.LightYellow; - } - else if (o.Type == PdfObjectType.Trailer) { - olvItem.Font = new Font(olvItem.Font, FontStyle.Bold); - olvItem.BackColor = Color.LightYellow; - } - else if (o.Type == PdfObjectType.Outline) { - olvItem.UseItemStyleForSubItems = false; - olvItem.SubItems[0].ForeColor = SystemColors.HotTrack; - olvItem.SubItems[_ValueColumn.Index].ForeColor = SystemColors.HotTrack; - } - else if (o.Type == PdfObjectType.PageCommand && (o.Name == "字符串" || o.Name == "换行字符串")) { - olvItem.UseItemStyleForSubItems = false; - var s = olvItem.SubItems[_DescriptionColumn.Index]; - s.Font = new Font(olvItem.Font, FontStyle.Underline); - } - }; - _ObjectDetailBox.SelectionChanged += _ObjectDetailBox_SelectionChanged; - _ObjectDetailBox.IsSimpleDropSink = true; - _ObjectDetailBox.CanDrop += _ObjectDetailBox_CanDrop; - _ObjectDetailBox.Dropped += _ObjectDetailBox_Dropped; - #endregion - _AddNameNode.Image = _ObjectTypeIcons.Images["Name"]; - _AddStringNode.Image = _ObjectTypeIcons.Images["String"]; - _AddDictNode.Image = _ObjectTypeIcons.Images["Dictionary"]; - _AddArrayNode.Image = _ObjectTypeIcons.Images["Array"]; - _AddNumberNode.Image = _ObjectTypeIcons.Images["Number"]; - _AddBooleanNode.Image = _ObjectTypeIcons.Images["Bool"]; - - _addPdfObjectMenuItems = new ToolStripItem[] { _AddNameNode, _AddStringNode, _AddDictNode, _AddArrayNode, _AddNumberNode, _AddBooleanNode }; - _pdfTypeForAddObjectMenuItems = new int[] { PdfObject.NAME, PdfObject.STRING, PdfObject.DICTIONARY, PdfObject.ARRAY, PdfObject.NUMBER, PdfObject.BOOLEAN }; - - _OpenButton.DropDownOpening += FileListHelper.OpenPdfButtonDropDownOpeningHandler; - _OpenButton.DropDownItemClicked += (s, args) => { - args.ClickedItem.Owner.Hide(); - LoadDocument(args.ClickedItem.ToolTipText); - }; - Disposed += (s, args) => { - _pdf?.Document.Dispose(); - }; - } - - public override void SetupCommand(ToolStripItem item) { - var n = item.Name; - switch (n) { - case Commands.Action: - item.Text = _SaveButton.Text; - item.Image = _SaveButton.Image; - item.ToolTipText = _SaveButton.ToolTipText; - return; - case Commands.Delete: - EnableCommand(item, _DeleteButton.Enabled, true); - return; - default: - break; - } - if (Commands.CommonSelectionCommands.Contains(n) - || Commands.RecentFiles == n - ) { - EnableCommand(item, _ObjectDetailBox.GetItemCount() > 0, true); - } - else { - base.SetupCommand(item); - } - } - - public override void ExecuteCommand(string commandName, params string[] parameters) { - switch (commandName) { - case Commands.Open: - var p = AppContext.MainForm.ShowPdfFileDialog(); - if (p != null) { - LoadDocument(p); - } - break; - case Commands.OpenFile: - LoadDocument(parameters[0]); - break; - case Commands.Action: - SaveDocument(); - break; - case Commands.SelectAllItems: - _ObjectDetailBox.SelectAll(); - break; - case Commands.SelectNone: - _ObjectDetailBox.SelectedObjects = null; - break; - case Commands.InvertSelectItem: - _ObjectDetailBox.InvertSelect(); - break; - default: - base.ExecuteCommand(commandName, parameters); - break; - } - } - - [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] - protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { - if (_ObjectDetailBox.IsCellEditing) { - return base.ProcessCmdKey(ref msg, keyData); - } - switch (keyData ^ Keys.Control) { - case Keys.O: ExecuteCommand(Commands.Open); return true; - case Keys.C: ExecuteCommand(Commands.Copy); return true; - case Keys.S: ExecuteCommand(Commands.Action); return true; - } - return base.ProcessCmdKey(ref msg, keyData); - } - - void RefreshReferences(DocumentObject r) { - if (r.Value == null || r.Value.Type != PdfObject.INDIRECT) { - return; - } - var v = r.Value as PdfIndirectReference; - var l = _ObjectDetailBox.VirtualListSize; - for (int i = 0; i < l; i++) { - var m = _ObjectDetailBox.GetModelObject(i) as DocumentObject; - if (m == null) { - continue; - } - if (m.Type == PdfObjectType.PageCommands) { - i += (_ObjectDetailBox.VirtualListDataSource as TreeListView.Tree).GetVisibleDescendentCount(m); - } - if (m.ExtensiveObject != null && m.Value != null && m.Value.Type == PdfObject.INDIRECT) { - var mv = m.Value as PdfIndirectReference; - if (mv.Number == v.Number && mv.Generation == v.Generation && m != r) { - _ObjectDetailBox.RefreshObject(m); - } - } - } - } - - public void CloseDocument() { - _pdf.Document?.SafeFile.Close(); - } - - public void Reopen() { - _pdf.Document?.SafeFile.ReOpen(); - } - - void _ObjectDetailBox_CanDrop(object sender, OlvDropEventArgs e) { - var o = e.DataObject as DataObject; - if (o == null) { - return; - } - var f = o.GetFileDropList(); - foreach (var item in f) { - if (FileHelper.HasExtension(item, Constants.FileExtensions.Xml) - || FileHelper.HasExtension(item, Constants.FileExtensions.Pdf)) { - e.Handled = true; - e.DropTargetLocation = DropTargetLocation.Background; - e.Effect = DragDropEffects.Move; - e.InfoMessage = "打开文件" + item; - return; - } - } - e.Effect = DragDropEffects.None; - e.DropTargetLocation = DropTargetLocation.None; - } - - void _ObjectDetailBox_Dropped(object sender, OlvDropEventArgs e) { - var o = e.DataObject as DataObject; - if (o == null) { - return; - } - var f = o.GetFileDropList(); - if (f.Count == 0) { - return; - } - LoadDocument(f[0]); - } - - void _ObjectDetailBox_SelectionChanged(object sender, EventArgs e) { - var si = _ObjectDetailBox.SelectedItem; - if (si == null) { - return; - } - _ExpandButton.Enabled = _CollapseButton.Enabled = true; - var d = _ObjectDetailBox.GetModelObject(si.Index) as DocumentObject; - _ViewButton.Enabled = false; - _DeleteButton.Enabled = false; - _ExportButton.Enabled = false; - _AddObjectMenu.Enabled = false; - if (d == null) { - return; - } - if (d.Value != null && (d.Value.Type == PdfObject.INDIRECT || d.Value.Type == PdfObject.STREAM)) { - var s = d.Value as PRStream ?? d.ExtensiveObject as PRStream; - if (s != null) { - _ViewButton.Enabled = d.Name.StartsWith("Font") == false; - _ExportButton.Enabled = _AddObjectMenu.Enabled = true; - if (PdfName.IMAGE.Equals(s.GetAsName(PdfName.SUBTYPE))) { - ShowDescription("图片", null, PdfHelper.GetTypeName(PdfObject.STREAM)); - return; - } - } - } - if (d.Value != null && d.Value is PdfDictionary || d.ExtensiveObject is PdfDictionary) { - _AddObjectMenu.Enabled = true; - } - if (__XmlExportableTypes.Contains(d.Type)) { - _ExportButton.Enabled = true; - } - if (d.Parent == null) { - if (d.Type == PdfObjectType.Trailer) { - ShowDescription("文档根节点", _fileName, null); - } - else if (d.Type == PdfObjectType.Pages) { - ShowDescription("文档页面", "页数:" + _pdf.PageCount, null); - } - return; - } - var i = Model.PdfStructInfo.GetInfo(d.Parent.GetContextName(), d.Name); - string t = null; - var o = (d.ExtensiveObject as PdfObject ?? d.Value); - if (o != null) { - t = PdfHelper.GetTypeName(o.Type); - } - ShowDescription(String.IsNullOrEmpty(i.Name) || d.Name == i.Name ? d.Name : String.Concat(d.Name, ":", i.Name), i.Description, t); - _DeleteButton.Enabled = !i.IsRequired && d != null - && (d.Type == PdfObjectType.Normal || d.Type == PdfObjectType.Image || d.Type == PdfObjectType.Outline && d.Name == "Outlines"); - } - - Dictionary InitOpNameIcons() { - var p = new string[] { "Document", "Pages", "Page", "PageCommands", "Image", "Hidden", "GoToPage", "Outline", "Null" }; - var n = new string[] { - "q", "Tm", "cm", "gs", "ri", "CS", "cs", - "RG", "rg", "scn", "SCN", "sc", "SC", "K", "k", - "g", "G", "s", "S", - "f", "F", "f*", "b", "B", "b*", "B*", - "Tf", "Tz", "Ts", "T*", "Td", "TD", - "TJ", "Tj", "'", "\"", - "Tk", "Tr", "Tc", "Tw", "TL", - "BI", "BT", "BDC", "BMC", - "Do", - "W*", "W", "c", "v", "y", "l", "re", - "m", "h", "n", "w", "J", "j", "M", "d", "i", - "pdf:number", "pdf:string", "pdf:name", "pdf:dictionary", "pdf:array", "pdf:boolean" }; - var ico = new string[] { - "op_q", "op_tm", "op_cm", "op_gs", "op_gs", "op_gs", "op_gs", - "op_sc", "op_sc", "op_sc", "op_sc", "op_sc", "op_sc", "op_sc", "op_sc", - "op_g", "op_g", "op_s", "op_s", - "op_f", "op_f", "op_f", "op_b", "op_b", "op_b", "op_b", - "Font", "op_Tz", "op_Ts", "op_Td", "op_Td", "op_Td", - "op_TJ", "op_TJ", "op_TJ", "op_TJ", - "op_Tr", "op_Tr", "op_Tc", "op_Tc", "op_Tl", - "Image", "op_BT", "op_BDC", "op_BDC", - "Resources", - "op_W*", "op_W*", "op_c", "op_c", "op_c", "op_l", "op_re", - "op_m", "op_h", "op_h", "op_w", "op_l", "op_l", "op_M_", "op_d", "op_gs", - "Number", "String", "Name", "Dictionary", "Array", "Bool" }; - var d = new Dictionary(n.Length + p.Length); - foreach (var i in p) { - d.Add(i, _ObjectTypeIcons.Images.IndexOfKey(i)); - } - for (int i = 0; i < n.Length; i++) { - d.Add(n[i], _ObjectTypeIcons.Images.IndexOfKey(ico[i])); - } - return d; - } - Dictionary InitPdfObjectIcons() { - var n = new int[] { PdfObject.NULL, PdfObject.ARRAY, PdfObject.BOOLEAN, - PdfObject.DICTIONARY, PdfObject.INDIRECT, PdfObject.NAME, - PdfObject.NUMBER, PdfObject.STREAM, PdfObject.STRING }; - var d = new Dictionary(n.Length); - for (int i = 0; i < n.Length; i++) { - d.Add(n[i], _ObjectTypeIcons.Images.IndexOfKey(PdfHelper.GetTypeName(n[i]))); - } - return d; - } - - static int GetImageKey(DocumentObject d) { - if (d.Value != null) { - var po = d.Value; - if (po.Type == PdfObject.INDIRECT && d.ExtensiveObject is PdfObject) { - po = d.ExtensiveObject as PdfObject; - } - return __PdfObjectIcons.GetOrDefault(po.Type); - } - return __PdfObjectIcons[PdfObject.NULL]; - } - - void _GotoImportLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { - AppContext.MainForm.SelectFunctionList(Function.Patcher); - } - - void bookmarkEditor1_DragEnter(object sender, DragEventArgs e) { - e.FeedbackDragFileOver(Constants.FileExtensions.PdfAndAllBookmarkExtension); - } - - void ControlEvent(object sender, EventArgs e) { - if (sender == _OpenButton) { - ExecuteCommand(Commands.Open); - } - } - - void LoadDocument(string path) { - _MainToolbar.Enabled = _ObjectDetailBox.Enabled = false; - _DescriptionBox.Text = "正在打开文档:" + path; - _LoadDocumentWorker.RunWorkerAsync(path); - } - - void ShowDescription(string name, string description, string type) { - _DescriptionBox.Text = String.Empty; - if (String.IsNullOrEmpty(name)) { - return; - } - - _DescriptionBox.SetSelectionFontSize(13); - _DescriptionBox.SetSelectionBold(true); - _DescriptionBox.AppendText(name); - _DescriptionBox.SetSelectionFontSize(9); - if (type != null) { - _DescriptionBox.AppendText(Environment.NewLine); - _DescriptionBox.AppendText("类型:" + type); - } - if (description != null) { - _DescriptionBox.AppendText(Environment.NewLine); - _DescriptionBox.AppendText(description); - } - } - - void ToolbarItemClicked(object sender, ToolStripItemClickedEventArgs e) { - if (_ObjectDetailBox.FocusedItem == null) { - return; - } - var ci = e.ClickedItem; - if (ci == _SaveButton) { - SaveDocument(); - return; - } - var cn = ci.Name; - var n = _ObjectDetailBox.GetModelObject(_ObjectDetailBox.FocusedItem.Index) as DocumentObject; - if (ci == _DeleteButton) { - //if (this.ActiveControl == _DocumentTree) { - if (n == null || n.Parent == null) { - return; - } - var po = n.Parent.Value as PdfObject; - if (po == null) { - return; - } - if (po.Type == PdfObject.INDIRECT) { - po = n.Parent.ExtensiveObject as PdfObject; - } - if (PdfHelper.CompoundTypes.Contains(po.Type)) { - if (n.Parent.RemoveChildByName(n.Name)) { - _ObjectDetailBox.RefreshObject(n.Parent); - } - } - //} - } - else if (ci == _ViewButton) { - if (n == null) { - return; - } - var s = n.ExtensiveObject as PRStream; - if (s == null) { - return; - } - if (PdfName.IMAGE.Equals(s.GetAsName(PdfName.SUBTYPE)) - || n.Name == "Thumb") { - var info = new Processor.Imaging.ImageInfo(s); - var bytes = info.DecodeImage(_imgExpOption); - if (bytes != null) { - if (info.LastDecodeError != null) { - FormHelper.ErrorBox("导出图像时出现错误:" + info.LastDecodeError); - } - else if (info.ExtName != Constants.FileExtensions.Dat) { - new ImageViewerForm(info, bytes).Show(); - } - } - } - else { - var b = PdfReader.GetStreamBytes(s); - using (var ms = new MemoryStream(b)) - using (var r = new StreamReader(ms)) - using (var f = new TextViewerForm(r.ReadToEnd(), true)) { - f.ShowDialog(FindForm()); - //_DescriptionBox.Text = String.Empty; - //while (r.Peek () != -1) { - // _DescriptionBox.AppendText (r.ReadLine ()); - // _DescriptionBox.AppendText (Environment.NewLine); - //} - } - } - } - else if (cn == "_ExportBinary") { - ci.HidePopupMenu(); - ExportBinaryStream(n, true); - } - else if (cn == "_ExportHexText") { - ci.HidePopupMenu(); - ExportBinHexStream(n, true); - } - else if (cn == "_ExportUncompressedBinary") { - ci.HidePopupMenu(); - ExportBinaryStream(n, false); - } - else if (cn == "_ExportUncompressedHexText") { - ci.HidePopupMenu(); - ExportBinHexStream(n, false); - } - else if (cn == "_ExportToUnicode") { - ci.HidePopupMenu(); - ExportToUnicode(n); - } - else if (cn == "_ExportXml") { - ci.HidePopupMenu(); - var so = _ObjectDetailBox.SelectedObjects; - var ep = new List(so.Count); - bool exportTrailer = false; - if (_ObjectDetailBox.Items[0].Selected || n.Type == PdfObjectType.Trailer) { - exportTrailer = true; - } - foreach (var item in so) { - var d = item as DocumentObject; - if (d == null) { - continue; - } - if (d.Type == PdfObjectType.Page) { - ep.Add((int)d.ExtensiveObject); - } - else if (d.Type == PdfObjectType.Pages) { - foreach (var r in PageRangeCollection.Parse((string)d.ExtensiveObject, 1, _pdf.PageCount, true)) { - foreach (var p in r) { - ep.Add(p); - } - } - } - } - if (ep.Count == 1) { - ExportXmlInfo((n.FriendlyName ?? n.Name), exportTrailer, new int[] { (int)n.ExtensiveObject }); - } - else { - ExportXmlInfo(Path.GetFileNameWithoutExtension(_fileName), exportTrailer, ep.ToArray()); - } - } - else if (cn == "_ExpandButton") { - _ObjectDetailBox.ExpandSelected(); - } - else if (cn == "_CollapseButton") { - _ObjectDetailBox.CollapseSelected(); - } - } - - void AddChildNode(DocumentObject documentObject, int objectType) { - using (var f = new AddPdfObjectForm()) { - f.PdfObjectType = objectType; - if (f.ShowDialog() == DialogResult.OK) { - var d = (documentObject.ExtensiveObject ?? documentObject.ExtensiveObject) as PdfDictionary; - var v = f.PdfValue; - d.Put(new PdfName(f.ObjectName), f.CreateAsIndirect ? _pdf.Document.AddPdfObject(v) : v); - documentObject.PopulateChildren(true); - _ObjectDetailBox.RefreshObject(documentObject); - } - } - } - - void ExportXmlInfo(string fileName, bool exportTrailer, int[] pages) { - using (var d = new SaveFileDialog() { AddExtension = true, FileName = fileName + Constants.FileExtensions.Xml, DefaultExt = Constants.FileExtensions.Xml, Filter = Constants.FileExtensions.XmlFilter, Title = "请选择信息文件的保存位置" }) { - if (d.ShowDialog() == DialogResult.OK) { - var exp = new PdfContentExport(new ExporterOptions() { ExtractPageDictionary = true, ExportContentOperators = true }); - using (XmlWriter w = XmlWriter.Create(d.FileName, DocInfoExporter.GetWriterSettings())) { - w.WriteStartDocument(); - w.WriteStartElement(Constants.PdfInfo); - w.WriteAttributeString(Constants.ContentPrefix, "http://www.w3.org/2000/xmlns/", Constants.ContentNamespace); - DocInfoExporter.WriteDocumentInfoAttributes(w, _fileName, _pdf.PageCount); - if (exportTrailer) { - exp.ExportTrailer(w, _pdf.Document); - } - exp.ExtractPage(_pdf.Document, w, pages); - w.WriteEndElement(); - } - } - } - } - - void ExportBinHexStream(DocumentObject n, bool decode) { - using (var d = new SaveFileDialog() { AddExtension = true, FileName = (n.FriendlyName ?? n.Name) + Constants.FileExtensions.Txt, DefaultExt = Constants.FileExtensions.Txt, Filter = "文本形式的二进制数据文件(*.txt)|*.txt|" + Constants.FileExtensions.AllFilter, Title = "请选择文件流的保存位置" }) { - if (d.ShowDialog() == DialogResult.OK) { - var s = n.ExtensiveObject as PRStream; - try { - var sb = decode ? DecodeStreamBytes(n) : PdfReader.GetStreamBytesRaw(s); - sb.DumpHexBinBytes(d.FileName); - } - catch (Exception ex) { - FormHelper.ErrorBox("在导出流数据时出错:" + ex.Message); - } - } - } - } - - void ExportBinaryStream(DocumentObject n, bool decode) { - using (var d = new SaveFileDialog() { AddExtension = true, FileName = (n.FriendlyName ?? n.Name) + ".bin", DefaultExt = ".bin", Filter = "二进制数据文件(*.bin,*.dat)|*.bin;*.dat|" + Constants.FileExtensions.AllFilter, Title = "请选择文件流的保存位置" }) { - if (d.ShowDialog() == DialogResult.OK) { - var s = n.ExtensiveObject as PRStream; - try { - var sb = decode ? DecodeStreamBytes(n) : PdfReader.GetStreamBytesRaw(s); - sb.DumpBytes(d.FileName); - } - catch (Exception ex) { - FormHelper.ErrorBox("在导出流数据时出错:" + ex.Message); - } - } - } - } - - void ExportToUnicode(DocumentObject n) { - using (var d = new SaveFileDialog { AddExtension = true, FileName = (n.Parent.FriendlyName ?? n.Name) + ".xml", DefaultExt = ".xml", Filter = "统一码映射信息文件(*.xml)|*.xml|" + Constants.FileExtensions.AllFilter, Title = "请选择统一码映射表的保存位置" }) { - if (d.ShowDialog() == DialogResult.OK) { - var s = n.ExtensiveObject as PRStream; - try { - var touni = PdfReader.GetStreamBytes((PRStream)s); - var lb = new iTextSharp.text.pdf.fonts.cmaps.CidLocationFromByte(touni); - var m = new iTextSharp.text.pdf.fonts.cmaps.CMapToUnicode(); - iTextSharp.text.pdf.fonts.cmaps.CMapParserEx.ParseCid("", m, lb); - using (var w = XmlWriter.Create(d.FileName, DocInfoExporter.GetWriterSettings())) { - w.WriteStartElement("toUnicode"); - w.WriteAttributeString("name", m.Name); - w.WriteAttributeString("registry", m.Registry); - w.WriteAttributeString("supplement", m.Supplement.ToText()); - w.WriteAttributeString("ordering", m.Ordering); - w.WriteAttributeString("oneByteMappings", m.HasOneByteMappings().ToString()); - w.WriteAttributeString("twoByteMappings", m.HasTwoByteMappings().ToString()); - foreach (var item in m.CreateDirectMapping()) { - w.WriteStartElement("map"); - w.WriteAttributeString("cid", item.Key.ToText()); - w.WriteAttributeString("uni", Char.ConvertFromUtf32(item.Value)); - w.WriteEndElement(); - } - w.WriteEndElement(); - } - } - catch (Exception ex) { - FormHelper.ErrorBox("在导出统一码映射表数据时出错:" + ex.Message); - } - } - } - } - - byte[] DecodeStreamBytes(DocumentObject d) { - var s = d.Value as PRStream ?? d.ExtensiveObject as PRStream; - if (d.Type == PdfObjectType.Image) { - var info = new Processor.Imaging.ImageInfo(s); - return info.DecodeImage(_imgExpOption); - } - return PdfReader.GetStreamBytes(s); - } - - void SaveDocument() { - string path; - using (var d = new SaveFileDialog() { - DefaultExt = Constants.FileExtensions.Pdf, - Filter = Constants.FileExtensions.PdfFilter, - AddExtension = true, - FileName = FileHelper.GetNewFileNameFromSourceFile(_fileName, Constants.FileExtensions.Pdf), - InitialDirectory = Path.GetDirectoryName(_fileName) - }) { - if (d.ShowDialog() != DialogResult.OK) { - return; - } - path = d.FileName; - } - - bool o = false; - var n = String.Empty; - if (FileHelper.ComparePath(path, _fileName) && FormHelper.YesNoBox("是否覆盖原始文件?") == DialogResult.Yes) { - o = true; - } - _ObjectDetailBox.ClearObjects(); - _pdf.Document.RemoveUnusedObjects(); - try { - n = o ? FileHelper.GetTempNameFromFileDirectory(path, Constants.FileExtensions.Pdf) : path; - using (var s = new FileStream(n, FileMode.Create)) { - var w = new PdfStamper(_pdf.Document, s); - if (AppContext.Patcher.FullCompression) { - w.SetFullCompression(); - } - w.Close(); - _pdf.Close(); - } - if (o) { - File.Delete(path); - File.Move(n, path); - } - } - catch (Exception ex) { - FormHelper.ErrorBox("保存文件时出错:" + ex.Message); - if (o && File.Exists(n)) { - try { - File.Delete(n); - } - catch (Exception) { - FormHelper.ErrorBox("无法删除临时文件:" + n); - } - } - LoadDocument(_fileName); - return; - } - LoadDocument(path); - } - - void _LoadDocumentWorker_DoWork(object sender, DoWorkEventArgs e) { - var path = e.Argument as string; - try { - var d = new PdfPathDocument(path); - _pdf?.Close(); - _pdf = d; - e.Result = path; - //Common.Form.Action ev = delegate () { _FilePathBox.Text = path; }; - //_FilePathBox.Invoke (ev); - } - catch (iTextSharp.text.exceptions.BadPasswordException) { - FormHelper.ErrorBox(Messages.PasswordInvalid); - } - catch (Exception ex) { - FormHelper.ErrorBox("在打开 PDF 文件时遇到错误:\n" + ex.Message); - } - } - - void _LoadDocumentWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { - var path = e.Result as string; - _DescriptionBox.Text = String.Empty; - if (path != null) { - AppContext.RecentItems.AddHistoryItem(AppContext.Recent.SourcePdfFiles, path); - DocumentPath = path; - ReloadPdf(); - } - _MainToolbar.Enabled = _ObjectDetailBox.Enabled = true; - } - - void ReloadPdf() { - _imgExp = new Processor.ImageExtractor(_imgExpOption, _pdf.Document); - - _ObjectDetailBox.ClearObjects(); - _ObjectDetailBox.Objects = ((IHierarchicalObject)_pdf).Children; - _SaveButton.Enabled = true; - _AddObjectMenu.Enabled = false; - _DeleteButton.Enabled = false; - } - - void _ExportButton_DropDownOpening(object sender, EventArgs e) { - var n = _ObjectDetailBox.GetModelObject(_ObjectDetailBox.FocusedItem.Index) as DocumentObject; - var m = _ExportButton.DropDownItems; - m["_ExportHexText"].Enabled - = m["_ExportBinary"].Enabled - = m["_ExportUncompressedHexText"].Enabled - = m["_ExportUncompressedBinary"].Enabled - = (n.ExtensiveObject as PRStream) != null; - m["_ExportXml"].Enabled - = __XmlExportableTypes.Contains(n.Type); - m["_ExportToUnicode"].Visible = (n.ExtensiveObject as PRStream) != null && n.Name == "ToUnicode"; - } - - void _AddObjectMenu_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { - AddChildNode( - _ObjectDetailBox.GetModelObject(_ObjectDetailBox.FocusedItem.Index) as DocumentObject, - ValueHelper.MapValue(e.ClickedItem, _addPdfObjectMenuItems, _pdfTypeForAddObjectMenuItems) - ); - } - } -} diff --git a/pdfpatcher/App/Functions/DocumentInspectorControl.resx b/pdfpatcher/App/Functions/DocumentInspectorControl.resx deleted file mode 100644 index 612a367f8a25763d7da07c13e3008f1e4d60c072..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentInspectorControl.resx +++ /dev/null @@ -1,425 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - False - - - False - - - False - - - False - - - False - - - False - - - 17, 17 - - - - AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w - LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 - ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACa - PgAAAk1TRnQBSQFMAgEBNAEAAUQBAAFEAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo - AwABQAMAAeADAAEBAQABCAYAATgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA - AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 - AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA - AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm - AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM - AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA - ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz - AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ - AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM - AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA - AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA - AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ - AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/ - AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA - AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm - ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ - Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz - AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA - AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM - AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM - ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM - Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA - AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM - AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ - AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz - AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm - AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw - AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD//8A/wD/AP8AGgABzwES - ARw9AAFzAXQBbgHvPAABmQFzARoB7AHvJwABFAG8Aw4BvAEOAbwDDgG8ARQIAAEHAe0B9AHrAZM8AAEH - AewBRgFFAZM2AAGSAm0B9wIAAe8BRQFGAUUB7yQAA0MB6gEAA0MBAAHqA0MDAAGSAW0BBwHwAesB7wIA - AfcBRQFGAUUBBwUAAQcBTwFJAU8BBwMAAQcB7AHrAewCBwHsAesB7AEHAwABBwFPAUkBTwEHEwAB9wFt - AbwB9wHvAfIB7AHvAQABhgH3A0UBvAEAAU8B7wEAAXEDVQFxAwAB7QHvAfIB7wLtAe8B8gHvAe0DAAFx - A1UBcQEAAe8BTxAAAewB8QEHAe8B9wHvAfIB7QEHAYYBiwEHAW4BRQFuAfACTwEAAU8DdwFPA/cB7QP0 - Au0D9AHtA/cBTwN3AU8BAAJPAQABFQG8ARUBvAEVAbwBFQG8ARUBvAEVAbwBFQIAAZIB8gHwAQcBkgES - AZIB8wHtAa0BzwEAAfABbwFFAW8BTwGYAQACdwHkAncDAAHvAbwB/wG8Au8BvAH/AbwB7wMAAncB5AJ3 - AQABmAFPEAABBwGSAfMB8AHtAbwB7AHxAa4BzwG7AwABkwFFAwABBwF3AVUBdwEHAwABvAPvArwD7wG8 - AwABBwF3AVUBdwEHFAABBwGSAfMBBwHrAQcBbQG0AbUnAAFtCxQBbQQAAQcB7QHzAusB9zsAAZIB9wFt - Ae88AAH3AbwB7D0AAQcBkgHvPwABzwESARw9AAFzAXQBbgHvKAABBwHOAQcRAAGZAXMBGgHsAe8YAAEH - AbUItAG1AQcDAAOtAQAB6gFDAxEBEAEPARQJAAEHAe0B9AHrAZMGAAEUCw4BFAMAAQcBtQG8CPABvAG1 - AQcDAAGtFAABBwHsAUYBRQGTBQANEAMAAbUMvAG1AwABpxUAAe8BRQFGAUUB7wQADREDAAG1AfEKvAHw - AbUDAAGnAgADFQRDAxEEAAGTAXMCSwFuARwBkwFFAUYBRQEHEwABtQHyAfAJvAHwAbUDAAGGEAABSwGZ - ApoBdAFLAW4BkwNFAbwRAAEHAbUBuwHxAfAIvAHwAbUDAAGGEAABcwF0BJoBUgFzAQcBbgFFAW4B8AEA - DRUCAAG1AfQBtQPxAfAGvAHwAbUDAAGtAgACFAYVBgABBwFLAZoDmQGaAnQBBwFvAUUBbwEADRUCAAEH - AbUBuwTyAfEC8AO8AfABtQMAAa0NAAEcA0sBTAGaAUsBAAFLApoCdAEAAZMBRREAAbUB8wryAfMBtQMA - Aa0NAAFLAZkEmgF0AUsBdAGaAe0BiwHrFAABuwHxCvIB8QG7AgABzwG0Ac8BAAFtBhQCFQFtAQACdAGZ - A3kBmQGaAZkBeQG0AdwBrQQAAW0LFAFtAwABvAG7AfEB8wEJAbUBCQTzAfEBuwG8AgABCQHVAQkMAAG8 - AnQBmQFvAekBTAFSAVEBUgHvAbQB9xUAAbwCuwG1AfQBtQW7AbwTAAG8AZMBdAFGARYBRgFSAXoBUQJ0 - AbwYAAEHAbUBBxoAAfABvAF0ARcBbwFSAVgBdAGZAbxwAAG1AbQBtQ0AAbUBtAG1CAABkgPsAZIgAAG0 - AfQBtA0AAbQB9AG0CAABkgPzAZIHAAEJAc8GAAGtAQkPAAG7AbQBuwwAAbwCtAG7CAAB9wH0AfMB9AH3 - BwAB1QG0Aq0ChgKnAq0PAAG8AbUMAAG8AbUBvAMAAQcG7wHtAf8B9AH/Ae0C7wEHBAABCQHPBgABrQEJ - DwABBwG7CwABvAG1AbwEAAHvBv8B8gEHAf8BBwHyAv8B7xwAAbwBtQEHCgABvAG1AbwFAAHvB/QB8gEH - AfID9AHvBQABFAEPARQBAAH3Ag8BFAoAAQcBtQEHAfABvAG7AQcKAAG8AbUBvAYAAfcC9AH3A/QB9wP0 - AfcC9AH3BgABFAHvAgABbQEUBwAB8AEHAbsCtQH0ArUBuwEHAfAJAAG8AbUBvAcAAZIC8wEHA/MBBwPz - AQcC8wGSBgAB7ARDAewHAAEHAbsBvAHwAQcBtQEHDAABvAG1AbwIAAHtA/IBBwHsAQcH8gHtBgAB7wES - Ae8B7AFDAe8GAAEHAbsBvBAAAbwBtQG8CQAB7ALxAQcB7QH0Ae0BBwbxAewHAAETAQcBbQETBwABuwEH - EAABvAG1AbwKAAHsAusBbQH0AfMB9AFtBusB7AcAAuwBFQHsBwABuwG8DwABvAG7AbwOAAH3Af8B9AH/ - AfcOAAEHAeoBFAEHBgABBwG1AQcNAAEHArUBvA8AAe8D/wHvDwACEgcAAbUB9AG1DQABtQH0AbUQAAEH - A+8BBxgAAQcBtQEHDQABBwG1AQc/AAHtCusB7TQAAewK/wHsAgABtQG0AbUKAAG1AbQBtQEAAQcBtQq0 - AbUBBxMAAewK/wHsAgABtAH0DLQB9AG0AQABtQEJCvABCQG1BAAB8AEIAeAB2QHTAUIB/AHJAbUB8AUA - Ae0I/wH0Af8B7QIAAbsBtAG7CvABuwG0AbsBAAG1AfADvATwA7wB8AG1BAAB8AEIAbMBxwHFAYABpQGD - AbUB8AUAAe0C/wHwAeoC8gHqAbwB9AH/Ae0DAAG1AfAKvAHwAbUCAAG1AfADvAG7ArUBuwO8AfABtQQA - AfABCAHAAbgB/AHFAacBzgG1AfAFAAHtAf8B8wFtAQcC/wEHAW0B8gH/Ae0DAAG1AfAKvAHwAbUCAAG1 - AfACvAG1AQcCvAEHAbUCvAHwAbUFAAHwAbwBmwFCAfwBrQEJAfAGAAGSAf8B7wH3Av8C9AH3Ae8B/wGS - AwABtQHyAfAJvAHwAbUCAAG1AfEB8AG7AQcEAAEHAbsC8AG1BgABvAF7AdMBQgGsAbsB8AYAAfcB/wHz - AewBvAL0AQcB7AHyAfQB9wMAAbUB8gHxAfAIvAHwAbUCAAG1AvIBtQG8BAABvAG1AvABtQYAAbwBPAH+ - AdMBsgG7AfAGAAH3Av8B8QHsAfMB8gHsAbwB8wH0AfcDAAG1AfID8QHwBrwB8AG1AgABtQLyAbUBvAQA - AbwBtQLwAbUDAAPwAbwB+gG+Af4BgQG7A/AEAAH3Av8F9ALzAfQB9wMAAbUF8gHxAvADvAHwAbUCAAG1 - AvIBuwEHBAABBwG7AbwB8AG1AwAEvAEdAXsBvgGVAbsEvAMAAfcB/wX0AvMB8QH0AfcDAAG1AfMK8gHz - AbUCAAG1AfMB8gHwAbUBBwK8AQcBtQHwAfIB8wG1AwABUwFSAV0BvAE5AfoBewF2AbsB4AGzAboBvAMA - AfcB/wT0AvMC8QH0AfcDAAG7AfMK8gHzAbsCAAG7AfMC8gHwAbsCtQG7AfAC8gHzAbsDAAFNASUBWAF+ - AToBOQH6AVQBfAGcAbIBuQG8AwAB9wH/A/QC8wHxA/cB7AIAAQcBtQEJCvMBCQG1AQcBAAG7AfME8gLz - BPIB8wG7AwABTQEgASUBMQE3AToBHQEzAXYBlQHZAbkBvAMAAfcB/wL0AvMC8QHvAf8B9wEHAgABtQH0 - AbUKuwG1AfQBtQEAAbsB8ArzAfABuwMAAUcBTQFTAXoB+wE7AToBOQJaAXwBnAG8AwAB7wL/BfQBBwHv - AQcDAAEHAbUBBwoAAQcBtQEHAQABvAy7AbwTAAnvAQcoAAH3Am0B9xsAAfAKAAG8CAAB7wGSCgAB9wFt - AbwB8AFtAfcYAAHwAbsBkgHvAQcFAAG8Ae8C9wHwBQAB8AHtAeoB6wH3Ae8BvAYAAfcB6wLvAQcB8AHs - Ae8EAAGuAgABEQsAAUMDAAEJAdMB1AG0Ae0B7wEHAQAB8AHvAbMC0wHvAfAEAAEHAesF6gFtAewBvAMA - Ae8B6wEHAvcB7wEHAfAB7AHvAwABpgG0AQABEQsAAUMEAAG7AdQC0wG0AZIB7wG0AtMBswG7AbwEAAH3 - BosD6gFtAbwBAAHvAewBvAEHAe8C9wHvAQcB8QHtAQcCAAKGBQAB1ALTAdQB2woAAQkB1AHTArMB0wGz - AbsB8AYAAbwB9wGRAtMBswGRAesD6gHsAQAB7AHxAbwCBwHvAvcB7wEHAfIB7QEHAQACpwYAAdQB0wHb - DQABuwLTAbMBkgHwCQABvALTAbMB7wEAAe8BbQLqAQcB7QHyAfEBvAIHAe8C9wHvAQcB8wHtAQcCrQYA - AdQB0wHbDAABvAHUAdMB1AHTAZEB7wkAAbwC0wHbAwAB7ALqAfcBBwHtAfIB8QG8AgcBkgESAe0B7wEH - AfMB7QGtAc8GAAHUAdMB2wsAAfABswHTAfcBvALUAe0BvAgAAbwC0wHbAwAB7QLqAZIBAAEHAe0B8gHx - AbwBBwHtAbwB7AH3Ae8B8gGuAc8BCQYAAdQB0wHbCwABuwHTAbQBvAEAAbsB0wGRAe8IAAG8AtMB2wMA - AewC6gH3AgABBwHtAfIB8QG8Ae8B6wL3AfAB6wG0AbUHAAHUAdMB2wkAAvAB1AHTAfcD8AHUAbMB7QLw - BgABvALTAdsCAAHwAW0C6gEHAwABBwHtAfMB8QG8AesBBwHwAW0B9wYAAbsCAAHUAdMB2wEAAbwBuwUA - AfABBwHtAdMBswGRAZIB9wGSAbMB0wHsAe0B9wG8BQABvALTAdsCAAEHAesB6gHrBQABBwHtAfMB8QHr - AfMBbQH3BwAB1AIAAdQB0wHbAQABvAHUBQABvAzTAbUBvAIAAdQBvAEAAbwC0wHbAgAB1AEJAQcB7wYA - AZIB7QHzAesB7AHvCAAI1AHbBQAB8AS8AbsB0wGzAe8FvAMAAdQDuwLTAdQCuwHUAbsIAAGSAQcB7QFt - Ae8cAAG7AdMBtQHwCAAK1AEJCAAB9wIAAeseAAEJAfAcAAEHAZIB7QHvbgAB7wGSGAABvAIJAbwB8B8A - AfAB7QHqAesB9wHvAbwHAAEHAewB6wJtAuwB9wEHBAABvAHcAdsB2gHbAQkBvB0AAQcB6wXqAW0B7AG8 - BQAB7AHvAQcB8AG8AQcB7wHtAewB7QEHAgABvAHcAtMB2gHbAQkBvBsAAfcBbQjqAW0BvAQAAewCvAEH - BbwB7wHsAe8BAAG8AdwB2gLTAdQB2wEJAbwaAAG8AfcB7AFtAuoB7AHrA+oB7AQAAu0CvAMHAbwBBwK8 - AewBBwHwAQkB2wHaAtMB1AHbAQkBvBEAArwJAAG8Ae8B7AHvAQAB7wFtAuoBBwMAAbwB7AHtAfAB7AEA - AewBvAEHAfcB6gHtAZICAAEJAdsB2gPTAdsB3AG8BQAC1AG8AQABCQLTAtsC0wHUAdMB1AG8AQAC1AG8 - AQABCQLTAtsC0wHUAdMBsgHqAfcB7wLsAZIB7wHrAbwBkgHrAZICBwLsAW0B7AMAAbwB3AHbA9MB2wHc - AbwEAAG8AdsCAAEJAdMB1AIAAdMB1AEAAboB0wG6AQABvAHbAgABCQHTAdQCAAHTAdQBAAG0AdMBiwGS - AewB7wEHAfcB7AGSAbwBBwG8AwcB7AEHAe8B6wQAAbwB3AHbA9MB2wHcAbwEAAHUAtsB1AHTAbsCAAHT - AdQBAAG7AdMB1AIAAdQC2wHUAdMBuwIAAdMB1AEAAbQB0wGzAfcBkgG8AgcBvAcHAe8BkgLtBQABvAHc - AdsD0wHaAdsBCQMAAQkBugG8AtMBvAIAAdMB1AEAAbsB0wHbAgABCQG6AbwC0wG8AgAB0wHUAfABiwHT - AYsBBwH3Ae8DBwHtARQB7AIHAe8B7AH3AgcB9wYAAbwBCQHbAdQC0wHaAdsBCQHwAgAB1AG6AdMB2wMA - AtMB2wHUAdMBvAMAAdQBugHTAdsDAALTAbQC0wHrAQABBwGSAe8BvAEHAeoBbQETAe0B7wGSAfcB7AHv - AfcB7wcAAbwBCQHbAdQC0wHaAdwBvAIAAdsC0wEJAwAB0wHUAQkBuwG8BAAB2wLTAQkDAAHTAdQBCQG7 - AQcB7wIAAbwC9wEHAesC9wHqAu8C8QHtAZIBvAgAAbwBCQHbAdoC0wHcAbwCAAG8AdMB1AQAAdMB1AcA - AbwB0wHUBAAB0wHUBwAB8AEHAfcB7QLsAe8CBwLvAfcBBwoAAbwBCQHbAdoB2wHcAbwDAAEJAbwDAAHb - AdQB2wgAAQkBvAMAAdsB1AHbCQAB8AEHAe8B9wKSAfcB7wEHAbwMAAHwAbwCCQG8aAACvA4AArwXAAGU - CbECjwNqAbEFAAHwAbUBzQG8DAAB8AG7AdMBvBcACrECjwRqBAABuwHOAs0C1AG0CQABuwHUAtMC2gG6 - CAAB7wFzBEsBcwEcAQcEAAGUCbECjwNqAbEEAAG1Bs0B1AHwBwABuwbTAdoB8AYAAUsBdAOaAZkCdAFL - AXQBBxcAAbwB1AHNAbsBtQLNAdUIAAG8AdoB0wK7AtMB2wYAAUsImgF0AVIBkwMAAc8BEgEcDAAB9wXs - Aa4B7wEAAQkCzQG7BQABugTbAgABuwLTAbsFAAJ0ApoDmQSaAXQBmQIAAXMBdAFuAe8LAAGSARMFcwHq - AgAB1QHNAdQFAAG7AdoB0wHaAQkDAAHbAdMB2gUAAbwBcwF0AZoBSwEAAUsCmgEcAYsBcwF0AgABmQFz - ARoB7AHvCgABvAETBeUBEgEHAQABvALNAbwFAAHaAdMB2wQAAbwC0wG8AQAB7wJLARwB7wFLAZoBdAFL - AXQBmgGZArQBiwFuAwABBwHtAfQB6wGTCgAB6wFzBOUBcwHsAgAB1AHNAbsFAAHaAdMB2wUAAdoB0wG7 - AQACdAGaAXQBUgF0BJoCmQG0AtwBswQAAQcB7AFGAUUBkwkAAe8B6gTlAXkBEgG8BM0BtAQAAdoB0wHb - AwABvATTAboBdAGaAZkDmgaZAe8CtAFzBQAB7wFFAUYBRQHvCQABEgF5BOUB6gHvAbUCzQHOBQAB2gHT - AdsEAAG7AtMB2gEAAnQBmgJ5AW8B6QFvAnkBdAEwAXQCeQF0BgABkwFFAUYBRQEHCAAB7AFzBOUBcwHr - AQAB1AHNAQkFAAHaAdMB2wUAAdoB0wEJAQABvAJ0AZoBeQNGAW8BdAJSAVECdAGZBwABkwNFAbwHAAEH - ARIF5QETAbwBCQHVAwAB2gIAAdoB0wHbAQABvAHaAgABCQHbAwABvAJ0AXkBRgIWAUYBdAFYAnoBUQF0 - AbwIAAEHAW4BRQFuAfAHAAESBXMBEwGSBQAB2gLbAdQB0wHaAtsB2ggAAfABmQF0AW8CFwF0AZoBeQJY - AXQBvAoAAfABbwFFAW8HAAHvBuwB9wUACLsBCQoAAfABBwGTBXQBmQG8DQABkwFFAZM+AAGTAUUEAAHt - CusB7QQAAe0K6wHtBAAB6wEOCYsBrhQAAewK/wHsBAAB7Ar/AewEAAEPAW0JtAGLAgAB7wn3A+8C9wMA - AewF/wFQAk8BcgH/AewEAAHsCv8B7AQAAREBbQm0AYsCAAEHAfEDCALxAvAB8QG8Ad0BvAHzAe8DAAHt - Af8BbwJFAUYBUAJXAVAB/wHtBAAB7Qj/AfQB/wHtBAABEQFtA7QB8AG8BLQBiwIAAbwBCAFVAZcBVgG7 - AdoBugHbAbsBpwHmAacBvAEHAwAB7QH/BEYBUAJXAVAB/wHtBAAB7Qf/AvQB/wHtBAABQwFtA7QBGQHx - BLQBiwIAAbwBCAKXAeQBCAPbAQkD5gHxAQcDAAHtAf8BRgLjARcBVgJ9AVYB/wHtBAAB7Qb/A/QB/wHt - BAABQwFtCbQBiwIAAbwBCAKXAeQBuwPbAQkD5gHdAQcDAAGSAf8BRgEXAY0BrgGQAXEBVgGYAf8BkgQA - AZIF/wT0Af8BkgQAAUMBbQO0AvEEtAGLAgABvAHxAwgB8QPwAfEBtgHXAbYB8wEHAwAB9wH/AZMBRgGL - ArMBiwP0AfcEAAH3BP8G9AH3BAABFQHrA7QBtQEZAQkDtAGLAgABvAEbAXkCfgEbAvQB/wHwAaoB0QHL - AfIBBwMAAfcD/wSzAfQB8wH0AfcEAAH3A/8F9AHzAfQB9wQAARUB6wS0AbsBGQG7ArQBrQIAAbwBGwN+ - ARsC9AH/AfED0QHeAQcDAAH3Av8B9AGzAtsBswLzAfQB9wQAAfcC/wX0AvMB9AH3BAABFQHsArQCtQG7 - ARkBuwK0AbMCAAG8ARsDfgEbA/8B8gPRAfMBvAMAAfcB/wL0AbsCswG6AfMB8QH0AfcEAAH3Af8F9ALz - AfEB9AH3BAABFAHsArQEGQG1ArQBswIAAbwB8wMaARsDGgHyAbYB8AG2AfQBBwMAAfcB/wT0AvMC8QH0 - AfcEAAH3Af8E9ALzAvEB9AH3BAABFAHsAboHtAG6AbQCAAHwARsBeQJ6AZoBFwHjARcBtwGwAdIBqwHe - AbwDAAH3Af8D9ALzAfED9wHsBAAB9wH/A/QC8wHxA/cB7AQAARQB7AHcB7oB3AG0AgAB8AEbA3oBGgHj - AhYBvQPSAd4BvAMAAfcB/wL0AvMC8QHvAf8B9wEHBAAB9wH/AvQC8wLxAe8B/wH3AQcEAAEUARIKtAIA - AfEBGwN6ARoD4wG9A9IB3gG8AwAB7wL/BfQBBwHvAQcFAAHvAv8F9AEHAe8BBwUAAW0B7wIHArwB8ALz - AfQB/wH3AgAB8AH/AxsB9gG9AhsB9AHeAfMB3gH/AbwDAAnvAQcGAAnvAQcGAAGSAW0KtAIAAbwB8AHx - AfAB8QHwAfED8AHxAfAB8QHwAbwDAAHtCusB7QQAAe0K6wHtJAAB7Ar/AewEAAHsCv8B7AYAAQcBrgSG - Aa4BBwgAAQcDiwG1AfEB8AcAAewK/wHsBAAB7AH/BSoBMQIqAf8B7AUAAbUBhgGnAa0CzgGtAacBhgG1 - BwAB9wRlAQcB8AcAAe0I/wH0Af8B7QQAAe0B/wUxATcCMQH/Ae0EAAG1AYYBrQLOAq0CzgGtAYYBtQYA - AbwCBwGLAWUBtQHwBwAB7QH/AfcB7AG8A/8C9AH/Ae0EAAHtAf8BKgMwATEBWQFYATEB/wHtAwABBwGL - BK0C8wStAYsBBwIAAfAF8QGuAWUBtQXxAfACAAHtAf8B7QH/AfcB8gH/A/QB/wHtBAAB7QH/AQ8BQwFE - AUsBeQGgAXkBWAH/Ae0DAAG0Ba0B8gHzBa0BtAIAAZEFiwFmAWUFiwGRAfEB7QLsAu0B8gH/AbwB8wP0 - Af8BkgQAAZIB/wEVAUQCWAF6AuUBWQH/AZIDAAHPBa0B8AHyBa0BzwIAAZEFiwJlBYsBkQHwAewI/wT0 - AfcEAAH3Af8BRAFRAlgBWQHlAVkBWAH0AfcDAAGtAc8DrQGnAbwB8AGnBa0GAALwAZIBZQGLAe8B8QHw - AwAB9wLtAvcB8wH/AbwB8wL0AfMB9AH3BAAB9wH/AVIHWAH0AfcDAAGtAc8DrQGnArwEpwKtAgAD8AG1 - AfcCtQGRAmUBkQHxA/ACAAH3Af8B7wH/AQcB8gL0AvMB9AH3BAAB9wH/CFgB9AH3AwACzwStAoYBpwKG - AacBrQHPAgABBwH3AQcBiwZlAYsBvAHvAbwB8AIAAfcB/wG8Ae8B8AL0AvMB8QH0AfcEAAH3Af8IMQH0 - AfcDAAG1As8DrQL/A60BzwGtAbUCAAH3AWUBkQHvBvcBtQGRAWUBtQHwAgAB9wH/BPQC8wLxAfQB9wQA - AfcB/wT0AvMC8QH0AfcDAAEHAa0B1QLPAa0C/wGtAs8BtAGtAQcCAAH3AWUBiwiRAYsBZQG1AfACAAH3 - Af8D9ALzAfED9wHsBAAB9wH/A/QC8wHxA/cB7AQAAbUBrQLVAbQCzwG0AtUBrQG1AwAB9wxlAfcB8AIA - AfcB/wL0AvMC8QHvAf8B9wEHBAAB9wH/AvQC8wLxAe8B/wH3AQcFAAG1Aa0BzwTVAc8BrQG1BAABvATv - AfcCZQGSBO8BvAHwAgAB7wL/BfQBBwHvAQcFAAHvAv8F9AEHAe8BBwcAAbwBtQHPAq0BzwG1AbwKAAG8 - AZIBkQHwCAAJ7wEHBgAJ7wEHLAABSwHvGAAB7QrrAe0TAAHsBesBSwHDAQMBbQPrAewBAALwAbwCBwGS - AW0BDgFtAZICBwG8AvADAAHsCv8B7BMAAewB8QG8AQcB8QIHAVIBegFRARwBBwHwAewBAAGuBIsBbQH3 - Ae0B9wFtBIsBrgMAAe0K/wHtEwAB7QH/AvEB/wLxAZkBUgF6AVEBmQH0Ae0BAAGLAu8BBwG8AfAB8wHt - AfMB8AG8AQcC7wGLAwAB7QH/AUYBGgEHAUYD/wH0Af8B7RMAAe0B/wG8AQcB/wEHAbwB8AGZAVgBegFR - ARoB7QEAAYsE/wH0AfMB9wL0BP8BiwMAAe0B/wRGAv8C9AH/Ae0IAAEcAUsBHAgAAZIB/wLxAf8D8QHw - ARoBUgF6AuwBAAGLAf8BRgIHAUYB8wH3AvQE/wGLAwAB7QH/AUYC4wFGAf8D9AH/Ae0DAAEcAUsBHAEA - ARwBSwGZAUsBHAcAAZIB/wEHAbwB/wMHAe8B9AEcAZIB9AHqAZMBiwH/BEYB8wH3AvQE/wGLAwAB9wH/ - AUYC4wFGBPQB/wH3AwABSwGaAUsBcwFLAZoBSwGaAksBcwEHBAAB9wH/AvEB/wX0AfABBwEcARYBRgGL - Af8BRgLjAUYB8wHvAvQE/wGLAwAB9wH/AUYC4wFGA/QB8wH0AfcDAAGTAVIBmgFLAZoBSwGaAXQBmgJ0 - AUsBHAMAAfcB/wEHAbwB9AHsAe0BbQESAfQB7wIHAUYBkwGLAf8BRgLjAUYB8wHvAvQE/wGLAwAB9wH/ - ARcC4wFGAvQC8wH0AfcEAAGZAXQBmgF0AZoBdAGaAZkBdAF5AXQBTAMAAfcB/wLxAfQB6gHsAe0BbQHz - ArwB8wH3AQABiwH/ARcC4wFGAfMB7wL0BP8BiwMAAfcB/wEXAuMBFwH0AvMB8QH0AfcEAAGTAnQBmgF0 - ApoCdAGZAZoBdAMAAe8B/wHtAfcB8AESAeoB7AHtAfMB7AH3AbwB7wEAAa0B/wEXAuMBFwHzAQcC9AT/ - Aa0DAAH3Af8BFwIWARcC8wLxAfQB9wQAAXQBmgJ0ApoBmQOaAXQBmQMAAe8B/wX0AvMB8gLxAfIB7wEA - AbMB/wEXAhYBFwHzAQcC9AT/AbMDAAH3Af8BFwIWARcB8wHxA/cB7AQAAZkJdAGZBAAB7wH/AgcB9AMH - Ae8B8QP3AewBAAG0Af8BFwIWARcB8wG8AvQE/wG0AwAB9wH/ARcCFgEXAvEB7wH/AfcBBxMAAe8E9ALz - AfIC8QHvAf8B7wEHAQABtAH/ARcCFgEXAfMB7wHzAfQE/wG0AwAB7wH/ARcCFgEXAvQBBwHvAQcUAAHv - BPQD8wLyAQcB7wEHAgABtAH/ARcCFgFGAe8BBwHvAbwB8gH0Av8BtAMAAu8BRgIWAUYD7wEHFQABBwrv - AQcDAALvAkYBbwGTAbwBAAG8AQcF7wUAAW8CFwFvKgAB7QnrAYsBkRQAAe0K6wHtFAAB7An/Aa0BiwG1 - AQABvAIHAZIBbQEOAW0BkgIHAbwF8AIAAewK/wHsFAAB7AX/AbQEswHaAa0BtQGuAosBbQH3Ae0B9wFt - B4sBrgIAAewK/wHsBQABBwjsAQcFAAHtBf8BswHcBdsBswGLAQcBvAHwAfEB7QHzAfABvAEHBe8BiwIA - Ae0B/wK8AfABvAP/AfQB/wHtBQABkgG8BvMBvAGSBQAB7QX/AboEtAHcAbMBuwGLAv8B9AHzAfcB8wP0 - Bf8BiwIAAe0B/wTzAv8C9AH/Ae0FAAHtAfMB8gHwAeoB8ALyAfMB7QUAAe0G/wP0AbQBswG7AQABiwL/ - AfQB8wH3AfME9AT/AYsBbwcfAW4DvAH/Ae0FAAGSAfMB8QNtAfEC8wGSBQABkgX/BPQB3AG0AgABiwL/ - AfQB8wH3AfMB9ALvAbwBBwLwAf8BiwIfAyAEHwPxAf8BkgUAAfcB9ALsAfAC7AHxAfQB9wUAAfcE/wb0 - AfcCAAGLAv8B9AHzAe8B8wT0Af8C8wH/AYsCIAHzAZMCRgEgAh8CvAEHAfQB9wUAAfcB9AHsAfIB9AHy - AuwB9AH3BQAB9wP/BfQB8wH0AfcCAAGLAv8B9AHzAe8B8wH0ASoBMAFSAf8B8AG8Af8BiwIgAW8BvQGU - Ab0B9AFvAR8D8QH0AfcFAAHvAf8E9AHzAe0B/wHvBQAB9wL/BfQC8wH0AfcCAAGLAv8B9AHzAe8B8wH0 - AUoBWAFZAf8C8wH/AYsDIAHjAW8BvQFGAiABBwG8AQcB9AH3BQAB7wb/AfIB/wHvBQAB9wH/BfQC8wHx - AfQB9wIAAa0C/wH0AfMBBwHzAfQBNwJYAf8B8AG8Af8BrQMgAUYBvQFvAyAC8wHxAfQB9wUAAe8B8gb/ - AfIB7wUAAfcB/wT0AvMC8QH0AfcCAAGzAv8B9AHzAQcB8wT0BP8BswMgAfkB/wFGAyAB8wLxAfQB9wUA - AbwI7wG8BQAB9wH/A/QC8wHxA/cB7AIAAbQC/wH0AfMBvAHzAfQC7wK8A/8BtAIgAvkFIAHxA/cB7BQA - AfcB/wL0AvMC8QHvAf8B9wEHAgABtAL/AfQB8wHvAfME9AT/AbQBbwcgAW8B8QHvAf8B9wEHFAAB7wL/ - BfQBBwHvAQcDAAG0AfQB8gG8Ae8BBwHvAbwB8QHzAfQE/wG0AgAB7wL/BfQBBwHvAQcVAAnvAQcEAAPv - AQcBvAEAAbwBBwjvAgAJ7wEHBgAB7QrrAe0EAAHtCusB7QQAAe0K6wHtBAAB7QrrAe0EAAHsCv8B7AQA - AewK/wHsBAAB7Ar/AewEAAHsCv8B7AQAAewK/wHsBAAB7Ar/AewEAAHsCv8B7AQAAewC/wG8AeoB8gEH - AeoBBwL/AewEAAHtCP8B9AH/Ae0EAAHtAf8CvAHwAbwD/wH0Af8B7QQAAe0C/wHqAbwB/wFtAfEB/wH0 - Af8B7QQAAe0C/wHyAeoB/wHqAf8B6gH0Af8B7QQAAe0C/wEaAWkC/wFpAQcB9AH/Ae0EAAHtAf8E8wL/ - AvQB/wHtBAAB7QL/Ae8B7QH/Ae0B7wL0Af8B7QQAAe0C/wHyAW0B/wFtAf8BbQH0Af8B7QQAAe0C/wEa - BGkB8AH0Af8B7QQAAe0B/wG8AfABvAEHBLwB/wHtBAAB7QH/Ae8GbQG8Af8B7QQAAe0C/wG8AW0B/wEH - AW0BBwH0Af8B7QQAAZID/wGOAhoBjgL0Af8BkgQAAZIB/wPzAfIE8QH/AZIEAAGSA/8B6wLwAesC9AH/ - AZIEAAGSBf8E9AH/AZIEAAH3A/8BGgGTAW8BGgP0AfcEAAH3Af8BvAIHAbwBBwK8AQcB9AH3BAAB9wH/ - AfEG7AEHAfQB9wQAAfcC/wG8AewBvAHyAewBvAL0AfcEAAH3A/8B9AJvAvQB8wH0AfcEAAH3Af8B8wHy - BvEB9AH3BAAB9wP/AQcB7wH0Ae8BBwHzAfQB9wQAAfcC/wHsAfQB7AH0AewB8gHzAfQB9wQAAfcC/wL0 - AvMB9ALzAfQB9wQAAfcB/wEHAbwEBwG8AQcB9AH3BAAB9wL/AfQB8gHtAfQBvAHtAfMB9AH3BAAB9wL/ - AewB9AHsAfQB7AHwAfMB9AH3BAAB9wH/BfQC8wHxAfQB9wQAAfcB/wTxAfQC8wHxAfQB9wQAAfcB/wX0 - AvMB8QH0AfcEAAH3Af8B9AG8AewBvAHyAewB8AHxAfQB9wQAAfcB/wT0AvMC8QH0AfcEAAH3Af8CBwG8 - AQcC8wLxAfQB9wQAAfcB/wT0AvMC8QH0AfcEAAH3Af8E9ALzAvEB9AH3BAAB9wH/A/QC8wHxA/cB7AQA - AfcB/wP0AvMB8QP3AewEAAH3Af8D9ALzAfED9wHsBAAB9wH/A/QC8wHxA/cB7AQAAfcB/wL0AvMC8QHv - Af8B9wEHBAAB9wH/AvQC8wLxAe8B/wH3AQcEAAH3Af8C9ALzAvEB7wH/AfcBBwQAAfcB/wL0AvMC8QHv - Af8B9wEHBAAB7wL/BfQBBwHvAQcFAAHvAv8F9AEHAe8BBwUAAe8C/wX0AQcB7wEHBQAB7wL/BfQBBwHv - AQcFAAnvAQcGAAnvAQcGAAnvAQcGAAnvAQcWAAHtCusB7QQAAe0K6wHtBAAB7QrrAe0UAAHsCv8B7AQA - AewK/wHsBAAB7Ar/AewKAAG0AbUIAAHsCv8B7AQAAewK/wHsBAAB7Ar/AewKAAKLAbUHAAHtAf8BvAHw - AbwB8AG8AfACvAH/Ae0EAAHtBv8BBwHtAQcB/wHtBAAB7QH/AdUB/wG8AvAB8QH/AfQB/wHtCgABiwHa - AYsBtQYAAe0G/wHyAvEB/wHtBAAB7QT/Ae8CkgH0AZIB/wHtBAAB7Qf/AvQB/wHtCgABrQHZAdoBrQG1 - BQAB7QH/AioCUgH/AQcCvAH/Ae0EAAHtBP8B9wH/AbwB7wG8Af8B7QQAAe0B/wHrAf8BvAHwAbwB8AG8 - AfQB/wHtAwABtAetAdoB0wHaAa0BtQQAAZIB/wFEAVIBegFZAfQD8QH/AZIEAAGSBP8B9wT0Af8BkgQA - AZIF/wT0Af8BkgMAAbMB3APbAdoFswHaAbMBtQMAAfcB/wI3AlgB9AEHAbwBBwH0AfcEAAH3Af8BBwGS - AQcB7wH0AQcBkgEHAfQB9wQAAfcB/wHVAf8BvAHwAbwB8AP0AfcDAAGzBNsB1QG0BbMB2wGzAwAB9wP/ - A/QD8QH0AfcEAAH3Af8B7wH0BO8B9AH3AfQB9wQAAfcD/wX0AfMB9AH3AwABswHcCdsB3AGzAbsDAAH3 - Af8BBwG8BAcBvAEHAfQB9wQAAfcB/wHxAbwB8AL0AbwBBwG8AfQB9wQAAfcB/wFvAfQGvAH0AfcDAAG0 - B7MB3AHbAdwBswG7BAAB9wH/BPEB9ALzAfEB9AH3BAAB9wH/BfQC8wHxAfQB9wQAAfcB/wX0AvMB8QH0 - AfcKAAG0AtwBtAG7BQAB9wH/AgcBvAEHAvMC8QH0AfcEAAH3Af8E9ALzAvEB9AH3BAAB9wH/AU8B9AEH - AbwC8wLxAfQB9woAAbQB3AG0AbsGAAH3Af8D9ALzAfED9wHsBAAB9wH/A/QC8wHxA/cB7AQAAfcB/wP0 - AvMB8QP3AewKAAK0AbsHAAH3Af8C9ALzAvEB7wH/AfcBBwQAAfcB/wL0AvMC8QHvAf8B9wEHBAAB9wH/ - AvQC8wLxAe8B/wH3AQcKAAG6AbsIAAHvAv8F9AEHAe8BBwUAAe8C/wX0AQcB7wEHBQAB7wL/BfQBBwHv - AQcVAAnvAQcGAAnvAQcGAAnvAQcEAAFCAU0BPgcAAT4DAAEoAwABQAMAAeADAAEBAQABAQYAAQcWAAP/ - gQAC/wH4B/8B+AF/Bv8B+AE/BP8BgAEDAfwBHwb/Af4BDwb/AcMBBwT/AYQBQwGBAYMC4AIHAv8BAAGB - ASAB4AEHAQQC/wIAASACAAEEAYABAwEAARABIAHgAQcBBAL/AQABHALgAgcC/wGAAT8E/wGAAQMBwAf/ - AeEH/wHjB/8B4wf/AfgH/wH4AX8E/wGPAf8B+AE/Av8BwAEDAYgBBwH8AR8BgAEDAYABAQHfAf8B/gEP - AYABAwGAAQEB3wL/AQcBgAEDAYABAQHYAQEB4AEDAv8BgAEBAd8B/wHgAQEC/wEAAQEB3wH/AeABAAGA - AQMBAAEBAdgBBwHgAQABgAEDAQABAQHfAf8BAQEEAv8BgAEBAd8B/wEAAQcC/wGAAQEBiAEBAQABBwGA - AQMBgAEBAY8B/wEAAQcC/wHAAQMC/wGAAQcC/wH4A/8BwAEPDf8B8QH/AfEB/gEPA/8B8QH/AfEB/gEP - AucB/wHxAf8B4QH+AQ8B4AEHAf8B8wH/AccBAAEBAucB/wHzAf8BjwEAAQED/wHjAf8BHwEAAQEB8QEP - AfwBBwH+AT8BAAEBAfkBnwHAAQcB/AF/AQABAQH4AR8BwAF/AfgB/wEAAQEB+AEfAY8B/wHxAf8BAAEB - AfwBPwGfAf8B4wH/AQABAQH8AT8BnwH/AccB/wHgAf8B/AE/AR8B/wEPAf8B4AH/Af4BfwEfAf8BHwH/ - AeAD/wEfAf8BHwf/AcABAwb/AcABAwEfAfgBgAEBAv8BwAEDAgABgAEBAeABBwHAAQMCAAGAAQEB4AEH - AcABAwGAAQEBgAEBAeABBwHAAQMBgAEBAYABAQHwAQ8BwAEDAYABAQGDAcEB+AEPAcABAwGAAQEBgwHB - AfgBDwHAAQMBgAEBAYMBwQHAAQMBwAEDAYABAQGDAcEBwAEBAcABAwGAAQEBgAEBAcABAQHAAQMBgAEB - AYABAQHAAQEBwAEDAgABgAEBAcABAQHAAQMCAAGAAQEBwAEBAcABBwEfAfgBgAEBAv8BwAEPBP8B8AP/ - Ae8B/QH+AX8B4AF/Av8BgwHgAfgBDwHAAT0BgAEDAoAB8AEDAYABHAGAAQMBwAEBAeABAQEAAQwB+AE/ - AfABBwHgAQEBAAEEAfwBfwH8AQ8B+AEgAgAB/AF/AfgBDwH4AXACAAH8AX8B8AEHAfgBcAGAAQAB/AF/ - AfABhwH4AXABwAEBAfwBfwHAAQEB+AFgAeABBwHsAU8BgAEAAfgBYQHwAQ8B7AFPAYABAAHIAWEB+AEf - AeABDwGAAQEBwAEHAfgBPwL/AfwBPwHAAQcB+wF/Av8B/gF/Av8B+AF/DP8B/gF/Av8BgwP/AfgBDwHg - AQ8BAQP/AfABAwHgAQMBAAP/AeABAQHgAQEBAAF/Av8B4AEBAeACAAE/Af8B5wH8ASAB4AGAAcABHwEQ - AQEBEAMAAeABDwExAZEBMQGQAgAB8AEHAYEBkQGBAZACAAH4AQMBgQGRAYEBgAIAAfwBAAHDAYEBwwGB - AgAB/gEAAcMBgwHDAYEBgAEAAf8BAAHHAZ8BxwGfAcABAQH/AYAB5wEfAecBHwHwAQMB/wHBDP8B/gF/ - Af4BfwL/AgAB+AF/AfgBfwL/AgAB8AEfAfABHwHgAQ8CAAHwAQcB8AEHAeABAwL/AfgBBwH4AQcB4AEB - AccB/wGAAUMB4AHDAeABAAHDAf8BgAFjAeAB4wHgAYABwQH/AYABIQHxAeECAAHgAf8BwAExAvECAAHw - AX8BwAEAAfEBwAIAAfgBPwHgAQEB8QHhAgAB/AEfAeABEQLxAgAB/gEPAeABAwGxATMBgAEAAf8BBwHw - AQ8BgAE/AcABAQH/AYcB8AEPAYABPwHwAQMB/wHjB/8B8wHAAQMBwAEDAcABAwL/AcABAwHAAQMBwAED - AQABAQHAAQMBwAEDAcABAwEAAQEBwAEDAcABAwHAAQMBAAEBAcABAwHAAQMBwAEDAQABAQHAAQMBwAED - AcABAwEAAQEBwAEDAcABAwHAAQMBAAEBAcABAwHAAQMBwAEDAQABAQHAAQMBwAEDAcABAwEAAQEBwAED - AcABAwHAAQMBAAEBAcABAwHAAQMBwAEDAQABAQHAAQMBwAEDAcABAwEAAQEBwAEDAcABAwHAAQMBAAEB - AcABAwHAAQMBwAEDAQABAQHAAQcBwAEHAcABAwEAAQEBwAEPAcABDwHAAQMBAAEBAcABAwHAAQME/wHA - AQMBwAEDAfABDwHwAR8BwAEDAcABAwHgAQcB8AEfAcABAwHAAQMBwAEDAfABHwHAAQMBwAEDAYABAQGA - AQABwAEDAcABAwGAAQEBgAIAAQMBwAEDAYABAQGAAgABAwHAAQMBgAEBAfgBBwEAAQMBwAEDAYABAQGA - AQABwAEDAcABAwGAAQEBgAEAAcABAwHAAQMBgAEBAYABAAHAAQMBwAEDAYABAQGAAQABwAEDAcABAwHA - AQMBgAEAAcABAwHAAQMB4AEHAYABAAHAAQcBwAEHAfABDwH8AT8BwAEPAcABDwT/Af4BPwL/AcABAwL/ - AYABAQEAAQEBwAEDAv8BgAEBAQABAQHAAQMC/wGAAQEBAAEBAcABAwL/AYABAQEAAQEBwAEDAfwBfwGA - AQEBAAEBAcABAwGIAT8BgAIAAQEBwAEDAYABBwGAAgABAQHAAQMBgAEDAYACAAEBAcABAwHAAQMBgAEB - AQABAQHAAQMBwAEDAYABAQEAAQEBwAEDAcABAwGAAQEBAAEBAcABAwHAAQcBgAEBAQABAQHAAQMC/wGA - AQEBAAEBAcABBwL/AYABAwEAAQEBwAEPAv8BgAEHAgEB8AX/AcABAwL/AcABAwL/AcABAQIAAcABAwL/ - AcADAAHAAQMB4AEHAcADAAHAAQMB4AEHAcADAAHAAQMB4AEHAcABAQMAAQMB4AEHAcABAwMAAQMB4AEH - AcABAwMAAQMB4AEHAcABAwMAAQMB4AEHAcABAwMAAQMB4AEHAcABAwMAAQMB4AEHAcABAwMAAQMB4AEH - AcABAwMAAQMC/wHAAQMDAAEDAv8BwAEHAgABwAEHAv8BwAEPAQQBAAHAAQ8BwAEDAcABAwHAAQMBwAED - AcABAwHAAQMBwAEDAcABAwHAAQMBwAEDAcABAwHAAQMBwAEDAcABAwHAAQMBwAEDAcABAwHAAQMBwAED - AcABAwHAAQMBwAEDAcABAwHAAQMBwAEDAcABAwHAAQMBwAEDAcABAwHAAQMBwAEDAcABAwHAAQMBwAED - AcABAwHAAQMBwAEDAcABAwHAAQMBwAEDAcABAwHAAQMBwAEDAcABAwHAAQMBwAEDAcABAwHAAQMBwAED - AcABAwHAAQMBwAEDAcABAwHAAQMBwAEDAcABAwHAAQcBwAEHAcABBwHAAQcBwAEPAcABDwHAAQ8BwAEP - Av8BwAEDAcABAwHAAQMC/wHAAQMBwAEDAcABAwH/AT8BwAEDAcABAwHAAQMB/wEfAcABAwHAAQMBwAED - Af8BDwHAAQMBwAEDAcABAwH/AQcBwAEDAcABAwHAAQMBgAEDAcABAwHAAQMBwAEDAYABAQHAAQMBwAED - AcABAwGAAQEBwAEDAcABAwHAAQMBgAEBAcABAwHAAQMBwAEDAYABAwHAAQMBwAEDAcABAwH/AQcBwAED - AcABAwHAAQMB/wEPAcABAwHAAQMBwAEDAf8BHwHAAQMBwAEDAcABAwH/AT8BwAEHAcABBwHAAQcC/wHA - AQ8BwAEPAcABDws= - - - - 257, 17 - - - 393, 17 - - - 158, 17 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/DocumentOption/DocumentFontListForm.Designer.cs b/pdfpatcher/App/Functions/DocumentOption/DocumentFontListForm.Designer.cs deleted file mode 100644 index 1952868097516fc9d63308ad3652c67f0cf475eb..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentOption/DocumentFontListForm.Designer.cs +++ /dev/null @@ -1,240 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class DocumentFontListForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.label1 = new System.Windows.Forms.Label(); - this._PageRangeBox = new System.Windows.Forms.TextBox(); - this._FontListBox = new BrightIdeasSoftware.FastObjectListView(); - this._NameColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._EmbeddedColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._FirstPageColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._ReferenceColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._Worker = new System.ComponentModel.BackgroundWorker(); - this._ProgressBar = new System.Windows.Forms.ProgressBar(); - this._AddSelectedFontsButton = new System.Windows.Forms.Button(); - this._SelectAllButton = new System.Windows.Forms.Button(); - this._ListFontsButton = new System.Windows.Forms.Button(); - this._SourceFileBox = new PDFPatcher.SourceFileControl(); - this._AppConfigButton = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this._FontListBox)).BeginInit(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(23, 61); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(82, 15); - this.label1.TabIndex = 1; - this.label1.Text = "页码范围:"; - // - // _PageRangeBox - // - this._PageRangeBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._PageRangeBox.Location = new System.Drawing.Point(146, 55); - this._PageRangeBox.Margin = new System.Windows.Forms.Padding(4); - this._PageRangeBox.Name = "_PageRangeBox"; - this._PageRangeBox.Size = new System.Drawing.Size(470, 25); - this._PageRangeBox.TabIndex = 2; - // - // _FontListBox - // - this._FontListBox.AllColumns.Add(this._NameColumn); - this._FontListBox.AllColumns.Add(this._EmbeddedColumn); - this._FontListBox.AllColumns.Add(this._FirstPageColumn); - this._FontListBox.AllColumns.Add(this._ReferenceColumn); - this._FontListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._FontListBox.CheckBoxes = true; - this._FontListBox.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this._NameColumn, - this._EmbeddedColumn, - this._FirstPageColumn, - this._ReferenceColumn}); - this._FontListBox.GridLines = true; - this._FontListBox.Location = new System.Drawing.Point(24, 128); - this._FontListBox.Margin = new System.Windows.Forms.Padding(4); - this._FontListBox.MultiSelect = false; - this._FontListBox.Name = "_FontListBox"; - this._FontListBox.OwnerDraw = true; - this._FontListBox.ShowGroups = false; - this._FontListBox.ShowImagesOnSubItems = true; - this._FontListBox.Size = new System.Drawing.Size(699, 309); - this._FontListBox.TabIndex = 8; - this._FontListBox.UseCompatibleStateImageBehavior = false; - this._FontListBox.View = System.Windows.Forms.View.Details; - this._FontListBox.VirtualMode = true; - // - // _NameColumn - // - this._NameColumn.AspectName = ""; - this._NameColumn.Text = "字体名称"; - this._NameColumn.Width = 273; - // - // _EmbeddedColumn - // - this._EmbeddedColumn.AspectName = ""; - this._EmbeddedColumn.CheckBoxes = true; - this._EmbeddedColumn.HeaderTextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this._EmbeddedColumn.IsEditable = false; - this._EmbeddedColumn.Text = "已嵌入"; - this._EmbeddedColumn.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // _FirstPageColumn - // - this._FirstPageColumn.AspectName = ""; - this._FirstPageColumn.HeaderTextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._FirstPageColumn.Text = "首次出现页码"; - this._FirstPageColumn.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._FirstPageColumn.Width = 96; - // - // _ReferenceColumn - // - this._ReferenceColumn.AspectName = ""; - this._ReferenceColumn.HeaderTextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._ReferenceColumn.Text = "出现页数"; - this._ReferenceColumn.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // _Worker - // - this._Worker.WorkerReportsProgress = true; - this._Worker.WorkerSupportsCancellation = true; - // - // _ProgressBar - // - this._ProgressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ProgressBar.Location = new System.Drawing.Point(24, 446); - this._ProgressBar.Margin = new System.Windows.Forms.Padding(4); - this._ProgressBar.Name = "_ProgressBar"; - this._ProgressBar.Size = new System.Drawing.Size(700, 29); - this._ProgressBar.TabIndex = 9; - // - // _AddSelectedFontsButton - // - this._AddSelectedFontsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._AddSelectedFontsButton.Location = new System.Drawing.Point(516, 91); - this._AddSelectedFontsButton.Margin = new System.Windows.Forms.Padding(4); - this._AddSelectedFontsButton.Name = "_AddSelectedFontsButton"; - this._AddSelectedFontsButton.Size = new System.Drawing.Size(208, 29); - this._AddSelectedFontsButton.TabIndex = 7; - this._AddSelectedFontsButton.Text = "添加选中项至替换列表"; - this._AddSelectedFontsButton.UseVisualStyleBackColor = true; - this._AddSelectedFontsButton.Click += new System.EventHandler(this._AddSelectedFontsButton_Click); - // - // _SelectAllButton - // - this._SelectAllButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._SelectAllButton.Location = new System.Drawing.Point(381, 91); - this._SelectAllButton.Margin = new System.Windows.Forms.Padding(4); - this._SelectAllButton.Name = "_SelectAllButton"; - this._SelectAllButton.Size = new System.Drawing.Size(127, 29); - this._SelectAllButton.TabIndex = 6; - this._SelectAllButton.Text = "全部选中(&Q)"; - this._SelectAllButton.UseVisualStyleBackColor = true; - this._SelectAllButton.Click += new System.EventHandler(this._SelectAllButton_Click); - // - // _ListFontsButton - // - this._ListFontsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._ListFontsButton.Location = new System.Drawing.Point(624, 55); - this._ListFontsButton.Margin = new System.Windows.Forms.Padding(4); - this._ListFontsButton.Name = "_ListFontsButton"; - this._ListFontsButton.Size = new System.Drawing.Size(100, 29); - this._ListFontsButton.TabIndex = 3; - this._ListFontsButton.Text = "列出字体"; - this._ListFontsButton.UseVisualStyleBackColor = true; - this._ListFontsButton.Click += new System.EventHandler(this._ListFontsButton_Click); - // - // _SourceFileBox - // - this._SourceFileBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._SourceFileBox.Location = new System.Drawing.Point(16, 15); - this._SourceFileBox.Margin = new System.Windows.Forms.Padding(5); - this._SourceFileBox.Name = "_SourceFileBox"; - this._SourceFileBox.Size = new System.Drawing.Size(712, 32); - this._SourceFileBox.TabIndex = 0; - // - // _AppConfigButton - // - this._AppConfigButton.Location = new System.Drawing.Point(26, 91); - this._AppConfigButton.Name = "_AppConfigButton"; - this._AppConfigButton.Size = new System.Drawing.Size(127, 29); - this._AppConfigButton.TabIndex = 10; - this._AppConfigButton.Text = "程序配置..."; - this._AppConfigButton.UseVisualStyleBackColor = true; - this._AppConfigButton.Click += new System.EventHandler(this._AppConfigButton_Click); - // - // DocumentFontListForm - // - this.AcceptButton = this._ListFontsButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(744, 490); - this.Controls.Add(this._AppConfigButton); - this.Controls.Add(this._SelectAllButton); - this.Controls.Add(this._AddSelectedFontsButton); - this.Controls.Add(this._ProgressBar); - this.Controls.Add(this._FontListBox); - this.Controls.Add(this._ListFontsButton); - this.Controls.Add(this._PageRangeBox); - this.Controls.Add(this.label1); - this.Controls.Add(this._SourceFileBox); - this.Margin = new System.Windows.Forms.Padding(4); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "DocumentFontListForm"; - this.ShowInTaskbar = false; - this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show; - this.Text = "PDF 文档使用的字体列表"; - ((System.ComponentModel.ISupportInitialize)(this._FontListBox)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private SourceFileControl _SourceFileBox; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox _PageRangeBox; - private System.Windows.Forms.Button _ListFontsButton; - private BrightIdeasSoftware.FastObjectListView _FontListBox; - private BrightIdeasSoftware.OLVColumn _NameColumn; - private BrightIdeasSoftware.OLVColumn _FirstPageColumn; - private BrightIdeasSoftware.OLVColumn _EmbeddedColumn; - private System.ComponentModel.BackgroundWorker _Worker; - private System.Windows.Forms.ProgressBar _ProgressBar; - private BrightIdeasSoftware.OLVColumn _ReferenceColumn; - private System.Windows.Forms.Button _AddSelectedFontsButton; - private System.Windows.Forms.Button _SelectAllButton; - private System.Windows.Forms.Button _AppConfigButton; - } -} \ No newline at end of file diff --git a/pdfpatcher/App/Functions/DocumentOption/DocumentFontListForm.cs b/pdfpatcher/App/Functions/DocumentOption/DocumentFontListForm.cs deleted file mode 100644 index 5a6d509cab2a479bb7aa15cf3380d11ebc06fff7..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentOption/DocumentFontListForm.cs +++ /dev/null @@ -1,192 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Windows.Forms; -using BrightIdeasSoftware; -using iTextSharp.text.pdf; -using PDFPatcher.Common; -using PDFPatcher.Model; -using PDFPatcher.Processor; - -namespace PDFPatcher.Functions -{ - sealed partial class DocumentFontListForm : Form - { - Dictionary _fontIdNames; - Dictionary _pageFonts; - internal FontSubstitutionsEditor SubstitutionsEditor { get; set; } - - public IList SelectedFonts { - get { - var sf = new List(); - foreach (PageFont item in _FontListBox.CheckedObjects) { - sf.Add(item.Name); - } - return sf; - } - } - - public DocumentFontListForm() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - } - - void OnLoad() { - this.SetIcon(Properties.Resources.Fonts); - MinimumSize = Size; - if (AppContext.Recent.SourcePdfFiles.HasContent()) { - _SourceFileBox.FileList.Text = AppContext.Recent.SourcePdfFiles[0]; - } - _Worker.ProgressChanged += (s, args) => { - if (args.ProgressPercentage < 0) { - _ProgressBar.Maximum = -args.ProgressPercentage; - } - else if (args.ProgressPercentage > 0) { - _ProgressBar.SetValue(args.ProgressPercentage); - } - else { - if (args.UserState is PageFont pf) { - _FontListBox.AddObject(pf); - } - } - }; - _Worker.RunWorkerCompleted += (s, args) => { - _ProgressBar.Value = _ProgressBar.Maximum; - if (_pageFonts.HasContent()) { - _FontListBox.AddObjects(_pageFonts.Values); - } - _ListFontsButton.Enabled = true; - }; - _Worker.DoWork += (s, args) => { - try { - _fontIdNames = new Dictionary(); - _pageFonts = new Dictionary(); - _FontListBox.ClearObjects(); - using (var p = PdfHelper.OpenPdfFile(_SourceFileBox.FirstFile, false, false)) { - var r = PageRangeCollection.Parse(_PageRangeBox.Text, 1, p.NumberOfPages, true); - var pp = new int[p.NumberOfPages + 1]; - _Worker.ReportProgress(-r.TotalPages); - int i = 0; - foreach (var range in r) { - foreach (var page in range) { - if (_Worker.CancellationPending) { - return; - } - _Worker.ReportProgress(++i); - if (pp[page] != 0) { - continue; - } - pp[page] = 1; - GetPageFonts(p, page); - } - } - } - } - catch (Exception ex) { - FormHelper.ErrorBox(ex.Message); - } - }; - _FontListBox.ScaleColumnWidths(); - _FontListBox.PersistentCheckBoxes = true; - new TypedColumn(_NameColumn) { - AspectGetter = (o) => o.Name - }; - new TypedColumn(_FirstPageColumn) { - AspectGetter = (o) => o.FirstPage - }; - new TypedColumn(_EmbeddedColumn) { - AspectGetter = (o) => o.Embedded - }; - new TypedColumn(_ReferenceColumn) { - AspectGetter = (o) => o.Reference - }; - } - - private void GetPageFonts(PdfReader pdf, int pageNumber) { - var page = pdf.GetPageNRelease(pageNumber); - var fl = page.Locate(true, PdfName.RESOURCES, PdfName.FONT); - if (fl == null) { - return; - } - foreach (var item in fl) { - var fr = item.Value as PdfIndirectReference; - if (fr == null) { - continue; - } - if (_fontIdNames.TryGetValue(fr.Number, out string fn)) { - _pageFonts[fn].IncrementReference(); - continue; - } - if (PdfReader.GetPdfObjectRelease(fr) is PdfDictionary f) { - var bf = f.GetAsName(PdfName.BASEFONT); - if (bf == null) { - continue; - } - fn = PdfHelper.GetPdfNameString(bf, AppContext.Encodings.FontNameEncoding); // 字体名称 - fn = PdfDocumentFont.RemoveSubsetPrefix(fn); - _fontIdNames.Add(fr.Number, fn); - if (_pageFonts.TryGetValue(fn, out PageFont pf)) { - pf.IncrementReference(); - continue; - } - _pageFonts.Add(fn, new PageFont(fn, pageNumber, PdfDocumentFont.HasEmbeddedFont(f))); - } - } - } - - private void SetGoal(int goal) { _ProgressBar.Maximum = goal; } - private void _ListFontsButton_Click(object sender, EventArgs e) { - _ProgressBar.Value = 0; - _ListFontsButton.Enabled = false; - _Worker.RunWorkerAsync(); - } - - sealed class PageFont - { - public string Name { get; } - public int FirstPage { get; } - public int Reference { get; private set; } - public bool Embedded { get; set; } - - public PageFont(string name, int firstPage, bool embedded) { - Name = name; - FirstPage = firstPage; - Embedded = embedded; - Reference = 1; - } - - public void IncrementReference() { - Reference++; - } - } - - private void _SelectAllButton_Click(object sender, EventArgs e) { - if (_FontListBox.GetItemCount() == 0) { - return; - } - if (_FontListBox.GetItem(0).Checked == false) { - _FontListBox.CheckObjects(_FontListBox.Objects); - } - else { - _FontListBox.CheckedObjects = null; - } - _FontListBox.Focus(); - } - - private void _AddSelectedFontsButton_Click(object sender, EventArgs e) { - if (SubstitutionsEditor == null) { - return; - } - var sf = SelectedFonts; - if (sf.Count == 0) { - FormHelper.ErrorBox("请选择需要添加到替换列表的字体。"); - return; - } - SubstitutionsEditor.AddFonts(sf); - Close(); - } - - private void _AppConfigButton_Click(object sender, EventArgs e) { - this.ShowDialog(); - } - } -} diff --git a/pdfpatcher/App/Functions/DocumentOption/DocumentFontListForm.resx b/pdfpatcher/App/Functions/DocumentOption/DocumentFontListForm.resx deleted file mode 100644 index 4e4521e8220dd27d1a08482879141165ba84fa20..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentOption/DocumentFontListForm.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/DocumentOption/DocumentInfoEditor.Designer.cs b/pdfpatcher/App/Functions/DocumentOption/DocumentInfoEditor.Designer.cs deleted file mode 100644 index 6c5e9d56a47cb9bf26e2a27d71c394ccbd0cf15c..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentOption/DocumentInfoEditor.Designer.cs +++ /dev/null @@ -1,221 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class DocumentInfoEditor - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.components = new System.ComponentModel.Container (); - this.groupBox4 = new System.Windows.Forms.GroupBox (); - this._MetadataPanel = new System.Windows.Forms.Panel (); - this.label16 = new System.Windows.Forms.Label (); - this._KeywordsBox = new System.Windows.Forms.TextBox (); - this.label17 = new System.Windows.Forms.Label (); - this._SubjectBox = new System.Windows.Forms.TextBox (); - this.label18 = new System.Windows.Forms.Label (); - this._AuthorBox = new System.Windows.Forms.TextBox (); - this.label19 = new System.Windows.Forms.Label (); - this._TitleBox = new System.Windows.Forms.TextBox (); - this._ForceMetadataBox = new System.Windows.Forms.CheckBox (); - this.label5 = new System.Windows.Forms.Label (); - this._RewriteXmpBox = new System.Windows.Forms.CheckBox (); - this._PropertyMacroMenu = new PDFPatcher.Functions.MacroMenu (this.components); - this.groupBox4.SuspendLayout (); - this._MetadataPanel.SuspendLayout (); - this.SuspendLayout (); - // - // groupBox4 - // - this.groupBox4.Controls.Add (this._MetadataPanel); - this.groupBox4.Controls.Add (this._ForceMetadataBox); - this.groupBox4.Location = new System.Drawing.Point (6, 23); - this.groupBox4.Name = "groupBox4"; - this.groupBox4.Size = new System.Drawing.Size (426, 232); - this.groupBox4.TabIndex = 2; - this.groupBox4.TabStop = false; - this.groupBox4.Text = "文档信息"; - // - // _MetadataPanel - // - this._MetadataPanel.Controls.Add (this._RewriteXmpBox); - this._MetadataPanel.Controls.Add (this.label16); - this._MetadataPanel.Controls.Add (this._KeywordsBox); - this._MetadataPanel.Controls.Add (this.label17); - this._MetadataPanel.Controls.Add (this._SubjectBox); - this._MetadataPanel.Controls.Add (this.label18); - this._MetadataPanel.Controls.Add (this._AuthorBox); - this._MetadataPanel.Controls.Add (this.label19); - this._MetadataPanel.Controls.Add (this._TitleBox); - this._MetadataPanel.Enabled = false; - this._MetadataPanel.Location = new System.Drawing.Point (6, 41); - this._MetadataPanel.Name = "_MetadataPanel"; - this._MetadataPanel.Size = new System.Drawing.Size (414, 185); - this._MetadataPanel.TabIndex = 1; - // - // label16 - // - this.label16.AutoSize = true; - this.label16.Location = new System.Drawing.Point (3, 0); - this.label16.Name = "label16"; - this.label16.Size = new System.Drawing.Size (41, 12); - this.label16.TabIndex = 0; - this.label16.Text = "标题:"; - // - // _KeywordsBox - // - this._KeywordsBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._KeywordsBox.Location = new System.Drawing.Point (5, 133); - this._KeywordsBox.Name = "_KeywordsBox"; - this._KeywordsBox.Size = new System.Drawing.Size (406, 21); - this._KeywordsBox.TabIndex = 7; - this._KeywordsBox.TextChanged += new System.EventHandler (this.DocumentInfoChanged); - // - // label17 - // - this.label17.AutoSize = true; - this.label17.Location = new System.Drawing.Point (3, 40); - this.label17.Name = "label17"; - this.label17.Size = new System.Drawing.Size (41, 12); - this.label17.TabIndex = 2; - this.label17.Text = "作者:"; - // - // _SubjectBox - // - this._SubjectBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._SubjectBox.Location = new System.Drawing.Point (5, 94); - this._SubjectBox.Name = "_SubjectBox"; - this._SubjectBox.Size = new System.Drawing.Size (406, 21); - this._SubjectBox.TabIndex = 5; - this._SubjectBox.TextChanged += new System.EventHandler (this.DocumentInfoChanged); - // - // label18 - // - this.label18.AutoSize = true; - this.label18.Location = new System.Drawing.Point (3, 79); - this.label18.Name = "label18"; - this.label18.Size = new System.Drawing.Size (41, 12); - this.label18.TabIndex = 4; - this.label18.Text = "主题:"; - // - // _AuthorBox - // - this._AuthorBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._AuthorBox.Location = new System.Drawing.Point (5, 55); - this._AuthorBox.Name = "_AuthorBox"; - this._AuthorBox.Size = new System.Drawing.Size (406, 21); - this._AuthorBox.TabIndex = 3; - this._AuthorBox.TextChanged += new System.EventHandler (this.DocumentInfoChanged); - // - // label19 - // - this.label19.AutoSize = true; - this.label19.Location = new System.Drawing.Point (3, 118); - this.label19.Name = "label19"; - this.label19.Size = new System.Drawing.Size (53, 12); - this.label19.TabIndex = 6; - this.label19.Text = "关键词:"; - // - // _TitleBox - // - this._TitleBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._TitleBox.Location = new System.Drawing.Point (5, 15); - this._TitleBox.Name = "_TitleBox"; - this._TitleBox.Size = new System.Drawing.Size (406, 21); - this._TitleBox.TabIndex = 1; - this._TitleBox.TextChanged += new System.EventHandler (this.DocumentInfoChanged); - // - // _ForceMetadataBox - // - this._ForceMetadataBox.AutoSize = true; - this._ForceMetadataBox.Location = new System.Drawing.Point (8, 20); - this._ForceMetadataBox.Name = "_ForceMetadataBox"; - this._ForceMetadataBox.Size = new System.Drawing.Size (180, 16); - this._ForceMetadataBox.TabIndex = 0; - this._ForceMetadataBox.Text = "使用此处设定的文档属性信息"; - this._ForceMetadataBox.UseVisualStyleBackColor = true; - this._ForceMetadataBox.CheckedChanged += new System.EventHandler (this.DocumentInfoChanged); - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point (6, 8); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size (221, 12); - this.label5.TabIndex = 0; - this.label5.Text = "说明:以下设定优先于信息文件的内容。"; - // - // _RewriteXmpBox - // - this._RewriteXmpBox.AutoSize = true; - this._RewriteXmpBox.Location = new System.Drawing.Point (5, 160); - this._RewriteXmpBox.Name = "_RewriteXmpBox"; - this._RewriteXmpBox.Size = new System.Drawing.Size (198, 16); - this._RewriteXmpBox.TabIndex = 8; - this._RewriteXmpBox.Text = "重写扩展标记(XML)元数据属性"; - this._RewriteXmpBox.UseVisualStyleBackColor = true; - this._RewriteXmpBox.CheckedChanged += new System.EventHandler (this.DocumentInfoChanged); - // - // _PropertyMacroMenu - // - this._PropertyMacroMenu.Name = "_PropertyMacroMenu"; - this._PropertyMacroMenu.Size = new System.Drawing.Size (61, 4); - // - // DocumentInfoEditor - // - this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add (this.groupBox4); - this.Controls.Add (this.label5); - this.Name = "DocumentInfoEditor"; - this.Size = new System.Drawing.Size (438, 270); - this.groupBox4.ResumeLayout (false); - this.groupBox4.PerformLayout (); - this._MetadataPanel.ResumeLayout (false); - this._MetadataPanel.PerformLayout (); - this.ResumeLayout (false); - this.PerformLayout (); - - } - - #endregion - - private System.Windows.Forms.GroupBox groupBox4; - private System.Windows.Forms.Panel _MetadataPanel; - private System.Windows.Forms.Label label16; - private System.Windows.Forms.TextBox _KeywordsBox; - private System.Windows.Forms.Label label17; - private System.Windows.Forms.TextBox _SubjectBox; - private System.Windows.Forms.Label label18; - private System.Windows.Forms.TextBox _AuthorBox; - private System.Windows.Forms.Label label19; - private System.Windows.Forms.TextBox _TitleBox; - private System.Windows.Forms.CheckBox _ForceMetadataBox; - private System.Windows.Forms.Label label5; - private Functions.MacroMenu _PropertyMacroMenu; - private System.Windows.Forms.CheckBox _RewriteXmpBox; - } -} diff --git a/pdfpatcher/App/Functions/DocumentOption/DocumentInfoEditor.cs b/pdfpatcher/App/Functions/DocumentOption/DocumentInfoEditor.cs deleted file mode 100644 index a87527f5a99220fdd59368f9a5342e84ad513445..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentOption/DocumentInfoEditor.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Windows.Forms; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - sealed partial class DocumentInfoEditor : UserControl - { - bool _settingsLockdown; - GeneralInfo _Options; - internal GeneralInfo Options { - get => _Options; - set { - _Options = value; - _settingsLockdown = true; - _AuthorBox.Text = _Options.Author; - _MetadataPanel.Enabled = _ForceMetadataBox.Checked = _Options.SpecifyMetaData; - _KeywordsBox.Text = _Options.Keywords; - _SubjectBox.Text = _Options.Subject; - _TitleBox.Text = _Options.Title; - _RewriteXmpBox.Checked = _Options.RewriteXmp; - _settingsLockdown = false; - } - } - - public DocumentInfoEditor() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - } - - void OnLoad() { - _settingsLockdown = true; - _TitleBox.ContextMenuStrip = _SubjectBox.ContextMenuStrip = _AuthorBox.ContextMenuStrip = _KeywordsBox.ContextMenuStrip = _PropertyMacroMenu; - _PropertyMacroMenu.AddInsertMacroMenuItem(Constants.FileNameMacros.FileName); - _PropertyMacroMenu.AddInsertMacroMenuItem(Constants.FileNameMacros.FolderName); - _PropertyMacroMenu.ItemClicked += _PropertyMacroMenu.ProcessInsertMacroCommand; - _settingsLockdown = false; - } - - void DocumentInfoChanged(object sender, EventArgs e) { - if (_settingsLockdown) { - return; - } - - if (sender == _AuthorBox) { - Options.Author = _AuthorBox.Text; - } - else if (sender == _ForceMetadataBox) { - _MetadataPanel.Enabled = Options.SpecifyMetaData = _ForceMetadataBox.Checked; - } - else if (sender == _KeywordsBox) { - Options.Keywords = _KeywordsBox.Text; - } - else if (sender == _SubjectBox) { - Options.Subject = _SubjectBox.Text; - } - else if (sender == _TitleBox) { - Options.Title = _TitleBox.Text; - } - else if (sender == _RewriteXmpBox) { - Options.RewriteXmp = _RewriteXmpBox.Checked; - } - } - } -} diff --git a/pdfpatcher/App/Functions/DocumentOption/DocumentInfoEditor.resx b/pdfpatcher/App/Functions/DocumentOption/DocumentInfoEditor.resx deleted file mode 100644 index bd78db42795653f4341c5e07d08821ab40d13c97..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentOption/DocumentInfoEditor.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/DocumentOption/FontCharSubstitutionForm.Designer.cs b/pdfpatcher/App/Functions/DocumentOption/FontCharSubstitutionForm.Designer.cs deleted file mode 100644 index 8f9ed74d44fdd39068517b22e944bb7faa9a0e0e..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentOption/FontCharSubstitutionForm.Designer.cs +++ /dev/null @@ -1,227 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class FontCharSubstitutionForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent () { - this.label1 = new System.Windows.Forms.Label(); - this._OriginalCharactersBox = new System.Windows.Forms.RichTextBox(); - this.label2 = new System.Windows.Forms.Label(); - this._SubstituteCharactersBox = new System.Windows.Forms.RichTextBox(); - this.label3 = new System.Windows.Forms.Label(); - this._ChineseCaseBox = new System.Windows.Forms.ComboBox(); - this.label4 = new System.Windows.Forms.Label(); - this._NumericWidthBox = new System.Windows.Forms.ComboBox(); - this._LetterWidthBox = new System.Windows.Forms.ComboBox(); - this.label5 = new System.Windows.Forms.Label(); - this._PunctuationWidthBox = new System.Windows.Forms.ComboBox(); - this.label6 = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(30, 34); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(80, 18); - this.label1.TabIndex = 0; - this.label1.Text = "原字符:"; - // - // _OriginalCharactersBox - // - this._OriginalCharactersBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._OriginalCharactersBox.HideSelection = false; - this._OriginalCharactersBox.Location = new System.Drawing.Point(112, 30); - this._OriginalCharactersBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this._OriginalCharactersBox.Multiline = false; - this._OriginalCharactersBox.Name = "_OriginalCharactersBox"; - this._OriginalCharactersBox.Size = new System.Drawing.Size(354, 29); - this._OriginalCharactersBox.TabIndex = 1; - this._OriginalCharactersBox.Text = ""; - this._OriginalCharactersBox.SelectionChanged += new System.EventHandler(this._OriginalCharactersBox_SelectionChanged); - this._OriginalCharactersBox.TextChanged += new System.EventHandler(this._OriginalCharactersBox_TextChanged); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(14, 91); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(98, 18); - this.label2.TabIndex = 2; - this.label2.Text = "替换字符:"; - // - // _SubstituteCharactersBox - // - this._SubstituteCharactersBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._SubstituteCharactersBox.HideSelection = false; - this._SubstituteCharactersBox.Location = new System.Drawing.Point(112, 88); - this._SubstituteCharactersBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this._SubstituteCharactersBox.Multiline = false; - this._SubstituteCharactersBox.Name = "_SubstituteCharactersBox"; - this._SubstituteCharactersBox.Size = new System.Drawing.Size(354, 29); - this._SubstituteCharactersBox.TabIndex = 1; - this._SubstituteCharactersBox.Text = ""; - this._SubstituteCharactersBox.TextChanged += new System.EventHandler(this._SubstituteCharactersBox_TextChanged); - this._SubstituteCharactersBox.Enter += new System.EventHandler(this._SubstituteCharactersBox_Enter); - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(14, 152); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(134, 18); - this.label3.TabIndex = 3; - this.label3.Text = "简繁汉字替换:"; - // - // _ChineseCaseBox - // - this._ChineseCaseBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._ChineseCaseBox.FormattingEnabled = true; - this._ChineseCaseBox.Items.AddRange(new object[] { - "不改变", - "简体转繁体", - "繁体转简体"}); - this._ChineseCaseBox.Location = new System.Drawing.Point(154, 149); - this._ChineseCaseBox.Name = "_ChineseCaseBox"; - this._ChineseCaseBox.Size = new System.Drawing.Size(161, 26); - this._ChineseCaseBox.TabIndex = 4; - this._ChineseCaseBox.SelectedIndexChanged += new System.EventHandler(this._ChineseCaseBox_SelectedIndexChanged); - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(50, 184); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(98, 18); - this.label4.TabIndex = 3; - this.label4.Text = "数字替换:"; - // - // _NumericWidthBox - // - this._NumericWidthBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._NumericWidthBox.FormattingEnabled = true; - this._NumericWidthBox.Items.AddRange(new object[] { - "不改变", - "半角转全角", - "全角转半角"}); - this._NumericWidthBox.Location = new System.Drawing.Point(154, 181); - this._NumericWidthBox.Name = "_NumericWidthBox"; - this._NumericWidthBox.Size = new System.Drawing.Size(161, 26); - this._NumericWidthBox.TabIndex = 4; - this._NumericWidthBox.SelectedIndexChanged += new System.EventHandler(this._NumericWidthBox_SelectedIndexChanged); - // - // _LetterWidthBox - // - this._LetterWidthBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._LetterWidthBox.FormattingEnabled = true; - this._LetterWidthBox.Items.AddRange(new object[] { - "不改变", - "半角转全角", - "全角转半角"}); - this._LetterWidthBox.Location = new System.Drawing.Point(154, 213); - this._LetterWidthBox.Name = "_LetterWidthBox"; - this._LetterWidthBox.Size = new System.Drawing.Size(161, 26); - this._LetterWidthBox.TabIndex = 4; - this._LetterWidthBox.SelectedIndexChanged += new System.EventHandler(this._LetterWidthBox_SelectedIndexChanged); - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(50, 216); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(98, 18); - this.label5.TabIndex = 3; - this.label5.Text = "字母替换:"; - // - // _PunctuationWidthBox - // - this._PunctuationWidthBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._PunctuationWidthBox.FormattingEnabled = true; - this._PunctuationWidthBox.Items.AddRange(new object[] { - "不改变", - "半角转全角", - "全角转半角"}); - this._PunctuationWidthBox.Location = new System.Drawing.Point(154, 245); - this._PunctuationWidthBox.Name = "_PunctuationWidthBox"; - this._PunctuationWidthBox.Size = new System.Drawing.Size(161, 26); - this._PunctuationWidthBox.TabIndex = 4; - this._PunctuationWidthBox.SelectedIndexChanged += new System.EventHandler(this._PunctuationWidthBox_SelectedIndexChanged); - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(50, 248); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(98, 18); - this.label6.TabIndex = 3; - this.label6.Text = "标点替换:"; - // - // FontCharSubstitutionForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(480, 288); - this.Controls.Add(this._PunctuationWidthBox); - this.Controls.Add(this._LetterWidthBox); - this.Controls.Add(this._NumericWidthBox); - this.Controls.Add(this._ChineseCaseBox); - this.Controls.Add(this.label6); - this.Controls.Add(this.label5); - this.Controls.Add(this.label4); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this._SubstituteCharactersBox); - this.Controls.Add(this._OriginalCharactersBox); - this.Controls.Add(this.label1); - this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "FontCharSubstitutionForm"; - this.ShowInTaskbar = false; - this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "替换字符"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.RichTextBox _OriginalCharactersBox; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.RichTextBox _SubstituteCharactersBox; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.ComboBox _ChineseCaseBox; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.ComboBox _NumericWidthBox; - private System.Windows.Forms.ComboBox _LetterWidthBox; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.ComboBox _PunctuationWidthBox; - private System.Windows.Forms.Label label6; - } -} \ No newline at end of file diff --git a/pdfpatcher/App/Functions/DocumentOption/FontCharSubstitutionForm.cs b/pdfpatcher/App/Functions/DocumentOption/FontCharSubstitutionForm.cs deleted file mode 100644 index 7ee1010e682950788658211155ce4b1759592583..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentOption/FontCharSubstitutionForm.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Drawing; -using System.Windows.Forms; -using PDFPatcher.Common; - -namespace PDFPatcher.Functions -{ - sealed partial class FontCharSubstitutionForm : Form - { - readonly FontSubstitution _Substitution; - public FontCharSubstitutionForm() { - InitializeComponent(); - } - public FontCharSubstitutionForm(FontSubstitution substitution) : this() { - this.SetIcon(Properties.Resources.Replace); - MinimumSize = Size; - MaximumSize = new Size(999, Size.Height); - _Substitution = substitution; - _OriginalCharactersBox.Text = substitution.OriginalCharacters; - _SubstituteCharactersBox.Text = substitution.SubstituteCharacters; - _ChineseCaseBox.Select(substitution.TraditionalChineseConversion == -1 ? 2 : substitution.TraditionalChineseConversion); - _LetterWidthBox.Select(substitution.AlphabeticWidthConversion == -1 ? 2 : substitution.AlphabeticWidthConversion); - _NumericWidthBox.Select(substitution.NumericWidthConversion == -1 ? 2 : substitution.NumericWidthConversion); - _PunctuationWidthBox.Select(substitution.PunctuationWidthConversion == -1 ? 2 : substitution.PunctuationWidthConversion); - } - - void _OriginalCharactersBox_TextChanged(object sender, EventArgs e) { - _Substitution.OriginalCharacters = _OriginalCharactersBox.Text; - } - - void _SubstituteCharactersBox_TextChanged(object sender, EventArgs e) { - _Substitution.SubstituteCharacters = _SubstituteCharactersBox.Text; - } - - void _SubstituteCharactersBox_Enter(object sender, EventArgs e) { - _SubstituteCharactersBox.Select( - _OriginalCharactersBox.SelectionStart, - _OriginalCharactersBox.SelectionLength - ); - } - - void _OriginalCharactersBox_SelectionChanged(object sender, EventArgs e) { - _SubstituteCharactersBox.Select( - _OriginalCharactersBox.SelectionStart, - _OriginalCharactersBox.SelectionLength - ); - } - - void _ChineseCaseBox_SelectedIndexChanged(object sender, EventArgs e) { - _Substitution.TraditionalChineseConversion = _ChineseCaseBox.SelectedIndex == 2 ? -1 : _ChineseCaseBox.SelectedIndex; - } - - void _NumericWidthBox_SelectedIndexChanged(object sender, EventArgs e) { - _Substitution.NumericWidthConversion = _NumericWidthBox.SelectedIndex == 2 ? -1 : _NumericWidthBox.SelectedIndex; - } - - void _LetterWidthBox_SelectedIndexChanged(object sender, EventArgs e) { - _Substitution.AlphabeticWidthConversion = _LetterWidthBox.SelectedIndex == 2 ? -1 : _LetterWidthBox.SelectedIndex; - } - - void _PunctuationWidthBox_SelectedIndexChanged(object sender, EventArgs e) { - _Substitution.PunctuationWidthConversion = _PunctuationWidthBox.SelectedIndex == 2 ? -1 : _PunctuationWidthBox.SelectedIndex; - } - } -} diff --git a/pdfpatcher/App/Functions/DocumentOption/FontCharSubstitutionForm.resx b/pdfpatcher/App/Functions/DocumentOption/FontCharSubstitutionForm.resx deleted file mode 100644 index 1af7de150c99c12dd67a509fe57c10d63e4eeb04..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentOption/FontCharSubstitutionForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/DocumentOption/FontSubstitutionsEditor.Designer.cs b/pdfpatcher/App/Functions/DocumentOption/FontSubstitutionsEditor.Designer.cs deleted file mode 100644 index 5a9f9f0e3a304826abc34ab667987aa91d81b570..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentOption/FontSubstitutionsEditor.Designer.cs +++ /dev/null @@ -1,255 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class FontSubstitutionsEditor - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.components = new System.ComponentModel.Container(); - this._FontSubstitutionsBox = new BrightIdeasSoftware.ObjectListView(); - this._SequenceColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._OriginalFontColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._SubstitutionColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._CharSubstitutionColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._FontSubstitutionMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._CopySubstitutionFont = new System.Windows.Forms.ToolStripMenuItem(); - this._PasteSubstitutionFont = new System.Windows.Forms.ToolStripMenuItem(); - this._RemovePageLabelButton = new System.Windows.Forms.Button(); - this._AddPageLabelButton = new System.Windows.Forms.Button(); - this._ListDocumentFontButton = new System.Windows.Forms.Button(); - this._EmbedLegacyCjkFontsBox = new System.Windows.Forms.CheckBox(); - this._EnableFontSubstitutionsBox = new System.Windows.Forms.CheckBox(); - this.panel1 = new System.Windows.Forms.Panel(); - this._TrimTrailingWhiteSpaceBox = new System.Windows.Forms.CheckBox(); - ((System.ComponentModel.ISupportInitialize)(this._FontSubstitutionsBox)).BeginInit(); - this._FontSubstitutionMenu.SuspendLayout(); - this.panel1.SuspendLayout(); - this.SuspendLayout(); - // - // _FontSubstitutionsBox - // - this._FontSubstitutionsBox.AllColumns.Add(this._SequenceColumn); - this._FontSubstitutionsBox.AllColumns.Add(this._OriginalFontColumn); - this._FontSubstitutionsBox.AllColumns.Add(this._SubstitutionColumn); - this._FontSubstitutionsBox.AllColumns.Add(this._CharSubstitutionColumn); - this._FontSubstitutionsBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._FontSubstitutionsBox.CellEditActivation = BrightIdeasSoftware.ObjectListView.CellEditActivateMode.SingleClick; - this._FontSubstitutionsBox.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this._SequenceColumn, - this._OriginalFontColumn, - this._SubstitutionColumn, - this._CharSubstitutionColumn}); - this._FontSubstitutionsBox.ContextMenuStrip = this._FontSubstitutionMenu; - this._FontSubstitutionsBox.Cursor = System.Windows.Forms.Cursors.Default; - this._FontSubstitutionsBox.Enabled = false; - this._FontSubstitutionsBox.GridLines = true; - this._FontSubstitutionsBox.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this._FontSubstitutionsBox.HideSelection = false; - this._FontSubstitutionsBox.LabelEdit = true; - this._FontSubstitutionsBox.Location = new System.Drawing.Point(4, 69); - this._FontSubstitutionsBox.Margin = new System.Windows.Forms.Padding(4); - this._FontSubstitutionsBox.Name = "_FontSubstitutionsBox"; - this._FontSubstitutionsBox.SelectColumnsOnRightClick = false; - this._FontSubstitutionsBox.SelectColumnsOnRightClickBehaviour = BrightIdeasSoftware.ObjectListView.ColumnSelectBehaviour.None; - this._FontSubstitutionsBox.ShowGroups = false; - this._FontSubstitutionsBox.Size = new System.Drawing.Size(575, 275); - this._FontSubstitutionsBox.TabIndex = 5; - this._FontSubstitutionsBox.UseCompatibleStateImageBehavior = false; - this._FontSubstitutionsBox.View = System.Windows.Forms.View.Details; - // - // _SequenceColumn - // - this._SequenceColumn.Text = "序号"; - this._SequenceColumn.Width = 40; - // - // _OriginalFontColumn - // - this._OriginalFontColumn.AspectName = ""; - this._OriginalFontColumn.Text = "原字体"; - this._OriginalFontColumn.Width = 160; - // - // _SubstitutionColumn - // - this._SubstitutionColumn.AspectName = ""; - this._SubstitutionColumn.Text = "替换字体"; - this._SubstitutionColumn.Width = 160; - // - // _CharSubstitutionColumn - // - this._CharSubstitutionColumn.Text = "替换字符"; - this._CharSubstitutionColumn.Width = 71; - // - // _FontSubstitutionMenu - // - this._FontSubstitutionMenu.ImageScalingSize = new System.Drawing.Size(20, 20); - this._FontSubstitutionMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._CopySubstitutionFont, - this._PasteSubstitutionFont}); - this._FontSubstitutionMenu.Name = "_FontSubstitutionMenu"; - this._FontSubstitutionMenu.Size = new System.Drawing.Size(192, 56); - this._FontSubstitutionMenu.Opening += new System.ComponentModel.CancelEventHandler(this._FontSubstitutionMenu_Opening); - this._FontSubstitutionMenu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._FontSubstitutionMenu_ItemClicked); - // - // _CopySubstitutionFont - // - this._CopySubstitutionFont.Image = global::PDFPatcher.Properties.Resources.Copy; - this._CopySubstitutionFont.Name = "_CopySubstitutionFont"; - this._CopySubstitutionFont.Size = new System.Drawing.Size(191, 26); - this._CopySubstitutionFont.Text = "复制替换字体(&F)"; - // - // _PasteSubstitutionFont - // - this._PasteSubstitutionFont.Image = global::PDFPatcher.Properties.Resources.Paste; - this._PasteSubstitutionFont.Name = "_PasteSubstitutionFont"; - this._PasteSubstitutionFont.Size = new System.Drawing.Size(191, 26); - this._PasteSubstitutionFont.Text = "粘贴替换字体(&Z)"; - // - // _RemovePageLabelButton - // - this._RemovePageLabelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._RemovePageLabelButton.Enabled = false; - this._RemovePageLabelButton.Image = global::PDFPatcher.Properties.Resources.Delete; - this._RemovePageLabelButton.Location = new System.Drawing.Point(509, 4); - this._RemovePageLabelButton.Margin = new System.Windows.Forms.Padding(4); - this._RemovePageLabelButton.Name = "_RemovePageLabelButton"; - this._RemovePageLabelButton.Size = new System.Drawing.Size(71, 29); - this._RemovePageLabelButton.TabIndex = 4; - this._RemovePageLabelButton.Text = "删除"; - this._RemovePageLabelButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._RemovePageLabelButton.UseVisualStyleBackColor = true; - this._RemovePageLabelButton.Click += new System.EventHandler(this._RemovePageLabelButton_Click); - // - // _AddPageLabelButton - // - this._AddPageLabelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._AddPageLabelButton.Enabled = false; - this._AddPageLabelButton.Image = global::PDFPatcher.Properties.Resources.Add; - this._AddPageLabelButton.Location = new System.Drawing.Point(431, 4); - this._AddPageLabelButton.Margin = new System.Windows.Forms.Padding(4); - this._AddPageLabelButton.Name = "_AddPageLabelButton"; - this._AddPageLabelButton.Size = new System.Drawing.Size(71, 29); - this._AddPageLabelButton.TabIndex = 3; - this._AddPageLabelButton.Text = "添加"; - this._AddPageLabelButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._AddPageLabelButton.UseVisualStyleBackColor = true; - this._AddPageLabelButton.Click += new System.EventHandler(this._AddPageLabelButton_Click); - // - // _ListDocumentFontButton - // - this._ListDocumentFontButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._ListDocumentFontButton.Enabled = false; - this._ListDocumentFontButton.Location = new System.Drawing.Point(276, 4); - this._ListDocumentFontButton.Margin = new System.Windows.Forms.Padding(4); - this._ListDocumentFontButton.Name = "_ListDocumentFontButton"; - this._ListDocumentFontButton.Size = new System.Drawing.Size(147, 29); - this._ListDocumentFontButton.TabIndex = 2; - this._ListDocumentFontButton.Text = "列出文档字体"; - this._ListDocumentFontButton.UseVisualStyleBackColor = true; - this._ListDocumentFontButton.Click += new System.EventHandler(this._ListDocumentFontButton_Click); - // - // _EmbedLegacyCjkFontsBox - // - this._EmbedLegacyCjkFontsBox.AutoSize = true; - this._EmbedLegacyCjkFontsBox.Location = new System.Drawing.Point(4, 9); - this._EmbedLegacyCjkFontsBox.Margin = new System.Windows.Forms.Padding(4); - this._EmbedLegacyCjkFontsBox.Name = "_EmbedLegacyCjkFontsBox"; - this._EmbedLegacyCjkFontsBox.Size = new System.Drawing.Size(104, 19); - this._EmbedLegacyCjkFontsBox.TabIndex = 0; - this._EmbedLegacyCjkFontsBox.Text = "嵌入汉字库"; - this._EmbedLegacyCjkFontsBox.UseVisualStyleBackColor = true; - // - // _EnableFontSubstitutionsBox - // - this._EnableFontSubstitutionsBox.AutoSize = true; - this._EnableFontSubstitutionsBox.Location = new System.Drawing.Point(124, 9); - this._EnableFontSubstitutionsBox.Margin = new System.Windows.Forms.Padding(4); - this._EnableFontSubstitutionsBox.Name = "_EnableFontSubstitutionsBox"; - this._EnableFontSubstitutionsBox.Size = new System.Drawing.Size(119, 19); - this._EnableFontSubstitutionsBox.TabIndex = 1; - this._EnableFontSubstitutionsBox.Text = "允许替换字体"; - this._EnableFontSubstitutionsBox.UseVisualStyleBackColor = true; - // - // panel1 - // - this.panel1.Controls.Add(this._TrimTrailingWhiteSpaceBox); - this.panel1.Controls.Add(this._FontSubstitutionsBox); - this.panel1.Controls.Add(this._EnableFontSubstitutionsBox); - this.panel1.Controls.Add(this._AddPageLabelButton); - this.panel1.Controls.Add(this._EmbedLegacyCjkFontsBox); - this.panel1.Controls.Add(this._RemovePageLabelButton); - this.panel1.Controls.Add(this._ListDocumentFontButton); - this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel1.Location = new System.Drawing.Point(0, 0); - this.panel1.Margin = new System.Windows.Forms.Padding(4); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(584, 349); - this.panel1.TabIndex = 6; - // - // _TrimTrailingWhiteSpaceBox - // - this._TrimTrailingWhiteSpaceBox.AutoSize = true; - this._TrimTrailingWhiteSpaceBox.Location = new System.Drawing.Point(4, 35); - this._TrimTrailingWhiteSpaceBox.Name = "_TrimTrailingWhiteSpaceBox"; - this._TrimTrailingWhiteSpaceBox.Size = new System.Drawing.Size(179, 19); - this._TrimTrailingWhiteSpaceBox.TabIndex = 6; - this._TrimTrailingWhiteSpaceBox.Text = "同时删除文本尾随空格"; - this._TrimTrailingWhiteSpaceBox.UseVisualStyleBackColor = true; - // - // FontSubstitutionsEditor - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.panel1); - this.Margin = new System.Windows.Forms.Padding(4); - this.Name = "FontSubstitutionsEditor"; - this.Size = new System.Drawing.Size(584, 349); - this.Load += new System.EventHandler(this.FontSubstitutionsEditor_Load); - ((System.ComponentModel.ISupportInitialize)(this._FontSubstitutionsBox)).EndInit(); - this._FontSubstitutionMenu.ResumeLayout(false); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Button _RemovePageLabelButton; - private System.Windows.Forms.Button _AddPageLabelButton; - private BrightIdeasSoftware.ObjectListView _FontSubstitutionsBox; - private BrightIdeasSoftware.OLVColumn _OriginalFontColumn; - private BrightIdeasSoftware.OLVColumn _SubstitutionColumn; - private BrightIdeasSoftware.OLVColumn _SequenceColumn; - private System.Windows.Forms.Button _ListDocumentFontButton; - private System.Windows.Forms.CheckBox _EmbedLegacyCjkFontsBox; - private System.Windows.Forms.CheckBox _EnableFontSubstitutionsBox; - private System.Windows.Forms.ContextMenuStrip _FontSubstitutionMenu; - private System.Windows.Forms.ToolStripMenuItem _CopySubstitutionFont; - private System.Windows.Forms.ToolStripMenuItem _PasteSubstitutionFont; - private System.Windows.Forms.Panel panel1; - private BrightIdeasSoftware.OLVColumn _CharSubstitutionColumn; - private System.Windows.Forms.CheckBox _TrimTrailingWhiteSpaceBox; - } -} diff --git a/pdfpatcher/App/Functions/DocumentOption/FontSubstitutionsEditor.cs b/pdfpatcher/App/Functions/DocumentOption/FontSubstitutionsEditor.cs deleted file mode 100644 index 9e0e8d35e1fd17723ab773c761625511cea6e54a..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentOption/FontSubstitutionsEditor.cs +++ /dev/null @@ -1,180 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Text.RegularExpressions; -using System.Windows.Forms; -using BrightIdeasSoftware; -using PDFPatcher.Common; - -namespace PDFPatcher.Functions -{ - sealed partial class FontSubstitutionsEditor : UserControl - { - string _copiedFont; - - FontUtility.FriendlyFontName[] _Fonts; - readonly TypedObjectListView _SubstitutionsBox; - List _Substitutions; - [Browsable(false)] - public List Substitutions { - get => _Substitutions; - set { _Substitutions = value; _FontSubstitutionsBox.Objects = value; } - } - public PatcherOptions Options { get; set; } - - public FontSubstitutionsEditor() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - _SubstitutionsBox = new TypedObjectListView(_FontSubstitutionsBox); - _FontSubstitutionsBox.FormatRow += (s, args) => args.Item.SubItems[0].Text = ValueHelper.ToText(args.RowIndex + 1); - new TypedColumn(_OriginalFontColumn) { - AspectGetter = (o) => o.OriginalFont, - AspectPutter = (o, v) => o.OriginalFont = v as string - }; - new TypedColumn(_SubstitutionColumn) { - AspectGetter = (o) => o.Substitution, - AspectPutter = (o, v) => o.Substitution = v as string - }; - new TypedColumn(_CharSubstitutionColumn) { - AspectGetter = (o) => String.IsNullOrEmpty(o.OriginalCharacters) ? "添加" : "修改" - }; - } - - void OnLoad() { - _FontSubstitutionsBox.FixEditControlWidth(); - _FontSubstitutionsBox.ScaleColumnWidths(); - _FontSubstitutionsBox.FullRowSelect = true; - _FontSubstitutionsBox.HideSelection = false; - _FontSubstitutionsBox.LabelEdit = false; - _FontSubstitutionsBox.CellEditStarting += (s, args) => { - if (args.Column == _SubstitutionColumn) { - EditSubstitutionItem(args); - } - else if (args.Column == _CharSubstitutionColumn) { - using (var f = new FontCharSubstitutionForm(args.RowObject as FontSubstitution)) { - f.ShowDialog(this); - } - args.Cancel = true; - } - }; - _FontSubstitutionsBox.CellEditFinishing += (s, args) => { - if (args.Column == _SubstitutionColumn) { - var c = args.Control as ComboBox; - if (c.FindString(c.Text) != -1) { - args.NewValue = c.Text; - } - } - }; - } - - void EditSubstitutionItem(CellEditEventArgs args) { - var cb = new ComboBox { - AutoCompleteSource = AutoCompleteSource.ListItems, - AutoCompleteMode = AutoCompleteMode.SuggestAppend, - Bounds = args.CellBounds - }; - var b = cb.Items; - b.Add(String.Empty); - var sf = (args.RowObject as FontSubstitution).Substitution; - bool cf = String.IsNullOrEmpty(sf) == false; - if (cf) { - sf = sf.ToUpperInvariant(); - } - if (_Fonts.HasContent() == false) { - _Fonts = FontUtility.InstalledFonts; - } - var l = _Fonts.Length; - string fn; - for (int i = 0; i < l; i++) { - fn = _Fonts[i].ToString(); - b.Add(fn); - if (String.Equals(fn, sf, StringComparison.OrdinalIgnoreCase)) { - cb.SelectedIndex = i + 1; - } - } - if (cb.SelectedIndex == -1) { - cb.SelectedIndex = 0; - } - args.Control = cb; - cb.ParentChanged += (s1, a) => { - var box = ((ComboBox)s1); - if (box.Parent != null) { - box.DroppedDown = true; - } - }; - } - - void FontSubstitutionsEditor_Load(object sender, EventArgs e) { - if (DesignMode) { - return; - } - _EmbedLegacyCjkFontsBox.Checked = Options.EmbedFonts; - _EmbedLegacyCjkFontsBox.CheckedChanged += (s, args) => Options.EmbedFonts = _EmbedLegacyCjkFontsBox.Checked; - _TrimTrailingWhiteSpaceBox.Checked = Options.TrimTrailingWhiteSpace; - _TrimTrailingWhiteSpaceBox.CheckedChanged += (s, args) => Options.TrimTrailingWhiteSpace = _TrimTrailingWhiteSpaceBox.Checked; - _EnableFontSubstitutionsBox.CheckedChanged += (s, args) => { - _ListDocumentFontButton.Enabled - = _AddPageLabelButton.Enabled - = _RemovePageLabelButton.Enabled - = _FontSubstitutionsBox.Enabled - = _TrimTrailingWhiteSpaceBox.Enabled - = Options.EnableFontSubstitutions - = _EnableFontSubstitutionsBox.Checked; - }; - _EnableFontSubstitutionsBox.Checked = Options.EnableFontSubstitutions; - _FontSubstitutionMenu.Invalidate(); - } - - void _AddPageLabelButton_Click(object sender, EventArgs e) { - var s = new FontSubstitution { OriginalFont = "请输入原字体名称" }; - _Substitutions.Add(s); - _FontSubstitutionsBox.AddObject(s); - _FontSubstitutionsBox.EditSubItem(_FontSubstitutionsBox.GetLastItemInDisplayOrder(), 1); - } - - void _RemovePageLabelButton_Click(object sender, EventArgs e) { - _FontSubstitutionsBox.RemoveObjects(_FontSubstitutionsBox.SelectedObjects); - _Substitutions.Clear(); - _Substitutions.AddRange(_SubstitutionsBox.Objects); - } - - void _ListDocumentFontButton_Click(object sender, EventArgs e) { - using (var f = new DocumentFontListForm()) { - f.SubstitutionsEditor = this; - f.ShowDialog(); - } - } - - internal void AddFonts(IEnumerable fonts) { - var s = new HashSet(StringComparer.CurrentCultureIgnoreCase); - foreach (var item in _Substitutions) { - s.Add(item.OriginalFont); - } - foreach (var item in fonts) { - if (s.Contains(item)) { - continue; - } - _Substitutions.Add(new FontSubstitution() { OriginalFont = item }); - } - _SubstitutionsBox.Objects = _Substitutions; - } - - void _FontSubstitutionMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { - if (e.ClickedItem == _CopySubstitutionFont) { - _copiedFont = _FontSubstitutionsBox.GetFirstSelectedModel().Substitution; - } - else if (e.ClickedItem == _PasteSubstitutionFont) { - foreach (var item in _SubstitutionsBox.SelectedObjects) { - item.Substitution = _copiedFont; - } - _FontSubstitutionsBox.RefreshSelectedObjects(); - } - } - - void _FontSubstitutionMenu_Opening(object sender, CancelEventArgs e) { - _CopySubstitutionFont.Enabled = (_FontSubstitutionsBox.SelectedIndex != -1); - _PasteSubstitutionFont.Enabled = String.IsNullOrEmpty(_copiedFont) == false; - } - - } -} diff --git a/pdfpatcher/App/Functions/DocumentOption/FontSubstitutionsEditor.resx b/pdfpatcher/App/Functions/DocumentOption/FontSubstitutionsEditor.resx deleted file mode 100644 index 20323674aae20e16a48675e705479eef3967cc62..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentOption/FontSubstitutionsEditor.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/DocumentOption/PageLabelEditor.Designer.cs b/pdfpatcher/App/Functions/DocumentOption/PageLabelEditor.Designer.cs deleted file mode 100644 index 2a9720619aa600c6797fa43c0019540b1cffb7ad..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentOption/PageLabelEditor.Designer.cs +++ /dev/null @@ -1,168 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class PageLabelEditor - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.components = new System.ComponentModel.Container(); - this._PageLabelBox = new BrightIdeasSoftware.ObjectListView(); - this._SequenceColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._PageNumColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._LabelStyleColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._LabelPrefixColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._StartNumColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._RemovePageLabelButton = new System.Windows.Forms.Button(); - this._AddPageLabelButton = new System.Windows.Forms.Button(); - this._LabelStyleMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this.panel1 = new System.Windows.Forms.Panel(); - ((System.ComponentModel.ISupportInitialize)(this._PageLabelBox)).BeginInit(); - this.panel1.SuspendLayout(); - this.SuspendLayout(); - // - // _PageLabelBox - // - this._PageLabelBox.AllColumns.Add(this._SequenceColumn); - this._PageLabelBox.AllColumns.Add(this._PageNumColumn); - this._PageLabelBox.AllColumns.Add(this._LabelStyleColumn); - this._PageLabelBox.AllColumns.Add(this._LabelPrefixColumn); - this._PageLabelBox.AllColumns.Add(this._StartNumColumn); - this._PageLabelBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._PageLabelBox.CellEditActivation = BrightIdeasSoftware.ObjectListView.CellEditActivateMode.SingleClick; - this._PageLabelBox.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this._SequenceColumn, - this._PageNumColumn, - this._LabelStyleColumn, - this._LabelPrefixColumn, - this._StartNumColumn}); - this._PageLabelBox.GridLines = true; - this._PageLabelBox.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this._PageLabelBox.HideSelection = false; - this._PageLabelBox.LabelEdit = true; - this._PageLabelBox.Location = new System.Drawing.Point(3, 32); - this._PageLabelBox.Name = "_PageLabelBox"; - this._PageLabelBox.OwnerDraw = true; - this._PageLabelBox.ShowGroups = false; - this._PageLabelBox.Size = new System.Drawing.Size(432, 244); - this._PageLabelBox.TabIndex = 0; - this._PageLabelBox.UseCompatibleStateImageBehavior = false; - this._PageLabelBox.View = System.Windows.Forms.View.Details; - // - // _SequenceColumn - // - this._SequenceColumn.IsEditable = false; - this._SequenceColumn.Text = "序号"; - this._SequenceColumn.Width = 40; - // - // _PageNumColumn - // - this._PageNumColumn.Text = "文档页码"; - this._PageNumColumn.Width = 65; - // - // _LabelStyleColumn - // - this._LabelStyleColumn.IsEditable = false; - this._LabelStyleColumn.Text = "页码样式"; - this._LabelStyleColumn.Width = 103; - // - // _LabelPrefixColumn - // - this._LabelPrefixColumn.Text = "前缀文本"; - this._LabelPrefixColumn.Width = 70; - // - // _StartNumColumn - // - this._StartNumColumn.Text = "起始号码"; - this._StartNumColumn.Width = 70; - // - // _RemovePageLabelButton - // - this._RemovePageLabelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._RemovePageLabelButton.Image = global::PDFPatcher.Properties.Resources.Delete; - this._RemovePageLabelButton.Location = new System.Drawing.Point(382, 3); - this._RemovePageLabelButton.Name = "_RemovePageLabelButton"; - this._RemovePageLabelButton.Size = new System.Drawing.Size(53, 23); - this._RemovePageLabelButton.TabIndex = 2; - this._RemovePageLabelButton.Text = "删除"; - this._RemovePageLabelButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._RemovePageLabelButton.UseVisualStyleBackColor = true; - this._RemovePageLabelButton.Click += new System.EventHandler(this._RemovePageLabelButton_Click); - // - // _AddPageLabelButton - // - this._AddPageLabelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._AddPageLabelButton.Image = global::PDFPatcher.Properties.Resources.Add; - this._AddPageLabelButton.Location = new System.Drawing.Point(323, 3); - this._AddPageLabelButton.Name = "_AddPageLabelButton"; - this._AddPageLabelButton.Size = new System.Drawing.Size(53, 23); - this._AddPageLabelButton.TabIndex = 1; - this._AddPageLabelButton.Text = "添加"; - this._AddPageLabelButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._AddPageLabelButton.UseVisualStyleBackColor = true; - this._AddPageLabelButton.Click += new System.EventHandler(this._AddPageLabelButton_Click); - // - // _LabelStyleMenu - // - this._LabelStyleMenu.Name = "_LabelStyleMenu"; - this._LabelStyleMenu.Size = new System.Drawing.Size(61, 4); - // - // panel1 - // - this.panel1.Controls.Add(this._PageLabelBox); - this.panel1.Controls.Add(this._RemovePageLabelButton); - this.panel1.Controls.Add(this._AddPageLabelButton); - this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel1.Location = new System.Drawing.Point(0, 0); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(438, 279); - this.panel1.TabIndex = 3; - // - // PageLabelEditor - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.panel1); - this.Name = "PageLabelEditor"; - this.Size = new System.Drawing.Size(438, 279); - ((System.ComponentModel.ISupportInitialize)(this._PageLabelBox)).EndInit(); - this.panel1.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Button _RemovePageLabelButton; - private System.Windows.Forms.Button _AddPageLabelButton; - private BrightIdeasSoftware.ObjectListView _PageLabelBox; - private BrightIdeasSoftware.OLVColumn _PageNumColumn; - private BrightIdeasSoftware.OLVColumn _LabelStyleColumn; - private BrightIdeasSoftware.OLVColumn _LabelPrefixColumn; - private BrightIdeasSoftware.OLVColumn _StartNumColumn; - private BrightIdeasSoftware.OLVColumn _SequenceColumn; - private System.Windows.Forms.ContextMenuStrip _LabelStyleMenu; - private System.Windows.Forms.Panel panel1; - } -} diff --git a/pdfpatcher/App/Functions/DocumentOption/PageLabelEditor.cs b/pdfpatcher/App/Functions/DocumentOption/PageLabelEditor.cs deleted file mode 100644 index f318a13c4fe5513733013e3fa364e45c40c5f0a5..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentOption/PageLabelEditor.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Windows.Forms; -using BrightIdeasSoftware; -using PDFPatcher.Common; - -namespace PDFPatcher.Functions -{ - sealed partial class PageLabelEditor : UserControl - { - readonly TypedObjectListView _LabelBox; - List _Labels; - - [Browsable(false)] - public List Labels { - get => _Labels; - set { _Labels = value; _PageLabelBox.Objects = value; } - } - - public PageLabelEditor() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - _LabelBox = new TypedObjectListView(_PageLabelBox); - _PageLabelBox.FormatRow += (s, args) => args.Item.SubItems[0].Text = (args.RowIndex + 1).ToText(); - new TypedColumn(_PageNumColumn) { - AspectGetter = (o) => o.PageNumber, - AspectPutter = (o, v) => { int i = v.ToString().ToInt32(); o.PageNumber = i > 0 ? i : 1; } - }; - new TypedColumn(_StartNumColumn) { - AspectGetter = (o) => o.StartPage, - AspectPutter = (o, v) => { int i = v.ToString().ToInt32(); o.StartPage = i > 0 ? i : 1; } - }; - new TypedColumn(_LabelStyleColumn) { - AspectGetter = (o) => o.Style ?? Constants.PageLabelStyles.Names[0] - }; - new TypedColumn(_LabelPrefixColumn) { - AspectGetter = (o) => o.Prefix, - AspectPutter = (o, v) => o.Prefix = v as string - }; - } - - void OnLoad() { - foreach (var item in Constants.PageLabelStyles.Names) { - _LabelStyleMenu.Items.Add(item); - } - _PageLabelBox.FixEditControlWidth(); - _PageLabelBox.ScaleColumnWidths(); - _PageLabelBox.FullRowSelect = true; - _PageLabelBox.LabelEdit = false; - _PageLabelBox.CellClick += (s, args) => { - if (args.Column == _LabelStyleColumn) { - var b = _PageLabelBox.GetSubItem(args.RowIndex, args.ColumnIndex).Bounds; - _LabelStyleMenu.Show(_PageLabelBox, b.Left, b.Bottom); - } - }; - _LabelStyleMenu.ItemClicked += (s, args) => { - _LabelBox.SelectedObject.Style = args.ClickedItem.Text; - _PageLabelBox.RefreshObject(_PageLabelBox.SelectedObject); - }; - } - - void _AddPageLabelButton_Click(object sender, EventArgs e) { - var i = 0; - foreach (var item in _Labels) { - if (item.PageNumber > i) { - i = item.PageNumber; - } - } - ++i; - _Labels.Add(new Model.PageLabel() { PageNumber = i, StartPage = 1 }); - _LabelBox.Objects = _Labels; - } - - void _RemovePageLabelButton_Click(object sender, EventArgs e) { - _PageLabelBox.RemoveObjects(_PageLabelBox.SelectedObjects); - _Labels.Clear(); - _Labels.AddRange(_LabelBox.Objects); - } - - } -} diff --git a/pdfpatcher/App/Functions/DocumentOption/PageLabelEditor.resx b/pdfpatcher/App/Functions/DocumentOption/PageLabelEditor.resx deleted file mode 100644 index 24882cca85cf5be02be23b2384cf54c4489cfd52..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentOption/PageLabelEditor.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/DocumentOption/PageSettingsEditor.Designer.cs b/pdfpatcher/App/Functions/DocumentOption/PageSettingsEditor.Designer.cs deleted file mode 100644 index 870a1bdec7fb98c48f3b877518c61feb54924d6c..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentOption/PageSettingsEditor.Designer.cs +++ /dev/null @@ -1,292 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class PageSettingsEditor - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.components = new System.ComponentModel.Container(); - System.Windows.Forms.ToolStripSeparator toolStripSeparator1; - System.Windows.Forms.ToolStripSeparator toolStripSeparator2; - this._RotateZeroMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this._PageSettingsBox = new BrightIdeasSoftware.ObjectListView(); - this._SequenceColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._PageRangeColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._PageFilterColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._SettingsColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._PageRangeFilterTypeMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._AllPagesMenu = new System.Windows.Forms.ToolStripMenuItem(); - this._OddPagesMenu = new System.Windows.Forms.ToolStripMenuItem(); - this._EvenPagesMenu = new System.Windows.Forms.ToolStripMenuItem(); - this._PortraitPagesMenu = new System.Windows.Forms.ToolStripMenuItem(); - this._LandscapePagesMenu = new System.Windows.Forms.ToolStripMenuItem(); - this._PageSettingsMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._RotateMenu = new System.Windows.Forms.ToolStripMenuItem(); - this._RotateLeftMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this._RotateRightMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this._Rotate180MenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this._RemoveButton = new System.Windows.Forms.Button(); - this._AddButton = new System.Windows.Forms.Button(); - this.panel1 = new System.Windows.Forms.Panel(); - toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - ((System.ComponentModel.ISupportInitialize)(this._PageSettingsBox)).BeginInit(); - this._PageRangeFilterTypeMenu.SuspendLayout(); - this._PageSettingsMenu.SuspendLayout(); - this.panel1.SuspendLayout(); - this.SuspendLayout(); - // - // toolStripSeparator1 - // - toolStripSeparator1.Name = "toolStripSeparator1"; - toolStripSeparator1.Size = new System.Drawing.Size(138, 6); - // - // toolStripSeparator2 - // - toolStripSeparator2.Name = "toolStripSeparator2"; - toolStripSeparator2.Size = new System.Drawing.Size(138, 6); - // - // _RotateZeroMenuItem - // - this._RotateZeroMenuItem.Name = "_RotateZeroMenuItem"; - this._RotateZeroMenuItem.Size = new System.Drawing.Size(149, 22); - this._RotateZeroMenuItem.Text = "保持不变(&B)"; - // - // _PageSettingsBox - // - this._PageSettingsBox.AllColumns.Add(this._SequenceColumn); - this._PageSettingsBox.AllColumns.Add(this._PageRangeColumn); - this._PageSettingsBox.AllColumns.Add(this._PageFilterColumn); - this._PageSettingsBox.AllColumns.Add(this._SettingsColumn); - this._PageSettingsBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._PageSettingsBox.CellEditActivation = BrightIdeasSoftware.ObjectListView.CellEditActivateMode.SingleClick; - this._PageSettingsBox.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this._SequenceColumn, - this._PageRangeColumn, - this._PageFilterColumn, - this._SettingsColumn}); - this._PageSettingsBox.GridLines = true; - this._PageSettingsBox.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this._PageSettingsBox.HideSelection = false; - this._PageSettingsBox.IsSimpleDragSource = true; - this._PageSettingsBox.IsSimpleDropSink = true; - this._PageSettingsBox.LabelEdit = true; - this._PageSettingsBox.Location = new System.Drawing.Point(3, 32); - this._PageSettingsBox.Name = "_PageSettingsBox"; - this._PageSettingsBox.OwnerDraw = true; - this._PageSettingsBox.ShowGroups = false; - this._PageSettingsBox.Size = new System.Drawing.Size(432, 244); - this._PageSettingsBox.TabIndex = 3; - this._PageSettingsBox.UseCompatibleStateImageBehavior = false; - this._PageSettingsBox.View = System.Windows.Forms.View.Details; - // - // _SequenceColumn - // - this._SequenceColumn.IsEditable = false; - this._SequenceColumn.Text = "序号"; - this._SequenceColumn.Width = 40; - // - // _PageRangeColumn - // - this._PageRangeColumn.AspectName = ""; - this._PageRangeColumn.Text = "页码范围"; - this._PageRangeColumn.Width = 82; - // - // _PageFilterColumn - // - this._PageFilterColumn.AspectName = ""; - this._PageFilterColumn.IsEditable = false; - this._PageFilterColumn.Text = "筛选页面"; - this._PageFilterColumn.Width = 61; - // - // _SettingsColumn - // - this._SettingsColumn.IsEditable = false; - this._SettingsColumn.Text = "处理方式"; - this._SettingsColumn.Width = 214; - // - // _PageRangeFilterTypeMenu - // - this._PageRangeFilterTypeMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._AllPagesMenu, - toolStripSeparator1, - this._OddPagesMenu, - this._EvenPagesMenu, - toolStripSeparator2, - this._PortraitPagesMenu, - this._LandscapePagesMenu}); - this._PageRangeFilterTypeMenu.Name = "_PageRangeFilterTypeMenu"; - this._PageRangeFilterTypeMenu.Size = new System.Drawing.Size(142, 126); - // - // _AllPagesMenu - // - this._AllPagesMenu.Image = global::PDFPatcher.Properties.Resources.Copy; - this._AllPagesMenu.Name = "_AllPagesMenu"; - this._AllPagesMenu.Size = new System.Drawing.Size(141, 22); - this._AllPagesMenu.Text = "所有页面(&Y)"; - // - // _OddPagesMenu - // - this._OddPagesMenu.Image = global::PDFPatcher.Properties.Resources.OddPage; - this._OddPagesMenu.Name = "_OddPagesMenu"; - this._OddPagesMenu.Size = new System.Drawing.Size(141, 22); - this._OddPagesMenu.Text = "单数页(&D)"; - // - // _EvenPagesMenu - // - this._EvenPagesMenu.Image = global::PDFPatcher.Properties.Resources.EvenPage; - this._EvenPagesMenu.Name = "_EvenPagesMenu"; - this._EvenPagesMenu.Size = new System.Drawing.Size(141, 22); - this._EvenPagesMenu.Text = "双数页(&S)"; - // - // _PortraitPagesMenu - // - this._PortraitPagesMenu.Image = global::PDFPatcher.Properties.Resources.Portrait; - this._PortraitPagesMenu.Name = "_PortraitPagesMenu"; - this._PortraitPagesMenu.Size = new System.Drawing.Size(141, 22); - this._PortraitPagesMenu.Text = "纵向页面(&Z)"; - // - // _LandscapePagesMenu - // - this._LandscapePagesMenu.Image = global::PDFPatcher.Properties.Resources.Lanscape; - this._LandscapePagesMenu.Name = "_LandscapePagesMenu"; - this._LandscapePagesMenu.Size = new System.Drawing.Size(141, 22); - this._LandscapePagesMenu.Text = "横向页面(&H)"; - // - // _PageSettingsMenu - // - this._PageSettingsMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._RotateMenu}); - this._PageSettingsMenu.Name = "_PageSettingsMenu"; - this._PageSettingsMenu.Size = new System.Drawing.Size(141, 26); - // - // _RotateMenu - // - this._RotateMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._RotateZeroMenuItem, - this._RotateLeftMenuItem, - this._RotateRightMenuItem, - this._Rotate180MenuItem}); - this._RotateMenu.Name = "_RotateMenu"; - this._RotateMenu.Size = new System.Drawing.Size(140, 22); - this._RotateMenu.Text = "旋转页面(&X)"; - // - // _RotateLeftMenuItem - // - this._RotateLeftMenuItem.Image = global::PDFPatcher.Properties.Resources.RotateLeft; - this._RotateLeftMenuItem.Name = "_RotateLeftMenuItem"; - this._RotateLeftMenuItem.Size = new System.Drawing.Size(149, 22); - this._RotateLeftMenuItem.Text = "左转 90 度(&Z)"; - // - // _RotateRightMenuItem - // - this._RotateRightMenuItem.Image = global::PDFPatcher.Properties.Resources.RotateRight; - this._RotateRightMenuItem.Name = "_RotateRightMenuItem"; - this._RotateRightMenuItem.Size = new System.Drawing.Size(149, 22); - this._RotateRightMenuItem.Text = "右转 90 度(&Y)"; - // - // _Rotate180MenuItem - // - this._Rotate180MenuItem.Image = global::PDFPatcher.Properties.Resources.Refresh; - this._Rotate180MenuItem.Name = "_Rotate180MenuItem"; - this._Rotate180MenuItem.Size = new System.Drawing.Size(149, 22); - this._Rotate180MenuItem.Text = "旋转 180 度"; - // - // _RemoveButton - // - this._RemoveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._RemoveButton.Image = global::PDFPatcher.Properties.Resources.Delete; - this._RemoveButton.Location = new System.Drawing.Point(382, 3); - this._RemoveButton.Name = "_RemoveButton"; - this._RemoveButton.Size = new System.Drawing.Size(53, 23); - this._RemoveButton.TabIndex = 5; - this._RemoveButton.Text = "删除"; - this._RemoveButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._RemoveButton.UseVisualStyleBackColor = true; - this._RemoveButton.Click += new System.EventHandler(this._RemovePageSettingsButton_Click); - // - // _AddButton - // - this._AddButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._AddButton.Image = global::PDFPatcher.Properties.Resources.Add; - this._AddButton.Location = new System.Drawing.Point(323, 3); - this._AddButton.Name = "_AddButton"; - this._AddButton.Size = new System.Drawing.Size(53, 23); - this._AddButton.TabIndex = 4; - this._AddButton.Text = "添加"; - this._AddButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._AddButton.UseVisualStyleBackColor = true; - this._AddButton.Click += new System.EventHandler(this._AddPageSettingsButton_Click); - // - // panel1 - // - this.panel1.Controls.Add(this._PageSettingsBox); - this.panel1.Controls.Add(this._AddButton); - this.panel1.Controls.Add(this._RemoveButton); - this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel1.Location = new System.Drawing.Point(0, 0); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(438, 279); - this.panel1.TabIndex = 6; - // - // PageSettingsEditor - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.panel1); - this.Name = "PageSettingsEditor"; - this.Size = new System.Drawing.Size(438, 279); - ((System.ComponentModel.ISupportInitialize)(this._PageSettingsBox)).EndInit(); - this._PageRangeFilterTypeMenu.ResumeLayout(false); - this._PageSettingsMenu.ResumeLayout(false); - this.panel1.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Button _RemoveButton; - private System.Windows.Forms.Button _AddButton; - private BrightIdeasSoftware.ObjectListView _PageSettingsBox; - private BrightIdeasSoftware.OLVColumn _SequenceColumn; - private BrightIdeasSoftware.OLVColumn _PageRangeColumn; - private BrightIdeasSoftware.OLVColumn _PageFilterColumn; - private BrightIdeasSoftware.OLVColumn _SettingsColumn; - private System.Windows.Forms.ContextMenuStrip _PageRangeFilterTypeMenu; - private System.Windows.Forms.ContextMenuStrip _PageSettingsMenu; - private System.Windows.Forms.ToolStripMenuItem _RotateMenu; - private System.Windows.Forms.ToolStripMenuItem _AllPagesMenu; - private System.Windows.Forms.ToolStripMenuItem _OddPagesMenu; - private System.Windows.Forms.ToolStripMenuItem _EvenPagesMenu; - private System.Windows.Forms.ToolStripMenuItem _LandscapePagesMenu; - private System.Windows.Forms.ToolStripMenuItem _PortraitPagesMenu; - private System.Windows.Forms.ToolStripMenuItem _RotateZeroMenuItem; - private System.Windows.Forms.ToolStripMenuItem _RotateLeftMenuItem; - private System.Windows.Forms.ToolStripMenuItem _RotateRightMenuItem; - private System.Windows.Forms.ToolStripMenuItem _Rotate180MenuItem; - private System.Windows.Forms.Panel panel1; - } -} diff --git a/pdfpatcher/App/Functions/DocumentOption/PageSettingsEditor.cs b/pdfpatcher/App/Functions/DocumentOption/PageSettingsEditor.cs deleted file mode 100644 index 28b12cc8c69f0d46b7d86f5d283e7dc62235ad48..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentOption/PageSettingsEditor.cs +++ /dev/null @@ -1,166 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using BrightIdeasSoftware; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - sealed partial class PageSettingsEditor : UserControl - { - readonly TypedObjectListView _SettingsBox; - private List _Settings; - [Browsable(false)] - public List Settings { - get => _Settings; - set { _Settings = value; _SettingsBox.Objects = value; } - } - - public PageSettingsEditor() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - _SettingsBox = new TypedObjectListView(_PageSettingsBox); - new TypedColumn(_PageFilterColumn) { - AspectGetter = (o) => { - var f = o.Filter; - var eo = f & (PageFilterFlag.Even | PageFilterFlag.Odd); - var pl = f & (PageFilterFlag.Landscape | PageFilterFlag.Portrait); - return f == PageFilterFlag.NotSpecified ? "所有页面" - : String.Concat( - eo == PageFilterFlag.Odd ? "单数" - : eo == PageFilterFlag.Even ? "双数" - : String.Empty, - pl == PageFilterFlag.Landscape ? "横向" - : pl == PageFilterFlag.Portrait ? "纵向" - : String.Empty, - "页"); - } - }; - new TypedColumn(_SettingsColumn) { - AspectGetter = (o) => { - var r = o.Rotation; - return String.Concat( - r == 0 ? Constants.Content.RotationDirections.Zero - : r == 90 ? Constants.Content.RotationDirections.Right - : r == 180 ? Constants.Content.RotationDirections.HalfClock - : r == 270 ? Constants.Content.RotationDirections.Left - : Constants.Content.RotationDirections.Zero - ); - } - }; - new TypedColumn(_PageRangeColumn) { - AspectGetter = (o) => { return String.IsNullOrEmpty(o.PageRanges) ? Constants.PageFilterTypes.AllPages : o.PageRanges; }, - AspectPutter = (o, v) => { - var s = v as string; - o.PageRanges = s != Constants.PageFilterTypes.AllPages ? s : null; - } - }; - _PageSettingsBox.FormatRow += (s, args) => { - args.Item.SubItems[0].Text = (args.RowIndex + 1).ToText(); - }; - } - - void OnLoad() { - _PageSettingsBox.FixEditControlWidth(); - _PageSettingsBox.ScaleColumnWidths(); - _PageSettingsBox.FullRowSelect = true; - _PageSettingsBox.LabelEdit = false; - _PageSettingsBox.CellClick += (s, args) => { - if (args.Column == _PageFilterColumn) { - ShowMenuForClickedCell(args, _PageRangeFilterTypeMenu); - } - else if (args.Column == _SettingsColumn) { - ShowMenuForClickedCell(args, _PageSettingsMenu); - } - }; - _PageRangeFilterTypeMenu.Opening += (s, args) => { - var f = _SettingsBox.SelectedObject.Filter; - _AllPagesMenu.Checked = f == PageFilterFlag.All || f == PageFilterFlag.NotSpecified; - _OddPagesMenu.Checked = (f & PageFilterFlag.Odd) == PageFilterFlag.Odd; - _EvenPagesMenu.Checked = (f & PageFilterFlag.Even) == PageFilterFlag.Even; - _PortraitPagesMenu.Checked = (f & PageFilterFlag.Portrait) == PageFilterFlag.Portrait; - _LandscapePagesMenu.Checked = (f & PageFilterFlag.Landscape) == PageFilterFlag.Landscape; - }; - _PageRangeFilterTypeMenu.ItemClicked += (s, args) => { - var o = _SettingsBox.SelectedObject; - var i = args.ClickedItem; - if (_AllPagesMenu == i) { - o.Filter = PageFilterFlag.NotSpecified; - } - else if (_OddPagesMenu == i) { - o.Filter &= ~PageFilterFlag.Even; - o.Filter ^= PageFilterFlag.Odd; - } - else if (_EvenPagesMenu == i) { - o.Filter &= ~PageFilterFlag.Odd; - o.Filter ^= PageFilterFlag.Even; - } - else if (_LandscapePagesMenu == i) { - o.Filter &= ~PageFilterFlag.Portrait; - o.Filter ^= PageFilterFlag.Landscape; - } - else if (_PortraitPagesMenu == i) { - o.Filter &= ~PageFilterFlag.Landscape; - o.Filter ^= PageFilterFlag.Portrait; - } - if (o.Filter == PageFilterFlag.All) { - o.Filter = PageFilterFlag.NotSpecified; - } - _PageSettingsBox.RefreshObject(_PageSettingsBox.SelectedObject); - }; - _RotateMenu.DropDownOpening += (s, args) => { - var r = _SettingsBox.SelectedObject.Rotation; - foreach (ToolStripMenuItem item in _RotateMenu.DropDownItems) { - item.Checked = false; - } - switch (r) { - case 0: _RotateZeroMenuItem.Checked = true; break; - case 90: _RotateRightMenuItem.Checked = true; break; - case 180: _Rotate180MenuItem.Checked = true; break; - case 270: _RotateLeftMenuItem.Checked = true; break; - default: _RotateZeroMenuItem.Checked = true; break; - } - }; - _RotateMenu.DropDownItemClicked += (s, args) => { - var o = _SettingsBox.SelectedObject; - var i = args.ClickedItem; - if (_RotateZeroMenuItem == i) { - o.Rotation = 0; - } - else if (_RotateRightMenuItem == i) { - o.Rotation = 90; - } - else if (_RotateLeftMenuItem == i) { - o.Rotation = 270; - } - else if (_Rotate180MenuItem == i) { - o.Rotation = 180; - } - _PageSettingsBox.RefreshObject(o); - }; - } - - private void ShowMenuForClickedCell(CellClickEventArgs args, ContextMenuStrip menu) { - var b = _PageSettingsBox.GetSubItem(args.RowIndex, args.ColumnIndex).Bounds; - menu.Show(_PageSettingsBox, b.Left, b.Bottom); - } - - private void _AddPageSettingsButton_Click(object sender, EventArgs e) { - _Settings.Add(new PageBoxSettings()); - _SettingsBox.Objects = _Settings; - } - - private void _RemovePageSettingsButton_Click(object sender, EventArgs e) { - _PageSettingsBox.RemoveObjects(_PageSettingsBox.SelectedObjects); - _Settings.Clear(); - _Settings.AddRange(_SettingsBox.Objects); - } - - - } -} diff --git a/pdfpatcher/App/Functions/DocumentOption/PageSettingsEditor.resx b/pdfpatcher/App/Functions/DocumentOption/PageSettingsEditor.resx deleted file mode 100644 index 8caaeabe3de44eef9249726ddaba478bb0070473..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DocumentOption/PageSettingsEditor.resx +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - False - - - False - - - 17, 17 - - - 220, 17 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/DraggableForm.cs b/pdfpatcher/App/Functions/DraggableForm.cs deleted file mode 100644 index 53e4ccdd6fcf5c1beb3fa278849fe42f24a19ba8..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/DraggableForm.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Windows.Forms; - -namespace PDFPatcher.Functions -{ - public class DraggableForm : Form - { - protected override void OnMouseDown(MouseEventArgs args) { - if (args.Button == MouseButtons.Left) { - NativeMethods.ReleaseCapture(); - NativeMethods.SendMessage(Handle, 0xa1, (IntPtr)0x2, (IntPtr)0); - } - base.OnMouseMove(args); - } - - static class NativeMethods - { - #region Form Dragging API Support - //The SendMessage function sends a message to a window or windows. - [DllImport("user32.dll", SetLastError = false)] - internal static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam); - - //ReleaseCapture releases a mouse capture - [DllImport("user32.dll", SetLastError = false)] - internal static extern bool ReleaseCapture(); - #endregion - } - } -} diff --git a/pdfpatcher/App/Functions/Editor/ActionEditorForm.Designer.cs b/pdfpatcher/App/Functions/Editor/ActionEditorForm.Designer.cs deleted file mode 100644 index bde5a2e4b3ff79eaec4991d84c86539bf81ae896..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/ActionEditorForm.Designer.cs +++ /dev/null @@ -1,629 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class ActionEditorForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager (typeof (ActionEditorForm)); - this._OkButton = new System.Windows.Forms.Button (); - this._CancelButton = new System.Windows.Forms.Button (); - this._DestinationPanel = new System.Windows.Forms.GroupBox (); - this._PathPanel = new System.Windows.Forms.Panel (); - this._PathBox = new System.Windows.Forms.TextBox (); - this.label4 = new System.Windows.Forms.Label (); - this._NewWindowBox = new System.Windows.Forms.CheckBox (); - this._NamedBox = new System.Windows.Forms.TextBox (); - this._GotoNamedDestBox = new System.Windows.Forms.RadioButton (); - this._GotoLocationBox = new System.Windows.Forms.RadioButton (); - this._LocationPanel = new System.Windows.Forms.Panel (); - this.label10 = new System.Windows.Forms.Label (); - this.label3 = new System.Windows.Forms.Label (); - this._KeepYBox = new System.Windows.Forms.CheckBox (); - this._PageBox = new System.Windows.Forms.NumericUpDown (); - this._KeepXBox = new System.Windows.Forms.CheckBox (); - this.label5 = new System.Windows.Forms.Label (); - this._ZoomRateBox = new System.Windows.Forms.ComboBox (); - this._LeftBox = new System.Windows.Forms.NumericUpDown (); - this.label7 = new System.Windows.Forms.Label (); - this._TopBox = new System.Windows.Forms.NumericUpDown (); - this.label6 = new System.Windows.Forms.Label (); - this._RectanglePanel = new System.Windows.Forms.Panel (); - this.label8 = new System.Windows.Forms.Label (); - this._WidthBox = new System.Windows.Forms.NumericUpDown (); - this.label9 = new System.Windows.Forms.Label (); - this._HeightBox = new System.Windows.Forms.NumericUpDown (); - this._ActionBox = new System.Windows.Forms.ComboBox (); - this.label2 = new System.Windows.Forms.Label (); - this._TitleBox = new System.Windows.Forms.TextBox (); - this.label1 = new System.Windows.Forms.Label (); - this.tabControl1 = new System.Windows.Forms.TabControl (); - this.tabPage1 = new System.Windows.Forms.TabPage (); - this._DefaultOpenBox = new System.Windows.Forms.CheckBox (); - this._ScriptBox = new System.Windows.Forms.GroupBox (); - this._ScriptContentBox = new System.Windows.Forms.TextBox (); - this.tabPage2 = new System.Windows.Forms.TabPage (); - this._AttributesBox = new BrightIdeasSoftware.ObjectListView (); - this._AttrNameColumn = new BrightIdeasSoftware.OLVColumn (); - this._AttrValueColumn = new BrightIdeasSoftware.OLVColumn (); - this._DestinationPanel.SuspendLayout (); - this._PathPanel.SuspendLayout (); - this._LocationPanel.SuspendLayout (); - ((System.ComponentModel.ISupportInitialize)(this._PageBox)).BeginInit (); - ((System.ComponentModel.ISupportInitialize)(this._LeftBox)).BeginInit (); - ((System.ComponentModel.ISupportInitialize)(this._TopBox)).BeginInit (); - this._RectanglePanel.SuspendLayout (); - ((System.ComponentModel.ISupportInitialize)(this._WidthBox)).BeginInit (); - ((System.ComponentModel.ISupportInitialize)(this._HeightBox)).BeginInit (); - this.tabControl1.SuspendLayout (); - this.tabPage1.SuspendLayout (); - this._ScriptBox.SuspendLayout (); - this.tabPage2.SuspendLayout (); - ((System.ComponentModel.ISupportInitialize)(this._AttributesBox)).BeginInit (); - this.SuspendLayout (); - // - // _OkButton - // - this._OkButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._OkButton.Location = new System.Drawing.Point (293, 348); - this._OkButton.Name = "_OkButton"; - this._OkButton.Size = new System.Drawing.Size (75, 23); - this._OkButton.TabIndex = 0; - this._OkButton.Text = "确定(&Q)"; - this._OkButton.UseVisualStyleBackColor = true; - this._OkButton.Click += new System.EventHandler (this._OkButton_Click); - // - // _CancelButton - // - this._CancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this._CancelButton.Location = new System.Drawing.Point (374, 348); - this._CancelButton.Name = "_CancelButton"; - this._CancelButton.Size = new System.Drawing.Size (75, 23); - this._CancelButton.TabIndex = 1; - this._CancelButton.Text = "取消(&X)"; - this._CancelButton.UseVisualStyleBackColor = true; - this._CancelButton.Click += new System.EventHandler (this._CancelButton_Click); - // - // _DestinationPanel - // - this._DestinationPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._DestinationPanel.Controls.Add (this._PathPanel); - this._DestinationPanel.Controls.Add (this._NamedBox); - this._DestinationPanel.Controls.Add (this._GotoNamedDestBox); - this._DestinationPanel.Controls.Add (this._GotoLocationBox); - this._DestinationPanel.Controls.Add (this._LocationPanel); - this._DestinationPanel.Location = new System.Drawing.Point (6, 61); - this._DestinationPanel.Name = "_DestinationPanel"; - this._DestinationPanel.Size = new System.Drawing.Size (417, 238); - this._DestinationPanel.TabIndex = 7; - this._DestinationPanel.TabStop = false; - this._DestinationPanel.Text = "目标"; - // - // _PathPanel - // - this._PathPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._PathPanel.Controls.Add (this._PathBox); - this._PathPanel.Controls.Add (this.label4); - this._PathPanel.Controls.Add (this._NewWindowBox); - this._PathPanel.Enabled = false; - this._PathPanel.Location = new System.Drawing.Point (5, 185); - this._PathPanel.Name = "_PathPanel"; - this._PathPanel.Size = new System.Drawing.Size (406, 47); - this._PathPanel.TabIndex = 15; - // - // _PathBox - // - this._PathBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._PathBox.Location = new System.Drawing.Point (105, 3); - this._PathBox.Name = "_PathBox"; - this._PathBox.Size = new System.Drawing.Size (298, 21); - this._PathBox.TabIndex = 3; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point (13, 6); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size (89, 12); - this.label4.TabIndex = 2; - this.label4.Text = "外部文档路径:"; - // - // _NewWindowBox - // - this._NewWindowBox.AutoSize = true; - this._NewWindowBox.Location = new System.Drawing.Point (105, 30); - this._NewWindowBox.Name = "_NewWindowBox"; - this._NewWindowBox.Size = new System.Drawing.Size (96, 16); - this._NewWindowBox.TabIndex = 4; - this._NewWindowBox.Text = "在新窗口打开"; - this._NewWindowBox.UseVisualStyleBackColor = true; - // - // _NamedBox - // - this._NamedBox.Enabled = false; - this._NamedBox.Location = new System.Drawing.Point (110, 158); - this._NamedBox.Name = "_NamedBox"; - this._NamedBox.Size = new System.Drawing.Size (215, 21); - this._NamedBox.TabIndex = 14; - // - // _GotoNamedDestBox - // - this._GotoNamedDestBox.AutoSize = true; - this._GotoNamedDestBox.Location = new System.Drawing.Point (9, 159); - this._GotoNamedDestBox.Name = "_GotoNamedDestBox"; - this._GotoNamedDestBox.Size = new System.Drawing.Size (95, 16); - this._GotoNamedDestBox.TabIndex = 13; - this._GotoNamedDestBox.TabStop = true; - this._GotoNamedDestBox.Text = "转到命名位置"; - this._GotoNamedDestBox.UseVisualStyleBackColor = true; - this._GotoNamedDestBox.CheckedChanged += new System.EventHandler (this.Control_ValueChanged); - // - // _GotoLocationBox - // - this._GotoLocationBox.AutoSize = true; - this._GotoLocationBox.Location = new System.Drawing.Point (6, 20); - this._GotoLocationBox.Name = "_GotoLocationBox"; - this._GotoLocationBox.Size = new System.Drawing.Size (95, 16); - this._GotoLocationBox.TabIndex = 12; - this._GotoLocationBox.TabStop = true; - this._GotoLocationBox.Text = "转到指定位置"; - this._GotoLocationBox.UseVisualStyleBackColor = true; - this._GotoLocationBox.CheckedChanged += new System.EventHandler (this.Control_ValueChanged); - // - // _LocationPanel - // - this._LocationPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._LocationPanel.Controls.Add (this.label10); - this._LocationPanel.Controls.Add (this.label3); - this._LocationPanel.Controls.Add (this._KeepYBox); - this._LocationPanel.Controls.Add (this._PageBox); - this._LocationPanel.Controls.Add (this._KeepXBox); - this._LocationPanel.Controls.Add (this.label5); - this._LocationPanel.Controls.Add (this._ZoomRateBox); - this._LocationPanel.Controls.Add (this._LeftBox); - this._LocationPanel.Controls.Add (this.label7); - this._LocationPanel.Controls.Add (this._TopBox); - this._LocationPanel.Controls.Add (this.label6); - this._LocationPanel.Controls.Add (this._RectanglePanel); - this._LocationPanel.Enabled = false; - this._LocationPanel.Location = new System.Drawing.Point (39, 42); - this._LocationPanel.Name = "_LocationPanel"; - this._LocationPanel.Size = new System.Drawing.Size (372, 110); - this._LocationPanel.TabIndex = 11; - // - // label10 - // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point (173, 86); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size (95, 12); - this.label10.TabIndex = 11; - this.label10.Text = "(0:保持不变)"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point (0, 5); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size (65, 12); - this.label3.TabIndex = 0; - this.label3.Text = "目标页面:"; - // - // _KeepYBox - // - this._KeepYBox.AutoSize = true; - this._KeepYBox.Location = new System.Drawing.Point (145, 57); - this._KeepYBox.Name = "_KeepYBox"; - this._KeepYBox.Size = new System.Drawing.Size (48, 16); - this._KeepYBox.TabIndex = 7; - this._KeepYBox.Text = "默认"; - this._KeepYBox.UseVisualStyleBackColor = true; - this._KeepYBox.CheckedChanged += new System.EventHandler (this.Control_ValueChanged); - // - // _PageBox - // - this._PageBox.Location = new System.Drawing.Point (71, 3); - this._PageBox.Maximum = new decimal (new int[] { - 9999999, - 0, - 0, - 0}); - this._PageBox.Minimum = new decimal (new int[] { - 1, - 0, - 0, - 0}); - this._PageBox.Name = "_PageBox"; - this._PageBox.Size = new System.Drawing.Size (68, 21); - this._PageBox.TabIndex = 1; - this._PageBox.Value = new decimal (new int[] { - 1, - 0, - 0, - 0}); - // - // _KeepXBox - // - this._KeepXBox.AutoSize = true; - this._KeepXBox.Location = new System.Drawing.Point (145, 30); - this._KeepXBox.Name = "_KeepXBox"; - this._KeepXBox.Size = new System.Drawing.Size (48, 16); - this._KeepXBox.TabIndex = 4; - this._KeepXBox.Text = "默认"; - this._KeepXBox.UseVisualStyleBackColor = true; - this._KeepXBox.CheckedChanged += new System.EventHandler (this.Control_ValueChanged); - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point (12, 31); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size (53, 12); - this.label5.TabIndex = 2; - this.label5.Text = "横坐标:"; - // - // _ZoomRateBox - // - this._ZoomRateBox.FormattingEnabled = true; - this._ZoomRateBox.Location = new System.Drawing.Point (71, 83); - this._ZoomRateBox.Name = "_ZoomRateBox"; - this._ZoomRateBox.Size = new System.Drawing.Size (96, 20); - this._ZoomRateBox.TabIndex = 10; - this._ZoomRateBox.SelectedIndexChanged += new System.EventHandler (this.Control_ValueChanged); - // - // _LeftBox - // - this._LeftBox.DecimalPlaces = 2; - this._LeftBox.Location = new System.Drawing.Point (71, 29); - this._LeftBox.Maximum = new decimal (new int[] { - 10000, - 0, - 0, - 0}); - this._LeftBox.Minimum = new decimal (new int[] { - 10000, - 0, - 0, - -2147483648}); - this._LeftBox.Name = "_LeftBox"; - this._LeftBox.Size = new System.Drawing.Size (68, 21); - this._LeftBox.TabIndex = 3; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point (2, 86); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size (65, 12); - this.label7.TabIndex = 9; - this.label7.Text = "缩放比例:"; - // - // _TopBox - // - this._TopBox.DecimalPlaces = 2; - this._TopBox.Location = new System.Drawing.Point (71, 56); - this._TopBox.Maximum = new decimal (new int[] { - 10000, - 0, - 0, - 0}); - this._TopBox.Minimum = new decimal (new int[] { - 10000, - 0, - 0, - -2147483648}); - this._TopBox.Name = "_TopBox"; - this._TopBox.Size = new System.Drawing.Size (68, 21); - this._TopBox.TabIndex = 6; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point (12, 58); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size (53, 12); - this.label6.TabIndex = 5; - this.label6.Text = "纵坐标:"; - // - // _RectanglePanel - // - this._RectanglePanel.Controls.Add (this.label8); - this._RectanglePanel.Controls.Add (this._WidthBox); - this._RectanglePanel.Controls.Add (this.label9); - this._RectanglePanel.Controls.Add (this._HeightBox); - this._RectanglePanel.Enabled = false; - this._RectanglePanel.Location = new System.Drawing.Point (229, 27); - this._RectanglePanel.Name = "_RectanglePanel"; - this._RectanglePanel.Size = new System.Drawing.Size (128, 56); - this._RectanglePanel.TabIndex = 8; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point (3, 4); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size (41, 12); - this.label8.TabIndex = 0; - this.label8.Text = "宽度:"; - // - // _WidthBox - // - this._WidthBox.DecimalPlaces = 2; - this._WidthBox.Location = new System.Drawing.Point (54, 2); - this._WidthBox.Maximum = new decimal (new int[] { - 10000, - 0, - 0, - 0}); - this._WidthBox.Name = "_WidthBox"; - this._WidthBox.Size = new System.Drawing.Size (68, 21); - this._WidthBox.TabIndex = 1; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point (3, 31); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size (41, 12); - this.label9.TabIndex = 2; - this.label9.Text = "高度:"; - // - // _HeightBox - // - this._HeightBox.DecimalPlaces = 2; - this._HeightBox.Location = new System.Drawing.Point (54, 29); - this._HeightBox.Maximum = new decimal (new int[] { - 10000, - 0, - 0, - 0}); - this._HeightBox.Name = "_HeightBox"; - this._HeightBox.Size = new System.Drawing.Size (68, 21); - this._HeightBox.TabIndex = 3; - // - // _ActionBox - // - this._ActionBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._ActionBox.FormattingEnabled = true; - this._ActionBox.Location = new System.Drawing.Point (49, 35); - this._ActionBox.Name = "_ActionBox"; - this._ActionBox.Size = new System.Drawing.Size (156, 20); - this._ActionBox.TabIndex = 6; - this._ActionBox.SelectedIndexChanged += new System.EventHandler (this.Control_ValueChanged); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point (6, 38); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size (41, 12); - this.label2.TabIndex = 5; - this.label2.Text = "动作:"; - // - // _TitleBox - // - this._TitleBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._TitleBox.Location = new System.Drawing.Point (49, 10); - this._TitleBox.Name = "_TitleBox"; - this._TitleBox.Size = new System.Drawing.Size (374, 21); - this._TitleBox.TabIndex = 1; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point (6, 13); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size (41, 12); - this.label1.TabIndex = 0; - this.label1.Text = "名称:"; - // - // tabControl1 - // - this.tabControl1.Controls.Add (this.tabPage1); - this.tabControl1.Controls.Add (this.tabPage2); - this.tabControl1.Location = new System.Drawing.Point (12, 12); - this.tabControl1.Name = "tabControl1"; - this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size (437, 330); - this.tabControl1.TabIndex = 8; - // - // tabPage1 - // - this.tabPage1.Controls.Add (this._DefaultOpenBox); - this.tabPage1.Controls.Add (this._TitleBox); - this.tabPage1.Controls.Add (this.label2); - this.tabPage1.Controls.Add (this.label1); - this.tabPage1.Controls.Add (this._ActionBox); - this.tabPage1.Controls.Add (this._DestinationPanel); - this.tabPage1.Controls.Add (this._ScriptBox); - this.tabPage1.Location = new System.Drawing.Point (4, 22); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding (3); - this.tabPage1.Size = new System.Drawing.Size (429, 304); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "常规"; - this.tabPage1.UseVisualStyleBackColor = true; - // - // _DefaultOpenBox - // - this._DefaultOpenBox.AutoSize = true; - this._DefaultOpenBox.Location = new System.Drawing.Point (211, 37); - this._DefaultOpenBox.Name = "_DefaultOpenBox"; - this._DefaultOpenBox.Size = new System.Drawing.Size (96, 16); - this._DefaultOpenBox.TabIndex = 9; - this._DefaultOpenBox.Text = "默认打开书签"; - this._DefaultOpenBox.UseVisualStyleBackColor = true; - // - // _ScriptBox - // - this._ScriptBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ScriptBox.Controls.Add (this._ScriptContentBox); - this._ScriptBox.Location = new System.Drawing.Point (348, 37); - this._ScriptBox.Name = "_ScriptBox"; - this._ScriptBox.Size = new System.Drawing.Size (75, 49); - this._ScriptBox.TabIndex = 8; - this._ScriptBox.TabStop = false; - this._ScriptBox.Text = "脚本内容"; - this._ScriptBox.Visible = false; - // - // _ScriptContentBox - // - this._ScriptContentBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ScriptContentBox.Location = new System.Drawing.Point (6, 20); - this._ScriptContentBox.Multiline = true; - this._ScriptContentBox.Name = "_ScriptContentBox"; - this._ScriptContentBox.Size = new System.Drawing.Size (63, 23); - this._ScriptContentBox.TabIndex = 16; - // - // tabPage2 - // - this.tabPage2.Controls.Add (this._AttributesBox); - this.tabPage2.Location = new System.Drawing.Point (4, 22); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding (3); - this.tabPage2.Size = new System.Drawing.Size (429, 304); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "属性"; - this.tabPage2.UseVisualStyleBackColor = true; - // - // _AttributesBox - // - this._AttributesBox.AllColumns.Add (this._AttrNameColumn); - this._AttributesBox.AllColumns.Add (this._AttrValueColumn); - this._AttributesBox.Columns.AddRange (new System.Windows.Forms.ColumnHeader[] { - this._AttrNameColumn, - this._AttrValueColumn}); - this._AttributesBox.GridLines = true; - this._AttributesBox.Location = new System.Drawing.Point (6, 6); - this._AttributesBox.Name = "_AttributesBox"; - this._AttributesBox.ShowGroups = false; - this._AttributesBox.Size = new System.Drawing.Size (417, 293); - this._AttributesBox.TabIndex = 0; - this._AttributesBox.UseCompatibleStateImageBehavior = false; - this._AttributesBox.View = System.Windows.Forms.View.Details; - // - // _AttrNameColumn - // - this._AttrNameColumn.Text = "属性名称"; - // - // _AttrValueColumn - // - this._AttrValueColumn.FillsFreeSpace = true; - this._AttrValueColumn.Text = "属性值"; - // - // ActionEditorForm - // - this.AcceptButton = this._OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this._CancelButton; - this.ClientSize = new System.Drawing.Size (461, 383); - this.Controls.Add (this._CancelButton); - this.Controls.Add (this._OkButton); - this.Controls.Add (this.tabControl1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.Icon = ((System.Drawing.Icon)(resources.GetObject ("$this.Icon"))); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "ActionEditorForm"; - this.ShowInTaskbar = false; - this.Text = "链接属性编辑器"; - this._DestinationPanel.ResumeLayout (false); - this._DestinationPanel.PerformLayout (); - this._PathPanel.ResumeLayout (false); - this._PathPanel.PerformLayout (); - this._LocationPanel.ResumeLayout (false); - this._LocationPanel.PerformLayout (); - ((System.ComponentModel.ISupportInitialize)(this._PageBox)).EndInit (); - ((System.ComponentModel.ISupportInitialize)(this._LeftBox)).EndInit (); - ((System.ComponentModel.ISupportInitialize)(this._TopBox)).EndInit (); - this._RectanglePanel.ResumeLayout (false); - this._RectanglePanel.PerformLayout (); - ((System.ComponentModel.ISupportInitialize)(this._WidthBox)).EndInit (); - ((System.ComponentModel.ISupportInitialize)(this._HeightBox)).EndInit (); - this.tabControl1.ResumeLayout (false); - this.tabPage1.ResumeLayout (false); - this.tabPage1.PerformLayout (); - this._ScriptBox.ResumeLayout (false); - this._ScriptBox.PerformLayout (); - this.tabPage2.ResumeLayout (false); - ((System.ComponentModel.ISupportInitialize)(this._AttributesBox)).EndInit (); - this.ResumeLayout (false); - - } - - #endregion - - private System.Windows.Forms.Button _OkButton; - private System.Windows.Forms.Button _CancelButton; - private System.Windows.Forms.GroupBox _DestinationPanel; - private System.Windows.Forms.ComboBox _ActionBox; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox _TitleBox; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.NumericUpDown _PageBox; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.CheckBox _NewWindowBox; - private System.Windows.Forms.TextBox _PathBox; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.CheckBox _KeepYBox; - private System.Windows.Forms.CheckBox _KeepXBox; - private System.Windows.Forms.ComboBox _ZoomRateBox; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.NumericUpDown _TopBox; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.NumericUpDown _LeftBox; - private System.Windows.Forms.NumericUpDown _HeightBox; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.NumericUpDown _WidthBox; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.TextBox _NamedBox; - private System.Windows.Forms.RadioButton _GotoNamedDestBox; - private System.Windows.Forms.RadioButton _GotoLocationBox; - private System.Windows.Forms.Panel _LocationPanel; - private System.Windows.Forms.Panel _PathPanel; - private System.Windows.Forms.Panel _RectanglePanel; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.TabControl tabControl1; - private System.Windows.Forms.TabPage tabPage1; - private System.Windows.Forms.TabPage tabPage2; - private BrightIdeasSoftware.ObjectListView _AttributesBox; - private BrightIdeasSoftware.OLVColumn _AttrNameColumn; - private BrightIdeasSoftware.OLVColumn _AttrValueColumn; - private System.Windows.Forms.TextBox _ScriptContentBox; - private System.Windows.Forms.GroupBox _ScriptBox; - private System.Windows.Forms.CheckBox _DefaultOpenBox; - } -} - diff --git a/pdfpatcher/App/Functions/Editor/ActionEditorForm.cs b/pdfpatcher/App/Functions/Editor/ActionEditorForm.cs deleted file mode 100644 index 6516b5aa82cddaa0a9cb7af51a264c8555edd7e1..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/ActionEditorForm.cs +++ /dev/null @@ -1,249 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using System.Xml; -using PDFPatcher.Common; -using PDFPatcher.Model; -using PDFPatcher.Processor; - -namespace PDFPatcher.Functions -{ - sealed partial class ActionEditorForm : System.Windows.Forms.Form - { - const string KeepZoomRate = "保持不变"; - const string NoAction = "无"; - public BookmarkElement Action { get; private set; } - internal UndoActionGroup UndoActions { get; private set; } - - public ActionEditorForm(BookmarkElement element) { - InitializeComponent(); - Action = element; - _ActionBox.Items.AddRange(Constants.ActionType.Names); - _ActionBox.Items.Add(NoAction); - _ZoomRateBox.Items.AddRange(Constants.DestinationAttributes.ViewType.Names); - _ZoomRateBox.Items.AddRange(new string[] { "————————", "4", "3", "2", "1.5", "1.3", "1.2", "1", "0", "0.9", "0.8", "0.5", "0.3" }); - - int i = Array.IndexOf(Constants.ActionType.Names, element.GetAttribute(Constants.DestinationAttributes.Action)); - _ActionBox.SelectedIndex = (i != -1 ? i : 0); - if (_ActionBox.SelectedIndex == 0 && element.HasAttribute(Constants.DestinationAttributes.Page) == false && element.HasAttribute(Constants.DestinationAttributes.Named) == false) { - _ActionBox.SelectedItem = NoAction; - _DestinationPanel.Enabled = false; - } - _DefaultOpenBox.Checked = element.IsOpen; - i = Array.IndexOf(Constants.DestinationAttributes.ViewType.Names, element.GetAttribute(Constants.DestinationAttributes.View)); - _ZoomRateBox.SelectedIndex = (i != -1 ? i : 0); - i = _ZoomRateBox.FindString(Constants.DestinationAttributes.ViewType.XYZ); - if (i != -1) { - _ZoomRateBox.Items[i] = KeepZoomRate; - } - - if (_ZoomRateBox.Text == Constants.DestinationAttributes.ViewType.XYZ - && element.GetAttribute(Constants.Coordinates.ScaleFactor).TryParse(out float f)) { - _ZoomRateBox.SelectedIndex = -1; - _ZoomRateBox.Text = f.ToText(); - } - _TitleBox.Text = element.GetAttribute(Constants.BookmarkAttributes.Title); - _PathBox.Text = element.GetAttribute(Constants.DestinationAttributes.Path); - _NewWindowBox.Checked = element.GetAttribute(Constants.DestinationAttributes.NewWindow) == Constants.Boolean.True; - _NamedBox.Text = element.GetAttribute(Constants.DestinationAttributes.Named); - _GotoNamedDestBox.Checked = String.IsNullOrEmpty(_NamedBox.Text) == false; - _GotoLocationBox.Checked = element.HasAttribute(Constants.DestinationAttributes.Named) == false - && element.HasAttribute(Constants.DestinationAttributes.NamedN) == false; - - InitCoordinateValue(element, Constants.DestinationAttributes.Page, _PageBox, null); - InitCoordinateValue(element, Constants.Coordinates.Left, _LeftBox, _KeepXBox); - InitCoordinateValue(element, Constants.Coordinates.Top, _TopBox, _KeepYBox); - InitCoordinateValue(element, Constants.Coordinates.Right, _WidthBox, null); - _ScriptContentBox.Text = element.GetAttribute(Constants.DestinationAttributes.ScriptContent); - if (_WidthBox.Enabled) { - var v = _WidthBox.Value - _LeftBox.Value; - if (v > _WidthBox.Maximum) { - v = _WidthBox.Maximum; - } - else if (v < _WidthBox.Minimum) { - v = _WidthBox.Minimum; - } - _WidthBox.Value = v; - } - InitCoordinateValue(element, Constants.Coordinates.Bottom, _HeightBox, null); - if (_HeightBox.Enabled) { - var v = _TopBox.Value - _HeightBox.Value; - if (v > _HeightBox.Maximum) { - v = _HeightBox.Maximum; - } - else if (v < _HeightBox.Minimum) { - v = _HeightBox.Minimum; - } - _HeightBox.Value = v; - } - _AttrNameColumn.AspectGetter = (object o) => o is XmlAttribute attr ? attr.Name : (object)null; - _AttrValueColumn.AspectGetter = (object o) => { - if (o is XmlAttribute attr) { - if (attr.Name == Constants.Font.ThisName && attr.Value.TryParse(out int fid)) { - var n = attr.OwnerDocument.DocumentElement.SelectSingleNode( - String.Concat(Constants.Font.DocumentFont, "/", Constants.Font.ThisName, - "[@", Constants.Font.ID, "='", attr.Value, "']/@", Constants.Font.Name) - ); - if (n != null) { - return String.Concat(attr.Value, " (", n.Value, ")"); - } - } - return attr.Value; - } - return null; - }; - _AttributesBox.ScaleColumnWidths(); - _AttributesBox.SetObjects(element.Attributes); - } - - void InitCoordinateValue(XmlElement element, string name, NumericUpDown control, CheckBox check) { - if (element.HasAttribute(name)) { - var s = element.GetAttribute(name); - if (s.TryParse(out decimal x)) { - control.SetValue(x); - } - else if (check != null) { - check.Checked = true; - } - } - else if (check != null) { - check.Checked = true; - } - } - - void SetValue(string name, string value) { - if (UndoActions == null) { - UndoActions = new UndoActionGroup(); - } - bool a = Action.HasAttribute(name); - if ((value == null && a == false) - || (a && Action.GetAttribute(name) == value)) { - return; - } - UndoActions.Add(UndoAttributeAction.GetUndoAction(Action, name, value)); - } - - void _OkButton_Click(object source, EventArgs args) { - if (String.IsNullOrEmpty(_TitleBox.Text) == false) { - SetValue(Constants.BookmarkAttributes.Title, _TitleBox.Text); - } - var act = _ActionBox.SelectedItem as string; - if (act == NoAction) { - act = null; - } - SetValue(Constants.DestinationAttributes.Action, act); - SetValue(Constants.BookmarkAttributes.Open, _DefaultOpenBox.Checked ? Constants.Boolean.True : null); - if (act == null) { - SetValue(Constants.DestinationAttributes.Page, null); - } - else if (_ScriptBox.Visible) { - SetValue(Constants.DestinationAttributes.ScriptContent, _ScriptContentBox.Text); - } - else if (_GotoLocationBox.Checked) { - SetValue(Constants.DestinationAttributes.Page, _PageBox.Value.ToText()); - if (_ZoomRateBox.Text.TryParse(out float f)) { - SetValue(Constants.DestinationAttributes.View, Constants.DestinationAttributes.ViewType.XYZ); - SetValue(Constants.Coordinates.ScaleFactor, f.ToText()); - } - else if (_ZoomRateBox.Text == KeepZoomRate) { - SetValue(Constants.DestinationAttributes.View, Constants.DestinationAttributes.ViewType.XYZ); - SetValue(Constants.Coordinates.ScaleFactor, null); - } - else { - SetValue(Constants.DestinationAttributes.View, _ZoomRateBox.Text); - } - if (_LeftBox.Enabled || _KeepXBox.Enabled) { - SetValue(Constants.Coordinates.Left, _KeepXBox.Checked ? null : _LeftBox.Value.ToText()); - } - if (_TopBox.Enabled || _KeepYBox.Enabled) { - SetValue(Constants.Coordinates.Top, _KeepYBox.Checked ? null : _TopBox.Value.ToText()); - } - if (_RectanglePanel.Enabled) { - SetValue(Constants.Coordinates.Right, (_LeftBox.Value + _WidthBox.Value).ToText()); - SetValue(Constants.Coordinates.Bottom, (_TopBox.Value - _HeightBox.Value).ToText()); - } - } - else if (_GotoNamedDestBox.Checked) { - SetValue(Constants.DestinationAttributes.Named, _NamedBox.Text); - } - if (_PathPanel.Enabled) { - SetValue(Constants.DestinationAttributes.Path, _PathBox.Text); - if (_NewWindowBox.Enabled) { - SetValue(Constants.DestinationAttributes.NewWindow, _NewWindowBox.Checked ? Constants.Boolean.True : Constants.Boolean.False); - } - } - DialogResult = DialogResult.OK; - Close(); - } - - void _CancelButton_Click(Object source, EventArgs args) { - DialogResult = DialogResult.Cancel; - Close(); - } - - void Control_ValueChanged(object sender, EventArgs e) { - if (sender == _ActionBox) { - var i = _ActionBox.SelectedItem as string; - if (i == Constants.ActionType.Javascript) { - _ScriptBox.Parent = _DestinationPanel.Parent; - _ScriptBox.Top = _DestinationPanel.Top; - _ScriptBox.Left = _DestinationPanel.Left; - _ScriptBox.Size = _DestinationPanel.Size; - _ScriptBox.Visible = true; - _DestinationPanel.Visible = false; - } - else { - _DestinationPanel.Visible = true; - _DestinationPanel.Enabled = i != NoAction && i != Constants.ActionType.Javascript; - } - if (_DestinationPanel.Enabled) { - _NewWindowBox.Enabled = ValueHelper.IsInCollection(i, Constants.ActionType.GotoR, Constants.ActionType.Uri); - _PathPanel.Enabled = ValueHelper.IsInCollection(i, Constants.ActionType.GotoR, Constants.ActionType.Launch, Constants.ActionType.Uri); - } - } - else if (sender == _GotoLocationBox || sender == _GotoNamedDestBox) { - _LocationPanel.Enabled = _GotoLocationBox.Checked; - _NamedBox.Enabled = _GotoNamedDestBox.Checked; - } - else if (sender == _KeepXBox) { - _LeftBox.Enabled = !_KeepXBox.Checked; - } - else if (sender == _KeepYBox) { - _TopBox.Enabled = !_KeepYBox.Checked; - } - else if (sender == _ZoomRateBox) { - switch (_ZoomRateBox.Text) { - case Constants.DestinationAttributes.ViewType.XYZ: - case "保持不变": - goto default; - case Constants.DestinationAttributes.ViewType.Fit: - case Constants.DestinationAttributes.ViewType.FitB: - _TopBox.Enabled = _LeftBox.Enabled = _KeepXBox.Enabled = _KeepYBox.Enabled = _RectanglePanel.Enabled = false; - break; - case Constants.DestinationAttributes.ViewType.FitBH: - case Constants.DestinationAttributes.ViewType.FitH: - _TopBox.Enabled = _KeepYBox.Enabled = true; - _LeftBox.Enabled = _KeepXBox.Enabled = _RectanglePanel.Enabled = false; - break; - case Constants.DestinationAttributes.ViewType.FitBV: - case Constants.DestinationAttributes.ViewType.FitV: - _LeftBox.Enabled = _KeepXBox.Enabled = true; - _TopBox.Enabled = _KeepYBox.Enabled = _RectanglePanel.Enabled = false; - break; - case Constants.DestinationAttributes.ViewType.FitR: - _TopBox.Enabled = _LeftBox.Enabled = _RectanglePanel.Enabled = true; - _KeepXBox.Enabled = _KeepYBox.Enabled = false; - break; - default: - _TopBox.Enabled = _LeftBox.Enabled = _KeepXBox.Enabled = _KeepYBox.Enabled = true; - _RectanglePanel.Enabled = false; - break; - } - } - } - } -} diff --git a/pdfpatcher/App/Functions/Editor/ActionEditorForm.resx b/pdfpatcher/App/Functions/Editor/ActionEditorForm.resx deleted file mode 100644 index 6fb070e3c60fbba3724bd90c0eb3884e12b23e10..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/ActionEditorForm.resx +++ /dev/null @@ -1,3251 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - AAABAAcAEBAAAAAAAABoBAAAdgAAACAgAAAAAAAAqAgAAN4EAABAQAAAAAAAAChCAACGDQAAwMAAAAAA - AAAoUgIArk8AABAQAAAAAAAAaAQAANahAgAgIAAAAAAAAKgQAAA+pgIAMDAAAAAAAACoJQAA5rYCACgA - AAAQAAAAIAAAAAEAIAAAAAAAAAQAACMuAAAjLgAAAAAAAAAAAAAAAAAAAAAAACwsDGUqKguHKioLhyoq - C4cxPCCNToRyqGzQydV049/kb9fR2lmfkbZCZlCcQWNLeH///xl///8LAAAAAAAAAAA4OBeC//////// - ///+////9P/+/8H+/v+7zP7//gj//7fb/f+O//7/pP/9/3DWz9V///+Kf///QQAAAAAAAAAASUkme/// - ///+////+P7+/+H9/f+s/v7/ldT///8A///dSP//f////4P4//+qlfDuorn/9X///50AAAAAAAAAAFRU - L3f+////x8/A/7bZzf+h8uz/iPr4/4ns////AP///wD//+BT/v/4FP///wD//7KZ//d///+yAAAAAAAA - AABYWDN2/P/+/9rw4v+t+PD/s+Hy/62r/v/fb/3//wD///8A////AP///wD//8du/v1////yf///iAAA - qI0AAKT/AACi/wMGov8dO7T/YKvi//sA/v//AP///wD///8A////AP///wD///gQ//+F9P//f///53// - /2oAAK7/AACu/wAAsf8CBLL/Fy+//1Ch4f9om+f/paX8/7VM8f//AP///wD///8A////AP//1VL+/X// - //N///+LAAC1/wAAuf/h4f//kpPn/09Y1P83XNH/U6Xk/3Hj9v+J7P///wD///8A///ZUfv/9xT///8A - //+7iP/3f///sgAAvv8AAMf/UVHe/93d/f+io/D/wcj3/9Lt//97zPH/ldT///8A///rQ/j/f////4P4 - //+sn/n0orn/83///5YAAMb/AADS/wAA1f9nZ+j/YWHl/8fH9/9FT9n/O3fb/4+5+f/3EP//lNr8/4j3 - 9f+f/Pf/fOXezn///4l///87AADN/wAA2v8AAN7/LS3l/9PT+v9kZOf/BgzR/yRI1P9Wrej/kfz6/5v5 - 9f+78Ob/3fTn/3WXeYB///8Zf///CwAA0f8AAOD/AADm/wUF6P/+/v//ICDh/wED1f8KFM3/GzfL/8nv - 5P/Q697/3efX//Dy4f90eFFtf///An///wEAANX/AADj/wAA6v8AAOz/AADn/wAA3/8AANb/AQLL/wIF - wv/k59b/o6WV/6SllP+kpJP/SUklfAAAAAAAAAAAAADOjQAA2P8AANv/AADc/wAA2f8AANX/AADQ/wAA - yv9+fs3/5eXU/7a2pf//////enpRaHp6USUAAAAAAAAAAAAAAAAAAAAAfX1TZ/z89f/5+e//9vbq//T0 - 5f/z8+L/8vLh//Ly4f/CwrH/fX1TZ319UyUAAAAAAAAAAAAAAAAAAAAAAAAAAH9/VU1/f1Vmf39VZn9/ - VWZ/f1Vmf39VZn9/VWZ/f1Vmf39VZn9/VSQAAAAAAAAAAAAAAAAAAAAA4Af//8AB4AfgAMAB4ADgAOAA - 4AAAAeAAAAAAAQAAAAAAAAAAAAEAAAADAAEABwADAAcABwAPAAfgHwAP///gHygAAAAgAAAAQAAAAAEA - CAAAAAAAAAQAACMuAAAjLgAAAAAAAAAAAAAAAAAA5+foAOXl5gDj4+QA4ODgAN7e3gDb29wA2dnbANfX - 2gDT09QAzc3QAMfHzwDBwckAtra8AK6usADV1dYA2trcANjY2gDR0dEA0M/QAM7O0QDLy88AurrEAKmo - sACsq68A0tLSAN3d3QDc3N0As7O2AN/f3wBCP+wAOjjdAIeG6ACMjO0AionrAIiI6QDJyc8AzMzQAP7Z - /gD98v0AUU7pAKSj5ACop+AAn57lAJOS7ACYl+kAZ2bgAOHh4QD+v/4A/lbUAPr6+gD8+/wATEnvAGVj - 4wCpqckA3t7fANbW2gB+feQAhYTcAFJQ5wD+xv4A/gT9AO/u7gD+5v0A9vX1ADQy1wBAPeYAqanXALi3 - wQA9O+AAnJviAG5t2ACioeQAX13jAP4a+AD+D/sAHx27ACUkwwAjIcEAWVmGAENCoAAyMLEAg4LZAElI - mgA9O6gAKCa2ACgnxQBwb90A/gf9AO3s6wAfHbcAWlqEAFpZggBWU3wAUlGQAP4u6wDx8fEAOzmsADo4 - rQA5NqwA/iLzAPLy8gALBhIALiy1ADYzqwBNTJYAqKi0AO/v8AD+BvwA+fn5AFZOcwCxsbQA/kHdAPX0 - 9AD+y8gA/szTAPDw8ADu7e0A7OrqAPj4+AD+w7kA/lgvAPf29QDz8/IA8fHwAL69ygD+MwAA/p6bAPv7 - +wD+rpsA/qmYAEhE8AB1dOIA9PPzAMXFzAD+y98A/jUDAPxiPAD+PAwA+Pf2AEpH8ADk5OUA/k4iAO3r - 6gBFQu8A5ubnAP5BEgD+NgQA6unpAP4/DwD+kKIA/rOgAFdU4gBPTOoA/sa/AP34/ABEQO8Ae3niAP7A - swBcWd8AVlPhAFRS4wBiYOQAeHbhAGtq2gDi4uIA////AP///wD///8A////AP///wD///8A////AP// - /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// - /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// - /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// - /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// - /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// - /wD///8A////AP///wD///8A////AP///wD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACUQBhoFHR0JJQYDA6UvBAUaGxsG - BwkMAAAAAAAAAAAACQF2j1l1ATajFo1ZWY92AQGRjaUdB4YAAAAAAAAAAAAIj3U+a2BZnYOfhll0az51 - j3YBkQMbJAAAAAAAAAAAAAd1dGB7cXsgoJ+kEGtlZXRrdXYBjQUlAAAAAAAAAAAXhgF7cUB6elmjHow6 - hhoBdVkvEgwMGQoAAAAAAAAAAICAC3t6i3dtbXd9oplHahwNHBdHn58WCgAAAAAAAAAznoJ1CXdAAwcP - bTICnyg0mKChg4MoKH0UAAAAAAAAAACaiocPGgGAmwFZgG0rSYZSnJ05IC0VLxMAAAAAAAAAAHN+iTOL - l4mCi0AzgI2YR5kqcXFla3YvFAAAAAAAJBFZj35+iZV+ljOLMzMzdyIeLHp6cWVrdgQUAAAAADM+eH+J - fn5+fokzeoAzMzNtQ4wli3pxdHWUHRQAAAAzc4mSfn5+fn6TcwEGMoCAgHpGHkhxQGVrWQEdCgAAAAAz - MzNzgn5+fn6OjwcdbTJtYDqQOWBgdT52kQUlAAAAAAAAADOHfoiBiYp5fBI+d4tgOYxXWY0SDwGNBiQA - AAAAAAAAAHN+f4AzcYGCcQF6emAgg4SFJicKBS8IhgAAAAAAAAAAeHltWWVAMjN6e3F7fH01DHEwMW0M - GyQUGw0AAAAAADNyc3RrdHR0dHR0dGs+dVl2YDw9MAEFdz8wYAAAAAAAbh0Fbxwcb28cHG9vb28WEAYd - Jj1KPzBwSzxxAAAAAGZnaGlpaWlpaWlpaWlpXmoQazMmPT1sPWwwbQAAAAAAVWFiYmJhYmNjYmJiYWFG - PzAxZD09PT09MGUAAAAAAABaWlpbWlpaXFtdWl5aWlI/MDFfPT09PT0wYBgAAAAAAExNTjpPUFFSQVJT - UlRVVlcqQDM/PT1YPT0wWRcAAAAAQUJCQzpELkNFRkcMSElCQkUTHSY9Sj8wMUs8LwAAAAA0NTUTNhEi - NzY4ORA2OjU1OxMaPD0wPgEzPzBAAAAAACghISkqKywqKi0sKiorISMuEy8wMTIlAAAAMwAAAAAAAB4f - ICEhISEiIiIjIyMgICQlBiYnBgAAAAAAAAAAAAAAAAAJBB0dBRobBgcRCA8ZFAwcAQUAAAAAAAAAAAAA - AAAAABkFGhsGBxEIDwkZExUMHBgMAAAAAAAAAAAAAAAAAAAADxARDwkSExQKFQsMFg4XGAAAAAAAAAAA - AAAAAAAAAAABAgMEBQYHCAkKCwwNDg4AAAAAAAAAAAAAAP/////8AAAP/AAAB/wAAAf8AAAH/AAAB/gA - AAf4AAAH8AAAB/gAAAf4AAAHwAAAB4AAAAcAAAAHgAAAB/AAAAf4AAAH+AAAAfAAAAHwAAAB4AAAA+AA - AAfgAAAD4AAAAeAAAAHgAAAB4AAAO/AAAH/8AAD//AAB//wAA//8AAf/KAAAAEAAAACAAAAAAQAgAAAA - AAAAQAAAIy4AACMuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAOzs7AS0tLQctLS0MLCwsDSwsLA0sLCwNLCwsDSwsLA0sLCwNLCwsDSws - LA0sLCwNLCwsDSwsLA0sLCwNLCwsDSwsLA0sLCwNLCwsDSwsLA0sLCwNLCwsDSwsLA0sLCwNLCwsDSws - LA0sLCwNLCwsDSwsLA0sLCwNLCwsDSwsLA0sLCwNLCwsDSwsLA0sLCwNLCwsDSwsLA0sLCwNLCwsDSws - LA0sLCwNLCwsDSwsLA0sLCwNLy8vCywsLAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAA7AAAAXQAAAGAAAABgAAAAYAAA - AGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAA - AGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAA - AGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYQAAAFIAAAAkJycnAwAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAwMYAwMDbQAA - AKsAAACyAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAA - ALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAA - ALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAAALIAAACYAAAAQC8v - LwUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAGBYWFoCjo6P0rKys9ampqfWrq6v1q6ur9aysrPWsrKz1ra2t9a2trfWurq71rq6u9a+v - r/Wurq71r6+v9a+vr/Wrq6v1q6ur9bCwsPW0tLT1tra29ba2tvW2trb1tbW19bW1tfW1tbX1tbW19bS0 - tPW0tLT1s7Oz9bKysvWysrL1srKy9bGxsfWwsLD1r6+v9bGxsfWysrL1sbGx9bGxsfWxsbH1sLCw9a+v - r/WsrKz1rq6u8JiYmMxEREQSAAAAAP///wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABcaGhqB2tra/+7u7v/t7e3/7+/v/+/v7//w8PD/8PDw//Ly - 8v/y8vL/8vLy//Pz8//z8/P/8/Pz//Hx8f/o6Of/2tjc/9TU1v/c293/5OXn//Dx8P/08/P/8/Pz//Pz - 8//z8/P/8vLy//Ly8v/x8fH/8PDw//Dw8P/v7+//7u7u/+7u7v/t7e3/7Ozs/+vr6//q6ur/6enp/+np - 6f/o6Oj/6Ojo/+fn5//l5eX/4uLi/+Li4v/GxsbvSUlJFgAAAAD///8BAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAXGRkZgdHR0f/l5eX/5OTk/+fn - 5//m5ub/5+fn/+jo6P/p6en/6urq/+rq6v/q6ur/6urq/+rq6v/j4+P/zczM/7e5rP+pqKT/tbit/8rK - xf/a2Nz/6Ojo/+rq6v/q6ur/6+vr/+rq6v/p6en/6Ojo/+jo6P/o6Oj/5+fn/+bm5v/l5eX/5OTk/+Tk - 5P/k5OT/4+Pj/+Hh4f/i4uL/4eHh/+Dg4P/e3t7/3Nzc/9nZ2f7Z2dn/v7+/6klJSRgAAAAA////AQAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFxkZ - GYHU1NT/6urq/+jo6P/r6+v/7e3t/+3t7f/t7e3/7e3t/+7u7v/v7+//7+/v/+/v7//u7u7/4N/g/8HD - vf9racT/UEvd/2pnzf+pqLX/zs/I/+Hh4//s7e3/7+/v/+/v7//v7+//7u7u/+7u7v/t7e3/7e3t/+zs - 7P/r6+v/6+vr/+rq6v/p6en/6Ojo/+fn5//m5ub/5+fn/+Xl5f/k5OT/4+Pj/+Dg4P/c3Nz+3Nzc/8PD - w+tJSUkZAAAAAP///wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAABcZGRmB1tbW/+zs7P/r6+v/7e3t/+7u7v/u7u7/7+/v/+/v7//w8PD/8fHx//Hx - 8f/x8fL/8PDy/+jo3v+UlNP/ODT3/0M9//9IQP//WVTo/6ysvP/Y2dL/5ufp//Dw7//x8fH/8PDw//Dw - 8P/v7+//8PDw/+/v7//v7+//7u7u/+3t7f/s7Oz/7Ozs/+rq6v/p6en/6enp/+jo6P/n5+f/5eXl/+Xl - 5f/i4uL/3t7e/t7e3v/ExMTsSEhIGQAAAAD///8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAXGRkZgdfX1//t7e3/7Ozs/+7u7v/v7+//7+/v//Dw - 8P/x8fH/8fHx//Pz8//z8/P/8/Pz//Hx8//w8OX/i4rk/1NS+/9IR9v/Skri/0hB//9VUef/sbO7/97e - 2v/r6+3/8vHx//Pz8//y8vL/8fHx//Hx8f/x8fH/8PDw/+/v7//u7u7/7u7u/+3t7f/s7Oz/6+vr/+vr - 6//p6en/6Ojo/+fn5//m5ub/4+Pj/9/f3/7f39//x8fH7kpKShwAAAAA////AQAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEBGBoaGoLY2Nj/7e3t/+3t - 7f/w8PD/8fHx//Hx8f/y8vL/8/Pz//Pz8//09PT/9PT0//X19f/y8vT//Pzu/42N7P8oIv//XFzb/46Q - ov9HRez/SED//2Jg2f/HyL//5eTm//Ly8v/09PT/9PT0//Pz8//y8vL/8vLy//Ly8v/x8fH/8PDw/+/v - 7//v7+//7u7u/+3t7f/r6+v/6+vr/+rq6v/p6en/6Ojo/+Xl5f/h4eH+4eHh/8jIyO5KSkocAAAAAP// - /wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzMzMAQAA - ABcWFhZ+3d3d//Hx8f/t7e3/8fHx//Ly8v/z8/P/9PT0//X19f/09PT/9fX1//b29v/39/f/9fT2//z8 - 9P/My/L/My/4/zQu/v9pZ8v/eXqy/1JO9/9HQP7/hYXC/9bVyv/n5un/8PDw//T09P/19fX/8/Pz//T0 - 9P/09PT/8/Pz//Ly8v/x8fH/8PDw/+/v7//u7u7/7e3t/+zs7P/q6uv/6Ojo/+fn5//k5OT/4eHh/uHh - 4f/JycnvSkpKHQAAAAD///8CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAA////AQAAAAATExMaMzMzksnJyf/q6ur/8vLy//Ly8v/09PT/9PT0//X19f/29vb/9vb2//b2 - 9v/39/f/9/f3//b29v/19fj////0/6Sk8/81MfT/NDH8/1ZU3P9PTuH/UU79/0xG7f+hoq7/zMzJ/9zd - 3v/n5+f/7+/v//Ly8//z8/P/9vb2//X19f/z8/P/8vLy//Dx8P/v7u7/6+vr/+fn5//g4OD/2dna/9PT - 1P/V1db/19fX/9ra2v7h4eH/y8vL8UtLSx8AAAAA////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC5ubkJnZ2dlr69vfG6ubn/srKy/+Pj4//29vb/9PT0//X1 - 9f/29vb/9/f3//f39//39/f/+Pj4//j4+P/4+Pj/+Pj4//f2+f////b/v774/09L9P8zLfr/MCz5/05L - 9v9RSv//X1zC/6OjlP+1tLb/wsLG/9LS0//c3d3/5eXl/+vr6//t7e3/7+/v//Dw8P/s7Oz/4uLj/9jX - 2f/My8//w8PF/7q6uP+4uLP/uLiz/769v//KzM3+3t7d/8zLy/FLS0sfAAAAAP///wIAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wIAAAAAw8PDhf///////////////9jY - 2P+vr6//7e3t//j4+P/29vb/9/f3//f39//39/f/+Pj4//n5+f/5+fn/+fn5//j5+f/6+fn/+fj7//// - +f/l5vr/hIT1/0VA9/85Nff/WVT4/0pE9/9nZqD/lpiQ/66uov+3trD/u7u7/8LCxf/IyMr/0tLU/9bW - 1//X1tf/z87Q/7y+wP+ysav/qKmb/56gl/+Skpz/ioqc/4eImf+jpKH/wMC5/tfW2f/MzMzyTExLIAAA - AAD///8CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3NvcGPz8 - /PT////+/vr5/v//////////xcXF/8DAwP/5+fn/+Pj4//j4+P/5+fn/+Pj4//n5+f/5+fn/+/v7//7+ - /v///////P38//r6+v/59/z////5////+//W1/j/dXT0/0ZE9/9aVPz/OjT7/0ZD2/9wbsb/kpS2/62u - rP+0taj/s7On/62upf+qqqb/qamo/6Wmnf+Yloz/c3SV/1pYsv9GQtj/OTTw/zs48f85NvD/Skbd/6+w - wP7Z2tb/zM3N9ExMTCIAAAAA////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAD///8CAAAAAPPz8zP9/Pz///////9uSv//yLr///////r5+P+wsLD/2dnZ//z8/P/4+Pj/+fn5//n5 - +f/9/f3//v7+//f39//p6en/4eHh//Hx8f/9/v3//Pv7//n6+v/6+fv////7////8P+Njuv/Ukz2/1BI - /f8/Of7/QDj//zw39v9QT+X/amfU/3Z5vf94eqH/goGN/4mLif9zcZ7/R0TN/zo09f9IQ///UlH8/2Bd - 8v9VU/D/RUH6/zcz/v+Xl9z+5ufa/8vLzvNNTUwiAAAAAP///wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAA////AgAAAADo5+ct+/r6////////Viz//0og///49v//////4+Pj/6+v - r//w8PD//f39//7+/v/8/Pz/7u7u/9nZ2f/Ozs7/zMvL/8PDw/+wsLD/3d3d//7////7+/v/+/v8//n5 - /P/7/Pf/4ODs/11b8v9TSvv/T0rz/3Bu6/9hWPv/SUH+/z43//8+OP//Qj70/zQw6v8yLeX/Qj34/1JO - /v9YVfv/Pz71/0JC5/9QUeD/RUPo/0dA+/9aVPf/v77h/+np4P/Nzs/1TU1NJAAAAAD///8CAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wIAAAAA6ejoIfz6+fj//////3dV//8Z - AP//knX////////////Gxsb/vr6+//Pz8//i4uL/0dHR/9LS0v/k4uH/+fb2////////////5eXl/7a2 - tv/y8vL//v7+//z8/P/9/f3/+Pr8///+8f+amez/TUr4/1FK+P+jpcn/zc7c/6ys6f+Df+P/ambi/0dB - /f83MP//Qz///0NA+/82Mvj/Pzj4/0M++f9KQ/v/T0f9/19V/v+Oh/j/yMjq/+fp4v/k4+X/z8/P901N - TSUAAAAA////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8BAAAAAPj4 - +Bj++/vu//////+CYv7/JwH//zAD///Owf//////+vn5/7S0tP/Ix8f/3t3d//Lv7/////////////// - ////9fP//vn3///////T09P/29vb///////8/Pz//f39//z7/f/9/fr/3N3r/11c8f9MRf//bGfk/83P - wv/S0Mf/vb2o/2Bdz/81MP7/Tk32/4iG8v+rqvT/oJ34/6Gg+P+kovf/qqj1/7a19v/MzfD/7e7s/+/w - 6v/j4+T/5OTk/87OzvZNTU0mAAAAAP///wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/v7+Af// - /wH///8C////A////wH///8J//794v//////kHP+/yYA//8vAf//UCb///b0///////59vX//Pr5//// - ///////////////Owf//gmX//0Ma///c0///////6Obm/+rq6v///////f39//39/f/9/f3/+/v+//39 - 8f+Uk+n/Tkn3/0tF+P+RkbD/qaud/11Y0v88OP//Wlb4/5ub8//3+fL////2////9f////X//P3z//v8 - 8P/6+/D/9ffv/+3t7v/p6Or/5OXk/+Pj4//Ozs75TU1NKAAAAAD///8CAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAA////AgAAAAAAAAAAAAAAAAAAAAAAAAAAs7OzEfr29dz//////56F/v8kAP//Ogj//yUA//+M - bv//////////////////6eT//6WR//9bNv//MQD//xkA//+dhP///////////+zs7P/5+fn//v7+//z8 - /P/9/f3//Pz8//z8/f/9/vr/1dPo/1pZ8f9MQv//YGC+/1tYw/88Nv//XVn2/7W07v////f/+fj3//T0 - 9//19Pb/9PP1//Lx8//x8PP/8O/x/+/u8P/t7e3/6urp/+Tk5P/j4+P/zs7O+k1NTSkAAAAA////AgAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADGxsYEq6urHKGhoT6ZmZlsn5+fl6ysrMHy7+35//39//+p - lP//JwD//zYE//80A///LQD//8O0///Lv///d1n//z0Q//8mAP//LgD//yYA//+Xff////////////f2 - 9v/29vb///////39/f/9/f3//f39//z8/P/8/f3/+/v9//j47f+Cguv/TUj6/zw3+P82MPv/U0/5/6Cd - 7/////T/9/f5//j4+P/49/f/9vb3//X19f/09PT/8/Pz//Hx8v/w8PD/7e3t/+rq6v/l5eX/4uLi/87O - zvpNTU0pAAAAAP///wIAAAAAAAAAAAAAAAAAAAAA////AQAAAACdnZ1Op6enrLu6utrQz87y5uPj//bz - 8v//////////////////xrf//ykA//81Av//NAH//zEA//83BP//LwD//yYA//8xAP//Ogj//yYA//+G - aP////////7+//j39//19fX//v7+//39/f/+/v7///////7+/v/9/f3//fz9//z8/P/+/vf/vLzj/05K - 8v9KQ/3/Qj76/31+6v/y8+3/+fj4//n5+f/5+Pj/9/f3//b29v/19fX/9PPz//Ly8v/x8fH/7+/v/+zs - 7P/p6en/5OTk/+Li4v/Pz8/8Tk5OKwAAAAD///8CAAAAAAAAAAAAAAAAAAAAAAAAAACxsbFy7e3t+f/+ - /f/////////////////////9/////v/v6///0sf//4tu//8uAP//NAL//zMA//80AP//MgD//zQB//82 - A///NwT//yQA//94Vv/////////+//n4+P/09PT//v7+//39/f/8/Pz//f39//39/f/9/f3//Pz8//z8 - /P/9/f3/+fn5/97f3f9hYuf/TEb8/0NA9v/Bw9b/9/by//j4+v/5+fj/+Pj4//f39//29vb/9fX1//Pz - 8//y8vL/8fHx/+/v7//s7Oz/6enp/+Pj4//h4eH/zs7O/E5OTiwAAAAA////AgAAAAAAAAAAAAAAAAAA - AADj4+Mi+fn59v/////////8//79/v7h2f7+uKf//45y//9kPf//RBb//y4A//8qAP//NAD//zMA//8z - AP//MwD//zQB//8zAP//NQL//ygA//9pRP//+/r///////38/P/z8/P//f39//39/f/9/f3//f39//z8 - /P/8/Pz//Pz8//39/f/9/P3//f38//f2+f/j5Nf/fHvR/0pE+/9OSPX/v8LS//bz8v/4+fn/+Pj5//f3 - 9//39/f/9vb2//T09P/y8vL/8fHx//Dw8P/u7u7/6+vr/+jo6P/i4uL/4eHh/8/Pz/1OTk4sAAAAAP// - /wIAAAAAAAAAAAAAAAAAAAAA////XP//////+vn8/35d//88Ef//KwD//yMA//8lAP//LAD//zIA//82 - A///NgP//zMA//8zAP//MwD//zMA//8zAP//NQL//y0A//9VLP//+/r///////j39//Cw8P/8PDw//// - ///7+/v//Pz8//z8/P/8/Pz//f39//z8/P/8/Pz//fz9//z9/P/z8/b/39/Q/1pZ2P8+Ovv/R0L7/5WS - 3//y9Of/9vX4//j4+P/4+Pj/9vb2//X19f/09PT/8vLy//Dw8P/v7+//7e3t/+vr6//n5+f/4uLi/+Dg - 4P/Pz8//T09PLgAAAAD///8CAAAAAAAAAAAAAAAAAAAAAP///0T///////39+/++rvz/jHH+/2lE//9K - H///NAH//ykA//8nAP//KwD//zEA//8zAP//MwD//zMA//8zAP//MwD//zQB//8xAf//PhT//8y+//// - ///9+/v/xcXF/7e3t//39/f//f39//v7+//8/Pz/+/v7//z8/P/8/Pz/+/v7//z8/P/6+/z/7+/v/9DQ - y/9BPur/PDb9/0lE+v9xben/6uvf//b1+P/39/f/9/f3//X19f/09PT/8/Pz//Ly8v/w8PD/7u7u/+3t - 7f/r6+v/5+fn/+Li4v/g4OD/z8/P/k9PTy8AAAAA////AgAAAAAAAAAAAAAAAAAAAAD///8G////v/// - ////////////////////9PL9/9fN+/+smP3/gmX//1oy//89Df//MgD//zMA//8zAP//MwD//zUC//81 - Av//NQH//y0A//84Df//1cr////////////AwMD/vLy8//n5+f/9/f3/+/v7//v7+//8/Pz/+/v7//r6 - +v/7+/v/+Pn6/+/u6v+6vcv/PTnz/0RA+P9MR/v/WVTw/9jb3f/39vX/9vb3//X19f/09PT/8/Pz//Pz - 8//w8PD/7+/v/+3t7f/s7Oz/6urq/+fn5//h4eH/4ODg/87Ozv9PT08wAAAAAP///wIAAAAAAAAAAAAA - AAAAAAAAAAAAAP///wr///9q//39sv/8+93//v7/////////////////////////////t6X//ysA//81 - Av//MwD//zUB//8sAP//KwD//zUC//85Bv//LgD//0EX///g1/////////39/7u7u//AwMD/+fn5//v7 - +//6+vr/+/v7//r6+v/6+vr/+vr6//j4+v/w8Of/q6rR/z45+f88PPf/SUf3/0tF+v/HyN7/9vbx//X1 - 9v/29vb/8fHx/+/v7//z8/P/8PDw/+7u7v/s7Oz/6+vr/+np6f/m5ub/4ODg/9/f3//Ozs7/UFBQMgAA - AAD///8CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8H////K////lz//v2Q//z7xf/6 - +ff//////7mo//8pAP//NQP//zUB//8rAP//XjX//1ow//8pAP//JgD//zQA//8uAP//TCP//+nj//// - ///8+/v/tbW1/8nJyf/7+/v/+vr6//r6+v/6+vr/+fn5//n5+v/49/n/8fHm/6Sj0/86Nv3/QUHs/0lF - 9P9CPfr/urnd//f38P/y8vP/2dnZ/8fHx/+2trb/w8PD/+vr6//t7e3/6+vr/+np6f/n5+f/5eXl/9/f - 3//e3t7/zc3N/1BQUDIAAAAA////AgAAAAAAAAAAAAAAAAAAAAAAAAAA////Af///wT///8BAAAAAAAA - AAAAAAAAAAAAAAAAAADz8O/S//////+mj/3/JgD//zgF//8vAf//Qhb///Ds///8+///wbL//3hY//88 - D///KQD//yAA//9VLv//8+////////f29v+ysrL/5eXl//z8/P/4+Pj/+Pj4//j4+P/4+Pj/9/b4//Lz - 5/+npdj/NzL+/0pJ3f9NSuv/Ozb8/7S04//49+7/5ubo/+3t7f/28/b/7uzu/7+/v/+7u7v/6+vr/+rq - 6v/o6Oj/5ubm/+Pj4//e3t7/3Nzc/8zMzP9QUFAzAAAAAP7+/gMAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAP///wH///8C////Bf///wT29vYH/Pj33f//////mX/+/yQA//85B///KAD//72s//// - ////////////////////6eT//6SP//9eN///IQD//1Qq///w7f//////2NfX/9jY2P/8/Pz/9/f3//f3 - 9//39/f/+Pj3//b3+f/09ej/qqra/zMv//9QT9f/TErm/zcz/v+6uuf/+Pjt//n5+/////////////// - ///+/v7/tLS0/8nJyf/s7Oz/5ubm/+Xl5f/h4eH/3Nzc/9ra2v/Jycn/UFBQNgAAAAAAAAAAAAAAAP// - /wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wEAAAAA6enpEvv49+j//////4tt//8o - AP//KQD//3xa/////////v3/9PLy//36+v///v3//////////////////9DE//+BZP//4dn//////+Xj - 4//k5OT/+vr6//b29v/29vb/9vb2//b29v/29fb/9/bu/7i45P88Nfz/SEbq/0hG7v8+OPr/zc3p//X3 - 7/////////////+J///+4v7//////+3r7f+qqqr/2tra/+fn5//k5OT/4ODg/9ra2v/W1tb/ycnJ/05O - Ti4AAAAAxMTEDgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8CAAAAAOPj - 4xz6+Pfz//////9+Xf//IgH//0cb///v6///////9PLy/+bm5v/29vb/9/f3//v6+v///Pv///////// - ///////////////////u7u7/8/Pz//b29v/29vb/9fX1//T09P/19fb/8/P0//T28f/a2u3/NTH4/zg1 - +v9HQ/b/aGjx/+/w6//x8PD/////////////Hf///03/////////////0M/Q/7Kysv/k5OT/4+Pj/+Dg - 4P/b29v/0dHR/729vf+NjY2FoaGhn6GhocaRkZGWq6urJQAAAAD///8BAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAA/v7+AgAAAADb2tom+vj4/f//////cU7//x8A///Bsf///////fv6/+Tl5f/09PT/9PT0//Pz - 8//z8/P/9PT0//j39//8+vr///z7//7+/v/4+Pj/8/Pz//X19f/19fX/9fX1//T09P/z8/P/8/Pz//P0 - 8//w8PH/+Pfx/5OS9f9WU/f/g4L1/9rZ7v/w8ev/7+/w///9/////////03///8A////rP////////79 - /v+1trX/w8PD/+Xl5f/V1dX/wsLC/7y8vP/Lysv/6ebp//r3+v/4+Pj/0dHR/5WVlazAwMAJAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wP///8B//7+M/z7+////////0oc//91Uf////////79/+np - 6P/t7e3/9PT0//Ly8v/y8vL/8vLy//Ly8v/x8fH/8vLy//Pz8//z8/P/8vLy//Pz8//y8vL/8/Pz//Pz - 8//y8vL/8fHx//Hx8f/y8vL/8vLy/+/v8P/4+e7/7u/v//T17v/x8uz/6+vt/+7t7f/+/P7///////9d - ////Af///xn////p////////7ezt/6ioqP+/v7//ycnJ/93b3f/28/b////////////////9/////f// - //7CwsLyl5eXQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADc3NwBAAAAAJqamjL//////f39/v6j - jf/+6+b///7+//Tz8//m5ub/9fX1//Pz8//z8/P/8/Pz//Pz8//y8vL/8vLy//Ly8v/y8vL/8vLy//Pz - 8//z8/P/8vLy//Pz8//z8/P/8vLy//Hx8f/x8fH/8fHx//Dw8P/v8O//7u3v/+/u7v/r6+z/6+rs/+rq - 6v/p6ur//fn+////////bf///wD///8A////VP/////////////k4+T/6ufq///+///////////////4 - ///+tv7//1z///7V/v/+/v7+4N7g86CgoDkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgYGCQAA - ABoGBgYv6enq3v/////////////////////Y2Nn/3d3e/9/f4P/e3t//3t7f/97e3//e3t//3t7f/9/e - 3//f3+D/39/g/9/f3//f3+D/397f/97e3//e3t//3t7f/93d3v/d3d7/3d3e/9zc3f/c3N3/4ODg/+bm - 5//r6+z/7e3t/+3t7f/s7Oz/6urq//z4/P///////3////8A////B////wD///+m//////////////// - /////////tn+//+C////LP///wD///85///+7/79/////8/Pz8Ourq4IAAAAAAAAAAAAAAAAAAAAAAAA - AABLS0sBAAAAFAICA0UFBQZ1AAAAgTAxLJ2/wLvl6OXh9urp5f+3t7P/nZ2Z/6Kinv+hoZ3/oaKd/6Gi - nf+goZz/oKCc/6CgnP+goZz/oaGc/6ChnP+goZz/oaGd/6Ghnf+goZz/oKGc/5+gm/+fn5v/n5+b/5+f - m/+fn5v/oKCc/6Skov+0tLT/0dHR/93d3f/W1tb/y8vL/8HBwf/07/T///////+Q////AP///wX///8C - ////E////+f///72/v//qf///0////8J////AP///wD///88////9//+//////b29vS3t7c6AAAAAP// - /wIAAAAAAAAAAAAAAAAAAAAAAAAADAYGB0oAAACTBAUAthERG8wPDSDPEA8hzCsrPttXWGz9W1pu/1xc - b/9dXXD/XV1w/11dcP9dXXD/XF1w/1xdcP9bXG//XFxv/1tcb/9cXG//XFxv/1xcb/9cXG//XFxv/1xc - b/9cXG//XFxv/1tbb/9bW2//XF1v/1pbbv9mZ3H/iomJ/6qrqv/CwcL/zs3O/9rX2v/s6Oz//ff9//// - ////qf///wD///8D////Af///wD///8v////KP///wD///8A////Af///wD///8t////6////////vv6 - +/q9vb1RAAAAAP///wIAAAAAAAAAAAAAAAAAAAAAAAAAAAICAiQDAwF7DAsTwSMgdvE2NKf/REGz/0RB - s/89Oar/PTmq/z07qv88Oqv/PDur/zw6q/88Oqv/PDqr/z06qv89Oqr/PDqq/zw6qv88Oqr/PDqq/zw6 - qv88Oqv/PDqq/zw6qv88Oqr/PDqr/zw6q/88Oqv/Pjur/zg1qv9TUKr/t7bL/+fl5//18fb///7///// - /////////////////////v///6D///8A////Av///wD///8B////AP///wD///8C////Bv///wD///8f - ////4f////////37/f+6urphAAAAAP///wMAAAAAAAAAAAAAAAAAAAAAAAAAAHt7fAEAAAA0CgoKliQh - hfU9OsP/V1fB/1pZwP9cWcL/XlvD/15dxv9eXcf/XVzD/11aw/9cW8L/XFvD/11bwv9eXMX/X13H/2Bc - x/9gXMb/X13H/15cxP9eWsL/XlrD/15cxP9fXMf/XVzE/1xcwv9dW8P/XlvD/1xaw/9hXsP/5OTz//// - ////////////////////6f///sL+//+O////Wv///yn///8I////AP///wD///8A////AP///wL///8C - ////Av///wD///8U////1P///////v////vGxsZxAAAAAP///wMAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAB+foADAAAANCAgQLQkILj/MC6z/i0qs/8sKbP/LSqy/y0qs/8nIqD/JSCd/yopsP8sKrP/LCqz/ywq - s/8sK7T/KCao/yMgl/8jH5n/IiCY/yIfnf8nI6z/LSu2/y4qtf8pJaf/Ix+a/ysoq/8sKrX/LSm1/zAt - tP8hHrD/cG7L///////8+P7//p/+//9l////OP///xX///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////Af///wH///8Y////yf///////vz7/P+/v7/BAAAAAP///wL9/f0CAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAfn6ABAAAADQnJlfAFRK9/w8Lr/0QDrL/EA6y/xEPs/8NCqr/Pj54/0xN - bP8UEKD/EAy0/xAOsP8RDrH/DAmx/yooiP9TVGj/UU9m/09PZf9JSGX/Kipr/w0Llf8NCbP/LSuE/1NU - aP8ZGJL/Dwq0/xEOr/8TEbL/AgCt/2Vjzv//////+/b///9m////Gf///wD///8A////AP///wD///8A - ////Av///wP///8A////AP///wD///8A////AP///wL///8A////Kf////P////////6+fr/sLCw8ZSU - lHMAAAAA////AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH5+gAQAAAA1JCJawBYTx/8QDrb9EA+7/xAP - uv8QELv/DQq3/21slP+Gh4n/Gxm3/xEQw/8VE7//FxK6/woHu/9DQqD/k5OH/4uKmf+SlaD/k5SY/4+P - g/9DQ3r/AgCt/0xLnf+UlIL/KCan/w8MwP8TErz/EhK7/wwMuv8iIb//7u77/////////////v////3f - /v//tP///33///9H////Hv///wD///8A////AP///wD///8A////AP///wH///8A////Av///wD///85 - ////9P////////f29/+srKz2mJiYZgAAAAD///8BAAAAAAAAAAAAAAAAAAAAAAAAAAB+foEEAAAANSQj - X8IdGtP/HBvD/Rwbxf8cG8X/HhzH/xcVxP93dqT/jY+a/xUUof8MDKT/Dw2t/xsaxf8XFMr/TUuw/6Gh - l/9TUr7/RUHX/1NR1f+Hhqz/lJWT/xgWqv9SUK3/oqCV/ygnr/8QDb7/FBS9/xkYxf8gHsf/ExPE/09O - 0//DwvH/8e78//////////////////////////////L////Q////dv///wD///8C////AP///wD///8A - ////AP///wP///8F////AP///0n////7///////+8/Lz/6enp/CWlpZbAAAAAP///wEAAAAAAAAAAAAA - AAAAAAAAfn6BBAAAADYkI2DDJCLd/yko0f0oJ9L/KCfS/yop1P8jIc//iIe2/7Szr/94eJL/dXSM/2Rk - iv8wMI//GhjG/11cwf+8va//SUnB/x8d0P8eHtX/YmHF/76+rv87Orj/Xly7/728r/9WVpL/PT2D/0ZF - hf8xL6T/JSTS/ysq0/8fHtD/IiHQ/0A/1/9XVd//p6Te//Xz7//59fv///3//////////////7b///8A - ////Av///wH///8A////CP///wD///8A////AP///wf///8A////Wf///v/+//////7t7e3/o6Oj65mZ - mU0AAAAA////AgAAAAAAAAAAAAAAAH5+gQQAAAA3IyNmxC4r6v86ONz9Nzbd/zg23f85N9//MTDZ/5qZ - yv/Q0Mz/xsbX/87N2P/b3NT/tLO4/y4tsf9pZ8//1NbI/19dz/80M93/MzLf/2hozf/W2Mr/VFXQ/29t - zP/V1Mr/zs3J/9DPxv/X18b/e3vI/y4t3v86ON7/Ojje/zg33v85Ntz/FhXb/09Ovv/b28r/2Njb/9nZ - 2f/49Pj///3///+U////AP///wT///8D////Af///7v////I////Yf///xX///8A////AP///wD///9t - ///+//7//////uno6f+amprPr6+vHAAAAAAAAAAAAAAAAAAAAAB+foEEAAAANyIiasU4NvT/TErl/UhH - 6P9JR+j/S0np/0A/4/+wsdv/09Xh/2Jh6/9iYu//jYze/+7w4f9radP/cXDZ/+zu4P9ra93/QULr/zQy - 1P+CgMb/7u7k/1pa4/+BgNz/6erg/5CN6f+JiPT/j47w/2pq8P9JSOr/Skjp/0lI6f9JR+n/UU/o/zEy - 6v9cXMj/29vM/9TU1//MzMz/9/L3////////hf///wD///8I////AP///3T////////////////////r - //3/nv/+/0H///8F////AP///3P///78/v/////+ycnJ95WVlUwAAAAAAAAAAAAAAAAAAAAAf3+CAwAA - AC4kInC/QkL9/11c7f5ZWPH/Wlnw/1xb8v9QT+v/vr/q/+Lj6v9PTab/OTiU/5WUxP/9/vb/gH7u/4GC - 5v/8/PP/eHa+/z4+nP9VVZn/19ne/+Pk9v9cWu7/k5Pm//r88v9kYrT/PTyg/0ZEov9HR63/VVPi/1pb - 8v9aWfD/WVjw/2Fg8P88PPT/XFvN/9vczP/S0tX/zMzM//j0+P///////3P///8A////Af///yv////3 - /////v//+vb6///8//7///////////////3/zv/8/3X///8d///+0/7//v7+/d7c3vKenp42AAAAAAAA - AAAAAAAAAAAAAHx8fwIAAAIUJid4sFBP//5wcPP9amv3/2xs9v9tbvf/Zmb0/83N9f////n/6ejn/+zs - 5/////j/5Ob5/3p49/+dnfL////7/+3v7f/m5+H/+/vy//v9/v+qrPb/ZmP2/6qq8/////z/7e7o/+fo - 4f/t7uP/1Nbf/21t5f9qbPn/bW32/2tr9/9zcvf/TEv3/19f2f/f387/zs7S/8zMzP/79/v///////9i - ////Af///wP////F////////+vj6/83Nzf3Kysr/7u3ut//8/9n//v//////////////+f/9//n/+/// - ///GxsanwMDABv///wEAAAAAAAAAAAAAAADMzM4CAAAAACcna3lLS///jI33/H5++/9/fvv/fn76/4B/ - /P+0tP7/z8/9/9DQ///R0P//w8P8/5uc+/99ffz/oJ7+/83N/P/Q0f//0tH//8nJ//+op/z/g4P8/3x7 - /P+jpP3/zs78/8/Q///S0f//09L//8bF//+IiP7/fX36/39/+/99ffr/kZH6/0hI/P9xcN//4+PS/8zM - z//Ozs7//vv+////////Vf///wD///96//////////7//9ra2vzBwcH/zc3NmAAAAAD///8L////Uv/9 - /63//P/z///////////s7OzHysvKFwAAAAD///8BAAAAAAAAAAAAAAAA////AV5fXAEBAQUZMTDr42pq - /v+fn/79nqD9/p2d/P6fn/3/oaH//6Cg/v+eoP3/n6D9/5+f/v+fn///oaH+/6Kg/v+hoP7/oKH+/5+f - /f+dn/7/nZ7//6Gg//+hov7/oaD+/6Gg/v+foP7/n6D9/5+f/v+fn/z/oKH+/6Kh/v+gof7/oaH//3p5 - //8qKvj/uLna/9va1P/Ly83/0NDQ///+/////////yv///8j////+f///////+zr7PzCwsL/0dHRowAA - AAD///8DAAAAAAAAAAAAAAAA////Hv/+/1f///9N9PT0BgAAAAD///8BAAAAAAAAAAAAAAAAAAAAAAAA - AAD//v8CAAAAAFpagTZWUv/UQkL7/1NS//9gX///WFf//1BP//9PT///T0///09P//9QT///UE///09P - //9PT///T0///1BP//9QT///UE///1BQ//9QT///UE///09P//9PT///UE///1BP//9QT///UE///09P - //9QT///UFD//0dG//85OPX/pKTe/93d1P/R0dT/ycnJ/9HQ0f////////////9M////v/////////r5 - +vzHx8f/0dHRrQAAAAD///8C////Af///wH///8D////AgAAAAAAAAAAAAAAAAAAAAD///8BAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wIAAAAA+Pn+CM7O/zasreg/LzBqThoaVZehot38srPv/6us - 6P+sren/q6zo/6ys6f+rrOj/qqvn/6ur5/+rrOj/qqvn/6mq5v+oqeX/qanm/6ip5f+nqOT/p6jk/6en - 4/+mpuL/pabi/6Sl4f+kpOH/o6Tg/6Kj3/+oqN7/0NHY/9/g0//Q0dP/0NDP/8fHx//Dw8P//Pz8//// - /////f////////////zV1dX/zs7Ot/z8/AYAAAAA////AgAAAAAAAAAAAAAAAAAAAAD///8C////A/// - /wMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AgAAAAAAAAAAAAAAAAEB - AQkREQVu4ODT+vb26f/t7d//7u7g/+3t3//t7eD/7e3f/+zs3//s7N//7O3f/+vr3v/r693/6urc/+rq - 3P/p6dz/6Ojb/+fo2v/n59r/5ubZ/+bm2P/l5dj/5eXX/+Tj1v/j4tb/4ODU/9fX1P/Q0NT/0dHQ/8zM - zP/ExMX/sbGx/9HR0f////////////////zj4+P/zMzMvfr6+goAAAAA////AgAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAD9/f4B/v7/BM/P0QMCAgQXEhIUd9LS1Pvn5+n/3d3g/97e4f/e3uD/3t7h/97e4P/d3eD/3d3g/93d - 3//c3N//29ve/9vb3f/b293/2trd/9rZ3P/Z2dv/2Njb/9jY2v/X19n/1tbZ/9bW2P/U1Nf/09TW/9LS - 1f/R0dL/0NDP/8zMzP/Gxsb/vLy8/6urq/+1tbX/3t7e/97d3vzR0dH/zMzMw/n5+Q0AAAAA////AgAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wEAAAAAAAAAFBEREXXT09P66Ojo/97e3v/g4OD/39/f/9/f - 3//f39//39/f/97e3v/d3d3/3d3d/9zc3P/c3Nz/3Nzc/9vb2//a2tr/2dnZ/9nZ2f/Z2dn/19fX/9bW - 1v/W1tb/1NTU/9PT0//R0dH/zs7O/8vLy//Gxsb/vr6+/7S0tP+kpKT/ubm5/83Nzfy/v7//yMjIyPn5 - +RAAAAAA////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8BAAAAAAAAABQRERF109PT++fn - 5//d3d3/39/f/97e3v/e3t7/3d3d/93d3f/c3Nz/29vb/9ra2v/Z2dn/2dnZ/9jY2P/X19f/1tbW/9fX - 1//W1tb/1dXV/9XV1f/U1NT/0tLS/9HR0f/Pz8//zMzM/8nJyf/ExMT/vr6+/7W1tf+rq6v/oKCg/7y8 - vPy+vr7/v7+/zvX19RQAAAAA////AwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AQAA - AAABAQEUEhISdNTU1Prl5eX/3Nzc/97e3v/d3d3/3Nzc/9vb2//a2tr/2dnZ/9jY2P/X19f/1tbW/9XV - 1f/V1dX/1NTU/9PT0//T09P/0tLS/9HR0f/Q0ND/z8/P/83Nzf/MzMz/ycnJ/8XFxf/BwcH/u7u7/7S0 - tP+tra3/oaGh/6Wlpfu1tbX/t7e30/Dw8BcAAAAA////AwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAADBoaGlXb29vw4ODg+9jY2PvZ2dn72NjY+9bW1vvV1dX71NTU+9LS - 0vvR0dH7z8/P+87OzvvOzs77zs7O+83NzfvMzMz7zMzM+8zMzPvLy8v7ycnJ+8jIyPvGxsb7w8PD+8DA - wPu8vLz7t7e3+7Gxsfuqqqr7oKCg/ZmZmf+np6f/tbW11+3t7RoAAAAA////AwAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA29vbAQMDAwEhISEj6+vr/uHh4f/e3t7/39/f/97e - 3v/c3Nz/29vb/9ra2v/X19f/1tbW/9XV1f/S0tL/0tLS/9HR0f/Pz8//zc3N/8zMzP/Kysr/x8fH/8PD - w//BwcH/vb29/7q6uv+2trb/sbGx/6urq/+lpaX/n5+f/52dnf+ysrLxzc3Nn/X19RgAAAAA////AwAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wEAAAAA19fXB/r6 - +mr39/d1+Pj4dfj4+HX39/d19/f3dfb29nX29vZ19vb2dfX19XX19fV19PT0dfT09HXz8/N18/PzdfLy - 8nXx8fF17+/vde7u7nXs7Ox17Ozsderq6nXp6el16Ojodebm5nXk5OR14uLidePj42/u7u5O+vr6HgAA - AAAAAAAA////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////8AAAAAAA///g - AAAAAAB//+AAAAAAAH//4AAAAAAAf//gAAAAAAB//+AAAAAAAH//4AAAAAAAf//gAAAAAAB///AAAAAA - AH//4AAAAAAAf//AAAAAAAB//4AAAAAAAH//gAAAAAAAf/+AAAAAAAB//4AAAAAAAH//gAAAAAAAf/+A - AAAAAAB//4AAAAAAAH//gAAAAAAAf/4AAAAAAAB/4AAAAAAAAH/AAAAAAAAAf4AAAAAAAAB/gAAAAAAA - AH+AAAAAAAAAf4AAAAAAAAB/4AAAAAAAAH/+AAAAAAAAf/+AAAAAAAB//4AAAAAAAH//gAAAAAAAf/+A - AAAAAAAH/4AAAAAAAAP/gAAAAAAAA/+AAAAAAAAD/4AAAAAAAAP/AAAAAAAAB/wAAAAAAAAP/AAAAAAA - AB/4AAAAAAAAP/gAAAAAAAA/+AAAAAAAAD/4AAAAAAAAH/gAAAAAAAAP+AAAAAAAAAf4AAAAAAAAA/gA - AAAAAAAD+AAAAAAAAAP4AAAAAAAAA/wAAAAAAAcH/AAAAAAAD//+AAAAAAAf///gAAAAAD////AAAAAA - f///8AAAAAD////wAAAAAf////AAAAAD////8AAAAAf////wAAAAD/////AAAAAf/////////////ygA - AADAAAAAgAEAAAEAIAAAAAAAAEACACMuAAAjLgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAQAAAAEAAAADAAAABAAAAAUAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAA - AAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAA - AAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAA - AAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAA - AAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAA - AAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAA - AAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAA - AAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAA - AAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAA - AAcAAAAHAAAABwAAAAYAAAAFAAAABAAAAAIAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAA - AAQAAAAIAAAADAAAABAAAAATAAAAFgAAABYAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAA - ABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAA - ABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAA - ABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAA - ABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAA - ABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAA - ABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAA - ABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAA - ABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAWAAAAFQAA - ABMAAAAPAAAACgAAAAcAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAABAAAAAkAAAAQAAAAGAAA - ACAAAAAmAAAAKwAAAC0AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAA - AC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAA - AC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAA - AC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAA - AC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAA - AC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAA - AC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAA - AC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAA - AC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAtAAAAKgAAACUAAAAeAAAAFgAA - AA0AAAAHAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAABwAAAA8AAAAaAAAAKAAAADYAAABAAAAARwAA - AEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAA - AEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAA - AEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAA - AEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAA - AEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAA - AEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAA - AEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAA - AEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAA - AEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABKAAAARgAAAD0AAAAyAAAAJAAAABYAAAANAAAABQAA - AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAADAAAACgAAABYAAAAoAAAAPQAAAFEAAABgAAAAawAAAHEAAABzAAAAcwAA - AHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAA - AHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAA - AHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAA - AHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAA - AHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAA - AHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAA - AHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAA - AHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAA - AHMAAABzAAAAcwAAAHMAAABwAAAAaAAAAFwAAABLAAAANgAAACIAAAATAAAABwAAAAEAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAEAAAADQAAABwAAAAyAAAATQAAAGYAAAB5AAAAiAAAAI8AAACRAAAAkQAAAJEAAACRAAAAkQAA - AJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAA - AJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAA - AJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAA - AJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAA - AJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAA - AJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAA - AJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAA - AJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAA - AJEAAACOAAAAhAAAAHUAAABfAAAARAAAACsAAAAXAAAACgAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAEAAA - ACEAAAA6AAAAWQAAAHYAAACNAAAAnQAAAKYAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAA - AKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAA - AKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAA - AKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAA - AKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAA - AKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAA - AKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAA - AKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAA - AKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACkAAAAmQAA - AIcAAABuAAAATwAAADIAAAAcAAAACwAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAEAAAACQAAAA/AAAAYQAA - AIEAAACaAAAAqwAAALUAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAA - ALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAA - ALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAA - ALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAA - ALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAA - ALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAA - ALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAA - ALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAA - ALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAACzAAAApwAAAJQAAAB5AAAAVwAA - ADcAAAAeAAAADQAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIYAAACgAAAAsgAA - ALwAAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAA - AL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAA - AL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAA - AL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAA - AL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAA - AL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAA - AL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAA - AL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAA - AL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC7AAAArgAAAJoAAAB+AAAAWwAAADkAAAAfAAAADQAA - AAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTdxMTE/8bGxv/AwMD/vr6+/7u7 - u/+3t7f/tra2/7e3t/+4uLj/ubm5/7m5uf+5ubn/ubm5/7q6uv+6urr/u7u7/7u7u/+7u7v/vLy8/7y8 - vP+8vLz/vLy8/729vf+9vb3/vb29/729vf+9vb3/vr6+/76+vv++vr7/vr6+/76+vv+/v7//v7+//7+/ - v/++vr7/v7+//7+/v/+/v7//v7+//7+/v//AwMD/wMDA/8HBwf/AwMD/v7+//7+/v/+/v7//wMDA/8DA - wP/AwMD/x8fH/8rKyv/Pz8//0dHR/9LS0v/S0tL/0tLS/9PT0//S0tL/0tLS/9LS0v/S0tL/0dHR/9HR - 0f/R0dH/0dHR/9HR0f/R0dH/0dHR/9HR0f/R0dH/0dHR/9HR0f/R0dH/0dHR/9HR0f/R0dH/0dHR/9HR - 0f/Q0ND/0NDQ/9DQ0P/Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/87Ozv/Ozs7/zc3N/83N - zf/Nzc3/zc3N/8zMzP/MzMz/y8vL/8vLy//Ly8v/y8vL/8zMzP/Nzc3/z8/P/9DQ0P/V1dX/1dXV/9XV - 1f/V1dX/1dXV/9XV1f/U1NT/1NTU/9TU1P/U1NT/1NTU/9PT0//T09P/09PT/9PT0//T09P/0dHR/9HR - 0f/Q0ND/z8/P/83Nzf/Nzc3/zs7O/8/Pz//IyMj/yMjI/8PDw/+cnJxuAAAADQAAAAMAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTdzMzM/9nZ2f/a2tr/29vb/9vb2//b29v/29vb/9zc - 3P/e3t7/3t7e/97e3v/c3Nz/3d3d/93d3f/e3t7/3t7e/97e3v/f39//39/f/9/f3//f39//4ODg/+Dg - 4P/g4OD/4ODg/+Dg4P/h4eH/4eHh/+Hh4f/h4eH/4uLi/+Li4v/i4uL/4uLi/+Li4v/i4uL/4uLi/+Li - 4v/i4uL/4uLi/+Li4v/i4uL/4uLi/9/f3//e3t7/3d3d/9vb2//a2tr/29vb/9zc3P/c3Nz/4eHh/+Dg - 4P/g4OD/4eHh/+Li4v/j4+P/4+Pj/+Li4v/l5eX/5eXl/+Xl5f/l5eX/5eXl/+Tk5P/k5OT/5OTk/+Tk - 5P/k5OT/5OTk/+Tk5P/j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//i4uL/4uLi/+Li4v/i4uL/4uLi/+Hh - 4f/g4OD/4ODg/+Dg4P/f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/97e3v/e3t7/3d3d/93d - 3f/d3d3/3d3d/93d3f/c3Nz/29vb/9vb2//c3Nz/3d3d/97e3v/a2tr/2tra/9ra2v/a2tr/2tra/9ra - 2v/a2tr/2tra/9nZ2f/Z2dn/2dnZ/9nZ2f/Y2Nj/2NjY/9jY2P/Y2Nj/19fX/9fX1//X19f/1dXV/9PT - 0//S0tL/0NDQ/8/Pz//Pz8//zc3N/8fHx/+ZmZlvAAAADQAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAA - ACUAAABCAAAAZQAAAIaUlJTdzs7O/93d3f/d3d3/3d3d/97e3v/f39//39/f/+Dg4P/h4eH/4eHh/+Hh - 4f/h4eH/4eHh/+Li4v/i4uL/4uLi/+Li4v/j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//k5OT/5OTk/+Tk - 5P/k5OT/5OTk/+Tk5P/k5OT/5OTk/+Xl5f/l5eX/5eXl/+Xl5f/m5ub/5eXl/+Xl5f/k5OT/5OTk/+Pj - 4//j4+P/4+Pj/+Dg4P/e3t7/29vb/9jY2P/V1dX/1dXV/9fX1//Z2dn/39/f/93d3f/c3Nz/3t7e/+Hh - 4f/k5OT/5ubm/+bm5v/n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+bm5v/m5ub/5ubm/+bm - 5v/m5ub/5ubm/+bm5v/m5ub/5OTk/+Tk5P/k5OT/5OTk/+Pj4//j4+P/4+Pj/+Pj4//k5OT/5OTk/+Pj - 4//j4+P/4+Pj/+Pj4//i4uL/4uLi/+Hh4f/h4eH/4eHh/+Hh4f/g4OD/4ODg/+Dg4P/g4OD/4eHh/+Dg - 4P/f39//3t7e/97e3v/d3d3/3Nzc/9zc3P/d3d3/3d3d/93d3f/d3d3/3d3d/93d3f/d3d3/3d3d/93d - 3f/d3d3/3Nzc/9zc3P/c3Nz/3Nzc/9vb2//b29v/2dnZ/9nZ2f/Z2dn/2NjY/9bW1v/W1tb/1NTU/9HR - 0f/S0tL/0NDQ/8rKyv+ZmZlvAAAADQAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAA - AIaUlJTd0NDQ/9/f3//e3t7/3d3d/+Dg4P/h4eH/4eHh/+Hh4f/j4+P/5OTk/+Tk5P/j4+P/4+Pj/+Pj - 4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Tk5P/k5OT/5OTk/+Tk5P/l5eX/5eXl/+Xl5f/l5eX/5ubm/+bm - 5v/m5ub/5ubm/+fn5//n5+f/5+fn/+fn5//o6Oj/5+fn/+fn5//m5ub/5eXl/+Tk5P/j4+P/4uLi/9ra - 2v/Y2Nj/1NTU/8/Pz//MzMz/y8vL/83Nzf/Pz8//1NTU/9TU1P/W1tb/2NjY/9zc3P/h4eH/5OTk/+fn - 5//m5ub/5ubm/+bm5v/m5ub/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn - 5//n5+f/5ubm/+bm5v/m5ub/5ubm/+Xl5f/l5eX/5eXl/+Xl5f/k5OT/5OTk/+Pj4//j4+P/4+Pj/+Li - 4v/i4uL/4uLi/+Li4v/i4uL/4uLi/+Li4v/i4uL/4uLi/+Li4v/h4eH/4ODg/+Dg4P/g4OD/4ODg/+Dg - 4P/g4OD/39/f/97e3v/e3t7/3t7e/97e3v/e3t7/3t7e/97e3v/e3t7/3t7e/93d3f/d3d3/3Nzc/9zc - 3P/c3Nz/3Nzc/9vb2//b29v/29vb/9vb2//a2tr/2NjY/9fX1//W1tb/1NTU/9LS0v/R0dH/0NDQ/8rK - yv+YmJhvAAAADQAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd0tLS/+Hh - 4f/i4uL/4ODg/+Hh4f/h4eH/4+Pj/+Tk5P/k5OT/5eXl/+Xl5f/l5eX/5eXl/+Xl5f/l5eX/5eXl/+bm - 5v/m5ub/5ubm/+fn5//n5+f/5+fn/+fn5//o6Oj/6Ojo/+jo6P/o6Oj/6Ojo/+jo6P/o6Oj/6enp/+np - 6f/p6en/6enp/+np6f/o6Oj/6enp/+fn5//n5+f/5ubm/+Xl5f/j4+P/2tra/9XZzv/Szs3/08zR/83F - z//Fxsr/vsPG/8TGx//Kxcf/z83D/9PPzv/X09j/0tTV/9fb3P/c3eH/6Ozh/+Xn2//o6Oj/5ubm/+rq - 6v/p6en/6enp/+vr6//p6en/6urq/+np6f/p6en/6enp/+np6f/p6en/6enp/+jo6P/o6Oj/6Ojo/+jo - 6P/o6Oj/6Ojo/+jo6P/n5+f/5+fn/+fn5//n5+f/5ubm/+bm5v/m5ub/5ubm/+bm5v/l5eX/5eXl/+Xl - 5f/l5eX/5OTk/+Tk5P/k5OT/5OTk/+Pj4//j4+P/4uLi/+Li4v/i4uL/4eHh/+Hh4f/i4uL/4uLi/+Li - 4v/h4eH/4eHh/+Hh4f/h4eH/4ODg/+Dg4P/g4OD/4ODg/9/f3//f39//39/f/9/f3//e3t7/3t7e/93d - 3f/d3d3/3Nzc/9vb2//a2tr/2dnZ/9nZ2f/X19f/1dXV/9TU1P/S0tL/0dHR/83Nzf+YmJhvAAAADgAA - AAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd0tLS/+Hh4f/i4uL/4eHh/+Li - 4v/j4+P/5OTk/+Xl5f/l5eX/5ubm/+bm5v/m5ub/5ubm/+bm5v/m5ub/5+fn/+fn5//n5+f/5+fn/+jo - 6P/o6Oj/6Ojo/+jo6P/p6en/6enp/+np6f/p6en/6urq/+rq6v/q6ur/6urq/+rq6v/q6ur/6urq/+rq - 6v/q6ur/6+vr/+rq6v/p6en/6Ojo/+bm5v/j4+P/2dnZ/83P0P/O0ND/xMbG/8XGxP+6uLf/v7y4/728 - uP+9u7r/vby+/8XGwv/My83/1dXb/8/U0v/e4+H/2NXe/+fe6P/p6en/6enp/+zs7P/q6ur/6enp/+rq - 6v/o6Oj/6enp/+rq6v/q6ur/6urq/+rq6v/q6ur/6urq/+np6f/p6en/6Ojo/+jo6P/o6Oj/6Ojo/+jo - 6P/o6Oj/6Ojo/+jo6P/o6Oj/5+fn/+fn5//n5+f/5+fn/+fn5//m5ub/5ubm/+Xl5f/l5eX/5eXl/+Xl - 5f/k5OT/5OTk/+Tk5P/k5OT/4+Pj/+Pj4//j4+P/4+Pj/+Li4v/i4uL/4+Pj/+Pj4//h4eH/4eHh/+Hh - 4f/h4eH/4eHh/+Hh4f/g4OD/4ODg/+Dg4P/g4OD/4ODg/9/f3//f39//3t7e/97e3v/d3d3/3d3d/9zc - 3P/b29v/2tra/9nZ2f/Y2Nj/1tbW/9TU1P/T09P/0tLS/87Ozv+amppxAAAADgAAAAMAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd09PT/+Hh4f/j4+P/4uLi/+Pj4//k5OT/5eXl/+bm - 5v/n5+f/5+fn/+fn5//o6Oj/6Ojo/+jo6P/o6Oj/6Ojo/+jo6P/o6Oj/6Ojo/+np6f/p6en/6urq/+rq - 6v/q6ur/6urq/+rq6v/r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/7e3t/+vr - 6//q6ur/5+fn/+Tk5P/f39//1NTU/9PL0v/IycX/uL65/7S3rv+2rLj/tq+0/7e1u/+vtrH/tLm6/7m8 - xP/Excn/yMTD/9jR1v/V1Mr/2NTf/9/h6f/n5+f/6urq/+3t7f/r6+v/6+vr/+zs7P/q6ur/6+vr/+vr - 6//r6+v/6+vr/+zs7P/r6+v/6+vr/+vr6//q6ur/6enp/+np6f/p6en/6enp/+np6f/p6en/6enp/+np - 6f/p6en/6Ojo/+jo6P/o6Oj/6Ojo/+jo6P/n5+f/5+fn/+bm5v/m5ub/5ubm/+bm5v/l5eX/5eXl/+Xl - 5f/l5eX/5eXl/+Xl5f/k5OT/5OTk/+Tk5P/k5OT/5OTk/+Tk5P/i4uL/4uLi/+Li4v/i4uL/4uLi/+Li - 4v/i4uL/4uLi/+Dg4P/h4eH/4ODg/+Dg4P/g4OD/39/f/9/f3//e3t7/3t7e/93d3f/c3Nz/29vb/9ra - 2v/Z2dn/1tbW/9XV1f/T09P/0tLS/87Ozv+enp58AAAADgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAA - ACUAAABCAAAAZQAAAIaUlJTd09PT/+Li4v/k5OT/4+Pj/+Tk5P/l5eX/5ubm/+fn5//n5+f/6Ojo/+np - 6f/p6en/6enp/+np6f/p6en/6enp/+rq6v/q6ur/6urq/+rq6v/q6ur/6+vr/+vr6//r6+v/6+vr/+zs - 7P/s7Oz/6+vr/+vr6//r6+v/7Ozs/+zs7P/s7Oz/7Ozs/+zs7P/t7e3/7u7u/+vr6//p6en/5eXl/+Dg - 4P/Z2dn/zs7O/8fBzP+8u7//s7qr/6OkqP+pqqH/qaSm/6Wpnv+boJ7/trOu/6utrv+0vrL/wcS7/8zJ - u//by9z/2dfW/9Xd3P/g4OD/5ubm/+rq6v/q6ur/6+vr/+3t7f/t7e3/7e3t/+zs7P/s7Oz/7e3t/+3t - 7f/s7Oz/7Ozs/+zs7P/s7Oz/6urq/+rq6v/q6ur/6urq/+rq6v/q6ur/6urq/+rq6v/q6ur/6enp/+np - 6f/p6en/6enp/+np6f/o6Oj/6Ojo/+jo6P/n5+f/5+fn/+fn5//n5+f/5ubm/+bm5v/m5ub/5ubm/+bm - 5v/m5ub/5eXl/+Xl5f/l5eX/5eXl/+Xl5f/j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Li - 4v/i4uL/4uLi/+Hh4f/h4eH/4ODg/+Dg4P/f39//3t7e/93d3f/c3Nz/29vb/9vb2//Z2dn/19fX/9XV - 1f/U1NT/09PT/87Ozv+enp58AAAADgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAA - AIaUlJTd09PT/+Pj4//k5OT/5OTk/+Xl5f/m5ub/5+fn/+fn5//o6Oj/6enp/+np6f/q6ur/6urq/+rq - 6v/q6ur/6urq/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+zs7P/s7Oz/7Ozs/+zs7P/s7Oz/7Ozs/+zs - 7P/s7Oz/7Ozs/+zs7P/t7e3/7e3t/+3t7f/u7u7/7u7u/+vr6//p6en/4+Pj/93d3f/W1tb/ysrK/7vA - vv+rsK7/pqip/6OpqP+TmKf/j5Kn/4yKoP+hoKr/qKOk/6+usv+qrbL/srqv/77Ev//Gyr//1tXL/9zZ - 1f/a2tr/4+Pj/+jo6P/o6Oj/6urq/+zs7P/t7e3/7e3t/+3t7f/t7e3/7e3t/+3t7f/t7e3/7e3t/+3t - 7f/s7Oz/7Ozs/+zs7P/s7Oz/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6urq/+rq6v/q6ur/6urq/+rq - 6v/p6en/6enp/+np6f/p6en/6enp/+jo6P/o6Oj/6Ojo/+jo6P/n5+f/5+fn/+fn5//n5+f/5ubm/+bm - 5v/m5ub/5ubm/+bm5v/k5OT/5OTk/+Tk5P/k5OT/5OTk/+Tk5P/k5OT/5OTk/+Pj4//j4+P/4+Pj/+Li - 4v/i4uL/4eHh/+Hh4f/g4OD/39/f/97e3v/d3d3/3Nzc/9vb2//Z2dn/19fX/9XV1f/V1dX/1NTU/8/P - z/+fn598AAAADgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd1NTU/+Pj - 4//l5eX/5OTk/+bm5v/n5+f/6Ojo/+jo6P/p6en/6enp/+rq6v/r6+v/6+vr/+vr6//r6+v/6+vr/+vr - 6//s7Oz/7Ozs/+zs7P/s7Oz/7Ozs/+zs7P/s7Oz/7e3t/+3t7f/t7e3/7u7u/+7u7v/u7u7/7u7u/+7u - 7v/u7u7/7u7u/+7u7v/t7e3/7e3t/+rq6v/n5+f/4uLi/9vb2//T09P/x8fH/8C+tP+0r7D/oZ+y/32I - o/9aXr3/TEjQ/0g80P9aVL//Zm+4/42Zo/+pnrj/vbS+/7m1wP+4usX/u7zG/9PVyf/Y2Nj/4+Pj/+fn - 5//o6Oj/6+vr/+3t7f/u7u7/7e3t/+7u7v/u7u7/7u7u/+7u7v/u7u7/7u7u/+3t7f/t7e3/7e3t/+3t - 7f/t7e3/7e3t/+zs7P/s7Oz/7Ozs/+zs7P/s7Oz/6+vr/+vr6//r6+v/6+vr/+vr6//q6ur/6urq/+rq - 6v/q6ur/6urq/+rq6v/p6en/6enp/+np6f/p6en/6Ojo/+jo6P/n5+f/5+fn/+fn5//m5ub/5ubm/+bm - 5v/l5eX/5eXl/+Xl5f/l5eX/5eXl/+Xl5f/l5eX/5eXl/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4uLi/+Hh - 4f/h4eH/4ODg/97e3v/d3d3/3Nzc/9vb2//a2tr/19fX/9XV1f/W1tb/1dXV/8/Pz/+fn598AAAADgAA - AAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd1NTU/+Tk5P/m5ub/5eXl/+bm - 5v/o6Oj/6enp/+np6f/p6en/6urq/+vr6//s7Oz/7Ozs/+zs7P/s7Oz/7Ozs/+zs7P/t7e3/7e3t/+zs - 7P/t7e3/7e3t/+3t7f/t7e3/7u7u/+7u7v/u7u7/7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v - 7//t7e3/7u7u/+vr6//o6Oj/4uLi/9ra2v/R0dH/xMTE/7+7uv+oq7P/dXq5/zcg7v8uGv//OC///0dM - 7/9BOfj/MSv8/zIZ5f+Diaz/o6So/7a1sf+7vb7/vsHF/8bNxv/T09P/4ODg/+Tk5P/m5ub/6+vr/+3t - 7f/v7+//7u7u/+7u7v/v7+//7+/v/+/v7//v7+//7u7u/+7u7v/u7u7/7u7u/+7u7v/u7u7/7e3t/+3t - 7f/t7e3/7e3t/+3t7f/t7e3/7Ozs/+zs7P/s7Oz/7Ozs/+zs7P/r6+v/6+vr/+vr6//r6+v/6+vr/+vr - 6//q6ur/6urq/+rq6v/q6ur/6enp/+np6f/o6Oj/6Ojo/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+bm - 5v/m5ub/5ubm/+bm5v/m5ub/5ubm/+Tk5P/k5OT/5OTk/+Pj4//j4+P/4uLi/+Li4v/i4uL/4ODg/9/f - 3//e3t7/3d3d/9zc3P/a2tr/2NjY/9bW1v/X19f/1dXV/9DQ0P+enp59AAAADgAAAAQAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd1NTU/+Tk5P/m5ub/5ubm/+fn5//p6en/6enp/+np - 6f/q6ur/6+vr/+zs7P/t7e3/7e3t/+3t7f/t7e3/7e3t/+3t7f/t7e3/7e3t/+3t7f/t7e3/7e3t/+7u - 7v/u7u7/7u7u/+7u7v/u7u7/7+/v/+/v7//v7+//7+/v/+/v7//w8PD/8PDw//Dw8P/w8PD/8fHx/+/v - 7//r6+v/5OTk/9vb2//R0dH/w8PD/6G1uv9oadn/Jhbw/yQg+/85OP//Skj//1lO//9fWP//WFj//z86 - +/8tHPX/ZmvI/5qjrf+2rLj/xbrE/8nIxP/Kysr/2dnZ/97e3v/h4eH/6Ojo/+vr6//u7u7/7Ozs/+/v - 7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//u7u7/7u7u/+7u7v/u7u7/7u7u/+7u7v/u7u7/7u7u/+7u - 7v/u7u7/7e3t/+3t7f/t7e3/7e3t/+3t7f/s7Oz/7Ozs/+zs7P/s7Oz/6+vr/+vr6//r6+v/6+vr/+rq - 6v/q6ur/6urq/+rq6v/p6en/6Ojo/+jo6P/o6Oj/6Ojo/+jo6P/n5+f/5+fn/+fn5//n5+f/5ubm/+bm - 5v/m5ub/5ubm/+Tk5P/k5OT/5OTk/+Tk5P/j4+P/4+Pj/+Li4v/i4uL/4eHh/+Dg4P/f39//3t7e/93d - 3f/b29v/2NjY/9fX1//Y2Nj/1dXV/9DQ0P+enp59AAAADwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAA - ACUAAABCAAAAZQAAAIaUlJTd1tbW/+fn5//m5ub/5ubm/+fn5//p6en/6urq/+vr6//s7Oz/7Ozs/+zs - 7P/t7e3/7e3t/+3t7f/t7e3/7e3t/+3t7f/t7e3/7e3t/+7u7v/u7u7/7+/v/+7u7v/u7u7/7u7u/+/v - 7//v7+//8PDw//Dw8P/w8PD/8PDw//Hx8f/x8fH/8fHx//Hx8f/w8PD/7+/v/+/w7v/s7ev/4eHh/9rZ - 2//T0tb/xcTI/5Gaxv8UEvT/Nzbg/zE09P9FN///TTn+/0dC+/9QSv3/Yln//2Zo9v9rYP//NB///1Zh - 0P+aobX/sLSu/8fEvP/E0L7/0tHT/9vV1v/o5ef/2+Dj/+ft8v/q6e3/8ubs//Hx8f/u7u7/8vLy//Dw - 8P/v7+//8fHx//Dw8P/v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7u7u/+7u7v/u7u7/7u7u/+7u - 7v/u7u7/7e3t/+3t7f/t7e3/7e3t/+3t7f/s7Oz/7Ozs/+vr6//r6+v/7Ozs/+vr6//r6+v/6urq/+rq - 6v/q6ur/6urq/+np6f/p6en/6enp/+jo6P/o6Oj/6Ojo/+jo6P/o6Oj/5+fn/+fn5//m5ub/5ubm/+Xl - 5f/l5eX/5eXl/+Tk5P/k5OT/4+Pj/+Pj4//j4+P/4uLi/+Hh4f/f39//39/f/97e3v/c3Nz/2dnZ/9jY - 2P/Y2Nj/2NjY/9HR0f+dnZ19AAAADwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAA - AIaUlJTd19fX/+fn5//m5ub/5+fn/+jo6P/p6en/6+vr/+zs7P/s7Oz/7e3t/+3t7f/t7e3/7e3t/+3t - 7f/t7e3/7e3t/+3t7f/u7u7/7u7u/+7u7v/v7+//7+/v/+/v7//u7u7/7u7u/+/v7//w8PD/8PDw//Dw - 8P/w8PD/8PDw//Dw8P/w8PD/8fHx//Hx8f/y8vL/8fHx//Dx7//t7uz/4uLi/9rZ2//T0tb/xMPH/2ln - 2P8yMPj/Vk7u/0tM9P9FP/L/Rz31/zg27v9AO///Sj/6/1xR//9YVvz/X17//zsu//9VUtD/q6W8/7i3 - u//ExcP/xsnH/9LQ3P/d3tX/6e3h/9/h6f/t7+//8e/n//Hx8f/u7u7/8fHx//Hx8f/w8PD/8PDw/+/v - 7//w8PD/7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+7u7v/u7u7/7u7u/+7u - 7v/u7u7/7e3t/+3t7f/t7e3/7Ozs/+zs7P/s7Oz/7Ozs/+zs7P/r6+v/6+vr/+vr6//q6ur/6urq/+rq - 6v/p6en/6enp/+np6f/p6en/6Ojo/+jo6P/o6Oj/5+fn/+fn5//n5+f/5+fn/+bm5v/l5eX/5eXl/+Xl - 5f/k5OT/5OTk/+Tk5P/k5OT/4uLi/+Hh4f/g4OD/39/f/97e3v/c3Nz/2tra/9jY2P/Z2dn/2NjY/9LS - 0v+dnZ19AAAADwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd19fX/+fn - 5//m5ub/6Ojo/+jo6P/q6ur/6+vr/+zs7P/t7e3/7e3t/+3t7f/t7e3/7e3t/+7u7v/u7u7/7u7u/+7u - 7v/u7u7/7u7u/+/v7//v7+//7+/v/+/v7//v7+//7+/v//Dw8P/w8PD/8PDw//Dw8P/x8fH/8fHx//Hx - 8f/x8fH/8fHx//Hx8f/y8vL/8fHx//Dx7//u7+3/5eXl/97d3//W1dn/xsXJ/0M67/9MR/b/cGft/2Ji - 8v9fYfX/T1fw/zs18v8wNfX/Pjz0/0g89P9DQ/v/V1n0/2JZ/f86Mf3/W1vR/6mmv/+4tLr/xc3C/8XH - z//d3Nj/6OLj/+Li3P/m6+L/7/Lw//Hx8f/t7e3/8PDw//Ly8v/x8fH/8PDw//Dw8P/y8vL/8PDw//Dw - 8P/w8PD/8PDw/+/v7//v7+//7+/v/+/v7//w8PD/7+/v/+/v7//v7+//7+/v/+7u7v/u7u7/7u7u/+7u - 7v/t7e3/7Ozs/+zs7P/s7Oz/7Ozs/+zs7P/s7Oz/6+vr/+vr6//r6+v/6+vr/+rq6v/q6ur/6enp/+np - 6f/p6en/6enp/+np6f/o6Oj/6Ojo/+fn5//n5+f/5+fn/+bm5v/m5ub/5ubm/+bm5v/l5eX/5eXl/+Tk - 5P/k5OT/4uLi/+Hh4f/g4OD/39/f/97e3v/c3Nz/2tra/9jY2P/Z2dn/2dnZ/9LS0v+ioqKHAAAADwAA - AAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd19fX/+jo6P/n5+f/6Ojo/+np - 6f/q6ur/6+vr/+zs7P/t7e3/7e3t/+3t7f/u7u7/7u7u/+7u7v/u7u7/7u7u/+/v7//v7+//7+/v//Dw - 8P/w8PD/8PDw//Dw8P/v7+//8PDw//Dw8P/x8fH/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly - 8v/y8vL/8vLy//Hy8P/v8O7/6enp/+Lh4//Z2Nz/ysnN/y0u7v9lZe//eW/4/2509f9OTvT/IyPr/0M3 - 4/8lFez/Lif+/0hL9P9AOvP/Qz71/1xL//9gWv//LSr1/2Fb0v+lqrn/sre2/8TDxf/RzNX/2t7L/+zi - 8v/m5ef/4efm/+/v7//u7u7/8PDw//Ly8v/y8vL/8fHx//Hx8f/y8vL/8fHx//Dw8P/w8PD/8PDw//Dw - 8P/w8PD/8PDw//Dw8P/w8PD/8PDw//Dw8P/v7+//7+/v/+/v7//v7+//7+/v/+7u7v/u7u7/7e3t/+3t - 7f/t7e3/7e3t/+3t7f/s7Oz/7Ozs/+zs7P/s7Oz/6+vr/+vr6//q6ur/6urq/+rq6v/q6ur/6enp/+np - 6f/p6en/6Ojo/+jo6P/o6Oj/5+fn/+fn5//n5+f/5ubm/+bm5v/m5ub/5eXl/+Xl5f/l5eX/4+Pj/+Li - 4v/h4eH/4ODg/9/f3//d3d3/29vb/9nZ2f/a2tr/2tra/9LS0v+jo6OKAAAADwAAAAQAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd19fX/+jo6P/n5+f/6Ojo/+np6f/q6ur/6+vr/+zs - 7P/t7e3/7e3t/+3t7f/v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v//Dw8P/x8fH/8fHx//Dw - 8P/w8PD/8PDw//Hx8f/y8vL/8vLy//Ly8v/y8vL/8/Pz//Pz8//z8/P/8/Pz//Pz8//09PT/8/Pz//Hy - 8P/w8e//6+vr/+Tj5f/b2t7/zczQ/yst/f9mYvf/dXn2/1FW+f8mFv3/FAj8/3iNrP93ha//RD7f/zY6 - 7f9YVvD/TUf0/z00//9VSfv/Y13//yUp7P9nacf/pqe7/765tv/Aw8H/z9XU/+Ld3//n3+r/4efm/+zs - 7P/v7+//8PDw//Hx8f/y8vL/8vLy//Pz8//y8vL/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Dw - 8P/w8PD/8PDw//Dw8P/w8PD/8PDw/+/v7//v7+//7+/v/+/v7//u7u7/7u7u/+3t7f/u7u7/7u7u/+3t - 7f/t7e3/7e3t/+3t7f/t7e3/7Ozs/+zs7P/r6+v/6+vr/+vr6//q6ur/6urq/+rq6v/p6en/6enp/+jo - 6P/o6Oj/6Ojo/+fn5//n5+f/5+fn/+bm5v/m5ub/5ubm/+Xl5f/l5eX/4+Pj/+Li4v/h4eH/4ODg/9/f - 3//d3d3/29vb/9nZ2f/b29v/2tra/9PT0/+kpKSKAAAADwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAA - ACUAAABCAAAAZQAAAIaUlJTd2NjY/+np6f/o6Oj/6Ojo/+np6f/q6ur/7Ozs/+3t7f/t7e3/7u7u/+7u - 7v/v7+//7+/v//Dw8P/w8PD/8PDw//Dw8P/w8PD/8PDw//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Ly - 8v/y8vL/8vLy//Ly8v/z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Dx7//w8e//7e3t/+jn - 6f/g3+P/09LW/ygx7f9hXvr/anX1/ykn/f8yKv//GAv7/3+RqP+Wlqb/h46h/0A21v86PPT/XVr9/0JH - 6v9EQ/3/WVD7/09R//8wIO//f4W0/66ru/+8v8P/xs3K/83Pyf/g29z/6Orq/+np6f/v7+//8PDw//Dw - 8P/y8vL/8/Pz//T09P/y8vL/8vLy//Ly8v/y8vL/8vLy//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx - 8f/w8PD/8PDw//Dw8P/w8PD/7+/v//Dw8P/v7+//7u7u/+7u7v/u7u7/7u7u/+7u7v/u7u7/7u7u/+7u - 7v/t7e3/7e3t/+zs7P/s7Oz/7Ozs/+zs7P/r6+v/6urq/+rq6v/q6ur/6enp/+np6f/p6en/6Ojo/+jo - 6P/o6Oj/5+fn/+fn5//m5ub/5ubm/+bm5v/m5ub/5OTk/+Pj4//i4uL/4eHh/+Dg4P/e3t7/3Nzc/9ra - 2v/c3Nz/29vb/9PT0/+kpKSKAAAADwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAA - AIaUlJTd2NjY/+np6f/o6Oj/6enp/+np6f/r6+v/7Ozs/+3t7f/u7u7/7u7u/+7u7v/w8PD/8PDw//Dw - 8P/w8PD/8PDw//Dw8P/x8fH/8fHx//Hx8f/y8vL/8vLy//Ly8v/x8fH/8fHx//Ly8v/z8/P/8/Pz//Pz - 8//z8/P/8/Pz//Pz8//z8/P/9PT0//T09P/y8vL/8/Pz//Hy8P/x8vD/8PDw/+3s7v/n5ur/29re/ycn - 7/9QTvz/SEX4/ygm/P9XV///JBv0/3WBt/+ippv/m56c/4aOrP8lEvH/SEbz/15c9v86QO3/RTv//2NS - //9CPvv/PCTu/5Cdtf+wtLX/wr7E/8vMyP/b3Nj/4d/f/+jo6P/u7u7/7+/v//Hx8f/z8/P/8vLy//Pz - 8//z8/P/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8fHx//Hx8f/x8fH/8fHx//Hx - 8f/w8PD/8PDw//Dw8P/w8PD/7+/v/+/v7//v7+//7+/v/+/v7//u7u7/7u7u/+7u7v/u7u7/7e3t/+3t - 7f/t7e3/7Ozs/+zs7P/r6+v/6+vr/+vr6//q6ur/6urq/+np6f/p6en/6enp/+jo6P/o6Oj/6Ojo/+jo - 6P/n5+f/5+fn/+fn5//m5ub/5OTk/+Pj4//i4uL/4eHh/+Dg4P/e3t7/3Nzc/9ra2v/d3d3/29vb/9PT - 0/+kpKSKAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd2NjY/+np - 6f/o6Oj/6enp/+rq6v/r6+v/7e3t/+7u7v/u7u7/7+/v/+/v7//w8PD/8PDw//Dw8P/w8PD/8fHx//Hx - 8f/x8fH/8fHx//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/z8/P/9PT0//T09P/09PT/9PT0//T0 - 9P/09PT/9PT0//T09P/19fX/9vb2//P08v/z9PL/8vLy/+/u8P/q6e3/397i/z0++v8vHv//MCH4/z5B - +v9TSv7/OTL//1BI0f+ema7/lZyl/5KYl/9zc6n/Jxf4/05b9/9fWO//RTX0/05I+/9cWf//ODH4/1hZ - y/+nqq7/w7i7/8bHxf/O0dn/5N/g/+jo6P/t7e3/7e3t//Hx8f/09PT/8fHx//Pz8//09PT/8/Pz//Pz - 8//y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8fHx//Hx8f/x8fH/8fHx//Hx - 8f/w8PD/7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+7u7v/u7u7/7u7u/+3t7f/t7e3/7e3t/+3t - 7f/r6+v/6+vr/+vr6//q6ur/6urq/+rq6v/p6en/6enp/+np6f/p6en/6enp/+jo6P/o6Oj/5+fn/+fn - 5//n5+f/5eXl/+Tk5P/i4uL/4eHh/+Dg4P/f39//3Nzc/9ra2v/d3d3/3Nzc/9PT0/+kpKSKAAAAEAAA - AAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd2tra/+rq6v/q6ur/6enp/+rq - 6v/s7Oz/7e3t/+7u7v/v7+//8PDw//Dw8P/w8PD/8fHx//Hx8f/x8fH/8fHx//Ly8v/y8vL/8vLy//Pz - 8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/9PT0//T09P/19fX/9fX1//X19f/19fX/9fX1//X1 - 9f/29vb/9vb2//X19f/z8/P/8fHx/+/v7//s7Oz/6enp/3OH8v8uIfP/DQX5/0VD//9NQv//Oj7//xkd - /v9ZYsn/qaCj/6KXof+VlpT/UFPA/y8r7v9mafP/WVT3/0Y5+f9RTP//XFj9/yAd//9vc8T/pqjA/7y+ - xv/Rysf/0tLM/+Li4v/l5eX/7e3t//T09P/v7+//8vLy//T09P/y8vL/9PT0//T09P/z8/P/8/Pz//Pz - 8//z8/P/8vLy//Ly8v/y8vL/8fHx//T09P/z8/P/8/Pz//Pz8//w8PD/8PDw//Hx8f/x8fH/8PDw//Dw - 8P/w8PD/8PDw//Dw8P/w8PD/8PDw/+/v7//v7+//7+/v/+3t7f/t7e3/7u7u/+zs7P/r6+v/6+vr/+vr - 6//r6+v/6urq/+rq6v/r6+v/6+vr/+np6f/q6ur/6Ojo/+jo6P/q6ur/6Ojo/+bm5v/n5+f/5ubm/+Tk - 5P/l5eX/5OTk/+Dg4P/e3t7/3d3d/9ra2v/d3d3/3d3d/9PT0/+jo6OLAAAAEAAAAAQAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd29vb/+vr6//q6ur/6urq/+vr6//s7Oz/7e3t/+7u - 7v/v7+//8PDw//Dw8P/x8fH/8fHx//Hx8f/x8fH/8fHx//Ly8v/y8vL/8vLy//Pz8//z8/P/8/Pz//Pz - 8//z8/P/8/Pz//Pz8//z8/P/9PT0//T09P/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9fX1//T0 - 9P/z8/P/8/Pz//Ly8v/w8PD/7e3t/8LF8f8bE/r/NTH8/z0z//89Ov//OD3w/0Mu9f8hEv//ZmrQ/5+i - p/+ampr/hYmb/0pFyv89QvX/XF/9/1VM8P9JO/7/VFf//1RK+v8rIPL/lqSi/7GtuP+5vb7/1tHQ/9nZ - 2f/e3t7/5eXl/+zs7P/r6+v/8fHx//T09P/19fX/8PDw//Ly8v/19fX/9fX1//X19f/09PT/8/Pz//Ly - 8v/z8/P/8vLy//T09P/y8vL/8vLy//Pz8//x8fH/8vLy//Ly8v/y8vL/8fHx//Hx8f/w8PD/8PDw//Dw - 8P/w8PD/7+/v/+7u7v/v7+//7+/v/+3t7f/t7e3/7u7u/+3t7f/s7Oz/7Ozs/+zs7P/s7Oz/7Ozs/+vr - 6//q6ur/6enp/+rq6v/r6+v/6Ojo/+fn5//o6Oj/6Ojo/+bm5v/l5eX/4+Pj/+Li4v/j4+P/4uLi/9/f - 3//d3d3/3Nzc/9ra2v/d3d3/3d3d/9TU1P+jo6OLAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAA - ACUAAABCAAAAZQAAAIaUlJTd29vb/+vr6//q6ur/6+vr/+vr6//t7e3/7u7u/+7u7v/v7+//8PDw//Dw - 8P/x8fH/8fHx//Hx8f/y8vL/8vLy//Ly8v/y8vL/8vLy//Pz8//z8/P/8/Pz//Pz8//09PT/9PT0//T0 - 9P/09PT/9PT0//T09P/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9fX1//T09P/09PT/9fX1//b2 - 9v/09PT/8vLy/+3m8/+Lg/j/HR/2/zQz9P84M+z/STv1/z09+/85Lf//FhP4/2tzzP+YoZ7/oJOh/3aB - of8pGfP/VVj3/2Fh8f9IPe3/R0D//2Vc//87NP//UljD/6inq/+qrrn/ycTB/87Ozv/Y2Nj/4eHh/+jo - 6P/p6en/7u7u/+3t7f/s7Oz/7u7u//Ly8v/09PT/8/Pz//Ly8v/y8vL/8/Pz//Pz8//z8/P/8vLy//T0 - 9P/z8/P/8/Pz//T09P/y8vL/8/Pz//Ly8v/y8vL/8vLy//Hx8f/x8fH/8fHx//Hx8f/x8fH/7+/v/+/v - 7//w8PD/7+/v/+7u7v/t7e3/7u7u/+7u7v/u7u7/7e3t/+vr6//r6+v/6urq/+rq6v/p6en/6Ojo/+rq - 6v/o6Oj/5ubm/+Xl5f/l5eX/5+fn/+fn5//k5OT/4uLi/+Hh4f/i4uL/4eHh/9/f3//e3t7/3d3d/9vb - 2//d3d3/3t7e/9TU1P+lpaWNAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAA - AIaUlJTd29vb/+vr6//r6+v/6+vr/+zs7P/t7e3/7u7u/+/v7//v7+//8PDw//Hx8f/y8vL/8vLy//Ly - 8v/y8vL/8vLy//Pz8//z8/P/8/Pz//T09P/09PT/9PT0//T09P/09PT/9PT0//T09P/09PT/9fX1//X1 - 9f/19fX/9fX1//X19f/19fX/9fX1//X19f/29vb/9vb2//X19f/19fX/9vb2//f39//19fX/8vLy//f2 - 6P/a4fL/aWP2/yEj8/8/P/H/QT/t/zkz8P87Ovz/OzD//xUW+v9aWNr/n6Gp/5qZuf9VV8P/OSz8/2pw - 7f9eU/D/Qzr8/01Q+f9iWf//LyT9/29zrf+sqLP/tby5/8TExP/Q0ND/1tbW/9zc3P/g4OD/6Ojo/+rq - 6v/s7Oz/8PDw//Pz8//09PT/8/Pz//Ly8v/z8/P/8/Pz//Pz8//z8/P/8vLy//X19f/19fX/9fX1//b2 - 9v/z8/P/9PT0//Ly8v/y8vL/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8PDw//Dw8P/x8fH/8PDw/+7u - 7v/t7e3/7e3t/+3t7f/u7u7/7Ozs/+rq6v/p6en/6Ojo/+fn5//l5eX/5OTk/+bm5v/i4uL/4ODg/97e - 3v/d3d3/4eHh/+Pj4//f39//3t7e/97e3v/f39//39/f/9/f3//e3t7/3d3d/9zc3P/e3t7/3t7e/9TU - 1P+pqamXAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQQEBCYJCQlFCAgIaAgICImUlJTe2NjY/+fn - 5//n5+f/6urq/+zs7P/u7u7/7+/v/+/v7//w8PD/8fHx//Hx8f/y8vL/8vLy//Ly8v/z8/P/8/Pz//Pz - 8//z8/P/8/Pz//T09P/09PT/9PT0//T09P/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9fX1//X1 - 9f/29vb/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//f39//19fX/8vLy/+jv+P/59uH/z8/t/ycW - //8rK/P/SEP9/0ZA8/81NvL/Ozb9/zg19v8wK/j/OTnj/31+uv+GjqX/QULa/0lE8/9xbfT/RkXz/0E8 - /f9YVPr/Uk77/ygX8P+bnqP/nqmt/7e3t//Dw8P/ysrK/9HR0f/X19f/4eHh/+Tk5P/o6Oj/6enp/+zs - 7P/v7+//8fHx//Pz8//z8/P/8vLy//Hx8f/w8PD/7+/v//Ly8v/y8vL/8/Pz//T09P/y8vL/8/Pz//Pz - 8//z8/P/8vLy//Ly8v/x8fH/8fHx//Hx8f/x8fH/8PDw//Hx8f/w8PD/7+/v/+7u7v/t7e3/7Ozs/+zs - 7P/r6+v/6urq/+jo6P/n5+f/5ubm/+Pj4//f39//3d3d/97e3v/Z2dn/19fX/9XV1f/T09P/19fX/9ra - 2v/W1tb/2NjY/9nZ2f/a2tr/2tra/9vb2//b29v/2tra/9ra2v/e3t7/3t7e/9XV1f+qqqqXAAAAEAAA - AAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAFKioqFzAwMDI1NTVXMTExfC0tLZuWlpbkzc3N/9nZ2f/a2tr/4ODg/+fn - 5//s7Oz/7+/v//Dw8P/x8fH/8fHx//Ly8v/z8/P/8/Pz//Pz8//z8/P/8/Pz//T09P/09PT/9PT0//X1 - 9f/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//b2 - 9v/19fX/9vb2//b29v/29vb/9/f3//f39//29vb/9PT0//T3/P/o7fD/8vX6/8W+9/8gGPH/NCr4/01J - 7v9GS+3/RDvp/z89+/88Qfz/MS72/ycg8/9YVdD/dHiz/x8V//9gYPr/Wl7z/0FB7f9MQv//YFv//zwy - 9v9UT8r/j5al/6urq/+3t7f/v7+//8fHx//Ozs7/1tbW/9jY2P/c3Nz/4ODg/+Dg4P/k5OT/6enp/+3t - 7f/u7u7/8PDw//Hx8f/v7+//7+/v//Hx8f/x8fH/8vLy//T09P/z8/P/9PT0//X19f/09PT/8/Pz//Ly - 8v/y8vL/8fHx//Hx8f/x8fH/7u7u/+/v7//u7u7/7e3t/+zs7P/r6+v/6Ojo/+jo6P/n5+f/5eXl/+Li - 4v/f39//3Nzc/9ra2v/Y2Nj/19fX/9LS0v/Nzc3/zc3N/87Ozv/MzMz/z8/P/9LS0v/Q0ND/0NDQ/9LS - 0v/U1NT/1tbW/9nZ2f/Z2dn/2dnZ/9ra2v/e3t7/39/f/9XV1f+qqqqXAAAAEAAAAAQAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AABQUFAKZGRkKWtra1dxcXGMcXFxsXFxccqbm5vytLS0/7i4uP+7u7v/yMjI/9nZ2f/m5ub/7u7u//Dw - 8P/x8fH/8vLy//Pz8//z8/P/8/Pz//Pz8//09PT/9PT0//T09P/09PT/9PT0//X19f/19fX/9fX1//X1 - 9f/19fX/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//f39//39/f/9/f3//f39//19fX/9vb2//b2 - 9v/29vb/9/f3//f39//39/f/9vb2//b69f/w9vH/+f3y/+bv8//d2/j/ZGXz/zMs8/9MSO7/UEj5/0k/ - 7f8uM/r/Qz///0k2//8rJv7/FRDv/0M/5P82Mf7/b3Xy/05I9f9JPvj/Tkz//2Vm9P8rF/n/eX+u/5ub - m/+kpKT/rKys/7a2tv+8vLz/x8fH/83Nzf/S0tL/19fX/9fX1//a2tr/4eHh/+Xl5f/m5ub/6urq/+/v - 7//u7u7/7u7u//Hx8f/y8vL/8/Pz//X19f/09PT/9fX1//Pz8//z8/P/8vLy//Hx8f/x8fH/8fHx//Hx - 8f/x8fH/7e3t/+7u7v/r6+v/6enp/+np6f/m5ub/4+Pj/+Li4v/f39//3Nzc/9jY2P/U1NT/0NDQ/87O - zv/Nzc3/zMzM/8XFxf/CwsL/xMTE/8bGxv/FxcX/xsbG/8jIyP/IyMj/ycnJ/8zMzP/Ozs7/0tLS/9bW - 1v/Y2Nj/2dnZ/9vb2//e3t7/39/f/9XV1f+oqKiYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnweJiYkgiYmJVouL - i5KNjY3Bj4+P3ZCQkOyenp77pKSk/6SkpP+np6f/srKy/8PDw//W1tb/5OTk/+7u7v/y8vL/8vLy//Pz - 8//z8/P/8/Pz//Pz8//09PT/9PT0//T09P/09PT/9fX1//X19f/19fX/9fX1//b29v/29vb/9vb2//b2 - 9v/29vb/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//29vb/9/f3//f39//39/f/9vb2//f3 - 9//4+Pj/+Pj4//Dy/P/89/T/9u75//b48v/r8/P/5+n7/4F9+/8fIPT/RUL1/0xM9P9XRu3/PTL6/zU8 - /f89Pfv/NDT+/xcU/f8XC/3/WV3x/29p7P9EPvf/TEX//1RW+v9WSfn/SkfF/4mJif+Tk5P/np6e/6ur - q/+xsbH/urq6/76+vv/CwsL/y8vL/8vLy//Q0ND/2dnZ/9vb2//a2tr/3d3d/+Pj4//k5OT/5eXl/+vr - 6//t7e3/7u7u/+/v7//t7e3/7e3t//Dw8P/w8PD/8PDw//Dw8P/w8PD/8fHx//Hx8f/x8fH/7u7u/+3t - 7f/q6ur/5+fn/+bm5v/j4+P/3t7e/93d3f/U1NT/09PT/9LS0v/Pz8//y8vL/8bGxv/CwsL/wMDA/729 - vf+7u7v/vb29/8DAwP++vr7/u7u7/7u7u/+9vb3/w8PD/8bGxv/Jycn/zc3N/9PT0//W1tb/19fX/9nZ - 2f/e3t7/39/f/9bW1v+oqKiYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAn5+fBp+fnxqYmJhNl5eXlKamptjIyMj12tra/dra - 2v7Pz8//ycnJ/6ampv+fn5//pKSk/66urv+/v7//1NTU/+Xl5f/v7+//8/Pz//T09P/09PT/9PT0//X1 - 9f/19fX/9fX1//X19f/19fX/9fX1//b29v/29vb/9vb2//b29v/29vb/9vb2//b29v/29vb/9/f3//f3 - 9//39/f/9/f3//f39//39/f/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//r5 - 9f/59/b/9fX1//X29P/y9fP/9vX//+Xg/f+9suD/ERf+/zIt9P9ZUO3/VUnv/0E79P84N+v/QTz1/0M9 - +v8pJ/3/HSD+/2xv+f9kWfX/Qz3u/05M+v9dX///PC3z/1tbp/+OgpT/kZSS/5ydof+qoK3/qq6i/6+r - t/+stK3/vLe4/8TCwf/BxcD/xsvJ/8nPzv/P0tb/0dLW/9bX2//Y2Nj/2tra/+Dg4P/j4+P/5OTk/+bm - 5v/o6Oj/5+fn/+bm5v/o6Oj/6urq/+3t7f/q6ur/6urq/+/v7//v7+//5+vg/+Lj3//h4t7/3+LZ/9rY - 2P/Y0t3/19PY/9LUyP/Qzs3/ycfH/8PCxv/Bwsb/v8HB/7u+vP+5ubn/tLO1/7Szt/+vrrD/r6+v/6+w - rv+srav/rq6u/7Kxs/+ysbX/uLm1/766wP/Cvcz/vcPC/8bP0v/O2dH/2NfT/+PX1//c3Nz/3t7e/9bW - 1v+pqamYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAACfn58Cn5+fFp+fn0K/v7+q7Ozs8/////////////////////////////////z8 - /P/V1dX/ra2t/6Ojo/+srKz/vr6+/9PT0//m5ub/8fHx//T09P/19fX/9fX1//X19f/19fX/9fX1//X1 - 9f/19fX/9fX1//b29v/29vb/9vb2//b29v/29vb/9vb2//b29v/29vb/9/f3//f39//39/f/9/f3//f3 - 9//4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//v5+f/7+fn/+Pj4//n6 - +P/2+vX/9vj5//Ly///m4fz/1tP6/3V5/f8kJPr/Oj3z/1pV+P9LQPv/Q0Dz/zky8f83Mfz/MSb//05G - /v9rbOz/UkT2/049//9bUP//VVf8/yAY7v9fd4P/kYmT/5yRk/+XlJD/lZmT/6itrP+qpKn/q6ux/7e2 - uv/BvL7/yMHE/8jBxP/Kxcb/x8nD/8vRxv/Ozs7/1dXV/9nZ2f/X19f/1tbW/9zc3P/f39//3Nzc/+Xl - 5f/m5ub/5ubm/+fn5//k5OT/4+Pj/+jo6P/n5+f/5eHn/+Te6f/b2OH/1NXZ/9PV1v/MzdH/wsTE/8LD - v/+/wLz/urq6/7q1t/+4s7X/trGy/7CwsP+prLD/oqWt/6WkqP+ioqL/o6Sg/6SmoP+ho53/oaKe/6Oj - o/+joqb/qquh/7Kzt/+xta//v7y3/8/Lxv/Q1Mn/y8rU/9XV1f/c3Nz/3d3d/9bW1v+pqamYAAAAEAAA - AAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AACfn58Hn5+fLby8vIL7+/v8////////////////////////////////////////////////+fn5/66u - rv+ioqL/ra2t/7+/v//a2tr/7Ozs//Pz8//19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9vb2//b2 - 9v/29vb/9vb2//b29v/29vb/9/f3//f39//39/f/9/f3//f39//39/f/+Pj4//j4+P/4+Pj/+Pj4//j4 - +P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//z5+//8+fv/+Pf5//n6+P/4/Pb/9Pjy//T2 - 9v/29/v/9Pn3/+rt8f+mpvT/KBzw/yMc+f9MSez/WVD6/0pP8f9VR/P/OC7z/yAe+v9ubfL/bF75/zY8 - 7f9IR/H/cmH//00/8f9BSLv/dX2K/3+Gf/+LkI//m5ed/5OYmf+inZz/ra+p/6ysrP+tq7H/srGz/7i4 - sv/Awbf/xMW8/8XDwv/Hx8f/yMjI/8zMzP/Ozs7/zc3N/8/Pz//U1NT/19fX/9ra2v/b29v/2tra/9zc - 3P/a2tr/2tra/93d3f/d3d3/2tLc/9bU1P/Kz8b/xMzB/8PKxf+8v8P/s7K7/7Cwtv+tq7H/q6ix/6ik - r/+joKn/n5+f/6Ghm/+hopn/n5yX/5udl/+Zmpj/mpmb/5qYnv+WlJr/lpWX/5mamP+Zm5X/o52Y/6iq - qv+rrbX/xL+8/8q+vP/Mws7/y8/J/8zO2P/b29v/3d3d/9bW1v+pqamYAAAAEAAAAAQAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwGfn58OxcXFYvr6 - +vX///////////////////////////////////////////////////////////Dw8P+lpaX/o6Oj/6+v - r//Kysr/4eHh//Hx8f/19fX/9fX1//X19f/19fX/9vb2//b29v/29vb/9vb2//b29v/29vb/9/f3//f3 - 9//39/f/9/f3//f39//39/f/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/5+fn/+fn5//n5 - +f/5+fn/+fn5//n5+f/5+fn/+fn5//r4+P/6+fv/+fj6//n4+v/8/fv/+Pz3//X58//1+fP/9/f//+7x - 9f/6+fv/7PHw/5yd+P8kHPL/Lij9/1hO9P9UX/f/U1Ts/y4r8/9IRPv/a2/z/0tN8v9LQf//XVD6/2Nd - //8tG/L/YWaX/4OFhf99g4j/i5eL/42Slf+cmJ3/nKSZ/6Knnv+ur63/s7Cy/6qprf+tq7H/r7G5/7K1 - vf++vr7/urq6/729vf/CwsL/wsLC/8HBwf/Gxsb/zMzM/87Ozv/Pz8//zs7O/8/Pz//Pz8//zc3N/83N - zf/Ly8v/0M7G/8TCwf+6vbv/trq1/6+xsf+tq7H/rKmr/6mnn/+copf/m5+Z/5ibmf+Ul5X/kZWP/5SW - kP+Yl5P/m5aX/4+Rmf+NkJX/jI+U/4qNkf+GiY3/h4qP/4yPlP+OkJj/oZ2i/6akpP+orKf/sriz/7q+ - sv/NyMf/19HW/9PQ3//c3Nz/3t7e/9fX1/+tra2jAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwHW1tYo+vr65/////////////////// - ///////////////////////////////////////////////////i4uL/oKCg/6enp/+4uLj/0dHR/+np - 6f/09PT/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//f39//39/f/9/f3//f39//39/f/9/f3//j4 - +P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5 - +f/5+fn/+fn5//j4+P/5+fn/+/r8//r5/f/49/v/+fj8//r6+v/6+/f/9/b4//z3///39/f/8fL8/+Xr - 8v/g7Pj/ioz4/ycY9f8oKvT/VFb6/09Q+P8gG/j/YWP9/3Bo9f8/PPD/Q0L8/2Jg//89QvX/Gwv4/0s4 - 1f9sa63/fYSd/5CLoP+LlZX/pZ6b/6Kdn/+ko6z/oqWt/6Knqv+nrKv/sK6t/7Svrv+0tLT/tLS0/7W1 - tf+1tbX/tra2/7q6uv+9vb3/u7u7/7+/v//AwMD/wMDA/8LCwv/CwsL/wMDA/76+vv+7u7v/uLyw/7Kx - tf+vq7f/qamp/6Khnf+emJ3/nJSb/5mRkf+WkJH/k5GR/42Skf+KlZP/hpKW/36Lm/94fqH/dnep/2dl - sf9mY7P/ZmC5/2Rcu/9hWbj/Yly1/2Visv9nZbH/e4ml/5uepv+xrLX/srq6/7/Kwv/Hwcb/zsbH/9jf - 0v/c3Nz/3t7e/9fX1/+vr6+lAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwL29vaE//////////////////////////////////////// - ////////////////////////////////////////w8PD/6Kiov+rq6v/wcHB/9vb2//t7e3/9vb2//b2 - 9v/29vb/9vb2//f39//39/f/9/f3//f39//39/f/9/f3//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//n5 - +f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//v8 - +v/3+Pb/+fr4//r5+//39P3/9/T9//n4/P/6+vr///nu///6///y8v//9Pv+//H39v/y8///3+T9/9Pj - +v+SkPT/NiD0/zQt+v8dK+//Ozr7/3Rn//9SU/H/Rz/3/01P//9dYv3/LSX//ywk7f8fGPX/HhL4/19Y - x/98fan/n52z/6Chr/+lqqv/oKih/6erpf+srav/rqqp/6+qqf+urq7/rKys/6ysrP+vr6//sLCw/7Ky - sv+ysrL/sLCw/62trf+vr6//rq6u/7Gxsf+0tLT/srKy/7CwsP+urq7/oqem/6WnqP+joaH/nZqV/5qX - k/+VkJH/iouH/4iNfv9+h4v/fIKJ/3h7iv9ycZj/ZmCx/0lCzf8rH+n/Gwv8/xwb+/8eHfz/HyD6/x8h - +P8eIPf/HR74/xwb+v8bGvr/JxX2/2t1q/+io7f/sre6/7vAv//OxtH/1NDV/8vWzv/b29v/3t7e/9fX - 1/+vr6+lAAAAEQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAJ+fnwP6+vqw//////////////////////////////////////////////////////// - ////////////////////////+fn5/6qqqv+jo6P/srKy/8jIyP/i4uL/8fHx//b29v/39/f/9/f3//f3 - 9//39/f/9/f3//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+fn5//n5+f/5+fn/+fn5//n5 - +f/5+fn/+fn5//n5+f/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//z7/f/3+Pb/+fr2//v8 - +v/7+v7//vr///z5+//9/Pj//P37//r49////fX//f70//T6///r9/n/+v/0//rv8f/o6f7/zM/u/46H - //8gHPf/Fhjy/2lq+P9vYvT/TT/4/0pG+f9iWv//TUr+/zAl//9CRvP/ODb0/ysi9P8oHf3/Ni3o/1pX - 3P+Hisf/nJ+u/66tr/+vrbP/pKit/6Gtrf+srKz/pqam/6ampv+qqqr/qamp/6Wlpf+jo6P/pKSk/6Cg - oP+ioqL/np6e/5+fn/+hoaH/n5+f/5+fn/+enp7/mpyk/56env+Yk5T/j4eR/4yHkP+DiIv/cn6K/2dy - kP9mY6H/U0+2/zgw0f8jGuz/IRf9/ygg//81Lvv/QDn4/zk4+v87Ovz/Ozn9/zs5/f87Of3/Ozn9/zk4 - +v82Nff/IRv8/y4d9v9VRdj/qbK7/7+7xv/HycP/ztHP/87Q2P/b29v/3t7e/9fX1/+vr6+lAAAAEQAA - AAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+f - nwP9/f3Y/////////////////////////////////9/X//+cg///7Of///////////////////////// - /////////////+Li4v+goKD/p6en/7a2tv/S0tL/5+fn//T09P/39/f/9/f3//f39//39/f/9/f3//j4 - +P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+vr6//r6 - +v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//r5/f/7/Pr//f/5//n79f/7+fn//fr8//r5 - 9f/7/PP/9vn9//f79f/6+vr///r////99P//+fX//vb///b4+f/v+ez/6unr/+Lk7P+3t+X/S0jy/zE1 - +P9xdfL/YFrv/0k4+f9YSvz/ZmT//yQi/v86N/H/UUnq/0VJ9v9DR+z/Oj7x/y8r9v8lGfX/Jx3i/1xX - 4v+NjtL/oqW0/7KwqP+vr6//rq6u/62trf+oqKj/o6Oj/6Ghof+enp7/mJiY/5WVlf+VlZX/kJCQ/5CQ - kP+Tk5P/lJSU/5WVlf+Wlpb/jY6S/42Pif+QjIv/jYaN/3+Egv9ueIn/Tkm2/zER5v8VF/H/JCP7/zQu - //88Nv//QDz//z49/v84O///Njr//0I4/f9COPz/Pzf2/z028f8+N/L/Pzf2/z81+f89M/j/ODn5/yQm - /P8lFvP/nKLP/8DDwf/O18r/0dbV/9jT0P/b29v/3t7e/9jY2P+wsLClAAAAEQAAAAQAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM/Pzwb////7//////// - /////////////////////////1wz//8zAP//ZT////z7//////////////////////////////////// - ///Dw8P/oaGh/6qqqv/CwsL/2tra/+7u7v/19fX/9/f3//f39//39/f/9/f3//j4+P/4+Pj/+Pj4//j4 - +P/4+Pj/+Pj4//j4+P/4+Pj/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/6+vr/+fn5//j4 - +P/29vb/9PT0//Ly8v/19fX/9/f3//n5+f/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//r6 - +v/6+vr/+vr6//v7+//7+/v/+vr6//n5+f/49O//7e/v/+Xq6//n5OD/wMTg/yIX+f9rYfv/a2j0/0RB - 9f9JQ///WVP//1hS/f8lHfb/QTH6/zw+8P9HO+3/TUbv/0pC8/9ERO7/PD73/yss+P8fHfP/Ghbr/z5F - 8P+Hhcv/k5rB/5qewf+borH/pK2q/5mapP+Ulpf/lJeO/42Slf+Nloz/iJKG/4aKhf+MiYT/kJCC/42R - i/+DhZD/i4aD/4uJif99gpH/ZW2i/zpCvf8bF/L/IR///ywn//9DOP//RDv//0U8/v9DOvz/QTb2/0U8 - 8f9VTvL/ZmP1/3ty8f97e+//dnj0/3J38v9zcv7/cWz9/3Bt+f9rbu7/aV76/01P8/8DE/n/nprb/8rG - y//Z0dz/1NfO/9PQ2f/a2tr/3d3d/9fX1/+xsbGlAAAAEQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPf39yL///////////////////////////// - /////////zkH//8zAP//MwD//6KL///////////////////////////////////////5+fn/qamp/6Oj - o/+wsLD/yMjI/+Tk5P/x8fH/9/f3//f39//4+Pj/+Pj4//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5 - +f/5+fn/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+Pj4//X19f/y8vL/7u7u/+rq6v/l5eX/4eHh/9/f - 3//j4+P/6urq//Dw8P/19fX/+fn5//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+/v7//v7 - +//7+/v/+vr6//n5+f/7/Pj//Pf///Xx/f/k7Ov/1tnn/4KH3P8vL/n/fXn2/1pf8P9EOfP/VUj3/2Jd - /v84Mv3/PTr//1NL//9OR/z/RTv//zwy+v9DQvD/Qjzv/0o/+v9KR/H/Q0D0/zUx9f8hJOv/HhH7/yIP - 7v9QS+L/ZWTM/3p5u/+Lkqb/goOd/4WFl/+Khov/jYWF/42FjP+Ig5L/hYaQ/4eKjv+LiYn/gYKW/29u - pv9DOsr/IRX3/ywp+v9AOPr/Qjf5/0I6/f9EPPX/QD3x/0ZK7/9dZvP/dX/1/36F8v95e/H/cHHx/1BJ - /v9BOPr/NCj8/ygi/f8bFv//Iyn0/yof/f9BMv//YmT4/2tv7P8ZE/z/mpLZ/8zX1f/X1t//2Nnd/9Pc - 2f/b29v/3t7e/9jY2P+xsbGlAAAAEQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAANnZ2QX//////////////////////////////////////0IT//8z - AP//MwD//zkH///f1///////////////////////////////////////4uLi/6CgoP+np6f/uLi4/9LS - 0v/p6en/9vb2//j4+P/4+Pj/+Pj4//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+vr6//r6 - +v/6+vr/+fn5//f39//09PT/7e3t/+Pj4//Y2Nj/zc3N/8TExP/AwMD/vb29/7y8vP/BwcH/ysrK/9jY - 2P/m5ub/8vLy//n5+f/7+/v/+/v7//v7+//7+/v/+vr6//r6+v/6+vr/+/v7//v7+//7+/v/+vr6//r6 - +v/0+fj/+fTx//b08//m8Or/4+Pv/8fN1P8lJvL/Y1j6/2pr6/9MP/X/UT7//15X//9XTP//GhP2/15X - 9P9ga///bmD7/2ZZ+/9XTP//Qzj//0E8+/8+OvH/RT32/0tF6v9LQ/T/TUrz/0RB9f8zNPD/Jyj0/xob - +f8SFfn/Cg73/0o/y/9NRr//U1Kw/2Jkpf9udJf/dn6P/3mAlP92d53/QELE/yUX+f8vKP//RDz//0w6 - //9GN///Qj30/0pE9/9qZ/n/dnj1/32B+P9qbf7/RkX//y4q+P8vMOz/PULk/2Jj1f90dcv/h46//3V7 - xP9TVNr/Jhrw/y4s8P8zLfD/KCP6/0dA+/8YEPH/pqbU/8/S2v/k4Nv/4+DS/9rU3//d3d3/39/f/9jY - 2P+ysrKlAAAAEQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAJ+fnwH//////////////////////////////////////0wf//8zAP//MwD//zMA//9f - N////Pv//////////////////////////////////////8PDw/+hoaH/rKys/7+/v//c3Nz/7+/v//f3 - 9//4+Pj/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//j4+P/09PT/7+/v/+fn - 5//f39//1dXV/8nJyf+8vLz/sbGx/6mpqf+np6f/paWl/6Wlpf+oqKj/sLCw/729vf/Ozs7/4ODg//Hx - 8f/4+Pj/+/v7//v7+//7+/v/+vr6//r6+v/7+/v/+/v7//v7+//7+/v/+vr6//r6+v/5+f//+vfz//L0 - 9P/y7u3/7e3z/93f6v+Ijer/NSz+/3Jx9v9mX/b/Oy/z/0tD//9sY///Oiz8/zou5v81J/v/WUr//2pi - /f92c/H/dnT8/11Y+/9RT/3/T0r//0c8/P9GPfH/Qjjw/0tA+v9JRO3/UFDw/05J+P9JQvf/RT/w/zAs - 9/8qKvj/ICH7/xsW+/8bEPL/GxPq/x0Y7/8YFPX/LDD7/zY0/P9DQvb/PDf4/z476/9ZVPf/bm/7/3R/ - +P9pbP3/SkT9/zIl9f88MuP/X1/L/3uBvP9/hMH/eXrL/2x5z/9iaNH/SELd/ygZ8f8lI/j/KS/6/zg6 - 9/9OTff/dnf//1JJ//8mHvT/v7/d/+Tf3v/h3N7/2uTT/9ne3//e3t7/4ODg/9jY2P+0tLSqAAAAEQAA - AAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+f - nwL+/v7i/////////////////////////////////2I7//8zAP//MwD//zMA//8zAP//mX////////// - //////////////////////////////n5+f+rq6v/pKSk/6+vr//Kysr/4+Pj//T09P/5+fn/+fn5//r6 - +v/6+vr/+vr6//r6+v/6+vr/+vr6//n5+f/29vb/8/Pz/+7u7v/m5ub/29vb/8vLy/+9vb3/srKy/7Cw - sP++vr7/yMjI/9XV1f/j4+P/4eHh/7q6uv+goKD/oqKi/6enp/+xsbH/xMTE/+Li4v/z8/P/+vr6//v7 - +//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//3+/D/9Pvs//n7/P/48vP/9fDx/+Dh - 9f/PzeD/Jh3v/1ZW//9xcfP/UU3z/0U7//9dWfj/YVT8/zk96v99jc//YWvh/0xN8f82K/f/UD///21Z - //9+bvz/enD//2pf//9TVvj/U1D//0Y/+v9JQvf/Qjzp/0c97v9LP/P/TEXp/0ZJ8v9HRPT/RUH0/zo5 - 8/8hIPL/EQz3/yUd/v89Ofz/RTv//0I99P9BPvH/Vlj6/3F87v95eP3/YFv8/zo28/8MDP//Dwz8/xIL - 9v8QCvf/Dgv6/xEQ+v8dGPX/KSDy/y0l9P8vKfj/PD/1/zs99v8+Nvn/Szr//2ld/f+Hgv3/hIT//0gx - 9/96h+n/1NXj/9vP4f/i4tb/3OHf/9Xc2f/f39//4ODg/9jY2P+0tLSyAAAAEgAAAAUAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwH+/v7a//////// - /////////////////////////2xH//8zAP//MwD//zMA//8zAP//NQP//9nP//////////////////// - ///////////////////n5+f/oKCg/6ampv+3t7f/0dHR/+vr6//29vb/+fn5//r6+v/6+vr/+vr6//r6 - +v/4+Pj/9fX1//Dw8P/m5ub/29vb/8/Pz//ExMT/urq6/7Gxsf+9vb3/29vb//v7+/////////////// - ///////////////////t7e3/vr6+/6Ghof+kpKT/s7Oz/9HR0f/p6en/+Pj4//v7+//7+/v/+/v7//v7 - +//7+/v/+/v7//v7+//7+/v/+/v7//v7+//+/f//9fj8///7/f/1+vj/8+3u//H25//g3+H/iZPq/y8t - +/9scun/Zlr6/0A16f9QUP//Ylv//zQs//+Bf8v/r7bH/73Az/+0sNr/lpbi/2dq8f8uJPL/Myb2/1NJ - 9/9sX/v/cGf+/3Jv+/9rZv//Xlj9/1dS//9NQ///ST///0RD9/8+Pvb/MCv4/ygd//8oH///NjD//0M8 - //9DOP//PTf0/1tP//97cfr/gH3w/1BT8v8hG///MCr5/1ZD8P9RS/D/SEjw/0JG8v9ER/b/TEr4/05L - 9f9MTPT/Rkzx/0dI8P9ERPb/PkDy/z868/9cVfr/e23//5iS/f+Hd/r/QzD5/4eE4P/H0eL/3d/p/+Dn - 4P/h2+D/6ODh/+Hc3f/g4OD/4ODg/9jY2P+0tLSyAAAAEgAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD9/f3D//////////////////////// - /////////39f//8zAP//MwD//zMA//8zAP//MwD//1kv///8+/////////////////////////////// - ////////x8fH/6Ghof+qqqr/v7+//9vb2//u7u7/9/f3//r6+v/5+fn/9vb2//Hx8f/q6ur/4eHh/9jY - 2P/MzMz/wMDA/7S0tP+0tLT/z8/P//Dw8P////////////////////////////////////////////// - /////////////+vr6/+jo6P/qamp/8DAwP/d3d3/9PT0//v7+//8/Pz//Pz8//v7+//7+/v/+/v7//z8 - /P/8/Pz/+/v7//v7+//+/Pz/9fj8//v+7//4//j/8e/1//f26P/b2Oj/0tvo/ygX9P9bXPT/b231/1RM - 7f9AOv3/WVr//1FO8f9XUNv/tLm4/7fBwf+/ytL/z9jb/97d7f/Nzev/sb3n/4mT6v9QXvT/KB31/zYm - //9FOf3/XVH//29p/v94dPz/fHf8/3py//9LPf//KBr8/zAr/P9CPfz/Qzn9/0Q8+/9FRPL/enD//3J1 - 9f9JT/b/IiT+/y4w8v9JP/f/T0T0/0NF6v9DQPP/Qz/y/0Q+8f9BPfD/PDvv/zs58P9BOPP/Rzj3/0Y7 - /f9YS/r/Z1D+/4Zz//+RhP//hoH8/1pF+P9eUvL/qKfp/93j4v/s6N3/4ePk/9/m4//d3en/293e/93j - 3v/g4OD/4ODg/9jY2P+0tLSyAAAAEgAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwH9/f23/////////////////////////////////4xv//8z - AP//MwD//zMA//8zAP//MwD//zMA//+Zf///////////////////////////////////////+vr6/6ur - q/+jo6P/sLCw/8fHx//h4eH/8PDw//Pz8//w8PD/6Ojo/93d3f/Pz8//wcHB/7W1tf+vr6//xMTE/+Tk - 5P/+/v7///////////////////////////////////////////////////////////////////////// - ///Y2Nj/pKSk/7Gxsf/Pz8//7Ozs//j4+P/8/Pz//Pz8//v7+//7+/v/+/v7//z8/P/8/Pz//Pz8//v7 - +///+/r//fz///T7+P/99v3/7Pj6//v19v/y7+r/3Njj/4eM6f89Mv7/ZXD2/11b9P9ENvn/Skf//3Nl - +f8pJPv/oJbB/7+9w//Oysn/2NjS/9fW2P/a1+f/3Nvd/+Db3P/Hx9X/trfM/5mexf9/gNb/WFrX/zY1 - 3/8jGvf/Kyv//ywi//8vJf//NjD//z49//86Ovz/QDzz/2Fc9f+Affj/S1P0/ykf//8oIfj/Ny37/zoy - 9P9APPn/Rkf7/0dH//9TS///Uk///1NT+/9YVvz/YFf//2hd//9vZv3/dm77/4F+/P+Ihf//gHn//2hj - //9ANvv/VE/w/5ad7P/T3fX/4N70/9vk5//m5ub/4uPf/+nl4P/k5N7/4eDk/+Le3f/g4OD/4ODg/9fX - 1/+0tLSyAAAAEgAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAJ+fnwH8/Pyk/////////////////////////////////5l///8zAP//MwD//zMA//8z - AP//MwD//zMA//81A///2c///////////////////////////////////////+fn5/+fn5//pqam/7W1 - tf/Ozs7/29vb/9zc3P/S0tL/yMjI/729vf+0tLT/urq6/9fX1//4+Pj///////////////////////// - ////////////////////////////////////////////////////////////////////////wcHB/6io - qP/CwsL/39/f//Pz8//7+/v//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz/+/v7//r6 - +v/4+Pj/9vb2//X19f/u7u7/5eXl/8/a2P8hE///aGft/2xo9/9DSu3/RDz//2ZU//9WU/3/SVDj/7a4 - wv/Bxcb/1MnF/9zV0v/K3Nv/3Nvd/9PO0P/Ix9D/w8PD/8G3xP+0qrf/pKOl/5OXqv9VW8z/Agz//zUo - //9FO///QTj//zk8/P9JT+7/eXT3/2tq8P8rL///FRb6/xwb+/8mI/v/NS/+/0hA//9bUf//amD//3Jp - //94bf//eW///3x1//+AeP//gHf//39y//95av//dmP//0pJ/f86MPX/QCzw/3Nm9/+usPD/2OLp/+Tq - 5f/p5+3/5+fn/+fn5//m5ub/5eXl/+Pj4//i4uL/4ODg/97e3v/g4OD/4ODg/9fX1/+zs7OzAAAAEgAA - AAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAD8/PyT/////////////////////////////////6+b//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//WS////z7///////////////////////////////////////Hx8f/oaGh/6ioqP+5ubn/wsLC/8HB - wf+3t7f/srKy/8vLy//s7Oz///////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////8/Pz/6SkpP+6urr/1tbW//Dw - 8P/7+/v//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz/+/v7//z8/P/8/Pz/+vr6//f3 - 9//09PT/7+/v/9PZ5P+Ag+v/Oy///3Fw9f9TV+z/RDr+/1JM/f9hWv7/MiH7/5CYvf/AwMb/0s3E/8bI - yP/T0tz/zNDK/8nAyv/IxcH/ubi6/6myqP+pqaP/n5ms/1pZ0f8kHPz/OjP6/0ZB+v85Of//PT3v/2Nc - 8/9+dfv/Tkz6/ycg8/+Yjuv/lpXz/42M8/+AfvX/b231/15c9f9OTvT/REXz/z5A8v9IP/P/SD/0/0s/ - 9f9MQfX/Uknz/1tX8/9naPb/cXP3/52d9/+usvP/w87u/9nl7//k6+7/6+3u/+7p6//w6uv/6Ojo/+jo - 6P/n5+f/5eXl/+Pj4//i4uL/4ODg/93d3f/g4OD/4ODg/9fX1/+zs7OzAAAAEgAAAAUAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8/PyD//////// - /////////////////////////7mn//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//5V7//// - ///////////////////////////////////6+vr/q6ur/6Ghof+mpqb/qamp/8DAwP/g4OD//Pz8//// - //////////////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////7Kysv+5ubn/1dXV/+/v7//7+/v//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/9/f3/+/v7//z8/P/9/f3/+fn5//X19f/z8/P/8fHx/+Lo - 7//ByNf/Ixvy/2Bl9v9uZ/j/SUbw/0A/+f9mWf//SkD+/1la2v+1sb3/u7zG/7nDtv/Oy8P/w8PD/8O+ - u/+9vav/tLC1/6enrf+QmqT/VVDT/ywb/v89OPn/TkH//zw8+v89O+v/aGzz/3x59P9HOPT/a2f//8/T - 7//b3u3/7+vw/+3q8//s6PT/6uf2/+no+P/o6Pj/5+r4/+fq+P/f6PL/3+f0/+Hn9P/e5PH/3OLv/+Dl - 7v/k6u//6O/y/+ns6v/u8e//8fLw/+7v7f/q6Oj/7+rs//Hq7f/y6/D/6enp/+np6f/n5+f/5eXl/+Pj - 4//h4eH/39/f/9zc3P/g4OD/39/f/9fX1/+zs7OzAAAAEwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8/Pxr//////////////////////// - /////////8y///8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zUD///Sx/////////////// - ////////////////////////5+fn/6urq//R0dH/9fX1//////////////////////////////////// - /////////////////////////////////////////////////////Pv//8Kz//+Zf///r5v///z7//// - /////////////////////////////8vLy/+/v7//3d3d//Pz8//7+/v//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz/+/v7//39/f/9/f3/+/v7//n5+f/4+Pj/9vb2/+jt6//b1+P/dXvk/zU1 - /f97dPP/VFXt/0E9+v9YS///XVv1/ysi+/+ambv/p6zB/7q4uP+1sbb/uq/D/7m2sf+qqa3/rKun/5iY - qv9SS9T/IyT2/z5A+f9UQ/7/PjH5/0RF+f91df//c2z3/zMw9/91f/H/4uLo/+nn7f/69f7/8fb0//H2 - 9f/x9fb/8PT1//L09f/y9PT/8vXz//L28f/y8/f/8vT0//L28P/x9+z/8ffs//Hy8P/w7vT/7+v2//Py - 7v/w7u7/7+vw/+7s8v/v7vL/7O7u/+rt6//p7ej/6enp/+np6f/o6Oj/5eXl/+Pj4//h4eH/39/f/9zc - 3P/g4OD/39/f/9bW1v+zs7OzAAAAEwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8/Pxi/////////////////////////////////9nP//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//9SJ///+ff///////////////////////// - //////////////////////////////////////////////////////////////////////////////// - /////////////////////////+Xf//+Ve///SRv//zMA//8zAP//MwD//8W3//////////////////// - /////////////9vb2//IyMj/5+fn//f39//8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/7+/v//Pz8//39/f/8/Pz/+/v7//v7+//6+vr/9fX1/+vq7P/i3uP/w87c/ygg9/9mae//Zl/2/0ZC - 7/9HPv//YmD5/zc2/P9iZsz/oaul/6+xq/+oqqT/qaqm/6emov+gpKX/lZyl/1FIzv8yJP7/Q0P//zxA - 9/8+Ov3/YFL4/3Z9/P9lau//LyX7/5KU8//g6Oj/4u7o//P06v/39O///Prw//v48P/79/L/+vXy//j0 - 8//48/T/9vT0//b09P/28vj/9PD2//Lu9P/y7vP/8/Dy//bx8v/28vH/9fHw/+7t9//s7fH/7PDr/+vx - 7P/q7+7/5+vs/+fr7P/p7u3/6enp/+np6f/n5+f/5eXl/+Pj4//h4eH/39/f/93d3f/g4OD/39/f/9bW - 1v+3t7e/AAAAEwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAD7+/tG/////////////////////////////////+Xf//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//j3P///////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////n3//+5 - p///bEf//zMA//8zAP//MwD//zMA//8zAP//Pw///+zn/////////////////////////////////9LS - 0v/R0dH/8PDw//r6+v/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//f39//39 - /f/7+/v/+vr6//v7+//5+fn/8/Pz//Tz9//x8eX/1Nfc/25q6P87OP//eHD5/1NS7v9GPvf/VUz//1RR - +/8iHer/kZGj/5icp/+oo6L/nKKh/5+jqP+HlKL/T0XO/zss//9COv//Qzr//0A/+f9TWPD/fHv//2NY - +v8qGvT/pqnt/+zr9f/y8fX/+fX7//P4+//w8/j/8vX5//H0+P/z9Pj/8vP3//Py9v/18fb/9fH2//fx - 9v/x9fD/8fTy//Dy8//w8fX/8PH1/+/x8f/u8u3/7vPq/+3w7v/t7/D/7e7y/+zr7//u7e//7e3t/+/r - 8P/s5/D/6enp/+jo6P/n5+f/5eXl/+Pj4//i4uL/39/f/93d3f/g4OD/39/f/9bW1v+2trbAAAAAEwAA - AAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAD///8///////////////////////////////////z7//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//NQP//9LH//////////////////////////////////////////////////// - ///////////////////////////////////////////////c0///j3P//0IT//8zAP//MwD//zMA//8z - AP//MwD//zMA//81A///z8P//////////////////////////////////////9DQ0P/c3Nz/9fX1//v7 - +//8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//39/f/9/f3//f39//7+ - /v/+/v7/+/v7//Hx8f/39vL/4drn/7i93P8uIvb/XmXy/2Jl8P9HPOz/SD///2Nc//8yKvP/bW25/46R - oP+ckZn/kZWa/4KNqP9LR9b/MSby/0Q6//9KRfr/PDj1/19f8/97fPb/WVr4/1pX6f/R0e//4+L2/+zt - 9//58vX//Prv//Lv+P/v9/b/9PT6//T0+v/09fn/8fX2//H29f/x9vX/8Pb1//D29f/z8vb/8/L0//Ly - 8v/x8u7/8fLu//Dy7P/x8+3/8fPt//Hv7//y8e3/9PXs/+7v5v/v8Of/7u7o//Dv6//t7Oj/6enp/+np - 6f/n5+f/5eXl/+Pj4//i4uL/39/f/93d3f/g4OD/39/f/9bW1v+2trbAAAAAEwAAAAUAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACfn58Bn5+fAZ+fnwH19fUj//////// - //////////////////////////////81A///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//1In///59/////////////////////////////////////////////////////////////// - ///////////////18///r5v//183//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zUD//+8 - q////////////////////////////////////////f39/9PT0//o6Oj/+Pj4//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz/+/v7//z8/P/9/f3//Pz8//v7+//8/Pz//Pz8//f2 - +P/n5+3/7Ojn/9TZ4v9kXuv/O0j+/3F07v9WR/b/RTv//1pM//9bS/f/NTfR/42Njf+RjIv/jo6O/1NK - wv8sI///REL5/0Q//v8+Nvn/ZWD3/3Jv//9VUPP/Wlby/9fb4P/a4fL/9PT6//v39v/6+fX/9fL0//v6 - 8P/9+Pf/+fj0//n58//7+PP/+vfy//r38v/79vP/+vXy//r19P/08vH/9PLx//Ty8f/08vL/9PHz//Tw - 9f/x7/X/8O70//Tz7//x7vD/8O70/+3q8//v7fP/6evs/+rs7P/p6+v/6enp/+np6f/n5+f/5eXl/+Pj - 4//h4eH/39/f/9zc3P/g4OD/39/f/9bW1v+2trbAAAAAEwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAn5+fAp+fnwefn58Mn5+fEp+fnxfPz882//////////////////////// - //////////////9MH///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//+P - c///////////////////////////////////////////////////////////////////0sf//4Vn//88 - C///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//6yX//////////////////// - ////////////////////////5OTk/+Tk5P/09PT/+/v7//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7/+r2+P/78u//7unm/+fp - 6f+vruD/LCb7/29u8/9bXPL/STbx/01I9/9TXPr/KCXs/2Z3nv+Dh5r/QEHP/ycf//9GQv//RkP3/z02 - /f9XXun/eX30/1dG//9iYeb/6eLl/+vr6//z8/P/+Pj4//b29v/09PT/9vb2//j4+P/39/f/9vb2//b2 - 9v/29vb/9vb2//X19f/19fX/9fX1//X19f/09PT/9PT0//T09P/z8/P/8/Pz//Ly8v/x8fH/8fHx//Dw - 8P/w8PD/7+/v/+/v7//u7u7/7e3t/+zs7P/r6+v/6enp/+jo6P/n5+f/5eXl/+Pj4//g4OD/3t7e/9zc - 3P/f39//3t7e/9XV1f+3t7fAAAAAEwAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwKfn58Gn5+fB5+f - nwufn58Rn5+fHZ+fny2fn58/n5+fUZ+fn2Kfn590//////////////////////////////////////9Z - L///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//81A///z8P///////// - ////////////////////////////////////7+v//6WP//9VK///MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//oov///////////////////////////////////////// - ///6+vr/39/f//Ly8v/6+vr//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//X6+//9+vX/7ubx/93h3P/T0e7/UE7j/09Q - /v9paPT/TUXw/0pB//9WU///PDL//0dLwf9NT7X/MR34/zs8+P9FO///Pjf+/1ZQ9f9ydf//WVP//1hW - 7//g2e7/4+v4//Hx8f/29vb/+Pj4//f39//29vb/+Pj4//j4+P/39/f/9vb2//b29v/29vb/9vb2//X1 - 9f/19fX/9fX1//X19f/09PT/9PT0//Pz8//z8/P/8/Pz//Ly8v/x8fH/8fHx//Dw8P/w8PD/7+/v/+/v - 7//u7u7/7e3t/+zs7P/r6+v/6enp/+jo6P/n5+f/5eXl/+Pj4//g4OD/3t7e/9zc3P/f39//3t7e/9XV - 1f+3t7fAAAAAEwAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAACfn58Bn5+fA5+fnwefn58Mn5+fFJ+fnx6fn58qn5+fNJ+fnz+fn59Ln5+fXZ+f - n3Kfn5+Hn5+fnZ+fn7Ofn5/H+/v7/f////////////////////////////////9lP///MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//TB////Xz//////////////////// - /////////8m7//95V///OQf//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//+Mb/////////////////////////////////////////////39/f/k5OT/8fHx//r6 - +v/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8///9/f/y8/f/9PLy/+fq4f/h3u3/l57X/yYm//9wbvb/VlP8/z84 - 9f9PR///VVL1/yUV9v8aEvP/Ni35/0M///8/M///TUb1/3B0+P9gV/v/IhXz/8XK4//q79r/6PD9//b2 - 9v/39/f/+Pj4//j4+P/4+Pj/+fn5//j4+P/29vb/9vb2//b29v/29vb/9vb2//X19f/19fX/9fX1//X1 - 9f/09PT/9PT0//Pz8//z8/P/8vLy//Ly8v/x8fH/8fHx//Dw8P/w8PD/7+/v/+/v7//u7u7/7Ozs/+zs - 7P/r6+v/6enp/+np6f/n5+f/5eXl/+Pj4//h4eH/3t7e/9zc3P/f39//3t7e/9XV1f+3t7fAAAAAEwAA - AAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACfn58Cn5+fCZ+f - nw+fn58Un5+fG5+fnyWfn580n5+fR5+fn12fn592n5+fjp+fn6Wfn5+4n5+fxp+fn9Gfn5/Yn5+f4aen - p+u+vr71+Pj4/v////////////////////////////////95V///MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//4lr/////////////+nj//+cg///TB///zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//3xb//// - /////////////////////////////////////////v7+/+fn5//v7+//+fn5//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//32+f/19///9v3u/+zt4//f3uj/z9Hb/ycj5v9WVfn/ZWjz/0M97v9IQP//ZFr//ygf - //8QFf7/RD7//z0z//9JP/D/bG/v/21x9f8kE/7/sbTr/+Ha5//p8PP/9/j0//b29v/29vb/9vb2//j4 - +P/5+fn/+Pj4//f39//39/f/9vb2//b29v/29vb/9fX1//X19f/19fX/9fX1//X19f/09PT/8/Pz//Pz - 8//z8/P/8vLy//Ly8v/x8fH/8fHx//Dw8P/v7+//7+/v/+7u7v/t7e3/7Ozs/+vr6//r6+v/6urq/+np - 6f/n5+f/5eXl/+Pj4//h4eH/3t7e/9zc3P/f39//3t7e/9XV1f+3t7fAAAAAEwAAAAYAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAn5+fA5+fnw2fn58dn5+fNJ+fn0qfn59en5+fcJ+f - n4Gfn5+Sn5+foJ+fn7Cfn5/Cn5+f0p+fn+Gjo6Ptt7e398vLy/zg4OD99fX1//////////////////// - //////////////////////////////+CY///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//+ii///b0v//zUD//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//dVP///z7//////////////////// - ////////////////////////5+fn/+3t7f/4+Pj//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//f39//39 - /f/9/f3//f39//39/f/9/f3//f39//39/f/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//75 - +v/2+ff/+f34//n27v/e5ej/4tzn/4F+5f80Lv//bG/p/1RO+/9BOvX/XU7//0RK+/8ZHvz/PjH//z08 - 6v9xZvj/cHnh/zEp//+Aiuj/6d/r/+3t7f/x8Pr/9/j0//X19f/29vb/9/f3//n5+f/5+fn/9/f3//f3 - 9//39/f/9vb2//b29v/29vb/9fX1//X19f/19fX/9fX1//T09P/09PT/8/Pz//Pz8//y8vL/8vLy//Hx - 8f/x8fH/8fHx//Dw8P/v7+//7+/v/+7u7v/t7e3/7Ozs/+vr6//r6+v/6enp/+jo6P/n5+f/5eXl/+Pj - 4//h4eH/3t7e/9zc3P/f39//3t7e/9XV1f+4uLjFAAAAEwAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAJ+fnwGfn58Hn5+fGZ+fnzSfn59Wn5+feJ+fn5Wfn5+vn5+fxZ+fn9efn5/joKCg6bKy - svHHx8f42tra/e3t7f////////////////////////////////////////////////////////////// - //////////////+Zf///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//9iO///9fP///////////////////////////////////////// - ///o6Oj/7e3t//j4+P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//f39//39/f/9/f3//f39//39 - /f/9/f3//f39//39/f/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//r99P//////9ff4//bu - 9f/m7u7/4t/h/7m31f8qI/D/ZGHz/11Y+f9COe3/UUb6/1JV/v8pHP//OC/x/1Vb8P+HfPr/Pzz2/1xp - 6//W0uX/4ebl//n19P/49fH/9vr1//f39//4+Pj/+vr6//r6+v/5+fn/9/f3//f39//4+Pj/9vb2//b2 - 9v/19fX/9fX1//X19f/19fX/9PT0//T09P/09PT/8/Pz//Pz8//y8vL/8vLy//Hx8f/x8fH/8fHx/+/v - 7//v7+//7+/v/+7u7v/t7e3/7Ozs/+vr6//r6+v/6enp/+jo6P/n5+f/5eXl/+Pj4//g4OD/3t7e/9zc - 3P/f39//3t7e/9XV1f+7u7vMAAAAEwAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAn5+fAp+f - nwufn58hn5+fTp+fn4Gfn5+yn5+fzp+fn96tra3rv7+/9tbW1vvp6en+/Pz8//////////////////// - //////////////////////////////////////////////////////////////////////////////+l - j///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//1Ur///18////////////////////////////////////////////+zs7P/r6+v/+Pj4//v7 - +//8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//f39//39/f/9/f3//f39//39/f/9/f3//f39//39 - /f/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//3/+f/5+f//+Pn1//fz/v/q6e3/5+nj/9HP - 2/9XWd3/SUT9/2Jj8/9RRfH/SD3//1FR//8+OPX/Myf7/29z//9eXu7/KR3z/8TH3P/b4dz/6+3u//L0 - 9f/79fb/+fzz//f39//5+fn/+vr6//n5+f/4+Pj/9/f3//f39//39/f/9vb2//b29v/19fX/9fX1//X1 - 9f/19fX/9PT0//T09P/09PT/8/Pz//Pz8//y8vL/8fHx//Hx8f/x8fH/8fHx/+/v7//v7+//7+/v/+7u - 7v/t7e3/7Ozs/+vr6//q6ur/6enp/+jo6P/m5ub/5eXl/+Li4v/g4OD/3d3d/9zc3P/f39//3t7e/9XV - 1f+7u7vMAAAAEwAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACfn58Dn5+fEZ+fnzOfn59ln5+fmbq6 - utLR0dHy4+Pj/Pj4+P////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////+yn///MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//Uif//+zn//// - ////////////////////////////////////////7e3t/+rq6v/39/f//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//33///4//n/+Pn3/+vw8f/y6ez/4eLm/8zP3f+OmdP/Ih/+/2dv - 8v9hVPD/Ozvz/09N//9OTPn/HhH5/25z9P8YHf//mpnZ/87J3v/f4eL/6uzs//H17//39f//+/T3//b2 - 9v/4+Pj/+Pj4//f39//39/f/9/f3//f39//39/f/9vb2//X19f/19fX/9fX1//X19f/19fX/9PT0//T0 - 9P/09PT/8/Pz//Pz8//y8vL/8fHx//Hx8f/x8fH/8fHx/+/v7//v7+//7+/v/+7u7v/t7e3/7Ozs/+vr - 6//q6ur/6Ojo/+jo6P/m5ub/5OTk/+Li4v/g4OD/3d3d/9vb2//f39//3t7e/9XV1f+6urrNAAAAEwAA - AAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACfn58Kn5+fLKKiomjJycnJ7+/v+P////////////////// - //////////////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////Ft///MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//9FF///4tv///////////////////////// - ///////////////////w8PD/6Ojo//b29v/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z9+//8/Pz/+fn5//T09P/x8fH/5ubm/9fX1//CwcP/HxT3/1td8f9YXfX/PDnz/1JE - /v9gWv//Jx3//zE9+/9rWdz/vsLD/+Db2v/d4eL/5vHn//f17f/89fj/9vr1//j4+P/4+Pj/+Pj4//j4 - +P/4+Pj/9/f3//f39//39/f/9vb2//b29v/29vb/9vb2//X19f/09PT/9PT0//Pz8//z8/P/8/Pz//Ly - 8v/x8fH/8fHx//Hx8f/w8PD/8PDw/+/v7//v7+//7u7u/+3t7f/t7e3/7Ozs/+vr6//q6ur/5+fn/+fn - 5//m5ub/5OTk/+Hh4f/f39//3d3d/93d3f/e3t7/3d3d/9bW1v+6urrNAAAAFAAAAAYAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAJ+fnwKfn58Uo6OjUOrq6tz///////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////n3///Pw///pY///3VT//9JG///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zwL///f1/////////////////////////////////////////////Pz - 8//n5+f/9fX1//v7+//8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z9 - +//7+/v/+fn5//X19f/y8vL/5ubm/9jY2P/FxMb/XGTf/0M5/f9hZfP/Uk3u/0U7//9YUv//Qjj//xYY - +f+dmdv/xcrT/9XZ1P/f3+X/7e7s//z3+f/9+Pn/8vf1//j4+P/4+Pj/+Pj4//j4+P/4+Pj/9/f3//f3 - 9//39/f/9vb2//b29v/29vb/9vb2//X19f/09PT/9PT0//Pz8//z8/P/8vLy//Ly8v/x8fH/8fHx//Hx - 8f/w8PD/8PDw/+/v7//u7u7/7u7u/+3t7f/t7e3/7Ozs/+rq6v/q6ur/5+fn/+fn5//m5ub/5OTk/+Hh - 4f/f39//3d3d/9zc3P/e3t7/3d3d/9bW1v+6urrNAAAAFAAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+f - nwSfn58c6enpv/////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////4tv//7Wj//+Ja///XDP//zUD//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//PAv//8/D////////////////////////////////////////////8/Pz/+fn5//09PT/+/v7//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z9+//6+vr/+Pj4//T0 - 9P/x8fH/5OTk/9nZ2f/Ix8n/jprE/y4e+P9iZfD/ZFrt/zs1+P9NSvr/X1j9/xYT+f+mrcD/vsfU/9Pe - 1P/t6PH/8+nv//vx/f/4+ff/9vv6//j4+P/4+Pj/+Pj4//j4+P/4+Pj/9/f3//f39//29vb/9vb2//b2 - 9v/29vb/9vb2//X19f/09PT/9PT0//Pz8//z8/P/8vLy//Ly8v/x8fH/8fHx//Hx8f/w8PD/8PDw/+/v - 7//u7u7/7u7u/+3t7f/s7Oz/6+vr/+rq6v/p6en/5+fn/+fn5//l5eX/5OTk/+Hh4f/f39//3d3d/9zc - 3P/e3t7/3d3d/9bW1v+6urrNAAAAFAAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwXw8PB///////// - //////////////////////////////////////////////////////////////////////////////// - //////////Lv///Ft///nIP//29L//8/D///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//81A///wrP///////// - ///////////////////////////////////39/f/5ubm//T09P/7+/v//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//3+/P/6+vr/9/f3//Pz8//u7u7/4ODg/9bW - 1v/JyMr/qKu6/zgy4/9XVvL/aF7x/z868/9JRfz/Ylj+/yso+f+Kj8b/vMfP/9Pay//o4uf/7ebt//nx - /P/29vb/9Pn4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/9/f3//f39//29vb/9vb2//b29v/29vb/9fX1//X1 - 9f/09PT/9PT0//Pz8//y8vL/8vLy//Ly8v/x8fH/8fHx//Dw8P/w8PD/7+/v/+/v7//u7u7/7e3t/+3t - 7f/s7Oz/6+vr/+rq6v/p6en/6Ojo/+fn5//l5eX/4+Pj/+Hh4f/f39//3d3d/9zc3P/e3t7/3d3d/9bW - 1v+6urrNAAAAFAAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwb9/f3k//////////////////////// - ///////////////////////////////////////////////8+///2c///6mT//9/X///Uif//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//+5p/////////////////////////////// - //////////////n5+f/h4eH/8vLy//n5+f/7+/v/+/v7//v7+//7+/v/+/v7//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//3+/P/6+vr/+Pj4//T09P/t7e3/3t7e/9PT0//FxMb/sLO3/0hN - 0v88Nfr/aWbx/09G9P9JQf//Ukn//0g///9XT+L/usPM/9zZy//f3d3/5urr//X19f/39Pb/9Pf1//j4 - +P/4+Pj/+Pj4//j4+P/39/f/9/f3//b29v/29vb/9vb2//b29v/29vb/9fX1//X19f/09PT/8/Pz//Pz - 8//y8vL/8vLy//Hx8f/x8fH/8PDw//Dw8P/v7+//7+/v/+7u7v/u7u7/7e3t/+zs7P/s7Oz/6+vr/+rq - 6v/p6en/6Ojo/+bm5v/l5eX/4+Pj/+Hh4f/f39//3d3d/9zc3P/e3t7/3d3d/9bW1v+6urrNAAAAFAAA - AAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAPn5+VD///////////////////////////////////////////// - /////////+nj//+/r///j3P//2I7//88C///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//6WP////////////////////////////////////////////+Pj4/9XV - 1f/n5+f/+Pj4//v7+//7+/v/+/v7//v7+//7+/v/+/v7//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z9+//6+vr/+fn5//b29v/v7+//3t7e/9DQ0P/Av8H/qa2y/zo53f8cEv//Zmvv/1tR - 8f9EPvv/SEj//15S//8qG/P/pq7M/+HY1P/h39//5Ozr/+/z7f/48/X/9/f3//f39//4+Pj/+Pj4//j4 - +P/39/f/9/f3//b29v/29vb/9vb2//b29v/19fX/9fX1//X19f/09PT/8/Pz//Pz8//y8vL/8vLy//Hx - 8f/x8fH/8PDw/+/v7//v7+//7+/v/+7u7v/t7e3/7e3t/+zs7P/s7Oz/6+vr/+np6f/p6en/6Ojo/+bm - 5v/k5OT/4+Pj/+Hh4f/f39//3d3d/9vb2//e3t7/3d3d/9bW1v+9vb3ZAAAAFAAAAAYAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAP39/Z7//////////////////////////////////////7mn//91U///SRv//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//j3P////////////////////////////////////////////7+/v/wMDA/8rKyv/j4+P/9PT0//r6 - +v/7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//r7 - +f/5+fn/+Pj4//Pz8//s7Oz/3Nzc/87Ozv+9vL7/mJu3/yEW9v8KBv//WVj0/2Na8P89Puz/Q0f5/2JY - //8yJP7/h4vS/8vK0//d2d7/5Ono/+zw6//z9PL/9fT2//f39//39/f/9/f3//f39//39/f/9/f3//b2 - 9v/29vb/9vb2//X19f/19fX/9fX1//X19f/09PT/8/Pz//Pz8//x8fH/8fHx//Hx8f/x8fH/8PDw/+/v - 7//v7+//7+/v/+7u7v/t7e3/7e3t/+zs7P/r6+v/6+vr/+np6f/o6Oj/6Ojo/+bm5v/k5OT/4+Pj/+Hh - 4f/f39//3d3d/9vb2//e3t7/3d3d/9bW1v+9vb3ZAAAAFAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7+ - /qH/////////////////////////////////r5v//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//98W/////////////// - //////////////////////////////z8/P+1tbX/p6en/7a2tv/Q0ND/5+fn//X19f/7+/v/+/v7//v7 - +//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//r7+f/4+Pj/9PT0/+7u - 7v/o6Oj/2tra/83Nzf+8u73/jY66/xEL/v8DDfX/STv3/25n+P8/RO3/REH//1xT/f9DPvj/a27W/7jA - 0f/d1+L/6Obm/+rs7P/z+O//9vT6//f39//39/f/9/f3//f39//39/f/9/f3//b29v/29vb/9fX1//X1 - 9f/19fX/9fX1//T09P/09PT/8/Pz//Pz8//x8fH/8fHx//Hx8f/x8fH/8PDw/+/v7//v7+//7+/v/+7u - 7v/t7e3/7Ozs/+zs7P/r6+v/6urq/+np6f/o6Oj/6Ojo/+bm5v/k5OT/4+Pj/+Hh4f/f39//3d3d/9vb - 2//e3t7/3d3d/9bW1v+9vb3ZAAAAFAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7+/oX///////////// - ////////////////////zL///zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//9iO////Pv///////////////////////// - ///////////////////Gxsb/oaGh/6ioqP+6urr/0dHR/+fn5//09PT/+vr6//v7+//7+/v/+/v7//v7 - +//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7 - +//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//X6/f/69vX/9PDv/+nr6//a4dr/29fd/9TK - 2/+3uLT/aXPR/yAZ9v8UEv7/IR79/3Fo9P9LUvX/NTXz/1ZN//9WT/j/JBL//7a71P/U29T/5uHe/+rp - 6//z8fD/8/L2//n5+f/4+Pj/9/f3//b29v/39/f/9/f3//f39//29vb/9fX1//T09P/09PT/8/Pz//T0 - 9P/z8/P/8/Pz//Pz8//y8vL/8vLy//Hx8f/w8PD/8PDw/+/v7//v7+//7u7u/+7u7v/t7e3/7e3t/+zs - 7P/r6+v/6urq/+rq6v/p6en/5+fn/+bm5v/l5eX/4+Pj/+Hh4f/f39//3Nzc/9vb2//e3t7/3t7e/9TU - 1P++vr7aAAAAFQAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///4D///////////////////////////// - /////////9zT//+Ve///aUP//zwL//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//dVP///z7//////////////////////////////////// - ///9/f3/vr6+/6Ghof+oqKj/ubm5/9TU1P/p6en/9fX1//r6+v/7+/v/+/v7//v7+//7+/v/+/v7//v7 - +//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7 - +//7+/v/+/v7//v7+//7+/v/+/v7//X5+v/9+fj/9vHy/+jq6v/a4dr/19TW/8vE0f+wtbT/SUnd/ykk - +/8hIf3/HBP9/2Zb8f9TVvj/OTnx/05H/P9aVvz/Jxb//6Wq0f/P1tP/5eLe/+np6f/w7/H/9fX1//f3 - 9//29vb/9vb2//b29v/39/f/9/f3//b29v/29vb/9PT0//T09P/z8/P/8/Pz//Pz8//z8/P/8/Pz//Ly - 8v/y8vL/8fHx//Hx8f/w8PD/8PDw/+/v7//u7u7/7u7u/+3t7f/t7e3/7e3t/+zs7P/r6+v/6urq/+rq - 6v/p6en/5+fn/+bm5v/k5OT/4uLi/+Dg4P/e3t7/3Nzc/9ra2v/e3t7/3t7e/9TU1P++vr7aAAAAFQAA - AAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///y////////////////////////////////////////////// - ///////////////Zz///r5v//4Jj//9VK///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//4Jj/////////////////////////////////////////////f39/7W1 - tf+hoaH/qqqq/7u7u//U1NT/6urq//b29v/6+vr/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7 - +//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7 - +//7+/v/+/v7//H29f/6+Pf/9/L0/+jq6v/f497/2dfW/8jHy/+usr3/Ihns/zUx//8zM/v/IBX//1dN - 9P9eXvj/QT3w/0VB+P9bV/3/NCT//4qL1f/Fz8//4d7a/+fo5v/v7fP/9/nz//X19f/19fX/9vb2//b2 - 9v/29vb/9vb2//b29v/19fX/9PT0//T09P/z8/P/8/Pz//Pz8//z8/P/8/Pz//Ly8v/x8fH/8fHx//Hx - 8f/w8PD/7+/v/+/v7//u7u7/7u7u/+3t7f/t7e3/7Ozs/+zs7P/r6+v/6urq/+np6f/p6en/5ubm/+Xl - 5f/k5OT/4uLi/+Dg4P/e3t7/3Nzc/9ra2v/d3d3/3t7e/9TU1P++vr7aAAAAFQAAAAcAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAD///+v//////////////////////////////////////////////////////// - ////////////////////9fP//8m7//+cg///b0v//0IT//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//+Mb/////////////////////////////////////////////r6+v+ysrL/oqKi/6qq - qv++vr7/1dXV/+vr6//29vb/+vr6//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7 - +//7+/v/+/v7//v7+//7+/v/+/v7//v7+//6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//T5 - +P/6+Pf/9fL0/+Xn5//a3dv/09PN/7vAv/+Ynb7/Ewr7/zw5//89OPf/Myz//0Q6+P9mZvb/S0Xy/0I9 - /P9UUP3/Rjv//2li4f++y83/2dfX/+bn5f/v7PX/9fjv//X19f/19fX/9fX1//b29v/29vb/9vb2//X1 - 9f/19fX/9PT0//Pz8//z8/P/8/Pz//Pz8//z8/P/8vLy//Ly8v/x8fH/8fHx//Dw8P/w8PD/7+/v/+7u - 7v/u7u7/7e3t/+3t7f/s7Oz/7Ozs/+vr6//q6ur/6urq/+np6f/p6en/5ubm/+Xl5f/k5OT/4uLi/+Dg - 4P/e3t7/3Nzc/9vb2//d3d3/3d3d/9TU1P++vr7aAAAAFQAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAD///8v//////////////////////////////////////////////////////////////////////// - ///////////////////////////////i2///taP//4xv//9cM///NQP//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//pY/////////////////////////////////////////////29vb/rq6u/6Ghof+rq6v/vr6+/9ra - 2v/s7Oz/9/f3//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7 - +//7+/v/+/v7//v7+//6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//T29v/z8fD/8Ozx/+Ll - 4//a2tr/09TL/7vDw/+IiMj/GBj//0E9//89NfT/SUj2/ywj9f9laPP/VE30/0M7/v9NSv7/U079/0c4 - 7f+2xs3/09PZ/+Xm5P/p6u7/9PTu//b29v/29vb/9vb2//b29v/19fX/9fX1//X19f/09PT/8/Pz//Pz - 8//y8vL/8vLy//Ly8v/y8vL/8vLy//Hx8f/x8fH/8PDw//Dw8P/v7+//7u7u/+7u7v/t7e3/7e3t/+zs - 7P/s7Oz/6+vr/+vr6//q6ur/6enp/+np6f/o6Oj/5+fn/+Xl5f/k5OT/4uLi/+Dg4P/e3t7/3Nzc/9vb - 2//c3Nz/3d3d/9TU1P++vr7aAAAAFQAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////r/// - //////////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////+ff//8/D//+lj///dVP//0kb//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//6+b//// - ////////////////////////////////////////9PT0/6ioqP+jo6P/ra2t/8DAwP/Z2dn/7u7u//j4 - +P/7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//r6 - +v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//f5+f/08vH/7ezw/+Pn4v/c2dv/1dLN/7nB - yP9xbdL/Iif4/z87//8/NPT/V1vw/xoV9P9cYPX/WlX4/z429f9JRf//WFX4/y8f9v+os9P/1Nbe/+Tl - 4//m6Oj/8/Hx//X19f/29vb/9vb2//X19f/19fX/9PT0//T09P/09PT/8/Pz//Ly8v/y8vL/8vLy//Ly - 8v/y8vL/8fHx//Hx8f/w8PD/8PDw/+/v7//v7+//7u7u/+3t7f/t7e3/7e3t/+zs7P/s7Oz/6+vr/+rq - 6v/p6en/6enp/+jo6P/o6Oj/5+fn/+Xl5f/j4+P/4eHh/+Dg4P/e3t7/3d3d/9zc3P/c3Nz/3Nzc/9PT - 0//AwMDhAAAAFQAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////D////3/////v//////// - //////////////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////s5///v6///49z//9cM///MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zUD//+8q/////////////// - //////////////////////////////Dw8P+mpqb/o6Oj/66urv/Dw8P/2tra/+7u7v/4+Pj/+vr6//r6 - +v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/5+fn/+fn5//n5 - +f/5+fn/+fn5//n5+f/5+fn/+fn5//b4+f/z9PL/6+rs/+Lm4P/c2N3/0c7K/7C4yf9cUdf/LC/2/0A5 - //9FPPf/Xl7y/xIQ9v9NUPn/XFv3/0Q47v9FQ///WVL5/ywi/v+Sldn/1NjZ/+Ti4f/k6ej/9PD1//T0 - 9P/09PT/9fX1//X19f/09PT/9PT0//Pz8//z8/P/8/Pz//Ly8v/y8vL/8vLy//Ly8v/y8vL/8fHx//Hx - 8f/w8PD/8PDw/+/v7//u7u7/7u7u/+3t7f/t7e3/7Ozs/+zs7P/r6+v/6+vr/+rq6v/p6en/6Ojo/+jo - 6P/o6Oj/5ubm/+Xl5f/j4+P/4eHh/9/f3//e3t7/3Nzc/9vb2//c3Nz/3Nzc/9PT0//AwMDmAAAAFQAA - AAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8X////j/////f///////////// - //////////////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////Cs///MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//81A///z8P///////////////////////// - ///////////////////o6Oj/pKSk/6Ojo/+vr6//w8PD/97e3v/v7+//+Pj4//r6+v/6+vr/+vr6//r6 - +v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/5+fn/+fn5//n5+f/5+fn/+fn5//n5 - +f/5+fn/+fn5//b4+f/4+ff/7ezu/+Pn4f/g2eD/z8rL/62zyv9PQdz/ODf9/0I6//9JQvf/XFf2/w4Q - +P89P/v/XWD4/0xD7f9BQPz/W1D//zQv//+AfNv/0NfU/+Lg3//n7Ov/9vL4//Ly8v/z8/P/9PT0//X1 - 9f/09PT/9PT0//Pz8//z8/P/8vLy//Ly8v/y8vL/8fHx//Ly8v/x8fH/8fHx//Dw8P/w8PD/7+/v/+/v - 7//u7u7/7u7u/+3t7f/s7Oz/7Ozs/+zs7P/r6+v/6+vr/+rq6v/p6en/6Ojo/+jo6P/n5+f/5ubm/+Xl - 5f/i4uL/4ODg/9/f3//d3d3/3Nzc/9vb2//b29v/3Nzc/9PT0//AwMDmAAAAFQAAAAcAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///w////9H////gP///7T////v//////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////+yn///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//PAv//9LH//////////////////////////////////// - ////////5OTk/6Ghof+kpKT/r6+v/8TExP/c3Nz/7+/v//f39//5+fn/+fn5//n5+f/5+fn/+vr6//r6 - +v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//Xz - 8//w8vP/8+3y/+Lk5f/T1tT/zM3E/769x/8hJPv/Qzn//zs99v9US/n/TU35/xoW8f8tNvH/YWTv/1BF - 9f9BO/7/VUv//0M//P9ZWvL/zc7S/+Lc3f/g5uH/7uvt//Pz8//z8/P/9PT0//T09P/09PT/8/Pz//Pz - 8//x8fH/8PDw//Dw8P/u7u7/7e3t/+vr6//s7Oz/7Ozs/+7u7v/v7+//7+/v/+7u7v/u7u7/7e3t/+3t - 7f/s7Oz/7Ozs/+rq6v/q6ur/6urq/+np6f/p6en/6Ojo/+fn5//m5ub/5eXl/+Tk5P/i4uL/4eHh/9/f - 3//d3d3/29vb/9nZ2f/b29v/29vb/9PT0//BwcHmAAAAFgAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////I////1v///+T////zP// - //v///////////////////////////////////////////////////////////////////////////// - //////////////+ii///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//0UX///f1////////////////////////////////////////////9/f - 3/+goKD/pKSk/7CwsP/Hx8f/39/f//Dw8P/4+Pj/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5 - +f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n39//w8vL/8Ovt/+Di - 4//V2Nb/zs7I/7y6xv8aHPb/Qzv+/zs7+f9XT/b/SEj4/ygm6v8nK/b/Y2Ty/1NL9v8/Ovv/UUn//0M/ - /P9PUO7/y8vR/+Db3P/i6OP/7+zu//T09P/09PT/9PT0//T09P/z8/P/8fHx/+3t7f/p6en/5ubm/+Tk - 5P/h4eH/3t7e/9zc3P/e3t7/4uLi/+np6f/s7Oz/7u7u/+7u7v/t7e3/7e3t/+zs7P/s7Oz/6+vr/+rq - 6v/q6ur/6enp/+np6f/o6Oj/5+fn/+bm5v/m5ub/5eXl/+Tk5P/i4uL/4ODg/9/f3//d3d3/2tra/9nZ - 2f/b29v/29vb/9PT0//BwcHmAAAAFgAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wf///87////b/// - /6v////f//////////////////////////////////////////////////////////////////////+Z - f///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//9FF///7Of////////////////////////////////////////////V1dX/oKCg/6Sk - pP+ysrL/yMjI/+Pj4//y8vL/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5 - +f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//r49//x8/P/8Ovs/+Di4v/V2Nb/zs3J/7q3 - x/8UFPT/RD77/zs6//9fVfX/PUH4/zs+3P8aGfj/ZGD1/1dS9f88N/b/Tkb//0VC/P9BQev/zMrQ/9zZ - 2//m6uX/7+vw//T09P/09PT/8/Pz//Pz8//w8PD/6urq/9/f3//R0dH/yMjI/8PDw/+/v7//urq6/7m5 - uf+9vb3/ycnJ/9ra2v/m5ub/6+vr/+3t7f/s7Oz/7Ozs/+vr6//r6+v/6+vr/+rq6v/p6en/6enp/+jo - 6P/n5+f/5ubm/+bm5v/m5ub/5OTk/+Pj4//i4uL/4ODg/97e3v/c3Nz/2tra/9nZ2f/b29v/29vb/9PT - 0//AwMDmAAAAFgAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////F/// - /0////+H////vP////P///////////////////////////////////////////9/X///MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zUD//+5p///iWv//z8P//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//Uif//+zn////////////////////////////////////////////z8/P/6CgoP+mpqb/tra2/9DQ - 0P/m5ub/9vb2//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/4+Pj/+Pj4//j4 - +P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j38//x9PL/8+/u/+Lk5P/V2Nb/zcvK/7m0yf8SEfX/RkH7/zs4 - //9jWvH/MzX3/05Vyv8UD/T/Xljz/1dW8v88NvP/SUL9/0pI//81Muz/zcrT/9rZ2//n6+b/7enu//Pz - 8//z8/P/8/Pz//Hx8f/p6en/2tra/8jIyP+6urr/sbGx/6ysrP+oqKj/paWl/6Wlpf+np6f/s7Oz/8TE - xP/V1dX/4uLi/+rq6v/s7Oz/7Ozs/+vr6//r6+v/6urq/+rq6v/p6en/6Ojo/+fn5//m5ub/5ubm/+bm - 5v/m5ub/5OTk/+Pj4//h4eH/4ODg/97e3v/c3Nz/2tra/9jY2P/b29v/2tra/9PT0//AwMDmAAAAFgAA - AAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAD///8v/v7+6v////////////////////////////////95V///MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//5l///////////////n3//+5p///ZT///zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//183///1 - 8////////////////////////////////////////////8nJyf+goKD/qamp/729vf/Y2Nj/7+/v//f3 - 9//4+Pj/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4 - +P/4+Pj/+Pj4//f28v/w8/H/9PDv/+Tm5v/W2df/z83N/7u1zP8SD/j/Q0D6/zs4//9kW/H/LSz4/1tk - vv8bFOv/WE71/1hZ7/89OPL/R0L8/05J//8nJPD/zcnU/9fa3v/m6uX/6+fs//Ly8v/y8vL/8fHx/+rq - 6v/b29v/xMTE/7i4uP/Nzc3/3Nzc/9zc3P/Pz8//ycnJ/6ampv+fn5//pKSk/66urv+/v7//0dHR/+Hh - 4f/p6en/6+vr/+vr6//q6ur/6urq/+rq6v/p6en/6Ojo/+fn5//m5ub/5ubm/+bm5v/m5ub/4+Pj/+Li - 4v/h4eH/39/f/93d3f/b29v/2dnZ/9jY2P/a2tr/2dnZ/9LS0v/AwMDmAAAAFgAAAAcAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACfn58E////+P// - //////////////////////////////9lP///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//WS////z7/////////////////////////////+Xf//+Sd///SRv//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//9iO////Pv///////// - //////////////////////////////39/f+9vb3/o6Oj/6+vr//Ly8v/6Ojo//T09P/4+Pj/+Pj4//j4 - +P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f1 - 9P/w8/H/8+/u/+Pl5f/X2tj/0tDQ/7640f8SD/n/Qz79/zw4+/9fWvH/LSb5/2FruP8sKd3/UUX3/1pb - 8f8/OvP/RED9/05K//8bFvP/zcnU/9Xc3//m5+P/7Ojt//Hx8f/x8fH/6+vr/93d3f/S0tL/7e3t//// - //////////////////////////////z8/P/V1dX/ra2t/6Ojo/+srKz/vLy8/8/Pz//h4eH/6enp/+vr - 6//q6ur/6urq/+np6f/p6en/6Ojo/+fn5//m5ub/5ubm/+Xl5f/l5eX/4+Pj/+Li4v/g4OD/3t7e/93d - 3f/b29v/2NjY/9fX1//Z2dn/2NjY/9HR0f/AwMDmAAAAFgAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACfn58F//////////////////////// - //////////////9VK///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//81 - A///2c///////////////////////////////////////////////Pv//8Kz//91U///NQP//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//dVP///z7//////////////////// - ///////////////////29vb/pKSk/6ioqP+/v7//29vb/+/v7//39/f/9/f3//f39//39/f/9/f3//f3 - 9//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f19f/v8fH/8u3u/+Pl - 5f/Y29n/1NLS/7+50v8SD/n/QDz//z869P9aV/P/MCL8/2Bqt/89Qc//SD34/1pb8f9BPPP/Qz/8/01K - /v8XEfr/z8vX/9bf4//l5uL/7urv//Ly8v/w8PD/4+Pj/9bW1v/7+/v///////////////////////// - ////////////////////////+fn5/66urv+hoaH/rKys/729vf/V1dX/4+Pj/+np6f/p6en/6enp/+jo - 6P/o6Oj/6Ojo/+fn5//m5ub/5eXl/+Xl5f/k5OT/4uLi/+Hh4f/g4OD/3t7e/9zc3P/a2tr/2NjY/9fX - 1//Z2dn/19fX/9DQ0P/Dw8PzAAAAFgAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADx8fEk//////////////////////////////////////9M - H///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//+cg/////////////// - ////////////////////////////////////////////////////7Of//6KL//9SJ///MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//4Jj//////////////////////////////////// - ////////ycnJ/6Wlpf+5ubn/1NTU/+zs7P/39/f/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4 - +P/39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f09v/w8vP/8+7v/+Pl5f/X2tj/09HQ/7+5 - 0P8SD/n/Pzz//0E88/9VVfX/MiD9/15otv9JUMP/QTb4/1la8v9BPPH/QD/7/01K/v8WEP//08/b/9rj - 5//l5uL/7urv//Ly8v/t7e3/4eHh//n5+f////////////////////////////////////////////// - //////////////Dw8P+lpaX/o6Oj/66urv/Gxsb/2dnZ/+Xl5f/p6en/6enp/+jo6P/o6Oj/5+fn/+fn - 5//m5ub/5eXl/+Tk5P/j4+P/4uLi/+Hh4f/g4OD/3t7e/9zc3P/a2tr/2NjY/9bW1v/Y2Nj/19fX/9DQ - 0P/Dw8PzAAAAFgAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAADv7+8q//////////////////////////////////////81A///MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//183///8+/////////////////////////////// - ////////////////////////////////////////////////////z8P//39f//85B///MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//+Mb///////////////////////////////////////9vb2/6am - pv+4uLj/0tLS/+vr6//29vb/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f3 - 9//39/f/9/f3//f39//39/f/9/f3//X3+P/0+PP/6fHx/+Xo3//j4Nz/2tDc/7C7yf8TEvH/PkD9/zo+ - 9P9XSvr/MSb4/15ps/9PU8T/PjL8/1lU8/9APO//Pzn//0lH//8eGfH/yc7X/97g4f/z6PL/7+/v//Dw - 8P/t7e3/+fn5//////////////////////////////////////////////////////////////////// - ///i4uL/oKCg/6ampv+1tbX/y8vL/97e3v/m5ub/6Ojo/+jo6P/n5+f/5ubm/+bm5v/l5eX/5OTk/+Tk - 5P/j4+P/4uLi/+Dg4P/e3t7/3Nzc/9vb2//Z2dn/19fX/9bW1v/W1tb/09PT/87Ozv/Dw8PzAAAAFgAA - AAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAD19fVH//////////////////////////////////z7//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//OQf//9/X//////////////////////////////////////////////////// - ///////////////////////////////////////////////18///rJf//1wz//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//qZP//////////////////////////////////////8zMzP+6urr/1tbW/+zs - 7P/29vb/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f3 - 9//39/f/9/f3//Tz9f/19vL/6/Dx/+bn4//i39v/2tPa/7bBz/8VE/X/RT7//zk4+f9TT/T/Miz1/19n - uv9TV8D/Nizw/1FR8f9BOvX/P0H6/0I8//8sJ/T/zM7g/+Dl5P/y7ez/7/Lw/+7u7v/z8/P///////// - ////////////////////////////////////////////////////////////////////////w8PD/6Gh - of+pqan/vLy8/9LS0v/h4eH/6Ojo/+fn5//n5+f/5ubm/+Xl5f/l5eX/5OTk/+Tk5P/j4+P/4eHh/+Dg - 4P/e3t7/3Nzc/9ra2v/Y2Nj/1tbW/9XV1f/V1dX/0tLS/83Nzf/CwsLzAAAAFgAAAAcAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwH19fVT//////// - /////////////////////////+Xf//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//oov///////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////c0///jG///0IT//8zAP//MwD//zMA//8z - AP//OQf//+zn/////////////////////////////////9XV1f++vr7/2tra/+7u7v/19fX/9vb2//b2 - 9v/29vb/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//f0 - 9v/4+PL/7fHy/+jn6f/h397/29nZ/7/H2P8cFPv/ST3//z46/f9LTfH/MSzz/15kw/9ZXcb/Nyvv/01S - 9P9AOfb/PED3/z42//88NPP/ztDi/+Dl4//s6+H/6Ovp/+3t7f/39/f///////////////////////// - ////////////////////////////////////////////////////////+fn5/6qqqv+jo6P/r6+v/8HB - wf/X19f/5OTk/+fn5//m5ub/5eXl/+Xl5f/l5eX/5OTk/+Tk5P/j4+P/4ODg/9/f3//d3d3/3Nzc/9ra - 2v/X19f/1dXV/9PT0//U1NT/0dHR/8zMzP/CwsLzAAAAFgAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwH39/do//////////////////////// - /////////9nP//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//9fN////Pv///////// - //////////////////////////////z8/P////////////////////////////////////////////// - //////////////////////////////////////////n3//+5p///bEf//zMA//8zAP//MwD//9/X//// - /////////////////////////////8fHx//ExMT/4eHh//Dw8P/29vb/9vb2//b29v/29vb/9vb2//b2 - 9v/29vb/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//n2+P/6+PD/7vDx/+zn - 8P/i4+H/4eDc/8fO3f8lHPn/QTb+/0I9/P9EQ/H/PDT3/1Nb1P9OUdf/PjH3/01R8P8/PPD/Nzj+/zwx - //9USfP/2tvp/+bt6v/s7eT/6uzs/+3t7f/7+/v//////////////////////////////////9f///+D - ////5////////////////////////////////////////+Li4v+goKD/pqam/7Kysv/Kysr/29vb/+Tk - 5P/l5eX/5eXl/+Tk5P/k5OT/5OTk/+Pj4//j4+P/39/f/9/f3//d3d3/29vb/9nZ2f/X19f/1NTU/9LS - 0v/T09P/0NDQ/8vLy//BwcHzAAAAFgAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwEAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD4+Ph3/////////////////////////////////8y///8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zkH///f1/////////////////////////////// - ////////6enp/9nZ2f/y8vL//Pz8//////////////////////////////////////////////////// - /////////////////////////////////////////+Xf//+pk///taP///////////////////////// - /////////////8PDw//Pz8//6enp//Pz8//29vb/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//b2 - 9v/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9fX1//Xy9P/08ez/7Ozs/+rm8f/l6Ob/4+Tg/8zS - 3/8zKfH/PTn9/0Y//v9EPvH/T0b6/zk85f80Mur/TUX+/1ZX7f9CQO7/NTb//zMf//97der/4ePt/+nu - 7f/r7Oj/6+zw/+3t7f///////////////////////////////////////zP///8A////P/////v///// - ///////////////////////////////////Dw8P/oaGh/6ioqP+7u7v/z8/P/97e3v/k5OT/5OTk/+Tk - 5P/k5OT/4+Pj/+Pj4//i4uL/39/f/97e3v/d3d3/29vb/9nZ2f/W1tb/09PT/9HR0f/S0tL/z8/P/8rK - yv/AwMDzAAAAFwAAAAefn58Cn5+fBZ+fnwifn58On5+fFJ+fnxifn58Sn5+fC5+fnwMAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAJ+fnwH5+fmI/////////////////////////////////7mn//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//6KL///////////////////////////////////////5+fn/0NDQ/+bm - 5v/x8fH/9PT0//b29v/6+vr//v7+//////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////////8jI - yP/c3Nz/7+/v//T09P/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9fX1//X1 - 9f/19fX/9fX1//X19f/19fX/9fX1//X09v/28+//8PHv//Dt9v/s8e//6+no/9fZ4f9NR+z/NTX9/0I2 - //9APuz/W1X2/yEc9P8jHPP/Wlb1/1xZ6/9EQvD/MjT+/zIg9/+rr9//4uDs/+Pm6v/n6Ob/6unt/+/v - 7////////////////////////////////////////wf///8A////AP///4v///////////////////// - ///////////////////5+fn/qamp/6Kiov+tra3/wMDA/9bW1v/f39//5OTk/+Pj4//j4+P/4+Pj/+Li - 4v/h4eH/39/f/97e3v/c3Nz/2tra/9jY2P/V1dX/0tLS/9DQ0P/R0dH/zs7O/8nJyf/AwMDzIiIiHGxs - bBWfn58Zn5+fJJ+fny+fn588n5+fR5+fn02fn59Cn5+fL5+fnxufn58Nn5+fBAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+f - nwH6+vqb/////////////////////////////////6+b//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//Xzf///z7///////////////////////////////////////Z2dn/3t7e/+7u7v/z8/P/9PT0//T0 - 9P/09PT/9PT0//f39//8/Pz///////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////9fX1/93d3f/s7Oz/9PT0//X1 - 9f/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9fX1//X19f/09PT/9PT0//T09P/09PT/9PT0//T0 - 9P/09PT/9PT0//Hz8//y8O//7vLt/+7t8f/r8O7/6+jq/9/e4P9ubO7/MCv8/0E1//85PvH/W1L8/ygi - //9BP/3/Z2by/1tY8f9GQu//KSf9/1pZ7//V3uL/5uLt/+jp7f/q6ur/8O/r/+3t7f////////////// - /////////////////////////xP///8A////AP///wf////X//////////////////////////////// - ////////4uLi/6CgoP+lpaX/s7Oz/8fHx//Z2dn/4uLi/+Pj4//j4+P/4uLi/+Hh4f/h4eH/39/f/97e - 3v/b29v/2dnZ/9bW1v/U1NT/0dHR/9DQ0P/Pz8//zc3N/8fHx/++vr76Z2dnOJOTk0Wfn59in5+fgJ+f - n5ifn5+kn5+fq5+fn66fn5+in5+fiZ+fn2Gfn585n5+fGJ+fnwYAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwH7+/un//////// - /////////////////////////5l///8zAP//MwD//zMA//8zAP//MwD//zMA//85B///39f///////// - /////////////////////////////+jo6P/X19f/6urq//Ly8v/09PT/9PT0//T09P/09PT/9PT0//T0 - 9P/09PT/9fX1//n5+f/9/f3///////////////////////////////////////////////////////// - ///////////////////////////////////+/v7/5eXl/+zs7P/z8/P/9fX1//X19f/19fX/9fX1//X1 - 9f/19fX/9fX1//X19f/19fX/9fX1//X19f/09PT/9PT0//T09P/09PT/9PT0//T09P/09PT/9PT0//D1 - 9P/z8fH/8PTu/+/u8P/u8/H/7+vw/+3r6v+Njvz/KCD2/z42//8mL/D/QTH0/ykp9/9eaPb/bmrx/1xX - +P9JRO3/Ixf//4qg7v/r8ez/6+fs/+7t7//t6uz/8vLm/+7u7v////////////////////////////// - /////////x////8A////AP///wD///83////+////////////////////////////////////////8PD - w/+hoaH/qamp/7m5uf/Ozs7/3d3d/+Li4v/i4uL/4uLi/+Hh4f/g4OD/39/f/93d3f/b29v/2NjY/9XV - 1f/T09P/0dHR/87Ozv/Ly8v/x8fH/7+/v/+2trb/jY2Nd5ubm42fn5+un5+fzJ+fn+Kfn5/qn5+f7Z+f - n+2fn5/mn5+f0Z+fn6ufn59+n5+fTJ+fnx2fn58HAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwL8/PzB//////////////////////// - /////////49z//8zAP//MwD//zMA//8zAP//MwD//zMA//+ii/////////////////////////////// - ////////9/f3/8/Pz//k5OT/8PDw//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Ly8v/y8vL/8/Pz//Pz - 8//z8/P/9vb2//r6+v/+/v7///////////////////////////////////////////////////////// - ///////////////////v7+//7e3t//Pz8//09PT/9PT0//T09P/09PT/9PT0//T09P/09PT/9PT0//T0 - 9P/09PT/9PT0//T09P/z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//P08v/z9PL/8fHx/+/v - 7//v7vD/7+7w/+rp7f/k4+f/GBf2/yAi//8NDfP/Kifz/2dm/P92dPz/ZWL+/05T9f8xJOr/gH/m/9DW - 6f/u7u7/7Ovv/+rx6v/w8+r/8uvy/+zs7P/8/Pz//////////////////////////////////zv///8A - ////AP///wD///8A////f/////////////////////////////////////////n5+f+rq6v/o6Oj/6ys - rP/AwMD/09PT/97e3v/h4eH/4ODg/9/f3//f39//3t7e/93d3f/a2tr/1tbW/9PT0//Q0ND/y8vL/8fH - x//Dw8P/u7u7/7Gxsf+qqqr/m5ubzqOjo966urrwx8fH+NXV1f7j4+P+4eHh/7q6uv6fn5/8n5+f9p+f - n+mfn5/On5+fmZ+fn0Wfn58Xn5+fAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwL8/PzF/////////////////////////////////39f//8z - AP//MwD//zMA//8zAP//MwD//183///8+///////////////////////////////////////1tbW/+Dg - 4P/t7e3/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Ly8v/y8vL/8/Pz//Pz8//z8/P/8/Pz//Pz - 8//09PT/9/f3//z8/P////////////////////////////////////////////////////////////j4 - +P/u7u7/8/Pz//T09P/09PT/9PT0//T09P/09PT/9PT0//T09P/09PT/9PT0//T09P/09PT/9PT0//T0 - 9P/z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Lz8f/x8vD/8PDw/+7u7v/v7vD/8fDy/+/u - 8v/r6u7/jJb//y8c9f8kE/7/R0ry/1FW5/9aVvX/RED3/yUc9f+Ghez/0tT//+jq6//o4+T/8e3y/+bs - 5//m6uT/8Ozx/+3t7f/7+/v//////////////////////////////////0f///8A////AP///wD///8A - ////A////8/////////////////////////////////////////n5+f/oKCg/6SkpP+ysrL/xcXF/9fX - 1//f39//4ODg/9/f3//e3t7/3d3d/9zc3P/Y2Nj/09PT/83Nzf/Gxsb/vr6+/7a2tv+xsbH/rKys/6am - pv+4uLj/2tra+vv7+//////////////////////////////////t7e3/vr6+/6CgoP2fn5/wn5+fx5+f - n3Wfn58zn5+fCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAJ+fnwP+/v7i/////////////////////////////////2xH//8zAP//MwD//zMA//8z - AP//PAv//+Xf///////////////////////////////////////n5+f/1tbW/+rq6v/x8fH/8/Pz//Pz - 8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Ly8v/y8vL/8/Pz//Pz8//z8/P/8vLy//Ly8v/y8vL/8/Pz//Pz - 8//19fX/+fn5//7+/v/////////////////////////////////9/f3/9fX1//Ly8v/z8/P/9PT0//T0 - 9P/09PT/9PT0//T09P/09PT/9PT0//T09P/09PT/9PT0//Pz8//z8/P/8/Pz//Pz8//y8vL/8vLy//Ly - 8v/y8vL/8vLy//Ly8v/y8vL/8vLy//P08v/y8/H/8fHx/+/v7//v7vD/8fDy//Dv8f/t7O7/7ufq/7u5 - 9f9YUPf/KBv//zEo+v9NQPD/hXv3/7fA8v/W3O//6uzt//fx7P/x6er/6ufp/+ft6P/t8ez/8Ozx/+zs - 7P/5+fn//////////////////////////////////1////8A////AP///wD///8A////AP///y/////7 - ////////////////////////////////////////x8fH/6CgoP+np6f/t7e3/8zMzP/Z2dn/39/f/9/f - 3//c3Nz/2dnZ/9XV1f/Ozs7/xsbG/8DAwP+4uLj/sLCw/6mpqf+vr6//zc3N//Dw8P////////////// - /////////////////////////////////////////////+vr6/+ioqL9n5+f45+fn6Wfn59Wn5+fFp+f - nwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+f - nwP+/v7q/////////////////////////////////2U///8zAP//MwD//zMA//8zAP//qZP///////// - //////////////////////////////f39//T09P/5OTk//Dw8P/z8/P/8/Pz//Pz8//z8/P/8/Pz//Ly - 8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8/Pz//Pz - 8//19fX/+Pj4//r6+v/6+vr/+Pj4//b29v/09PT/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz - 8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//y8vL/8vLy//Ly8v/y8vL/8vLy//Ly - 8v/y8vL/8vLy//Lz8f/z8/P/8vLy//Hx8f/w8PD/8O/x/+7t7//s6+3/5e7k/+jx9f/e5/T/2eDv/97g - 8v/i5e3/4+zv/+Dq9P/t7e3/6OPk//Lq6//y7ez/6uvp/+rv7f/q7O3/7urw/+vr6//4+Pj///////// - /////////////////////////2////8A////AP///wD///8A////AP///wD///9///////////////// - ////////////////////////+vr6/6urq/+ioqL/rKys/7y8vP/Q0ND/2tra/9nZ2f/W1tb/z8/P/8fH - x/+9vb3/s7Oz/6urq/+pqan/wsLC/+Pj4//+/v7///////////////////////////////////////// - ///////////////////////////////////Y2Nj/n5+f8p+fn82fn598n5+fLJ+fnwsAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwP///////////// - /////////////////////////0wf//8zAP//MwD//zMA//9lP/////////////////////////////// - /////////////9XV1f/e3t7/7e3t//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly - 8v/y8vL/8vLy//Ly8v/y8vL/8fHx//Hx8f/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly - 8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8/Pz//Pz - 8//z8/P/8/Pz//Ly8v/y8vL/8vLy//Ly8v/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Dw - 8P/x8fH/8vLy//Hx8f/x8fH/8PDw/+/v7//t7e3/8/Dy/+fk7f/v8/T/8PXs/+/u6v/27vX/8+rt//bw - 6//q6e3/8+/0/+zp6//r7Or/7fDu/+rr7//s6+//7ejp/+rq6v/29vb///////////////////////// - /////////3////8A////AP///wD///8A////AP///wD///8D////z/////////////////////////// - /////////////+fn5/+fn5//pKSk/6+vr//BwcH/ysrK/8nJyf/BwcH/ubm5/7Kysv+srKz/tbW1/9bW - 1v/4+Pj///////////////////////////////////////////////////////////////////////// - ////////////////////////wMDA+5+fn+Wfn5+fn5+fUJ+fnxmfn58CAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPHx8Q3///////////////////////////// - /////////0UX//8zAP//MwD//zwL///l3///////////////////////////////////////5ubm/9fX - 1//p6en/8fHx//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly - 8v/y8vL/8fHx//Hx8f/x8fH/8fHx//Hx8f/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly - 8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly - 8v/y8vL/8vLy//Ly8v/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Dw - 8P/w8PD/8PDw//Dw8P/v7+//9PLq//Xz8v/u7e//7e3t/+rs7P/q7ev/7/Du/+zs7P/q8er/6O7p/+nv - 6v/q7+3/6uvv/+vp7//t6uz/7e3n/+rq6v/09PT//////////////////////////////////5v///8A - ////AP///wD///8A////AP///wD///8A////L/////v///////////////////////////////////// - ///Hx8f/oaGh/6Wlpf+ysrL/t7e3/7a2tv+vr6//ra2t/8rKyv/s7Oz///////////////////////// - //////////////////////////////////////////////////////////////////////////////// - ////////8/Pz/5+fn/Cfn5+1n5+faZ+fnyKfn58EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAPz8/CD//////////////////////////////////////zMA//8z - AP//MwD//6mT///////////////////////////////////////39/f/0NDQ/+Tk5P/v7+//8vLy//Ly - 8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Hx8f/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/x8fH/8fHx//Hx - 8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Ly - 8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/x8fH/8fHx//Hx - 8f/w8PD/8PDw//Dw8P/w8PD/8PDw//Dw8P/w8PD/8PDw//Ly8v/x8fH/8PDw/+/v7//v7+//7u/t/+7v - 7f/u7+3/7+3t/+/u6v/x7+7/7u/r/+nx5//o7u3/5uvu/+nw6f/u8ej/5+vl/+zw6//o6uv/7Ovv/+3q - 7P/h4uD/6+/q/+np6f/z8/P//////////////////////////////////6f///8A////AP///wD///8A - ////AP///wD///8A////AP///3v////////////////////////////////////////6+vr/q6ur/6Gh - of+kpKT/pqam/76+vv/f39///Pz8//////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////////66u - rvSfn5+4n5+fbJ+fnyOfn58EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAP///wv//////////////////////////////////////08j//8zAP//dVP///////// - ///////////////////////////////////W1tb/3Nzc/+zs7P/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly - 8v/y8vL/8vLy//Hx8f/x8fH/8vLy//Ly8v/y8vL/8vLy//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx - 8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx - 8f/x8fH/8fHx//Hx8f/x8fH/8vLy//Ly8v/y8vL/8fHx//Hx8f/x8fH/8fHx//Hx8f/w8PD/8PDw//Dw - 8P/w8PD/8PDw//Dw8P/w8PD/8PDw/+/v7//v7+//7u7u/+/v7//v8O7/7u/t/+7v7f/t7uz/7u/z/+7s - 6//y7+v/8evw//Dq9f/w7e//7Ovn//Hr8P/v6O//7+vw/+7q7//s6O7/7ejp/+7u6P/q7un/4uXp/+np - 6f/w8PD//////////////////////////////////7////8A////AP///wD///8A////AP///wD///8A - ////AP///wP////H////////////////////////////////////////5+fn/6urq//R0dH/9fX1//// - //////////////////////////////////////////////////////////////////////////////// - ////+////7P///9/////m/////v//////////////////////////////////8nJyfSfn5+nn5+fVp+f - nxqfn58CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAgAA - AAL////7/////////////////////////////////9/X//+5p////Pv///////////////////////// - /////////////+Pj4//W1tb/6Ojo//Dw8P/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx - 8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8PDw//Dw8P/w8PD/8PDw//Dw8P/w8PD/8fHx//Hx - 8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx - 8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8PDw//Dw8P/w8PD/8PDw//Dw8P/w8PD/8PDw/+/v - 7//v7+//7+/v//Dw8P/w8PD/7+/v/+7u7v/t7e3/7e3t/+7u7v/v7+//7e3t/+7u7v/u7u7/7e3t/+3t - 7f/t7e3/7Ozs/+rq6v/r6+v/6+vr/+rq6v/q6ur/6enp/+np6f/p6en/6enp/+jo6P/w8PD///////// - /////////////////////////8////8A////AP///wD///8A////AP///wD///8A////AP///wD///8n - ////9/////////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////9////97////G////wD///8A - ////AP///7f//////////////////////////////////9nZ2fKfn5+Pn5+fOp+fnw8AAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAADAAAABQAAAAcAAAAKAAAACwAAAA38/PzR//////// - ////////////////////////////////////////////////////////////////////////9vb2/87O - zv/g4OD/6+vr/+3t7f/t7e3/7e3t/+3t7f/t7e3/7e3t/+3t7f/t7e3/7e3t/+3t7f/t7e3/7e3t/+3t - 7f/t7e3/7e3t/+3t7f/s7Oz/7e3t/+3t7f/t7e3/7e3t/+7u7v/u7u7/7u7u/+7u7v/t7e3/7e3t/+3t - 7f/t7e3/7e3t/+3t7f/t7e3/7e3t/+7u7v/u7u7/7u7u/+3t7f/t7e3/7e3t/+3t7f/t7e3/7e3t/+3t - 7f/t7e3/7e3t/+3t7f/t7e3/7e3t/+zs7P/s7Oz/7Ozs/+zs7P/s7Oz/7Ozs/+zs7P/r6+v/6+vr/+vr - 6//r6+v/6+vr/+rq6v/q6ur/6+vr/+zs7P/s7Oz/7Ozs/+3t7f/t7e3/7Ozs/+zs7P/s7Oz/6+vr/+np - 6f/q6ur/6urq/+np6f/p6en/6enp/+np6f/o6Oj/6Ojo/+fn5//t7e3///////////////////////// - /////////9////8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////c/////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////f///+n////R////wD///8A////AP///wD///8A////D////+f///// - /////////////////////////////83NzeGfn591n5+fIp+fnwYAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAEAAAACAAAABAAAAAcAAAAMAAAAEAAAABUAAAAZAAAAHAAAAB7U1NRy//////////////////////// - ////////////////////////////////////////////////////////1NTU/9fX1//g4OD/5OTk/+Tk - 5P/k5OT/5OTk/+Tk5P/k5OT/5OTk/+Tk5P/k5OT/5OTk/+Tk5P/k5OT/5OTk/+Tk5P/k5OT/5OTk/+Tk - 5P/k5OT/4+Pj/+Pj4//j4+P/4+Pj/+Tk5P/k5OT/5OTk/+Tk5P/l5eX/5eXl/+Xl5f/l5eX/5eXl/+Xl - 5f/l5eX/5eXl/+Xl5f/l5eX/5eXl/+Xl5f/l5eX/5OTk/+Tk5P/k5OT/5OTk/+Tk5P/k5OT/5OTk/+Tk - 5P/k5OT/5OTk/+Tk5P/j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Hh4f/i4uL/4uLi/+Li - 4v/i4uL/4+Pj/+Xl5f/m5ub/6enp/+rq6v/r6+v/6urq/+rq6v/r6+v/6+vr/+rq6v/q6ur/6enp/+np - 6f/o6Oj/6Ojo/+jo6P/o6Oj/5+fn/+fn5//t7e3///////////////////////////////////v///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////A////8f///////////////////// - ///////////////////////////////////////////////////////////////////////////////T - ////c////xP///8A////AP///wD///8A////AP///wD///8D////w/////////////////////////// - /////////////8LCwsGfn59Yn5+fFJ+fnwIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAQAAAAHAAAADQAA - ABMAAAAbAAAAIwAAACoAAAAwAAAANAAAADcNDQ079vb24/////////////////////////////////// - ///////////////////////////////////k5OT/y8vL/9LS0v/V1dX/1tbW/9bW1v/W1tb/1tbW/9bW - 1v/W1tb/1tbW/9bW1v/W1tb/1tbW/9bW1v/W1tb/1tbW/9bW1v/W1tb/1tbW/9bW1v/W1tb/1tbW/9bW - 1v/X19f/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9bW - 1v/W1tb/1tbW/9bW1v/W1tb/1tbW/9bW1v/W1tb/1tbW/9bW1v/W1tb/1tbW/9XV1f/V1dX/1dXV/9XV - 1f/V1dX/1dXV/9XV1f/V1dX/1dXV/9XV1f/U1NT/1NTU/9PT0//T09P/1NTU/9TU1P/V1dX/19fX/9nZ - 2f/b29v/3t7e/+Hh4f/l5eX/5+fn/+jo6P/q6ur/6urq/+rq6v/q6ur/6enp/+jo6P/o6Oj/6Ojo/+jo - 6P/n5+f/5+fn/+bm5v/o6Oj///////////////////////////////////////8D////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///yf////3//////////////////////////////// - ///////////////////////////////////////////////z////m////zf///8A////AP///wD///8A - ////AP///wD///8A////AP///wP///+r/////////////////////////////////////////f39/aqq - qoKfn584n5+fCp+fnwEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAABAAAAAkAAAAQAAAAGgAAACUAAAAxAAAAPQAA - AEcAAABPAAAAVQAAAFgAAABbiYmJi/v7+/f///////////////////////////////////////////// - /////////////+bm5v+8vLz/v7+//8HBwf/CwsL/wsLC/8LCwv/Dw8P/w8PD/8PDw//Dw8P/w8PD/8PD - w//Dw8P/w8PD/8PDw//Dw8P/wsLC/8LCwv/CwsL/wsLC/8LCwv/CwsL/w8PD/8PDw//Dw8P/w8PD/8PD - w//Dw8P/w8PD/8PDw//CwsL/wsLC/8LCwv/CwsL/wsLC/8LCwv/CwsL/wsLC/8PDw//Dw8P/wsLC/8LC - wv/CwsL/wsLC/8LCwv/CwsL/wsLC/8HBwf/BwcH/wcHB/8HBwf/BwcH/wcHB/8HBwf/BwcH/wcHB/8HB - wf/BwcH/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wcHB/8HBwf/CwsL/xMTE/8jIyP/Ly8v/z8/P/9TU - 1P/b29v/4ODg/+Tk5P/n5+f/6Ojo/+np6f/p6en/6enp/+jo6P/o6Oj/5+fn/+bm5v/k5OT/4uLi/+Dg - 4P/h4eH///////////////////////////////////////8f////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///9z//////////////////////////////////////////////// - ////////////////////x////2f///8L////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///5f/////////////////////////////////////////////3d3dyp+fn0Kfn58Xn5+fAgAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAEAAAAEAAAACgAAABMAAAAfAAAALgAAAD8AAABPAAAAXgAAAGoAAAByAAAAeAAA - AHwAAAB+AAAAf1tbW5vy8vLz////////////////////////////////////////////////4eHh/6en - p/+oqKj/qKio/6ioqP+pqan/qamp/6mpqf+qqqr/qqqq/6qqqv+qqqr/qqqq/6qqqv+qqqr/qqqq/6mp - qf+pqan/qamp/6mpqf+pqan/qamp/6mpqf+pqan/qKio/6ioqP+oqKj/qKio/6ioqP+pqan/qamp/6mp - qf+pqan/qamp/6mpqf+pqan/qamp/6mpqf+pqan/qamp/6qqqv+qqqr/qqqq/6qqqv+pqan/qamp/6mp - qf+pqan/qKio/6ioqP+oqKj/qKio/6ioqP+oqKj/qKio/6ioqP+oqKj/qKio/6ioqP+np6f/p6en/6en - p/+np6f/p6en/6ioqP+oqKj/qKio/6ioqP+pqan/rKys/7Gxsf+0tLT/vb29/8TExP/Ozs7/1tbW/93d - 3f/j4+P/5ubm/+fn5//n5+f/5ubm/+Xl5f/j4+P/39/f/9ra2v/V1dX/0NDQ/8vLy//Gxsb///////// - //////////////////////////////8v////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8D////w///////////////////////////////////////////////6////4////8r - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////i/////////// - ///////////////////////////////////6+vr1q6urWZ+fnxyfn58GAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA - AAQAAAAKAAAAFAAAACIAAAA0AAAASQAAAFwAAABvAAAAfQAAAIgAAACRAAAAlQAAAJgAAACaAAAAmgAA - AJovLy+nw8PD3/f39/v///////////////////////////r6+v/X19f/jo6O/42Njf+Ojo7/j4+P/4+P - j/+Pj4//j4+P/5CQkP+QkJD/kJCQ/5CQkP+QkJD/kJCQ/5CQkP+QkJD/kJCQ/4+Pj/+Pj4//j4+P/4+P - j/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//kJCQ/5CQkP+QkJD/kJCQ/5CQkP+Pj4//j4+P/4+P - j/+Pj4//j4+P/4+Pj/+Pj4//j4+P/5CQkP+QkJD/kJCQ/5CQkP+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+P - j/+Ojo7/jo6O/46Ojv+Ojo7/jo6O/46Ojv+Ojo7/jo6O/46Ojv+Ojo7/jo6O/46Ojv+Ojo7/jY2N/46O - jv+Ojo7/j4+P/4+Pj/+Pj4//kpKS/5eXl/+ampr/paWl/66urv+6urr/xsbG/9DQ0P/X19f/3Nzc/93d - 3f/b29v/2dnZ/9bW1v/S0tL/zMzM/8bGxv/AwMD/urq6/7S0tP+vr6//+/v7//////////////////// - //////////////8/////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////H/////P//////////////////////////////7v///9X////B////wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///9v//////////////////////////////// - //////////////39/fzMzMx/n5+fHp+fnwYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAgAAAASAAAAIgAA - ADYAAABMAAAAZAAAAHkAAACLAAAAmAAAAKEAAACnAAAAqwAAAKwAAACuAAAArgAAAK8AAACvAAAAsAoK - CrRWVlbIlJSU239/f9eAgIDugoKC/4KCgv+AgID/fHx8/3x8fP99fX3/fn5+/35+fv9+fn7/fn5+/39/ - f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//35+fv9+fn7/fn5+/35+fv9+fn7/fn5+/319 - ff99fX3/fX19/319ff99fX3/fX19/319ff99fX3/fX19/319ff9+fn7/fn5+/35+fv9+fn7/fn5+/35+ - fv9+fn7/fn5+/35+fv9+fn7/fn5+/35+fv9+fn7/fn5+/319ff99fX3/fn5+/35+fv9+fn7/fn5+/319 - ff99fX3/fX19/319ff99fX3/fX19/319ff99fX3/fX19/319ff99fX3/fX19/3x8fP98fHz/fX19/319 - ff9+fn7/gICA/4SEhP+IiIj/kZGR/5qamv+np6f/tLS0/76+vv/Gxsb/ysrK/8jIyP/Gxsb/v7+//7m5 - uf+zs7P/r6+v/6ysrP+qqqr/p6en/6ysrP/AwMD/+Pj4//////////////////////////////////9X - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///2v///// - /////////+P///+D////H////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///1v//////////////////////////////////////////////v7+/tfX - 14+fn58ln5+fBwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAABgAAAA8AAAAdAAAAMgAAAEwAAABmAAAAfgAA - AJIAAACiAAAArAAAALIAAAC2AAAAuAAAALoAAAC6AAAAuwAAALsAAAC7AAAAuwAAALsAAAC8AAAAvQAA - AL5BRUPoZmtp/3B1c/9vdHL/b3Bu/3Bxb/9wcW//cHFv/3Bxb/9xcnD/cXJw/3FycP9xcnD/cXJw/3Fy - cP9xcnD/cXJw/3FycP9xcnD/cXJw/29ycP9vcnD/b3Jw/29ycP9vcnD/b3Jw/29ycP9vcnD/b3Jw/29y - cP9vcnD/b3Jw/29ycP9vcnD/b3Jw/29ycP9vcnD/b3Jw/29ycP9vcnD/b3Jw/29ycP9vcnD/b3Jw/29y - cP9vcnD/b3Jw/29ycP9vcnD/b3Jw/29ycP9vcnD/cHFv/3Bxb/9wcW//cHFv/3Bxb/9wcW//cHFv/3Bx - b/9ucW//bnFv/25xb/9ucW//bnFv/25xb/9ucW//bnFv/29wdP9ucHH/bnBw/3Bxb/9xcm7/cnNx/3d1 - df98enz/i4KG/4+Mj/+VmZb/naOc/6iqpf+wrq7/s7Gz/7Gxsv+vr6//rKys/6enp/+oqKj/ubm5/8vL - y//g4OD/9fX1//////////////////////////////////////////////////9j////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///+L////S////wP///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////U/////v/////////////////////////////////////////////2tranJ+fnyifn58KAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAEAAAADAAAACgAAABcAAAArAAAARQAAAGEAAAB8AAAAlAAAAKYAAACyAAAAuAAA - ALwAAAC+AAAAvhcXGMozNDbZMjQ22TI0NtkyNTXZMjU12TIyNdkwMDPZLy8x2SsrLtlKSk/xYWFn/2lp - b/9oaG7/ZWVr/2Vla/9mZmz/ZmZs/2ZmbP9mZmz/Z2dt/2dnbf9nZ23/Z2dt/2dnbf9nZ23/Z2dt/2dn - bf9nZ23/Z2dt/2dnbf9nZ23/Z2dt/2dnbf9nZ23/Z2dt/2dnbf9nZ23/ZmZs/2ZmbP9mZmz/ZmZs/2Zm - bP9mZmz/ZmZs/2ZmbP9mZmz/ZmZs/2ZmbP9mZmz/ZmZs/2ZmbP9mZmz/ZmZs/2ZmbP9mZmz/ZmZs/2Zm - bP9mZmz/ZmZs/2ZmbP9mZmz/ZmZs/2ZmbP9mZmz/ZmZs/2ZmbP9mZmz/ZmZs/2ZmbP9lZWv/ZWVr/2Vl - a/9lZWv/ZWVr/2Vla/9lZWv/ZWVr/2FqZ/9gaGf/Ymdq/2Jma/9kaGz/aWxw/3J1dv97f37/iIuB/46O - jv+Vk5f/nJyc/5+goP+hoqL/o6Ok/7S0s//IyMj/2tra/+3t7f////////////////////////////// - //////////////////////////////////////////////9/////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///87////8/////////// - ///////////////////////////////////e3t6pn5+fKZ+fnwoAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAEAAAAFAAAAEAAAACAAAAA5AAAAVwAAAHUAAACQAAAApAAAALIAAAC6AAAAvRocHctBR2DqSlB5+kZH - gf9BPob/PTeJ/zsyjP86MYv/OjGL/zc0if81Mof/MzCF/zAtgv8tKn//MS6D/zYziP81Mof/NDGG/zQx - hv80MYb/NDGG/zQxhv81Mof/NTKH/zUyh/81Mof/NTKH/zUyh/81Mof/NTKH/zUyh/81Mof/NTKH/zUy - h/81Mof/NTKH/zUyh/81Mof/NTKH/zUyh/81Mof/NDGG/zQxhv80MYb/NDGG/zQxhv80MYb/NDGG/zQx - hv80MYb/NDGG/zQxhv80MYb/NDGG/zQxhv80MYb/NDGG/zQxhv80MYb/NDGG/zQxhv80MYb/NDGG/zQx - hv80MYb/NDGG/zQxhv80MYb/NDGG/zQxhv80MYb/NDGG/zQxhv80MYb/NDGG/zQxhv80MYb/NDGG/zQx - hv80MYb/NDGG/zkyh/84MIf/OTCJ/zw2h/9GQ4X/W1uH/3J0jf+Fh5T/kZOW/5iYmf+qqar/vr2+/9XV - 1f/o6Oj//Pz8//////////////////////////////////////////////////////////////////// - //////////////////////////////+P////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///yv////z//////////////////////////////// - /////////////+fn57qfn58un5+fDJ+fnwIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAIAAAAFgAA - ACoAAABGAAAAZwAAAIUAAACdAAAArwAAALkHCAjBPEBa5zw3k/8aFpT/GBKV/xcQl/8ZEJ3/GQ+f/xgP - n/8ZEZ7/GhOe/xYSof8UEJ//FBCf/xQQn/8SDp3/Ew+e/xURoP8UEJ//EhCf/xIQn/8SEJ//EhCf/xIQ - n/8SEJ//EhCf/xMRoP8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQ - n/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQ - n/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQ - n/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xgR - mv8aE5z/IRmf/zMsn/9NR57/aWWd/52ctP/IyM7/4eHi//f39/////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////+f////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////J////+f/////////////////////////////////////////////6Ojoxp+f - nzKfn58PAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAALAAAAHAAAADMAAABSAAAAdAAA - AJEAAACnAAAAtRQVFsZAQXf3IxqZ/xEKk/8VDaD/IBqn/y0qr/84OLT/P0K1/0VJuf9ITbr/Sk+8/1FO - u/9PTLn/UE26/1FOu/9QTbr/UE26/1BNuv9QTbr/Tk66/05Ouv9OTrr/Tk66/05Ouv9OTrr/Tk66/05O - uv9OTrr/Tk66/05Ouv9OTrr/Tk66/05Ouv9OTrr/Tk66/1BNuv9QTbr/UE26/1BNuv9QTbr/UE26/1BN - uv9QTbr/UE26/1BNuv9QTbr/UE26/1BNuv9QTbr/UE26/1BNuv9QTbr/UE26/1BNuv9QTbr/UE26/1BN - uv9QTbr/UE26/1BNuv9QTbr/UE26/1BNuv9QTbr/UE26/1BNuv9QTbr/Tk66/05Ouv9OTrr/Tk66/05O - uv9OTrr/Tk66/05Ouv9QTbr/UE26/1BNuv9QTbr/UE26/1BNuv9QTbr/UE26/0tNvf9OULz/V1q3/2tt - sP+rq8X/6urt//////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////+3 - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8X - ////2//////////////////////////////////////////////t7e3SpKSkOZ+fnxCfn58BAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAOAAAAIAAAADoAAABcAAAAfgAAAJkAAACtFRYYw0E+ - hvcZDZv/Fg2k/yMhqf9PTbf/W1rB/2RmxP9pa8P/am3C/2prxf9qacn/amjM/25rwf9tasD/bWrA/29s - wv9vbML/bmvB/21qwP9ua8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9tbML/bWzC/21swv9sa8H/bGvB/2xr - wf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xr - wf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xr - wf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xr - wf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9sa8H/bGvB/2dky/9sa8b/fHy6/9jZ5P////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////f////D////j////1P///8b////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wv////X//////////////// - //////////////////////////////Ly8t2kpKQ8n5+fEp+fnwQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAQAAAAQAAAAJQAAAEAAAABjAAAAhAAAAJ4CAgOyQ0J58R4Zmv8UCqr/MC24/01O - vv9dWcL/Yl/G/2Nhxf9iYMD/YV+//2BdwP9hWsL/Y1zF/11cxP9cW8P/XFvD/11cxP9eXcX/XVzE/1xb - w/9dXMT/XVzE/11cxP9dXMT/XVzE/11cxP9dXMT/XVzE/11cxP9dXMT/XVzE/11cxP9dXMT/XVzE/11c - xP9dXMT/XVzE/19bxP9fW8T/X1vE/19bxP9fW8T/X1vE/19bxP9fW8T/X1vE/19bxP9fW8T/X1vE/19b - xP9fW8T/X1vE/19bxP9fW8T/X1vE/19bxP9fW8T/X1vE/19bxP9fW8T/X1vE/19bxP9fW8T/X1vE/19b - xP9fW8T/X1vE/19bxP9fW8T/XVzE/11cxP9dXMT/XVzE/11cxP9dXMT/XVzE/11cxP9fW8T/X1vE/19b - xP9fW8T/X1vE/19bxP9fW8T/X1vE/2RdxP9qY8D/x8Xe//////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - ////2////6P///9r////M////wP///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////C////8P///////////////////////////////////// - ////////8vLy4q6urkWfn58Wn5+fAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAUAAAATAAAAJwAAAEMAAABnAAAAiAAAAKFERF3WKiGa/w8In/8lKqv/Sk26/1RQuf9MTrr/TE66/01M - uv9MSrv/T068/1BNuv9PTbf/UVC4/1FOu/9RTrv/UE26/1BNuv9ST7z/UU67/1FOu/9RTrv/UU67/1FO - u/9RTrv/UU67/1FOu/9QTbr/UE26/1BNuv9QTbr/UE26/1BNuv9QTbr/UE26/1BNuv9QTbr/UE26/1FO - u/9RTrv/UU67/1FOu/9RTrv/UU67/1FOu/9RTrv/UE26/1BNuv9QTbr/UE26/1BNuv9QTbr/UE26/1BN - uv9RTrv/UU67/1FOu/9RTrv/UU67/1FOu/9RTrv/UU67/1BNuv9QTbr/UE26/1BNuv9QTbr/UE26/1BN - uv9QTbr/UU67/1FOu/9RTrv/UU67/1FOu/9RTrv/UU67/1FOu/9RTrv/UU67/1FOu/9RTrv/UU67/1FO - u/9RTrv/UU67/1JOtf+hn9T///////////////////////////////////////////////////////// - /////////////////////////////////////////+////+3////g////0v///8P////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8D////s//////////////////////////////////////////////29vbsubm5VZ+f - nxWfn58DAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAATAAAAKAAA - AEYAAABqAAAAiwMEBKQ4OJ34EQyj/yAbpv88OrH/QT27/zk7uP9BPbr/QT26/0E9uv9BPbr/QT26/0E9 - uv9BPbr/QT26/0E+vP9APrn/Qj6//z88uv9ARLT/P0G3/zo6vP87Prj/QT65/z87uP9BP7r/QkK2/0BA - tv9BPbr/QDu8/0E5u/9APrr/QD66/0A+uv9APrr/QD66/0A+uv9APrr/QD66/0VCtv9CQbX/QkG5/z4+ - uv8+Prr/QD+3/0BAtv9CP7r/Qjy5/0M+uf9EP7j/Qz63/0A+tv9BP7f/Qj+6/0E+uf8+QLb/PT62/z48 - t/9CPrv/Qjy5/0E6uf9EPbz/Qjq8/0Q/uv9CPbb/Q0O1/0A8uf9BP7v/QD65/z8+tv8+P7f/Qj+9/0E/ - uv8+QLb/P0G3/z9AuP8/QLr/QD65/z89uP9BPrn/QT65/0E+uf9BPrn/QT65/0E+uf9BPrn/QT65/0JA - uf/p6fb////////////////////////////////////////////////////////////////////////7 - ////z////5P///9f////J////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///+n - //////////////////////////////////////////////j4+PS1tbVgn5+fGp+fnwYAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAUAAAAKQAAAEYAAABrAAAAi0FD - TsErKaD/Dguk/yIerf83NLL/ODK5/y8xs/8zMbP/MzGz/zMxs/8zMbP/MzGz/zMxs/8zMbP/MzGz/zY1 - tf8zMrD/NDC3/zMvtv8zNK7/NTKw/zMttP83NLL/NjGy/zQvsv8zMbP/MTKy/zAxsf8xMbP/NDK0/zg0 - tf8zMbP/MzGz/zMxs/8zMbP/MzGz/zMxs/8zMbP/MzGz/zMysv80M7P/NTO1/zMxs/8yMbH/NTOv/zYy - r/81MLH/NTGy/zQxr/8zMK7/MzGt/zQyrv81MrD/NDOz/zQzs/82Mbb/NTC1/zo4uv8zMbP/MTCw/zk1 - tv80L7L/NTCz/zcxuP83Mrf/NzSy/zMvsP8zL7D/NDCx/zQwsf81MbL/NjKz/zYys/80M7H/MzS0/zMy - t/81Mrf/NDG2/zYxtP80MrT/NDK0/zQytP80MrT/NDK0/zQytP80MrT/NDK0/3Jwyf////////////// - /////////////////////////////////////////+P///+v////c////zv///8L////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///4////////////////////// - ////////////////////////9/f3+7S0tJSdnZ04n5+fCQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAUAAAAKgAAAEcAAABsAAAAjFpdedodF57/Dwyo/yAe - s/8tJ7T/KSO2/yUnsf8pJrL/KSay/ykmsv8pJrL/KSay/ykmsv8pJrL/KSay/yknr/8nJqz/Kye2/y0m - t/8rJqv/JyOg/yYem/8oH5f/Jh6a/ygjnv8mJKb/JiWx/yYns/8lJrL/Jiaw/yYnrf8oJ7P/KCez/ygn - s/8oJ7P/KCez/ygns/8oJ7P/KCez/yQktP8oJbb/JiOu/yQjo/8iIJf/JCGU/ychlv8lH5b/ISCU/yEg - lP8iIZX/IiGV/yEflv8gH5f/IiCb/yQinv8rIan/LSat/yYiqv8oKLL/Kiq0/yQkrv8rKLP/Kiiw/yQg - tf8pJbT/JyOr/ycjoP8mIZr/JSCZ/yUgm/8nIZ7/JSSk/yglqv8pJrH/JyS1/yYjtf8pI7b/KSS1/ygk - s/8qJ7P/Kiez/yons/8qJ7P/Kiez/yons/8qJ7P/Kiez/6ur4P////////////////////////////// - /////////6f///9T////G////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////c/////////////////////////////////////////// - ///6+vr/tLS05Jubm4ydnZ1En5+fE5+fnwQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAcAAAAUAAAAKgAAAEcAAABtAAAAjGFikecVD6T/Dg2w/xwatP8fGbT/HBe2/xse - r/8cGbL/HBmy/xwZsv8cGbL/HBmy/xwZsv8cGbL/HBmy/xsZrv8bGqz/Hhu0/x4ZsP8ZFJn/GhiC/xoV - cP8ZEmf/FxFo/xgZcf8XFIf/GBSj/x0bsP8dHLL/HRqz/x0bsP8cGbL/HBmy/xwZsv8cGbL/HBmy/xwZ - sv8cGbL/HBmy/x0btP8dGK//FxOa/xcXg/8UFWv/ExJi/xURY/8VEWP/FRNl/xQSZP8TEWP/EBFi/xER - Zf8UE2n/FhRu/xUSbv8UD3j/GRWG/x0amP8YGKL/GRmt/x4ctf8bGrD/HBqw/x0Ztf8dGqv/Fg+W/xsa - fP8WFG3/ExBm/xYRbP8cF3P/FxaW/xsZof8eGq//HRm1/xwXtv8dGbX/IBu0/x4ZsP8cGbL/HBmy/xwZ - sv8cGbL/HBmy/xwZsv8cGbL/HBmy/6qp4v//////////////////////////////////m////wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///9b//////////////////////////////////////////////z8/P+1tbX/n5+f756e - nsGenp55n5+fOJ+fnxCfn58BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAcAAAAVAAAAKwAAAEgAAABtAAAAjV9fnO4VDa7/Cwux/xERsf8UDbH/FA20/xIUr/8UErL/FBKy/xQS - sv8UErL/FBKy/xQSsv8UErL/FBKy/xcStf8UErL/FRCx/w8Mpf8PDYn/JSl3/zQ6Zf84OVv/Ojlh/zY5 - Zf8fIHj/EguW/xIPqP8UEK//Fg61/xgQsf8TEbH/ExGx/xMRsf8TEbH/ExGx/xMRsf8TEbH/ExGx/xMT - rf8SDaT/Ew2K/ysref82OWX/ODpc/zo7Xf88O13/ODZa/zk4Wv85OFr/ODhc/zo5YP82NV3/KSdR/xoX - RP8REkr/Dw5W/xAPb/8QDon/Eg+g/xQRrf8TDrH/FBC1/xURsP8VEp3/EwuI/zAzcP84OWX/Njdd/zg4 - YP88O2f/CgyJ/xAQmv8UEKv/FA6z/xQOs/8UD7D/FRGw/xMQrP8TEbH/ExGx/xMRsf8TEbH/ExGx/xMR - sf8TEbH/ExGx/46N2v//////////////////////////////////v////wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///87 - ////+//////////////////////////////////////////////Gxsb/n5+f+p+fn+afn5+zn5+fdJ+f - nzSfn58Rn5+fAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAVAAAAKwAA - AEgAAABtAAAAjV1bnu8TDLH/CAiy/wwKsP8QCq//EQqz/woKsP8LCa//Cwmv/wsJr/8LCa//Cwmv/wsJ - r/8LCa//Cwmv/wsIsv8LCLH/Cgmt/wsIpP8VE47/R06H/2t0ff90eXj/dHR6/2dteP84OoD/Fg+a/w8K - qf8OCq//EAa2/xIJs/8LCa//Cwmv/wsJr/8LCa//Cwmv/wsJr/8LCa//Cwmv/wwNq/8OCKP/GROK/0xN - hf9qcHv/c3d4/3V3eP90dnb/dXR4/3d2eP92dXf/dHN1/3Z1ef96eH7/dnV+/3Fwev9lann/Rkpn/xob - U/8JCF7/CQV8/wsGl/8SDa7/DAax/wwIrf8PDJf/GxCK/1hegf9vdH3/cHN3/29yd/9tb3f/BgmJ/woL - mf8PCqv/Dwqz/wwKsP8MC67/Dguu/w4Kr/8LCa//Cwmv/wsJr/8LCa//Cwmv/wsJr/8LCa//Cwmv/4aF - 1////////////////////////////////////////9P///97////Q////wv///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////U/////v///// - ///////////////////////////////////9/f3/vr6+/5+fn/qfn5/ln5+ftZ+fn2qfn58xn5+fDZ+f - nwEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAVAAAAKwAAAEkAAABtAAAAjVpa - ne8UDLP/CQi2/w4Ltf8SDLH/EQ2z/wsJtv8NDbX/DQ21/w0Ntf8NDbX/DQ21/w0Ntf8NDbX/DQ21/w4N - t/8MDLb/Cwuz/wwJrP8YE5b/VFaQ/3uAgf+EgXz/goCA/3R7fv8/QYj/Fg2j/wsJr/8MDLT/DQq6/w4M - sv8PDLX/Dwy1/w8Mtf8PDLX/Dwy1/w8Mtf8PDLX/Dwy1/wkMtP8PCa7/HRWS/1lZj/97gIP/goR+/4OB - gP+DgHz/goB//4SDf/+Eg3//gYF7/31+ev99fnr/f4B+/4GBgf9/gYH/fX6C/3Fxg/9AP2n/FRNf/wwJ - fP8NCZ7/EQy1/wsJuf8ODZ//HRGT/2ZtiP98gYD/foB6/4F/fv97enz/Cw6U/w8No/8PC7H/Dwq5/w4L - tf8MDbH/DAyy/w4Ltf8NDbX/DQ21/w0Ntf8NDbX/DQ21/w0Ntf8NDbX/DQ21/zo4wv////////////// - ///////////////////////////////////////////////P////m////2P///8r////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///2P///////////////////// - /////////////////////////f39/7W1tf6fn5/5n5+f4J+fn7Cfn59rn5+fLZ+fnwsAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAVAAAAKwAAAEkAAABuAAAAjlpanO8XELX/DQy6/xEN - uv8UD7L/FBC1/xAOvP8PDrj/Dw64/w8OuP8PDrj/Dw64/w8OuP8PDrj/Dw64/w4Qtf8ODrj/Dg64/xIN - tv8fFqP/W1mb/4KCiP+JgIP/hH+I/3h/iP9DRJT/Fw+v/w0Nuf8LELn/DQ68/w0Ps/8RDrj/EQ64/xEO - uP8RDrj/EQ64/xEOuP8RDrj/EQ64/wgMvv8QC7r/Hhed/1tclv98f4f/gYGB/4eAh/+HgYb/g4KG/3+A - hP+AgoP/g4WF/4SGhv+ChIT/gYOE/4GDhP+FgIH/hIF9/4WGhP94eoX/R0h0/xcXcf8LCZH/Dgqv/wkL - xP8QEKr/IRSg/2pyj/99gYL/gH97/4SAhf9+e4T/EhOf/xIQqv8TDbr/Egy9/w8Nuv8ODrb/Dg23/w8M - vP8PD7f/Dw+3/w8Pt/8PD7f/Dw+3/w8Pt/8PD7f/Dw+3/xEOuP+1tOn///////////////////////// - ////////////////////////////////////////////////////8////7v///+D////S////xP///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///9v//////////////////////////////// - //////////////r6+v+ysrL/n5+f9p+fn9+fn5+pn5+fZ5+fnymfn58LAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAcAAAAVAAAAKwAAAEkAAABuAAAAjlhao+8QCb7/Dwy//xUUvv8TE7n/EhG7/xUS - vP8TErz/ExK8/xMSvP8TErz/ExK8/xMSvP8TErz/ExK8/xERu/8UEL3/FBO9/xAStv8bFbD/YGCg/4SI - if+KiIf/kYmK/36Eif9ERJ7/GxK2/xUSvP8UEr//FhO9/xQRu/8QEr7/ExO9/xYWvP8VEbb/GBK3/xsU - u/8VELn/GRO+/xUTuf8RD7z/Ghep/19env+HiIz/i4mJ/4eJif+Ghoz/hoiT/4aCq/+Ij6j/hpKc/4uT - oP+NkJ7/ioyW/4OMif+Fio3/lImF/5CMh/+AhYj/foOG/z47ef8ODYX/Eg+h/xQSsv8VFLf/GxOm/290 - k/+JhYr/ioWG/4aFh/+BgIn/FBeo/xUUsP8WErj/FhK//xQSv/8VFL7/FBO9/xISvP8VD7z/FxS+/xIR - u/8REL7/FBLC/xMSwP8UE73/ERG3/xMSvP8+Psj///////////////////////////////////////// - ///////////////////////////////////////////////////////////////b////o////2////8z - ////A////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////j/////////////////////////////////////////// - ///29vb/rq6u/p+fn/mfn5/en5+fqZ+fn1ufn58nn5+fCZ+fnwEAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAcAAAAVAAAAKwAAAEkAAABuAAAAjllapfARCr//EA3B/xcWwP8WFr7/FRS+/xgVv/8WFb//FhW//xYV - v/8WFb//FhW//xYVv/8WFb//FhW//xUVv/8ZFcL/FxbA/xMVuf8eGLP/ZGSk/4qOj/+Rj47/lZKO/4KO - kP9GSKD/Gxa1/xUVvf8UFL7/FRW//xYWwP8TEsD/ExLA/xYUwf8aFsP/GRbA/xgVv/8aF8H/FxS+/xkX - vf8VE8D/Hhut/2Rjo/+NjpL/kY+P/42Pj/+MjJL/eHS1/3pvz/+Cgtb/honT/42K2f+PitX/kYrT/46P - yf+Dh6r/k42S/5OOj/+Gi4n/jI6P/29wlv8WFoD/FhOf/xYUtP8YF7r/Hxeq/3R5mP+Pi5D/kYyN/4yL - jf+Hho//FRas/xcWtP8YE7z/FxLB/xcTwP8VFL7/FRS+/xUTwP8VFL7/FxbA/xYVv/8VFL7/FRPA/xQS - v/8WFb//Fha+/xYVv/8WFb//trbr//////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////9////8P///+P - ////U////xv///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///5v/////////////////////////////////////////////9PT0/6io - qP6fn5/1n5+f2Z+fn6Ofn59dn5+fI5+fnwgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAVAAAAKwAA - AEkAAABvAAAAjlxdrPUSC8D/EA/D/xoYxf8aGsL/GhnD/xwZw/8aGcP/GhnD/xoZw/8aGcP/GhnD/xoZ - w/8aGcP/GhnD/xkZw/8cGMX/GhnD/xYYvP8hG7b/aGio/5GVlv+YlpX/lpaW/4iTm/9GSqL/HBqw/xoZ - vP8WFrz/GRq+/xsbwf8dGsP/HxzG/xkXxP8aGcf/GRfH/xgXxf8cHMj/GBbD/xwawP8YFsP/IR6w/2hn - p/+TlJj/mJaW/5SWlv+Tk5n/U1G1/0lByv9RTdT/VlXT/1pV2v9fV9n/ZmDd/2lq2v9uccb/jIut/5KR - mv+UmZD/mZeW/4qPmP85Oor/GBSb/xgWtv8aGbz/Ihqt/3p/nv+Wkpf/mJOU/5OTk/+OjZb/Ghq0/xwa - uv8eGcL/HRnG/x0Zxv8aGcP/GxrE/xwax/8YG8T/FxrD/xoaxP8cHMT/GxrE/xoZw/8ZF8T/GRnF/xoZ - w/8aGcP/JyfH/4yM4f/x8fv///////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////////////////n - ////r////3P///8z////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wP///+r//////////////////////////////////////////////Dw8P+mpqb/n5+f9J+f - n9afn5+bn5+fWZ+fnyGfn58HAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAWAAAAKwAAAEkAAABvAAAAjlxd - rfUTC8P/EhHF/x4cyf8eHsb/Hh3H/yAdx/8eHcf/Hh3H/x4dx/8eHcf/Hh3H/x4dx/8eHcf/Hh3H/x0d - x/8gHMn/HRzG/xocwP8kHrn/bGys/5ebnP+enJv/m5mf/46Vpv9LS5//Hxqf/xsapv8XFKX/Fxik/xYX - pf8aFqX/Hhut/xsZs/8cG77/Hh/H/xsbx/8bGsj/HRvL/x8dw/8cGsf/JCGz/2xrq/+am5//n52d/5qc - nP+ZmZ//RUm5/ysowf8qKcX/Ky3H/y8qy/8zL8v/PDnS/0FEz/9HS8//bmq8/5SUpP+fopn/oZ2c/5SY - k/9tcp//HRad/xkYtv8cHLz/Jh6x/4CFpP+dmZ7/n5qb/5qamv+UlJr/Gxy0/xwbuf8eGr//IBzB/x4d - wf8dHL//HRzA/x4cwv8cHsP/GxzE/xwbxf8hHsj/IB3G/yAgyP8eHcf/HR3J/x4dx/8eHcf/Hh3H/x4d - x/8yMcz/nJzm//j4/f////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////+z - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8D - ////w//////////////////////////////////////////////o6Oj/o6Oj/J+fn/Ofn5/Tn5+fm5+f - n06fn58fn5+fBQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAWAAAALAAAAEoAAABwAAAAjlxdrfUSDcT/FBLJ/yEf - zP8iIsr/IiHL/yQgzf8iIcv/IiHL/yIhy/8iIcv/IiHL/yIhy/8iIcv/IiHL/yIizP8lIc7/IiHL/yAi - xv8pI77/cXGx/5+jpP+npaT/rKar/5qbqf9RTY7/HBl1/xUUcv8TEXH/Fxdx/xYXcv8XFnj/FxZ+/xka - jP8YGZn/Ghyq/yMiwP8kIcr/Ih/P/yQiyP8hH8z/Kie5/3Jxsf+io6f/qKam/6KkpP+hoaf/Rky9/yYh - wv8gH8n/IiLM/yIfz/8nIc7/KifR/yotzP8wM9X/Rj3D/5OWsv+opqX/qKSj/6impv+MlKX/Jhuh/x0c - uP8fH7//KiK1/4aLrP+loaf/qKOk/6Kjof+cnaH/HiCk/xwcpP8bGqb/HBun/x0dp/8dHaX/Ghym/xsc - qv8dHa3/IR+5/yEdw/8lIc7/Ih/J/yIiyv8iIsr/ISHL/yIhy/8iIcv/IiHL/yIhy/8iIcv/IiHL/y8u - zv9gX9n/kJDl/7298P/x8fz///////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////+f////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////C////8f///// - ////////////////////////////////////////5OTk/6CgoP2fn5/xn5+f0p+fn5afn59Sn5+fG5+f - nwUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAcAAAAWAAAALAAAAEoAAABwAAAAj1xdr/UTDcb/FxXM/yUj0f8mJ8//JibS/ygk - 0f8mJc//JiXP/yYlz/8mJc//JiXP/yYlz/8mJc//JiXP/yYm0P8qJtP/JiXP/yQmyv8sJsH/dXW1/6er - rP+vraz/s6+q/6alp/9wb5H/Sklz/0VGbP9FRGz/Rkhq/0RFa/82N2r/GRpS/xcXV/8aHGr/Gxt//yEg - nv8lI7n/KSXK/ycly/8lI9D/LSq8/3d2tv+pqq7/sK6u/6qsrP+pqa//S1G8/yomwv8oJc7/KSnR/yYk - 0v8oJc//KSXS/ykqzv8mKtb/NyvR/4yOt/+trK7/rKqp/7Ovtf+boqX/Ny6n/yAguv8iI8H/Lia5/4yR - sv+sqK7/r6qr/6qrqf+lp6j/ICF8/xoZef8WFXX/FRVz/xYXcf8WF3H/FhZ0/xcWeP8ZF3v/IR+X/yAa - r/8pJcv/JyXS/yQkzv8mJs7/JibO/ycm0P8nJtD/JybQ/ycm0P8nJtD/JybQ/ycm0P8nJtD/JiXP/yUl - 0f8pJs//Q0PW/3Nz4f+Xluj/0M/z//7+/v////////////////////////////////////////////// - //////////////////////////////////////////////+L////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///xf////X//////////////// - /////////////////////////////9/f3/+goKD+n5+f8J+fn86fn5+Pn5+fS5+fnxmfn58EAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAcAAAAWAAAALAAAAEoAAABwAAAAj1xdsPUUDcj/GhjQ/ygn1f8rLNT/KirW/ysp1v8rKtT/KyrU/ysq - 1P8rKtT/KyrU/ysq1P8rKtT/KyrU/yoq1P8uKtf/KinT/ygqzv8wKsX/enq6/6+ztP+4trX/urev/7m6 - tv+rrLr/p6qy/62xsv+ysLb/sbCy/62stf+sq7v/qqq4/5qarP9qaoj/MzJq/xkZc/8gHpr/LCm7/yoo - zv8oJtP/MS7A/3x7u/+xsrb/ube3/7O1tf+xsbf/UFi9/zAuxP8tLM//LC7Q/ysr0f8uLdH/LCzU/ywu - 0v8kKdL/NCzT/4GAuP+ztLj/sraw/7eyu/+tsLj/UU6x/yUlv/8nKMb/Myu+/5KXuP+0sLb/uLO0/7O0 - sv+vsbL/UVB6/0xLd/9IR3P/R0dv/0lJbf9ISWv/SEdv/0pHdP9KTHX/QkCM/yEemf8oJcH/KyvV/ygq - 1v8sK9X/LSrU/ysq1P8rKtT/KyrU/ysq1P8rKtT/KyrU/ysq1P8rKtT/KinT/yoq1v8uK9T/KSnT/yop - 1/8KCcr/GBHG/6OjtP/Nzc3/4uLi//Ly8v/6+vr///////////////////////////////////////// - //////////////////////////////9/////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8X////5/////////////////////////// - ///////////////////V1dX/n5+f/J+fn/Gfn5/Jn5+fip+fnz6fn58Un5+fAQAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAWAAAALAAA - AEsAAABwAAAAkF1esfUVDsn/HBrS/ysq2P8uL9f/Li7a/y4s2f8vLtj/Ly7Y/y8u2P8vLtj/Ly7Y/y8u - 2P8vLtj/Ly7Y/y4u2P8yLtv/Li3X/ywu0v81L8r/gIDA/7a6u/+/vbz/wr+7/7+/v/+7u8f/u8C+/8HC - uf/Cvbz/wb24/8K8wf/Av7v/w8G5/8HAtv/BwcH/mZiy/0dGiP8eHoj/KSmr/y0r0f8rKdb/NTLE/4GA - wP+3uLz/wL6+/7q8vP+5ub//VVjE/zMuzf8vLNb/Li3X/y8t2v8zL9z/MCzf/y8u3P8qMdT/My7N/4N+ - w/+6vL3/vMS6/7u6vv+2tsj/XmKx/ysrxf8tLsz/OTHE/5mev/+8uL7/wLu8/7y9u/+4urv/uLa8/7Wy - u/+0srj/tbS2/7W2tP+1tLD/tbK0/7ayuP+tsbL/hIWx/zk2nf8rKb7/LS7W/yst2f8xL9z/MizZ/y8u - 2P8vLtj/Ly7Y/y8u2P8vLtj/Ly7Y/y8u2P8vLtj/Li7W/y0t2f8xLtf/LCzW/ywr2f8LCsz/GRLH/6Gg - tP+/v7//zMzM/9fX1//a2tr/3d3d/+Xl5f/s7Oz/9PT0//39/f////////////////////////////// - //////////////9f////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wP///+n////a////w////8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////J////+f///////////////////////////////////// - ////////z8/P/5+fn/yfn5/qn5+fv5+fn3Wfn581n5+fCQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAWAAAALQAAAEsAAABxAAAAkFtb - t/UNCtH/GhzY/zYy3/86M9z/ODPc/zY32/82NNr/NjTa/zY02v82NNr/NjTa/zY02v82NNr/NjTa/zM0 - 3P84Mt3/NzXb/zM02P85OcP/hILI/8LCzv/Hx8f/yMPF/8bHw//Cws7/xsrF/8vGx//Mx8T/y8bD/8vG - x//JyMr/v8m9/8nCyf/RyMT/xMTK/6+yx/9BQIL/IyuW/zEvvv8zMs7/OzbH/4SDx//CxMz/xcXF/8TH - xf/CwcX/W17H/zkwzf80Mtj/MzXZ/zMz2f83Ntr/NDTc/zM02P81MtX/Nz3G/4N+yf/Dwsv/vMfF/8jJ - x//EwMz/XF/B/zI0z/8yNM//PDPD/5+hyv/FxsL/xsbG/8bGxv/KxsX/x8bK/8LBw//CwcP/xMTE/8PD - w//DwsT/wsHF/8C/w/+7wL//lZ6//z85wP8wLNn/MTPf/zMw5P83Ntn/NzPZ/zY02v82NNr/NjTa/zY0 - 2v82NNr/NjTa/zY02v82NNr/NDHa/zo03/83NdX/NTba/zcz2P8FBdv/CwzS/6Khq/+9vb3/y8vL/9bW - 1v/Z2dn/2dnZ/9fX1//V1dX/1dXV/9PT0//Z2dn/+vr6//////////////////////////////////9X - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///3////// - //////////f///+n////P////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///zf////z/////////////////////////////////////////////8nJ - yf+fn5/7n5+f4p+fn6ifn59bn5+fGZ+fnwQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAWAAAALQAAAEsAAABxAAAAkF9fv/kOC9L/HB7a/zk2 - 4P8+N97/PDfg/zo73/87Od//Oznf/zs53/87Od//Oznf/zs53/87Od//Oznf/zg43v87Nt//Ojje/zY3 - 2/89Pcf/iIbM/8fI0v/Mzcv/zs7I/8nQyf+5utb/ur7W/8DC2v/Gxtj/xcXX/8TG2P/Bv9X/xtLS/83O - zP/WzMz/0c/P/8TFz/+QkLj/MzCd/zIwv/81NND/PjnK/4iHyf/HydH/y8vL/8vOzP/JyMz/YmLM/0A4 - 0/89Od7/OTvd/zY23P88O9//Ojfg/zg32/84Ndj/NTfF/4qIyv/Ny9H/xs7N/9LRzf/Cwcr/Z2fT/zk7 - 1v84OtX/QjnJ/6ao0f/Mzcn/zczO/83Nzf/OzMz/zs7O/83OzP/Nzsr/zc7K/8vMyP/Ky8f/ysvH/8rL - yf/KydL/pKrP/1RP0P8/PN//OTvf/zk35f87O9v/PTjh/zo43v86ON7/Ojje/zo43v86ON7/Ojje/zo4 - 3v86ON7/OTbf/z454v87Otj/ODnd/zo22/8GBtz/DA3T/6OirP++vr7/y8vL/9bW1v/Z2dn/2NjY/9bW - 1v/U1NT/09PT/9LS0v/Nzc3//f39//////////////////////////////////8/////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////L/////v///////////////////// - /////////9////93////G////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///87////+/////////////////////////////////////////39/f+9vb3/n5+f85+f - n9Gfn5+An5+fL5+fnwwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAcAAAAWAAAALQAAAEwAAABxAAAAkV5gwvoOC9b/HyHd/z885f9EP+L/QT3i/0FA - 4/9AP+P/QD/j/0A/4/9AP+P/QD/j/0A/4/9AP+P/QD/j/z0+4v9BPeP/QD/j/zw+4P9EQsr/jozS/87P - 2f/V1tT/1tTT/8nO1/+cmOD/kZDm/5ic6/+cn+n/oaHv/6Gj6f+qqef/srvh/87S1//Z0tf/19fR/9TV - 0f/HydT/Ukis/zY0w/84N9P/Qj7N/46Nz//P0tf/1NTU/9TX1f/S0dX/Y2fN/0I80f9BQN7/P0Lg/z49 - 4f9CP+L/QT3j/z8/3/9APt7/NzXE/5ORxf/Y1df/0dPU/9fW0v/R1Nn/aGbh/0JB3f8+QNv/Rz7O/6ut - 1v/S1dP/1dTW/9TT1f/V0tT/wL3W/8bD3P/Kyd3/ycnb/8nJ2//Jydv/ycnb/8nJ2//Dv+P/o6Tg/2Vg - 4f9OTOX/P0Pe/0A+5P8/QN7/QD3m/0A/4/9AP+P/QD/j/0A/4/9AP+P/QD/j/0A/4/9AP+P/Pz7i/0RA - 5v9BQNz/Pj/j/z084P8HBt7/DQ3V/6Ohrf++vr7/y8vL/9XV1f/Y2Nj/19fX/9XV1f/S0tL/0tLS/9DQ - 0P/Kysr///////////////////////////////////////8r////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8D////z/////////////////////////////////////////// - ////+////7P///9T////A////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////U/////v////////////////////////////////////////29vb/oqKi+p+fn+afn5+in5+fU5+f - nxmfn58CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAcAAAAWAAAALQAAAEsAAABxAAAAkF5fw/oPDNj/IiTh/0RC6P9LRuX/RkPm/0ZG5v9GQ+b/RkPm/0ZD - 5v9GQ+b/RkPm/0ZD5v9GQ+b/RkPm/0VF5f9IQ+b/R0Tn/0BD4v9JR8//lJPX/9XW4P/d3tz/4uDf/83T - 5v+Be+b/aGPu/21v8/9wcfH/d3P6/3l69P+Bfuz/gYXk/7W24v/b2d//3N3Z/97f1v/Z29v/gHfI/zw7 - x/8+Ptj/R0PS/5ST1f/W2d7/3Nzc/9zf3f/Z2Nz/am/V/0RB0/9CRN7/Q0ni/0JE5v9GROT/REHk/0RE - 3v84OMz/Qz7B/66u0v/g29z/3tvd/93c2P/M0t3/VVHY/0hI4v9ERN7/S0LS/7Cy2//Y29n/3Nvf/9na - 3v/a1tv/jYbh/5mS7f+hm/L/op3y/6Sg8v+kofH/op/v/6Of8f+bluv/h4Xp/2Fg7P9OUen/RUfi/0dE - 5/9FROD/R0Pp/0dE5/9HROf/R0Tn/0dE5/9HROf/R0Tn/0dE5/9HROf/R0Tn/0lG6f9GRuD/Q0Xn/0JB - 5f8IB9//Dg7W/6Ghr/++vr7/y8vL/9XV1f/X19f/1tbW/9TU1P/R0dH/0NDQ/87Ozv/Q0ND///////// - //////////////////////////////8f////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///+D//////////////////////////////////////////////////////////////// - ////5////4v///8n////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///2P///// - ////////////////////////////////////////ycnJ/p+fn++fn5+0n5+faJ+fnyKfn58EAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAWAAAALAAA - AEoAAABwAAAAj19fxfoPC9n/JCbj/0lI7P9QTOf/TEjn/0xL6f9MS+n/TEvp/0xL6f9MS+n/TEvp/0xL - 6f9MS+n/TEvp/0pM5/9NSOn/TEvp/0VI5v9NTNL/mZja/9vd5f/j5OL/5ejZ/9Lb5f91cN3/UE3f/1JV - 5v9VVub/WFbv/1pc5v9iXOn/Xlvn/42H3v/d4uX/3+Pk/+Hi3v/e3uT/l5bU/0ZF0f9FRd//TEnV/5mY - 2v/c3+T/4uLi/+Hk4v/f3uL/b3Lf/0tG3f9ISuT/SE3m/0pK6v9QS+z/Skbl/0RE1v9BQb3/RECn/8XF - 3f/n4uP/5OHj/+Tl4//Dxef/V1Tg/09Q6P9KS+P/UEjV/7a44f/f4uD/4+Lm/9/g5P/e3eH/YGHh/2xu - 6/90dvL/dXjy/3d78v92evD/dHju/3N37v9wbO3/ZGTu/1ZY8v9NUez/Skrq/09K6/9PS+b/T0rt/0xL - 6f9MS+n/TEvp/0xL6f9MS+n/TEvp/0xL6f9MS+n/S0ro/09K6/9NS+T/SUzr/0ZF6P8IB9//DA7Y/6Kh - sf++vr7/ysrK/9TU1P/W1tb/1tbW/9PT0//Q0ND/z8/P/8zMzP/Pz8////////////////////////// - //////////////8D////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///zf////7 - //////////////////////////////////////////////////////////////////////////////// - ////w////1////8H////AP///wD///8A////AP///wD///8A////AP///wD///9v//////////////// - ////////////////////////9vb2/6KiovGfn5+3n5+fbJ+fnyOfn58EAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAVAAAAKwAAAEgAAABtAAAAjV5g - yPoQCt3/Jifn/01M7/9VU+j/UU/p/1FQ7P9RUev/UVHr/1FR6/9RUev/UVHr/1FR6/9RUev/UVHr/1FR - 6/9UUOz/U1Ds/0xO6f9SUdb/nZze/+Hj6//p6ub/6erg/9rh8P96ddj/T0zR/1BP2/9PT9n/UEzb/05N - 0v9PSs//Qj7F/310zv/f5OX/4+fs/+Tm5v/c3ev/nZ3d/1JS3P9OT+f/Uk/b/52d3f/h5On/6Ojo/+fp - 6f/j4ub/b2/Z/09I2f9NTd3/TE7c/05K3/9RTN3/SEPO/zw8uP84OJL/bGyo/93d6//s6ur/6Ojo/+Lk - 5f+zsvL/Yl/r/1dW7P9PUOb/VE3Y/7u95f/l6eT/5+nq/+Xm6v/j4ub/TUrj/1FP5f9UUuf/VVTm/1ZW - 5v9WVub/VVXl/1VU5v9ZV9//UlLi/1FT5/9OT+X/Uk7t/1VQ7/9UUer/U1Ds/1FR6/9RUev/UVHr/1FR - 6/9RUev/UVHr/1FR6/9RUev/UFDq/1RR7f9SUef/TlHw/0xL7v8JCOL/Dg/b/6Kgs/++vr7/ysrK/9TU - 1P/W1tb/1dXV/9PT0//Pz8//zc3N/8vLy//T09P///////////////////////////////////v///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////B////9f///////////////////// - ///////////////////////////////////////////////////////////////////////////////z - ////l////zP///8A////AP///wD///8A////AP///wD///8A////k/////////////////////////// - /////////////8rKyvWfn5+wn5+fYZ+fnx+fn58DAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAATAAAAKAAAAEQAAABoAAAAiGBhy/oSDOH/Jyrq/1JS - 8v9aWev/VlTt/1dX8f9YVu//WFbv/1hW7/9YVu//WFbv/1hW7/9YVu//WFbv/1dY7v9aVvH/WVfx/1FT - 7f9XV9n/oqLi/+bo8P/v8Oz/7+zu/+Pk+P97dcb/R0Wp/0Q/sv9DP7D/Pzyp/zw7ov81NJL/PkKT/6Ch - zf/o5+v/6+zw/+7y7f/k5vH/oJvw/15e6P9WV+//V1Tg/6Ki4v/m6e7/7e3t/+zu7v/p6Oz/dHPD/0lC - tf9BQrL/QESt/z8+rP8+OqP/NzaU/zM3hf85OnT/ur7Q//Hw+f/s7Oz/7/Lw/+To7f+ck/T/Z2ju/1xc - 7v9WVuj/WVHa/8DD6f/r7+n/7O7v/+nr7P/o5+n/Ske7/0RBtP9BP7D/Q0Gy/0NCsP9DQbL/Q0Gy/0RB - tP9FQ63/QEC2/0VJv/9KS8v/V1Hm/1lU7f9YWOz/U1bu/1hW7/9YVu//WFbv/1hW7/9YVu//WFbv/1hW - 7/9YVu//WFft/1lX8f9XV+v/VVb0/1FQ8/8ICeP/Dw/d/6Oitv+/v7//y8vL/9TU1P/W1tb/1dXV/9LS - 0v/Ozs7/zMzM/8fHx//T09P//////////////////////////////////9////8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////i/////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////////////////T - ////b////xP///8A////AP///wD///8A////B////+f//////////////////////////////////9TU - 1PWfn5+jn5+fUZ+fnxifn58CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAQAAAAQAAAAIwAAAD4AAABhAAAAgmVm0/4UDuP/Ki3t/1ZX9f9eXu7/Wlnv/1tb - 9f9cW/H/XFvx/1xb8f9cW/H/XFvx/1xb8f9cW/H/XFvx/1tc8v9eW/T/XVv0/1VY8P9aWtz/pqbm/+nr - 8//y8+//+PTz/+bo8v90dKr/Nzp3/y0sfP8vLnj/Kixt/yYrav8sLGj/ZG+N/+Hp6P/58fj/8/Dy//H0 - 6//r7/T/lInx/2Vl7f9cXfX/W1jk/6Wl5f/q7fL/8fHx//Dy8v/t6/H/dXWl/zs1h/8nLHf/KjF2/yos - c/8pKWn/LS9l/ztEZf+pqtD/7vbs/+3s8P/09vb/6/Du/9zk6/+IfPL/bG7w/2Fi8v9aW+v/Xlfe/8XJ - 7P/v8+3/8PLy/+zw8f/s6+3/Q0KG/zc2ev8wL3H/MTBy/zEwcv8vLnD/MC9z/y8tc/8vLnb/LiyF/zc7 - lP9ERLD/WlHe/11X6v9bXu//VVzz/1xb8f9cW/H/XFvx/1xb8f9cW/H/XFvx/1xb8f9cW/H/XFvx/11b - 9P9bW+3/WVr4/1RT9v8JCuT/ERHf/6Sjt//AwMD/zMzM/9TU1P/W1tb/1dXV/9HR0f/Nzc3/y8vL/8bG - xv/X19f//////////////////////////////////8////8A////AP///wD///8A////AP///wD///8A - ////AP///wD///83////+/////////////////////////////////////////z8/P////////////// - //////////////////////////////////////////////////////////////////////////f///+n - ////R////wD///8A////AP///9f//////////////////////////////////8PDw+ufn5+Sn5+fPp+f - nxEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAMAAAANAAAAHgAAADcAAABXAAAAeGtp2v8YCe3/LjDz/1pi6/9iY+n/Z2H8/15k6/9jZPL/Y2Ty/2Nk - 8v9jZPL/Y2Ty/2Nk8v9jZPL/Y2Ty/2Rj7/9iYPb/X2Px/19h7/9lYOX/pajl/+zx8v/58/j/8vT8/+Tl - 7/+8vMr/mJen/5GPov+Ni57/jo2d/5ycqv/LytT/8fDs//jz8P/78/r/+Pnw/+767v/T1v//jHv0/29x - 9f9hYPL/YmHf/6ap5v/s7vb/+/bz//f09v/t8vX/sq/I/5yZsv+Ni6H/j42h/5KRof+em6r/wb/L/+jm - 8v/17vX/9/Py//X17//2+Pn/4OP//62u8v+CgPH/cm/6/2Rn8f9jYOz/Z1/c/8LG7//w8/f/+fT2//Xx - 9v/x8u7/mJas/5ORp/+PjaP/joyi/46Mov+Ni6H/jYuh/46Mov+QjaP/kZGh/5OWtf9XV6P/UlDL/15f - 7f9gYvD/YmTu/2Jj8f9iY/H/YmPx/2Jj8f9iY/H/YmPx/2Jj8f9iY/H/XGTz/2xj8/9lZ+v/X2Xs/1lb - 9f8GAvX/GA/s/6ius//ExMT/zMzM/9PT0//T09P/0dHR/9DQ0P/MzMz/yMjI/8TExP/b29v///////// - /////////////////////////7////8A////AP///wD///8A////AP///wD///8A////AP///wf////X - ////////////////////////////////////////5ubm/7+/v//c3Nz/8/Pz//////////////////// - /////////////////////////////////////////////////////////////////////////9////+T - ////o////////////////////////////////////////7e3t86fn59zn5+fJ5+fnwkAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAKAAAAFwAA - AC0AAABKAAAAa25w3P8TCe//LzHz/2Ro9v9rZ+//a2r2/2Zn9/9oafX/aGn1/2hp9f9oafX/aGn1/2hp - 9f9oafX/aGn1/2pq9P9oZ/n/Zmn0/2Rl8f9sZ+j/ra7q/+/09f/69ff/9ff3//f5+v/x8vb/7ez1//Lx - +v/y8fr/7+/1//Hx9//y8vL/+/n4//z3+P/48/T/+Pz3/+fw+f+3uPT/jYP1/3V3+f9pZ/b/a2nk/62x - 7P/w8vr//vr1//r49//y9/b/8/T+/+3u+P/u7fb/8PD2//Dx9f/w7/P/9PP1//z7/f/49fH/+/r2//n7 - +//t8P7/yMz1/5qb6/9+ffH/dHH8/2ps9v9oZfD/cmni/8jO8//0+Pn//Pf4//v29//3+fP/9Pb3//Hz - 9P/v8fL/7/Hy/+/x8v/v8fL/7/Hy//Dy8//w8Pb/7fD0/9nd9f+AgMb/YF7V/2Zl8f9oafX/Zmjy/2hp - 9f9oafX/aGn1/2hp9f9oafX/aGn1/2hp9f9oafX/Ymn2/25m+f9mZ+3/a2z6/19j8v8HCPL/Egvo/6mv - uv/Gxsb/zc3N/9PT0//T09P/0dHR/9DQ0P/MzMz/yMjI/8TExP/e3t7///////////////////////// - /////////6f///8A////AP///wD///8A////AP///wD///8A////AP///4v///////////////////// - ///////////////////4+Pj/vb29/8nJyf/Hx8f/wsLC/8vLy//l5eX/+Pj4//////////////////// - //////////////////////////////////////////////////////////////////////////////// - /////////////////////////////6amppKfn59Jn5+fE5+fnwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAGAAAAEQAAACMAAAA9AAAAW3N2 - 4f0KCen/Mjf4/2po/f95c/r/b27z/21u/P9vb/f/b2/3/29v9/9vb/f/b2/3/29v9/9vb/f/b2/3/3Fw - 9f9wb/v/bXD3/25v9f97du//uLn1//L5/P/9+vz/+Pr0//n69v/6+/n/+/v7//v7+//8/Pz/+/v7//j5 - 9//7/ff/+Pf7//z6///2+Pj/8Pb9/9HU//+cnPD/i4j2/3h69/9wbvb/d3bq/7e49P/z9f////35//38 - +P/3/fj/+Pz3//n9+P/7/Pj/+/z4//z9+f/9/vr/+fv1//X38f/+//v/9/n6/+vt///S1Pz/qq3x/4yN - 7/+Afvn/dXL9/29v9/9xbvP/fnfq/87U9//2+f3/+/n5//v5+f/5/ff/+vr6//n5+f/5+fn/+vr6//v7 - +//6+vr/+vr6//r6+v/4+/L//f/7/+3x//+Yl9n/cW7h/25u9v9ucPr/bm72/29v9/9vb/f/b2/3/29v - 9/9vb/f/b2/3/29v9/9vb/f/a2/2/3Nt//9vcPb/dnD9/2Ro7/8ECu3/EArr/6+zxf/Kysr/z8/P/9TU - 1P/T09P/0dHR/9DQ0P/MzMz/yMjI/8TExP/j4+P//////////////////////////////////5v///8A - ////AP///wD///8A////AP///wD///8A////N/////v///////////////////////////////////// - ///Pz8//wcHB/8jIyP/Kysr/xsbG/8TExP+4uLj/uLi4rP///1H///+z////+/////////////////// - //////////////////////////////////////////////////////////////////////////////// - ////////9fX165+fn0afn58bn5+fBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAEAAAACwAAABkAAAAuAAAASXR43O8JC+z/Ky/6/29t - //9/evv/dXP1/3V4+P92dvj/dnb4/3Z2+P92dvj/dnb4/3Z2+P92dvj/dnb4/3V38/90dvr/dHb4/3t6 - +v+Lhvn/vr/8/+3y///49///+vz9//f4/P/3+Pz/9vf7//X1+//29vz/+fn///j4/v/4+///9fP///Tz - ///o7P7/z9P2/66u+v+Tkfv/hIT4/3x8+P99efr/iof0/76+/v/t7///+fn///j5/f/1+v3/+vz9//j6 - +//3+fr/9vf7//f4/P/5+v7/+fn///j4/v/z8///4eL8/8nM+f+vsfj/lJb1/4eH+f+Af/3/d3T5/3d2 - +/9/ffn/j4n4/8/W/f/y9f//9vX+//f2///2+f3/+Pr6//j6+v/4+vr/+fv7//n7+//4+vr/+Pr6//j6 - +v/39/f/+Pr7/+zt//+sqfH/hYP0/3h4+v9zdfn/d3b7/3Z2+P92dvj/dnb4/3Z2+P92dvj/dnb4/3Z2 - +P92dvj/dnj1/3Zz/v93dvz/eHXz/2Bj9P8CBu7/GxL1/7W5y//Nzc3/0dHR/9TU1P/T09P/0dHR/8/P - z//MzMz/yMjI/8TExP/m5ub//////////////////////////////////3////8A////AP///wD///8A - ////AP///wD///8H////1////////////////////////////////////////+Tk5P+8vLz/ysrK/8rK - yv/Gxsb/w8PD/8LCwv+1tbW36urqBgAAAAAAAAAA////F////3f////X//////////////////////// - ///////////////////////////////////////////////////////////////////+/v790dHRcZ+f - nxqfn58GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAABAAAABwAAABEAAAAhAAAAN32EzMYPBvf/GBf2/3F2//98fPL/gYD4/3x/ - +f99ffn/fX35/319+f99ffn/fX35/319+f99ffn/fX35/36A9v97ffr/enz4/4WE/P+Sj/3/trX9/9TX - /f/e3vz/4d/8/+Lg/f/j4f7/5OL//+Ti///j4f7/4+H+/+Ph///d3P7/1tX8/87N9//Cw/X/qqzy/5iX - +f+Pjf//gIH7/4GA+P+GhPz/k5H7/7e2///V1v//39/9/9/g+v/e4Pj/4+L8/+Ph/v/j4f7/4+H//+Lf - ///f3v7/3Nv9/9nY+v/OzPr/wb/6/62t+/+YmPz/ior8/4KD/f9+fvr/fH33/4B8/f+Ghvz/lJH+/8DG - +//a3P7/4d/9/+Hh///e4vv/4uH7/+Lh+//j4vz/4uH7/+Lh+//h4Pr/4eD6/+Hg+v/k4f//3t78/9XS - //+qp/z/jov+/36A/P95e/f/f4D6/319+f99ffn/fX35/319+f99ffn/fX35/319+f99ffn/fYHy/3t6 - +P96ePr/fIDw/09O/P8FBfP/LiTz/7zAy//Q0ND/09PT/9TU1P/S0tL/0dHR/8/Pz//MzMz/yMjI/8TE - xP/t7e3//////////////////////////////////3P///8A////AP///wD///8A////AP///wD///+L - ////////////////////////////////////////9vb2/76+vv/FxcX/y8vL/83Nzf/Hx8f/wsLC/7S0 - tMDm5uYJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////N////5v////z//////////////////////// - ///////////////////////////////////////////////////t7e2nn5+fFp+fnwMAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAABAAAABAAAAAoAAAAWAAAAJo6WuowZBvX/DQn1/1pn+f+Eh/r/ior0/4B///+EhPr/hIT6/4SE - +v+EhPr/hIT6/4SE+v+EhPr/hIT6/4WG+P+Eg/v/g4L6/4qJ/f+TkP3/o6T8/7O0+P+8vPj/vLv5/7y7 - +f+8vPj/u7v3/7y8+P+7u/f/urn3/7y7+f++vP7/t7b4/7Gw+P+lpvf/nJv7/5OS//+Hhv7/goP9/4OD - +f+Jifv/k5H7/6Si+/+zsvr/urv4/72++P+9vvj/vbz6/7++/P++vfv/vLv7/727/f++vP7/urn9/7Sz - 9/+qqPr/pKL8/5mW/f+Li/3/h4b+/4WE/P+Cgvj/hYX5/4WD+/+Ki/v/kY///6is8/+4t/f/vbr4/76+ - +v+6vvj/vbr//767//++u///vbr//726//+9uv//vbr//726//+7t/7/t7b2/7Ow+P+dm/v/jo3//4aI - /v+Dg/f/hoP3/4SE+v+EhPr/hIT6/4SE+v+EhPr/hIT6/4SE+v+EhPr/goXx/4eF/f+Dgf3/e4X7/zEs - /f8JBPP/S0fi/8bJzv/S0tL/09PT/9PT0//S0tL/0NDQ/87Ozv/Ly8v/x8fH/8TExP/u7u7///////// - /////////////////////////1////8A////AP///wD///8A////AP///zf////7//////////////// - ////////////////////////y8vL/8bGxv/Ly8v/ysrK/8rKyv/FxcX/tbW1yerq6g8AAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8L////X////8P///////////////////////////// - //////////////////////////////n5+baurq4Un5+fAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA - AAUAAAAMAAAAGD9DSDVJPfH2DQf6/y849P+AhP//joz2/4WE//+Kivz/ior8/4qK/P+Kivz/ior8/4qK - /P+Kivz/ior8/4qL+/+Kif3/iYj8/4yN/f+Rkf3/mJf+/5ya+v+jofv/o6P//6Gi/f+hovz/oqP9/6Kk - /P+hovz/oaL9/6Gh//+hovr/np37/5mZ/f+Qkfn/jpD8/42N//+Hh/n/jI39/4qK/v+OjP3/lJL8/5iU - /f+cm/3/oKH8/6Oj/f+lov7/oqL8/6Oj/f+jov7/oKH8/6Gh//+iov//nqD+/5qc+v+XmP//k5P9/42O - /P+Jifv/ion9/4uL/f+Jivr/jI39/4yN/f+OkPz/kI7//5ea9f+gnPv/o576/6Ki/P+eovv/oqP5/6Kj - +f+io/n/oaL4/6Kj+f+jpPr/oqP5/6Gi+P+iof//oaH7/5yd9/+Ulf3/jI3//4mN/f+Mi/n/kIr7/4qK - /P+Kivz/ior8/4qK/P+Kivz/ior8/4qK/P+Kivz/iIv4/5GK//+Lif//YWn8/xIO+v8UD/T/f4jY/9DN - 1v/T09P/09PT/9LS0v/R0dH/0NDQ/87Ozv/Kysr/x8fH/8PDw//39/f///////////////////////// - /////////0f///8A////AP///wD///8A////C////9////////////////////////////////////// - ///i4uL/vr6+/8jIyP/Nzc3/yMjI/8LCwv+7u7vS2traFgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8n////h////+f///////////////////////////// - ///////k+fn5VJ+fnwWfn58CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAAGAAAADQAA - ABd+gOWjCQb2/xAO+v9tcPb/kYv//4yP//+PkP//j5D//4+Q//+PkP//j5D//4+Q//+PkP//j5D//5CO - //+Rkf//jo7//4+Q/v+Pkf3/lJL//5GP//+Wk///kZP//42P//+Okf3/kJT9/46S+/+Okf3/kJP//46R - /v+Slff/k5H//4+N//+Pkf//jpH+/4+P//+Tkv//kZP3/46P//+Qj/3/lJH+/5OP//+Rjv//kJH//5KR - //+UkP//kpX+/5CT/P+Qk/z/kZP//4+S/v+NkPz/jpH9/46U//+MkP//i4///5CS//+PkP7/kZD+/5OS - //+Qj/3/jo/9/5CQ/P+Okfr/kI7//5GR+/+Xkf//lpD//5KR//+Pkv//kJL+/5GT//+Rk///kJL+/5CS - /v+Rk///kJL+/4+R/f+Qkf//kJT6/5CT9f+QlP3/i4///4yP/P+Sj/z/mJH//4+Q//+PkP//j5D//4+Q - //+PkP//j5D//4+Q//+PkP//j5D//5GH//+Kivz/O0Hu/wMC/P8nIvr/rsTd/9XO2//T09P/09PT/9LS - 0v/R0dH/0NDQ/87Ozv/Kysr/xsbG/8PDw//5+fn//////////////////////////////////z////8A - ////AP///wD///8A////k/////////////////////////////////////////b29v+/v7//xcXF/8vL - y//Nzc3/xsbG/8DAwNvV1dUZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wP///8v////a////5////+T////b////0f///8PAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAACAAAABgAAAAxrbHkmRUD35woG - //8gGPn/dn///4mY//+Zmvz/mJb//5aS//+Vlf//lpz7/5Wd9/+SmPv/k5b//5aW//+Vlf//lZX//5WV - //+Vlf//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lpb//5aW - //+Wlv//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lpb//5aW - //+Wlv//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lpb//5aW - //+Wlv//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lZX//5WV//+Wlv//lpb//5aW//+Wlv//lpb//5aW - //+Wlv//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lpb//5mW//+YmPz/mJr4/5qZ+/+alf//m5P//5uW - //+cm/n/kZf//4GO+P9GSP//BAD9/xgW8v99heL/zNHU/+HT2f/U1NT/09PT/9LS0v/R0dH/0NDQ/83N - zf/Jycn/xsbG/8LCwv///////////////////////////////////////x////8A////AP///wD///8/ - /////////////////////////////////////////////8vLy//ExMT/ycnJ/87Ozv/BwcH/xMTE5NjY - 2B8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAUAAAAKsbTeVjMs8fwDCfz/Ewv//2Fa - //+RkP7/mZv//5ug+/+anfj/nZz+/6Gd//+hnf//oJ3//5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f - /f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f - /f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f - /f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/6Cg/v+goP7/oKD+/6Cg - /v+goP7/oKD+/6Cg/v+goP7/n5/9/5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f - /f+fn/3/n5/9/5+f/f+fn/3/n5/9/5yh9v+eoP7/np3//5uc//+anf//mJ79/5ed/v+Umf//c3T//yYg - //8DAP7/Fwz2/2pj6f/Dydz/1dnU/9PX0v/U1NT/09PT/9LS0v/Q0ND/z8/P/8zMzP/IyMj/xcXF/8TE - xP///////////////////////////////////////xf///8A////AP///wv////f//////////////// - ////////////////////////4uLi/7+/v//Jycn/y8vL/8PDw//Ly8vq1tbWJQAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAADAAAABrO48GwzMPf8Dgv1/xgE//8wJff/UU3//3R5 - //+Jkf//lJb//5yX//+imP//pZr//56b/v+em/7/npv+/56b/v+em/7/n5z//5+c//+em/7/npv+/56b - /v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b - /v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b - /v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b - /v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b - /v+em/7/npv+/56d+/+dm///mpn//5ia//+Ul///hoT//2pe/v9QPfj/EAX//woH9v8hF/f/enbn/8XJ - 2//R1Nj/09fR/9PR0f/T09P/0tLS/9HR0f/Pz8//zc3N/8rKyv/Hx8f/xcXF/8jIyP////////////// - /////////////////////////wD///8A////AP///5P///////////////////////////////////// - ///29vb/vr6+/8fHx//Jycn/x8fH/8bGxu3X19cuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAAALQ0/RFcGr+5RoX7/8PDPz/Cwf6/woF+/8KB/3/CQn9/wgK - +P8GC/T/Bw30/wQI+/8FCfz/BQn8/wQI+/8DB/r/BQn8/wYK/f8FCfz/BQn8/wUJ/P8FCfz/BQn8/wUJ - /P8FCfz/BQn8/wUJ/P8FCfz/BQn8/wUJ/P8FCfz/BQn8/wUJ/P8FCfz/BQn8/wUJ/P8FCfz/BQn8/wUJ - /P8FCfz/BQn8/wUJ/P8FCfz/Bgr9/wYK/f8GCv3/Bgr9/wUJ/P8FCfz/BQn8/wUJ/P8FCfz/BQn8/wUJ - /P8FCfz/BQn8/wUJ/P8FCfz/BQn8/wQI+/8ECPv/BAj7/wQI+/8ECPv/BAj7/wQI+/8ECPv/BQn8/wUJ - /P8FCfz/BQn8/wUJ/P8FCfz/BQn8/wUJ/P8FCfz/BQn8/wUJ/P8FCfz/BQn8/wUJ/P8FCfz/BQn8/woF - //8JB///CQj+/wcJ+/8HCfv/Bgr9/wQK/f8CCPv/Dw3z/z496/+dpt//z9PY/9PS1v/Q19L/zs3W/93V - 3P/T09P/0tLS/9DQ0P/Ozs7/zMzM/8nJyf/Gxsb/xMTE/8LCwv////////////////////////////// - /////////yP///8A////U//////////////////////////////////////////////Kysr/xMTE/8rK - yv/IyMj/x8fH89ra2jcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAA8vP/D7/K/WpsdP/PTEz8/ywj9v8dD/v/FQz9/xEM+/8ODff/DQ74/w8K - //8QC///Eg3//w4J/v8LBvv/Dwr//xEM//8LBvv/Dgn+/w4J/v8OCf7/Dgn+/w4J/v8OCf7/Dgn+/w4J - /v8OCf7/Dgn+/w4J/v8OCf7/Dgn+/w4J/v8OCf7/Dgn+/w4J/v8OCf7/Dgn+/w4J/v8OCf7/Dgn+/w4J - /v8OCf7/Dgn+/w4J/v8OCf7/Dgn+/w4J/v8OCf7/DQj9/w0I/f8PCv//Dwr//w8K//8PCv//Dwr//w8K - //8PCv//Dwr//w8K//8PCv//Dwr//w8K//8PCv//Dwr//w8K//8PCv//Dwr//w8K//8PCv//Dwr//w8K - //8OCf7/Dgn+/w4J/v8PCv//Dwr//w8K//8OCf7/Dgn+/w4J/v8OCf7/Dgn+/w8I/f8RC/z/Ew38/xAJ - +v8RCPj/Gxb1/y0x9P8/S/f/h4vq/7XB3f/Q19r/09TY/9jT1P/Y0tP/1NLR/8rR1P/S0tL/0dHR/8/P - z//Nzc3/y8vL/8jIyP/FxcX/wsLC/729vf/+/v7//////////////////////////////////9f///+n - ////+////////////////////////////////////////97e3v/AwMD/yMjI/8jIyP/MzMz21NTUQAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAOrz/yHr8v8z6/L/M+7z/zPl6fU1xsbSPpqcpk12d39hV1hefUJD - SJl7fYfPztHg/+Dj8v/f4vH/1Nfm/9TX5v/U1+b/1Nfm/9TX5v/U1+b/1Nfm/9TX5v/U1+b/1Nfm/9TX - 5v/U1+b/1Nfm/9TX5v/U1+b/1Nfm/9PW5f/T1uX/09bl/9PW5f/T1uX/09bl/9PW5f/T1uX/0tXk/9LV - 5P/S1eT/0tXk/9LV5P/R1OP/0dTj/9HU4//P0uH/z9Lh/8/S4f/P0uH/z9Lh/8/S4f/P0uH/z9Lh/87R - 4P/O0eD/ztHg/87R4P/O0eD/ztHg/87R4P/O0eD/zdDf/83Q3//Mz97/zM/e/8zP3v/Mz97/zM/e/8vO - 3f/Lzt3/y87d/8vO3f/Lzt3/y87d/8rN3P/Kzdz/ys3c/8TP1//Dztb/xc7X/8rQ2//Nzd3/y8nc/87K - 3f/Qzd3/1NnY/9nT2P/a1tX/09fR/9PT0//c19T/2drR/8bP0v/R0dH/0NDQ/87Ozv/MzMz/ysrK/8bG - xv/Dw8P/wMDA/7u7u//x8fH///////////////////////////////////////////////////////// - ////////////////////////9fX1/76+vv/FxcX/xsbG/8nJyfnX19dMAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADgAAACAAAAA6AAAAXAAAAH9sbWvE3d7c//Hy - 8P/r7Or/4uPh/+Lj4f/i4+H/4uPh/+Lj4f/i4+H/4uPh/+Lj4f/h4uD/4eLg/+Hi4P/h4uD/4eLg/+Hi - 4P/h4uD/4eLg/+Dh3//g4d//4OHf/+Dh3//g4d//4OHf/+Dh3//g4d//4OHf/+Dh3//g4d//4OHf/9/g - 3v/f4N7/3+De/9/g3v/f4N7/3+De/9/g3v/f4N7/3+De/9/g3v/f4N7/3+De/93e3P/d3tz/3d7c/93e - 3P/d3tz/3d7c/93e3P/d3tz/29za/9vc2v/b3Nr/29za/9rb2f/a29n/2tvZ/9rb2f/Z2tj/2drY/9na - 2P/Y2df/2NnX/9jZ1//Y2df/2NnX/9Xa2f/T19j/0tXZ/9TW1//U19X/1tfT/9fY1v/b2Nr/1dLU/9zT - 1v/e1dL/1tfO/9Hbzv/N09L/zcnU/9nW0v/Pz8//zs7O/83Nzf/Ly8v/ycnJ/8XFxf/BwcH/vr6+/7i4 - uP/R0dH///////////////////////////////////////////////////////////////////////// - ////////y8vL/8XFxf/Hx8f/ysrK/NbW1lUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAADAAAADgAAACAAAAA6AAAAXAAAAH9qamrE3d3d//Pz8//q6ur/4uLi/+Li - 4v/i4uL/4uLi/+Li4v/i4uL/4uLi/+Li4v/h4eH/4eHh/+Hh4f/h4eH/4eHh/+Hh4f/h4eH/4eHh/+Dg - 4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg4P/g4OD/4eHh/+Dg4P/g4OD/4ODg/+Dg4P/f39//39/f/9/f - 3//d3d3/3d3d/93d3f/d3d3/3d3d/93d3f/d3d3/3d3d/9zc3P/c3Nz/3Nzc/9zc3P/c3Nz/3Nzc/9zc - 3P/c3Nz/29vb/9vb2//a2tr/2tra/9ra2v/Z2dn/2dnZ/9nZ2f/Z2dn/2dnZ/9jY2P/Y2Nj/2NjY/9jY - 2P/X19f/19fX/9vW1//b1tj/29Xa/9nW2P/Y1tb/1dbU/9TV0f/T1c//1tnQ/9XZ1P/T0df/1s7Z/9DR - 2//K1NT/0dbN/9vOzP/Ozs7/zc3N/8zMzP/Kysr/yMjI/8TExP/AwMD/vb29/7a2tv+0tLT/9PT0//// - ///////////////////////////////////////////////////////////////////j4+P/xMTE/8fH - x//Hx8f80dHRXgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAADAAAADgAAACAAAAA6AAAAXAAAAH9ra2vE3d3d//Dw8P/q6ur/4uLi/+Li4v/h4eH/4eHh/+Hh - 4f/h4eH/4eHh/+Hh4f/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg - 4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg4P/f39//39/f/9/f3//f39//3t7e/97e3v/e3t7/3t7e/93d - 3f/d3d3/3d3d/93d3f/d3d3/3d3d/9zc3P/c3Nz/3Nzc/9zc3P/b29v/29vb/9vb2//b29v/2tra/9ra - 2v/a2tr/2tra/9ra2v/a2tr/2dnZ/9nZ2f/Z2dn/2dnZ/9nZ2f/Z2dn/2dnZ/9nZ2f/Y2Nj/2NjY/9fX - 1//X19f/19fX/9bW1v/W1tb/1tbW/9XV1f/V1dX/1dXV/9TU1P/T09P/09PT/9PT0//S0tL/0dHR/9DQ - 0P/Pz8//zc3N/8rKyv/IyMj/xcXF/8HBwf+9vb3/urq6/7S0tP+xsbH/xMTE//z8/P////////////// - /////////////////////////////////////////////+rq6v/Hx8f/ycnJ/8rKyv/Ozs5kAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADgAA - ACAAAAA6AAAAXAAAAH9ra2vE3d3d//Dw8P/q6ur/4eHh/+Hh4f/h4eH/4eHh/+Hh4f/h4eH/4eHh/+Hh - 4f/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg - 4P/g4OD/39/f/9/f3//f39//3t7e/97e3v/e3t7/3t7e/97e3v/d3d3/3d3d/93d3f/d3d3/3d3d/93d - 3f/d3d3/3d3d/9zc3P/c3Nz/3Nzc/9vb2//b29v/29vb/9vb2//b29v/2tra/9ra2v/a2tr/2tra/9ra - 2v/a2tr/2dnZ/9nZ2f/Z2dn/2dnZ/9nZ2f/Z2dn/2dnZ/9jY2P/Y2Nj/19fX/9fX1//W1tb/1tbW/9bW - 1v/V1dX/1dXV/9XV1f/V1dX/1NTU/9PT0//T09P/0tLS/9LS0v/R0dH/0NDQ/8/Pz//Ozs7/zMzM/8nJ - yf/Gxsb/w8PD/7+/v/+7u7v/uLi4/7Kysv+urq7/qamp/8rKyv/8/Pz///////////////////////// - ////////////////////////7e3t/8bGxv/Gxsb/ysrK/8nJyWoAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADgAAACAAAAA6AAAAXAAA - AH9ra2vE3d3d//Dw8P/q6ur/4eHh/+Hh4f/h4eH/4eHh/+Hh4f/h4eH/4eHh/+Dg4P/g4OD/4ODg/+Dg - 4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//3t7e/97e - 3v/e3t7/3t7e/97e3v/d3d3/3d3d/93d3f/d3d3/3d3d/93d3f/d3d3/3d3d/93d3f/c3Nz/3Nzc/9zc - 3P/b29v/29vb/9vb2//b29v/2tra/9ra2v/a2tr/2tra/9ra2v/a2tr/2tra/9ra2v/Z2dn/2dnZ/9nZ - 2f/Z2dn/2dnZ/9nZ2f/Z2dn/2NjY/9fX1//X19f/1tbW/9bW1v/W1tb/1tbW/9XV1f/V1dX/1NTU/9TU - 1P/U1NT/09PT/9LS0v/S0tL/0dHR/9DQ0P/Pz8//zs7O/83Nzf/MzMz/ysrK/8fHx//ExMT/wcHB/729 - vf+4uLj/tbW1/6+vr/+rq6v/p6en/76+vv/i4uL/8/Pz//39/f////////////////////////////z8 - /P/t7e3/ycnJ/8jIyP/Gxsb/xsbGcwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADgAAACAAAAA6AAAAXAAAAH9qamrE3d3d//Dw - 8P/p6en/4eHh/+Hh4f/h4eH/4eHh/+Dg4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg - 4P/g4OD/4ODg/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//3t7e/97e3v/e3t7/3d3d/93d - 3f/d3d3/3d3d/93d3f/c3Nz/3Nzc/93d3f/d3d3/3Nzc/9zc3P/c3Nz/3Nzc/9vb2//b29v/29vb/9vb - 2//b29v/2tra/9ra2v/a2tr/2tra/9ra2v/a2tr/2tra/9ra2v/Z2dn/2dnZ/9jY2P/Y2Nj/2NjY/9jY - 2P/Y2Nj/19fX/9fX1//W1tb/1tbW/9bW1v/V1dX/1dXV/9XV1f/U1NT/1NTU/9PT0//T09P/0tLS/9HR - 0f/Q0ND/0NDQ/8/Pz//Ozs7/zMzM/8vLy//Kysr/yMjI/8XFxf/CwsL/vr6+/7q6uv+1tbX/srKy/62t - rf+np6f/pqam/8HBwf/b29v/19fX/9fX1//e3t7/5+fn/+Xl5f/b29v/0NDQ/8rKyv/Kysr/yMjI/8LC - wv/Kysp5AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAADAAAADgAAACAAAAA6AAAAXAAAAH9qamrE3Nzc/+/v7//p6en/4ODg/+Dg - 4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg4P/f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f - 3//f39//39/f/9/f3//f39//3t7e/97e3v/e3t7/3t7e/97e3v/e3t7/3d3d/93d3f/d3d3/3d3d/9zc - 3P/c3Nz/3Nzc/9zc3P/c3Nz/29vb/9vb2//c3Nz/3Nzc/9vb2//b29v/29vb/9vb2//a2tr/2tra/9ra - 2v/a2tr/2dnZ/9nZ2f/Z2dn/2dnZ/9nZ2f/Z2dn/2NjY/9jY2P/X19f/19fX/9fX1//X19f/19fX/9fX - 1//W1tb/1tbW/9XV1f/V1dX/1dXV/9TU1P/T09P/09PT/9PT0//S0tL/0dHR/9DQ0P/Pz8//zs7O/83N - zf/MzMz/y8vL/8rKyv/IyMj/xsbG/8LCwv+/v7//vLy8/7i4uP+zs7P/sLCw/6urq/+lpaX/paWl/8TE - xP/W1tb/09PT/9HR0f/Pz8//zc3N/83Nzf/Gxsb/yMjI/8rKyv/ExMT/xMTE/8rKyoEAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAADAAAADgAAACAAAAA6AAAAXAAAAH9qamrE3Nzc/+/v7//p6en/4ODg/+Dg4P/g4OD/4ODg/+Dg - 4P/f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f - 3//e3t7/3t7e/97e3v/e3t7/3t7e/93d3f/d3d3/3d3d/93d3f/c3Nz/3Nzc/9zc3P/c3Nz/3Nzc/9vb - 2//b29v/29vb/9vb2//b29v/29vb/9vb2//b29v/2tra/9ra2v/a2tr/2tra/9nZ2f/Z2dn/2NjY/9nZ - 2f/Z2dn/2dnZ/9jY2P/Y2Nj/19fX/9fX1//W1tb/1tbW/9bW1v/W1tb/1tbW/9bW1v/W1tb/1dXV/9XV - 1f/U1NT/1NTU/9PT0//T09P/0tLS/9HR0f/R0dH/0NDQ/8/Pz//Ozs7/zc3N/8zMzP/Kysr/ycnJ/8jI - yP/FxcX/w8PD/8DAwP+9vb3/ubm5/7W1tf+wsLD/ra2t/6mpqf+jo6P/pqam/8fHx//R0dH/zs7O/83N - zf/Ly8v/y8vL/8fHx//Jycn/xcXF/8LCwv/BwcH/ysrKhwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADgAA - ACAAAAA6AAAAXAAAAH9qamrE3Nzc/+/v7//o6Oj/4ODg/+Dg4P/g4OD/39/f/9/f3//f39//39/f/9/f - 3//f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//3t7e/97e3v/e3t7/3t7e/93d - 3f/d3d3/3d3d/93d3f/d3d3/3Nzc/9zc3P/c3Nz/3Nzc/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb - 2//b29v/29vb/9ra2v/a2tr/2dnZ/9nZ2f/Z2dn/2dnZ/9jY2P/Y2Nj/2NjY/9jY2P/Y2Nj/2NjY/9jY - 2P/X19f/19fX/9bW1v/W1tb/1tbW/9bW1v/W1tb/1tbW/9XV1f/V1dX/1dXV/9PT0//T09P/09PT/9LS - 0v/R0dH/0dHR/9DQ0P/Q0ND/zs7O/83Nzf/MzMz/y8vL/8rKyv/IyMj/x8fH/8bGxv/CwsL/wMDA/729 - vf+6urr/tra2/7Kysv+urq7/qqqq/6ampv+ioqL/p6en/8nJyf/Nzc3/y8vL/8rKyv/Hx8f/xMTE/8nJ - yf/ExMT/xMTE/8LCwv/JycmQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADgAAACAAAAA6AAAAXAAA - AH9qamrE3Nzc/+/v7//o6Oj/4ODg/+Dg4P/f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f - 3//f39//39/f/9/f3//f39//39/f/97e3v/e3t7/3t7e/97e3v/d3d3/3d3d/93d3f/d3d3/3Nzc/9zc - 3P/c3Nz/3Nzc/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//a2tr/2tra/9nZ - 2f/Z2dn/2dnZ/9jY2P/Y2Nj/2NjY/9jY2P/Y2Nj/19fX/9fX1//Y2Nj/2NjY/9fX1//X19f/1tbW/9bW - 1v/W1tb/1tbW/9bW1v/W1tb/1dXV/9XV1f/U1NT/1NTU/9PT0//S0tL/0tLS/9HR0f/Q0ND/0NDQ/8/P - z//Pz8//zc3N/8zMzP/Ly8v/ysrK/8nJyf/Hx8f/xcXF/8TExP/AwMD/vb29/7q6uv+3t7f/tLS0/7Cw - sP+srKz/qKio/6SkpP+hoaH/p6en/8vLy//Ly8v/ycnJ/8jIyP/ExMT/wsLC/8DAwP/CwsL/vb29/8bG - xpYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADgAAACAAAAA6AAAAXAAAAH9qamrE29vb/+/v - 7//o6Oj/39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//e3t7/3t7e/97e3v/e3t7/3d3d/93d - 3f/d3d3/3d3d/93d3f/d3d3/3Nzc/9zc3P/c3Nz/3Nzc/9zc3P/c3Nz/3Nzc/9zc3P/c3Nz/29vb/9vb - 2//a2tr/2tra/9ra2v/a2tr/2tra/9ra2v/a2tr/2dnZ/9nZ2f/Z2dn/2dnZ/9fX1//X19f/19fX/9fX - 1//Y2Nj/2NjY/9jY2P/Y2Nj/19fX/9fX1//X19f/1tbW/9bW1v/W1tb/1tbW/9XV1f/W1tb/1dXV/9XV - 1f/U1NT/09PT/9LS0v/S0tL/0dHR/9HR0f/R0dH/0NDQ/9DQ0P/Pz8//zs7O/83Nzf/MzMz/zMzM/8vL - y//Jycn/x8fH/8bGxv/ExMT/wcHB/7+/v/+9vb3/urq6/7e3t/+0tLT/r6+v/6ysrP+pqan/pqam/56e - nv+ioqL/uLi4/8LCwv/FxcX/xMTE/8TExP/AwMD/v7+//7+/v/+9vb3/yMjInwAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAADAAAADgAAACAAAAA6AAAAXAAAAH9qamrE2tra/+/v7//n5+f/39/f/9/f - 3//f39//3t7e/97e3v/e3t7/3t7e/97e3v/e3t7/3t7e/97e3v/d3d3/3d3d/93d3f/d3d3/3d3d/93d - 3f/c3Nz/3Nzc/9zc3P/c3Nz/3Nzc/9vb2//b29v/29vb/9vb2//b29v/2tra/9ra2v/a2tr/2dnZ/9nZ - 2f/Z2dn/2dnZ/9jY2P/Y2Nj/2NjY/9jY2P/Y2Nj/2NjY/9fX1//X19f/19fX/9fX1//X19f/19fX/9fX - 1//X19f/1tbW/9bW1v/W1tb/1dXV/9XV1f/V1dX/1dXV/9XV1f/V1dX/1NTU/9TU1P/T09P/0tLS/9LS - 0v/R0dH/0dHR/9DQ0P/Q0ND/z8/P/87Ozv/Ozs7/zc3N/8zMzP/Ly8v/ysrK/8nJyf/Hx8f/xcXF/8TE - xP/CwsL/v7+//76+vv+6urr/t7e3/7S0tP+ysrL/rq6u/6urq/+np6f/oqKi/5+fn/+fn5//t7e3/8XF - xf/ExMT/v7+//8DAwP+8vLz/v7+//7q6uv/BwcGl5eXlAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAADAAAADgAAACAAAAA6AAAAXAAAAH9ra2vE29vb/+7u7v/n5+f/3t7e/97e3v/e3t7/3t7e/97e - 3v/d3d3/3d3d/93d3f/e3t7/3d3d/93d3f/d3d3/3d3d/9zc3P/c3Nz/3Nzc/9zc3P/c3Nz/3Nzc/9zc - 3P/b29v/29vb/9vb2//b29v/2tra/9ra2v/Z2dn/2dnZ/9nZ2f/Y2Nj/2NjY/9jY2P/X19f/19fX/9fX - 1//X19f/19fX/9fX1//W1tb/1tbW/9bW1v/W1tb/1tbW/9bW1v/W1tb/1tbW/9bW1v/W1tb/1NTU/9TU - 1P/U1NT/1NTU/9TU1P/T09P/09PT/9PT0//T09P/09PT/9LS0v/S0tL/0dHR/9DQ0P/Q0ND/0NDQ/8/P - z//Ozs7/zc3N/83Nzf/MzMz/y8vL/8rKyv/Jycn/yMjI/8bGxv/ExMT/w8PD/8HBwf+/v7//vb29/7u7 - u/+4uLj/tbW1/7Kysv+urq7/qqqq/6ioqP+kpKT/n5+f/5ycnP+kpKT/u7u7/8LCwv+9vb3/urq6/729 - vf+5ubn/uLi4/8DAwKvi4uIDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADgAA - ACAAAAA6AAAAXAAAAH9tbW3E3Nzc/+7u7v/o6Oj/3d3d/93d3f/d3d3/3d3d/93d3f/d3d3/3d3d/93d - 3f/d3d3/3d3d/93d3f/d3d3/3Nzc/9zc3P/c3Nz/29vb/9vb2//b29v/29vb/9vb2//a2tr/2tra/9ra - 2v/Z2dn/2dnZ/9jY2P/Y2Nj/2NjY/9fX1//X19f/19fX/9bW1v/W1tb/1tbW/9bW1v/W1tb/1tbW/9XV - 1f/V1dX/1dXV/9TU1P/U1NT/1NTU/9TU1P/U1NT/1NTU/9TU1P/U1NT/09PT/9LS0v/S0tL/0tLS/9LS - 0v/S0tL/0dHR/9HR0f/R0dH/0NDQ/9DQ0P/Q0ND/z8/P/8/Pz//Ozs7/zs7O/83Nzf/Nzc3/zMzM/8vL - y//Kysr/ycnJ/8jIyP/Hx8f/xcXF/8TExP/CwsL/wMDA/76+vv+8vLz/ubm5/7i4uP+0tLT/s7Oz/7Cw - sP+rq6v/p6en/6SkpP+ioqL/n5+f/5qamv+wsLD/vr6+/7q6uv+4uLj/urq6/7i4uP+1tbX/vLy8seLi - 4gYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADgAAACAAAAA6AAAAXAAA - AH9ubm7E3d3d/+7u7v/n5+f/3d3d/93d3f/d3d3/3d3d/93d3f/d3d3/3d3d/93d3f/d3d3/3d3d/93d - 3f/c3Nz/3Nzc/9vb2//b29v/29vb/9ra2v/a2tr/2tra/9nZ2f/Z2dn/2NjY/9jY2P/Y2Nj/19fX/9fX - 1//X19f/1tbW/9bW1v/W1tb/1dXV/9XV1f/V1dX/1dXV/9XV1f/V1dX/1dXV/9TU1P/U1NT/1NTU/9PT - 0//T09P/09PT/9PT0//T09P/0tLS/9LS0v/S0tL/0dHR/9HR0f/R0dH/0dHR/9HR0f/Q0ND/0NDQ/9DQ - 0P/Pz8//z8/P/8/Pz//Ozs7/zs7O/83Nzf/Nzc3/zc3N/8vLy//Ly8v/ysrK/8nJyf/IyMj/x8fH/8XF - xf/ExMT/wsLC/8HBwf+/v7//vb29/7u7u/+5ubn/tra2/7S0tP+wsLD/r6+v/6ysrP+oqKj/paWl/6Ki - ov+fn5//nZ2d/56env+2trb/ubm5/7S0tP+4uLj/tra2/7Kysv+8vLy33d3dBgAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADQAAAB8AAAA4AAAAWAAAAHpxcXHA39/f/+3t - 7f/m5ub/3d3d/93d3f/d3d3/3Nzc/9zc3P/c3Nz/3Nzc/9zc3P/c3Nz/3Nzc/9vb2//b29v/2tra/9ra - 2v/a2tr/2dnZ/9jY2P/Y2Nj/2NjY/9fX1//X19f/1tbW/9bW1v/W1tb/1dXV/9XV1f/V1dX/1dXV/9TU - 1P/U1NT/1NTU/9PT0//T09P/09PT/9PT0//T09P/09PT/9PT0//T09P/09PT/9LS0v/S0tL/0tLS/9LS - 0v/R0dH/0dHR/9HR0f/R0dH/0NDQ/9DQ0P/Q0ND/0NDQ/8/Pz//Pz8//z8/P/8/Pz//Ozs7/zs7O/83N - zf/Nzc3/zMzM/8vLy//Ly8v/y8vL/8nJyf/IyMj/x8fH/8bGxv/FxcX/xMTE/8LCwv/BwcH/v7+//729 - vf+7u7v/ubm5/7e3t/+1tbX/srKy/7Gxsf+vr6//rKys/6enp/+lpaX/pKSk/5+fn/+ampr/mJiY/6io - qP+3t7f/tLS0/7S0tP+zs7P/rq6u/7m5ub3Z2dkJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAADAAAADAAAABwAAAA0AAAAUQAAAHB5eXm54eHh/+3t7f/k5OT/3Nzc/9zc - 3P/c3Nz/3Nzc/9zc3P/b29v/29vb/9vb2//b29v/2tra/9ra2v/a2tr/2dnZ/9jY2P/Y2Nj/2NjY/9fX - 1//X19f/1tbW/9bW1v/V1dX/1dXV/9TU1P/U1NT/1NTU/9PT0//T09P/09PT/9LS0v/S0tL/0tLS/9LS - 0v/R0dH/0dHR/9HR0f/R0dH/0dHR/9HR0f/R0dH/0dHR/9DQ0P/Q0ND/0NDQ/9DQ0P/Pz8//z8/P/8/P - z//Pz8//zs7O/87Ozv/Ozs7/zs7O/83Nzf/Nzc3/zc3N/83Nzf/MzMz/y8vL/8vLy//Kysr/ycnJ/8nJ - yf/IyMj/yMjI/8bGxv/FxcX/xMTE/8PDw//CwsL/wMDA/76+vv+9vb3/u7u7/7q6uv+3t7f/tbW1/7S0 - tP+xsbH/r6+v/62trf+srKz/qKio/6SkpP+ioqL/oKCg/5qamv+ZmZn/nZ2d/6+vr/+0tLT/sbGx/7Ky - sv+vr6//urq6w9fX1wkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAACAAAACgAAABkAAAAsAAAARgAAAGGDg4Ou5OTk/+3t7f/k5OT/29vb/9vb2//b29v/29vb/9vb - 2//b29v/29vb/9vb2//a2tr/2dnZ/9nZ2f/Y2Nj/2NjY/9fX1//X19f/19fX/9bW1v/W1tb/1dXV/9XV - 1f/U1NT/1NTU/9PT0//T09P/0tLS/9LS0v/S0tL/0tLS/9HR0f/R0dH/0NDQ/9DQ0P/Q0ND/0NDQ/9DQ - 0P/Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//zs7O/87Ozv/Ozs7/zc3N/83Nzf/Nzc3/zMzM/8zM - zP/MzMz/y8vL/8vLy//Ly8v/y8vL/8vLy//Jycn/ycnJ/8jIyP/IyMj/x8fH/8bGxv/FxcX/xcXF/8PD - w//Dw8P/wsLC/8DAwP+/v7//vr6+/7y8vP+7u7v/ubm5/7e3t/+1tbX/s7Oz/7Gxsf+vr6//rKys/6qq - qv+lpaX/o6Oj/6Ghof+fn5//m5ub/5eXl/+dnZ3/qqqq/7Kysv+xsbH/rq6u/66urv+xsbHJ1NTUDAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAACAAA - ABMAAAAjAAAANwAAAEyVlZWg5ubm/+7u7v/i4uL/2tra/9ra2v/a2tr/2dnZ/9nZ2f/Z2dn/2dnZ/9nZ - 2f/X19f/19fX/9fX1//W1tb/1tbW/9bW1v/V1dX/1dXV/9TU1P/U1NT/1NTU/9PT0//S0tL/0dHR/9HR - 0f/R0dH/0NDQ/9DQ0P/Q0ND/z8/P/87Ozv/Ozs7/zc3N/83Nzf/Ozs7/zc3N/83Nzf/Nzc3/zc3N/83N - zf/Nzc3/zc3N/8vLy//Ly8v/y8vL/8vLy//Ly8v/ysrK/8rKyv/Kysr/ysrK/8nJyf/Jycn/yMjI/8jI - yP/Hx8f/x8fH/8bGxv/Gxsb/xsbG/8XFxf/ExMT/w8PD/8PDw//CwsL/wsLC/8DAwP+/v7//vr6+/729 - vf+7u7v/urq6/7m5uf+4uLj/tLS0/7Kysv+ysrL/sbGx/66urv+qqqr/p6en/6enp/+lpaX/oqKi/52d - nf+cnJz/mJiY/5qamv+np6f/rq6u/7Kysv+urq7/qqqq/7a2tszV1dUPAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAABQAAAA0AAAAXAAAAJQAA - ADOurq6N6enp/+3t7f/k5OT/2NjY/9jY2P/Y2Nj/2NjY/9jY2P/Y2Nj/2NjY/9jY2P/X19f/19fX/9bW - 1v/W1tb/1dXV/9XV1f/U1NT/1NTU/9PT0//T09P/09PT/9LS0v/R0dH/0NDQ/9DQ0P/Pz8//z8/P/8/P - z//Ozs7/zs7O/83Nzf/MzMz/zMzM/8zMzP/Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Kysr/ysrK/8nJ - yf/Jycn/ycnJ/8nJyf/Jycn/ycnJ/8nJyf/Jycn/ycnJ/8nJyf/IyMj/yMjI/8fHx//Gxsb/xsbG/8XF - xf/Dw8P/w8PD/8LCwv/CwsL/wcHB/8DAwP/AwMD/wMDA/7y8vP+7u7v/urq6/7m5uf+3t7f/tra2/7S0 - tP+zs7P/sbGx/7CwsP+urq7/q6ur/6mpqf+np6f/paWl/6Kiov+fn5//n5+f/5mZmf+ampr/mZmZ/52d - nf+srKz/sLCw/6mpqf+pqan/vb29z+Hh4RIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAOAAAAFgAAAB/Hx8d/6urq/+rq - 6v/l5eX/19fX/9fX1//X19f/19fX/9fX1//X19f/1tbW/9bW1v/V1dX/1dXV/9XV1f/U1NT/09PT/9PT - 0//T09P/0tLS/9LS0v/R0dH/0dHR/9DQ0P/Pz8//zs7O/87Ozv/Nzc3/zc3N/83Nzf/MzMz/y8vL/8vL - y//Kysr/ysrK/8nJyf/Ly8v/y8vL/8vLy//Kysr/ysrK/8rKyv/Jycn/ycnJ/8nJyf/Jycn/ycnJ/8nJ - yf/IyMj/yMjI/8jIyP/Hx8f/x8fH/8bGxv/Gxsb/xcXF/8TExP/Dw8P/wsLC/8LCwv/CwsL/wcHB/8DA - wP+/v7//vr6+/729vf+9vb3/vLy8/7u7u/+6urr/uLi4/7e3t/+1tbX/s7Oz/7Kysv+xsbH/ra2t/62t - rf+rq6v/qKio/6enp/+np6f/paWl/6Ghof+goKD/l5eX/5mZmf+YmJj/oqKi/7Gxsf+urq7/r6+v/7Oz - s/zR0dGH8fHxCQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAQAAAAHAAAACwAAAA/g4OB07u7u/+vr6//r6+v/6Ojo/+jo - 6P/n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//o6Oj/5+fn/+fn5//m5ub/5ubm/+Xl5f/l5eX/5OTk/+Tk - 5P/k5OT/4+Pj/+Li4v/h4eH/4eHh/+Dg4P/g4OD/4ODg/+Dg4P/f39//3t7e/97e3v/d3d3/3d3d/9zc - 3P/a2tr/2tra/9ra2v/a2tr/2dnZ/9nZ2f/Y2Nj/2NjY/9fX1//X19f/1tbW/9XV1f/U1NT/09PT/9PT - 0//S0tL/0NDQ/8/Pz//Ozs7/zc3N/8zMzP/Kysr/ysrK/8nJyf/Hx8f/xsbG/8XFxf/ExMT/wsLC/8HB - wf+/v7//v7+//76+vv+9vb3/u7u7/7m5uf+4uLj/tra2/7W1tf+0tLT/sLCw/6+vr/+tra3/q6ur/6io - qP+mpqb/o6Oj/6CgoP+goKD/nZ2d/5+fn/+srKz/srKy/7Gxsf+4uLj8v7+/qPDw8DMAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAQAAAAEAAAACAAAABAAAAAXw8PBt7u7u/+np6f/q6ur/7e3t/+3t7f/s7Oz/7Ozs/+zs - 7P/s7Oz/7Ozs/+zs7P/r6+v/6+vr/+vr6//q6ur/6urq/+np6f/p6en/6enp/+jo6P/o6Oj/6Ojo/+fn - 5//m5ub/5ubm/+Xl5f/l5eX/5eXl/+Xl5f/l5eX/5OTk/+Tk5P/j4+P/4+Pj/+Pj4//h4eH/4eHh/+Hh - 4f/g4OD/4ODg/9/f3//f39//39/f/9ra2v/a2tr/2dnZ/9jY2P/X19f/1tbW/9XV1f/V1dX/0tLS/9LS - 0v/R0dH/z8/P/87Ozv/Nzc3/zMzM/8vLy//IyMj/yMjI/8fHx//FxcX/xMTE/8LCwv/BwcH/wcHB/76+ - vv+9vb3/u7u7/7q6uv+5ubn/t7e3/7a2tv+1tbX/sbGx/6+vr/+tra3/ra2t/6qqqv+mpqb/pqam/6io - qP+ioqL/qKio/7a2tv+2trb/zc3N2PPz84H5+fkYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAD8/Pxp8/Pz/+zs7P/t7e3/7Ozs/+zs7P/s7Oz/7Ozs/+vr6//r6+v/6+vr/+vr - 6//q6ur/6urq/+rq6v/p6en/6enp/+np6f/o6Oj/6Ojo/+jo6P/o6Oj/6Ojo/+fn5//n5+f/5+fn/+bm - 5v/m5ub/5+fn/+bm5v/m5ub/5ubm/+bm5v/m5ub/5eXl/+Xl5f/k5OT/5OTk/+Tk5P/j4+P/4+Pj/+Pj - 4//i4uL/4uLi/+Pj4//j4+P/4uLi/+Li4v/i4uL/4eHh/+Hh4f/h4eH/4ODg/9/f3//f39//3t7e/9zc - 3P/b29v/29vb/9ra2v/b29v/29vb/9ra2v/a2tr/2dnZ/9nZ2f/Y2Nj/2NjY/9fX1//W1tb/1dXV/9TU - 1P/U1NT/09PT/9LS0v/R0dH/z8/P/8zMzP/Ly8v/zc3N/8zMzP/Kysr/zs7O89TU1Mzm5ua98vLylvf3 - 91f8/PwYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAD///////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////+AAAAAAAAAAAAAAAAAAAAAH/////////8AAAAAAA - AAAAAAAAAAAAAAD/////////4AAAAAAAAAAAAAAAAAAAAAD/////////4AAAAAAAAAAAAAAAAAAAAAD/ - ////////4AAAAAAAAAAAAAAAAAAAAAAf////////4AAAAAAAAAAAAAAAAAAAAAAf////////4AAAAAAA - AAAAAAAAAAAAAAAf////////4AAAAAAAAAAAAAAAAAAAAAAf////////4AAAAAAAAAAAAAAAAAAAAAAf - ////////4AAAAAAAAAAAAAAAAAAAAAAf////////4AAAAAAAAAAAAAAAAAAAAAAf////////4AAAAAAA - AAAAAAAAAAAAAAAf////////4AAAAAAAAAAAAAAAAAAAAAAf////////4AAAAAAAAAAAAAAAAAAAAAAf - ////////4AAAAAAAAAAAAAAAAAAAAAAf////////4AAAAAAAAAAAAAAAAAAAAAAf////////4AAAAAAA - AAAAAAAAAAAAAAAf////////4AAAAAAAAAAAAAAAAAAAAAAf////////4AAAAAAAAAAAAAAAAAAAAAAP - ////////4AAAAAAAAAAAAAAAAAAAAAAP////////4AAAAAAAAAAAAAAAAAAAAAAP////////4AAAAAAA - AAAAAAAAAAAAAAAP////////4AAAAAAAAAAAAAAAAAAAAAAP////////4AAAAAAAAAAAAAAAAAAAAAAP - ////////4AAAAAAAAAAAAAAAAAAAAAAP////////4AAAAAAAAAAAAAAAAAAAAAAP////////4AAAAAAA - AAAAAAAAAAAAAAAP////////4AAAAAAAAAAAAAAAAAAAAAAP////////4AAAAAAAAAAAAAAAAAAAAAAP - ////////4AAAAAAAAAAAAAAAAAAAAAAP////////gAAAAAAAAAAAAAAAAAAAAAAP////////AAAAAAAA - AAAAAAAAAAAAAAAP///////+AAAAAAAAAAAAAAAAAAAAAAAP///////8AAAAAAAAAAAAAAAAAAAAAAAP - ///////4AAAAAAAAAAAAAAAAAAAAAAAP///////4AAAAAAAAAAAAAAAAAAAAAAAP///////wAAAAAAAA - AAAAAAAAAAAAAAAP///////gAAAAAAAAAAAAAAAAAAAAAAAP///////gAAAAAAAAAAAAAAAAAAAAAAAP - ///////gAAAAAAAAAAAAAAAAAAAAAAAP///////gAAAAAAAAAAAAAAAAAAAAAAAP///////gAAAAAAAA - AAAAAAAAAAAAAAAP///////gAAAAAAAAAAAAAAAAAAAAAAAP///////gAAAAAAAAAAAAAAAAAAAAAAAP - ///////gAAAAAAAAAAAAAAAAAAAAAAAP///////gAAAAAAAAAAAAAAAAAAAAAAAP///////gAAAAAAAA - AAAAAAAAAAAAAAAP///////gAAAAAAAAAAAAAAAAAAAAAAAP///////gAAAAAAAAAAAAAAAAAAAAAAAP - ///////gAAAAAAAAAAAAAAAAAAAAAAAP///////gAAAAAAAAAAAAAAAAAAAAAAAP///////wAAAAAAAA - AAAAAAAAAAAAAAAP///////wAAAAAAAAAAAAAAAAAAAAAAAP///////wAAAAAAAAAAAAAAAAAAAAAAAP - ///////wAAAAAAAAAAAAAAAAAAAAAAAP///////wAAAAAAAAAAAAAAAAAAAAAAAP///////wAAAAAAAA - AAAAAAAAAAAAAAAP///////wAAAAAAAAAAAAAAAAAAAAAAAP//////8AAAAAAAAAAAAAAAAAAAAAAAAP - /////+AAAAAAAAAAAAAAAAAAAAAAAAAP/////AAAAAAAAAAAAAAAAAAAAAAAAAAP////4AAAAAAAAAAA - AAAAAAAAAAAAAAAP////AAAAAAAAAAAAAAAAAAAAAAAAAAAP///+AAAAAAAAAAAAAAAAAAAAAAAAAAAP - ///8AAAAAAAAAAAAAAAAAAAAAAAAAAAP///4AAAAAAAAAAAAAAAAAAAAAAAAAAAP///wAAAAAAAAAAAA - AAAAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAP///gAAAAAAAAAAAAAAAAAAAAAAAAAAAP - ///gAAAAAAAAAAAAAAAAAAAAAAAAAAAP///AAAAAAAAAAAAAAAAAAAAAAAAAAAAP///AAAAAAAAAAAAA - AAAAAAAAAAAAAAAP///AAAAAAAAAAAAAAAAAAAAAAAAAAAAP///AAAAAAAAAAAAAAAAAAAAAAAAAAAAP - ///gAAAAAAAAAAAAAAAAAAAAAAAAAAAP///gAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wAAAAAAAAAAAA - AAAAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAP///8AAAAAAAAAAAAAAAAAAAAAAAAAAAP - ///+AAAAAAAAAAAAAAAAAAAAAAAAAAAP////wAAAAAAAAAAAAAAAAAAAAAAAAAAP/////gAAAAAAAAAA - AAAAAAAAAAAAAAAP//////AAAAAAAAAAAAAAAAAAAAAAAAAP//////8AAAAAAAAAAAAAAAAAAAAAAAAP - ///////wAAAAAAAAAAAAAAAAAAAAAAAP///////wAAAAAAAAAAAAAAAAAAAAAAAP///////wAAAAAAAA - AAAAAAAAAAAAAAAP///////wAAAAAAAAAAAAAAAAAAAAAAAP///////wAAAAAAAAAAAAAAAAAAAAAAAP - ///////wAAAAAAAAAAAAAAAAAAAAAAAP///////wAAAAAAAAAAAAAAAAAAAAAAAP///////wAAAAAAAA - AAAAAAAAAAAAAAAP///////wAAAAAAAAAAAAAAAAAAAAAAAP///////gAAAAAAAAAAAAAAAAAAAAAAAP - ///////gAAAAAAAAAAAAAAAAAAAAAAAOA//////gAAAAAAAAAAAAAAAAAAAAAAAIAf/////gAAAAAAAA - AAAAAAAAAAAAAAAAAH/////gAAAAAAAAAAAAAAAAAAAAAAAAAH/////gAAAAAAAAAAAAAAAAAAAAAAAA - AD/////gAAAAAAAAAAAAAAAAAAAAAAAAAD/////gAAAAAAAAAAAAAAAAAAAAAAAAAB/////gAAAAAAAA - AAAAAAAAAAAAAAAAAB/////gAAAAAAAAAAAAAAAAAAAAAAAAAB/////gAAAAAAAAAAAAAAAAAAAAAAAA - AB/////gAAAAAAAAAAAAAAAAAAAAAAAAAB/////gAAAAAAAAAAAAAAAAAAAAAAAAAD/////wAAAAAAAA - AAAAAAAAAAAAAAAAAD/////wAAAAAAAAAAAAAAAAAAAAAAAAAD/////wAAAAAAAAAAAAAAAAAAAAAAAA - AH/////4AAAAAAAAAAAAAAAAAAAAAAAAAP////4AAAAAAAAAAAAAAAAAAAAAAAAAAf////gAAAAAAAAA - AAAAAAAAAAAAAAAAAf////AAAAAAAAAAAAAAAAAAAAAAAAAAA////+AAAAAAAAAAAAAAAAAAAAAAAAAA - B////8AAAAAAAAAAAAAAAAAAAAAAAAAAD////4AAAAAAAAAAAAAAAAAAAAAAAAAAH////4AAAAAAAAAA - AAAAAAAAAAAAAAAAP////4AAAAAAAAAAAAAAAAAAAAAAAAAAf////wAAAAAAAAAAAAAAAAAAAAAAAAAA - /////wAAAAAAAAAAAAAAAAAAAAAAAAAB/////wAAAAAAAAAAAAAAAAAAAAAAAAAD/////wAAAAAAAAAA - AAAAAAAAAAAAAAAD/////wAAAAAAAAAAAAAAAAAAAAAAAAAD/////wAAAAAAAAAAAAAAAAAAAAAAAAAD - /////wAAAAAAAAAAAAAAAAAAAAAAAAAB/////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////wAAAAAAAAAA - AAAAAAAAAAAAAAAAf////wAAAAAAAAAAAAAAAAAAAAAAAAAAP////wAAAAAAAAAAAAAAAAAAAAAAAAAA - H////wAAAAAAAAAAAAAAAAAAAAAAAAAAD////wAAAAAAAAAAAAAAAAAAAAAAAAAAB////wAAAAAAAAAA - AAAAAAAAAAAAAAAAA////wAAAAAAAAAAAAAAAAAAAAAAAAAAAf///wAAAAAAAAAAAAAAAAAAAAAAAAAA - AP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAH///wAAAAAAAAAAAAAAAAAAAAAAAAAAAH///wAAAAAAAAAA - AAAAAAAAAAAAAAAAAD///wAAAAAAAAAAAAAAAAAAAAAAAAAAAB///wAAAAAAAAAAAAAAAAAAAAAAAAAA - AB///wAAAAAAAAAAAAAAAAAAAAAAAAAAAB///wAAAAAAAAAAAAAAAAAAAAAAAAAAAB///wAAAAAAAAAA - AAAAAAAAAAAAAAAAAB///wAAAAAAAAAAAAAAAAAAAAAAAAAAAB///wAAAAAAAAAAAAAAAAAAAAAAAAAA - AB///4AAAAAAAAAAAAAAAAAAAAAAAAAAAD///4AAAAAAAAAAAAAAAAAAAAAAAAAAAD///4AAAAAAAAAA - AAAAAAAAAAAAAEAAAH///4AAAAAAAAAAAAAAAAAAAAAAAPgAAP///4AAAAAAAAAAAAAAAAAAAAAAAf4A - AP///4AAAAAAAAAAAAAAAAAAAAAAA//AAf///8AAAAAAAAAAAAAAAAAAAAAAB//wB////8AAAAAAAAAA - AAAAAAAAAAAAD///P////+AAAAAAAAAAAAAAAAAAAAAAH/////////AAAAAAAAAAAAAAAAAAAAAAP/// - //////gAAAAAAAAAAAAAAAAAAAAAf/////////wAAAAAAAAAAAAAAAAAAAAA//////////8AAAAAAAAA - AAAAAAAAAAAB////////////4AAAAAAAAAAAAAAAAAAD////////////8AAAAAAAAAAAAAAAAAAH//// - ////////8AAAAAAAAAAAAAAAAAAP////////////8AAAAAAAAAAAAAAAAAAf////////////8AAAAAAA - AAAAAAAAAAA/////////////8AAAAAAAAAAAAAAAAAB/////////////8AAAAAAAAAAAAAAAAAD///// - ////////8AAAAAAAAAAAAAAAAAD/////////////8AAAAAAAAAAAAAAAAAH/////////////8AAAAAAA - AAAAAAAAAAP/////////////8AAAAAAAAAAAAAAAAAf/////////////8AAAAAAAAAAAAAAAAA////// - ////////8AAAAAAAAAAAAAAAAB//////////////8AAAAAAAAAAAAAAAAD//////////////8AAAAAAA - AAAAAAAAAH//////////////8AAAAAAAAAAAAAAAAP//////////////8AAAAAAAAAAAAAAAAf////// - ////////8AAAAAAAAAAAAAAAA///////////////8AAAAAAAAAAAAAAAB///////////////8AAAAAAA - AAAAAAAAD///////////////8AAAAAAAAAAAAAAAH///////////////+AAAAAAAAAAAAAAAP/////// - ////////+AAAAAAAAAAAAAAA////////////////+AAAAAAAAAAAAAAD////////////////+AAAAAAA - AAAAAAA///////////////////////////////////////////////////////////////////////// - //8oAAAAEAAAACAAAAABACAAAAAAAAAEAAAjLgAAIy4AAAAAAAAAAAAAAAAAAAAAAAAsLAxlKioLhyoq - C4ctMhSJOE0zkjxXP5Y8Vz+WPFY+ljdMMZI7VTyVPFY+lkFjS3h///8bf///BwAAAAAAAAAAODgXgv// - ////////+f///8r7/v+66/7/vOb+/7rq/f/b8Pv/t+38/7zn/P97ssbPhvH/cH///xAAAAAAAAAAAElJ - Jnv///////////j+/v/J9/3/54j9//lN/f/NtP3/r+H8/8m4+//4Tv3/v0TS0Yzl/3R///8RAAAAAAAA - AABUVC93/////8zMu//Hzb3/suzi/7qx6//7K/7/+i7+/+tg/P/6Lv3/+yv+/56S2dN///93f///EAAA - AAAAAAAAWFgzdv///v/t7dz/6u3d/8zy5v+q3fX/5y////kH///4Df///gH//+cv//+LxuLbf///S3// - /wYAAKiNAACk/wAAov8AAKD/AACe/x06s/9YseD/fZbp/95C///JNv//7RL//+0S///eQv//mLXp4X// - /7F///86AACu/wAArv8AALH/AACx/wAAsP9XruX/aHHg/8AP7f+6TP//oV7//61S//+nWP//x0D//+Ub - 6eGls/+hf///rgAAtf8AALn/4eH//5KS5/9MTNH/Ybzs/7UD6f+7Eez/2Uv//9lM//+Ucf//2Uz//9lM - ///jIOje/QP/tX///7QAAL7/AADH/1FR3v/d3f3/oqLw/5bs/P+h+P//fNPz/1u25//Wg/L/8zn2/9SC - 8f+g/Pj/e+bf0X///6x///+rAADG/wAA0v8AANX/Z2fo/2Fh5f/Fyff/QkbX/wYNv/85c9X/tK7h/+1G - 7P+2sOP/v/jv/299WnR///8If///CAAAzf8AANr/AADe/y0t5f/T0/r/ZGTn/wAAz/8BA8T/Hj3J/6vw - 8//3TPL/qe7w/9b16P9xdU1uAAAAAAAAAAAAANH/AADg/wAA5v8FBej//v7//yAg4f8AANT/AADJ/wgR - wf+k9/H/offx/6P28P/q8+P/dHRMawAAAAAAAAAAAADV/wAA4/8AAOr/AADs/wAA5/8AAN//AADW/wAA - y/8AAMH/5ubV/6Skk/+kpJP/pKST/0lJJXwAAAAAAAAAAAAAzo0AANj/AADb/wAA3P8AANn/AADV/wAA - 0P8AAMr/fn7N/+Xl1P+2tqX//////3p6UWh6elElAAAAAAAAAAAAAAAAAAAAAH19U2f8/PX/+fnv//b2 - 6v/09OX/8/Pi//Ly4f/y8uH/wsKx/319U2d9fVMlAAAAAAAAAAAAAAAAAAAAAAAAAAB/f1VNf39VZn9/ - VWZ/f1Vmf39VZn9/VWZ/f1Vmf39VZn9/VWZ/f1UkAAAAAAAAAAAAAAAAAAAAAOAH///AA+AH4APAA+AD - 4APgA+ADAAHgAwAAAAEAAAAAAAAAAAAHAAAABwAHAAcABwAHAAcADwAH4B8AD///4B8oAAAAIAAAAEAA - AAABACAAAAAAAAAQAAAjLgAAIy4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADAAA - AAwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAMAAAADAAA - AAwAAAAMAAAADAAAAAwAAAAMAAAACwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AC0AAACMAAAAkgAAAJIAAACSAAAAkgAAAJIAAACSAAAAkgAAAJIAAACSAAAAkgAAAJIAAACSAAAAkgAA - AJIAAACSAAAAkgAAAJIAAACSAAAAkgAAAJIAAACKAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAPMzMzPna2tr/29vb/93d3f/e3t7/39/f/9/f3//U1NT/zMzM/9vb2//j4+P/4+Pj/+Li - 4v/h4eH/4ODg/97e3v/d3d3/3Nzc/9zc3P/b29v/2dnZ/9TU1P/CwsKUAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAA81NTU+efn5//q6ur/6+vr/+zs7P/t7e3/5+fn/6ysxP96d8n/urnE/+Tk - 5P/s7Oz/7Ozs/+vr6//q6ur/6Ojo/+fn5//m5ub/5OTk/+Li4v/f39//2dnZ/8bGxpcAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADzX19f56+vr/+3t7f/u7u7/7+/v//Hx8f/r7Ov/enrm/0hF - 6f9dWen/w8TP/+zs7P/w8PD/7+/v/+7u7v/t7e3/6+vr/+rq6v/o6Oj/5ubm/+Pj4//c3Nz/ysrKmAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPNnZ2fnt7e3/8PDw//Hx8f/z8/P/9PT0//Pz - 8v+IhvP/VlTc/1xZ2/9tat3/2tra/+/v7//y8vL/8vLy//Dw8P/v7+//7e3t/+rq6v/n5+f/5OTk/97e - 3v/MzMyaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJmZmQOfn5+KxMTE/Ofn5//z8/P/9PT0//X1 - 9f/29vb/9vb2/+zs9f94dvX/QD3t/0xH9/+JiLn/xcXF/93d3f/o6Oj/7e3t/+zs7P/h4eH/0dDQ/8HB - wf/BwMD/0tLS/83NzZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9PT0Vv77+v78+/v/yMjI//Pz - 8//29vb/9/f3//j4+P/5+fn/+fn5//j4+P+8vPf/YmD0/1BL6f9ubb7/oKG1/7W1tf+2trb/tLS0/5iX - ov9vb7X/XFrM/15cyv+6usf/zc3NnQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD9/f1+/7+w//+q - lf/t7e3/09PT//j4+P/19fX/4+Pj/9nZ2f/V1dX/+fn5//r6+v/l5fD/XFf0/1RO8v9PSfX/V1Pn/1ZU - zf9UUcj/SUXv/0ZE8/9RUen/U073/7u73v/Ozs6fAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP39 - /W7/zcD//zwL///j3f/W1tb/3d3d/+fn5//7+/v///j2/+fn5//s7Oz/+/v7//n5+P+dnO7/X1vs/8XF - zf+Egsv/RUD5/3t49f9/fff/iIX1/5uW9f/Lyuz/4eHh/8/Pz6EAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AACXl5cD8vLyaP/c1P//MwD//2U////9/f//9/X//7Sh//9kPv//ppD/9/f3//X19f/8/Pz/+/v7/+Tk - 7/9YU/X/bm6+/1BM7/+qqPP/9PT0//X09P/y8fL/7+/v/+rq6v/h4eH/zs7OowAAAAAAAAAAAAAAAJSU - lAKysrJKycnJmNjY2M3s7Ozy/+vn//8zAP//MwD//2pE//8/D///MwD//5B0//39/f/39/f//Pz8//z8 - /P/8/Pz/+Pj3/4mJ6/9CPPj/kpDt//X29f/29vb/9PT0//Ly8v/v7+//6urq/+Dg4P/Ozs6kAAAAAAAA - AAAAAAAA8fHxWP39/f3/7+v//8O1//+Xff//aUT//zMA//8zAP//MwD//zMA//+AYP/9/Pz/9vb2//v7 - +//8/Pz//Pz8//z8/P/5+fn/srHa/0pF+P/MzN//9/f3//b29v/09PT/8PDw/+3t7f/p6en/39/f/87O - zqYAAAAAAAAAAAAAAAD+/v6O/9rR//9tSf//QRL//zMA//8zAP//MwD//zMA//8zAP//NgT//9/Y/+fn - 5//b29v/+vr6//v7+//7+/v/+/v7//b29v+dnNf/Qj73/6Oh5P/19PX/9fX1//Ly8v/v7+//7Ozs/+jo - 6P/f39//zc3NqAAAAAAAAAAAAAAAAP7+/h////+q////6P/+/v//4Nj//6yY//8zAP//MwD//zMA//8z - AP//TiL//+vm/9nZ2f/f39//+fn5//r6+v/5+fn/8fLx/4WD4P9FQvT/gX/r//Hx8f/x8fH/7e3t/+7u - 7v/q6ur/5ubm/97e3v/MzMypAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////IP7+/on/5uD//zMA//81 - A///sJ3//4Bh//88C///Vy3///Hu/9HR0f/u7u7/+Pj4//f39//x8fH/fXvl/0lH6P9vbO3/7Ozs/+Tk - 5P/R0dH/1tbW/+jo6P/k5OT/29vb/8rKyqoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/Pz8ZP/X - zf//MwD//5R5//v7+//9/f3///Tx//+umf//qpX/9PT0/+jo6P/29vb/9vb2//Hx8f+Hher/R0Xo/3Vz - 8P/09PP//9/////u///Nzc3/3t7e/+Hh4f/X19f/xcXFrJqamgqYmJgFAAAAAAAAAAAAAAAAAAAAAAAA - AAD8/Px1/8i6//9WLP/++ff/7Ozs//Ly8v/19fX/+vr6//39/f/29vb/8/Pz//T09P/z8/P/8fHw/7y7 - 8f9kYvT/wsLs//X09P//tP///1z///n5+f/CwsL/3Nzc/8nJyf/Ozs7q3Nzc5rm5ubmZmZkKAAAAAAAA - AAAAAAAAAAAAAPz8/ID/0MT//9fN//Dw8P/v7+//8PDw//Dw8P/w8PD/8PDw//Dw8P/w8PD/8PDw/+/v - 7//u7u7/7e3t/+3s7P/q6uv/8fHx///H////AP///6///+jo6P/e3t7/+Pj4///k////vP//8fHx+5yc - nCsAAAAAAAAAAAAAAAYAAAA9TExMht/f3/He3t7+srKy/7Ozs/+zs7P/srKy/7Kysv+zs7P/s7Oz/7Ky - sv+ysrL/sbGx/7Gxsf+6urr/2tra/9vb2//f39///9r///8A////F////+f///+w////TP///xD////K - ///09PS/mJiYBQAAAAAAAAAAAAAANw8OMb0uLHnqNTOA7UtKkf1OTZT/Tk6V/05Nlf9OTZT/Tk2U/05N - lP9OTZT/Tk2U/05NlP9OTZT/U1KU/6qqtP/a2tr/7+/v//39/f//3////wD///8A////Bv///wD///8G - ////u///+fn51NfX1xQAAAAAAAAAAAAAAAAPEBZcJyWm+js5t/87OLf/Ojeq/zo4tf87Obj/Ozi1/zk2 - pf85NqX/Oziz/zw4tP86N6v/Ozm4/zw5uP+dnNr//+b///+X////YP///yj///8B////AP///wD///8A - ////Av///6r///Ly8vXNzc0mAAAAAAAAAAAAAAAAAAAAASEhO2gQDbb/EA+2/xAOtf9eX4b/GBas/xEP - tv8dGqr/dHSB/3R1iv9RUX7/Hx2g/1JSiP8RDrX/EA+2/39/2P//6v///53///9m////Lv///wP///8A - ////AP///wD///8B////pP//8fHx/aysrJaXl5cFAAAAAAAAAAAAAAABIiNBah4cy/8kI83/IyLM/4mI - rv9ZWZ3/QUCh/zEvvv+EhLH/NDLR/4KBtf9IR7L/g4Kk/zw6oP8qKbv/JybO/29v4P+op+n/9fX1//7+ - /v//4v///wD///8A////CP///wD///8E////tf//7Ozs/Kenp4eYmJgCAAAAAAAAAAEjI0lrNDLg/0NB - 4/9CQOP/sLHV/4uK3f+4t9f/ZmTL/6qq1v9AQN3/nJvO/29u2P/Cwdf/oKDc/19f4P9DQeP/Q0Hj/z4+ - 1v/Pz8//39/f///a////AP///xn////q////tv///1P///8P////w///4eHh95ycnCoAAAAAAAAAADIz - ZldNTPH/ZmXz/2Vl8//Pz/H/qqnK/9fY5/+KiPD/3d7q/6ipx//T1e//f33w/9ra5/+lpcb/hoXU/2Rl - 8/9lZfP/UVHm/8/Pz//d3d3//8f///8A////sv//7u7u/+fn5+f////q/+n////A///19fXpmpqaFQAA - AAAAAAAAREhlElBP9+mMjPv/jY38/6Sk/P+rq/z/oKD7/5KS/P+qqvz/qqr9/5eX/P+Skvv/q6r8/6ur - /P+dnvz/jY37/4eH+/9oaOv/0NDQ/+Hh4f//tP///17///r6+v/MzMzpvr6+J/7+/gX+/v5S////kfj4 - +DcAAAAAAAAAAAAAAAAAAAAAR0L0K0A9+4M6OdOhhITq+oyM8P+Li+//i4vv/4uL7/+Kiu7/ioru/4mJ - 7f+IiOz/h4fr/4eH6/+Ghur/h4bm/8nJ1f/MzMz/29vb///f////7///29vb7sjIyC8AAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADbT09P14ODg/9/f3//f39//3t7e/93d - 3f/c3Nz/29vb/9nZ2f/Y2Nj/19fX/9XV1f/S0tL/zs7O/8PDw/+0tLT/5+fn/97e3vHHx8c2AAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANtLS0vXe3t7/3d3d/9zc - 3P/b29v/2dnZ/9jY2P/X19f/1tbW/9TU1P/S0tL/z8/P/8vLy//CwsL/s7Oz/6urq//AwMDzwcHBOwAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAp1dXV8dra - 2v/Y2Nj/1tbW/9PT0//R0dH/z8/P/87Ozv/Nzc3/y8vL/8jIyP/Dw8P/u7u7/7CwsP+hoaH/q6ur9bOz - s0EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAPn5+ea5eXlquPj46rg4OCq3t7eqtvb26rZ2dmq19fXqtPT06rNzc2qyMjIqsLCwqq5ubmqr6+vqK+v - r4e4uLgmAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/////8AAAP/AAAB/wA - AAf8AAAH/AAAB/gAAAf4AAAH+AAAB/gAAAf4AAAHwAAAB4AAAAcAAAAHgAAAB/AAAAf4AAAH+AAAAfAA - AAHwAAAB4AAAA+AAAAfgAAAD4AAAAeAAAAHgAAAB4AAAO/AAAH/8AAD//AAB//wAA//8AAf/KAAAADAA - AABgAAAAAQAgAAAAAAAAJAAAIy4AACMuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAADAwMDIQQEBDQEBAQ2BAQENgQEBDYEBAQ2BAQENgQEBDYEBAQ2BAQENgQE - BDYEBAQ2BAQENgQEBDYEBAQ2BAQENgQEBDYEBAQ2BAQENgQEBDYEBAQ2BAQENgQEBDYEBAQ2BAQENgQE - BDYEBAQ2BAQENgQEBDYEBAQ2BAQENgQEBDYEBAQ2BQUFLgAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAgICbQAAAKsAAACxAAAAsQAAALEAAACxAAAAsQAA - ALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAA - ALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAmAAAAEAAAAACAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMFRUVgKGhofSpqan1qqqq9aqq - qvWrq6v1rKys9aysrPWtra31rq6u9a2trfWurq71qqqq9aqqqvWxsbH1tbW19bW1tfW0tLT1tLS09bS0 - tPWzs7P1s7Oz9bGxsfWxsbH1sbGx9bCwsPWurq71sLCw9bGxsfWwsLD1sLCw9a+vr/WsrKz1ra2t8JeX - l8w4ODgJ////AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALGBgYgdXV - 1f/o6Oj/6+vr/+rq6v/r6+v/7e3t/+7u7v/u7u7/7u7u/+7u7v/i4eH/yMjE/76+vf/P0M3/5eTm/+7t - 7f/u7u7/7+/v/+7u7v/s7Oz/7Ozs/+zs7P/q6ur/6enp/+jo6P/n5+f/5ubm/+Xl5f/k5OT/5OTk/+Li - 4v/e3t7+3d3d/8HBwexBQUEL////AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAALFxcXgdTU1P/p6en/6+vr/+3t7f/t7e3/7e3t/+7u7v/v7+//7+/v/+7u7v/Q0c7/a2nE/1BL - 3f+Jh8H/zs/I/+Hh4//t7u7/7+/v/+/v7//u7u7/7e3t/+3t7f/r6+v/6+vr/+rq6v/o6Oj/5+fn/+bm - 5v/m5ub/5OTk/+Pj4//d3d3+3Nzc/8LCwutHR0cM////AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAALFxcXgdbW1v/r6+v/7e3t/+7u7v/u7u7/7+/v//Dw8P/x8fH/8fHy//Dw - 8v++vtj/ODT3/0M9//9QSvP/rKy8/9jZ0v/r6+z/8fHx//Dw8P/v7+//8PDw/+/v7//u7u7/7e3t/+zs - 7P/r6+v/6enp/+np6f/n5+f/5eXl/+Xl5f/f39/+3t7e/8PDw+xHR0cM////AQAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALGBgYgdfX1//s7Oz/7+/v//Dw8P/w8PD/8vLy//Ly - 8v/z8/P/9PT0//Hx8//AwOj/PTr9/1JR2/9ZV9v/Tkjz/4mJyv/d3dr/8vHx//Pz8//y8vL/8fHx//Hx - 8f/w8PD/7+/v/+7u7v/t7e3/7Ozs/+vr6//p6en/6Ojo/+fn5//h4eH+4ODg/8bGxu5ISEgO////AQAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMFBQUft3d3f/v7+//8fHx//Ly - 8v/z8/P/9fX1//T09P/19fX/9/f3//X09v/k4/P/My/4/zQu/v9xcL7/Uk73/0dA/v+trcb/5+bp//Dw - 8P/09PT/8/Pz//T09P/z8/P/8vLy//Hx8f/v7+//7u7u/+3t7f/r6+v/6Ojo/+fn5//i4uL+4eHh/8jI - yO9GRkYO////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wEJCQkNMjIyksnJ - yf/u7u7/8vLy//T09P/09PT/9vb2//b29v/29vb/9/f3//b29v/6+vb/pKTz/zUx9P9FQuz/T07h/1FO - /f92dM3/zMzJ/9zd3v/r6+v/8vLz//Pz8//19fX/8/Pz//Ly8v/v7+//6+vr/+fn5//c3N3/09PU/9XV - 1v/X19f+4eHh/8rKyvFKSkoP////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AQAA - AADS0tKI3t7e+Nzc3P/Gxsb/8fHx//b29v/19fX/9/f3//f39//39/f/+Pj4//j4+P/4+Pj//Pv4/9/e - +P96ePf/Ojb4/0NA9v9UT+v/hYSa/6Wmo/++vrr/y8zM/9PT1f/c3N3/4uLj/+Pj4//W1tf/xcTC/7q6 - tf+rq6v/oaGn/5+gpv+5urj+2trb/8vKyvFISEgP////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAANTU1Bj9/f35/fn4/v/////i4uL/wMDA//n5+f/4+Pj/+fn5//j4+P/5+fn/+/v7//7+ - /v/9/v3/+vr6//n3/P////r/1tf4/3V09P9QTPn/OjT7/0ZD2/+Bgb7/ra6s/7S1qP+wsKb/qqqm/6mp - qP+enpT/c3SV/1pYsv8/O+T/Ozjx/zk28P97es7+2drW/8vMzPRLS0sR////AgAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAD///8BAAAAAPDw8DP+/f3//25K///Iuv/8/Pv/sLCw/9nZ2f/6+vr/+fn5//n5 - +f/9/f3/9/f3/+np6f/p6en//f79//z7+//5+fr////7////8P9vbfD/UEj9/z85/v8+N/r/UE/l/2pn - 1P93ea//goGN/4mLif9dWrX/OjT1/0hD//9ZV/f/VVPw/0VB+v9lZOv+5ufa/8rKzfNLS0sR////AgAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8BAAAAAOTk5Cf8+/v9/2ZA//8xEP//4dr/8fHx/7q6 - uv/n5+f/8PDw/+bm5v/f3t7/4+Li/+Xl5f/V1dX/ycnJ//j4+P/8/Pz/+/v8//n7+f+1tO7/UEr5/1BK - 9f+QjuL/enbz/2Bb8f9MR/T/NTD0/zo28v9DP/r/S0b5/0E+9/9KR+//Ukzz/2pj+f+xsOn/5ubi/83N - zvZISEgS////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPT09Bj+/Pz2/4Fh/v8n - Af//f2L///////r5+f++vb3/3t3d//Lv7//////////////18//+/Pv/09PT/9vb2//9/f3//f39//z7 - /f/s7fL/XVzx/0xF//+cm9P/0tDH/729qP9KRub/Tk32/4iG8v+lo/b/oaD4/6Si9/+wrvX/zM3w/+3u - 7P/p6ef/5OTk/83NzfZJSUkT////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf///wH///8C////Af// - /wn//v3w/49y/v8mAP//PxP///b0///////6+Pf/////////////5uD//4Jl//9DGv//7en/6Obm/+rq - 6v/+/v7//f39//39/f/8/Pf/lJPp/05J9/9ua9T/qaud/11Y0v9LR/v/m5vz//f58v////X////1//z9 - 8//6+/D/9ffv/+3t7v/m5uf/4+Pj/83NzflMTEwU////AgAAAAAAAAAAAAAAAAAAAAAAAAAAv7+/AqOj - ow6ampoqnp6eS6mpqWn59/b0/6OM/v8lAP//MgP//1w3///h2f//0MX//5N6//9lSP//OA3//1g+///O - wf/9/Pz/8fHx//z8/P/9/f3//f39//z8/P/7/Pz/5uXq/25t7v9NSOv/SETf/0dC/P+sqvH/+/v4//j4 - 9//19fb/9PT1//Py8//x8PL/7+/w/+3t7f/n5+b/4uLi/83NzfpKSkoU////AgAAAAAAAAAAAAAAAP// - /wGcnJwnpqamrLm5udra2Nj49vPy/////////////8a3//8pAP//NAH//zEA//83BP//KgD//zEA//86 - CP//VjT////////+/v/29vb//v7+//39/f/+/v7//v7+//39/f/8/Pz//v73/7y84/9MRvf/Qj76/31+ - 6v/19fL/+fn5//n4+P/29vb/9fX1//Tz8//x8fH/7+/v/+zs7P/m5ub/4uLi/87OzvxNTU0V////AgAA - AAAAAAAAAAAAAAAAAADZ2dm1//79/////////////////f////7/4Nn//4tu//8uAP//MwH//zQA//8y - AP//NQL//zcE//8kAP//u6r////+//n4+P/5+fn//f39//z8/P/9/f3//f39//z8/P/8/Pz/+fn5/97f - 3f9WVPH/Q0D2/8HD1v/39/b/+fn4//j4+P/29vb/9fX1//Pz8//x8fH/7+/v/+zs7P/m5ub/4eHh/83N - zfxLS0sW////AgAAAAAAAAAAAAAAAPb29j/9+/v7/76t/f+chf7+eF/+/1k5//9IHv//Ngb//zAB//8z - AP//MwD//zMA//8zAP//MgH//z4W//+yn//9/Pv/39/f//Hx8f/9/f3//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz/9fT3/+Hh0/9XVOf/SkX4/6qq2P/19fL/+Pj4//f39//19fX/9PT0//Ly8v/v7+//7e3t/+vr - 6//k5OT/4ODg/87Ozv5MTEwW////AgAAAAAAAAAAAAAAAP///0T//f39/72t/P+LcP7/WTH//zQB//8p - AP//KQD//zEA//8zAP//MwD//zMA//8zAP//MgH//z4U///Mvv/+/f3/xcXF/7e3t//6+vr/+/v7//z8 - /P/7+/v//Pz8//v7+//7+/z/7+/v/9DQy/8+OvP/SUT6/3Ft6f/w8Ov/9/f3//f39//09PT/8/Pz//Ly - 8v/v7+//7e3t/+vr6//k5OT/4ODg/87Ozv5LS0sX////AgAAAAAAAAAAAAAAAP///wb////f//////// - ////+fj+/9bM+/+rl/3/bkv//z0N//8yAP//MwD//zMA//81Av//NQH//y0A//84Df//6uT//////8DA - wP/a2tr//f39//v7+//7+/v/+/v7//r6+v/5+vr/7+7q/7q9y/9APPX/TEf7/1lU8P/n6On/9vb3//X1 - 9f/z8/P/8/Pz//Dw8P/u7u7/7Ozs/+rq6v/k5OT/4ODg/87Ozv9KSkoY////AgAAAAAAAAAAAAAAAAAA - AAD+/v4d//z8Wf/7+nL//v2h//79x//8/OL+/f39/7im//8qAP//NAH//zAA//9FGv//OAz//y8D//8x - AP//ZkT///Tx///+/v/Kysr/4eHh//v7+//6+vr/+vr6//n5+f/4+Pn/8PDm/6em0v89Ovb/SUb1/0ZB - +v/b2+b/8/P0/+fn5//X19f/29vb/+3t7f/s7Oz/6urq/+jo6P/i4uL/3t7e/83Nzf9MTEwZ////AgAA - AAAAAAAAAAAAAAAAAAD///8C////AQAAAAAAAAAAAAAAAAAAAAD59/fo/6WN/f8mAP//MwP//0IW///w - 7P//3tb//3hY//88D///JAD//1Uu///z7//7+vr/srKy/+Xl5f/6+vr/+Pj4//j4+P/39/j/8vPn/6el - 2P9APe3/TUrr/zs2/P/W1ej/5ubo/+3t7f/y7/L/v7+//7u7u//q6ur/6Ojo/+bm5v/g4OD/3Nzc/8zM - zP9QUFAZqqqqAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wH///8D////BNra2gf9+vru/5h9/v8k - AP//MAP//72s///////////////////p5P//gWP//yEA//9UKv//9/b/2NfX/9jY2P/5+fn/9/f3//f3 - 9//39/j/9PXo/6qq2v9BP+v/TErm/zcz/v/Z2er/+fn7/////////////v7+/7S0tP/a2tr/5ubm/+Xl - 5f/e3t7/2tra/8nJyf9LS0sbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAN3d - 3Rf8+/r2/4Rl//8lAP//dlj///////n49//z8vL/+/r6//38/P///v7//+fh///Asf//9/X/6ejo/+vr - 6//39/f/9fX1//X19f/19PX/9fbv/8nJ6P88OPb/R0Ty/1NQ9f/o6ez////////////+df7///////b1 - 9v/BwcH/5eXl/+Pj4//d3d3/09PT/8PDw/+MjIxUoaGhapCQkEulpaUJAAAAAAAAAAAAAAAAAAAAAAAA - AAB/f38BAAAAANbW1ib7+/v+/3FO//8fAP//4Nj//fv6/+Tl5f/09PT/8/Pz//Pz8//29fX//Pr6///8 - +//7+/v/8/Pz//X19f/19fX/9PT0//Pz8//z8/P/8PDx//j38f90cvb/g4L1/9rZ7v/v8O3///3///// - ////Jv///6z////////Z2dn/w8PD/+Xl5f/Ly8v/vLy8/8vKy//x7vH/+Pj4/9HR0f+VlZVaAAAAAAAA - AAAAAAAAAAAAAAAAAAD///8B////Af/6+jP9/f3//0oc//91Uf///v7/6eno/+3t7f/z8/P/8vLy//Ly - 8v/x8fH/8vLy//Pz8//y8vL/8/Pz//Ly8v/z8/P/8vLy//Hx8f/x8fH/8vLy/+/v8P/z9O7/9PXu//Hy - 7P/s7O3//vz+////////L////xn////p///29fb/qKio/7+/v//T0tP/9vP2///////////+/////f// - //63t7eaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAADVFRUTD4+Pj2/tHG//718v/y8fL/4eHi/+rq - 6v/o6On/6Ojp/+jo6f/o6Oj/6Ojp/+jo6f/o6Oj/6ejp/+jo6P/o6On/5+fo/+fn5//m5uf/5ubm/+fo - 5//r6uv/7Ozs/+zr7P/q6ur//Pj9////////Ov///wP///8q////6P//8fHx//Tz9P/+9f7//8D///+S - ///+Uv7//eD9/v7+/v7Pzs99AAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAsBAQEdQAAAIGDhH/B5+Tg9urp - 5f+qqqb/oqKe/6Ghnf+hop3/oKGc/6CgnP+goJz/oaGc/6ChnP+goZz/oaGd/6ChnP+foJv/n5+b/5+f - m/+fn5v/oKCc/6Skov/CwsL/3d3d/9bW1v/Gxsb/9O/0////////SP///wX///8C////ff///vb+//+p - ////LP///wD///8A////mP/+//////X19fS0tLQd////AgAAAAAAAAAAAAAAAAAAAAwBAQJuAgQAthAQ - GswODR7NKSk921ZWav1bW27/XV1w/11dcP9dXXD/XF1w/1xdcP9bXG//W1xv/1xcb/9cXG//XFxv/1xc - b/9cXG//XFxv/1tbb/9bXG//Wltu/2Zncf+ampn/wsHC/87Nzv/j3+P//ff9////////VP///wP///8B - ////F////yj///8A////AP///wD///8t////9P/++vn6+ry8vFH///8BAAAAAAAAAAAAAAAAAAAAAAAA - ACwQDjOxLyyd+EZFtP9PTbr/TUq2/01LuP9MS7f/TEq3/0xKtv9MSrb/TUu3/05LuP9OS7j/TUu4/01L - t/9NSrb/TUu3/01LuP9MS7b/TEq3/01Kt/9MSrb/m5rO/9va5f/29fb///7////0///+0/7//6z///+T - ////Kv///wH///8A////AP///wH///8C////Bv///3n////v//729fbauLi4MP///wEAAAAAAAAAAAAA - AAAAAAAAVVVVAwAAADQhH4XZLi2y/i0qs/8sKbL/LSqz/ycioP8nJKb/LCqz/ywqs/8sKrP/KCao/yMg - l/8iH5j/Ih+d/ycjrP8tKrX/KSWn/yMfmv8rKbD/LSm1/zAttP9IRr3///////z4/v/+gv7//zj///8V - ////AP///wD///8A////AP///wD///8A////AP///wH///8B////cP///////vz7/P++vr5g////An9/ - fwIAAAAAAAAAAAAAAAAAAAAAPz9/BAAAADQbGpDfDgqt/RAOsv8QDrL/DQqq/z4+eP8wLob/EAy0/xAO - sP8OC7H/KiiI/1NUaP9QT2X/SUhl/yoqa/8NCqT/LSuE/1NUaP8UEaP/EQ6v/xMRsv8zMb3///////v2 - ////P////wD///8A////AP///wD///8C////Af///wD///8A////AP///wL///8A////jv////////r5 - +v+lpaWyAAAAAP///wEAAAAAAAAAAAAAAAAAAAAAPz9/BAAAADUdG5vfFRO7/RYVwP8WFcD/Eg+9/3Jx - nP9QUJ7/Dg6z/xIQtv8UEcD/SEao/5qaj/9tbLP/c3K2/4uKl/88O5j/T02l/5uai/8bGbT/ExO8/xUV - wP8YF8D/np7n/+Hg+P/7+v7//u/+///Z////sP///4j///9o////Hf///wH///8A////AP///wD///8C - ////D////57////9///k5OT8oaGhq5SUlC0AAAAAAAAAAAAAAAAAAAAAPz9/BAAAADYjIqbhKCfQ/Sgn - 0v8pKNP/IyHP/4iHtv+WlaD/dXSM/2Rkiv8lJKr/XVzB/7y9r/80M8j/Hh7V/2Jhxf98fLP/Xly7/728 - r/9JSYr/RkWF/zEvpP8oJ9L/Hx7Q/yIh0P9LStv/p6Te//Xz7//8+f3/////////////W////wL///8B - ////BP///wD///8A////A////wD///9Z///+//7+7e3t/6KiouuYmJgm////AgAAAAAAAAAAPz9/BAAA - ADcoJrDhOTfb/Tc23f84Nt7/MTDZ/5qZyv/Ly9H/zs3Y/9vc1P9xcLT/aWfP/9TWyP9JSNb/MzLf/2ho - zf+Vls3/b23M/9XUyv/Pzsf/19fG/3t7yP80Mt7/Ojje/zg33v8nJdv/T06+/9vbyv/Y2Nr/+PT4///9 - ////Sv///wT///8D////Xv///8j///9h////Cv///wD///8A///+tv7//////uno6f+bm5t1AAAAAAAA - AAAAAAAASEhtAwAAADIwL7rgU1Ln/VBP7P9SUez/SEfn/7e44v+Zmdf/TU3B/5GQ0f+1teb/eXnf//T1 - 6f9YWMj/REO2/6ys0v+hoer/ionh//Hz6f9ubMz/amnJ/1hYzv9QT+n/UVDs/1FP7P9HR+3/XFvK/9vb - zP/Pz9D/9/P3////////Pf///wT///8V////2f///Pr8///9//7/4f/+/5///v9o//3/Qf///uf+//7+ - /v3FxMWaAAAAAAAAAAAAAAAAAAAAAgAAABQ9PcbXbm7y/Wpr9/9sbfb/Zmb0/83N9f/08/D/7Ozn//// - +P+vr/j/nZ3y////+//p6+f/+/vy//v9/v+Ih/b/qqrz/////P/q6+T/7e7j/9TW3/9rbO//bW32/2tr - 9/9fXvf/X1/Z/9/fzv/Nzc//+/f7////////Mf///wP////F///8+/z/zMzM/crKyv/29PbI//7///// - ////+//+//j/+//////Dw8NW////AQAAAAAAAAAAf39/AgAAAAA+Ps68i4z2/H5++/9+fvr/gH/8/7S0 - /v/Pz/7/0dD//8PD/P+MjPv/oJ7+/83N/P/R0f//ycn//6in/P9/f/z/o6T9/87O/P/Q0P//09L//8bF - //+Cgvz/f3/7/319+v9sbPv/cXDf/+Pj0v/Nzc7//vv+////////Kv///3r////////s6+z9wcHB/8zM - zJj///8F/v7+Uv/8/63//f/5/////+vr68fHx8cL////AQAAAAAAAAAAAAAAAKpUqgEzMsNMYF7+6W9v - +/56ev3+e3v+/3h4//93d/7/d3f+/3d3/v93d/7/eHf+/3h3/v93d/7/dnf+/3Z3//94eP7/eHf+/3h3 - /v93d/7/d3f+/3d3/f94eP7/eHj+/3Rz//9gX/L/ysvX/9bV1P/NzM3///7/////////Vv////z///z7 - /P3Qz9Dp0NDQUf///wH///8B////Af///wH+/P4d////JtTU1AMAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAD///8B39/fCMvL/zZkZKBGGRlUl6Ch3Pyur+v/rK3p/6us6P+rrOj/qqvn/6ur5/+qq+f/qarm/6ip - 5f+oqeX/p6jk/6eo5P+mpuL/pabi/6Sl4f+jpOD/oqPf/6io3v/X2NX/0NHT/9DQz//FxcX//Pz8//// - /////v///////NXV1f/MzMxeAAAAAP///wIAAAAAAAAAAAAAAAD///8C////AwAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAD///8BAAAAAAAAAAAAAAAEEBAEbt/f0vrx8eT/7u7g/+3t3//t7d//7Ozf/+zs - 3//r7N7/6+vd/+rq3P/p6dz/6Ojb/+fo2v/m5tn/5ubY/+Xl2P/k5Nb/4+LW/+Dg1P/T09T/0dHQ/8zM - zP+6urv/0dHR///////////94+Pj/8vLy73l5eUF////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMvL/wIKCgoLEBARdtHR0vri4uP/39/g/97e - 3//e3t//3t7f/93d3//c3N7/29vd/9vb3P/a2tz/2tnb/9nZ2v/Y2Nn/19fY/9bW1//V1db/09PU/9HR - 0//Ozs7/ycnJ/8LCwv+vr6//t7e3/9XV1f3MzMzwzs7Oaevr6wb///8BAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wEAAAAKDw8PddLS - 0vvi4uL/39/f/97e3v/d3d3/3d3d/9zc3P/a2tr/2dnZ/9nZ2f/X19f/1tbW/9fX1//V1dX/1dXV/9TU - 1P/R0dH/z8/P/8zMzP/Gxsb/vr6+/7W1tf+lpaX/u7u7/L6+vv/CwsJxAAAAAP///wMAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP// - /wEAAAAKERERdNPT0/rg4OD/3t7e/93d3f/b29v/2tra/9nZ2f/X19f/1tbW/9XV1f/U1NT/09PT/9PT - 0//R0dH/0NDQ/8/Pz//MzMz/ycnJ/8XFxf++vr7/tLS0/62trf+ioqL9tbW1/7a2ttPo6OgL////AwAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAADGRkZPOLi4vfd3d3929vb/dra2v3X19f91tbW/dTU1P3S0tL9z8/P/c/P - z/3Ozs79zMzM/cvLy/3IyMj9xcXF/cPDw/2+vr79ubm5/bW1tf2tra39o6Oj/Z2dnf6rq6vjubm5d+vr - 6w3///8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtra2B/f392r29vZ19vb2dfb29nX19fV19PT0dfT0 - 9HX09PR18fHxdfHx8XXx8fF18fHxde/v73Xt7e116+vrdevr63Xo6Oh15+fndeTk5HXg4OB14eHhb+vr - 60729vYPAAAAAP///wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAP//////////////////////gAAAAD////8AAAAAH/+A/wAAAAAf/wD/AAAAAB//AP8A - AAAAH/8A/wAAAAAf/wD/gAAAAB//AP8AAAAAH/+A/gAAAAAf/wD+AAAAAB/+AP4AAAAAH/4A/gAAAAAf - /gD+AAAAAB/+AP4AAAAAH/4A/gAAAAAf/gDAAAAAAB/+AIAAAAAAH8AAgAAAAAAfgACAAAAAAB+AAIAA - AAAAH4AA8AAAAAAfgAD+AAAAAB/wAP4AAAAAH/4A/gAAAAAf/gD+AAAAAAP+AP4AAAAAAf4A/gAAAAAD - /gD8AAAAAAP+APgAAAAAB/wA8AAAAAAP+ADwAAAAAB/wAPAAAAAAD/AA8AAAAAAH8ADwAAAAAAPwAPAA - AAAAA/AA8AAAAAAB8ADwAAAAAAPwAPAAAAAAw/AA+AAAAAP/8AD/AAAAB//4AP+AAAAH//8A/4AAAB// - /4D/gAAAP///gP+AAAA///+A/4AAAP///4D/////////gA== - - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/Editor/AutoBookmarkForm.Designer.cs b/pdfpatcher/App/Functions/Editor/AutoBookmarkForm.Designer.cs deleted file mode 100644 index 5270b46bb6deed7275144a11adec9504006b32f4..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/AutoBookmarkForm.Designer.cs +++ /dev/null @@ -1,264 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class AutoBookmarkForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent () { - System.Windows.Forms.ToolStripDropDownButton toolStripDropDownButton1; - this._LoadListButton = new System.Windows.Forms.ToolStripMenuItem(); - this._SaveListButton = new System.Windows.Forms.ToolStripMenuItem(); - this._BookmarkConditionBox = new BrightIdeasSoftware.ObjectListView(); - this._ConditionColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._LevelColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._BoldColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._ItalicColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._ColorColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._OpenColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._GoToTopColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._AutoBookmarkButton = new System.Windows.Forms.Button(); - this._MergeAdjacentTitleBox = new System.Windows.Forms.CheckBox(); - this._Toolbar = new System.Windows.Forms.ToolStrip(); - this._SetPatternMenu = new System.Windows.Forms.ToolStripDropDownButton(); - this._RemoveButton = new System.Windows.Forms.ToolStripButton(); - this._KeepExistingBookmarksBox = new System.Windows.Forms.CheckBox(); - toolStripDropDownButton1 = new System.Windows.Forms.ToolStripDropDownButton(); - ((System.ComponentModel.ISupportInitialize)(this._BookmarkConditionBox)).BeginInit(); - this._Toolbar.SuspendLayout(); - this.SuspendLayout(); - // - // toolStripDropDownButton1 - // - toolStripDropDownButton1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._LoadListButton, - this._SaveListButton}); - toolStripDropDownButton1.Image = global::PDFPatcher.Properties.Resources.TextFile; - toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta; - toolStripDropDownButton1.Name = "toolStripDropDownButton1"; - toolStripDropDownButton1.Size = new System.Drawing.Size(109, 22); - toolStripDropDownButton1.Text = "识别条件列表"; - // - // _LoadListButton - // - this._LoadListButton.Image = global::PDFPatcher.Properties.Resources.OpenFile; - this._LoadListButton.Name = "_LoadListButton"; - this._LoadListButton.Size = new System.Drawing.Size(180, 22); - this._LoadListButton.Text = "加载条件列表..."; - // - // _SaveListButton - // - this._SaveListButton.Image = global::PDFPatcher.Properties.Resources.Save; - this._SaveListButton.Name = "_SaveListButton"; - this._SaveListButton.Size = new System.Drawing.Size(180, 22); - this._SaveListButton.Text = "保存条件列表..."; - // - // _BookmarkConditionBox - // - this._BookmarkConditionBox.AllColumns.Add(this._ConditionColumn); - this._BookmarkConditionBox.AllColumns.Add(this._LevelColumn); - this._BookmarkConditionBox.AllColumns.Add(this._BoldColumn); - this._BookmarkConditionBox.AllColumns.Add(this._ItalicColumn); - this._BookmarkConditionBox.AllColumns.Add(this._ColorColumn); - this._BookmarkConditionBox.AllColumns.Add(this._OpenColumn); - this._BookmarkConditionBox.AllColumns.Add(this._GoToTopColumn); - this._BookmarkConditionBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._BookmarkConditionBox.CellEditActivation = BrightIdeasSoftware.ObjectListView.CellEditActivateMode.SingleClick; - this._BookmarkConditionBox.CellEditUseWholeCell = false; - this._BookmarkConditionBox.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this._ConditionColumn, - this._LevelColumn, - this._BoldColumn, - this._ItalicColumn, - this._ColorColumn, - this._OpenColumn, - this._GoToTopColumn}); - this._BookmarkConditionBox.Cursor = System.Windows.Forms.Cursors.Default; - this._BookmarkConditionBox.GridLines = true; - this._BookmarkConditionBox.HideSelection = false; - this._BookmarkConditionBox.Location = new System.Drawing.Point(14, 24); - this._BookmarkConditionBox.Name = "_BookmarkConditionBox"; - this._BookmarkConditionBox.ShowGroups = false; - this._BookmarkConditionBox.Size = new System.Drawing.Size(453, 143); - this._BookmarkConditionBox.TabIndex = 1; - this._BookmarkConditionBox.UseCompatibleStateImageBehavior = false; - this._BookmarkConditionBox.View = System.Windows.Forms.View.Details; - // - // _ConditionColumn - // - this._ConditionColumn.IsEditable = false; - this._ConditionColumn.Text = "识别条件"; - this._ConditionColumn.Width = 148; - // - // _LevelColumn - // - this._LevelColumn.Text = "书签级别"; - // - // _BoldColumn - // - this._BoldColumn.CheckBoxes = true; - this._BoldColumn.Text = "粗体"; - this._BoldColumn.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this._BoldColumn.Width = 37; - // - // _ItalicColumn - // - this._ItalicColumn.CheckBoxes = true; - this._ItalicColumn.Text = "斜体"; - this._ItalicColumn.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this._ItalicColumn.Width = 37; - // - // _ColorColumn - // - this._ColorColumn.IsEditable = false; - this._ColorColumn.Text = "颜色"; - // - // _OpenColumn - // - this._OpenColumn.CheckBoxes = true; - this._OpenColumn.Text = "展开"; - this._OpenColumn.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this._OpenColumn.Width = 37; - // - // _GoToTopColumn - // - this._GoToTopColumn.CheckBoxes = true; - this._GoToTopColumn.Text = "到页首"; - this._GoToTopColumn.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this._GoToTopColumn.Width = 49; - // - // _AutoBookmarkButton - // - this._AutoBookmarkButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._AutoBookmarkButton.Image = global::PDFPatcher.Properties.Resources.AutoBookmark; - this._AutoBookmarkButton.Location = new System.Drawing.Point(367, 4); - this._AutoBookmarkButton.Name = "_AutoBookmarkButton"; - this._AutoBookmarkButton.Size = new System.Drawing.Size(101, 23); - this._AutoBookmarkButton.TabIndex = 4; - this._AutoBookmarkButton.Text = "生成书签(&K)"; - this._AutoBookmarkButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._AutoBookmarkButton.UseVisualStyleBackColor = true; - this._AutoBookmarkButton.Click += new System.EventHandler(this._AutoBookmarkButton_Click); - // - // _MergeAdjacentTitleBox - // - this._MergeAdjacentTitleBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this._MergeAdjacentTitleBox.AutoSize = true; - this._MergeAdjacentTitleBox.Checked = true; - this._MergeAdjacentTitleBox.CheckState = System.Windows.Forms.CheckState.Checked; - this._MergeAdjacentTitleBox.Location = new System.Drawing.Point(14, 171); - this._MergeAdjacentTitleBox.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); - this._MergeAdjacentTitleBox.Name = "_MergeAdjacentTitleBox"; - this._MergeAdjacentTitleBox.Size = new System.Drawing.Size(168, 16); - this._MergeAdjacentTitleBox.TabIndex = 5; - this._MergeAdjacentTitleBox.Text = "合并同字体尺寸的相邻标题"; - this._MergeAdjacentTitleBox.UseVisualStyleBackColor = true; - // - // _Toolbar - // - this._Toolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - toolStripDropDownButton1, - this._SetPatternMenu, - this._RemoveButton}); - this._Toolbar.Location = new System.Drawing.Point(0, 0); - this._Toolbar.Name = "_Toolbar"; - this._Toolbar.Size = new System.Drawing.Size(485, 25); - this._Toolbar.TabIndex = 6; - // - // _SetPatternMenu - // - this._SetPatternMenu.Enabled = false; - this._SetPatternMenu.Image = global::PDFPatcher.Properties.Resources.SelectItem; - this._SetPatternMenu.Name = "_SetPatternMenu"; - this._SetPatternMenu.Size = new System.Drawing.Size(109, 22); - this._SetPatternMenu.Text = "文本识别模式"; - // - // _RemoveButton - // - this._RemoveButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this._RemoveButton.Enabled = false; - this._RemoveButton.Image = global::PDFPatcher.Properties.Resources.Delete; - this._RemoveButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._RemoveButton.Name = "_RemoveButton"; - this._RemoveButton.Size = new System.Drawing.Size(23, 22); - this._RemoveButton.Text = "删除"; - this._RemoveButton.Click += new System.EventHandler(this._RemoveButton_Click); - // - // _KeepExistingBookmarksBox - // - this._KeepExistingBookmarksBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this._KeepExistingBookmarksBox.AutoSize = true; - this._KeepExistingBookmarksBox.Location = new System.Drawing.Point(223, 171); - this._KeepExistingBookmarksBox.Name = "_KeepExistingBookmarksBox"; - this._KeepExistingBookmarksBox.Size = new System.Drawing.Size(96, 16); - this._KeepExistingBookmarksBox.TabIndex = 7; - this._KeepExistingBookmarksBox.Text = "保留原有书签"; - this._KeepExistingBookmarksBox.UseVisualStyleBackColor = true; - // - // AutoBookmarkForm - // - this.AcceptButton = this._AutoBookmarkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(485, 195); - this.Controls.Add(this._KeepExistingBookmarksBox); - this.Controls.Add(this._MergeAdjacentTitleBox); - this.Controls.Add(this._AutoBookmarkButton); - this.Controls.Add(this._BookmarkConditionBox); - this.Controls.Add(this._Toolbar); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "AutoBookmarkForm"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show; - this.Text = "自动生成书签"; - ((System.ComponentModel.ISupportInitialize)(this._BookmarkConditionBox)).EndInit(); - this._Toolbar.ResumeLayout(false); - this._Toolbar.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - private BrightIdeasSoftware.ObjectListView _BookmarkConditionBox; - private BrightIdeasSoftware.OLVColumn _ConditionColumn; - private System.Windows.Forms.Button _AutoBookmarkButton; - private BrightIdeasSoftware.OLVColumn _LevelColumn; - private BrightIdeasSoftware.OLVColumn _BoldColumn; - private BrightIdeasSoftware.OLVColumn _ItalicColumn; - private BrightIdeasSoftware.OLVColumn _ColorColumn; - private BrightIdeasSoftware.OLVColumn _OpenColumn; - private System.Windows.Forms.CheckBox _MergeAdjacentTitleBox; - private BrightIdeasSoftware.OLVColumn _GoToTopColumn; - private System.Windows.Forms.ToolStrip _Toolbar; - private System.Windows.Forms.ToolStripMenuItem _LoadListButton; - private System.Windows.Forms.ToolStripMenuItem _SaveListButton; - private System.Windows.Forms.CheckBox _KeepExistingBookmarksBox; - private System.Windows.Forms.ToolStripDropDownButton _SetPatternMenu; - private System.Windows.Forms.ToolStripButton _RemoveButton; - } -} \ No newline at end of file diff --git a/pdfpatcher/App/Functions/Editor/AutoBookmarkForm.cs b/pdfpatcher/App/Functions/Editor/AutoBookmarkForm.cs deleted file mode 100644 index dd4f393aae7a566d7238f45abc76419091bd2be5..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/AutoBookmarkForm.cs +++ /dev/null @@ -1,223 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Windows.Forms; -using BrightIdeasSoftware; -using PDFPatcher.Common; -using PDFPatcher.Functions.Editor; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - sealed partial class AutoBookmarkForm : DraggableForm - { - List _list; - readonly Controller _controller; - - internal AutoBookmarkForm() { - InitializeComponent(); - } - - internal AutoBookmarkForm(Controller controller) : this() { - _controller = controller; - this.OnFirstLoad(OnLoad); - } - - void OnLoad() { - MinimumSize = Size; - _Toolbar.ScaleIcons(16); - - _ConditionColumn.AsTyped(c => { - c.AspectGetter = o => $"字体为{o.FontName} 尺寸为{o.FontSize}{(o.MatchPattern != null ? o.MatchPattern.ToString() : String.Empty)}"; - }); - _LevelColumn.CellEditUseWholeCell = true; - _LevelColumn.AsTyped(c => { - c.AspectGetter = o => o.Level; - c.AspectPutter = (o, v) => o.Level = Convert.ToInt32(v).LimitInRange(1, 10); - }); - _BoldColumn.AsTyped(c => { - c.AspectGetter = o => o.Bookmark.IsBold; - c.AspectPutter = (o, v) => o.Bookmark.IsBold = (bool)v; - }); - _ItalicColumn.AsTyped(c => { - c.AspectGetter = o => o.Bookmark.IsItalic; - c.AspectPutter = (o, v) => o.Bookmark.IsItalic = (bool)v; - }); - _ColorColumn.AsTyped(c => { - c.AspectGetter = o => "点击设置颜色"; - }); - _OpenColumn.AsTyped(c => { - c.AspectGetter = o => o.Bookmark.IsOpened; - c.AspectPutter = (o, v) => o.Bookmark.IsOpened = (bool)v; - }); - _GoToTopColumn.AsTyped(c => { - c.AspectGetter = o => o.Bookmark.GoToTop; - c.AspectPutter = (o, v) => o.Bookmark.GoToTop = (bool)v; - }); - _BookmarkConditionBox.ScaleColumnWidths(); - _BookmarkConditionBox.IsSimpleDragSource = true; - _BookmarkConditionBox.IsSimpleDropSink = true; - _BookmarkConditionBox.CellClick += (s, args) => { - if (args.ColumnIndex == _ColorColumn.Index) { - var b = ((EditModel.AutoBookmarkStyle)args.Model).Bookmark; - this.ShowCommonDialog( - f => f.Color = b.ForeColor == Color.Transparent ? Color.White : b.ForeColor, - f => { - b.ForeColor = f.Color == Color.White || f.Color == Color.Black ? Color.Transparent : f.Color; - _BookmarkConditionBox.RefreshItem(args.Item); - } - ); - } - }; - _BookmarkConditionBox.RowFormatter = (r) => { - var b = ((EditModel.AutoBookmarkStyle)r.RowObject).Bookmark; - r.UseItemStyleForSubItems = false; - r.SubItems[_ColorColumn.Index].ForeColor = b.ForeColor == Color.Transparent ? _BookmarkConditionBox.ForeColor : b.ForeColor; - }; - _BookmarkConditionBox.SelectionChanged += _BookmarkConditionBox_SelectionChanged; - _LoadListButton.Click += _LoadListButton_Click; - _SaveListButton.Click += _SaveListButton_Click; - - QuickSelectCommand.RegisterMenuItemsWithPattern(_SetPatternMenu.DropDownItems); - _SetPatternMenu.DropDownItems.AddRange(new ToolStripItem[] { - new ToolStripSeparator(), - new ToolStripMenuItem("自定义文本匹配模式...") { - Tag = "CustomPattern" - }, - new ToolStripMenuItem("清除文本匹配模式") { - Tag = "ClearPattern", - Image = Properties.Resources.Delete - } - }); - _SetPatternMenu.DropDownItemClicked += _SetPattern_DropDownItemClicked; - } - - void _BookmarkConditionBox_SelectionChanged(object sender, EventArgs e) { - _SetPatternMenu.Enabled = _RemoveButton.Enabled = _BookmarkConditionBox.SelectedItems.Count > 0; - } - - void _SetPattern_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { - if (e.ClickedItem.Tag is MatchPattern p) { - SetMatchPatternToSelectedBookmarkStyles(p); - return; - } - if (e.ClickedItem.Tag is string s) { - switch (s) { - case "ClearPattern": - SetMatchPatternToSelectedBookmarkStyles(null); - return; - case "CustomPattern": - p = (_BookmarkConditionBox.SelectedObject as EditModel.AutoBookmarkStyle)?.MatchPattern; - this.ShowDialog(f => { - if (p != null) { - f.Pattern = p.Text; - f.MatchCase = p.MatchCase; - f.FullMatch = p.FullMatch; - } - }, f => { - SetMatchPatternToSelectedBookmarkStyles(f.Pattern.Length != 0 ? new MatchPattern(f.Pattern, f.MatchCase, f.FullMatch, true) : null); - }); - return; - } - } - } - - void SetMatchPatternToSelectedBookmarkStyles(MatchPattern p) { - foreach (EditModel.AutoBookmarkStyle item in _BookmarkConditionBox.SelectedObjects) { - item.MatchPattern = p; - } - _BookmarkConditionBox.RefreshObjects(_BookmarkConditionBox.SelectedObjects); - } - - internal void SetValues(List list) { - _BookmarkConditionBox.Objects = _list = list; - } - - void _RemoveButton_Click(object sender, EventArgs e) { - _BookmarkConditionBox.SelectedObjects.ForEach(i => _list.Remove(i)); - _BookmarkConditionBox.RemoveObjects(_BookmarkConditionBox.SelectedObjects); - } - - void _AutoBookmarkButton_Click(object sender, EventArgs e) { - SyncList(); - _controller.AutoBookmark(_list, _MergeAdjacentTitleBox.Checked, _KeepExistingBookmarksBox.Checked); - } - - void _SaveListButton_Click(object sender, EventArgs e) { - this.ShowCommonDialog(d => { - d.Title = "请输入需要保存自动书签格式列表的文件名"; - d.Filter = Constants.FileExtensions.XmlFilter; - d.DefaultExt = Constants.FileExtensions.Xml; - }, d => { - try { - SyncList(); - using (var w = new FilePath(d.FileName).OpenTextWriter(false, null)) { - Serialize(_list, w); - } - } - catch (Exception ex) { - this.ErrorBox("保存自动书签格式列表时出现错误", ex); - } - }); - } - - static void Serialize(List list, System.IO.StreamWriter writer) { - using (var x = System.Xml.XmlWriter.Create(writer)) { - x.WriteStartDocument(); - x.WriteStartElement("autoBookmark"); - foreach (var item in list) { - x.WriteStartElement("style"); - x.WriteAttributeString("fontName", item.FontName); - x.WriteAttributeString("fontSize", item.FontSize.ToText()); - x.WriteAttributeString("level", item.Level.ToText()); - item.Bookmark.WriteXml(x); - item.MatchPattern?.WriteXml(x); - x.WriteEndElement(); - } - x.WriteEndElement(); - x.WriteEndDocument(); - } - } - - void _LoadListButton_Click(object sender, EventArgs e) { - this.ShowCommonDialog(d => { - d.Title = "请选择需要打开的自动书签格式列表"; - d.Filter = Constants.FileExtensions.XmlFilter; - d.DefaultExt = Constants.FileExtensions.Xml; - }, d => { - try { - SetValues(Deserialize(d.FileName)); - } - catch (Exception ex) { - this.ErrorBox("加载自动书签格式列表时出现错误", ex); - } - }); - } - - static List Deserialize(FilePath path) { - var doc = new System.Xml.XmlDocument(); - doc.Load(path); - var l = new List(); - foreach (System.Xml.XmlElement item in doc.DocumentElement.GetElementsByTagName("style")) { - var s = new EditModel.AutoBookmarkStyle( - item.GetValue("level", 1), - item.GetValue("fontName"), - item.GetValue("fontSize", 0)); - s.Bookmark.ReadXml(item.GetElement("bookmark").CreateNavigator().ReadSubtree()); - var p = item.GetElement("pattern"); - if (p != null) { - s.MatchPattern = new Model.MatchPattern(); - s.MatchPattern.ReadXml(p.CreateNavigator().ReadSubtree()); - } - - l.Add(s); - } - return l; - } - - void SyncList() { - _list.Clear(); - _list.AddRange(new TypedObjectListView(_BookmarkConditionBox).Objects); - } - } -} diff --git a/pdfpatcher/App/Functions/Editor/AutoBookmarkForm.resx b/pdfpatcher/App/Functions/Editor/AutoBookmarkForm.resx deleted file mode 100644 index 4140e094b4c96c60bc06a4fafe0e6b4b35d1e5be..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/AutoBookmarkForm.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - False - - - 17, 17 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/Editor/BookmarkEditorView.Designer.cs b/pdfpatcher/App/Functions/Editor/BookmarkEditorView.Designer.cs deleted file mode 100644 index 2c787fe4bb77fc8d5901dd108833d0dc6de72f3d..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/BookmarkEditorView.Designer.cs +++ /dev/null @@ -1,126 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class BookmarkEditorView - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.components = new System.ComponentModel.Container (); - this._BookmarkNameColumn = new BrightIdeasSoftware.OLVColumn (); - this._BookmarkOpenColumn = new BrightIdeasSoftware.OLVColumn (); - this._BookmarkPageColumn = new BrightIdeasSoftware.OLVColumn (); - this._ActionColumn = new BrightIdeasSoftware.OLVColumn (); - ((System.ComponentModel.ISupportInitialize)(this)).BeginInit (); - this.SuspendLayout (); - // - // _BookmarkBox - // - this.AllColumns.Add (this._BookmarkNameColumn); - this.AllColumns.Add (this._BookmarkOpenColumn); - this.AllColumns.Add (this._BookmarkPageColumn); - this.AllColumns.Add (this._ActionColumn); - this.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.CellEditActivation = BrightIdeasSoftware.ObjectListView.CellEditActivateMode.SingleClick; - this.Columns.AddRange (new System.Windows.Forms.ColumnHeader[] { - this._BookmarkNameColumn, - this._BookmarkOpenColumn, - this._BookmarkPageColumn, - this._ActionColumn}); - this.CopySelectionOnControlC = false; - this.Cursor = System.Windows.Forms.Cursors.Default; - this.GridLines = true; - this.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this.HideSelection = false; - this.IsSimpleDragSource = true; - this.IsSimpleDropSink = true; - this.LabelEdit = true; - this.Location = new System.Drawing.Point (0, 0); - this.Name = "_BookmarkBox"; - this.OwnerDraw = true; - this.RevealAfterExpand = false; - this.ShowGroups = false; - this.Size = new System.Drawing.Size (408, 208); - this.TabIndex = 0; - this.UseCellFormatEvents = false; - this.UseHotItem = false; - this.UseCompatibleStateImageBehavior = false; - this.UseHyperlinks = true; - this.View = System.Windows.Forms.View.Details; - this.VirtualMode = true; - this.BeforeLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.BookmarkEditorView_BeforeLabelEdit); - this.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler (this._BookmarkBox_AfterLabelEdit); - this.FormatRow += new System.EventHandler (this._BookmarkBox_FormatRow); - this.HyperlinkClicked += new System.EventHandler(BookmarkEditor_CellClick); - this.HotItemChanged += new System.EventHandler (BookmarkEditor_HotItemChanged); - // - // _BookmarkNameColumn - // - this._BookmarkNameColumn.AspectName = ""; - this._BookmarkNameColumn.Text = "书签文本"; - this._BookmarkNameColumn.Width = 160; - // - // _BookmarkOpenColumn - // - this._BookmarkOpenColumn.AspectName = ""; - this._BookmarkOpenColumn.CheckBoxes = true; - this._BookmarkOpenColumn.DisplayIndex = 2; - this._BookmarkOpenColumn.HeaderTextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this._BookmarkOpenColumn.Text = "打开"; - this._BookmarkOpenColumn.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this._BookmarkOpenColumn.Width = 40; - // - // _BookmarkPageColumn - // - this._BookmarkPageColumn.AspectName = ""; - this._BookmarkPageColumn.DisplayIndex = 1; - this._BookmarkPageColumn.HeaderTextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._BookmarkPageColumn.Text = "页码"; - this._BookmarkPageColumn.Width = 42; - // - // _ActionColumn - // - this._ActionColumn.AspectName = ""; - this._ActionColumn.Hyperlink = true; - this._ActionColumn.IsEditable = false; - this._ActionColumn.Text = "书签动作"; - this._ActionColumn.Width = 100; - // - // Editor - // - this.Name = "BookmarkEditor"; - this.Size = new System.Drawing.Size (408, 208); - ((System.ComponentModel.ISupportInitialize)(this)).EndInit (); - this.ResumeLayout (false); - - } - - #endregion - - private BrightIdeasSoftware.OLVColumn _BookmarkNameColumn; - private BrightIdeasSoftware.OLVColumn _BookmarkOpenColumn; - private BrightIdeasSoftware.OLVColumn _BookmarkPageColumn; - private BrightIdeasSoftware.OLVColumn _ActionColumn; - } -} diff --git a/pdfpatcher/App/Functions/Editor/BookmarkEditorView.cs b/pdfpatcher/App/Functions/Editor/BookmarkEditorView.cs deleted file mode 100644 index 206588e9eaa3d77f027afca38e34b7557dd997fd..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/BookmarkEditorView.cs +++ /dev/null @@ -1,615 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Drawing; -using System.Windows.Forms; -using System.Xml; -using BrightIdeasSoftware; -using PDFPatcher.Common; -using PDFPatcher.Model; -using PDFPatcher.Processor; - -namespace PDFPatcher.Functions -{ - sealed partial class BookmarkEditorView : TreeListView - { - [EditorBrowsable(EditorBrowsableState.Never)] - internal static List _copiedBookmarks; - - [EditorBrowsable(EditorBrowsableState.Never)] - internal UndoManager Undo { get; set; } - - public bool OperationAffectsDescendants { get; set; } - public OLVColumn BookmarkOpenColumn => _BookmarkOpenColumn; - public OLVColumn BookmarkNameColumn => _BookmarkNameColumn; - public OLVColumn BookmarkPageColumn => _BookmarkPageColumn; - public bool HasMarker => _markers.Count > 0; - public bool IsLabelEditing { get; private set; } - - readonly Dictionary _markers = new Dictionary(); - - public BookmarkEditorView() { - InitializeComponent(); - InitEditorBox(); - } - - private void InitEditorBox() { - if (IsDesignMode) { - return; - } - UseOverlays = false; - #region 修复树视图无法正确选择节点的问题 - SmallImageList = new ImageList(); - #endregion - this.SetTreeViewLine(); - this.FixEditControlWidth(); - CanExpandGetter = (object x) => x is BookmarkElement e && e.HasSubBookmarks; - ChildrenGetter = (object x) => ((BookmarkElement)x).SubBookmarks; - _BookmarkNameColumn.AutoCompleteEditorMode = AutoCompleteMode.Suggest; - //this.SelectedRowDecoration = new RowBorderDecoration () - //{ - // FillBrush = new SolidBrush (Color.FromArgb (64, SystemColors.Highlight)), - // BoundsPadding = new Size (0, 0), - // CornerRounding = 2, - // BorderPen = new Pen (Color.FromArgb (216, SystemColors.Highlight)) - //}; - new TypedColumn(_BookmarkNameColumn) { - AspectGetter = (e) => e.Title, - AspectPutter = (e, newValue) => { - var s = newValue as string; - if (e.Title == s) { - return; - } - var p = new ReplaceTitleTextProcessor(s); - Undo?.AddUndo("编辑书签文本", p.Process(e)); - } - }; - new TypedColumn(_BookmarkOpenColumn) { - AspectGetter = (e) => e == null ? false : (object)e.IsOpen, - AspectPutter = (e, newValue) => { - if (e == null || e.HasSubBookmarks == false) { - return; - } - var p = new BookmarkOpenStatusProcessor((bool)newValue); - Undo.AddUndo(p.Name, p.Process(e)); - } - }; - new TypedColumn(_BookmarkPageColumn) { - AspectGetter = (e) => { - if (e == null) { - return 0; - } - int p = e.GetValue(Constants.DestinationAttributes.Page, 0); - if (e.HasAttribute(Constants.DestinationAttributes.FirstPageNumber)) { - int o = e.GetValue(Constants.DestinationAttributes.FirstPageNumber, 0); - if (o > 0) { - p += o; - e.RemoveAttribute(Constants.DestinationAttributes.FirstPageNumber); - } - } - return p; - }, - AspectPutter = (e, value) => { - if (e == null) { - return; - } - if (value.ToString().TryParse(out int n)) { - var p = new ChangePageNumberProcessor(n, true, false); - Undo.AddUndo(p.Name, p.Process(e)); - } - } - }; - _ActionColumn.AspectGetter = (object x) => { - var e = x as XmlElement; - if (e == null) { - return String.Empty; - } - var a = e.GetAttribute(Constants.DestinationAttributes.Action); - if (String.IsNullOrEmpty(a)) { - return e.HasAttribute(Constants.DestinationAttributes.Page) ? Constants.ActionType.Goto : "无"; - } - return a; - }; - } - protected override void OnBeforeSorting(BeforeSortingEventArgs e) { - e.Canceled = true; // 禁止排序 - base.OnBeforeSorting(e); - } - protected override void OnItemActivate(EventArgs e) { - base.OnItemActivate(e); - EditSubItem(SelectedItem, 0); - } - #region 拖放操作 - protected override void OnCanDrop(OlvDropEventArgs args) { - var o = args.DataObject as DataObject; - if (o == null) { - return; - } - var f = o.GetFileDropList(); - foreach (var item in f) { - if (FileHelper.HasExtension(item, Constants.FileExtensions.Xml) - || FileHelper.HasExtension(item, Constants.FileExtensions.Pdf)) { - args.Handled = true; - args.DropTargetLocation = DropTargetLocation.Background; - args.Effect = DragDropEffects.Copy; - args.InfoMessage = "打开文件" + item; - return; - } - } - base.OnCanDrop(args); - } - protected override void OnModelCanDrop(ModelDropEventArgs e) { - var si = e.SourceModels; - var ti = e.TargetModel as XmlElement; - if (si == null || si.Count == 0 || e.TargetModel == null) { - e.Effect = DragDropEffects.None; - return; - } - var copy = (Control.ModifierKeys & Keys.Control) != Keys.None || (e.SourceModels[0] as XmlElement).OwnerDocument != ti.OwnerDocument; - if (copy == false) { - if (e.DropTargetItem.Selected) { - e.Effect = DragDropEffects.None; - return; - } - foreach (XmlElement item in si) { - if (IsAncestorOrSelf(item, ti)) { - e.Effect = DragDropEffects.None; - e.InfoMessage = "目标书签不能是源书签的子书签。"; - return; - } - } - } - var d = e.DropTargetItem; - var ml = e.MouseLocation; - var child = ml.X > d.Position.X + d.GetBounds(ItemBoundsPortion.ItemOnly).Width / 2; - var append = ml.Y > d.Position.Y + d.Bounds.Height / 2; - if (child == false && copy == false) { - var xi = e.DropTargetIndex + (append ? 1 : -1); - if (xi > -1 && xi < e.ListView.Items.Count - && e.ListView.Items[xi].Selected - && ti.ParentNode == (e.ListView.GetModelObject(xi) as XmlElement).ParentNode) { - e.Effect = DragDropEffects.None; - return; - } - } - e.Effect = copy ? DragDropEffects.Copy : DragDropEffects.Move; - e.InfoMessage = String.Concat((copy ? "复制" : "移动"), "到", (child ? "所有子书签" : String.Empty), (append ? "后面" : "前面")); - base.OnModelCanDrop(e); - } - - protected override void OnModelDropped(ModelDropEventArgs args) { - base.OnModelDropped(args); - var t = args.TargetModel as BookmarkElement; - var se = GetSelectedElements(args.SourceListView as BrightIdeasSoftware.TreeListView, false); - if (se == null) { - return; - } - var ti = args.TargetModel as BookmarkElement; - var d = args.DropTargetItem; - var ml = args.MouseLocation; - Freeze(); - var child = ml.X > d.Position.X + d.GetBounds(ItemBoundsPortion.ItemOnly).Width / 2; - var append = ml.Y > d.Position.Y + d.Bounds.Height / 2; - var copy = (Control.ModifierKeys & Keys.Control) != Keys.None || (args.SourceModels[0] as BookmarkElement).OwnerDocument != ti.OwnerDocument; - var deepCopy = copy && (OperationAffectsDescendants || (Control.ModifierKeys & Keys.Shift) != Keys.None); - var tii = TopItemIndex; - CopyOrMoveElement(se, ti, child, append, copy, deepCopy); - //e.RefreshObjects (); - TopItemIndex = tii; - Unfreeze(); - args.Handled = true; - } - #endregion - - internal void LoadBookmarks(XmlNodeList bookmarks) { - Roots = bookmarks.ToXmlNodeArray(); - foreach (BookmarkElement item in Roots) { - if (item?.IsOpen == true) { - Expand(item); - } - } - _markers.Clear(); - Mark(bookmarks); - } - - void Mark(XmlNodeList bookmarks) { - foreach (BookmarkElement item in bookmarks) { - if (item == null || item.MarkerColor == 0) { - continue; - } - _markers.Add(item, Color.FromArgb(item.MarkerColor)); - Mark(item.ChildNodes); - } - } - - /// - /// 复制或移动书签。 - /// - /// 需要复制或移动的源书签。 - /// 目标书签。 - /// 是否复制为子节点。 - /// 是否复制到后面。 - /// 是否复制书签。 - /// 是否深度复制书签。 - internal void CopyOrMoveElement(List source, XmlElement target, bool child, bool after, bool copy, bool deepCopy) { - var undo = new UndoActionGroup(); - bool spr = false; // source parent is root - bool tpr = false; // target parent is root - var pn = new List(); - if (copy) { - var clones = new List(source.Count); - var td = target.OwnerDocument; - foreach (XmlElement item in source) { - if (item.OwnerDocument == td) { - clones.Add((BookmarkElement)item.CloneNode(deepCopy)); - } - else { - clones.Add(td.ImportNode(item, deepCopy) as BookmarkElement); - } - } - source = clones; - } - else { - foreach (var item in source) { - var e = item.ParentNode as XmlElement; - if (e.Name == Constants.DocumentBookmark) { - spr = true; - pn = null; - break; - } - pn.Add(e); - } - } - //else { - // foreach (var item in source) { - // this.Collapse (item); - // } - // this.RemoveObjects (source); - //} - if (child) { - if (after) { - tpr = target.Name == Constants.DocumentBookmark; - foreach (XmlElement item in source) { - if (!copy) { - undo.Add(new AddElementAction(item)); - } - target.AppendChild(item); - undo.Add(new RemoveElementAction(item)); - } - } - else { - source.Reverse(); - foreach (XmlElement item in source) { - if (!copy) { - undo.Add(new AddElementAction(item)); - } - target.PrependChild(item); - undo.Add(new RemoveElementAction(item)); - } - } - Expand(target); - } - else { - var p = target.ParentNode; - if (after) { - tpr = p.Name == Constants.DocumentBookmark; - source.Reverse(); - foreach (XmlElement item in source) { - if (!copy) { - undo.Add(new AddElementAction(item)); - } - p.InsertAfter(item, target); - undo.Add(new RemoveElementAction(item)); - } - } - else { - foreach (XmlElement item in source) { - if (!copy) { - undo.Add(new AddElementAction(item)); - } - p.InsertBefore(item, target); - undo.Add(new RemoveElementAction(item)); - } - } - } - Undo?.AddUndo(copy ? "复制书签" : "移动书签", undo); - if (copy == false && spr || tpr) { - Roots = (target.OwnerDocument as PdfInfoXmlDocument).BookmarkRoot.SubBookmarks; - } - if (pn != null) { - RefreshObjects(pn); - } - RefreshObject(target); - SelectedObjects = source; - } - - /// - /// 检查 是否为 的先代元素。 - /// - private static bool IsAncestorOrSelf(XmlElement source, XmlElement target) { - do { - if (source == target) { - return true; - } - } while ((target = target.ParentNode as XmlElement) != null); - return false; - } - - internal void MarkItems(List items, Color color) { - foreach (var item in items) { - _markers[item] = color; - item.MarkerColor = color.ToArgb(); - } - RefreshObjects(items); - } - internal List SelectMarkedItems(Color color) { - Freeze(); - var items = new List(); - var c = color.ToArgb(); - var r = new List(); - foreach (var item in _markers) { - if (item.Value.ToArgb() == c) { - var k = item.Key; - Debug.Assert((k.ParentNode == null || k.OwnerDocument == null) == false); - if (k.ParentNode == null || k.OwnerDocument == null) { - r.Add(k); - continue; - } - items.Add(k); - MakeItemVisible(k); - } - } - foreach (var item in r) { - _markers.Remove(item); - } - SelectObjects(items); - EnsureItemsVisible(items); - Unfreeze(); - return items; - } - internal void UnmarkItems(List items) { - foreach (var item in items) { - _markers.Remove(item); - item.MarkerColor = 0; - } - RefreshObjects(items); - } - internal void ClearMarks(bool refresh) { - if (refresh) { - var items = new List(_markers.Count); - foreach (var item in _markers) { - items.Add(item.Key); - item.Key.MarkerColor = 0; - } - _markers.Clear(); - RefreshObjects(items); - } - else { - _markers.Clear(); - } - } - - internal void MakeItemVisible(XmlElement item) { - var p = item.ParentNode; - var a = new Stack(); //ancestorsToExpand - a.Push(null); - a.Push(p); - while (p.Name != Constants.DocumentBookmark) { - p = p.ParentNode; - a.Push(p); - } - while (a.Peek() != null) { - Expand(a.Pop()); - } - } - - internal void EnsureItemsVisible(ICollection items) { - if (items.Count == 0) { - return; - } - var cr = ClientRectangle; - OLVListItem fi = null, li = null; - foreach (var item in items) { - var i = ModelToItem(item); - if (i != null) { - var r = GetItemRect(i.Index); - if (r.Top >= cr.Top && r.Bottom <= cr.Bottom) { - return; - } - li = i; - if (fi == null) { - fi = i; - } - } - } - if ((fi ?? li) != null) { - EnsureVisible(fi.Index); - } - } - - internal void CopySelectedBookmark() { - _copiedBookmarks = GetSelectedElements(false); - Clipboard.Clear(); - } - internal void PasteBookmarks(XmlElement target, bool asChild) { - try { - var t = Clipboard.GetText(); - bool c = false; - if (t.IsNullOrWhiteSpace() == false) { - var doc = new PdfInfoXmlDocument(); - using (var s = new System.IO.StringReader(t)) { - OutlineManager.ImportSimpleBookmarks(s, doc); - } - _copiedBookmarks = doc.Bookmarks.ToNodeList() as List; - c = true; - } - if (_copiedBookmarks == null || _copiedBookmarks.Count == 0) { - return; - } - CopyOrMoveElement(_copiedBookmarks, target, asChild, true, true, c || OperationAffectsDescendants); - } - catch (Exception) { - // ignore - } - } - - internal List GetSelectedElements() { return GetSelectedElements(this, true); } - internal List GetSelectedElements(bool selectChildren) { return GetSelectedElements(this, selectChildren); } - private static List GetSelectedElements(TreeListView treeList, bool selectChildren) { - if (treeList == null) { - return null; - } - var si = treeList.SelectedIndices; - var il = new int[si.Count]; - si.CopyTo(il, 0); - Array.Sort(il); - var el = new List(); - var l = -1; - BookmarkElement e; - foreach (var item in il) { - e = treeList.GetModelObject(item) as BookmarkElement; - if (selectChildren) { - el.Add(e); - } - else if (item > l) { - l = item + (treeList.VirtualListDataSource as Tree).GetVisibleDescendentCount(e); - el.Add(e); - } - } - return el; - } - - private void BookmarkEditorView_BeforeLabelEdit(object sender, LabelEditEventArgs e) { - IsLabelEditing = true; - } - - private void _BookmarkBox_AfterLabelEdit(object sender, LabelEditEventArgs e) { - IsLabelEditing = false; - var o = GetModelObject(e.Item) as XmlElement; - if (o == null || String.IsNullOrEmpty(e.Label)) { - e.CancelEdit = true; - return; - } - var p = new ReplaceTitleTextProcessor(e.Label); - Undo?.AddUndo("编辑书签文本", p.Process(o)); - var i = GetItem(e.Item); - if (o.HasChildNodes && FormHelper.IsCtrlKeyDown == false) { - Expand(o); - } - if (i.Index < Items.Count - 1) { - GetItem(i.Index + 1).BeginEdit(); - } - RefreshItem(i); - } - - private void BookmarkEditor_CellClick(object sender, HyperlinkClickedEventArgs e) { - if (e.Column != _ActionColumn) { - return; - } - e.Handled = true; - ShowBookmarkProperties(e.Model as BookmarkElement); - } - - public void ShowBookmarkProperties(BookmarkElement bookmark) { - if (bookmark == null) { - return; - } - using (var form = new ActionEditorForm(bookmark)) { - if (form.ShowDialog() == DialogResult.OK && form.UndoActions.Count > 0) { - Undo?.AddUndo("更改书签动作属性", form.UndoActions); - RefreshObject(bookmark); - } - } - } - - void BookmarkEditor_HotItemChanged(object sender, BrightIdeasSoftware.HotItemChangedEventArgs e) { - if ((e.HotColumnIndex == _ActionColumn.Index || e.OldHotColumnIndex == _ActionColumn.Index) - //&& (e.HotRowIndex != e.OldHotRowIndex || e.HotColumnIndex != e.OldHotColumnIndex) - ) { - // e.handled = false; - return; - } - e.Handled = true; - } - - private void _BookmarkBox_FormatRow(object sender, FormatRowEventArgs e) { - var b = e.Model as BookmarkElement; - if (b == null) { - return; - } - e.Item.UseItemStyleForSubItems = false; - e.UseCellFormatEvents = false; - Color c; - if (b.MarkerColor != 0) { - e.Item.BackColor = Color.FromArgb(b.MarkerColor); - } - c = b.ForeColor; - if (c != Color.Transparent) { - e.Item.ForeColor = c; - } - var ts = b.TextStyle; - if (ts != FontStyle.Regular) { - e.Item.Font = new Font(e.Item.Font, ts); - } - if (_ActionColumn.Index != -1) { - e.Item.SubItems[_ActionColumn.Index].ForeColor = Color.Blue; - } - } - - internal BookmarkElement SearchBookmark(BookmarkMatcher matcher) { - var s = this.GetFirstSelectedModel(); - if (s == null) { - s = GetModelObject(0) as BookmarkElement; - if (s == null) { - return null; - } - } - var n = s.CreateNavigator(); - BookmarkElement e; - while (n.MoveToFollowing(Constants.Bookmark, String.Empty)) { - e = n.UnderlyingObject as BookmarkElement; - if (e != null && matcher.Match(e)) { - MakeItemVisible(e); - EnsureModelVisible(e); - SelectedObject = e; - return e; - } - } - return null; - } - - internal List SearchBookmarks(BookmarkMatcher matcher) { - var matches = new List(); - Freeze(); - try { - foreach (BookmarkElement item in Roots) { - SearchBookmarks(matcher, matches, item); - } - } - catch (Exception ex) { - FormHelper.ErrorBox("在匹配文本时出现错误:" + ex.Message); - } - Unfreeze(); - if (matches.Count > 0) { - EnsureItemsVisible(matches); - SelectedObjects = matches; - } - return matches; - } - - private void SearchBookmarks(BookmarkMatcher matcher, List matches, BookmarkElement item) { - if (item.HasChildNodes) { - foreach (BookmarkElement c in item.SelectNodes(Constants.Bookmark)) { - SearchBookmarks(matcher, matches, c); - } - } - if (matcher.Match(item)) { - matches.Add(item); - MakeItemVisible(item); - } - } - - - } -} diff --git a/pdfpatcher/App/Functions/Editor/BookmarkEditorView.resx b/pdfpatcher/App/Functions/Editor/BookmarkEditorView.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/BookmarkEditorView.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/Editor/Commands/BookmarkActionCommand.cs b/pdfpatcher/App/Functions/Editor/Commands/BookmarkActionCommand.cs deleted file mode 100644 index 808f280164d3da3cd3c80e4595d5871de474fd81..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/Commands/BookmarkActionCommand.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; -using BrightIdeasSoftware; -using PDFPatcher.Common; -using PDFPatcher.Processor; - -namespace PDFPatcher.Functions.Editor -{ - sealed class BookmarkActionCommand : IEditorCommand - { - readonly string _viewType; - - public BookmarkActionCommand(string viewType) { - _viewType = viewType; - } - - public void Process(Controller controller, params string[] parameters) { - var b = controller.View.Bookmark; - if (b.FocusedItem == null) { - return; - } - switch (_viewType) { - case Constants.DestinationAttributes.ViewType.XYZ: - using (var form = new ZoomRateEntryForm()) { - if (form.ShowDialog() != DialogResult.OK) { - return; - } - var z = form.ZoomRate; - float r; - if (z == Constants.Coordinates.Unchanged) { - controller.ProcessBookmarks(new ChangeZoomRateProcessor(null)); - } - else if (z.TryParse(out r)) { - controller.ProcessBookmarks(new ChangeZoomRateProcessor(r)); - } - } - break; - case Constants.Coordinates.Unchanged: - controller.ProcessBookmarks(new ChangeZoomRateProcessor(null)); - break; - case "_ChangeCoordinates": - using (var f = new NewCoordinateEntryForm()) { - if (f.ShowDialog() == DialogResult.OK) { - controller.ProcessBookmarks(new ChangeCoordinateProcessor(f.CoordinateName, f.AdjustmentValue, f.IsAbsolute, f.IsProportional)); - } - } - break; - case "_SetCurrentCoordinates": - var v = controller.View.Viewer; - var pp = v.TransposeClientToPagePosition(v.ClientRectangle.Width, 0); - if (pp.Page == 0) { - return; - } - controller.ProcessBookmarks(new ChangePageCoordinateProcessor(Constants.Coordinates.Top, pp.Page, pp.PageX, pp.PageY)); - break; - case "_BookmarkAction": - b.ShowBookmarkProperties(b.GetFirstSelectedModel()); - break; - default: - controller.ProcessBookmarks(new ChangeZoomRateProcessor(_viewType)); - break; - } - } - - } -} diff --git a/pdfpatcher/App/Functions/Editor/Commands/BookmarkLevelCommand.cs b/pdfpatcher/App/Functions/Editor/Commands/BookmarkLevelCommand.cs deleted file mode 100644 index 4f31c94ccce181b2208222266b18445924b369e9..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/Commands/BookmarkLevelCommand.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using PDFPatcher.Processor; - -namespace PDFPatcher.Functions.Editor -{ - sealed class BookmarkLevelCommand : IEditorCommand - { - readonly bool _levelUp; - public BookmarkLevelCommand(bool levelUp) { - _levelUp = levelUp; - } - public void Process(Controller controller, params string[] parameters) { - BookmarkLevel(controller, _levelUp); - } - - internal void BookmarkLevel(Controller controller, bool levelUp) { - var b = controller.View.Bookmark; - var si = b.GetSelectedElements(true); - b.BeginUpdate(); - var ld = controller.ProcessBookmarks(false, false, levelUp ? new LevelUpProcessor() as IPdfInfoXmlProcessor : new LevelDownProcessor()); - if (ld != null) { - foreach (var item in ld) { - b.Expand(item); - } - } - b.RefreshObjects(si); - b.SelectedObjects = si; - b.EndUpdate(); - } - - } -} diff --git a/pdfpatcher/App/Functions/Editor/Commands/BookmarkMarkerCommand.cs b/pdfpatcher/App/Functions/Editor/Commands/BookmarkMarkerCommand.cs deleted file mode 100644 index 382d2171fbd49424df2d9261725c5c314a02c768..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/Commands/BookmarkMarkerCommand.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System.Drawing; -using System.Windows.Forms; -using PDFPatcher.Common; - -namespace PDFPatcher.Functions.Editor -{ - sealed class BookmarkMarkerCommand : IEditorCommand - { - static readonly string[] __commands = { - "_MarkBookmarkRed", - "_MarkBookmarkYellow", - "_MarkBookmarkGreen", - "_MarkBookmarkBlue", - "_MarkBookmarkCyan", - "_MarkBookmarkPurple", - "_UnmarkBookmark", - "_ClearBookmarkMarks", - "_SelectRedMarks", - "_SelectYellowMarks", - "_SelectGreenMarks", - "_SelectBlueMarks", - "_SelectCyanMarks", - "_SelectPurpleMarks" - }; - internal static void RegisterCommands(CommandRegistry registry) { - foreach (var item in __commands) { - registry.Register(new BookmarkMarkerCommand(item), item); - } - } - - readonly string _command; - - public BookmarkMarkerCommand(string command) { - _command = command; - } - - public void Process(Controller controller, params string[] parameters) { - var b = controller.View.Bookmark; - switch (_command) { - case "_MarkBookmarkRed": b.MarkItems(b.GetSelectedElements(true), Color.PeachPuff); break; - case "_MarkBookmarkYellow": b.MarkItems(b.GetSelectedElements(true), Color.Yellow); break; - case "_MarkBookmarkGreen": b.MarkItems(b.GetSelectedElements(true), Color.GreenYellow); break; - case "_MarkBookmarkBlue": b.MarkItems(b.GetSelectedElements(true), Color.LightSkyBlue); break; - case "_MarkBookmarkCyan": b.MarkItems(b.GetSelectedElements(true), Color.Aqua); break; - case "_MarkBookmarkPurple": b.MarkItems(b.GetSelectedElements(true), Color.Violet); break; - case "_UnmarkBookmark": b.UnmarkItems(b.GetSelectedElements(true)); break; - case "_ClearBookmarkMarks": - if (b.HasMarker && FormHelper.YesNoBox("是否确定清除书签标记?") == DialogResult.Yes) { - b.ClearMarks(true); - } - break; - case "_SelectRedMarks": b.SelectMarkedItems(Color.PeachPuff); break; - case "_SelectYellowMarks": b.SelectMarkedItems(Color.Yellow); break; - case "_SelectGreenMarks": b.SelectMarkedItems(Color.GreenYellow); break; - case "_SelectBlueMarks": b.SelectMarkedItems(Color.LightSkyBlue); break; - case "_SelectCyanMarks": b.SelectMarkedItems(Color.Aqua); break; - case "_SelectPurpleMarks": b.SelectMarkedItems(Color.Violet); break; - } - } - - } -} diff --git a/pdfpatcher/App/Functions/Editor/Commands/BookmarkPageCommand.cs b/pdfpatcher/App/Functions/Editor/Commands/BookmarkPageCommand.cs deleted file mode 100644 index 93c6c2736c820fcfcc91f4d83895638ef0783f39..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/Commands/BookmarkPageCommand.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Windows.Forms; -using PDFPatcher.Processor; - -namespace PDFPatcher.Functions.Editor -{ - sealed class BookmarkPageCommand : IEditorCommand - { - readonly int _number; - - public BookmarkPageCommand(int number) { - _number = number; - } - - public void Process(Controller controller, params string[] parameters) { - var n = _number; - if (_number == 0) { - using (var form = new ShiftPageNumberEntryForm()) { - if (form.ShowDialog() != DialogResult.OK || form.ShiftNumber == 0) { - return; - } - n = form.ShiftNumber; - } - } - controller.ProcessBookmarks(new ChangePageNumberProcessor(n, false, true)); - } - - } -} diff --git a/pdfpatcher/App/Functions/Editor/Commands/BookmarkSelectionCommand.cs b/pdfpatcher/App/Functions/Editor/Commands/BookmarkSelectionCommand.cs deleted file mode 100644 index 0be4ca6a20e64e8590418a35038e5e714e9af0ae..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/Commands/BookmarkSelectionCommand.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Xml; -using BrightIdeasSoftware; - -namespace PDFPatcher.Functions.Editor -{ - sealed class BookmarkSelectionCommand : IEditorCommand - { - readonly string _command; - - public BookmarkSelectionCommand(string command) { - _command = command; - } - - public void Process(Controller controller, params string[] parameters) { - var b = controller.View.Bookmark; - switch (_command) { - case Commands.SelectAllItems: - b.SelectAll(); - break; - case Commands.SelectNone: - b.DeselectAll(); - break; - case Commands.InvertSelectItem: - b.InvertSelect(); - break; - case Commands.CollapseAll: - b.CollapseAll(); - break; - case Commands.ExpandAll: - b.ExpandAll(); - break; - case Commands.CollapseChildren: - foreach (var item in b.GetSelectedElements(false)) { - foreach (XmlNode ci in item.SubBookmarks) { - b.Collapse(ci); - } - } - break; - } - } - - } -} diff --git a/pdfpatcher/App/Functions/Editor/Commands/BookmarkStyleCommand.cs b/pdfpatcher/App/Functions/Editor/Commands/BookmarkStyleCommand.cs deleted file mode 100644 index d87d957dc24cf9c1e44e74e7c77ae48060a6d246..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/Commands/BookmarkStyleCommand.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using BrightIdeasSoftware; -using PDFPatcher.Processor; - -namespace PDFPatcher.Functions.Editor -{ - sealed class BookmarkStyleCommand : IEditorCommand - { - readonly SetTextStyleProcessor.Style _style; - - public BookmarkStyleCommand(SetTextStyleProcessor.Style style) { - _style = style; - } - - public void Process(Controller controller, params string[] parameters) { - var b = controller.View.Bookmark; - if (b.FocusedItem == null) { - return; - } - var i = b.GetFirstSelectedModel(); - if (i == null) { - return; - } - controller.ProcessBookmarks(new SetTextStyleProcessor(i, _style)); - } - - } -} diff --git a/pdfpatcher/App/Functions/Editor/Commands/CopyBookmarkItemCommand.cs b/pdfpatcher/App/Functions/Editor/Commands/CopyBookmarkItemCommand.cs deleted file mode 100644 index 3a2817c1f23182cac36dd56ecda6652cd811c58f..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/Commands/CopyBookmarkItemCommand.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using PDFPatcher.Processor; - -namespace PDFPatcher.Functions.Editor -{ - sealed class CopyBookmarkItemCommand : IEditorCommand - { - public void Process(Controller controller, params string[] parameters) { - controller.View.Bookmark.CopySelectedBookmark(); - } - - } -} diff --git a/pdfpatcher/App/Functions/Editor/Commands/DeleteBookmarkItemCommand.cs b/pdfpatcher/App/Functions/Editor/Commands/DeleteBookmarkItemCommand.cs deleted file mode 100644 index e861061794d59ea25788413cff288ea4bfac0be6..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/Commands/DeleteBookmarkItemCommand.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using PDFPatcher.Processor; - -namespace PDFPatcher.Functions.Editor -{ - sealed class DeleteBookmarkItemCommand : IEditorCommand - { - public void Process(Controller controller, params string[] parameters) { - RemoveItems(controller, controller.View.Bookmark.GetSelectedElements(false)); - } - - static void RemoveItems(Controller controller, System.Collections.IList si) { - if (si.Count == 0) { - return; - } - var b = controller.View.Bookmark; - b.RemoveObjects(si); - var undo = new UndoActionGroup(); - var l = new List(); - foreach (XmlElement item in si) { - if (item == null || item.ParentNode == null) { - continue; - } - undo.Add(new AddElementAction(item)); - var p = item.ParentNode; - p.RemoveChild(item); - if (l.Contains(p) == false) { - l.Add(p); - } - } - foreach (var item in l) { - if (item.ParentNode != null) { - b.RefreshObject(item); - } - } - controller.Model.Undo.AddUndo("删除书签", undo); - } - - } -} diff --git a/pdfpatcher/App/Functions/Editor/Commands/DocumentPropertyCommand.cs b/pdfpatcher/App/Functions/Editor/Commands/DocumentPropertyCommand.cs deleted file mode 100644 index d0312f23488a9a98081849d2e36a7f3d36d884df..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/Commands/DocumentPropertyCommand.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace PDFPatcher.Functions.Editor -{ - sealed class DocumentPropertyCommand : IEditorCommand - { - public void Process(Controller controller, params string[] parameters) { - using (var f = new DocumentInfoForm() { - Document = controller.Model.PdfDocument, - InfoDocument = controller.Model.Document - }) { - f.ShowDialog(); - } - } - - } -} diff --git a/pdfpatcher/App/Functions/Editor/Commands/InsertBookmarkCommand.cs b/pdfpatcher/App/Functions/Editor/Commands/InsertBookmarkCommand.cs deleted file mode 100644 index 5de0188197988c07a86f8b8597c348e1654caf81..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/Commands/InsertBookmarkCommand.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System; -using System.Drawing; -using System.Text.RegularExpressions; -using System.Windows.Forms; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions.Editor -{ - sealed class InsertBookmarkCommand : IEditorCommand - { - static readonly Regex __RemoveOcrWhiteSpace = new Regex(@"\s{2,}", RegexOptions.Compiled); - static InsertBookmarkForm _dialog; - - public void Process(Controller controller, params string[] parameters) { - var v = controller.View.Viewer; - BookmarkAtClientPoint(controller, v.TransposeVirtualImageToClient(v.PinPoint.X, v.PinPoint.Y)); - } - - static void BookmarkAtClientPoint(Controller controller, Point cp) { - var v = controller.View.Viewer; - var pp = v.TransposeClientToPagePosition(cp.X, cp.Y); - if (pp.Page == 0) { - return; - } - if (Control.ModifierKeys == Keys.Control) { - v.PinPoint = v.PointToImage(cp); - ShowInsertBookmarkDialog(controller, cp, new EditModel.Region(pp, null, EditModel.TextSource.Empty)); - return; - } - ShowInsertBookmarkDialog(controller, cp, controller.CopyText(cp, pp)); - } - - static void ShowInsertBookmarkDialog(Controller controller, Point mousePoint, EditModel.Region region) { - var p = region.Position; - if (p.Page == 0) { - return; - } - var f = GetDialog(controller); - var v = controller.View.Viewer; - Point fp; - var sr = v.SelectionRegion; - if (sr != RectangleF.Empty) { - fp = v.TransposeVirtualImageToClient(sr.Left, sr.Top); - if (v.HorizontalFlow) { - fp.X += sr.Width.ToInt32() + 20; - } - else { - fp.Y -= f.Height + 20; - } - } - else { - fp = new Point(mousePoint.X + 20, mousePoint.Y - f.Height); - } - var l = v.PointToScreen(fp); - if (l.Y < 0) { - l.Y = l.Y + (int)sr.Height + f.Height + 40; - if (l.Y + f.Height > Screen.PrimaryScreen.WorkingArea.Height) { - l.Y = Screen.PrimaryScreen.WorkingArea.Height - f.Height; - } - } - if (l.X < v.PointToScreen(Point.Empty).X) { - l.X = v.PointToScreen(Point.Empty).X; - } - f.Location = l; - f.TargetPosition = p.PageY; - if (String.IsNullOrEmpty(region.Text) == false) { - f.Title = __RemoveOcrWhiteSpace.Replace(region.Text, " ").Trim(); - } - f.Comment = region.LiteralTextSource; - f.Show(); - f.TargetPageNumber = p.Page; - } - - static InsertBookmarkForm GetDialog(Controller controller) { - if (_dialog != null && _dialog.IsDisposed == false) { - _dialog.Controller = controller; - return _dialog; - } - _dialog = new InsertBookmarkForm { - Controller = controller - }; - _dialog.OkClicked += (object sender, EventArgs e) => { - var f = (InsertBookmarkForm)sender; - var c = f.Controller; - var t = f.Title; - if (string.IsNullOrEmpty(t) && f.InsertMode != 0) { - FormHelper.ErrorBox("书签标题不能为空。"); - return; - } - c.Model.LockDownViewer = true; - c.InsertBookmark(t, f.TargetPageNumber, f.TargetPosition, (InsertBookmarkPositionType)f.InsertMode); - c.Model.LockDownViewer = false; - }; - _dialog.Deactivate += (s, args) => { - (s as Form).Visible = false; - }; - _dialog.VisibleChanged += (s, args) => { - var f = (InsertBookmarkForm)s; - f.Controller.View.Viewer.ShowPinPoint = f.Visible; - }; - return _dialog; - } - - } -} diff --git a/pdfpatcher/App/Functions/Editor/Commands/LoadDocumentCommand.cs b/pdfpatcher/App/Functions/Editor/Commands/LoadDocumentCommand.cs deleted file mode 100644 index 87828f274095f9540eb50782136bad4cfa1b1af2..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/Commands/LoadDocumentCommand.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Windows.Forms; -using PDFPatcher.Common; - -namespace PDFPatcher.Functions.Editor -{ - sealed class LoadDocumentCommand : IEditorCommand - { - readonly bool _showDialog, _importBookmark; - public LoadDocumentCommand(bool showDialog, bool importBookmark) { - _showDialog = showDialog; - _importBookmark = importBookmark; - } - - public void Process(Controller controller, params string[] parameters) { - if (_showDialog) { - using (var f = new OpenFileDialog { - DefaultExt = _importBookmark ? Constants.FileExtensions.Xml : Constants.FileExtensions.Pdf, - Title = _importBookmark ? "打开需要导入的书签文件" : "打开需要编辑的文件", - Filter = Constants.FileExtensions.AllEditableFilter - }) { - if (f.ShowDialog() != DialogResult.OK) { - return; - } - parameters = new string[] { f.FileName }; - } - } - try { - controller.LoadDocument(parameters[0], _importBookmark); - } - catch (Exception ex) { - FormHelper.ErrorBox("在加载信息文件时出现错误:" + ex.Message); - } - } - } -} diff --git a/pdfpatcher/App/Functions/Editor/Commands/OcrPageCommand.cs b/pdfpatcher/App/Functions/Editor/Commands/OcrPageCommand.cs deleted file mode 100644 index e7ef455001d1acdff60d05fe2996b2552daa5b77..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/Commands/OcrPageCommand.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; -using System.Xml; -using PDFPatcher.Common; -using PDFPatcher.Processor; - -namespace PDFPatcher.Functions.Editor -{ - sealed class OcrPageCommand : IEditorCommand - { - public void Process(Controller controller, params string[] parameters) { - var v = controller.View.Viewer; - var pp = v.TransposeVirtualImageToPagePosition(v.PinPoint.X, v.PinPoint.Y); - if (pp.Page == 0) { - return; - } - var or = v.OcrPage(pp.Page, true); - if (or.HasContent()) { - Clipboard.SetText(String.Join(Environment.NewLine, v.CleanUpOcrResult(or))); - } - else { - FormHelper.InfoBox("页面不包含可识别的文本,或出现识别引擎错误。"); - } - } - - } -} diff --git a/pdfpatcher/App/Functions/Editor/Commands/PagePropertiesCommand.cs b/pdfpatcher/App/Functions/Editor/Commands/PagePropertiesCommand.cs deleted file mode 100644 index f19222bad417e52b4a9fc4db9d704dba25faa47f..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/Commands/PagePropertiesCommand.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Text.RegularExpressions; -using System.Windows.Forms; - -namespace PDFPatcher.Functions.Editor -{ - sealed class PagePropertiesCommand : IEditorCommand - { - //static readonly Regex __RemoveOcrWhiteSpace = new Regex (@"\s{2,}", RegexOptions.Compiled); - static PagePropertyForm _dialog; - - public void Process(Controller controller, params string[] parameters) { - var v = controller.View.Viewer; - var l = v.PinPoint; - var p = v.TransposeVirtualImageToPagePosition(l.X, l.Y); - var f = GetDialog(); - using (var page = controller.Model.PdfDocument.LoadPage(p.Page)) { - f.Location = v.PointToScreen(v.TransposeVirtualImageToClient(l.X, l.Y)); - f.Show(); - f.LoadPage(page); - } - } - - private static PagePropertyForm GetDialog() { - if (_dialog != null && _dialog.IsDisposed == false) { - return _dialog; - } - _dialog = new PagePropertyForm(); - _dialog.Deactivate += (s, args) => ((Form)s).Visible = false; - return _dialog; - } - - } -} diff --git a/pdfpatcher/App/Functions/Editor/Commands/PasteBookmarkItemCommand.cs b/pdfpatcher/App/Functions/Editor/Commands/PasteBookmarkItemCommand.cs deleted file mode 100644 index 79c29708ec1ecb02cee59f7a9a9e83b4ceca9c5f..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/Commands/PasteBookmarkItemCommand.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using PDFPatcher.Processor; - -namespace PDFPatcher.Functions.Editor -{ - sealed class PasteBookmarkItemCommand : IEditorCommand - { - public void Process(Controller controller, params string[] parameters) { - var b = controller.View.Bookmark; - b.PasteBookmarks(b.FocusedItem != null - ? b.GetModelObject(b.FocusedItem.Index) as XmlElement - : controller.Model.Document.BookmarkRoot, - b.FocusedItem == null); - } - - } -} diff --git a/pdfpatcher/App/Functions/Editor/Commands/QuickSelectCommand.cs b/pdfpatcher/App/Functions/Editor/Commands/QuickSelectCommand.cs deleted file mode 100644 index 422bfe251ecd31849ea7ffc1f342c3fa6f0dd593..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/Commands/QuickSelectCommand.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System.Drawing; -using System.Windows.Forms; -using PDFPatcher.Common; -using PDFPatcher.Model; -using PDFPatcher.Processor; - -namespace PDFPatcher.Functions.Editor -{ - sealed class QuickSelectCommand : IEditorCommand - { - const string __N = "[0-90-9一二三四五六七八九十〇]+"; - const string __S = @"\s*"; - const string __D = __S + @"[\.. ]"; - const string __ND = __N + __D; - const string __NN = @"(?:\s*[^0-90-9\..一二三四五六七八九十〇]|$)"; - const string __UC = "[A-Z]+"; - const string __UCNS = @"[A-Z0-9\s]*"; - const string __OD = @"(?:[0-9]+\.?)?"; - - static readonly MatchPattern[] __Patterns = { - new MatchPattern ("^" + __S + __ND + "?" + __NN, true, false, true){ Name = "“N.”模式" }, - new MatchPattern ("^" + __S + __ND + __ND + "?" + __NN, true, false, true){ Name = "“N.N”模式" }, - new MatchPattern ("^" + __S + __ND + __ND + __ND + "?" + __NN, true, false, true){ Name = "“N.N.N”模式" }, - new MatchPattern ("^" + __S + __ND + __ND + __ND + __ND + "?" + __NN, true, false, true){ Name = "“N.N.N.N”模式" }, - new MatchPattern ("^" + __S + __ND + __ND + __ND + __ND + __ND + "?" + __NN, true, false, true){ Name = "“N.N.N.N.N”模式" }, - new MatchPattern ("^" + __S + "第" + __S + __N + __S + "(?:部分|部)|^" + __S + "part" + __S + "[0-9]", false, false, true){ Name = "“第N部分”" }, - new MatchPattern ("^" + __S + "第" + __S + __N + __S + "[篇卷]|^" + __S + "(?:volume|vol)" + __S + "[0-9]", false, false, true){ Name = "“第N篇”或“第N卷”" }, - new MatchPattern ("^" + __S + "第" + __S + __N + __S + "章|^" + __S + "chapter" + __S + "[0-9]", false, false, true){ Name = "“第N章”" }, - new MatchPattern ("^" + __S + "第" + __S + __N + __S + "节|^" + __S + "section" + __S + "[0-9]", false, false, true){ Name = "“第N节”" }, - new MatchPattern ("^(?:" + __S + __OD + __S + __UC + __UCNS + ")+", true, true, true){ Name = "全英文大写" }, - }; - internal static void RegisterCommands(CommandRegistry registry) { - foreach (var item in __Patterns) { - registry.Register(new QuickSelectCommand(item), item.Name); - } - } - internal static void RegisterMenuItems(ToolStripItemCollection container) { - foreach (var item in __Patterns) { - container.Add(new ToolStripMenuItem(item.Name) { Name = item.Name }); - } - } - internal static void RegisterMenuItemsWithPattern(ToolStripItemCollection container) { - foreach (var item in __Patterns) { - container.Add(new ToolStripMenuItem(item.Name) { Name = item.Name, Tag = item }); - } - } - - readonly BookmarkMatcher _command; - - public QuickSelectCommand(MatchPattern command) { - _command = BookmarkMatcher.Create(command.Text, BookmarkMatcher.MatcherType.Regex, command.MatchCase, command.FullMatch); - } - - public void Process(Controller controller, params string[] parameters) { - controller.View.Bookmark.SearchBookmarks(_command); - } - - } -} diff --git a/pdfpatcher/App/Functions/Editor/Commands/SaveDocumentCommand.cs b/pdfpatcher/App/Functions/Editor/Commands/SaveDocumentCommand.cs deleted file mode 100644 index db08c4c5c31af1d697ab31a8ebe6b9960b1fed16..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/Commands/SaveDocumentCommand.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System; -using System.IO; -using System.Windows.Forms; -using PDFPatcher.Common; -using PDFPatcher.Processor; - -namespace PDFPatcher.Functions.Editor -{ - sealed class SaveDocumentCommand : IEditorCommand - { - readonly bool _showDialog, _saveAsBookmark; - public SaveDocumentCommand(bool showDialog, bool saveAsBookmark) { - _saveAsBookmark = saveAsBookmark; - _showDialog = showDialog; - } - public void Process(Controller controller, params string[] parameters) { - if (_saveAsBookmark) { - SaveBookmark(controller, _showDialog); - } - else { - SavePdf(controller); - } - } - - static void SaveBookmark(Controller controller, bool showDialog) { - var idoc = controller.Model.Document; - var mudoc = controller.Model.PdfDocument; - var t = new FilePath(controller.Model.DocumentPath); - if (idoc == null || idoc.DocumentElement == null || t == null) { - return; - } - - if (t.HasExtension(Constants.FileExtensions.Xml) == false - || showDialog) { - using (var d = new SaveFileDialog() { - DefaultExt = Constants.FileExtensions.Xml, - Title = "指定保存文件的路径", - Filter = Constants.FileExtensions.XmlFilter + "|" + Constants.FileExtensions.TxtFilter - }) { - if (t.ExistsFile) { - d.InitialDirectory = t.Directory; - d.FileName = t.FileNameWithoutExtension; - } - if (d.ShowDialog() == DialogResult.OK) { - t = d.FileName; - } - else { - return; - } - } - } - - if (t.HasExtension(Constants.FileExtensions.Txt)) { - using (var writer = new StreamWriter(t)) { - const string indentString = "\t"; - writer.WriteLine("#版本=" + Constants.InfoDocVersion); - if (mudoc != null) { - writer.WriteLine("#" + Constants.Info.DocumentPath + "=" + mudoc.FilePath); - } - writer.WriteLine("#缩进标记=" + indentString); - writer.WriteLine("#首页页码=1"); - writer.WriteLine(); - OutlineManager.WriteSimpleBookmark(writer, idoc.BookmarkRoot, 0, indentString); - } - } - else { - t = t.EnsureExtension(Constants.FileExtensions.Xml); - using (var writer = System.Xml.XmlWriter.Create(t, DocInfoExporter.GetWriterSettings())) { - if (mudoc != null) { - idoc.PdfDocumentPath = mudoc.FilePath; - } - idoc.WriteContentTo(writer); - } - controller.View.DocumentPath = t; - - RecentFileMenuHelper.AddRecentHistoryFile(t); - } - } - - private static void SavePdf(Controller controller) { - var m = controller.Model; - var vv = controller.View.Viewer; - if (m.Document == null) { - FormHelper.ErrorBox("尚未加载书签文档。"); - return; - } - using (var f = new SavePdfForm(m.GetPdfFilePath(), m.LastSavedPdfPath, m.Document)) { - f.DoWork = (s, args) => vv.CloseFile(); - f.Finished = (s, args) => { vv.Reopen(); vv.Enabled = true; }; - - if (f.ShowDialog() == DialogResult.OK) { - vv.Enabled = false; - m.Document.PdfDocumentPath = f.SourceFilePath; - m.LastSavedPdfPath = f.TargetFilePath; - } - } - } - - } -} diff --git a/pdfpatcher/App/Functions/Editor/Commands/SavePageImageCommand.cs b/pdfpatcher/App/Functions/Editor/Commands/SavePageImageCommand.cs deleted file mode 100644 index 2c5464a2651076269cc402e721d4a7e36887239c..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/Commands/SavePageImageCommand.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Windows.Forms; -using PDFPatcher.Common; -using PDFPatcher.Processor.Imaging; - -namespace PDFPatcher.Functions.Editor -{ - sealed class SavePageImageCommand : IEditorCommand - { - static SaveFileDialog _dialog; - - public void Process(Controller controller, params string[] parameters) { - var v = controller.View.Viewer; - var l = v.PinPoint; - var p = v.TransposeVirtualImageToPagePosition(l.X, l.Y); - _dialog = InitDialog(); - _dialog.FileName = ((FilePath)controller.Model.DocumentPath).FileNameWithoutExtension + "." + p.Page; - - if (_dialog.ShowDialog() == DialogResult.OK) { - _dialog.DefaultExt = ((FilePath)_dialog.FileName).FileExtension; - v.GetPageImage(p.Page).SaveAs(_dialog.FileName); - } - } - - static SaveFileDialog InitDialog() { - return _dialog ?? (_dialog = new SaveFileDialog { - DefaultExt = Constants.FileExtensions.Png, - Filter = Constants.FileExtensions.ImageFilter - }); - } - } -} diff --git a/pdfpatcher/App/Functions/Editor/Commands/SimpleBookmarkCommand.cs b/pdfpatcher/App/Functions/Editor/Commands/SimpleBookmarkCommand.cs deleted file mode 100644 index e78312498bf915e19285c5be7d78efb4740e5e0b..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/Commands/SimpleBookmarkCommand.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; -using System.Xml; -using PDFPatcher.Common; -using PDFPatcher.Processor; - -namespace PDFPatcher.Functions.Editor -{ - sealed class SimpleBookmarkCommand : IEditorCommand where T : IPdfInfoXmlProcessor, new() - { - public void Process(Controller controller, params string[] parameters) { - var b = controller.View.Bookmark; - if (b.FocusedItem == null) { - return; - } - controller.ProcessBookmarks(new T()); - } - } - - sealed class SimpleBookmarkCommand : IEditorCommand where T : IPdfInfoXmlProcessor

, new() - { - readonly P _parameter; - - public SimpleBookmarkCommand(P parameter) { - _parameter = parameter; - } - - public void Process(Controller controller, params string[] parameters) { - var b = controller.View.Bookmark; - if (b.FocusedItem == null) { - return; - } - controller.ProcessBookmarks(new T() { Parameter = _parameter }); - } - - } -} diff --git a/pdfpatcher/App/Functions/Editor/Commands/ViewerCommand.cs b/pdfpatcher/App/Functions/Editor/Commands/ViewerCommand.cs deleted file mode 100644 index 0e16318bfc17aa4b0e73b73f5078b41226123b19..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/Commands/ViewerCommand.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System.Drawing; -using System.Windows.Forms; -using PDFPatcher.Common; - -namespace PDFPatcher.Functions.Editor -{ - sealed class ViewerCommand : IEditorCommand - { - static readonly Color __DarkModeColor = Color.DarkGray; - static readonly Color __GreenModeColor = Color.FromArgb(0xCC, 0xFF, 0xCC); - static readonly string[] __commands = { - "_FirstPage", - "_PreviousPage", - "_NextPage", - "_LastPage", - "_ScrollVertical", - "_ScrollHorizontal", - "_TrueColorSpace", - "_GrayColorSpace", - "_InvertColor", - "_MoveMode", - "_SelectionMode", - "_FullPageScroll", - "_ShowTextBorders", - "_DarkMode", - "_GreenMode", - "_ShowBookmarks", - "_ShowAnnotations", - "_OcrDetectPunctuation", - "_FullScreen", - "_EditorOptions" - }; - internal static void RegisterCommands(CommandRegistry registry) { - foreach (var item in __commands) { - registry.Register(new ViewerCommand(item), item); - } - } - - readonly string _command; - - public ViewerCommand(string command) { - _command = command; - } - - public void Process(Controller controller, params string[] parameters) { - var v = controller.View.Viewer; - switch (_command) { - case "_FirstPage": - case "_PreviousPage": - case "_NextPage": - case "_LastPage": v.ExecuteCommand(_command); break; - case "_ScrollVertical": v.ContentDirection = Editor.ContentDirection.TopToDown; break; - case "_ScrollHorizontal": v.ContentDirection = Editor.ContentDirection.RightToLeft; break; - case "_TrueColorSpace": v.GrayScale = false; break; - case "_GrayColorSpace": v.GrayScale = true; break; - case "_InvertColor": v.InvertColor = !v.InvertColor; break; - case "_MoveMode": v.MouseMode = Editor.MouseMode.Move; break; - case "_SelectionMode": v.MouseMode = Editor.MouseMode.Selection; break; - case "_FullPageScroll": v.FullPageScroll = !v.FullPageScroll; break; - case "_ShowTextBorders": v.ShowTextBorders = !v.ShowTextBorders; break; - case "_DarkMode": v.TintColor = v.TintColor != __DarkModeColor ? __DarkModeColor : Color.Transparent; break; - case "_GreenMode": v.TintColor = v.TintColor != __GreenModeColor ? __GreenModeColor : Color.Transparent; break; - case "_ShowAnnotations": v.HideAnnotations = !v.HideAnnotations; break; - case "_ShowBookmarks": controller.View.MainPanel.Panel1Collapsed = !controller.View.MainPanel.Panel1Collapsed; break; - case "_OcrDetectPunctuation": v.OcrOptions.DetectContentPunctuations = !v.OcrOptions.DetectContentPunctuations; break; - case "_FullScreen": AppContext.MainForm.FullScreen = !AppContext.MainForm.FullScreen; break; - case "_EditorOptions": AppContext.MainForm.SelectFunctionList(Function.EditorOptions); break; - } - } - - } -} diff --git a/pdfpatcher/App/Functions/Editor/Controller.cs b/pdfpatcher/App/Functions/Editor/Controller.cs deleted file mode 100644 index 47c6e2e24968ad87c231afafda1ef78d02c36278..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/Controller.cs +++ /dev/null @@ -1,895 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using System.Xml; -using BrightIdeasSoftware; -using PDFPatcher.Common; -using PDFPatcher.Model; -using PDFPatcher.Processor; - -namespace PDFPatcher.Functions.Editor -{ - sealed class Controller - { - public EditModel Model { get; } - public IEditView View { get; } - - BackgroundWorker _loader; - - public Controller(IEditView view) { - Model = new EditModel(); - View = view; - Model.Undo.OnAddUndo += (UndoManager u, IUndoAction a) => View.UndoButton.Enabled = true; - View.Bookmark.Undo = Model.Undo; - } - - internal IEnumerable ProcessBookmarks(IPdfInfoXmlProcessor processor) { - return ProcessBookmarks(View.AffectsDescendantBookmarks, true, processor); - } - ///

- /// 逐个处理选中的书签。 - /// - /// 处理操作是否包含选中书签的内层书签。 - /// 处理时是否遍历选中的内层书签。 - /// 用于处理书签的 。 - /// 处理后的书签。 - internal IEnumerable ProcessBookmarks(bool includeDescendant, bool selectChildren, IPdfInfoXmlProcessor processor) { - var b = View.Bookmark; - b.Freeze(); - var si = b.GetSelectedElements(selectChildren); - var pi = new HashSet(); - var r = ProcessBookmarks(si, pi, includeDescendant, processor); - if (r != null) { - foreach (var item in r) { - var i = item as XmlElement; - if (i.ParentNode.Name == Constants.DocumentBookmark) { - b.Roots = i.ParentNode.SelectNodes(Constants.Bookmark).ToXmlNodeArray(); - break; - } - } - b.RefreshObjects(r.ToArray()); - } - b.Unfreeze(); - return r; - } - HashSet ProcessBookmarks(IList si, HashSet processedItems, bool includeDescendant, IPdfInfoXmlProcessor processor) { - if (si == null || si.Count == 0) { - return null; - } - var undo = new UndoActionGroup(); - foreach (BookmarkElement item in si) { - ProcessItem(includeDescendant, processor, processedItems, undo, item); - } - if (undo.Count > 0) { - Model.Undo.AddUndo(processor.Name, undo); - } - return new HashSet(undo.AffectedElements); - } - - static void ProcessItem(bool includeDescendant, IPdfInfoXmlProcessor processor, HashSet processedItems, UndoActionGroup undo, BookmarkElement item) { - if (item == null || processedItems.Contains(item)) { - return; - } - undo.Add(processor.Process(item)); - processedItems.Add(item); - if (includeDescendant) { - foreach (BookmarkElement d in item.SubBookmarks) { - ProcessItem(includeDescendant, processor, processedItems, undo, d); - } - } - } - - internal XmlElement PrepareBookmarkDocument() { - if (Model.Document == null) { - Model.Document = new PdfInfoXmlDocument(); - } - return Model.Document.BookmarkRoot; - } - - internal void ClearBookmarks() { - Model.Document.BookmarkRoot.RemoveAll(); - View.Bookmark.ClearObjects(); - } - - void LoadPdfDocument() { - var s = Model.GetPdfFilePath(); - var v = View.Viewer; - if (s != null) { - try { - var d = v.Document; - Model.PdfDocument = v.Document = PdfHelper.OpenMuDocument(s); - d.TryDispose(); - View.AutoBookmark.TryDispose(); - v.Enabled = true; - View.ViewerToolbar.Enabled = true; - View.Viewer.Invalidate(); - } - catch (Exception ex) { - FormHelper.ErrorBox(ex.Message); - s = null; - } - } - if (s == null) { - Uninitialize(v); - } - } - - internal void Uninitialize(PdfViewerControl v) { - v.Document.TryDispose(); - View.AutoBookmark.TryDispose(); - Model.PdfDocument = v.Document = null; - v.Enabled = false; - View.ViewerToolbar.Enabled = false; - } - - internal void Destroy() { - //if (_view.InsertBookmarkForm != null) { - // _view.InsertBookmarkForm.Dispose (); - // _view.InsertBookmarkForm = null; - //} - if (_loader != null) { - _loader.RunWorkerCompleted -= _LoadBookmarkWorker_RunWorkerCompleted; - _loader.Dispose(); - } - Model.PdfDocument.TryDispose(); - View.AutoBookmark.TryDispose(); - } - - internal void InitBookmarkEditor() { - Model.Undo.Clear(); - View.Bookmark.DeselectAll(); - View.UndoButton.DropDown.Items.Clear(); - View.UndoButton.Enabled = false; - View.Bookmark.ClearMarks(false); - } - - internal void LoadDocument(string path, bool importMode) { - if (File.Exists(path) == false) { - FormHelper.ErrorBox("找不到文件:" + path); - return; - } - var ext = Path.GetExtension(path).ToLowerInvariant(); - var infoDoc = new PdfInfoXmlDocument(); - switch (ext) { - case Constants.FileExtensions.Txt: - OutlineManager.ImportSimpleBookmarks(path, infoDoc); - goto case ""; - case Constants.FileExtensions.Xml: - infoDoc.Load(path); - goto case ""; - case Constants.FileExtensions.Pdf: - View.MainPanel.Enabled = View.BookmarkToolbar.Enabled = false; - if (importMode == false) { - View.DocumentPath = path; - } - _loader = new BackgroundWorker(); - _loader.RunWorkerCompleted += _LoadBookmarkWorker_RunWorkerCompleted; - _loader.DoWork += _LoadBookmarkWorker_DoWork; - Model.IsLoadingDocument = true; - _loader.RunWorkerAsync(new object[] { path, importMode }); - break; - case "": - if (importMode) { - LoadInfoDocument(infoDoc, importMode); - break; - } - View.Bookmark.ClearObjects(); - View.DocumentPath = path; - LoadInfoDocument(infoDoc, importMode); - LoadPdfDocument(); - break; - default: - return; - } - RecentFileMenuHelper.AddRecentHistoryFile(path); - //// 书签编辑器窗口需要重画表头 - //this._BookmarkBox.HeaderControl.Invalidate (); - } - - void _LoadBookmarkWorker_DoWork(object sender, DoWorkEventArgs e) { - var args = e.Argument as object[]; - var path = args[0] as string; - bool importMode = (bool)args[1]; - Tracker.DebugMessage("open file"); - using (var reader = PdfHelper.OpenPdfFile(path, AppContext.LoadPartialPdfFile, false)) { - try { - Tracker.DebugMessage("consolidate"); - reader.ConsolidateNamedDestinations(); - Tracker.DebugMessage("get bookmark"); - e.Result = new object[] { - OutlineManager.GetBookmark (reader, new UnitConverter () { Unit = Constants.Units.Point }), - importMode, - path - }; - Tracker.DebugMessage("finished loading"); - } - catch (iTextSharp.text.exceptions.BadPasswordException) { - FormHelper.ErrorBox(Messages.PasswordInvalid); - Tracker.TraceMessage(Tracker.Category.Error, Messages.PasswordInvalid); - } - catch (Exception ex) { - FormHelper.ErrorBox("在打开 PDF 文件时遇到错误:\n" + ex.Message); - } - } - } - - void _LoadBookmarkWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { - ((BackgroundWorker)sender).Dispose(); - Model.IsLoadingDocument = false; - View.MainPanel.Enabled = View.BookmarkToolbar.Enabled = true; - var r = e.Error == null ? e.Result as object[] : null; - if (r == null) { - // 异常终止 - ClearBookmarks(); - InitBookmarkEditor(); - Uninitialize(View.Viewer); - return; - } - LoadPdfDocument(); - var importMode = (bool)r[1]; - if (importMode == false) { - View.DocumentPath = r[2] as string; - } - if (r[0] is XmlElement b) { - var infoDoc = new PdfInfoXmlDocument(); - var root = infoDoc.DocumentElement; - (root.AppendChild(infoDoc.CreateElement(Constants.Units.ThisName)) as XmlElement).SetAttribute(Constants.Units.Unit, Constants.Units.Point); - root.AppendChild(infoDoc.ImportNode(b, true)); - LoadInfoDocument(infoDoc, importMode); - if (importMode == false) { - infoDoc.PdfDocumentPath = Model.DocumentPath; - } - } - else { - if (importMode) { - FormHelper.InfoBox("文档不包含书签。"); - return; - } - ClearBookmarks(); - InitBookmarkEditor(); - //if (_currentFilePath != null) { - // Common.FormHelper.InfoBox ("文档不包含书签。"); - //} - } - //_viewer = new PdfViewer (this._FilePathBox.Text, _doc.DocumentElement); - } - - internal void LoadInfoDocument(PdfInfoXmlDocument document, bool importMode) { - var b = View.Bookmark; - var m = document.Bookmarks; - if (importMode) { - if (m.Count > 0) { - ImportBookmarks(b, m); - } - return; - } - // 文档不包含书签 - if (m.Count == 0) { - ClearBookmarks(); - InitBookmarkEditor(); - Model.Document = new PdfInfoXmlDocument(); - PrepareBookmarkDocument(); - return; - } - Model.Document = document; - LoadBookmarks(b, m); - if (Model.PdfDocument != null && document.PageLabelRoot.HasChildNodes) { - var pl = Model.PdfDocument.PageLabels; - pl.Clear(); - foreach (PageLabelElement item in document.PageLabels) { - pl.Add(item.ToPageLabel()); - } - } - } - - void LoadBookmarks(BookmarkEditorView view, XmlNodeList bookmarks) { - InitBookmarkEditor(); - view.LoadBookmarks(bookmarks); - } - - void ImportBookmarks(BookmarkEditorView editView, XmlNodeList bookmarks) { - if (Model.Document == null) { - Model.Document = new PdfInfoXmlDocument(); - } - var d = Model.Document; - var g = new UndoActionGroup(); - var s = editView.GetFirstSelectedModel(); - var il = new List(); - XmlElement n; - if (s != null) { - foreach (XmlNode item in bookmarks) { - n = s.AppendChild(d.ImportNode(item, true)) as XmlElement; - g.Add(new RemoveElementAction(n)); - il.Add(n); - } - editView.RefreshObject(s); - editView.Expand(s); - } - else { - var r = d.BookmarkRoot; - foreach (XmlNode item in bookmarks) { - n = r.AppendChild(d.ImportNode(item, true)) as XmlElement; - g.Add(new RemoveElementAction(n)); - il.Add(n); - } - editView.Roots = d.Bookmarks; - } - editView.SelectedObjects = il; - Model.Undo.AddUndo("导入书签", g); - } - - //internal void HideInsertBookmarkForm () { - // if (_view.InsertBookmarkForm != null) { - // _view.InsertBookmarkForm.Visible = false; - // } - //} - - //internal void BookmarkAtClientPoint (Point cp) { - // var v = _view.Viewer; - // var pp = v.TransposeClientToPagePosition (cp.X, cp.Y); - // if (pp.Page == 0) { - // return; - // } - // if (Control.ModifierKeys == Keys.Control) { - // v.PinPoint = v.PointToImage (cp); - // ShowInsertBookmarkDialog (cp, new EditModel.Region (pp, null, EditModel.TextSource.Empty)); - // return; - // } - // var r = CopyText (cp, pp); - // ShowInsertBookmarkDialog (cp, r); - //} - - internal EditModel.Region CopyText(Point cp, PagePosition pp) { - var v = View.Viewer; - var ps = v.IsClientPointInSelection(cp); - var lines = ps ? v.FindTextLines(v.GetSelectionPageRegion()) : v.FindTextLines(pp).Lines; - string t = null; - EditModel.TextSource ts; - if (Model.InsertBookmarkWithOcrOnly == false && lines.HasContent()) { - var sb = StringBuilderCache.Acquire(); - var r = lines[0].BBox; - foreach (var line in lines) { - if (sb.Length > 100) { - break; - } - t = line.Text.TrimEnd(); - if (sb.Length > 0 && t.Length > 0) { - var c = t[0]; - sb.Append(' '); - r = r.Union(line.BBox); - } - sb.Append(t); - } - t = StringBuilderCache.GetStringAndRelease(sb); - var b = v.MuRectangleToImageRegion(pp.Page, r); - v.SelectionRegion = b; - v.PinPoint = b.Location.Round(); - b.Offset(v.GetVirtualImageOffset(pp.Page)); - pp = v.TransposeVirtualImageToPagePosition(pp.Page, v.PinPoint.X, v.PinPoint.Y); - ts = EditModel.TextSource.Text; - } - else if (t == null && ModiOcr.ModiInstalled && v.OcrLanguage != 0) { - v.UseWaitCursor = true; - var r = v.OcrPage(pp.Page, true); - v.UseWaitCursor = false; - if (r.HasContent()) { - var ir = v.GetSelection().ImageRegion; - var ib = new Bound(ir.Left, ir.Bottom, ir.Right, ir.Top); - var b = RectangleF.Empty; - if (ps) { - var mr = r.FindAll((i) => i.Region.IntersectWith(ib)); - if (mr.HasContent()) { - var sb = StringBuilderCache.Acquire(); - b = mr[0].Region; - foreach (var line in mr) { - t = OcrProcessor.CleanUpText(line.Text, v.OcrOptions); - if (sb.Length > 0 && t.Length > 0) { - var c = t[0]; - sb.Append(' '); - b = b.Union(line.Region); - } - sb.Append(t); - } - t = StringBuilderCache.GetStringAndRelease(sb); - } - } - else { - var l = v.TransposeClientToPageImage(cp.X, cp.Y); - var tl = r.Find((i) => i.Region.Contains(l.ImageX, l.ImageY)); - if (tl != null) { - t = tl.Text; - b = (RectangleF)tl.Region; - } - } - if (b != RectangleF.Empty) { - b.Offset(v.GetVirtualImageOffset(pp.Page)); - v.SelectionRegion = b; - v.PinPoint = b.Location.Round(); - pp = v.TransposeVirtualImageToPagePosition(pp.Page, b.Left.ToInt32(), b.Top.ToInt32()); - ts = EditModel.TextSource.OcrText; - } - else { - ts = EditModel.TextSource.Empty; - } - } - else { - ts = EditModel.TextSource.OcrError; - } - } - else { - v.PinPoint = v.PointToImage(cp); - ts = EditModel.TextSource.Empty; - } - return new EditModel.Region(pp, t, ts); - } - - //void ShowInsertBookmarkDialog (Point mousePoint, EditModel.Region region) { - // var p = region.Position; - // if (p.Page == 0) { - // return; - // } - // if (_view.InsertBookmarkForm == null) { - // _view.InsertBookmarkForm = new InsertBookmarkForm (); - // _view.InsertBookmarkForm.OkClicked += _insertBookmarkForm_OkClicked; - // _view.InsertBookmarkForm.VisibleChanged += (s, args) => { - // _view.Viewer.ShowPinPoint = (s as Form).Visible; - // }; - // } - // var f = _view.InsertBookmarkForm; - // var v = _view.Viewer; - // var vp = v.GetImageViewPort (); - // Point fp; - // var sr = v.SelectionRegion; - // if (sr != RectangleF.Empty) { - // fp = v.TransposeVirtualImageToClient (sr.Left, sr.Top); - // if (v.HorizontalFlow) { - // fp.X += sr.Width.ToInt32 () + 20; - // } - // else { - // fp.Y -= f.Height + 20; - // } - // } - // else { - // fp = new Point (mousePoint.X + 20, mousePoint.Y - f.Height); - // } - // var l = v.PointToScreen (fp); - // if (l.Y < 0) { - // l.Y = l.Y + (int)sr.Height + f.Height + 40; - // if (l.Y + f.Height > Screen.PrimaryScreen.WorkingArea.Height) { - // l.Y = Screen.PrimaryScreen.WorkingArea.Height - f.Height; - // } - // } - // if (l.X < v.PointToScreen (Point.Empty).X) { - // l.X = v.PointToScreen (Point.Empty).X; - // } - // f.Location = l; - // f.TargetPosition = p.PageY; - // if (String.IsNullOrEmpty (region.Text) == false) { - // f.Title = __RemoveOcrWhiteSpace.Replace (region.Text, " ").Trim (); - // } - // f.Comment = region.LiteralTextSource; - // f.Show (); - // f.TargetPageNumber = p.Page; - // f.FormClosed += (s1, a1) => { _view.InsertBookmarkForm = null; }; - //} - - internal void LabelAtPage(Editor.PagePosition position) { - if (position.Page == 0) { - return; - } - var l = Model.PdfDocument.PageLabels; - if (l == null) { - return; - } - var v = View.Viewer; - var f = new InsertPageLabelForm { - Location = Cursor.Position.Transpose(-16, -16), - PageNumber = position.Page - }; - var pl = l.Find(position.Page); - if (pl.IsEmpty == false) { - f.SetValues(pl); - } - f.FormClosed += InsertPageLabelForm_Closed; - f.Show(); - } - - void InsertPageLabelForm_Closed(object sender, EventArgs e) { - var form = sender as InsertPageLabelForm; - if (form.DialogResult == DialogResult.Cancel) { - return; - } - var l = Model.PdfDocument.PageLabels; - if (form.DialogResult == DialogResult.OK) { - if (l == null) { - return; - } - l.Add(form.PageLabel); - } - else if (form.DialogResult == DialogResult.Abort) { - Model.PdfDocument.PageLabels.Remove(form.PageLabel); - } - var pl = Model.Document.PageLabelRoot; - pl.InnerText = String.Empty; - foreach (var item in l) { - pl.AppendChild(Model.Document.CreatePageLabel(item)); - } - View.Viewer.Invalidate(); - } - - internal void InsertBookmark() { - if (Model.PdfDocument != null) { - var pn = View.Viewer.CurrentPageNumber; - var p = View.Viewer.TransposeClientToPagePosition(0, 0).PageY; - var pt = View.Viewer.GetPageBound(pn).Bottom; - if (pt < p) { - p = pt; - } - InsertBookmark(null, pn, p, (Control.ModifierKeys & Keys.Shift) > 0 ? InsertBookmarkPositionType.BeforeCurrent : InsertBookmarkPositionType.AfterCurrent); - } - else { - InsertBookmark(null, 0, 0, InsertBookmarkPositionType.AfterCurrent); - } - } - - internal void InsertBookmark(string title, int pageNumber, float position, InsertBookmarkPositionType type) { - var b = View.Bookmark; - var d = Model.Document; - int i = b.SelectedIndex; - BookmarkElement c = null; - if (i == -1 && b.Items.Count == 0) { - c = d.BookmarkRoot.AppendBookmark(); - Model.Undo.AddUndo("插入书签", new RemoveElementAction(c)); - var s = title ?? Path.GetFileNameWithoutExtension(Model.DocumentPath); - c.SetTitleAndGotoPagePosition( - string.IsNullOrEmpty(s) ? Constants.Bookmark : s, - pageNumber > 0 ? pageNumber : 1, - position); - b.Roots = new XmlElement[] { c }; - } - else { - var o = b.GetModelObject(i != -1 ? i : b.GetItemCount() - 1) as BookmarkElement; - var t = title ?? Constants.Bookmark; - var p = pageNumber > 0 ? pageNumber : o.Page; - if (type == InsertBookmarkPositionType.NoDefined) { - var g = new UndoActionGroup(); - if (t.Length > 0) { - g.SetAttribute(o, Constants.BookmarkAttributes.Title, t); - } - g.SetAttribute(o, Constants.DestinationAttributes.Action, Constants.ActionType.Goto); - g.SetAttribute(o, Constants.DestinationAttributes.Page, p.ToText()); - g.SetAttribute(o, Constants.DestinationAttributes.View, Constants.DestinationAttributes.ViewType.XYZ); - g.SetAttribute(o, Constants.Coordinates.Top, position.ToText()); - Model.Undo.AddUndo("替换书签", g); - c = o; - } - else { - c = d.CreateBookmark(); - c.SetTitleAndGotoPagePosition(t, p, position); - switch (type) { - case InsertBookmarkPositionType.AfterCurrent: - goto default; - case InsertBookmarkPositionType.AsChild: - o.AppendChild(c); - break; - case InsertBookmarkPositionType.AfterParent: - if (o.ParentBookmark != null) { - o.ParentBookmark.ParentNode.InsertAfter(c, o.ParentBookmark); - } - else { - goto default; - } - break; - case InsertBookmarkPositionType.BeforeCurrent: - o.ParentNode.InsertBefore(c, o); - break; - default: - o.ParentNode.InsertAfter(c, o); - break; - } - Model.Undo.AddUndo("插入书签", new RemoveElementAction(c)); - } - if (c.ParentNode.Name == Constants.DocumentBookmark) { - b.SetObjects(c.Parent.SubBookmarks); - } - else { - b.RefreshObject(c.ParentNode); - b.RefreshObject(c); - } - } - if (c != null) { - if (c.ParentNode.Name == Constants.Bookmark) { - b.Expand(c.ParentNode); - } - b.Expand(c); - b.EnsureItemsVisible(new BookmarkElement[] { c }); - b.SelectedObjects = new BookmarkElement[] { c }; - b.FocusedObject = c; - b.ModelToItem (c).BeginEdit (); - } - } - - internal void Undo(int step) { - if (Model.Undo.CanUndo == false) { - return; - } - Model.LockDownViewer = true; - var sl = View.Bookmark.SelectedObjects; - XmlElement e; - bool r = false; // 是否需要刷新根节点 - var rl = new HashSet(); - while (step-- > 0) { - var a = Model.Undo.Undo(); - foreach (var item in a) { - e = item as XmlElement; - if (r == false && e.Name == Constants.DocumentBookmark) { - r = true; - } - else { - rl.Add(item); - } - } - } - - View.Bookmark.RefreshObjects(rl.ToArray()); - if (r) { - View.Bookmark.Roots = Model.Document.Bookmarks; - } - View.Bookmark.SelectedObjects = sl; - View.UndoButton.Enabled = Model.Undo.CanUndo; - Model.LockDownViewer = false; - } - - internal void MergeBookmark(IList es) { - var l = es.Count; - if (l < 2) { - return; - } - var p = es[0].ParentNode; - for (int i = 1; i < l; i++) { - //if (es[i].SelectSingleNode (Constants.Bookmark) != null) { - // Common.Form.ErrorBox ("合并的书签不能有子书签。"); - // return; - //} - if (es[i].ParentNode != p && es[i].ParentNode != es[0]) { - FormHelper.ErrorBox("合并的书签必须有相同的上级书签。"); - return; - } - } - var undo = new UndoActionGroup(); - var ts = new string[l]; - var dest = es[0]; - ts[0] = dest.Title; - var ct = dest.OwnerDocument.CreateDocumentFragment(); - for (int i = 1; i < l; i++) { - ts[i] = es[i].GetAttribute(Constants.BookmarkAttributes.Title); - if (ts[i].Length > 0) { - var c = ts[i][0]; - if (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z') { - ts[i] = " " + ts[i]; - } - } - while (es[i].HasChildNodes) { - var c = es[i].FirstChild as XmlElement; - if (c == null) { - continue; - } - undo.Add(new AddElementAction(c)); - ct.AppendChild(c); - } - if (es[i].ParentNode == p) { - undo.Add(new AddElementAction(es[i])); - p.RemoveChild(es[i]); - } - else /*es[i].ParentNode = es[0]*/ { - undo.Add(new AddElementAction(es[i])); - dest.RemoveChild(es[i]); - } - } - while (ct.HasChildNodes) { - dest.AppendChild(ct.FirstChild); - } - undo.Add(UndoAttributeAction.GetUndoAction(dest, Constants.BookmarkAttributes.Title, String.Concat(ts))); - var b = View.Bookmark; - if (p.Name != Constants.DocumentBookmark) { - b.RefreshObject(p); - } - else { - b.SetObjects(p.SelectNodes(Constants.Bookmark)); - } - Model.Undo.AddUndo("合并书签", undo); - b.RefreshObject(dest); - b.SelectObject(dest); - } - - - internal void ConfigAutoBookmarkTextStyles(int level, Editor.TextInfo textInfo) { - if (textInfo.Spans == null) { - return; - } - foreach (var span in textInfo.Spans) { - var s = textInfo.Page.GetFont(span); - if (s == null) { - continue; - } - var fn = PdfDocumentFont.RemoveSubsetPrefix(s.Name); - bool m = false; - int fs = span.Size.ToInt32(); - foreach (var item in Model.TitleStyles) { - if (item.FontSize == fs && item.FontName == fn && item.MatchPattern == null) { - m = true; - goto NEXT; - } - } - if (m == false) { - Model.TitleStyles.Add(new EditModel.AutoBookmarkStyle(level, fn, fs)); - } - NEXT:; - } - ShowAutoBookmarkForm(); - } - - internal void ShowAutoBookmarkForm() { - var f = View.AutoBookmark; - if (f.Visible == false) { - f.Location = Cursor.Position.Transpose(-16, -16); - f.Show(View.Viewer); - } - f.SetValues(Model.TitleStyles); - } - - internal void AutoBookmark(IEnumerable list, bool mergeAdjacentTitle, bool keepExisting) { - View.Bookmark.CancelCellEdit(); - var pdf = Model.PdfDocument; - BookmarkContainer bm = Model.Document.BookmarkRoot; - var c = pdf.PageCount; - var bs = new List(list); - if (bs.Count == 0) { - return; - } - bs.Sort((x, y) => x.Level - y.Level); - var mp = new Func[bs.Count]; - for (var i = 0; i < bs.Count; i++) { - var m = bs[i].MatchPattern?.CreateMatcher(); - if (m != null) { - mp[i] = m.Matches; - } - } - var ug = new UndoActionGroup(); - Model.Undo.AddUndo("自动生成书签", ug); - foreach (XmlElement item in bm.SubBookmarks) { - ug.Add(new AddElementAction(item)); - } - if (keepExisting == false) { - bm.RemoveAll(); - } - var spans = new List(3); - var bl = 0; - for (int i = 0; i < c;) { - using (var p = pdf.LoadPage(++i)) { - var h = p.VisualBound.Height; - var dh = p.VisualBound.Bottom - h; - foreach (var block in p.TextPage.Blocks) { - foreach (var line in block.Lines) { - foreach (var span in line.Spans) { - for (var si = 0; si < bs.Count; si++) { - var style = bs[si]; - var matcher = mp[si]; - if (style.FontName != PdfDocumentFont.RemoveSubsetPrefix(p.GetFont(span).Name) - || style.FontSize != span.Size.ToInt32()) { - continue; - } - var t = span.Text; - if (t.Length == 0) { - continue; - } - var b = span.Box; - if (bl < style.Level) { - if (matcher?.Invoke(line.Text) == false) { - continue; - } - bm = CreateNewSiblingBookmark(bm, spans); - ++bl; - } - else if (bl == style.Level) { - // todo 删除重复的文本 - var cb = bm as BookmarkElement; - var bb = h - cb.Bottom + dh; - var bt = h - cb.Top; - var lt = b.Top - b.Height * 2 + dh; - var lb = b.Bottom; - if (cb.Page == p.PageNumber - && (bb >= lt && bb <= lb || bt >= lt && bt <= lb || bt < lt && bb > lb) - && (mergeAdjacentTitle || spans[spans.Count - 1].Point.Y == span.Point.Y)) { - if (/*m == false &&*/ t.Length > 0) { - // 保留英文和数字文本之间的空格 - var ct = cb.Title; - if (ct.Length > 0) { - var lc = ct[ct.Length - 1]; - cb.Title = (Char.IsLetterOrDigit(lc) || Char.IsPunctuation(lc) - && lc != '-') && t[0] != ' ' - ? ct + ' ' + t - : ct + t; - } - cb.Bottom = h - lb; - spans.Add(span); - } - continue; - } - if (matcher?.Invoke(line.Text) == false) { - continue; - } - bm = CreateNewSiblingBookmarkForParent(bm, spans); - } - else { - while (bl > style.Level) { - bm = bm.ParentBookmark; - --bl; - } - if (matcher?.Invoke(line.Text) == false) { - continue; - } - bm = CreateNewSiblingBookmarkForParent(bm, spans); - } - var be = bm as BookmarkElement; - var s = style.Bookmark; - if (s.IsBold || s.IsItalic) { - be.TextStyle = s.IsBold && s.IsItalic ? FontStyle.Bold | FontStyle.Italic - : s.IsBold ? FontStyle.Bold - : s.IsItalic ? FontStyle.Italic - : FontStyle.Regular; - } - be.Title = t; - be.Top = s.GoToTop ? h + dh : h - b.Top + b.Height + dh; - be.Bottom = h - b.Bottom + dh; - be.Action = Constants.ActionType.Goto; - be.Page = p.PageNumber; - if (s.IsOpened) { - be.IsOpen = true; - } - be.ForeColor = s.ForeColor; - //todo 删除尾随的空格 - ug.Add(new RemoveElementAction(bm)); - spans.Add(span); - break; - } - } - } - } - } - } - View.Bookmark.Roots = Model.Document.Bookmarks; - View.Bookmark.RebuildAll(false); - } - - static BookmarkContainer CreateNewSiblingBookmarkForParent(BookmarkContainer bm, List spans) { - TrimBookmarkText(bm); - bm = bm.Parent.AppendBookmark(); - spans.Clear(); - return bm; - } - - static void TrimBookmarkText(BookmarkContainer bm) { - if (bm is BookmarkElement b) { - var t = b.Title; - var t2 = b.Title.Trim(); - if (t2 != t) { - b.Title = t2; - } - } - } - - static BookmarkContainer CreateNewSiblingBookmark(BookmarkContainer bm, List spans) { - TrimBookmarkText(bm); - bm = bm.AppendBookmark(); - spans.Clear(); - return bm; - } - } -} diff --git a/pdfpatcher/App/Functions/Editor/CustomPatternForm.Designer.cs b/pdfpatcher/App/Functions/Editor/CustomPatternForm.Designer.cs deleted file mode 100644 index 9d983ff4bc2bf6cbfc6951490f461d1c43db13bf..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/CustomPatternForm.Designer.cs +++ /dev/null @@ -1,121 +0,0 @@ -namespace PDFPatcher.Functions.Editor -{ - partial class CustomPatternForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) { - if (disposing && (components != null)) { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); - this._PatternBox = new System.Windows.Forms.TextBox(); - this._MatchCaseBox = new System.Windows.Forms.CheckBox(); - this._FullMatchBox = new System.Windows.Forms.CheckBox(); - this._OkButton = new System.Windows.Forms.Button(); - this._CancelButton = new System.Windows.Forms.Button(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 15); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(116, 18); - this.label1.TabIndex = 0; - this.label1.Text = "正则表达式:"; - // - // _PatternBox - // - this._PatternBox.Location = new System.Drawing.Point(134, 12); - this._PatternBox.Name = "_PatternBox"; - this._PatternBox.Size = new System.Drawing.Size(364, 28); - this._PatternBox.TabIndex = 1; - // - // _MatchCaseBox - // - this._MatchCaseBox.AutoSize = true; - this._MatchCaseBox.Location = new System.Drawing.Point(134, 46); - this._MatchCaseBox.Name = "_MatchCaseBox"; - this._MatchCaseBox.Size = new System.Drawing.Size(160, 22); - this._MatchCaseBox.TabIndex = 2; - this._MatchCaseBox.Text = "区分英文大小写"; - this._MatchCaseBox.UseVisualStyleBackColor = true; - // - // _FullMatchBox - // - this._FullMatchBox.AutoSize = true; - this._FullMatchBox.Location = new System.Drawing.Point(374, 46); - this._FullMatchBox.Name = "_FullMatchBox"; - this._FullMatchBox.Size = new System.Drawing.Size(124, 22); - this._FullMatchBox.TabIndex = 3; - this._FullMatchBox.Text = "匹配全标题"; - this._FullMatchBox.UseVisualStyleBackColor = true; - // - // _OkButton - // - this._OkButton.Location = new System.Drawing.Point(134, 74); - this._OkButton.Name = "_OkButton"; - this._OkButton.Size = new System.Drawing.Size(124, 30); - this._OkButton.TabIndex = 4; - this._OkButton.Text = "确定"; - this._OkButton.UseVisualStyleBackColor = true; - this._OkButton.Click += new System.EventHandler(this._OkButton_Click); - // - // _CancelButton - // - this._CancelButton.Location = new System.Drawing.Point(264, 74); - this._CancelButton.Name = "_CancelButton"; - this._CancelButton.Size = new System.Drawing.Size(124, 30); - this._CancelButton.TabIndex = 5; - this._CancelButton.Text = "取消"; - this._CancelButton.UseVisualStyleBackColor = true; - this._CancelButton.Click += new System.EventHandler(this._CancelButton_Click); - // - // CustomPatternForm - // - this.AcceptButton = this._OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(525, 129); - this.Controls.Add(this._CancelButton); - this.Controls.Add(this._OkButton); - this.Controls.Add(this._FullMatchBox); - this.Controls.Add(this._MatchCaseBox); - this.Controls.Add(this._PatternBox); - this.Controls.Add(this.label1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; - this.Name = "CustomPatternForm"; - this.Text = "自定义书签文本匹配模式"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox _PatternBox; - private System.Windows.Forms.CheckBox _MatchCaseBox; - private System.Windows.Forms.CheckBox _FullMatchBox; - private System.Windows.Forms.Button _OkButton; - private System.Windows.Forms.Button _CancelButton; - } -} \ No newline at end of file diff --git a/pdfpatcher/App/Functions/Editor/CustomPatternForm.cs b/pdfpatcher/App/Functions/Editor/CustomPatternForm.cs deleted file mode 100644 index 6e70aa434fdce9b20c86ea8ab54dceeeef0be502..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/CustomPatternForm.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text.RegularExpressions; -using System.Windows.Forms; -using PDFPatcher.Common; - -namespace PDFPatcher.Functions.Editor -{ - public partial class CustomPatternForm : Form - { - public CustomPatternForm() { - InitializeComponent(); - } - - public string Pattern { get => _PatternBox.Text; set => _PatternBox.Text = value; } - public bool MatchCase { get => _MatchCaseBox.Checked; set => _MatchCaseBox.Checked = value; } - public bool FullMatch { get => _FullMatchBox.Checked; set => _FullMatchBox.Checked = value; } - - void _OkButton_Click(object sender, EventArgs e) { - try { - new Regex(Pattern); - } - catch (Exception ex) { - this.ErrorBox("正则表达式格式错误:" + ex); - return; - } - DialogResult = DialogResult.OK; - Close(); - } - - void _CancelButton_Click(object sender, EventArgs e) { - DialogResult = DialogResult.Cancel; - Close(); - } - } -} diff --git a/pdfpatcher/App/Functions/Editor/CustomPatternForm.resx b/pdfpatcher/App/Functions/Editor/CustomPatternForm.resx deleted file mode 100644 index 1af7de150c99c12dd67a509fe57c10d63e4eeb04..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/CustomPatternForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/Editor/DocumentInfoForm.Designer.cs b/pdfpatcher/App/Functions/Editor/DocumentInfoForm.Designer.cs deleted file mode 100644 index 96e6169db08e71964bd5289df5aab74c18bedb12..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/DocumentInfoForm.Designer.cs +++ /dev/null @@ -1,317 +0,0 @@ -namespace PDFPatcher.Functions.Editor -{ - partial class DocumentInfoForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent () { - this.label1 = new System.Windows.Forms.Label (); - this._TitleBox = new System.Windows.Forms.TextBox (); - this.label2 = new System.Windows.Forms.Label (); - this._SubjectBox = new System.Windows.Forms.TextBox (); - this.label3 = new System.Windows.Forms.Label (); - this._AuthorBox = new System.Windows.Forms.TextBox (); - this.label4 = new System.Windows.Forms.Label (); - this._CreatorBox = new System.Windows.Forms.TextBox (); - this.label5 = new System.Windows.Forms.Label (); - this._ProducerBox = new System.Windows.Forms.TextBox (); - this.label6 = new System.Windows.Forms.Label (); - this._KeywordsBox = new System.Windows.Forms.TextBox (); - this._FilePathBox = new System.Windows.Forms.TextBox (); - this.label7 = new System.Windows.Forms.Label (); - this.label8 = new System.Windows.Forms.Label (); - this._CreationDateBox = new System.Windows.Forms.Label (); - this.label10 = new System.Windows.Forms.Label (); - this._ModDateBox = new System.Windows.Forms.Label (); - this.label9 = new System.Windows.Forms.Label (); - this._PageCountBox = new System.Windows.Forms.Label (); - this._OkButton = new System.Windows.Forms.Button (); - this._CancelButton = new System.Windows.Forms.Button (); - this._ConfigButton = new System.Windows.Forms.Button (); - this.SuspendLayout (); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point (12, 45); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size (41, 12); - this.label1.TabIndex = 2; - this.label1.Text = "标题:"; - // - // _TitleBox - // - this._TitleBox.Location = new System.Drawing.Point (101, 42); - this._TitleBox.Name = "_TitleBox"; - this._TitleBox.Size = new System.Drawing.Size (324, 21); - this._TitleBox.TabIndex = 3; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point (12, 72); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size (41, 12); - this.label2.TabIndex = 4; - this.label2.Text = "主题:"; - // - // _SubjectBox - // - this._SubjectBox.Location = new System.Drawing.Point (101, 69); - this._SubjectBox.Name = "_SubjectBox"; - this._SubjectBox.Size = new System.Drawing.Size (324, 21); - this._SubjectBox.TabIndex = 5; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point (12, 99); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size (41, 12); - this.label3.TabIndex = 6; - this.label3.Text = "作者:"; - // - // _AuthorBox - // - this._AuthorBox.Location = new System.Drawing.Point (101, 96); - this._AuthorBox.Name = "_AuthorBox"; - this._AuthorBox.Size = new System.Drawing.Size (324, 21); - this._AuthorBox.TabIndex = 7; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point (12, 126); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size (53, 12); - this.label4.TabIndex = 8; - this.label4.Text = "创建者:"; - // - // _CreatorBox - // - this._CreatorBox.Location = new System.Drawing.Point (101, 123); - this._CreatorBox.Name = "_CreatorBox"; - this._CreatorBox.Size = new System.Drawing.Size (324, 21); - this._CreatorBox.TabIndex = 9; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point (12, 153); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size (53, 12); - this.label5.TabIndex = 10; - this.label5.Text = "制作者:"; - // - // _ProducerBox - // - this._ProducerBox.Location = new System.Drawing.Point (101, 150); - this._ProducerBox.Name = "_ProducerBox"; - this._ProducerBox.Size = new System.Drawing.Size (324, 21); - this._ProducerBox.TabIndex = 11; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point (12, 180); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size (53, 12); - this.label6.TabIndex = 12; - this.label6.Text = "关键词:"; - // - // _KeywordsBox - // - this._KeywordsBox.Location = new System.Drawing.Point (101, 177); - this._KeywordsBox.Name = "_KeywordsBox"; - this._KeywordsBox.Size = new System.Drawing.Size (324, 21); - this._KeywordsBox.TabIndex = 13; - // - // _FilePathBox - // - this._FilePathBox.Location = new System.Drawing.Point (101, 15); - this._FilePathBox.Name = "_FilePathBox"; - this._FilePathBox.ReadOnly = true; - this._FilePathBox.Size = new System.Drawing.Size (324, 21); - this._FilePathBox.TabIndex = 1; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point (12, 18); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size (65, 12); - this.label7.TabIndex = 0; - this.label7.Text = "文档路径:"; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point (12, 211); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size (65, 12); - this.label8.TabIndex = 14; - this.label8.Text = "创建日期:"; - // - // _CreationDateBox - // - this._CreationDateBox.AutoSize = true; - this._CreationDateBox.Location = new System.Drawing.Point (99, 211); - this._CreationDateBox.Name = "_CreationDateBox"; - this._CreationDateBox.Size = new System.Drawing.Size (53, 12); - this._CreationDateBox.TabIndex = 15; - this._CreationDateBox.Text = "创建日期"; - // - // label10 - // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point (12, 232); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size (65, 12); - this.label10.TabIndex = 16; - this.label10.Text = "修改日期:"; - // - // _ModDateBox - // - this._ModDateBox.AutoSize = true; - this._ModDateBox.Location = new System.Drawing.Point (99, 232); - this._ModDateBox.Name = "_ModDateBox"; - this._ModDateBox.Size = new System.Drawing.Size (53, 12); - this._ModDateBox.TabIndex = 17; - this._ModDateBox.Text = "修改日期"; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point (12, 253); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size (41, 12); - this.label9.TabIndex = 18; - this.label9.Text = "页数:"; - // - // _PageCountBox - // - this._PageCountBox.AutoSize = true; - this._PageCountBox.Location = new System.Drawing.Point (99, 253); - this._PageCountBox.Name = "_PageCountBox"; - this._PageCountBox.Size = new System.Drawing.Size (29, 12); - this._PageCountBox.TabIndex = 19; - this._PageCountBox.Text = "页数"; - // - // _OkButton - // - this._OkButton.Location = new System.Drawing.Point (269, 280); - this._OkButton.Name = "_OkButton"; - this._OkButton.Size = new System.Drawing.Size (75, 23); - this._OkButton.TabIndex = 20; - this._OkButton.Text = "确定"; - this._OkButton.UseVisualStyleBackColor = true; - // - // _CancelButton - // - this._CancelButton.Location = new System.Drawing.Point (350, 280); - this._CancelButton.Name = "_CancelButton"; - this._CancelButton.Size = new System.Drawing.Size (75, 23); - this._CancelButton.TabIndex = 20; - this._CancelButton.Text = "取消"; - this._CancelButton.UseVisualStyleBackColor = true; - // - // _ConfigButton - // - this._ConfigButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this._ConfigButton.Image = global::PDFPatcher.Properties.Resources.PdfOptions; - this._ConfigButton.Location = new System.Drawing.Point (14, 280); - this._ConfigButton.Name = "_ConfigButton"; - this._ConfigButton.Size = new System.Drawing.Size (181, 23); - this._ConfigButton.TabIndex = 21; - this._ConfigButton.Text = "设置 P&DF 文件的修改方式"; - this._ConfigButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._ConfigButton.UseVisualStyleBackColor = true; - // - // DocumentInfoForm - // - this.AcceptButton = this._OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size (437, 315); - this.Controls.Add (this._ConfigButton); - this.Controls.Add (this._CancelButton); - this.Controls.Add (this._OkButton); - this.Controls.Add (this.label9); - this.Controls.Add (this._ModDateBox); - this.Controls.Add (this._PageCountBox); - this.Controls.Add (this._CreationDateBox); - this.Controls.Add (this.label10); - this.Controls.Add (this.label8); - this.Controls.Add (this.label7); - this.Controls.Add (this._FilePathBox); - this.Controls.Add (this._KeywordsBox); - this.Controls.Add (this.label6); - this.Controls.Add (this._ProducerBox); - this.Controls.Add (this.label5); - this.Controls.Add (this._CreatorBox); - this.Controls.Add (this.label4); - this.Controls.Add (this._AuthorBox); - this.Controls.Add (this.label3); - this.Controls.Add (this._SubjectBox); - this.Controls.Add (this.label2); - this.Controls.Add (this._TitleBox); - this.Controls.Add (this.label1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "DocumentInfoForm"; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "文档属性"; - this.ResumeLayout (false); - this.PerformLayout (); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox _TitleBox; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox _SubjectBox; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox _AuthorBox; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.TextBox _CreatorBox; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.TextBox _ProducerBox; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.TextBox _KeywordsBox; - private System.Windows.Forms.TextBox _FilePathBox; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.Label _CreationDateBox; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.Label _ModDateBox; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.Label _PageCountBox; - private System.Windows.Forms.Button _OkButton; - private System.Windows.Forms.Button _CancelButton; - private System.Windows.Forms.Button _ConfigButton; - } -} \ No newline at end of file diff --git a/pdfpatcher/App/Functions/Editor/DocumentInfoForm.cs b/pdfpatcher/App/Functions/Editor/DocumentInfoForm.cs deleted file mode 100644 index 72b293cdd66dffcb2202184c13290be9bc1bf276..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/DocumentInfoForm.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.Windows.Forms; -using MuPdfSharp; -using PDFPatcher.Common; - -namespace PDFPatcher.Functions.Editor -{ - sealed partial class DocumentInfoForm : Form - { - internal MuDocument Document { get; set; } - internal Model.PdfInfoXmlDocument InfoDocument { get; set; } - - public DocumentInfoForm() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - } - - void OnLoad() { - if (Document != null) { - var info = Document.Info; - _AuthorBox.Text = info.Author; - _CreationDateBox.Text = Processor.PdfHelper.ParseDateTime(info.CreationDate).ToString(); - _CreatorBox.Text = info.Creator; - _FilePathBox.Text = Document.FilePath; - _KeywordsBox.Text = info.Keywords; - _ModDateBox.Text = Processor.PdfHelper.ParseDateTime(info.ModificationDate).ToString(); - _PageCountBox.Text = Document.PageCount.ToString(); - _ProducerBox.Text = info.Producer; - _SubjectBox.Text = info.Subject; - _TitleBox.Text = info.Title; - } - if (InfoDocument != null) { - var info = InfoDocument.InfoNode; - SetText(_AuthorBox, info.Author); - SetText(_CreatorBox, info.Creator); - SetText(_KeywordsBox, info.Keywords); - SetText(_ProducerBox, info.Producer); - SetText(_SubjectBox, info.Subject); - SetText(_TitleBox, info.Title); - } - else { - _OkButton.Enabled = false; - } - _OkButton.Click += (s, args) => { - DialogResult = DialogResult.OK; - var info = InfoDocument.InfoNode; - info.Author = _AuthorBox.Text; - info.Creator = _CreatorBox.Text; - info.Keywords = _KeywordsBox.Text; - info.Producer = _ProducerBox.Text; - info.Subject = _SubjectBox.Text; - info.Title = _TitleBox.Text; - Close(); - }; - _CancelButton.Click += (s, args) => { - DialogResult = DialogResult.Cancel; - Close(); - }; - _ConfigButton.Click += (s, args) => { - AppContext.MainForm.SelectFunctionList(Function.EditorOptions); - }; - } - - static void SetText(Control control, string value) { - if (value == null) { - return; - } - control.Text = value; - } - } -} diff --git a/pdfpatcher/App/Functions/Editor/DocumentInfoForm.resx b/pdfpatcher/App/Functions/Editor/DocumentInfoForm.resx deleted file mode 100644 index 1af7de150c99c12dd67a509fe57c10d63e4eeb04..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/DocumentInfoForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/Editor/DoubleClickableRadioButton.cs b/pdfpatcher/App/Functions/Editor/DoubleClickableRadioButton.cs deleted file mode 100644 index cbc9bcf3cfb78b6703bc04315498dfab1fe0fe2f..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/DoubleClickableRadioButton.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; - -namespace PDFPatcher.Functions -{ - sealed class DoubleClickableRadioButton : RadioButton - { - public DoubleClickableRadioButton() { - SetStyle(ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, true); - } - - public new event EventHandler DoubleClick; - - protected override void OnMouseDoubleClick(MouseEventArgs e) { - base.OnMouseDoubleClick(e); - - DoubleClick?.Invoke(this, e); - } - } -} diff --git a/pdfpatcher/App/Functions/Editor/EditModel.cs b/pdfpatcher/App/Functions/Editor/EditModel.cs deleted file mode 100644 index ea917704fbfc7cfa8621c0debf660cc66b82fee1..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/EditModel.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using System.Windows.Forms; -using PDFPatcher.Common; -using PDFPatcher.Model; -using PDFPatcher.Processor; - -namespace PDFPatcher.Functions.Editor -{ - internal sealed class EditModel - { - public EditModel() { - Undo = new UndoManager(); - TitleStyles = new List(); - } - - internal bool IsLoadingDocument { get; set; } - internal PdfInfoXmlDocument Document { get; set; } - internal bool LockDownViewer { get; set; } - internal bool InsertBookmarkWithOcrOnly { get; set; } - internal UndoManager Undo { get; } - internal string DocumentPath { get; set; } - internal string LastSavedPdfPath { get; set; } - internal MuPdfSharp.MuDocument PdfDocument { get; set; } - internal List TitleStyles { get; } - internal string GetPdfFilePath() { - if (DocumentPath == null) { - return null; - } - var s = FileHelper.HasExtension(DocumentPath, Constants.FileExtensions.Pdf) ? DocumentPath : null; - if (string.IsNullOrEmpty(s)) { - s = Document.PdfDocumentPath; - if (Path.IsPathRooted(s) == false) { - s = Path.Combine(Path.GetDirectoryName(DocumentPath), s); - } - } - if (File.Exists(s) == false) { - s = null; - } - return s; - } - - internal sealed class Region - { - internal PagePosition Position { get; } - internal string Text { get; } - internal TextSource TextSource { get; } - internal string LiteralTextSource { - get { - switch (TextSource) { - case TextSource.Empty: return "当前位置不包含文本"; - case TextSource.Text: return "已自动匹配文本层文本"; - case TextSource.OcrText: return "已自动识别图像文本"; - case TextSource.OcrError: return "当前页面不包含可识别文本,或识别过程出错"; - default: - throw new System.IndexOutOfRangeException("TextSource"); - } - } - } - - public Region(PagePosition position, string text, TextSource source) { - Position = position; - Text = text; - TextSource = source; - } - } - - internal enum TextSource - { - Empty, Text, OcrText, OcrError - } - internal sealed class AutoBookmarkStyle - { - internal readonly string FontName; - internal readonly int FontSize; - internal readonly BookmarkSettings Bookmark; - internal MatchPattern MatchPattern; - - internal int Level; - - public AutoBookmarkStyle(int level, string fontName, int fontSize) { - Level = level; - FontName = fontName; - FontSize = fontSize; - Bookmark = new BookmarkSettings(); - } - } - } - - internal interface IEditView - { - bool AffectsDescendantBookmarks { get; } - ToolStripSplitButton UndoButton { get; } - AutoBookmarkForm AutoBookmark { get; } - BookmarkEditorView Bookmark { get; } - PdfViewerControl Viewer { get; } - ToolStrip ViewerToolbar { get; } - ToolStrip BookmarkToolbar { get; } - SplitContainer MainPanel { get; } - string DocumentPath { get; set; } - } - -} \ No newline at end of file diff --git a/pdfpatcher/App/Functions/Editor/IEditorCommand.cs b/pdfpatcher/App/Functions/Editor/IEditorCommand.cs deleted file mode 100644 index 0cfe36d472975a82943bb4fb0ef0ad831fa3b35e..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/IEditorCommand.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Functions.Editor -{ - interface IEditorCommand : Common.ICommand - { - } - -} diff --git a/pdfpatcher/App/Functions/Editor/InsertBookmarkForm.Designer.cs b/pdfpatcher/App/Functions/Editor/InsertBookmarkForm.Designer.cs deleted file mode 100644 index 0cc439121c68e8edf0e431dc65cb82f0f3b48128..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/InsertBookmarkForm.Designer.cs +++ /dev/null @@ -1,250 +0,0 @@ -namespace PDFPatcher.Functions.Editor -{ - partial class InsertBookmarkForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.label1 = new System.Windows.Forms.Label (); - this._TitleBox = new System.Windows.Forms.TextBox (); - this._OkButton = new System.Windows.Forms.Button (); - this.label2 = new System.Windows.Forms.Label (); - this._CancelButton = new System.Windows.Forms.Button (); - this.label3 = new System.Windows.Forms.Label (); - this._PositionBox = new System.Windows.Forms.NumericUpDown (); - this._PageLabel = new System.Windows.Forms.Label (); - this._DirectionBox = new System.Windows.Forms.Label (); - this._CommentBox = new System.Windows.Forms.Label (); - this._AfterParentBox = new PDFPatcher.Functions.DoubleClickableRadioButton (); - this._BeforeCurrentBox = new PDFPatcher.Functions.DoubleClickableRadioButton (); - this._AsChildBox = new PDFPatcher.Functions.DoubleClickableRadioButton (); - this._AfterCurrentBox = new PDFPatcher.Functions.DoubleClickableRadioButton (); - this._ReplaceBookmarkBox = new PDFPatcher.Functions.DoubleClickableRadioButton (); - ((System.ComponentModel.ISupportInitialize)(this._PositionBox)).BeginInit (); - this.SuspendLayout (); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point (12, 15); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size (65, 12); - this.label1.TabIndex = 0; - this.label1.Text = "书签文本:"; - // - // _TitleBox - // - this._TitleBox.Location = new System.Drawing.Point (83, 12); - this._TitleBox.Name = "_TitleBox"; - this._TitleBox.Size = new System.Drawing.Size (275, 21); - this._TitleBox.TabIndex = 1; - // - // _OkButton - // - this._OkButton.Image = global::PDFPatcher.Properties.Resources.ImportInfoFile; - this._OkButton.Location = new System.Drawing.Point (283, 61); - this._OkButton.Name = "_OkButton"; - this._OkButton.Size = new System.Drawing.Size (75, 23); - this._OkButton.TabIndex = 12; - this._OkButton.Text = "插入(&C)"; - this._OkButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._OkButton.UseVisualStyleBackColor = true; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point (12, 53); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size (101, 12); - this.label2.TabIndex = 2; - this.label2.Text = "插入到当前书签:"; - // - // _CancelButton - // - this._CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this._CancelButton.Location = new System.Drawing.Point (283, 90); - this._CancelButton.Name = "_CancelButton"; - this._CancelButton.Size = new System.Drawing.Size (75, 23); - this._CancelButton.TabIndex = 13; - this._CancelButton.Text = "取消(&X)"; - this._CancelButton.UseVisualStyleBackColor = true; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point (12, 141); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size (65, 12); - this.label3.TabIndex = 8; - this.label3.Text = "目标位置:"; - // - // _PositionBox - // - this._PositionBox.DecimalPlaces = 2; - this._PositionBox.Location = new System.Drawing.Point (212, 139); - this._PositionBox.Maximum = new decimal (new int[] { - 9999, - 0, - 0, - 0}); - this._PositionBox.Minimum = new decimal (new int[] { - 9999, - 0, - 0, - -2147483648}); - this._PositionBox.Name = "_PositionBox"; - this._PositionBox.Size = new System.Drawing.Size (68, 21); - this._PositionBox.TabIndex = 11; - // - // _PageLabel - // - this._PageLabel.AutoSize = true; - this._PageLabel.Location = new System.Drawing.Point (83, 141); - this._PageLabel.Name = "_PageLabel"; - this._PageLabel.Size = new System.Drawing.Size (35, 12); - this._PageLabel.TabIndex = 9; - this._PageLabel.Text = "第N页"; - // - // _DirectionBox - // - this._DirectionBox.AutoSize = true; - this._DirectionBox.Location = new System.Drawing.Point (165, 141); - this._DirectionBox.Name = "_DirectionBox"; - this._DirectionBox.Size = new System.Drawing.Size (41, 12); - this._DirectionBox.TabIndex = 10; - this._DirectionBox.Text = "方位:"; - // - // _CommentBox - // - this._CommentBox.ForeColor = System.Drawing.SystemColors.GrayText; - this._CommentBox.Location = new System.Drawing.Point (83, 36); - this._CommentBox.Name = "_CommentBox"; - this._CommentBox.Size = new System.Drawing.Size (275, 12); - this._CommentBox.TabIndex = 14; - // - // _AfterParentBox - // - this._AfterParentBox.AutoSize = true; - this._AfterParentBox.Location = new System.Drawing.Point (119, 90); - this._AfterParentBox.Name = "_AfterParentBox"; - this._AfterParentBox.Size = new System.Drawing.Size (101, 16); - this._AfterParentBox.TabIndex = 6; - this._AfterParentBox.Text = "上级书签后(&S)"; - this._AfterParentBox.UseVisualStyleBackColor = true; - // - // _BeforeCurrentBox - // - this._BeforeCurrentBox.AutoSize = true; - this._BeforeCurrentBox.Location = new System.Drawing.Point (34, 68); - this._BeforeCurrentBox.Name = "_BeforeCurrentBox"; - this._BeforeCurrentBox.Size = new System.Drawing.Size (65, 16); - this._BeforeCurrentBox.TabIndex = 3; - this._BeforeCurrentBox.Text = "前面(&Q)"; - this._BeforeCurrentBox.UseVisualStyleBackColor = true; - // - // _AsChildBox - // - this._AsChildBox.AutoSize = true; - this._AsChildBox.Location = new System.Drawing.Point (34, 90); - this._AsChildBox.Name = "_AsChildBox"; - this._AsChildBox.Size = new System.Drawing.Size (77, 16); - this._AsChildBox.TabIndex = 5; - this._AsChildBox.Text = "子书签(&Z)"; - this._AsChildBox.UseVisualStyleBackColor = true; - // - // _AfterCurrentBox - // - this._AfterCurrentBox.AutoSize = true; - this._AfterCurrentBox.Checked = true; - this._AfterCurrentBox.Location = new System.Drawing.Point (119, 68); - this._AfterCurrentBox.Name = "_AfterCurrentBox"; - this._AfterCurrentBox.Size = new System.Drawing.Size (65, 16); - this._AfterCurrentBox.TabIndex = 4; - this._AfterCurrentBox.TabStop = true; - this._AfterCurrentBox.Text = "后面(&H)"; - this._AfterCurrentBox.UseVisualStyleBackColor = true; - // - // _ReplaceBookmarkBox - // - this._ReplaceBookmarkBox.AutoSize = true; - this._ReplaceBookmarkBox.Location = new System.Drawing.Point (14, 112); - this._ReplaceBookmarkBox.Name = "_ReplaceBookmarkBox"; - this._ReplaceBookmarkBox.Size = new System.Drawing.Size (113, 16); - this._ReplaceBookmarkBox.TabIndex = 7; - this._ReplaceBookmarkBox.TabStop = true; - this._ReplaceBookmarkBox.Text = "替换当前书签(&T)"; - this._ReplaceBookmarkBox.UseVisualStyleBackColor = true; - // - // InsertBookmarkForm - // - this.AcceptButton = this._OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this._CancelButton; - this.ClientSize = new System.Drawing.Size (375, 171); - this.Controls.Add (this._ReplaceBookmarkBox); - this.Controls.Add (this._CommentBox); - this.Controls.Add (this._DirectionBox); - this.Controls.Add (this._PageLabel); - this.Controls.Add (this._PositionBox); - this.Controls.Add (this.label3); - this.Controls.Add (this._CancelButton); - this.Controls.Add (this._AfterParentBox); - this.Controls.Add (this._BeforeCurrentBox); - this.Controls.Add (this._AsChildBox); - this.Controls.Add (this.label2); - this.Controls.Add (this._AfterCurrentBox); - this.Controls.Add (this._OkButton); - this.Controls.Add (this._TitleBox); - this.Controls.Add (this.label1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.Name = "InsertBookmarkForm"; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; - this.Text = "插入书签"; - this.TopMost = true; - ((System.ComponentModel.ISupportInitialize)(this._PositionBox)).EndInit (); - this.ResumeLayout (false); - this.PerformLayout (); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox _TitleBox; - private System.Windows.Forms.Button _OkButton; - private DoubleClickableRadioButton _AfterCurrentBox; - private System.Windows.Forms.Label label2; - private DoubleClickableRadioButton _AsChildBox; - private DoubleClickableRadioButton _BeforeCurrentBox; - private DoubleClickableRadioButton _AfterParentBox; - private System.Windows.Forms.Button _CancelButton; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.NumericUpDown _PositionBox; - private System.Windows.Forms.Label _PageLabel; - private System.Windows.Forms.Label _DirectionBox; - private System.Windows.Forms.Label _CommentBox; - private DoubleClickableRadioButton _ReplaceBookmarkBox; - } -} diff --git a/pdfpatcher/App/Functions/Editor/InsertBookmarkForm.cs b/pdfpatcher/App/Functions/Editor/InsertBookmarkForm.cs deleted file mode 100644 index 8a94eb5706b6c1e54d85a3e0a2911dded72f3b09..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/InsertBookmarkForm.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using System.ComponentModel; -using PDFPatcher.Common; - -namespace PDFPatcher.Functions.Editor -{ - sealed partial class InsertBookmarkForm : DraggableForm - { - public event EventHandler OkClicked; - - /// - /// 获取或设置书签标题。 - /// - public string Title { get => _TitleBox.Text; set => _TitleBox.Text = value; } - public string Comment { get => _CommentBox.Text; set => _CommentBox.Text = value; } - /// - /// 获取或设置书签的位置。 - /// - public float TargetPosition { get => (float)_PositionBox.Value; set => _PositionBox.SetValue(value); } - int _TargetPageNumber; - public int TargetPageNumber { - get => _TargetPageNumber; - set { _TargetPageNumber = value; _PageLabel.Text = "第" + value.ToText() + "页"; } - } - /// - /// 获取新书签的插入位置(当前书签后:1;子书签:2;父书签后:3;当前书签前:4) - /// - public int InsertMode => _AfterCurrentBox.Checked ? 1 - : _AsChildBox.Checked ? 2 - : _AfterParentBox.Checked ? 3 - : _BeforeCurrentBox.Checked ? 4 - : 0; - - [Browsable(false)] - internal Controller Controller { get; set; } - - public InsertBookmarkForm() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - } - void OnLoad() { - VisibleChanged += (s, args) => { - if (!Visible) { - return; - } - _TitleBox.Focus(); - _TitleBox.SelectAll(); - }; - _AfterCurrentBox.DoubleClick += InsertModeBox_DoubleClick; - _AfterParentBox.DoubleClick += InsertModeBox_DoubleClick; - _AsChildBox.DoubleClick += InsertModeBox_DoubleClick; - _BeforeCurrentBox.DoubleClick += InsertModeBox_DoubleClick; - _ReplaceBookmarkBox.DoubleClick += InsertModeBox_DoubleClick; - _OkButton.Click += (s, args) => { - OkClicked?.Invoke(this, args); - if (_AsChildBox.Checked || _AfterParentBox.Checked) { - _AfterCurrentBox.Checked = true; - } - Hide(); - }; - _CancelButton.Click += (s, args) => Hide(); - } - - void InsertModeBox_DoubleClick(object sender, EventArgs e) { - _OkButton.PerformClick(); - } - - protected override void OnDeactivate(EventArgs e) { - Hide(); - base.OnDeactivate(e); - } - - } -} diff --git a/pdfpatcher/App/Functions/Editor/InsertBookmarkForm.resx b/pdfpatcher/App/Functions/Editor/InsertBookmarkForm.resx deleted file mode 100644 index 1af7de150c99c12dd67a509fe57c10d63e4eeb04..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/InsertBookmarkForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/Editor/InsertPageLabelForm.Designer.cs b/pdfpatcher/App/Functions/Editor/InsertPageLabelForm.Designer.cs deleted file mode 100644 index 4f6eb848517dddda4d739cb8b641b370a807927a..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/InsertPageLabelForm.Designer.cs +++ /dev/null @@ -1,195 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class InsertPageLabelForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent () { - this.label1 = new System.Windows.Forms.Label(); - this._PrefixBox = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); - this._NumericStyleBox = new System.Windows.Forms.ComboBox(); - this.label3 = new System.Windows.Forms.Label(); - this._StartAtBox = new System.Windows.Forms.NumericUpDown(); - this._OkButton = new System.Windows.Forms.Button(); - this._CancelButton = new System.Windows.Forms.Button(); - this.label4 = new System.Windows.Forms.Label(); - this._PageNumberBox = new System.Windows.Forms.Label(); - this._RemoveLabelButton = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this._StartAtBox)).BeginInit(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 41); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(65, 12); - this.label1.TabIndex = 4; - this.label1.Text = "前缀文本:"; - // - // _PrefixBox - // - this._PrefixBox.Location = new System.Drawing.Point(83, 38); - this._PrefixBox.Name = "_PrefixBox"; - this._PrefixBox.Size = new System.Drawing.Size(63, 21); - this._PrefixBox.TabIndex = 5; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(152, 13); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(65, 12); - this.label2.TabIndex = 2; - this.label2.Text = "编号格式:"; - // - // _NumericStyleBox - // - this._NumericStyleBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._NumericStyleBox.FormattingEnabled = true; - this._NumericStyleBox.Location = new System.Drawing.Point(223, 11); - this._NumericStyleBox.Name = "_NumericStyleBox"; - this._NumericStyleBox.Size = new System.Drawing.Size(121, 20); - this._NumericStyleBox.TabIndex = 3; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(152, 40); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(65, 12); - this.label3.TabIndex = 6; - this.label3.Text = "起始页号:"; - // - // _StartAtBox - // - this._StartAtBox.Location = new System.Drawing.Point(223, 38); - this._StartAtBox.Maximum = new decimal(new int[] { - 99999, - 0, - 0, - 0}); - this._StartAtBox.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this._StartAtBox.Name = "_StartAtBox"; - this._StartAtBox.Size = new System.Drawing.Size(63, 21); - this._StartAtBox.TabIndex = 7; - this._StartAtBox.Value = new decimal(new int[] { - 1, - 0, - 0, - 0}); - // - // _OkButton - // - this._OkButton.Location = new System.Drawing.Point(202, 79); - this._OkButton.Name = "_OkButton"; - this._OkButton.Size = new System.Drawing.Size(75, 23); - this._OkButton.TabIndex = 8; - this._OkButton.Text = "确定(&Q)"; - this._OkButton.UseVisualStyleBackColor = true; - // - // _CancelButton - // - this._CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this._CancelButton.Location = new System.Drawing.Point(286, 79); - this._CancelButton.Name = "_CancelButton"; - this._CancelButton.Size = new System.Drawing.Size(75, 23); - this._CancelButton.TabIndex = 9; - this._CancelButton.Text = "取消(&X)"; - this._CancelButton.UseVisualStyleBackColor = true; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(12, 14); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(53, 12); - this.label4.TabIndex = 0; - this.label4.Text = "目标页面"; - // - // _PageNumberBox - // - this._PageNumberBox.Location = new System.Drawing.Point(81, 14); - this._PageNumberBox.Name = "_PageNumberBox"; - this._PageNumberBox.Size = new System.Drawing.Size(65, 19); - this._PageNumberBox.TabIndex = 1; - // - // _RemoveLabelButton - // - this._RemoveLabelButton.Location = new System.Drawing.Point(14, 79); - this._RemoveLabelButton.Name = "_RemoveLabelButton"; - this._RemoveLabelButton.Size = new System.Drawing.Size(117, 23); - this._RemoveLabelButton.TabIndex = 10; - this._RemoveLabelButton.Text = "删除本页码标签(&S)"; - this._RemoveLabelButton.UseVisualStyleBackColor = true; - // - // InsertPageLabelForm - // - this.AcceptButton = this._OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this._CancelButton; - this.ClientSize = new System.Drawing.Size(373, 114); - this.Controls.Add(this._RemoveLabelButton); - this.Controls.Add(this._PageNumberBox); - this.Controls.Add(this.label4); - this.Controls.Add(this._CancelButton); - this.Controls.Add(this._OkButton); - this.Controls.Add(this._StartAtBox); - this.Controls.Add(this.label3); - this.Controls.Add(this._NumericStyleBox); - this.Controls.Add(this.label2); - this.Controls.Add(this._PrefixBox); - this.Controls.Add(this.label1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.Name = "InsertPageLabelForm"; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; - this.Text = "插入页码标签"; - this.Load += new System.EventHandler(this.InsertPageLabelForm_Load); - ((System.ComponentModel.ISupportInitialize)(this._StartAtBox)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox _PrefixBox; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.ComboBox _NumericStyleBox; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.NumericUpDown _StartAtBox; - private System.Windows.Forms.Button _OkButton; - private System.Windows.Forms.Button _CancelButton; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label _PageNumberBox; - private System.Windows.Forms.Button _RemoveLabelButton; - } -} \ No newline at end of file diff --git a/pdfpatcher/App/Functions/Editor/InsertPageLabelForm.cs b/pdfpatcher/App/Functions/Editor/InsertPageLabelForm.cs deleted file mode 100644 index 4e367cf0c2190a9fb549d9f156cd8eddfe801c37..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/InsertPageLabelForm.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Windows.Forms; -using PDFPatcher.Common; - -namespace PDFPatcher.Functions -{ - sealed partial class InsertPageLabelForm : DraggableForm - { - public int PageNumber { - get => _PageNumberBox.Text.ToInt32(); - set => _PageNumberBox.Text = value.ToText(); - } - - internal MuPdfSharp.PageLabel PageLabel => new MuPdfSharp.PageLabel(PageNumber - 1, (int)_StartAtBox.Value, _PrefixBox.Text, (MuPdfSharp.PageLabelStyle)Constants.PageLabelStyles.PdfValues[_NumericStyleBox.SelectedIndex]); - - public InsertPageLabelForm() { - InitializeComponent(); - _NumericStyleBox.AddRange(Constants.PageLabelStyles.Names).Select(0); - _RemoveLabelButton.Enabled = false; - } - - void InsertPageLabelForm_Load(object sender, EventArgs e) { - _CancelButton.Click += (s, args) => { - DialogResult = DialogResult.Cancel; - Close(); - }; - _OkButton.Click += (s, args) => { - DialogResult = DialogResult.OK; - Close(); - }; - _RemoveLabelButton.Click += (s, args) => { - DialogResult = DialogResult.Abort; - Close(); - }; - } - - internal void SetValues(MuPdfSharp.PageLabel label) { - var s = Array.IndexOf(Constants.PageLabelStyles.PdfValues, (char)label.NumericStyle); - _NumericStyleBox.Select(s); - _PrefixBox.Text = label.Prefix; - _StartAtBox.SetValue(label.StartAt); - _RemoveLabelButton.Enabled = true; - } - - protected override void OnDeactivate(EventArgs e) { - base.OnDeactivate(e); - Close(); - } - - } -} diff --git a/pdfpatcher/App/Functions/Editor/InsertPageLabelForm.resx b/pdfpatcher/App/Functions/Editor/InsertPageLabelForm.resx deleted file mode 100644 index 1af7de150c99c12dd67a509fe57c10d63e4eeb04..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/InsertPageLabelForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/Editor/NewCoordinateEntryForm.Designer.cs b/pdfpatcher/App/Functions/Editor/NewCoordinateEntryForm.Designer.cs deleted file mode 100644 index 1f2d797ced56809fddb7782ff6306774584c7a10..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/NewCoordinateEntryForm.Designer.cs +++ /dev/null @@ -1,196 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class NewCoordinateEntryForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._CancelButton = new System.Windows.Forms.Button(); - this._OkButton = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); - this._CoordinateBox = new System.Windows.Forms.ComboBox(); - this.label2 = new System.Windows.Forms.Label(); - this._AdjustmentAmountBox = new System.Windows.Forms.NumericUpDown(); - this._RelativeBox = new System.Windows.Forms.RadioButton(); - this._AbsoluteBox = new System.Windows.Forms.RadioButton(); - this._ProportionBox = new System.Windows.Forms.RadioButton(); - ((System.ComponentModel.ISupportInitialize)(this._AdjustmentAmountBox)).BeginInit(); - this.SuspendLayout(); - // - // _CancelButton - // - this._CancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this._CancelButton.Location = new System.Drawing.Point(189, 198); - this._CancelButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._CancelButton.Name = "_CancelButton"; - this._CancelButton.Size = new System.Drawing.Size(100, 29); - this._CancelButton.TabIndex = 5; - this._CancelButton.Text = "取消(&X)"; - this._CancelButton.UseVisualStyleBackColor = true; - this._CancelButton.Click += new System.EventHandler(this._CancelButton_Click); - // - // _OkButton - // - this._OkButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._OkButton.Location = new System.Drawing.Point(81, 198); - this._OkButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._OkButton.Name = "_OkButton"; - this._OkButton.Size = new System.Drawing.Size(100, 29); - this._OkButton.TabIndex = 4; - this._OkButton.Text = "确定(&Q)"; - this._OkButton.UseVisualStyleBackColor = true; - this._OkButton.Click += new System.EventHandler(this._OkButton_Click); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(16, 25); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(127, 15); - this.label1.TabIndex = 6; - this.label1.Text = "需要调整的坐标:"; - // - // _CoordinateBox - // - this._CoordinateBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._CoordinateBox.FormattingEnabled = true; - this._CoordinateBox.Items.AddRange(new object[] { - "上", - "下", - "左", - "右"}); - this._CoordinateBox.Location = new System.Drawing.Point(159, 21); - this._CoordinateBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._CoordinateBox.Name = "_CoordinateBox"; - this._CoordinateBox.Size = new System.Drawing.Size(115, 23); - this._CoordinateBox.TabIndex = 7; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(16, 56); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(97, 15); - this.label2.TabIndex = 8; - this.label2.Text = "坐标调整量:"; - // - // _AdjustmentAmountBox - // - this._AdjustmentAmountBox.DecimalPlaces = 2; - this._AdjustmentAmountBox.Location = new System.Drawing.Point(159, 54); - this._AdjustmentAmountBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._AdjustmentAmountBox.Maximum = new decimal(new int[] { - 1000, - 0, - 0, - 0}); - this._AdjustmentAmountBox.Minimum = new decimal(new int[] { - 1000, - 0, - 0, - -2147483648}); - this._AdjustmentAmountBox.Name = "_AdjustmentAmountBox"; - this._AdjustmentAmountBox.Size = new System.Drawing.Size(116, 25); - this._AdjustmentAmountBox.TabIndex = 9; - this._AdjustmentAmountBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // _RelativeBox - // - this._RelativeBox.AutoSize = true; - this._RelativeBox.Checked = true; - this._RelativeBox.Location = new System.Drawing.Point(19, 89); - this._RelativeBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._RelativeBox.Name = "_RelativeBox"; - this._RelativeBox.Size = new System.Drawing.Size(223, 19); - this._RelativeBox.TabIndex = 10; - this._RelativeBox.TabStop = true; - this._RelativeBox.Text = "相对调整(原坐标加调整量)"; - this._RelativeBox.UseVisualStyleBackColor = true; - // - // _AbsoluteBox - // - this._AbsoluteBox.AutoSize = true; - this._AbsoluteBox.Location = new System.Drawing.Point(19, 116); - this._AbsoluteBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._AbsoluteBox.Name = "_AbsoluteBox"; - this._AbsoluteBox.Size = new System.Drawing.Size(238, 19); - this._AbsoluteBox.TabIndex = 11; - this._AbsoluteBox.Text = "绝对调整(原坐标设为调整值)"; - this._AbsoluteBox.UseVisualStyleBackColor = true; - // - // _ProportionBox - // - this._ProportionBox.AutoSize = true; - this._ProportionBox.Location = new System.Drawing.Point(19, 142); - this._ProportionBox.Name = "_ProportionBox"; - this._ProportionBox.Size = new System.Drawing.Size(238, 19); - this._ProportionBox.TabIndex = 12; - this._ProportionBox.TabStop = true; - this._ProportionBox.Text = "比例调整(原坐标乘以调整量)"; - this._ProportionBox.UseVisualStyleBackColor = true; - // - // NewCoordinateEntryForm - // - this.AcceptButton = this._OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this._CancelButton; - this.ClientSize = new System.Drawing.Size(305, 242); - this.Controls.Add(this._ProportionBox); - this.Controls.Add(this._AbsoluteBox); - this.Controls.Add(this._RelativeBox); - this.Controls.Add(this._AdjustmentAmountBox); - this.Controls.Add(this.label2); - this.Controls.Add(this._CoordinateBox); - this.Controls.Add(this.label1); - this.Controls.Add(this._CancelButton); - this.Controls.Add(this._OkButton); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "NewCoordinateEntryForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "输入坐标调整值"; - ((System.ComponentModel.ISupportInitialize)(this._AdjustmentAmountBox)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Button _CancelButton; - private System.Windows.Forms.Button _OkButton; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.ComboBox _CoordinateBox; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.NumericUpDown _AdjustmentAmountBox; - private System.Windows.Forms.RadioButton _RelativeBox; - private System.Windows.Forms.RadioButton _AbsoluteBox; - private System.Windows.Forms.RadioButton _ProportionBox; - } -} \ No newline at end of file diff --git a/pdfpatcher/App/Functions/Editor/NewCoordinateEntryForm.cs b/pdfpatcher/App/Functions/Editor/NewCoordinateEntryForm.cs deleted file mode 100644 index d79b3f6de57a51a0c3f250345d226a556f3df99a..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/NewCoordinateEntryForm.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Windows.Forms; - -namespace PDFPatcher.Functions -{ - sealed partial class NewCoordinateEntryForm : Form - { - public string CoordinateName => _CoordinateBox.Text; - public float AdjustmentValue => (float)_AdjustmentAmountBox.Value; - public bool IsAbsolute => _AbsoluteBox.Checked; - public bool IsProportional => _ProportionBox.Checked; - - public NewCoordinateEntryForm() { - InitializeComponent(); - _CoordinateBox.SelectedIndex = 0; - } - - void _OkButton_Click(object sender, EventArgs e) { - DialogResult = DialogResult.OK; - Close(); - } - - void _CancelButton_Click(object sender, EventArgs e) { - DialogResult = DialogResult.Cancel; - Close(); - } - } -} diff --git a/pdfpatcher/App/Functions/Editor/NewCoordinateEntryForm.resx b/pdfpatcher/App/Functions/Editor/NewCoordinateEntryForm.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/NewCoordinateEntryForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/Editor/PagePropertyForm.Designer.cs b/pdfpatcher/App/Functions/Editor/PagePropertyForm.Designer.cs deleted file mode 100644 index 6587cca6735fb2ee903fe26c585fc8a0c1a257ef..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/PagePropertyForm.Designer.cs +++ /dev/null @@ -1,364 +0,0 @@ -namespace PDFPatcher.Functions.Editor -{ - partial class PagePropertyForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._CloseButton = new System.Windows.Forms.Button(); - this._PageDimensionBox = new System.Windows.Forms.ListBox(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this._TopBox = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this._RightBox = new System.Windows.Forms.TextBox(); - this.label4 = new System.Windows.Forms.Label(); - this._BottomBox = new System.Windows.Forms.TextBox(); - this.label5 = new System.Windows.Forms.Label(); - this._LeftBox = new System.Windows.Forms.TextBox(); - this.label6 = new System.Windows.Forms.Label(); - this._RotationBox = new System.Windows.Forms.TextBox(); - this._MainTab = new System.Windows.Forms.TabControl(); - this._DimensionPage = new System.Windows.Forms.TabPage(); - this._TextStylePage = new System.Windows.Forms.TabPage(); - this._TextStyleBox = new BrightIdeasSoftware.ObjectListView(); - this._FontNameColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._SizeColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this.label7 = new System.Windows.Forms.Label(); - this.label8 = new System.Windows.Forms.Label(); - this._WidthBox = new System.Windows.Forms.TextBox(); - this._HeightBox = new System.Windows.Forms.TextBox(); - this.label9 = new System.Windows.Forms.Label(); - this._MainTab.SuspendLayout(); - this._DimensionPage.SuspendLayout(); - this._TextStylePage.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._TextStyleBox)).BeginInit(); - this.SuspendLayout(); - // - // _CloseButton - // - this._CloseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._CloseButton.Location = new System.Drawing.Point(368, 282); - this._CloseButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._CloseButton.Name = "_CloseButton"; - this._CloseButton.Size = new System.Drawing.Size(100, 29); - this._CloseButton.TabIndex = 1; - this._CloseButton.Text = "关闭(&G)"; - this._CloseButton.UseVisualStyleBackColor = true; - // - // _PageDimensionBox - // - this._PageDimensionBox.FormattingEnabled = true; - this._PageDimensionBox.ItemHeight = 15; - this._PageDimensionBox.Location = new System.Drawing.Point(133, 20); - this._PageDimensionBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._PageDimensionBox.Name = "_PageDimensionBox"; - this._PageDimensionBox.Size = new System.Drawing.Size(159, 109); - this._PageDimensionBox.TabIndex = 1; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(39, 20); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(82, 15); - this.label1.TabIndex = 0; - this.label1.Text = "页面边框:"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(301, 20); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(37, 15); - this.label2.TabIndex = 6; - this.label2.Text = "上:"; - // - // _TopBox - // - this._TopBox.Location = new System.Drawing.Point(348, 16); - this._TopBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._TopBox.Name = "_TopBox"; - this._TopBox.ReadOnly = true; - this._TopBox.Size = new System.Drawing.Size(69, 25); - this._TopBox.TabIndex = 7; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(301, 54); - this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(37, 15); - this.label3.TabIndex = 8; - this.label3.Text = "右:"; - // - // _RightBox - // - this._RightBox.Location = new System.Drawing.Point(348, 50); - this._RightBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._RightBox.Name = "_RightBox"; - this._RightBox.ReadOnly = true; - this._RightBox.Size = new System.Drawing.Size(69, 25); - this._RightBox.TabIndex = 9; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(8, 74); - this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(37, 15); - this.label4.TabIndex = 2; - this.label4.Text = "下:"; - // - // _BottomBox - // - this._BottomBox.Location = new System.Drawing.Point(55, 70); - this._BottomBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._BottomBox.Name = "_BottomBox"; - this._BottomBox.ReadOnly = true; - this._BottomBox.Size = new System.Drawing.Size(69, 25); - this._BottomBox.TabIndex = 3; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(8, 108); - this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(37, 15); - this.label5.TabIndex = 4; - this.label5.Text = "左:"; - // - // _LeftBox - // - this._LeftBox.Location = new System.Drawing.Point(55, 104); - this._LeftBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._LeftBox.Name = "_LeftBox"; - this._LeftBox.ReadOnly = true; - this._LeftBox.Size = new System.Drawing.Size(69, 25); - this._LeftBox.TabIndex = 5; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(71, 158); - this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(52, 15); - this.label6.TabIndex = 14; - this.label6.Text = "旋转:"; - // - // _RotationBox - // - this._RotationBox.Location = new System.Drawing.Point(133, 154); - this._RotationBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._RotationBox.Name = "_RotationBox"; - this._RotationBox.ReadOnly = true; - this._RotationBox.Size = new System.Drawing.Size(53, 25); - this._RotationBox.TabIndex = 15; - // - // _MainTab - // - this._MainTab.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._MainTab.Controls.Add(this._DimensionPage); - this._MainTab.Controls.Add(this._TextStylePage); - this._MainTab.Location = new System.Drawing.Point(16, 15); - this._MainTab.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._MainTab.Name = "_MainTab"; - this._MainTab.SelectedIndex = 0; - this._MainTab.Size = new System.Drawing.Size(452, 260); - this._MainTab.TabIndex = 0; - // - // _DimensionPage - // - this._DimensionPage.Controls.Add(this._PageDimensionBox); - this._DimensionPage.Controls.Add(this._RotationBox); - this._DimensionPage.Controls.Add(this.label1); - this._DimensionPage.Controls.Add(this.label6); - this._DimensionPage.Controls.Add(this.label9); - this._DimensionPage.Controls.Add(this.label2); - this._DimensionPage.Controls.Add(this._LeftBox); - this._DimensionPage.Controls.Add(this._HeightBox); - this._DimensionPage.Controls.Add(this._TopBox); - this._DimensionPage.Controls.Add(this.label5); - this._DimensionPage.Controls.Add(this._WidthBox); - this._DimensionPage.Controls.Add(this.label4); - this._DimensionPage.Controls.Add(this.label8); - this._DimensionPage.Controls.Add(this._RightBox); - this._DimensionPage.Controls.Add(this.label3); - this._DimensionPage.Controls.Add(this._BottomBox); - this._DimensionPage.Location = new System.Drawing.Point(4, 25); - this._DimensionPage.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._DimensionPage.Name = "_DimensionPage"; - this._DimensionPage.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._DimensionPage.Size = new System.Drawing.Size(444, 231); - this._DimensionPage.TabIndex = 1; - this._DimensionPage.Text = "页面尺寸"; - this._DimensionPage.UseVisualStyleBackColor = true; - // - // _TextStylePage - // - this._TextStylePage.Controls.Add(this._TextStyleBox); - this._TextStylePage.Controls.Add(this.label7); - this._TextStylePage.Location = new System.Drawing.Point(4, 25); - this._TextStylePage.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._TextStylePage.Name = "_TextStylePage"; - this._TextStylePage.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._TextStylePage.Size = new System.Drawing.Size(444, 231); - this._TextStylePage.TabIndex = 2; - this._TextStylePage.Text = "文本样式"; - this._TextStylePage.UseVisualStyleBackColor = true; - // - // _TextStyleBox - // - this._TextStyleBox.AllColumns.Add(this._FontNameColumn); - this._TextStyleBox.AllColumns.Add(this._SizeColumn); - this._TextStyleBox.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this._FontNameColumn, - this._SizeColumn}); - this._TextStyleBox.Cursor = System.Windows.Forms.Cursors.Default; - this._TextStyleBox.Location = new System.Drawing.Point(11, 22); - this._TextStyleBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._TextStyleBox.Name = "_TextStyleBox"; - this._TextStyleBox.ShowGroups = false; - this._TextStyleBox.Size = new System.Drawing.Size(421, 196); - this._TextStyleBox.TabIndex = 1; - this._TextStyleBox.UseCompatibleStateImageBehavior = false; - this._TextStyleBox.View = System.Windows.Forms.View.Details; - // - // _FontNameColumn - // - this._FontNameColumn.Text = "字体名称"; - this._FontNameColumn.Width = 219; - // - // _SizeColumn - // - this._SizeColumn.Text = "字体尺寸"; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(8, 4); - this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(202, 15); - this.label7.TabIndex = 0; - this.label7.Text = "本页面包含如下样式的文本:"; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(301, 121); - this.label8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(37, 15); - this.label8.TabIndex = 12; - this.label8.Text = "宽:"; - // - // _WidthBox - // - this._WidthBox.Location = new System.Drawing.Point(348, 117); - this._WidthBox.Margin = new System.Windows.Forms.Padding(4); - this._WidthBox.Name = "_WidthBox"; - this._WidthBox.ReadOnly = true; - this._WidthBox.Size = new System.Drawing.Size(69, 25); - this._WidthBox.TabIndex = 13; - // - // _HeightBox - // - this._HeightBox.Location = new System.Drawing.Point(348, 83); - this._HeightBox.Margin = new System.Windows.Forms.Padding(4); - this._HeightBox.Name = "_HeightBox"; - this._HeightBox.ReadOnly = true; - this._HeightBox.Size = new System.Drawing.Size(69, 25); - this._HeightBox.TabIndex = 11; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(301, 87); - this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(37, 15); - this.label9.TabIndex = 10; - this.label9.Text = "高:"; - // - // PagePropertyForm - // - this.AcceptButton = this._CloseButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(484, 326); - this.Controls.Add(this._MainTab); - this.Controls.Add(this._CloseButton); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "PagePropertyForm"; - this.ShowInTaskbar = false; - this.Text = "页面属性"; - this._MainTab.ResumeLayout(false); - this._DimensionPage.ResumeLayout(false); - this._DimensionPage.PerformLayout(); - this._TextStylePage.ResumeLayout(false); - this._TextStylePage.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this._TextStyleBox)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Button _CloseButton; - private System.Windows.Forms.ListBox _PageDimensionBox; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox _TopBox; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox _RightBox; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.TextBox _BottomBox; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.TextBox _LeftBox; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.TextBox _RotationBox; - private System.Windows.Forms.TabControl _MainTab; - private System.Windows.Forms.TabPage _DimensionPage; - private System.Windows.Forms.TabPage _TextStylePage; - private BrightIdeasSoftware.ObjectListView _TextStyleBox; - private System.Windows.Forms.Label label7; - private BrightIdeasSoftware.OLVColumn _FontNameColumn; - private BrightIdeasSoftware.OLVColumn _SizeColumn; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.TextBox _HeightBox; - private System.Windows.Forms.TextBox _WidthBox; - private System.Windows.Forms.Label label8; - } -} \ No newline at end of file diff --git a/pdfpatcher/App/Functions/Editor/PagePropertyForm.cs b/pdfpatcher/App/Functions/Editor/PagePropertyForm.cs deleted file mode 100644 index 702b42ce812c1805141d28541d60fd8107fbcef9..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/PagePropertyForm.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Windows.Forms; -using BrightIdeasSoftware; -using MuPdfSharp; -using PDFPatcher.Common; -using MuRectangle = MuPdfSharp.Rectangle; - -namespace PDFPatcher.Functions.Editor -{ - sealed partial class PagePropertyForm : DraggableForm - { - public int PageNumber { get; set; } - - public PagePropertyForm() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - } - void OnLoad() { - _PageDimensionBox.SelectedIndexChanged += _PageDimensionBox_SelectedIndexChanged; - _CloseButton.Click += (s, args) => Hide(); - _FontNameColumn.AsTyped(f => f.AspectGetter = o => o.FontName); - _SizeColumn.AsTyped(f => f.AspectGetter = o => o.Size); - _TextStyleBox.ScaleColumnWidths(); - } - - public void LoadPage(MuPage page) { - _PageDimensionBox.Items.Clear(); - AddBox(page, page.CropBox, Constants.Content.PageSettings.CropBox); - AddBox(page, page.MediaBox, Constants.Content.PageSettings.MediaBox); - AddBox(page, page.TrimBox, Constants.Content.PageSettings.TrimBox); - AddBox(page, page.ArtBox, Constants.Content.PageSettings.ArtBox); - AddBox(page, page.BleedBox, Constants.Content.PageSettings.BleedBox); - _RotationBox.Text = page.Rotation.ToString(); - if (_PageDimensionBox.Items.Count > 0) { - _PageDimensionBox.SelectedIndex = 0; - } - var ts = new HashSet(new FontAndSizeComparer()); - foreach (var block in page.TextPage.Blocks) { - foreach (var line in block.Lines) { - var c = line.FirstCharacter; - ts.Add(new MuFontAndSize(Model.PdfDocumentFont.RemoveSubsetPrefix(page.GetFont(c).Name), c.Size)); - } - } - _TextStyleBox.Objects = ts; - _TextStyleBox.Sort(_SizeColumn, SortOrder.Descending); - PageNumber = page.PageNumber; - } - - void AddBox(MuPage page, MuRectangle rect, string title) { - if (rect.IsEmpty == false) { - _PageDimensionBox.Items.Add(new Box(rect, title)); - } - } - - void _PageDimensionBox_SelectedIndexChanged(object sender, EventArgs args) { - var v = _PageDimensionBox.SelectedItem as Box; - if (v == null) { - return; - } - var r = v.Rect; - _TopBox.Text = r.Bottom.ToText(); - _RightBox.Text = r.Right.ToText(); - _BottomBox.Text = r.Top.ToText(); - _LeftBox.Text = r.Left.ToText(); - _WidthBox.Text = r.Width.ToText(); - _HeightBox.Text = r.Height.ToText(); - } - - protected override void OnDeactivate(EventArgs e) { - Hide(); - base.OnDeactivate(e); - } - - sealed class Box - { - public readonly MuRectangle Rect; - public readonly string Title; - public Box(MuRectangle rect, string title) { - Rect = rect; - Title = title; - } - public override string ToString() { - return Title; - } - } - - sealed class MuFontAndSize - { - public readonly string FontName; - public readonly float Size; - - public MuFontAndSize(string fontName, float size) { - FontName = fontName; - Size = size; - } - } - sealed class FontAndSizeComparer : IEqualityComparer - { - public bool Equals(MuFontAndSize x, MuFontAndSize y) { - return x.FontName == y.FontName && x.Size == y.Size; - } - - public int GetHashCode(MuFontAndSize obj) { - return obj.FontName.GetHashCode() ^ obj.Size.GetHashCode(); - } - } - } -} diff --git a/pdfpatcher/App/Functions/Editor/PagePropertyForm.resx b/pdfpatcher/App/Functions/Editor/PagePropertyForm.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/PagePropertyForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/Editor/PdfViewerControl.cs b/pdfpatcher/App/Functions/Editor/PdfViewerControl.cs deleted file mode 100644 index 8c2ae0c4f019bcea399a2817dce1f0a8e32dd64f..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/PdfViewerControl.cs +++ /dev/null @@ -1,1251 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Windows.Forms; -using Cyotek.Windows.Forms; -using Cyotek.Windows.Forms.Demo; -using MuPdfSharp; -using PDFPatcher.Common; -using DrawingPoint = System.Drawing.Point; -using DrawingRectangle = System.Drawing.Rectangle; -using MuPoint = MuPdfSharp.Point; -using MuRectangle = MuPdfSharp.Rectangle; - -namespace PDFPatcher.Functions -{ - internal sealed class PdfViewerControl : ImageBoxEx - { - enum ZoomMode - { - Custom, FitPage = -1, FitHorizontal = -2, FitVertical = -3 - } - - public event EventHandler DocumentLoaded; - public new event EventHandler ZoomChanged; - public event EventHandler PageChanged; - public event EventHandler SelectionChanged; - - internal sealed class PageChangedEventArgs : EventArgs - { - public int PageNumber { get; } - public PageChangedEventArgs(int pageNumber) { - PageNumber = pageNumber; - } - } - internal sealed class SelectionChangedEventArgs : EventArgs - { - public Editor.Selection Selection { get; } - public SelectionChangedEventArgs(Editor.Selection selection) { - Selection = selection; - } - } - - readonly static IComparer __horizontalComparer = ValueHelper.GetReverseComparer(); - - static readonly int __pageMargin = (int)(TextRenderer.MeasureText("国", SystemFonts.MessageBoxFont).Height * 1.2d); - - readonly BackgroundWorker _renderWorker; - readonly Timer _refreshTimer; - bool _cancelRendering; - bool _lockDown; - MuDocument _mupdf; - readonly ImageRendererOptions _renderOptions; - - ZoomMode _zoomMode; - float _zoomFactor; - Editor.ContentDirection _contentFlow; - /// - /// 页面的尺寸信息。 - /// - MuRectangle[] _pageBounds; - SizeF _maxDimension; - /// - /// 页面的滚动位置。 - /// - int[] _pageOffsets; - /// - /// 缓存页面渲染结果的缓冲区。 - /// - RenderResultCache _cache; - Dictionary> _ocrResults; - - Model.PageRange _DisplayRange; - /// - /// 获取或设置显示的焦点页面。 - /// - [DefaultValue(0)] - public int CurrentPageNumber { - get => HorizontalFlow ? _DisplayRange.EndValue : _DisplayRange.StartValue; - set { - if (value == CurrentPageNumber) { - return; - } - ShowPage(value); - } - } - /// - /// 获取当前可见的第一个页面。 - /// - [Browsable(false)] - public int FirstPage => _DisplayRange.StartValue; - /// - /// 获取当前可见的最后一个页面。 - /// - [Browsable(false)] - public int LastPage => _DisplayRange.EndValue; - - readonly OcrOptions _OcrOptions = new OcrOptions(); - /// - /// 获取文本识别选项。 - /// - [Browsable(false)] - public OcrOptions OcrOptions => _OcrOptions; - - string _LiteralZoom; - /// - /// 获取或设置显示放大比率。 - /// - [Browsable(false)] - public string LiteralZoom { - get => _LiteralZoom; - set { - if (value != null && ChangeZoom(value)) { - _LiteralZoom = value; - ZoomChanged?.Invoke(this, EventArgs.Empty); - } - } - } - public new float ZoomFactor => _zoomFactor * 72f / _renderOptions.Dpi; - /// - /// 获取或设置阅读器是否使用右到左的水平滚动模式。 - /// - [DefaultValue(Editor.ContentDirection.TopToDown)] - public Editor.ContentDirection ContentDirection { - get => _contentFlow; - set { - if (value == _contentFlow) { - return; - } - var pp = Editor.PagePosition.Empty; - if (HorizontalScroll.Value != 0 || VerticalScroll.Value != 0) { - pp = TransposeVirtualImageToPagePosition(HorizontalScroll.Value, VerticalScroll.Value); - } - var s = GetSelection(); - _contentFlow = value; - UpdateDisplay(true); - if (s.ImageRegion.IsEmpty == false) { - var r = s.ImageRegion; - var p = GetVirtualImageOffset(s.Page); - r = new RectangleF(p.X + r.Left, p.Y + r.Top, r.Width, r.Height); - SelectionRegion = r; - } - if (pp.Page > 0) { - if (_zoomMode == ZoomMode.FitPage) { - ShowPage(pp.Page); - } - else { - ScrollToPosition(pp); - } - } - } - } - public bool HorizontalFlow => _contentFlow != Editor.ContentDirection.TopToDown; - - /// - /// 获取或设置阅读器是否将页面渲染为灰度图像。 - /// - [DefaultValue(false)] - public bool GrayScale { - get => _renderOptions.ColorSpace == ColorSpace.Gray; - set { - var v = value ? ColorSpace.Gray : ColorSpace.Rgb; - if (_renderOptions.ColorSpace != v) { - _renderOptions.ColorSpace = v; - UpdateDisplay(); - } - } - } - - /// - /// 获取或设置阅读器是否将页面渲染为反转颜色的效果。 - /// - [DefaultValue(false)] - public bool InvertColor { - get => _renderOptions.InvertColor; - set { - if (_renderOptions.InvertColor == value) { - return; - } - _renderOptions.InvertColor = value; - UpdateDisplay(); - } - } - - public Color TintColor { - get => _renderOptions.TintColor; - set { - if (_renderOptions.TintColor == value) { - return; - } - _renderOptions.TintColor = value; - UpdateDisplay(); - } - } - - [DefaultValue(false)] - public bool HideAnnotations { - get => _renderOptions.HideAnnotations; - set { - if (_renderOptions.HideAnnotations == value) { - return; - } - _renderOptions.HideAnnotations = value; - UpdateDisplay(); - } - } - - /// - /// 获取或设置阅读器的鼠标操作模式。 - /// - [DefaultValue(Editor.MouseMode.Move)] - public Editor.MouseMode MouseMode { - get => PanMode != ImageBoxPanMode.None ? Editor.MouseMode.Move : Editor.MouseMode.Selection; - set { - if (value == Editor.MouseMode.Move) { - PanMode = ImageBoxPanMode.Both; - AllowZoom = false; - SelectionMode = ImageBoxSelectionMode.None; - SelectionRegion = RectangleF.Empty; - } - else { - PanMode = ImageBoxPanMode.Both; - AllowZoom = false; - SelectionMode = ImageBoxSelectionMode.Rectangle; - } - } - } - - [DefaultValue(false)] - public bool FullPageScroll { get; set; } - - DrawingPoint _PinPoint; - [Description("指定鼠标定位点")] - public DrawingPoint PinPoint { - get => _PinPoint; - set { - if (_PinPoint != value) { - _PinPoint = value; - if (IsPinPointVisible && DesignMode == false) { - Invalidate(); - } - } - } - } - bool _ShowPinPoint; - [DefaultValue(false)] - [Description("指定是否显示鼠标定位点")] - public bool ShowPinPoint { - get => _ShowPinPoint; - set { - if (_ShowPinPoint != value) { - _ShowPinPoint = value; - if (IsPinPointVisible && DesignMode == false) { - Invalidate(); - } - } - } - } - - bool IsPinPointVisible { - get { - if (PinPoint != DrawingPoint.Empty) { - var op = GetOffsetPoint(0, 0); - var vp = GetImageViewPort(); - var pp = PinPoint; - pp.Offset(op); - if (vp.Contains(pp)) { - return true; - } - } - return false; - } - } - - bool _ShowTextBorders; - [DefaultValue(false)] - [Description("显示文本层的边框")] - public bool ShowTextBorders { - get => _ShowTextBorders; - set { - if (_ShowTextBorders != value) { - _ShowTextBorders = value; - if (DesignMode == false) { - Invalidate(); - } - } - } - } - - [DefaultValue(0)] - [Description("指定用于识别文本的语言")] - public int OcrLanguage { - get => _OcrOptions.OcrLangID; - set { - if (_OcrOptions.OcrLangID == value) { - return; - } - _OcrOptions.OcrLangID = value; - _ocrResults.Clear(); - } - } - - [Description("指定需要显示的 PDF 文档")] - [Browsable(false)] - [DefaultValue(null)] - public MuDocument Document { - get => _mupdf; - set { - Enabled = false; - InitViewer(); - _mupdf = value; - if (value != null) { - Tracker.DebugMessage("Load document."); - var l = _mupdf.PageCount + 1; - _pageOffsets = new int[l]; - _pageBounds = new MuRectangle[l]; - LoadPageBounds(); - _cache = new RenderResultCache(_mupdf); - Tracker.DebugMessage("Calculating document virtual size."); - CalculateZoomFactor(_LiteralZoom); - CalculateDocumentVirtualSize(); - ShowPage(1); - _refreshTimer.Start(); - if (_renderWorker.IsBusy == false) { - _renderWorker.RunWorkerAsync(); - } - DocumentLoaded?.Invoke(this, EventArgs.Empty); - Enabled = true; - } - } - } - - public PdfViewerControl() { - VirtualMode = true; - VirtualSize = Size.Empty; - PanMode = ImageBoxPanMode.Both; - AllowUnfocusedMouseWheel = true; - _renderOptions = new ImageRendererOptions(); - //_ViewBox.SelectionMode = ImageBoxSelectionMode.Rectangle; - - _refreshTimer = new Timer { - Interval = 200 - }; - _refreshTimer.Tick += (s, args) => { - for (int i = _DisplayRange.StartValue; i <= _DisplayRange.EndValue; i++) { - bool v; - lock (_cache.SyncObj) { - v = _cache.GetBitmap(i) != null; - } - if (v == false && _renderWorker.IsBusy == false) { - _renderWorker.RunWorkerAsync(); - return; - } - } - }; - - _renderWorker = new BackgroundWorker { - WorkerSupportsCancellation = true - }; - _renderWorker.DoWork += (s, args) => { - Tracker.DebugMessage("started prerender job: " + _DisplayRange); - _refreshTimer.Stop(); - for (int i = _DisplayRange.StartValue; i >= _DisplayRange.StartValue && i < _DisplayRange.EndValue + 2; i++) { - if (i < 1 || i > _mupdf.PageCount) { - continue; - } - if (_cancelRendering || _renderWorker.CancellationPending || _mupdf.IsDocumentOpened == false) { - _cancelRendering = false; - args.Cancel = true; - return; - } - if (_cache.GetBitmap(i) == null) { - lock (_cache.SyncObj) { - var pb = _pageBounds[i]; - Tracker.DebugMessage("load page " + i); - var z = GetZoomFactorForPage(pb); - RenderPage(i, (pb.Width * z).ToInt32(), (pb.Height * z).ToInt32()); - if (_DisplayRange.Contains(i)) { - Invalidate(); - } - } - } - } - }; - _renderWorker.RunWorkerCompleted += (s, args) => { - if (_cancelRendering == false) { - _refreshTimer.Start(); - } - }; - } - - protected override void OnCreateControl() { - base.OnCreateControl(); - using (var g = CreateGraphics()) { - _renderOptions.Dpi = g.DpiX; - } - } - - protected override void OnMouseMove(MouseEventArgs e) { - base.OnMouseMove(e); - if (SelectionRegion.IsEmpty == false && (IsResizing || IsSelecting || IsMoving) && e.Button == MouseButtons.Left) { - LimitSelectionInPage(e.Location); - } - } - - // protected override void SetCursor (DrawingPoint point) { - // if (IsPanning) { - // return; - // } - //#if DEBUG - // if (!IsResizing || !IsSelecting) { - // var p = TransposeClientToPageImage (point.X, point.Y); - // if (p.ImageY < 0) { - // this.Cursor = Cursors.Hand; - // return; - // } - // } - //#endif - // base.SetCursor (point); - // } - - protected override void OnSelectionRegionChanged(EventArgs e) { - base.OnSelectionRegionChanged(e); - if (_mupdf == null || MouseMode == Editor.MouseMode.Move || SelectionChanged == null) { - return; - } - SelectionChanged(this, new SelectionChangedEventArgs(GetSelection())); - } - protected override void OnClientSizeChanged(EventArgs e) { - base.OnClientSizeChanged(e); - if (_zoomMode != ZoomMode.Custom && _lockDown == false) { - if (ChangeZoom(LiteralZoom) && ZoomChanged != null) { - ZoomChanged(this, EventArgs.Empty); - } - //CalculateDocumentVirtualSize (); - Invalidate(); - } - } - void LimitSelectionInPage(DrawingPoint location) { - var r = SelectionRegion; - var pp = TransposeClientToPagePosition(location.X, location.Y); - var p = GetVirtualImageOffset(pp.Page); - Tracker.DebugMessage(pp.Location.ToString()); - r.Offset(-p.X, -p.Y); - var b = _pageBounds[pp.Page]; - var z = GetZoomFactorForPage(b); - - float x1 = r.Left, y1 = r.Top, x2 = r.Right, y2 = r.Bottom; - var c = false; - if (r.Left < 0) { - x1 = 0; - x2 -= r.Left; - c = true; - } - if (r.Top < 0) { - y1 = 0; - y2 -= r.Top; - c = true; - } - if (r.Right > b.Width * z) { - x2 = b.Width * z; - x1 -= r.Right - b.Width * z; - if (x1 < 0) { - x1 = 0; - } - c = true; - } - if (r.Bottom > b.Height * z) { - y2 = b.Height * z; - y1 -= r.Bottom - b.Height * z; - if (y1 < 0) { - y1 = 0; - } - c = true; - } - if (c) { - SelectionRegion = new MuRectangle(p.X + x1, p.Y + y1, p.X + x2, p.Y + y2); - } - } - protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { - switch (keyData) { - case Keys.Space: - case Keys.PageDown: - if (FullPageScroll) { - ExecuteCommand("_NextPage"); - return true; - } - if (HorizontalFlow) { - ScrollTo(HorizontalScroll.Value - (GetInsideViewPort().Width * 0.95).ToInt32(), VerticalScroll.Value); - } - else { - ScrollTo(HorizontalScroll.Value, VerticalScroll.Value + (GetInsideViewPort().Height * 0.95).ToInt32()); - } - return true; - case Keys.PageUp: - if (FullPageScroll) { - ExecuteCommand("_PreviousPage"); - return true; - } - if (HorizontalFlow) { - ScrollTo(HorizontalScroll.Value + (GetInsideViewPort().Width * 0.95).ToInt32(), VerticalScroll.Value); - } - else { - ScrollTo(HorizontalScroll.Value, VerticalScroll.Value - (GetInsideViewPort().Height * 0.95).ToInt32()); - } - return true; - case Keys.Home: - ShowPage(1); - return true; - case Keys.End: - if (_mupdf != null) { - ShowPage(_mupdf.PageCount); - } - return true; - } - return base.ProcessCmdKey(ref msg, keyData); - } - - protected override void OnMouseWheel(MouseEventArgs e) { - base.OnMouseWheel(e); - if (HorizontalFlow) { - ScrollTo(HorizontalScroll.Value + e.Delta, VerticalScroll.Value); - } - else { - ScrollTo(HorizontalScroll.Value, VerticalScroll.Value - e.Delta); - } - } - internal void CloseFile() { - if (_mupdf != null) { - _cache.Clear(); - _mupdf.ReleaseFile(); - } - } - internal void Reopen() { - if (_mupdf != null && _mupdf.IsDocumentOpened == false) { - _mupdf.Reopen(); - UpdateDisplay(true); - } - } - - protected override void OnVirtualDraw(PaintEventArgs e) { - base.OnVirtualDraw(e); - - if (VirtualSize.IsEmpty || Enabled == false) { - return; - } - _DisplayRange = GetDisplayingPageRange(); - var p = _DisplayRange.StartValue; - PageChanged?.Invoke(this, new PageChangedEventArgs(p)); - var g = e.Graphics; - var op = GetOffsetPoint(0, 0); // 偏移位置点 - var vp = GetImageViewPort(); - if (TintColor == Color.Transparent) { - g.FillRectangle(Brushes.FloralWhite, vp); - } - else { - using (var b = new SolidBrush(Processor.Imaging.BitmapHelper.Tint(Color.Gainsboro, TintColor))) { - g.FillRectangle(b, vp); - } - } - - var r = DrawingRectangle.Empty; - do { - System.Diagnostics.Debug.Assert(p > 0 && p < _mupdf.PageCount + 1, p.ToString()); - var pb = _pageBounds[p]; - var z = GetZoomFactorForPage(pb); - var ox = HorizontalFlow ? _pageOffsets[p] : 0; - var oy = HorizontalFlow ? 0 : _pageOffsets[p]; - r = new DrawingRectangle( - ox + op.X + __pageMargin, - oy + op.Y + __pageMargin, - (pb.Width * z).ToInt32(), - (pb.Height * z).ToInt32() - ); - var pl = GetPageLabel(p); - TextRenderer.DrawText(e.Graphics, - string.Concat(pl, pl.Length > 0 ? " / 第 " : "第 ", p, " 页 (", pb.Width, " * ", pb.Height, ")"), - SystemFonts.MessageBoxFont, - new DrawingPoint(ox + op.X + __pageMargin, oy + op.Y), - Color.Black); - var bmp = _cache.GetBitmap(p); - if (bmp == null) { - g.FillRectangle(Brushes.White, r); - if (_renderWorker.IsBusy == false) { - _renderWorker.RunWorkerAsync(); - } - } - else { - g.DrawImage(bmp, r.Location); - } - g.DrawRectangle(Pens.Black, r.Left - 1, r.Top - 1, r.Width + 1, r.Height + 1); - if (ShowTextBorders) { - DrawTextBorders(g, p, op); - } - } while ((HorizontalFlow ? (r.Right > 0) : (r.Bottom < vp.Height)) - && ++p < _pageOffsets.Length); - if (ShowPinPoint && PinPoint != DrawingPoint.Empty) { - var pp = PinPoint.Transpose(op); - if (vp.Contains(pp)) { - g.DrawImage(Properties.Resources.Pin, pp.X, pp.Y - Properties.Resources.Pin.Height); - } - } - if (_cache.GetBitmap(p + 1) == null && _renderWorker.IsBusy == false) { - _renderWorker.RunWorkerAsync(); - } - } - - string GetPageLabel(int pageNumber) { - return _mupdf.IsDocumentOpened ? _mupdf.PageLabels.Format(pageNumber) : String.Empty; - } - - Model.PageRange GetDisplayingPageRange() { - var b = GetOffsetRectangle(GetImageViewPort()); - return new Model.PageRange(GetPageNumberFromOffset(-b.Left + b.Width, -b.Y), GetPageNumberFromOffset(-b.Left, -(b.Y - b.Height))); - } - - void DrawTextBorders(Graphics g, int pageNumber, DrawingPoint offset) { - if (_mupdf.IsDocumentOpened == false) { - return; - } - lock (_mupdf.SyncObj) { - var p = _cache.LoadPage(pageNumber); - var z = GetZoomFactorForPage(p.VisualBound); - var o = GetVirtualImageOffset(pageNumber); - using (var spanPen = new Pen(Color.LightGray, 1)) - using (var blockPen = new Pen(Color.Gray, 1)) { - blockPen.DashStyle - = spanPen.DashStyle - = System.Drawing.Drawing2D.DashStyle.Dash; - using (var m = new System.Drawing.Drawing2D.Matrix(z, 0, 0, z, offset.X + o.X, offset.Y + o.Y)) { - g.MultiplyTransform(m); - } - foreach (var block in p.TextPage.Blocks) { - g.DrawRectangle(blockPen, block.BBox); - if (block == null) { - continue; - } - foreach (var line in block.Lines) { - g.DrawRectangle(spanPen, line.BBox); - } - } - } - g.ResetTransform(); - } - } - - /// - /// 返回选定区域。 - /// - /// 选定的矩形区域。 - internal Editor.Selection GetSelection() { - var s = GetSelectionPageRegion(); - if (s.Page == 0 || _mupdf.IsDocumentOpened == false) { - return Editor.Selection.Empty; - } - else { - lock (_mupdf.SyncObj) { - var vb = _pageBounds[s.Page]; - var sr = s.Region; - var pr = new MuRectangle(sr.Left - vb.Left, vb.Bottom - sr.Top, sr.Right - vb.Left, vb.Bottom - sr.Bottom); - var o = GetVirtualImageOffset(s.Page); - var area = SelectionRegion; - area.Offset(-o.X, -o.Y); - return new Editor.Selection(_cache, s.Page, pr, area); - } - } - } - - internal Editor.PageRegion GetSelectionPageRegion() { - var area = SelectionRegion; - if (area.IsEmpty) { - return Editor.PageRegion.Empty; - } - var b = GetOffsetRectangle(GetImageViewPort()); - var p1 = TransposeVirtualImageToPagePosition(area.Left.ToInt32(), area.Top.ToInt32()); - var p2 = TransposeVirtualImageToPagePosition(area.Right.ToInt32(), area.Bottom.ToInt32()); - return new Editor.PageRegion(p1, p2); - } - - /// - /// 返回指定位置的文本行以及与该文本行具有相同样式的后续文本行。 - /// - /// 查找文本行的位置。 - /// 返回指定位置的文本行以及与该文本行具有相同样式的后续文本行。 - internal Editor.TextInfo FindTextLines(Editor.PagePosition position) { - var rect = new MuRectangle(); - var ti = new Editor.TextInfo(); - if (_mupdf.IsDocumentOpened == false) { - return ti; - } - lock (_mupdf.SyncObj) { - var page = _cache.LoadPage(position.Page); - var point = position.Location.ToPageCoordinate(page.VisualBound); - if (page.Bound.Contains(point) == false - || page.TextPage.BBox.Contains(point) == false) { - return ti; - } - foreach (var block in page.TextPage.Blocks) { - if (block.Type != ContentBlockType.Text || block.BBox.Contains(point) == false) { - continue; - } - HashSet s = null; - MuTextLine l = null; - List r = null; - foreach (var line in block.Lines) { - if (l == null) { - if (line.BBox.Contains(point) == false) { - continue; - } - s = new HashSet(); // 获取选中文本行的文本样式集合 - r = new List(); - foreach (var ch in line.Characters) { - s.Add(ch.FontID); - } - rect = line.BBox; - l = line; - r.Add(l); - } - else { - if (line.BBox.IsHorizontalNeighbor(rect) == false) { - break; - } - // 获取具有相同样式的邻接文本行 - foreach (var ch in line.Characters) { - if (s.Contains(ch.FontID)) { - r.Add(line); - l = line; - goto NEXT; - } - } - rect = rect.Union(line.BBox); - } - NEXT:; - } - if (l != null) { - var spans = new List(r.Count * 2); - foreach (var item in r) { - spans.AddRange(item.Spans); - } - return new Editor.TextInfo(page, rect, r, spans); - } - } - } - return ti; - } - - /// - /// 返回指定区域内的文本行。 - /// - /// 选择的区域。 - /// 区域内的文本行。 - internal List FindTextLines(Editor.PageRegion region) { - if (_mupdf.IsDocumentOpened == false) { - return null; - } - lock (_mupdf.SyncObj) { - var page = _cache.LoadPage(region.Page); - var pr = region.Region.ToPageCoordinate(page.VisualBound); - if (pr.Intersect(page.VisualBound).IsEmpty) { - return null; - } - if (pr.Intersect(page.TextPage.BBox).IsEmpty) { - return null; - } - foreach (var block in page.TextPage.Blocks) { - if (block.Type != ContentBlockType.Text || pr.Intersect(block.BBox).IsEmpty) { - continue; - } - var s = new HashSet(); - var r = new List(); - foreach (var line in block.Lines) { - if (pr.Intersect(line.BBox).IsEmpty == false) { - r.Add(line); - } - } - return r; - } - } - return null; - } - - float GetZoomFactorForPage(MuRectangle bound) { - return _zoomFactor; - } - - public List OcrPage(int pageNumber, bool cached) { - if (cached && _ocrResults.TryGetValue(pageNumber, out var r)) { - return r; - } - r = Ocr(pageNumber); - return _ocrResults[pageNumber] = r; - } - public string[] CleanUpOcrResult(List result) { - return result.ConvertAll((t) => Processor.OcrProcessor.CleanUpText(t.Text, _OcrOptions)).ToArray(); - } - - List Ocr(int pageNumber) { - try { - Bitmap bmp = GetPageImage(pageNumber); - return Processor.OcrProcessor.OcrBitmap(bmp, _OcrOptions); - } - catch (System.Runtime.InteropServices.COMException ex) { - switch (ex.ErrorCode) { - case -959971327: - FormHelper.InfoBox("识别引擎初始化时遇到错误。\n请尝试以管理员身份运行程序,或重新安装 Office 2007 的 MODI 组件。"); - return new List(); - case -959967087: - FormHelper.ErrorBox("识别引擎无法识别本页文本。请尝试调整页面的显示比例,然后再执行识别。"); - return new List(); - default: - throw; - } - } - catch (Exception ex) { - Tracker.DebugMessage("OCR error: " + ex.Message); - return null; - } - } - - public Bitmap GetPageImage(int pageNumber) { - var b = _pageBounds[pageNumber]; - var z = GetZoomFactorForPage(b); - return RenderPage(pageNumber, (z * b.Width).ToInt32(), (z * b.Height).ToInt32()); - } - - public MuPage LoadPage(int pageNumber) { - return _cache.LoadPage(pageNumber); - } - public MuRectangle GetPageBound(int pageNumber) { - return _pageBounds[pageNumber]; - } - - Bitmap RenderPage(int pageNumber, int width, int height) { - var bmp = _cache.GetBitmap(pageNumber); - if (bmp != null) { - return bmp; - } - if (_mupdf == null || _mupdf.IsDocumentOpened == false || Enabled == false) { - return null; - } - lock (_mupdf.SyncObj) { - var p = _cache.LoadPage(pageNumber); - if (pageNumber < _DisplayRange.StartValue - 1 || pageNumber > _DisplayRange.EndValue + 1) { - return null; - } - Tracker.DebugMessage("render page " + pageNumber); - bmp = p.RenderBitmapPage(width, height, _renderOptions); - _cache.AddBitmap(pageNumber, bmp); - } - return bmp; - } - - int GetPageNumberFromOffset(int offsetX, int offsetY) { - if (_mupdf == null) { - return 0; - } - var p = HorizontalFlow ? - Array.BinarySearch(_pageOffsets, 1, _pageOffsets.Length - 1, offsetX, __horizontalComparer) : - Array.BinarySearch(_pageOffsets, 1, _pageOffsets.Length - 1, offsetY); - if (p < 0) { - p = ~p; - if (HorizontalFlow == false) { - --p; - } - } - if (p >= _pageOffsets.Length) { - return _pageOffsets.Length - 1; - } - else if (p < 1) { - return 1; - } - return p; - } - - bool ChangeZoom(string zoomMode) { - var s = GetSelection(); - var pp = Editor.PagePosition.Empty; - float z = 0; - if (s.Page > 0) { - z = GetZoomFactorForPage(_pageBounds[s.Page]); - } - if (HorizontalScroll.Value != 0 || VerticalScroll.Value != 0) { - pp = TransposeVirtualImageToPagePosition(HorizontalScroll.Value, VerticalScroll.Value); - } - if (CalculateZoomFactor(zoomMode) == false) { - return false; - } - if (_mupdf == null) { - return false; - } - UpdateDisplay(true); - // 保持选区尺寸比例 - if (z > 0) { - var r = s.ImageRegion; - var p = GetVirtualImageOffset(s.Page); - z = _zoomFactor / z; - r = new RectangleF(p.X + r.Left * z, p.Y + r.Top * z, r.Width * z, r.Height * z); - SelectionRegion = r; - } - if (pp.Page > 0) { - if (_zoomMode == ZoomMode.FitPage) { - ShowPage(pp.Page); - } - else { - ScrollToPosition(pp); - } - } - return true; - } - - bool CalculateZoomFactor(string zoomMode) { - switch (zoomMode) { - case Constants.DestinationAttributes.ViewType.Fit: - _zoomMode = ZoomMode.FitPage; - _zoomFactor = Math.Min( - (GetInsideViewPort().Width - __pageMargin - __pageMargin) / _maxDimension.Width, - (GetInsideViewPort().Height - __pageMargin - __pageMargin) / _maxDimension.Height - ); - break; - case Constants.DestinationAttributes.ViewType.FitH: - _zoomMode = ZoomMode.FitHorizontal; - _zoomFactor = (GetInsideViewPort().Width - __pageMargin - __pageMargin) / _maxDimension.Width; - break; - case Constants.DestinationAttributes.ViewType.FitV: - _zoomMode = ZoomMode.FitVertical; - _zoomFactor = (GetInsideViewPort().Height - __pageMargin - __pageMargin) / _maxDimension.Height; - break; - default: - int f; - if (zoomMode.EndsWith("%", StringComparison.Ordinal) && zoomMode.Length > 2) { - f = zoomMode.Substring(0, zoomMode.Length - 1).ToInt32(); - } - else if (zoomMode.Length > 1) { - f = zoomMode.ToInt32(); - } - else { return false; } - if (f == 0) { - return false; - } - _zoomMode = ZoomMode.Custom; - _zoomFactor = (float)f / 100f * _renderOptions.Dpi / 72f; - break; - } - return true; - } - - void UpdateDisplay() { UpdateDisplay(false); } - void UpdateDisplay(bool resized) { - if (DesignMode) { - return; - } - _refreshTimer.Stop(); - _renderWorker.CancelAsync(); - _cancelRendering = true; - if (_cache != null) { - lock (_mupdf.SyncObj) { - lock (_cache.SyncObj) { - _cache.Clear(); - } - } - } - _ocrResults.Clear(); - _cancelRendering = false; - _refreshTimer.Start(); - if (resized) { - //var p = FirstPage; - CalculateDocumentVirtualSize(); - //ShowPage (p); - } - } - - #region 坐标转换 - internal bool IsClientPointInSelection(DrawingPoint point) { - return SelectionRegion.Contains(PointToImage(point)); - } - - internal RectangleF MuRectangleToImageRegion(int pageNumber, MuRectangle box) { - var rtl = HorizontalFlow; - var o = _pageOffsets[pageNumber]; - var z = _zoomFactor; - if (rtl) { - return new RectangleF(o + __pageMargin + box.Left * z, box.Top * z + __pageMargin, box.Width * z, box.Height * z); - } - else { - return new RectangleF(box.Left * z + __pageMargin, box.Top * z + __pageMargin + o, box.Width * z, box.Height * z); - } - } - /// - /// 将屏幕客户区域的位置转换为页面坐标。 - /// - /// 横坐标。 - /// 纵坐标。 - /// 页面坐标。 - internal Editor.PagePosition TransposeClientToPagePosition(int clientX, int clientY) { - if (_DisplayRange.StartValue <= 0 || _pageBounds == null) { - return Editor.PagePosition.Empty; - } - var p = PointToImage(clientX, clientY); - return TransposeVirtualImageToPagePosition(p.X, p.Y); - } - - /// - /// 将虚拟画布的坐标点转换为屏幕客户区域的位置。 - /// - /// 虚拟画布位置的横坐标。 - /// 虚拟画布位置的横坐标。 - /// 屏幕客户区域的位置。 - internal DrawingPoint TransposeVirtualImageToClient(float imageX, float imageY) { - var vp = GetImageViewPort(); - return new DrawingPoint(vp.Left + AutoScrollPosition.X + imageX.ToInt32(), vp.Top + AutoScrollPosition.Y + imageY.ToInt32()); - } - - /// - /// 获取指定页面在虚拟画布上的绘制坐标点。 - /// - /// 页面编号。 - /// 页面左上角在虚拟画布上的坐标点。 - internal DrawingPoint GetVirtualImageOffset(int pageNumber) { - var rtl = HorizontalFlow; - var ox = rtl ? _pageOffsets[pageNumber] : 0; - var oy = rtl ? 0 : _pageOffsets[pageNumber]; - return new DrawingPoint(ox + __pageMargin, oy + __pageMargin); - } - - /// - /// 将虚拟画布的位置转换为页面坐标。 - /// - /// 虚拟画布位置的横坐标。 - /// 虚拟画布位置的纵坐标。 - /// 页面坐标。 - internal Editor.PagePosition TransposeVirtualImageToPagePosition(int imageX, int imageY) { - var n = GetPageNumberFromOffset(imageX, imageY); - return TransposeVirtualImageToPagePosition(n, imageX, imageY); - } - - /// - /// 将屏幕客户区域的位置转换为渲染页面位置。 - /// - /// 屏幕区域的横坐标。 - /// 屏幕区域的纵坐标。 - /// 渲染页面的位置。 - internal Editor.PagePoint TransposeClientToPageImage(int clientX, int clientY) { - if (_DisplayRange.StartValue <= 0 || _pageBounds == null || IsPointInImage(clientX, clientY) == false) { - return Editor.PagePoint.Empty; - } - var p = PointToImage(clientX, clientY); - var n = GetPageNumberFromOffset(p.X, p.Y); - var o = GetVirtualImageOffset(n); - return new Editor.PagePoint(n, p.X - o.X, p.Y - o.Y); - } - - /// - /// 将虚拟页面的位置转换为PDF页面位置。 - /// - /// 页码。 - /// 虚拟图片的横坐标。 - /// 虚拟图片的纵坐标。 - /// PDF 页面的位置。 - internal Editor.PagePosition TransposeVirtualImageToPagePosition(int pageNumber, int imageX, int imageY) { - var o = GetVirtualImageOffset(pageNumber); - var b = _pageBounds[pageNumber]; - var z = GetZoomFactorForPage(b); - var ox = (float)(imageX - o.X) / z; - var oy = (float)(imageY - o.Y) / z; - return new Editor.PagePosition(pageNumber, - b.Left + ox, b.Top + b.Height - oy, - imageX - o.X, imageY - o.Y, - b.Contains(ox, oy)); - } - - internal Editor.PagePosition TransposePageImageToPagePosition(int pageNumber, float pageImageX, float pageImageY) { - var b = _pageBounds[pageNumber]; - var z = _zoomFactor; - var ox = pageImageX / z; - var oy = pageImageY / z; - return new Editor.PagePosition(pageNumber, - b.Left + ox, b.Top + b.Height - oy, - pageImageX.ToInt32(), pageImageY.ToInt32(), - b.Contains(ox, oy)); - } - #endregion - - int GetPageFullWidth(float pageWidth) { - return __pageMargin + __pageMargin + (pageWidth * _zoomFactor).ToInt32(); - } - int GetPageFullHeight(float pageHeight) { - return __pageMargin + __pageMargin + (pageHeight * _zoomFactor).ToInt32(); - } - - bool ShowPage(int pageNumber) { - if (_mupdf == null || _pageOffsets == null) { - return false; - } - if (pageNumber < 0) { - pageNumber = _mupdf.PageCount + pageNumber + 1; - } - if (pageNumber <= 0 || pageNumber > _mupdf.PageCount) { - return false; - } - _DisplayRange.StartValue = pageNumber; - try { - if (HorizontalFlow) { - ScrollTo(_pageOffsets[pageNumber], VerticalScroll.Value); - } - else { - ScrollTo(HorizontalScroll.Value, _pageOffsets[pageNumber]); - } - } - catch (Exception ex) { - FormHelper.ErrorBox(ex.Message); - return false; - } - //if (PageChanged != null) { - // PageChanged (this, new PageChangedEventArgs (pageNumber)); - //} - return true; - } - - internal void ScrollToPosition(Editor.PagePosition position) { - var op = GetVirtualImageOffset(position.Page); - var l = position.Location.ToPageCoordinate(_pageBounds[position.Page]); - var z = GetZoomFactorForPage(_pageBounds[position.Page]); - var h = HorizontalFlow; - ScrollTo( - (position.PageX == 0 && h == false) ? HorizontalScroll.Value : (l.X * z).ToInt32() + op.X, - (position.PageY == 0 && h) ? VerticalScroll.Value : (position.Location.Y == 0 ? 0 : (l.Y * z).ToInt32()) + op.Y - ); - } - - bool Next(int deltaPageNumber) { - return ShowPage(CurrentPageNumber + deltaPageNumber); - } - - void LoadPageBounds() { - float w = 0, h = 0; - for (int i = _mupdf.PageCount; i > 0; i--) { - using (var p = _mupdf.LoadPage(i)) { - var b = p.VisualBound; - _pageBounds[i] = b; - if (b.Width > w) { - w = b.Width; - } - if (b.Height > h) { - h = b.Height; - } - } - } - _maxDimension = new SizeF(w, h); - } - - void CalculateDocumentVirtualSize() { - if (_pageOffsets == null || _pageBounds == null) { - return; - } - int h = 0, w = 0; - var l = _mupdf.PageCount + 1; - var vs = GetInsideViewPort().Size; - _lockDown = true; - if (HorizontalFlow) { - lock (_mupdf.SyncObj) { - for (int i = l - 1; i >= 0; i--) { - var b = _pageBounds[i]; - _pageOffsets[i] = w; - w += GetPageFullWidth(b.Width); - if (b.Height > h) { - h = b.Height.ToInt32(); - } - } - var w1 = GetPageFullWidth(_pageBounds[1].Width); - if (w1 < vs.Width) { - w += vs.Width - w1; - } - } - VirtualSize = new Size(w, GetPageFullHeight(h)); - } - else { - lock (_mupdf.SyncObj) { - for (int i = 1; i < l; i++) { - var b = _pageBounds[i]; - _pageOffsets[i] = h; - h += GetPageFullHeight(_pageBounds[i].Height); - if (b.Width > w) { - w = b.Width.ToInt32(); - } - } - var h1 = GetPageFullHeight(_pageBounds[1].Height); - if (h1 < vs.Height) { - h += vs.Height - h1; - } - } - VirtualSize = new Size(GetPageFullWidth(w), h); - } - _lockDown = false; - } - - public void ExecuteCommand(string cmd) { - switch (cmd) { - case "_FirstPage": ShowPage(1); break; - case "_PreviousPage": Next(-1); break; - case "_NextPage": Next(1); break; - case "_LastPage": ShowPage(-1); break; - case "_ScrollVertical": ContentDirection = Editor.ContentDirection.TopToDown; break; - case "_ScrollHorizontal": ContentDirection = Editor.ContentDirection.RightToLeft; break; - case "_TrueColorSpace": GrayScale = false; break; - case "_GrayColorSpace": GrayScale = true; break; - case "_InvertColor": InvertColor = !InvertColor; break; - case "_Refresh": UpdateDisplay(); break; - } - } - - public void InitViewer() { - _cancelRendering = true; - _refreshTimer.Stop(); - SelectionRegion = DrawingRectangle.Empty; - _DisplayRange = new Model.PageRange(); - if (_LiteralZoom == null) { - _zoomFactor = (float)_renderOptions.Dpi / 72; - _zoomMode = ZoomMode.FitHorizontal; - _LiteralZoom = Constants.DestinationAttributes.ViewType.FitH; - VirtualSize = new Size(1, 1); - } - ShowTextBorders = false; - _pageBounds = null; - _pageOffsets = null; - if (_cache != null) { - lock (_cache.SyncObj) { - _cache.Clear(); - } - } - _contentFlow = Editor.ContentDirection.TopToDown; - _OcrOptions.CompressWhiteSpaces = true; - _ocrResults = new Dictionary>(); - } - - protected override void Dispose(bool disposing) { - base.Dispose(disposing); - Tracker.DebugMessage("PDF Viewer control destroyed."); - _cancelRendering = true; - _mupdf?.AbortAsync(); - _refreshTimer.Stop(); - if (_cache != null) { - _renderWorker.CancelAsync(); - lock (_cache.SyncObj) { - _cache.Dispose(); - } - } - _renderWorker.Dispose(); - _refreshTimer.Dispose(); - } - } -} diff --git a/pdfpatcher/App/Functions/Editor/SavePdfForm.Designer.cs b/pdfpatcher/App/Functions/Editor/SavePdfForm.Designer.cs deleted file mode 100644 index 1f093cccfffcdb4cfe5a11cd1e1f1ca07484e942..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/SavePdfForm.Designer.cs +++ /dev/null @@ -1,142 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class SavePdfForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._OkButton = new System.Windows.Forms.Button(); - this._CancelButton = new System.Windows.Forms.Button(); - this._MessageLabel = new System.Windows.Forms.Label(); - this._SourceFileBox = new PDFPatcher.SourceFileControl(); - this._TargetFileBox = new PDFPatcher.TargetFileControl(); - this._ConfigButton = new System.Windows.Forms.Button(); - this._OverwriteBox = new System.Windows.Forms.CheckBox(); - this.SuspendLayout(); - // - // _OkButton - // - this._OkButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._OkButton.Location = new System.Drawing.Point(322, 132); - this._OkButton.Name = "_OkButton"; - this._OkButton.Size = new System.Drawing.Size(75, 23); - this._OkButton.TabIndex = 0; - this._OkButton.Text = "确定(&Q)"; - this._OkButton.UseVisualStyleBackColor = true; - this._OkButton.Click += new System.EventHandler(this._OkButton_Click); - // - // _CancelButton - // - this._CancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this._CancelButton.Location = new System.Drawing.Point(403, 132); - this._CancelButton.Name = "_CancelButton"; - this._CancelButton.Size = new System.Drawing.Size(75, 23); - this._CancelButton.TabIndex = 1; - this._CancelButton.Text = "取消(&X)"; - this._CancelButton.UseVisualStyleBackColor = true; - this._CancelButton.Click += new System.EventHandler(this._CancelButton_Click); - // - // _MessageLabel - // - this._MessageLabel.AutoSize = true; - this._MessageLabel.Location = new System.Drawing.Point(113, 100); - this._MessageLabel.Name = "_MessageLabel"; - this._MessageLabel.Size = new System.Drawing.Size(347, 12); - this._MessageLabel.TabIndex = 2; - this._MessageLabel.Text = "点击“确定”按钮,将书签编辑器的书签写入到目标 PDF 文档。"; - // - // _SourceFileBox - // - this._SourceFileBox.Location = new System.Drawing.Point(12, 12); - this._SourceFileBox.Name = "_SourceFileBox"; - this._SourceFileBox.Size = new System.Drawing.Size(469, 26); - this._SourceFileBox.TabIndex = 3; - // - // _TargetFileBox - // - this._TargetFileBox.Location = new System.Drawing.Point(12, 44); - this._TargetFileBox.Name = "_TargetFileBox"; - this._TargetFileBox.Size = new System.Drawing.Size(469, 25); - this._TargetFileBox.TabIndex = 4; - // - // _ConfigButton - // - this._ConfigButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this._ConfigButton.Image = global::PDFPatcher.Properties.Resources.PdfOptions; - this._ConfigButton.Location = new System.Drawing.Point(12, 132); - this._ConfigButton.Name = "_ConfigButton"; - this._ConfigButton.Size = new System.Drawing.Size(181, 23); - this._ConfigButton.TabIndex = 12; - this._ConfigButton.Text = "设置 P&DF 文件的修改方式"; - this._ConfigButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._ConfigButton.UseVisualStyleBackColor = true; - // - // _OverwriteBox - // - this._OverwriteBox.AutoSize = true; - this._OverwriteBox.Location = new System.Drawing.Point(115, 75); - this._OverwriteBox.Name = "_OverwriteBox"; - this._OverwriteBox.Size = new System.Drawing.Size(126, 16); - this._OverwriteBox.TabIndex = 13; - this._OverwriteBox.Text = "覆盖原始 PDF 文件"; - this._OverwriteBox.UseVisualStyleBackColor = true; - // - // SavePdfForm - // - this.AcceptButton = this._OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this._CancelButton; - this.ClientSize = new System.Drawing.Size(490, 167); - this.Controls.Add(this._OverwriteBox); - this.Controls.Add(this._ConfigButton); - this.Controls.Add(this._TargetFileBox); - this.Controls.Add(this._SourceFileBox); - this.Controls.Add(this._MessageLabel); - this.Controls.Add(this._CancelButton); - this.Controls.Add(this._OkButton); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "SavePdfForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "保存PDF文件"; - this.Load += new System.EventHandler(this.ImportBookmarkForm_Load); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Button _OkButton; - private System.Windows.Forms.Button _CancelButton; - private System.Windows.Forms.Label _MessageLabel; - private SourceFileControl _SourceFileBox; - private TargetFileControl _TargetFileBox; - private System.Windows.Forms.Button _ConfigButton; - private System.Windows.Forms.CheckBox _OverwriteBox; - } -} - diff --git a/pdfpatcher/App/Functions/Editor/SavePdfForm.cs b/pdfpatcher/App/Functions/Editor/SavePdfForm.cs deleted file mode 100644 index e212194c6f4e3af397b0e72ea0e27ae8e4392f21..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/SavePdfForm.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using System.Windows.Forms; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - sealed partial class SavePdfForm : Form - { - readonly PdfInfoXmlDocument _bookmarkDocument; - public EventHandler DoWork; - public EventHandler Finished; - - public string SourceFilePath => _SourceFileBox.Text; - public string TargetFilePath => _TargetFileBox.Text; - - SavePdfForm() { - InitializeComponent(); - } - public SavePdfForm(string sourcePath, string targetPath, PdfInfoXmlDocument bookmarkDocument) : this() { - if (String.IsNullOrEmpty(sourcePath) == false) { - _SourceFileBox.Text = sourcePath; - } - if (String.IsNullOrEmpty(targetPath) == false) { - _TargetFileBox.Text = targetPath; - } - _bookmarkDocument = new PdfInfoXmlDocument(); - using (var r = bookmarkDocument.CreateNavigator().ReadSubtree()) { - _bookmarkDocument.Load(r); - } - - _OverwriteBox.CheckedChanged += (s, args) => _TargetFileBox.Enabled = !_OverwriteBox.Checked; - } - - void ImportBookmarkForm_Load(object sender, EventArgs e) { - _TargetFileBox.FileMacroMenu.LoadStandardSourceFileMacros(); - _ConfigButton.Click += (s, args) => { - AppContext.MainForm.SelectFunctionList(Function.EditorOptions); - }; - } - - void _OkButton_Click(Object source, EventArgs args) { - AppContext.MainForm.ResetWorker(); - var doc = _bookmarkDocument; - var s = _SourceFileBox.Text; - var t = _OverwriteBox.Checked ? _SourceFileBox.Text : _TargetFileBox.Text; - if (String.IsNullOrEmpty(s)) { - Common.FormHelper.ErrorBox(Messages.SourceFileNotFound); - return; - } - if (String.IsNullOrEmpty(t)) { - Common.FormHelper.ErrorBox(Messages.TargetFileNotSpecified); - return; - } - _SourceFileBox.FileList.AddHistoryItem(); - _TargetFileBox.FileList.AddHistoryItem(); - - var worker = AppContext.MainForm.GetWorker(); - worker.DoWork += (dummy, arg) => { - DoWork?.Invoke(this, null); - Processor.Worker.PatchDocument(new SourceItem.Pdf(s), t, _bookmarkDocument, AppContext.Importer, AppContext.Editor); - }; - worker.RunWorkerCompleted += (dummy, arg) => { - Finished?.Invoke(this, arg); - }; - worker.RunWorkerAsync(); - - DialogResult = DialogResult.OK; - Close(); - } - - void _CancelButton_Click(Object source, EventArgs args) { - DialogResult = DialogResult.Cancel; - Close(); - } - } -} diff --git a/pdfpatcher/App/Functions/Editor/SavePdfForm.resx b/pdfpatcher/App/Functions/Editor/SavePdfForm.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/SavePdfForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/Editor/SearchBookmarkForm.Designer.cs b/pdfpatcher/App/Functions/Editor/SearchBookmarkForm.Designer.cs deleted file mode 100644 index 53165d97e4edf09a67e32e06622d4d43e0f06ba4..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/SearchBookmarkForm.Designer.cs +++ /dev/null @@ -1,330 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class SearchBookmarkForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._SearchButton = new System.Windows.Forms.Button (); - this.label1 = new System.Windows.Forms.Label (); - this._MatchCaseBox = new System.Windows.Forms.CheckBox (); - this._FullMatchBox = new System.Windows.Forms.CheckBox (); - this.label2 = new System.Windows.Forms.Label (); - this._ReplaceButton = new System.Windows.Forms.Button (); - this._ResultLabel = new System.Windows.Forms.Label (); - this.label3 = new System.Windows.Forms.Label (); - this._NormalSearchBox = new System.Windows.Forms.RadioButton (); - this._RegexSearchBox = new System.Windows.Forms.RadioButton (); - this._XPathSearchBox = new System.Windows.Forms.RadioButton (); - this.label4 = new System.Windows.Forms.Label (); - this._ReplaceInSelectionBox = new System.Windows.Forms.RadioButton (); - this._ReplaceInAllBox = new System.Windows.Forms.RadioButton (); - this.panel1 = new System.Windows.Forms.Panel (); - this.panel2 = new System.Windows.Forms.Panel (); - this._SearchNextButton = new System.Windows.Forms.Button (); - this._ReplaceTextBox = new PDFPatcher.HistoryComboBox (); - this._SearchTextBox = new PDFPatcher.HistoryComboBox (); - this._CloseButton = new System.Windows.Forms.Button (); - this.panel1.SuspendLayout (); - this.panel2.SuspendLayout (); - this.SuspendLayout (); - // - // _SearchButton - // - this._SearchButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._SearchButton.Location = new System.Drawing.Point (357, 10); - this._SearchButton.Name = "_SearchButton"; - this._SearchButton.Size = new System.Drawing.Size (99, 23); - this._SearchButton.TabIndex = 2; - this._SearchButton.Text = "搜索全部(&S)"; - this._SearchButton.UseVisualStyleBackColor = true; - this._SearchButton.Click += new System.EventHandler (this._SearchButton_Click); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point (12, 15); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size (65, 12); - this.label1.TabIndex = 0; - this.label1.Text = "搜索文本:"; - // - // _MatchCaseBox - // - this._MatchCaseBox.AutoSize = true; - this._MatchCaseBox.Location = new System.Drawing.Point (83, 38); - this._MatchCaseBox.Name = "_MatchCaseBox"; - this._MatchCaseBox.Size = new System.Drawing.Size (84, 16); - this._MatchCaseBox.TabIndex = 6; - this._MatchCaseBox.Text = "区分大小写"; - this._MatchCaseBox.UseVisualStyleBackColor = true; - // - // _FullMatchBox - // - this._FullMatchBox.AutoSize = true; - this._FullMatchBox.Location = new System.Drawing.Point (183, 38); - this._FullMatchBox.Name = "_FullMatchBox"; - this._FullMatchBox.Size = new System.Drawing.Size (132, 16); - this._FullMatchBox.TabIndex = 8; - this._FullMatchBox.Text = "匹配整个书签的文本"; - this._FullMatchBox.UseVisualStyleBackColor = true; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point (12, 85); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size (65, 12); - this.label2.TabIndex = 3; - this.label2.Text = "替换文本:"; - // - // _ReplaceButton - // - this._ReplaceButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._ReplaceButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this._ReplaceButton.Location = new System.Drawing.Point (357, 80); - this._ReplaceButton.Name = "_ReplaceButton"; - this._ReplaceButton.Size = new System.Drawing.Size (99, 23); - this._ReplaceButton.TabIndex = 5; - this._ReplaceButton.Text = "替换(&T)"; - this._ReplaceButton.UseVisualStyleBackColor = true; - this._ReplaceButton.Click += new System.EventHandler (this._ReplaceButton_Click); - // - // _ResultLabel - // - this._ResultLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ResultLabel.Location = new System.Drawing.Point (12, 127); - this._ResultLabel.Name = "_ResultLabel"; - this._ResultLabel.Size = new System.Drawing.Size (443, 33); - this._ResultLabel.TabIndex = 10; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point (12, 61); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size (65, 12); - this.label3.TabIndex = 13; - this.label3.Text = "搜索模式:"; - // - // _NormalSearchBox - // - this._NormalSearchBox.AutoSize = true; - this._NormalSearchBox.Location = new System.Drawing.Point (0, 0); - this._NormalSearchBox.Name = "_NormalSearchBox"; - this._NormalSearchBox.Size = new System.Drawing.Size (47, 16); - this._NormalSearchBox.TabIndex = 14; - this._NormalSearchBox.TabStop = true; - this._NormalSearchBox.Text = "普通"; - this._NormalSearchBox.UseVisualStyleBackColor = true; - this._NormalSearchBox.CheckedChanged += new System.EventHandler (this.MatchModeChanged); - // - // _RegexSearchBox - // - this._RegexSearchBox.AutoSize = true; - this._RegexSearchBox.Location = new System.Drawing.Point (53, 0); - this._RegexSearchBox.Name = "_RegexSearchBox"; - this._RegexSearchBox.Size = new System.Drawing.Size (83, 16); - this._RegexSearchBox.TabIndex = 15; - this._RegexSearchBox.TabStop = true; - this._RegexSearchBox.Text = "正则表达式"; - this._RegexSearchBox.UseVisualStyleBackColor = true; - this._RegexSearchBox.CheckedChanged += new System.EventHandler (this.MatchModeChanged); - // - // _XPathSearchBox - // - this._XPathSearchBox.AutoSize = true; - this._XPathSearchBox.Location = new System.Drawing.Point (144, 0); - this._XPathSearchBox.Name = "_XPathSearchBox"; - this._XPathSearchBox.Size = new System.Drawing.Size (53, 16); - this._XPathSearchBox.TabIndex = 16; - this._XPathSearchBox.TabStop = true; - this._XPathSearchBox.Text = "XPath"; - this._XPathSearchBox.UseVisualStyleBackColor = true; - this._XPathSearchBox.CheckedChanged += new System.EventHandler (this.MatchModeChanged); - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point (12, 110); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size (65, 12); - this.label4.TabIndex = 17; - this.label4.Text = "替换范围:"; - // - // _ReplaceInSelectionBox - // - this._ReplaceInSelectionBox.AutoSize = true; - this._ReplaceInSelectionBox.Location = new System.Drawing.Point (0, 0); - this._ReplaceInSelectionBox.Name = "_ReplaceInSelectionBox"; - this._ReplaceInSelectionBox.Size = new System.Drawing.Size (83, 16); - this._ReplaceInSelectionBox.TabIndex = 18; - this._ReplaceInSelectionBox.TabStop = true; - this._ReplaceInSelectionBox.Text = "选中的书签"; - this._ReplaceInSelectionBox.UseVisualStyleBackColor = true; - this._ReplaceInSelectionBox.CheckedChanged += new System.EventHandler (this.ReplaceModeChanged); - // - // _ReplaceInAllBox - // - this._ReplaceInAllBox.AutoSize = true; - this._ReplaceInAllBox.Location = new System.Drawing.Point (100, 0); - this._ReplaceInAllBox.Name = "_ReplaceInAllBox"; - this._ReplaceInAllBox.Size = new System.Drawing.Size (71, 16); - this._ReplaceInAllBox.TabIndex = 19; - this._ReplaceInAllBox.TabStop = true; - this._ReplaceInAllBox.Text = "所有书签"; - this._ReplaceInAllBox.UseVisualStyleBackColor = true; - this._ReplaceInAllBox.CheckedChanged += new System.EventHandler (this.ReplaceModeChanged); - // - // panel1 - // - this.panel1.Controls.Add (this._ReplaceInAllBox); - this.panel1.Controls.Add (this._ReplaceInSelectionBox); - this.panel1.Location = new System.Drawing.Point (83, 108); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size (268, 16); - this.panel1.TabIndex = 20; - // - // panel2 - // - this.panel2.Controls.Add (this._NormalSearchBox); - this.panel2.Controls.Add (this._XPathSearchBox); - this.panel2.Controls.Add (this._RegexSearchBox); - this.panel2.Location = new System.Drawing.Point (83, 60); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size (268, 16); - this.panel2.TabIndex = 21; - // - // _SearchNextButton - // - this._SearchNextButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._SearchNextButton.Location = new System.Drawing.Point (357, 39); - this._SearchNextButton.Name = "_SearchNextButton"; - this._SearchNextButton.Size = new System.Drawing.Size (99, 23); - this._SearchNextButton.TabIndex = 2; - this._SearchNextButton.Text = "搜索下一个(&X)"; - this._SearchNextButton.UseVisualStyleBackColor = true; - this._SearchNextButton.Click += new System.EventHandler (this._SearchButton_Click); - // - // _ReplaceTextBox - // - this._ReplaceTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ReplaceTextBox.Contents = null; - this._ReplaceTextBox.FormattingEnabled = true; - this._ReplaceTextBox.Location = new System.Drawing.Point (83, 82); - this._ReplaceTextBox.MaxItemCount = 16; - this._ReplaceTextBox.Name = "_ReplaceTextBox"; - this._ReplaceTextBox.Size = new System.Drawing.Size (268, 20); - this._ReplaceTextBox.TabIndex = 12; - // - // _SearchTextBox - // - this._SearchTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._SearchTextBox.Contents = null; - this._SearchTextBox.FormattingEnabled = true; - this._SearchTextBox.Location = new System.Drawing.Point (83, 12); - this._SearchTextBox.MaxItemCount = 16; - this._SearchTextBox.Name = "_SearchTextBox"; - this._SearchTextBox.Size = new System.Drawing.Size (268, 20); - this._SearchTextBox.TabIndex = 11; - // - // _CloseButton - // - this._CloseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._CloseButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this._CloseButton.Location = new System.Drawing.Point (357, 105); - this._CloseButton.Name = "_CloseButton"; - this._CloseButton.Size = new System.Drawing.Size (99, 23); - this._CloseButton.TabIndex = 5; - this._CloseButton.Text = "关闭"; - this._CloseButton.UseVisualStyleBackColor = true; - this._CloseButton.Click += new System.EventHandler (this._CloseButton_Click); - // - // SearchBookmarkForm - // - this.AcceptButton = this._SearchButton; - this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this._CloseButton; - this.ClientSize = new System.Drawing.Size (467, 162); - this.Controls.Add (this.label4); - this.Controls.Add (this.label3); - this.Controls.Add (this._ReplaceTextBox); - this.Controls.Add (this._SearchTextBox); - this.Controls.Add (this._ResultLabel); - this.Controls.Add (this.label2); - this.Controls.Add (this._FullMatchBox); - this.Controls.Add (this._MatchCaseBox); - this.Controls.Add (this.label1); - this.Controls.Add (this._CloseButton); - this.Controls.Add (this._ReplaceButton); - this.Controls.Add (this._SearchNextButton); - this.Controls.Add (this._SearchButton); - this.Controls.Add (this.panel1); - this.Controls.Add (this.panel2); - this.MaximizeBox = false; - this.MaximumSize = new System.Drawing.Size (999, 200); - this.MinimizeBox = false; - this.Name = "SearchBookmarkForm"; - this.ShowIcon = false; - this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "查找、替换书签项"; - this.Load += new System.EventHandler (this.SearchBookmarkForm_Load); - this.panel1.ResumeLayout (false); - this.panel1.PerformLayout (); - this.panel2.ResumeLayout (false); - this.panel2.PerformLayout (); - this.ResumeLayout (false); - this.PerformLayout (); - - } - - #endregion - - private System.Windows.Forms.Button _SearchButton; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.CheckBox _MatchCaseBox; - private System.Windows.Forms.CheckBox _FullMatchBox; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Button _ReplaceButton; - private System.Windows.Forms.Label _ResultLabel; - private HistoryComboBox _SearchTextBox; - private HistoryComboBox _ReplaceTextBox; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.RadioButton _NormalSearchBox; - private System.Windows.Forms.RadioButton _RegexSearchBox; - private System.Windows.Forms.RadioButton _XPathSearchBox; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.RadioButton _ReplaceInSelectionBox; - private System.Windows.Forms.RadioButton _ReplaceInAllBox; - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Panel panel2; - private System.Windows.Forms.Button _SearchNextButton; - private System.Windows.Forms.Button _CloseButton; - } -} - diff --git a/pdfpatcher/App/Functions/Editor/SearchBookmarkForm.cs b/pdfpatcher/App/Functions/Editor/SearchBookmarkForm.cs deleted file mode 100644 index 60fba37fb02f9473df991b8f38c7693857c9d410..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/SearchBookmarkForm.cs +++ /dev/null @@ -1,174 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Windows.Forms; -using System.Xml; -using PDFPatcher.Processor; - -namespace PDFPatcher.Functions -{ - sealed partial class SearchBookmarkForm : Form - { - static BookmarkMatcher.MatcherType _matcherType = BookmarkMatcher.MatcherType.Normal; - static bool _replaceInSelection = true; - - //static char[] __TrimChars = new char[] { ' ', '\t', '\r', '\n', ' ' }; - readonly Editor.Controller _controller; - internal SearchBookmarkForm(Editor.Controller controller) { - InitializeComponent(); - _controller = controller; - } - - void _SearchTextBox_TextChanged(object sender, EventArgs e) { - _ResultLabel.Text = String.Empty; - } - - private void SearchBookmarkForm_Load(object sender, EventArgs e) { - MinimumSize = Size; - ShowInTaskbar = false; - _SearchTextBox.Contents = AppContext.Recent.SearchPatterns; - _ReplaceTextBox.Contents = AppContext.Recent.ReplacePatterns; - var b = _NormalSearchBox; - switch (_matcherType) { - case BookmarkMatcher.MatcherType.Normal: - goto default; - case BookmarkMatcher.MatcherType.Regex: - b = _RegexSearchBox; - goto default; - case BookmarkMatcher.MatcherType.XPath: - b = _XPathSearchBox; - goto default; - default: - b.Checked = true; - break; - } - if (_replaceInSelection) { - _ReplaceInSelectionBox.Checked = true; - } - else { - _ReplaceInAllBox.Checked = true; - } - _SearchTextBox.TextChanged += new EventHandler(_SearchTextBox_TextChanged); - } - - BookmarkMatcher CreateMatcher() { - return BookmarkMatcher.Create(_SearchTextBox.Text, - _RegexSearchBox.Checked ? BookmarkMatcher.MatcherType.Regex - : _XPathSearchBox.Checked ? BookmarkMatcher.MatcherType.XPath - : BookmarkMatcher.MatcherType.Normal, - _MatchCaseBox.Checked, - _FullMatchBox.Checked); - } - - private void _SearchButton_Click(Object sender, EventArgs args) { - if (String.IsNullOrEmpty(_SearchTextBox.Text)) { - Common.FormHelper.InfoBox("请先输入查询关键字。"); - return; - } - BookmarkMatcher matcher; - try { - matcher = CreateMatcher(); - } - catch (Exception ex) { - Common.FormHelper.ErrorBox("搜索表达式有误:" + ex.Message); - return; - } - _SearchTextBox.AddHistoryItem(); - if (sender == _SearchButton) { - var matches = _controller.View.Bookmark.SearchBookmarks(matcher); - if (matches.Count > 0) { - _ResultLabel.Text = "找到 " + matches.Count + " 个匹配的书签。"; - _controller.View.Bookmark.FindForm().Activate(); - } - else { - _ResultLabel.Text = "没有找到任何匹配的书签。"; - } - } - else { - var m = _controller.View.Bookmark.SearchBookmark(matcher); - if (m == null) { - _ResultLabel.Text = "没有找到对应的书签。"; - } - else { - _ResultLabel.Text = String.Empty; - } - } - } - - - private void _ReplaceButton_Click(object sender, EventArgs e) { - BookmarkMatcher matcher; - try { - matcher = CreateMatcher(); - } - catch (Exception ex) { - Common.FormHelper.ErrorBox("搜索表达式有误:" + ex.Message); - return; - } - int i = ReplaceBookmarks(_replaceInSelection, matcher, _ReplaceTextBox.Text); - _ResultLabel.Text = i > 0 ? "替换了 " + i + " 个匹配的书签。" : "没有替换任何书签。"; - _SearchTextBox.AddHistoryItem(); - _ReplaceTextBox.AddHistoryItem(); - } - - private void _CloseButton_Click(Object source, EventArgs args) { - DialogResult = DialogResult.Cancel; - Close(); - } - - private void MatchModeChanged(object sender, EventArgs e) { - if (_NormalSearchBox.Checked) { - _matcherType = BookmarkMatcher.MatcherType.Normal; - } - else if (_RegexSearchBox.Checked) { - _matcherType = BookmarkMatcher.MatcherType.Regex; - } - else if (_XPathSearchBox.Checked) { - _matcherType = BookmarkMatcher.MatcherType.XPath; - } - _MatchCaseBox.Enabled = _FullMatchBox.Enabled = _ReplaceButton.Enabled = _ReplaceTextBox.Enabled = !_XPathSearchBox.Checked; - } - - private void ReplaceModeChanged(object sender, EventArgs e) { - _replaceInSelection = _ReplaceInSelectionBox.Checked; - } - - private int ReplaceBookmarks(bool replaceInSelection, BookmarkMatcher matcher, string replacement) { - var b = _controller.View.Bookmark; - if (b.GetItemCount() == 0) { - return 0; - } - - var si = new List(); - var ol = replaceInSelection ? b.SelectedObjects : (b.GetModelObject(0) as XmlElement).ParentNode.SelectNodes(".//" + Constants.Bookmark) as IEnumerable; - foreach (XmlNode item in ol) { - si.Add(item); - } - var undo = new UndoActionGroup(); - var p = new ReplaceTitleTextProcessor(matcher, replacement); - try { - XmlElement x; - foreach (XmlNode item in si) { - x = item as XmlElement; - if (x == null) { - continue; - } - undo.Add(p.Process(x)); - } - } - catch (Exception ex) { - Common.FormHelper.ErrorBox("在替换匹配文本时出现错误:" + ex.Message); - } - if (undo.Count > 0) { - _controller.Model.Undo.AddUndo(p.Name, undo); - si.Clear(); - si.AddRange(undo.AffectedElements); - b.RefreshObjects(si); - return si.Count; - } - return 0; - } - - - } -} diff --git a/pdfpatcher/App/Functions/Editor/SearchBookmarkForm.resx b/pdfpatcher/App/Functions/Editor/SearchBookmarkForm.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/SearchBookmarkForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/Editor/ShiftPageNumberEntryForm.Designer.cs b/pdfpatcher/App/Functions/Editor/ShiftPageNumberEntryForm.Designer.cs deleted file mode 100644 index a37dd3df5a89d7059a85a52c96f9f51677e1a811..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/ShiftPageNumberEntryForm.Designer.cs +++ /dev/null @@ -1,116 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class ShiftPageNumberEntryForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._OkButton = new System.Windows.Forms.Button(); - this._CancelButton = new System.Windows.Forms.Button(); - this._MessageLabel = new System.Windows.Forms.Label(); - this._ShiftNumberBox = new System.Windows.Forms.NumericUpDown(); - ((System.ComponentModel.ISupportInitialize)(this._ShiftNumberBox)).BeginInit(); - this.SuspendLayout(); - // - // _OkButton - // - this._OkButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._OkButton.Location = new System.Drawing.Point(128, 71); - this._OkButton.Name = "_OkButton"; - this._OkButton.Size = new System.Drawing.Size(75, 23); - this._OkButton.TabIndex = 0; - this._OkButton.Text = "确定(&Q)"; - this._OkButton.UseVisualStyleBackColor = true; - this._OkButton.Click += new System.EventHandler(this._OkButton_Click); - // - // _CancelButton - // - this._CancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this._CancelButton.Location = new System.Drawing.Point(209, 71); - this._CancelButton.Name = "_CancelButton"; - this._CancelButton.Size = new System.Drawing.Size(75, 23); - this._CancelButton.TabIndex = 1; - this._CancelButton.Text = "取消(&X)"; - this._CancelButton.UseVisualStyleBackColor = true; - this._CancelButton.Click += new System.EventHandler(this._CancelButton_Click); - // - // _MessageLabel - // - this._MessageLabel.AutoSize = true; - this._MessageLabel.Location = new System.Drawing.Point(12, 27); - this._MessageLabel.Name = "_MessageLabel"; - this._MessageLabel.Size = new System.Drawing.Size(197, 24); - this._MessageLabel.TabIndex = 2; - this._MessageLabel.Text = "在此输入需要增加或减少的页数\r\n(正数增加页码,负数减少页码):"; - // - // _ShiftNumberBox - // - this._ShiftNumberBox.Location = new System.Drawing.Point(215, 27); - this._ShiftNumberBox.Maximum = new decimal(new int[] { - 999, - 0, - 0, - 0}); - this._ShiftNumberBox.Minimum = new decimal(new int[] { - 999, - 0, - 0, - -2147483648}); - this._ShiftNumberBox.Name = "_ShiftNumberBox"; - this._ShiftNumberBox.Size = new System.Drawing.Size(68, 21); - this._ShiftNumberBox.TabIndex = 3; - this._ShiftNumberBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // ShiftPageNumberEntryForm - // - this.AcceptButton = this._OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this._CancelButton; - this.ClientSize = new System.Drawing.Size(296, 106); - this.Controls.Add(this._ShiftNumberBox); - this.Controls.Add(this._MessageLabel); - this.Controls.Add(this._CancelButton); - this.Controls.Add(this._OkButton); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "ShiftPageNumberEntryForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "增加或减少页码"; - ((System.ComponentModel.ISupportInitialize)(this._ShiftNumberBox)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Button _OkButton; - private System.Windows.Forms.Button _CancelButton; - private System.Windows.Forms.Label _MessageLabel; - private System.Windows.Forms.NumericUpDown _ShiftNumberBox; - } -} - diff --git a/pdfpatcher/App/Functions/Editor/ShiftPageNumberEntryForm.cs b/pdfpatcher/App/Functions/Editor/ShiftPageNumberEntryForm.cs deleted file mode 100644 index d1147f9bf98787f921d45de317a853f0289089cf..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/ShiftPageNumberEntryForm.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Windows.Forms; - -namespace PDFPatcher.Functions -{ - sealed partial class ShiftPageNumberEntryForm : Form - { - internal int ShiftNumber => (int)_ShiftNumberBox.Value; - - public ShiftPageNumberEntryForm() { - InitializeComponent(); - } - - void _OkButton_Click(Object source, EventArgs args) { - DialogResult = DialogResult.OK; - Close(); - } - - void _CancelButton_Click(Object source, EventArgs args) { - DialogResult = DialogResult.Cancel; - Close(); - } - } -} diff --git a/pdfpatcher/App/Functions/Editor/ShiftPageNumberEntryForm.resx b/pdfpatcher/App/Functions/Editor/ShiftPageNumberEntryForm.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/ShiftPageNumberEntryForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/Editor/ViewerStructures.cs b/pdfpatcher/App/Functions/Editor/ViewerStructures.cs deleted file mode 100644 index 9fcb7d8d22729954445170074f9fcb9dd176ebd7..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/ViewerStructures.cs +++ /dev/null @@ -1,197 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Text; -using PDFPatcher.Common; -using MuPdfSharp; -using DrawingPoint = System.Drawing.Point; - -namespace PDFPatcher.Functions.Editor -{ - public enum ContentDirection - { - TopToDown, - RightToLeft - } - - public enum MouseMode - { - Move, Selection - } - - public readonly struct PagePoint - { - public static readonly PagePoint Empty; - - public readonly int Page; - public readonly float ImageX, ImageY; - public PagePoint(int pageNumber, float imageX, float imageY) { - Page = pageNumber; - ImageX = imageX; - ImageY = imageY; - } - } - - public readonly struct PagePosition - { - public static readonly PagePosition Empty; - /// - /// 所在页码。 - /// - public readonly int Page; - /// - /// 在 PDF 页面空间上的位置。 - /// - public readonly float PageX, PageY; - /// - /// 在渲染页面上的位置。 - /// - public readonly int ImageX, ImageY; - /// - /// 当前点是否在页面上。 - /// - public readonly bool IsInPage; - public MuPdfSharp.Point Location => new MuPdfSharp.Point(PageX, PageY); - internal PagePosition(int page, PointF position, DrawingPoint imagePosition, bool isInPage) - : this(page, position.X, position.Y, imagePosition.X, imagePosition.Y, isInPage) { } - - internal PagePosition(int page, float x, float y, int imageX, int imageY, bool isInPage) { - Page = page; - PageX = x; - PageY = y; - ImageX = imageX; - ImageY = imageY; - IsInPage = isInPage; - } - } - - public readonly struct PageRegion - { - public static readonly PageRegion Empty = new PageRegion(); - - public readonly int Page; - public readonly MuPdfSharp.Rectangle Region; - - internal PageRegion(PagePosition p1, PagePosition p2) { - if (p1.Page != p2.Page) { - Page = 0; - Region = new MuPdfSharp.Rectangle(); - } - else { - Page = p1.Page; - Region = new MuPdfSharp.Rectangle(p1.PageX, p1.PageY, p2.PageX, p2.PageY); - } - } - } - - public readonly struct TextInfo : IMuTextLines, IMuTextSpans, IMuBoundedElement - { - public readonly MuPage Page; - - /// 获取文本字符的位置边框。 - public readonly MuPdfSharp.Rectangle TextBBox; - /// 获取文本位置以下的文本行。 - public readonly List Lines; - public readonly List Spans; - - public TextInfo(MuPage page, MuPdfSharp.Rectangle bbox, List textLines, List spans) { - Page = page; - TextBBox = bbox; - Lines = textLines; - Spans = spans; - } - - IEnumerable IMuTextLines.Lines => Lines; - - public MuPdfSharp.Rectangle BBox => TextBBox; - - IEnumerable IMuTextSpans.Spans => Spans; - - public IEnumerable GetFonts() { - if (Spans.HasContent() == false) { - yield break; - } - HashSet fonts = new HashSet(); - foreach (var span in Spans) { - if (fonts.Add(span.FontID)) { - yield return Page.GetFont(span); - } - } - } - - public IEnumerable GetFontNames() { - if (Spans.HasContent() == false) { - yield break; - } - HashSet fonts = new HashSet(); - foreach (var span in Spans) { - var f = Page.GetFont(span); - if (fonts.Add(f.Name)) { - yield return f.Name; - } - } - } - - public override string ToString() { - if (Lines == null) { - return null; - } - var c = Lines.Count; - if (c == 1) { - return Lines[0].Text; - } - var sb = new StringBuilder(); - var b = Lines[0].BBox; - foreach (var line in Lines) { - if (line.BBox.IsHorizontalNeighbor(b)) { - sb.Append(line.Text); - b = b.Union(line.BBox); - } - else { - b = line.BBox; - sb.AppendLine(); - sb.Append(line.Text); - } - } - return sb.ToString(); - } - } - - public readonly struct Selection - { - readonly RenderResultCache _cache; - public static readonly Selection Empty; - - /// - /// 获取选中区域的页码。 - /// - public readonly int Page; - /// - /// 获取选中区域在页面上的矩形区域(屏幕左下角点坐标为0,0)。 - /// - public readonly MuPdfSharp.Rectangle PageRegion; - /// - /// 获取选中区域在显示图片上的矩形区域。 - /// - public readonly RectangleF ImageRegion; - - public Bitmap GetSelectedBitmap() { - _cache.LoadPage(Page); - var p = _cache.GetBitmap(Page); - var clip = new MuPdfSharp.Rectangle( - ImageRegion.Left < 0 ? 0 : ImageRegion.Left, - ImageRegion.Top < 0 ? 0 : ImageRegion.Top, - ImageRegion.Right > p.Width ? p.Width : ImageRegion.Right, - ImageRegion.Bottom > p.Height ? p.Height : ImageRegion.Bottom - ); - return p.Clone(clip, p.PixelFormat); - } - - public Selection(RenderResultCache cache, int page, MuPdfSharp.Rectangle region, RectangleF imageRegion) { - Page = page; - PageRegion = region; - ImageRegion = imageRegion; - _cache = cache; - } - } -} diff --git a/pdfpatcher/App/Functions/Editor/ZoomRateEntryForm.Designer.cs b/pdfpatcher/App/Functions/Editor/ZoomRateEntryForm.Designer.cs deleted file mode 100644 index 4909da5be23913c5f9233871720bf9b6176e135b..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/ZoomRateEntryForm.Designer.cs +++ /dev/null @@ -1,120 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class ZoomRateEntryForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._OkButton = new System.Windows.Forms.Button(); - this._CancelButton = new System.Windows.Forms.Button(); - this._MessageLabel = new System.Windows.Forms.Label(); - this._ZoomRateBox = new System.Windows.Forms.ComboBox(); - this.SuspendLayout(); - // - // _OkButton - // - this._OkButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._OkButton.Location = new System.Drawing.Point(97, 74); - this._OkButton.Name = "_OkButton"; - this._OkButton.Size = new System.Drawing.Size(75, 23); - this._OkButton.TabIndex = 0; - this._OkButton.Text = "确定(&Q)"; - this._OkButton.UseVisualStyleBackColor = true; - this._OkButton.Click += new System.EventHandler(this._OkButton_Click); - // - // _CancelButton - // - this._CancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this._CancelButton.Location = new System.Drawing.Point(178, 74); - this._CancelButton.Name = "_CancelButton"; - this._CancelButton.Size = new System.Drawing.Size(75, 23); - this._CancelButton.TabIndex = 1; - this._CancelButton.Text = "取消(&X)"; - this._CancelButton.UseVisualStyleBackColor = true; - this._CancelButton.Click += new System.EventHandler(this._CancelButton_Click); - // - // _MessageLabel - // - this._MessageLabel.AutoSize = true; - this._MessageLabel.Location = new System.Drawing.Point(12, 33); - this._MessageLabel.Name = "_MessageLabel"; - this._MessageLabel.Size = new System.Drawing.Size(113, 12); - this._MessageLabel.TabIndex = 2; - this._MessageLabel.Text = "在此输入缩放比例:"; - // - // _ZoomRateBox - // - this._ZoomRateBox.FormattingEnabled = true; - this._ZoomRateBox.Items.AddRange(new object[] { - "1", - "保持不变", - "——————", - "4", - "3", - "2", - "1.5", - "1.3", - "1.2", - "1", - "0.9", - "0.8", - "0.5", - "0.3", - "0.2"}); - this._ZoomRateBox.Location = new System.Drawing.Point(131, 30); - this._ZoomRateBox.Name = "_ZoomRateBox"; - this._ZoomRateBox.Size = new System.Drawing.Size(121, 20); - this._ZoomRateBox.TabIndex = 3; - // - // ZoomRateEntryForm - // - this.AcceptButton = this._OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this._CancelButton; - this.ClientSize = new System.Drawing.Size(265, 109); - this.Controls.Add(this._ZoomRateBox); - this.Controls.Add(this._MessageLabel); - this.Controls.Add(this._CancelButton); - this.Controls.Add(this._OkButton); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "ZoomRateEntryForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "输入缩放比例"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Button _OkButton; - private System.Windows.Forms.Button _CancelButton; - private System.Windows.Forms.Label _MessageLabel; - private System.Windows.Forms.ComboBox _ZoomRateBox; - } -} - diff --git a/pdfpatcher/App/Functions/Editor/ZoomRateEntryForm.cs b/pdfpatcher/App/Functions/Editor/ZoomRateEntryForm.cs deleted file mode 100644 index c1f0d768d236977183771f107da5e9a5a9895d37..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/ZoomRateEntryForm.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Windows.Forms; - -namespace PDFPatcher.Functions -{ - sealed partial class ZoomRateEntryForm : Form - { - internal string ZoomRate => _ZoomRateBox.Text; - - public ZoomRateEntryForm() { - InitializeComponent(); - } - - void _OkButton_Click(Object source, EventArgs args) { - DialogResult = DialogResult.OK; - Close(); - } - - void _CancelButton_Click(Object source, EventArgs args) { - DialogResult = DialogResult.Cancel; - Close(); - } - } -} diff --git a/pdfpatcher/App/Functions/Editor/ZoomRateEntryForm.resx b/pdfpatcher/App/Functions/Editor/ZoomRateEntryForm.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/Editor/ZoomRateEntryForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/EditorControl.Designer.cs b/pdfpatcher/App/Functions/EditorControl.Designer.cs deleted file mode 100644 index 5d14a8b26d9e2ab7cb55836facd03c13c14531a0..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/EditorControl.Designer.cs +++ /dev/null @@ -1,1533 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class EditorControl - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.components = new System.ComponentModel.Container(); - System.Windows.Forms.ToolStripMenuItem _AlterPosition; - System.Windows.Forms.ToolStripMenuItem _ChangeCoordinates; - System.Windows.Forms.ToolStripMenuItem _ClearPositionX; - System.Windows.Forms.ToolStripMenuItem _ClearPositionY; - System.Windows.Forms.ToolStripMenuItem _ClearPositionXY; - System.Windows.Forms.ToolStripMenuItem _ForceInternalLink; - System.Windows.Forms.ToolStripMenuItem _SelectNone; - System.Windows.Forms.ToolStripMenuItem _InvertSelect; - System.Windows.Forms.ToolStripMenuItem _ShiftPageNumber; - System.Windows.Forms.ToolStripMenuItem _ShiftMultiPageNumber; - System.Windows.Forms.ToolStripMenuItem _IncrementPageNumber; - System.Windows.Forms.ToolStripMenuItem _DecrementPageNumber; - System.Windows.Forms.ToolStripMenuItem _MergeBookmark; - System.Windows.Forms.ToolStripMenuItem _SelectAll; - System.Windows.Forms.ToolStripSeparator toolStripSeparator3; - System.Windows.Forms.ToolStripMenuItem dummyToolStripMenuItem; - System.Windows.Forms.ToolStripButton _Copy; - System.Windows.Forms.ToolStripButton _Paste; - System.Windows.Forms.ToolStripButton _DeleteBookmark; - System.Windows.Forms.ToolStripSeparator toolStripSeparator2; - System.Windows.Forms.ToolStripButton _InsertBookmark; - System.Windows.Forms.ToolStripButton _LevelUp; - System.Windows.Forms.ToolStripButton _LevelDown; - System.Windows.Forms.ToolStripSeparator toolStripSeparator7; - System.Windows.Forms.ToolStripMenuItem _SelectItems; - System.Windows.Forms.ToolStripMenuItem _SearchReplace; - System.Windows.Forms.ToolStripMenuItem _BookmarkAction; - System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; - System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2; - System.Windows.Forms.ToolStripMenuItem toolStripMenuItem3; - System.Windows.Forms.ToolStripSeparator toolStripSeparator8; - System.Windows.Forms.ToolStripMenuItem toolStripMenuItem4; - System.Windows.Forms.ToolStripMenuItem toolStripMenuItem5; - System.Windows.Forms.ToolStripMenuItem toolStripMenuItem6; - System.Windows.Forms.ToolStripMenuItem toolStripMenuItem7; - System.Windows.Forms.ToolStripMenuItem toolStripMenuItem9; - System.Windows.Forms.ToolStripMenuItem toolStripMenuItem10; - System.Windows.Forms.ToolStripMenuItem toolStripMenuItem11; - System.Windows.Forms.ToolStripMenuItem toolStripMenuItem12; - System.Windows.Forms.ToolStripMenuItem toolStripMenuItem13; - System.Windows.Forms.ToolStripMenuItem toolStripMenuItem14; - System.Windows.Forms.ToolStripMenuItem toolStripMenuItem15; - System.Windows.Forms.ToolStripMenuItem toolStripMenuItem16; - System.Windows.Forms.ToolStripMenuItem toolStripMenuItem17; - System.Windows.Forms.ToolStripMenuItem toolStripMenuItem18; - System.Windows.Forms.ToolStripMenuItem toolStripMenuItem19; - System.Windows.Forms.ToolStripSeparator toolStripSeparator10; - System.Windows.Forms.ToolStripButton _FirstPage; - System.Windows.Forms.ToolStripButton _PreviousPage; - System.Windows.Forms.ToolStripButton _NextPage; - System.Windows.Forms.ToolStripButton _LastPage; - System.Windows.Forms.ToolStripMenuItem _MoveMode; - System.Windows.Forms.ToolStripMenuItem _SelectionMode; - System.Windows.Forms.ToolStripSeparator toolStripSeparator1; - System.Windows.Forms.ToolStripMenuItem _ScrollVertical; - System.Windows.Forms.ToolStripMenuItem _ScrollHorizontal; - System.Windows.Forms.ToolStripMenuItem _FullPageScroll; - System.Windows.Forms.ToolStripSeparator toolStripSeparator6; - System.Windows.Forms.ToolStripMenuItem _TrueColorSpace; - System.Windows.Forms.ToolStripMenuItem _GrayColorSpace; - System.Windows.Forms.ToolStripMenuItem _InvertColor; - System.Windows.Forms.ToolStripMenuItem _BookmarkHere; - System.Windows.Forms.ToolStripMenuItem _CopySelection; - System.Windows.Forms.ToolStripSeparator toolStripSeparator11; - System.Windows.Forms.ToolStripMenuItem _OcrDisabled; - System.Windows.Forms.ToolStripMenuItem _ShowTextBorders; - System.Windows.Forms.ToolStripMenuItem _DarkMode; - System.Windows.Forms.ToolStripSeparator toolStripSeparator12; - System.Windows.Forms.ToolStripMenuItem _GreenMode; - System.Windows.Forms.ToolStripMenuItem _ShowBookmarks; - System.Windows.Forms.ToolStripMenuItem _InsertPageLabel; - System.Windows.Forms.ToolStripMenuItem _AutoBookmark; - System.Windows.Forms.ToolStripMenuItem _SetOpenStatusTrue; - System.Windows.Forms.ToolStripMenuItem _SetOpenStatusFalse; - System.Windows.Forms.ToolStripMenuItem _OcrDetectPunctuation; - System.Windows.Forms.ToolStripMenuItem _FullScreen; - System.Windows.Forms.ToolStripMenuItem _PageProperties; - System.Windows.Forms.ToolStripMenuItem _MarkBookmark; - System.Windows.Forms.ToolStripMenuItem _MarkBookmarkRed; - System.Windows.Forms.ToolStripMenuItem _MarkBookmarkYellow; - System.Windows.Forms.ToolStripMenuItem _MarkBookmarkGreen; - System.Windows.Forms.ToolStripMenuItem _MarkBookmarkBlue; - System.Windows.Forms.ToolStripMenuItem _MarkBookmarkPurple; - System.Windows.Forms.ToolStripSeparator toolStripSeparator5; - System.Windows.Forms.ToolStripMenuItem _UnmarkBookmark; - System.Windows.Forms.ToolStripMenuItem _ClearBookmarkMarks; - System.Windows.Forms.ToolStripMenuItem _SelectMarkedBookmarks; - System.Windows.Forms.ToolStripMenuItem _SelectRedMarks; - System.Windows.Forms.ToolStripMenuItem _SelectYellowMarks; - System.Windows.Forms.ToolStripMenuItem _SelectGreenMarks; - System.Windows.Forms.ToolStripMenuItem _SelectCyanMarks; - System.Windows.Forms.ToolStripMenuItem _SelectBlueMarks; - System.Windows.Forms.ToolStripMenuItem _SelectPurpleMarks; - System.Windows.Forms.ToolStripSeparator toolStripSeparator14; - System.Windows.Forms.ToolStripSeparator toolStripSeparator13; - System.Windows.Forms.ToolStripSeparator toolStripSeparator4; - System.Windows.Forms.ToolStripButton _EditorOptions; - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditorControl)); - this._SetCurrentCoordinates = new System.Windows.Forms.ToolStripMenuItem(); - this._SelectionMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._CollapseAll = new System.Windows.Forms.ToolStripMenuItem(); - this._CollapseChildren = new System.Windows.Forms.ToolStripMenuItem(); - this._ExpandAll = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItem8 = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator(); - this._MarkBookmarkCyan = new System.Windows.Forms.ToolStripMenuItem(); - this._ViewerButton = new System.Windows.Forms.ToolStripDropDownButton(); - this._OcrMenu = new System.Windows.Forms.ToolStripMenuItem(); - this._InsertWithOcrOnly = new System.Windows.Forms.ToolStripMenuItem(); - this._ShowAnnotations = new System.Windows.Forms.ToolStripMenuItem(); - this._EditMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._SetOpenStatus = new System.Windows.Forms.ToolStripMenuItem(); - this._ChangeZoomRate = new System.Windows.Forms.ToolStripMenuItem(); - this._ChangeCase = new System.Windows.Forms.ToolStripMenuItem(); - this._QuickSelect = new System.Windows.Forms.ToolStripMenuItem(); - this._RecentFileMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._AddFilesButton = new System.Windows.Forms.ToolStripSplitButton(); - this._UndoMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._UndoButton = new System.Windows.Forms.ToolStripSplitButton(); - this._IncludeDecendantBox = new System.Windows.Forms.CheckBox(); - this._BookmarkBox = new PDFPatcher.Functions.BookmarkEditorView(); - this._MainPanel = new System.Windows.Forms.SplitContainer(); - this._PageInfoBox = new System.Windows.Forms.Label(); - this._ViewerBox = new PDFPatcher.Functions.PdfViewerControl(); - this._ViewerMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._OcrPage = new System.Windows.Forms.ToolStripMenuItem(); - this._SavePageImage = new System.Windows.Forms.ToolStripMenuItem(); - this._BookmarkToolbar = new System.Windows.Forms.ToolStrip(); - this._SavePDF = new System.Windows.Forms.ToolStripButton(); - this._SaveBookmark = new System.Windows.Forms.ToolStripButton(); - this._BookmarkBoldButton = new System.Windows.Forms.ToolStripButton(); - this._BookmarkItalicButton = new System.Windows.Forms.ToolStripButton(); - this._BookmarkColorButton = new ColorPicker.ToolStripColorPicker(); - this.toolStripMenuItem20 = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItem21 = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItem22 = new System.Windows.Forms.ToolStripMenuItem(); - this._ViewerToolbar = new System.Windows.Forms.ToolStrip(); - this._CurrentPageBox = new System.Windows.Forms.ToolStripTextBox(); - this._ZoomBox = new System.Windows.Forms.ToolStripComboBox(); - _AlterPosition = new System.Windows.Forms.ToolStripMenuItem(); - _ChangeCoordinates = new System.Windows.Forms.ToolStripMenuItem(); - _ClearPositionX = new System.Windows.Forms.ToolStripMenuItem(); - _ClearPositionY = new System.Windows.Forms.ToolStripMenuItem(); - _ClearPositionXY = new System.Windows.Forms.ToolStripMenuItem(); - _ForceInternalLink = new System.Windows.Forms.ToolStripMenuItem(); - _SelectNone = new System.Windows.Forms.ToolStripMenuItem(); - _InvertSelect = new System.Windows.Forms.ToolStripMenuItem(); - _ShiftPageNumber = new System.Windows.Forms.ToolStripMenuItem(); - _ShiftMultiPageNumber = new System.Windows.Forms.ToolStripMenuItem(); - _IncrementPageNumber = new System.Windows.Forms.ToolStripMenuItem(); - _DecrementPageNumber = new System.Windows.Forms.ToolStripMenuItem(); - _MergeBookmark = new System.Windows.Forms.ToolStripMenuItem(); - _SelectAll = new System.Windows.Forms.ToolStripMenuItem(); - toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); - dummyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - _Copy = new System.Windows.Forms.ToolStripButton(); - _Paste = new System.Windows.Forms.ToolStripButton(); - _DeleteBookmark = new System.Windows.Forms.ToolStripButton(); - toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - _InsertBookmark = new System.Windows.Forms.ToolStripButton(); - _LevelUp = new System.Windows.Forms.ToolStripButton(); - _LevelDown = new System.Windows.Forms.ToolStripButton(); - toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator(); - _SelectItems = new System.Windows.Forms.ToolStripMenuItem(); - _SearchReplace = new System.Windows.Forms.ToolStripMenuItem(); - _BookmarkAction = new System.Windows.Forms.ToolStripMenuItem(); - toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); - toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem(); - toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator(); - toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem(); - toolStripMenuItem5 = new System.Windows.Forms.ToolStripMenuItem(); - toolStripMenuItem6 = new System.Windows.Forms.ToolStripMenuItem(); - toolStripMenuItem7 = new System.Windows.Forms.ToolStripMenuItem(); - toolStripMenuItem9 = new System.Windows.Forms.ToolStripMenuItem(); - toolStripMenuItem10 = new System.Windows.Forms.ToolStripMenuItem(); - toolStripMenuItem11 = new System.Windows.Forms.ToolStripMenuItem(); - toolStripMenuItem12 = new System.Windows.Forms.ToolStripMenuItem(); - toolStripMenuItem13 = new System.Windows.Forms.ToolStripMenuItem(); - toolStripMenuItem14 = new System.Windows.Forms.ToolStripMenuItem(); - toolStripMenuItem15 = new System.Windows.Forms.ToolStripMenuItem(); - toolStripMenuItem16 = new System.Windows.Forms.ToolStripMenuItem(); - toolStripMenuItem17 = new System.Windows.Forms.ToolStripMenuItem(); - toolStripMenuItem18 = new System.Windows.Forms.ToolStripMenuItem(); - toolStripMenuItem19 = new System.Windows.Forms.ToolStripMenuItem(); - toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator(); - _FirstPage = new System.Windows.Forms.ToolStripButton(); - _PreviousPage = new System.Windows.Forms.ToolStripButton(); - _NextPage = new System.Windows.Forms.ToolStripButton(); - _LastPage = new System.Windows.Forms.ToolStripButton(); - _MoveMode = new System.Windows.Forms.ToolStripMenuItem(); - _SelectionMode = new System.Windows.Forms.ToolStripMenuItem(); - toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - _ScrollVertical = new System.Windows.Forms.ToolStripMenuItem(); - _ScrollHorizontal = new System.Windows.Forms.ToolStripMenuItem(); - _FullPageScroll = new System.Windows.Forms.ToolStripMenuItem(); - toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator(); - _TrueColorSpace = new System.Windows.Forms.ToolStripMenuItem(); - _GrayColorSpace = new System.Windows.Forms.ToolStripMenuItem(); - _InvertColor = new System.Windows.Forms.ToolStripMenuItem(); - _BookmarkHere = new System.Windows.Forms.ToolStripMenuItem(); - _CopySelection = new System.Windows.Forms.ToolStripMenuItem(); - toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator(); - _OcrDisabled = new System.Windows.Forms.ToolStripMenuItem(); - _ShowTextBorders = new System.Windows.Forms.ToolStripMenuItem(); - _DarkMode = new System.Windows.Forms.ToolStripMenuItem(); - toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator(); - _GreenMode = new System.Windows.Forms.ToolStripMenuItem(); - _ShowBookmarks = new System.Windows.Forms.ToolStripMenuItem(); - _InsertPageLabel = new System.Windows.Forms.ToolStripMenuItem(); - _AutoBookmark = new System.Windows.Forms.ToolStripMenuItem(); - _SetOpenStatusTrue = new System.Windows.Forms.ToolStripMenuItem(); - _SetOpenStatusFalse = new System.Windows.Forms.ToolStripMenuItem(); - _OcrDetectPunctuation = new System.Windows.Forms.ToolStripMenuItem(); - _FullScreen = new System.Windows.Forms.ToolStripMenuItem(); - _PageProperties = new System.Windows.Forms.ToolStripMenuItem(); - _MarkBookmark = new System.Windows.Forms.ToolStripMenuItem(); - _MarkBookmarkRed = new System.Windows.Forms.ToolStripMenuItem(); - _MarkBookmarkYellow = new System.Windows.Forms.ToolStripMenuItem(); - _MarkBookmarkGreen = new System.Windows.Forms.ToolStripMenuItem(); - _MarkBookmarkBlue = new System.Windows.Forms.ToolStripMenuItem(); - _MarkBookmarkPurple = new System.Windows.Forms.ToolStripMenuItem(); - toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); - _UnmarkBookmark = new System.Windows.Forms.ToolStripMenuItem(); - _ClearBookmarkMarks = new System.Windows.Forms.ToolStripMenuItem(); - _SelectMarkedBookmarks = new System.Windows.Forms.ToolStripMenuItem(); - _SelectRedMarks = new System.Windows.Forms.ToolStripMenuItem(); - _SelectYellowMarks = new System.Windows.Forms.ToolStripMenuItem(); - _SelectGreenMarks = new System.Windows.Forms.ToolStripMenuItem(); - _SelectCyanMarks = new System.Windows.Forms.ToolStripMenuItem(); - _SelectBlueMarks = new System.Windows.Forms.ToolStripMenuItem(); - _SelectPurpleMarks = new System.Windows.Forms.ToolStripMenuItem(); - toolStripSeparator14 = new System.Windows.Forms.ToolStripSeparator(); - toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator(); - toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); - _EditorOptions = new System.Windows.Forms.ToolStripButton(); - this._SelectionMenu.SuspendLayout(); - this._EditMenu.SuspendLayout(); - this._RecentFileMenu.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._BookmarkBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this._MainPanel)).BeginInit(); - this._MainPanel.Panel1.SuspendLayout(); - this._MainPanel.Panel2.SuspendLayout(); - this._MainPanel.SuspendLayout(); - this._ViewerMenu.SuspendLayout(); - this._BookmarkToolbar.SuspendLayout(); - this._ViewerToolbar.SuspendLayout(); - this.SuspendLayout(); - // - // _AlterPosition - // - _AlterPosition.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - _ChangeCoordinates, - this._SetCurrentCoordinates, - _ClearPositionX, - _ClearPositionY, - _ClearPositionXY}); - _AlterPosition.Image = global::PDFPatcher.Properties.Resources.ScrollPosition; - _AlterPosition.Name = "_AlterPosition"; - _AlterPosition.Size = new System.Drawing.Size(211, 22); - _AlterPosition.Text = "更改目标页面坐标(&Y)"; - _AlterPosition.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _ChangeCoordinates - // - _ChangeCoordinates.Image = global::PDFPatcher.Properties.Resources.ScrollPosition; - _ChangeCoordinates.Name = "_ChangeCoordinates"; - _ChangeCoordinates.Size = new System.Drawing.Size(184, 22); - _ChangeCoordinates.Text = "更改坐标(&B)..."; - // - // _SetCurrentCoordinates - // - this._SetCurrentCoordinates.Image = global::PDFPatcher.Properties.Resources.Pin; - this._SetCurrentCoordinates.Name = "_SetCurrentCoordinates"; - this._SetCurrentCoordinates.Size = new System.Drawing.Size(184, 22); - this._SetCurrentCoordinates.Text = "设为当前页坐标(&S)"; - // - // _ClearPositionX - // - _ClearPositionX.Name = "_ClearPositionX"; - _ClearPositionX.Size = new System.Drawing.Size(184, 22); - _ClearPositionX.Text = "清除横坐标"; - // - // _ClearPositionY - // - _ClearPositionY.Name = "_ClearPositionY"; - _ClearPositionY.Size = new System.Drawing.Size(184, 22); - _ClearPositionY.Text = "清除纵坐标"; - // - // _ClearPositionXY - // - _ClearPositionXY.Name = "_ClearPositionXY"; - _ClearPositionXY.Size = new System.Drawing.Size(184, 22); - _ClearPositionXY.Text = "清除横坐标与纵坐标"; - // - // _ForceInternalLink - // - _ForceInternalLink.Name = "_ForceInternalLink"; - _ForceInternalLink.Size = new System.Drawing.Size(211, 22); - _ForceInternalLink.Text = "强制设置为文件内链接"; - // - // _SelectNone - // - _SelectNone.Name = "_SelectNone"; - _SelectNone.Size = new System.Drawing.Size(148, 22); - _SelectNone.Text = "全部不选"; - // - // _InvertSelect - // - _InvertSelect.Name = "_InvertSelect"; - _InvertSelect.Size = new System.Drawing.Size(148, 22); - _InvertSelect.Text = "反转选择状态"; - // - // _ShiftPageNumber - // - _ShiftPageNumber.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - _ShiftMultiPageNumber, - _IncrementPageNumber, - _DecrementPageNumber}); - _ShiftPageNumber.Image = global::PDFPatcher.Properties.Resources.PageRange; - _ShiftPageNumber.Name = "_ShiftPageNumber"; - _ShiftPageNumber.Size = new System.Drawing.Size(211, 22); - _ShiftPageNumber.Text = "更改目标页码(&M)"; - _ShiftPageNumber.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _ShiftMultiPageNumber - // - _ShiftMultiPageNumber.Name = "_ShiftMultiPageNumber"; - _ShiftMultiPageNumber.Size = new System.Drawing.Size(157, 22); - _ShiftMultiPageNumber.Text = "增减指定数值..."; - // - // _IncrementPageNumber - // - _IncrementPageNumber.Name = "_IncrementPageNumber"; - _IncrementPageNumber.Size = new System.Drawing.Size(157, 22); - _IncrementPageNumber.Text = "增加页码"; - // - // _DecrementPageNumber - // - _DecrementPageNumber.Name = "_DecrementPageNumber"; - _DecrementPageNumber.Size = new System.Drawing.Size(157, 22); - _DecrementPageNumber.Text = "减少页码"; - // - // _MergeBookmark - // - _MergeBookmark.Image = global::PDFPatcher.Properties.Resources.Merge; - _MergeBookmark.Name = "_MergeBookmark"; - _MergeBookmark.Size = new System.Drawing.Size(211, 22); - _MergeBookmark.Text = "合并书签(&H)"; - // - // _SelectAll - // - _SelectAll.Image = global::PDFPatcher.Properties.Resources.SelectAll; - _SelectAll.Name = "_SelectAll"; - _SelectAll.Size = new System.Drawing.Size(148, 22); - _SelectAll.Text = "全部选中"; - // - // toolStripSeparator3 - // - toolStripSeparator3.Name = "toolStripSeparator3"; - toolStripSeparator3.Size = new System.Drawing.Size(145, 6); - // - // dummyToolStripMenuItem - // - dummyToolStripMenuItem.Name = "dummyToolStripMenuItem"; - dummyToolStripMenuItem.Size = new System.Drawing.Size(94, 22); - dummyToolStripMenuItem.Text = "dummy"; - // - // _Copy - // - _Copy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - _Copy.Image = global::PDFPatcher.Properties.Resources.Copy; - _Copy.ImageTransparentColor = System.Drawing.Color.Magenta; - _Copy.Name = "_Copy"; - _Copy.Size = new System.Drawing.Size(23, 22); - _Copy.Text = "复制书签"; - _Copy.ToolTipText = "复制书签\r\nCtrl+C"; - // - // _Paste - // - _Paste.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - _Paste.Image = global::PDFPatcher.Properties.Resources.Paste; - _Paste.ImageTransparentColor = System.Drawing.Color.Magenta; - _Paste.Name = "_Paste"; - _Paste.Size = new System.Drawing.Size(23, 22); - _Paste.Text = "粘贴书签"; - _Paste.ToolTipText = "粘贴书签\r\nCtrl+P"; - // - // _DeleteBookmark - // - _DeleteBookmark.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - _DeleteBookmark.Image = global::PDFPatcher.Properties.Resources.Delete; - _DeleteBookmark.ImageTransparentColor = System.Drawing.Color.Magenta; - _DeleteBookmark.Name = "_DeleteBookmark"; - _DeleteBookmark.Size = new System.Drawing.Size(23, 22); - _DeleteBookmark.Text = "删除"; - _DeleteBookmark.ToolTipText = "删除书签项目\r\nDelete"; - // - // toolStripSeparator2 - // - toolStripSeparator2.Name = "toolStripSeparator2"; - toolStripSeparator2.Size = new System.Drawing.Size(6, 25); - // - // _InsertBookmark - // - _InsertBookmark.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - _InsertBookmark.Image = global::PDFPatcher.Properties.Resources.BookmarkFile; - _InsertBookmark.ImageTransparentColor = System.Drawing.Color.Magenta; - _InsertBookmark.Name = "_InsertBookmark"; - _InsertBookmark.Size = new System.Drawing.Size(23, 22); - _InsertBookmark.Text = "插入(&C)"; - _InsertBookmark.ToolTipText = "插入书签项(按住 Shift 向上插入)\r\nInsert"; - // - // _LevelUp - // - _LevelUp.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - _LevelUp.Image = global::PDFPatcher.Properties.Resources.MoveLeft; - _LevelUp.ImageTransparentColor = System.Drawing.Color.Magenta; - _LevelUp.Name = "_LevelUp"; - _LevelUp.Size = new System.Drawing.Size(23, 22); - _LevelUp.Text = "设置为父书签"; - _LevelUp.ToolTipText = "将选中书签向外移一级变成父级书签\r\nShift+Tab"; - // - // _LevelDown - // - _LevelDown.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - _LevelDown.Image = global::PDFPatcher.Properties.Resources.MoveRight; - _LevelDown.ImageTransparentColor = System.Drawing.Color.Magenta; - _LevelDown.Name = "_LevelDown"; - _LevelDown.Size = new System.Drawing.Size(23, 22); - _LevelDown.Text = "设置为子书签"; - _LevelDown.ToolTipText = "设置选中书签为其上一个同级书签的子书签\r\nTab"; - // - // toolStripSeparator7 - // - toolStripSeparator7.Name = "toolStripSeparator7"; - toolStripSeparator7.Size = new System.Drawing.Size(208, 6); - // - // _SelectItems - // - _SelectItems.DropDown = this._SelectionMenu; - _SelectItems.Image = global::PDFPatcher.Properties.Resources.SelectItem; - _SelectItems.ImageTransparentColor = System.Drawing.Color.Magenta; - _SelectItems.Name = "_SelectItems"; - _SelectItems.Size = new System.Drawing.Size(211, 22); - _SelectItems.Text = "选择书签(&S)"; - // - // _SelectionMenu - // - this._SelectionMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - _SelectAll, - _SelectNone, - _InvertSelect, - toolStripSeparator3, - this._CollapseAll, - this._CollapseChildren, - this._ExpandAll}); - this._SelectionMenu.Name = "_SelectionMenu"; - this._SelectionMenu.OwnerItem = _SelectItems; - this._SelectionMenu.Size = new System.Drawing.Size(149, 142); - this._SelectionMenu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _CollapseAll - // - this._CollapseAll.Name = "_CollapseAll"; - this._CollapseAll.Size = new System.Drawing.Size(148, 22); - this._CollapseAll.Text = "全部折叠"; - // - // _CollapseChildren - // - this._CollapseChildren.Name = "_CollapseChildren"; - this._CollapseChildren.Size = new System.Drawing.Size(148, 22); - this._CollapseChildren.Text = "折叠子书签"; - // - // _ExpandAll - // - this._ExpandAll.Name = "_ExpandAll"; - this._ExpandAll.Size = new System.Drawing.Size(148, 22); - this._ExpandAll.Text = "全部展开"; - // - // _SearchReplace - // - _SearchReplace.Image = global::PDFPatcher.Properties.Resources.SearchReplace; - _SearchReplace.ImageTransparentColor = System.Drawing.Color.Magenta; - _SearchReplace.Name = "_SearchReplace"; - _SearchReplace.Size = new System.Drawing.Size(211, 22); - _SearchReplace.Text = "查找/替换书签文本(&W)..."; - _SearchReplace.ToolTipText = "查找或替换书签文本\r\nCtrl+F"; - // - // _BookmarkAction - // - _BookmarkAction.Image = global::PDFPatcher.Properties.Resources.EditItem; - _BookmarkAction.Name = "_BookmarkAction"; - _BookmarkAction.Size = new System.Drawing.Size(211, 22); - _BookmarkAction.Text = "书签动作属性(&D)..."; - _BookmarkAction.ToolTipText = "修改点击书签后执行的动作"; - // - // toolStripMenuItem1 - // - toolStripMenuItem1.Image = global::PDFPatcher.Properties.Resources.SelectAll; - toolStripMenuItem1.Name = "toolStripMenuItem1"; - toolStripMenuItem1.Size = new System.Drawing.Size(158, 22); - toolStripMenuItem1.Text = "全部选中"; - // - // toolStripMenuItem2 - // - toolStripMenuItem2.Name = "toolStripMenuItem2"; - toolStripMenuItem2.Size = new System.Drawing.Size(158, 22); - toolStripMenuItem2.Text = "全部不选"; - // - // toolStripMenuItem3 - // - toolStripMenuItem3.Name = "toolStripMenuItem3"; - toolStripMenuItem3.Size = new System.Drawing.Size(158, 22); - toolStripMenuItem3.Text = "反转选择状态"; - // - // toolStripSeparator8 - // - toolStripSeparator8.Name = "toolStripSeparator8"; - toolStripSeparator8.Size = new System.Drawing.Size(155, 6); - // - // toolStripMenuItem4 - // - toolStripMenuItem4.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - toolStripMenuItem5, - toolStripMenuItem6, - toolStripMenuItem7, - this.toolStripMenuItem8, - toolStripMenuItem9, - toolStripMenuItem10, - this.toolStripSeparator9, - toolStripMenuItem11, - toolStripMenuItem12}); - toolStripMenuItem4.Image = global::PDFPatcher.Properties.Resources.Mark; - toolStripMenuItem4.Name = "toolStripMenuItem4"; - toolStripMenuItem4.Size = new System.Drawing.Size(158, 22); - toolStripMenuItem4.Text = "标记书签"; - toolStripMenuItem4.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // toolStripMenuItem5 - // - toolStripMenuItem5.Name = "toolStripMenuItem5"; - toolStripMenuItem5.Size = new System.Drawing.Size(148, 22); - toolStripMenuItem5.Text = "红色"; - // - // toolStripMenuItem6 - // - toolStripMenuItem6.Name = "toolStripMenuItem6"; - toolStripMenuItem6.Size = new System.Drawing.Size(148, 22); - toolStripMenuItem6.Text = "黄色"; - // - // toolStripMenuItem7 - // - toolStripMenuItem7.Name = "toolStripMenuItem7"; - toolStripMenuItem7.Size = new System.Drawing.Size(148, 22); - toolStripMenuItem7.Text = "绿色"; - // - // toolStripMenuItem8 - // - this.toolStripMenuItem8.Name = "toolStripMenuItem8"; - this.toolStripMenuItem8.Size = new System.Drawing.Size(148, 22); - this.toolStripMenuItem8.Text = "青色"; - // - // toolStripMenuItem9 - // - toolStripMenuItem9.Name = "toolStripMenuItem9"; - toolStripMenuItem9.Size = new System.Drawing.Size(148, 22); - toolStripMenuItem9.Text = "蓝色"; - // - // toolStripMenuItem10 - // - toolStripMenuItem10.Name = "toolStripMenuItem10"; - toolStripMenuItem10.Size = new System.Drawing.Size(148, 22); - toolStripMenuItem10.Text = "紫色"; - // - // toolStripSeparator9 - // - this.toolStripSeparator9.Name = "toolStripSeparator9"; - this.toolStripSeparator9.Size = new System.Drawing.Size(145, 6); - // - // toolStripMenuItem11 - // - toolStripMenuItem11.Image = global::PDFPatcher.Properties.Resources.Unmark; - toolStripMenuItem11.Name = "toolStripMenuItem11"; - toolStripMenuItem11.Size = new System.Drawing.Size(148, 22); - toolStripMenuItem11.Text = "取消标记"; - // - // toolStripMenuItem12 - // - toolStripMenuItem12.Name = "toolStripMenuItem12"; - toolStripMenuItem12.Size = new System.Drawing.Size(148, 22); - toolStripMenuItem12.Text = "清除所有标记"; - // - // toolStripMenuItem13 - // - toolStripMenuItem13.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - toolStripMenuItem14, - toolStripMenuItem15, - toolStripMenuItem16, - toolStripMenuItem17, - toolStripMenuItem18, - toolStripMenuItem19}); - toolStripMenuItem13.Image = global::PDFPatcher.Properties.Resources.SelectMarks; - toolStripMenuItem13.Name = "toolStripMenuItem13"; - toolStripMenuItem13.Size = new System.Drawing.Size(158, 22); - toolStripMenuItem13.Text = "选择已标记书签"; - toolStripMenuItem13.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // toolStripMenuItem14 - // - toolStripMenuItem14.Name = "toolStripMenuItem14"; - toolStripMenuItem14.Size = new System.Drawing.Size(100, 22); - toolStripMenuItem14.Text = "红色"; - // - // toolStripMenuItem15 - // - toolStripMenuItem15.Name = "toolStripMenuItem15"; - toolStripMenuItem15.Size = new System.Drawing.Size(100, 22); - toolStripMenuItem15.Text = "黄色"; - // - // toolStripMenuItem16 - // - toolStripMenuItem16.Name = "toolStripMenuItem16"; - toolStripMenuItem16.Size = new System.Drawing.Size(100, 22); - toolStripMenuItem16.Text = "绿色"; - // - // toolStripMenuItem17 - // - toolStripMenuItem17.Name = "toolStripMenuItem17"; - toolStripMenuItem17.Size = new System.Drawing.Size(100, 22); - toolStripMenuItem17.Text = "青色"; - // - // toolStripMenuItem18 - // - toolStripMenuItem18.Name = "toolStripMenuItem18"; - toolStripMenuItem18.Size = new System.Drawing.Size(100, 22); - toolStripMenuItem18.Text = "蓝色"; - // - // toolStripMenuItem19 - // - toolStripMenuItem19.Name = "toolStripMenuItem19"; - toolStripMenuItem19.Size = new System.Drawing.Size(100, 22); - toolStripMenuItem19.Text = "紫色"; - // - // toolStripSeparator10 - // - toolStripSeparator10.Name = "toolStripSeparator10"; - toolStripSeparator10.Size = new System.Drawing.Size(155, 6); - // - // _FirstPage - // - _FirstPage.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - _FirstPage.Image = global::PDFPatcher.Properties.Resources.MoveTop; - _FirstPage.ImageTransparentColor = System.Drawing.Color.Magenta; - _FirstPage.Name = "_FirstPage"; - _FirstPage.Size = new System.Drawing.Size(23, 22); - _FirstPage.Text = "转到文档第一页"; - // - // _PreviousPage - // - _PreviousPage.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - _PreviousPage.Image = global::PDFPatcher.Properties.Resources.MoveUp; - _PreviousPage.ImageTransparentColor = System.Drawing.Color.Magenta; - _PreviousPage.Name = "_PreviousPage"; - _PreviousPage.Size = new System.Drawing.Size(23, 22); - _PreviousPage.Text = "转到上一页"; - // - // _NextPage - // - _NextPage.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - _NextPage.Image = global::PDFPatcher.Properties.Resources.MoveDown; - _NextPage.ImageTransparentColor = System.Drawing.Color.Magenta; - _NextPage.Name = "_NextPage"; - _NextPage.Size = new System.Drawing.Size(23, 22); - _NextPage.Text = "转到下一页"; - // - // _LastPage - // - _LastPage.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - _LastPage.Image = global::PDFPatcher.Properties.Resources.MoveBottom; - _LastPage.ImageTransparentColor = System.Drawing.Color.Magenta; - _LastPage.Name = "_LastPage"; - _LastPage.Size = new System.Drawing.Size(23, 22); - _LastPage.Text = "转到文档最后一页"; - // - // _MoveMode - // - _MoveMode.Checked = true; - _MoveMode.CheckState = System.Windows.Forms.CheckState.Checked; - _MoveMode.Image = global::PDFPatcher.Properties.Resources.Move; - _MoveMode.Name = "_MoveMode"; - _MoveMode.Size = new System.Drawing.Size(208, 22); - _MoveMode.Text = "移动页面模式(&Y)"; - _MoveMode.ToolTipText = "使用鼠标拖动页面"; - // - // _SelectionMode - // - _SelectionMode.Image = global::PDFPatcher.Properties.Resources.SelectItem; - _SelectionMode.Name = "_SelectionMode"; - _SelectionMode.Size = new System.Drawing.Size(208, 22); - _SelectionMode.Text = "框选模式(&K)"; - _SelectionMode.ToolTipText = "框选文档内容,可复制所选内容、添加书签"; - // - // toolStripSeparator1 - // - toolStripSeparator1.Name = "toolStripSeparator1"; - toolStripSeparator1.Size = new System.Drawing.Size(205, 6); - // - // _ScrollVertical - // - _ScrollVertical.Checked = true; - _ScrollVertical.CheckState = System.Windows.Forms.CheckState.Checked; - _ScrollVertical.Image = global::PDFPatcher.Properties.Resources.ScrollVertical; - _ScrollVertical.Name = "_ScrollVertical"; - _ScrollVertical.Size = new System.Drawing.Size(208, 22); - _ScrollVertical.Text = "从上到下阅读(&S)"; - // - // _ScrollHorizontal - // - _ScrollHorizontal.Image = global::PDFPatcher.Properties.Resources.ScrollHorizontal; - _ScrollHorizontal.Name = "_ScrollHorizontal"; - _ScrollHorizontal.Size = new System.Drawing.Size(208, 22); - _ScrollHorizontal.Text = "从右到左阅读(&Y)"; - // - // _FullPageScroll - // - _FullPageScroll.Name = "_FullPageScroll"; - _FullPageScroll.Size = new System.Drawing.Size(208, 22); - _FullPageScroll.Text = "整页翻页(&Z)"; - _FullPageScroll.ToolTipText = "按翻页键翻页时,按整页来翻页而不是按显示窗口翻页"; - // - // toolStripSeparator6 - // - toolStripSeparator6.Name = "toolStripSeparator6"; - toolStripSeparator6.Size = new System.Drawing.Size(205, 6); - // - // _TrueColorSpace - // - _TrueColorSpace.Checked = true; - _TrueColorSpace.CheckState = System.Windows.Forms.CheckState.Checked; - _TrueColorSpace.Image = global::PDFPatcher.Properties.Resources.ColorDisplay; - _TrueColorSpace.Name = "_TrueColorSpace"; - _TrueColorSpace.Size = new System.Drawing.Size(208, 22); - _TrueColorSpace.Text = "彩色显示(&C)"; - // - // _GrayColorSpace - // - _GrayColorSpace.Image = global::PDFPatcher.Properties.Resources.GrayScaleDisplay; - _GrayColorSpace.Name = "_GrayColorSpace"; - _GrayColorSpace.Size = new System.Drawing.Size(208, 22); - _GrayColorSpace.Text = "黑白显示(&H)"; - // - // _InvertColor - // - _InvertColor.Image = global::PDFPatcher.Properties.Resources.InvertColor; - _InvertColor.Name = "_InvertColor"; - _InvertColor.Size = new System.Drawing.Size(208, 22); - _InvertColor.Text = "反转颜色(&F)"; - // - // _BookmarkHere - // - _BookmarkHere.Image = global::PDFPatcher.Properties.Resources.BookmarkFile; - _BookmarkHere.Name = "_BookmarkHere"; - _BookmarkHere.Size = new System.Drawing.Size(225, 22); - _BookmarkHere.Text = "在此插入书签(&S)..."; - _BookmarkHere.ToolTipText = "插入书签,指向当前位置"; - // - // _CopySelection - // - _CopySelection.Image = global::PDFPatcher.Properties.Resources.Copy; - _CopySelection.Name = "_CopySelection"; - _CopySelection.Size = new System.Drawing.Size(225, 22); - _CopySelection.Text = "复制选中内容(&F)"; - _CopySelection.ToolTipText = "复制选中部分的图像"; - // - // toolStripSeparator11 - // - toolStripSeparator11.Name = "toolStripSeparator11"; - toolStripSeparator11.Size = new System.Drawing.Size(205, 6); - // - // _OcrDisabled - // - _OcrDisabled.Name = "_OcrDisabled"; - _OcrDisabled.Size = new System.Drawing.Size(164, 22); - _OcrDisabled.Text = "不要识别文本(&B)"; - // - // _ShowTextBorders - // - _ShowTextBorders.Name = "_ShowTextBorders"; - _ShowTextBorders.Size = new System.Drawing.Size(208, 22); - _ShowTextBorders.Text = "显示文本边框"; - // - // _DarkMode - // - _DarkMode.Image = global::PDFPatcher.Properties.Resources.DarkMode; - _DarkMode.Name = "_DarkMode"; - _DarkMode.Size = new System.Drawing.Size(208, 22); - _DarkMode.Text = "暗黑阅读模式(&A)"; - // - // toolStripSeparator12 - // - toolStripSeparator12.Name = "toolStripSeparator12"; - toolStripSeparator12.Size = new System.Drawing.Size(205, 6); - // - // _GreenMode - // - _GreenMode.Image = global::PDFPatcher.Properties.Resources.GreenMode; - _GreenMode.Name = "_GreenMode"; - _GreenMode.Size = new System.Drawing.Size(208, 22); - _GreenMode.Text = "绿色阅读模式(&L)"; - // - // _ShowBookmarks - // - _ShowBookmarks.Name = "_ShowBookmarks"; - _ShowBookmarks.Size = new System.Drawing.Size(208, 22); - _ShowBookmarks.Text = "显示书签栏(&Q)"; - // - // _InsertPageLabel - // - _InsertPageLabel.Image = global::PDFPatcher.Properties.Resources.PageRange; - _InsertPageLabel.Name = "_InsertPageLabel"; - _InsertPageLabel.Size = new System.Drawing.Size(225, 22); - _InsertPageLabel.Text = "插入页码标签(&Y)..."; - _InsertPageLabel.Visible = false; - // - // _AutoBookmark - // - _AutoBookmark.Enabled = false; - _AutoBookmark.Image = global::PDFPatcher.Properties.Resources.AutoBookmark; - _AutoBookmark.Name = "_AutoBookmark"; - _AutoBookmark.Size = new System.Drawing.Size(225, 22); - _AutoBookmark.Text = "设置自动书签标题格式(&Z)"; - // - // _SetOpenStatusTrue - // - _SetOpenStatusTrue.Name = "_SetOpenStatusTrue"; - _SetOpenStatusTrue.Size = new System.Drawing.Size(100, 22); - _SetOpenStatusTrue.Text = "打开"; - // - // _SetOpenStatusFalse - // - _SetOpenStatusFalse.Name = "_SetOpenStatusFalse"; - _SetOpenStatusFalse.Size = new System.Drawing.Size(100, 22); - _SetOpenStatusFalse.Text = "关闭"; - // - // _OcrDetectPunctuation - // - _OcrDetectPunctuation.Name = "_OcrDetectPunctuation"; - _OcrDetectPunctuation.Size = new System.Drawing.Size(208, 22); - _OcrDetectPunctuation.Text = "增强识别目录页标点"; - // - // _FullScreen - // - _FullScreen.Name = "_FullScreen"; - _FullScreen.Size = new System.Drawing.Size(208, 22); - _FullScreen.Text = "全屏显示(&Q)"; - // - // _PageProperties - // - _PageProperties.Image = global::PDFPatcher.Properties.Resources.Property; - _PageProperties.Name = "_PageProperties"; - _PageProperties.Size = new System.Drawing.Size(225, 22); - _PageProperties.Text = "查看页面属性(&X)..."; - // - // _MarkBookmark - // - _MarkBookmark.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - _MarkBookmarkRed, - _MarkBookmarkYellow, - _MarkBookmarkGreen, - this._MarkBookmarkCyan, - _MarkBookmarkBlue, - _MarkBookmarkPurple, - toolStripSeparator5, - _UnmarkBookmark, - _ClearBookmarkMarks}); - _MarkBookmark.Image = global::PDFPatcher.Properties.Resources.Mark; - _MarkBookmark.Name = "_MarkBookmark"; - _MarkBookmark.Size = new System.Drawing.Size(211, 22); - _MarkBookmark.Text = "标记书签"; - _MarkBookmark.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _MarkBookmarkRed - // - _MarkBookmarkRed.Name = "_MarkBookmarkRed"; - _MarkBookmarkRed.Size = new System.Drawing.Size(148, 22); - _MarkBookmarkRed.Text = "红色"; - // - // _MarkBookmarkYellow - // - _MarkBookmarkYellow.Name = "_MarkBookmarkYellow"; - _MarkBookmarkYellow.Size = new System.Drawing.Size(148, 22); - _MarkBookmarkYellow.Text = "黄色"; - // - // _MarkBookmarkGreen - // - _MarkBookmarkGreen.Name = "_MarkBookmarkGreen"; - _MarkBookmarkGreen.Size = new System.Drawing.Size(148, 22); - _MarkBookmarkGreen.Text = "绿色"; - // - // _MarkBookmarkCyan - // - this._MarkBookmarkCyan.Name = "_MarkBookmarkCyan"; - this._MarkBookmarkCyan.Size = new System.Drawing.Size(148, 22); - this._MarkBookmarkCyan.Text = "青色"; - // - // _MarkBookmarkBlue - // - _MarkBookmarkBlue.Name = "_MarkBookmarkBlue"; - _MarkBookmarkBlue.Size = new System.Drawing.Size(148, 22); - _MarkBookmarkBlue.Text = "蓝色"; - // - // _MarkBookmarkPurple - // - _MarkBookmarkPurple.Name = "_MarkBookmarkPurple"; - _MarkBookmarkPurple.Size = new System.Drawing.Size(148, 22); - _MarkBookmarkPurple.Text = "紫色"; - // - // toolStripSeparator5 - // - toolStripSeparator5.Name = "toolStripSeparator5"; - toolStripSeparator5.Size = new System.Drawing.Size(145, 6); - // - // _UnmarkBookmark - // - _UnmarkBookmark.Image = global::PDFPatcher.Properties.Resources.Unmark; - _UnmarkBookmark.Name = "_UnmarkBookmark"; - _UnmarkBookmark.Size = new System.Drawing.Size(148, 22); - _UnmarkBookmark.Text = "取消标记"; - // - // _ClearBookmarkMarks - // - _ClearBookmarkMarks.Name = "_ClearBookmarkMarks"; - _ClearBookmarkMarks.Size = new System.Drawing.Size(148, 22); - _ClearBookmarkMarks.Text = "清除所有标记"; - // - // _SelectMarkedBookmarks - // - _SelectMarkedBookmarks.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - _SelectRedMarks, - _SelectYellowMarks, - _SelectGreenMarks, - _SelectCyanMarks, - _SelectBlueMarks, - _SelectPurpleMarks}); - _SelectMarkedBookmarks.Image = global::PDFPatcher.Properties.Resources.SelectMarks; - _SelectMarkedBookmarks.Name = "_SelectMarkedBookmarks"; - _SelectMarkedBookmarks.Size = new System.Drawing.Size(211, 22); - _SelectMarkedBookmarks.Text = "选择已标记书签"; - _SelectMarkedBookmarks.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _SelectRedMarks - // - _SelectRedMarks.Name = "_SelectRedMarks"; - _SelectRedMarks.Size = new System.Drawing.Size(100, 22); - _SelectRedMarks.Text = "红色"; - // - // _SelectYellowMarks - // - _SelectYellowMarks.Name = "_SelectYellowMarks"; - _SelectYellowMarks.Size = new System.Drawing.Size(100, 22); - _SelectYellowMarks.Text = "黄色"; - // - // _SelectGreenMarks - // - _SelectGreenMarks.Name = "_SelectGreenMarks"; - _SelectGreenMarks.Size = new System.Drawing.Size(100, 22); - _SelectGreenMarks.Text = "绿色"; - // - // _SelectCyanMarks - // - _SelectCyanMarks.Name = "_SelectCyanMarks"; - _SelectCyanMarks.Size = new System.Drawing.Size(100, 22); - _SelectCyanMarks.Text = "青色"; - // - // _SelectBlueMarks - // - _SelectBlueMarks.Name = "_SelectBlueMarks"; - _SelectBlueMarks.Size = new System.Drawing.Size(100, 22); - _SelectBlueMarks.Text = "蓝色"; - // - // _SelectPurpleMarks - // - _SelectPurpleMarks.Name = "_SelectPurpleMarks"; - _SelectPurpleMarks.Size = new System.Drawing.Size(100, 22); - _SelectPurpleMarks.Text = "紫色"; - // - // toolStripSeparator14 - // - toolStripSeparator14.Name = "toolStripSeparator14"; - toolStripSeparator14.Size = new System.Drawing.Size(205, 6); - // - // toolStripSeparator13 - // - toolStripSeparator13.Name = "toolStripSeparator13"; - toolStripSeparator13.Size = new System.Drawing.Size(208, 6); - // - // toolStripSeparator4 - // - toolStripSeparator4.Name = "toolStripSeparator4"; - toolStripSeparator4.Size = new System.Drawing.Size(208, 6); - // - // _EditorOptions - // - _EditorOptions.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - _EditorOptions.Image = global::PDFPatcher.Properties.Resources.PdfOptions; - _EditorOptions.Name = "_EditorOptions"; - _EditorOptions.Size = new System.Drawing.Size(23, 22); - _EditorOptions.Text = "设置文件修改方式(X)..."; - // - // _ViewerButton - // - this._ViewerButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this._ViewerButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - _MoveMode, - _SelectionMode, - toolStripSeparator11, - this._OcrMenu, - this._InsertWithOcrOnly, - _OcrDetectPunctuation, - toolStripSeparator1, - _ScrollVertical, - _ScrollHorizontal, - _FullPageScroll, - toolStripSeparator6, - _TrueColorSpace, - _GrayColorSpace, - toolStripSeparator12, - _InvertColor, - _DarkMode, - _GreenMode, - toolStripSeparator14, - _FullScreen, - _ShowBookmarks, - _ShowTextBorders, - this._ShowAnnotations}); - this._ViewerButton.Image = global::PDFPatcher.Properties.Resources.CreateDocument; - this._ViewerButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._ViewerButton.Name = "_ViewerButton"; - this._ViewerButton.Size = new System.Drawing.Size(29, 22); - this._ViewerButton.Text = "阅读器"; - this._ViewerButton.ToolTipText = "设置阅读器的操作方式"; - this._ViewerButton.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _OcrMenu - // - this._OcrMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - _OcrDisabled}); - this._OcrMenu.Image = global::PDFPatcher.Properties.Resources.Ocr; - this._OcrMenu.Name = "_OcrMenu"; - this._OcrMenu.Size = new System.Drawing.Size(208, 22); - this._OcrMenu.Text = "识别文本语言(&W)"; - this._OcrMenu.ToolTipText = "设置插入书签、识别页面文本时的识别引擎"; - // - // _InsertWithOcrOnly - // - this._InsertWithOcrOnly.Name = "_InsertWithOcrOnly"; - this._InsertWithOcrOnly.Size = new System.Drawing.Size(208, 22); - this._InsertWithOcrOnly.Text = "插入书签仅使用识别引擎"; - // - // _ShowAnnotations - // - this._ShowAnnotations.Name = "_ShowAnnotations"; - this._ShowAnnotations.Size = new System.Drawing.Size(208, 22); - this._ShowAnnotations.Text = "显示文档批注(&P)"; - // - // _EditMenu - // - this._EditMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - _BookmarkAction, - toolStripSeparator13, - this._SetOpenStatus, - _ShiftPageNumber, - _AlterPosition, - this._ChangeZoomRate, - _ForceInternalLink, - toolStripSeparator7, - _MergeBookmark, - this._ChangeCase, - _SearchReplace, - toolStripSeparator4, - _SelectItems, - this._QuickSelect, - _MarkBookmark, - _SelectMarkedBookmarks}); - this._EditMenu.Name = "_EditMenu"; - this._EditMenu.Size = new System.Drawing.Size(212, 308); - this._EditMenu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _SetOpenStatus - // - this._SetOpenStatus.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - _SetOpenStatusTrue, - _SetOpenStatusFalse}); - this._SetOpenStatus.Image = global::PDFPatcher.Properties.Resources.Open; - this._SetOpenStatus.Name = "_SetOpenStatus"; - this._SetOpenStatus.Size = new System.Drawing.Size(211, 22); - this._SetOpenStatus.Text = "设置书签默认打开状态(&T)"; - // - // _ChangeZoomRate - // - this._ChangeZoomRate.Image = global::PDFPatcher.Properties.Resources.Zoom; - this._ChangeZoomRate.Name = "_ChangeZoomRate"; - this._ChangeZoomRate.Size = new System.Drawing.Size(211, 22); - this._ChangeZoomRate.Text = "设置目标显示方式(&X)"; - // - // _ChangeCase - // - this._ChangeCase.Image = global::PDFPatcher.Properties.Resources.ChangeCase; - this._ChangeCase.Name = "_ChangeCase"; - this._ChangeCase.Size = new System.Drawing.Size(211, 22); - this._ChangeCase.Text = "更改书签文本大小写"; - this._ChangeCase.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _QuickSelect - // - this._QuickSelect.Image = global::PDFPatcher.Properties.Resources.SelectItem; - this._QuickSelect.Name = "_QuickSelect"; - this._QuickSelect.Size = new System.Drawing.Size(211, 22); - this._QuickSelect.Text = "快速选择书签(&K)"; - this._QuickSelect.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _RecentFileMenu - // - this._RecentFileMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - dummyToolStripMenuItem}); - this._RecentFileMenu.Name = "_RecentFileMenu"; - this._RecentFileMenu.OwnerItem = this._AddFilesButton; - this._RecentFileMenu.ShowImageMargin = false; - this._RecentFileMenu.Size = new System.Drawing.Size(95, 26); - // - // _AddFilesButton - // - this._AddFilesButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this._AddFilesButton.DropDown = this._RecentFileMenu; - this._AddFilesButton.Image = global::PDFPatcher.Properties.Resources.OpenFile; - this._AddFilesButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._AddFilesButton.Name = "_AddFilesButton"; - this._AddFilesButton.Size = new System.Drawing.Size(32, 22); - this._AddFilesButton.Text = "打开"; - this._AddFilesButton.ToolTipText = "打开需要编辑的PDF文件"; - this._AddFilesButton.ButtonClick += new System.EventHandler(this.ButtonClicked); - this._AddFilesButton.DropDownOpening += new System.EventHandler(this._OpenButton_DropDownOpening); - this._AddFilesButton.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._OpenButton_DropDownItemClicked); - // - // _UndoMenu - // - this._UndoMenu.Name = "_UndoMenu"; - this._UndoMenu.OwnerItem = this._UndoButton; - this._UndoMenu.ShowImageMargin = false; - this._UndoMenu.Size = new System.Drawing.Size(36, 4); - // - // _UndoButton - // - this._UndoButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this._UndoButton.DropDown = this._UndoMenu; - this._UndoButton.Enabled = false; - this._UndoButton.Image = global::PDFPatcher.Properties.Resources.Undo; - this._UndoButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._UndoButton.Name = "_UndoButton"; - this._UndoButton.Size = new System.Drawing.Size(32, 22); - this._UndoButton.Text = "撤销"; - this._UndoButton.ToolTipText = "撤销\r\nCtrl+Z"; - this._UndoButton.ButtonClick += new System.EventHandler(this.ButtonClicked); - // - // _IncludeDecendantBox - // - this._IncludeDecendantBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this._IncludeDecendantBox.AutoSize = true; - this._IncludeDecendantBox.Location = new System.Drawing.Point(3, 275); - this._IncludeDecendantBox.Name = "_IncludeDecendantBox"; - this._IncludeDecendantBox.Size = new System.Drawing.Size(192, 16); - this._IncludeDecendantBox.TabIndex = 1; - this._IncludeDecendantBox.Text = "修改操作包含未选中的内部书签"; - this._IncludeDecendantBox.UseVisualStyleBackColor = true; - // - // _BookmarkBox - // - this._BookmarkBox.AllowDrop = true; - this._BookmarkBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._BookmarkBox.CellEditActivation = BrightIdeasSoftware.ObjectListView.CellEditActivateMode.SingleClick; - this._BookmarkBox.CellEditUseWholeCell = false; - this._BookmarkBox.ContextMenuStrip = this._EditMenu; - this._BookmarkBox.CopySelectionOnControlC = false; - this._BookmarkBox.Cursor = System.Windows.Forms.Cursors.Default; - this._BookmarkBox.GridLines = true; - this._BookmarkBox.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this._BookmarkBox.HideSelection = false; - this._BookmarkBox.IsSimpleDragSource = true; - this._BookmarkBox.IsSimpleDropSink = true; - this._BookmarkBox.LabelEdit = true; - this._BookmarkBox.Location = new System.Drawing.Point(3, 3); - this._BookmarkBox.Name = "_BookmarkBox"; - this._BookmarkBox.OperationAffectsDescendants = false; - this._BookmarkBox.RevealAfterExpand = false; - this._BookmarkBox.ShowGroups = false; - this._BookmarkBox.Size = new System.Drawing.Size(261, 266); - this._BookmarkBox.TabIndex = 0; - this._BookmarkBox.UseCellFormatEvents = true; - this._BookmarkBox.UseCompatibleStateImageBehavior = false; - this._BookmarkBox.UseHyperlinks = true; - this._BookmarkBox.UseOverlays = false; - this._BookmarkBox.View = System.Windows.Forms.View.Details; - this._BookmarkBox.VirtualMode = true; - this._BookmarkBox.DragDrop += new System.Windows.Forms.DragEventHandler(this._BookmarkBox_DragDrop); - this._BookmarkBox.DragEnter += new System.Windows.Forms.DragEventHandler(this._BookmarkBox_DragEnter); - // - // _MainPanel - // - this._MainPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._MainPanel.Location = new System.Drawing.Point(3, 29); - this._MainPanel.Name = "_MainPanel"; - // - // _MainPanel.Panel1 - // - this._MainPanel.Panel1.Controls.Add(this._IncludeDecendantBox); - this._MainPanel.Panel1.Controls.Add(this._BookmarkBox); - // - // _MainPanel.Panel2 - // - this._MainPanel.Panel2.Controls.Add(this._PageInfoBox); - this._MainPanel.Panel2.Controls.Add(this._ViewerBox); - this._MainPanel.Size = new System.Drawing.Size(627, 294); - this._MainPanel.SplitterDistance = 268; - this._MainPanel.TabIndex = 1; - // - // _PageInfoBox - // - this._PageInfoBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._PageInfoBox.AutoEllipsis = true; - this._PageInfoBox.Location = new System.Drawing.Point(3, 276); - this._PageInfoBox.Name = "_PageInfoBox"; - this._PageInfoBox.Size = new System.Drawing.Size(349, 15); - this._PageInfoBox.TabIndex = 1; - this._PageInfoBox.Text = "PDF 页面信息"; - // - // _ViewerBox - // - this._ViewerBox.AllowUnfocusedMouseWheel = true; - this._ViewerBox.AllowZoom = false; - this._ViewerBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ViewerBox.BackColor = System.Drawing.Color.DarkGray; - this._ViewerBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this._ViewerBox.GridDisplayMode = Cyotek.Windows.Forms.ImageBoxGridDisplayMode.None; - this._ViewerBox.LiteralZoom = null; - this._ViewerBox.Location = new System.Drawing.Point(3, 3); - this._ViewerBox.Name = "_ViewerBox"; - this._ViewerBox.OcrLanguage = 2052; - this._ViewerBox.PinPoint = new System.Drawing.Point(0, 0); - this._ViewerBox.Size = new System.Drawing.Size(349, 266); - this._ViewerBox.TabIndex = 0; - this._ViewerBox.TintColor = System.Drawing.Color.Transparent; - this._ViewerBox.VirtualMode = true; - // - // _ViewerMenu - // - this._ViewerMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - _BookmarkHere, - _AutoBookmark, - _CopySelection, - this._OcrPage, - _InsertPageLabel, - _PageProperties, - this._SavePageImage}); - this._ViewerMenu.Name = "_ViewerMenu"; - this._ViewerMenu.Size = new System.Drawing.Size(226, 158); - this._ViewerMenu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _OcrPage - // - this._OcrPage.Image = global::PDFPatcher.Properties.Resources.Ocr; - this._OcrPage.Name = "_OcrPage"; - this._OcrPage.Size = new System.Drawing.Size(225, 22); - this._OcrPage.Text = "复制本页文本识别结果(&W)..."; - this._OcrPage.ToolTipText = "调用图像识别引擎识别选中图像内容的文本"; - // - // _SavePageImage - // - this._SavePageImage.Image = global::PDFPatcher.Properties.Resources.RenderImage; - this._SavePageImage.Name = "_SavePageImage"; - this._SavePageImage.Size = new System.Drawing.Size(225, 22); - this._SavePageImage.Text = "保存为图片(&P)..."; - // - // _BookmarkToolbar - // - this._BookmarkToolbar.Dock = System.Windows.Forms.DockStyle.None; - this._BookmarkToolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._AddFilesButton, - this._SavePDF, - this._SaveBookmark, - this._UndoButton, - _Copy, - _Paste, - _DeleteBookmark, - toolStripSeparator2, - _InsertBookmark, - _LevelUp, - _LevelDown, - this._BookmarkBoldButton, - this._BookmarkItalicButton, - this._BookmarkColorButton}); - this._BookmarkToolbar.Location = new System.Drawing.Point(0, 0); - this._BookmarkToolbar.Name = "_BookmarkToolbar"; - this._BookmarkToolbar.Size = new System.Drawing.Size(344, 25); - this._BookmarkToolbar.TabIndex = 2; - this._BookmarkToolbar.Text = "menuStrip1"; - this._BookmarkToolbar.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _SavePDF - // - this._SavePDF.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this._SavePDF.Image = global::PDFPatcher.Properties.Resources.Save; - this._SavePDF.ImageTransparentColor = System.Drawing.Color.Magenta; - this._SavePDF.Name = "_SavePDF"; - this._SavePDF.Size = new System.Drawing.Size(23, 22); - this._SavePDF.Text = "保存PDF文件"; - this._SavePDF.ToolTipText = "保存PDF文件\r\nCtrl+S"; - // - // _SaveBookmark - // - this._SaveBookmark.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this._SaveBookmark.Image = global::PDFPatcher.Properties.Resources.ExportInfoFile; - this._SaveBookmark.ImageTransparentColor = System.Drawing.Color.Magenta; - this._SaveBookmark.Name = "_SaveBookmark"; - this._SaveBookmark.Size = new System.Drawing.Size(23, 22); - this._SaveBookmark.Text = "保存书签文件"; - this._SaveBookmark.ToolTipText = "保存书签文件\r\nCtrl+Q"; - // - // _BookmarkBoldButton - // - this._BookmarkBoldButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this._BookmarkBoldButton.Image = global::PDFPatcher.Properties.Resources.Bold; - this._BookmarkBoldButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._BookmarkBoldButton.Name = "_BookmarkBoldButton"; - this._BookmarkBoldButton.Size = new System.Drawing.Size(23, 22); - this._BookmarkBoldButton.Text = "粗体"; - this._BookmarkBoldButton.ToolTipText = "切换书签文本的粗体样式\r\nCtrl+B"; - // - // _BookmarkItalicButton - // - this._BookmarkItalicButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this._BookmarkItalicButton.Image = global::PDFPatcher.Properties.Resources.Italic; - this._BookmarkItalicButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._BookmarkItalicButton.Name = "_BookmarkItalicButton"; - this._BookmarkItalicButton.Size = new System.Drawing.Size(23, 22); - this._BookmarkItalicButton.Text = "斜体"; - this._BookmarkItalicButton.ToolTipText = "切换书签文本的斜体样式\r\nCtrl+I"; - // - // _BookmarkColorButton - // - this._BookmarkColorButton.ButtonDisplayStyle = ColorPicker.ToolStripColorPickerDisplayType.UnderLineAndImage; - this._BookmarkColorButton.Color = System.Drawing.Color.Black; - this._BookmarkColorButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this._BookmarkColorButton.Image = ((System.Drawing.Image)(resources.GetObject("_BookmarkColorButton.Image"))); - this._BookmarkColorButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._BookmarkColorButton.Name = "_BookmarkColorButton"; - this._BookmarkColorButton.Size = new System.Drawing.Size(32, 22); - this._BookmarkColorButton.Text = "颜色"; - this._BookmarkColorButton.ToolTipText = "设置书签文本的颜色"; - this._BookmarkColorButton.SelectedColorChanged += new System.EventHandler(this._BookmarkColorButton_SelectedColorChanged); - this._BookmarkColorButton.ButtonClick += new System.EventHandler(this._BookmarkColorButton_SelectedColorChanged); - // - // toolStripMenuItem20 - // - this.toolStripMenuItem20.Name = "toolStripMenuItem20"; - this.toolStripMenuItem20.Size = new System.Drawing.Size(158, 22); - this.toolStripMenuItem20.Text = "全部折叠"; - // - // toolStripMenuItem21 - // - this.toolStripMenuItem21.Name = "toolStripMenuItem21"; - this.toolStripMenuItem21.Size = new System.Drawing.Size(158, 22); - this.toolStripMenuItem21.Text = "折叠子书签"; - // - // toolStripMenuItem22 - // - this.toolStripMenuItem22.Name = "toolStripMenuItem22"; - this.toolStripMenuItem22.Size = new System.Drawing.Size(158, 22); - this.toolStripMenuItem22.Text = "全部展开"; - // - // _ViewerToolbar - // - this._ViewerToolbar.Dock = System.Windows.Forms.DockStyle.None; - this._ViewerToolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - _FirstPage, - _PreviousPage, - this._CurrentPageBox, - _NextPage, - _LastPage, - this._ZoomBox, - this._ViewerButton, - _EditorOptions}); - this._ViewerToolbar.Location = new System.Drawing.Point(342, 0); - this._ViewerToolbar.Name = "_ViewerToolbar"; - this._ViewerToolbar.Size = new System.Drawing.Size(285, 25); - this._ViewerToolbar.TabIndex = 4; - this._ViewerToolbar.Text = "toolStrip1"; - this._ViewerToolbar.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _CurrentPageBox - // - this._CurrentPageBox.Name = "_CurrentPageBox"; - this._CurrentPageBox.Size = new System.Drawing.Size(50, 25); - this._CurrentPageBox.TextBoxTextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // _ZoomBox - // - this._ZoomBox.Items.AddRange(new object[] { - "适合页面", - "适合页宽", - "适合页高", - "20%", - "30%", - "50%", - "75%", - "100%", - "133%", - "150%", - "200%", - "300%", - "400%"}); - this._ZoomBox.Name = "_ZoomBox"; - this._ZoomBox.Size = new System.Drawing.Size(75, 25); - // - // EditorControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this._MainPanel); - this.Controls.Add(this._ViewerToolbar); - this.Controls.Add(this._BookmarkToolbar); - this.Font = new System.Drawing.Font("SimSun", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.Name = "EditorControl"; - this.Size = new System.Drawing.Size(633, 323); - this._SelectionMenu.ResumeLayout(false); - this._EditMenu.ResumeLayout(false); - this._RecentFileMenu.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this._BookmarkBox)).EndInit(); - this._MainPanel.Panel1.ResumeLayout(false); - this._MainPanel.Panel1.PerformLayout(); - this._MainPanel.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this._MainPanel)).EndInit(); - this._MainPanel.ResumeLayout(false); - this._ViewerMenu.ResumeLayout(false); - this._BookmarkToolbar.ResumeLayout(false); - this._BookmarkToolbar.PerformLayout(); - this._ViewerToolbar.ResumeLayout(false); - this._ViewerToolbar.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.ContextMenuStrip _EditMenu; - private System.Windows.Forms.ToolStripMenuItem _ChangeZoomRate; - private System.Windows.Forms.ToolStripMenuItem _SetOpenStatus; - private System.Windows.Forms.ContextMenuStrip _UndoMenu; - private PDFPatcher.Functions.BookmarkEditorView _BookmarkBox; - private System.Windows.Forms.ContextMenuStrip _SelectionMenu; - private System.Windows.Forms.ToolStripMenuItem _CollapseAll; - private System.Windows.Forms.ToolStripMenuItem _ExpandAll; - private System.Windows.Forms.ContextMenuStrip _RecentFileMenu; - private System.Windows.Forms.ToolStripMenuItem _CollapseChildren; - private System.Windows.Forms.ToolStripMenuItem _ChangeCase; - private System.Windows.Forms.CheckBox _IncludeDecendantBox; - private System.Windows.Forms.SplitContainer _MainPanel; - private PdfViewerControl _ViewerBox; - private System.Windows.Forms.Label _PageInfoBox; - private System.Windows.Forms.ToolStrip _BookmarkToolbar; - private System.Windows.Forms.ToolStripSplitButton _UndoButton; - private System.Windows.Forms.ToolStripButton _BookmarkBoldButton; - private System.Windows.Forms.ToolStripButton _BookmarkItalicButton; - private ColorPicker.ToolStripColorPicker _BookmarkColorButton; - private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem8; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator9; - private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem20; - private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem21; - private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem22; - private System.Windows.Forms.ToolStrip _ViewerToolbar; - private System.Windows.Forms.ToolStripTextBox _CurrentPageBox; - private System.Windows.Forms.ToolStripComboBox _ZoomBox; - private System.Windows.Forms.ToolStripSplitButton _AddFilesButton; - private System.Windows.Forms.ContextMenuStrip _ViewerMenu; - private System.Windows.Forms.ToolStripMenuItem _OcrPage; - private System.Windows.Forms.ToolStripButton _SavePDF; - private System.Windows.Forms.ToolStripButton _SaveBookmark; - private System.Windows.Forms.ToolStripMenuItem _OcrMenu; - private System.Windows.Forms.ToolStripDropDownButton _ViewerButton; - private System.Windows.Forms.ToolStripMenuItem _QuickSelect; - private System.Windows.Forms.ToolStripMenuItem _MarkBookmarkCyan; - private System.Windows.Forms.ToolStripMenuItem _SavePageImage; - private System.Windows.Forms.ToolStripMenuItem _ShowAnnotations; - private System.Windows.Forms.ToolStripMenuItem _InsertWithOcrOnly; - private System.Windows.Forms.ToolStripMenuItem _SetCurrentCoordinates; - } -} diff --git a/pdfpatcher/App/Functions/EditorControl.cs b/pdfpatcher/App/Functions/EditorControl.cs deleted file mode 100644 index 4283bdf8b6deb3145886ff70703fc1c8acbbd646..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/EditorControl.cs +++ /dev/null @@ -1,587 +0,0 @@ -using System; -using System.Drawing; -using System.Security.Permissions; -using System.Windows.Forms; -using BrightIdeasSoftware; -using PDFPatcher.Common; -using PDFPatcher.Model; -using PDFPatcher.Processor; - -namespace PDFPatcher.Functions -{ - public sealed partial class EditorControl : FunctionControl, IDocumentEditor, Editor.IEditView - { - static readonly Color __DarkModeColor = Color.DarkGray; - static readonly Color __GreenModeColor = Color.FromArgb(0xCC, 0xFF, 0xCC); - - public event EventHandler DocumentChanged; - - static readonly CommandRegistry __Commands = InitCommands(); - - static CommandRegistry InitCommands() { - var d = new CommandRegistry(); - d.Register(new Editor.LoadDocumentCommand(true, false), Commands.Open); - d.Register(new Editor.LoadDocumentCommand(true, true), Commands.ImportBookmark); - d.Register(new Editor.LoadDocumentCommand(false, false), Commands.OpenFile); - d.Register(new Editor.InsertBookmarkCommand(), Commands.EditorInsertBookmark); - d.Register(new Editor.SaveDocumentCommand(false, true), "_SaveButton", Commands.SaveBookmark); - d.Register(new Editor.SaveDocumentCommand(true, true), Commands.SaveAsInfoFile); - d.Register(new Editor.SaveDocumentCommand(true, false), Commands.Action, Commands.EditorSavePdf); - d.Register(new Editor.BookmarkLevelCommand(true), Commands.EditorBookmarkLevelUp); - d.Register(new Editor.BookmarkLevelCommand(false), Commands.EditorBookmarkLevelDown); - d.Register(new Editor.DocumentPropertyCommand(), Commands.DocumentProperties); - d.Register(new Editor.CopyBookmarkItemCommand(), Commands.Copy); - d.Register(new Editor.PasteBookmarkItemCommand(), Commands.Paste); - d.Register(new Editor.DeleteBookmarkItemCommand(), Commands.EditorBookmarkDelete, Commands.Delete); - d.Register(new Editor.BookmarkStyleCommand(SetTextStyleProcessor.Style.SetBold), Commands.EditorBookmarkBold); - d.Register(new Editor.BookmarkStyleCommand(SetTextStyleProcessor.Style.SetItalic), Commands.EditorBookmarkItalic); - d.Register(new Editor.BookmarkPageCommand(1), Commands.EditorBookmarkPageNumberIncrement); - d.Register(new Editor.BookmarkPageCommand(-1), Commands.EditorBookmarkPageNumberDecrement); - d.Register(new Editor.BookmarkPageCommand(0), Commands.EditorBookmarkPageNumberShift); - d.Register(new Editor.SimpleBookmarkCommand(ClearDestinationOffsetProcessor.PositionType.XY), "_ClearPositionXY"); - d.Register(new Editor.SimpleBookmarkCommand(ClearDestinationOffsetProcessor.PositionType.X), "_ClearPositionX"); - d.Register(new Editor.SimpleBookmarkCommand(ClearDestinationOffsetProcessor.PositionType.Y), "_ClearPositionY"); - d.Register(new Editor.SimpleBookmarkCommand(true), "_SetOpenStatusTrue"); - d.Register(new Editor.SimpleBookmarkCommand(false), "_SetOpenStatusFalse"); - foreach (var item in Constants.DestinationAttributes.ViewType.Names) { - d.Register(new Editor.BookmarkActionCommand(item), item); - } - d.Register(new Editor.BookmarkActionCommand(Constants.Coordinates.Unchanged), Constants.Coordinates.Unchanged); - d.Register(new Editor.BookmarkActionCommand("_ChangeCoordinates"), "_ChangeCoordinates"); - d.Register(new Editor.BookmarkActionCommand("_SetCurrentCoordinates"), "_SetCurrentCoordinates"); - d.Register(new Editor.BookmarkActionCommand("_BookmarkAction"), "_BookmarkAction"); - d.Register(new Editor.SimpleBookmarkCommand(), "_SetGotoTop"); - d.Register(new Editor.SimpleBookmarkCommand(), "_ForceInternalLink"); - d.Register(new Editor.BookmarkSelectionCommand(Commands.SelectAllItems), Commands.SelectAllItems); - d.Register(new Editor.BookmarkSelectionCommand(Commands.SelectNone), Commands.SelectNone); - d.Register(new Editor.BookmarkSelectionCommand(Commands.InvertSelectItem), Commands.InvertSelectItem); - d.Register(new Editor.BookmarkSelectionCommand(Commands.CollapseAll), Commands.CollapseAll); - d.Register(new Editor.BookmarkSelectionCommand(Commands.ExpandAll), Commands.ExpandAll); - d.Register(new Editor.BookmarkSelectionCommand(Commands.CollapseChildren), Commands.CollapseChildren); - d.Register(new Editor.OcrPageCommand(), Commands.EditorOcrPage); - d.Register(new Editor.PagePropertiesCommand(), Commands.EditorPageProperties); - d.Register(new Editor.SavePageImageCommand(), Commands.EditorSavePageImage); - Editor.BookmarkMarkerCommand.RegisterCommands(d); - Editor.ViewerCommand.RegisterCommands(d); - Editor.QuickSelectCommand.RegisterCommands(d); - return d; - } - SearchBookmarkForm _searchForm; - AutoBookmarkForm _autoBookmarkForm; - readonly Editor.Controller _controller; - - public override string FunctionName => "文档编辑器"; - - public override Bitmap IconImage => Properties.Resources.Editor; - - public string DocumentPath { - get => _controller?.Model.DocumentPath; - set { - _controller.Model.DocumentPath = value; - DocumentChanged?.Invoke(this, new DocumentChangedEventArgs(value)); - } - } - - public EditorControl() { - InitializeComponent(); - _controller = new Editor.Controller(this); - this.OnFirstLoad(OnLoad); - } - - void OnLoad() { - ListRecentFiles = _OpenButton_DropDownOpening; - RecentFileItemClicked = _OpenButton_DropDownItemClicked; - var s = this.GetDpiScale(); - var size = new Size((int)(s * 16), (int)(s * 16)); - _BookmarkToolbar.ScaleIcons(size); - _ViewerToolbar.ScaleIcons(size); - _EditMenu.ScaleIcons(size); - _RecentFileMenu.ScaleIcons(size); - _SelectionMenu.ScaleIcons(size); - _UndoMenu.ScaleIcons(size); - _ViewerMenu.ScaleIcons(size); - _BookmarkBox.ScaleColumnWidths(s); - _ViewerToolbar.Left = _BookmarkToolbar.Right; - _MainPanel.FixedPanel = FixedPanel.Panel1; - //_MainToolbar.ToggleEnabled (false, _editButtonNames); - - _controller.PrepareBookmarkDocument(); - - var di = _ChangeZoomRate.DropDownItems; - di.AddRange(Array.ConvertAll(Constants.DestinationAttributes.ViewType.Names, n => new ToolStripMenuItem { Name = n, Text = n })); - di.RemoveByKey(Constants.DestinationAttributes.ViewType.FitR); - di[0].Text += "..."; - di.Insert(0, new ToolStripMenuItem { Name = Constants.Coordinates.Unchanged, Text = Constants.Coordinates.Unchanged }); - _ChangeZoomRate.DropDownItemClicked += _MainToolbar_ItemClicked; - _ChangeCase.DropDownItemClicked += (object s, ToolStripItemClickedEventArgs args) => { - args.ClickedItem.HidePopupMenu(); - _EditMenu.Hide(); - var i = Array.IndexOf(SetCaseProcessor.CaseNames, args.ClickedItem.Text); - if (i != -1) { - _controller.ProcessBookmarks(new SetCaseProcessor((SetCaseProcessor.LetterCase)i)); - } - }; - foreach (int item in Enum.GetValues(typeof(SetCaseProcessor.LetterCase))) { - _ChangeCase.DropDownItems.Add(SetCaseProcessor.CaseNames[item]); - } - _SetOpenStatus.DropDownItemClicked += _MainToolbar_ItemClicked; - - AppContext.MainForm.SetTooltip(_IncludeDecendantBox, "选中此选项后,加粗、斜体等其它修改书签的操作将应用到选中书签的子书签"); - _IncludeDecendantBox.CheckedChanged += (s, args) => _BookmarkBox.OperationAffectsDescendants = _IncludeDecendantBox.Checked; - - _UndoButton.DropDownOpening += (object s, EventArgs args) => { - var i = _UndoMenu.Items; - i.Clear(); - foreach (var item in _controller.Model.Undo.GetActionNames(16)) { - i.Add(item); - } - }; - _UndoButton.DropDownItemClicked += (object s, ToolStripItemClickedEventArgs args) => { - var i = args.ClickedItem.Owner.Items.IndexOf(args.ClickedItem) + 1; - _controller.Undo(i); - }; - Editor.QuickSelectCommand.RegisterMenuItems(_QuickSelect.DropDownItems); - _BookmarkBox.CellClick += (s, args) => { - if (args.ColumnIndex != 0 || args.ClickCount > 1 || ModifierKeys != Keys.None) { - return; - } - ScrollToSelectedBookmarkLocation(); - //var bs = el.GetAttribute (Constants.BookmarkAttributes.Style); - //switch (bs) { - // case Constants.BookmarkAttributes.StyleType.Bold: - // _BookmarkBoldButton.Checked = true; - // _BookmarkItalicButton.Checked = false; - // break; - // case Constants.BookmarkAttributes.StyleType.BoldItalic: - // _BookmarkBoldButton.Checked = true; - // _BookmarkItalicButton.Checked = true; - // break; - // case Constants.BookmarkAttributes.StyleType.Italic: - // _BookmarkBoldButton.Checked = false; - // _BookmarkItalicButton.Checked = true; - // break; - // default: - // _BookmarkBoldButton.Checked = false; - // _BookmarkItalicButton.Checked = false; - // break; - //} - }; - _BookmarkBox.CellEditStarting += (s, args) => { - if (args.Column.Index == 0) { - ScrollToSelectedBookmarkLocation(); - } - }; - _BookmarkBox.BeforeLabelEdit += (s, args) => { - ((TreeListView)s).SelectedIndex = args.Item; - ScrollToSelectedBookmarkLocation(); - }; - _CurrentPageBox.KeyUp += (s, args) => { - int d; - switch (args.KeyCode) { - case Keys.Enter: - d = 0; - break; - case Keys.Up: - case Keys.OemMinus: - d = -1; - break; - case Keys.Down: - case Keys.Add: - d = 1; - break; - case Keys.Home: - _ViewerBox.CurrentPageNumber = 1; - return; - case Keys.End: - _ViewerBox.CurrentPageNumber = -1; - return; - default: - return; - } - if (_CurrentPageBox.Text.TryParse(out int p)) { - _ViewerBox.CurrentPageNumber = p + d; - } - }; - _ViewerButton.DropDownOpening += (s, args) => SetupMenu(_ViewerButton.DropDownItems); - _OcrMenu.DropDownItemClicked += (s, args) => _ViewerBox.OcrLanguage = (int)(args.ClickedItem.Tag ?? 0); - _OcrMenu.DropDownOpening += (s, args) => { - var m = _OcrMenu.DropDownItems; - if (m.Count == 1) { - for (int i = 0; i < Constants.Ocr.LangIDs.Length; i++) { - var item = new ToolStripMenuItem(Constants.Ocr.LangNames[i]); - m.Add(item); - item.Tag = Constants.Ocr.LangIDs[i]; - item.Enabled = ModiOcr.IsLanguageInstalled(Constants.Ocr.LangIDs[i]); - } - } - foreach (ToolStripMenuItem item in _OcrMenu.DropDownItems) { - item.Checked = _ViewerBox.OcrLanguage == (int)(item.Tag ?? 0); - } - }; - _ZoomBox.Text = Constants.DestinationAttributes.ViewType.FitH; - _ZoomBox.TextChanged += (s, args) => _ViewerBox.LiteralZoom = _ZoomBox.Text; - _ViewerBox.Enabled = false; - _ViewerBox.DocumentLoaded += (s, args) => _CurrentPageBox.ToolTipText = "文档共" + _ViewerBox.Document.PageCount + "页\nHome:转到第一页\nEnd:转到最后一页"; - _ViewerBox.ZoomChanged += (s, args) => _ZoomBox.ToolTipText = "当前显示比例:" + (_ViewerBox.ZoomFactor * 100).ToInt32() + "%"; - _ViewerBox.PageChanged += (s, args) => _CurrentPageBox.Text = _ViewerBox.CurrentPageNumber.ToText(); - //_ViewerBox.SelectionChanged += (s, args) => - //{ - // var t = args.Selection.SelectedText; - // if (String.IsNullOrEmpty (t) == false) { - // var p = _ViewerBox.ViewBox.SelectionRegion; - // ShowInsertBookmarkDialog (_ViewerBox.ViewBox.PointToClient (MousePosition), _ViewerBox.MapPositionFromImagePoint (p.Left.ToInt32 (), p.Top.ToInt32 ()), t); - // } - //}; - //_ViewerBox.MouseMode = Editor.MouseMode.Selection; - _ViewerBox.MouseMove += (s, args) => { - if (_ViewerBox.FirstPage == 0) { - return; - } - var l = args.Location; - var p = _ViewerBox.TransposeClientToPagePosition(l.X, l.Y); - if (p.Page == 0) { - return; - } - var ti = _ViewerBox.FindTextLines(p); - var t = ti.ToString(); - _PageInfoBox.Text = string.Concat("页面:", p.Page, "; 位置:", Math.Round(p.PageX, 2), " * ", Math.Round(p.PageY, 2), ti.Spans.HasContent() ? String.Concat("; 字体:", String.Join(";", ti.GetFontNames()), " ", ti.Spans[0].Size) : null, t != null ? "; 文本:" : null, t); - }; - _ViewerBox.MouseClick += _ViewBox_MouseClick; - _ViewerToolbar.Enabled = false; - - Disposed += (s, args) => _controller.Destroy(); - } - - void ScrollToSelectedBookmarkLocation() { - BookmarkElement el; - var i = _BookmarkBox.GetFirstSelectedIndex(); - //_MainToolbar.ToggleEnabled (i != -1, _editButtonNames); - if (i == -1) { - return; - } - el = _BookmarkBox.GetModelObject(i) as BookmarkElement; - if (_controller.Model.LockDownViewer == false - && _BookmarkBox.SelectedIndices.Count == 1 - && (i = el.Page) > 0) { - var v = _ViewerBox; - if (_controller.Model.PdfDocument != null && el.Page > 0 && el.Page <= _ViewerBox.Document.PageCount) { - var b = _ViewerBox.GetPageBound(el.Page); - v.ScrollToPosition(new Editor.PagePosition(el.Page, - v.HorizontalFlow ? el.Left > b.Width ? b.Width : el.Left : 0, - v.HorizontalFlow || el.Top == 0 ? 0 : el.Top.LimitInRange(b.Top, b.Bottom), - 0, 0, true) - ); - } - } - } - - //protected override void OnClick (EventArgs e) { - // base.OnClick (e); - // _controller.HideInsertBookmarkForm (); - //} - internal override void OnDeselected() { - base.OnDeselected(); - _searchForm?.Close(); - } - - void _ViewBox_MouseClick(object sender, MouseEventArgs args) { - if (_ViewerBox.FirstPage == 0) { - return; - } - var l = args.Location; - if (args.Button != MouseButtons.Right) { - return; - } - - _ViewerBox.PinPoint = _ViewerBox.PointToImage(l); - SetupMenu(_ViewerMenu.Items); - _ViewerMenu.Show(_ViewerBox, l); - if (_ViewerBox.IsClientPointInSelection(l) == false) { - _ViewerBox.SelectNone(); - } - //_ViewerBox.Invalidate (); - //var sp = _ViewerBox.FindTextSpanAtPoint (p); - //var t = sp != null ? sp.Text : String.Empty; - //_controller.ShowInsertBookmarkDialog (l, p, t); - } - - void _MainToolbar_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { - e.ClickedItem.HidePopupMenu(); - ExecuteCommand(e.ClickedItem.Name); - } - - void ButtonClicked(object sender, EventArgs e) { - if (sender == _UndoButton) { - _controller.Undo(1); - } - else if (sender == _AddFilesButton) { - ExecuteCommand(Commands.Open); - } - } - - public override void SetupCommand(ToolStripItem item) { - var n = item.Name; - var l = _controller.Model.DocumentPath != null; - var m = item as ToolStripMenuItem; - if (_controller.Model.IsLoadingDocument) { - item.Enabled = false; - return; - } - switch (n) { - case Commands.Action: - EnableCommand(item, l, true); - item.ToolTipText = "将书签和编辑结果写入到 PDF 文件中"; - break; - case Commands.SaveBookmark: - case Commands.SaveAsInfoFile: - EnableCommand(item, l, true); - break; - case Commands.SelectAllFolders: - case Commands.SelectAllImages: - case Commands.SelectAllPdf: - case Commands.ItemTypeSeparator: - EnableCommand(item, false, false); - break; - case Commands.Options: - item.Text = "设置文件修改方式(&X)..."; - item.ToolTipText = "设置在编辑器修改 PDF 文档的选项"; - EnableCommand(item, true, true); - item.Tag = nameof(Function.EditorOptions); - break; - case Commands.ResetOptions: - // keep disabled - break; - case Commands.DocumentProperties: - item.Enabled = _ViewerBox.Document != null && _ViewerBox.Document.IsDocumentOpened; - item.Visible = true; - break; - case "_ScrollVertical": m.Checked = _ViewerBox.ContentDirection == Editor.ContentDirection.TopToDown; break; - case "_ScrollHorizontal": m.Checked = _ViewerBox.ContentDirection == Editor.ContentDirection.RightToLeft; break; - case "_TrueColorSpace": m.Checked = _ViewerBox.GrayScale == false; break; - case "_GrayColorSpace": m.Checked = _ViewerBox.GrayScale; break; - case "_InvertColor": m.Checked = _ViewerBox.InvertColor; break; - case "_MoveMode": m.Checked = _ViewerBox.MouseMode == Editor.MouseMode.Move; break; - case "_SelectionMode": m.Checked = _ViewerBox.MouseMode == Editor.MouseMode.Selection; break; - case "_FullPageScroll": m.Checked = _ViewerBox.FullPageScroll; break; - case "_ShowTextBorders": m.Checked = _ViewerBox.ShowTextBorders; break; - case "_DarkMode": m.Checked = _ViewerBox.TintColor == __DarkModeColor; break; - case "_GreenMode": m.Checked = _ViewerBox.TintColor == __GreenModeColor; break; - case "_ShowAnnotations": m.Checked = _ViewerBox.HideAnnotations == false; break; - case "_ShowBookmarks": m.Checked = _MainPanel.Panel1Collapsed == false; break; - case "_OcrPage": item.Enabled = ModiOcr.ModiInstalled && _ViewerBox.OcrLanguage != Constants.Ocr.NoLanguage; break; - case "_OcrDetectPunctuation": - item.Enabled = ModiOcr.ModiInstalled && _ViewerBox.OcrLanguage != Constants.Ocr.NoLanguage; - m.Checked = _ViewerBox.OcrOptions.DetectContentPunctuations; - break; - case "_InsertWithOcrOnly": - m.Checked = _controller.Model.InsertBookmarkWithOcrOnly; - break; - case "_EnableOcr": - item.Enabled = ModiOcr.ModiInstalled; - item.ToolTipText = item.Enabled ? String.Empty : Messages.ModiNotAvailable; - break; - case "_OcrDisabled": - m.Checked = _ViewerBox.OcrLanguage == Constants.Ocr.NoLanguage; - break; - case "_CopySelection": - item.Enabled = _ViewerBox.SelectionRegion.Contains(_ViewerBox.PinPoint); - break; - case "_AutoBookmark": - if (m.DropDownItems.Count == 0) { - m.DropDownItemClicked += _MainToolbar_ItemClicked; - for (int i = 1; i < 8; i++) { - m.DropDownItems.Add(new ToolStripMenuItem("&" + i + " 级标题") { Name = "_AutoBookmarkLevel" + i }); - } - } - break; - case "_FullScreen": - m.Checked = AppContext.MainForm.FullScreen; - break; - default: - EnableCommand(item, true, true); - break; - } - base.SetupCommand(item); - } - - public override void ExecuteCommand(string cmd, params string[] parameters) { - switch (cmd) { - #region 书签命令 - case "_InsertBookmark": - _controller.InsertBookmark(); - break; - case "_MergeBookmark": - _controller.MergeBookmark(_BookmarkBox.GetSelectedElements()); - break; - case "_SearchReplace": - if (_searchForm == null || _searchForm.IsDisposed) { - _searchForm = new SearchBookmarkForm(_controller); - } - if (_searchForm.Visible == false) { - _searchForm.Show(this); - } - _searchForm.BringToFront(); - break; - #endregion - #region 阅读器工具栏命令 - case "_AutoBookmark": - _controller.ShowAutoBookmarkForm(); - break; - case "_CopySelection": - var sel = _ViewerBox.GetSelection(); - if (sel.Page > 0) { - using (var b = sel.GetSelectedBitmap()) { - Clipboard.SetImage(b); - } - } - break; - case "_InsertPageLabel": - _controller.LabelAtPage(_ViewerBox.TransposeVirtualImageToPagePosition(_ViewerBox.PinPoint.X, _ViewerBox.PinPoint.Y)); - break; - case "_InsertWithOcrOnly": - _controller.Model.InsertBookmarkWithOcrOnly = !_controller.Model.InsertBookmarkWithOcrOnly; - break; - #endregion - default: - if (cmd.StartsWith("_AutoBookmarkLevel", StringComparison.Ordinal)) { - _controller.ConfigAutoBookmarkTextStyles( - cmd.Substring("_AutoBookmarkLevel".Length).ToInt32(), - _ViewerBox.FindTextLines(_ViewerBox.TransposeVirtualImageToPagePosition(_ViewerBox.PinPoint.X, _ViewerBox.PinPoint.Y))); - break; - } - __Commands.Process(cmd, _controller, parameters); - break; - } - } - - public void CloseDocument() { - _ViewerBox.CloseFile(); - } - - public void Reopen() { - _ViewerBox.Reopen(); - } - - void _BookmarkColorButton_SelectedColorChanged(object sender, EventArgs e) { - var c = _BookmarkColorButton.Color; - _controller.ProcessBookmarks(new SetTextColorProcessor(c)); - } - - void _OpenButton_DropDownOpening(object sender, EventArgs e) { - var m = (sender as ToolStripDropDownItem); - var l = m.DropDown.Items; - l.ClearDropDownItems(); - l.AddSourcePdfFiles(); - if (l.Count > 0) { - l.Add(new ToolStripSeparator()); - } - l.AddInfoFiles(); - } - - void _OpenButton_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { - e.ClickedItem.HidePopupMenu(); - ExecuteCommand(Commands.OpenFile, e.ClickedItem.ToolTipText); - } - - [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] - protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { - if (_BookmarkBox.IsCellEditing || _BookmarkBox.IsLabelEditing || _CurrentPageBox.Focused) { - return base.ProcessCmdKey(ref msg, keyData); - } - switch (keyData ^ Keys.Control) { - case Keys.B: - ExecuteCommand("_BookmarkBoldButton"); return true; - case Keys.I: - ExecuteCommand("_BookmarkItalicButton"); return true; - case Keys.Z: _controller.Undo(1); return true; - case Keys.F: - ExecuteCommand("_SearchReplace"); return true; - case Keys.R: - ExecuteCommand(Commands.ImportBookmark); return true; - case Keys.Q: - ExecuteCommand(Commands.SaveBookmark); return true; - case Keys.S: - ExecuteCommand(Commands.Action); return true; - case Keys.O: - ExecuteCommand(Commands.Open); return true; - case Keys.C: - ExecuteCommand(Commands.Copy); return true; - case Keys.V: - ExecuteCommand(Commands.Paste); return true; - } - switch (keyData ^ Keys.Shift) { - case Keys.Tab: - ExecuteCommand("_LevelUp"); return true; - } - switch (keyData) { - case Keys.Insert: - _controller.InsertBookmark(); return true; - case Keys.Delete: - ExecuteCommand(Commands.Delete); return true; - case Keys.Add: - ExecuteCommand("_IncrementPageNumber"); return true; - case Keys.Subtract: - ExecuteCommand("_DecrementPageNumber"); return true; - case Keys.P: - if (_BookmarkBox.FocusedItem != null) { - _BookmarkBox.EditSubItem(_BookmarkBox.FocusedItem as BrightIdeasSoftware.OLVListItem, _BookmarkBox.BookmarkPageColumn.Index); - } - return true; - case Keys.Tab: - ExecuteCommand("_LevelDown"); return true; - case Keys.F2: - if (_BookmarkBox.FocusedItem != null) { - _BookmarkBox.FocusedItem.BeginEdit(); - } - else { - _BookmarkBox.SelectedItem?.BeginEdit(); - } - return true; - case Keys.Space: - if (_BookmarkBox.FocusedItem != null) { - _ViewerBox.CurrentPageNumber = (_BookmarkBox.FocusedObject as BookmarkElement).Page; - } - return true; - } - - return base.ProcessCmdKey(ref msg, keyData); - } - - void _BookmarkBox_DragEnter(object sender, DragEventArgs e) { - e.FeedbackDragFileOver(Constants.FileExtensions.PdfAndAllBookmarkExtension); - } - - void _BookmarkBox_DragDrop(object sender, DragEventArgs e) { - if (this.DropFileOver(e, Constants.FileExtensions.PdfAndAllBookmarkExtension)) { - _controller.LoadDocument(Text, false); - } - } - - - #region Editor.IEditView - bool Editor.IEditView.AffectsDescendantBookmarks => _IncludeDecendantBox.Checked || ModifierKeys == Keys.Shift; - - ToolStripSplitButton Editor.IEditView.UndoButton => _UndoButton; - - AutoBookmarkForm Editor.IEditView.AutoBookmark { - get { - if (_autoBookmarkForm == null || _autoBookmarkForm.IsDisposed) { - _autoBookmarkForm = new AutoBookmarkForm(_controller); - } - return _autoBookmarkForm; - } - } - - BookmarkEditorView Editor.IEditView.Bookmark => _BookmarkBox; - - PdfViewerControl Editor.IEditView.Viewer => _ViewerBox; - - ToolStrip Editor.IEditView.ViewerToolbar => _ViewerToolbar; - - ToolStrip Editor.IEditView.BookmarkToolbar => _BookmarkToolbar; - - SplitContainer Editor.IEditView.MainPanel => _MainPanel; - - #endregion - } -} diff --git a/pdfpatcher/App/Functions/EditorControl.resx b/pdfpatcher/App/Functions/EditorControl.resx deleted file mode 100644 index 03ef9e6424de96c9afc7eb25add94e4b25527e1c..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/EditorControl.resx +++ /dev/null @@ -1,454 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - 244, 17 - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - 17, 17 - - - 382, 17 - - - 126, 17 - - - 815, 17 - - - 526, 17 - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAALRSURBVDhPzZJrSJNhFMefd+9EISiFMogICaL6IPkhQcWK - nM3USs0MLxO3hSFIoYRZar6StVfdNHUzxVBWppWXzdm87L4xL02GzAuFdFGbo9SpaWkmymnvXEnQxz70 - gz+Hczj/8xye50H/HB2B6BqO2zEDl5ak59Jz9Gy8RM/B+XoOPd+h6wYuzlSw0A5X+zbNcQjXcOkntWw6 - MZJ8pHs2JgamIyPBRmSu2zqI9Ql5+ldTz2nok58ANbG3VcVxP+iyIqTkon3qFPrNV7cONdjaM95NMJnw - Iz8f1vLyoN/XFyZab4OhPRBWbXmwMp0L0vrDoGa7kaqraBfqTnH3UXDc+W/rE006XdnmR1k+mPz8wBwU - BAofHxjOS4RJSS7IxEdB+cIfngr3w4g0FSxFwZ0KNn4edSbjBROPr4zMakqAMlMavcMCqbc3WHISftfM - TUlQJ9gDpoYEsHYQYG3L+NDFomUjeSJeOtZHbEy/LIDPShLmDWVg1wmAyv8mjVQMN5rG4Zp4FISZsXJU - F43XvH6WZp3TE2uDotjxxiSvdmMRc2je8ABm1MXOgVS0dRU6lfZoCCp6v0O5cRWi7nYCEpylB/PDsFY+ - E28WhNHSqVwQhmmWB6tBT16YrIjyHNSS5yZntXz4pODBxfs9EM/XQkjWcyDYDK3rHbYgTiGP0jCcL8kO - GF6x1EFtvJeaqtfGeaoX+4XOTdqeCCEgvR5qCzOnnsXhxU7jL8rDaTmyrONmna56c6G3Aqyqe0vvZTl2 - a3fB0oKxHOYcW1DRbiz91sLdLWm8hAJd1i2qIrAWe3/lmvMiHVrsq4Ql00OgTv8yIALqQw1VXX7TlLhT - Ko6lJbhs24jCMclAbcrUTA+xumSugbEBYmNKSSxbxKk2eW7QcHW0h0oUgRXXhCNfl+VPeAzkTzIwoUMK - XijWR4ZgvWQo1sJjYALyDGIVhaIDrtb/BoR+AhgWoMzludfHAAAAAElFTkSuQmCC - - - - 680, 17 - - - 94 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/ExtractImageControl.Designer.cs b/pdfpatcher/App/Functions/ExtractImageControl.Designer.cs deleted file mode 100644 index b8d79df75a4dac2b1ec8779e43b766041f3f837f..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/ExtractImageControl.Designer.cs +++ /dev/null @@ -1,575 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class ExtractImageControl - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ExtractImageControl)); - this._ExtractPageRangeBox = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this._BrowseTargetPdfButton = new System.Windows.Forms.Button(); - this._SaveImageBox = new System.Windows.Forms.FolderBrowserDialog(); - this.label4 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this._FileMaskPreviewBox = new System.Windows.Forms.Label(); - this._FileNameMaskBox = new System.Windows.Forms.ComboBox(); - this._MergeImageBox = new System.Windows.Forms.CheckBox(); - this._VerticalFlipImageBox = new System.Windows.Forms.CheckBox(); - this._InvertBlackAndWhiteBox = new System.Windows.Forms.CheckBox(); - this.label7 = new System.Windows.Forms.Label(); - this._MinWidthBox = new System.Windows.Forms.NumericUpDown(); - this.label8 = new System.Windows.Forms.Label(); - this._MinHeightBox = new System.Windows.Forms.NumericUpDown(); - this.label9 = new System.Windows.Forms.Label(); - this.tabControl1 = new System.Windows.Forms.TabControl(); - this.tabPage1 = new System.Windows.Forms.TabPage(); - this._MonoPngBox = new System.Windows.Forms.RadioButton(); - this._MonoTiffBox = new System.Windows.Forms.RadioButton(); - this.label1 = new System.Windows.Forms.Label(); - this._InvertSoftMaskBox = new System.Windows.Forms.CheckBox(); - this._ExportSoftMaskBox = new System.Windows.Forms.CheckBox(); - this._ExportAnnotImagesBox = new System.Windows.Forms.CheckBox(); - this._MergeJpgToPngBox = new System.Windows.Forms.CheckBox(); - this.tabPage2 = new System.Windows.Forms.TabPage(); - this.label6 = new System.Windows.Forms.Label(); - this.tabPage3 = new System.Windows.Forms.TabPage(); - this.textBox1 = new System.Windows.Forms.TextBox(); - this._AutoOutputDirBox = new System.Windows.Forms.CheckBox(); - this._TargetBox = new PDFPatcher.HistoryComboBox(); - this._SourceFileControl = new PDFPatcher.SourceFileControl(); - this._ExtractButton = new EnhancedGlassButton.GlassButton(); - this._SkipRedundantImagesBox = new System.Windows.Forms.CheckBox(); - ((System.ComponentModel.ISupportInitialize)(this._MinWidthBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this._MinHeightBox)).BeginInit(); - this.tabControl1.SuspendLayout(); - this.tabPage1.SuspendLayout(); - this.tabPage2.SuspendLayout(); - this.tabPage3.SuspendLayout(); - this.SuspendLayout(); - // - // _ExtractPageRangeBox - // - this._ExtractPageRangeBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ExtractPageRangeBox.Location = new System.Drawing.Point(124, 8); - this._ExtractPageRangeBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._ExtractPageRangeBox.Name = "_ExtractPageRangeBox"; - this._ExtractPageRangeBox.Size = new System.Drawing.Size(473, 25); - this._ExtractPageRangeBox.TabIndex = 1; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(8, 11); - this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(82, 15); - this.label3.TabIndex = 0; - this.label3.Text = "页码范围:"; - // - // _BrowseTargetPdfButton - // - this._BrowseTargetPdfButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._BrowseTargetPdfButton.Image = global::PDFPatcher.Properties.Resources.ImageFolder; - this._BrowseTargetPdfButton.Location = new System.Drawing.Point(529, 42); - this._BrowseTargetPdfButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._BrowseTargetPdfButton.Name = "_BrowseTargetPdfButton"; - this._BrowseTargetPdfButton.Size = new System.Drawing.Size(100, 29); - this._BrowseTargetPdfButton.TabIndex = 4; - this._BrowseTargetPdfButton.Text = "浏览..."; - this._BrowseTargetPdfButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._BrowseTargetPdfButton.UseVisualStyleBackColor = true; - this._BrowseTargetPdfButton.Click += new System.EventHandler(this._BrowseTargetPdfButton_Click); - // - // _SaveImageBox - // - this._SaveImageBox.Description = "请选择保存图片的文件夹"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(23, 49); - this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(112, 15); - this.label4.TabIndex = 2; - this.label4.Text = "输出图片位置:"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(8, 11); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(97, 15); - this.label2.TabIndex = 0; - this.label2.Text = "文件名掩码:"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(11, 119); - this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(97, 15); - this.label5.TabIndex = 2; - this.label5.Text = "文件名示例:"; - // - // _FileMaskPreviewBox - // - this._FileMaskPreviewBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._FileMaskPreviewBox.Location = new System.Drawing.Point(121, 119); - this._FileMaskPreviewBox.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this._FileMaskPreviewBox.Name = "_FileMaskPreviewBox"; - this._FileMaskPreviewBox.Size = new System.Drawing.Size(440, 39); - this._FileMaskPreviewBox.TabIndex = 3; - // - // _FileNameMaskBox - // - this._FileNameMaskBox.FormattingEnabled = true; - this._FileNameMaskBox.Items.AddRange(new object[] { - "0000", - "000", - "0", - "图片0000"}); - this._FileNameMaskBox.Location = new System.Drawing.Point(124, 8); - this._FileNameMaskBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._FileNameMaskBox.Name = "_FileNameMaskBox"; - this._FileNameMaskBox.Size = new System.Drawing.Size(423, 23); - this._FileNameMaskBox.TabIndex = 1; - this._FileNameMaskBox.TextChanged += new System.EventHandler(this._FileNameMaskBox_TextChanged); - // - // _MergeImageBox - // - this._MergeImageBox.AutoSize = true; - this._MergeImageBox.Location = new System.Drawing.Point(11, 41); - this._MergeImageBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._MergeImageBox.Name = "_MergeImageBox"; - this._MergeImageBox.Size = new System.Drawing.Size(194, 19); - this._MergeImageBox.TabIndex = 3; - this._MergeImageBox.Text = "尝试合并相同页面的图片"; - this._MergeImageBox.UseVisualStyleBackColor = true; - // - // _VerticalFlipImageBox - // - this._VerticalFlipImageBox.AutoSize = true; - this._VerticalFlipImageBox.Location = new System.Drawing.Point(277, 69); - this._VerticalFlipImageBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._VerticalFlipImageBox.Name = "_VerticalFlipImageBox"; - this._VerticalFlipImageBox.Size = new System.Drawing.Size(119, 19); - this._VerticalFlipImageBox.TabIndex = 6; - this._VerticalFlipImageBox.Text = "垂直翻转图片"; - this._VerticalFlipImageBox.UseVisualStyleBackColor = true; - // - // _InvertBlackAndWhiteBox - // - this._InvertBlackAndWhiteBox.AutoSize = true; - this._InvertBlackAndWhiteBox.Location = new System.Drawing.Point(11, 96); - this._InvertBlackAndWhiteBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._InvertBlackAndWhiteBox.Name = "_InvertBlackAndWhiteBox"; - this._InvertBlackAndWhiteBox.Size = new System.Drawing.Size(164, 19); - this._InvertBlackAndWhiteBox.TabIndex = 7; - this._InvertBlackAndWhiteBox.Text = "反转黑白图片的颜色"; - this._InvertBlackAndWhiteBox.UseVisualStyleBackColor = true; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(8, 155); - this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(97, 15); - this.label7.TabIndex = 13; - this.label7.Text = "忽略宽度小于"; - // - // _MinWidthBox - // - this._MinWidthBox.Increment = new decimal(new int[] { - 10, - 0, - 0, - 0}); - this._MinWidthBox.Location = new System.Drawing.Point(119, 152); - this._MinWidthBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._MinWidthBox.Maximum = new decimal(new int[] { - 10000, - 0, - 0, - 0}); - this._MinWidthBox.Name = "_MinWidthBox"; - this._MinWidthBox.Size = new System.Drawing.Size(57, 25); - this._MinWidthBox.TabIndex = 14; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(184, 155); - this.label8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(82, 15); - this.label8.TabIndex = 15; - this.label8.Text = "或高度小于"; - // - // _MinHeightBox - // - this._MinHeightBox.Increment = new decimal(new int[] { - 10, - 0, - 0, - 0}); - this._MinHeightBox.Location = new System.Drawing.Point(279, 152); - this._MinHeightBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._MinHeightBox.Maximum = new decimal(new int[] { - 10000, - 0, - 0, - 0}); - this._MinHeightBox.Name = "_MinHeightBox"; - this._MinHeightBox.Size = new System.Drawing.Size(57, 25); - this._MinHeightBox.TabIndex = 16; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(344, 155); - this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(82, 15); - this.label9.TabIndex = 17; - this.label9.Text = "像素的图片"; - // - // tabControl1 - // - this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tabControl1.Controls.Add(this.tabPage1); - this.tabControl1.Controls.Add(this.tabPage2); - this.tabControl1.Controls.Add(this.tabPage3); - this.tabControl1.Location = new System.Drawing.Point(16, 115); - this.tabControl1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.tabControl1.Name = "tabControl1"; - this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(617, 286); - this.tabControl1.TabIndex = 7; - // - // tabPage1 - // - this.tabPage1.Controls.Add(this._SkipRedundantImagesBox); - this.tabPage1.Controls.Add(this._MonoPngBox); - this.tabPage1.Controls.Add(this._MonoTiffBox); - this.tabPage1.Controls.Add(this.label1); - this.tabPage1.Controls.Add(this._InvertSoftMaskBox); - this.tabPage1.Controls.Add(this._ExportSoftMaskBox); - this.tabPage1.Controls.Add(this._ExportAnnotImagesBox); - this.tabPage1.Controls.Add(this._MergeJpgToPngBox); - this.tabPage1.Controls.Add(this.label3); - this.tabPage1.Controls.Add(this.label9); - this.tabPage1.Controls.Add(this._InvertBlackAndWhiteBox); - this.tabPage1.Controls.Add(this.label7); - this.tabPage1.Controls.Add(this.label8); - this.tabPage1.Controls.Add(this._VerticalFlipImageBox); - this.tabPage1.Controls.Add(this._ExtractPageRangeBox); - this.tabPage1.Controls.Add(this._MinWidthBox); - this.tabPage1.Controls.Add(this._MergeImageBox); - this.tabPage1.Controls.Add(this._MinHeightBox); - this.tabPage1.Location = new System.Drawing.Point(4, 25); - this.tabPage1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.tabPage1.Size = new System.Drawing.Size(609, 257); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "选项"; - this.tabPage1.UseVisualStyleBackColor = true; - // - // _MonoPngBox - // - this._MonoPngBox.AutoSize = true; - this._MonoPngBox.Location = new System.Drawing.Point(277, 124); - this._MonoPngBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._MonoPngBox.Name = "_MonoPngBox"; - this._MonoPngBox.Size = new System.Drawing.Size(90, 19); - this._MonoPngBox.TabIndex = 12; - this._MonoPngBox.TabStop = true; - this._MonoPngBox.Text = "PNG 文件"; - this._MonoPngBox.UseVisualStyleBackColor = true; - // - // _MonoTiffBox - // - this._MonoTiffBox.AutoSize = true; - this._MonoTiffBox.Location = new System.Drawing.Point(167, 124); - this._MonoTiffBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._MonoTiffBox.Name = "_MonoTiffBox"; - this._MonoTiffBox.Size = new System.Drawing.Size(98, 19); - this._MonoTiffBox.TabIndex = 11; - this._MonoTiffBox.TabStop = true; - this._MonoTiffBox.Text = "TIFF 文件"; - this._MonoTiffBox.UseVisualStyleBackColor = true; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(8, 126); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(142, 15); - this.label1.TabIndex = 10; - this.label1.Text = "将黑白图片保存为:"; - // - // _InvertSoftMaskBox - // - this._InvertSoftMaskBox.AutoSize = true; - this._InvertSoftMaskBox.Location = new System.Drawing.Point(413, 96); - this._InvertSoftMaskBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._InvertSoftMaskBox.Name = "_InvertSoftMaskBox"; - this._InvertSoftMaskBox.Size = new System.Drawing.Size(119, 19); - this._InvertSoftMaskBox.TabIndex = 9; - this._InvertSoftMaskBox.Text = "反转掩模颜色"; - this._InvertSoftMaskBox.UseVisualStyleBackColor = true; - // - // _ExportSoftMaskBox - // - this._ExportSoftMaskBox.AutoSize = true; - this._ExportSoftMaskBox.Location = new System.Drawing.Point(277, 96); - this._ExportSoftMaskBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._ExportSoftMaskBox.Name = "_ExportSoftMaskBox"; - this._ExportSoftMaskBox.Size = new System.Drawing.Size(119, 19); - this._ExportSoftMaskBox.TabIndex = 8; - this._ExportSoftMaskBox.Text = "导出图像掩模"; - this._ExportSoftMaskBox.UseVisualStyleBackColor = true; - // - // _ExportAnnotImagesBox - // - this._ExportAnnotImagesBox.AutoSize = true; - this._ExportAnnotImagesBox.Location = new System.Drawing.Point(11, 69); - this._ExportAnnotImagesBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._ExportAnnotImagesBox.Name = "_ExportAnnotImagesBox"; - this._ExportAnnotImagesBox.Size = new System.Drawing.Size(149, 19); - this._ExportAnnotImagesBox.TabIndex = 5; - this._ExportAnnotImagesBox.Text = "导出批注内的图片"; - this._ExportAnnotImagesBox.UseVisualStyleBackColor = true; - // - // _MergeJpgToPngBox - // - this._MergeJpgToPngBox.AutoSize = true; - this._MergeJpgToPngBox.Location = new System.Drawing.Point(277, 41); - this._MergeJpgToPngBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._MergeJpgToPngBox.Name = "_MergeJpgToPngBox"; - this._MergeJpgToPngBox.Size = new System.Drawing.Size(244, 19); - this._MergeJpgToPngBox.TabIndex = 4; - this._MergeJpgToPngBox.Text = "JPEG 图片无损合并为 PNG 图片"; - this._MergeJpgToPngBox.UseVisualStyleBackColor = true; - // - // tabPage2 - // - this.tabPage2.Controls.Add(this.label6); - this.tabPage2.Controls.Add(this._FileNameMaskBox); - this.tabPage2.Controls.Add(this.label2); - this.tabPage2.Controls.Add(this.label5); - this.tabPage2.Controls.Add(this._FileMaskPreviewBox); - this.tabPage2.Location = new System.Drawing.Point(4, 25); - this.tabPage2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.tabPage2.Size = new System.Drawing.Size(609, 257); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "文件命名"; - this.tabPage2.UseVisualStyleBackColor = true; - // - // label6 - // - this.label6.Location = new System.Drawing.Point(121, 38); - this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(440, 81); - this.label6.TabIndex = 4; - this.label6.Text = "文件名掩码说明:\r\n“0000”:不足四位用0补足四位。\r\n“0”:文件名按实际页码,不用0补位。\r\n可用英文双引号将文本括起来(如“\"相约2046\"0”,前面的" + - "“2046”不会被解释为占位符)。"; - // - // tabPage3 - // - this.tabPage3.Controls.Add(this.textBox1); - this.tabPage3.Location = new System.Drawing.Point(4, 25); - this.tabPage3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.tabPage3.Name = "tabPage3"; - this.tabPage3.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.tabPage3.Size = new System.Drawing.Size(609, 257); - this.tabPage3.TabIndex = 2; - this.tabPage3.Text = "页码范围说明"; - this.tabPage3.UseVisualStyleBackColor = true; - // - // textBox1 - // - this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBox1.Location = new System.Drawing.Point(8, 8); - this.textBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.textBox1.Multiline = true; - this.textBox1.Name = "textBox1"; - this.textBox1.ReadOnly = true; - this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.textBox1.Size = new System.Drawing.Size(581, 224); - this.textBox1.TabIndex = 2; - this.textBox1.Text = resources.GetString("textBox1.Text"); - // - // _AutoOutputDirBox - // - this._AutoOutputDirBox.AutoSize = true; - this._AutoOutputDirBox.Location = new System.Drawing.Point(25, 84); - this._AutoOutputDirBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._AutoOutputDirBox.Name = "_AutoOutputDirBox"; - this._AutoOutputDirBox.Size = new System.Drawing.Size(194, 19); - this._AutoOutputDirBox.TabIndex = 5; - this._AutoOutputDirBox.Text = "自动指定输出图片的位置"; - this._AutoOutputDirBox.UseVisualStyleBackColor = true; - // - // _TargetBox - // - this._TargetBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._TargetBox.Contents = null; - this._TargetBox.FormattingEnabled = true; - this._TargetBox.Location = new System.Drawing.Point(149, 45); - this._TargetBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._TargetBox.MaxItemCount = 16; - this._TargetBox.Name = "_TargetBox"; - this._TargetBox.Size = new System.Drawing.Size(371, 23); - this._TargetBox.TabIndex = 3; - // - // _SourceFileControl - // - this._SourceFileControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._SourceFileControl.Location = new System.Drawing.Point(16, 4); - this._SourceFileControl.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5); - this._SourceFileControl.Name = "_SourceFileControl"; - this._SourceFileControl.Size = new System.Drawing.Size(617, 36); - this._SourceFileControl.TabIndex = 1; - // - // _ExtractButton - // - this._ExtractButton.AlternativeFocusBorderColor = System.Drawing.SystemColors.Highlight; - this._ExtractButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._ExtractButton.AnimateGlow = true; - this._ExtractButton.BackColor = System.Drawing.SystemColors.Highlight; - this._ExtractButton.CornerRadius = 3; - this._ExtractButton.ForeColor = System.Drawing.SystemColors.ControlText; - this._ExtractButton.GlowColor = System.Drawing.Color.White; - this._ExtractButton.Image = global::PDFPatcher.Properties.Resources.Save; - this._ExtractButton.InnerBorderColor = System.Drawing.SystemColors.ControlDarkDark; - this._ExtractButton.Location = new System.Drawing.Point(465, 79); - this._ExtractButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._ExtractButton.Name = "_ExtractButton"; - this._ExtractButton.OuterBorderColor = System.Drawing.SystemColors.ControlLightLight; - this._ExtractButton.ShowFocusBorder = true; - this._ExtractButton.Size = new System.Drawing.Size(164, 36); - this._ExtractButton.TabIndex = 13; - this._ExtractButton.Text = " 提取图片(&T)"; - this._ExtractButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._ExtractButton.Click += new System.EventHandler(this._ExtractButton_Click); - // - // _SkipRedundantImagesBox - // - this._SkipRedundantImagesBox.AutoSize = true; - this._SkipRedundantImagesBox.Location = new System.Drawing.Point(11, 183); - this._SkipRedundantImagesBox.Name = "_SkipRedundantImagesBox"; - this._SkipRedundantImagesBox.Size = new System.Drawing.Size(164, 19); - this._SkipRedundantImagesBox.TabIndex = 18; - this._SkipRedundantImagesBox.Text = "避免导出相同的图片"; - this._SkipRedundantImagesBox.UseVisualStyleBackColor = true; - // - // ExtractImageControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this._ExtractButton); - this.Controls.Add(this._AutoOutputDirBox); - this.Controls.Add(this.tabControl1); - this.Controls.Add(this._TargetBox); - this.Controls.Add(this.label4); - this.Controls.Add(this._SourceFileControl); - this.Controls.Add(this._BrowseTargetPdfButton); - this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.Name = "ExtractImageControl"; - this.Size = new System.Drawing.Size(649, 416); - this.Load += new System.EventHandler(this.Control_Show); - this.VisibleChanged += new System.EventHandler(this.Control_Show); - this.Click += new System.EventHandler(this._ExtractButton_Click); - ((System.ComponentModel.ISupportInitialize)(this._MinWidthBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this._MinHeightBox)).EndInit(); - this.tabControl1.ResumeLayout(false); - this.tabPage1.ResumeLayout(false); - this.tabPage1.PerformLayout(); - this.tabPage2.ResumeLayout(false); - this.tabPage2.PerformLayout(); - this.tabPage3.ResumeLayout(false); - this.tabPage3.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.TextBox _ExtractPageRangeBox; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Button _BrowseTargetPdfButton; - private SourceFileControl _SourceFileControl; - private System.Windows.Forms.FolderBrowserDialog _SaveImageBox; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label _FileMaskPreviewBox; - private System.Windows.Forms.ComboBox _FileNameMaskBox; - private HistoryComboBox _TargetBox; - private System.Windows.Forms.CheckBox _MergeImageBox; - private System.Windows.Forms.CheckBox _VerticalFlipImageBox; - private System.Windows.Forms.CheckBox _InvertBlackAndWhiteBox; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.NumericUpDown _MinHeightBox; - private System.Windows.Forms.NumericUpDown _MinWidthBox; - private System.Windows.Forms.TabControl tabControl1; - private System.Windows.Forms.TabPage tabPage1; - private System.Windows.Forms.TabPage tabPage2; - private System.Windows.Forms.CheckBox _AutoOutputDirBox; - private System.Windows.Forms.CheckBox _MergeJpgToPngBox; - private System.Windows.Forms.CheckBox _ExportAnnotImagesBox; - private System.Windows.Forms.CheckBox _ExportSoftMaskBox; - private System.Windows.Forms.CheckBox _InvertSoftMaskBox; - private System.Windows.Forms.RadioButton _MonoTiffBox; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.RadioButton _MonoPngBox; - private EnhancedGlassButton.GlassButton _ExtractButton; - private System.Windows.Forms.TabPage tabPage3; - private System.Windows.Forms.TextBox textBox1; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.CheckBox _SkipRedundantImagesBox; - } -} diff --git a/pdfpatcher/App/Functions/ExtractImageControl.cs b/pdfpatcher/App/Functions/ExtractImageControl.cs deleted file mode 100644 index a6f70fec657365a20786ae04130ee19ad77a2f78..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/ExtractImageControl.cs +++ /dev/null @@ -1,189 +0,0 @@ -using System; -using System.ComponentModel; -using System.IO; -using System.Windows.Forms; -using PDFPatcher.Common; - -namespace PDFPatcher.Functions -{ - [ToolboxItem(false)] - public partial class ExtractImageControl : FunctionControl, IResettableControl - { - public override string FunctionName => "提取图片"; - - public override System.Drawing.Bitmap IconImage => Properties.Resources.ExtractImage; - - public ExtractImageControl() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - } - - void OnLoad() { - _SourceFileControl.BrowseSelectedFiles += (object sender, EventArgs e) => { - if (_AutoOutputDirBox.Checked == false) { - return; - } - var sourceFile = _SourceFileControl.FirstFile; - if (sourceFile.Length > 0) { - _TargetBox.Text = FileHelper.CombinePath(Path.GetDirectoryName(sourceFile), Path.GetFileNameWithoutExtension(sourceFile)); - } - }; - _AutoOutputDirBox.CheckedChanged += (object sender, EventArgs e) => { AppContext.ImageExtracter.AutoOutputFolder = _AutoOutputDirBox.Checked; }; - ShowFileMaskPreview(); - AppContext.MainForm.SetTooltip(_SourceFileControl.FileList, "包含图片的 PDF 文件路径"); - AppContext.MainForm.SetTooltip(_TargetBox, "放置输出图片的文件夹路径"); - AppContext.MainForm.SetTooltip(_ExtractPageRangeBox, "在此指定需提取图片的页码范围,不指定页码范围时提取所有页面的图片"); - AppContext.MainForm.SetTooltip(_FileNameMaskBox, "提取的图片文件名按其所在页码数字命名,可在此修改命名规则\n“0000”:不足四位用0补足四位\n“0”:文件名按实际页码,不用0补位\n可用英文双引号将文本括起来(如“\"相约2000\"0”,前面的“2000”不会被解释为占位符)"); - AppContext.MainForm.SetTooltip(_MergeImageBox, "尝试将相同页面下的图片合并为同一个文件\n①合并图片的格式必须相同\n②宽度必须相同\n③仅限 PNG 和 TIFF 格式"); - AppContext.MainForm.SetTooltip(_VerticalFlipImageBox, "某些 PDF 文件导出的图片上下颠倒,可用此选项将其还原"); - AppContext.MainForm.SetTooltip(_InvertBlackAndWhiteBox, "翻转 PNG 和 TIFF 黑白图片的颜色"); - AppContext.MainForm.SetTooltip(_MinHeightBox, "忽略高度小于此处指定值的图片"); - AppContext.MainForm.SetTooltip(_MinWidthBox, "忽略宽度小于此处指定值的图片"); - AppContext.MainForm.SetTooltip(_MergeJpgToPngBox, "在合并图片时,将使用有损压缩的 JPEG 图片合并为无损压缩的 PNG 图片"); - AppContext.MainForm.SetTooltip(_ExtractButton, "点击此按钮,将 PDF 文件的图片提取到指定的目录"); - AppContext.MainForm.SetTooltip(_SkipRedundantImagesBox, "避免导出 PDF 内部引用值一致的图片"); - Reload(); - } - - public void Reset() { - AppContext.ImageExtracter = new ImageExtracterOptions(); - Reload(); - } - - public void Reload() { - var o = AppContext.ImageExtracter; - _AutoOutputDirBox.Checked = o.AutoOutputFolder; - _FileNameMaskBox.Text = o.FileMask; - _InvertBlackAndWhiteBox.Checked = o.InvertBlackAndWhiteImages; - _MonoTiffBox.Checked = !o.MonoPng; - _MergeImageBox.Checked = o.MergeImages; - _MergeJpgToPngBox.Checked = o.MergeJpgToPng; - _ExportAnnotImagesBox.Checked = o.ExtractAnnotationImages; - _MinHeightBox.SetValue(o.MinHeight); - _MinWidthBox.SetValue(o.MinWidth); - _VerticalFlipImageBox.Checked = o.VerticalFlipImages; - _ExportSoftMaskBox.Checked = o.ExtractSoftMask; - _InvertSoftMaskBox.Checked = o.InvertSoftMask; - _MonoPngBox.Checked = o.MonoPng; - _SkipRedundantImagesBox.Checked = o.SkipRedundantImages; - } - - void _BrowseTargetPdfButton_Click(object sender, EventArgs e) { - var sourceFile = _SourceFileControl.Text; - if (_TargetBox.Text.Length > 0) { - _SaveImageBox.SelectedPath = Path.GetDirectoryName(_TargetBox.Text); - } - else if (sourceFile.Length > 0) { - _SaveImageBox.SelectedPath = Path.GetDirectoryName(sourceFile); - } - if (_SaveImageBox.ShowDialog() == DialogResult.OK) { - _TargetBox.Text = - _SaveImageBox.SelectedPath - //+ (_SaveImageBox.SelectedPath.EndsWith ("\\") ? String.Empty : "\\") - //+ Path.GetFileNameWithoutExtension (sourceFile) - ; - } - } - - void _ExtractButton_Click(object sender, EventArgs e) { - if (File.Exists(_SourceFileControl.FirstFile) == false) { - FormHelper.ErrorBox(Messages.SourceFileNotFound); - return; - } - if (_TargetBox.Text.IsNullOrWhiteSpace()) { - _BrowseTargetPdfButton_Click(_BrowseTargetPdfButton, e); - if (_TargetBox.Text.IsNullOrWhiteSpace()) { - return; - } - } - - AppContext.SourceFiles = _SourceFileControl.Files; - if (_SourceFileControl.Files.Length == 1) { - _SourceFileControl.FileList.AddHistoryItem(); - _TargetBox.AddHistoryItem(); - } - - AppContext.MainForm.ResetWorker(); - var worker = AppContext.MainForm.GetWorker(); - worker.DoWork += (dummy, arg) => { - var a = arg.Argument as object[]; - var files = a[0] as string[]; - var options = a[1] as ImageExtracterOptions; - options.OutputPath = new FilePath(options.OutputPath).Normalize(); - if (files.Length > 1) { - var ep = options.OutputPath; - Tracker.SetTotalProgressGoal(files.Length); - foreach (var file in files) { - options.OutputPath = new FilePath(ep).Combine(new FilePath(file).FileNameWithoutExtension).Normalize(); - Processor.Worker.ExtractImages(file, options); - Tracker.IncrementTotalProgress(); - if (AppContext.Abort) { - return; - } - } - } - else { - Processor.Worker.ExtractImages(files[0], options); - } - }; - worker.RunWorkerCompleted += (dummy, arg) => { AppContext.ImageExtracter.OutputPath = _ExtractPageRangeBox.Text; }; - var option = AppContext.ImageExtracter; - option.ExtractAnnotationImages = _ExportAnnotImagesBox.Checked; - option.PageRange = _ExtractPageRangeBox.Text; - option.OutputPath = _TargetBox.Text; - option.FileMask = _FileNameMaskBox.Text; - option.MergeImages = _MergeImageBox.Checked; - option.MergeJpgToPng = _MergeJpgToPngBox.Checked; - option.VerticalFlipImages = _VerticalFlipImageBox.Checked; - option.InvertBlackAndWhiteImages = _InvertBlackAndWhiteBox.Checked; - option.MonoPng = _MonoPngBox.Checked; - option.MinHeight = (int)_MinHeightBox.Value; - option.MinWidth = (int)_MinWidthBox.Value; - option.ExtractSoftMask = _ExportSoftMaskBox.Checked; - option.InvertSoftMask = _InvertSoftMaskBox.Checked; - option.SkipRedundantImages = _SkipRedundantImagesBox.Checked; - worker.RunWorkerAsync( - new object[] { - AppContext.SourceFiles, option - }); - } - - #region IDefaultButtonControl 成员 - - public override Button DefaultButton => _ExtractButton; - - #endregion - - void _FileNameMaskBox_TextChanged(object sender, EventArgs e) { - ShowFileMaskPreview(); - } - - void ShowFileMaskPreview() { - try { - var previews = new string[7]; - var f = _FileNameMaskBox.Text; - previews[0] = 1.ToString(f) + ".jpg"; - previews[1] = 2.ToString(f) + ".jpg"; - previews[2] = 3.ToString(f) + ".jpg ..."; - previews[3] = "\n" + 11.ToString(f) + ".jpg"; - previews[4] = 12.ToString(f) + ".jpg"; - previews[5] = 13.ToString(f) + ".jpg ..."; - previews[6] = 100.ToString(f) + ".jpg"; - _FileMaskPreviewBox.Text = String.Join(" ", previews); - } - catch (Exception) { - _FileMaskPreviewBox.Text = "文件名掩码无效。"; - } - } - - void Control_Show(object sender, EventArgs e) { - if (Visible && AppContext.MainForm != null) { - _TargetBox.Contents = AppContext.Recent.Folders; - } - //else if (this.Visible == false) { - // this._TargetBox.DataSource = null; - //} - } - - } -} diff --git a/pdfpatcher/App/Functions/ExtractImageControl.resx b/pdfpatcher/App/Functions/ExtractImageControl.resx deleted file mode 100644 index c6f90cca5cef202a8f21defc9db41847f5997e4b..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/ExtractImageControl.resx +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 页码范围说明: -  页码范围表示需处理的原始 PDF 文档页面。 -  不指定页码范围时,提取源文件所有页面的内容。 -  如有多个页码,可用“,”或“ ”(空格)隔开。 -  用“-”表示起止页码。例如:“1;4-15;2 56”,表示依次提取第1页、第4至15页、第2页和第56页的内容。 -  如“-”之前的数字大于“-”之后的数字,表示逆序处理。例如:“300-1”表示提取第300、299、298……3、2、1页的内容。 -  负数表示文档倒数页数,例如“-1”表示倒数第1页,“1--2”表示从第1页到倒数第2页。 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/ExtractPageControl.Designer.cs b/pdfpatcher/App/Functions/ExtractPageControl.Designer.cs deleted file mode 100644 index 923c7b155703ba19fda69574f31b9ece8c320e69..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/ExtractPageControl.Designer.cs +++ /dev/null @@ -1,396 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class ExtractPageControl - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ExtractPageControl)); - this._ExtractPageRangeBox = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this._KeepBookmarkBox = new System.Windows.Forms.CheckBox(); - this._RemoveOrphanBoomarksBox = new System.Windows.Forms.CheckBox(); - this._KeepDocInfoPropertyBox = new System.Windows.Forms.CheckBox(); - this._SourceFileControl = new PDFPatcher.SourceFileControl(); - this._TargetFileControl = new PDFPatcher.TargetFileControl(); - this._RemoveRestrictionBox = new System.Windows.Forms.CheckBox(); - this.label2 = new System.Windows.Forms.Label(); - this._ExcludePageRangeBox = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this._SeparatingModeBox = new System.Windows.Forms.ComboBox(); - this.tabControl1 = new System.Windows.Forms.TabControl(); - this.tabPage1 = new System.Windows.Forms.TabPage(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this._NumberFileNamesBox = new System.Windows.Forms.CheckBox(); - this.label5 = new System.Windows.Forms.Label(); - this._SeperateByPageNumberBox = new System.Windows.Forms.NumericUpDown(); - this.label4 = new System.Windows.Forms.Label(); - this.tabPage2 = new System.Windows.Forms.TabPage(); - this.textBox1 = new System.Windows.Forms.TextBox(); - this._ExtractButton = new EnhancedGlassButton.GlassButton(); - this._EnableFullCompression = new System.Windows.Forms.CheckBox(); - this.tabControl1.SuspendLayout(); - this.tabPage1.SuspendLayout(); - this.groupBox2.SuspendLayout(); - this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._SeperateByPageNumberBox)).BeginInit(); - this.tabPage2.SuspendLayout(); - this.SuspendLayout(); - // - // _ExtractPageRangeBox - // - this._ExtractPageRangeBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ExtractPageRangeBox.Location = new System.Drawing.Point(112, 65); - this._ExtractPageRangeBox.Name = "_ExtractPageRangeBox"; - this._ExtractPageRangeBox.Size = new System.Drawing.Size(454, 21); - this._ExtractPageRangeBox.TabIndex = 3; - this._ExtractPageRangeBox.TextChanged += new System.EventHandler(this._ExtractPageRangeBox_TextChanged); - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(17, 68); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(65, 12); - this.label3.TabIndex = 2; - this.label3.Text = "页码范围:"; - // - // _KeepBookmarkBox - // - this._KeepBookmarkBox.AutoSize = true; - this._KeepBookmarkBox.Location = new System.Drawing.Point(6, 41); - this._KeepBookmarkBox.Name = "_KeepBookmarkBox"; - this._KeepBookmarkBox.Size = new System.Drawing.Size(120, 16); - this._KeepBookmarkBox.TabIndex = 1; - this._KeepBookmarkBox.Text = "保留原文档的书签"; - this._KeepBookmarkBox.UseVisualStyleBackColor = true; - // - // _RemoveOrphanBoomarksBox - // - this._RemoveOrphanBoomarksBox.AutoSize = true; - this._RemoveOrphanBoomarksBox.Location = new System.Drawing.Point(6, 85); - this._RemoveOrphanBoomarksBox.Name = "_RemoveOrphanBoomarksBox"; - this._RemoveOrphanBoomarksBox.Size = new System.Drawing.Size(168, 16); - this._RemoveOrphanBoomarksBox.TabIndex = 3; - this._RemoveOrphanBoomarksBox.Text = "删除连接到无效页面的书签"; - this._RemoveOrphanBoomarksBox.UseVisualStyleBackColor = true; - // - // _KeepDocInfoPropertyBox - // - this._KeepDocInfoPropertyBox.AutoSize = true; - this._KeepDocInfoPropertyBox.Location = new System.Drawing.Point(6, 19); - this._KeepDocInfoPropertyBox.Name = "_KeepDocInfoPropertyBox"; - this._KeepDocInfoPropertyBox.Size = new System.Drawing.Size(120, 16); - this._KeepDocInfoPropertyBox.TabIndex = 0; - this._KeepDocInfoPropertyBox.Text = "保留原文档的属性"; - this._KeepDocInfoPropertyBox.UseVisualStyleBackColor = true; - // - // _SourceFileControl - // - this._SourceFileControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._SourceFileControl.Location = new System.Drawing.Point(12, 3); - this._SourceFileControl.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._SourceFileControl.Name = "_SourceFileControl"; - this._SourceFileControl.Size = new System.Drawing.Size(559, 29); - this._SourceFileControl.TabIndex = 0; - // - // _TargetFileControl - // - this._TargetFileControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._TargetFileControl.Location = new System.Drawing.Point(12, 33); - this._TargetFileControl.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._TargetFileControl.Name = "_TargetFileControl"; - this._TargetFileControl.Size = new System.Drawing.Size(559, 29); - this._TargetFileControl.TabIndex = 1; - // - // _RemoveRestrictionBox - // - this._RemoveRestrictionBox.AutoSize = true; - this._RemoveRestrictionBox.Location = new System.Drawing.Point(6, 63); - this._RemoveRestrictionBox.Name = "_RemoveRestrictionBox"; - this._RemoveRestrictionBox.Size = new System.Drawing.Size(120, 16); - this._RemoveRestrictionBox.TabIndex = 2; - this._RemoveRestrictionBox.Text = "解除原文档的限制"; - this._RemoveRestrictionBox.UseVisualStyleBackColor = true; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(17, 97); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(89, 12); - this.label2.TabIndex = 5; - this.label2.Text = "排除页码范围:"; - // - // _ExcludePageRangeBox - // - this._ExcludePageRangeBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ExcludePageRangeBox.Location = new System.Drawing.Point(112, 94); - this._ExcludePageRangeBox.Name = "_ExcludePageRangeBox"; - this._ExcludePageRangeBox.Size = new System.Drawing.Size(325, 21); - this._ExcludePageRangeBox.TabIndex = 6; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(6, 23); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(65, 12); - this.label1.TabIndex = 0; - this.label1.Text = "拆分方式:"; - // - // _SeparatingModeBox - // - this._SeparatingModeBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._SeparatingModeBox.FormattingEnabled = true; - this._SeparatingModeBox.Items.AddRange(new object[] { - "按页码范围的分号标记拆分", - "按顶层书签拆分", - "按页数拆分"}); - this._SeparatingModeBox.Location = new System.Drawing.Point(89, 20); - this._SeparatingModeBox.Name = "_SeparatingModeBox"; - this._SeparatingModeBox.Size = new System.Drawing.Size(217, 20); - this._SeparatingModeBox.TabIndex = 1; - // - // tabControl1 - // - this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tabControl1.Controls.Add(this.tabPage1); - this.tabControl1.Controls.Add(this.tabPage2); - this.tabControl1.Location = new System.Drawing.Point(12, 121); - this.tabControl1.Name = "tabControl1"; - this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(559, 197); - this.tabControl1.TabIndex = 7; - // - // tabPage1 - // - this.tabPage1.Controls.Add(this.groupBox2); - this.tabPage1.Controls.Add(this.groupBox1); - this.tabPage1.Location = new System.Drawing.Point(4, 22); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); - this.tabPage1.Size = new System.Drawing.Size(551, 171); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "选项"; - this.tabPage1.UseVisualStyleBackColor = true; - // - // groupBox2 - // - this.groupBox2.Controls.Add(this._KeepDocInfoPropertyBox); - this.groupBox2.Controls.Add(this._EnableFullCompression); - this.groupBox2.Controls.Add(this._RemoveOrphanBoomarksBox); - this.groupBox2.Controls.Add(this._RemoveRestrictionBox); - this.groupBox2.Controls.Add(this._KeepBookmarkBox); - this.groupBox2.Location = new System.Drawing.Point(6, 6); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(200, 135); - this.groupBox2.TabIndex = 0; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "文档"; - // - // groupBox1 - // - this.groupBox1.Controls.Add(this._NumberFileNamesBox); - this.groupBox1.Controls.Add(this.label5); - this.groupBox1.Controls.Add(this._SeperateByPageNumberBox); - this.groupBox1.Controls.Add(this.label4); - this.groupBox1.Controls.Add(this.label1); - this.groupBox1.Controls.Add(this._SeparatingModeBox); - this.groupBox1.Location = new System.Drawing.Point(212, 6); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(317, 111); - this.groupBox1.TabIndex = 1; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "拆分文档"; - // - // _NumberFileNamesBox - // - this._NumberFileNamesBox.AutoSize = true; - this._NumberFileNamesBox.Location = new System.Drawing.Point(24, 70); - this._NumberFileNamesBox.Name = "_NumberFileNamesBox"; - this._NumberFileNamesBox.Size = new System.Drawing.Size(144, 16); - this._NumberFileNamesBox.TabIndex = 6; - this._NumberFileNamesBox.Text = "在文件名前面添加编号"; - this._NumberFileNamesBox.UseVisualStyleBackColor = true; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(234, 48); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(17, 12); - this.label5.TabIndex = 4; - this.label5.Text = "页"; - // - // _SeperateByPageNumberBox - // - this._SeperateByPageNumberBox.Location = new System.Drawing.Point(153, 46); - this._SeperateByPageNumberBox.Maximum = new decimal(new int[] { - 10000, - 0, - 0, - 0}); - this._SeperateByPageNumberBox.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this._SeperateByPageNumberBox.Name = "_SeperateByPageNumberBox"; - this._SeperateByPageNumberBox.Size = new System.Drawing.Size(75, 21); - this._SeperateByPageNumberBox.TabIndex = 3; - this._SeperateByPageNumberBox.Value = new decimal(new int[] { - 1, - 0, - 0, - 0}); - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(22, 48); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(125, 12); - this.label4.TabIndex = 2; - this.label4.Text = "按页数拆分:每个文档"; - // - // tabPage2 - // - this.tabPage2.Controls.Add(this.textBox1); - this.tabPage2.Location = new System.Drawing.Point(4, 22); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); - this.tabPage2.Size = new System.Drawing.Size(551, 171); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "关于页码范围的说明"; - this.tabPage2.UseVisualStyleBackColor = true; - // - // textBox1 - // - this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBox1.Location = new System.Drawing.Point(6, 6); - this.textBox1.Multiline = true; - this.textBox1.Name = "textBox1"; - this.textBox1.ReadOnly = true; - this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.textBox1.Size = new System.Drawing.Size(532, 159); - this.textBox1.TabIndex = 1; - this.textBox1.Text = resources.GetString("textBox1.Text"); - // - // _ExtractButton - // - this._ExtractButton.AlternativeFocusBorderColor = System.Drawing.SystemColors.Highlight; - this._ExtractButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._ExtractButton.AnimateGlow = true; - this._ExtractButton.BackColor = System.Drawing.SystemColors.Highlight; - this._ExtractButton.CornerRadius = 3; - this._ExtractButton.ForeColor = System.Drawing.SystemColors.ControlText; - this._ExtractButton.GlowColor = System.Drawing.Color.White; - this._ExtractButton.Image = global::PDFPatcher.Properties.Resources.Save; - this._ExtractButton.InnerBorderColor = System.Drawing.SystemColors.ControlDarkDark; - this._ExtractButton.Location = new System.Drawing.Point(443, 92); - this._ExtractButton.Name = "_ExtractButton"; - this._ExtractButton.OuterBorderColor = System.Drawing.SystemColors.ControlLightLight; - this._ExtractButton.ShowFocusBorder = true; - this._ExtractButton.Size = new System.Drawing.Size(123, 29); - this._ExtractButton.TabIndex = 14; - this._ExtractButton.Text = " 提取页面(&T)"; - this._ExtractButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._ExtractButton.Click += new System.EventHandler(this._ExtractButton_Click); - // - // _EnableFullCompression - // - this._EnableFullCompression.AutoSize = true; - this._EnableFullCompression.Location = new System.Drawing.Point(6, 107); - this._EnableFullCompression.Name = "_EnableFullCompression"; - this._EnableFullCompression.Size = new System.Drawing.Size(132, 16); - this._EnableFullCompression.TabIndex = 3; - this._EnableFullCompression.Text = "清理并压缩输出文档"; - this._EnableFullCompression.UseVisualStyleBackColor = true; - // - // ExtractPageControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this._ExtractButton); - this.Controls.Add(this.tabControl1); - this.Controls.Add(this._ExcludePageRangeBox); - this.Controls.Add(this.label2); - this.Controls.Add(this._SourceFileControl); - this.Controls.Add(this._ExtractPageRangeBox); - this.Controls.Add(this.label3); - this.Controls.Add(this._TargetFileControl); - this.Font = new System.Drawing.Font("SimSun", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.Name = "ExtractPageControl"; - this.Size = new System.Drawing.Size(583, 333); - this.tabControl1.ResumeLayout(false); - this.tabPage1.ResumeLayout(false); - this.groupBox2.ResumeLayout(false); - this.groupBox2.PerformLayout(); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this._SeperateByPageNumberBox)).EndInit(); - this.tabPage2.ResumeLayout(false); - this.tabPage2.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.TextBox _ExtractPageRangeBox; - private System.Windows.Forms.Label label3; - private SourceFileControl _SourceFileControl; - private TargetFileControl _TargetFileControl; - private System.Windows.Forms.CheckBox _KeepBookmarkBox; - private System.Windows.Forms.CheckBox _RemoveOrphanBoomarksBox; - private System.Windows.Forms.CheckBox _KeepDocInfoPropertyBox; - private System.Windows.Forms.CheckBox _RemoveRestrictionBox; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox _ExcludePageRangeBox; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.ComboBox _SeparatingModeBox; - private System.Windows.Forms.TabControl tabControl1; - private System.Windows.Forms.TabPage tabPage1; - private System.Windows.Forms.TabPage tabPage2; - private System.Windows.Forms.TextBox textBox1; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.NumericUpDown _SeperateByPageNumberBox; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.CheckBox _NumberFileNamesBox; - private EnhancedGlassButton.GlassButton _ExtractButton; - private System.Windows.Forms.CheckBox _EnableFullCompression; - } -} diff --git a/pdfpatcher/App/Functions/ExtractPageControl.cs b/pdfpatcher/App/Functions/ExtractPageControl.cs deleted file mode 100644 index 6053988b95d9ff97db29730b9063dc78b15ab2a3..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/ExtractPageControl.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using System.ComponentModel; -using System.IO; -using System.Windows.Forms; -using PDFPatcher.Common; - -namespace PDFPatcher.Functions -{ - [ToolboxItem(false)] - sealed partial class ExtractPageControl : FunctionControl, IResettableControl - { - public override string FunctionName => "提取页面"; - - public override System.Drawing.Bitmap IconImage => Properties.Resources.ExtractPages; - - public ExtractPageControl() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - } - - void OnLoad() { - AppContext.MainForm.SetTooltip(_SourceFileControl.FileList, "需要提取页面的 PDF 文件路径,可选择多个文件"); - AppContext.MainForm.SetTooltip(_ExtractPageRangeBox, "提取页面的页码范围,不指定页码范围时提取源文件的所有页"); - AppContext.MainForm.SetTooltip(_TargetFileControl.FileList, "输出 PDF 文件的路径,右键点击插入文件名替代符"); - AppContext.MainForm.SetTooltip(_ExtractButton, "点击此按钮,提取源 PDF 文件指定范围的页面,生成新的文件"); - AppContext.MainForm.SetTooltip(_SeparatingModeBox, "选择拆分源 PDF 文档的方式"); - AppContext.MainForm.SetTooltip(_SeperateByPageNumberBox, "将源 PDF 文档按页数拆分"); - AppContext.MainForm.SetTooltip(_NumberFileNamesBox, "按书签拆分:在拆分所得的文件名前面添加“1 - ”、“2 - ”等顺序编号;其它拆分:第 1 个文件名也添加编号"); - AppContext.MainForm.SetTooltip(_ExcludePageRangeBox, "不提取此范围内的页面"); - AppContext.MainForm.SetTooltip(_EnableFullCompression, "去除文档中未被使用的对象,尽可能压缩输出文档"); - - _TargetFileControl.FileMacroMenu.LoadStandardInfoMacros(); - _TargetFileControl.FileMacroMenu.LoadStandardSourceFileMacros(); - _SeparatingModeBox.SelectedIndexChanged += (s, args) => { - _NumberFileNamesBox.Text = _SeparatingModeBox.SelectedIndex == 1 ? "在文件名前面添加编号" : "第一个文件名也添加编号"; - _SeperateByPageNumberBox.Enabled = _SeparatingModeBox.SelectedIndex == 2; - }; - ((IResettableControl)this).Reload(); - } - - void _ExtractButton_Click(object sender, EventArgs e) { - if (File.Exists(_SourceFileControl.FirstFile) == false) { - FormHelper.ErrorBox(Messages.SourceFileNotFound); - return; - } - if (_TargetFileControl.Text.IsNullOrWhiteSpace()) { - FormHelper.ErrorBox(Messages.TargetFileNotSpecified); - return; - } - AppContext.SourceFiles = _SourceFileControl.Files; - if (AppContext.SourceFiles.Length == 1) { - _SourceFileControl.FileList.AddHistoryItem(); - _TargetFileControl.FileList.AddHistoryItem(); - } - var o = AppContext.ExtractPage; - o.EnableFullCompression = _EnableFullCompression.Checked; - o.KeepBookmarks = _KeepBookmarkBox.Checked; - o.KeepDocumentProperties = _KeepDocInfoPropertyBox.Checked; - o.RemoveOrphanBookmarks = _RemoveOrphanBoomarksBox.Checked; - o.PageRanges = _ExtractPageRangeBox.Text; - o.RemoveDocumentRestrictions = _RemoveRestrictionBox.Checked; - o.ExcludePageRanges = _ExcludePageRangeBox.Text; - o.SeparatingMode = _SeparatingModeBox.SelectedIndex; - o.SeparateByPage = (int)_SeperateByPageNumberBox.Value; - o.NumberFileNames = _NumberFileNamesBox.Checked; - - AppContext.MainForm.ResetWorker(); - var worker = AppContext.MainForm.GetWorker(); - worker.DoWork += (dummy, arg) => { - var a = arg.Argument as object[]; - var files = a[0] as string[]; - var t = a[1] as string; - var options = a[2] as ExtractPageOptions; - if (files.Length > 1) { - var m = FileHelper.HasFileNameMacro(t); // 包含替换符 - var p = m ? null : Path.GetDirectoryName(t); - Tracker.SetTotalProgressGoal(files.Length); - foreach (var file in files) { - Processor.Worker.ExtractPages(options, - file, - m ? t : FileHelper.CombinePath(p, Path.GetFileNameWithoutExtension(file) + Constants.FileExtensions.Pdf)); - Tracker.IncrementTotalProgress(); - if (AppContext.Abort) { - return; - } - } - } - else { - Processor.Worker.ExtractPages(options, files[0], t); - } - }; - worker.RunWorkerAsync(new object[] { - AppContext.SourceFiles, - _TargetFileControl.Text, - AppContext.ExtractPage - }); - } - - void _ExtractPageRangeBox_TextChanged(object sender, EventArgs e) { - AppContext.Exporter.ExtractPageRange = _ExtractPageRangeBox.Text; - } - - #region IDefaultButtonControl 成员 - - public override Button DefaultButton => _ExtractButton; - - #endregion - - - #region IResettableControl 成员 - - void IResettableControl.Reset() { - AppContext.ExtractPage = new ExtractPageOptions(); - ((IResettableControl)this).Reload(); - } - - void IResettableControl.Reload() { - var options = AppContext.ExtractPage; - _EnableFullCompression.Checked = options.EnableFullCompression; - _KeepBookmarkBox.Checked = options.KeepBookmarks; - _KeepDocInfoPropertyBox.Checked = options.KeepDocumentProperties; - _RemoveRestrictionBox.Checked = options.RemoveDocumentRestrictions; - _RemoveOrphanBoomarksBox.Checked = options.RemoveOrphanBookmarks; - _SeparatingModeBox.Select(options.SeparatingMode); - _NumberFileNamesBox.Checked = options.NumberFileNames; - _SeperateByPageNumberBox.SetValue(options.SeparateByPage); - } - - #endregion - - - } -} diff --git a/pdfpatcher/App/Functions/ExtractPageControl.resx b/pdfpatcher/App/Functions/ExtractPageControl.resx deleted file mode 100644 index 4c37942db26bc72924a06ff40420d7bfb847fa00..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/ExtractPageControl.resx +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 页码范围说明; -  页码范围表示需处理的原始 PDF 文档页面。 -  不指定页码范围时,提取源文件所有页面的内容。 -  如有多个页码,可用“,”或“ ”(空格)隔开。 -  用“-”表示起止页码。例如:“1;4-15;2 56”,表示依次提取第1页、第4至15页、第2页和第56页的内容。 -  如“-”之前的数字大于“-”之后的数字,表示逆序处理。例如:“300-1”表示提取第300、299、298……3、2、1页的内容。 -  负数表示文档倒数页数,例如“-1”表示倒数第1页,“1--2”表示从第1页到倒数第2页。 -  分号“;”表示拆分成多个文件,例如“1-5;1,6-10”表示拆分成两个文件,其中第1至5页为一个文件,第1页和6到10页为第二个文件。 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/FileListHelper.cs b/pdfpatcher/App/Functions/FileListHelper.cs deleted file mode 100644 index f1b8ccd415223cd1ac6762394834270401b0abbb..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/FileListHelper.cs +++ /dev/null @@ -1,253 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; -using BrightIdeasSoftware; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - sealed class FileListHelper - { - public delegate void AddFilesCallback(string[] files, bool alertInvalidFiles); - - readonly ObjectListView _fileList; - public FileListHelper(ObjectListView fileList) { - _fileList = fileList; - } - - /// - /// 设置 PDF 文件列表的拖放操作。 - /// - /// 添加文件的回调函数。 - public void SetupDragAndDrop(AddFilesCallback addFilesCallback) { - _fileList.DragSource = new SimpleDragSource(true); - var ds = new RearrangingDropSink(false); - _fileList.DropSink = ds; - - ds.CanDrop += (s, args) => { - var files = FormHelper.DropFileOver(args.DragEventArgs, Constants.FileExtensions.Pdf); - if (files.Length > 0) { - args.Effect = DragDropEffects.Link; - args.InfoMessage = "添加 " + files.Length.ToString() + " 个文件"; - args.Handled = true; - } - }; - ds.Dropped += (s, args) => { - var files = FormHelper.DropFileOver(args.DragEventArgs, Constants.FileExtensions.Pdf); - if (files.Length > 0) { - _fileList.SelectedIndex - = args.DropTargetLocation == DropTargetLocation.Background - ? _fileList.GetItemCount() - 1 - : args.DropTargetIndex + (args.DropTargetLocation == DropTargetLocation.AboveItem ? -1 : 0); - addFilesCallback(files, false); - args.Handled = true; - } - }; - } - - /// - /// 打开 PDF 文件的 显示下拉文件列表的事件处理函数。 - /// - /// - /// - public static void OpenPdfButtonDropDownOpeningHandler(object sender, EventArgs e) { - var b = sender as ToolStripSplitButton; - var l = b.DropDown.Items; - l.ClearDropDownItems(); - foreach (var item in AppContext.Recent.SourcePdfFiles) { - l.Add(FileHelper.GetEllipticPath(item, 50)).ToolTipText = item; - } - if (l.Count == 0) { - b.PerformButtonClick(); - } - } - - /// - /// 以指定编码刷新文件列表的选定项目。 - /// - /// 用于读取文档元数据的 。 - public void RefreshInfo(Encoding encoding) { - var ol = _fileList.SelectedObjects; - if (ol.Count == 0) { - _fileList.SelectAll(); - ol = _fileList.SelectedObjects; - } - foreach (SourceItem.Pdf item in ol) { - item.Refresh(encoding); - } - _fileList.RefreshObjects(ol); - } - - /// - /// 为 设置读写处理函数。 - /// - /// 需要设置的列。 - public static void SetupCommonPdfColumns(params OLVColumn[] columns) { - foreach (var item in columns) { - switch (item.Text) { - case "源文件名": SetupFileNameColumn(item); break; - case "文件夹": SetupFolderNameColumn(item); break; - case "标题": SetupTitleColumn(item); break; - case "作者": SetupAuthorColumn(item); break; - case "主题": SetupSubjectColumn(item); break; - case "关键词": SetupKeywordsColumn(item); break; - case "页数": SetupPageCountColumn(item); break; - case "修改时间": SetupFileTimeColumn(item); break; - } - } - } - static void SetupAuthorColumn(OLVColumn column) { - column.AsTyped(c => { - c.AspectGetter = o => o.DocInfo.Author; - c.AspectPutter = (o, value) => o.DocInfo.Author = value as string; - }); - } - static void SetupKeywordsColumn(OLVColumn column) { - column.AsTyped(c => { - c.AspectGetter = o => o.DocInfo.Keywords; - c.AspectPutter = (o, value) => o.DocInfo.Keywords = value as string; - }); - } - static void SetupSubjectColumn(OLVColumn column) { - column.AsTyped(c => { - c.AspectGetter = o => o.DocInfo.Subject; - c.AspectPutter = (o, value) => o.DocInfo.Subject = value as string; - }); - } - static void SetupTitleColumn(OLVColumn column) { - column.AsTyped(c => { - c.AspectGetter = o => o.DocInfo.Title; - c.AspectPutter = (o, value) => o.DocInfo.Title = value as string; - }); - } - static void SetupPageCountColumn(OLVColumn column) { - column.AsTyped(c => c.AspectGetter = o => o.PageCount.ToText()); - } - static void SetupFileNameColumn(OLVColumn column) { - column.AsTyped(c => { - c.AspectGetter = o => o.Type == SourceItem.ItemType.Empty ? "<空白页面>" : o.FileName; - c.ImageGetter = o => 0; - }); - } - static void SetupFolderNameColumn(OLVColumn column) { - column.AsTyped(c => c.AspectGetter = o => o.Type != SourceItem.ItemType.Empty ? o.FolderName : String.Empty); - } - static void SetupFileTimeColumn(OLVColumn column) { - column.AsTyped(c => c.AspectGetter = o => o.FileTime); - column.AspectToStringConverter = o => ((DateTime)o).ToText(); - } - - public void SetupHotkeys() { - _fileList.KeyUp += (s, args) => { - switch (args.KeyCode) { - case Keys.Delete: - if (_fileList.IsCellEditing || _fileList.Focused == false) { - return; - } - ProcessCommonMenuCommand(Commands.Delete); - break; - } - }; - } - - public bool ProcessCommonMenuCommand(string commandID) { - switch (commandID) { - case Commands.Delete: - if (_fileList.GetItemCount() == 0) { - return true; - } - var l = _fileList.SelectedObjects; - if (l.Count == 0) { - if (FormHelper.YesNoBox("是否清空文件列表?") == DialogResult.Yes) { - _fileList.ClearObjects(); - } - } - else { - _fileList.RemoveObjects(_fileList.SelectedObjects); - } - break; - case "_Copy": - var sb = StringBuilderCache.Acquire(); - foreach (SourceItem.Pdf item in GetSourceItems(true)) { - sb.AppendLine(String.Join("\t", new string[] { - item.FilePath.ToString(), - item.PageCount.ToText (), - item.DocInfo.Title, - item.DocInfo.Author, - item.DocInfo.Subject, - item.DocInfo.Keywords - })); - } - if (sb.Length > 0) { - Clipboard.SetText(StringBuilderCache.GetStringAndRelease(sb)); - } - else { - StringBuilderCache.Release(sb); - } - break; - case Commands.SelectAllItems: - _fileList.SelectAll(); - break; - case Commands.InvertSelectItem: - foreach (ListViewItem item in _fileList.Items) { - item.Selected = !item.Selected; - } - break; - case Commands.SelectNone: - _fileList.SelectObjects(null); - break; - default: - return false; - } - return true; - } - - public List GetSourceItems(bool selectedOnly) where T : SourceItem { - if (_fileList.GetItemCount() == 0) { - return null; - } - var l = (selectedOnly ? _fileList.SelectedObjects : _fileList.Objects); - var items = new List(selectedOnly ? 10 : _fileList.GetItemCount()); - foreach (T item in l) { - if (item == null) { - continue; - } - items.Add(item); - } - return items; - } - - public void PrepareSourceFiles() { - var c = _fileList.GetItemCount(); - if (c == 0) { - return; - } - var f = new string[c]; - var i = 0; - foreach (SourceItem item in _fileList.Objects) { - if (item.Type == SourceItem.ItemType.Pdf) { - f[i++] = item.FilePath.ToString(); - } - } - Array.Resize(ref f, i); - AppContext.SourceFiles = f; - } - - public void ResizeItemListColumns() { - var c = _fileList.Columns[0]; - _fileList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); - if (c.Width < 100) { - c.Width = 100; - } - for (int i = 1; i < _fileList.Columns.Count; i++) { - c = _fileList.Columns[i]; - if (c.Width < 50) { - c.Width = 50; - } - } - } - - } -} diff --git a/pdfpatcher/App/Functions/FormState.cs b/pdfpatcher/App/Functions/FormState.cs deleted file mode 100644 index 3ce8b8bbd49844507c1a0a43c5a5bf46753d1d9f..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/FormState.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System.Drawing; -using System.Windows.Forms; - -namespace PDFPatcher.Functions -{ - /// - /// Class used to preserve / restore / maximize state of the form - /// - public sealed class FormState - { - FormBorderStyle brdStyle; - bool topMost; - Rectangle bounds; - - bool IsMaximized; - - public void Maximize(Form targetForm) { - if (IsMaximized) { - return; - } - - IsMaximized = true; - if (targetForm.WindowState == FormWindowState.Maximized) { - targetForm.WindowState = FormWindowState.Normal; - } - Save(targetForm); - targetForm.FormBorderStyle = FormBorderStyle.None; - targetForm.TopMost = true; - targetForm.Bounds = Screen.FromControl(targetForm).Bounds; - } - - void Save(Form targetForm) { - brdStyle = targetForm.FormBorderStyle; - topMost = targetForm.TopMost; - bounds = targetForm.Bounds; - } - - public void Restore(Form targetForm) { - targetForm.FormBorderStyle = brdStyle; - targetForm.TopMost = topMost; - targetForm.Bounds = bounds; - IsMaximized = false; - } - } -} diff --git a/pdfpatcher/App/Functions/FrontPage.html b/pdfpatcher/App/Functions/FrontPage.html deleted file mode 100644 index 57cf16fbc6040b4773d6d856e14c703fe6557aed..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/FrontPage.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - $appName - - - -

$appName

- - - - - -
-

处理 PDF 文档

-
Editor;Editor;修改 PDF 文件;创建或修改 PDF 文档的书签,修改 PDF 文档的设置
-
DocumentProcessor;Patcher;批量修改 PDF 文件;根据配置批量处理 PDF 文档,生成新的文档
-
Merger;Merger;合并文件;将多个图片和 PDF 文档合并为新的 PDF 文档
-
Ocr;Ocr;识别图像文本;识别扫描 PDF 文档的文字(需微软 Office 2003或2007的光学字符识别(OCR)引擎支持)
-
AutoBookmark;BookmarkGenerator;自动生成书签;根据 PDF 的文本样式生成书签文件
-
Rename;Rename;批量重命名文件;根据 PDF 的文本属性更改文件名
-

提取文档内容

-
ExtractPages;ExtractPages;提取页面或拆分文档;提取 PDF 文档的页面或重排页面
-
ExtractImage;ExtractImages;提取图片;无损提取 PDF 文档中的图片
-
RenderDocument;RenderPages;转换页面为图片;将 PDF 文档的页面转换为图片
-

高手工具

-
DocumentInspector;Inspector;文档结构探查器;探查 PDF 文档的内部结构
-
ExportInfoFile;InfoExchanger;导出或导入信息文件;导出书签、文档元数据、阅读器设定等信息到信息文件
-
AppOptions;Options;程序配置;修改 PDF 补丁丁的程序配置
-

支持作者

-
About;About;关于本软件;支持软件发展
-
-
请点击左边的功能,或打开需要修改的文件
-
    -
  1. -
- -
-
著作权所有:WMJordan;主页:$appHomePage;电邮:wmjordan@163.com
- - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/FrontPageControl.Designer.cs b/pdfpatcher/App/Functions/FrontPageControl.Designer.cs deleted file mode 100644 index 7d5f4b7a2da676e88a74d96238d2518d7f879f59..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/FrontPageControl.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace PDFPatcher -{ - partial class FrontPageControl - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._FrontPageBox = new TheArtOfDev.HtmlRenderer.WinForms.HtmlPanel(); - this.SuspendLayout(); - // - // _FrontPageBox - // - this._FrontPageBox.AutoScroll = true; - this._FrontPageBox.BackColor = System.Drawing.SystemColors.Window; - this._FrontPageBox.BaseStylesheet = ""; - this._FrontPageBox.Dock = System.Windows.Forms.DockStyle.Fill; - this._FrontPageBox.IsContextMenuEnabled = false; - this._FrontPageBox.IsSelectionEnabled = false; - this._FrontPageBox.Location = new System.Drawing.Point(9, 8); - this._FrontPageBox.Name = "_FrontPageBox"; - this._FrontPageBox.Size = new System.Drawing.Size(433, 328); - this._FrontPageBox.TabIndex = 0; - this._FrontPageBox.Text = null; - this._FrontPageBox.LinkClicked += new System.EventHandler(this._FrontPageBox_LinkClicked); - this._FrontPageBox.ImageLoad += new System.EventHandler(this._FrontPageBox_ImageLoad); - // - // FrontPageControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this._FrontPageBox); - this.Name = "FrontPageControl"; - this.Padding = new System.Windows.Forms.Padding(9, 8, 9, 8); - this.Size = new System.Drawing.Size(451, 344); - this.ResumeLayout(false); - - } - - #endregion - - private TheArtOfDev.HtmlRenderer.WinForms.HtmlPanel _FrontPageBox; - - } -} diff --git a/pdfpatcher/App/Functions/FrontPageControl.cs b/pdfpatcher/App/Functions/FrontPageControl.cs deleted file mode 100644 index 28ef5ba419c8dbd2a4c6313138b034c58305598e..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/FrontPageControl.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System; -using System.ComponentModel; -using System.Text.RegularExpressions; -using System.Windows.Forms; -using PDFPatcher.Common; -using TheArtOfDev.HtmlRenderer.Core.Entities; - -namespace PDFPatcher -{ - [ToolboxItem(false)] - sealed partial class FrontPageControl : Functions.HtmlPageControl, ITabContent - { - readonly Regex __FrontPagePattern = new Regex("
(.+);(.+);(.+);(.+)
", RegexOptions.CultureInvariant); - - public override string FunctionName => "主页"; - - public override System.Drawing.Bitmap IconImage => Properties.Resources.HomePage; - - bool ITabContent.CanClose => false; - - public override void ExecuteCommand(string commandName, params string[] parameters) { - switch (commandName) { - case Commands.Open: - var n = AppContext.MainForm.ShowPdfFileDialog(); - if (n != null) { - AppContext.MainForm.OpenFileWithEditor(n); - } - return; - case Commands.CleanUpInexistentFiles: - AppContext.CleanUpInexistentFiles(AppContext.Recent.SourcePdfFiles); - AppContext.CleanUpInexistentFiles(AppContext.Recent.InfoDocuments); - AppContext.CleanUpInexistentFolders(AppContext.Recent.Folders); - RefreshContent(); - return; - } - base.ExecuteCommand(commandName, parameters); - } - - public FrontPageControl() { - InitializeComponent(); - Text = "主页"; - RefreshContent(); - RecentFileItemClicked = (s, args) => AppContext.MainForm.OpenFileWithEditor(args.ClickedItem.ToolTipText); - AllowDrop = true; - } - - protected override void OnDragEnter(DragEventArgs drgevent) { - base.OnDragEnter(drgevent); - drgevent.FeedbackDragFileOver(Constants.FileExtensions.PdfAndAllBookmarkExtension); - } - protected override void OnDragDrop(DragEventArgs drgevent) { - base.OnDragDrop(drgevent); - foreach (var item in drgevent.DropFileOver(Constants.FileExtensions.PdfAndAllBookmarkExtension)) { - AppContext.MainForm.OpenFileWithEditor(item); - } - } - internal override void OnSelected() { - base.OnSelected(); - RefreshContent(); - } - public override void SetupCommand(ToolStripItem item) { - switch (item.Name) { - case Commands.Close: - case Commands.Action: - EnableCommand(item, false, true); - break; - } - base.SetupCommand(item); - } - - void RefreshContent() { - var s = FormHelper.GetDpiScale(this); - _FrontPageBox.Text = __FrontPagePattern - .Replace(Properties.Resources.FrontPage, $@"") - .Replace("$sideBarWidth", (s * 180).ToText() + "px") - .Replace("$appName", Constants.AppName) - .Replace("$appHomePage", Constants.AppHomePage) - .Replace("
  • ", GetLastFileList()); - } - - string GetLastFileList() { - var i = 0; - return String.Concat(AppContext.Recent.SourcePdfFiles.ConvertAll((s) => FileHelper.IsPathValid(s) && new FilePath(s).ExistsFile - ? String.Concat(@"
  • ", SubstringAfter(s, '\\'), "
  • ") - : String.Concat(@"
  • ", SubstringAfter(s, '\\'), "
  • "))); - } - - void _FrontPageBox_LinkClicked(object sender, HtmlLinkClickedEventArgs e) { - HandleLinkClicked(e.Link); - e.Handled = true; - } - - void _FrontPageBox_ImageLoad(object sender, HtmlImageLoadEventArgs e) { - LoadResourceImage(e); - } - - } -} diff --git a/pdfpatcher/App/Functions/FrontPageControl.resx b/pdfpatcher/App/Functions/FrontPageControl.resx deleted file mode 100644 index 1af7de150c99c12dd67a509fe57c10d63e4eeb04..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/FrontPageControl.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/FunctionControl.cs b/pdfpatcher/App/Functions/FunctionControl.cs deleted file mode 100644 index ab87d3ab73f19924019907b01ac69448243aad96..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/FunctionControl.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using System.ComponentModel; -using System.Windows.Forms; -using PDFPatcher.Common; - -namespace PDFPatcher.Functions -{ - public class FunctionControl : System.Windows.Forms.UserControl - { - [Browsable(false)] - public virtual string FunctionName => null; - [Browsable(false)] - public virtual System.Drawing.Bitmap IconImage => null; - [Browsable(false)] - public virtual Button DefaultButton => null; - - public EventHandler ListRecentFiles; - - public EventHandler RecentFileItemClicked; - - public void ExecuteCommand(ToolStripItem item) { - item.HidePopupMenu(); - ExecuteCommand(item.Name); - } - - public virtual void ExecuteCommand(string commandName, params string[] parameters) { - if (Commands.OpenFile != commandName) { - return; - } - - // 将第一个文本框设置为文件路径 - if (parameters.Length > 0 && String.IsNullOrEmpty(parameters[0]) == false - && FileHelper.HasExtension(parameters[0], Constants.FileExtensions.Pdf) - ) { - foreach (Control c in Controls) { - if (c is SourceFileControl i) { - i.Text = parameters[0]; - return; - } - } - } - } - - public virtual void SetupCommand(ToolStripItem item) { } - internal virtual void OnSelected() { } - internal virtual void OnDeselected() { } - - protected FunctionControl() { - ListRecentFiles = (s, args) => { - var m = (ToolStripDropDownItem)s; - var l = m.DropDown.Items; - l.ClearDropDownItems(); - l.AddSourcePdfFiles(); - }; - RecentFileItemClicked = (s, args) => ExecuteCommand(Commands.OpenFile, args.ClickedItem.ToolTipText); - } - - internal void SetupMenu(ToolStripMenuItem menu) { - SetupMenu(menu.DropDownItems); - } - internal void SetupMenu(ToolStripItemCollection items) { - var pvs = false; // 前一个可见项目是否为分隔符 - foreach (ToolStripItem item in items) { - switch (item.Name) { - case Commands.Action: - if (DefaultButton != null) { - var b = DefaultButton; - item.Image = b.Image; - item.Text = b.Text.Trim(); - item.ToolTipText = b.Tag as string; - } - EnableCommand(item, true, true); - break; - case Commands.SaveBookmark: - item.Text = "保存书签文件(&Q)"; - item.ToolTipText = "将书签保存为 XML 格式的信息文件,可用于迁移书签"; - goto default; - case Commands.ResetOptions: - EnableCommand(item, this is IResettableControl, true); - break; - case Commands.ShowGeneralToolbar: - var m = item as ToolStripMenuItem; - m.Checked = AppContext.Toolbar.ShowGeneralToolbar; - break; - default: - EnableCommand(item, - Commands.DefaultDisabledItems.Contains(item.Name) == false, - Commands.DefaultHiddenItems.Contains(item.Name) == false - ); - break; - } - SetupCommand(item); - if (item.Visible) { - var s = item is ToolStripSeparator; - if (s) { - item.Visible = pvs == false; - pvs = true; - } - else { - pvs = false; - } - } - } - } - - internal void EnableCommand(ToolStripItem item, bool enabled, bool visible) { - if (item == null) { - return; - } - item.Enabled = enabled; - item.Visible = visible; - } - } -} diff --git a/pdfpatcher/App/Functions/HistoryComboBox.cs b/pdfpatcher/App/Functions/HistoryComboBox.cs deleted file mode 100644 index 7d7ee14cb70f9f6164ea6d84ca65256ec31aeb3d..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/HistoryComboBox.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Windows.Forms; - -namespace PDFPatcher -{ - public class HistoryComboBox : ComboBox - { - public int MaxItemCount { get; set; } - public IList Contents { get; set; } - - public HistoryComboBox() { - MaxItemCount = 16; - DropDown += (s, args) => { - Items.Clear(); - if (Contents == null) { - return; - } - Items.AddRange(Contents.ToArray()); - }; - } - - internal void AddHistoryItem() { - AddHistoryItem(Text); - } - - internal void AddHistoryItem(string text) { - if (text.Length == 0) { - return; - } - var i = IndexOf(text); - if (i == 0) { - return; - } - //Trace.WriteLine ("add history item:" + text); - if (i != -1) { - RemoveAt(i); - } - Insert(0, text); - while (Contents.Count > MaxItemCount) { - RemoveAt(Contents.Count - 1); - } - Text = text; - } - - private int IndexOf(string o) { - var l = Contents; - if (l != null) { - return l.IndexOf(o); - } - else { - return Items.IndexOf(o); - } - } - - private void RemoveAt(int i) { - //Trace.WriteLine ("remove item:" + i); - - var l = Contents; - if (l != null) { - l.RemoveAt(i); - } - else { - Items.RemoveAt(i); - } - } - - private void Insert(int i, string o) { - //Trace.WriteLine ("insert item:" + i + ":" + o); - var l = Contents; - if (l != null) { - l.Insert(i, o); - } - else { - Items.Insert(i, o); - } - } - } -} diff --git a/pdfpatcher/App/Functions/HtmlPageControl.cs b/pdfpatcher/App/Functions/HtmlPageControl.cs deleted file mode 100644 index 9b1fe8fcfd9332813d6e7edc2bed2fa4da6930b2..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/HtmlPageControl.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using PDFPatcher.Common; - -namespace PDFPatcher.Functions -{ - class HtmlPageControl : FunctionControl - { - protected void HandleLinkClicked(string link) { - var i = link.IndexOf(':'); - if (i == -1) { - return; - } - var p = link.Substring(0, i); - switch (p) { - case "func": - var func = (Function)Enum.Parse(typeof(Function), link.Substring(i + 1)); - AppContext.MainForm.SelectFunctionList(func); - break; - case "recent": - AppContext.MainForm.OpenFileWithEditor(AppContext.Recent.SourcePdfFiles[link.Substring(i + 1).ToInt32()]); - break; - case "exec": - ExecuteCommand(link.Substring(i + 1)); - break; - case "http": - case "https": - System.Diagnostics.Process.Start(link); - break; - } - } - - protected void LoadResourceImage(TheArtOfDev.HtmlRenderer.Core.Entities.HtmlImageLoadEventArgs e) { - e.Callback(Properties.Resources.ResourceManager.GetObject(e.Src.Substring("res:".Length)) as System.Drawing.Image); - e.Handled = true; - } - - /// 返回字符串中包含指定字符串之后的子字符串。 - /// 如果找不到指定字符串,则返回空字符串。 - protected static string SubstringAfter(string source, char value) { - int index = source.LastIndexOf(value); - if (index != -1) { - return source.Substring(index + 1); - } - return String.Empty; - } - - } -} diff --git a/pdfpatcher/App/Functions/IDocumentEditor.cs b/pdfpatcher/App/Functions/IDocumentEditor.cs deleted file mode 100644 index abe0fb343c01c7c85719da7babb344348f44274c..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/IDocumentEditor.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Functions -{ - interface IDocumentEditor - { - event EventHandler DocumentChanged; - string DocumentPath { get; } - void CloseDocument(); - void Reopen(); - } - - public sealed class DocumentChangedEventArgs : EventArgs - { - public string Path { get; private set; } - internal DocumentChangedEventArgs(string path) { - Path = path; - } - } - - -} diff --git a/pdfpatcher/App/Functions/IResettableControl.cs b/pdfpatcher/App/Functions/IResettableControl.cs deleted file mode 100644 index b0d9df3e03921fdb7bf7dcfd33a2e3a54a2ef8cf..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/IResettableControl.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - - -namespace PDFPatcher.Functions -{ - interface IResettableControl - { - void Reset(); - void Reload(); - } -} diff --git a/pdfpatcher/App/Functions/ITextInfoFilterEditor.cs b/pdfpatcher/App/Functions/ITextInfoFilterEditor.cs deleted file mode 100644 index 2cf27eb1bb9d409a5c4bf6b6fd81886a2ff81497..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/ITextInfoFilterEditor.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -namespace PDFPatcher.Functions -{ - interface IFilterConditionEditor - { - PDFPatcher.Model.AutoBookmarkCondition Filter { get; set; } - System.Windows.Forms.UserControl EditorControl { get; } - } -} diff --git a/pdfpatcher/App/Functions/InfoExchangerControl.Designer.cs b/pdfpatcher/App/Functions/InfoExchangerControl.Designer.cs deleted file mode 100644 index ae443defd9eb56cf51a5e295d8b40a7ffc6dae14..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/InfoExchangerControl.Designer.cs +++ /dev/null @@ -1,675 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class InfoExchangerControl - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.components = new System.ComponentModel.Container(); - System.Windows.Forms.ToolStripDropDownButton _Actions; - System.Windows.Forms.ToolStripMenuItem _DocumentActions; - System.Windows.Forms.ToolStripMenuItem _RemoveUsageRightsAction; - System.Windows.Forms.ToolStripMenuItem _ModifyMetaDataAction; - System.Windows.Forms.ToolStripMenuItem _PageActions; - System.Windows.Forms.ToolStripMenuItem _ImageRecompressionAction; - System.Windows.Forms.ToolStripMenuItem _RemoveAnnotationAction; - System.Windows.Forms.ToolStripMenuItem _RemoveThumbnailAction; - System.Windows.Forms.ToolStripMenuItem _RemoveTextAction; - System.Windows.Forms.ToolStripMenuItem _RemoveImageAction; - System.Windows.Forms.ToolStripMenuItem _RemoveActions; - System.Windows.Forms.ToolStripDropDownButton _Sort; - System.Windows.Forms.ToolStripButton _Delete; - System.Windows.Forms.ToolStripSeparator toolStripSeparator2; - System.Windows.Forms.ToolStripMenuItem _SelectAllItem; - System.Windows.Forms.ToolStripMenuItem _InvertSelectItem; - System.Windows.Forms.ToolStripMenuItem _SelectNoneItem; - System.Windows.Forms.ToolStripMenuItem _Copy; - System.Windows.Forms.ToolStripMenuItem _RefreshInfo; - this._MainToolbar = new System.Windows.Forms.ToolStrip(); - this._AddFilesButton = new System.Windows.Forms.ToolStripSplitButton(); - this._RecentFileMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._SortMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._SortByNaturalNumberItem = new System.Windows.Forms.ToolStripMenuItem(); - this._SortByAlphaItem = new System.Windows.Forms.ToolStripMenuItem(); - this._RefreshInfoButton = new System.Windows.Forms.ToolStripSplitButton(); - this._RefreshInfoMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._SelectionMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._SelectionMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this._ItemList = new BrightIdeasSoftware.ObjectListView(); - this._NameColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._PageCountColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._TitleColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._AuthorColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._SubjectColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._KeywordsColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._FolderColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._FileTimeColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._ItemListMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._FileTypeList = new System.Windows.Forms.ImageList(this.components); - this._OpenPdfBox = new System.Windows.Forms.OpenFileDialog(); - this._AutoClearListBox = new System.Windows.Forms.CheckBox(); - this._AddDocumentWorker = new System.ComponentModel.BackgroundWorker(); - this._BookmarkControl = new PDFPatcher.BookmarkControl(); - this._TargetPdfFile = new PDFPatcher.TargetFileControl(); - this._ActionsBox = new BrightIdeasSoftware.ObjectListView(); - this._ActionNameColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._ItemActionsContainerBox = new System.Windows.Forms.SplitContainer(); - this._ExportBookmarkButton = new System.Windows.Forms.Button(); - this._ImportButton = new EnhancedGlassButton.GlassButton(); - this._ConfigButton = new System.Windows.Forms.Button(); - this._InfoConfigButton = new System.Windows.Forms.Button(); - _Actions = new System.Windows.Forms.ToolStripDropDownButton(); - _DocumentActions = new System.Windows.Forms.ToolStripMenuItem(); - _RemoveUsageRightsAction = new System.Windows.Forms.ToolStripMenuItem(); - _ModifyMetaDataAction = new System.Windows.Forms.ToolStripMenuItem(); - _PageActions = new System.Windows.Forms.ToolStripMenuItem(); - _ImageRecompressionAction = new System.Windows.Forms.ToolStripMenuItem(); - _RemoveAnnotationAction = new System.Windows.Forms.ToolStripMenuItem(); - _RemoveThumbnailAction = new System.Windows.Forms.ToolStripMenuItem(); - _RemoveTextAction = new System.Windows.Forms.ToolStripMenuItem(); - _RemoveImageAction = new System.Windows.Forms.ToolStripMenuItem(); - _RemoveActions = new System.Windows.Forms.ToolStripMenuItem(); - _Sort = new System.Windows.Forms.ToolStripDropDownButton(); - _Delete = new System.Windows.Forms.ToolStripButton(); - toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - _SelectAllItem = new System.Windows.Forms.ToolStripMenuItem(); - _InvertSelectItem = new System.Windows.Forms.ToolStripMenuItem(); - _SelectNoneItem = new System.Windows.Forms.ToolStripMenuItem(); - _Copy = new System.Windows.Forms.ToolStripMenuItem(); - _RefreshInfo = new System.Windows.Forms.ToolStripMenuItem(); - this._MainToolbar.SuspendLayout(); - this._SortMenu.SuspendLayout(); - this._SelectionMenu.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._ItemList)).BeginInit(); - this._ItemListMenu.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._ActionsBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this._ItemActionsContainerBox)).BeginInit(); - this._ItemActionsContainerBox.Panel1.SuspendLayout(); - this._ItemActionsContainerBox.Panel2.SuspendLayout(); - this._ItemActionsContainerBox.SuspendLayout(); - this.SuspendLayout(); - // - // _MainToolbar - // - this._MainToolbar.Dock = System.Windows.Forms.DockStyle.None; - this._MainToolbar.GripMargin = new System.Windows.Forms.Padding(0); - this._MainToolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._AddFilesButton, - _Actions, - _Sort, - _Delete, - toolStripSeparator2, - this._RefreshInfoButton}); - this._MainToolbar.Location = new System.Drawing.Point(0, 0); - this._MainToolbar.Name = "_MainToolbar"; - this._MainToolbar.Padding = new System.Windows.Forms.Padding(0, 0, 2, 0); - this._MainToolbar.Size = new System.Drawing.Size(483, 25); - this._MainToolbar.TabIndex = 0; - this._MainToolbar.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _AddFilesButton - // - this._AddFilesButton.DropDown = this._RecentFileMenu; - this._AddFilesButton.Image = global::PDFPatcher.Properties.Resources.Add; - this._AddFilesButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._AddFilesButton.Name = "_AddFilesButton"; - this._AddFilesButton.Size = new System.Drawing.Size(103, 22); - this._AddFilesButton.Text = "添加文件(&T)"; - this._AddFilesButton.ToolTipText = "添加文件"; - this._AddFilesButton.ButtonClick += new System.EventHandler(this._MainToolbar_ButtonClick); - // - // _RecentFileMenu - // - this._RecentFileMenu.ImageScalingSize = new System.Drawing.Size(24, 24); - this._RecentFileMenu.Name = "_RecentFileMenu"; - this._RecentFileMenu.OwnerItem = this._AddFilesButton; - this._RecentFileMenu.ShowImageMargin = false; - this._RecentFileMenu.Size = new System.Drawing.Size(36, 4); - // - // _Actions - // - _Actions.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - _DocumentActions, - _PageActions, - _RemoveActions}); - _Actions.Image = global::PDFPatcher.Properties.Resources.Actions; - _Actions.ImageTransparentColor = System.Drawing.Color.Magenta; - _Actions.Name = "_Actions"; - _Actions.Size = new System.Drawing.Size(85, 22); - _Actions.Text = "补丁操作"; - _Actions.Visible = false; - _Actions.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _DocumentActions - // - _DocumentActions.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - _RemoveUsageRightsAction, - _ModifyMetaDataAction}); - _DocumentActions.Image = global::PDFPatcher.Properties.Resources.DocumentProcessor; - _DocumentActions.Name = "_DocumentActions"; - _DocumentActions.Size = new System.Drawing.Size(196, 22); - _DocumentActions.Text = "添加文档处理操作"; - _DocumentActions.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _RemoveUsageRightsAction - // - _RemoveUsageRightsAction.Name = "_RemoveUsageRightsAction"; - _RemoveUsageRightsAction.Size = new System.Drawing.Size(184, 22); - _RemoveUsageRightsAction.Text = "移除复制、打印限制"; - // - // _ModifyMetaDataAction - // - _ModifyMetaDataAction.Name = "_ModifyMetaDataAction"; - _ModifyMetaDataAction.Size = new System.Drawing.Size(184, 22); - _ModifyMetaDataAction.Text = "修改元数据"; - // - // _PageActions - // - _PageActions.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - _ImageRecompressionAction, - _RemoveAnnotationAction, - _RemoveThumbnailAction, - _RemoveTextAction, - _RemoveImageAction}); - _PageActions.Image = global::PDFPatcher.Properties.Resources.PageProcessor; - _PageActions.Name = "_PageActions"; - _PageActions.Size = new System.Drawing.Size(196, 22); - _PageActions.Text = "添加页面内容处理操作"; - _PageActions.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _ImageRecompressionAction - // - _ImageRecompressionAction.Name = "_ImageRecompressionAction"; - _ImageRecompressionAction.Size = new System.Drawing.Size(196, 22); - _ImageRecompressionAction.Text = "优化纯黑白图像压缩率"; - // - // _RemoveAnnotationAction - // - _RemoveAnnotationAction.Name = "_RemoveAnnotationAction"; - _RemoveAnnotationAction.Size = new System.Drawing.Size(196, 22); - _RemoveAnnotationAction.Text = "删除批注"; - // - // _RemoveThumbnailAction - // - _RemoveThumbnailAction.Name = "_RemoveThumbnailAction"; - _RemoveThumbnailAction.Size = new System.Drawing.Size(196, 22); - _RemoveThumbnailAction.Text = "删除缩略图"; - // - // _RemoveTextAction - // - _RemoveTextAction.Name = "_RemoveTextAction"; - _RemoveTextAction.Size = new System.Drawing.Size(196, 22); - _RemoveTextAction.Text = "删除文本内容"; - // - // _RemoveImageAction - // - _RemoveImageAction.Name = "_RemoveImageAction"; - _RemoveImageAction.Size = new System.Drawing.Size(196, 22); - _RemoveImageAction.Text = "删除图片"; - // - // _RemoveActions - // - _RemoveActions.Image = global::PDFPatcher.Properties.Resources.Delete; - _RemoveActions.Name = "_RemoveActions"; - _RemoveActions.Size = new System.Drawing.Size(196, 22); - _RemoveActions.Text = "删除选中的操作"; - // - // _Sort - // - _Sort.DropDown = this._SortMenu; - _Sort.Image = global::PDFPatcher.Properties.Resources.Sort; - _Sort.ImageTransparentColor = System.Drawing.Color.Magenta; - _Sort.Name = "_Sort"; - _Sort.Size = new System.Drawing.Size(61, 22); - _Sort.Text = "排序"; - _Sort.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._SortMenu_ItemClicked); - // - // _SortMenu - // - this._SortMenu.ImageScalingSize = new System.Drawing.Size(24, 24); - this._SortMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._SortByNaturalNumberItem, - this._SortByAlphaItem}); - this._SortMenu.Name = "_SortMenu"; - this._SortMenu.OwnerItem = _Sort; - this._SortMenu.Size = new System.Drawing.Size(225, 64); - this._SortMenu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._SortMenu_ItemClicked); - // - // _SortByNaturalNumberItem - // - this._SortByNaturalNumberItem.Image = global::PDFPatcher.Properties.Resources.NaturalSort; - this._SortByNaturalNumberItem.Name = "_SortByNaturalNumberItem"; - this._SortByNaturalNumberItem.Size = new System.Drawing.Size(224, 30); - this._SortByNaturalNumberItem.Text = "按数值和字母顺序排序(&M)"; - // - // _SortByAlphaItem - // - this._SortByAlphaItem.Image = global::PDFPatcher.Properties.Resources.AlphabeticSort; - this._SortByAlphaItem.Name = "_SortByAlphaItem"; - this._SortByAlphaItem.Size = new System.Drawing.Size(224, 30); - this._SortByAlphaItem.Text = "按字母顺序排序(&Z)"; - // - // _Delete - // - _Delete.Image = global::PDFPatcher.Properties.Resources.Delete; - _Delete.ImageTransparentColor = System.Drawing.Color.Magenta; - _Delete.Name = "_Delete"; - _Delete.Size = new System.Drawing.Size(76, 22); - _Delete.Text = "删除文件"; - // - // toolStripSeparator2 - // - toolStripSeparator2.Name = "toolStripSeparator2"; - toolStripSeparator2.Size = new System.Drawing.Size(6, 25); - // - // _RefreshInfoButton - // - this._RefreshInfoButton.Image = global::PDFPatcher.Properties.Resources.Refresh; - this._RefreshInfoButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._RefreshInfoButton.Name = "_RefreshInfoButton"; - this._RefreshInfoButton.Size = new System.Drawing.Size(112, 22); - this._RefreshInfoButton.Text = "刷新文档属性"; - // - // _SelectAllItem - // - _SelectAllItem.Image = global::PDFPatcher.Properties.Resources.SelectAll; - _SelectAllItem.Name = "_SelectAllItem"; - _SelectAllItem.Size = new System.Drawing.Size(132, 30); - _SelectAllItem.Text = "全部选中"; - // - // _InvertSelectItem - // - _InvertSelectItem.Name = "_InvertSelectItem"; - _InvertSelectItem.Size = new System.Drawing.Size(132, 30); - _InvertSelectItem.Text = "反转选择"; - // - // _SelectNoneItem - // - _SelectNoneItem.Name = "_SelectNoneItem"; - _SelectNoneItem.Size = new System.Drawing.Size(132, 30); - _SelectNoneItem.Text = "取消选择"; - // - // _Copy - // - _Copy.Image = global::PDFPatcher.Properties.Resources.Copy; - _Copy.Name = "_Copy"; - _Copy.Size = new System.Drawing.Size(156, 30); - _Copy.Text = "复制列表内容"; - // - // _RefreshInfo - // - _RefreshInfo.DropDown = this._RefreshInfoMenu; - _RefreshInfo.Image = global::PDFPatcher.Properties.Resources.Refresh; - _RefreshInfo.Name = "_RefreshInfo"; - _RefreshInfo.Size = new System.Drawing.Size(156, 30); - _RefreshInfo.Text = "刷新文档属性"; - // - // _RefreshInfoMenu - // - this._RefreshInfoMenu.ImageScalingSize = new System.Drawing.Size(24, 24); - this._RefreshInfoMenu.Name = "_RefreshInfoMenu"; - this._RefreshInfoMenu.OwnerItem = _RefreshInfo; - this._RefreshInfoMenu.Size = new System.Drawing.Size(61, 4); - // - // _SelectionMenu - // - this._SelectionMenu.ImageScalingSize = new System.Drawing.Size(24, 24); - this._SelectionMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - _SelectAllItem, - _InvertSelectItem, - _SelectNoneItem}); - this._SelectionMenu.Name = "_SelectionMenu"; - this._SelectionMenu.OwnerItem = this._SelectionMenuItem; - this._SelectionMenu.Size = new System.Drawing.Size(133, 94); - this._SelectionMenu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _SelectionMenuItem - // - this._SelectionMenuItem.DropDown = this._SelectionMenu; - this._SelectionMenuItem.Image = global::PDFPatcher.Properties.Resources.SelectItem; - this._SelectionMenuItem.Name = "_SelectionMenuItem"; - this._SelectionMenuItem.Size = new System.Drawing.Size(156, 30); - this._SelectionMenuItem.Text = "选择文件"; - // - // _ItemList - // - this._ItemList.AllColumns.Add(this._NameColumn); - this._ItemList.AllColumns.Add(this._PageCountColumn); - this._ItemList.AllColumns.Add(this._TitleColumn); - this._ItemList.AllColumns.Add(this._AuthorColumn); - this._ItemList.AllColumns.Add(this._SubjectColumn); - this._ItemList.AllColumns.Add(this._KeywordsColumn); - this._ItemList.AllColumns.Add(this._FolderColumn); - this._ItemList.AllColumns.Add(this._FileTimeColumn); - this._ItemList.AllowDrop = true; - this._ItemList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ItemList.CellEditActivation = BrightIdeasSoftware.ObjectListView.CellEditActivateMode.SingleClick; - this._ItemList.CellEditUseWholeCell = false; - this._ItemList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this._NameColumn, - this._PageCountColumn, - this._TitleColumn, - this._AuthorColumn, - this._SubjectColumn, - this._KeywordsColumn, - this._FolderColumn, - this._FileTimeColumn}); - this._ItemList.ContextMenuStrip = this._ItemListMenu; - this._ItemList.Cursor = System.Windows.Forms.Cursors.Default; - this._ItemList.GridLines = true; - this._ItemList.HideSelection = false; - this._ItemList.Location = new System.Drawing.Point(3, 3); - this._ItemList.Name = "_ItemList"; - this._ItemList.ShowGroups = false; - this._ItemList.Size = new System.Drawing.Size(544, 199); - this._ItemList.SmallImageList = this._FileTypeList; - this._ItemList.TabIndex = 0; - this._ItemList.UseCompatibleStateImageBehavior = false; - this._ItemList.View = System.Windows.Forms.View.Details; - this._ItemList.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this._ImageList_ColumnClick); - // - // _NameColumn - // - this._NameColumn.Text = "源文件名"; - this._NameColumn.Width = 149; - // - // _PageCountColumn - // - this._PageCountColumn.HeaderTextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._PageCountColumn.IsEditable = false; - this._PageCountColumn.Text = "页数"; - this._PageCountColumn.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._PageCountColumn.Width = 50; - // - // _TitleColumn - // - this._TitleColumn.Text = "标题"; - // - // _AuthorColumn - // - this._AuthorColumn.Text = "作者"; - // - // _SubjectColumn - // - this._SubjectColumn.Text = "主题"; - // - // _KeywordsColumn - // - this._KeywordsColumn.Text = "关键词"; - this._KeywordsColumn.Width = 73; - // - // _FolderColumn - // - this._FolderColumn.IsEditable = false; - this._FolderColumn.Text = "文件夹"; - this._FolderColumn.Width = 96; - // - // _FileTimeColumn - // - this._FileTimeColumn.IsEditable = false; - this._FileTimeColumn.Text = "修改时间"; - this._FileTimeColumn.Width = 145; - // - // _ItemListMenu - // - this._ItemListMenu.ImageScalingSize = new System.Drawing.Size(24, 24); - this._ItemListMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - _Copy, - _RefreshInfo, - this._SelectionMenuItem}); - this._ItemListMenu.Name = "_ItemListMenu"; - this._ItemListMenu.Size = new System.Drawing.Size(157, 94); - this._ItemListMenu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _FileTypeList - // - this._FileTypeList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; - this._FileTypeList.ImageSize = new System.Drawing.Size(16, 16); - this._FileTypeList.TransparentColor = System.Drawing.Color.Transparent; - // - // _OpenPdfBox - // - this._OpenPdfBox.DefaultExt = "pdf"; - this._OpenPdfBox.Filter = "PDF 文件(*.pdf)|*.pdf"; - this._OpenPdfBox.Multiselect = true; - this._OpenPdfBox.Title = "选择需要处理的 PDF 文件"; - // - // _AutoClearListBox - // - this._AutoClearListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._AutoClearListBox.AutoSize = true; - this._AutoClearListBox.Checked = true; - this._AutoClearListBox.CheckState = System.Windows.Forms.CheckState.Checked; - this._AutoClearListBox.Location = new System.Drawing.Point(434, 9); - this._AutoClearListBox.Name = "_AutoClearListBox"; - this._AutoClearListBox.Size = new System.Drawing.Size(132, 16); - this._AutoClearListBox.TabIndex = 4; - this._AutoClearListBox.Text = "添加文件前清空列表"; - this._AutoClearListBox.UseVisualStyleBackColor = true; - // - // _AddDocumentWorker - // - this._AddDocumentWorker.WorkerReportsProgress = true; - this._AddDocumentWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this._AddDocumentWorker_DoWork); - this._AddDocumentWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this._AddDocumentWorker_ProgressChanged); - this._AddDocumentWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this._AddDocumentWorker_RunWorkerCompleted); - // - // _BookmarkControl - // - this._BookmarkControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._BookmarkControl.LabelText = "P&DF 信息文件:"; - this._BookmarkControl.Location = new System.Drawing.Point(13, 235); - this._BookmarkControl.Margin = new System.Windows.Forms.Padding(4); - this._BookmarkControl.Name = "_BookmarkControl"; - this._BookmarkControl.Size = new System.Drawing.Size(553, 24); - this._BookmarkControl.TabIndex = 6; - // - // _TargetPdfFile - // - this._TargetPdfFile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._TargetPdfFile.Location = new System.Drawing.Point(13, 265); - this._TargetPdfFile.Margin = new System.Windows.Forms.Padding(4); - this._TargetPdfFile.Name = "_TargetPdfFile"; - this._TargetPdfFile.Size = new System.Drawing.Size(553, 26); - this._TargetPdfFile.TabIndex = 7; - // - // _ActionsBox - // - this._ActionsBox.AllColumns.Add(this._ActionNameColumn); - this._ActionsBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ActionsBox.CellEditUseWholeCell = false; - this._ActionsBox.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this._ActionNameColumn}); - this._ActionsBox.Cursor = System.Windows.Forms.Cursors.Default; - this._ActionsBox.FullRowSelect = true; - this._ActionsBox.GridLines = true; - this._ActionsBox.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this._ActionsBox.HideSelection = false; - this._ActionsBox.Location = new System.Drawing.Point(5, 3); - this._ActionsBox.Name = "_ActionsBox"; - this._ActionsBox.RowHeight = 18; - this._ActionsBox.ShowGroups = false; - this._ActionsBox.Size = new System.Drawing.Size(126, 176); - this._ActionsBox.TabIndex = 18; - this._ActionsBox.UseCompatibleStateImageBehavior = false; - this._ActionsBox.View = System.Windows.Forms.View.Details; - // - // _ActionNameColumn - // - this._ActionNameColumn.Text = "补丁操作"; - this._ActionNameColumn.Width = 120; - // - // _ItemActionsContainerBox - // - this._ItemActionsContainerBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ItemActionsContainerBox.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; - this._ItemActionsContainerBox.Location = new System.Drawing.Point(13, 28); - this._ItemActionsContainerBox.Name = "_ItemActionsContainerBox"; - // - // _ItemActionsContainerBox.Panel1 - // - this._ItemActionsContainerBox.Panel1.Controls.Add(this._ItemList); - // - // _ItemActionsContainerBox.Panel2 - // - this._ItemActionsContainerBox.Panel2.Controls.Add(this._ActionsBox); - this._ItemActionsContainerBox.Panel2Collapsed = true; - this._ItemActionsContainerBox.Size = new System.Drawing.Size(550, 205); - this._ItemActionsContainerBox.SplitterDistance = 412; - this._ItemActionsContainerBox.TabIndex = 5; - // - // _ExportBookmarkButton - // - this._ExportBookmarkButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this._ExportBookmarkButton.Image = global::PDFPatcher.Properties.Resources.ExportInfoFile; - this._ExportBookmarkButton.Location = new System.Drawing.Point(18, 297); - this._ExportBookmarkButton.Name = "_ExportBookmarkButton"; - this._ExportBookmarkButton.Size = new System.Drawing.Size(120, 23); - this._ExportBookmarkButton.TabIndex = 8; - this._ExportBookmarkButton.Text = "导出信息文件(&C)"; - this._ExportBookmarkButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._ExportBookmarkButton.UseVisualStyleBackColor = true; - this._ExportBookmarkButton.Click += new System.EventHandler(this._ExportBookmarkButton_Click); - // - // _ImportButton - // - this._ImportButton.AlternativeFocusBorderColor = System.Drawing.SystemColors.Highlight; - this._ImportButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._ImportButton.AnimateGlow = true; - this._ImportButton.BackColor = System.Drawing.SystemColors.Highlight; - this._ImportButton.CornerRadius = 3; - this._ImportButton.ForeColor = System.Drawing.SystemColors.ControlText; - this._ImportButton.GlowColor = System.Drawing.Color.White; - this._ImportButton.Image = global::PDFPatcher.Properties.Resources.Save; - this._ImportButton.InnerBorderColor = System.Drawing.SystemColors.ControlDarkDark; - this._ImportButton.Location = new System.Drawing.Point(440, 297); - this._ImportButton.Name = "_ImportButton"; - this._ImportButton.OuterBorderColor = System.Drawing.SystemColors.ControlLightLight; - this._ImportButton.ShowFocusBorder = true; - this._ImportButton.Size = new System.Drawing.Size(123, 29); - this._ImportButton.TabIndex = 13; - this._ImportButton.Text = "生成目标文件(&S)"; - this._ImportButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._ImportButton.Click += new System.EventHandler(this._ImportButton_Click); - // - // _ConfigButton - // - this._ConfigButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._ConfigButton.Image = global::PDFPatcher.Properties.Resources.PdfOptions; - this._ConfigButton.Location = new System.Drawing.Point(253, 297); - this._ConfigButton.Name = "_ConfigButton"; - this._ConfigButton.Size = new System.Drawing.Size(181, 23); - this._ConfigButton.TabIndex = 14; - this._ConfigButton.Text = "设置 P&DF 文件的修改方式"; - this._ConfigButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._ConfigButton.UseVisualStyleBackColor = true; - // - // _InfoConfigButton - // - this._InfoConfigButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this._InfoConfigButton.Image = global::PDFPatcher.Properties.Resources.InfoFileOptions; - this._InfoConfigButton.Location = new System.Drawing.Point(144, 297); - this._InfoConfigButton.Name = "_InfoConfigButton"; - this._InfoConfigButton.Size = new System.Drawing.Size(103, 23); - this._InfoConfigButton.TabIndex = 14; - this._InfoConfigButton.Text = "信息文件配置"; - this._InfoConfigButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._InfoConfigButton.UseVisualStyleBackColor = true; - this._InfoConfigButton.Click += new System.EventHandler(this._MainToolbar_ButtonClick); - // - // InfoExchangerControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this._InfoConfigButton); - this.Controls.Add(this._ConfigButton); - this.Controls.Add(this._ImportButton); - this.Controls.Add(this._MainToolbar); - this.Controls.Add(this._TargetPdfFile); - this.Controls.Add(this._ExportBookmarkButton); - this.Controls.Add(this._ItemActionsContainerBox); - this.Controls.Add(this._AutoClearListBox); - this.Controls.Add(this._BookmarkControl); - this.Font = new System.Drawing.Font("SimSun", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.Name = "InfoExchangerControl"; - this.Size = new System.Drawing.Size(575, 342); - this._MainToolbar.ResumeLayout(false); - this._MainToolbar.PerformLayout(); - this._SortMenu.ResumeLayout(false); - this._SelectionMenu.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this._ItemList)).EndInit(); - this._ItemListMenu.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this._ActionsBox)).EndInit(); - this._ItemActionsContainerBox.Panel1.ResumeLayout(false); - this._ItemActionsContainerBox.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this._ItemActionsContainerBox)).EndInit(); - this._ItemActionsContainerBox.ResumeLayout(false); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - private BrightIdeasSoftware.ObjectListView _ItemList; - private BrightIdeasSoftware.OLVColumn _NameColumn; - private BrightIdeasSoftware.OLVColumn _FolderColumn; - private TargetFileControl _TargetPdfFile; - private System.Windows.Forms.ContextMenuStrip _SortMenu; - private System.Windows.Forms.ToolStripMenuItem _SortByNaturalNumberItem; - private System.Windows.Forms.ToolStripMenuItem _SortByAlphaItem; - private System.Windows.Forms.ContextMenuStrip _SelectionMenu; - private BookmarkControl _BookmarkControl; - private BrightIdeasSoftware.OLVColumn _PageCountColumn; - private System.Windows.Forms.ToolStripMenuItem _SelectionMenuItem; - private System.Windows.Forms.ContextMenuStrip _ItemListMenu; - private System.Windows.Forms.Button _ExportBookmarkButton; - private System.Windows.Forms.ToolStripSplitButton _AddFilesButton; - private System.Windows.Forms.ContextMenuStrip _RecentFileMenu; - private System.Windows.Forms.OpenFileDialog _OpenPdfBox; - private System.Windows.Forms.CheckBox _AutoClearListBox; - private System.ComponentModel.BackgroundWorker _AddDocumentWorker; - private BrightIdeasSoftware.OLVColumn _TitleColumn; - private BrightIdeasSoftware.OLVColumn _AuthorColumn; - private BrightIdeasSoftware.OLVColumn _SubjectColumn; - private BrightIdeasSoftware.OLVColumn _KeywordsColumn; - private BrightIdeasSoftware.ObjectListView _ActionsBox; - private System.Windows.Forms.SplitContainer _ItemActionsContainerBox; - private BrightIdeasSoftware.OLVColumn _ActionNameColumn; - private System.Windows.Forms.ImageList _FileTypeList; - private System.Windows.Forms.ToolStripSplitButton _RefreshInfoButton; - private System.Windows.Forms.ContextMenuStrip _RefreshInfoMenu; - private EnhancedGlassButton.GlassButton _ImportButton; - private System.Windows.Forms.Button _ConfigButton; - private System.Windows.Forms.Button _InfoConfigButton; - private BrightIdeasSoftware.OLVColumn _FileTimeColumn; - private System.Windows.Forms.ToolStrip _MainToolbar; - } -} diff --git a/pdfpatcher/App/Functions/InfoExchangerControl.cs b/pdfpatcher/App/Functions/InfoExchangerControl.cs deleted file mode 100644 index 05de2ce5675b18cae7f4ca0eaf378e3a8bc11a1f..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/InfoExchangerControl.cs +++ /dev/null @@ -1,377 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.IO; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using BrightIdeasSoftware; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - [ToolboxItem(false)] - public partial class InfoExchangerControl : FunctionControl - { - FileListHelper _listHelper; - - public override string FunctionName => "导出导入信息文件"; - - public override System.Drawing.Bitmap IconImage => Properties.Resources.ExportInfoFile; - - public InfoExchangerControl() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - } - - void OnLoad() { - _MainToolbar.ScaleIcons(16); - _ItemList.ListViewItemSorter = new ListViewItemComparer(0); - - AppContext.MainForm.SetTooltip(_BookmarkControl.FileList, "需要导出或导入的信息文件路径"); - AppContext.MainForm.SetTooltip(_ActionsBox, "双击项目编辑操作选项;右键点击项目弹出上下文菜单"); - AppContext.MainForm.SetTooltip(_ItemList, "在此添加需要导出或导入信息文件的 PDF 文件"); - AppContext.MainForm.SetTooltip(_ImportButton, "点击此按钮执行补丁生成新的 PDF 文件,该文件具有信息文件的设定"); - AppContext.MainForm.SetTooltip(_TargetPdfFile.FileList, "在此指定导入信息文件后生成的目标 PDF 文件路径(鼠标右键点击列表可插入文件名替代符)"); - _ItemList.EmptyListMsg = "请使用“添加文件”按钮添加需要处理的 PDF 文件,或从资源管理器拖放文件到本列表框"; - - _ConfigButton.Click += (s, args) => AppContext.MainForm.SelectFunctionList(Function.PatcherOptions); - _InfoConfigButton.Click += (s, args) => AppContext.MainForm.SelectFunctionList(Function.InfoFileOptions); - - new TypedColumn(_ActionNameColumn) { - AspectGetter = (o) => o.Name, - ImageGetter = (o) => { - if (o is Processor.IPageProcessor) { - return Properties.Resources.PageProcessor; - } - else { - return Properties.Resources.DocumentProcessor; - } - } - }; - _TargetPdfFile.FileMacroMenu.LoadStandardInfoMacros(); - _TargetPdfFile.FileMacroMenu.LoadStandardSourceFileMacros(); - _BookmarkControl.FileDialog.CheckFileExists = false; - _BookmarkControl.BrowseForFile += new EventHandler(FileControl_BrowseForFile); - _TargetPdfFile.BrowseForFile += new EventHandler(FileControl_BrowseForFile); - _TargetPdfFile.TargetFileChangedByBrowseButton += (s, args) => { - int i; - var f = _TargetPdfFile.FileDialog.FileName; - if (_ItemList.Items.Count > 1 && (i = f.LastIndexOf(Path.DirectorySeparatorChar)) != -1) { - _TargetPdfFile.Text = string.Concat(f.Substring(0, i), Path.DirectorySeparatorChar, Constants.FileNameMacros.FileName, Path.GetExtension(f)); - args.Cancel = true; - } - }; - var fi = _FileTypeList.Images; - fi.AddRange(new System.Drawing.Image[] { - Properties.Resources.OriginalPdfFile - }); - //_ItemList.SelectedIndexChanged += (s, args) => { - // if (_ItemList.SelectedIndex != -1 && _TargetPdfFile.Text.Trim ().Length > 0) { - // var f = _ItemList.GetModelObject (_ItemList.SelectedIndex) as SourceItem; - // AppContext.MainForm.StatusText = "输出文件:" + f.GetTargetPdfFileName (_TargetPdfFile.Text.Trim ()); - // } - // else { - // AppContext.MainForm.StatusText = String.Empty; - // } - //}; - _ItemList.FixEditControlWidth(); - _ItemList.ScaleColumnWidths(); - _listHelper = new FileListHelper(_ItemList); - _listHelper.SetupDragAndDrop(AddFiles); - FileListHelper.SetupCommonPdfColumns(_AuthorColumn, _KeywordsColumn, _SubjectColumn, _TitleColumn, _PageCountColumn, _NameColumn, _FolderColumn, _FileTimeColumn); - _RefreshInfoButton.ButtonClick += (s, args) => _listHelper.RefreshInfo(AppContext.Encodings.DocInfoEncoding); - _RefreshInfoButton.DropDown = _RefreshInfoMenu; - foreach (var item in Constants.Encoding.EncodingNames) { - _RefreshInfoMenu.Items.Add(item); - } - _RefreshInfoMenu.ItemClicked += (s, args) => _listHelper.RefreshInfo(ValueHelper.MapValue(args.ClickedItem.Text, Constants.Encoding.EncodingNames, Constants.Encoding.Encodings)); - _AddFilesButton.DropDownOpening += FileListHelper.OpenPdfButtonDropDownOpeningHandler; - _AddFilesButton.DropDownItemClicked += (s, args) => { - args.ClickedItem.Owner.Hide(); - AddFiles(new string[] { args.ClickedItem.ToolTipText }, true); - }; - } - - public override void ExecuteCommand(string commandName, params string[] parameters) { - if (commandName == Commands.Open) { - var b = _OpenPdfBox; - if (b.ShowDialog() == DialogResult.OK) { - AddFiles(b.FileNames, true); - } - } - else if (commandName == Commands.OpenFile) { - AddFiles(parameters, true); - } - else if (commandName == Commands.SaveBookmark) { - _ExportBookmarkButton.PerformClick(); - } - else if (_listHelper.ProcessCommonMenuCommand(commandName) == false) { - base.ExecuteCommand(commandName, parameters); - } - } - - public override void SetupCommand(ToolStripItem item) { - var n = item.Name; - if (Commands.CommonSelectionCommands.Contains(n) - || n == Commands.Delete - || n == Commands.Action) { - item.Enabled = _ItemList.GetItemCount() > 0; - } - else if (n == Commands.SaveBookmark) { - item.Enabled = _ItemList.GetItemCount() > 0; - item.Text = "导出书签文件(&Q)"; - item.Visible = true; - } - else if (n == Commands.Options) { - item.Text = "修改文档设置(&S)..."; - item.ToolTipText = "设置修改后的 PDF 文档"; - EnableCommand(item, true, true); - item.Tag = nameof(Function.PatcherOptions); - } - base.SetupCommand(item); - } - - void FileControl_BrowseForFile(object sender, EventArgs e) { - _listHelper.PrepareSourceFiles(); - } - - void AddFiles(string[] files, bool alertInvalidFiles) { - if (files == null || files.Length == 0) { - return; - } - if ((ModifierKeys & Keys.Control) != Keys.None || _AutoClearListBox.Checked) { - _ItemList.ClearObjects(); - } - if (files.Length > 3) { - AppContext.MainForm.Enabled = false; - } - if (files.Length == 0) { - return; - } - _AddDocumentWorker.RunWorkerAsync(files); - } - - void _ImportButton_Click(object sender, EventArgs e) { - var infoFile = _BookmarkControl.Text.Trim(); - var targetPdfFile = _TargetPdfFile.Text.Trim(); - if (string.IsNullOrEmpty(targetPdfFile) && string.IsNullOrEmpty(targetPdfFile = _TargetPdfFile.BrowseTargetFile())) { - FormHelper.ErrorBox(Messages.TargetFileNotSpecified); - return; - } - //if (_mode == ProcessMode.Merge && Common.FileHelper.IsPathValid (targetPdfFile) == false) { - // Common.FormHelper.ErrorBox ("输出文件名无效。" + (Common.FileUtility.HasFileNameMacro (targetPdfFile) ? "\n制作 PDF 文件功能不支持替代符。" : String.Empty)); - // return; - //} - - var l = _ItemList.GetItemCount(); - if (l == 0) { - FormHelper.InfoBox("请添加需要处理的 PDF 文件。"); - return; - } - var files = GetSourceItemList(); - _BookmarkControl.FileList.AddHistoryItem(); - _TargetPdfFile.FileList.AddHistoryItem(); - - AppContext.MainForm.ResetWorker(); - var worker = AppContext.MainForm.GetWorker(); - worker.DoWork += (dummy, arg) => { - var a = arg.Argument as object[]; - var t = a[0] as string; - if (files.Count > 1) { - Tracker.SetTotalProgressGoal(files.Count); - foreach (var file in files) { - if (file.Type == SourceItem.ItemType.Pdf) { - Processor.Worker.PatchDocument(file as SourceItem.Pdf, - file.GetTargetPdfFileName(t), - file.GetInfoFileName(), - AppContext.Importer, - AppContext.Patcher); - } - else { - Tracker.TraceMessage("输入文件不是 PDF 文件。"); - } - Tracker.IncrementTotalProgress(); - if (AppContext.Abort) { - return; - } - } - } - else { - if (files[0].Type != SourceItem.ItemType.Pdf) { - Tracker.TraceMessage("输入文件不是 PDF 文件。"); - return; - } - Processor.Worker.PatchDocument(files[0] as SourceItem.Pdf, - t, - a[1] as string, - AppContext.Importer, - AppContext.Patcher); - } - }; - worker.RunWorkerAsync(new object[] { targetPdfFile, infoFile }); - } - - void _ExportBookmarkButton_Click(object sender, EventArgs e) { - if (string.IsNullOrEmpty(_BookmarkControl.Text)) { - FormHelper.ErrorBox(Messages.InfoDocNotSpecified); - return; - } - - var files = GetSourceItemList(); - - if (files.Count == 0) { - FormHelper.InfoBox(Messages.SourceFileNotFound); - return; - } - - _BookmarkControl.FileList.AddHistoryItem(); - - AppContext.MainForm.ResetWorker(); - var w = AppContext.MainForm.GetWorker(); - w.DoWork += (dummy, arg) => { - var b = AppContext.BookmarkFile; - var fs = arg.Argument as List; - if (fs.Count > 1) { - var p = b.Contains(Path.DirectorySeparatorChar) || b.Contains(Path.AltDirectorySeparatorChar) ? Path.GetDirectoryName(b) : Path.GetFileNameWithoutExtension(b); - var ext = Path.GetExtension(b); - Tracker.SetTotalProgressGoal(fs.Count); - foreach (var file in fs) { - Processor.Worker.ExportInfo(file.FilePath, file.FilePath.Directory.Combine(p).Combine(file.FilePath.ChangeExtension(ext).FileName)); - Tracker.IncrementTotalProgress(); - if (AppContext.Abort) { - return; - } - } - } - else { - if (fs[0].Type != SourceItem.ItemType.Pdf) { - Tracker.TraceMessage("输入文件不是 PDF 文件。"); - return; - } - Processor.Worker.ExportInfo(fs[0].FilePath, b); - } - }; - w.RunWorkerAsync(files); - } - - List GetSourceItemList() { - var l = _ItemList.GetItemCount(); - var files = new List(l); - for (int i = 0; i < l; i++) { - var item = _ItemList.GetModelObject(_ItemList.GetNthItemInDisplayOrder(i).Index) as SourceItem; - if (item.Type == SourceItem.ItemType.Pdf - && FileHelper.HasExtension(item.FilePath, Constants.FileExtensions.Pdf)) { - AppContext.RecentItems.AddHistoryItem(AppContext.Recent.SourcePdfFiles, item.FilePath.ToString()); - } - files.Add(item); - } - return files; - } - - void _SortMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { - switch (e.ClickedItem.Name) { - case "_SortByAlphaItem": - _ItemList.ListViewItemSorter = new ListViewItemComparer(0, false); - break; - case "_SortByNaturalNumberItem": - _ItemList.ListViewItemSorter = new ListViewItemComparer(0, true); - break; - } - } - - void _ImageList_ColumnClick(object sender, ColumnClickEventArgs e) { - var c = e.Column; - var ss = c == 0 || c == _PageCountColumn.Index; - var o = _ItemList.PrimarySortOrder == SortOrder.Ascending ? SortOrder.Descending : SortOrder.Ascending; - _ItemList.ListViewItemSorter = new ListViewItemComparer(e.Column, ss, o); - } - - void _MainToolbar_ButtonClick(object sender, EventArgs e) { - if (sender == _AddFilesButton) { - var b = _OpenPdfBox; - _AddFilesButton.DropDown.Items.ClearDropDownItems(); - if (b.ShowDialog() == DialogResult.OK) { - AddFiles(b.FileNames, true); - } - } - } - - void _MainToolbar_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { - _listHelper.ProcessCommonMenuCommand(e.ClickedItem.Name); - } - - void PreviewRename(List items, string template) { - var i = 0; - var result = new string[items.Count]; - var source = new string[items.Count]; - FilePath s; - string t; - foreach (var item in items) { - try { - s = item.FilePath; - if (s.ExistsFile == false) { - t = string.Concat("(找不到 PDF 文件:", s, ")"); - continue; - } - else { - t = Processor.Worker.GetExpandedFileName(item, template); - if (t.Length == 0) { - t = "<输出文件名无效>"; - } - else if (Path.GetFileName(t).Length == 0) { - t = "<输出文件名为空>"; - } - } - source[i] = s.ToString(); - result[i] = t; - i++; - } - catch (Exception ex) { - FormHelper.ErrorBox(ex.Message); - } - } - using (var f = new RenamePreviewForm(source, result)) { - f.ShowDialog(); - } - } - - #region AddDocumentWorker - void _AddDocumentWorker_DoWork(object sender, DoWorkEventArgs e) { - var files = e.Argument as string[]; - Array.ForEach(files, f => ((BackgroundWorker)sender).ReportProgress(0, f)); - } - - void _AddDocumentWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { - AppContext.MainForm.Enabled = true; - _listHelper.ResizeItemListColumns(); - } - - void _AddDocumentWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) { - var item = e.UserState as string; - AddItem(SourceItem.Create(item)); - } - - void AddItem(SourceItem item) { - if (item == null) { - return; - } - AddItems(new SourceItem[] { item }); - } - - void AddItems(System.Collections.ICollection items) { - var i = _ItemList.GetLastSelectedIndex(); - _ItemList.InsertObjects(++i, items); - _ItemList.SelectedIndex = --i + items.Count; - } - #endregion - - #region IDefaultButtonControl 成员 - - public override Button DefaultButton => _ImportButton; - - #endregion - - } -} diff --git a/pdfpatcher/App/Functions/InfoExchangerControl.resx b/pdfpatcher/App/Functions/InfoExchangerControl.resx deleted file mode 100644 index f687cdc86be41541140b66e7d59bddc4b9d3964b..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/InfoExchangerControl.resx +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 495, 17 - - - 614, 17 - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - 135, 17 - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - 137, 56 - - - 240, 17 - - - 370, 17 - - - 17, 56 - - - 17, 17 - - - 750, 17 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/InfoFileOptionControl.Designer.cs b/pdfpatcher/App/Functions/InfoFileOptionControl.Designer.cs deleted file mode 100644 index e9bf7f219bbf0a1688e4e1ccf90ba98eb27293ad..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/InfoFileOptionControl.Designer.cs +++ /dev/null @@ -1,592 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class InfoFileOptionControl - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._EncodingBox = new System.Windows.Forms.ComboBox (); - this.label1 = new System.Windows.Forms.Label (); - this._ExtractPageLinksBox = new System.Windows.Forms.CheckBox (); - this._ExportViewerPreferencesBox = new System.Windows.Forms.CheckBox (); - this._ExportBookmarksBox = new System.Windows.Forms.CheckBox (); - this._ExportOptionsTab = new System.Windows.Forms.TabControl (); - this.tabPage1 = new System.Windows.Forms.TabPage (); - this._UnitBox = new System.Windows.Forms.ComboBox (); - this.label7 = new System.Windows.Forms.Label (); - this.groupBox1 = new System.Windows.Forms.GroupBox (); - this._ExportDocPropertiesBox = new System.Windows.Forms.CheckBox (); - this._ExtractPageSettingsBox = new System.Windows.Forms.CheckBox (); - this._ConsolidateNamedDestBox = new System.Windows.Forms.CheckBox (); - this.tabPage2 = new System.Windows.Forms.TabPage (); - this._ExportCatalogBox = new System.Windows.Forms.CheckBox (); - this.label2 = new System.Windows.Forms.Label (); - this.label5 = new System.Windows.Forms.Label (); - this._ExtractPageContentBox = new System.Windows.Forms.CheckBox (); - this._PageContentBox = new System.Windows.Forms.Panel (); - this._ExportContentOperatorsBox = new System.Windows.Forms.CheckBox (); - this._ExtractPageDictionaryBox = new System.Windows.Forms.CheckBox (); - this._ExtractPageRangeBox = new System.Windows.Forms.TextBox (); - this.label9 = new System.Windows.Forms.Label (); - this.label3 = new System.Windows.Forms.Label (); - this.label8 = new System.Windows.Forms.Label (); - this._ExportBinaryStreamBox = new System.Windows.Forms.NumericUpDown (); - this._ExtractImagesBox = new System.Windows.Forms.CheckBox (); - this._ExtractPageTextContentBox = new System.Windows.Forms.CheckBox (); - this.tabPage3 = new System.Windows.Forms.TabPage (); - this.groupBox2 = new System.Windows.Forms.GroupBox (); - this._ImportPageSettingsBox = new System.Windows.Forms.CheckBox (); - this._ImportDocumentInfoBox = new System.Windows.Forms.CheckBox (); - this.panel1 = new System.Windows.Forms.Panel (); - this.label10 = new System.Windows.Forms.Label (); - this._RemoveOriginalPageLinksBox = new System.Windows.Forms.RadioButton (); - this._KeepOriginalPageLinksBox = new System.Windows.Forms.RadioButton (); - this._ImportBookmarksBox = new System.Windows.Forms.CheckBox (); - this._ImportPageLinksBox = new System.Windows.Forms.CheckBox (); - this._ImportViewerPreferencesBox = new System.Windows.Forms.CheckBox (); - this._ExportOptionsTab.SuspendLayout (); - this.tabPage1.SuspendLayout (); - this.groupBox1.SuspendLayout (); - this.tabPage2.SuspendLayout (); - this._PageContentBox.SuspendLayout (); - ((System.ComponentModel.ISupportInitialize)(this._ExportBinaryStreamBox)).BeginInit (); - this.tabPage3.SuspendLayout (); - this.groupBox2.SuspendLayout (); - this.panel1.SuspendLayout (); - this.SuspendLayout (); - // - // _EncodingBox - // - this._EncodingBox.FormattingEnabled = true; - this._EncodingBox.Items.AddRange (new object[] { - "系统默认", - "GB18030", - "UTF-8", - "UTF-16", - "Big5"}); - this._EncodingBox.Location = new System.Drawing.Point (77, 6); - this._EncodingBox.Name = "_EncodingBox"; - this._EncodingBox.Size = new System.Drawing.Size (121, 20); - this._EncodingBox.TabIndex = 1; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point (6, 9); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size (65, 12); - this.label1.TabIndex = 0; - this.label1.Text = "字符编码:"; - // - // _ExtractPageLinksBox - // - this._ExtractPageLinksBox.AutoSize = true; - this._ExtractPageLinksBox.Location = new System.Drawing.Point (114, 42); - this._ExtractPageLinksBox.Name = "_ExtractPageLinksBox"; - this._ExtractPageLinksBox.Size = new System.Drawing.Size (96, 16); - this._ExtractPageLinksBox.TabIndex = 4; - this._ExtractPageLinksBox.Text = "页面内的链接"; - this._ExtractPageLinksBox.UseVisualStyleBackColor = true; - // - // _ExportViewerPreferencesBox - // - this._ExportViewerPreferencesBox.AutoSize = true; - this._ExportViewerPreferencesBox.Location = new System.Drawing.Point (6, 86); - this._ExportViewerPreferencesBox.Name = "_ExportViewerPreferencesBox"; - this._ExportViewerPreferencesBox.Size = new System.Drawing.Size (240, 16); - this._ExportViewerPreferencesBox.TabIndex = 6; - this._ExportViewerPreferencesBox.Text = "阅读器设置(如排版布局、页码样式等)"; - this._ExportViewerPreferencesBox.UseVisualStyleBackColor = true; - // - // _ExportBookmarksBox - // - this._ExportBookmarksBox.AutoSize = true; - this._ExportBookmarksBox.Location = new System.Drawing.Point (6, 42); - this._ExportBookmarksBox.Name = "_ExportBookmarksBox"; - this._ExportBookmarksBox.Size = new System.Drawing.Size (72, 16); - this._ExportBookmarksBox.TabIndex = 3; - this._ExportBookmarksBox.Text = "文档书签"; - this._ExportBookmarksBox.UseVisualStyleBackColor = true; - // - // _ExportOptionsTab - // - this._ExportOptionsTab.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ExportOptionsTab.Controls.Add (this.tabPage1); - this._ExportOptionsTab.Controls.Add (this.tabPage2); - this._ExportOptionsTab.Controls.Add (this.tabPage3); - this._ExportOptionsTab.Location = new System.Drawing.Point (12, 12); - this._ExportOptionsTab.Name = "_ExportOptionsTab"; - this._ExportOptionsTab.SelectedIndex = 0; - this._ExportOptionsTab.Size = new System.Drawing.Size (424, 245); - this._ExportOptionsTab.TabIndex = 1; - // - // tabPage1 - // - this.tabPage1.Controls.Add (this._UnitBox); - this.tabPage1.Controls.Add (this.label7); - this.tabPage1.Controls.Add (this.label1); - this.tabPage1.Controls.Add (this._EncodingBox); - this.tabPage1.Controls.Add (this.groupBox1); - this.tabPage1.Location = new System.Drawing.Point (4, 21); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding (3); - this.tabPage1.Size = new System.Drawing.Size (416, 220); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "常规导出选项"; - this.tabPage1.UseVisualStyleBackColor = true; - // - // _UnitBox - // - this._UnitBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._UnitBox.FormattingEnabled = true; - this._UnitBox.Location = new System.Drawing.Point (299, 6); - this._UnitBox.Name = "_UnitBox"; - this._UnitBox.Size = new System.Drawing.Size (54, 20); - this._UnitBox.TabIndex = 9; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point (204, 9); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size (89, 12); - this.label7.TabIndex = 8; - this.label7.Text = "尺寸度量单位:"; - // - // groupBox1 - // - this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox1.Controls.Add (this._ExportDocPropertiesBox); - this.groupBox1.Controls.Add (this._ExportBookmarksBox); - this.groupBox1.Controls.Add (this._ExtractPageSettingsBox); - this.groupBox1.Controls.Add (this._ConsolidateNamedDestBox); - this.groupBox1.Controls.Add (this._ExtractPageLinksBox); - this.groupBox1.Controls.Add (this._ExportViewerPreferencesBox); - this.groupBox1.Location = new System.Drawing.Point (6, 32); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size (404, 185); - this.groupBox1.TabIndex = 10; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "导出如下内容到信息文件"; - // - // _ExportDocPropertiesBox - // - this._ExportDocPropertiesBox.AutoSize = true; - this._ExportDocPropertiesBox.Location = new System.Drawing.Point (6, 20); - this._ExportDocPropertiesBox.Name = "_ExportDocPropertiesBox"; - this._ExportDocPropertiesBox.Size = new System.Drawing.Size (228, 16); - this._ExportDocPropertiesBox.TabIndex = 2; - this._ExportDocPropertiesBox.Text = "文档属性(如标题、作者、关键字等)"; - this._ExportDocPropertiesBox.UseVisualStyleBackColor = true; - // - // _ExtractPageSettingsBox - // - this._ExtractPageSettingsBox.AutoSize = true; - this._ExtractPageSettingsBox.Location = new System.Drawing.Point (6, 108); - this._ExtractPageSettingsBox.Name = "_ExtractPageSettingsBox"; - this._ExtractPageSettingsBox.Size = new System.Drawing.Size (264, 16); - this._ExtractPageSettingsBox.TabIndex = 7; - this._ExtractPageSettingsBox.Text = "页面设置(如页面尺寸、裁剪、旋转角度等)"; - this._ExtractPageSettingsBox.UseVisualStyleBackColor = true; - // - // _ConsolidateNamedDestBox - // - this._ConsolidateNamedDestBox.AutoSize = true; - this._ConsolidateNamedDestBox.Location = new System.Drawing.Point (18, 64); - this._ConsolidateNamedDestBox.Name = "_ConsolidateNamedDestBox"; - this._ConsolidateNamedDestBox.Size = new System.Drawing.Size (192, 16); - this._ConsolidateNamedDestBox.TabIndex = 5; - this._ConsolidateNamedDestBox.Text = "解析书签和页面链接的命名位置"; - this._ConsolidateNamedDestBox.UseVisualStyleBackColor = true; - // - // tabPage2 - // - this.tabPage2.Controls.Add (this._ExportCatalogBox); - this.tabPage2.Controls.Add (this.label2); - this.tabPage2.Controls.Add (this.label5); - this.tabPage2.Controls.Add (this._ExtractPageContentBox); - this.tabPage2.Controls.Add (this._PageContentBox); - this.tabPage2.Location = new System.Drawing.Point (4, 21); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding (3); - this.tabPage2.Size = new System.Drawing.Size (416, 220); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "高级导出选项"; - this.tabPage2.UseVisualStyleBackColor = true; - // - // _ExportCatalogBox - // - this._ExportCatalogBox.AutoSize = true; - this._ExportCatalogBox.Location = new System.Drawing.Point (6, 38); - this._ExportCatalogBox.Name = "_ExportCatalogBox"; - this._ExportCatalogBox.Size = new System.Drawing.Size (96, 16); - this._ExportCatalogBox.TabIndex = 1; - this._ExportCatalogBox.Text = "导出编录信息"; - this._ExportCatalogBox.UseVisualStyleBackColor = true; - // - // label2 - // - this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label2.Location = new System.Drawing.Point (4, 3); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size (432, 31); - this.label2.TabIndex = 0; - this.label2.Text = "说明:高级导出选项导出的内容仅供研究 PDF 文件结构之用,导入信息文件时不会导入这些内容。"; - // - // label5 - // - this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label5.Location = new System.Drawing.Point (107, 61); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size (307, 28); - this.label5.TabIndex = 3; - this.label5.Text = "此选项将生成很大的信息文件,包含页面大部分内容(如字体、图片信息等)。"; - // - // _ExtractPageContentBox - // - this._ExtractPageContentBox.AutoSize = true; - this._ExtractPageContentBox.Location = new System.Drawing.Point (6, 60); - this._ExtractPageContentBox.Name = "_ExtractPageContentBox"; - this._ExtractPageContentBox.Size = new System.Drawing.Size (96, 16); - this._ExtractPageContentBox.TabIndex = 2; - this._ExtractPageContentBox.Text = "导出页面内容"; - this._ExtractPageContentBox.UseVisualStyleBackColor = true; - // - // _PageContentBox - // - this._PageContentBox.Controls.Add (this._ExportContentOperatorsBox); - this._PageContentBox.Controls.Add (this._ExtractPageDictionaryBox); - this._PageContentBox.Controls.Add (this._ExtractPageRangeBox); - this._PageContentBox.Controls.Add (this.label9); - this._PageContentBox.Controls.Add (this.label3); - this._PageContentBox.Controls.Add (this.label8); - this._PageContentBox.Controls.Add (this._ExportBinaryStreamBox); - this._PageContentBox.Controls.Add (this._ExtractImagesBox); - this._PageContentBox.Controls.Add (this._ExtractPageTextContentBox); - this._PageContentBox.Enabled = false; - this._PageContentBox.Location = new System.Drawing.Point (17, 92); - this._PageContentBox.Name = "_PageContentBox"; - this._PageContentBox.Size = new System.Drawing.Size (419, 125); - this._PageContentBox.TabIndex = 4; - // - // _ExportContentOperatorsBox - // - this._ExportContentOperatorsBox.AutoSize = true; - this._ExportContentOperatorsBox.Location = new System.Drawing.Point (224, 36); - this._ExportContentOperatorsBox.Name = "_ExportContentOperatorsBox"; - this._ExportContentOperatorsBox.Size = new System.Drawing.Size (120, 16); - this._ExportContentOperatorsBox.TabIndex = 9; - this._ExportContentOperatorsBox.Text = "导出绘制页面命令"; - this._ExportContentOperatorsBox.UseVisualStyleBackColor = true; - // - // _ExtractPageDictionaryBox - // - this._ExtractPageDictionaryBox.AutoSize = true; - this._ExtractPageDictionaryBox.Location = new System.Drawing.Point (10, 36); - this._ExtractPageDictionaryBox.Name = "_ExtractPageDictionaryBox"; - this._ExtractPageDictionaryBox.Size = new System.Drawing.Size (120, 16); - this._ExtractPageDictionaryBox.TabIndex = 8; - this._ExtractPageDictionaryBox.Text = "导出页面字典信息"; - this._ExtractPageDictionaryBox.UseVisualStyleBackColor = true; - // - // _ExtractPageRangeBox - // - this._ExtractPageRangeBox.Location = new System.Drawing.Point (98, 3); - this._ExtractPageRangeBox.Name = "_ExtractPageRangeBox"; - this._ExtractPageRangeBox.Size = new System.Drawing.Size (231, 21); - this._ExtractPageRangeBox.TabIndex = 1; - this._ExtractPageRangeBox.Leave += new System.EventHandler (this._ExtractPageRangeBox_Leave); - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point (226, 77); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size (83, 12); - this.label9.TabIndex = 7; - this.label9.Text = "(0:不限制)"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point (3, 6); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size (89, 12); - this.label3.TabIndex = 0; - this.label3.Text = "导出页码范围:"; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point (5, 77); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size (149, 12); - this.label8.TabIndex = 5; - this.label8.Text = "限制导出二进制流字节数:"; - // - // _ExportBinaryStreamBox - // - this._ExportBinaryStreamBox.Increment = new decimal (new int[] { - 100, - 0, - 0, - 0}); - this._ExportBinaryStreamBox.Location = new System.Drawing.Point (157, 75); - this._ExportBinaryStreamBox.Maximum = new decimal (new int[] { - 99999999, - 0, - 0, - 0}); - this._ExportBinaryStreamBox.Name = "_ExportBinaryStreamBox"; - this._ExportBinaryStreamBox.Size = new System.Drawing.Size (63, 21); - this._ExportBinaryStreamBox.TabIndex = 6; - this._ExportBinaryStreamBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // _ExtractImagesBox - // - this._ExtractImagesBox.AutoSize = true; - this._ExtractImagesBox.Location = new System.Drawing.Point (10, 58); - this._ExtractImagesBox.Name = "_ExtractImagesBox"; - this._ExtractImagesBox.Size = new System.Drawing.Size (144, 16); - this._ExtractImagesBox.TabIndex = 3; - this._ExtractImagesBox.Text = "将图片导出为独立文件"; - this._ExtractImagesBox.UseVisualStyleBackColor = true; - // - // _ExtractPageTextContentBox - // - this._ExtractPageTextContentBox.AutoSize = true; - this._ExtractPageTextContentBox.Location = new System.Drawing.Point (224, 58); - this._ExtractPageTextContentBox.Name = "_ExtractPageTextContentBox"; - this._ExtractPageTextContentBox.Size = new System.Drawing.Size (144, 16); - this._ExtractPageTextContentBox.TabIndex = 4; - this._ExtractPageTextContentBox.Text = "解码导出页面内的文本"; - this._ExtractPageTextContentBox.UseVisualStyleBackColor = true; - // - // tabPage3 - // - this.tabPage3.Controls.Add (this.groupBox2); - this.tabPage3.Location = new System.Drawing.Point (4, 21); - this.tabPage3.Name = "tabPage3"; - this.tabPage3.Padding = new System.Windows.Forms.Padding (3); - this.tabPage3.Size = new System.Drawing.Size (416, 220); - this.tabPage3.TabIndex = 2; - this.tabPage3.Text = "导入选项"; - this.tabPage3.UseVisualStyleBackColor = true; - // - // groupBox2 - // - this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox2.Controls.Add (this._ImportPageSettingsBox); - this.groupBox2.Controls.Add (this._ImportDocumentInfoBox); - this.groupBox2.Controls.Add (this.panel1); - this.groupBox2.Controls.Add (this._ImportBookmarksBox); - this.groupBox2.Controls.Add (this._ImportPageLinksBox); - this.groupBox2.Controls.Add (this._ImportViewerPreferencesBox); - this.groupBox2.Location = new System.Drawing.Point (6, 6); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size (430, 211); - this.groupBox2.TabIndex = 12; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "导入信息文件如下项目"; - // - // _ImportPageSettingsBox - // - this._ImportPageSettingsBox.AutoSize = true; - this._ImportPageSettingsBox.Location = new System.Drawing.Point (6, 108); - this._ImportPageSettingsBox.Name = "_ImportPageSettingsBox"; - this._ImportPageSettingsBox.Size = new System.Drawing.Size (264, 16); - this._ImportPageSettingsBox.TabIndex = 12; - this._ImportPageSettingsBox.Text = "页面设置(如页面尺寸、裁剪、旋转角度等)"; - this._ImportPageSettingsBox.UseVisualStyleBackColor = true; - // - // _ImportDocumentInfoBox - // - this._ImportDocumentInfoBox.AutoSize = true; - this._ImportDocumentInfoBox.Checked = true; - this._ImportDocumentInfoBox.CheckState = System.Windows.Forms.CheckState.Checked; - this._ImportDocumentInfoBox.Location = new System.Drawing.Point (6, 20); - this._ImportDocumentInfoBox.Name = "_ImportDocumentInfoBox"; - this._ImportDocumentInfoBox.Size = new System.Drawing.Size (252, 16); - this._ImportDocumentInfoBox.TabIndex = 7; - this._ImportDocumentInfoBox.Text = "文档属性信息(如作者、主题、关键字等)"; - this._ImportDocumentInfoBox.UseVisualStyleBackColor = true; - // - // panel1 - // - this.panel1.Controls.Add (this.label10); - this.panel1.Controls.Add (this._RemoveOriginalPageLinksBox); - this.panel1.Controls.Add (this._KeepOriginalPageLinksBox); - this.panel1.Location = new System.Drawing.Point (213, 64); - this.panel1.Margin = new System.Windows.Forms.Padding (0); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size (191, 16); - this.panel1.TabIndex = 10; - // - // label10 - // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point (3, 1); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size (77, 12); - this.label10.TabIndex = 0; - this.label10.Text = "原页面链接:"; - // - // _RemoveOriginalPageLinksBox - // - this._RemoveOriginalPageLinksBox.AutoSize = true; - this._RemoveOriginalPageLinksBox.Checked = true; - this._RemoveOriginalPageLinksBox.Location = new System.Drawing.Point (86, -1); - this._RemoveOriginalPageLinksBox.Name = "_RemoveOriginalPageLinksBox"; - this._RemoveOriginalPageLinksBox.Size = new System.Drawing.Size (46, 16); - this._RemoveOriginalPageLinksBox.TabIndex = 1; - this._RemoveOriginalPageLinksBox.TabStop = true; - this._RemoveOriginalPageLinksBox.Text = "替换"; - this._RemoveOriginalPageLinksBox.UseVisualStyleBackColor = true; - // - // _KeepOriginalPageLinksBox - // - this._KeepOriginalPageLinksBox.AutoSize = true; - this._KeepOriginalPageLinksBox.Location = new System.Drawing.Point (139, -1); - this._KeepOriginalPageLinksBox.Name = "_KeepOriginalPageLinksBox"; - this._KeepOriginalPageLinksBox.Size = new System.Drawing.Size (46, 16); - this._KeepOriginalPageLinksBox.TabIndex = 2; - this._KeepOriginalPageLinksBox.Text = "保留"; - this._KeepOriginalPageLinksBox.UseVisualStyleBackColor = true; - // - // _ImportBookmarksBox - // - this._ImportBookmarksBox.AutoSize = true; - this._ImportBookmarksBox.Checked = true; - this._ImportBookmarksBox.CheckState = System.Windows.Forms.CheckState.Checked; - this._ImportBookmarksBox.Location = new System.Drawing.Point (6, 42); - this._ImportBookmarksBox.Name = "_ImportBookmarksBox"; - this._ImportBookmarksBox.Size = new System.Drawing.Size (72, 16); - this._ImportBookmarksBox.TabIndex = 8; - this._ImportBookmarksBox.Text = "文档书签"; - this._ImportBookmarksBox.UseVisualStyleBackColor = true; - // - // _ImportPageLinksBox - // - this._ImportPageLinksBox.AutoSize = true; - this._ImportPageLinksBox.Checked = true; - this._ImportPageLinksBox.CheckState = System.Windows.Forms.CheckState.Checked; - this._ImportPageLinksBox.Location = new System.Drawing.Point (6, 64); - this._ImportPageLinksBox.Name = "_ImportPageLinksBox"; - this._ImportPageLinksBox.Size = new System.Drawing.Size (204, 16); - this._ImportPageLinksBox.TabIndex = 9; - this._ImportPageLinksBox.Text = "页面内的链接(合并模式下无效)"; - this._ImportPageLinksBox.UseVisualStyleBackColor = true; - // - // _ImportViewerPreferencesBox - // - this._ImportViewerPreferencesBox.AutoSize = true; - this._ImportViewerPreferencesBox.Checked = true; - this._ImportViewerPreferencesBox.CheckState = System.Windows.Forms.CheckState.Checked; - this._ImportViewerPreferencesBox.Location = new System.Drawing.Point (6, 86); - this._ImportViewerPreferencesBox.Name = "_ImportViewerPreferencesBox"; - this._ImportViewerPreferencesBox.Size = new System.Drawing.Size (240, 16); - this._ImportViewerPreferencesBox.TabIndex = 11; - this._ImportViewerPreferencesBox.Text = "阅读器设置(如排版布局、页码样式等)"; - this._ImportViewerPreferencesBox.UseVisualStyleBackColor = true; - // - // ExportOptionControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size (448, 269); - this.Controls.Add (this._ExportOptionsTab); - this.Font = new System.Drawing.Font ("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "ExportOptionControl"; - this.Text = "信息文件选项"; - this.VisibleChanged += new System.EventHandler (this.ExportOptionControl_VisibleChanged); - this._ExportOptionsTab.ResumeLayout (false); - this.tabPage1.ResumeLayout (false); - this.tabPage1.PerformLayout (); - this.groupBox1.ResumeLayout (false); - this.groupBox1.PerformLayout (); - this.tabPage2.ResumeLayout (false); - this.tabPage2.PerformLayout (); - this._PageContentBox.ResumeLayout (false); - this._PageContentBox.PerformLayout (); - ((System.ComponentModel.ISupportInitialize)(this._ExportBinaryStreamBox)).EndInit (); - this.tabPage3.ResumeLayout (false); - this.groupBox2.ResumeLayout (false); - this.groupBox2.PerformLayout (); - this.panel1.ResumeLayout (false); - this.panel1.PerformLayout (); - this.ResumeLayout (false); - - } - - #endregion - - private System.Windows.Forms.CheckBox _ExtractPageLinksBox; - private System.Windows.Forms.CheckBox _ExportViewerPreferencesBox; - private System.Windows.Forms.CheckBox _ExportBookmarksBox; - private System.Windows.Forms.ComboBox _EncodingBox; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TabControl _ExportOptionsTab; - private System.Windows.Forms.TabPage tabPage1; - private System.Windows.Forms.TabPage tabPage2; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox _ExtractPageRangeBox; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.CheckBox _ExtractPageContentBox; - private System.Windows.Forms.CheckBox _ExtractPageSettingsBox; - private System.Windows.Forms.CheckBox _ExtractImagesBox; - private System.Windows.Forms.CheckBox _ConsolidateNamedDestBox; - private System.Windows.Forms.CheckBox _ExportDocPropertiesBox; - private System.Windows.Forms.ComboBox _UnitBox; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.NumericUpDown _ExportBinaryStreamBox; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.CheckBox _ExportCatalogBox; - private System.Windows.Forms.CheckBox _ExtractPageTextContentBox; - private System.Windows.Forms.Panel _PageContentBox; - private System.Windows.Forms.CheckBox _ExtractPageDictionaryBox; - private System.Windows.Forms.CheckBox _ExportContentOperatorsBox; - private System.Windows.Forms.TabPage tabPage3; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.CheckBox _ImportDocumentInfoBox; - private System.Windows.Forms.CheckBox _ImportPageLinksBox; - private System.Windows.Forms.CheckBox _ImportViewerPreferencesBox; - private System.Windows.Forms.CheckBox _ImportBookmarksBox; - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.RadioButton _RemoveOriginalPageLinksBox; - private System.Windows.Forms.RadioButton _KeepOriginalPageLinksBox; - private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.CheckBox _ImportPageSettingsBox; - } -} diff --git a/pdfpatcher/App/Functions/InfoFileOptionControl.cs b/pdfpatcher/App/Functions/InfoFileOptionControl.cs deleted file mode 100644 index a8c00eeecaae73a12c55dfa55b9f759130b79e06..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/InfoFileOptionControl.cs +++ /dev/null @@ -1,183 +0,0 @@ -using System; -using System.ComponentModel; -using System.Windows.Forms; -using PDFPatcher.Common; - -namespace PDFPatcher.Functions -{ - [ToolboxItem(false)] - public partial class InfoFileOptionControl : Form, IResettableControl - { - ExporterOptions _expOptions; - ImporterOptions _impOptions; - bool locked; - - public InfoFileOptionControl() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - } - - void OnLoad() { - this.SetIcon(Properties.Resources.InfoFileOptions); - AppContext.MainForm.SetTooltip(_ExtractPageRangeBox, Messages.PageRanges); - - _UnitBox.Items.AddRange(Constants.Units.Names); - - Reload(); - - _ConsolidateNamedDestBox.CheckedChanged += OptionChanged; - _EncodingBox.Leave += _EncodingBox_Leave; - _ExportBinaryStreamBox.ValueChanged += OptionChanged; - _ExportBookmarksBox.CheckedChanged += OptionChanged; - _ExportCatalogBox.CheckedChanged += OptionChanged; - _ExportDocPropertiesBox.CheckedChanged += OptionChanged; - _ExtractImagesBox.CheckedChanged += OptionChanged; - _ExtractPageContentBox.CheckedChanged += OptionChanged; - _ExtractPageDictionaryBox.CheckedChanged += OptionChanged; - _ExtractPageLinksBox.CheckedChanged += OptionChanged; - _ExtractPageRangeBox.Leave += OptionChanged; - _ExtractPageSettingsBox.CheckedChanged += OptionChanged; - _ExtractPageTextContentBox.CheckedChanged += OptionChanged; - _ExportViewerPreferencesBox.CheckedChanged += OptionChanged; - _ExportContentOperatorsBox.CheckedChanged += OptionChanged; - _ImportBookmarksBox.CheckedChanged += OptionChanged; - _ImportDocumentInfoBox.CheckedChanged += OptionChanged; - _ImportPageLinksBox.CheckedChanged += OptionChanged; - _ImportPageSettingsBox.CheckedChanged += OptionChanged; - _ImportViewerPreferencesBox.CheckedChanged += OptionChanged; - _KeepOriginalPageLinksBox.CheckedChanged += OptionChanged; - _RemoveOriginalPageLinksBox.CheckedChanged += OptionChanged; - } - - public void Reset() { - locked = true; - AppContext.Exporter = new ExporterOptions(); - AppContext.Importer = new ImporterOptions(); - Reload(); - locked = false; - } - - public void Reload() { - _expOptions = AppContext.Exporter; - _impOptions = AppContext.Importer; - - _ConsolidateNamedDestBox.Checked = _expOptions.ConsolidateNamedDestinations; - _EncodingBox.Text = _expOptions.Encoding; - _ExportBinaryStreamBox.Value = _expOptions.ExportBinaryStream; - _ExportBookmarksBox.Checked = _expOptions.ExportBookmarks; - _ExportCatalogBox.Checked = _expOptions.ExportCatalog; - _ExportContentOperatorsBox.Checked = _expOptions.ExportContentOperators; - _ExportDocPropertiesBox.Checked = _expOptions.ExportDocProperties; - _ExtractImagesBox.Checked = _expOptions.ExtractImages; - _ExtractPageContentBox.Checked = _expOptions.ExtractPageContent; - _ExtractPageDictionaryBox.Checked = _expOptions.ExtractPageDictionary; - _ExtractPageLinksBox.Checked = _expOptions.ExtractPageLinks; - _ExtractPageRangeBox.Text = _expOptions.ExtractPageRange; - _ExtractPageSettingsBox.Checked = _expOptions.ExtractPageSettings; - _ExtractPageTextContentBox.Checked = _expOptions.ExportDecodedText; - _ExportViewerPreferencesBox.Checked = _expOptions.ExportViewerPreferences; - _PageContentBox.Enabled = _ExtractPageContentBox.Checked = _expOptions.ExtractPageContent; - - _ImportDocumentInfoBox.Checked = _impOptions.ImportDocProperties; - _ImportBookmarksBox.Checked = _impOptions.ImportBookmarks; - _ImportPageLinksBox.Checked = _impOptions.ImportPageLinks; - _ImportPageSettingsBox.Checked = _impOptions.ImportPageSettings; - _ImportViewerPreferencesBox.Checked = _impOptions.ImportViewerPreferences; - _KeepOriginalPageLinksBox.Checked = _impOptions.KeepPageLinks; - - var i = _UnitBox.Items.IndexOf(_expOptions.UnitConverter.Unit); - _UnitBox.SelectedIndex = (i != -1) ? i : 0; - } - - void OptionChanged(object sender, EventArgs e) { - if (locked) { - return; - } - if (sender == _ExtractPageDictionaryBox) { - _expOptions.ExtractPageDictionary = _ExtractPageDictionaryBox.Checked; - } - else if (sender == _ExtractPageTextContentBox) { - _expOptions.ExportDecodedText = _ExtractPageTextContentBox.Checked; - } - else if (sender == _ExportDocPropertiesBox) { - _expOptions.ExportDocProperties = _ExportDocPropertiesBox.Checked; - } - else if (sender == _ConsolidateNamedDestBox) { - _expOptions.ConsolidateNamedDestinations = _ConsolidateNamedDestBox.Checked; - } - else if (sender == _ExtractImagesBox) { - _expOptions.ExtractImages = _ExtractImagesBox.Checked; - } - else if (sender == _ExtractPageSettingsBox) { - _expOptions.ExtractPageSettings = _ExtractPageSettingsBox.Checked; - } - else if (sender == _ExportBookmarksBox) { - _expOptions.ExportBookmarks = _ExportBookmarksBox.Checked; - } - else if (sender == _ExtractPageLinksBox) { - _expOptions.ExtractPageLinks = _ExtractPageLinksBox.Checked; - } - else if (sender == _ExportViewerPreferencesBox) { - _expOptions.ExportViewerPreferences = _ExportViewerPreferencesBox.Checked; - } - else if (sender == _ExtractPageContentBox) { - _expOptions.ExtractPageContent = _PageContentBox.Enabled = _ExtractPageContentBox.Checked; - _ExtractPageRangeBox.Focus(); - } - else if (sender == _ExportContentOperatorsBox) { - _expOptions.ExportContentOperators = _ExportContentOperatorsBox.Checked; - } - else if (sender == _ExportBinaryStreamBox) { - AppContext.Exporter.ExportBinaryStream = (int)_ExportBinaryStreamBox.Value; - } - else if (sender == _ExportCatalogBox) { - AppContext.Exporter.ExportCatalog = _ExportCatalogBox.Checked; - } - else if (sender == _ImportDocumentInfoBox) { - _impOptions.ImportDocProperties = _ImportDocumentInfoBox.Checked; - } - else if (sender == _KeepOriginalPageLinksBox) { - _impOptions.KeepPageLinks = _KeepOriginalPageLinksBox.Checked; - } - else if (sender == _ImportBookmarksBox) { - _impOptions.ImportBookmarks = _ImportBookmarksBox.Checked; - } - else if (sender == _ImportPageLinksBox) { - _impOptions.ImportPageLinks = _ImportPageLinksBox.Checked; - } - else if (sender == _ImportPageSettingsBox) { - _impOptions.ImportPageSettings = _ImportPageSettingsBox.Checked; - } - else if (sender == _ImportViewerPreferencesBox) { - _impOptions.ImportViewerPreferences = _ImportViewerPreferencesBox.Checked; - } - } - - void _EncodingBox_Leave(object sender, EventArgs e) { - try { - _expOptions.Encoding = _EncodingBox.Text; - _EncodingBox.Text = _expOptions.Encoding; - } - catch (Exception) { - FormHelper.ErrorBox("输入的编码无效。"); - _EncodingBox.Text = Constants.Encoding.SystemDefault; - } - } - - void _ExtractPageRangeBox_Leave(object sender, EventArgs e) { - _expOptions.ExtractPageRange = _ExtractPageRangeBox.Text.Trim(); - if (_expOptions.ExtractPageRange.Length > 0) { - _ExtractPageContentBox.Checked = true; - } - } - - private void ExportOptionControl_VisibleChanged(object sender, EventArgs e) { - if (Visible) { - _ExtractPageRangeBox.Text = AppContext.Exporter.ExtractPageRange; - } - else { - AppContext.Exporter.UnitConverter.Unit = _UnitBox.SelectedItem.ToString(); - } - } - } -} diff --git a/pdfpatcher/App/Functions/InfoFileOptionControl.resx b/pdfpatcher/App/Functions/InfoFileOptionControl.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/InfoFileOptionControl.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/ListViewItemComparer.cs b/pdfpatcher/App/Functions/ListViewItemComparer.cs deleted file mode 100644 index cfbc2f7abbb246ca890616d02cd8d1580e8beb84..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/ListViewItemComparer.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.Windows.Forms; -using PDFPatcher.Common; - -namespace PDFPatcher -{ - sealed class ListViewItemComparer : System.Collections.IComparer - { - ///获取或指定排序列的值。 - public int Col { get; } - ///获取或指定是否使用智能排序。 - public bool UseSmartSort { get; } - ///获取或指定列表排序的方式。 - public SortOrder SortOrder { get; } - - public ListViewItemComparer() { - Col = 0; - } - public ListViewItemComparer(int column) { - Col = column; - } - public ListViewItemComparer(int column, bool useSmartSort) { - Col = column; - UseSmartSort = useSmartSort; - SortOrder = SortOrder.Ascending; - } - public ListViewItemComparer(int column, bool useSmartSort, SortOrder sortOrder) { - Col = column; - UseSmartSort = useSmartSort; - SortOrder = sortOrder; - } - - #region IComparer 成员 - - int System.Collections.IComparer.Compare(object x, object y) { - if (SortOrder == SortOrder.None) { - return 0; - } - var a = ((ListViewItem)x).SubItems[Col].Text; - var b = ((ListViewItem)y).SubItems[Col].Text; - int r = UseSmartSort ? FileHelper.NumericAwareComparePath(a, b) : String.Compare(a, b); - return (SortOrder == SortOrder.Ascending) ? r : -r; - } - - #endregion - - } - - sealed class OlvColumnSmartComparer : System.Collections.IComparer - { - ///获取排序列。 - public BrightIdeasSoftware.OLVColumn Column { get; } - ///获取列表排序的方式。 - public SortOrder SortOrder { get; } - - public OlvColumnSmartComparer(BrightIdeasSoftware.OLVColumn column, SortOrder sortOrder) { - Column = column; - SortOrder = sortOrder; - } - - #region IComparer 成员 - - int System.Collections.IComparer.Compare(object x, object y) { - if (SortOrder == SortOrder.None) { - return 0; - } - var a = Column.GetStringValue(x); - var b = Column.GetStringValue(y); - int r = FileHelper.NumericAwareComparePath(a, b); - return (SortOrder == SortOrder.Ascending) ? r : -r; - } - - #endregion - } -} diff --git a/pdfpatcher/App/Functions/MacroMenu.cs b/pdfpatcher/App/Functions/MacroMenu.cs deleted file mode 100644 index b62b70542a66d21bbbd471034203995b7b6bf579..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/MacroMenu.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System.Windows.Forms; - -namespace PDFPatcher.Functions -{ - internal sealed class MacroMenu : ContextMenuStrip - { - readonly TextBox __editOperationWrapper = new TextBox(); - - internal const string InsertText = "插入"; - //internal const string Copy = "复制"; - //internal const string Paste = "粘贴"; - //internal const string Cut = "剪切"; - //internal const string Delete = "删除"; - - //internal void LoadCopyEditMacros () { - // this.Items.AddRange (new ToolStripItem[] { - // new ToolStripMenuItem (Cut), - // new ToolStripMenuItem (Copy), - // new ToolStripMenuItem (Paste), - // new ToolStripMenuItem (Delete) - // }); - //} - public MacroMenu() : base() { } - public MacroMenu(System.ComponentModel.IContainer container) : base(container) { } - - internal void AddInsertMacroMenuItem(string text) { - Items.Add(InsertText + text); - } - - internal void LoadStandardSourceFileMacros() { - Items.AddRange(new ToolStripItem[] { - new ToolStripMenuItem (InsertText + Constants.FileNameMacros.PathName), - new ToolStripMenuItem (InsertText + Constants.FileNameMacros.FileName), - new ToolStripMenuItem (InsertText + Constants.FileNameMacros.FolderName) - }); - } - - internal void LoadStandardInfoMacros() { - Items.AddRange(new ToolStripItem[] { - new ToolStripMenuItem (InsertText + Constants.FileNameMacros.TitleProperty), - new ToolStripMenuItem (InsertText + Constants.FileNameMacros.AuthorProperty), - new ToolStripMenuItem (InsertText + Constants.FileNameMacros.SubjectProperty), - new ToolStripMenuItem (InsertText + Constants.FileNameMacros.KeywordsProperty), - new ToolStripMenuItem (InsertText + Constants.FileNameMacros.PageCount), - }); - } - - internal void ProcessInsertMacroCommand(object sender, ToolStripItemClickedEventArgs e) { - var t = e.ClickedItem.Text; - if (!t.StartsWith(InsertText)) { - return; - } - - t = t.Substring(InsertText.Length); - var c = SourceControl as TextBoxBase; - if (c != null) { - c.SelectedText = t; - return; - } - var cb = SourceControl as ComboBox; - if (cb != null) { - cb.SelectedText = t; - } - } - } -} diff --git a/pdfpatcher/App/Functions/MergerControl.Designer.cs b/pdfpatcher/App/Functions/MergerControl.Designer.cs deleted file mode 100644 index 35e1e857774717ff0485c9a54299c6850e167940..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/MergerControl.Designer.cs +++ /dev/null @@ -1,640 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class MergerControl - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.components = new System.ComponentModel.Container(); - System.Windows.Forms.ToolStripDropDownButton _File; - System.Windows.Forms.ToolStripSeparator toolStripSeparator4; - System.Windows.Forms.ToolStripMenuItem _LoadList; - System.Windows.Forms.ToolStripMenuItem _SaveList; - System.Windows.Forms.ToolStripSeparator toolStripSeparator1; - System.Windows.Forms.ToolStripSeparator toolStripSeparator2; - System.Windows.Forms.ToolStripButton _EditItemProperty; - System.Windows.Forms.ToolStripButton _Refresh; - System.Windows.Forms.ToolStripMenuItem _SetPdfOptions; - System.Windows.Forms.ToolStripMenuItem _SetCroppingOptions; - System.Windows.Forms.ToolStripMenuItem _Copy; - System.Windows.Forms.ToolStripMenuItem _RefreshFolder; - System.Windows.Forms.ToolStripMenuItem _ClearBookmarkTitle; - System.Windows.Forms.ToolStripMenuItem _SetBookmarkTitle; - System.Windows.Forms.ToolStripMenuItem _PasteBookmarkText; - System.Windows.Forms.ToolStripMenuItem _CopyBookmarkText; - System.Windows.Forms.ToolStripMenuItem _CopyFileName; - System.Windows.Forms.ToolStripButton _Delete; - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MergerControl)); - this._FileMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._SortByNaturalNumberItem = new System.Windows.Forms.ToolStripMenuItem(); - this._SortByAlphaItem = new System.Windows.Forms.ToolStripMenuItem(); - this._SortByCaj = new System.Windows.Forms.ToolStripMenuItem(); - this._SortByFileTime = new System.Windows.Forms.ToolStripMenuItem(); - this._ReverseSort = new System.Windows.Forms.ToolStripMenuItem(); - this._MainToolbar = new System.Windows.Forms.ToolStrip(); - this._AddFilesButton = new System.Windows.Forms.ToolStripSplitButton(); - this._RecentFileMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._AddFolderButton = new System.Windows.Forms.ToolStripSplitButton(); - this._RecentFolderMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._InsertEmptyPage = new System.Windows.Forms.ToolStripButton(); - this._BoldStyleButton = new System.Windows.Forms.ToolStripButton(); - this._ItalicStyleButton = new System.Windows.Forms.ToolStripButton(); - this._BookmarkColorButton = new ColorPicker.ToolStripColorPicker(); - this._BookmarkTextMenu = new System.Windows.Forms.ToolStripDropDownButton(); - this._ItemList = new BrightIdeasSoftware.TreeListView(); - this._NameColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._BookmarkColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._PageRangeColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._FolderColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._FileTimeColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._ItemListMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); - this._FileTypeList = new System.Windows.Forms.ImageList(this.components); - this._OpenImageBox = new System.Windows.Forms.OpenFileDialog(); - this._OpenPdfBox = new System.Windows.Forms.OpenFileDialog(); - this._AddDocumentWorker = new System.ComponentModel.BackgroundWorker(); - this._BookmarkControl = new PDFPatcher.BookmarkControl(); - this._TargetPdfFile = new PDFPatcher.TargetFileControl(); - this._ImportButton = new EnhancedGlassButton.GlassButton(); - this._IndividualMergerModeBox = new System.Windows.Forms.CheckBox(); - this._ConfigButton = new System.Windows.Forms.Button(); - _File = new System.Windows.Forms.ToolStripDropDownButton(); - toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); - _LoadList = new System.Windows.Forms.ToolStripMenuItem(); - _SaveList = new System.Windows.Forms.ToolStripMenuItem(); - toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - _EditItemProperty = new System.Windows.Forms.ToolStripButton(); - _Refresh = new System.Windows.Forms.ToolStripButton(); - _SetPdfOptions = new System.Windows.Forms.ToolStripMenuItem(); - _SetCroppingOptions = new System.Windows.Forms.ToolStripMenuItem(); - _Copy = new System.Windows.Forms.ToolStripMenuItem(); - _RefreshFolder = new System.Windows.Forms.ToolStripMenuItem(); - _ClearBookmarkTitle = new System.Windows.Forms.ToolStripMenuItem(); - _SetBookmarkTitle = new System.Windows.Forms.ToolStripMenuItem(); - _PasteBookmarkText = new System.Windows.Forms.ToolStripMenuItem(); - _CopyBookmarkText = new System.Windows.Forms.ToolStripMenuItem(); - _CopyFileName = new System.Windows.Forms.ToolStripMenuItem(); - _Delete = new System.Windows.Forms.ToolStripButton(); - this._FileMenu.SuspendLayout(); - this._MainToolbar.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._ItemList)).BeginInit(); - this._ItemListMenu.SuspendLayout(); - this.SuspendLayout(); - // - // _File - // - _File.AutoToolTip = false; - _File.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - _File.DropDown = this._FileMenu; - _File.Image = global::PDFPatcher.Properties.Resources.Sort; - _File.ImageTransparentColor = System.Drawing.Color.Magenta; - _File.Name = "_File"; - _File.Size = new System.Drawing.Size(58, 22); - _File.Text = "文件(&J)"; - _File.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _FileMenu - // - this._FileMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._SortByNaturalNumberItem, - this._SortByAlphaItem, - this._SortByCaj, - this._SortByFileTime, - this._ReverseSort, - toolStripSeparator4, - _LoadList, - _SaveList}); - this._FileMenu.Name = "_SortMenu"; - this._FileMenu.OwnerItem = _File; - this._FileMenu.Size = new System.Drawing.Size(212, 164); - this._FileMenu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._SortMenu_ItemClicked); - // - // _SortByNaturalNumberItem - // - this._SortByNaturalNumberItem.Image = global::PDFPatcher.Properties.Resources.NaturalSort; - this._SortByNaturalNumberItem.Name = "_SortByNaturalNumberItem"; - this._SortByNaturalNumberItem.Size = new System.Drawing.Size(211, 22); - this._SortByNaturalNumberItem.Text = "按数值和字母顺序排序(&S)"; - // - // _SortByAlphaItem - // - this._SortByAlphaItem.Image = global::PDFPatcher.Properties.Resources.AlphabeticSort; - this._SortByAlphaItem.Name = "_SortByAlphaItem"; - this._SortByAlphaItem.Size = new System.Drawing.Size(211, 22); - this._SortByAlphaItem.Text = "按字母顺序排序(&Z)"; - // - // _SortByCaj - // - this._SortByCaj.Name = "_SortByCaj"; - this._SortByCaj.Size = new System.Drawing.Size(211, 22); - this._SortByCaj.Text = "按CAJ文件命名规则排序"; - // - // _SortByFileTime - // - this._SortByFileTime.Image = global::PDFPatcher.Properties.Resources.Time; - this._SortByFileTime.Name = "_SortByFileTime"; - this._SortByFileTime.Size = new System.Drawing.Size(211, 22); - this._SortByFileTime.Text = "按修改时间先后排序"; - // - // _ReverseSort - // - this._ReverseSort.Image = global::PDFPatcher.Properties.Resources.SortReverse; - this._ReverseSort.Name = "_ReverseSort"; - this._ReverseSort.Size = new System.Drawing.Size(211, 22); - this._ReverseSort.Text = "反转排序"; - // - // toolStripSeparator4 - // - toolStripSeparator4.Name = "toolStripSeparator4"; - toolStripSeparator4.Size = new System.Drawing.Size(208, 6); - // - // _LoadList - // - _LoadList.Image = global::PDFPatcher.Properties.Resources.Open; - _LoadList.Name = "_LoadList"; - _LoadList.Size = new System.Drawing.Size(211, 22); - _LoadList.Text = "加载文件列表(&J)..."; - _LoadList.ToolTipText = "加载上次保存的文件列表,供继续编辑"; - // - // _SaveList - // - _SaveList.Image = global::PDFPatcher.Properties.Resources.Save; - _SaveList.Name = "_SaveList"; - _SaveList.Size = new System.Drawing.Size(211, 22); - _SaveList.Text = "保存文件列表(&B)..."; - _SaveList.ToolTipText = "保存文件列表到文件,供以后处理"; - // - // toolStripSeparator1 - // - toolStripSeparator1.Name = "toolStripSeparator1"; - toolStripSeparator1.Size = new System.Drawing.Size(6, 25); - // - // toolStripSeparator2 - // - toolStripSeparator2.Name = "toolStripSeparator2"; - toolStripSeparator2.Size = new System.Drawing.Size(6, 25); - // - // _EditItemProperty - // - _EditItemProperty.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - _EditItemProperty.Image = global::PDFPatcher.Properties.Resources.PdfPageRange; - _EditItemProperty.ImageTransparentColor = System.Drawing.Color.Magenta; - _EditItemProperty.Name = "_EditItemProperty"; - _EditItemProperty.Size = new System.Drawing.Size(23, 22); - _EditItemProperty.Text = "编辑源文件的处理方式"; - // - // _Refresh - // - _Refresh.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - _Refresh.Image = global::PDFPatcher.Properties.Resources.Refresh; - _Refresh.ImageTransparentColor = System.Drawing.Color.Magenta; - _Refresh.Name = "_Refresh"; - _Refresh.Size = new System.Drawing.Size(23, 22); - _Refresh.Text = "toolStripButton1"; - _Refresh.Visible = false; - // - // _SetPdfOptions - // - _SetPdfOptions.Name = "_SetPdfOptions"; - _SetPdfOptions.Size = new System.Drawing.Size(223, 22); - _SetPdfOptions.Text = "设置源 &PDF 文件处理方式..."; - _SetPdfOptions.ToolTipText = "更改源 PDF 文件的页码范围"; - // - // _SetCroppingOptions - // - _SetCroppingOptions.Name = "_SetCroppingOptions"; - _SetCroppingOptions.Size = new System.Drawing.Size(223, 22); - _SetCroppingOptions.Text = "设置裁剪图片选项(&C)..."; - // - // _Copy - // - _Copy.Name = "_Copy"; - _Copy.Size = new System.Drawing.Size(223, 22); - _Copy.Text = "复制列表内容(&F)"; - // - // _RefreshFolder - // - _RefreshFolder.Image = global::PDFPatcher.Properties.Resources.Refresh; - _RefreshFolder.Name = "_RefreshFolder"; - _RefreshFolder.Size = new System.Drawing.Size(223, 22); - _RefreshFolder.Text = "刷新文件夹(&W)"; - _RefreshFolder.ToolTipText = "刷新文件夹的内容"; - // - // _ClearBookmarkTitle - // - _ClearBookmarkTitle.Name = "_ClearBookmarkTitle"; - _ClearBookmarkTitle.Size = new System.Drawing.Size(208, 22); - _ClearBookmarkTitle.Text = "清空书签文本"; - _ClearBookmarkTitle.ToolTipText = "清空选中项目对应的书签文本及书签设置"; - // - // _SetBookmarkTitle - // - _SetBookmarkTitle.Name = "_SetBookmarkTitle"; - _SetBookmarkTitle.Size = new System.Drawing.Size(208, 22); - _SetBookmarkTitle.Text = "设置书签文本为源文件名"; - _SetBookmarkTitle.ToolTipText = "将选中项目对应的书签文本设置为文件名"; - // - // _PasteBookmarkText - // - _PasteBookmarkText.Image = global::PDFPatcher.Properties.Resources.Paste; - _PasteBookmarkText.Name = "_PasteBookmarkText"; - _PasteBookmarkText.Size = new System.Drawing.Size(223, 22); - _PasteBookmarkText.Text = "粘贴书签文本(Z)"; - // - // _CopyBookmarkText - // - _CopyBookmarkText.Image = global::PDFPatcher.Properties.Resources.Copy; - _CopyBookmarkText.Name = "_CopyBookmarkText"; - _CopyBookmarkText.Size = new System.Drawing.Size(223, 22); - _CopyBookmarkText.Text = "复制书签文本(&S)"; - // - // _CopyFileName - // - _CopyFileName.Name = "_CopyFileName"; - _CopyFileName.Size = new System.Drawing.Size(223, 22); - _CopyFileName.Text = "复制文件名(M)"; - // - // _Delete - // - _Delete.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - _Delete.Image = global::PDFPatcher.Properties.Resources.Delete; - _Delete.ImageTransparentColor = System.Drawing.Color.Magenta; - _Delete.Name = "_Delete"; - _Delete.Size = new System.Drawing.Size(23, 22); - _Delete.Text = "删除选中项"; - // - // _MainToolbar - // - this._MainToolbar.AutoSize = false; - this._MainToolbar.GripMargin = new System.Windows.Forms.Padding(0); - this._MainToolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - _File, - this._AddFilesButton, - this._AddFolderButton, - this._InsertEmptyPage, - _Delete, - toolStripSeparator1, - this._BoldStyleButton, - this._ItalicStyleButton, - this._BookmarkColorButton, - this._BookmarkTextMenu, - toolStripSeparator2, - _EditItemProperty, - _Refresh}); - this._MainToolbar.Location = new System.Drawing.Point(0, 0); - this._MainToolbar.Name = "_MainToolbar"; - this._MainToolbar.Size = new System.Drawing.Size(575, 25); - this._MainToolbar.TabIndex = 6; - this._MainToolbar.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _AddFilesButton - // - this._AddFilesButton.DropDown = this._RecentFileMenu; - this._AddFilesButton.Image = global::PDFPatcher.Properties.Resources.Add; - this._AddFilesButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._AddFilesButton.Name = "_AddFilesButton"; - this._AddFilesButton.Size = new System.Drawing.Size(103, 22); - this._AddFilesButton.Text = "添加文件(&T)"; - this._AddFilesButton.ToolTipText = "添加需要合并的文件到处理列表"; - this._AddFilesButton.ButtonClick += new System.EventHandler(this._MainToolbar_ButtonClick); - // - // _RecentFileMenu - // - this._RecentFileMenu.Name = "_RecentFileMenu"; - this._RecentFileMenu.OwnerItem = this._AddFilesButton; - this._RecentFileMenu.ShowImageMargin = false; - this._RecentFileMenu.Size = new System.Drawing.Size(36, 4); - // - // _AddFolderButton - // - this._AddFolderButton.DropDown = this._RecentFolderMenu; - this._AddFolderButton.Image = global::PDFPatcher.Properties.Resources.ImageFolder; - this._AddFolderButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._AddFolderButton.Name = "_AddFolderButton"; - this._AddFolderButton.Size = new System.Drawing.Size(100, 22); - this._AddFolderButton.Text = "添加文件夹"; - this._AddFolderButton.ToolTipText = "添加文件夹及其包含的文件到处理列表"; - this._AddFolderButton.ButtonClick += new System.EventHandler(this._MainToolbar_ButtonClick); - this._AddFolderButton.DropDownOpening += new System.EventHandler(this._AddFolder_DropDownOpening); - this._AddFolderButton.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._AddFolderButton_DropDownItemClicked); - // - // _RecentFolderMenu - // - this._RecentFolderMenu.Name = "_RecentFolderMenu"; - this._RecentFolderMenu.OwnerItem = this._AddFolderButton; - this._RecentFolderMenu.ShowImageMargin = false; - this._RecentFolderMenu.Size = new System.Drawing.Size(36, 4); - // - // _InsertEmptyPage - // - this._InsertEmptyPage.Image = global::PDFPatcher.Properties.Resources.EmptyPage; - this._InsertEmptyPage.ImageTransparentColor = System.Drawing.Color.Magenta; - this._InsertEmptyPage.Name = "_InsertEmptyPage"; - this._InsertEmptyPage.Size = new System.Drawing.Size(88, 22); - this._InsertEmptyPage.Text = "插入空白页"; - // - // _BoldStyleButton - // - this._BoldStyleButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this._BoldStyleButton.Image = global::PDFPatcher.Properties.Resources.Bold; - this._BoldStyleButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._BoldStyleButton.Name = "_BoldStyleButton"; - this._BoldStyleButton.Size = new System.Drawing.Size(23, 22); - this._BoldStyleButton.Text = "切换书签文本的粗体样式"; - // - // _ItalicStyleButton - // - this._ItalicStyleButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this._ItalicStyleButton.Image = global::PDFPatcher.Properties.Resources.Italic; - this._ItalicStyleButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._ItalicStyleButton.Name = "_ItalicStyleButton"; - this._ItalicStyleButton.Size = new System.Drawing.Size(23, 22); - this._ItalicStyleButton.Text = "切换书签文本的斜体样式"; - // - // _BookmarkColorButton - // - this._BookmarkColorButton.ButtonDisplayStyle = ColorPicker.ToolStripColorPickerDisplayType.UnderLineAndImage; - this._BookmarkColorButton.Color = System.Drawing.Color.Black; - this._BookmarkColorButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this._BookmarkColorButton.Image = ((System.Drawing.Image)(resources.GetObject("_BookmarkColorButton.Image"))); - this._BookmarkColorButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._BookmarkColorButton.Name = "_BookmarkColorButton"; - this._BookmarkColorButton.Size = new System.Drawing.Size(32, 22); - this._BookmarkColorButton.Text = "颜色"; - this._BookmarkColorButton.ToolTipText = "设置书签文本的颜色"; - // - // _BookmarkTextMenu - // - this._BookmarkTextMenu.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this._BookmarkTextMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - _ClearBookmarkTitle, - _SetBookmarkTitle}); - this._BookmarkTextMenu.Image = global::PDFPatcher.Properties.Resources.Mark; - this._BookmarkTextMenu.ImageTransparentColor = System.Drawing.Color.Magenta; - this._BookmarkTextMenu.Name = "_BookmarkTextMenu"; - this._BookmarkTextMenu.Size = new System.Drawing.Size(29, 22); - this._BookmarkTextMenu.Text = "设置选中项目的书签文本"; - this._BookmarkTextMenu.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _ItemList - // - this._ItemList.AllColumns.Add(this._NameColumn); - this._ItemList.AllColumns.Add(this._BookmarkColumn); - this._ItemList.AllColumns.Add(this._PageRangeColumn); - this._ItemList.AllColumns.Add(this._FolderColumn); - this._ItemList.AllColumns.Add(this._FileTimeColumn); - this._ItemList.AllowDrop = true; - this._ItemList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ItemList.CellEditActivation = BrightIdeasSoftware.ObjectListView.CellEditActivateMode.SingleClick; - this._ItemList.CellEditUseWholeCell = false; - this._ItemList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this._NameColumn, - this._BookmarkColumn, - this._PageRangeColumn, - this._FolderColumn, - this._FileTimeColumn}); - this._ItemList.ContextMenuStrip = this._ItemListMenu; - this._ItemList.Cursor = System.Windows.Forms.Cursors.Default; - this._ItemList.GridLines = true; - this._ItemList.HideSelection = false; - this._ItemList.IsSimpleDragSource = true; - this._ItemList.IsSimpleDropSink = true; - this._ItemList.Location = new System.Drawing.Point(13, 28); - this._ItemList.Name = "_ItemList"; - this._ItemList.ShowGroups = false; - this._ItemList.Size = new System.Drawing.Size(550, 197); - this._ItemList.SmallImageList = this._FileTypeList; - this._ItemList.TabIndex = 0; - this._ItemList.UseCellFormatEvents = true; - this._ItemList.UseCompatibleStateImageBehavior = false; - this._ItemList.View = System.Windows.Forms.View.Details; - this._ItemList.VirtualMode = true; - this._ItemList.FormatRow += new System.EventHandler(this._ItemList_FormatRow); - this._ItemList.ItemActivate += new System.EventHandler(this._ItemList_ItemActivate); - // - // _NameColumn - // - this._NameColumn.IsEditable = false; - this._NameColumn.Text = "源文件名"; - this._NameColumn.Width = 145; - // - // _BookmarkColumn - // - this._BookmarkColumn.Text = "书签文本"; - this._BookmarkColumn.Width = 119; - // - // _PageRangeColumn - // - this._PageRangeColumn.AutoCompleteEditorMode = System.Windows.Forms.AutoCompleteMode.Suggest; - this._PageRangeColumn.Text = "页码范围"; - this._PageRangeColumn.Width = 63; - // - // _FolderColumn - // - this._FolderColumn.IsEditable = false; - this._FolderColumn.Text = "文件夹"; - this._FolderColumn.Width = 104; - // - // _FileTimeColumn - // - this._FileTimeColumn.IsEditable = false; - this._FileTimeColumn.Text = "修改时间"; - this._FileTimeColumn.Width = 98; - // - // _ItemListMenu - // - this._ItemListMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - _CopyBookmarkText, - _PasteBookmarkText, - _CopyFileName, - _Copy, - this.toolStripSeparator3, - _SetCroppingOptions, - _SetPdfOptions, - _RefreshFolder}); - this._ItemListMenu.Name = "_ItemListMenu"; - this._ItemListMenu.Size = new System.Drawing.Size(224, 164); - this._ItemListMenu.Opening += new System.ComponentModel.CancelEventHandler(this._ItemListMenu_Opening); - this._ItemListMenu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // toolStripSeparator3 - // - this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(220, 6); - // - // _FileTypeList - // - this._FileTypeList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; - this._FileTypeList.ImageSize = new System.Drawing.Size(16, 16); - this._FileTypeList.TransparentColor = System.Drawing.Color.Transparent; - // - // _OpenImageBox - // - this._OpenImageBox.Filter = resources.GetString("_OpenImageBox.Filter"); - this._OpenImageBox.Multiselect = true; - this._OpenImageBox.Title = "选择需要导入的图片文件或PDF文件"; - // - // _OpenPdfBox - // - this._OpenPdfBox.DefaultExt = "pdf"; - this._OpenPdfBox.Filter = "PDF 文件(*.pdf)|*.pdf"; - this._OpenPdfBox.Multiselect = true; - this._OpenPdfBox.Title = "选择需要处理的 PDF 文件"; - // - // _AddDocumentWorker - // - this._AddDocumentWorker.WorkerReportsProgress = true; - this._AddDocumentWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this._AddDocumentWorker_DoWork); - this._AddDocumentWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this._AddDocumentWorker_ProgressChanged); - this._AddDocumentWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this._AddDocumentWorker_RunWorkerCompleted); - // - // _BookmarkControl - // - this._BookmarkControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._BookmarkControl.LabelText = "P&DF 信息文件:"; - this._BookmarkControl.Location = new System.Drawing.Point(13, 235); - this._BookmarkControl.Margin = new System.Windows.Forms.Padding(4); - this._BookmarkControl.Name = "_BookmarkControl"; - this._BookmarkControl.Size = new System.Drawing.Size(553, 24); - this._BookmarkControl.TabIndex = 1; - // - // _TargetPdfFile - // - this._TargetPdfFile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._TargetPdfFile.Location = new System.Drawing.Point(13, 265); - this._TargetPdfFile.Margin = new System.Windows.Forms.Padding(4); - this._TargetPdfFile.Name = "_TargetPdfFile"; - this._TargetPdfFile.Size = new System.Drawing.Size(553, 25); - this._TargetPdfFile.TabIndex = 2; - // - // _ImportButton - // - this._ImportButton.AlternativeFocusBorderColor = System.Drawing.SystemColors.Highlight; - this._ImportButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._ImportButton.AnimateGlow = true; - this._ImportButton.BackColor = System.Drawing.SystemColors.Highlight; - this._ImportButton.CornerRadius = 3; - this._ImportButton.ForeColor = System.Drawing.SystemColors.ControlText; - this._ImportButton.GlowColor = System.Drawing.Color.White; - this._ImportButton.Image = global::PDFPatcher.Properties.Resources.Save; - this._ImportButton.InnerBorderColor = System.Drawing.SystemColors.ControlDarkDark; - this._ImportButton.Location = new System.Drawing.Point(440, 297); - this._ImportButton.Name = "_ImportButton"; - this._ImportButton.OuterBorderColor = System.Drawing.SystemColors.ControlLightLight; - this._ImportButton.ShowFocusBorder = true; - this._ImportButton.Size = new System.Drawing.Size(123, 29); - this._ImportButton.TabIndex = 4; - this._ImportButton.Text = "生成合并文件(&S)"; - this._ImportButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._ImportButton.Click += new System.EventHandler(this._ImportButton_Click); - // - // _IndividualMergerModeBox - // - this._IndividualMergerModeBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this._IndividualMergerModeBox.AutoSize = true; - this._IndividualMergerModeBox.Location = new System.Drawing.Point(13, 301); - this._IndividualMergerModeBox.Name = "_IndividualMergerModeBox"; - this._IndividualMergerModeBox.Size = new System.Drawing.Size(186, 16); - this._IndividualMergerModeBox.TabIndex = 3; - this._IndividualMergerModeBox.Text = "顶层项目合并为单独的PDF文件"; - this._IndividualMergerModeBox.UseVisualStyleBackColor = true; - // - // _ConfigButton - // - this._ConfigButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._ConfigButton.Image = global::PDFPatcher.Properties.Resources.PdfOptions; - this._ConfigButton.Location = new System.Drawing.Point(347, 297); - this._ConfigButton.Name = "_ConfigButton"; - this._ConfigButton.Size = new System.Drawing.Size(86, 23); - this._ConfigButton.TabIndex = 5; - this._ConfigButton.Text = "功能选项"; - this._ConfigButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._ConfigButton.UseVisualStyleBackColor = true; - this._ConfigButton.Click += new System.EventHandler(this._MainToolbar_ButtonClick); - // - // MergerControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this._ConfigButton); - this.Controls.Add(this._IndividualMergerModeBox); - this.Controls.Add(this._MainToolbar); - this.Controls.Add(this._TargetPdfFile); - this.Controls.Add(this._ImportButton); - this.Controls.Add(this._BookmarkControl); - this.Controls.Add(this._ItemList); - this.Font = new System.Drawing.Font("SimSun", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.Name = "MergerControl"; - this.Size = new System.Drawing.Size(575, 343); - this._FileMenu.ResumeLayout(false); - this._MainToolbar.ResumeLayout(false); - this._MainToolbar.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this._ItemList)).EndInit(); - this._ItemListMenu.ResumeLayout(false); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private BrightIdeasSoftware.TreeListView _ItemList; - private BrightIdeasSoftware.OLVColumn _NameColumn; - private EnhancedGlassButton.GlassButton _ImportButton; - private System.Windows.Forms.OpenFileDialog _OpenImageBox; - private BrightIdeasSoftware.OLVColumn _FolderColumn; - private TargetFileControl _TargetPdfFile; - private System.Windows.Forms.ContextMenuStrip _FileMenu; - private System.Windows.Forms.ToolStripMenuItem _SortByAlphaItem; - private BookmarkControl _BookmarkControl; - private System.Windows.Forms.ContextMenuStrip _ItemListMenu; - private System.Windows.Forms.ToolStripSplitButton _AddFilesButton; - private System.Windows.Forms.ContextMenuStrip _RecentFileMenu; - private System.Windows.Forms.OpenFileDialog _OpenPdfBox; - private System.Windows.Forms.ToolStripButton _InsertEmptyPage; - private System.ComponentModel.BackgroundWorker _AddDocumentWorker; - private System.Windows.Forms.ImageList _FileTypeList; - private BrightIdeasSoftware.OLVColumn _BookmarkColumn; - private System.Windows.Forms.ToolStripButton _BoldStyleButton; - private System.Windows.Forms.ToolStripButton _ItalicStyleButton; - private ColorPicker.ToolStripColorPicker _BookmarkColorButton; - private System.Windows.Forms.ToolStrip _MainToolbar; - private System.Windows.Forms.ToolStripSplitButton _AddFolderButton; - private System.Windows.Forms.ContextMenuStrip _RecentFolderMenu; - private System.Windows.Forms.ToolStripDropDownButton _BookmarkTextMenu; - private System.Windows.Forms.CheckBox _IndividualMergerModeBox; - private BrightIdeasSoftware.OLVColumn _PageRangeColumn; - private System.Windows.Forms.Button _ConfigButton; - private System.Windows.Forms.ToolStripMenuItem _SortByNaturalNumberItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; - private BrightIdeasSoftware.OLVColumn _FileTimeColumn; - private System.Windows.Forms.ToolStripMenuItem _SortByCaj; - private System.Windows.Forms.ToolStripMenuItem _SortByFileTime; - private System.Windows.Forms.ToolStripMenuItem _ReverseSort; - } -} diff --git a/pdfpatcher/App/Functions/MergerControl.cs b/pdfpatcher/App/Functions/MergerControl.cs deleted file mode 100644 index 80de5d0d60747be0ac3edccff3ed36eb9ad0fd57..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/MergerControl.cs +++ /dev/null @@ -1,987 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Linq; -using System.Security.Permissions; -using System.Text; -using System.Windows.Forms; -using BrightIdeasSoftware; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - [ToolboxItem(false)] - public partial class MergerControl : FunctionControl - { - FileListHelper _listHelper; - readonly SourceItem _itemsContainer = new SourceItem.Empty(); - readonly string[] _bookmarkStyleButtonNames; - - public override string FunctionName => "合并文档"; - - public override Bitmap IconImage => Properties.Resources.Merger; - - public MergerControl() { - InitializeComponent(); - _bookmarkStyleButtonNames = new string[] { "_BoldStyleButton", "_BookmarkColorButton", "_ItalicStyleButton" }; - this.OnFirstLoad(OnLoad); - } - - void OnLoad() { - _MainToolbar.ScaleIcons(16); - _FileMenu.ScaleIcons(16); - _ItemListMenu.ScaleIcons(16); - _RecentFileMenu.ScaleIcons(16); - _RecentFolderMenu.ScaleIcons(16); - _ItemList.ScaleColumnWidths(); - - _BookmarkColorButton.SelectedColorChanged += (s, e) => { RefreshBookmarkColor(); }; - - AppContext.MainForm.SetTooltip(_BookmarkControl.FileList, "为目标 PDF 文件添加书签的信息文件(可选)"); - AppContext.MainForm.SetTooltip(_ItemList, "在此添加需要合并的 PDF 文件、图片文件或包含上述类型文件的文件夹"); - AppContext.MainForm.SetTooltip(_ImportButton, "点击此按钮将列表的文件合并为一个 PDF 文件"); - AppContext.MainForm.SetTooltip(_TargetPdfFile.FileList, "生成的目标 PDF 文件路径"); - _ItemList.EmptyListMsg = "请使用“添加文件”按钮添加需要合并的文件,或从资源管理器拖放文件到本列表框"; - - var fi = _FileTypeList.Images; - fi.AddRange(new Image[] { - Properties.Resources.EmptyPage, - Properties.Resources.OriginalPdfFile, - Properties.Resources.Image, - Properties.Resources.ImageFolder - }); - - _BookmarkControl.FileDialog.CheckFileExists = false; - _BookmarkControl.BrowseForFile += FileControl_BrowseForFile; - _TargetPdfFile.BrowseForFile += FileControl_BrowseForFile; - _IndividualMergerModeBox.CheckedChanged += (s, e) => { - _BookmarkControl.Enabled = !_IndividualMergerModeBox.Checked; - }; - _listHelper = new FileListHelper(_ItemList); - _ItemList.FixEditControlWidth(); - _ItemList.BeforeSorting += (s, e) => e.Canceled = true; - _ItemList.CanExpandGetter = (x) => ((SourceItem)x).HasSubItems; - _ItemList.ChildrenGetter = (x) => ((SourceItem)x).Items; - _ItemList.SelectedIndexChanged += (s, e) => { - var i = _ItemList.GetFirstSelectedIndex(); - var en = false; - if (i != -1) { - var b = (_ItemList.GetModelObject(i) as SourceItem).Bookmark; - if (b != null && String.IsNullOrEmpty(b.Title) == false) { - en = true; - _BoldStyleButton.Checked = b.IsBold; - _ItalicStyleButton.Checked = b.IsItalic; - } - } - _MainToolbar.ToggleEnabled(en, _bookmarkStyleButtonNames); - }; - _ItemList.CellEditStarting += (s, e) => _MainToolbar.Enabled = false; - _ItemList.CellEditFinishing += (s, e) => _MainToolbar.Enabled = true; - _ItemList.CanDrop += ItemList_CanDropFile; - _ItemList.Dropped += ItemList_FileDropped; - _ItemList.ModelCanDrop += ItemList_CanDropModel; - _ItemList.ModelDropped += ItemList_Dropped; - _ItemListMenu.Opening += (s, e) => { - foreach (ToolStripItem item in _ItemListMenu.Items) { - SetupCommand(item); - } - }; - _ItemList.AsTyped() - .ConfigColumn(_NameColumn, c => { - c.AspectGetter = o => o.FileName ?? "<空白页>"; - c.ImageGetter = o => (int)o.Type; - }) - .ConfigColumn(_BookmarkColumn, c => { - c.AspectGetter = (o) => o.Bookmark?.Title; - c.AspectPutter = (o, v) => { - var s = v as string; - if (String.IsNullOrEmpty(s)) { - o.Bookmark = null; - } - else if (o.Bookmark == null) { - o.Bookmark = new BookmarkSettings(s); - } - else { - o.Bookmark.Title = s; - } - }; - }) - .ConfigColumn(_PageRangeColumn, c => { - c.AspectGetter = (o) => (o as SourceItem.Pdf)?.PageRanges; - c.AspectPutter = (o, v) => { - if (o is SourceItem.Pdf p) { - p.PageRanges = v as string; - if (String.IsNullOrEmpty(p.PageRanges)) { - p.PageRanges = "1-" + p.PageCount.ToText(); - } - } - }; - }) - .ConfigColumn(_FolderColumn, c => c.AspectGetter = (o) => o.FolderName); - FileListHelper.SetupCommonPdfColumns(_FileTimeColumn); - _AddFilesButton.DropDownOpening += FileListHelper.OpenPdfButtonDropDownOpeningHandler; - _AddFilesButton.DropDownItemClicked += (s, e) => { - _RecentFileMenu.Hide(); - FilePath file = e.ClickedItem.ToolTipText; - if (file.ExistsFile) { - ExecuteCommand(Commands.OpenFile, file); - AppContext.RecentItems.AddHistoryItem(AppContext.Recent.SourcePdfFiles, file); - } - else { - FormHelper.ErrorBox("找不到文件:" + file); - } - }; - } - - [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] - protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { - if (_ItemList.IsCellEditing || _ItemList.Focused == false) { - return base.ProcessCmdKey(ref msg, keyData); - } - switch (keyData) { - case Keys.Delete: - ExecuteCommand(Commands.Delete); - return true; - case Keys.Control | Keys.B: - _BoldStyleButton.PerformClick(); - return true; - case Keys.Control | Keys.I: - _ItalicStyleButton.PerformClick(); - return true; - default: - return base.ProcessCmdKey(ref msg, keyData); - } - } - - #region 拖放操作 - void ItemList_CanDropFile(object sender, OlvDropEventArgs e) { - var o = e.DataObject as DataObject; - if (o == null) { - return; - } - var f = o.GetFileDropList(); - var d = e.DropTargetItem; - var child = d != null && e.MouseLocation.X > d.Position.X + d.GetBounds(ItemBoundsPortion.ItemOnly).Width / 2; - var after = d == null || e.MouseLocation.Y > d.Position.Y + d.Bounds.Height / 2; - foreach (var item in f) { - if (System.IO.Directory.Exists(item)) { - e.Handled = true; - e.Effect = DragDropEffects.Copy; - e.InfoMessage = String.Concat("添加目录", item, "到", (child ? "所有子项" : String.Empty), (after ? "后面" : "前面")); - return; - } - var ext = System.IO.Path.GetExtension(item).ToLowerInvariant(); - if (ext == Constants.FileExtensions.Pdf || Constants.FileExtensions.AllSupportedImageExtension.Contains(ext)) { - e.Handled = true; - e.Effect = DragDropEffects.Copy; - e.InfoMessage = String.Concat("添加文件", item, "到", (child ? "所有子项" : String.Empty), (after ? "后面" : "前面")); - return; - } - } - } - - void ItemList_FileDropped(object sender, OlvDropEventArgs e) { - var o = e.DataObject as DataObject; - if (o == null) { - return; - } - var f = o.GetFileDropList(); - var fl = new string[f.Count]; - f.CopyTo(fl, 0); - SourceItem.SortFileList(fl); - var sl = new List(fl.Length); - foreach (var item in fl) { - var si = SourceItem.Create(item); - if (si == null) { - continue; - } - sl.Add(si); - } - var ti = e.ListView.GetModelObject(e.DropTargetIndex) as SourceItem; - var d = e.DropTargetItem; - var child = d != null && e.MouseLocation.X > d.Position.X + d.GetBounds(ItemBoundsPortion.ItemOnly).Width / 2; - var after = d != null && e.MouseLocation.Y > d.Position.Y + d.Bounds.Height / 2; - CopyOrMoveElement(sl, ti, child, after, false, true); - } - - void ItemList_CanDropModel(object sender, ModelDropEventArgs e) { - var si = e.SourceModels; - var ti = e.TargetModel as SourceItem; - if (si == null || si.Count == 0 || e.TargetModel == null) { - e.Effect = DragDropEffects.None; - return; - } - var copy = (Control.ModifierKeys & Keys.Control) != Keys.None; - if (copy == false) { - if (e.DropTargetItem.Selected) { - e.Effect = DragDropEffects.None; - return; - } - var al = _ItemList.GetAncestorsOrSelf(ti); - foreach (SourceItem item in si) { - if (al.IndexOf(item) != -1) { - e.Effect = DragDropEffects.None; - e.InfoMessage = "目标项不能是源项目的子项。"; - return; - } - } - } - var d = e.DropTargetItem; - var ml = e.MouseLocation; - var child = ml.X > d.Position.X + d.GetBounds(ItemBoundsPortion.ItemOnly).Width / 2; - var append = ml.Y > d.Position.Y + d.Bounds.Height / 2; - if (child == false && copy == false) { - var xi = e.DropTargetIndex + (append ? 1 : -1); - if (xi > -1 && xi < e.ListView.GetItemCount() - && e.ListView.Items[xi].Selected - && GetParentSourceItem(ti) == GetParentSourceItem(_ItemList.GetModelObject(xi) as SourceItem)) { - e.Effect = DragDropEffects.None; - return; - } - } - e.Effect = copy ? DragDropEffects.Copy : DragDropEffects.Move; - e.InfoMessage = String.Concat((copy ? "复制" : "移动"), "到", (child ? "所有子项" : String.Empty), (append ? "后面" : "前面")); - } - - void ItemList_Dropped(object sender, ModelDropEventArgs e) { - var t = e.TargetModel as SourceItem; - var si = (e.SourceListView as TreeListView).GetSelectedModels(); - if (si == null) { - return; - } - var ti = e.TargetModel as SourceItem; - var d = e.DropTargetItem; - var child = e.MouseLocation.X > d.Position.X + d.GetBounds(ItemBoundsPortion.ItemOnly).Width / 2; - var after = e.MouseLocation.Y > d.Position.Y + d.Bounds.Height / 2; - var copy = (Control.ModifierKeys & Keys.Control) != Keys.None; - var deepCopy = copy && ((Control.ModifierKeys & Keys.Shift) != Keys.None); - var tii = _ItemList.TopItemIndex; - CopyOrMoveElement(si, ti, child, after, copy, deepCopy); - e.RefreshObjects(); - _ItemList.TopItemIndex = tii; - } - #endregion - - public override void SetupCommand(ToolStripItem item) { - var n = item.Name; - if (item.OwnerItem != null && item.OwnerItem.Name == Commands.Selection) { - EnableCommand(item, _ItemList.GetItemCount() > 0 && _ItemList.Focused, true); - } - else if (n.StartsWith(Commands.Copy, StringComparison.Ordinal) || n.StartsWith(Commands.Paste, StringComparison.Ordinal) || n == Commands.Delete) { - EnableCommand(item, _ItemList.GetItemCount() > 0 && _ItemList.GetFirstSelectedIndex() > -1, true); - } - else if (n == Commands.Options) { - item.Text = "合并文档设置(&S)..."; - item.ToolTipText = "设置合并后的 PDF 文档"; - EnableCommand(item, true, true); - item.Tag = nameof(Function.MergerOptions); - } - base.SetupCommand(item); - } - - void FileControl_BrowseForFile(object sender, EventArgs e) { - _listHelper.PrepareSourceFiles(); - } - - /// - /// 复制或移动书签。 - /// - /// 需要复制或移动的源书签。 - /// 目标书签。 - /// 是否复制为子节点。 - /// 是否复制到后面。 - /// 是否复制书签。 - /// 是否深度复制书签。 - internal void CopyOrMoveElement(List source, SourceItem target, bool child, bool after, bool copy, bool deepCopy) { - if (copy) { - var clones = new List(source.Count); - foreach (SourceItem item in source) { - clones.Add(item.Clone()); - } - source = clones; - } - else { - foreach (var item in source) { - //_ItemList.Collapse (item); - GetParentSourceItem(item).Items.Remove(item); - } - _ItemList.RemoveObjects(source); - } - if (child && target != null) { - if (after) { - target.Items.AddRange(source); - } - else { - var a = target.Items.ToArray(); - target.Items.Clear(); - target.Items.AddRange(source); - target.Items.AddRange(a); - } - if (target == _itemsContainer) { - _ItemList.SetObjects(target.Items); - } - else { - _ItemList.Expand(target); - } - } - else { - var p = GetParentSourceItem(target); - if (after) { - p.Items.InsertRange(target != null ? p.Items.IndexOf(target) + 1 : p.Items.Count, source); - } - else { - p.Items.InsertRange(target != null ? p.Items.IndexOf(target) : p.Items.Count, source); - } - if (p == _itemsContainer) { - _ItemList.SetObjects(_itemsContainer.Items); - } - else { - //_ItemList.RefreshObject (p); - } - } - _ItemList.SelectedObjects = source; - } - - SourceItem GetParentSourceItem(SourceItem item) { - var p = _ItemList.GetParentModel(item); - if (p == null) { - p = _itemsContainer; - } - return p; - } - - void AddFiles(string[] files) { - if (files == null || files.Length == 0) { - return; - } - if ((ModifierKeys & Keys.Control) != Keys.None) { - _ItemList.ClearObjects(); - } - if (files.Length > 3) { - AppContext.MainForm.Enabled = false; - } - SourceItem.SortFileList(files); - _AddDocumentWorker.RunWorkerAsync(files); - } - - void _AddFolder_DropDownOpening(object sender, EventArgs e) { - var l = _AddFolderButton.DropDown.Items; - l.ClearDropDownItems(); - foreach (var item in AppContext.Recent.Folders) { - if (FileHelper.IsPathValid(item) && String.IsNullOrEmpty(System.IO.Path.GetFileName(item)) == false) { - l.Add(FileHelper.GetEllipticPath(item, 50)).ToolTipText = item; - } - } - } - - void _AddFolderButton_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { - _RecentFolderMenu.Hide(); - var f = e.ClickedItem.ToolTipText; - if (System.IO.Directory.Exists(f) == false) { - FormHelper.ErrorBox("找不到文件夹:" + f); - return; - } - ExecuteCommand(Commands.OpenFile, f); - } - - void _ImportButton_Click(object sender, EventArgs e) { - var infoFile = _BookmarkControl.Text.Trim(); - var targetPdfFile = _TargetPdfFile.Text.Trim(); - if (String.IsNullOrEmpty(targetPdfFile) && String.IsNullOrEmpty(targetPdfFile = _TargetPdfFile.BrowseTargetFile())) { - FormHelper.ErrorBox(Messages.TargetFileNotSpecified); - return; - } - if (FileHelper.IsPathValid(targetPdfFile) == false) { - FormHelper.ErrorBox("输出文件名无效。" + (FileHelper.HasFileNameMacro(targetPdfFile) ? "\n合并 PDF 文件功能不支持替代符。" : String.Empty)); - return; - } - - //for (int i = _ItemList.GetItemCount () - 1; i >= 0; i--) { - // var f = _ItemList.GetModelObject (i) as SourceItem; - // if (f.Type == SourceItem.ItemType.Pdf) { - // AppContext.Recent.AddHistoryItem (AppContext.Recent.SourcePdfFiles, f.FilePath); - // } - //} - var l = _ItemList.GetItemCount(); - if (l == 0) { - FormHelper.InfoBox("请添加用于生成 PDF 文件的图片或 PDF 源文件。"); - return; - } - //var si = new List (l); - //for (int i = 0; i < l; i++) { - // var item = _ItemList.GetModelObject (_ItemList.GetNthItemInDisplayOrder (i).Index) as SourceItem; - // //if (item.Type == SourceFileItem.ItemType.Pdf && item.Path.EndsWith (Constants.FileExtensions.Pdf, StringComparison.OrdinalIgnoreCase)) { - // // ContextData.Recent.AddHistoryItem (ContextData.Recent.SourcePdfFiles, item.Path); - // //} - // si.Add (item); - //} - - _BookmarkControl.FileList.AddHistoryItem(); - _TargetPdfFile.FileList.AddHistoryItem(); - var fm = _IndividualMergerModeBox.Checked; - var fl = fm ? new List(_itemsContainer.Items.Count) : _itemsContainer.Items; - - if (fm) { - foreach (var item in _itemsContainer.Items) { - if (item.HasSubItems) { - fl.Add(item); - } - } - if (fl.Count == 0) { - FormHelper.ErrorBox("合并文件列表没有包含子项的首层项目。"); - return; - } - } - - AppContext.MainForm.ResetWorker(); - var worker = AppContext.MainForm.GetWorker(); - worker.DoWork += (dummy, arg) => { - var args = arg.Argument as object[]; - var items = args[0] as ICollection; - var target = args[1] as string; - if ((bool)args[3]) { - Tracker.SetTotalProgressGoal(items.Count); - foreach (var item in items) { - var tn = FileHelper.CombinePath(System.IO.Path.GetDirectoryName(target), item.FileName + Constants.FileExtensions.Pdf); - switch (item.Type) { - case SourceItem.ItemType.Empty: - Tracker.TraceMessage(Tracker.Category.Error, "首层项目不能为空白页。"); - break; - case SourceItem.ItemType.Pdf: - case SourceItem.ItemType.Image: - Processor.Worker.MergeDocuments(new SourceItem[] { item }, tn, null); - break; - case SourceItem.ItemType.Folder: - Processor.Worker.MergeDocuments(item.Items, tn, null); - break; - default: - break; - } - Tracker.IncrementTotalProgress(); - } - } - else { - Processor.Worker.MergeDocuments(items, args[1] as string, args[2] as string); - } - }; - worker.RunWorkerAsync(new object[] { fl, targetPdfFile, infoFile, fm }); - } - - void _SortMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { - SourceItem.SortType sortOptions; - bool recursive = ModifierKeys != Keys.Control; - switch (e.ClickedItem.Name) { - case "_SortByAlphaItem": - sortOptions = SourceItem.SortType.Literal; - break; - case "_SortByNaturalNumberItem": - sortOptions = SourceItem.SortType.NumericAwareSort; - break; - case "_SortByCaj": - sortOptions = SourceItem.SortType.CajSort; - break; - case "_SortByFileTime": - sortOptions = SourceItem.SortType.FileTime; - break; - case "_ReverseSort": - sortOptions = SourceItem.SortType.Reverse; - break; - default: - return; - } - _itemsContainer.SortItems(sortOptions, recursive); - _ItemList.Objects = _itemsContainer.Items; - } - - void _MainToolbar_ButtonClick(object sender, EventArgs e) { - if (sender == _AddFilesButton) { - ExecuteCommand(Commands.Open); - } - else if (sender == _ConfigButton) { - AppContext.MainForm.SelectFunctionList(Function.MergerOptions); - } - else if (sender == _AddFolderButton) { - using (var f = new OpenFileDialog() { - FileName = "【选择目录】", - Filter = _OpenImageBox.Filter, - CheckFileExists = false, - Title = "选择包含图片或 PDF 的文件夹,点击“打开”按钮" - }) { - if (f.ShowDialog() == DialogResult.OK) { - var p = System.IO.Path.GetDirectoryName(f.FileName); - if (String.IsNullOrEmpty(System.IO.Path.GetFileName(p))) { - FormHelper.ErrorBox("选择的文件夹无效,不允许选择根目录。"); - return; - } - ExecuteCommand(Commands.OpenFile, p); - AppContext.RecentItems.AddHistoryItem(AppContext.Recent.Folders, p); - } - } - } - } - - void _MainToolbar_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { - ExecuteCommand(e.ClickedItem); - } - - public override void ExecuteCommand(string commandName, params string[] parameters) { - switch (commandName) { - case Commands.Open: - if (_OpenImageBox.ShowDialog() == DialogResult.OK) { - ExecuteCommand(Commands.OpenFile, _OpenImageBox.FileNames); - foreach (FilePath item in _OpenImageBox.FileNames) { - if (item.HasExtension(Constants.FileExtensions.Pdf)) { - AppContext.RecentItems.AddHistoryItem(AppContext.Recent.SourcePdfFiles, item); - } - } - } - break; - case Commands.OpenFile: - AddFiles(parameters); - break; - case Commands.LoadList: - using (var f = new OpenFileDialog() { - Title = "请选择需要打开的文件列表", - Filter = Constants.FileExtensions.XmlFilter, - DefaultExt = Constants.FileExtensions.Xml - }) { - if (f.ShowDialog() == DialogResult.OK) { - _ItemList.DeselectAll(); - _ItemList.ClearObjects(); - _itemsContainer.Items.Clear(); - _itemsContainer.Items.AddRange(Processor.SourceItemSerializer.Deserialize(f.FileName)); - _ItemList.Objects = _itemsContainer.Items; - } - } - break; - case Commands.SaveList: - using (var f = new SaveFileDialog() { - Title = "请输入需要保存文件列表的文件名", - Filter = Constants.FileExtensions.XmlFilter, - DefaultExt = Constants.FileExtensions.Xml - }) { - if (f.ShowDialog() == DialogResult.OK) { - Processor.SourceItemSerializer.Serialize(_itemsContainer.Items, f.FileName); - } - } - break; - case Commands.Delete: - if (_ItemList.GetItemCount() == 0) { - return; - } - var l = _ItemList.SelectedObjects; - if (l.Count == 0) { - if (FormHelper.YesNoBox("是否清空文件列表?") == DialogResult.Yes) { - _ItemList.ClearObjects(); - _itemsContainer.Items.Clear(); - } - } - else { - foreach (SourceItem item in _ItemList.SelectedObjects) { - GetParentSourceItem(item).Items.Remove(item); - _ItemList.RemoveObject(item); - } - } - break; - case Commands.Copy: - var sb = StringBuilderCache.Acquire(200); - var sl = GetSourceItems(true); - if (sl.HasContent() == false) { - sl = GetSourceItems(false); - if (sl.HasContent() == false) { - return; - } - } - foreach (var item in sl) { - if (item.Type == SourceItem.ItemType.Empty) { - if (String.IsNullOrEmpty(item.Bookmark?.Title) == false) { - sb.Append('\t').Append(item.Bookmark.Title).Append('\t').Append('-').AppendLine(); - } - } - else if (item.Type == SourceItem.ItemType.Pdf) { - var pi = item as SourceItem.Pdf; - sb.AppendLine(String.Join("\t", new string[] { - pi.FilePath.ToString(), - item.Bookmark != null ? item.Bookmark.Title : String.Empty, - pi.PageRanges, - pi.PageCount.ToText () - })); - } - else if (item.Type == SourceItem.ItemType.Image) { - var im = item as SourceItem.Image; - sb.AppendLine(String.Join("\t", new string[] { - im.FilePath.ToString(), - item.Bookmark != null ? item.Bookmark.Title : String.Empty, - "-"/*im.PageRanges*/, - im.PageCount.ToText () })); - } - else if (item.Type == SourceItem.ItemType.Folder) { - sb.AppendLine(item.FilePath.ToString()); - } - } - if (sb.Length > 0) { - Clipboard.SetText(sb.ToString()); - } - StringBuilderCache.Release(sb); - break; - case "_InsertEmptyPage": - AddItem(new SourceItem.Empty()); - break; - case Commands.SelectAllItems: - _ItemList.SelectAll(); - break; - case Commands.SelectNone: - _ItemList.SelectObjects(null); - break; - case Commands.InvertSelectItem: - _ItemList.InvertSelect(); - break; - case Commands.SelectAllImages: - SelectItemsByType(SourceItem.ItemType.Image); - break; - case Commands.SelectAllPdf: - SelectItemsByType(SourceItem.ItemType.Pdf); - break; - case Commands.SelectAllFolders: - SelectItemsByType(SourceItem.ItemType.Folder); - break; - case "_EditItemProperty": - case "_SetPdfOptions": - _ItemList_ItemActivate(null, null); - break; - case "_SetCroppingOptions": - SetImageCropping(); - break; - case "_RefreshFolder": - foreach (SourceItem.Folder item in _ItemList.SelectedObjects) { - item?.Reload(); - } - _ItemList.RefreshObjects(_ItemList.SelectedObjects); - break; - case "_PdfOptions": - AppContext.MainForm.SelectFunctionList(Function.PatcherOptions); - break; - case "_BoldStyleButton": - var cb = !_BoldStyleButton.Checked; - foreach (SourceItem item in _ItemList.SelectedObjects) { - if (item != null && item.Bookmark != null) { - item.Bookmark.IsBold = cb; - } - } - goto case "__Refresh"; - case "_ItalicStyleButton": - var ci = !_ItalicStyleButton.Checked; - foreach (SourceItem item in _ItemList.SelectedObjects) { - if (item != null && item.Bookmark != null) { - item.Bookmark.IsItalic = ci; - } - } - goto case "__Refresh"; - case "_BookmarkColorButton": - RefreshBookmarkColor(); - break; - case "_CopyFileName": - CopySelectedItems(item => item.FilePath.FileNameWithoutExtension); - break; - case "_CopyBookmarkText": - CopySelectedItems(item => item != null && item.Bookmark != null ? item.Bookmark.Title : String.Empty); - break; - case "_PasteBookmarkText": - var ct = Clipboard.GetText(TextDataFormat.UnicodeText); - if (String.IsNullOrEmpty(ct) || _ItemList.GetItemCount() == 0) { - break; - } - var li = _ItemList.GetLastItemInDisplayOrder().Index; - using (var sr = new System.IO.StringReader(ct)) { - var i = _ItemList.GetFirstSelectedIndex(); - if (i == -1) { - i = 0; - } - while (i <= li && sr.Peek() != -1) { - var b = _ItemList.GetModelObject(i) as SourceItem; - if (b != null) { - if (b.Bookmark == null) { - b.Bookmark = new BookmarkSettings(sr.ReadLine()); - } - else { - b.Bookmark.Title = sr.ReadLine(); - } - } - var di = _ItemList.GetDisplayOrderOfItemIndex(i); - ++di; - var ni = _ItemList.GetNthItemInDisplayOrder(di); - if (ni == null) { - break; - } - i = ni.Index; - } - } - break; - case "_ClearBookmarkTitle": - foreach (SourceItem item in _ItemList.SelectedObjects) { - if (item != null && item.Bookmark != null) { - item.Bookmark = null; - } - } - goto case "__Refresh"; - case "_SetBookmarkTitle": - foreach (SourceItem item in _ItemList.SelectedObjects) { - if (item != null) { - BookmarkSettings b; - var t = System.IO.Path.GetFileNameWithoutExtension(item.FileName); - if ((b = item.Bookmark) == null) { - b = item.Bookmark = new BookmarkSettings(t); - } - else { - item.Bookmark.Title = t; - } - } - } - goto case "__Refresh"; - case "__Refresh": - _ItemList.RefreshObjects(_ItemList.SelectedObjects); - break; - default: - break; - } - } - - void CopySelectedItems(Converter converter) { - var bt = StringBuilderCache.Acquire(200); - foreach (SourceItem item in _ItemList.SelectedObjects) { - bt.AppendLine(converter(item)); - } - if (bt.Length > 0) { - Clipboard.SetText(bt.ToString()); - } - StringBuilderCache.Release(bt); - } - - void RefreshBookmarkColor() { - var sc = _BookmarkColorButton.Color == Color.White - ? Color.Transparent - : _BookmarkColorButton.Color; - foreach (SourceItem item in _ItemList.SelectedObjects) { - if (item != null && item.Bookmark != null) { - item.Bookmark.ForeColor = sc; - } - } - _ItemList.RefreshObjects(_ItemList.SelectedObjects); - } - - void SelectItemsByType(SourceItem.ItemType type) { - var r = new List(); - SelectItemsByType(type, r, _itemsContainer); - if (r.Count > 0) { - _ItemList.SelectedObjects = r; - } - else { - _ItemList.SelectedObjects = null; - } - } - - void SelectItemsByType(SourceItem.ItemType type, List result, SourceItem container) { - foreach (var item in container.Items) { - if (item.Type == type) { - _ItemList.Reveal(item, false); - result.Add(item); - } - if (item.HasSubItems) { - SelectItemsByType(type, result, item); - } - } - } - - void _ItemList_ItemActivate(object sender, EventArgs e) { - var vi = GetFocusedPdfItem(); - if (vi != null) { - var pdfItem = _ItemList.GetModelObject(vi.Index) as SourceItem.Pdf; - using (SourcePdfOptionForm f = new SourcePdfOptionForm(pdfItem)) { - if (f.ShowDialog() == DialogResult.OK) { - _ItemList.RefreshObject(pdfItem); - } - } - return; - } - SetImageCropping(); - } - - void SetImageCropping() { - var items = _ItemList.SelectedObjects; - if (items.Count == 0) { - return; - } - - var s = items[0] as SourceItem.Image; - int c = 1; - for (int i = 1; i < items.Count; i++) { - var image = items[i] as SourceItem.Image; - if (image == null || image.Type == SourceItem.ItemType.Pdf) { - continue; - } - if (s == null) { - s = image; - continue; - } - c++; - if (s.Cropping.Equals(image.Cropping) == false) { - if (FormHelper.YesNoBox("选择的图片具有不同的设置,是否重置为统一的值?") == DialogResult.No) { - return; - } - break; - } - } - if (s == null) { - return; - } - var o = new SourceItem.Image(c > 1 ? (FilePath)(c + " 个文件") : s.FilePath) { - Cropping = s.Cropping.Clone() - }; - using (var f = new SourceImageOptionForm(o)) { - if (f.ShowDialog() == DialogResult.OK) { - foreach (SourceItem.Image image in items) { - if (image == null || image.Type == SourceItem.ItemType.Pdf) { - continue; - } - image.Cropping = o.Cropping.Clone(); - } - } - } - } - - ListViewItem GetFocusedPdfItem() { - var vi = _ItemList.FocusedItem; - if (vi == null - //|| vi.Selected == false - || vi.Text.EndsWith(Constants.FileExtensions.Pdf, StringComparison.OrdinalIgnoreCase) == false) { - return null; - } - return vi; - } - - void _ItemListMenu_Opening(object sender, CancelEventArgs e) { - var vi = _ItemList.FocusedItem; - if (vi == null) { - _ItemListMenu.ToggleEnabled(false, "_SetPdfOptions", "_RefreshFolder", "_SetCroppingOptions"); - return; - } - var s = _ItemList.GetModelObject(vi.Index) as SourceItem; - _ItemListMenu.Items["_SetPdfOptions"].Enabled = s.Type == SourceItem.ItemType.Pdf; - _ItemListMenu.Items["_SetCroppingOptions"].Enabled = s.Type == SourceItem.ItemType.Image; - _ItemListMenu.Items["_RefreshFolder"].Enabled = s.Type == SourceItem.ItemType.Folder; - } - - List GetSourceItems(bool selectedOnly) where T : SourceItem { - if (_ItemList.GetItemCount() == 0) { - return null; - } - var l = (selectedOnly ? _ItemList.SelectedObjects : _ItemList.Objects); - var items = new List(selectedOnly ? 10 : _ItemList.GetItemCount()); - SelectItems(l, items); - return items; - } - - static void SelectItems(System.Collections.IEnumerable list, List results) where T : SourceItem { - foreach (T item in list) { - if (item == null) { - continue; - } - results.Add(item); - if (item.HasSubItems) { - SelectItems(item.Items, results); - } - } - } - - #region AddDocumentWorker - void _AddDocumentWorker_DoWork(object sender, DoWorkEventArgs e) { - var files = e.Argument as string[]; - Array.ForEach(files, f => { - ((BackgroundWorker)sender).ReportProgress(0, f); - }); - } - - void _AddDocumentWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { - AppContext.MainForm.Enabled = true; - //ResizeItemListColumns (); - } - - //void ResizeItemListColumns () { - // var c = _ItemList.Columns[0]; - // _ItemList.AutoResizeColumns (ColumnHeaderAutoResizeStyle.ColumnContent); - // if (c.Width < 100) { - // c.Width = 100; - // } - // for (int i = 1; i < _ItemList.Columns.Count; i++) { - // c = _ItemList.Columns[i]; - // if (c.Width < 50) { - // c.Width = 50; - // } - // } - //} - - void _AddDocumentWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) { - AddItem(SourceItem.Create(e.UserState as string)); - } - - void AddItem(SourceItem item) { - if (item == null) { - return; - } - _ItemList.Focus(); - AddItems(new SourceItem[] { item }); - } - - void AddItems(SourceItem[] items) { - int i = _ItemList.GetLastSelectedIndex(); - if (i == -1) { - i = _ItemList.FocusedItem?.Index ?? -1; - } - if (i == -1) { - _itemsContainer.Items.AddRange(items); - _ItemList.Objects = _itemsContainer.Items; - goto SELECT; - } - var m = _ItemList.GetModelObject(i) as SourceItem; - var p = _ItemList.GetParentModel(m); - if (p == null) { - i = _itemsContainer.Items.IndexOf(m); - _itemsContainer.Items.InsertRange(++i, items); - _ItemList.Objects = _itemsContainer.Items; - _ItemList.RebuildAll(true); - goto SELECT; - } - i = p.Items.IndexOf(m); - p.Items.InsertRange(++i, items); - _ItemList.RefreshObject(p); - SELECT: - _ItemList.SelectedObjects = items; - _ItemList.FocusedObject = items[0]; - } - #endregion - - #region IDefaultButtonControl 成员 - - public override Button DefaultButton => _ImportButton; - - #endregion - - void _ItemList_FormatRow(object sender, FormatRowEventArgs e) { - var si = e.Model as SourceItem; - var bs = si.Bookmark; - if (bs == null) { - return; - } - e.Item.UseItemStyleForSubItems = false; - e.UseCellFormatEvents = false; - var c = e.Item.SubItems[1]; - c.ForeColor = bs.ForeColor.IsEmptyOrTransparent() ? Color.Black : bs.ForeColor; - if (bs.IsBold || bs.IsItalic) { - c.Font = new Font(c.Font, (bs.IsBold ? FontStyle.Bold : FontStyle.Regular) | (bs.IsItalic ? FontStyle.Italic : FontStyle.Regular)); - } - } - - } -} diff --git a/pdfpatcher/App/Functions/MergerControl.resx b/pdfpatcher/App/Functions/MergerControl.resx deleted file mode 100644 index 8e4b4e75792f05235c7cb31216b431302066c9cb..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/MergerControl.resx +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - False - - - 269, 17 - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - 508, 17 - - - 634, 17 - - - 149, 55 - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAALRSURBVDhPzZJrSJNhFMefd+9EISiFMogICaL6IPkhQcWK - nM3USs0MLxO3hSFIoYRZar6StVfdNHUzxVBWppWXzdm87L4xL02GzAuFdFGbo9SpaWkmymnvXEnQxz70 - gz+Hczj/8xye50H/HB2B6BqO2zEDl5ak59Jz9Gy8RM/B+XoOPd+h6wYuzlSw0A5X+zbNcQjXcOkntWw6 - MZJ8pHs2JgamIyPBRmSu2zqI9Ql5+ldTz2nok58ANbG3VcVxP+iyIqTkon3qFPrNV7cONdjaM95NMJnw - Iz8f1vLyoN/XFyZab4OhPRBWbXmwMp0L0vrDoGa7kaqraBfqTnH3UXDc+W/rE006XdnmR1k+mPz8wBwU - BAofHxjOS4RJSS7IxEdB+cIfngr3w4g0FSxFwZ0KNn4edSbjBROPr4zMakqAMlMavcMCqbc3WHISftfM - TUlQJ9gDpoYEsHYQYG3L+NDFomUjeSJeOtZHbEy/LIDPShLmDWVg1wmAyv8mjVQMN5rG4Zp4FISZsXJU - F43XvH6WZp3TE2uDotjxxiSvdmMRc2je8ABm1MXOgVS0dRU6lfZoCCp6v0O5cRWi7nYCEpylB/PDsFY+ - E28WhNHSqVwQhmmWB6tBT16YrIjyHNSS5yZntXz4pODBxfs9EM/XQkjWcyDYDK3rHbYgTiGP0jCcL8kO - GF6x1EFtvJeaqtfGeaoX+4XOTdqeCCEgvR5qCzOnnsXhxU7jL8rDaTmyrONmna56c6G3Aqyqe0vvZTl2 - a3fB0oKxHOYcW1DRbiz91sLdLWm8hAJd1i2qIrAWe3/lmvMiHVrsq4Ql00OgTv8yIALqQw1VXX7TlLhT - Ko6lJbhs24jCMclAbcrUTA+xumSugbEBYmNKSSxbxKk2eW7QcHW0h0oUgRXXhCNfl+VPeAzkTzIwoUMK - XijWR4ZgvWQo1sJjYALyDGIVhaIDrtb/BoR+AhgWoMzludfHAAAAAElFTkSuQmCC - - - - 376, 17 - - - 17, 55 - - - 17, 17 - - - 支持的文件(*.pdf,*.jpg,*.png,*.gif,*.bmp,*.tif,*.jp2)|*.pdf;*.jpg;*.jpeg;*.png;*.gif;*.bmp;*.tif;*.tiff;*.jp2;*.j2k|PDF文件(*.pdf)|*.pdf|图片文件(,*.jpg,*.jpeg,*.png,*.gif,*.bmp,*.tif)|*.jpg;*.jpeg;*.png;*.gif;*.bmp;*.tif;*.tiff;;*.jp2;*.j2k - - - 149, 17 - - - 778, 17 - - - 123 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/MergerOptionForm.Designer.cs b/pdfpatcher/App/Functions/MergerOptionForm.Designer.cs deleted file mode 100644 index 428e4769bcf8a92c3c5ef9966bc1a1b78fea0105..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/MergerOptionForm.Designer.cs +++ /dev/null @@ -1,957 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class MergerOptionForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._MainTab = new System.Windows.Forms.TabControl(); - this._FilePage = new System.Windows.Forms.TabPage(); - this.groupBox3 = new System.Windows.Forms.GroupBox(); - this._DeduplicateBox = new System.Windows.Forms.CheckBox(); - this._KeepSourcePdfBookmarkBox = new System.Windows.Forms.CheckBox(); - this._RemoveOrphanBoomarksBox = new System.Windows.Forms.CheckBox(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this._SubFolderWithFilesBox = new System.Windows.Forms.RadioButton(); - this._ExcludeSubFoldersBox = new System.Windows.Forms.RadioButton(); - this.label9 = new System.Windows.Forms.Label(); - this._AutoBookmarkTitleBox = new System.Windows.Forms.CheckBox(); - this._CajSortBox = new System.Windows.Forms.CheckBox(); - this._IgnoreLeadingNumbersBox = new System.Windows.Forms.CheckBox(); - this._NumericAwareSortBox = new System.Windows.Forms.CheckBox(); - this._SubFoldersBeforeFilesBox = new System.Windows.Forms.RadioButton(); - this._LayoutPage = new System.Windows.Forms.TabPage(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); - this._RecompressImageBox = new System.Windows.Forms.CheckBox(); - this._AutoMaskBWImageBox = new System.Windows.Forms.CheckBox(); - this._ImageGroupBox = new System.Windows.Forms.GroupBox(); - this._AutoScaleDownBox = new System.Windows.Forms.CheckBox(); - this._AutoScaleUpBox = new System.Windows.Forms.CheckBox(); - this._LayoutGroupBox = new System.Windows.Forms.GroupBox(); - this._RotationBox = new System.Windows.Forms.ComboBox(); - this._SourceOrientationBox = new System.Windows.Forms.ComboBox(); - this._UnifyOrientationBox = new System.Windows.Forms.CheckBox(); - this._HeightBox = new System.Windows.Forms.NumericUpDown(); - this._WidthBox = new System.Windows.Forms.NumericUpDown(); - this._ImageVAlignBox = new System.Windows.Forms.ComboBox(); - this._ImageHAlignBox = new System.Windows.Forms.ComboBox(); - this.label2 = new System.Windows.Forms.Label(); - this.label8 = new System.Windows.Forms.Label(); - this._PageSizeBox = new System.Windows.Forms.ComboBox(); - this._AutoRotateBox = new System.Windows.Forms.CheckBox(); - this.label5 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this._MarginGroupBox = new System.Windows.Forms.GroupBox(); - this._SyncMarginsBox = new System.Windows.Forms.CheckBox(); - this._RightMarginBox = new System.Windows.Forms.NumericUpDown(); - this._LeftMarginBox = new System.Windows.Forms.NumericUpDown(); - this._BottomMarginBox = new System.Windows.Forms.NumericUpDown(); - this._TopMarginBox = new System.Windows.Forms.NumericUpDown(); - this.label7 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this._PdfGroupBox = new System.Windows.Forms.GroupBox(); - this._ResizePdfPagesBox = new System.Windows.Forms.RadioButton(); - this._ScalePdfPagesBox = new System.Windows.Forms.RadioButton(); - this._ViewerSettingsPage = new System.Windows.Forms.TabPage(); - this._ViewerSettingsEditor = new PDFPatcher.Functions.ViewerPreferenceEditor(); - this._DocumentInfoPage = new System.Windows.Forms.TabPage(); - this._FullCompressionBox = new System.Windows.Forms.CheckBox(); - this._DocumentInfoEditor = new PDFPatcher.Functions.DocumentInfoEditor(); - this._PageLabelsPage = new System.Windows.Forms.TabPage(); - this._PageLabelEditor = new PDFPatcher.Functions.PageLabelEditor(); - this.label10 = new System.Windows.Forms.Label(); - this._DpiYBox = new System.Windows.Forms.NumericUpDown(); - this._DpiXBox = new System.Windows.Forms.NumericUpDown(); - this.label11 = new System.Windows.Forms.Label(); - this.label12 = new System.Windows.Forms.Label(); - this._MainTab.SuspendLayout(); - this._FilePage.SuspendLayout(); - this.groupBox3.SuspendLayout(); - this.groupBox1.SuspendLayout(); - this._LayoutPage.SuspendLayout(); - this.groupBox2.SuspendLayout(); - this._ImageGroupBox.SuspendLayout(); - this._LayoutGroupBox.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._HeightBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this._WidthBox)).BeginInit(); - this._MarginGroupBox.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._RightMarginBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this._LeftMarginBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this._BottomMarginBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this._TopMarginBox)).BeginInit(); - this._PdfGroupBox.SuspendLayout(); - this._ViewerSettingsPage.SuspendLayout(); - this._DocumentInfoPage.SuspendLayout(); - this._PageLabelsPage.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._DpiYBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this._DpiXBox)).BeginInit(); - this.SuspendLayout(); - // - // _MainTab - // - this._MainTab.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._MainTab.Controls.Add(this._FilePage); - this._MainTab.Controls.Add(this._LayoutPage); - this._MainTab.Controls.Add(this._ViewerSettingsPage); - this._MainTab.Controls.Add(this._DocumentInfoPage); - this._MainTab.Controls.Add(this._PageLabelsPage); - this._MainTab.Location = new System.Drawing.Point(12, 12); - this._MainTab.Name = "_MainTab"; - this._MainTab.SelectedIndex = 0; - this._MainTab.Size = new System.Drawing.Size(448, 319); - this._MainTab.TabIndex = 0; - // - // _FilePage - // - this._FilePage.Controls.Add(this.groupBox3); - this._FilePage.Controls.Add(this.groupBox1); - this._FilePage.Location = new System.Drawing.Point(4, 22); - this._FilePage.Name = "_FilePage"; - this._FilePage.Padding = new System.Windows.Forms.Padding(3); - this._FilePage.Size = new System.Drawing.Size(440, 293); - this._FilePage.TabIndex = 1; - this._FilePage.Text = "文件"; - this._FilePage.UseVisualStyleBackColor = true; - // - // groupBox3 - // - this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox3.Controls.Add(this._DeduplicateBox); - this.groupBox3.Controls.Add(this._KeepSourcePdfBookmarkBox); - this.groupBox3.Controls.Add(this._RemoveOrphanBoomarksBox); - this.groupBox3.Location = new System.Drawing.Point(6, 141); - this.groupBox3.Margin = new System.Windows.Forms.Padding(2); - this.groupBox3.Name = "groupBox3"; - this.groupBox3.Padding = new System.Windows.Forms.Padding(2); - this.groupBox3.Size = new System.Drawing.Size(431, 133); - this.groupBox3.TabIndex = 1; - this.groupBox3.TabStop = false; - this.groupBox3.Text = "合并文件行为"; - // - // _DeduplicateBox - // - this._DeduplicateBox.AutoSize = true; - this._DeduplicateBox.Location = new System.Drawing.Point(10, 73); - this._DeduplicateBox.Margin = new System.Windows.Forms.Padding(2); - this._DeduplicateBox.Name = "_DeduplicateBox"; - this._DeduplicateBox.Size = new System.Drawing.Size(258, 16); - this._DeduplicateBox.TabIndex = 2; - this._DeduplicateBox.Text = "尝试合并 PDF 文档重复数据以缩小结果文件"; - this._DeduplicateBox.UseVisualStyleBackColor = true; - // - // _KeepSourcePdfBookmarkBox - // - this._KeepSourcePdfBookmarkBox.AutoSize = true; - this._KeepSourcePdfBookmarkBox.Location = new System.Drawing.Point(10, 19); - this._KeepSourcePdfBookmarkBox.Name = "_KeepSourcePdfBookmarkBox"; - this._KeepSourcePdfBookmarkBox.Size = new System.Drawing.Size(150, 16); - this._KeepSourcePdfBookmarkBox.TabIndex = 0; - this._KeepSourcePdfBookmarkBox.Text = "保留源 PDF 文档的书签"; - this._KeepSourcePdfBookmarkBox.UseVisualStyleBackColor = true; - // - // _RemoveOrphanBoomarksBox - // - this._RemoveOrphanBoomarksBox.AutoSize = true; - this._RemoveOrphanBoomarksBox.Location = new System.Drawing.Point(33, 41); - this._RemoveOrphanBoomarksBox.Name = "_RemoveOrphanBoomarksBox"; - this._RemoveOrphanBoomarksBox.Size = new System.Drawing.Size(168, 16); - this._RemoveOrphanBoomarksBox.TabIndex = 1; - this._RemoveOrphanBoomarksBox.Text = "删除连接到无效页面的书签"; - this._RemoveOrphanBoomarksBox.UseVisualStyleBackColor = true; - // - // groupBox1 - // - this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox1.Controls.Add(this._SubFolderWithFilesBox); - this.groupBox1.Controls.Add(this._ExcludeSubFoldersBox); - this.groupBox1.Controls.Add(this.label9); - this.groupBox1.Controls.Add(this._AutoBookmarkTitleBox); - this.groupBox1.Controls.Add(this._CajSortBox); - this.groupBox1.Controls.Add(this._IgnoreLeadingNumbersBox); - this.groupBox1.Controls.Add(this._NumericAwareSortBox); - this.groupBox1.Controls.Add(this._SubFoldersBeforeFilesBox); - this.groupBox1.Location = new System.Drawing.Point(6, 6); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(431, 131); - this.groupBox1.TabIndex = 0; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "向文件列表添加项目时的行为"; - // - // _SubFolderWithFilesBox - // - this._SubFolderWithFilesBox.AutoSize = true; - this._SubFolderWithFilesBox.Location = new System.Drawing.Point(177, 63); - this._SubFolderWithFilesBox.Name = "_SubFolderWithFilesBox"; - this._SubFolderWithFilesBox.Size = new System.Drawing.Size(107, 16); - this._SubFolderWithFilesBox.TabIndex = 4; - this._SubFolderWithFilesBox.TabStop = true; - this._SubFolderWithFilesBox.Text = "和文件一起排序"; - this._SubFolderWithFilesBox.UseVisualStyleBackColor = true; - // - // _ExcludeSubFoldersBox - // - this._ExcludeSubFoldersBox.AutoSize = true; - this._ExcludeSubFoldersBox.Location = new System.Drawing.Point(290, 63); - this._ExcludeSubFoldersBox.Name = "_ExcludeSubFoldersBox"; - this._ExcludeSubFoldersBox.Size = new System.Drawing.Size(71, 16); - this._ExcludeSubFoldersBox.TabIndex = 5; - this._ExcludeSubFoldersBox.TabStop = true; - this._ExcludeSubFoldersBox.Text = "不要导入"; - this._ExcludeSubFoldersBox.UseVisualStyleBackColor = true; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(8, 65); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(65, 12); - this.label9.TabIndex = 2; - this.label9.Text = "子文件夹:"; - // - // _AutoBookmarkTitleBox - // - this._AutoBookmarkTitleBox.AutoSize = true; - this._AutoBookmarkTitleBox.Location = new System.Drawing.Point(10, 19); - this._AutoBookmarkTitleBox.Name = "_AutoBookmarkTitleBox"; - this._AutoBookmarkTitleBox.Size = new System.Drawing.Size(168, 16); - this._AutoBookmarkTitleBox.TabIndex = 0; - this._AutoBookmarkTitleBox.Text = "添加项时自动生成书签文本"; - this._AutoBookmarkTitleBox.UseVisualStyleBackColor = true; - // - // _CajSortBox - // - this._CajSortBox.AutoSize = true; - this._CajSortBox.Location = new System.Drawing.Point(10, 107); - this._CajSortBox.Name = "_CajSortBox"; - this._CajSortBox.Size = new System.Drawing.Size(144, 16); - this._CajSortBox.TabIndex = 7; - this._CajSortBox.Text = "使用超星命名规则排序"; - this._CajSortBox.UseVisualStyleBackColor = true; - // - // _IgnoreLeadingNumbersBox - // - this._IgnoreLeadingNumbersBox.AutoSize = true; - this._IgnoreLeadingNumbersBox.Location = new System.Drawing.Point(33, 41); - this._IgnoreLeadingNumbersBox.Name = "_IgnoreLeadingNumbersBox"; - this._IgnoreLeadingNumbersBox.Size = new System.Drawing.Size(156, 16); - this._IgnoreLeadingNumbersBox.TabIndex = 1; - this._IgnoreLeadingNumbersBox.Text = "删除书签文本的前导数字"; - this._IgnoreLeadingNumbersBox.UseVisualStyleBackColor = true; - // - // _NumericAwareSortBox - // - this._NumericAwareSortBox.AutoSize = true; - this._NumericAwareSortBox.Location = new System.Drawing.Point(10, 85); - this._NumericAwareSortBox.Name = "_NumericAwareSortBox"; - this._NumericAwareSortBox.Size = new System.Drawing.Size(180, 16); - this._NumericAwareSortBox.TabIndex = 6; - this._NumericAwareSortBox.Text = "文件名分别按数值和文本排序"; - this._NumericAwareSortBox.UseVisualStyleBackColor = true; - // - // _SubFoldersBeforeFilesBox - // - this._SubFoldersBeforeFilesBox.AutoSize = true; - this._SubFoldersBeforeFilesBox.Location = new System.Drawing.Point(76, 63); - this._SubFoldersBeforeFilesBox.Name = "_SubFoldersBeforeFilesBox"; - this._SubFoldersBeforeFilesBox.Size = new System.Drawing.Size(95, 16); - this._SubFoldersBeforeFilesBox.TabIndex = 3; - this._SubFoldersBeforeFilesBox.Text = "排在文件前面"; - this._SubFoldersBeforeFilesBox.UseVisualStyleBackColor = true; - // - // _LayoutPage - // - this._LayoutPage.Controls.Add(this.groupBox2); - this._LayoutPage.Controls.Add(this._ImageGroupBox); - this._LayoutPage.Controls.Add(this._LayoutGroupBox); - this._LayoutPage.Controls.Add(this._MarginGroupBox); - this._LayoutPage.Controls.Add(this._PdfGroupBox); - this._LayoutPage.Location = new System.Drawing.Point(4, 22); - this._LayoutPage.Name = "_LayoutPage"; - this._LayoutPage.Padding = new System.Windows.Forms.Padding(3); - this._LayoutPage.Size = new System.Drawing.Size(440, 293); - this._LayoutPage.TabIndex = 0; - this._LayoutPage.Text = "页面布局"; - this._LayoutPage.UseVisualStyleBackColor = true; - // - // groupBox2 - // - this.groupBox2.Controls.Add(this._DpiYBox); - this.groupBox2.Controls.Add(this._DpiXBox); - this.groupBox2.Controls.Add(this.label10); - this.groupBox2.Controls.Add(this.label11); - this.groupBox2.Controls.Add(this._RecompressImageBox); - this.groupBox2.Controls.Add(this.label12); - this.groupBox2.Controls.Add(this._AutoMaskBWImageBox); - this.groupBox2.Location = new System.Drawing.Point(237, 139); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(195, 138); - this.groupBox2.TabIndex = 4; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "图片"; - // - // _RecompressImageBox - // - this._RecompressImageBox.AutoSize = true; - this._RecompressImageBox.Location = new System.Drawing.Point(7, 43); - this._RecompressImageBox.Name = "_RecompressImageBox"; - this._RecompressImageBox.Size = new System.Drawing.Size(120, 16); - this._RecompressImageBox.TabIndex = 1; - this._RecompressImageBox.Text = "优化压缩黑白图片"; - this._RecompressImageBox.UseVisualStyleBackColor = true; - // - // _AutoMaskBWImageBox - // - this._AutoMaskBWImageBox.AutoSize = true; - this._AutoMaskBWImageBox.Location = new System.Drawing.Point(7, 21); - this._AutoMaskBWImageBox.Name = "_AutoMaskBWImageBox"; - this._AutoMaskBWImageBox.Size = new System.Drawing.Size(120, 16); - this._AutoMaskBWImageBox.TabIndex = 0; - this._AutoMaskBWImageBox.Text = "黑白图片设为透明"; - this._AutoMaskBWImageBox.UseVisualStyleBackColor = true; - // - // _ImageGroupBox - // - this._ImageGroupBox.Controls.Add(this._AutoScaleDownBox); - this._ImageGroupBox.Controls.Add(this._AutoScaleUpBox); - this._ImageGroupBox.Location = new System.Drawing.Point(237, 6); - this._ImageGroupBox.Name = "_ImageGroupBox"; - this._ImageGroupBox.Size = new System.Drawing.Size(195, 48); - this._ImageGroupBox.TabIndex = 2; - this._ImageGroupBox.TabStop = false; - this._ImageGroupBox.Text = "缩放原始内容适应页面"; - // - // _AutoScaleDownBox - // - this._AutoScaleDownBox.AutoSize = true; - this._AutoScaleDownBox.Checked = true; - this._AutoScaleDownBox.CheckState = System.Windows.Forms.CheckState.Checked; - this._AutoScaleDownBox.Location = new System.Drawing.Point(7, 20); - this._AutoScaleDownBox.Name = "_AutoScaleDownBox"; - this._AutoScaleDownBox.Size = new System.Drawing.Size(72, 16); - this._AutoScaleDownBox.TabIndex = 0; - this._AutoScaleDownBox.Text = "无损缩小"; - this._AutoScaleDownBox.UseVisualStyleBackColor = true; - // - // _AutoScaleUpBox - // - this._AutoScaleUpBox.AutoSize = true; - this._AutoScaleUpBox.Location = new System.Drawing.Point(94, 20); - this._AutoScaleUpBox.Name = "_AutoScaleUpBox"; - this._AutoScaleUpBox.Size = new System.Drawing.Size(72, 16); - this._AutoScaleUpBox.TabIndex = 1; - this._AutoScaleUpBox.Text = "无损放大"; - this._AutoScaleUpBox.UseVisualStyleBackColor = true; - // - // _LayoutGroupBox - // - this._LayoutGroupBox.Controls.Add(this._RotationBox); - this._LayoutGroupBox.Controls.Add(this._SourceOrientationBox); - this._LayoutGroupBox.Controls.Add(this._UnifyOrientationBox); - this._LayoutGroupBox.Controls.Add(this._HeightBox); - this._LayoutGroupBox.Controls.Add(this._WidthBox); - this._LayoutGroupBox.Controls.Add(this._ImageVAlignBox); - this._LayoutGroupBox.Controls.Add(this._ImageHAlignBox); - this._LayoutGroupBox.Controls.Add(this.label2); - this._LayoutGroupBox.Controls.Add(this.label8); - this._LayoutGroupBox.Controls.Add(this._PageSizeBox); - this._LayoutGroupBox.Controls.Add(this._AutoRotateBox); - this._LayoutGroupBox.Controls.Add(this.label5); - this._LayoutGroupBox.Controls.Add(this.label4); - this._LayoutGroupBox.Location = new System.Drawing.Point(6, 6); - this._LayoutGroupBox.Name = "_LayoutGroupBox"; - this._LayoutGroupBox.Size = new System.Drawing.Size(225, 171); - this._LayoutGroupBox.TabIndex = 0; - this._LayoutGroupBox.TabStop = false; - this._LayoutGroupBox.Text = "默认页面布局及尺寸(单位:厘米)"; - // - // _RotationBox - // - this._RotationBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._RotationBox.FormattingEnabled = true; - this._RotationBox.Items.AddRange(new object[] { - "顺时针旋转90度", - "逆时针旋转90度"}); - this._RotationBox.Location = new System.Drawing.Point(103, 140); - this._RotationBox.Name = "_RotationBox"; - this._RotationBox.Size = new System.Drawing.Size(112, 20); - this._RotationBox.TabIndex = 12; - // - // _SourceOrientationBox - // - this._SourceOrientationBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._SourceOrientationBox.FormattingEnabled = true; - this._SourceOrientationBox.Items.AddRange(new object[] { - "横向页面", - "纵向页面"}); - this._SourceOrientationBox.Location = new System.Drawing.Point(20, 140); - this._SourceOrientationBox.Name = "_SourceOrientationBox"; - this._SourceOrientationBox.Size = new System.Drawing.Size(77, 20); - this._SourceOrientationBox.TabIndex = 11; - // - // _UnifyOrientationBox - // - this._UnifyOrientationBox.AutoSize = true; - this._UnifyOrientationBox.Location = new System.Drawing.Point(8, 118); - this._UnifyOrientationBox.Name = "_UnifyOrientationBox"; - this._UnifyOrientationBox.Size = new System.Drawing.Size(156, 16); - this._UnifyOrientationBox.TabIndex = 10; - this._UnifyOrientationBox.Text = "修改所有页面的纵横方向"; - this._UnifyOrientationBox.UseVisualStyleBackColor = true; - // - // _HeightBox - // - this._HeightBox.DecimalPlaces = 2; - this._HeightBox.Increment = new decimal(new int[] { - 1, - 0, - 0, - 131072}); - this._HeightBox.Location = new System.Drawing.Point(154, 45); - this._HeightBox.Maximum = new decimal(new int[] { - 9999, - 0, - 0, - 0}); - this._HeightBox.Name = "_HeightBox"; - this._HeightBox.Size = new System.Drawing.Size(61, 21); - this._HeightBox.TabIndex = 5; - this._HeightBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // _WidthBox - // - this._WidthBox.DecimalPlaces = 2; - this._WidthBox.Increment = new decimal(new int[] { - 1, - 0, - 0, - 131072}); - this._WidthBox.Location = new System.Drawing.Point(53, 44); - this._WidthBox.Maximum = new decimal(new int[] { - 9999, - 0, - 0, - 0}); - this._WidthBox.Name = "_WidthBox"; - this._WidthBox.Size = new System.Drawing.Size(61, 21); - this._WidthBox.TabIndex = 3; - this._WidthBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // _ImageVAlignBox - // - this._ImageVAlignBox.DisplayMember = "Key"; - this._ImageVAlignBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._ImageVAlignBox.Location = new System.Drawing.Point(139, 93); - this._ImageVAlignBox.Name = "_ImageVAlignBox"; - this._ImageVAlignBox.Size = new System.Drawing.Size(76, 20); - this._ImageVAlignBox.TabIndex = 9; - this._ImageVAlignBox.ValueMember = "Value"; - // - // _ImageHAlignBox - // - this._ImageHAlignBox.DisplayMember = "Key"; - this._ImageHAlignBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._ImageHAlignBox.Location = new System.Drawing.Point(53, 93); - this._ImageHAlignBox.Name = "_ImageHAlignBox"; - this._ImageHAlignBox.Size = new System.Drawing.Size(76, 20); - this._ImageHAlignBox.TabIndex = 8; - this._ImageHAlignBox.ValueMember = "Value"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(6, 23); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(41, 12); - this.label2.TabIndex = 0; - this.label2.Text = "尺寸:"; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(6, 96); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(41, 12); - this.label8.TabIndex = 7; - this.label8.Text = "位置:"; - // - // _PageSizeBox - // - this._PageSizeBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._PageSizeBox.Location = new System.Drawing.Point(53, 18); - this._PageSizeBox.Name = "_PageSizeBox"; - this._PageSizeBox.Size = new System.Drawing.Size(162, 20); - this._PageSizeBox.TabIndex = 1; - this._PageSizeBox.SelectedIndexChanged += new System.EventHandler(this._PageSizeBox_SelectedIndexChanged); - // - // _AutoRotateBox - // - this._AutoRotateBox.AutoSize = true; - this._AutoRotateBox.Checked = true; - this._AutoRotateBox.CheckState = System.Windows.Forms.CheckState.Checked; - this._AutoRotateBox.Location = new System.Drawing.Point(20, 72); - this._AutoRotateBox.Name = "_AutoRotateBox"; - this._AutoRotateBox.Size = new System.Drawing.Size(192, 16); - this._AutoRotateBox.TabIndex = 6; - this._AutoRotateBox.Text = "旋转页面适应原始内容纵横方向"; - this._AutoRotateBox.UseVisualStyleBackColor = true; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(120, 47); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(29, 12); - this.label5.TabIndex = 4; - this.label5.Text = "高:"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(18, 47); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(29, 12); - this.label4.TabIndex = 2; - this.label4.Text = "宽:"; - // - // _MarginGroupBox - // - this._MarginGroupBox.Controls.Add(this._SyncMarginsBox); - this._MarginGroupBox.Controls.Add(this._RightMarginBox); - this._MarginGroupBox.Controls.Add(this._LeftMarginBox); - this._MarginGroupBox.Controls.Add(this._BottomMarginBox); - this._MarginGroupBox.Controls.Add(this._TopMarginBox); - this._MarginGroupBox.Controls.Add(this.label7); - this._MarginGroupBox.Controls.Add(this.label3); - this._MarginGroupBox.Controls.Add(this.label6); - this._MarginGroupBox.Controls.Add(this.label1); - this._MarginGroupBox.Location = new System.Drawing.Point(6, 183); - this._MarginGroupBox.Name = "_MarginGroupBox"; - this._MarginGroupBox.Size = new System.Drawing.Size(225, 94); - this._MarginGroupBox.TabIndex = 1; - this._MarginGroupBox.TabStop = false; - this._MarginGroupBox.Text = "页边留白(单位:厘米)"; - // - // _SyncMarginsBox - // - this._SyncMarginsBox.AutoSize = true; - this._SyncMarginsBox.Checked = true; - this._SyncMarginsBox.CheckState = System.Windows.Forms.CheckState.Checked; - this._SyncMarginsBox.Location = new System.Drawing.Point(53, 74); - this._SyncMarginsBox.Name = "_SyncMarginsBox"; - this._SyncMarginsBox.Size = new System.Drawing.Size(120, 16); - this._SyncMarginsBox.TabIndex = 9; - this._SyncMarginsBox.Text = "同步调整四边留白"; - this._SyncMarginsBox.UseVisualStyleBackColor = true; - // - // _RightMarginBox - // - this._RightMarginBox.DecimalPlaces = 2; - this._RightMarginBox.Increment = new decimal(new int[] { - 1, - 0, - 0, - 131072}); - this._RightMarginBox.Location = new System.Drawing.Point(154, 47); - this._RightMarginBox.Maximum = new decimal(new int[] { - 99, - 0, - 0, - 0}); - this._RightMarginBox.Name = "_RightMarginBox"; - this._RightMarginBox.Size = new System.Drawing.Size(61, 21); - this._RightMarginBox.TabIndex = 8; - this._RightMarginBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._RightMarginBox.ValueChanged += new System.EventHandler(this.MarginBox_ValueChanged); - // - // _LeftMarginBox - // - this._LeftMarginBox.DecimalPlaces = 2; - this._LeftMarginBox.Increment = new decimal(new int[] { - 1, - 0, - 0, - 131072}); - this._LeftMarginBox.Location = new System.Drawing.Point(53, 47); - this._LeftMarginBox.Maximum = new decimal(new int[] { - 99, - 0, - 0, - 0}); - this._LeftMarginBox.Name = "_LeftMarginBox"; - this._LeftMarginBox.Size = new System.Drawing.Size(61, 21); - this._LeftMarginBox.TabIndex = 6; - this._LeftMarginBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._LeftMarginBox.ValueChanged += new System.EventHandler(this.MarginBox_ValueChanged); - // - // _BottomMarginBox - // - this._BottomMarginBox.DecimalPlaces = 2; - this._BottomMarginBox.Increment = new decimal(new int[] { - 1, - 0, - 0, - 131072}); - this._BottomMarginBox.Location = new System.Drawing.Point(154, 20); - this._BottomMarginBox.Maximum = new decimal(new int[] { - 99, - 0, - 0, - 0}); - this._BottomMarginBox.Name = "_BottomMarginBox"; - this._BottomMarginBox.Size = new System.Drawing.Size(61, 21); - this._BottomMarginBox.TabIndex = 4; - this._BottomMarginBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._BottomMarginBox.ValueChanged += new System.EventHandler(this.MarginBox_ValueChanged); - // - // _TopMarginBox - // - this._TopMarginBox.DecimalPlaces = 2; - this._TopMarginBox.Increment = new decimal(new int[] { - 1, - 0, - 0, - 131072}); - this._TopMarginBox.Location = new System.Drawing.Point(53, 20); - this._TopMarginBox.Maximum = new decimal(new int[] { - 99, - 0, - 0, - 0}); - this._TopMarginBox.Name = "_TopMarginBox"; - this._TopMarginBox.Size = new System.Drawing.Size(61, 21); - this._TopMarginBox.TabIndex = 1; - this._TopMarginBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._TopMarginBox.ValueChanged += new System.EventHandler(this.MarginBox_ValueChanged); - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(119, 50); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(29, 12); - this.label7.TabIndex = 7; - this.label7.Text = "右:"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(119, 22); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(29, 12); - this.label3.TabIndex = 3; - this.label3.Text = "下:"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(18, 50); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(29, 12); - this.label6.TabIndex = 5; - this.label6.Text = "左:"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(18, 23); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(29, 12); - this.label1.TabIndex = 0; - this.label1.Text = "上:"; - // - // _PdfGroupBox - // - this._PdfGroupBox.Controls.Add(this._ResizePdfPagesBox); - this._PdfGroupBox.Controls.Add(this._ScalePdfPagesBox); - this._PdfGroupBox.Location = new System.Drawing.Point(237, 60); - this._PdfGroupBox.Name = "_PdfGroupBox"; - this._PdfGroupBox.Size = new System.Drawing.Size(195, 73); - this._PdfGroupBox.TabIndex = 3; - this._PdfGroupBox.TabStop = false; - this._PdfGroupBox.Text = "源 PDF 页面尺寸"; - // - // _ResizePdfPagesBox - // - this._ResizePdfPagesBox.AutoSize = true; - this._ResizePdfPagesBox.Location = new System.Drawing.Point(7, 20); - this._ResizePdfPagesBox.Name = "_ResizePdfPagesBox"; - this._ResizePdfPagesBox.Size = new System.Drawing.Size(107, 16); - this._ResizePdfPagesBox.TabIndex = 1; - this._ResizePdfPagesBox.Text = "调整为页面尺寸"; - this._ResizePdfPagesBox.UseVisualStyleBackColor = true; - // - // _ScalePdfPagesBox - // - this._ScalePdfPagesBox.AutoSize = true; - this._ScalePdfPagesBox.CheckAlign = System.Drawing.ContentAlignment.TopLeft; - this._ScalePdfPagesBox.Location = new System.Drawing.Point(7, 42); - this._ScalePdfPagesBox.Name = "_ScalePdfPagesBox"; - this._ScalePdfPagesBox.Size = new System.Drawing.Size(119, 16); - this._ScalePdfPagesBox.TabIndex = 2; - this._ScalePdfPagesBox.TabStop = true; - this._ScalePdfPagesBox.Text = "缩放内容适应页面"; - this._ScalePdfPagesBox.UseVisualStyleBackColor = true; - // - // _ViewerSettingsPage - // - this._ViewerSettingsPage.Controls.Add(this._ViewerSettingsEditor); - this._ViewerSettingsPage.Location = new System.Drawing.Point(4, 22); - this._ViewerSettingsPage.Name = "_ViewerSettingsPage"; - this._ViewerSettingsPage.Padding = new System.Windows.Forms.Padding(3); - this._ViewerSettingsPage.Size = new System.Drawing.Size(440, 293); - this._ViewerSettingsPage.TabIndex = 2; - this._ViewerSettingsPage.Text = "阅读方式"; - this._ViewerSettingsPage.UseVisualStyleBackColor = true; - // - // _ViewerSettingsEditor - // - this._ViewerSettingsEditor.Location = new System.Drawing.Point(0, 0); - this._ViewerSettingsEditor.Margin = new System.Windows.Forms.Padding(4); - this._ViewerSettingsEditor.Name = "_ViewerSettingsEditor"; - this._ViewerSettingsEditor.Size = new System.Drawing.Size(438, 279); - this._ViewerSettingsEditor.TabIndex = 1; - // - // _DocumentInfoPage - // - this._DocumentInfoPage.Controls.Add(this._FullCompressionBox); - this._DocumentInfoPage.Controls.Add(this._DocumentInfoEditor); - this._DocumentInfoPage.Location = new System.Drawing.Point(4, 22); - this._DocumentInfoPage.Name = "_DocumentInfoPage"; - this._DocumentInfoPage.Padding = new System.Windows.Forms.Padding(3); - this._DocumentInfoPage.Size = new System.Drawing.Size(440, 293); - this._DocumentInfoPage.TabIndex = 3; - this._DocumentInfoPage.Text = "文档杂项"; - this._DocumentInfoPage.UseVisualStyleBackColor = true; - // - // _FullCompressionBox - // - this._FullCompressionBox.AutoSize = true; - this._FullCompressionBox.Location = new System.Drawing.Point(15, 260); - this._FullCompressionBox.Name = "_FullCompressionBox"; - this._FullCompressionBox.Size = new System.Drawing.Size(120, 16); - this._FullCompressionBox.TabIndex = 2; - this._FullCompressionBox.Text = "压缩索引表和书签"; - this._FullCompressionBox.UseVisualStyleBackColor = true; - // - // _DocumentInfoEditor - // - this._DocumentInfoEditor.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._DocumentInfoEditor.Location = new System.Drawing.Point(0, 0); - this._DocumentInfoEditor.Margin = new System.Windows.Forms.Padding(4); - this._DocumentInfoEditor.Name = "_DocumentInfoEditor"; - this._DocumentInfoEditor.Size = new System.Drawing.Size(439, 294); - this._DocumentInfoEditor.TabIndex = 1; - // - // _PageLabelsPage - // - this._PageLabelsPage.Controls.Add(this._PageLabelEditor); - this._PageLabelsPage.Location = new System.Drawing.Point(4, 22); - this._PageLabelsPage.Name = "_PageLabelsPage"; - this._PageLabelsPage.Padding = new System.Windows.Forms.Padding(3); - this._PageLabelsPage.Size = new System.Drawing.Size(440, 293); - this._PageLabelsPage.TabIndex = 4; - this._PageLabelsPage.Text = "页码标签"; - this._PageLabelsPage.UseVisualStyleBackColor = true; - // - // _PageLabelEditor - // - this._PageLabelEditor.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._PageLabelEditor.Labels = null; - this._PageLabelEditor.Location = new System.Drawing.Point(-2, 0); - this._PageLabelEditor.Margin = new System.Windows.Forms.Padding(4); - this._PageLabelEditor.Name = "_PageLabelEditor"; - this._PageLabelEditor.Size = new System.Drawing.Size(439, 282); - this._PageLabelEditor.TabIndex = 1; - // - // label10 - // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(6, 66); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(179, 12); - this.label10.TabIndex = 2; - this.label10.Text = "指定导入分辨率(0:保持原图)"; - // - // _DpiYBox - // - this._DpiYBox.Location = new System.Drawing.Point(55, 111); - this._DpiYBox.Maximum = new decimal(new int[] { - 10000, - 0, - 0, - 0}); - this._DpiYBox.Name = "_DpiYBox"; - this._DpiYBox.Size = new System.Drawing.Size(61, 21); - this._DpiYBox.TabIndex = 6; - this._DpiYBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // _DpiXBox - // - this._DpiXBox.Location = new System.Drawing.Point(55, 84); - this._DpiXBox.Maximum = new decimal(new int[] { - 10000, - 0, - 0, - 0}); - this._DpiXBox.Name = "_DpiXBox"; - this._DpiXBox.Size = new System.Drawing.Size(61, 21); - this._DpiXBox.TabIndex = 4; - this._DpiXBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // label11 - // - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(8, 113); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(41, 12); - this.label11.TabIndex = 5; - this.label11.Text = "垂直:"; - // - // label12 - // - this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(8, 87); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(41, 12); - this.label12.TabIndex = 3; - this.label12.Text = "水平:"; - // - // MergerOptionForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(474, 343); - this.Controls.Add(this._MainTab); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "MergerOptionForm"; - this.ShowInTaskbar = false; - this.Text = "合并 PDF 文档选项"; - this._MainTab.ResumeLayout(false); - this._FilePage.ResumeLayout(false); - this.groupBox3.ResumeLayout(false); - this.groupBox3.PerformLayout(); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this._LayoutPage.ResumeLayout(false); - this.groupBox2.ResumeLayout(false); - this.groupBox2.PerformLayout(); - this._ImageGroupBox.ResumeLayout(false); - this._ImageGroupBox.PerformLayout(); - this._LayoutGroupBox.ResumeLayout(false); - this._LayoutGroupBox.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this._HeightBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this._WidthBox)).EndInit(); - this._MarginGroupBox.ResumeLayout(false); - this._MarginGroupBox.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this._RightMarginBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this._LeftMarginBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this._BottomMarginBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this._TopMarginBox)).EndInit(); - this._PdfGroupBox.ResumeLayout(false); - this._PdfGroupBox.PerformLayout(); - this._ViewerSettingsPage.ResumeLayout(false); - this._DocumentInfoPage.ResumeLayout(false); - this._DocumentInfoPage.PerformLayout(); - this._PageLabelsPage.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this._DpiYBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this._DpiXBox)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.TabControl _MainTab; - private System.Windows.Forms.TabPage _LayoutPage; - private System.Windows.Forms.TabPage _FilePage; - private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.CheckBox _AutoMaskBWImageBox; - private System.Windows.Forms.GroupBox _ImageGroupBox; - private System.Windows.Forms.CheckBox _AutoScaleDownBox; - private System.Windows.Forms.CheckBox _AutoScaleUpBox; - private System.Windows.Forms.GroupBox _LayoutGroupBox; - private System.Windows.Forms.NumericUpDown _HeightBox; - private System.Windows.Forms.NumericUpDown _WidthBox; - private System.Windows.Forms.ComboBox _ImageVAlignBox; - private System.Windows.Forms.ComboBox _ImageHAlignBox; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.ComboBox _PageSizeBox; - private System.Windows.Forms.CheckBox _AutoRotateBox; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.GroupBox _MarginGroupBox; - private System.Windows.Forms.CheckBox _SyncMarginsBox; - private System.Windows.Forms.NumericUpDown _RightMarginBox; - private System.Windows.Forms.NumericUpDown _LeftMarginBox; - private System.Windows.Forms.NumericUpDown _BottomMarginBox; - private System.Windows.Forms.NumericUpDown _TopMarginBox; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.GroupBox _PdfGroupBox; - private System.Windows.Forms.RadioButton _ResizePdfPagesBox; - private System.Windows.Forms.RadioButton _ScalePdfPagesBox; - private System.Windows.Forms.CheckBox _IgnoreLeadingNumbersBox; - private System.Windows.Forms.TabPage _ViewerSettingsPage; - private ViewerPreferenceEditor _ViewerSettingsEditor; - private System.Windows.Forms.TabPage _DocumentInfoPage; - private DocumentInfoEditor _DocumentInfoEditor; - private System.Windows.Forms.TabPage _PageLabelsPage; - private PageLabelEditor _PageLabelEditor; - private System.Windows.Forms.CheckBox _RecompressImageBox; - private System.Windows.Forms.CheckBox _FullCompressionBox; - private System.Windows.Forms.CheckBox _AutoBookmarkTitleBox; - private System.Windows.Forms.RadioButton _SubFoldersBeforeFilesBox; - private System.Windows.Forms.CheckBox _NumericAwareSortBox; - private System.Windows.Forms.CheckBox _RemoveOrphanBoomarksBox; - private System.Windows.Forms.CheckBox _KeepSourcePdfBookmarkBox; - private System.Windows.Forms.CheckBox _CajSortBox; - private System.Windows.Forms.CheckBox _UnifyOrientationBox; - private System.Windows.Forms.ComboBox _RotationBox; - private System.Windows.Forms.ComboBox _SourceOrientationBox; - private System.Windows.Forms.CheckBox _DeduplicateBox; - private System.Windows.Forms.GroupBox groupBox3; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.RadioButton _ExcludeSubFoldersBox; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.RadioButton _SubFolderWithFilesBox; - private System.Windows.Forms.NumericUpDown _DpiYBox; - private System.Windows.Forms.NumericUpDown _DpiXBox; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.Label label11; - private System.Windows.Forms.Label label12; - } -} \ No newline at end of file diff --git a/pdfpatcher/App/Functions/MergerOptionForm.cs b/pdfpatcher/App/Functions/MergerOptionForm.cs deleted file mode 100644 index d3b4e0be978d0c5e419e27f17d9a4dbe65291210..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/MergerOptionForm.cs +++ /dev/null @@ -1,208 +0,0 @@ -using System; -using System.ComponentModel; -using System.Windows.Forms; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - [ToolboxItem(false)] - public partial class MergerOptionForm : Form, IResettableControl - { - string paperName; - bool _uiLockDown; - - public MergerOptionForm() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - } - - void OnLoad() { - this.SetIcon(Properties.Resources.PdfOptions); - MinimumSize = Size; - - _AutoBookmarkTitleBox.CheckedChanged += CheckBoxChanged; - _KeepSourcePdfBookmarkBox.CheckedChanged += CheckBoxChanged; - _UnifyOrientationBox.CheckedChanged += CheckBoxChanged; - _SubFoldersBeforeFilesBox.Checked = true; - _PageSizeBox.Items.AddRange(Array.FindAll(Processor.PdfDocumentCreator.PaperSizes, i => i.SpecialSize < SpecialPaperSize.AsSpecificPage)); - _ImageHAlignBox.Items.Add("水平居中"); - _ImageHAlignBox.Items.Add("左对齐"); - _ImageHAlignBox.Items.Add("右对齐"); - _ImageVAlignBox.Items.Add("垂直居中"); - _ImageVAlignBox.Items.Add("置顶"); - _ImageVAlignBox.Items.Add("置底"); - - Reload(); - } - - public void Reset() { - AppContext.Merger = new MergerOptions(); - Reload(); - } - - public void Reload() { - _uiLockDown = true; - var options = AppContext.Merger; - var ps = options.PageSettings; - _AutoBookmarkTitleBox.Checked = options.AutoBookmarkTitle; - _AutoMaskBWImageBox.Checked = options.AutoMaskBWImages; - _AutoRotateBox.Checked = ps.AutoRotation; - _AutoScaleDownBox.Checked = options.AutoScaleDown; - _AutoScaleUpBox.Checked = options.AutoScaleUp; - _BottomMarginBox.SetValue(ps.Margins.Bottom / Constants.Units.CmToPoint); - _CajSortBox.Checked = options.CajSort; - _HeightBox.SetValue(ps.PaperSize.Height / Constants.Units.CmToPoint); - _IgnoreLeadingNumbersBox.Checked = options.IgnoreLeadingNumbers; - _ImageHAlignBox.SelectedIndex = (int)ps.HorizontalAlign; - _ImageVAlignBox.SelectedIndex = (int)ps.VerticalAlign; - _KeepSourcePdfBookmarkBox.Checked = options.KeepBookmarks; - _LeftMarginBox.SetValue(ps.Margins.Left / Constants.Units.CmToPoint); - for (int i = 0; i < _PageSizeBox.Items.Count; i++) { - var p = _PageSizeBox.Items[i] as Model.PaperSize; - if (p.PaperName == ps.PaperSize.PaperName) { - _PageSizeBox.SelectedIndex = i; - } - } - if (_PageSizeBox.SelectedIndex == -1) { - _PageSizeBox.SelectedIndex = 0; - } - _NumericAwareSortBox.Checked = options.NumericAwareSort; - _RemoveOrphanBoomarksBox.Checked = options.RemoveOrphanBookmarks; - _ResizePdfPagesBox.Checked = ps.ScaleContent == false; - _RightMarginBox.SetValue(ps.Margins.Right / Constants.Units.CmToPoint); - switch (options.SubFolder) { - case MergerOptions.SubFolderPosition.BeforeFiles: - _SubFoldersBeforeFilesBox.Checked = true; - break; - case MergerOptions.SubFolderPosition.WithFiles: - _SubFolderWithFilesBox.Checked = true; - break; - case MergerOptions.SubFolderPosition.Exclude: - _ExcludeSubFoldersBox.Checked = true; - break; - } - _ScalePdfPagesBox.Checked = ps.ScaleContent; - _TopMarginBox.SetValue(ps.Margins.Top / Constants.Units.CmToPoint); - _WidthBox.SetValue(ps.PaperSize.Width / Constants.Units.CmToPoint); - if (_PageSizeBox.SelectedIndex == 0) { - _HeightBox.Value = 26.01M; - _WidthBox.Value = 18M; - } - - _SourceOrientationBox.SelectedIndex = options.RotateVerticalPages ? 1 : 0; - _RotationBox.SelectedIndex = options.RotateAntiClockwise ? 1 : 0; - _UnifyOrientationBox.Checked = options.UnifyPageOrientation; - _DeduplicateBox.Checked = options.Deduplicate; - _RecompressImageBox.Checked = options.RecompressWithJbig2; - _FullCompressionBox.Checked = options.FullCompression; - _DpiXBox.SetValue(options.DpiX); - _DpiYBox.SetValue(options.DpiY); - _DocumentInfoEditor.Options = options.MetaData; - _ViewerSettingsEditor.Options = options.ViewerPreferences; - _PageLabelEditor.Labels = options.PageLabels; - - _uiLockDown = false; - } - - protected override void OnClosed(EventArgs e) { - var option = AppContext.Merger; - var ps = option.PageSettings; - option.AutoBookmarkTitle = _AutoBookmarkTitleBox.Checked; - option.AutoMaskBWImages = _AutoMaskBWImageBox.Checked; - ps.AutoRotation = _AutoRotateBox.Checked; - option.AutoScaleDown = _AutoScaleDownBox.Checked; - option.AutoScaleUp = _AutoScaleUpBox.Checked; - option.CajSort = _CajSortBox.Checked; - ps.Margins.Top = CmToPoint(_TopMarginBox); - ps.Margins.Bottom = CmToPoint(_BottomMarginBox); - ps.Margins.Left = CmToPoint(_LeftMarginBox); - ps.Margins.Right = CmToPoint(_RightMarginBox); - option.NumericAwareSort = _NumericAwareSortBox.Checked; - ps.PaperSize.PaperName = paperName; - ps.PaperSize.Width = CmToPoint(_WidthBox); - ps.PaperSize.Height = CmToPoint(_HeightBox); - ps.HorizontalAlign = (Model.HorizontalAlignment)_ImageHAlignBox.SelectedIndex; - ps.VerticalAlign = (Model.VerticalAlignment)_ImageVAlignBox.SelectedIndex; - ps.ScaleContent = _ScalePdfPagesBox.Checked; - option.SubFolder = _SubFoldersBeforeFilesBox.Checked ? MergerOptions.SubFolderPosition.BeforeFiles - : _SubFolderWithFilesBox.Checked ? MergerOptions.SubFolderPosition.WithFiles - : MergerOptions.SubFolderPosition.Exclude; - - option.UnifyPageOrientation = _UnifyOrientationBox.Checked; - option.RotateVerticalPages = _SourceOrientationBox.SelectedIndex == 1; - option.RotateAntiClockwise = _RotationBox.SelectedIndex == 1; - option.IgnoreLeadingNumbers = _IgnoreLeadingNumbersBox.Checked; - option.KeepBookmarks = _KeepSourcePdfBookmarkBox.Checked; - option.RemoveOrphanBookmarks = _RemoveOrphanBoomarksBox.Checked; - - option.RecompressWithJbig2 = _RecompressImageBox.Checked; - option.FullCompression = _FullCompressionBox.Checked; - option.DpiX = (int)_DpiXBox.Value; - option.DpiY = (int)_DpiYBox.Value; - option.Deduplicate = _DeduplicateBox.Checked; - } - - float CmToPoint(NumericUpDown box) { - return (float)box.Value * Constants.Units.CmToPoint; - } - - void _PageSizeBox_SelectedIndexChanged(object sender, EventArgs e) { - if (_PageSizeBox.SelectedIndex == -1) { - return; - } - var p = _PageSizeBox.SelectedItem as Model.PaperSize; - if (p.Width > 0 && p.Height > 0) { - _WidthBox.SetValue((decimal)p.Width / (decimal)100); - _HeightBox.SetValue((decimal)p.Height / (decimal)100); - } - paperName = p.PaperName; - switch (paperName) { - case Model.PaperSize.FixedWidthAutoHeight: - _AutoRotateBox.Enabled = - _HeightBox.Enabled = - _ImageVAlignBox.Enabled = - false; - _ImageHAlignBox.Enabled = - _PdfGroupBox.Enabled = - _ImageGroupBox.Enabled = - _WidthBox.Enabled = true; - break; - case Model.PaperSize.AsPageSize: - _AutoRotateBox.Enabled = - _WidthBox.Enabled = - _ImageHAlignBox.Enabled = - _ImageVAlignBox.Enabled = - _PdfGroupBox.Enabled = - _ImageGroupBox.Enabled = - _HeightBox.Enabled = false; - break; - default: - _AutoRotateBox.Enabled = - _WidthBox.Enabled = - _HeightBox.Enabled = - _ImageHAlignBox.Enabled = - _ImageVAlignBox.Enabled = - _PdfGroupBox.Enabled = - _ImageGroupBox.Enabled = - true; - break; - } - } - - void MarginBox_ValueChanged(object sender, EventArgs e) { - if (_SyncMarginsBox.Checked == false || _uiLockDown) { - return; - } - var c = sender as NumericUpDown; - var d = c.Value; - _TopMarginBox.Value = _BottomMarginBox.Value = _LeftMarginBox.Value = _RightMarginBox.Value = d; - } - - void CheckBoxChanged(object sender, EventArgs e) { - _IgnoreLeadingNumbersBox.Enabled = _AutoBookmarkTitleBox.Checked; - _RemoveOrphanBoomarksBox.Enabled = _KeepSourcePdfBookmarkBox.Checked; - _SourceOrientationBox.Enabled = _RotationBox.Enabled = _UnifyOrientationBox.Checked; - } - } -} diff --git a/pdfpatcher/App/Functions/MergerOptionForm.resx b/pdfpatcher/App/Functions/MergerOptionForm.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/MergerOptionForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/OcrControl.Designer.cs b/pdfpatcher/App/Functions/OcrControl.Designer.cs deleted file mode 100644 index c81d77c5db23ebfcfd6fc53a54669eaac63505f7..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/OcrControl.Designer.cs +++ /dev/null @@ -1,403 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class OcrControl - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.label3 = new System.Windows.Forms.Label(); - this._PageRangeBox = new System.Windows.Forms.TextBox(); - this.tabControl1 = new System.Windows.Forms.TabControl(); - this.tabPage1 = new System.Windows.Forms.TabPage(); - this._PrintOcrResultBox = new System.Windows.Forms.CheckBox(); - this._OutputOriginalOcrResultBox = new System.Windows.Forms.CheckBox(); - this._ConvertToMonoColorBox = new System.Windows.Forms.CheckBox(); - this._RemoveSpaceBetweenChineseBox = new System.Windows.Forms.CheckBox(); - this._SaveOcredImageBox = new System.Windows.Forms.CheckBox(); - this._CompressWhiteSpaceBox = new System.Windows.Forms.CheckBox(); - this._DetectContentPunctuationsBox = new System.Windows.Forms.CheckBox(); - this._DetectColumnsBox = new System.Windows.Forms.CheckBox(); - this._StretchBox = new System.Windows.Forms.CheckBox(); - this._OrientBox = new System.Windows.Forms.CheckBox(); - this._OcrLangBox = new System.Windows.Forms.ComboBox(); - this.label13 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this._WritingDirectionBox = new System.Windows.Forms.ComboBox(); - this.label14 = new System.Windows.Forms.Label(); - this._QuantitiveFactorBox = new System.Windows.Forms.NumericUpDown(); - this._SourceFileControl = new PDFPatcher.SourceFileControl(); - this._BookmarkControl = new PDFPatcher.BookmarkControl(); - this._TargetFileControl = new PDFPatcher.TargetFileControl(); - this._ExportBookmarkButton = new System.Windows.Forms.Button(); - this._ImportOcrResultButton = new EnhancedGlassButton.GlassButton(); - this.tabControl1.SuspendLayout(); - this.tabPage1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._QuantitiveFactorBox)).BeginInit(); - this.SuspendLayout(); - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(3, 12); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(89, 12); - this.label3.TabIndex = 0; - this.label3.Text = "识别页码范围:"; - // - // _PageRangeBox - // - this._PageRangeBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._PageRangeBox.Location = new System.Drawing.Point(98, 9); - this._PageRangeBox.Name = "_PageRangeBox"; - this._PageRangeBox.Size = new System.Drawing.Size(335, 21); - this._PageRangeBox.TabIndex = 1; - // - // tabControl1 - // - this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tabControl1.Controls.Add(this.tabPage1); - this.tabControl1.Location = new System.Drawing.Point(13, 124); - this.tabControl1.Name = "tabControl1"; - this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(447, 194); - this.tabControl1.TabIndex = 4; - // - // tabPage1 - // - this.tabPage1.Controls.Add(this._PrintOcrResultBox); - this.tabPage1.Controls.Add(this._OutputOriginalOcrResultBox); - this.tabPage1.Controls.Add(this._ConvertToMonoColorBox); - this.tabPage1.Controls.Add(this._RemoveSpaceBetweenChineseBox); - this.tabPage1.Controls.Add(this._SaveOcredImageBox); - this.tabPage1.Controls.Add(this._CompressWhiteSpaceBox); - this.tabPage1.Controls.Add(this._DetectContentPunctuationsBox); - this.tabPage1.Controls.Add(this._DetectColumnsBox); - this.tabPage1.Controls.Add(this._StretchBox); - this.tabPage1.Controls.Add(this._OrientBox); - this.tabPage1.Controls.Add(this._OcrLangBox); - this.tabPage1.Controls.Add(this.label13); - this.tabPage1.Controls.Add(this.label5); - this.tabPage1.Controls.Add(this._WritingDirectionBox); - this.tabPage1.Controls.Add(this.label3); - this.tabPage1.Controls.Add(this._PageRangeBox); - this.tabPage1.Location = new System.Drawing.Point(4, 22); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(439, 168); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "识别选项"; - this.tabPage1.UseVisualStyleBackColor = true; - // - // _PrintOcrResultBox - // - this._PrintOcrResultBox.AutoSize = true; - this._PrintOcrResultBox.Location = new System.Drawing.Point(6, 150); - this._PrintOcrResultBox.Name = "_PrintOcrResultBox"; - this._PrintOcrResultBox.Size = new System.Drawing.Size(180, 16); - this._PrintOcrResultBox.TabIndex = 17; - this._PrintOcrResultBox.Text = "在日志窗口输出识别后的文本"; - this._PrintOcrResultBox.UseVisualStyleBackColor = true; - // - // _OutputOriginalOcrResultBox - // - this._OutputOriginalOcrResultBox.AutoSize = true; - this._OutputOriginalOcrResultBox.Location = new System.Drawing.Point(202, 128); - this._OutputOriginalOcrResultBox.Name = "_OutputOriginalOcrResultBox"; - this._OutputOriginalOcrResultBox.Size = new System.Drawing.Size(132, 16); - this._OutputOriginalOcrResultBox.TabIndex = 16; - this._OutputOriginalOcrResultBox.Text = "保存原始的识别结果"; - this._OutputOriginalOcrResultBox.UseVisualStyleBackColor = true; - this._OutputOriginalOcrResultBox.CheckedChanged += new System.EventHandler(this.ControlEvent); - // - // _ConvertToMonoColorBox - // - this._ConvertToMonoColorBox.AutoSize = true; - this._ConvertToMonoColorBox.Location = new System.Drawing.Point(6, 128); - this._ConvertToMonoColorBox.Name = "_ConvertToMonoColorBox"; - this._ConvertToMonoColorBox.Size = new System.Drawing.Size(144, 16); - this._ConvertToMonoColorBox.TabIndex = 12; - this._ConvertToMonoColorBox.Text = "转换为黑白图片再识别"; - this._ConvertToMonoColorBox.UseVisualStyleBackColor = true; - // - // _RemoveSpaceBetweenChineseBox - // - this._RemoveSpaceBetweenChineseBox.AutoSize = true; - this._RemoveSpaceBetweenChineseBox.Location = new System.Drawing.Point(202, 106); - this._RemoveSpaceBetweenChineseBox.Name = "_RemoveSpaceBetweenChineseBox"; - this._RemoveSpaceBetweenChineseBox.Size = new System.Drawing.Size(120, 16); - this._RemoveSpaceBetweenChineseBox.TabIndex = 11; - this._RemoveSpaceBetweenChineseBox.Text = "删除汉字间的空格"; - this._RemoveSpaceBetweenChineseBox.UseVisualStyleBackColor = true; - // - // _SaveOcredImageBox - // - this._SaveOcredImageBox.AutoSize = true; - this._SaveOcredImageBox.Location = new System.Drawing.Point(202, 150); - this._SaveOcredImageBox.Name = "_SaveOcredImageBox"; - this._SaveOcredImageBox.Size = new System.Drawing.Size(156, 16); - this._SaveOcredImageBox.TabIndex = 13; - this._SaveOcredImageBox.Text = "保存识别引擎处理的图片"; - this._SaveOcredImageBox.UseVisualStyleBackColor = true; - this._SaveOcredImageBox.Visible = false; - // - // _CompressWhiteSpaceBox - // - this._CompressWhiteSpaceBox.AutoSize = true; - this._CompressWhiteSpaceBox.Location = new System.Drawing.Point(6, 106); - this._CompressWhiteSpaceBox.Name = "_CompressWhiteSpaceBox"; - this._CompressWhiteSpaceBox.Size = new System.Drawing.Size(132, 16); - this._CompressWhiteSpaceBox.TabIndex = 10; - this._CompressWhiteSpaceBox.Text = "压缩连续出现的空格"; - this._CompressWhiteSpaceBox.UseVisualStyleBackColor = true; - // - // _DetectContentPunctuationsBox - // - this._DetectContentPunctuationsBox.AutoSize = true; - this._DetectContentPunctuationsBox.Location = new System.Drawing.Point(202, 84); - this._DetectContentPunctuationsBox.Name = "_DetectContentPunctuationsBox"; - this._DetectContentPunctuationsBox.Size = new System.Drawing.Size(192, 16); - this._DetectContentPunctuationsBox.TabIndex = 9; - this._DetectContentPunctuationsBox.Text = "识别目录页的点(……)分隔符"; - this._DetectContentPunctuationsBox.UseVisualStyleBackColor = true; - // - // _DetectColumnsBox - // - this._DetectColumnsBox.AutoSize = true; - this._DetectColumnsBox.Location = new System.Drawing.Point(6, 84); - this._DetectColumnsBox.Name = "_DetectColumnsBox"; - this._DetectColumnsBox.Size = new System.Drawing.Size(96, 16); - this._DetectColumnsBox.TabIndex = 8; - this._DetectColumnsBox.Text = "识别分栏排版"; - this._DetectColumnsBox.UseVisualStyleBackColor = true; - // - // _StretchBox - // - this._StretchBox.AutoSize = true; - this._StretchBox.Location = new System.Drawing.Point(202, 62); - this._StretchBox.Name = "_StretchBox"; - this._StretchBox.Size = new System.Drawing.Size(96, 16); - this._StretchBox.TabIndex = 7; - this._StretchBox.Text = "纠正倾斜页面"; - this._StretchBox.UseVisualStyleBackColor = true; - // - // _OrientBox - // - this._OrientBox.AutoSize = true; - this._OrientBox.Location = new System.Drawing.Point(6, 62); - this._OrientBox.Name = "_OrientBox"; - this._OrientBox.Size = new System.Drawing.Size(96, 16); - this._OrientBox.TabIndex = 6; - this._OrientBox.Text = "检测页面方向"; - this._OrientBox.UseVisualStyleBackColor = true; - // - // _OcrLangBox - // - this._OcrLangBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._OcrLangBox.FormattingEnabled = true; - this._OcrLangBox.Location = new System.Drawing.Point(295, 36); - this._OcrLangBox.Name = "_OcrLangBox"; - this._OcrLangBox.Size = new System.Drawing.Size(76, 20); - this._OcrLangBox.TabIndex = 5; - // - // label13 - // - this.label13.AutoSize = true; - this.label13.Location = new System.Drawing.Point(200, 39); - this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(89, 12); - this.label13.TabIndex = 4; - this.label13.Text = "文字识别语言:"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(3, 39); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(89, 12); - this.label5.TabIndex = 2; - this.label5.Text = "文字排版方向:"; - // - // _WritingDirectionBox - // - this._WritingDirectionBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._WritingDirectionBox.FormattingEnabled = true; - this._WritingDirectionBox.Items.AddRange(new object[] { - "自动检测", - "横向", - "纵向"}); - this._WritingDirectionBox.Location = new System.Drawing.Point(98, 36); - this._WritingDirectionBox.Name = "_WritingDirectionBox"; - this._WritingDirectionBox.Size = new System.Drawing.Size(76, 20); - this._WritingDirectionBox.TabIndex = 3; - this._WritingDirectionBox.SelectedIndexChanged += new System.EventHandler(this.ControlEvent); - // - // label14 - // - this.label14.AutoSize = true; - this.label14.Location = new System.Drawing.Point(20, 96); - this.label14.Name = "label14"; - this.label14.Size = new System.Drawing.Size(89, 12); - this.label14.TabIndex = 14; - this.label14.Text = "尺寸量化因数:"; - this.label14.Visible = false; - // - // _QuantitiveFactorBox - // - this._QuantitiveFactorBox.DecimalPlaces = 2; - this._QuantitiveFactorBox.Increment = new decimal(new int[] { - 1, - 0, - 0, - 65536}); - this._QuantitiveFactorBox.Location = new System.Drawing.Point(102, 94); - this._QuantitiveFactorBox.Maximum = new decimal(new int[] { - 2, - 0, - 0, - 0}); - this._QuantitiveFactorBox.Name = "_QuantitiveFactorBox"; - this._QuantitiveFactorBox.Size = new System.Drawing.Size(53, 21); - this._QuantitiveFactorBox.TabIndex = 15; - this._QuantitiveFactorBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._QuantitiveFactorBox.Visible = false; - // - // _SourceFileControl - // - this._SourceFileControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._SourceFileControl.Location = new System.Drawing.Point(9, 3); - this._SourceFileControl.Name = "_SourceFileControl"; - this._SourceFileControl.Size = new System.Drawing.Size(454, 24); - this._SourceFileControl.TabIndex = 1; - // - // _BookmarkControl - // - this._BookmarkControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._BookmarkControl.LabelText = "识别结果文件:"; - this._BookmarkControl.Location = new System.Drawing.Point(9, 33); - this._BookmarkControl.Name = "_BookmarkControl"; - this._BookmarkControl.Size = new System.Drawing.Size(454, 25); - this._BookmarkControl.TabIndex = 2; - this._BookmarkControl.UseForBookmarkExport = true; - // - // _TargetFileControl - // - this._TargetFileControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._TargetFileControl.Location = new System.Drawing.Point(9, 64); - this._TargetFileControl.Name = "_TargetFileControl"; - this._TargetFileControl.Size = new System.Drawing.Size(454, 25); - this._TargetFileControl.TabIndex = 16; - // - // _ExportBookmarkButton - // - this._ExportBookmarkButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._ExportBookmarkButton.Image = global::PDFPatcher.Properties.Resources.Ocr; - this._ExportBookmarkButton.Location = new System.Drawing.Point(211, 96); - this._ExportBookmarkButton.Name = "_ExportBookmarkButton"; - this._ExportBookmarkButton.Size = new System.Drawing.Size(120, 23); - this._ExportBookmarkButton.TabIndex = 3; - this._ExportBookmarkButton.Text = "识别图像文本(&S)"; - this._ExportBookmarkButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._ExportBookmarkButton.UseVisualStyleBackColor = true; - this._ExportBookmarkButton.Click += new System.EventHandler(this.Button_Click); - // - // _ImportOcrResultButton - // - this._ImportOcrResultButton.AlternativeFocusBorderColor = System.Drawing.SystemColors.Highlight; - this._ImportOcrResultButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._ImportOcrResultButton.AnimateGlow = true; - this._ImportOcrResultButton.BackColor = System.Drawing.SystemColors.Highlight; - this._ImportOcrResultButton.CornerRadius = 3; - this._ImportOcrResultButton.ForeColor = System.Drawing.SystemColors.ControlText; - this._ImportOcrResultButton.GlowColor = System.Drawing.Color.White; - this._ImportOcrResultButton.Image = global::PDFPatcher.Properties.Resources.Save; - this._ImportOcrResultButton.InnerBorderColor = System.Drawing.SystemColors.ControlDarkDark; - this._ImportOcrResultButton.Location = new System.Drawing.Point(337, 95); - this._ImportOcrResultButton.Name = "_ImportOcrResultButton"; - this._ImportOcrResultButton.OuterBorderColor = System.Drawing.SystemColors.ControlLightLight; - this._ImportOcrResultButton.ShowFocusBorder = true; - this._ImportOcrResultButton.Size = new System.Drawing.Size(123, 29); - this._ImportOcrResultButton.TabIndex = 17; - this._ImportOcrResultButton.Text = "写入PDF文档(&X)"; - this._ImportOcrResultButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._ImportOcrResultButton.Click += new System.EventHandler(this.Button_Click); - // - // OcrControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this._TargetFileControl); - this.Controls.Add(this._ExportBookmarkButton); - this.Controls.Add(this.tabControl1); - this.Controls.Add(this._SourceFileControl); - this.Controls.Add(this.label14); - this.Controls.Add(this._BookmarkControl); - this.Controls.Add(this._QuantitiveFactorBox); - this.Controls.Add(this._ImportOcrResultButton); - this.Font = new System.Drawing.Font("SimSun", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.Name = "OcrControl"; - this.Size = new System.Drawing.Size(475, 333); - this.tabControl1.ResumeLayout(false); - this.tabPage1.ResumeLayout(false); - this.tabPage1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this._QuantitiveFactorBox)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private SourceFileControl _SourceFileControl; - private BookmarkControl _BookmarkControl; - private System.Windows.Forms.Button _ExportBookmarkButton; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox _PageRangeBox; - private System.Windows.Forms.TabControl tabControl1; - private System.Windows.Forms.TabPage tabPage1; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.ComboBox _WritingDirectionBox; - private System.Windows.Forms.Label label14; - private System.Windows.Forms.NumericUpDown _QuantitiveFactorBox; - private System.Windows.Forms.CheckBox _StretchBox; - private System.Windows.Forms.CheckBox _OrientBox; - private System.Windows.Forms.ComboBox _OcrLangBox; - private System.Windows.Forms.Label label13; - private System.Windows.Forms.CheckBox _DetectColumnsBox; - private System.Windows.Forms.CheckBox _DetectContentPunctuationsBox; - private System.Windows.Forms.CheckBox _CompressWhiteSpaceBox; - private System.Windows.Forms.CheckBox _RemoveSpaceBetweenChineseBox; - private System.Windows.Forms.CheckBox _SaveOcredImageBox; - private System.Windows.Forms.CheckBox _ConvertToMonoColorBox; - private System.Windows.Forms.CheckBox _OutputOriginalOcrResultBox; - private TargetFileControl _TargetFileControl; - private EnhancedGlassButton.GlassButton _ImportOcrResultButton; - private System.Windows.Forms.CheckBox _PrintOcrResultBox; - - } -} diff --git a/pdfpatcher/App/Functions/OcrControl.cs b/pdfpatcher/App/Functions/OcrControl.cs deleted file mode 100644 index 3db316b70bb3414ae451e601ba13c41a1f8a9c0c..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/OcrControl.cs +++ /dev/null @@ -1,249 +0,0 @@ -using System; -using System.ComponentModel; -using System.IO; -using System.Windows.Forms; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - [ToolboxItem(false)] - public partial class OcrControl : FunctionControl, IResettableControl - { - OcrOptions _options; - - public override string FunctionName => "识别图像文本"; - - public override System.Drawing.Bitmap IconImage => Properties.Resources.Ocr; - - public override Button DefaultButton => _ExportBookmarkButton; - - public OcrControl() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - } - - void OnLoad() { - _BookmarkControl.FileDialog.Filter = Constants.FileExtensions.XmlFilter + "|" + Constants.FileExtensions.TxtFilter + "|" + Constants.FileExtensions.XmlOrTxtFilter; - - AppContext.MainForm.SetTooltip(_SourceFileControl.FileList, "需要识别文本的 PDF 源文件路径"); - AppContext.MainForm.SetTooltip(_BookmarkControl.FileList, "指定识别文本后生成的信息文件或文本文件路径,如路径为空则不输出文件"); - AppContext.MainForm.SetTooltip(_ExportBookmarkButton, "点击此按钮导出识别后的文本到文件"); - AppContext.MainForm.SetTooltip(_ImportOcrResultButton, "点击此按钮,将识别后的文本内容写入到目标 PDF 文件。"); - AppContext.MainForm.SetTooltip(_PageRangeBox, Messages.PageRanges); - AppContext.MainForm.SetTooltip(_DetectColumnsBox, "允许将距离较远的文本合并为同一行文本"); - AppContext.MainForm.SetTooltip(_DetectContentPunctuationsBox, "将三个以上的连续标点替换成“ .... ”"); - AppContext.MainForm.SetTooltip(_CompressWhiteSpaceBox, "将三个以上连续出现的空格压缩成两个空格"); - AppContext.MainForm.SetTooltip(_OrientBox, "自动检测页面横竖置放方向"); - AppContext.MainForm.SetTooltip(_StretchBox, "自动纠直倾斜的页面"); - AppContext.MainForm.SetTooltip(_OutputOriginalOcrResultBox, "保存原始的未经过优化合并的识别结果(可用于写入 PDF 文档)"); - - var lb = _OcrLangBox.Items; - if (Processor.ModiOcr.ModiInstalled) { - foreach (var item in Constants.Ocr.LangIDs) { - if (Processor.ModiOcr.IsLanguageInstalled(item)) { - lb.Add(ValueHelper.MapValue(item, Constants.Ocr.LangIDs, Constants.Ocr.LangNames)); - } - } - } - if (lb.Count == 0) { - lb.Add("无"); - } - _ExportBookmarkButton.Enabled = Processor.ModiOcr.ModiInstalled; - if (_ExportBookmarkButton.Enabled == false) { - AppContext.MainForm.SetTooltip(_OcrLangBox, "当前系统尚未安装识别引擎,请先安装微软 Office 文字识别引擎,再重新启动程序。"); - } - Reload(); - - var d = _BookmarkControl.FileDialog; - d.CheckFileExists = false; - d.CheckPathExists = false; - - if (d is SaveFileDialog sd) { - sd.OverwritePrompt = false; - } - } - - public override void SetupCommand(ToolStripItem item) { - switch (item.Name) { - case Commands.SaveBookmark: - item.Text = "写入PDF文件(&Q)"; - item.ToolTipText = "将识别结果写入 PDF 文件"; - EnableCommand(item, true, true); - break; - } - base.SetupCommand(item); - } - - public override void ExecuteCommand(string commandName, params string[] parameters) { - switch (commandName) { - case Commands.SaveBookmark: - _ImportOcrResultButton.PerformClick(); - return; - } - base.ExecuteCommand(commandName, parameters); - } - - public void Reset() { - AppContext.Ocr = new OcrOptions(); - Reload(); - } - - public void Reload() { - _options = AppContext.Ocr; - _CompressWhiteSpaceBox.Checked = _options.CompressWhiteSpaces; - _ConvertToMonoColorBox.Checked = !_options.PreserveColor; - _DetectColumnsBox.Checked = _options.DetectColumns; - _DetectContentPunctuationsBox.Checked = _options.DetectContentPunctuations; - var i = Array.IndexOf(Constants.Ocr.LangIDs, _options.OcrLangID); - _OcrLangBox.Select(i > 0 ? i : 0); - _OrientBox.Checked = _options.OrientPage; - _RemoveSpaceBetweenChineseBox.Checked = _options.RemoveWhiteSpacesBetweenChineseCharacters; - _SaveOcredImageBox.Checked = !String.IsNullOrEmpty(_options.SaveOcredImagePath); - _StretchBox.Checked = _options.StretchPage; - _OutputOriginalOcrResultBox.Checked = _options.OutputOriginalOcrResult; - _PrintOcrResultBox.Checked = _options.PrintOcrResult; - - _WritingDirectionBox.Select((int)_options.WritingDirection); - _QuantitiveFactorBox.SetValue(_options.QuantitativeFactor); - } - - void Button_Click(object sender, EventArgs e) { - if (File.Exists(_SourceFileControl.FirstFile) == false) { - FormHelper.ErrorBox(Messages.SourceFileNotFound); - return; - } - if (sender == _ImportOcrResultButton) { - if (FileHelper.IsPathValid(_TargetFileControl.Text) == false) { - FormHelper.ErrorBox(Messages.TargetFileNameInvalid); - return; - } - if (_BookmarkControl.Text.Length == 0) { - FormHelper.ErrorBox("请指定识别结果文件。"); - return; - } - } - //else if (String.IsNullOrEmpty (_BookmarkControl.Text)) { - // Common.Form.ErrorBox (Messages.InfoDocNotSpecified); - // return; - //} - - AppContext.SourceFiles = _SourceFileControl.Files; - AppContext.BookmarkFile = _BookmarkControl.Text; - AppContext.TargetFile = _TargetFileControl.Text; - if (_SourceFileControl.Files.Length == 1) { - _SourceFileControl.FileList.AddHistoryItem(); - if (_BookmarkControl.Text.Length > 0) { - _BookmarkControl.FileList.AddHistoryItem(); - } - } - if (sender == _ImportOcrResultButton) { - _TargetFileControl.FileList.AddHistoryItem(); - } - - AppContext.MainForm.ResetWorker(); - - SyncOptions(); - - var worker = AppContext.MainForm.GetWorker(); - if (sender != _ImportOcrResultButton) { - worker.DoWork += OcrExport; - worker.RunWorkerAsync(new object[] { - AppContext.SourceFiles, - AppContext.BookmarkFile, - _options - }); - } - else { - worker.DoWork += ImportOcr; - worker.RunWorkerAsync(new object[] { - AppContext.SourceFiles, - AppContext.BookmarkFile, - AppContext.TargetFile - }); - } - worker.RunWorkerCompleted += Worker_Completed; - } - - void Worker_Completed(object sender, RunWorkerCompletedEventArgs e) { - var worker = (BackgroundWorker)sender; - worker.RunWorkerCompleted -= Worker_Completed; - worker.DoWork -= OcrExport; - worker.DoWork -= ImportOcr; - } - - void SyncOptions() { - _options.CompressWhiteSpaces = _CompressWhiteSpaceBox.Checked; - _options.PreserveColor = !_ConvertToMonoColorBox.Checked; - _options.DetectColumns = _DetectColumnsBox.Checked; - _options.DetectContentPunctuations = _DetectContentPunctuationsBox.Checked; - _options.PageRanges = _PageRangeBox.Text; - _options.OcrLangID = ValueHelper.MapValue(_OcrLangBox.Text, Constants.Ocr.LangNames, Constants.Ocr.LangIDs, -1); - _options.OrientPage = _OrientBox.Checked; - _options.OutputOriginalOcrResult = _OutputOriginalOcrResultBox.Checked; - _options.QuantitativeFactor = (float)_QuantitiveFactorBox.Value; - _options.PrintOcrResult = _PrintOcrResultBox.Checked; - _options.RemoveWhiteSpacesBetweenChineseCharacters = _RemoveSpaceBetweenChineseBox.Checked; - _options.StretchPage = _StretchBox.Checked; - // _options.SaveOcredImagePath = String.IsNullOrEmpty (this._BookmarkControl.Text) ? null : Common.FileHelper.CombinePath (Path.GetDirectoryName (this._BookmarkControl.Text), Path.GetFileNameWithoutExtension (_BookmarkControl.Text) + Constants.FileExtensions.Tif); - _options.WritingDirection = (WritingDirection)_WritingDirectionBox.SelectedIndex; - } - - void OcrExport(object sender, DoWorkEventArgs e) { - var a = e.Argument as object[]; - var files = a[0] as string[]; - var b = a[1] as string; - var options = a[2] as OcrOptions; - if (files.Length > 1) { - var p = Path.GetDirectoryName(b); - var ext = Path.GetExtension(b); - foreach (var file in files) { - Processor.Worker.Ocr(file, FileHelper.CombinePath(p, Path.GetFileNameWithoutExtension(file) + ext), options); - if (AppContext.Abort) { - return; - } - } - } - else { - Processor.Worker.Ocr(files[0], b, options); - } - } - - void ImportOcr(object sender, DoWorkEventArgs e) { - var a = e.Argument as object[]; - var files = a[0] as string[]; - var b = a[1] as string; - var target = a[2] as string; - if (files.Length > 1) { - var p = Path.GetDirectoryName(b); - var ext = Path.GetExtension(b); - foreach (var file in files) { - Processor.Worker.ImportOcr(file, FileHelper.CombinePath(p, Path.GetFileNameWithoutExtension(file) + ext), target); - if (AppContext.Abort) { - return; - } - } - } - else { - Processor.Worker.ImportOcr(files[0], b, target); - } - } - - void _ImportLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { - AppContext.MainForm.SelectFunctionList(Function.Patcher); - } - - void ControlEvent(object sender, EventArgs e) { - if (sender == _WritingDirectionBox) { - _DetectColumnsBox.Enabled = _WritingDirectionBox.SelectedIndex != 0; - } - else if (sender == _OutputOriginalOcrResultBox) { - _DetectColumnsBox.Enabled - = _DetectContentPunctuationsBox.Enabled - = _CompressWhiteSpaceBox.Enabled - = _RemoveSpaceBetweenChineseBox.Enabled - = !_OutputOriginalOcrResultBox.Checked; - } - } - } -} diff --git a/pdfpatcher/App/Functions/OcrControl.resx b/pdfpatcher/App/Functions/OcrControl.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/OcrControl.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/PasswordEntryForm.Designer.cs b/pdfpatcher/App/Functions/PasswordEntryForm.Designer.cs deleted file mode 100644 index 9daf2c7599860d51dfc6a82523669c2c303a553d..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/PasswordEntryForm.Designer.cs +++ /dev/null @@ -1,115 +0,0 @@ -namespace PDFPatcher -{ - partial class PasswordEntryForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.label1 = new System.Windows.Forms.Label (); - this._PasswordBox = new System.Windows.Forms.TextBox (); - this._OkButton = new System.Windows.Forms.Button (); - this._CancelButton = new System.Windows.Forms.Button (); - this._MessageLabel = new System.Windows.Forms.Label (); - this.SuspendLayout (); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point (12, 46); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size (191, 12); - this.label1.TabIndex = 0; - this.label1.Text = "请输入 PDF 文件的编辑权限密码:"; - // - // _PasswordBox - // - this._PasswordBox.Location = new System.Drawing.Point (14, 61); - this._PasswordBox.Name = "_PasswordBox"; - this._PasswordBox.PasswordChar = '★'; - this._PasswordBox.Size = new System.Drawing.Size (274, 21); - this._PasswordBox.TabIndex = 1; - // - // _OkButton - // - this._OkButton.Location = new System.Drawing.Point (132, 88); - this._OkButton.Name = "_OkButton"; - this._OkButton.Size = new System.Drawing.Size (75, 23); - this._OkButton.TabIndex = 2; - this._OkButton.Text = "确定(&Q)"; - this._OkButton.UseVisualStyleBackColor = true; - this._OkButton.Click += new System.EventHandler (this._OkButton_Click); - // - // _CancelButton - // - this._CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this._CancelButton.Location = new System.Drawing.Point (213, 88); - this._CancelButton.Name = "_CancelButton"; - this._CancelButton.Size = new System.Drawing.Size (75, 23); - this._CancelButton.TabIndex = 3; - this._CancelButton.Text = "取消(&X)"; - this._CancelButton.UseVisualStyleBackColor = true; - this._CancelButton.Click += new System.EventHandler (this._CancelButton_Click); - // - // _MessageLabel - // - this._MessageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._MessageLabel.Location = new System.Drawing.Point (12, 9); - this._MessageLabel.Name = "_MessageLabel"; - this._MessageLabel.Size = new System.Drawing.Size (275, 37); - this._MessageLabel.TabIndex = 4; - this._MessageLabel.Text = "PDF 文件已被加密,需要编辑权限密码才能打开。"; - // - // PasswordEntryForm - // - this.AcceptButton = this._OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this._CancelButton; - this.ClientSize = new System.Drawing.Size (300, 123); - this.Controls.Add (this._MessageLabel); - this.Controls.Add (this._CancelButton); - this.Controls.Add (this._OkButton); - this.Controls.Add (this._PasswordBox); - this.Controls.Add (this.label1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "PasswordEntryForm"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "输入密码"; - this.ResumeLayout (false); - this.PerformLayout (); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox _PasswordBox; - private System.Windows.Forms.Button _OkButton; - private System.Windows.Forms.Button _CancelButton; - private System.Windows.Forms.Label _MessageLabel; - } -} \ No newline at end of file diff --git a/pdfpatcher/App/Functions/PasswordEntryForm.cs b/pdfpatcher/App/Functions/PasswordEntryForm.cs deleted file mode 100644 index 0ba9612f190e8cdfa239d0510facc1f95ee6fd51..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/PasswordEntryForm.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Windows.Forms; - -namespace PDFPatcher -{ - public partial class PasswordEntryForm : Form - { - public PasswordEntryForm(string sourceFile) { - InitializeComponent(); - - sourceFile = System.IO.Path.GetFileName(sourceFile); - Text += ":" + sourceFile; - _MessageLabel.Text = _MessageLabel.Text.Replace("PDF 文件", String.Concat("PDF 文件 ", sourceFile, " ")); - } - - /// - /// 获取密码框的文本。 - /// - public string Password => _PasswordBox.Text; - - private void _OkButton_Click(object sender, EventArgs e) { - DialogResult = DialogResult.OK; - Close(); - } - - private void _CancelButton_Click(object sender, EventArgs e) { - DialogResult = DialogResult.Cancel; - Close(); - } - } -} diff --git a/pdfpatcher/App/Functions/PasswordEntryForm.resx b/pdfpatcher/App/Functions/PasswordEntryForm.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/PasswordEntryForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/PatcherControl.Designer.cs b/pdfpatcher/App/Functions/PatcherControl.Designer.cs deleted file mode 100644 index 460f9f7407fe88aa0d20ee096bccdb6861950d2d..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/PatcherControl.Designer.cs +++ /dev/null @@ -1,509 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class PatcherControl - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.components = new System.ComponentModel.Container(); - System.Windows.Forms.ToolStripDropDownButton _Sort; - System.Windows.Forms.ToolStripButton _Delete; - System.Windows.Forms.ToolStripSeparator toolStripSeparator2; - System.Windows.Forms.ToolStripMenuItem _SelectAll; - System.Windows.Forms.ToolStripMenuItem _InvertSelect; - System.Windows.Forms.ToolStripMenuItem _SelectNone; - System.Windows.Forms.ToolStripMenuItem _Copy; - System.Windows.Forms.ToolStripMenuItem _RefreshInfo; - this._SortMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._SortByNaturalNumberItem = new System.Windows.Forms.ToolStripMenuItem(); - this._SortByAlphaItem = new System.Windows.Forms.ToolStripMenuItem(); - this._RefreshInfoMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._MainToolbar = new System.Windows.Forms.ToolStrip(); - this._AddFilesButton = new System.Windows.Forms.ToolStripSplitButton(); - this._RecentFileMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._RefreshInfoButton = new System.Windows.Forms.ToolStripSplitButton(); - this._SelectionMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._SelectionMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this._ItemList = new BrightIdeasSoftware.ObjectListView(); - this._NameColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._PageCountColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._TitleColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._AuthorColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._SubjectColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._KeywordsColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._FolderColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._FileTimeColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._ItemListMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._FileTypeList = new System.Windows.Forms.ImageList(this.components); - this._OpenPdfBox = new System.Windows.Forms.OpenFileDialog(); - this._AutoClearListBox = new System.Windows.Forms.CheckBox(); - this._AddDocumentWorker = new System.ComponentModel.BackgroundWorker(); - this._TargetPdfFile = new PDFPatcher.TargetFileControl(); - this._ActionsBox = new BrightIdeasSoftware.ObjectListView(); - this._ActionNameColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._ItemActionsContainerBox = new System.Windows.Forms.SplitContainer(); - this._ConfigButton = new System.Windows.Forms.Button(); - this._ImportButton = new EnhancedGlassButton.GlassButton(); - _Sort = new System.Windows.Forms.ToolStripDropDownButton(); - _Delete = new System.Windows.Forms.ToolStripButton(); - toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - _SelectAll = new System.Windows.Forms.ToolStripMenuItem(); - _InvertSelect = new System.Windows.Forms.ToolStripMenuItem(); - _SelectNone = new System.Windows.Forms.ToolStripMenuItem(); - _Copy = new System.Windows.Forms.ToolStripMenuItem(); - _RefreshInfo = new System.Windows.Forms.ToolStripMenuItem(); - this._SortMenu.SuspendLayout(); - this._MainToolbar.SuspendLayout(); - this._SelectionMenu.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._ItemList)).BeginInit(); - this._ItemListMenu.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._ActionsBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this._ItemActionsContainerBox)).BeginInit(); - this._ItemActionsContainerBox.Panel1.SuspendLayout(); - this._ItemActionsContainerBox.Panel2.SuspendLayout(); - this._ItemActionsContainerBox.SuspendLayout(); - this.SuspendLayout(); - // - // _Sort - // - _Sort.DropDown = this._SortMenu; - _Sort.Image = global::PDFPatcher.Properties.Resources.Sort; - _Sort.ImageTransparentColor = System.Drawing.Color.Magenta; - _Sort.Name = "_Sort"; - _Sort.Size = new System.Drawing.Size(61, 22); - _Sort.Text = "排序"; - _Sort.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._SortMenu_ItemClicked); - // - // _SortMenu - // - this._SortMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._SortByNaturalNumberItem, - this._SortByAlphaItem}); - this._SortMenu.Name = "_SortMenu"; - this._SortMenu.Size = new System.Drawing.Size(217, 48); - this._SortMenu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._SortMenu_ItemClicked); - // - // _SortByNaturalNumberItem - // - this._SortByNaturalNumberItem.Image = global::PDFPatcher.Properties.Resources.NaturalSort; - this._SortByNaturalNumberItem.Name = "_SortByNaturalNumberItem"; - this._SortByNaturalNumberItem.Size = new System.Drawing.Size(216, 22); - this._SortByNaturalNumberItem.Text = "按数值和字母顺序排序(&M)"; - // - // _SortByAlphaItem - // - this._SortByAlphaItem.Image = global::PDFPatcher.Properties.Resources.AlphabeticSort; - this._SortByAlphaItem.Name = "_SortByAlphaItem"; - this._SortByAlphaItem.Size = new System.Drawing.Size(216, 22); - this._SortByAlphaItem.Text = "按字母顺序排序(&Z)"; - // - // _Delete - // - _Delete.Image = global::PDFPatcher.Properties.Resources.Delete; - _Delete.ImageTransparentColor = System.Drawing.Color.Magenta; - _Delete.Name = "_Delete"; - _Delete.Size = new System.Drawing.Size(76, 22); - _Delete.Text = "删除文件"; - // - // toolStripSeparator2 - // - toolStripSeparator2.Name = "toolStripSeparator2"; - toolStripSeparator2.Size = new System.Drawing.Size(6, 25); - // - // _SelectAll - // - _SelectAll.Image = global::PDFPatcher.Properties.Resources.SelectAll; - _SelectAll.Name = "_SelectAll"; - _SelectAll.Size = new System.Drawing.Size(124, 22); - _SelectAll.Text = "全部选中"; - // - // _InvertSelect - // - _InvertSelect.Name = "_InvertSelect"; - _InvertSelect.Size = new System.Drawing.Size(124, 22); - _InvertSelect.Text = "反转选择"; - // - // _SelectNone - // - _SelectNone.Name = "_SelectNone"; - _SelectNone.Size = new System.Drawing.Size(124, 22); - _SelectNone.Text = "取消选择"; - // - // _Copy - // - _Copy.Image = global::PDFPatcher.Properties.Resources.Copy; - _Copy.Name = "_Copy"; - _Copy.Size = new System.Drawing.Size(148, 22); - _Copy.Text = "复制列表内容"; - // - // _RefreshInfo - // - _RefreshInfo.DropDown = this._RefreshInfoMenu; - _RefreshInfo.Image = global::PDFPatcher.Properties.Resources.Refresh; - _RefreshInfo.Name = "_RefreshInfo"; - _RefreshInfo.Size = new System.Drawing.Size(148, 22); - _RefreshInfo.Text = "刷新文档属性"; - // - // _RefreshInfoMenu - // - this._RefreshInfoMenu.Name = "_RefreshInfoMenu"; - this._RefreshInfoMenu.Size = new System.Drawing.Size(181, 26); - // - // _MainToolbar - // - this._MainToolbar.Dock = System.Windows.Forms.DockStyle.None; - this._MainToolbar.GripMargin = new System.Windows.Forms.Padding(0); - this._MainToolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._AddFilesButton, - _Sort, - _Delete, - toolStripSeparator2, - this._RefreshInfoButton}); - this._MainToolbar.Location = new System.Drawing.Point(0, 0); - this._MainToolbar.Name = "_MainToolbar"; - this._MainToolbar.Padding = new System.Windows.Forms.Padding(0, 0, 2, 0); - this._MainToolbar.Size = new System.Drawing.Size(367, 25); - this._MainToolbar.TabIndex = 0; - this._MainToolbar.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _AddFilesButton - // - this._AddFilesButton.DropDown = this._RecentFileMenu; - this._AddFilesButton.Image = global::PDFPatcher.Properties.Resources.Add; - this._AddFilesButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._AddFilesButton.Name = "_AddFilesButton"; - this._AddFilesButton.Size = new System.Drawing.Size(103, 22); - this._AddFilesButton.Text = "添加文件(&T)"; - this._AddFilesButton.ToolTipText = "添加需要合并的文件到处理列表"; - // - // _RecentFileMenu - // - this._RecentFileMenu.Name = "_RecentFileMenu"; - this._RecentFileMenu.ShowImageMargin = false; - this._RecentFileMenu.Size = new System.Drawing.Size(36, 4); - // - // _RefreshInfoButton - // - this._RefreshInfoButton.Image = global::PDFPatcher.Properties.Resources.Refresh; - this._RefreshInfoButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._RefreshInfoButton.Name = "_RefreshInfoButton"; - this._RefreshInfoButton.Size = new System.Drawing.Size(112, 22); - this._RefreshInfoButton.Text = "刷新文档属性"; - // - // _SelectionMenu - // - this._SelectionMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - _SelectAll, - _InvertSelect, - _SelectNone}); - this._SelectionMenu.Name = "_SelectionMenu"; - this._SelectionMenu.Size = new System.Drawing.Size(125, 70); - this._SelectionMenu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _SelectionMenuItem - // - this._SelectionMenuItem.DropDown = this._SelectionMenu; - this._SelectionMenuItem.Image = global::PDFPatcher.Properties.Resources.SelectItem; - this._SelectionMenuItem.Name = "_SelectionMenuItem"; - this._SelectionMenuItem.Size = new System.Drawing.Size(148, 22); - this._SelectionMenuItem.Text = "选择文件"; - // - // _ItemList - // - this._ItemList.AllColumns.Add(this._NameColumn); - this._ItemList.AllColumns.Add(this._PageCountColumn); - this._ItemList.AllColumns.Add(this._TitleColumn); - this._ItemList.AllColumns.Add(this._AuthorColumn); - this._ItemList.AllColumns.Add(this._SubjectColumn); - this._ItemList.AllColumns.Add(this._KeywordsColumn); - this._ItemList.AllColumns.Add(this._FolderColumn); - this._ItemList.AllColumns.Add(this._FileTimeColumn); - this._ItemList.AllowDrop = true; - this._ItemList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ItemList.CellEditActivation = BrightIdeasSoftware.ObjectListView.CellEditActivateMode.SingleClick; - this._ItemList.CellEditUseWholeCell = false; - this._ItemList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this._NameColumn, - this._PageCountColumn, - this._TitleColumn, - this._AuthorColumn, - this._SubjectColumn, - this._KeywordsColumn, - this._FolderColumn, - this._FileTimeColumn}); - this._ItemList.ContextMenuStrip = this._ItemListMenu; - this._ItemList.Cursor = System.Windows.Forms.Cursors.Default; - this._ItemList.GridLines = true; - this._ItemList.HideSelection = false; - this._ItemList.Location = new System.Drawing.Point(3, 3); - this._ItemList.Name = "_ItemList"; - this._ItemList.ShowGroups = false; - this._ItemList.Size = new System.Drawing.Size(544, 225); - this._ItemList.SmallImageList = this._FileTypeList; - this._ItemList.TabIndex = 0; - this._ItemList.UseCompatibleStateImageBehavior = false; - this._ItemList.View = System.Windows.Forms.View.Details; - this._ItemList.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this._ImageList_ColumnClick); - // - // _NameColumn - // - this._NameColumn.Text = "源文件名"; - this._NameColumn.Width = 149; - // - // _PageCountColumn - // - this._PageCountColumn.HeaderTextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._PageCountColumn.IsEditable = false; - this._PageCountColumn.Text = "页数"; - this._PageCountColumn.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._PageCountColumn.Width = 50; - // - // _TitleColumn - // - this._TitleColumn.Text = "标题"; - // - // _AuthorColumn - // - this._AuthorColumn.Text = "作者"; - // - // _SubjectColumn - // - this._SubjectColumn.Text = "主题"; - // - // _KeywordsColumn - // - this._KeywordsColumn.Text = "关键词"; - this._KeywordsColumn.Width = 73; - // - // _FolderColumn - // - this._FolderColumn.IsEditable = false; - this._FolderColumn.Text = "文件夹"; - this._FolderColumn.Width = 96; - // - // _FileTimeColumn - // - this._FileTimeColumn.IsEditable = false; - this._FileTimeColumn.Text = "修改时间"; - this._FileTimeColumn.Width = 145; - // - // _ItemListMenu - // - this._ItemListMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - _Copy, - _RefreshInfo, - this._SelectionMenuItem}); - this._ItemListMenu.Name = "_ItemListMenu"; - this._ItemListMenu.Size = new System.Drawing.Size(149, 70); - this._ItemListMenu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _FileTypeList - // - this._FileTypeList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; - this._FileTypeList.ImageSize = new System.Drawing.Size(16, 16); - this._FileTypeList.TransparentColor = System.Drawing.Color.Transparent; - // - // _OpenPdfBox - // - this._OpenPdfBox.DefaultExt = "pdf"; - this._OpenPdfBox.Filter = "PDF 文件(*.pdf)|*.pdf"; - this._OpenPdfBox.Multiselect = true; - this._OpenPdfBox.Title = "选择需要处理的 PDF 文件"; - // - // _AutoClearListBox - // - this._AutoClearListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._AutoClearListBox.AutoSize = true; - this._AutoClearListBox.Checked = true; - this._AutoClearListBox.CheckState = System.Windows.Forms.CheckState.Checked; - this._AutoClearListBox.Location = new System.Drawing.Point(434, 9); - this._AutoClearListBox.Name = "_AutoClearListBox"; - this._AutoClearListBox.Size = new System.Drawing.Size(132, 16); - this._AutoClearListBox.TabIndex = 4; - this._AutoClearListBox.Text = "添加文件前清空列表"; - this._AutoClearListBox.UseVisualStyleBackColor = true; - // - // _AddDocumentWorker - // - this._AddDocumentWorker.WorkerReportsProgress = true; - this._AddDocumentWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this._AddDocumentWorker_DoWork); - this._AddDocumentWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this._AddDocumentWorker_ProgressChanged); - this._AddDocumentWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this._AddDocumentWorker_RunWorkerCompleted); - // - // _TargetPdfFile - // - this._TargetPdfFile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._TargetPdfFile.Location = new System.Drawing.Point(13, 265); - this._TargetPdfFile.Margin = new System.Windows.Forms.Padding(4); - this._TargetPdfFile.Name = "_TargetPdfFile"; - this._TargetPdfFile.Size = new System.Drawing.Size(553, 26); - this._TargetPdfFile.TabIndex = 7; - // - // _ActionsBox - // - this._ActionsBox.AllColumns.Add(this._ActionNameColumn); - this._ActionsBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ActionsBox.CellEditUseWholeCell = false; - this._ActionsBox.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this._ActionNameColumn}); - this._ActionsBox.Cursor = System.Windows.Forms.Cursors.Default; - this._ActionsBox.FullRowSelect = true; - this._ActionsBox.GridLines = true; - this._ActionsBox.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this._ActionsBox.HideSelection = false; - this._ActionsBox.Location = new System.Drawing.Point(5, 3); - this._ActionsBox.Name = "_ActionsBox"; - this._ActionsBox.RowHeight = 18; - this._ActionsBox.ShowGroups = false; - this._ActionsBox.Size = new System.Drawing.Size(126, 176); - this._ActionsBox.TabIndex = 18; - this._ActionsBox.UseCompatibleStateImageBehavior = false; - this._ActionsBox.View = System.Windows.Forms.View.Details; - // - // _ActionNameColumn - // - this._ActionNameColumn.Text = "补丁操作"; - this._ActionNameColumn.Width = 120; - // - // _ItemActionsContainerBox - // - this._ItemActionsContainerBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ItemActionsContainerBox.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; - this._ItemActionsContainerBox.Location = new System.Drawing.Point(13, 28); - this._ItemActionsContainerBox.Name = "_ItemActionsContainerBox"; - // - // _ItemActionsContainerBox.Panel1 - // - this._ItemActionsContainerBox.Panel1.Controls.Add(this._ItemList); - // - // _ItemActionsContainerBox.Panel2 - // - this._ItemActionsContainerBox.Panel2.Controls.Add(this._ActionsBox); - this._ItemActionsContainerBox.Panel2Collapsed = true; - this._ItemActionsContainerBox.Size = new System.Drawing.Size(550, 231); - this._ItemActionsContainerBox.SplitterDistance = 412; - this._ItemActionsContainerBox.TabIndex = 5; - // - // _ConfigButton - // - this._ConfigButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._ConfigButton.Image = global::PDFPatcher.Properties.Resources.PdfOptions; - this._ConfigButton.Location = new System.Drawing.Point(253, 297); - this._ConfigButton.Name = "_ConfigButton"; - this._ConfigButton.Size = new System.Drawing.Size(181, 23); - this._ConfigButton.TabIndex = 11; - this._ConfigButton.Text = "设置 P&DF 文件的修改方式"; - this._ConfigButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._ConfigButton.UseVisualStyleBackColor = true; - // - // _ImportButton - // - this._ImportButton.AlternativeFocusBorderColor = System.Drawing.SystemColors.Highlight; - this._ImportButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._ImportButton.AnimateGlow = true; - this._ImportButton.BackColor = System.Drawing.SystemColors.Highlight; - this._ImportButton.CornerRadius = 3; - this._ImportButton.ForeColor = System.Drawing.SystemColors.ControlText; - this._ImportButton.GlowColor = System.Drawing.Color.White; - this._ImportButton.Image = global::PDFPatcher.Properties.Resources.Save; - this._ImportButton.InnerBorderColor = System.Drawing.SystemColors.ControlDarkDark; - this._ImportButton.Location = new System.Drawing.Point(440, 297); - this._ImportButton.Name = "_ImportButton"; - this._ImportButton.OuterBorderColor = System.Drawing.SystemColors.ControlLightLight; - this._ImportButton.ShowFocusBorder = true; - this._ImportButton.Size = new System.Drawing.Size(123, 29); - this._ImportButton.TabIndex = 12; - this._ImportButton.Text = "生成目标文件(&S)"; - this._ImportButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._ImportButton.Click += new System.EventHandler(this._ImportButton_Click); - // - // PatcherControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this._ImportButton); - this.Controls.Add(this._ConfigButton); - this.Controls.Add(this._MainToolbar); - this.Controls.Add(this._TargetPdfFile); - this.Controls.Add(this._ItemActionsContainerBox); - this.Controls.Add(this._AutoClearListBox); - this.Font = new System.Drawing.Font("SimSun", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.Name = "PatcherControl"; - this.Size = new System.Drawing.Size(575, 342); - this._SortMenu.ResumeLayout(false); - this._MainToolbar.ResumeLayout(false); - this._MainToolbar.PerformLayout(); - this._SelectionMenu.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this._ItemList)).EndInit(); - this._ItemListMenu.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this._ActionsBox)).EndInit(); - this._ItemActionsContainerBox.Panel1.ResumeLayout(false); - this._ItemActionsContainerBox.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this._ItemActionsContainerBox)).EndInit(); - this._ItemActionsContainerBox.ResumeLayout(false); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private BrightIdeasSoftware.ObjectListView _ItemList; - private BrightIdeasSoftware.OLVColumn _NameColumn; - private BrightIdeasSoftware.OLVColumn _FolderColumn; - private TargetFileControl _TargetPdfFile; - private System.Windows.Forms.ContextMenuStrip _SortMenu; - private System.Windows.Forms.ToolStripMenuItem _SortByNaturalNumberItem; - private System.Windows.Forms.ToolStripMenuItem _SortByAlphaItem; - private System.Windows.Forms.ContextMenuStrip _SelectionMenu; - private BrightIdeasSoftware.OLVColumn _PageCountColumn; - private System.Windows.Forms.ToolStripMenuItem _SelectionMenuItem; - private System.Windows.Forms.ContextMenuStrip _ItemListMenu; - private System.Windows.Forms.ContextMenuStrip _RecentFileMenu; - private System.Windows.Forms.OpenFileDialog _OpenPdfBox; - private System.Windows.Forms.CheckBox _AutoClearListBox; - private System.ComponentModel.BackgroundWorker _AddDocumentWorker; - private BrightIdeasSoftware.OLVColumn _TitleColumn; - private BrightIdeasSoftware.OLVColumn _AuthorColumn; - private BrightIdeasSoftware.OLVColumn _SubjectColumn; - private BrightIdeasSoftware.OLVColumn _KeywordsColumn; - private BrightIdeasSoftware.ObjectListView _ActionsBox; - private System.Windows.Forms.SplitContainer _ItemActionsContainerBox; - private BrightIdeasSoftware.OLVColumn _ActionNameColumn; - private System.Windows.Forms.ImageList _FileTypeList; - private System.Windows.Forms.ToolStripSplitButton _RefreshInfoButton; - private System.Windows.Forms.ContextMenuStrip _RefreshInfoMenu; - private System.Windows.Forms.Button _ConfigButton; - private EnhancedGlassButton.GlassButton _ImportButton; - private System.Windows.Forms.ToolStripSplitButton _AddFilesButton; - private BrightIdeasSoftware.OLVColumn _FileTimeColumn; - private System.Windows.Forms.ToolStrip _MainToolbar; - } -} diff --git a/pdfpatcher/App/Functions/PatcherControl.cs b/pdfpatcher/App/Functions/PatcherControl.cs deleted file mode 100644 index 9b421800771a3127e3fe6bcb89e2fe4c44ba1c14..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/PatcherControl.cs +++ /dev/null @@ -1,287 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.IO; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using BrightIdeasSoftware; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - [ToolboxItem(false)] - public partial class PatcherControl : FunctionControl - { - FileListHelper _listHelper; - - public override string FunctionName => "批量修改文档"; - - public override System.Drawing.Bitmap IconImage => Properties.Resources.DocumentProcessor; - - public override Button DefaultButton => _ImportButton; - - public PatcherControl() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - } - - void OnLoad() { - _MainToolbar.ScaleIcons(16); - _ItemListMenu.ScaleIcons(16); - _RecentFileMenu.ScaleIcons(16); - _RefreshInfoMenu.ScaleIcons(16); - _SelectionMenu.ScaleIcons(16); - _SortMenu.ScaleIcons(16); - - AppContext.MainForm.SetTooltip(_ConfigButton, "点击此处设置 PDF 文件的修改方式选项"); - AppContext.MainForm.SetTooltip(_ActionsBox, "双击项目编辑操作选项;右键点击项目弹出上下文菜单"); - AppContext.MainForm.SetTooltip(_ItemList, "在此添加需要补丁修改的 PDF 文件"); - AppContext.MainForm.SetTooltip(_ImportButton, "点击此按钮执行补丁生成新的 PDF 文件,该文件具有信息文件和 PDF 选项中的设定"); - AppContext.MainForm.SetTooltip(_TargetPdfFile.FileList, "生成的目标 PDF 文件路径(鼠标右键点击列表可插入文件名替代符)"); - _ItemList.EmptyListMsg = "请使用“添加文件”按钮添加需要处理的 PDF 文件,或从资源管理器拖放文件到本列表框"; - - _ConfigButton.Click += (s, args) => AppContext.MainForm.SelectFunctionList(Function.PatcherOptions); - - _AddFilesButton.ButtonClick += (s, args) => { ExecuteCommand(Commands.Open); }; - _AddFilesButton.DropDownOpening += FileListHelper.OpenPdfButtonDropDownOpeningHandler; - _AddFilesButton.DropDownItemClicked += (s, args) => { - _RecentFileMenu.Hide(); - ExecuteCommand(Commands.OpenFile, args.ClickedItem.ToolTipText); - }; - - _TargetPdfFile.FileMacroMenu.LoadStandardInfoMacros(); - _TargetPdfFile.FileMacroMenu.LoadStandardSourceFileMacros(); - _TargetPdfFile.BrowseForFile += FileControl_BrowseForFile; - _TargetPdfFile.TargetFileChangedByBrowseButton += (s, args) => { - int i; - var f = _TargetPdfFile.FileDialog.FileName; - if (_ItemList.Items.Count > 1 && (i = f.LastIndexOf(Path.DirectorySeparatorChar)) != -1) { - _TargetPdfFile.Text = String.Concat(f.Substring(0, i), Path.DirectorySeparatorChar, Constants.FileNameMacros.FileName, Path.GetExtension(f)); - args.Cancel = true; - } - }; - var fi = _FileTypeList.Images; - fi.AddRange(new System.Drawing.Image[] { - Properties.Resources.OriginalPdfFile - }); - - _ItemList.FixEditControlWidth(); - _ItemList.ScaleColumnWidths(); - _ItemList.ListViewItemSorter = new ListViewItemComparer(0); - _listHelper = new FileListHelper(_ItemList); - _listHelper.SetupHotkeys(); - _listHelper.SetupDragAndDrop(AddFiles); - FileListHelper.SetupCommonPdfColumns(_AuthorColumn, _KeywordsColumn, _SubjectColumn, _TitleColumn, _PageCountColumn, _NameColumn, _FolderColumn, _FileTimeColumn); - _RefreshInfoButton.ButtonClick += (s, args) => _listHelper.RefreshInfo(AppContext.Encodings.DocInfoEncoding); - _RefreshInfoButton.DropDown = _RefreshInfoMenu; - foreach (var item in Constants.Encoding.EncodingNames) { - _RefreshInfoMenu.Items.Add(item); - } - _RefreshInfoMenu.ItemClicked += (s, args) => { - _listHelper.RefreshInfo(ValueHelper.MapValue(args.ClickedItem.Text, Constants.Encoding.EncodingNames, Constants.Encoding.Encodings)); - }; - - RecentFileItemClicked = (s, args) => { - args.ClickedItem.Owner.Hide(); - AddFiles(new string[] { args.ClickedItem.ToolTipText }, true); - }; - } - - public override void ExecuteCommand(string commandName, params string[] parameters) { - if (commandName == Commands.Open) { - var b = _OpenPdfBox; - if (b.ShowDialog() == DialogResult.OK) { - AddFiles(b.FileNames, true); - } - } - else if (commandName == Commands.OpenFile) { - AddFiles(parameters, true); - } - else if (_listHelper.ProcessCommonMenuCommand(commandName) == false) { - base.ExecuteCommand(commandName, parameters); - } - } - - public override void SetupCommand(ToolStripItem item) { - var n = item.Name; - if (Commands.CommonSelectionCommands.Contains(n) || n == Commands.Delete) { - item.Enabled = _ItemList.GetItemCount() > 0 && _ItemList.Focused; - } - else if (n == Commands.Options) { - item.Text = "修改文档设置(&S)..."; - item.ToolTipText = "设置修改后的 PDF 文档"; - EnableCommand(item, true, true); - item.Tag = nameof(Function.PatcherOptions); - } - base.SetupCommand(item); - } - - void FileControl_BrowseForFile(object sender, EventArgs e) { - _listHelper.PrepareSourceFiles(); - } - - void AddFiles(string[] files, bool alertInvalidFiles) { - if (files == null || files.Length == 0) { - return; - } - if ((ModifierKeys & Keys.Control) != Keys.None || _AutoClearListBox.Checked) { - _ItemList.ClearObjects(); - } - if (files.Length > 3) { - AppContext.MainForm.Enabled = false; - } - if (files.Length == 0) { - return; - } - _AddDocumentWorker.RunWorkerAsync(files); - } - - void _ImportButton_Click(object sender, EventArgs e) { - var targetPdfFile = _TargetPdfFile.Text.Trim(); - if (String.IsNullOrEmpty(targetPdfFile) && String.IsNullOrEmpty(targetPdfFile = _TargetPdfFile.BrowseTargetFile())) { - Common.FormHelper.ErrorBox(Messages.TargetFileNotSpecified); - return; - } - //if (_mode == ProcessMode.Merge && Common.FileHelper.IsPathValid (targetPdfFile) == false) { - // Common.FormHelper.ErrorBox ("输出文件名无效。" + (Common.FileUtility.HasFileNameMacro (targetPdfFile) ? "\n制作 PDF 文件功能不支持替代符。" : String.Empty)); - // return; - //} - - var l = _ItemList.GetItemCount(); - if (l == 0) { - Common.FormHelper.InfoBox("请添加需要处理的 PDF 文件。"); - return; - } - var files = GetSourceItemList(); - _TargetPdfFile.FileList.AddHistoryItem(); - - AppContext.MainForm.ResetWorker(); - var worker = AppContext.MainForm.GetWorker(); - worker.DoWork += (dummy, arg) => { - var a = arg.Argument as object[]; - var t = a[0] as string; - if (files.Count > 1) { - string targetFolder = null; - var m = FileHelper.HasFileNameMacro(t); // 包含替换符 - if (m == false) { - targetFolder = Path.GetDirectoryName(t); - } - Tracker.SetTotalProgressGoal(files.Count); - foreach (var file in files) { - if (file.Type == SourceItem.ItemType.Pdf) { - // 确定信息文件名 - // 优先采用与输入文件同名的 XML 信息文件 - var f = new FilePath(FileHelper.CombinePath(file.FolderName, Path.ChangeExtension(file.FileName, Constants.FileExtensions.Xml))); - if (f.ExistsFile == false) { - // 次之采用与输入文件同名的 TXT 信息文件 - f = f.ChangeExtension(Constants.FileExtensions.Txt); - if (f.ExistsFile == false) { - // 次之采用同一个信息文件 - f = file.FilePath.ChangeExtension(Constants.FileExtensions.Xml); - if (f.ExistsFile == false) { - f = FilePath.Empty; - } - } - } - - Processor.Worker.PatchDocument(file as SourceItem.Pdf, - m ? t : FileHelper.CombinePath(targetFolder, file.FilePath.FileName), - f.ToString(), - AppContext.Importer, - AppContext.Patcher); - } - else { - Tracker.TraceMessage("输入文件不是 PDF 文件。"); - } - Tracker.IncrementTotalProgress(); - if (AppContext.Abort) { - return; - } - } - } - else { - if (files[0].Type != SourceItem.ItemType.Pdf) { - Tracker.TraceMessage("输入文件不是 PDF 文件。"); - return; - } - Processor.Worker.PatchDocument(files[0] as SourceItem.Pdf, - t, - a[1] as string, - AppContext.Importer, - AppContext.Patcher); - } - }; - worker.RunWorkerAsync(new object[] { targetPdfFile, null }); - } - - List GetSourceItemList() { - var l = _ItemList.GetItemCount(); - var files = new List(l); - for (int i = 0; i < l; i++) { - var item = _ItemList.GetModelObject(_ItemList.GetNthItemInDisplayOrder(i).Index) as SourceItem; - if (item.Type == SourceItem.ItemType.Pdf - && FileHelper.HasExtension(item.FilePath, Constants.FileExtensions.Pdf)) { - AppContext.RecentItems.AddHistoryItem(AppContext.Recent.SourcePdfFiles, item.FilePath.ToString()); - } - files.Add(item); - } - return files; - } - - void _SortMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { - switch (e.ClickedItem.Name) { - case "_SortByAlphaItem": - _ItemList.ListViewItemSorter = new ListViewItemComparer(0, false); - break; - case "_SortByNaturalNumberItem": - _ItemList.ListViewItemSorter = new ListViewItemComparer(0, true); - break; - } - } - - void _ImageList_ColumnClick(object sender, ColumnClickEventArgs e) { - var c = e.Column; - var ss = c == 0 || c == _PageCountColumn.Index; - var o = _ItemList.PrimarySortOrder == SortOrder.Ascending ? SortOrder.Descending : SortOrder.Ascending; - _ItemList.ListViewItemSorter = new ListViewItemComparer(e.Column, ss, o); - } - - void _MainToolbar_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { - _listHelper.ProcessCommonMenuCommand(e.ClickedItem.Name); - } - - #region AddDocumentWorker - void _AddDocumentWorker_DoWork(object sender, DoWorkEventArgs e) { - var files = e.Argument as string[]; - Array.ForEach(files, f => { - ((BackgroundWorker)sender).ReportProgress(0, f); - }); - } - - void _AddDocumentWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { - AppContext.MainForm.Enabled = true; - _listHelper.ResizeItemListColumns(); - } - - void _AddDocumentWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) { - var item = e.UserState as string; - AddItem(SourceItem.Create(item)); - } - - void AddItem(SourceItem item) { - if (item is SourceItem.Pdf) { - AddItems(new SourceItem[] { item }); - } - } - - void AddItems(System.Collections.ICollection items) { - var i = _ItemList.GetLastSelectedIndex(); - _ItemList.InsertObjects(++i, items); - _ItemList.SelectedIndex = --i + items.Count; - } - #endregion - - } -} diff --git a/pdfpatcher/App/Functions/PatcherControl.resx b/pdfpatcher/App/Functions/PatcherControl.resx deleted file mode 100644 index 821f117371473baa900d79f7f7b4d9333785691f..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/PatcherControl.resx +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - False - - - 135, 17 - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - 137, 56 - - - 495, 17 - - - 614, 17 - - - 240, 17 - - - 370, 17 - - - 17, 56 - - - 17, 17 - - - 750, 17 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/PatcherOptionForm.Designer.cs b/pdfpatcher/App/Functions/PatcherOptionForm.Designer.cs deleted file mode 100644 index 5c1e6346723dbe4ce876a8ba38508715bbe82f57..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/PatcherOptionForm.Designer.cs +++ /dev/null @@ -1,1049 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class PatcherOptionForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._PageSettingsPage = new System.Windows.Forms.TabPage(); - this._PageSettingsEditor = new PDFPatcher.Functions.PageSettingsEditor(); - this._MainTab = new System.Windows.Forms.TabControl(); - this._PageLayoutPage = new System.Windows.Forms.TabPage(); - this._MarginGroupBox = new System.Windows.Forms.GroupBox(); - this._MarginUnitBox = new System.Windows.Forms.ComboBox(); - this.label13 = new System.Windows.Forms.Label(); - this._SyncMarginsBox = new System.Windows.Forms.CheckBox(); - this._RightMarginBox = new System.Windows.Forms.NumericUpDown(); - this._LeftMarginBox = new System.Windows.Forms.NumericUpDown(); - this._BottomMarginBox = new System.Windows.Forms.NumericUpDown(); - this._TopMarginBox = new System.Windows.Forms.NumericUpDown(); - this.label7 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this._LayoutGroupBox = new System.Windows.Forms.GroupBox(); - this._ImageHAlignBox = new System.Windows.Forms.ComboBox(); - this.label8 = new System.Windows.Forms.Label(); - this._ImageVAlignBox = new System.Windows.Forms.ComboBox(); - this._ScalePdfPagesBox = new System.Windows.Forms.RadioButton(); - this._ResizePdfPagesBox = new System.Windows.Forms.RadioButton(); - this._HeightBox = new System.Windows.Forms.NumericUpDown(); - this._WidthBox = new System.Windows.Forms.NumericUpDown(); - this.label9 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this._PageSizeBox = new System.Windows.Forms.ComboBox(); - this._AutoRotateBox = new System.Windows.Forms.CheckBox(); - this.label5 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this._ViewerSettingsPage = new System.Windows.Forms.TabPage(); - this._ViewerSettingsEditor = new PDFPatcher.Functions.ViewerPreferenceEditor(); - this._CleanerPage = new System.Windows.Forms.TabPage(); - this.groupBox4 = new System.Windows.Forms.GroupBox(); - this.label12 = new System.Windows.Forms.Label(); - this.label11 = new System.Windows.Forms.Label(); - this._RemoveTrailingCommandCountBox = new System.Windows.Forms.NumericUpDown(); - this._RemoveLeadingCommandCountBox = new System.Windows.Forms.NumericUpDown(); - this.label10 = new System.Windows.Forms.Label(); - this._RemovePageFormsBox = new System.Windows.Forms.CheckBox(); - this._RemovePageThumbnailsBox = new System.Windows.Forms.CheckBox(); - this._RemovePageTextBlocksBox = new System.Windows.Forms.CheckBox(); - this._RemovePageLinksBox = new System.Windows.Forms.CheckBox(); - this._RemoveAnnotationsBox = new System.Windows.Forms.CheckBox(); - this._RemovePageAutoActionsBox = new System.Windows.Forms.CheckBox(); - this._RemovePageMetaDataBox = new System.Windows.Forms.CheckBox(); - this.groupBox3 = new System.Windows.Forms.GroupBox(); - this._RemoveBookmarksBox = new System.Windows.Forms.CheckBox(); - this._FixContentBox = new System.Windows.Forms.CheckBox(); - this._RemoveXmlMetaDataBox = new System.Windows.Forms.CheckBox(); - this._RemoveDocAutoActionsBox = new System.Windows.Forms.CheckBox(); - this._RemoveUsageRightsBox = new System.Windows.Forms.CheckBox(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this._RecompressWithJbig2Box = new System.Windows.Forms.CheckBox(); - this._FullCompressionBox = new System.Windows.Forms.CheckBox(); - this._DocumentInfoPage = new System.Windows.Forms.TabPage(); - this._DocumentInfoEditor = new PDFPatcher.Functions.DocumentInfoEditor(); - this._PageLabelsPage = new System.Windows.Forms.TabPage(); - this._PageLabelEditor = new PDFPatcher.Functions.PageLabelEditor(); - this._FontSubstitutionsPage = new System.Windows.Forms.TabPage(); - this._FontSubstitutionsEditor = new PDFPatcher.Functions.FontSubstitutionsEditor(); - this._ConfigPage = new System.Windows.Forms.TabPage(); - this._ExportButton = new System.Windows.Forms.Button(); - this._ImportButton = new System.Windows.Forms.Button(); - this._ResetButton = new System.Windows.Forms.Button(); - this._PageSettingsPage.SuspendLayout(); - this._MainTab.SuspendLayout(); - this._PageLayoutPage.SuspendLayout(); - this._MarginGroupBox.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._RightMarginBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this._LeftMarginBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this._BottomMarginBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this._TopMarginBox)).BeginInit(); - this._LayoutGroupBox.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._HeightBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this._WidthBox)).BeginInit(); - this._ViewerSettingsPage.SuspendLayout(); - this._CleanerPage.SuspendLayout(); - this.groupBox4.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._RemoveTrailingCommandCountBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this._RemoveLeadingCommandCountBox)).BeginInit(); - this.groupBox3.SuspendLayout(); - this.groupBox1.SuspendLayout(); - this._DocumentInfoPage.SuspendLayout(); - this._PageLabelsPage.SuspendLayout(); - this._FontSubstitutionsPage.SuspendLayout(); - this._ConfigPage.SuspendLayout(); - this.SuspendLayout(); - // - // _PageSettingsPage - // - this._PageSettingsPage.Controls.Add(this._PageSettingsEditor); - this._PageSettingsPage.Location = new System.Drawing.Point(4, 25); - this._PageSettingsPage.Margin = new System.Windows.Forms.Padding(4); - this._PageSettingsPage.Name = "_PageSettingsPage"; - this._PageSettingsPage.Padding = new System.Windows.Forms.Padding(4); - this._PageSettingsPage.Size = new System.Drawing.Size(595, 372); - this._PageSettingsPage.TabIndex = 6; - this._PageSettingsPage.Text = "页面设置"; - this._PageSettingsPage.UseVisualStyleBackColor = true; - // - // _PageSettingsEditor - // - this._PageSettingsEditor.Dock = System.Windows.Forms.DockStyle.Fill; - this._PageSettingsEditor.Location = new System.Drawing.Point(4, 4); - this._PageSettingsEditor.Margin = new System.Windows.Forms.Padding(5); - this._PageSettingsEditor.Name = "_PageSettingsEditor"; - this._PageSettingsEditor.Settings = null; - this._PageSettingsEditor.Size = new System.Drawing.Size(587, 364); - this._PageSettingsEditor.TabIndex = 0; - // - // _MainTab - // - this._MainTab.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._MainTab.Controls.Add(this._PageLayoutPage); - this._MainTab.Controls.Add(this._ViewerSettingsPage); - this._MainTab.Controls.Add(this._CleanerPage); - this._MainTab.Controls.Add(this._DocumentInfoPage); - this._MainTab.Controls.Add(this._PageLabelsPage); - this._MainTab.Controls.Add(this._PageSettingsPage); - this._MainTab.Controls.Add(this._FontSubstitutionsPage); - this._MainTab.Controls.Add(this._ConfigPage); - this._MainTab.Location = new System.Drawing.Point(16, 15); - this._MainTab.Margin = new System.Windows.Forms.Padding(4); - this._MainTab.Name = "_MainTab"; - this._MainTab.SelectedIndex = 0; - this._MainTab.Size = new System.Drawing.Size(603, 401); - this._MainTab.TabIndex = 1; - // - // _PageLayoutPage - // - this._PageLayoutPage.Controls.Add(this._MarginGroupBox); - this._PageLayoutPage.Controls.Add(this._LayoutGroupBox); - this._PageLayoutPage.Location = new System.Drawing.Point(4, 25); - this._PageLayoutPage.Margin = new System.Windows.Forms.Padding(4); - this._PageLayoutPage.Name = "_PageLayoutPage"; - this._PageLayoutPage.Padding = new System.Windows.Forms.Padding(4); - this._PageLayoutPage.Size = new System.Drawing.Size(595, 372); - this._PageLayoutPage.TabIndex = 8; - this._PageLayoutPage.Text = "页面尺寸"; - this._PageLayoutPage.UseVisualStyleBackColor = true; - // - // _MarginGroupBox - // - this._MarginGroupBox.Controls.Add(this._MarginUnitBox); - this._MarginGroupBox.Controls.Add(this.label13); - this._MarginGroupBox.Controls.Add(this._SyncMarginsBox); - this._MarginGroupBox.Controls.Add(this._RightMarginBox); - this._MarginGroupBox.Controls.Add(this._LeftMarginBox); - this._MarginGroupBox.Controls.Add(this._BottomMarginBox); - this._MarginGroupBox.Controls.Add(this._TopMarginBox); - this._MarginGroupBox.Controls.Add(this.label7); - this._MarginGroupBox.Controls.Add(this.label3); - this._MarginGroupBox.Controls.Add(this.label6); - this._MarginGroupBox.Controls.Add(this.label1); - this._MarginGroupBox.Location = new System.Drawing.Point(8, 171); - this._MarginGroupBox.Margin = new System.Windows.Forms.Padding(4); - this._MarginGroupBox.Name = "_MarginGroupBox"; - this._MarginGroupBox.Padding = new System.Windows.Forms.Padding(4); - this._MarginGroupBox.Size = new System.Drawing.Size(576, 90); - this._MarginGroupBox.TabIndex = 7; - this._MarginGroupBox.TabStop = false; - this._MarginGroupBox.Text = "调整页边留白"; - // - // _MarginUnitBox - // - this._MarginUnitBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._MarginUnitBox.FormattingEnabled = true; - this._MarginUnitBox.Items.AddRange(new object[] { - "厘米", - "相对原页面尺寸比例"}); - this._MarginUnitBox.Location = new System.Drawing.Point(71, 57); - this._MarginUnitBox.Name = "_MarginUnitBox"; - this._MarginUnitBox.Size = new System.Drawing.Size(215, 23); - this._MarginUnitBox.TabIndex = 12; - // - // label13 - // - this.label13.AutoSize = true; - this.label13.Location = new System.Drawing.Point(9, 60); - this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(52, 15); - this.label13.TabIndex = 11; - this.label13.Text = "单位:"; - // - // _SyncMarginsBox - // - this._SyncMarginsBox.AutoSize = true; - this._SyncMarginsBox.Location = new System.Drawing.Point(303, 59); - this._SyncMarginsBox.Margin = new System.Windows.Forms.Padding(4); - this._SyncMarginsBox.Name = "_SyncMarginsBox"; - this._SyncMarginsBox.Size = new System.Drawing.Size(149, 19); - this._SyncMarginsBox.TabIndex = 9; - this._SyncMarginsBox.Text = "同步调整四边留白"; - this._SyncMarginsBox.UseVisualStyleBackColor = true; - // - // _RightMarginBox - // - this._RightMarginBox.DecimalPlaces = 2; - this._RightMarginBox.Increment = new decimal(new int[] { - 1, - 0, - 0, - 65536}); - this._RightMarginBox.Location = new System.Drawing.Point(481, 25); - this._RightMarginBox.Margin = new System.Windows.Forms.Padding(4); - this._RightMarginBox.Maximum = new decimal(new int[] { - 99, - 0, - 0, - 0}); - this._RightMarginBox.Minimum = new decimal(new int[] { - 99, - 0, - 0, - -2147483648}); - this._RightMarginBox.Name = "_RightMarginBox"; - this._RightMarginBox.Size = new System.Drawing.Size(81, 25); - this._RightMarginBox.TabIndex = 8; - this._RightMarginBox.ValueChanged += new System.EventHandler(this.MarginBox_ValueChanged); - // - // _LeftMarginBox - // - this._LeftMarginBox.DecimalPlaces = 2; - this._LeftMarginBox.Increment = new decimal(new int[] { - 1, - 0, - 0, - 65536}); - this._LeftMarginBox.Location = new System.Drawing.Point(347, 25); - this._LeftMarginBox.Margin = new System.Windows.Forms.Padding(4); - this._LeftMarginBox.Maximum = new decimal(new int[] { - 99, - 0, - 0, - 0}); - this._LeftMarginBox.Minimum = new decimal(new int[] { - 99, - 0, - 0, - -2147483648}); - this._LeftMarginBox.Name = "_LeftMarginBox"; - this._LeftMarginBox.Size = new System.Drawing.Size(81, 25); - this._LeftMarginBox.TabIndex = 6; - this._LeftMarginBox.ValueChanged += new System.EventHandler(this.MarginBox_ValueChanged); - // - // _BottomMarginBox - // - this._BottomMarginBox.DecimalPlaces = 2; - this._BottomMarginBox.Increment = new decimal(new int[] { - 1, - 0, - 0, - 65536}); - this._BottomMarginBox.Location = new System.Drawing.Point(205, 25); - this._BottomMarginBox.Margin = new System.Windows.Forms.Padding(4); - this._BottomMarginBox.Maximum = new decimal(new int[] { - 99, - 0, - 0, - 0}); - this._BottomMarginBox.Minimum = new decimal(new int[] { - 99, - 0, - 0, - -2147483648}); - this._BottomMarginBox.Name = "_BottomMarginBox"; - this._BottomMarginBox.Size = new System.Drawing.Size(81, 25); - this._BottomMarginBox.TabIndex = 4; - this._BottomMarginBox.ValueChanged += new System.EventHandler(this.MarginBox_ValueChanged); - // - // _TopMarginBox - // - this._TopMarginBox.DecimalPlaces = 2; - this._TopMarginBox.Increment = new decimal(new int[] { - 1, - 0, - 0, - 65536}); - this._TopMarginBox.Location = new System.Drawing.Point(71, 25); - this._TopMarginBox.Margin = new System.Windows.Forms.Padding(4); - this._TopMarginBox.Maximum = new decimal(new int[] { - 99, - 0, - 0, - 0}); - this._TopMarginBox.Minimum = new decimal(new int[] { - 99, - 0, - 0, - -2147483648}); - this._TopMarginBox.Name = "_TopMarginBox"; - this._TopMarginBox.Size = new System.Drawing.Size(81, 25); - this._TopMarginBox.TabIndex = 2; - this._TopMarginBox.ValueChanged += new System.EventHandler(this.MarginBox_ValueChanged); - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(435, 29); - this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(37, 15); - this.label7.TabIndex = 7; - this.label7.Text = "右:"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(159, 28); - this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(37, 15); - this.label3.TabIndex = 3; - this.label3.Text = "下:"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(300, 29); - this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(37, 15); - this.label6.TabIndex = 5; - this.label6.Text = "左:"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(24, 29); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(37, 15); - this.label1.TabIndex = 1; - this.label1.Text = "上:"; - // - // _LayoutGroupBox - // - this._LayoutGroupBox.Controls.Add(this._ImageHAlignBox); - this._LayoutGroupBox.Controls.Add(this.label8); - this._LayoutGroupBox.Controls.Add(this._ImageVAlignBox); - this._LayoutGroupBox.Controls.Add(this._ScalePdfPagesBox); - this._LayoutGroupBox.Controls.Add(this._ResizePdfPagesBox); - this._LayoutGroupBox.Controls.Add(this._HeightBox); - this._LayoutGroupBox.Controls.Add(this._WidthBox); - this._LayoutGroupBox.Controls.Add(this.label9); - this._LayoutGroupBox.Controls.Add(this.label2); - this._LayoutGroupBox.Controls.Add(this._PageSizeBox); - this._LayoutGroupBox.Controls.Add(this._AutoRotateBox); - this._LayoutGroupBox.Controls.Add(this.label5); - this._LayoutGroupBox.Controls.Add(this.label4); - this._LayoutGroupBox.Location = new System.Drawing.Point(8, 8); - this._LayoutGroupBox.Margin = new System.Windows.Forms.Padding(4); - this._LayoutGroupBox.Name = "_LayoutGroupBox"; - this._LayoutGroupBox.Padding = new System.Windows.Forms.Padding(4); - this._LayoutGroupBox.Size = new System.Drawing.Size(576, 156); - this._LayoutGroupBox.TabIndex = 6; - this._LayoutGroupBox.TabStop = false; - this._LayoutGroupBox.Text = "指定页面布局及尺寸(单位:厘米)"; - // - // _ImageHAlignBox - // - this._ImageHAlignBox.DisplayMember = "Key"; - this._ImageHAlignBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._ImageHAlignBox.Location = new System.Drawing.Point(71, 116); - this._ImageHAlignBox.Margin = new System.Windows.Forms.Padding(4); - this._ImageHAlignBox.Name = "_ImageHAlignBox"; - this._ImageHAlignBox.Size = new System.Drawing.Size(100, 23); - this._ImageHAlignBox.TabIndex = 13; - this._ImageHAlignBox.ValueMember = "Value"; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(8, 120); - this.label8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(52, 15); - this.label8.TabIndex = 12; - this.label8.Text = "方位:"; - // - // _ImageVAlignBox - // - this._ImageVAlignBox.DisplayMember = "Key"; - this._ImageVAlignBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._ImageVAlignBox.Location = new System.Drawing.Point(185, 116); - this._ImageVAlignBox.Margin = new System.Windows.Forms.Padding(4); - this._ImageVAlignBox.Name = "_ImageVAlignBox"; - this._ImageVAlignBox.Size = new System.Drawing.Size(100, 23); - this._ImageVAlignBox.TabIndex = 14; - this._ImageVAlignBox.ValueMember = "Value"; - // - // _ScalePdfPagesBox - // - this._ScalePdfPagesBox.AutoSize = true; - this._ScalePdfPagesBox.CheckAlign = System.Drawing.ContentAlignment.TopLeft; - this._ScalePdfPagesBox.Location = new System.Drawing.Point(185, 89); - this._ScalePdfPagesBox.Margin = new System.Windows.Forms.Padding(4); - this._ScalePdfPagesBox.Name = "_ScalePdfPagesBox"; - this._ScalePdfPagesBox.Size = new System.Drawing.Size(178, 19); - this._ScalePdfPagesBox.TabIndex = 11; - this._ScalePdfPagesBox.TabStop = true; - this._ScalePdfPagesBox.Text = "按比例缩放至页面边缘"; - this._ScalePdfPagesBox.UseVisualStyleBackColor = true; - // - // _ResizePdfPagesBox - // - this._ResizePdfPagesBox.AutoSize = true; - this._ResizePdfPagesBox.Location = new System.Drawing.Point(71, 89); - this._ResizePdfPagesBox.Margin = new System.Windows.Forms.Padding(4); - this._ResizePdfPagesBox.Name = "_ResizePdfPagesBox"; - this._ResizePdfPagesBox.Size = new System.Drawing.Size(88, 19); - this._ResizePdfPagesBox.TabIndex = 10; - this._ResizePdfPagesBox.Text = "保持不变"; - this._ResizePdfPagesBox.UseVisualStyleBackColor = true; - // - // _HeightBox - // - this._HeightBox.DecimalPlaces = 2; - this._HeightBox.Increment = new decimal(new int[] { - 1, - 0, - 0, - 65536}); - this._HeightBox.Location = new System.Drawing.Point(481, 21); - this._HeightBox.Margin = new System.Windows.Forms.Padding(4); - this._HeightBox.Maximum = new decimal(new int[] { - 999, - 0, - 0, - 0}); - this._HeightBox.Name = "_HeightBox"; - this._HeightBox.Size = new System.Drawing.Size(81, 25); - this._HeightBox.TabIndex = 5; - // - // _WidthBox - // - this._WidthBox.DecimalPlaces = 2; - this._WidthBox.Increment = new decimal(new int[] { - 1, - 0, - 0, - 65536}); - this._WidthBox.Location = new System.Drawing.Point(347, 21); - this._WidthBox.Margin = new System.Windows.Forms.Padding(4); - this._WidthBox.Maximum = new decimal(new int[] { - 999, - 0, - 0, - 0}); - this._WidthBox.Name = "_WidthBox"; - this._WidthBox.Size = new System.Drawing.Size(81, 25); - this._WidthBox.TabIndex = 3; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(8, 91); - this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(52, 15); - this.label9.TabIndex = 0; - this.label9.Text = "内容:"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(8, 26); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(52, 15); - this.label2.TabIndex = 0; - this.label2.Text = "尺寸:"; - // - // _PageSizeBox - // - this._PageSizeBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._PageSizeBox.Location = new System.Drawing.Point(71, 22); - this._PageSizeBox.Margin = new System.Windows.Forms.Padding(4); - this._PageSizeBox.Name = "_PageSizeBox"; - this._PageSizeBox.Size = new System.Drawing.Size(215, 23); - this._PageSizeBox.TabIndex = 1; - this._PageSizeBox.SelectedIndexChanged += new System.EventHandler(this._PageSizeBox_SelectedIndexChanged); - // - // _AutoRotateBox - // - this._AutoRotateBox.AutoSize = true; - this._AutoRotateBox.Checked = true; - this._AutoRotateBox.CheckState = System.Windows.Forms.CheckState.Checked; - this._AutoRotateBox.Location = new System.Drawing.Point(71, 55); - this._AutoRotateBox.Margin = new System.Windows.Forms.Padding(4); - this._AutoRotateBox.Name = "_AutoRotateBox"; - this._AutoRotateBox.Size = new System.Drawing.Size(179, 19); - this._AutoRotateBox.TabIndex = 6; - this._AutoRotateBox.Text = "适应原始内容纵横方向"; - this._AutoRotateBox.UseVisualStyleBackColor = true; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(436, 26); - this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(37, 15); - this.label5.TabIndex = 4; - this.label5.Text = "高:"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(300, 26); - this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(37, 15); - this.label4.TabIndex = 2; - this.label4.Text = "宽:"; - // - // _ViewerSettingsPage - // - this._ViewerSettingsPage.Controls.Add(this._ViewerSettingsEditor); - this._ViewerSettingsPage.Location = new System.Drawing.Point(4, 25); - this._ViewerSettingsPage.Margin = new System.Windows.Forms.Padding(4); - this._ViewerSettingsPage.Name = "_ViewerSettingsPage"; - this._ViewerSettingsPage.Padding = new System.Windows.Forms.Padding(4); - this._ViewerSettingsPage.Size = new System.Drawing.Size(595, 372); - this._ViewerSettingsPage.TabIndex = 4; - this._ViewerSettingsPage.Text = "阅读方式"; - this._ViewerSettingsPage.UseVisualStyleBackColor = true; - // - // _ViewerSettingsEditor - // - this._ViewerSettingsEditor.Location = new System.Drawing.Point(0, 0); - this._ViewerSettingsEditor.Margin = new System.Windows.Forms.Padding(5); - this._ViewerSettingsEditor.Name = "_ViewerSettingsEditor"; - this._ViewerSettingsEditor.Size = new System.Drawing.Size(584, 349); - this._ViewerSettingsEditor.TabIndex = 0; - // - // _CleanerPage - // - this._CleanerPage.Controls.Add(this.groupBox4); - this._CleanerPage.Controls.Add(this.groupBox3); - this._CleanerPage.Controls.Add(this.groupBox1); - this._CleanerPage.Location = new System.Drawing.Point(4, 25); - this._CleanerPage.Margin = new System.Windows.Forms.Padding(4); - this._CleanerPage.Name = "_CleanerPage"; - this._CleanerPage.Padding = new System.Windows.Forms.Padding(4); - this._CleanerPage.Size = new System.Drawing.Size(595, 372); - this._CleanerPage.TabIndex = 5; - this._CleanerPage.Text = "压缩清理"; - this._CleanerPage.UseVisualStyleBackColor = true; - // - // groupBox4 - // - this.groupBox4.Controls.Add(this.label12); - this.groupBox4.Controls.Add(this.label11); - this.groupBox4.Controls.Add(this._RemoveTrailingCommandCountBox); - this.groupBox4.Controls.Add(this._RemoveLeadingCommandCountBox); - this.groupBox4.Controls.Add(this.label10); - this.groupBox4.Controls.Add(this._RemovePageFormsBox); - this.groupBox4.Controls.Add(this._RemovePageThumbnailsBox); - this.groupBox4.Controls.Add(this._RemovePageTextBlocksBox); - this.groupBox4.Controls.Add(this._RemovePageLinksBox); - this.groupBox4.Controls.Add(this._RemoveAnnotationsBox); - this.groupBox4.Controls.Add(this._RemovePageAutoActionsBox); - this.groupBox4.Controls.Add(this._RemovePageMetaDataBox); - this.groupBox4.Location = new System.Drawing.Point(8, 131); - this.groupBox4.Margin = new System.Windows.Forms.Padding(4); - this.groupBox4.Name = "groupBox4"; - this.groupBox4.Padding = new System.Windows.Forms.Padding(4); - this.groupBox4.Size = new System.Drawing.Size(576, 166); - this.groupBox4.TabIndex = 1; - this.groupBox4.TabStop = false; - this.groupBox4.Text = "源文档页面"; - // - // label12 - // - this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(296, 134); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(52, 15); - this.label12.TabIndex = 10; - this.label12.Text = "条指令"; - // - // label11 - // - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(190, 134); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(37, 15); - this.label11.TabIndex = 9; - this.label11.Text = "结尾"; - // - // _RemoveTrailingCommandCountBox - // - this._RemoveTrailingCommandCountBox.Location = new System.Drawing.Point(233, 132); - this._RemoveTrailingCommandCountBox.Name = "_RemoveTrailingCommandCountBox"; - this._RemoveTrailingCommandCountBox.Size = new System.Drawing.Size(51, 25); - this._RemoveTrailingCommandCountBox.TabIndex = 8; - // - // _RemoveLeadingCommandCountBox - // - this._RemoveLeadingCommandCountBox.Location = new System.Drawing.Point(118, 132); - this._RemoveLeadingCommandCountBox.Name = "_RemoveLeadingCommandCountBox"; - this._RemoveLeadingCommandCountBox.Size = new System.Drawing.Size(51, 25); - this._RemoveLeadingCommandCountBox.TabIndex = 8; - // - // label10 - // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(7, 134); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(105, 15); - this.label10.TabIndex = 7; - this.label10.Text = "清除页面开头 "; - // - // _RemovePageFormsBox - // - this._RemovePageFormsBox.AutoSize = true; - this._RemovePageFormsBox.Location = new System.Drawing.Point(299, 52); - this._RemovePageFormsBox.Name = "_RemovePageFormsBox"; - this._RemovePageFormsBox.Size = new System.Drawing.Size(149, 19); - this._RemovePageFormsBox.TabIndex = 3; - this._RemovePageFormsBox.Text = "清除页面所有表单"; - this._RemovePageFormsBox.UseVisualStyleBackColor = true; - // - // _RemovePageThumbnailsBox - // - this._RemovePageThumbnailsBox.AutoSize = true; - this._RemovePageThumbnailsBox.Location = new System.Drawing.Point(8, 52); - this._RemovePageThumbnailsBox.Margin = new System.Windows.Forms.Padding(4); - this._RemovePageThumbnailsBox.Name = "_RemovePageThumbnailsBox"; - this._RemovePageThumbnailsBox.Size = new System.Drawing.Size(134, 19); - this._RemovePageThumbnailsBox.TabIndex = 2; - this._RemovePageThumbnailsBox.Text = "清除页面缩略图"; - this._RemovePageThumbnailsBox.UseVisualStyleBackColor = true; - // - // _RemovePageTextBlocksBox - // - this._RemovePageTextBlocksBox.AutoSize = true; - this._RemovePageTextBlocksBox.Location = new System.Drawing.Point(8, 106); - this._RemovePageTextBlocksBox.Margin = new System.Windows.Forms.Padding(4); - this._RemovePageTextBlocksBox.Name = "_RemovePageTextBlocksBox"; - this._RemovePageTextBlocksBox.Size = new System.Drawing.Size(149, 19); - this._RemovePageTextBlocksBox.TabIndex = 6; - this._RemovePageTextBlocksBox.Text = "清除页面所有文本"; - this._RemovePageTextBlocksBox.UseVisualStyleBackColor = true; - // - // _RemovePageLinksBox - // - this._RemovePageLinksBox.AutoSize = true; - this._RemovePageLinksBox.Location = new System.Drawing.Point(299, 77); - this._RemovePageLinksBox.Margin = new System.Windows.Forms.Padding(4); - this._RemovePageLinksBox.Name = "_RemovePageLinksBox"; - this._RemovePageLinksBox.Size = new System.Drawing.Size(179, 19); - this._RemovePageLinksBox.TabIndex = 5; - this._RemovePageLinksBox.Text = "清除页面所有链接批注"; - this._RemovePageLinksBox.UseVisualStyleBackColor = true; - // - // _RemoveAnnotationsBox - // - this._RemoveAnnotationsBox.AutoSize = true; - this._RemoveAnnotationsBox.Location = new System.Drawing.Point(8, 79); - this._RemoveAnnotationsBox.Margin = new System.Windows.Forms.Padding(4); - this._RemoveAnnotationsBox.Name = "_RemoveAnnotationsBox"; - this._RemoveAnnotationsBox.Size = new System.Drawing.Size(149, 19); - this._RemoveAnnotationsBox.TabIndex = 4; - this._RemoveAnnotationsBox.Text = "清除页面所有批注"; - this._RemoveAnnotationsBox.UseVisualStyleBackColor = true; - // - // _RemovePageAutoActionsBox - // - this._RemovePageAutoActionsBox.AutoSize = true; - this._RemovePageAutoActionsBox.Location = new System.Drawing.Point(8, 25); - this._RemovePageAutoActionsBox.Margin = new System.Windows.Forms.Padding(4); - this._RemovePageAutoActionsBox.Name = "_RemovePageAutoActionsBox"; - this._RemovePageAutoActionsBox.Size = new System.Drawing.Size(179, 19); - this._RemovePageAutoActionsBox.TabIndex = 0; - this._RemovePageAutoActionsBox.Text = "禁止页面自动执行动作"; - this._RemovePageAutoActionsBox.UseVisualStyleBackColor = true; - // - // _RemovePageMetaDataBox - // - this._RemovePageMetaDataBox.AutoSize = true; - this._RemovePageMetaDataBox.Location = new System.Drawing.Point(299, 25); - this._RemovePageMetaDataBox.Margin = new System.Windows.Forms.Padding(4); - this._RemovePageMetaDataBox.Name = "_RemovePageMetaDataBox"; - this._RemovePageMetaDataBox.Size = new System.Drawing.Size(248, 19); - this._RemovePageMetaDataBox.TabIndex = 1; - this._RemovePageMetaDataBox.Text = "删除页面扩展标记(XML)元数据"; - this._RemovePageMetaDataBox.UseVisualStyleBackColor = true; - // - // groupBox3 - // - this.groupBox3.Controls.Add(this._RemoveBookmarksBox); - this.groupBox3.Controls.Add(this._FixContentBox); - this.groupBox3.Controls.Add(this._RemoveXmlMetaDataBox); - this.groupBox3.Controls.Add(this._RemoveDocAutoActionsBox); - this.groupBox3.Controls.Add(this._RemoveUsageRightsBox); - this.groupBox3.Location = new System.Drawing.Point(8, 8); - this.groupBox3.Margin = new System.Windows.Forms.Padding(4); - this.groupBox3.Name = "groupBox3"; - this.groupBox3.Padding = new System.Windows.Forms.Padding(4); - this.groupBox3.Size = new System.Drawing.Size(576, 116); - this.groupBox3.TabIndex = 0; - this.groupBox3.TabStop = false; - this.groupBox3.Text = "源文档"; - // - // _RemoveBookmarksBox - // - this._RemoveBookmarksBox.AutoSize = true; - this._RemoveBookmarksBox.Location = new System.Drawing.Point(8, 80); - this._RemoveBookmarksBox.Margin = new System.Windows.Forms.Padding(4); - this._RemoveBookmarksBox.Name = "_RemoveBookmarksBox"; - this._RemoveBookmarksBox.Size = new System.Drawing.Size(119, 19); - this._RemoveBookmarksBox.TabIndex = 4; - this._RemoveBookmarksBox.Text = "删除导航书签"; - this._RemoveBookmarksBox.UseVisualStyleBackColor = true; - // - // _FixContentBox - // - this._FixContentBox.AutoSize = true; - this._FixContentBox.Location = new System.Drawing.Point(299, 52); - this._FixContentBox.Margin = new System.Windows.Forms.Padding(4); - this._FixContentBox.Name = "_FixContentBox"; - this._FixContentBox.Size = new System.Drawing.Size(149, 19); - this._FixContentBox.TabIndex = 3; - this._FixContentBox.Text = "尝试修复文档错误"; - this._FixContentBox.UseVisualStyleBackColor = true; - // - // _RemoveXmlMetaDataBox - // - this._RemoveXmlMetaDataBox.AutoSize = true; - this._RemoveXmlMetaDataBox.Location = new System.Drawing.Point(299, 25); - this._RemoveXmlMetaDataBox.Margin = new System.Windows.Forms.Padding(4); - this._RemoveXmlMetaDataBox.Name = "_RemoveXmlMetaDataBox"; - this._RemoveXmlMetaDataBox.Size = new System.Drawing.Size(248, 19); - this._RemoveXmlMetaDataBox.TabIndex = 1; - this._RemoveXmlMetaDataBox.Text = "删除扩展标记(XML)元数据属性"; - this._RemoveXmlMetaDataBox.UseVisualStyleBackColor = true; - // - // _RemoveDocAutoActionsBox - // - this._RemoveDocAutoActionsBox.AutoSize = true; - this._RemoveDocAutoActionsBox.Location = new System.Drawing.Point(8, 52); - this._RemoveDocAutoActionsBox.Margin = new System.Windows.Forms.Padding(4); - this._RemoveDocAutoActionsBox.Name = "_RemoveDocAutoActionsBox"; - this._RemoveDocAutoActionsBox.Size = new System.Drawing.Size(224, 19); - this._RemoveDocAutoActionsBox.TabIndex = 2; - this._RemoveDocAutoActionsBox.Text = "禁止打开文档时自动执行动作"; - this._RemoveDocAutoActionsBox.UseVisualStyleBackColor = true; - // - // _RemoveUsageRightsBox - // - this._RemoveUsageRightsBox.AutoSize = true; - this._RemoveUsageRightsBox.Location = new System.Drawing.Point(8, 25); - this._RemoveUsageRightsBox.Margin = new System.Windows.Forms.Padding(4); - this._RemoveUsageRightsBox.Name = "_RemoveUsageRightsBox"; - this._RemoveUsageRightsBox.Size = new System.Drawing.Size(179, 19); - this._RemoveUsageRightsBox.TabIndex = 0; - this._RemoveUsageRightsBox.Text = "清除复制、打印等限制"; - this._RemoveUsageRightsBox.UseVisualStyleBackColor = true; - // - // groupBox1 - // - this.groupBox1.Controls.Add(this._RecompressWithJbig2Box); - this.groupBox1.Controls.Add(this._FullCompressionBox); - this.groupBox1.Location = new System.Drawing.Point(8, 305); - this.groupBox1.Margin = new System.Windows.Forms.Padding(4); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Padding = new System.Windows.Forms.Padding(4); - this.groupBox1.Size = new System.Drawing.Size(576, 54); - this.groupBox1.TabIndex = 2; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "内容压缩"; - // - // _RecompressWithJbig2Box - // - this._RecompressWithJbig2Box.AutoSize = true; - this._RecompressWithJbig2Box.Location = new System.Drawing.Point(299, 25); - this._RecompressWithJbig2Box.Margin = new System.Windows.Forms.Padding(4); - this._RecompressWithJbig2Box.Name = "_RecompressWithJbig2Box"; - this._RecompressWithJbig2Box.Size = new System.Drawing.Size(164, 19); - this._RecompressWithJbig2Box.TabIndex = 1; - this._RecompressWithJbig2Box.Text = "优化黑白图片压缩率"; - this._RecompressWithJbig2Box.UseVisualStyleBackColor = true; - // - // _FullCompressionBox - // - this._FullCompressionBox.AutoSize = true; - this._FullCompressionBox.Location = new System.Drawing.Point(8, 25); - this._FullCompressionBox.Margin = new System.Windows.Forms.Padding(4); - this._FullCompressionBox.Name = "_FullCompressionBox"; - this._FullCompressionBox.Size = new System.Drawing.Size(149, 19); - this._FullCompressionBox.TabIndex = 0; - this._FullCompressionBox.Text = "压缩索引表和书签"; - this._FullCompressionBox.UseVisualStyleBackColor = true; - // - // _DocumentInfoPage - // - this._DocumentInfoPage.Controls.Add(this._DocumentInfoEditor); - this._DocumentInfoPage.Location = new System.Drawing.Point(4, 25); - this._DocumentInfoPage.Margin = new System.Windows.Forms.Padding(4); - this._DocumentInfoPage.Name = "_DocumentInfoPage"; - this._DocumentInfoPage.Padding = new System.Windows.Forms.Padding(4); - this._DocumentInfoPage.Size = new System.Drawing.Size(595, 372); - this._DocumentInfoPage.TabIndex = 2; - this._DocumentInfoPage.Text = "文档属性"; - this._DocumentInfoPage.UseVisualStyleBackColor = true; - // - // _DocumentInfoEditor - // - this._DocumentInfoEditor.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._DocumentInfoEditor.Location = new System.Drawing.Point(0, 0); - this._DocumentInfoEditor.Margin = new System.Windows.Forms.Padding(5); - this._DocumentInfoEditor.Name = "_DocumentInfoEditor"; - this._DocumentInfoEditor.Size = new System.Drawing.Size(585, 368); - this._DocumentInfoEditor.TabIndex = 0; - // - // _PageLabelsPage - // - this._PageLabelsPage.Controls.Add(this._PageLabelEditor); - this._PageLabelsPage.Location = new System.Drawing.Point(4, 25); - this._PageLabelsPage.Margin = new System.Windows.Forms.Padding(4); - this._PageLabelsPage.Name = "_PageLabelsPage"; - this._PageLabelsPage.Padding = new System.Windows.Forms.Padding(4); - this._PageLabelsPage.Size = new System.Drawing.Size(595, 372); - this._PageLabelsPage.TabIndex = 3; - this._PageLabelsPage.Text = "页码标签"; - this._PageLabelsPage.UseVisualStyleBackColor = true; - // - // _PageLabelEditor - // - this._PageLabelEditor.Dock = System.Windows.Forms.DockStyle.Fill; - this._PageLabelEditor.Labels = null; - this._PageLabelEditor.Location = new System.Drawing.Point(4, 4); - this._PageLabelEditor.Margin = new System.Windows.Forms.Padding(5); - this._PageLabelEditor.Name = "_PageLabelEditor"; - this._PageLabelEditor.Size = new System.Drawing.Size(587, 364); - this._PageLabelEditor.TabIndex = 0; - // - // _FontSubstitutionsPage - // - this._FontSubstitutionsPage.Controls.Add(this._FontSubstitutionsEditor); - this._FontSubstitutionsPage.Location = new System.Drawing.Point(4, 25); - this._FontSubstitutionsPage.Margin = new System.Windows.Forms.Padding(4); - this._FontSubstitutionsPage.Name = "_FontSubstitutionsPage"; - this._FontSubstitutionsPage.Padding = new System.Windows.Forms.Padding(4); - this._FontSubstitutionsPage.Size = new System.Drawing.Size(595, 372); - this._FontSubstitutionsPage.TabIndex = 7; - this._FontSubstitutionsPage.Text = "替换字体"; - this._FontSubstitutionsPage.UseVisualStyleBackColor = true; - // - // _FontSubstitutionsEditor - // - this._FontSubstitutionsEditor.Dock = System.Windows.Forms.DockStyle.Fill; - this._FontSubstitutionsEditor.Location = new System.Drawing.Point(4, 4); - this._FontSubstitutionsEditor.Margin = new System.Windows.Forms.Padding(5); - this._FontSubstitutionsEditor.Name = "_FontSubstitutionsEditor"; - this._FontSubstitutionsEditor.Options = null; - this._FontSubstitutionsEditor.Size = new System.Drawing.Size(587, 364); - this._FontSubstitutionsEditor.Substitutions = null; - this._FontSubstitutionsEditor.TabIndex = 0; - // - // _ConfigPage - // - this._ConfigPage.Controls.Add(this._ResetButton); - this._ConfigPage.Controls.Add(this._ImportButton); - this._ConfigPage.Controls.Add(this._ExportButton); - this._ConfigPage.Location = new System.Drawing.Point(4, 25); - this._ConfigPage.Name = "_ConfigPage"; - this._ConfigPage.Padding = new System.Windows.Forms.Padding(3); - this._ConfigPage.Size = new System.Drawing.Size(595, 372); - this._ConfigPage.TabIndex = 9; - this._ConfigPage.Text = "其它"; - this._ConfigPage.UseVisualStyleBackColor = true; - // - // _ExportButton - // - this._ExportButton.Location = new System.Drawing.Point(30, 22); - this._ExportButton.Name = "_ExportButton"; - this._ExportButton.Size = new System.Drawing.Size(185, 23); - this._ExportButton.TabIndex = 0; - this._ExportButton.Text = "导出选项配置文件..."; - this._ExportButton.UseVisualStyleBackColor = true; - // - // _ImportButton - // - this._ImportButton.Location = new System.Drawing.Point(30, 51); - this._ImportButton.Name = "_ImportButton"; - this._ImportButton.Size = new System.Drawing.Size(185, 23); - this._ImportButton.TabIndex = 0; - this._ImportButton.Text = "导入选项配置文件..."; - this._ImportButton.UseVisualStyleBackColor = true; - // - // _ResetButton - // - this._ResetButton.Location = new System.Drawing.Point(30, 80); - this._ResetButton.Name = "_ResetButton"; - this._ResetButton.Size = new System.Drawing.Size(185, 23); - this._ResetButton.TabIndex = 0; - this._ResetButton.Text = "还原选项为默认值"; - this._ResetButton.UseVisualStyleBackColor = true; - // - // PatcherOptionForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(635, 435); - this.Controls.Add(this._MainTab); - this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.Margin = new System.Windows.Forms.Padding(4); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(637, 458); - this.Name = "PatcherOptionForm"; - this.ShowInTaskbar = false; - this.Text = "PDF 文档选项"; - this._PageSettingsPage.ResumeLayout(false); - this._MainTab.ResumeLayout(false); - this._PageLayoutPage.ResumeLayout(false); - this._MarginGroupBox.ResumeLayout(false); - this._MarginGroupBox.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this._RightMarginBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this._LeftMarginBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this._BottomMarginBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this._TopMarginBox)).EndInit(); - this._LayoutGroupBox.ResumeLayout(false); - this._LayoutGroupBox.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this._HeightBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this._WidthBox)).EndInit(); - this._ViewerSettingsPage.ResumeLayout(false); - this._CleanerPage.ResumeLayout(false); - this.groupBox4.ResumeLayout(false); - this.groupBox4.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this._RemoveTrailingCommandCountBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this._RemoveLeadingCommandCountBox)).EndInit(); - this.groupBox3.ResumeLayout(false); - this.groupBox3.PerformLayout(); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this._DocumentInfoPage.ResumeLayout(false); - this._PageLabelsPage.ResumeLayout(false); - this._FontSubstitutionsPage.ResumeLayout(false); - this._ConfigPage.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.TabControl _MainTab; - private System.Windows.Forms.TabPage _DocumentInfoPage; - private PDFPatcher.Functions.DocumentInfoEditor _DocumentInfoEditor; - private System.Windows.Forms.TabPage _PageLabelsPage; - private PDFPatcher.Functions.PageLabelEditor _PageLabelEditor; - private System.Windows.Forms.TabPage _ViewerSettingsPage; - private PDFPatcher.Functions.ViewerPreferenceEditor _ViewerSettingsEditor; - private System.Windows.Forms.TabPage _CleanerPage; - private System.Windows.Forms.GroupBox groupBox3; - private System.Windows.Forms.CheckBox _FixContentBox; - private System.Windows.Forms.CheckBox _RemoveXmlMetaDataBox; - private System.Windows.Forms.CheckBox _RemoveDocAutoActionsBox; - private System.Windows.Forms.CheckBox _RemoveUsageRightsBox; - private System.Windows.Forms.GroupBox groupBox4; - private System.Windows.Forms.CheckBox _RemoveAnnotationsBox; - private System.Windows.Forms.CheckBox _RemovePageAutoActionsBox; - private System.Windows.Forms.CheckBox _RemovePageMetaDataBox; - private System.Windows.Forms.CheckBox _RemovePageTextBlocksBox; - private System.Windows.Forms.CheckBox _RemoveBookmarksBox; - private PageSettingsEditor _PageSettingsEditor; - private System.Windows.Forms.CheckBox _RemovePageThumbnailsBox; - private System.Windows.Forms.TabPage _FontSubstitutionsPage; - private FontSubstitutionsEditor _FontSubstitutionsEditor; - private System.Windows.Forms.TabPage _PageSettingsPage; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.CheckBox _RecompressWithJbig2Box; - private System.Windows.Forms.CheckBox _FullCompressionBox; - private System.Windows.Forms.TabPage _PageLayoutPage; - private System.Windows.Forms.GroupBox _LayoutGroupBox; - private System.Windows.Forms.NumericUpDown _HeightBox; - private System.Windows.Forms.NumericUpDown _WidthBox; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.ComboBox _PageSizeBox; - private System.Windows.Forms.CheckBox _AutoRotateBox; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.RadioButton _ResizePdfPagesBox; - private System.Windows.Forms.RadioButton _ScalePdfPagesBox; - private System.Windows.Forms.GroupBox _MarginGroupBox; - private System.Windows.Forms.CheckBox _SyncMarginsBox; - private System.Windows.Forms.NumericUpDown _RightMarginBox; - private System.Windows.Forms.NumericUpDown _LeftMarginBox; - private System.Windows.Forms.NumericUpDown _BottomMarginBox; - private System.Windows.Forms.NumericUpDown _TopMarginBox; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.ComboBox _ImageHAlignBox; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.ComboBox _ImageVAlignBox; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.CheckBox _RemovePageFormsBox; - private System.Windows.Forms.CheckBox _RemovePageLinksBox; - private System.Windows.Forms.Label label12; - private System.Windows.Forms.Label label11; - private System.Windows.Forms.NumericUpDown _RemoveTrailingCommandCountBox; - private System.Windows.Forms.NumericUpDown _RemoveLeadingCommandCountBox; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.ComboBox _MarginUnitBox; - private System.Windows.Forms.Label label13; - private System.Windows.Forms.TabPage _ConfigPage; - private System.Windows.Forms.Button _ResetButton; - private System.Windows.Forms.Button _ImportButton; - private System.Windows.Forms.Button _ExportButton; - } -} diff --git a/pdfpatcher/App/Functions/PatcherOptionForm.cs b/pdfpatcher/App/Functions/PatcherOptionForm.cs deleted file mode 100644 index 551d13ec7c3205df7138bcd820340a3231d0fd80..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/PatcherOptionForm.cs +++ /dev/null @@ -1,227 +0,0 @@ -using System; -using System.ComponentModel; -using System.Windows.Forms; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - [ToolboxItem(false)] - public partial class PatcherOptionForm : Form, IResettableControl - { - const float cm2point = (72f / 2.54f); - string paperName; - bool _uiLockDown; - readonly bool _editorOptions; - - public PatcherOptions Options { get; set; } - - public PatcherOptionForm(bool editorOptions) { - InitializeComponent(); - _editorOptions = editorOptions; - this.OnFirstLoad(OnLoad); - } - - void OnLoad() { - this.SetIcon(Properties.Resources.PdfOptions); - _PageSizeBox.Items.AddRange(Processor.PdfDocumentCreator.PaperSizes); - _ImageHAlignBox.Items.Add("水平居中"); - _ImageHAlignBox.Items.Add("左对齐"); - _ImageHAlignBox.Items.Add("右对齐"); - _ImageVAlignBox.Items.Add("垂直居中"); - _ImageVAlignBox.Items.Add("置顶"); - _ImageVAlignBox.Items.Add("置底"); - _ResetButton.Click += (s, args) => { - if (this.ConfirmYesBox("是否将选项配置还原为默认值?")) { - Reset(); - } - }; - Reload(); - if (_editorOptions) { - _MainTab.TabPages.Remove(_DocumentInfoPage); - Options.MetaData.SpecifyMetaData = false; - } - } - - public void Reset() { - if (_editorOptions) { - Options = AppContext.Editor = new PatcherOptions(); - } - else { - Options = AppContext.Patcher = new PatcherOptions(); - } - Reload(); - } - - public void Reload() { - _uiLockDown = true; - var settings = Options; - _DocumentInfoEditor.Options = settings.MetaData; - _FontSubstitutionsEditor.Options = settings; - _FontSubstitutionsEditor.Substitutions = settings.FontSubstitutions; - _ViewerSettingsEditor.Options = settings.ViewerPreferences; - _PageLabelEditor.Labels = settings.PageLabels; - _PageSettingsEditor.Settings = settings.PageSettings; - - _FixContentBox.Checked = settings.FixContents; - _RecompressWithJbig2Box.Checked = settings.RecompressWithJbig2; - _RemoveAnnotationsBox.Checked = settings.RemoveAnnotations; - _RemoveBookmarksBox.Checked = settings.RemoveBookmarks; - _RemoveDocAutoActionsBox.Checked = settings.RemoveDocAutoActions; - _RemoveLeadingCommandCountBox.SetValue(settings.RemoveLeadingCommandCount); - _RemovePageAutoActionsBox.Checked = settings.RemovePageAutoActions; - _RemovePageFormsBox.Checked = settings.RemovePageForms; - _RemovePageLinksBox.Checked = settings.RemovePageLinks; - _RemovePageMetaDataBox.Checked = settings.RemovePageMetaData; - _RemovePageTextBlocksBox.Checked = settings.RemovePageTextBlocks; - _RemovePageThumbnailsBox.Checked = settings.RemovePageThumbnails; - _RemoveTrailingCommandCountBox.SetValue(settings.RemoveTrailingCommandCount); - _RemoveUsageRightsBox.Checked = settings.RemoveUsageRights; - _RemoveXmlMetaDataBox.Checked = settings.RemoveXmlMetadata; - _FullCompressionBox.Checked = settings.FullCompression; - - var ps = settings.UnifiedPageSettings; - _AutoRotateBox.Checked = ps.AutoRotation; - _MarginUnitBox.SelectedIndex = ps.Margins.IsRelative ? 1 : 0; - var marginScale = ps.Margins.IsRelative ? 1 : Constants.Units.CmToPoint; - _BottomMarginBox.SetValue(ps.Margins.Bottom / marginScale); - _LeftMarginBox.SetValue(ps.Margins.Left / marginScale); - _RightMarginBox.SetValue(ps.Margins.Right / marginScale); - _TopMarginBox.SetValue(ps.Margins.Top / marginScale); - _HeightBox.SetValue(ps.PaperSize.Height / Constants.Units.CmToPoint); - _WidthBox.SetValue(ps.PaperSize.Width / Constants.Units.CmToPoint); - _ImageHAlignBox.SelectedIndex = (int)ps.HorizontalAlign; - _ImageVAlignBox.SelectedIndex = (int)ps.VerticalAlign; - for (int i = 0; i < _PageSizeBox.Items.Count; i++) { - var p = _PageSizeBox.Items[i] as Model.PaperSize; - if (p.PaperName == ps.PaperSize.PaperName) { - _PageSizeBox.SelectedIndex = i; - } - } - if (_PageSizeBox.SelectedIndex == -1) { - _PageSizeBox.SelectedIndex = 0; - } - _ResizePdfPagesBox.Checked = ps.ScaleContent == false; - _ScalePdfPagesBox.Checked = ps.ScaleContent; - if (_PageSizeBox.SelectedIndex == 0) { - _HeightBox.Value = 26.01M; - _WidthBox.Value = 18M; - } - _uiLockDown = false; - } - - protected override void OnClosing(CancelEventArgs e) { - base.OnClosing(e); - var settings = Options; - var ps = settings.UnifiedPageSettings; - ps.AutoRotation = _AutoRotateBox.Checked; - ps.Margins.IsRelative = _MarginUnitBox.SelectedIndex == 1; - var marginScale = ps.Margins.IsRelative ? 1 : Constants.Units.CmToPoint; - ps.Margins.Top = (float)_TopMarginBox.Value * marginScale; - ps.Margins.Bottom = (float)_BottomMarginBox.Value * marginScale; - ps.Margins.Left = (float)_LeftMarginBox.Value * marginScale; - ps.Margins.Right = (float)_RightMarginBox.Value * marginScale; - ps.PaperSize.PaperName = paperName; - ps.PaperSize.Width = CmToPoint(_WidthBox); - ps.PaperSize.Height = CmToPoint(_HeightBox); - ps.HorizontalAlign = (Model.HorizontalAlignment)_ImageHAlignBox.SelectedIndex; - ps.VerticalAlign = (Model.VerticalAlignment)_ImageVAlignBox.SelectedIndex; - ps.ScaleContent = _ScalePdfPagesBox.Checked; - settings.RecompressWithJbig2 = _RecompressWithJbig2Box.Checked; - settings.RemoveAnnotations = _RemoveAnnotationsBox.Checked; - settings.RemoveBookmarks = _RemoveBookmarksBox.Checked; - settings.RemoveLeadingCommandCount = (int)_RemoveLeadingCommandCountBox.Value; - settings.RemoveUsageRights = _RemoveUsageRightsBox.Checked; - settings.RemoveXmlMetadata = _RemoveXmlMetaDataBox.Checked; - settings.RemoveDocAutoActions = _RemoveDocAutoActionsBox.Checked; - settings.RemovePageAutoActions = _RemovePageAutoActionsBox.Checked; - settings.RemovePageForms = _RemovePageFormsBox.Checked; - settings.RemovePageLinks = _RemovePageLinksBox.Checked; - settings.RemovePageMetaData = _RemovePageMetaDataBox.Checked; - settings.RemovePageTextBlocks = _RemovePageTextBlocksBox.Checked; - settings.RemovePageThumbnails = _RemovePageThumbnailsBox.Checked; - settings.RemoveTrailingCommandCount = (int)_RemoveTrailingCommandCountBox.Value; - settings.FixContents = _FixContentBox.Checked; - settings.FullCompression = _FullCompressionBox.Checked; - } - - private float CmToPoint(NumericUpDown box) { - return (float)box.Value * Constants.Units.CmToPoint; - } - - private void _PageSizeBox_SelectedIndexChanged(object sender, EventArgs e) { - if (_PageSizeBox.SelectedIndex == -1) { - return; - } - var p = _PageSizeBox.SelectedItem as PaperSize; - if (p.Width > 0 && p.Height > 0) { - _WidthBox.SetValue((decimal)p.Width / 100); - _HeightBox.SetValue((decimal)p.Height / 100); - } - paperName = p.PaperName; - switch (paperName) { - case PaperSize.FixedWidthAutoHeight: - _AutoRotateBox.Enabled = - _HeightBox.Enabled = - _ImageVAlignBox.Enabled = - false; - _ScalePdfPagesBox.Enabled = - _ResizePdfPagesBox.Enabled = - _ImageHAlignBox.Enabled = - _WidthBox.Enabled = true; - break; - case PaperSize.AsNarrowestPage: - case PaperSize.AsWidestPage: - _AutoRotateBox.Enabled = - _HeightBox.Enabled = - _ImageVAlignBox.Enabled = - _WidthBox.Enabled = - false; - _ScalePdfPagesBox.Enabled = - _ResizePdfPagesBox.Enabled = - _ImageHAlignBox.Enabled = true; - break; - case PaperSize.AsPageSize: - _AutoRotateBox.Enabled = - _WidthBox.Enabled = - _ImageHAlignBox.Enabled = - _ImageVAlignBox.Enabled = - _ScalePdfPagesBox.Enabled = - _ResizePdfPagesBox.Enabled = - _HeightBox.Enabled = false; - break; - case PaperSize.AsLargestPage: - case PaperSize.AsSmallestPage: - _AutoRotateBox.Enabled = - _HeightBox.Enabled = - _WidthBox.Enabled = - false; - _ImageVAlignBox.Enabled = - _ImageHAlignBox.Enabled = - _ScalePdfPagesBox.Enabled = - _ResizePdfPagesBox.Enabled = true; - break; - default: - _AutoRotateBox.Enabled = - _WidthBox.Enabled = - _HeightBox.Enabled = - _ImageHAlignBox.Enabled = - _ImageVAlignBox.Enabled = - _ScalePdfPagesBox.Enabled = - _ResizePdfPagesBox.Enabled = - true; - break; - } - } - - private void MarginBox_ValueChanged(object sender, EventArgs e) { - if (_SyncMarginsBox.Checked == false || _uiLockDown) { - return; - } - var c = sender as NumericUpDown; - var d = c.Value; - _TopMarginBox.Value = _BottomMarginBox.Value = _LeftMarginBox.Value = _RightMarginBox.Value = d; - } - - } -} diff --git a/pdfpatcher/App/Functions/PatcherOptionForm.resx b/pdfpatcher/App/Functions/PatcherOptionForm.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/PatcherOptionForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/RecentFileMenuHelper.cs b/pdfpatcher/App/Functions/RecentFileMenuHelper.cs deleted file mode 100644 index 05de8da31d9ed44052f0876e024278845dcfe9aa..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/RecentFileMenuHelper.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.IO; -using System.Windows.Forms; -using PDFPatcher.Common; - -namespace PDFPatcher.Functions -{ - static class RecentFileMenuHelper - { - public static void AddRecentHistoryFile(string path) { - switch (Path.GetExtension(path).ToLowerInvariant()) { - case Constants.FileExtensions.Pdf: - AppContext.RecentItems.AddHistoryItem(AppContext.Recent.SourcePdfFiles, path); - break; - //case Constants.FileExtensions.Txt: - case Constants.FileExtensions.Xml: - AppContext.RecentItems.AddHistoryItem(AppContext.Recent.InfoDocuments, path); - break; - } - } - - - public static void AddSourcePdfFiles(this ToolStripItemCollection list) { - foreach (var item in AppContext.Recent.SourcePdfFiles) { - var i = list.Add(FileHelper.GetEllipticPath(item, 50)); - i.ToolTipText = item; - if (File.Exists(item) == false) { - i.Enabled = false; - } - } - } - - public static void AddInfoFiles(this ToolStripItemCollection list) { - foreach (var item in AppContext.Recent.InfoDocuments) { - if (FileHelper.IsPathValid(item) && Path.IsPathRooted(item)) { - var i = list.Add(FileHelper.GetEllipticPath(item, 50)); - i.ToolTipText = item; - if (File.Exists(item) == false) { - i.Enabled = false; - } - } - } - } - } -} diff --git a/pdfpatcher/App/Functions/RenameControl.Designer.cs b/pdfpatcher/App/Functions/RenameControl.Designer.cs deleted file mode 100644 index 317f0275f13977a8caa831d040b6882cbaeb3e46..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/RenameControl.Designer.cs +++ /dev/null @@ -1,468 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class RenameControl - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.components = new System.ComponentModel.Container(); - System.Windows.Forms.ToolStripSeparator toolStripSeparator1; - System.Windows.Forms.ToolStripDropDownButton _Sort; - System.Windows.Forms.ToolStripButton _Delete; - System.Windows.Forms.ToolStripSeparator toolStripSeparator2; - System.Windows.Forms.ToolStripMenuItem _SelectAll; - System.Windows.Forms.ToolStripMenuItem _InvertSelect; - System.Windows.Forms.ToolStripMenuItem _SelectNone; - System.Windows.Forms.ToolStripMenuItem _Copy; - System.Windows.Forms.ToolStripMenuItem _RefreshInfo; - this._MainToolbar = new System.Windows.Forms.ToolStrip(); - this._AddFilesButton = new System.Windows.Forms.ToolStripSplitButton(); - this._RecentFileMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._SortMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._SortByNaturalNumberItem = new System.Windows.Forms.ToolStripMenuItem(); - this._SortByAlphaItem = new System.Windows.Forms.ToolStripMenuItem(); - this._RefreshInfoButton = new System.Windows.Forms.ToolStripSplitButton(); - this._RefreshInfoMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._SelectionMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._SelectionMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this._ItemList = new BrightIdeasSoftware.ObjectListView(); - this._NameColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._PageCountColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._TitleColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._AuthorColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._SubjectColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._KeywordsColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._FolderColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._FileTimeColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this._ItemListMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this._FileTypeList = new System.Windows.Forms.ImageList(this.components); - this._OpenPdfBox = new System.Windows.Forms.OpenFileDialog(); - this._AutoClearListBox = new System.Windows.Forms.CheckBox(); - this._AddDocumentWorker = new System.ComponentModel.BackgroundWorker(); - this._KeepSourceFileBox = new System.Windows.Forms.CheckBox(); - this._TestRenameButton = new System.Windows.Forms.Button(); - this._TargetPdfFile = new PDFPatcher.TargetFileControl(); - this._RenameButton = new EnhancedGlassButton.GlassButton(); - toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - _Sort = new System.Windows.Forms.ToolStripDropDownButton(); - _Delete = new System.Windows.Forms.ToolStripButton(); - toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - _SelectAll = new System.Windows.Forms.ToolStripMenuItem(); - _InvertSelect = new System.Windows.Forms.ToolStripMenuItem(); - _SelectNone = new System.Windows.Forms.ToolStripMenuItem(); - _Copy = new System.Windows.Forms.ToolStripMenuItem(); - _RefreshInfo = new System.Windows.Forms.ToolStripMenuItem(); - this._MainToolbar.SuspendLayout(); - this._SortMenu.SuspendLayout(); - this._SelectionMenu.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._ItemList)).BeginInit(); - this._ItemListMenu.SuspendLayout(); - this.SuspendLayout(); - // - // _MainToolbar - // - this._MainToolbar.GripMargin = new System.Windows.Forms.Padding(0); - this._MainToolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._AddFilesButton, - toolStripSeparator1, - _Sort, - _Delete, - toolStripSeparator2, - this._RefreshInfoButton}); - this._MainToolbar.Location = new System.Drawing.Point(0, 0); - this._MainToolbar.Name = "_MainToolbar"; - this._MainToolbar.Padding = new System.Windows.Forms.Padding(0, 0, 2, 0); - this._MainToolbar.Size = new System.Drawing.Size(575, 25); - this._MainToolbar.TabIndex = 0; - this._MainToolbar.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _AddFilesButton - // - this._AddFilesButton.DropDown = this._RecentFileMenu; - this._AddFilesButton.Image = global::PDFPatcher.Properties.Resources.Add; - this._AddFilesButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._AddFilesButton.Name = "_AddFilesButton"; - this._AddFilesButton.Size = new System.Drawing.Size(103, 22); - this._AddFilesButton.Text = "添加文件(&T)"; - this._AddFilesButton.ToolTipText = "添加文件"; - this._AddFilesButton.ButtonClick += new System.EventHandler(this._MainToolbar_ButtonClick); - // - // _RecentFileMenu - // - this._RecentFileMenu.Name = "_RecentFileMenu"; - this._RecentFileMenu.ShowImageMargin = false; - this._RecentFileMenu.Size = new System.Drawing.Size(36, 4); - // - // toolStripSeparator1 - // - toolStripSeparator1.Name = "toolStripSeparator1"; - toolStripSeparator1.Size = new System.Drawing.Size(6, 25); - // - // _Sort - // - _Sort.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - _Sort.DropDown = this._SortMenu; - _Sort.Image = global::PDFPatcher.Properties.Resources.Sort; - _Sort.ImageTransparentColor = System.Drawing.Color.Magenta; - _Sort.Name = "_Sort"; - _Sort.Size = new System.Drawing.Size(29, 22); - _Sort.Text = "排序"; - _Sort.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._SortMenu_ItemClicked); - // - // _SortMenu - // - this._SortMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._SortByNaturalNumberItem, - this._SortByAlphaItem}); - this._SortMenu.Name = "_SortMenu"; - this._SortMenu.Size = new System.Drawing.Size(217, 48); - this._SortMenu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._SortMenu_ItemClicked); - // - // _SortByNaturalNumberItem - // - this._SortByNaturalNumberItem.Image = global::PDFPatcher.Properties.Resources.NaturalSort; - this._SortByNaturalNumberItem.Name = "_SortByNaturalNumberItem"; - this._SortByNaturalNumberItem.Size = new System.Drawing.Size(216, 22); - this._SortByNaturalNumberItem.Text = "按数值和字母顺序排序(&M)"; - // - // _SortByAlphaItem - // - this._SortByAlphaItem.Image = global::PDFPatcher.Properties.Resources.AlphabeticSort; - this._SortByAlphaItem.Name = "_SortByAlphaItem"; - this._SortByAlphaItem.Size = new System.Drawing.Size(216, 22); - this._SortByAlphaItem.Text = "按字母顺序排序(&Z)"; - // - // _Delete - // - _Delete.Image = global::PDFPatcher.Properties.Resources.Delete; - _Delete.ImageTransparentColor = System.Drawing.Color.Magenta; - _Delete.Name = "_Delete"; - _Delete.Size = new System.Drawing.Size(76, 22); - _Delete.Text = "删除文件"; - // - // toolStripSeparator2 - // - toolStripSeparator2.Name = "toolStripSeparator2"; - toolStripSeparator2.Size = new System.Drawing.Size(6, 25); - // - // _RefreshInfoButton - // - this._RefreshInfoButton.Image = global::PDFPatcher.Properties.Resources.Refresh; - this._RefreshInfoButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this._RefreshInfoButton.Name = "_RefreshInfoButton"; - this._RefreshInfoButton.Size = new System.Drawing.Size(112, 22); - this._RefreshInfoButton.Text = "刷新文档属性"; - // - // _SelectAll - // - _SelectAll.Image = global::PDFPatcher.Properties.Resources.SelectAll; - _SelectAll.Name = "_SelectAll"; - _SelectAll.Size = new System.Drawing.Size(124, 22); - _SelectAll.Text = "全部选中"; - // - // _InvertSelect - // - _InvertSelect.Name = "_InvertSelect"; - _InvertSelect.Size = new System.Drawing.Size(124, 22); - _InvertSelect.Text = "反转选择"; - // - // _SelectNone - // - _SelectNone.Name = "_SelectNone"; - _SelectNone.Size = new System.Drawing.Size(124, 22); - _SelectNone.Text = "取消选择"; - // - // _Copy - // - _Copy.Image = global::PDFPatcher.Properties.Resources.Copy; - _Copy.Name = "_Copy"; - _Copy.Size = new System.Drawing.Size(148, 22); - _Copy.Text = "复制列表内容"; - // - // _RefreshInfo - // - _RefreshInfo.DropDown = this._RefreshInfoMenu; - _RefreshInfo.Image = global::PDFPatcher.Properties.Resources.Refresh; - _RefreshInfo.Name = "_RefreshInfo"; - _RefreshInfo.Size = new System.Drawing.Size(148, 22); - _RefreshInfo.Text = "刷新文档属性"; - // - // _RefreshInfoMenu - // - this._RefreshInfoMenu.Name = "_RefreshInfoMenu"; - this._RefreshInfoMenu.Size = new System.Drawing.Size(61, 4); - // - // _SelectionMenu - // - this._SelectionMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - _SelectAll, - _InvertSelect, - _SelectNone}); - this._SelectionMenu.Name = "_SelectionMenu"; - this._SelectionMenu.Size = new System.Drawing.Size(125, 70); - this._SelectionMenu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _SelectionMenuItem - // - this._SelectionMenuItem.DropDown = this._SelectionMenu; - this._SelectionMenuItem.Image = global::PDFPatcher.Properties.Resources.SelectItem; - this._SelectionMenuItem.Name = "_SelectionMenuItem"; - this._SelectionMenuItem.Size = new System.Drawing.Size(148, 22); - this._SelectionMenuItem.Text = "选择文件"; - // - // _ItemList - // - this._ItemList.AllColumns.Add(this._NameColumn); - this._ItemList.AllColumns.Add(this._PageCountColumn); - this._ItemList.AllColumns.Add(this._TitleColumn); - this._ItemList.AllColumns.Add(this._AuthorColumn); - this._ItemList.AllColumns.Add(this._SubjectColumn); - this._ItemList.AllColumns.Add(this._KeywordsColumn); - this._ItemList.AllColumns.Add(this._FolderColumn); - this._ItemList.AllColumns.Add(this._FileTimeColumn); - this._ItemList.AllowDrop = true; - this._ItemList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ItemList.CellEditActivation = BrightIdeasSoftware.ObjectListView.CellEditActivateMode.SingleClick; - this._ItemList.CellEditUseWholeCell = false; - this._ItemList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this._NameColumn, - this._PageCountColumn, - this._TitleColumn, - this._AuthorColumn, - this._SubjectColumn, - this._KeywordsColumn, - this._FolderColumn, - this._FileTimeColumn}); - this._ItemList.ContextMenuStrip = this._ItemListMenu; - this._ItemList.Cursor = System.Windows.Forms.Cursors.Default; - this._ItemList.GridLines = true; - this._ItemList.HideSelection = false; - this._ItemList.Location = new System.Drawing.Point(16, 57); - this._ItemList.Name = "_ItemList"; - this._ItemList.ShowGroups = false; - this._ItemList.Size = new System.Drawing.Size(544, 202); - this._ItemList.SmallImageList = this._FileTypeList; - this._ItemList.TabIndex = 0; - this._ItemList.UseCompatibleStateImageBehavior = false; - this._ItemList.View = System.Windows.Forms.View.Details; - this._ItemList.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this._ImageList_ColumnClick); - // - // _NameColumn - // - this._NameColumn.Text = "源文件名"; - this._NameColumn.Width = 149; - // - // _PageCountColumn - // - this._PageCountColumn.HeaderTextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._PageCountColumn.IsEditable = false; - this._PageCountColumn.Text = "页数"; - this._PageCountColumn.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this._PageCountColumn.Width = 50; - // - // _TitleColumn - // - this._TitleColumn.Text = "标题"; - this._TitleColumn.Width = 58; - // - // _AuthorColumn - // - this._AuthorColumn.Text = "作者"; - // - // _SubjectColumn - // - this._SubjectColumn.Text = "主题"; - // - // _KeywordsColumn - // - this._KeywordsColumn.Text = "关键词"; - this._KeywordsColumn.Width = 73; - // - // _FolderColumn - // - this._FolderColumn.IsEditable = false; - this._FolderColumn.Text = "文件夹"; - this._FolderColumn.Width = 96; - // - // _FileTimeColumn - // - this._FileTimeColumn.IsEditable = false; - this._FileTimeColumn.Text = "修改时间"; - this._FileTimeColumn.Width = 145; - // - // _ItemListMenu - // - this._ItemListMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - _Copy, - _RefreshInfo, - this._SelectionMenuItem}); - this._ItemListMenu.Name = "_ItemListMenu"; - this._ItemListMenu.Size = new System.Drawing.Size(149, 70); - this._ItemListMenu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this._MainToolbar_ItemClicked); - // - // _FileTypeList - // - this._FileTypeList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; - this._FileTypeList.ImageSize = new System.Drawing.Size(16, 16); - this._FileTypeList.TransparentColor = System.Drawing.Color.Transparent; - // - // _OpenPdfBox - // - this._OpenPdfBox.DefaultExt = "pdf"; - this._OpenPdfBox.Filter = "PDF 文件(*.pdf)|*.pdf"; - this._OpenPdfBox.Multiselect = true; - this._OpenPdfBox.Title = "选择需要处理的 PDF 文件"; - // - // _AutoClearListBox - // - this._AutoClearListBox.AutoSize = true; - this._AutoClearListBox.Checked = true; - this._AutoClearListBox.CheckState = System.Windows.Forms.CheckState.Checked; - this._AutoClearListBox.Location = new System.Drawing.Point(16, 29); - this._AutoClearListBox.Name = "_AutoClearListBox"; - this._AutoClearListBox.Size = new System.Drawing.Size(132, 16); - this._AutoClearListBox.TabIndex = 4; - this._AutoClearListBox.Text = "添加文件前清空列表"; - this._AutoClearListBox.UseVisualStyleBackColor = true; - // - // _AddDocumentWorker - // - this._AddDocumentWorker.WorkerReportsProgress = true; - this._AddDocumentWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this._AddDocumentWorker_DoWork); - this._AddDocumentWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this._AddDocumentWorker_ProgressChanged); - this._AddDocumentWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this._AddDocumentWorker_RunWorkerCompleted); - // - // _KeepSourceFileBox - // - this._KeepSourceFileBox.AutoSize = true; - this._KeepSourceFileBox.Checked = true; - this._KeepSourceFileBox.CheckState = System.Windows.Forms.CheckState.Checked; - this._KeepSourceFileBox.Location = new System.Drawing.Point(166, 29); - this._KeepSourceFileBox.Name = "_KeepSourceFileBox"; - this._KeepSourceFileBox.Size = new System.Drawing.Size(96, 16); - this._KeepSourceFileBox.TabIndex = 12; - this._KeepSourceFileBox.Text = "保留原始文件"; - this._KeepSourceFileBox.UseVisualStyleBackColor = true; - // - // _TestRenameButton - // - this._TestRenameButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._TestRenameButton.Location = new System.Drawing.Point(312, 297); - this._TestRenameButton.Name = "_TestRenameButton"; - this._TestRenameButton.Size = new System.Drawing.Size(119, 23); - this._TestRenameButton.TabIndex = 11; - this._TestRenameButton.Text = "测试命名模板(&C)"; - this._TestRenameButton.UseVisualStyleBackColor = true; - this._TestRenameButton.Click += new System.EventHandler(this._TestRenameButton_Click); - // - // _TargetPdfFile - // - this._TargetPdfFile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._TargetPdfFile.Label = "重命名模板(&M):"; - this._TargetPdfFile.Location = new System.Drawing.Point(13, 265); - this._TargetPdfFile.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._TargetPdfFile.Name = "_TargetPdfFile"; - this._TargetPdfFile.Size = new System.Drawing.Size(553, 26); - this._TargetPdfFile.TabIndex = 7; - // - // _RenameButton - // - this._RenameButton.AlternativeFocusBorderColor = System.Drawing.SystemColors.Highlight; - this._RenameButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._RenameButton.AnimateGlow = true; - this._RenameButton.BackColor = System.Drawing.SystemColors.Highlight; - this._RenameButton.CornerRadius = 3; - this._RenameButton.ForeColor = System.Drawing.SystemColors.ControlText; - this._RenameButton.GlowColor = System.Drawing.Color.White; - this._RenameButton.Image = global::PDFPatcher.Properties.Resources.Save; - this._RenameButton.InnerBorderColor = System.Drawing.SystemColors.ControlDarkDark; - this._RenameButton.Location = new System.Drawing.Point(440, 297); - this._RenameButton.Name = "_RenameButton"; - this._RenameButton.OuterBorderColor = System.Drawing.SystemColors.ControlLightLight; - this._RenameButton.ShowFocusBorder = true; - this._RenameButton.Size = new System.Drawing.Size(123, 29); - this._RenameButton.TabIndex = 13; - this._RenameButton.Text = "重命名文件(&C)"; - this._RenameButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._RenameButton.Click += new System.EventHandler(this._RenameButton_Click); - // - // RenameControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this._RenameButton); - this.Controls.Add(this._ItemList); - this.Controls.Add(this._MainToolbar); - this.Controls.Add(this._TargetPdfFile); - this.Controls.Add(this._AutoClearListBox); - this.Controls.Add(this._TestRenameButton); - this.Controls.Add(this._KeepSourceFileBox); - this.Font = new System.Drawing.Font("SimSun", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.Name = "RenameControl"; - this.Size = new System.Drawing.Size(575, 342); - this._MainToolbar.ResumeLayout(false); - this._MainToolbar.PerformLayout(); - this._SortMenu.ResumeLayout(false); - this._SelectionMenu.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this._ItemList)).EndInit(); - this._ItemListMenu.ResumeLayout(false); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private BrightIdeasSoftware.ObjectListView _ItemList; - private BrightIdeasSoftware.OLVColumn _NameColumn; - private BrightIdeasSoftware.OLVColumn _FolderColumn; - private TargetFileControl _TargetPdfFile; - private System.Windows.Forms.ContextMenuStrip _SortMenu; - private System.Windows.Forms.ToolStripMenuItem _SortByNaturalNumberItem; - private System.Windows.Forms.ToolStripMenuItem _SortByAlphaItem; - private System.Windows.Forms.ContextMenuStrip _SelectionMenu; - private BrightIdeasSoftware.OLVColumn _PageCountColumn; - private System.Windows.Forms.ToolStripMenuItem _SelectionMenuItem; - private System.Windows.Forms.ContextMenuStrip _ItemListMenu; - private System.Windows.Forms.ToolStripSplitButton _AddFilesButton; - private System.Windows.Forms.ContextMenuStrip _RecentFileMenu; - private System.Windows.Forms.OpenFileDialog _OpenPdfBox; - private System.Windows.Forms.CheckBox _AutoClearListBox; - private System.ComponentModel.BackgroundWorker _AddDocumentWorker; - private BrightIdeasSoftware.OLVColumn _TitleColumn; - private BrightIdeasSoftware.OLVColumn _AuthorColumn; - private BrightIdeasSoftware.OLVColumn _SubjectColumn; - private BrightIdeasSoftware.OLVColumn _KeywordsColumn; - private System.Windows.Forms.CheckBox _KeepSourceFileBox; - private System.Windows.Forms.Button _TestRenameButton; - private System.Windows.Forms.ImageList _FileTypeList; - private System.Windows.Forms.ToolStripSplitButton _RefreshInfoButton; - private System.Windows.Forms.ContextMenuStrip _RefreshInfoMenu; - private EnhancedGlassButton.GlassButton _RenameButton; - private BrightIdeasSoftware.OLVColumn _FileTimeColumn; - private System.Windows.Forms.ToolStrip _MainToolbar; - } -} diff --git a/pdfpatcher/App/Functions/RenameControl.cs b/pdfpatcher/App/Functions/RenameControl.cs deleted file mode 100644 index 498fba47d5d40207cc78074250b2771806a1786a..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/RenameControl.cs +++ /dev/null @@ -1,281 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.IO; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using BrightIdeasSoftware; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - [ToolboxItem(false)] - public partial class RenameControl : FunctionControl - { - FileListHelper _listHelper; - static readonly string[] __EnabledCommands = { Commands.Copy, Commands.Delete }; - - public override string FunctionName => "重命名文件"; - - public override System.Drawing.Bitmap IconImage => Properties.Resources.Rename; - - public RenameControl() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - } - - void OnLoad() { - var s = (int)(this.GetDpiScale() * 16); - var size = new System.Drawing.Size(s, s); - _MainToolbar.ScaleIcons(size); - _SortMenu.ScaleIcons(size); - _ItemListMenu.ScaleIcons(size); - _RecentFileMenu.ScaleIcons(size); - _RefreshInfoMenu.ScaleIcons(size); - - _ItemList.ListViewItemSorter = new ListViewItemComparer(0); - - AppContext.MainForm.SetTooltip(_ItemList, "在此添加需要重命名的 PDF 文件"); - AppContext.MainForm.SetTooltip(_RenameButton, "点击此按钮根据文件属性和输出文件名将 PDF 文件重命名"); - AppContext.MainForm.SetTooltip(_TargetPdfFile.FileList, "生成的目标 PDF 文件路径(鼠标右键点击列表可插入文件名替代符)"); - _ItemList.EmptyListMsg = "请使用“添加文件”按钮添加需要处理的 PDF 文件,或从资源管理器拖放文件到本列表框"; - - _TargetPdfFile.FileMacroMenu.LoadStandardInfoMacros(); - _TargetPdfFile.FileMacroMenu.LoadStandardSourceFileMacros(); - _TargetPdfFile.BrowseForFile += new EventHandler(FileControl_BrowseForFile); - _TargetPdfFile.TargetFileChangedByBrowseButton += (s, args) => { - int i; - var f = _TargetPdfFile.FileDialog.FileName; - if (_ItemList.Items.Count > 1 && (i = f.LastIndexOf(Path.DirectorySeparatorChar)) != -1) { - _TargetPdfFile.Text = String.Concat(f.Substring(0, i), Path.DirectorySeparatorChar, Constants.FileNameMacros.FileName, Path.GetExtension(f)); - args.Cancel = true; - } - }; - var fi = _FileTypeList.Images; - fi.AddRange(new System.Drawing.Image[] { - Properties.Resources.OriginalPdfFile - }); - _ItemList.FixEditControlWidth(); - _ItemList.ScaleColumnWidths(); - _listHelper = new FileListHelper(_ItemList); - _listHelper.SetupDragAndDrop(AddFiles); - _listHelper.SetupHotkeys(); - FileListHelper.SetupCommonPdfColumns(_AuthorColumn, _KeywordsColumn, _SubjectColumn, _TitleColumn, _PageCountColumn, _NameColumn, _FolderColumn, _FileTimeColumn); - _RefreshInfoButton.ButtonClick += (s, args) => _listHelper.RefreshInfo(AppContext.Encodings.DocInfoEncoding); - _RefreshInfoButton.DropDown = _RefreshInfoMenu; - foreach (var item in Constants.Encoding.EncodingNames) { - _RefreshInfoMenu.Items.Add(item); - } - _RefreshInfoMenu.ItemClicked += (s, args) => _listHelper.RefreshInfo(ValueHelper.MapValue(args.ClickedItem.Text, Constants.Encoding.EncodingNames, Constants.Encoding.Encodings)); - _AddFilesButton.DropDownOpening += FileListHelper.OpenPdfButtonDropDownOpeningHandler; - _AddFilesButton.DropDownItemClicked += (s, args) => { - args.ClickedItem.Owner.Hide(); - ExecuteCommand(Commands.OpenFile, args.ClickedItem.ToolTipText); - }; - RecentFileItemClicked += (s, args) => ExecuteCommand(Commands.OpenFile, args.ClickedItem.ToolTipText); - } - - public override void SetupCommand(ToolStripItem item) { - if (__EnabledCommands.Contains(item.Name) - || Commands.CommonSelectionCommands.Contains(item.Name)) { - EnableCommand(item, _ItemList.GetItemCount() > 0 && _ItemList.Focused, true); - } - base.SetupCommand(item); - } - - public override void ExecuteCommand(string commandName, params string[] parameters) { - if (_listHelper.ProcessCommonMenuCommand(commandName)) { - return; - } - switch (commandName) { - case Commands.Open: - var b = _OpenPdfBox; - _AddFilesButton.DropDown.Items.ClearDropDownItems(); - if (b.ShowDialog() == DialogResult.OK) { - AddFiles(b.FileNames, true); - } - break; - case Commands.OpenFile: - AddFiles(parameters, true); - break; - default: - break; - } - base.ExecuteCommand(commandName, parameters); - } - - void FileControl_BrowseForFile(object sender, EventArgs e) { - _listHelper.PrepareSourceFiles(); - } - - void _RenameButton_Click(object sender, EventArgs e) { - var targetPdfFile = _TargetPdfFile.Text.Trim(); - if (String.IsNullOrEmpty(targetPdfFile) && String.IsNullOrEmpty(targetPdfFile = _TargetPdfFile.BrowseTargetFile())) { - FormHelper.ErrorBox(Messages.TargetFileNotSpecified); - return; - } - - var l = _ItemList.GetItemCount(); - if (l == 0) { - FormHelper.InfoBox("请添加需要重命名的 PDF 文件。"); - return; - } - var files = GetSourceItemList(); - _TargetPdfFile.FileList.AddHistoryItem(); - - AppContext.MainForm.ResetWorker(); - var worker = AppContext.MainForm.GetWorker(); - worker.DoWork += (dummy, arg) => { - var items = _listHelper.GetSourceItems(false); - Processor.Worker.RenameFiles(items, targetPdfFile, _KeepSourceFileBox.Checked); - }; - worker.RunWorkerAsync(); - } - - void AddFiles(string[] files, bool alertInvalidFiles) { - if (files == null || files.Length == 0) { - return; - } - if ((ModifierKeys & Keys.Control) != Keys.None || _AutoClearListBox.Checked) { - _ItemList.ClearObjects(); - } - if (files.Length > 3) { - AppContext.MainForm.Enabled = false; - } - if (files.Length == 0) { - return; - } - _AddDocumentWorker.RunWorkerAsync(files); - } - - List GetSourceItemList() { - var l = _ItemList.GetItemCount(); - var files = new List(l); - for (int i = 0; i < l; i++) { - var item = _ItemList.GetModelObject(_ItemList.GetNthItemInDisplayOrder(i).Index) as SourceItem; - if (item.Type == SourceItem.ItemType.Pdf - && FileHelper.HasExtension(item.FilePath, Constants.FileExtensions.Pdf)) { - AppContext.RecentItems.AddHistoryItem(AppContext.Recent.SourcePdfFiles, item.FilePath.ToString()); - } - files.Add(item); - } - return files; - } - - void _SortMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { - switch (e.ClickedItem.Name) { - case "_SortByAlphaItem": - _ItemList.ListViewItemSorter = new ListViewItemComparer(0, false); - break; - case "_SortByNaturalNumberItem": - _ItemList.ListViewItemSorter = new ListViewItemComparer(0, true); - break; - } - } - - void _ImageList_ColumnClick(object sender, ColumnClickEventArgs e) { - var c = e.Column; - var ss = c == 0 || c == _PageCountColumn.Index; - var o = _ItemList.PrimarySortOrder == SortOrder.Ascending ? SortOrder.Descending : SortOrder.Ascending; - _ItemList.ListViewItemSorter = new ListViewItemComparer(e.Column, ss, o); - } - - void _MainToolbar_ButtonClick(object sender, EventArgs e) { - if (sender == _AddFilesButton) { - ExecuteCommand(Commands.Open); - } - } - - void _MainToolbar_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { - ExecuteCommand(e.ClickedItem.Name); - } - - void _TestRenameButton_Click(object sender, EventArgs e) { - if (String.IsNullOrEmpty(_TargetPdfFile.Text)) { - FormHelper.ErrorBox(Messages.TargetFileNotSpecified); - return; - } - var pdfs = _listHelper.GetSourceItems(false); - if (pdfs.Count == 0) { - FormHelper.InfoBox("请添加需要重命名的 PDF 文件。"); - return; - } - - PreviewRename(pdfs, _TargetPdfFile.Text); - } - - void PreviewRename(List items, string template) { - var i = 0; - var result = new string[items.Count]; - var source = new string[items.Count]; - FilePath s; - string t; - foreach (var item in items) { - try { - s = item.FilePath; - if (s.ExistsFile == false) { - t = String.Concat("(找不到 PDF 文件:", s, ")"); - continue; - } - else { - t = Processor.Worker.GetExpandedFileName(item, template); - if (t.Length == 0) { - t = "<输出文件名无效>"; - } - else if (Path.GetFileName(t).Length == 0) { - t = "<输出文件名为空>"; - } - } - source[i] = s.ToString(); - result[i] = t; - i++; - } - catch (Exception ex) { - FormHelper.ErrorBox(ex.Message); - } - } - using (var f = new Functions.RenamePreviewForm(source, result)) { - f.ShowDialog(); - } - } - - #region AddDocumentWorker - void _AddDocumentWorker_DoWork(object sender, DoWorkEventArgs e) { - var files = e.Argument as string[]; - Array.ForEach(files, f => ((BackgroundWorker)sender).ReportProgress(0, f)); - } - - void _AddDocumentWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { - AppContext.MainForm.Enabled = true; - //_listHelper.ResizeItemListColumns (); - } - - void _AddDocumentWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) { - var item = e.UserState as string; - AddItem(SourceItem.Create(item)); - } - - void AddItem(SourceItem item) { - if (item == null || item.Type != SourceItem.ItemType.Pdf) { - return; - } - AddItems(new SourceItem[] { item }); - } - - void AddItems(System.Collections.ICollection items) { - var i = _ItemList.GetLastSelectedIndex(); - _ItemList.InsertObjects(++i, items); - _ItemList.SelectedIndex = --i + items.Count; - } - #endregion - - #region IDefaultButtonControl 成员 - - public override Button DefaultButton => _RenameButton; - - #endregion - - } -} diff --git a/pdfpatcher/App/Functions/RenameControl.resx b/pdfpatcher/App/Functions/RenameControl.resx deleted file mode 100644 index 49339707525561e54a89bc04c040f3ea20e24ad2..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/RenameControl.resx +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 495, 17 - - - 614, 17 - - - False - - - False - - - 135, 17 - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - 149, 54 - - - 240, 17 - - - 370, 17 - - - 17, 54 - - - 17, 17 - - - 750, 17 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/RenamePreviewForm.Designer.cs b/pdfpatcher/App/Functions/RenamePreviewForm.Designer.cs deleted file mode 100644 index 1d47d69ca1a1cecf1b8796f5a860459ce90aecc7..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/RenamePreviewForm.Designer.cs +++ /dev/null @@ -1,125 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class RenamePreviewForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._RenamePreviewBox = new System.Windows.Forms.ListView (); - this._OriginalNameColumn = new System.Windows.Forms.ColumnHeader (); - this._OutputNameColumn = new System.Windows.Forms.ColumnHeader (); - this._OriginalFolderColumn = new System.Windows.Forms.ColumnHeader (); - this._OutputFolderColumn = new System.Windows.Forms.ColumnHeader (); - this.label1 = new System.Windows.Forms.Label (); - this._OKButton = new System.Windows.Forms.Button (); - this.SuspendLayout (); - // - // _RenamePreviewBox - // - this._RenamePreviewBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._RenamePreviewBox.Columns.AddRange (new System.Windows.Forms.ColumnHeader[] { - this._OriginalNameColumn, - this._OutputNameColumn, - this._OriginalFolderColumn, - this._OutputFolderColumn}); - this._RenamePreviewBox.GridLines = true; - this._RenamePreviewBox.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this._RenamePreviewBox.Location = new System.Drawing.Point (12, 24); - this._RenamePreviewBox.Name = "_RenamePreviewBox"; - this._RenamePreviewBox.Size = new System.Drawing.Size (456, 197); - this._RenamePreviewBox.TabIndex = 0; - this._RenamePreviewBox.UseCompatibleStateImageBehavior = false; - this._RenamePreviewBox.View = System.Windows.Forms.View.Details; - // - // _OriginalNameColumn - // - this._OriginalNameColumn.Text = "原始文件名"; - this._OriginalNameColumn.Width = 84; - // - // _OutputNameColumn - // - this._OutputNameColumn.Text = "输出文件名"; - this._OutputNameColumn.Width = 83; - // - // _OriginalFolderColumn - // - this._OriginalFolderColumn.Text = "原始文件夹"; - this._OriginalFolderColumn.Width = 85; - // - // _OutputFolderColumn - // - this._OutputFolderColumn.Text = "输出文件夹"; - this._OutputFolderColumn.Width = 88; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point (12, 9); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size (149, 12); - this.label1.TabIndex = 1; - this.label1.Text = "PDF 文件重命名结果预览:"; - // - // _OKButton - // - this._OKButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._OKButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this._OKButton.Location = new System.Drawing.Point (393, 232); - this._OKButton.Name = "_OKButton"; - this._OKButton.Size = new System.Drawing.Size (75, 23); - this._OKButton.TabIndex = 2; - this._OKButton.Text = "确定(&Q)"; - this._OKButton.UseVisualStyleBackColor = true; - this._OKButton.Click += new System.EventHandler (this._OKButton_Click); - // - // RenamePreviewForm - // - this.AcceptButton = this._OKButton; - this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this._OKButton; - this.ClientSize = new System.Drawing.Size (480, 267); - this.Controls.Add (this._OKButton); - this.Controls.Add (this.label1); - this.Controls.Add (this._RenamePreviewBox); - this.MinimumSize = new System.Drawing.Size (300, 200); - this.Name = "RenamePreviewForm"; - this.Text = "重命名结果预览"; - this.ResumeLayout (false); - this.PerformLayout (); - - } - - #endregion - - private System.Windows.Forms.ListView _RenamePreviewBox; - private System.Windows.Forms.ColumnHeader _OriginalNameColumn; - private System.Windows.Forms.ColumnHeader _OutputNameColumn; - private System.Windows.Forms.ColumnHeader _OriginalFolderColumn; - private System.Windows.Forms.ColumnHeader _OutputFolderColumn; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Button _OKButton; - } -} \ No newline at end of file diff --git a/pdfpatcher/App/Functions/RenamePreviewForm.cs b/pdfpatcher/App/Functions/RenamePreviewForm.cs deleted file mode 100644 index 1c0783f45e66ac36cf8f8f485c482471fb664a43..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/RenamePreviewForm.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Drawing; -using System.Windows.Forms; -using PDFPatcher.Common; - -namespace PDFPatcher.Functions -{ - public partial class RenamePreviewForm : Form - { - public RenamePreviewForm() { - InitializeComponent(); - } - public RenamePreviewForm(string[] sourceFiles, string[] targetFiles) : this() { - var l = sourceFiles.Length; - var c = _RenamePreviewBox.Items; - FilePath s, t; - for (int i = 0; i < l; i++) { - s = sourceFiles[i]; - t = targetFiles[i]; - if (t.IsEmpty) { - continue; - } - if (t.ToString().IndexOf('<') == -1) { - c.Add(new ListViewItem(new string[]{ - s.FileName, - t.FileName, - s.Directory, - t.Directory - })); - } - else { - var item = c.Add(new ListViewItem(new string[]{ - s.FileName, - t, - s.Directory, - String.Empty - })); - item.UseItemStyleForSubItems = false; - item.SubItems[1].BackColor = Color.LightYellow; - } - } - foreach (ColumnHeader item in _RenamePreviewBox.Columns) { - item.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); - } - } - - private void _OKButton_Click(object sender, EventArgs e) { - Close(); - } - } -} diff --git a/pdfpatcher/App/Functions/RenamePreviewForm.resx b/pdfpatcher/App/Functions/RenamePreviewForm.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/RenamePreviewForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/RenderImageControl.Designer.cs b/pdfpatcher/App/Functions/RenderImageControl.Designer.cs deleted file mode 100644 index 9527043d5850d5f0c371542f2c7d5a7e9d1588f5..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/RenderImageControl.Designer.cs +++ /dev/null @@ -1,686 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class RenderImageControl - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._ExtractPageRangeBox = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this._SaveImageBox = new System.Windows.Forms.FolderBrowserDialog(); - this.label4 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this._FileMaskPreviewBox = new System.Windows.Forms.Label(); - this._FileNameMaskBox = new System.Windows.Forms.ComboBox(); - this.label6 = new System.Windows.Forms.Label(); - this._InvertColorBox = new System.Windows.Forms.CheckBox(); - this.tabControl1 = new System.Windows.Forms.TabControl(); - this.tabPage1 = new System.Windows.Forms.TabPage(); - this.groupBox3 = new System.Windows.Forms.GroupBox(); - this._RotationBox = new System.Windows.Forms.ComboBox(); - this.label9 = new System.Windows.Forms.Label(); - this._HorizontalFlipImageBox = new System.Windows.Forms.CheckBox(); - this._HideAnnotationsBox = new System.Windows.Forms.CheckBox(); - this._VerticalFlipImageBox = new System.Windows.Forms.CheckBox(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); - this._ResolutionBox = new System.Windows.Forms.ComboBox(); - this.label1 = new System.Windows.Forms.Label(); - this.label12 = new System.Windows.Forms.Label(); - this._ExtractPageImageWidthBox = new System.Windows.Forms.NumericUpDown(); - this._ExtractPageRatioBox = new System.Windows.Forms.NumericUpDown(); - this.label13 = new System.Windows.Forms.Label(); - this.label10 = new System.Windows.Forms.Label(); - this._SpecificRatioBox = new System.Windows.Forms.RadioButton(); - this._SpecificWidthBox = new System.Windows.Forms.RadioButton(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this._ColorSpaceRgbBox = new System.Windows.Forms.RadioButton(); - this.label8 = new System.Windows.Forms.Label(); - this._QuantizeBox = new System.Windows.Forms.CheckBox(); - this._ColorSpaceGrayBox = new System.Windows.Forms.RadioButton(); - this.label11 = new System.Windows.Forms.Label(); - this.label7 = new System.Windows.Forms.Label(); - this._JpegQualityBox = new System.Windows.Forms.ComboBox(); - this._ImageFormatBox = new System.Windows.Forms.ComboBox(); - this.tabPage2 = new System.Windows.Forms.TabPage(); - this._AutoOutputDirBox = new System.Windows.Forms.CheckBox(); - this._BrowseTargetPdfButton = new System.Windows.Forms.Button(); - this._TargetBox = new PDFPatcher.HistoryComboBox(); - this._SourceFileControl = new PDFPatcher.SourceFileControl(); - this._ExtractButton = new EnhancedGlassButton.GlassButton(); - this._RenderToPdfBox = new System.Windows.Forms.CheckBox(); - this.tabControl1.SuspendLayout(); - this.tabPage1.SuspendLayout(); - this.groupBox3.SuspendLayout(); - this.groupBox2.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this._ExtractPageImageWidthBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this._ExtractPageRatioBox)).BeginInit(); - this.groupBox1.SuspendLayout(); - this.tabPage2.SuspendLayout(); - this.SuspendLayout(); - // - // _ExtractPageRangeBox - // - this._ExtractPageRangeBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ExtractPageRangeBox.Location = new System.Drawing.Point(93, 6); - this._ExtractPageRangeBox.Name = "_ExtractPageRangeBox"; - this._ExtractPageRangeBox.Size = new System.Drawing.Size(478, 21); - this._ExtractPageRangeBox.TabIndex = 1; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(6, 9); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(65, 12); - this.label3.TabIndex = 0; - this.label3.Text = "页码范围:"; - // - // _SaveImageBox - // - this._SaveImageBox.Description = "请选择保存图片的文件夹"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(17, 39); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(89, 12); - this.label4.TabIndex = 1; - this.label4.Text = "输出图片位置:"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(6, 9); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(77, 12); - this.label2.TabIndex = 0; - this.label2.Text = "文件名掩码:"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(10, 30); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(77, 12); - this.label5.TabIndex = 2; - this.label5.Text = "文件名示例:"; - // - // _FileMaskPreviewBox - // - this._FileMaskPreviewBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._FileMaskPreviewBox.Location = new System.Drawing.Point(93, 30); - this._FileMaskPreviewBox.Name = "_FileMaskPreviewBox"; - this._FileMaskPreviewBox.Size = new System.Drawing.Size(330, 31); - this._FileMaskPreviewBox.TabIndex = 3; - // - // _FileNameMaskBox - // - this._FileNameMaskBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._FileNameMaskBox.FormattingEnabled = true; - this._FileNameMaskBox.Items.AddRange(new object[] { - "0000", - "000", - "0", - "图片0000"}); - this._FileNameMaskBox.Location = new System.Drawing.Point(93, 6); - this._FileNameMaskBox.Name = "_FileNameMaskBox"; - this._FileNameMaskBox.Size = new System.Drawing.Size(244, 20); - this._FileNameMaskBox.TabIndex = 1; - this._FileNameMaskBox.TextChanged += new System.EventHandler(this._FileNameMaskBox_TextChanged); - // - // label6 - // - this.label6.Location = new System.Drawing.Point(46, 30); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(522, 38); - this.label6.TabIndex = 2; - this.label6.Text = "用“-”表示起止页码。多个页码可用“;”、“,”或“ ”(空格)隔开,如“1;4-15;2 56”,表示依次提取第1页、第4至15页、第2页和第56页的内容。不指" + - "定页码时提取源文件所有页面的内容。"; - // - // _InvertColorBox - // - this._InvertColorBox.AutoSize = true; - this._InvertColorBox.Location = new System.Drawing.Point(10, 48); - this._InvertColorBox.Name = "_InvertColorBox"; - this._InvertColorBox.Size = new System.Drawing.Size(108, 16); - this._InvertColorBox.TabIndex = 3; - this._InvertColorBox.Text = "反转图片的颜色"; - this._InvertColorBox.UseVisualStyleBackColor = true; - // - // tabControl1 - // - this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tabControl1.Controls.Add(this.tabPage1); - this.tabControl1.Controls.Add(this.tabPage2); - this.tabControl1.Location = new System.Drawing.Point(12, 92); - this.tabControl1.Name = "tabControl1"; - this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(585, 229); - this.tabControl1.TabIndex = 5; - // - // tabPage1 - // - this.tabPage1.Controls.Add(this.groupBox3); - this.tabPage1.Controls.Add(this.groupBox2); - this.tabPage1.Controls.Add(this.groupBox1); - this.tabPage1.Controls.Add(this.label11); - this.tabPage1.Controls.Add(this.label7); - this.tabPage1.Controls.Add(this._JpegQualityBox); - this.tabPage1.Controls.Add(this._ImageFormatBox); - this.tabPage1.Controls.Add(this.label3); - this.tabPage1.Controls.Add(this.label6); - this.tabPage1.Controls.Add(this._ExtractPageRangeBox); - this.tabPage1.Location = new System.Drawing.Point(4, 22); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(577, 203); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "选项"; - this.tabPage1.UseVisualStyleBackColor = true; - // - // groupBox3 - // - this.groupBox3.Controls.Add(this._RotationBox); - this.groupBox3.Controls.Add(this.label9); - this.groupBox3.Controls.Add(this._HorizontalFlipImageBox); - this.groupBox3.Controls.Add(this._HideAnnotationsBox); - this.groupBox3.Controls.Add(this._VerticalFlipImageBox); - this.groupBox3.Location = new System.Drawing.Point(378, 97); - this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(179, 100); - this.groupBox3.TabIndex = 10; - this.groupBox3.TabStop = false; - this.groupBox3.Text = "其它"; - // - // _RotationBox - // - this._RotationBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._RotationBox.FormattingEnabled = true; - this._RotationBox.Items.AddRange(new object[] { - "不旋转", - "顺时针90度", - "180度", - "逆时针90度"}); - this._RotationBox.Location = new System.Drawing.Point(76, 20); - this._RotationBox.Name = "_RotationBox"; - this._RotationBox.Size = new System.Drawing.Size(86, 20); - this._RotationBox.TabIndex = 1; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(5, 24); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(65, 12); - this.label9.TabIndex = 0; - this.label9.Text = "旋转角度:"; - // - // _HorizontalFlipImageBox - // - this._HorizontalFlipImageBox.AutoSize = true; - this._HorizontalFlipImageBox.Location = new System.Drawing.Point(7, 48); - this._HorizontalFlipImageBox.Name = "_HorizontalFlipImageBox"; - this._HorizontalFlipImageBox.Size = new System.Drawing.Size(72, 16); - this._HorizontalFlipImageBox.TabIndex = 2; - this._HorizontalFlipImageBox.Text = "水平翻转"; - this._HorizontalFlipImageBox.UseVisualStyleBackColor = true; - // - // _HideAnnotationsBox - // - this._HideAnnotationsBox.AutoSize = true; - this._HideAnnotationsBox.Location = new System.Drawing.Point(7, 70); - this._HideAnnotationsBox.Name = "_HideAnnotationsBox"; - this._HideAnnotationsBox.Size = new System.Drawing.Size(96, 16); - this._HideAnnotationsBox.TabIndex = 4; - this._HideAnnotationsBox.Text = "隐藏批注内容"; - this._HideAnnotationsBox.UseVisualStyleBackColor = true; - // - // _VerticalFlipImageBox - // - this._VerticalFlipImageBox.AutoSize = true; - this._VerticalFlipImageBox.Location = new System.Drawing.Point(85, 48); - this._VerticalFlipImageBox.Name = "_VerticalFlipImageBox"; - this._VerticalFlipImageBox.Size = new System.Drawing.Size(72, 16); - this._VerticalFlipImageBox.TabIndex = 3; - this._VerticalFlipImageBox.Text = "垂直翻转"; - this._VerticalFlipImageBox.UseVisualStyleBackColor = true; - // - // groupBox2 - // - this.groupBox2.Controls.Add(this._ResolutionBox); - this.groupBox2.Controls.Add(this.label1); - this.groupBox2.Controls.Add(this.label12); - this.groupBox2.Controls.Add(this._ExtractPageImageWidthBox); - this.groupBox2.Controls.Add(this._ExtractPageRatioBox); - this.groupBox2.Controls.Add(this.label13); - this.groupBox2.Controls.Add(this.label10); - this.groupBox2.Controls.Add(this._SpecificRatioBox); - this.groupBox2.Controls.Add(this._SpecificWidthBox); - this.groupBox2.Location = new System.Drawing.Point(193, 97); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(179, 100); - this.groupBox2.TabIndex = 9; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "输出图片尺寸"; - // - // _ResolutionBox - // - this._ResolutionBox.FormattingEnabled = true; - this._ResolutionBox.Items.AddRange(new object[] { - "72", - "96", - "100", - "150", - "200", - "300", - "400", - "600", - "1200", - "2400"}); - this._ResolutionBox.Location = new System.Drawing.Point(86, 74); - this._ResolutionBox.Name = "_ResolutionBox"; - this._ResolutionBox.Size = new System.Drawing.Size(55, 20); - this._ResolutionBox.TabIndex = 1; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(7, 77); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(53, 12); - this.label1.TabIndex = 6; - this.label1.Text = "分辨率:"; - // - // label12 - // - this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(147, 23); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(17, 12); - this.label12.TabIndex = 5; - this.label12.Text = "倍"; - // - // _ExtractPageImageWidthBox - // - this._ExtractPageImageWidthBox.Increment = new decimal(new int[] { - 100, - 0, - 0, - 0}); - this._ExtractPageImageWidthBox.Location = new System.Drawing.Point(86, 48); - this._ExtractPageImageWidthBox.Maximum = new decimal(new int[] { - 10000, - 0, - 0, - 0}); - this._ExtractPageImageWidthBox.Name = "_ExtractPageImageWidthBox"; - this._ExtractPageImageWidthBox.Size = new System.Drawing.Size(55, 21); - this._ExtractPageImageWidthBox.TabIndex = 1; - // - // _ExtractPageRatioBox - // - this._ExtractPageRatioBox.DecimalPlaces = 1; - this._ExtractPageRatioBox.Increment = new decimal(new int[] { - 1, - 0, - 0, - 65536}); - this._ExtractPageRatioBox.Location = new System.Drawing.Point(86, 21); - this._ExtractPageRatioBox.Maximum = new decimal(new int[] { - 20, - 0, - 0, - 0}); - this._ExtractPageRatioBox.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 65536}); - this._ExtractPageRatioBox.Name = "_ExtractPageRatioBox"; - this._ExtractPageRatioBox.Size = new System.Drawing.Size(55, 21); - this._ExtractPageRatioBox.TabIndex = 4; - this._ExtractPageRatioBox.Value = new decimal(new int[] { - 1, - 0, - 0, - 0}); - // - // label13 - // - this.label13.AutoSize = true; - this.label13.Location = new System.Drawing.Point(147, 77); - this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(23, 12); - this.label13.TabIndex = 2; - this.label13.Text = "DPI"; - // - // label10 - // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(147, 50); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(29, 12); - this.label10.TabIndex = 2; - this.label10.Text = "像素"; - // - // _SpecificRatioBox - // - this._SpecificRatioBox.AutoSize = true; - this._SpecificRatioBox.Location = new System.Drawing.Point(9, 21); - this._SpecificRatioBox.Name = "_SpecificRatioBox"; - this._SpecificRatioBox.Size = new System.Drawing.Size(71, 16); - this._SpecificRatioBox.TabIndex = 3; - this._SpecificRatioBox.TabStop = true; - this._SpecificRatioBox.Text = "指定比例"; - this._SpecificRatioBox.UseVisualStyleBackColor = true; - // - // _SpecificWidthBox - // - this._SpecificWidthBox.AutoSize = true; - this._SpecificWidthBox.Location = new System.Drawing.Point(9, 49); - this._SpecificWidthBox.Name = "_SpecificWidthBox"; - this._SpecificWidthBox.Size = new System.Drawing.Size(71, 16); - this._SpecificWidthBox.TabIndex = 0; - this._SpecificWidthBox.TabStop = true; - this._SpecificWidthBox.Text = "指定宽度"; - this._SpecificWidthBox.UseVisualStyleBackColor = true; - // - // groupBox1 - // - this.groupBox1.Controls.Add(this._ColorSpaceRgbBox); - this.groupBox1.Controls.Add(this.label8); - this.groupBox1.Controls.Add(this._QuantizeBox); - this.groupBox1.Controls.Add(this._ColorSpaceGrayBox); - this.groupBox1.Controls.Add(this._InvertColorBox); - this.groupBox1.Location = new System.Drawing.Point(8, 97); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(179, 100); - this.groupBox1.TabIndex = 8; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "颜色"; - // - // _ColorSpaceRgbBox - // - this._ColorSpaceRgbBox.AutoSize = true; - this._ColorSpaceRgbBox.Location = new System.Drawing.Point(55, 22); - this._ColorSpaceRgbBox.Name = "_ColorSpaceRgbBox"; - this._ColorSpaceRgbBox.Size = new System.Drawing.Size(47, 16); - this._ColorSpaceRgbBox.TabIndex = 1; - this._ColorSpaceRgbBox.TabStop = true; - this._ColorSpaceRgbBox.Text = "彩色"; - this._ColorSpaceRgbBox.UseVisualStyleBackColor = true; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(8, 23); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(41, 12); - this.label8.TabIndex = 0; - this.label8.Text = "颜色:"; - // - // _QuantizeBox - // - this._QuantizeBox.AutoSize = true; - this._QuantizeBox.Location = new System.Drawing.Point(10, 70); - this._QuantizeBox.Name = "_QuantizeBox"; - this._QuantizeBox.Size = new System.Drawing.Size(108, 16); - this._QuantizeBox.TabIndex = 4; - this._QuantizeBox.Text = "减少图片的颜色"; - this._QuantizeBox.UseVisualStyleBackColor = true; - // - // _ColorSpaceGrayBox - // - this._ColorSpaceGrayBox.AutoSize = true; - this._ColorSpaceGrayBox.Location = new System.Drawing.Point(108, 22); - this._ColorSpaceGrayBox.Name = "_ColorSpaceGrayBox"; - this._ColorSpaceGrayBox.Size = new System.Drawing.Size(47, 16); - this._ColorSpaceGrayBox.TabIndex = 2; - this._ColorSpaceGrayBox.TabStop = true; - this._ColorSpaceGrayBox.Text = "灰度"; - this._ColorSpaceGrayBox.UseVisualStyleBackColor = true; - // - // label11 - // - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(193, 74); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(89, 12); - this.label11.TabIndex = 5; - this.label11.Text = "JPEG图片质量:"; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(6, 74); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(89, 12); - this.label7.TabIndex = 3; - this.label7.Text = "输出图片格式:"; - // - // _JpegQualityBox - // - this._JpegQualityBox.FormattingEnabled = true; - this._JpegQualityBox.Items.AddRange(new object[] { - "95", - "85", - "75", - "50", - "30"}); - this._JpegQualityBox.Location = new System.Drawing.Point(288, 71); - this._JpegQualityBox.Name = "_JpegQualityBox"; - this._JpegQualityBox.Size = new System.Drawing.Size(86, 20); - this._JpegQualityBox.TabIndex = 6; - // - // _ImageFormatBox - // - this._ImageFormatBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._ImageFormatBox.FormattingEnabled = true; - this._ImageFormatBox.Items.AddRange(new object[] { - "PNG", - "JPEG", - "黑白TIFF"}); - this._ImageFormatBox.Location = new System.Drawing.Point(101, 71); - this._ImageFormatBox.Name = "_ImageFormatBox"; - this._ImageFormatBox.Size = new System.Drawing.Size(78, 20); - this._ImageFormatBox.TabIndex = 4; - // - // tabPage2 - // - this.tabPage2.Controls.Add(this._FileNameMaskBox); - this.tabPage2.Controls.Add(this.label2); - this.tabPage2.Controls.Add(this._AutoOutputDirBox); - this.tabPage2.Controls.Add(this.label5); - this.tabPage2.Controls.Add(this._FileMaskPreviewBox); - this.tabPage2.Location = new System.Drawing.Point(4, 22); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(577, 203); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "文件命名"; - this.tabPage2.UseVisualStyleBackColor = true; - // - // _AutoOutputDirBox - // - this._AutoOutputDirBox.AutoSize = true; - this._AutoOutputDirBox.Location = new System.Drawing.Point(344, 8); - this._AutoOutputDirBox.Name = "_AutoOutputDirBox"; - this._AutoOutputDirBox.Size = new System.Drawing.Size(156, 16); - this._AutoOutputDirBox.TabIndex = 5; - this._AutoOutputDirBox.Text = "自动指定输出图片的位置"; - this._AutoOutputDirBox.UseVisualStyleBackColor = true; - // - // _BrowseTargetPdfButton - // - this._BrowseTargetPdfButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._BrowseTargetPdfButton.Image = global::PDFPatcher.Properties.Resources.ImageFolder; - this._BrowseTargetPdfButton.Location = new System.Drawing.Point(522, 34); - this._BrowseTargetPdfButton.Name = "_BrowseTargetPdfButton"; - this._BrowseTargetPdfButton.Size = new System.Drawing.Size(75, 23); - this._BrowseTargetPdfButton.TabIndex = 3; - this._BrowseTargetPdfButton.Text = "浏览..."; - this._BrowseTargetPdfButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._BrowseTargetPdfButton.UseVisualStyleBackColor = true; - this._BrowseTargetPdfButton.Click += new System.EventHandler(this._BrowseTargetPdfButton_Click); - // - // _TargetBox - // - this._TargetBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._TargetBox.Contents = null; - this._TargetBox.FormattingEnabled = true; - this._TargetBox.Location = new System.Drawing.Point(112, 36); - this._TargetBox.MaxItemCount = 16; - this._TargetBox.Name = "_TargetBox"; - this._TargetBox.Size = new System.Drawing.Size(404, 20); - this._TargetBox.TabIndex = 2; - // - // _SourceFileControl - // - this._SourceFileControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._SourceFileControl.Location = new System.Drawing.Point(12, 3); - this._SourceFileControl.Name = "_SourceFileControl"; - this._SourceFileControl.Size = new System.Drawing.Size(588, 29); - this._SourceFileControl.TabIndex = 0; - // - // _ExtractButton - // - this._ExtractButton.AlternativeFocusBorderColor = System.Drawing.SystemColors.Highlight; - this._ExtractButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._ExtractButton.AnimateGlow = true; - this._ExtractButton.BackColor = System.Drawing.SystemColors.Highlight; - this._ExtractButton.CornerRadius = 3; - this._ExtractButton.ForeColor = System.Drawing.SystemColors.ControlText; - this._ExtractButton.GlowColor = System.Drawing.Color.White; - this._ExtractButton.Image = global::PDFPatcher.Properties.Resources.Save; - this._ExtractButton.InnerBorderColor = System.Drawing.SystemColors.ControlDarkDark; - this._ExtractButton.Location = new System.Drawing.Point(474, 63); - this._ExtractButton.Name = "_ExtractButton"; - this._ExtractButton.OuterBorderColor = System.Drawing.SystemColors.ControlLightLight; - this._ExtractButton.ShowFocusBorder = true; - this._ExtractButton.Size = new System.Drawing.Size(123, 29); - this._ExtractButton.TabIndex = 6; - this._ExtractButton.Text = " 转换图片(&T)"; - this._ExtractButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._ExtractButton.Click += new System.EventHandler(this._ExtractButton_Click); - // - // _RenderToPdfBox - // - this._RenderToPdfBox.AutoSize = true; - this._RenderToPdfBox.Location = new System.Drawing.Point(19, 70); - this._RenderToPdfBox.Name = "_RenderToPdfBox"; - this._RenderToPdfBox.Size = new System.Drawing.Size(162, 16); - this._RenderToPdfBox.TabIndex = 4; - this._RenderToPdfBox.Text = "合并输出到图片 PDF 文件"; - this._RenderToPdfBox.UseVisualStyleBackColor = true; - // - // RenderImageControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this._RenderToPdfBox); - this.Controls.Add(this._ExtractButton); - this.Controls.Add(this.tabControl1); - this.Controls.Add(this._TargetBox); - this.Controls.Add(this.label4); - this.Controls.Add(this._SourceFileControl); - this.Controls.Add(this._BrowseTargetPdfButton); - this.Font = new System.Drawing.Font("SimSun", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.Name = "RenderImageControl"; - this.Size = new System.Drawing.Size(612, 333); - this.Load += new System.EventHandler(this.Control_Show); - this.VisibleChanged += new System.EventHandler(this.Control_Show); - this.tabControl1.ResumeLayout(false); - this.tabPage1.ResumeLayout(false); - this.tabPage1.PerformLayout(); - this.groupBox3.ResumeLayout(false); - this.groupBox3.PerformLayout(); - this.groupBox2.ResumeLayout(false); - this.groupBox2.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this._ExtractPageImageWidthBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this._ExtractPageRatioBox)).EndInit(); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.tabPage2.ResumeLayout(false); - this.tabPage2.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.TextBox _ExtractPageRangeBox; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Button _BrowseTargetPdfButton; - private SourceFileControl _SourceFileControl; - private System.Windows.Forms.FolderBrowserDialog _SaveImageBox; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label _FileMaskPreviewBox; - private System.Windows.Forms.ComboBox _FileNameMaskBox; - private HistoryComboBox _TargetBox; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.CheckBox _InvertColorBox; - private System.Windows.Forms.TabControl tabControl1; - private System.Windows.Forms.TabPage tabPage1; - private System.Windows.Forms.TabPage tabPage2; - private System.Windows.Forms.CheckBox _AutoOutputDirBox; - private System.Windows.Forms.NumericUpDown _ExtractPageImageWidthBox; - private System.Windows.Forms.RadioButton _ColorSpaceGrayBox; - private System.Windows.Forms.RadioButton _ColorSpaceRgbBox; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.ComboBox _ImageFormatBox; - private System.Windows.Forms.CheckBox _VerticalFlipImageBox; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.ComboBox _RotationBox; - private System.Windows.Forms.Label label11; - private System.Windows.Forms.ComboBox _JpegQualityBox; - private System.Windows.Forms.CheckBox _HorizontalFlipImageBox; - private System.Windows.Forms.CheckBox _HideAnnotationsBox; - private System.Windows.Forms.CheckBox _QuantizeBox; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.NumericUpDown _ExtractPageRatioBox; - private System.Windows.Forms.RadioButton _SpecificRatioBox; - private System.Windows.Forms.RadioButton _SpecificWidthBox; - private System.Windows.Forms.Label label12; - private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.GroupBox groupBox3; - private EnhancedGlassButton.GlassButton _ExtractButton; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label13; - private System.Windows.Forms.ComboBox _ResolutionBox; - private System.Windows.Forms.CheckBox _RenderToPdfBox; - } -} diff --git a/pdfpatcher/App/Functions/RenderImageControl.cs b/pdfpatcher/App/Functions/RenderImageControl.cs deleted file mode 100644 index d33042b5d313368bcefe0114c3c18f2084429a29..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/RenderImageControl.cs +++ /dev/null @@ -1,253 +0,0 @@ -using System; -using System.ComponentModel; -using System.IO; -using System.Windows.Forms; -using iTextSharp.text.pdf; -using MuPdfSharp; -using PDFPatcher.Common; - -namespace PDFPatcher.Functions -{ - [ToolboxItem(false)] - public partial class RenderImageControl : FunctionControl, IResettableControl - { - public override string FunctionName => "转换页面为图片"; - - public override System.Drawing.Bitmap IconImage => Properties.Resources.RenderDocument; - - public RenderImageControl() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - } - - void OnLoad() { - _SourceFileControl.BrowseSelectedFiles += (object sender, EventArgs e) => { - if (_AutoOutputDirBox.Checked == false) { - return; - } - var sourceFile = _SourceFileControl.FirstFile; - if (sourceFile.Length > 0) { - _TargetBox.Text = FileHelper.CombinePath(Path.GetDirectoryName(sourceFile), Path.GetFileNameWithoutExtension(sourceFile)); - } - }; - _AutoOutputDirBox.CheckedChanged += (object sender, EventArgs e) => { AppContext.ImageRenderer.AutoOutputFolder = _AutoOutputDirBox.Checked; }; - _ResolutionBox.TextChanged += (s, args) => { - var v = _ResolutionBox.Text.ToSingle(); - if (v <= 0) { - _ResolutionBox.Text = "72"; - } - else if (v > 3000) { - _ResolutionBox.Text = "3000"; - } - }; - _ExtractPageImageWidthBox.GotFocus += (s, args) => { _SpecificWidthBox.Checked = true; }; - _ExtractPageRatioBox.GotFocus += (s, args) => { _SpecificRatioBox.Checked = true; }; - - ShowFileMaskPreview(); - AppContext.MainForm.SetTooltip(_SourceFileControl.FileList, "包含图片的 PDF 文件路径"); - AppContext.MainForm.SetTooltip(_TargetBox, "放置输出图片的文件夹路径"); - AppContext.MainForm.SetTooltip(_ExtractPageRangeBox, "需要提取图片的页码范围,不指定页码范围时提取所有页面的图片"); - AppContext.MainForm.SetTooltip(_FileNameMaskBox, "提取的图片文件名按其所在页码数字命名,可在此修改命名规则\n“0000”:不足四位用0补足四位\n“0”:文件名按实际页码,不用0补位\n可用英文双引号将文本括起来(如“\"相约2000\"0”,前面的“2000”不会被解释为占位符)"); - AppContext.MainForm.SetTooltip(_VerticalFlipImageBox, "某些 PDF 文件导出的图片上下颠倒,可用此选项将其还原"); - AppContext.MainForm.SetTooltip(_InvertColorBox, "翻转 PNG 和 TIFF 黑白图片的颜色"); - AppContext.MainForm.SetTooltip(_QuantizeBox, "尽量减少导出图片所用的颜色,从而减小图片占用的磁盘空间"); - AppContext.MainForm.SetTooltip(_SpecificWidthBox, "指定输出图片的宽度(单位为像素,图片的高度将按比例缩放)"); - AppContext.MainForm.SetTooltip(_SpecificRatioBox, "指定输出图片的放大倍数"); - AppContext.MainForm.SetTooltip(_ExtractPageImageWidthBox, "指定输出图片的宽度(单位为像素,图片的高度将按比例缩放),宽度为 0 时相当于按 1:1 比例输出"); - Reload(); - } - - public void Reset() { - AppContext.ImageRenderer = new ImageRendererOptions(); - Reload(); - } - - public void Reload() { - var o = AppContext.ImageRenderer; - _AutoOutputDirBox.Checked = o.AutoOutputFolder; - _ColorSpaceRgbBox.Checked = !(_ColorSpaceGrayBox.Checked = o.ColorSpace == ColorSpace.Gray); - _FileNameMaskBox.Text = o.FileMask; - _HorizontalFlipImageBox.Checked = o.HorizontalFlipImages; - _HideAnnotationsBox.Checked = o.HideAnnotations; - _ImageFormatBox.SelectedIndex = ValueHelper.MapValue(o.FileFormat, new ImageFormat[] { ImageFormat.Png, ImageFormat.Jpeg, ImageFormat.Tiff }, new int[] { 0, 1, 2 }, 0); - _InvertColorBox.Checked = o.InvertColor; - if (o.JpegQuality > 0 && o.JpegQuality <= 100) { - _JpegQualityBox.Text = ValueHelper.ToText(o.JpegQuality); - } - else { - o.JpegQuality = 75; - _JpegQualityBox.Text = "75"; - } - _QuantizeBox.Checked = o.Quantize; - _ResolutionBox.Text = o.Dpi.ToText(); - _RotationBox.SelectedIndex = ValueHelper.MapValue(o.Rotation, new int[] { 0, 90, 180, 270 }, new int[] { 0, 1, 2, 3 }, 0); - _SpecificRatioBox.Checked = !o.UseSpecificWidth; - _SpecificWidthBox.Checked = o.UseSpecificWidth; - _VerticalFlipImageBox.Checked = o.VerticalFlipImages; - _ExtractPageImageWidthBox.SetValue(o.ImageWidth); - _ExtractPageRatioBox.SetValue(o.ScaleRatio); - } - - private void _BrowseTargetPdfButton_Click(object sender, EventArgs e) { - var sourceFile = _SourceFileControl.Text; - if (_TargetBox.Text.Length > 0) { - _SaveImageBox.SelectedPath = Path.GetDirectoryName(_TargetBox.Text); - } - else if (sourceFile.Length > 0) { - _SaveImageBox.SelectedPath = Path.GetDirectoryName(sourceFile); - } - if (_SaveImageBox.ShowDialog() == DialogResult.OK) { - _TargetBox.Text = - _SaveImageBox.SelectedPath - //+ (_SaveImageBox.SelectedPath.EndsWith ("\\") ? String.Empty : "\\") - //+ Path.GetFileNameWithoutExtension (sourceFile) - ; - } - } - - private void _ExtractButton_Click(object sender, EventArgs e) { - if (File.Exists(_SourceFileControl.FirstFile) == false) { - Common.FormHelper.ErrorBox(Messages.SourceFileNotFound); - return; - } - if (_TargetBox.Text.IsNullOrWhiteSpace()) { - _BrowseTargetPdfButton_Click(_BrowseTargetPdfButton, e); - if (_TargetBox.Text.IsNullOrWhiteSpace()) { - return; - } - } - - AppContext.SourceFiles = _SourceFileControl.Files; - if (_SourceFileControl.Files.Length == 1) { - _SourceFileControl.FileList.AddHistoryItem(); - _TargetBox.AddHistoryItem(); - } - - AppContext.MainForm.ResetWorker(); - var worker = AppContext.MainForm.GetWorker(); - worker.DoWork += (dummy, arg) => { - var a = arg.Argument as object[]; - var files = a[0] as string[]; - var options = a[1] as ImageRendererOptions; - FilePath target = new FilePath(options.ExtractImagePath).Normalize(); - options.ExtractImagePath = target; - if (target.HasExtension(Constants.FileExtensions.Pdf)) { - using (var f = target.OpenFileWriter(true)) { - var doc = new iTextSharp.text.Document(); - using (var w = PdfWriter.GetInstance(doc, f)) { - doc.Open(); - doc.AddCreator(Application.ProductName + " " + Application.ProductVersion); - doc.SetMargins(0, 0, 0, 0); - foreach (var file in files) { - Processor.Worker.RenderPagesToPdf(file, options, doc); - Tracker.IncrementTotalProgress(); - if (AppContext.Abort) { - return; - } - } - doc.Close(); - } - } - return; - } - if (files.Length > 1) { - var ep = options.ExtractImagePath; - foreach (var file in files) { - options.ExtractImagePath = new FilePath(ep).Combine(new FilePath(file).FileNameWithoutExtension).Normalize(); - Processor.Worker.RenderPages(file, options); - Tracker.IncrementTotalProgress(); - if (AppContext.Abort) { - return; - } - } - } - else { - Processor.Worker.RenderPages(files[0], options); - } - }; - worker.RunWorkerCompleted += (dummy, arg) => { AppContext.ImageExtracter.OutputPath = _ExtractPageRangeBox.Text; }; - var option = AppContext.ImageRenderer; - option.ColorSpace = _ColorSpaceRgbBox.Checked ? ColorSpace.Rgb : ColorSpace.Gray; - option.ExtractPageRange = _ExtractPageRangeBox.Text; - option.ExtractImagePath = _RenderToPdfBox.Checked - ? GetRenderedPdfFileName(_TargetBox.Text) - : _TargetBox.Text; - option.FileMask = _FileNameMaskBox.Text; - option.HideAnnotations = _HideAnnotationsBox.Checked; - option.HorizontalFlipImages = _HorizontalFlipImageBox.Checked; - option.InvertColor = _InvertColorBox.Checked; - option.FileFormat = ValueHelper.MapValue(_ImageFormatBox.SelectedIndex, new int[] { 0, 1, 2 }, new ImageFormat[] { ImageFormat.Png, ImageFormat.Jpeg, ImageFormat.Tiff }, ImageFormat.Png); - option.ImageWidth = (int)_ExtractPageImageWidthBox.Value; - option.JpegQuality = _JpegQualityBox.Text.TryParse(out int j) - ? j > 0 && j <= 100 ? j : 75 - : 75; - option.Quantize = _QuantizeBox.Checked; - option.Dpi = _ResolutionBox.Text.ToSingle(); - option.Rotation = _RotationBox.SelectedIndex * 90; - option.ScaleRatio = (float)_ExtractPageRatioBox.Value; - option.UseSpecificWidth = _SpecificWidthBox.Checked; - option.VerticalFlipImages = _VerticalFlipImageBox.Checked; - worker.RunWorkerAsync( - new object[] { - AppContext.SourceFiles, option - }); - option = null; - - } - - static string GetRenderedPdfFileName(string target) { - var p = new FilePath(target).Normalize(); - if (p.HasExtension(Constants.FileExtensions.Pdf) == false) { - target = p.Combine(new FilePath(AppContext.SourceFiles[0]).FileName); - } - foreach (var f in AppContext.SourceFiles) { - if (new FilePath(f).Equals(target)) { - return FileHelper.GetNewFileNameFromSourceFile(target, Constants.FileExtensions.Pdf); - } - } - return target; - } - - #region IDefaultButtonControl 成员 - - public override Button DefaultButton => _ExtractButton; - - #endregion - - private void _GoToImportImageLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { - AppContext.MainForm.SelectFunctionList(Function.Patcher); - } - - private void _FileNameMaskBox_TextChanged(object sender, EventArgs e) { - ShowFileMaskPreview(); - } - - private void ShowFileMaskPreview() { - try { - var previews = new string[7]; - var f = _FileNameMaskBox.Text; - previews[0] = 1.ToString(f) + ".jpg"; - previews[1] = 2.ToString(f) + ".jpg"; - previews[2] = 3.ToString(f) + ".jpg ..."; - previews[3] = "\n" + 11.ToString(f) + ".jpg"; - previews[4] = 12.ToString(f) + ".jpg"; - previews[5] = 13.ToString(f) + ".jpg ..."; - previews[6] = 100.ToString(f) + ".jpg"; - _FileMaskPreviewBox.Text = String.Join(" ", previews); - } - catch (Exception) { - _FileMaskPreviewBox.Text = "文件名掩码无效。"; - } - } - - private void Control_Show(object sender, EventArgs e) { - if (Visible && AppContext.MainForm != null) { - _TargetBox.Contents = AppContext.Recent.Folders; - } - //else if (this.Visible == false) { - // this._TargetBox.DataSource = null; - //} - } - - } -} diff --git a/pdfpatcher/App/Functions/RenderImageControl.resx b/pdfpatcher/App/Functions/RenderImageControl.resx deleted file mode 100644 index c4b98ad33e7261fba577c970a1e177505374fc9b..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/RenderImageControl.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/ReportControl.Designer.cs b/pdfpatcher/App/Functions/ReportControl.Designer.cs deleted file mode 100644 index 746e848f3035a10b874b81d03506edad32fe7e16..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/ReportControl.Designer.cs +++ /dev/null @@ -1,209 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class ReportControl - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._ProgressBar = new System.Windows.Forms.ProgressBar(); - this.label2 = new System.Windows.Forms.Label(); - this._CancelButton = new System.Windows.Forms.Button(); - this.label3 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this._InputFileBox = new System.Windows.Forms.TextBox(); - this._OutputFileBox = new System.Windows.Forms.TextBox(); - this._TotalProgressBar = new System.Windows.Forms.ProgressBar(); - this.label6 = new System.Windows.Forms.Label(); - this._LogBox = new RichTextBoxLinks.RichTextBoxEx(); - this.SuspendLayout(); - // - // _ProgressBar - // - this._ProgressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._ProgressBar.Location = new System.Drawing.Point(111, 302); - this._ProgressBar.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._ProgressBar.Name = "_ProgressBar"; - this._ProgressBar.Size = new System.Drawing.Size(447, 21); - this._ProgressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous; - this._ProgressBar.TabIndex = 8; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(15, 65); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(82, 15); - this.label2.TabIndex = 5; - this.label2.Text = "日志内容:"; - // - // _CancelButton - // - this._CancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._CancelButton.Image = global::PDFPatcher.Properties.Resources.Return; - this._CancelButton.Location = new System.Drawing.Point(565, 302); - this._CancelButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._CancelButton.Name = "_CancelButton"; - this._CancelButton.Size = new System.Drawing.Size(100, 42); - this._CancelButton.TabIndex = 9; - this._CancelButton.Text = "返回(&F)"; - this._CancelButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._CancelButton.UseVisualStyleBackColor = true; - this._CancelButton.Click += new System.EventHandler(this._CancelButton_Click); - // - // label3 - // - this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(16, 302); - this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(82, 15); - this.label3.TabIndex = 7; - this.label3.Text = "执行进度:"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(16, 15); - this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(82, 15); - this.label4.TabIndex = 1; - this.label4.Text = "输入文件:"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(16, 42); - this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(82, 15); - this.label5.TabIndex = 3; - this.label5.Text = "输出文件:"; - // - // _InputFileBox - // - this._InputFileBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._InputFileBox.BackColor = System.Drawing.SystemColors.Control; - this._InputFileBox.BorderStyle = System.Windows.Forms.BorderStyle.None; - this._InputFileBox.Location = new System.Drawing.Point(111, 13); - this._InputFileBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._InputFileBox.Name = "_InputFileBox"; - this._InputFileBox.ReadOnly = true; - this._InputFileBox.Size = new System.Drawing.Size(551, 18); - this._InputFileBox.TabIndex = 2; - // - // _OutputFileBox - // - this._OutputFileBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._OutputFileBox.BackColor = System.Drawing.SystemColors.Control; - this._OutputFileBox.BorderStyle = System.Windows.Forms.BorderStyle.None; - this._OutputFileBox.Location = new System.Drawing.Point(111, 40); - this._OutputFileBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._OutputFileBox.Name = "_OutputFileBox"; - this._OutputFileBox.ReadOnly = true; - this._OutputFileBox.Size = new System.Drawing.Size(551, 18); - this._OutputFileBox.TabIndex = 4; - // - // _TotalProgressBar - // - this._TotalProgressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._TotalProgressBar.Location = new System.Drawing.Point(111, 324); - this._TotalProgressBar.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this._TotalProgressBar.Name = "_TotalProgressBar"; - this._TotalProgressBar.Size = new System.Drawing.Size(447, 21); - this._TotalProgressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous; - this._TotalProgressBar.TabIndex = 8; - // - // label6 - // - this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(16, 324); - this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(82, 15); - this.label6.TabIndex = 7; - this.label6.Text = "总体进度:"; - // - // _LogBox - // - this._LogBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._LogBox.BackColor = System.Drawing.SystemColors.Window; - this._LogBox.Location = new System.Drawing.Point(17, 84); - this._LogBox.Margin = new System.Windows.Forms.Padding(4); - this._LogBox.Name = "_LogBox"; - this._LogBox.ReadOnly = true; - this._LogBox.Size = new System.Drawing.Size(645, 210); - this._LogBox.TabIndex = 6; - this._LogBox.Text = ""; - this._LogBox.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this._LogBox_LinkClicked); - // - // ReportControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this._OutputFileBox); - this.Controls.Add(this._InputFileBox); - this.Controls.Add(this.label5); - this.Controls.Add(this.label4); - this.Controls.Add(this.label6); - this.Controls.Add(this.label3); - this.Controls.Add(this._CancelButton); - this.Controls.Add(this.label2); - this.Controls.Add(this._TotalProgressBar); - this.Controls.Add(this._ProgressBar); - this.Controls.Add(this._LogBox); - this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.Name = "ReportControl"; - this.Size = new System.Drawing.Size(680, 359); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - internal System.Windows.Forms.ProgressBar _ProgressBar; - private System.Windows.Forms.Label label2; - internal RichTextBoxLinks.RichTextBoxEx _LogBox; - private System.Windows.Forms.Button _CancelButton; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label5; - internal System.Windows.Forms.TextBox _InputFileBox; - internal System.Windows.Forms.TextBox _OutputFileBox; - internal System.Windows.Forms.ProgressBar _TotalProgressBar; - private System.Windows.Forms.Label label6; - - } -} diff --git a/pdfpatcher/App/Functions/ReportControl.cs b/pdfpatcher/App/Functions/ReportControl.cs deleted file mode 100644 index ab3bcdcadd41be0f079f9d1af47db9a0cd47f798..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/ReportControl.cs +++ /dev/null @@ -1,127 +0,0 @@ -using System; -using System.IO; -using System.Windows.Forms; - -namespace PDFPatcher.Functions -{ - public partial class ReportControl : UserControl - { - public ReportControl() { - InitializeComponent(); - } - - protected override void OnVisibleChanged(EventArgs e) { - base.OnVisibleChanged(e); - if (Visible) { - FindForm().AcceptButton = _CancelButton; - _CancelButton.Focus(); - } - } - - private void _CancelButton_Click(object sender, EventArgs e) { - if (AppContext.MainForm.IsWorkerBusy == false) { - Hide(); - } - else { - if (Common.FormHelper.YesNoBox("程序正在工作,是否终止执行?") == DialogResult.Yes) { - AppContext.MainForm.GetWorker().CancelAsync(); - AppContext.Abort = true; - } - } - } - - - #region IDefaultButtonControl 成员 - - //public override Button DefaultButton { - // get { return _CancelButton; } - //} - - #endregion - - internal void SetGoal(int goalValue) { - _ProgressBar.Value = 0; - _ProgressBar.Maximum = goalValue; - } - internal void SetTotalGoal(int goalValue) { - _TotalProgressBar.Value = 0; - _TotalProgressBar.Maximum = goalValue; - } - internal void SetProgress(int p) { - _ProgressBar.Value = p > _ProgressBar.Maximum ? _ProgressBar.Maximum : p; - } - internal void IncrementProgress(int progress) { - _ProgressBar.Increment(progress); - } - internal void IncrementTotalProgress() { - try { - _TotalProgressBar.Value++; - } - catch (ArgumentException) { - System.Diagnostics.Debug.WriteLine("Total Progress too big: " + _TotalProgressBar.Value); - } - } - internal void PrintMessage(string text, Tracker.Category category) { - switch (category) { - case Tracker.Category.Message: - goto default; - case Tracker.Category.ImportantMessage: - _LogBox.SelectionColor = System.Drawing.Color.DarkBlue; - Common.FormHelper.InsertLinkedText(_LogBox, text); - _LogBox.AppendText(Environment.NewLine); - break; - case Tracker.Category.Alert: - _LogBox.SelectionFont = new System.Drawing.Font(_LogBox.Font, System.Drawing.FontStyle.Bold); - _LogBox.SelectionColor = System.Drawing.Color.Blue; - Common.FormHelper.InsertLinkedText(_LogBox, text); - _LogBox.AppendText(Environment.NewLine); - break; - case Tracker.Category.Error: - _LogBox.SelectionFont = new System.Drawing.Font(_LogBox.Font, System.Drawing.FontStyle.Bold); - _LogBox.SelectionColor = System.Drawing.Color.Red; - goto default; - case Tracker.Category.Notice: - _LogBox.SelectionColor = System.Drawing.Color.DarkMagenta; - goto default; - case Tracker.Category.InputFile: - _InputFileBox.Text = text; - break; - case Tracker.Category.OutputFile: - _OutputFileBox.Text = text; - break; - default: - _LogBox.AppendText(text); - _LogBox.AppendText(Environment.NewLine); - break; - } - } - internal void Reset() { - _LogBox.Clear(); - _ProgressBar.Value = 0; - _TotalProgressBar.Value = 0; - _InputFileBox.Text = String.Empty; - _OutputFileBox.Text = String.Empty; - _CancelButton.Text = "取消"; - _CancelButton.Image = Properties.Resources.Reset; - } - internal void Complete() { - _ProgressBar.Value = _ProgressBar.Maximum; - _TotalProgressBar.Value = _TotalProgressBar.Maximum; - _CancelButton.Text = "返回"; - _CancelButton.Image = Properties.Resources.Return; - } - - private void _LogBox_LinkClicked(object sender, LinkClickedEventArgs e) { - var f = e.LinkText; - if (File.Exists(f) || Directory.Exists(f)) { - try { - System.Diagnostics.Process.Start(f); - } - catch (Exception) { - Common.FormHelper.ErrorBox("无法打开文件:" + f); - } - } - } - - } -} diff --git a/pdfpatcher/App/Functions/ReportControl.resx b/pdfpatcher/App/Functions/ReportControl.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/ReportControl.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/RichTextBoxEx.cs b/pdfpatcher/App/Functions/RichTextBoxEx.cs deleted file mode 100644 index 9a42970ec17d5afe8223f1660c67b6455701b1f8..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/RichTextBoxEx.cs +++ /dev/null @@ -1,260 +0,0 @@ -using System; -using System.ComponentModel; -using System.Drawing; -using System.Runtime.InteropServices; -using System.Windows.Forms; - -namespace RichTextBoxLinks -{ - public class RichTextBoxEx : RichTextBox - { - #region Interop-Definitions - [StructLayout(LayoutKind.Sequential)] - struct CHARFORMAT2_STRUCT - { - public UInt32 cbSize; - public UInt32 dwMask; - public UInt32 dwEffects; - public Int32 yHeight; - public Int32 yOffset; - public Int32 crTextColor; - public byte bCharSet; - public byte bPitchAndFamily; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public char[] szFaceName; - public UInt16 wWeight; - public UInt16 sSpacing; - public int crBackColor; // Color.ToArgb() -> int - public int lcid; - public int dwReserved; - public Int16 sStyle; - public Int16 wKerning; - public byte bUnderlineType; - public byte bAnimation; - public byte bRevAuthor; - public byte bReserved1; - } - - [DllImport("user32.dll", CharSet = CharSet.Auto)] - static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam); - - const int WM_USER = 0x0400; - const int EM_GETCHARFORMAT = WM_USER + 58; - const int EM_SETCHARFORMAT = WM_USER + 68; - - const int SCF_SELECTION = 0x0001; - const int SCF_WORD = 0x0002; - const int SCF_ALL = 0x0004; - - #region CHARFORMAT2 Flags - const UInt32 CFE_BOLD = 0x0001; - const UInt32 CFE_ITALIC = 0x0002; - const UInt32 CFE_UNDERLINE = 0x0004; - const UInt32 CFE_STRIKEOUT = 0x0008; - const UInt32 CFE_PROTECTED = 0x0010; - const UInt32 CFE_LINK = 0x0020; - const UInt32 CFE_AUTOCOLOR = 0x40000000; - const UInt32 CFE_SUBSCRIPT = 0x00010000; /* Superscript and subscript are */ - const UInt32 CFE_SUPERSCRIPT = 0x00020000; /* mutually exclusive */ - - const int CFM_SMALLCAPS = 0x0040; /* (*) */ - const int CFM_ALLCAPS = 0x0080; /* Displayed by 3.0 */ - const int CFM_HIDDEN = 0x0100; /* Hidden by 3.0 */ - const int CFM_OUTLINE = 0x0200; /* (*) */ - const int CFM_SHADOW = 0x0400; /* (*) */ - const int CFM_EMBOSS = 0x0800; /* (*) */ - const int CFM_IMPRINT = 0x1000; /* (*) */ - const int CFM_DISABLED = 0x2000; - const int CFM_REVISED = 0x4000; - - const int CFM_BACKCOLOR = 0x04000000; - const int CFM_LCID = 0x02000000; - const int CFM_UNDERLINETYPE = 0x00800000; /* Many displayed by 3.0 */ - const int CFM_WEIGHT = 0x00400000; - const int CFM_SPACING = 0x00200000; /* Displayed by 3.0 */ - const int CFM_KERNING = 0x00100000; /* (*) */ - const int CFM_STYLE = 0x00080000; /* (*) */ - const int CFM_ANIMATION = 0x00040000; /* (*) */ - const int CFM_REVAUTHOR = 0x00008000; - - - const UInt32 CFM_BOLD = 0x00000001; - const UInt32 CFM_ITALIC = 0x00000002; - const UInt32 CFM_UNDERLINE = 0x00000004; - const UInt32 CFM_STRIKEOUT = 0x00000008; - const UInt32 CFM_PROTECTED = 0x00000010; - const UInt32 CFM_LINK = 0x00000020; - const UInt32 CFM_SIZE = 0x80000000; - const UInt32 CFM_COLOR = 0x40000000; - const UInt32 CFM_FACE = 0x20000000; - const UInt32 CFM_OFFSET = 0x10000000; - const UInt32 CFM_CHARSET = 0x08000000; - const UInt32 CFM_SUBSCRIPT = CFE_SUBSCRIPT | CFE_SUPERSCRIPT; - const UInt32 CFM_SUPERSCRIPT = CFM_SUBSCRIPT; - - const byte CFU_UNDERLINENONE = 0x00000000; - const byte CFU_UNDERLINE = 0x00000001; - const byte CFU_UNDERLINEWORD = 0x00000002; /* (*) displayed as ordinary underline */ - const byte CFU_UNDERLINEDOUBLE = 0x00000003; /* (*) displayed as ordinary underline */ - const byte CFU_UNDERLINEDOTTED = 0x00000004; - const byte CFU_UNDERLINEDASH = 0x00000005; - const byte CFU_UNDERLINEDASHDOT = 0x00000006; - const byte CFU_UNDERLINEDASHDOTDOT = 0x00000007; - const byte CFU_UNDERLINEWAVE = 0x00000008; - const byte CFU_UNDERLINETHICK = 0x00000009; - const byte CFU_UNDERLINEHAIRLINE = 0x0000000A; /* (*) displayed as ordinary underline */ - - #endregion - - #endregion - - public RichTextBoxEx() { - // Otherwise, non-standard links get lost when user starts typing - // next to a non-standard link - DetectUrls = false; - } - - [DefaultValue(false)] - public new bool DetectUrls { - get => base.DetectUrls; - set => base.DetectUrls = value; - } - - /// - /// Insert a given text as a link into the RichTextBox at the current insert position. - /// - /// Text to be inserted - public void InsertLink(string text) { - InsertLink(text, SelectionStart); - } - - /// - /// Insert a given text at a given position as a link. - /// - /// Text to be inserted - /// Insert position - public void InsertLink(string text, int position) { - if (position < 0 || position > Text.Length) - throw new ArgumentOutOfRangeException("position"); - - SelectionStart = position; - SelectedText = text; - Select(position, text.Length); - SetSelectionLink(true); - Select(position + text.Length, 0); - } - - /// - /// Insert a given text at at the current input position as a link. - /// The link text is followed by a hash (#) and the given hyperlink text, both of - /// them invisible. - /// When clicked on, the whole link text and hyperlink string are given in the - /// LinkClickedEventArgs. - /// - /// Text to be inserted - /// Invisible hyperlink string to be inserted - public void InsertLink(string text, string hyperlink) { - InsertLink(text, hyperlink, SelectionStart); - } - - /// - /// Insert a given text at a given position as a link. The link text is followed by - /// a hash (#) and the given hyperlink text, both of them invisible. - /// When clicked on, the whole link text and hyperlink string are given in the - /// LinkClickedEventArgs. - /// - /// Text to be inserted - /// Invisible hyperlink string to be inserted - /// Insert position - public void InsertLink(string text, string hyperlink, int position) { - if (position < 0 || position > Text.Length) - throw new ArgumentOutOfRangeException("position"); - - SelectionStart = position; - SelectedRtf = @"{\rtf1\ansi " + text + @"\v #" + hyperlink + @"\v0}"; - Select(position, text.Length + hyperlink.Length + 1); - SetSelectionLink(true); - Select(position + text.Length + hyperlink.Length + 1, 0); - } - - /// - /// Set the current selection's link style - /// - /// true: set link style, false: clear link style - public void SetSelectionLink(bool link) { - SetSelectionStyle(CFM_LINK, link ? CFE_LINK : 0); - } - /// - /// Get the link style for the current selection - /// - /// 0: link style not set, 1: link style set, -1: mixed - public int GetSelectionLink() { - return GetSelectionStyle(CFM_LINK, CFE_LINK); - } - - public void SetSelectionFontSize(float size) { - var cf = new CHARFORMAT2_STRUCT { - dwMask = CFM_SIZE - }; - cf.cbSize = (UInt32)Marshal.SizeOf(cf); - cf.yHeight = (int)(size * 20f); - - IntPtr wpar = new IntPtr(SCF_SELECTION); - IntPtr lpar = Marshal.AllocCoTaskMem(Marshal.SizeOf(cf)); - Marshal.StructureToPtr(cf, lpar, false); - IntPtr res = SendMessage(Handle, EM_SETCHARFORMAT, wpar, lpar); - Marshal.FreeCoTaskMem(lpar); - } - - public void SetSelectionBold(bool bold) { - SetSelectionStyle(CFM_BOLD, bold ? CFE_BOLD : 0); - } - public void SetSelectionUnderline(bool underline) { - SetSelectionStyle(CFM_UNDERLINE, underline ? CFE_UNDERLINE : 0); - } - - void SetSelectionStyle(UInt32 mask, UInt32 effect) { - var cf = new CHARFORMAT2_STRUCT(); - cf.cbSize = (UInt32)Marshal.SizeOf(cf); - cf.dwMask = mask; - cf.dwEffects = effect; - - IntPtr wpar = new IntPtr(SCF_SELECTION); - IntPtr lpar = Marshal.AllocCoTaskMem(Marshal.SizeOf(cf)); - Marshal.StructureToPtr(cf, lpar, false); - - IntPtr res = SendMessage(Handle, EM_SETCHARFORMAT, wpar, lpar); - - Marshal.FreeCoTaskMem(lpar); - } - - int GetSelectionStyle(UInt32 mask, UInt32 effect) { - var cf = new CHARFORMAT2_STRUCT(); - cf.cbSize = (UInt32)Marshal.SizeOf(cf); - cf.szFaceName = new char[32]; - - IntPtr wpar = new IntPtr(SCF_SELECTION); - IntPtr lpar = Marshal.AllocCoTaskMem(Marshal.SizeOf(cf)); - Marshal.StructureToPtr(cf, lpar, false); - - IntPtr res = SendMessage(Handle, EM_GETCHARFORMAT, wpar, lpar); - - cf = (CHARFORMAT2_STRUCT)Marshal.PtrToStructure(lpar, typeof(CHARFORMAT2_STRUCT)); - - int state; - // dwMask holds the information which properties are consistent throughout the selection: - if ((cf.dwMask & mask) == mask) { - if ((cf.dwEffects & effect) == effect) - state = 1; - else - state = 0; - } - else { - state = -1; - } - - Marshal.FreeCoTaskMem(lpar); - return state; - } - } -} diff --git a/pdfpatcher/App/Functions/SourceFileControl.Designer.cs b/pdfpatcher/App/Functions/SourceFileControl.Designer.cs deleted file mode 100644 index dd91c9f5042283f07afa59cdb8a5468b13f95ca2..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/SourceFileControl.Designer.cs +++ /dev/null @@ -1,115 +0,0 @@ -namespace PDFPatcher -{ - partial class SourceFileControl - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.label1 = new System.Windows.Forms.Label(); - this._BrowseSourcePdfButton = new System.Windows.Forms.Button(); - this._OpenPdfBox = new System.Windows.Forms.OpenFileDialog(); - this.panel1 = new System.Windows.Forms.Panel(); - this._SourcePdfBox = new PDFPatcher.HistoryComboBox(); - this.panel1.SuspendLayout(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(3, 6); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(95, 12); - this.label1.TabIndex = 0; - this.label1.Text = "原始 &PDF 文件:"; - // - // _BrowseSourcePdfButton - // - this._BrowseSourcePdfButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._BrowseSourcePdfButton.Image = global::PDFPatcher.Properties.Resources.OriginalPdfFile; - this._BrowseSourcePdfButton.Location = new System.Drawing.Point(391, 1); - this._BrowseSourcePdfButton.Name = "_BrowseSourcePdfButton"; - this._BrowseSourcePdfButton.Size = new System.Drawing.Size(75, 23); - this._BrowseSourcePdfButton.TabIndex = 2; - this._BrowseSourcePdfButton.Text = "浏览(&L)"; - this._BrowseSourcePdfButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._BrowseSourcePdfButton.UseVisualStyleBackColor = true; - this._BrowseSourcePdfButton.Click += new System.EventHandler(this._BrowseSourcePdfButton_Click); - // - // _OpenPdfBox - // - this._OpenPdfBox.DefaultExt = "pdf"; - this._OpenPdfBox.Filter = "PDF 文件(*.pdf)|*.pdf"; - this._OpenPdfBox.Multiselect = true; - this._OpenPdfBox.Title = "打开 PDF 源文件"; - // - // panel1 - // - this.panel1.Controls.Add(this._SourcePdfBox); - this.panel1.Controls.Add(this.label1); - this.panel1.Controls.Add(this._BrowseSourcePdfButton); - this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel1.Location = new System.Drawing.Point(0, 0); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(469, 26); - this.panel1.TabIndex = 4; - // - // _SourcePdfBox - // - this._SourcePdfBox.AllowDrop = true; - this._SourcePdfBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._SourcePdfBox.Contents = null; - this._SourcePdfBox.FormattingEnabled = true; - this._SourcePdfBox.Location = new System.Drawing.Point(104, 3); - this._SourcePdfBox.MaxItemCount = 16; - this._SourcePdfBox.Name = "_SourcePdfBox"; - this._SourcePdfBox.Size = new System.Drawing.Size(281, 20); - this._SourcePdfBox.TabIndex = 3; - this._SourcePdfBox.DragDrop += new System.Windows.Forms.DragEventHandler(this._SourcePdfBox_DragDrop); - this._SourcePdfBox.DragEnter += new System.Windows.Forms.DragEventHandler(this._SourcePdfBox_DragEnter); - this._SourcePdfBox.TextChanged += new System.EventHandler(this._SourcePdfBox_TextChanged); - // - // SourceFileControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.Controls.Add(this.panel1); - this.Name = "SourceFileControl"; - this.Size = new System.Drawing.Size(469, 26); - this.Load += new System.EventHandler(this.SourceFileControl_Show); - this.VisibleChanged += new System.EventHandler(this.SourceFileControl_Show); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Button _BrowseSourcePdfButton; - private System.Windows.Forms.OpenFileDialog _OpenPdfBox; - private HistoryComboBox _SourcePdfBox; - private System.Windows.Forms.Panel panel1; - } -} diff --git a/pdfpatcher/App/Functions/SourceFileControl.cs b/pdfpatcher/App/Functions/SourceFileControl.cs deleted file mode 100644 index 9de63cd5af69f6ba2f86814f4ff7ff63f0f46b06..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/SourceFileControl.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System; -using System.ComponentModel; -using System.Windows.Forms; -using PDFPatcher.Common; - -namespace PDFPatcher -{ - public partial class SourceFileControl : UserControl - { - bool _controlLockDown; - public SourceFileControl() { - _controlLockDown = true; - InitializeComponent(); - _controlLockDown = false; - Files = new string[] { }; - } - - ///获取文件下拉列表框。 - internal HistoryComboBox FileList => _SourcePdfBox; - - ///点击浏览按钮更改选中文件后触发的事件。 - public event EventHandler BrowseSelectedFiles; - - /// - /// 获取选定的 PDF 文件列表。 - /// - internal string[] Files { get; set; } - /// - /// 获取选定的 PDF 文件列表的第一项。 - /// - internal string FirstFile => Files != null && Files.Length > 0 ? Files[0] : String.Empty; - - [DefaultValue(null)] - public override string Text { - get => _SourcePdfBox.Text; - set => _SourcePdfBox.Text = value; - } - - /////获取或指定文本标签的值。 - //[Description ("文本标签的值")] - //public string Label { - // get { return this.label1.Text; } - // set { this.label1.Text = value; } - //} - - /////获取或指定是否可多选文件。 - //[Description ("是否可多选文件")] - //public bool MultiSelect { - // get { return this._OpenPdfBox.Multiselect; } - // set { this._OpenPdfBox.Multiselect = value; } - //} - - void _BrowseSourcePdfButton_Click(object sender, EventArgs e) { - var t = _SourcePdfBox.Text; - if (t.Length > 0 - && FileHelper.IsPathValid(t) - && System.IO.Path.GetFileName(t).Length > 0) { - _OpenPdfBox.FileName = t; - } - if (_OpenPdfBox.ShowDialog() == DialogResult.OK) { - SelectFiles(_OpenPdfBox.FileNames); - if (BrowseSelectedFiles != null) { - BrowseSelectedFiles(sender, e); - } - } - } - - void SelectFiles(string[] files) { - var t = _SourcePdfBox.Text; - if (files.Length > 1) { - Text = String.Concat("<选定了 ", files.Length, " 个文件>", System.IO.Path.GetDirectoryName(files[0])); - } - else if (files[0] != t) { - Text = files[0]; - } - Files = files; - } - - void _SourcePdfBox_TextChanged(object sender, EventArgs e) { - if (_controlLockDown == true) { - return; - } - if (FileHelper.HasFileNameMacro(_SourcePdfBox.Text) == false) { - SelectFiles(new string[] { _SourcePdfBox.Text }); - } - } - - void _SourcePdfBox_DragEnter(object sender, DragEventArgs e) { - FormHelper.FeedbackDragFileOver(e, Constants.FileExtensions.Pdf); - } - - void _SourcePdfBox_DragDrop(object sender, DragEventArgs e) { - var files = FormHelper.DropFileOver(e, Constants.FileExtensions.Pdf); - SelectFiles(files); - } - - void SourceFileControl_Show(object sender, EventArgs e) { - _controlLockDown = true; - var t = Text; - if (Visible && AppContext.MainForm != null) { - _SourcePdfBox.Contents = AppContext.Recent.SourcePdfFiles; - } - else if (Visible == false) { - _SourcePdfBox.Contents = null; - } - Text = t; - _controlLockDown = false; - } - } -} diff --git a/pdfpatcher/App/Functions/SourceFileControl.resx b/pdfpatcher/App/Functions/SourceFileControl.resx deleted file mode 100644 index a38baa00a32ea69a53bdb30a95ac1a239a93c16e..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/SourceFileControl.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/SourceImageOptionForm.Designer.cs b/pdfpatcher/App/Functions/SourceImageOptionForm.Designer.cs deleted file mode 100644 index 8306081436037720a946bb248cb22ccdf434f291..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/SourceImageOptionForm.Designer.cs +++ /dev/null @@ -1,339 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class SourceImageOptionForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._OkButton = new System.Windows.Forms.Button (); - this._CancelButton = new System.Windows.Forms.Button (); - this.label2 = new System.Windows.Forms.Label (); - this._SourceFileBox = new System.Windows.Forms.TextBox (); - this.label12 = new System.Windows.Forms.Label (); - this.label11 = new System.Windows.Forms.Label (); - this.label9 = new System.Windows.Forms.Label (); - this._MinCropWidthBox = new System.Windows.Forms.NumericUpDown (); - this._MinCropHeightBox = new System.Windows.Forms.NumericUpDown (); - this.label5 = new System.Windows.Forms.Label (); - this._RightMarginBox = new System.Windows.Forms.NumericUpDown (); - this._LeftMarginBox = new System.Windows.Forms.NumericUpDown (); - this._BottomMarginBox = new System.Windows.Forms.NumericUpDown (); - this._TopMarginBox = new System.Windows.Forms.NumericUpDown (); - this.label7 = new System.Windows.Forms.Label (); - this.label3 = new System.Windows.Forms.Label (); - this.label6 = new System.Windows.Forms.Label (); - this.label4 = new System.Windows.Forms.Label (); - ((System.ComponentModel.ISupportInitialize)(this._MinCropWidthBox)).BeginInit (); - ((System.ComponentModel.ISupportInitialize)(this._MinCropHeightBox)).BeginInit (); - ((System.ComponentModel.ISupportInitialize)(this._RightMarginBox)).BeginInit (); - ((System.ComponentModel.ISupportInitialize)(this._LeftMarginBox)).BeginInit (); - ((System.ComponentModel.ISupportInitialize)(this._BottomMarginBox)).BeginInit (); - ((System.ComponentModel.ISupportInitialize)(this._TopMarginBox)).BeginInit (); - this.SuspendLayout (); - // - // _OkButton - // - this._OkButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._OkButton.Location = new System.Drawing.Point (226, 137); - this._OkButton.Name = "_OkButton"; - this._OkButton.Size = new System.Drawing.Size (75, 23); - this._OkButton.TabIndex = 5; - this._OkButton.Text = "确定(&Q)"; - this._OkButton.UseVisualStyleBackColor = true; - this._OkButton.Click += new System.EventHandler (this._OkButton_Click); - // - // _CancelButton - // - this._CancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this._CancelButton.Location = new System.Drawing.Point (307, 137); - this._CancelButton.Name = "_CancelButton"; - this._CancelButton.Size = new System.Drawing.Size (75, 23); - this._CancelButton.TabIndex = 6; - this._CancelButton.Text = "取消(&X)"; - this._CancelButton.UseVisualStyleBackColor = true; - this._CancelButton.Click += new System.EventHandler (this._CancelButton_Click); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point (12, 9); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size (53, 12); - this.label2.TabIndex = 7; - this.label2.Text = "文件名:"; - // - // _SourceFileBox - // - this._SourceFileBox.Enabled = false; - this._SourceFileBox.Location = new System.Drawing.Point (14, 24); - this._SourceFileBox.Name = "_SourceFileBox"; - this._SourceFileBox.Size = new System.Drawing.Size (368, 21); - this._SourceFileBox.TabIndex = 8; - // - // label12 - // - this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point (223, 71); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size (65, 12); - this.label12.TabIndex = 18; - this.label12.Text = "宽度不小于"; - // - // label11 - // - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point (211, 48); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size (149, 12); - this.label11.TabIndex = 17; - this.label11.Text = "裁剪条件(单位:像素):"; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point (224, 98); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size (65, 12); - this.label9.TabIndex = 20; - this.label9.Text = "高度不小于"; - // - // _MinCropWidthBox - // - this._MinCropWidthBox.Increment = new decimal (new int[] { - 100, - 0, - 0, - 0}); - this._MinCropWidthBox.Location = new System.Drawing.Point (299, 69); - this._MinCropWidthBox.Maximum = new decimal (new int[] { - 10000, - 0, - 0, - 0}); - this._MinCropWidthBox.Name = "_MinCropWidthBox"; - this._MinCropWidthBox.Size = new System.Drawing.Size (53, 21); - this._MinCropWidthBox.TabIndex = 19; - this._MinCropWidthBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // _MinCropHeightBox - // - this._MinCropHeightBox.Increment = new decimal (new int[] { - 100, - 0, - 0, - 0}); - this._MinCropHeightBox.Location = new System.Drawing.Point (299, 96); - this._MinCropHeightBox.Maximum = new decimal (new int[] { - 10000, - 0, - 0, - 0}); - this._MinCropHeightBox.Name = "_MinCropHeightBox"; - this._MinCropHeightBox.Size = new System.Drawing.Size (53, 21); - this._MinCropHeightBox.TabIndex = 21; - this._MinCropHeightBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point (12, 48); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size (149, 12); - this.label5.TabIndex = 8; - this.label5.Text = "裁剪图片(单位:像素):"; - // - // _RightMarginBox - // - this._RightMarginBox.Increment = new decimal (new int[] { - 10, - 0, - 0, - 0}); - this._RightMarginBox.Location = new System.Drawing.Point (143, 96); - this._RightMarginBox.Maximum = new decimal (new int[] { - 1000, - 0, - 0, - 0}); - this._RightMarginBox.Name = "_RightMarginBox"; - this._RightMarginBox.Size = new System.Drawing.Size (49, 21); - this._RightMarginBox.TabIndex = 16; - this._RightMarginBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // _LeftMarginBox - // - this._LeftMarginBox.Increment = new decimal (new int[] { - 10, - 0, - 0, - 0}); - this._LeftMarginBox.Location = new System.Drawing.Point (53, 96); - this._LeftMarginBox.Maximum = new decimal (new int[] { - 1000, - 0, - 0, - 0}); - this._LeftMarginBox.Name = "_LeftMarginBox"; - this._LeftMarginBox.Size = new System.Drawing.Size (49, 21); - this._LeftMarginBox.TabIndex = 14; - this._LeftMarginBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // _BottomMarginBox - // - this._BottomMarginBox.Increment = new decimal (new int[] { - 10, - 0, - 0, - 0}); - this._BottomMarginBox.Location = new System.Drawing.Point (143, 69); - this._BottomMarginBox.Maximum = new decimal (new int[] { - 1000, - 0, - 0, - 0}); - this._BottomMarginBox.Name = "_BottomMarginBox"; - this._BottomMarginBox.Size = new System.Drawing.Size (49, 21); - this._BottomMarginBox.TabIndex = 12; - this._BottomMarginBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // _TopMarginBox - // - this._TopMarginBox.Increment = new decimal (new int[] { - 10, - 0, - 0, - 0}); - this._TopMarginBox.Location = new System.Drawing.Point (53, 69); - this._TopMarginBox.Maximum = new decimal (new int[] { - 1000, - 0, - 0, - 0}); - this._TopMarginBox.Name = "_TopMarginBox"; - this._TopMarginBox.Size = new System.Drawing.Size (49, 21); - this._TopMarginBox.TabIndex = 10; - this._TopMarginBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point (108, 99); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size (29, 12); - this.label7.TabIndex = 15; - this.label7.Text = "右:"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point (108, 71); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size (29, 12); - this.label3.TabIndex = 11; - this.label3.Text = "下:"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point (18, 99); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size (29, 12); - this.label6.TabIndex = 13; - this.label6.Text = "左:"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point (18, 72); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size (29, 12); - this.label4.TabIndex = 9; - this.label4.Text = "上:"; - // - // SourceImageOptionForm - // - this.AcceptButton = this._OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this._CancelButton; - this.ClientSize = new System.Drawing.Size (394, 172); - this.Controls.Add (this.label12); - this.Controls.Add (this.label11); - this.Controls.Add (this._SourceFileBox); - this.Controls.Add (this.label9); - this.Controls.Add (this.label2); - this.Controls.Add (this._MinCropWidthBox); - this.Controls.Add (this._CancelButton); - this.Controls.Add (this._MinCropHeightBox); - this.Controls.Add (this._OkButton); - this.Controls.Add (this.label5); - this.Controls.Add (this._RightMarginBox); - this.Controls.Add (this.label4); - this.Controls.Add (this._LeftMarginBox); - this.Controls.Add (this.label6); - this.Controls.Add (this._BottomMarginBox); - this.Controls.Add (this.label3); - this.Controls.Add (this._TopMarginBox); - this.Controls.Add (this.label7); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "SourceImageOptionForm"; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "源图片处理选项"; - ((System.ComponentModel.ISupportInitialize)(this._MinCropWidthBox)).EndInit (); - ((System.ComponentModel.ISupportInitialize)(this._MinCropHeightBox)).EndInit (); - ((System.ComponentModel.ISupportInitialize)(this._RightMarginBox)).EndInit (); - ((System.ComponentModel.ISupportInitialize)(this._LeftMarginBox)).EndInit (); - ((System.ComponentModel.ISupportInitialize)(this._BottomMarginBox)).EndInit (); - ((System.ComponentModel.ISupportInitialize)(this._TopMarginBox)).EndInit (); - this.ResumeLayout (false); - this.PerformLayout (); - - } - - #endregion - - private System.Windows.Forms.Button _OkButton; - private System.Windows.Forms.Button _CancelButton; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox _SourceFileBox; - private System.Windows.Forms.NumericUpDown _RightMarginBox; - private System.Windows.Forms.NumericUpDown _LeftMarginBox; - private System.Windows.Forms.NumericUpDown _BottomMarginBox; - private System.Windows.Forms.NumericUpDown _TopMarginBox; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label11; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.NumericUpDown _MinCropWidthBox; - private System.Windows.Forms.NumericUpDown _MinCropHeightBox; - private System.Windows.Forms.Label label12; - } -} - diff --git a/pdfpatcher/App/Functions/SourceImageOptionForm.cs b/pdfpatcher/App/Functions/SourceImageOptionForm.cs deleted file mode 100644 index 7b2fa107dffd6029e808b5b1e5fcc6ca53aef66a..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/SourceImageOptionForm.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Windows.Forms; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - internal sealed partial class SourceImageOptionForm : Form - { - readonly SourceItem.Image _image; - - SourceImageOptionForm() { - InitializeComponent(); - } - internal SourceImageOptionForm(SourceItem.Image image) : this() { - _SourceFileBox.Text = image.FilePath.ToString(); - - _TopMarginBox.Value = image.Cropping.Top; - _LeftMarginBox.Value = image.Cropping.Left; - _BottomMarginBox.Value = image.Cropping.Bottom; - _RightMarginBox.Value = image.Cropping.Right; - _MinCropHeightBox.Value = image.Cropping.MinHeight; - _MinCropWidthBox.Value = image.Cropping.MinWidth; - - _image = image; - } - - void _OkButton_Click(Object source, EventArgs args) { - DialogResult = DialogResult.OK; - _image.Cropping.Top = (int)_TopMarginBox.Value; - _image.Cropping.Left = (int)_LeftMarginBox.Value; - _image.Cropping.Right = (int)_RightMarginBox.Value; - _image.Cropping.Bottom = (int)_BottomMarginBox.Value; - _image.Cropping.MinHeight = (int)_MinCropHeightBox.Value; - _image.Cropping.MinWidth = (int)_MinCropWidthBox.Value; - - Close(); - } - - void _CancelButton_Click(Object source, EventArgs args) { - DialogResult = DialogResult.Cancel; - Close(); - } - - } -} diff --git a/pdfpatcher/App/Functions/SourceImageOptionForm.resx b/pdfpatcher/App/Functions/SourceImageOptionForm.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/SourceImageOptionForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/SourcePdfOptionForm.Designer.cs b/pdfpatcher/App/Functions/SourcePdfOptionForm.Designer.cs deleted file mode 100644 index a543dc662e06e0249090c1b682d3fa2bc20ef7a1..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/SourcePdfOptionForm.Designer.cs +++ /dev/null @@ -1,513 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class SourcePdfOptionForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._OkButton = new System.Windows.Forms.Button (); - this._CancelButton = new System.Windows.Forms.Button (); - this._MessageLabel = new System.Windows.Forms.Label (); - this._PageRangeBox = new System.Windows.Forms.TextBox (); - this.label2 = new System.Windows.Forms.Label (); - this._SourceFileBox = new System.Windows.Forms.TextBox (); - this._ImportImagesOnlyBox = new System.Windows.Forms.CheckBox (); - this._ExtractImageOptionBox = new System.Windows.Forms.GroupBox (); - this.label13 = new System.Windows.Forms.Label (); - this.label12 = new System.Windows.Forms.Label (); - this.label11 = new System.Windows.Forms.Label (); - this.label8 = new System.Windows.Forms.Label (); - this.label9 = new System.Windows.Forms.Label (); - this.label10 = new System.Windows.Forms.Label (); - this._MinCropWidthBox = new System.Windows.Forms.NumericUpDown (); - this._MinCropHeightBox = new System.Windows.Forms.NumericUpDown (); - this._MinWidthBox = new System.Windows.Forms.NumericUpDown (); - this._MinHeightBox = new System.Windows.Forms.NumericUpDown (); - this._VerticalFlipImagesBox = new System.Windows.Forms.CheckBox (); - this._InvertBlackAndWhiteImageBox = new System.Windows.Forms.CheckBox (); - this._MergeImagesBox = new System.Windows.Forms.CheckBox (); - this.label5 = new System.Windows.Forms.Label (); - this._RightMarginBox = new System.Windows.Forms.NumericUpDown (); - this._LeftMarginBox = new System.Windows.Forms.NumericUpDown (); - this._BottomMarginBox = new System.Windows.Forms.NumericUpDown (); - this._TopMarginBox = new System.Windows.Forms.NumericUpDown (); - this.label7 = new System.Windows.Forms.Label (); - this.label3 = new System.Windows.Forms.Label (); - this.label6 = new System.Windows.Forms.Label (); - this.label4 = new System.Windows.Forms.Label (); - this._ExtractImageOptionBox.SuspendLayout (); - ((System.ComponentModel.ISupportInitialize)(this._MinCropWidthBox)).BeginInit (); - ((System.ComponentModel.ISupportInitialize)(this._MinCropHeightBox)).BeginInit (); - ((System.ComponentModel.ISupportInitialize)(this._MinWidthBox)).BeginInit (); - ((System.ComponentModel.ISupportInitialize)(this._MinHeightBox)).BeginInit (); - ((System.ComponentModel.ISupportInitialize)(this._RightMarginBox)).BeginInit (); - ((System.ComponentModel.ISupportInitialize)(this._LeftMarginBox)).BeginInit (); - ((System.ComponentModel.ISupportInitialize)(this._BottomMarginBox)).BeginInit (); - ((System.ComponentModel.ISupportInitialize)(this._TopMarginBox)).BeginInit (); - this.SuspendLayout (); - // - // _OkButton - // - this._OkButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._OkButton.Location = new System.Drawing.Point (288, 335); - this._OkButton.Name = "_OkButton"; - this._OkButton.Size = new System.Drawing.Size (75, 23); - this._OkButton.TabIndex = 5; - this._OkButton.Text = "确定(&Q)"; - this._OkButton.UseVisualStyleBackColor = true; - this._OkButton.Click += new System.EventHandler (this._OkButton_Click); - // - // _CancelButton - // - this._CancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this._CancelButton.Location = new System.Drawing.Point (369, 335); - this._CancelButton.Name = "_CancelButton"; - this._CancelButton.Size = new System.Drawing.Size (75, 23); - this._CancelButton.TabIndex = 6; - this._CancelButton.Text = "取消(&X)"; - this._CancelButton.UseVisualStyleBackColor = true; - this._CancelButton.Click += new System.EventHandler (this._CancelButton_Click); - // - // _MessageLabel - // - this._MessageLabel.AutoSize = true; - this._MessageLabel.Location = new System.Drawing.Point (12, 54); - this._MessageLabel.Name = "_MessageLabel"; - this._MessageLabel.Size = new System.Drawing.Size (89, 12); - this._MessageLabel.TabIndex = 0; - this._MessageLabel.Text = "导入页码范围:"; - // - // _PageRangeBox - // - this._PageRangeBox.Location = new System.Drawing.Point (107, 51); - this._PageRangeBox.Name = "_PageRangeBox"; - this._PageRangeBox.Size = new System.Drawing.Size (337, 21); - this._PageRangeBox.TabIndex = 1; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point (10, 15); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size (53, 12); - this.label2.TabIndex = 7; - this.label2.Text = "文件名:"; - // - // _SourceFileBox - // - this._SourceFileBox.Location = new System.Drawing.Point (71, 12); - this._SourceFileBox.Name = "_SourceFileBox"; - this._SourceFileBox.ReadOnly = true; - this._SourceFileBox.Size = new System.Drawing.Size (373, 21); - this._SourceFileBox.TabIndex = 8; - // - // _ImportImagesOnlyBox - // - this._ImportImagesOnlyBox.AutoSize = true; - this._ImportImagesOnlyBox.Location = new System.Drawing.Point (14, 78); - this._ImportImagesOnlyBox.Name = "_ImportImagesOnlyBox"; - this._ImportImagesOnlyBox.Size = new System.Drawing.Size (162, 16); - this._ImportImagesOnlyBox.TabIndex = 3; - this._ImportImagesOnlyBox.Text = "仅导入源 PDF 文件的图片"; - this._ImportImagesOnlyBox.UseVisualStyleBackColor = true; - this._ImportImagesOnlyBox.CheckedChanged += new System.EventHandler (this._ImportImagesOnlyBox_CheckedChanged); - // - // _ExtractImageOptionBox - // - this._ExtractImageOptionBox.Controls.Add (this.label13); - this._ExtractImageOptionBox.Controls.Add (this.label12); - this._ExtractImageOptionBox.Controls.Add (this.label11); - this._ExtractImageOptionBox.Controls.Add (this.label8); - this._ExtractImageOptionBox.Controls.Add (this.label9); - this._ExtractImageOptionBox.Controls.Add (this.label10); - this._ExtractImageOptionBox.Controls.Add (this._MinCropWidthBox); - this._ExtractImageOptionBox.Controls.Add (this._MinCropHeightBox); - this._ExtractImageOptionBox.Controls.Add (this._MinWidthBox); - this._ExtractImageOptionBox.Controls.Add (this._MinHeightBox); - this._ExtractImageOptionBox.Controls.Add (this._VerticalFlipImagesBox); - this._ExtractImageOptionBox.Controls.Add (this._InvertBlackAndWhiteImageBox); - this._ExtractImageOptionBox.Controls.Add (this._MergeImagesBox); - this._ExtractImageOptionBox.Controls.Add (this.label5); - this._ExtractImageOptionBox.Controls.Add (this._RightMarginBox); - this._ExtractImageOptionBox.Controls.Add (this._LeftMarginBox); - this._ExtractImageOptionBox.Controls.Add (this._BottomMarginBox); - this._ExtractImageOptionBox.Controls.Add (this._TopMarginBox); - this._ExtractImageOptionBox.Controls.Add (this.label7); - this._ExtractImageOptionBox.Controls.Add (this.label3); - this._ExtractImageOptionBox.Controls.Add (this.label6); - this._ExtractImageOptionBox.Controls.Add (this.label4); - this._ExtractImageOptionBox.Enabled = false; - this._ExtractImageOptionBox.Location = new System.Drawing.Point (14, 100); - this._ExtractImageOptionBox.Name = "_ExtractImageOptionBox"; - this._ExtractImageOptionBox.Size = new System.Drawing.Size (430, 175); - this._ExtractImageOptionBox.TabIndex = 4; - this._ExtractImageOptionBox.TabStop = false; - this._ExtractImageOptionBox.Text = "导入及处理源 PDF 文件图片的方式(尺寸单位:像素)"; - // - // label13 - // - this.label13.AutoSize = true; - this.label13.Location = new System.Drawing.Point (220, 21); - this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size (89, 12); - this.label13.TabIndex = 3; - this.label13.Text = "导入图片条件:"; - // - // label12 - // - this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point (232, 116); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size (65, 12); - this.label12.TabIndex = 18; - this.label12.Text = "宽度不小于"; - // - // label11 - // - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point (220, 92); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size (65, 12); - this.label11.TabIndex = 17; - this.label11.Text = "裁剪条件:"; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point (232, 38); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size (65, 12); - this.label8.TabIndex = 4; - this.label8.Text = "宽度不小于"; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point (232, 143); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size (65, 12); - this.label9.TabIndex = 20; - this.label9.Text = "高度不小于"; - // - // label10 - // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point (232, 65); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size (65, 12); - this.label10.TabIndex = 6; - this.label10.Text = "高度不小于"; - // - // _MinCropWidthBox - // - this._MinCropWidthBox.Increment = new decimal (new int[] { - 100, - 0, - 0, - 0}); - this._MinCropWidthBox.Location = new System.Drawing.Point (308, 113); - this._MinCropWidthBox.Maximum = new decimal (new int[] { - 10000, - 0, - 0, - 0}); - this._MinCropWidthBox.Name = "_MinCropWidthBox"; - this._MinCropWidthBox.Size = new System.Drawing.Size (53, 21); - this._MinCropWidthBox.TabIndex = 19; - this._MinCropWidthBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // _MinCropHeightBox - // - this._MinCropHeightBox.Increment = new decimal (new int[] { - 100, - 0, - 0, - 0}); - this._MinCropHeightBox.Location = new System.Drawing.Point (308, 140); - this._MinCropHeightBox.Maximum = new decimal (new int[] { - 10000, - 0, - 0, - 0}); - this._MinCropHeightBox.Name = "_MinCropHeightBox"; - this._MinCropHeightBox.Size = new System.Drawing.Size (53, 21); - this._MinCropHeightBox.TabIndex = 21; - this._MinCropHeightBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // _MinWidthBox - // - this._MinWidthBox.Increment = new decimal (new int[] { - 10, - 0, - 0, - 0}); - this._MinWidthBox.Location = new System.Drawing.Point (308, 36); - this._MinWidthBox.Maximum = new decimal (new int[] { - 10000, - 0, - 0, - 0}); - this._MinWidthBox.Name = "_MinWidthBox"; - this._MinWidthBox.Size = new System.Drawing.Size (53, 21); - this._MinWidthBox.TabIndex = 5; - this._MinWidthBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // _MinHeightBox - // - this._MinHeightBox.Increment = new decimal (new int[] { - 10, - 0, - 0, - 0}); - this._MinHeightBox.Location = new System.Drawing.Point (308, 63); - this._MinHeightBox.Maximum = new decimal (new int[] { - 10000, - 0, - 0, - 0}); - this._MinHeightBox.Name = "_MinHeightBox"; - this._MinHeightBox.Size = new System.Drawing.Size (53, 21); - this._MinHeightBox.TabIndex = 7; - this._MinHeightBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // _VerticalFlipImagesBox - // - this._VerticalFlipImagesBox.AutoSize = true; - this._VerticalFlipImagesBox.Location = new System.Drawing.Point (6, 42); - this._VerticalFlipImagesBox.Name = "_VerticalFlipImagesBox"; - this._VerticalFlipImagesBox.Size = new System.Drawing.Size (96, 16); - this._VerticalFlipImagesBox.TabIndex = 1; - this._VerticalFlipImagesBox.Text = "垂直翻转图片"; - this._VerticalFlipImagesBox.UseVisualStyleBackColor = true; - // - // _InvertBlackAndWhiteImageBox - // - this._InvertBlackAndWhiteImageBox.AutoSize = true; - this._InvertBlackAndWhiteImageBox.Location = new System.Drawing.Point (6, 64); - this._InvertBlackAndWhiteImageBox.Name = "_InvertBlackAndWhiteImageBox"; - this._InvertBlackAndWhiteImageBox.Size = new System.Drawing.Size (132, 16); - this._InvertBlackAndWhiteImageBox.TabIndex = 2; - this._InvertBlackAndWhiteImageBox.Text = "反转黑白图片的颜色"; - this._InvertBlackAndWhiteImageBox.UseVisualStyleBackColor = true; - // - // _MergeImagesBox - // - this._MergeImagesBox.AutoSize = true; - this._MergeImagesBox.Checked = true; - this._MergeImagesBox.CheckState = System.Windows.Forms.CheckState.Checked; - this._MergeImagesBox.Location = new System.Drawing.Point (6, 20); - this._MergeImagesBox.Name = "_MergeImagesBox"; - this._MergeImagesBox.Size = new System.Drawing.Size (120, 16); - this._MergeImagesBox.TabIndex = 0; - this._MergeImagesBox.Text = "尝试合并同页图片"; - this._MergeImagesBox.UseVisualStyleBackColor = true; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point (6, 91); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size (65, 12); - this.label5.TabIndex = 8; - this.label5.Text = "裁剪图片:"; - // - // _RightMarginBox - // - this._RightMarginBox.Increment = new decimal (new int[] { - 10, - 0, - 0, - 0}); - this._RightMarginBox.Location = new System.Drawing.Point (137, 139); - this._RightMarginBox.Maximum = new decimal (new int[] { - 1000, - 0, - 0, - 0}); - this._RightMarginBox.Name = "_RightMarginBox"; - this._RightMarginBox.Size = new System.Drawing.Size (49, 21); - this._RightMarginBox.TabIndex = 16; - this._RightMarginBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // _LeftMarginBox - // - this._LeftMarginBox.Increment = new decimal (new int[] { - 10, - 0, - 0, - 0}); - this._LeftMarginBox.Location = new System.Drawing.Point (47, 139); - this._LeftMarginBox.Maximum = new decimal (new int[] { - 1000, - 0, - 0, - 0}); - this._LeftMarginBox.Name = "_LeftMarginBox"; - this._LeftMarginBox.Size = new System.Drawing.Size (49, 21); - this._LeftMarginBox.TabIndex = 14; - this._LeftMarginBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // _BottomMarginBox - // - this._BottomMarginBox.Increment = new decimal (new int[] { - 10, - 0, - 0, - 0}); - this._BottomMarginBox.Location = new System.Drawing.Point (137, 112); - this._BottomMarginBox.Maximum = new decimal (new int[] { - 1000, - 0, - 0, - 0}); - this._BottomMarginBox.Name = "_BottomMarginBox"; - this._BottomMarginBox.Size = new System.Drawing.Size (49, 21); - this._BottomMarginBox.TabIndex = 12; - this._BottomMarginBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // _TopMarginBox - // - this._TopMarginBox.Increment = new decimal (new int[] { - 10, - 0, - 0, - 0}); - this._TopMarginBox.Location = new System.Drawing.Point (47, 112); - this._TopMarginBox.Maximum = new decimal (new int[] { - 1000, - 0, - 0, - 0}); - this._TopMarginBox.Name = "_TopMarginBox"; - this._TopMarginBox.Size = new System.Drawing.Size (49, 21); - this._TopMarginBox.TabIndex = 10; - this._TopMarginBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point (102, 142); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size (29, 12); - this.label7.TabIndex = 15; - this.label7.Text = "右:"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point (102, 114); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size (29, 12); - this.label3.TabIndex = 11; - this.label3.Text = "下:"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point (12, 142); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size (29, 12); - this.label6.TabIndex = 13; - this.label6.Text = "左:"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point (12, 115); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size (29, 12); - this.label4.TabIndex = 9; - this.label4.Text = "上:"; - // - // SourcePdfOptionForm - // - this.AcceptButton = this._OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this._CancelButton; - this.ClientSize = new System.Drawing.Size (456, 370); - this.Controls.Add (this._PageRangeBox); - this.Controls.Add (this._ImportImagesOnlyBox); - this.Controls.Add (this._MessageLabel); - this.Controls.Add (this._ExtractImageOptionBox); - this.Controls.Add (this._SourceFileBox); - this.Controls.Add (this.label2); - this.Controls.Add (this._CancelButton); - this.Controls.Add (this._OkButton); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "SourcePdfOptionForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "源 PDF 文件选项"; - this._ExtractImageOptionBox.ResumeLayout (false); - this._ExtractImageOptionBox.PerformLayout (); - ((System.ComponentModel.ISupportInitialize)(this._MinCropWidthBox)).EndInit (); - ((System.ComponentModel.ISupportInitialize)(this._MinCropHeightBox)).EndInit (); - ((System.ComponentModel.ISupportInitialize)(this._MinWidthBox)).EndInit (); - ((System.ComponentModel.ISupportInitialize)(this._MinHeightBox)).EndInit (); - ((System.ComponentModel.ISupportInitialize)(this._RightMarginBox)).EndInit (); - ((System.ComponentModel.ISupportInitialize)(this._LeftMarginBox)).EndInit (); - ((System.ComponentModel.ISupportInitialize)(this._BottomMarginBox)).EndInit (); - ((System.ComponentModel.ISupportInitialize)(this._TopMarginBox)).EndInit (); - this.ResumeLayout (false); - this.PerformLayout (); - - } - - #endregion - - private System.Windows.Forms.Button _OkButton; - private System.Windows.Forms.Button _CancelButton; - private System.Windows.Forms.Label _MessageLabel; - private System.Windows.Forms.TextBox _PageRangeBox; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox _SourceFileBox; - private System.Windows.Forms.CheckBox _ImportImagesOnlyBox; - private System.Windows.Forms.GroupBox _ExtractImageOptionBox; - private System.Windows.Forms.NumericUpDown _RightMarginBox; - private System.Windows.Forms.NumericUpDown _LeftMarginBox; - private System.Windows.Forms.NumericUpDown _BottomMarginBox; - private System.Windows.Forms.NumericUpDown _TopMarginBox; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.CheckBox _MergeImagesBox; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.CheckBox _InvertBlackAndWhiteImageBox; - private System.Windows.Forms.CheckBox _VerticalFlipImagesBox; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.NumericUpDown _MinWidthBox; - private System.Windows.Forms.NumericUpDown _MinHeightBox; - private System.Windows.Forms.Label label11; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.NumericUpDown _MinCropWidthBox; - private System.Windows.Forms.NumericUpDown _MinCropHeightBox; - private System.Windows.Forms.Label label13; - private System.Windows.Forms.Label label12; - } -} - diff --git a/pdfpatcher/App/Functions/SourcePdfOptionForm.cs b/pdfpatcher/App/Functions/SourcePdfOptionForm.cs deleted file mode 100644 index 1da6452c46b985d787f272b0ae06ab75edabbd98..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/SourcePdfOptionForm.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Windows.Forms; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - internal sealed partial class SourcePdfOptionForm : Form - { - readonly SourceItem.Pdf _pdf; - - SourcePdfOptionForm() { - InitializeComponent(); - } - internal SourcePdfOptionForm(SourceItem.Pdf pdf) : this() { - _SourceFileBox.Text = pdf.FilePath.ToString(); - _PageRangeBox.Text = pdf.PageRanges; - _ImportImagesOnlyBox.Checked = pdf.ImportImagesOnly; - - //_TopMarginBox.Value = pdf.Cropping.Top; - //_LeftMarginBox.Value = pdf.Cropping.Left; - //_BottomMarginBox.Value = pdf.Cropping.Bottom; - //_RightMarginBox.Value = pdf.Cropping.Right; - //_MinCropHeightBox.Value = pdf.Cropping.MinHeight; - //_MinCropWidthBox.Value = pdf.Cropping.MinWidth; - - _MergeImagesBox.Checked = pdf.ExtractImageOptions.MergeImages; - _InvertBlackAndWhiteImageBox.Checked = pdf.ExtractImageOptions.InvertBlackAndWhiteImages; - _VerticalFlipImagesBox.Checked = pdf.ExtractImageOptions.VerticalFlipImages; - _MinHeightBox.Value = pdf.ExtractImageOptions.MinHeight; - _MinWidthBox.Value = pdf.ExtractImageOptions.MinWidth; - _pdf = pdf; - } - - void _OkButton_Click(Object source, EventArgs args) { - DialogResult = DialogResult.OK; - _pdf.PageRanges = Model.PageRangeCollection.Parse(_PageRangeBox.Text, 1, _pdf.PageCount, true).ToString(); - _pdf.ImportImagesOnly = _ImportImagesOnlyBox.Checked; - //_pdf.Cropping.Top = (int)_TopMarginBox.Value; - //_pdf.Cropping.Left = (int)_LeftMarginBox.Value; - //_pdf.Cropping.Right = (int)_RightMarginBox.Value; - //_pdf.Cropping.Bottom = (int)_BottomMarginBox.Value; - //_pdf.Cropping.MinHeight = (int)_MinCropHeightBox.Value; - //_pdf.Cropping.MinWidth = (int)_MinCropWidthBox.Value; - - _pdf.ExtractImageOptions.MergeImages = _MergeImagesBox.Checked; - _pdf.ExtractImageOptions.InvertBlackAndWhiteImages = _InvertBlackAndWhiteImageBox.Checked; - _pdf.ExtractImageOptions.VerticalFlipImages = _VerticalFlipImagesBox.Checked; - _pdf.ExtractImageOptions.MinHeight = (int)_MinHeightBox.Value; - _pdf.ExtractImageOptions.MinWidth = (int)_MinWidthBox.Value; - Close(); - } - - void _CancelButton_Click(Object source, EventArgs args) { - DialogResult = DialogResult.Cancel; - Close(); - } - - void _ImportImagesOnlyBox_CheckedChanged(object sender, EventArgs e) { - _ExtractImageOptionBox.Enabled = _ImportImagesOnlyBox.Checked; - } - } -} diff --git a/pdfpatcher/App/Functions/SourcePdfOptionForm.resx b/pdfpatcher/App/Functions/SourcePdfOptionForm.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/SourcePdfOptionForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/TargetFileControl.Designer.cs b/pdfpatcher/App/Functions/TargetFileControl.Designer.cs deleted file mode 100644 index 0385431c8cc9affe106cc61229bda9c98741446e..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/TargetFileControl.Designer.cs +++ /dev/null @@ -1,124 +0,0 @@ -namespace PDFPatcher -{ - partial class TargetFileControl - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.components = new System.ComponentModel.Container(); - this.label1 = new System.Windows.Forms.Label(); - this._SavePdfBox = new System.Windows.Forms.SaveFileDialog(); - this._BrowseTargetPdfButton = new System.Windows.Forms.Button(); - this.panel1 = new System.Windows.Forms.Panel(); - this._TargetPdfBox = new PDFPatcher.HistoryComboBox(); - this._FileMacroMenu = new PDFPatcher.Functions.MacroMenu(this.components); - this.panel1.SuspendLayout(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(3, 6); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(95, 12); - this.label1.TabIndex = 0; - this.label1.Text = "输出 PD&F 文件:"; - // - // _SavePdfBox - // - this._SavePdfBox.DefaultExt = "pdf"; - this._SavePdfBox.Filter = "PDF 文件 (*.pdf)|*.pdf"; - this._SavePdfBox.OverwritePrompt = false; - this._SavePdfBox.Title = "指定输出的 PDF 文件路径"; - // - // _BrowseTargetPdfButton - // - this._BrowseTargetPdfButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this._BrowseTargetPdfButton.Image = global::PDFPatcher.Properties.Resources.NewPdfFile; - this._BrowseTargetPdfButton.Location = new System.Drawing.Point(391, 1); - this._BrowseTargetPdfButton.Name = "_BrowseTargetPdfButton"; - this._BrowseTargetPdfButton.Size = new System.Drawing.Size(75, 23); - this._BrowseTargetPdfButton.TabIndex = 2; - this._BrowseTargetPdfButton.Text = "浏览..."; - this._BrowseTargetPdfButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._BrowseTargetPdfButton.UseVisualStyleBackColor = true; - this._BrowseTargetPdfButton.Click += new System.EventHandler(this._BrowseTargetPdfButton_Click); - // - // panel1 - // - this.panel1.Controls.Add(this._BrowseTargetPdfButton); - this.panel1.Controls.Add(this._TargetPdfBox); - this.panel1.Controls.Add(this.label1); - this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel1.Location = new System.Drawing.Point(0, 0); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(469, 25); - this.panel1.TabIndex = 3; - // - // _TargetPdfBox - // - this._TargetPdfBox.AllowDrop = true; - this._TargetPdfBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._TargetPdfBox.Contents = null; - this._TargetPdfBox.ContextMenuStrip = this._FileMacroMenu; - this._TargetPdfBox.FormattingEnabled = true; - this._TargetPdfBox.Location = new System.Drawing.Point(104, 3); - this._TargetPdfBox.MaxItemCount = 16; - this._TargetPdfBox.Name = "_TargetPdfBox"; - this._TargetPdfBox.Size = new System.Drawing.Size(281, 20); - this._TargetPdfBox.TabIndex = 1; - this._TargetPdfBox.DragDrop += new System.Windows.Forms.DragEventHandler(this._TargetPdfBox_DragDrop); - this._TargetPdfBox.DragEnter += new System.Windows.Forms.DragEventHandler(this._TargetPdfBox_DragEnter); - this._TargetPdfBox.TextChanged += new System.EventHandler(this._TargetPdfBox_TextChanged); - // - // _FileMacroMenu - // - this._FileMacroMenu.Name = "_FileMacroMenu"; - this._FileMacroMenu.Size = new System.Drawing.Size(61, 4); - // - // TargetFileControl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.Controls.Add(this.panel1); - this.Name = "TargetFileControl"; - this.Size = new System.Drawing.Size(469, 25); - this.Load += new System.EventHandler(this.TargetFileControl_Show); - this.VisibleChanged += new System.EventHandler(this.TargetFileControl_Show); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Button _BrowseTargetPdfButton; - private System.Windows.Forms.SaveFileDialog _SavePdfBox; - private HistoryComboBox _TargetPdfBox; - private Functions.MacroMenu _FileMacroMenu; - private System.Windows.Forms.Panel panel1; - } -} diff --git a/pdfpatcher/App/Functions/TargetFileControl.cs b/pdfpatcher/App/Functions/TargetFileControl.cs deleted file mode 100644 index ebb55959f774c2150e07378f68ba5f33e2c30140..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/TargetFileControl.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System; -using System.ComponentModel; -using System.IO; -using System.Windows.Forms; -using PDFPatcher.Common; - -namespace PDFPatcher -{ - public partial class TargetFileControl : UserControl - { - internal event CancelEventHandler TargetFileChangedByBrowseButton; - internal event EventHandler BrowseForFile; - - public TargetFileControl() { - InitializeComponent(); - - _FileMacroMenu.ItemClicked += _FileMacroMenu.ProcessInsertMacroCommand; - } - - ///获取或指定书签文件路径的值。 - internal HistoryComboBox FileList => _TargetPdfBox; - internal FileDialog FileDialog => _SavePdfBox; - internal Functions.MacroMenu FileMacroMenu => _FileMacroMenu; - - public string BrowseTargetFile() { - _BrowseTargetPdfButton_Click(_BrowseTargetPdfButton, null); - return _TargetPdfBox.Text; - } - - /// - /// 获取或设置文件下拉框的文本。 - /// - public override string Text { - get => _TargetPdfBox.Text; - set => _TargetPdfBox.Text = value; - } - - /// - /// 获取或设置文件下拉框前的标签文本。 - /// - [DefaultValue("输出 PD&F 文件:")] - public string Label { - get => label1.Text; - set => label1.Text = value; - } - - void _BrowseTargetPdfButton_Click(object sender, EventArgs e) { - BrowseForFile?.Invoke(sender, e); - FilePath sourceFile = (AppContext.SourceFiles != null && AppContext.SourceFiles.Length > 0) ? AppContext.SourceFiles[0] : String.Empty; - var t = _TargetPdfBox.Text; - if (t.Length > 0 && FileHelper.IsPathValid(t) && Path.GetFileName(t).Length > 0) { - _SavePdfBox.SetLocation(t); - } - else if (sourceFile.FileName.Length > 0) { - t = FileHelper.GetNewFileNameFromSourceFile(sourceFile, Constants.FileExtensions.Pdf); - _SavePdfBox.SetLocation(t); - } - if (_SavePdfBox.ShowDialog() == DialogResult.OK) { - if (TargetFileChangedByBrowseButton != null) { - var a = new CancelEventArgs(); - TargetFileChangedByBrowseButton(this, a); - if (a.Cancel) { - return; - } - } - Text = _SavePdfBox.FileName; - } - } - - void _TargetPdfBox_TextChanged(object sender, EventArgs e) { - AppContext.TargetFile = _TargetPdfBox.Text; - } - - void _TargetPdfBox_DragEnter(object sender, DragEventArgs e) { - FormHelper.FeedbackDragFileOver(e, Constants.FileExtensions.Pdf); - } - - void _TargetPdfBox_DragDrop(object sender, DragEventArgs e) { - FormHelper.DropFileOver((Control)sender, e, Constants.FileExtensions.Pdf); - } - - void TargetFileControl_Show(object sender, EventArgs e) { - var t = Text; - if (Visible && AppContext.MainForm != null) { - _TargetPdfBox.Contents = AppContext.Recent.TargetPdfFiles; - } - else if (Visible == false) { - _TargetPdfBox.Contents = null; - } - Text = t; - } - - } -} diff --git a/pdfpatcher/App/Functions/TargetFileControl.resx b/pdfpatcher/App/Functions/TargetFileControl.resx deleted file mode 100644 index cbc76c75afd3b30500909dd2591e268a8009b2bb..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/TargetFileControl.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 143, 17 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/UpdateForm.Designer.cs b/pdfpatcher/App/Functions/UpdateForm.Designer.cs deleted file mode 100644 index 82b21185329bddb4b9983f06cd35b9f4a3c25141..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/UpdateForm.Designer.cs +++ /dev/null @@ -1,142 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class UpdateForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this._InfoBox = new System.Windows.Forms.RichTextBox(); - this._HomePageButton = new System.Windows.Forms.Button(); - this._CancelButton = new System.Windows.Forms.Button(); - this._DownloadButton = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); - this._CheckUpdateIntervalBox = new System.Windows.Forms.ComboBox(); - this.SuspendLayout(); - // - // _InfoBox - // - this._InfoBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this._InfoBox.Location = new System.Drawing.Point(21, 18); - this._InfoBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this._InfoBox.Name = "_InfoBox"; - this._InfoBox.ReadOnly = true; - this._InfoBox.Size = new System.Drawing.Size(777, 446); - this._InfoBox.TabIndex = 0; - this._InfoBox.Text = ""; - // - // _HomePageButton - // - this._HomePageButton.Image = global::PDFPatcher.Properties.Resources.HomePage; - this._HomePageButton.Location = new System.Drawing.Point(199, 474); - this._HomePageButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this._HomePageButton.Name = "_HomePageButton"; - this._HomePageButton.Size = new System.Drawing.Size(162, 35); - this._HomePageButton.TabIndex = 2; - this._HomePageButton.Text = "转到主页(&Z)"; - this._HomePageButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._HomePageButton.UseVisualStyleBackColor = true; - // - // _CancelButton - // - this._CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this._CancelButton.Location = new System.Drawing.Point(370, 474); - this._CancelButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this._CancelButton.Name = "_CancelButton"; - this._CancelButton.Size = new System.Drawing.Size(112, 35); - this._CancelButton.TabIndex = 3; - this._CancelButton.Text = "取消(&Q)"; - this._CancelButton.UseVisualStyleBackColor = true; - // - // _DownloadButton - // - this._DownloadButton.Enabled = false; - this._DownloadButton.Image = global::PDFPatcher.Properties.Resources.Save; - this._DownloadButton.Location = new System.Drawing.Point(21, 474); - this._DownloadButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this._DownloadButton.Name = "_DownloadButton"; - this._DownloadButton.Size = new System.Drawing.Size(170, 35); - this._DownloadButton.TabIndex = 1; - this._DownloadButton.Text = "下载新版本(&X)"; - this._DownloadButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this._DownloadButton.UseVisualStyleBackColor = true; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(490, 482); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(170, 18); - this.label1.TabIndex = 4; - this.label1.Text = "自动检查更新间隔:"; - // - // _CheckUpdateIntervalBox - // - this._CheckUpdateIntervalBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._CheckUpdateIntervalBox.FormattingEnabled = true; - this._CheckUpdateIntervalBox.Items.AddRange(new object[] { - "7天", - "14天", - "30天", - "从不检查"}); - this._CheckUpdateIntervalBox.Location = new System.Drawing.Point(657, 479); - this._CheckUpdateIntervalBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this._CheckUpdateIntervalBox.Name = "_CheckUpdateIntervalBox"; - this._CheckUpdateIntervalBox.Size = new System.Drawing.Size(136, 26); - this._CheckUpdateIntervalBox.TabIndex = 5; - // - // UpdateForm - // - this.AcceptButton = this._HomePageButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this._CancelButton; - this.ClientSize = new System.Drawing.Size(818, 534); - this.Controls.Add(this._CheckUpdateIntervalBox); - this.Controls.Add(this.label1); - this.Controls.Add(this._DownloadButton); - this.Controls.Add(this._CancelButton); - this.Controls.Add(this._HomePageButton); - this.Controls.Add(this._InfoBox); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "UpdateForm"; - this.Text = "检查更新"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.RichTextBox _InfoBox; - private System.Windows.Forms.Button _HomePageButton; - private System.Windows.Forms.Button _CancelButton; - private System.Windows.Forms.Button _DownloadButton; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.ComboBox _CheckUpdateIntervalBox; - } -} \ No newline at end of file diff --git a/pdfpatcher/App/Functions/UpdateForm.cs b/pdfpatcher/App/Functions/UpdateForm.cs deleted file mode 100644 index ac3038e6d49606a0775bd1b91eed1f0136a17591..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/UpdateForm.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using System.Drawing; -using System.Net; -using System.Windows.Forms; -using System.Xml; -using PDFPatcher.Common; - -namespace PDFPatcher.Functions -{ - public partial class UpdateForm : Form - { - WebClient _UpdateChecker; - - public UpdateForm() { - InitializeComponent(); - this.SetIcon(Properties.Resources.CheckUpdate); - Load += (s, args) => { - CheckNewVersion(); - var i = AppContext.CheckUpdateInterval; - _CheckUpdateIntervalBox.Select(i == 7 ? 0 : i == 14 ? 1 : i == 30 ? 2 : 3); - }; - FormClosed += (s, args) => { - var c = _UpdateChecker; - if (c != null) { - c.DownloadDataCompleted -= UpdateChecker_DownloadDataCompleted; - c.CancelAsync(); - c.Dispose(); - } - }; - _HomePageButton.Click += (s, args) => { - CommonCommands.VisitHomePage(); - }; - _DownloadButton.Click += (s, args) => { - System.Diagnostics.Process.Start(_DownloadButton.Tag.ToString()); - }; - _CheckUpdateIntervalBox.SelectedIndexChanged += (s, args) => { - AppContext.CheckUpdateInterval = _CheckUpdateIntervalBox.SelectedIndex switch { - 0 => 7, - 1 => 14, - 2 => 30, - _ => Int32.MaxValue, - }; - if (AppContext.CheckUpdateInterval != Int32.MaxValue) { - AppContext.CheckUpdateDate = DateTime.Today + TimeSpan.FromDays(AppContext.CheckUpdateInterval); - } - }; - } - - private void CheckNewVersion() { - _UpdateChecker = new WebClient(); - _InfoBox.AppendLine("正在检查新版本,请稍候……"); - _UpdateChecker.DownloadDataCompleted += UpdateChecker_DownloadDataCompleted; - _UpdateChecker.DownloadDataAsync(new Uri(Constants.AppUpdateFile)); - } - - void UpdateChecker_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs args) { - _InfoBox.Clear(); - if (args.Error != null) { - _InfoBox.AppendText("检查新版本失败:" + args.Error.Message); - goto Exit; - } - try { - var x = new XmlDocument(); - x.Load(new System.IO.MemoryStream(args.Result)); - CheckResult(x); - } - catch (Exception) { - FormHelper.ErrorBox("版本信息文件格式错误,请稍候重试。"); - } - Exit: - _UpdateChecker.Dispose(); - _UpdateChecker = null; - } - - private void CheckResult(XmlDocument x) { - var r = x.DocumentElement; - if (r == null || r.Name != Constants.AppEngName) { - _InfoBox.SelectionColor = Color.Red; - _InfoBox.AppendLine("版本信息文件格式错误,请稍候重试。"); - return; - } - var v = r.GetAttribute("version"); - var d = r.GetAttribute("date"); - var u = r.GetAttribute("url"); - var c = r.SelectSingleNode("content"); - if (new Version(ProductVersion) < new Version(r.GetAttribute("version"))) { - _InfoBox.SelectionColor = Color.Blue; - _InfoBox.AppendLine(String.Concat("发现新版本:", v, " ", d)); - _InfoBox.AppendLine(c.InnerText); - _InfoBox.SelectionStart = 0; - if (u.Length > 0) { - _DownloadButton.Enabled = true; - _DownloadButton.Tag = u; - } - } - else { - _InfoBox.AppendLine(String.Join("\n", new string[] { - "未发现新版本。", "服务器上发布的版本是:", v + " " + d - })); - } - } - } -} diff --git a/pdfpatcher/App/Functions/UpdateForm.resx b/pdfpatcher/App/Functions/UpdateForm.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/UpdateForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Functions/ViewerPreferenceEditor.Designer.cs b/pdfpatcher/App/Functions/ViewerPreferenceEditor.Designer.cs deleted file mode 100644 index 1682f2c7eee73401c2952065e056f12350132beb..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/ViewerPreferenceEditor.Designer.cs +++ /dev/null @@ -1,340 +0,0 @@ -namespace PDFPatcher.Functions -{ - partial class ViewerPreferenceEditor - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region 组件设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.groupBox2 = new System.Windows.Forms.GroupBox (); - this._ForceInternalLinkBox = new System.Windows.Forms.CheckBox (); - this._ForceRemoveZoomRateBox = new System.Windows.Forms.CheckBox (); - this._ForceBookmarkOpenBox = new System.Windows.Forms.ComboBox (); - this.label2 = new System.Windows.Forms.Label (); - this.groupBox1 = new System.Windows.Forms.GroupBox (); - this.label8 = new System.Windows.Forms.Label (); - this._ForceInitialModeBox = new System.Windows.Forms.ComboBox (); - this._ForceDirectionBox = new System.Windows.Forms.ComboBox (); - this.label7 = new System.Windows.Forms.Label (); - this._ForceInitialViewBox = new System.Windows.Forms.ComboBox (); - this.label3 = new System.Windows.Forms.Label (); - this.label5 = new System.Windows.Forms.Label (); - this._HideMenuBox = new System.Windows.Forms.CheckBox (); - this._HideToolbarBox = new System.Windows.Forms.CheckBox (); - this._HideUIBox = new System.Windows.Forms.CheckBox (); - this._FitWindowBox = new System.Windows.Forms.CheckBox (); - this._CenterWindowBox = new System.Windows.Forms.CheckBox (); - this._DisplayDocTitleBox = new System.Windows.Forms.CheckBox (); - this._UISettingsPanel = new System.Windows.Forms.Panel (); - this._OverrideUISettingsBox = new System.Windows.Forms.CheckBox (); - this.groupBox4 = new System.Windows.Forms.GroupBox (); - this.groupBox2.SuspendLayout (); - this.groupBox1.SuspendLayout (); - this._UISettingsPanel.SuspendLayout (); - this.groupBox4.SuspendLayout (); - this.SuspendLayout (); - // - // groupBox2 - // - this.groupBox2.Controls.Add (this._ForceInternalLinkBox); - this.groupBox2.Controls.Add (this._ForceRemoveZoomRateBox); - this.groupBox2.Location = new System.Drawing.Point (6, 164); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size (426, 70); - this.groupBox2.TabIndex = 2; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "书签及链接动作"; - // - // _ForceInternalLinkBox - // - this._ForceInternalLinkBox.AutoSize = true; - this._ForceInternalLinkBox.Location = new System.Drawing.Point (6, 42); - this._ForceInternalLinkBox.Name = "_ForceInternalLinkBox"; - this._ForceInternalLinkBox.Size = new System.Drawing.Size (234, 16); - this._ForceInternalLinkBox.TabIndex = 3; - this._ForceInternalLinkBox.Text = "强制将外部 PDF 文件链接改成内部链接"; - this._ForceInternalLinkBox.UseVisualStyleBackColor = true; - this._ForceInternalLinkBox.CheckedChanged += new System.EventHandler (this.DocumentInfoChanged); - // - // _ForceRemoveZoomRateBox - // - this._ForceRemoveZoomRateBox.AutoSize = true; - this._ForceRemoveZoomRateBox.Location = new System.Drawing.Point (6, 20); - this._ForceRemoveZoomRateBox.Name = "_ForceRemoveZoomRateBox"; - this._ForceRemoveZoomRateBox.Size = new System.Drawing.Size (204, 16); - this._ForceRemoveZoomRateBox.TabIndex = 0; - this._ForceRemoveZoomRateBox.Text = "禁止书签及页面链接更改显示比例"; - this._ForceRemoveZoomRateBox.UseVisualStyleBackColor = true; - this._ForceRemoveZoomRateBox.CheckedChanged += new System.EventHandler (this.DocumentInfoChanged); - // - // _ForceBookmarkOpenBox - // - this._ForceBookmarkOpenBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._ForceBookmarkOpenBox.FormattingEnabled = true; - this._ForceBookmarkOpenBox.Location = new System.Drawing.Point (77, 96); - this._ForceBookmarkOpenBox.Name = "_ForceBookmarkOpenBox"; - this._ForceBookmarkOpenBox.Size = new System.Drawing.Size (127, 20); - this._ForceBookmarkOpenBox.TabIndex = 2; - this._ForceBookmarkOpenBox.SelectedIndexChanged += new System.EventHandler (this.DocumentInfoChanged); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point (6, 99); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size (65, 12); - this.label2.TabIndex = 1; - this.label2.Text = "书签状态:"; - // - // groupBox1 - // - this.groupBox1.Controls.Add (this.label8); - this.groupBox1.Controls.Add (this._ForceBookmarkOpenBox); - this.groupBox1.Controls.Add (this._ForceInitialModeBox); - this.groupBox1.Controls.Add (this._ForceDirectionBox); - this.groupBox1.Controls.Add (this.label2); - this.groupBox1.Controls.Add (this.label7); - this.groupBox1.Controls.Add (this._ForceInitialViewBox); - this.groupBox1.Controls.Add (this.label3); - this.groupBox1.Location = new System.Drawing.Point (6, 23); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size (210, 135); - this.groupBox1.TabIndex = 1; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "阅读器设定"; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point (6, 73); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size (65, 12); - this.label8.TabIndex = 4; - this.label8.Text = "初始模式:"; - // - // _ForceInitialModeBox - // - this._ForceInitialModeBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._ForceInitialModeBox.FormattingEnabled = true; - this._ForceInitialModeBox.Location = new System.Drawing.Point (77, 70); - this._ForceInitialModeBox.Name = "_ForceInitialModeBox"; - this._ForceInitialModeBox.Size = new System.Drawing.Size (127, 20); - this._ForceInitialModeBox.TabIndex = 5; - this._ForceInitialModeBox.SelectedIndexChanged += new System.EventHandler (this.DocumentInfoChanged); - // - // _ForceDirectionBox - // - this._ForceDirectionBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._ForceDirectionBox.FormattingEnabled = true; - this._ForceDirectionBox.Location = new System.Drawing.Point (77, 44); - this._ForceDirectionBox.Name = "_ForceDirectionBox"; - this._ForceDirectionBox.Size = new System.Drawing.Size (127, 20); - this._ForceDirectionBox.TabIndex = 3; - this._ForceDirectionBox.SelectedIndexChanged += new System.EventHandler (this.DocumentInfoChanged); - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point (6, 47); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size (65, 12); - this.label7.TabIndex = 2; - this.label7.Text = "阅读方向:"; - // - // _ForceInitialViewBox - // - this._ForceInitialViewBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this._ForceInitialViewBox.Location = new System.Drawing.Point (77, 18); - this._ForceInitialViewBox.Name = "_ForceInitialViewBox"; - this._ForceInitialViewBox.Size = new System.Drawing.Size (127, 20); - this._ForceInitialViewBox.TabIndex = 1; - this._ForceInitialViewBox.SelectedIndexChanged += new System.EventHandler (this.DocumentInfoChanged); - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point (6, 21); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size (65, 12); - this.label3.TabIndex = 0; - this.label3.Text = "初始视图:"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point (6, 8); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size (221, 12); - this.label5.TabIndex = 0; - this.label5.Text = "说明:以下设定优先于信息文件的内容。"; - // - // _HideMenuBox - // - this._HideMenuBox.AutoSize = true; - this._HideMenuBox.Location = new System.Drawing.Point (3, 3); - this._HideMenuBox.Name = "_HideMenuBox"; - this._HideMenuBox.Size = new System.Drawing.Size (72, 16); - this._HideMenuBox.TabIndex = 0; - this._HideMenuBox.Text = "隐藏菜单"; - this._HideMenuBox.UseVisualStyleBackColor = true; - this._HideMenuBox.CheckedChanged += new System.EventHandler (this.DocumentInfoChanged); - // - // _HideToolbarBox - // - this._HideToolbarBox.AutoSize = true; - this._HideToolbarBox.Location = new System.Drawing.Point (99, 3); - this._HideToolbarBox.Name = "_HideToolbarBox"; - this._HideToolbarBox.Size = new System.Drawing.Size (84, 16); - this._HideToolbarBox.TabIndex = 1; - this._HideToolbarBox.Text = "隐藏工具栏"; - this._HideToolbarBox.UseVisualStyleBackColor = true; - this._HideToolbarBox.CheckedChanged += new System.EventHandler (this.DocumentInfoChanged); - // - // _HideUIBox - // - this._HideUIBox.AutoSize = true; - this._HideUIBox.Location = new System.Drawing.Point (3, 25); - this._HideUIBox.Name = "_HideUIBox"; - this._HideUIBox.Size = new System.Drawing.Size (192, 16); - this._HideUIBox.TabIndex = 2; - this._HideUIBox.Text = "隐藏操作界面,仅显示文档内容"; - this._HideUIBox.UseVisualStyleBackColor = true; - this._HideUIBox.CheckedChanged += new System.EventHandler (this.DocumentInfoChanged); - // - // _FitWindowBox - // - this._FitWindowBox.AutoSize = true; - this._FitWindowBox.Location = new System.Drawing.Point (3, 47); - this._FitWindowBox.Name = "_FitWindowBox"; - this._FitWindowBox.Size = new System.Drawing.Size (120, 16); - this._FitWindowBox.TabIndex = 3; - this._FitWindowBox.Text = "窗口适应文档首页"; - this._FitWindowBox.UseVisualStyleBackColor = true; - this._FitWindowBox.CheckedChanged += new System.EventHandler (this.DocumentInfoChanged); - // - // _CenterWindowBox - // - this._CenterWindowBox.AutoSize = true; - this._CenterWindowBox.Location = new System.Drawing.Point (3, 68); - this._CenterWindowBox.Name = "_CenterWindowBox"; - this._CenterWindowBox.Size = new System.Drawing.Size (72, 16); - this._CenterWindowBox.TabIndex = 4; - this._CenterWindowBox.Text = "窗口居中"; - this._CenterWindowBox.UseVisualStyleBackColor = true; - this._CenterWindowBox.CheckedChanged += new System.EventHandler (this.DocumentInfoChanged); - // - // _DisplayDocTitleBox - // - this._DisplayDocTitleBox.AutoSize = true; - this._DisplayDocTitleBox.Location = new System.Drawing.Point (99, 68); - this._DisplayDocTitleBox.Name = "_DisplayDocTitleBox"; - this._DisplayDocTitleBox.Size = new System.Drawing.Size (96, 16); - this._DisplayDocTitleBox.TabIndex = 5; - this._DisplayDocTitleBox.Text = "显示文档标题"; - this._DisplayDocTitleBox.UseVisualStyleBackColor = true; - this._DisplayDocTitleBox.CheckedChanged += new System.EventHandler (this.DocumentInfoChanged); - // - // _UISettingsPanel - // - this._UISettingsPanel.Controls.Add (this._DisplayDocTitleBox); - this._UISettingsPanel.Controls.Add (this._HideMenuBox); - this._UISettingsPanel.Controls.Add (this._CenterWindowBox); - this._UISettingsPanel.Controls.Add (this._HideToolbarBox); - this._UISettingsPanel.Controls.Add (this._FitWindowBox); - this._UISettingsPanel.Controls.Add (this._HideUIBox); - this._UISettingsPanel.Enabled = false; - this._UISettingsPanel.Location = new System.Drawing.Point (2, 42); - this._UISettingsPanel.Name = "_UISettingsPanel"; - this._UISettingsPanel.Size = new System.Drawing.Size (208, 87); - this._UISettingsPanel.TabIndex = 1; - // - // _OverrideUISettingsBox - // - this._OverrideUISettingsBox.AutoSize = true; - this._OverrideUISettingsBox.Location = new System.Drawing.Point (5, 20); - this._OverrideUISettingsBox.Name = "_OverrideUISettingsBox"; - this._OverrideUISettingsBox.Size = new System.Drawing.Size (144, 16); - this._OverrideUISettingsBox.TabIndex = 0; - this._OverrideUISettingsBox.Text = "设置阅读器的操作界面"; - this._OverrideUISettingsBox.UseVisualStyleBackColor = true; - this._OverrideUISettingsBox.CheckedChanged += new System.EventHandler (this.DocumentInfoChanged); - // - // groupBox4 - // - this.groupBox4.Controls.Add (this._OverrideUISettingsBox); - this.groupBox4.Controls.Add (this._UISettingsPanel); - this.groupBox4.Location = new System.Drawing.Point (222, 23); - this.groupBox4.Name = "groupBox4"; - this.groupBox4.Size = new System.Drawing.Size (210, 135); - this.groupBox4.TabIndex = 3; - this.groupBox4.TabStop = false; - this.groupBox4.Text = "阅读器操作界面设定"; - // - // ViewerPreferenceEditor - // - this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add (this.groupBox4); - this.Controls.Add (this.groupBox2); - this.Controls.Add (this.groupBox1); - this.Controls.Add (this.label5); - this.Name = "ViewerPreferenceEditor"; - this.Size = new System.Drawing.Size (438, 279); - this.groupBox2.ResumeLayout (false); - this.groupBox2.PerformLayout (); - this.groupBox1.ResumeLayout (false); - this.groupBox1.PerformLayout (); - this._UISettingsPanel.ResumeLayout (false); - this._UISettingsPanel.PerformLayout (); - this.groupBox4.ResumeLayout (false); - this.groupBox4.PerformLayout (); - this.ResumeLayout (false); - this.PerformLayout (); - - } - - #endregion - - private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.ComboBox _ForceBookmarkOpenBox; - private System.Windows.Forms.CheckBox _ForceRemoveZoomRateBox; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.ComboBox _ForceInitialModeBox; - private System.Windows.Forms.ComboBox _ForceDirectionBox; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.ComboBox _ForceInitialViewBox; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.CheckBox _HideUIBox; - private System.Windows.Forms.CheckBox _HideToolbarBox; - private System.Windows.Forms.CheckBox _HideMenuBox; - private System.Windows.Forms.CheckBox _FitWindowBox; - private System.Windows.Forms.CheckBox _DisplayDocTitleBox; - private System.Windows.Forms.CheckBox _CenterWindowBox; - private System.Windows.Forms.Panel _UISettingsPanel; - private System.Windows.Forms.CheckBox _OverrideUISettingsBox; - private System.Windows.Forms.GroupBox groupBox4; - private System.Windows.Forms.CheckBox _ForceInternalLinkBox; - } -} diff --git a/pdfpatcher/App/Functions/ViewerPreferenceEditor.cs b/pdfpatcher/App/Functions/ViewerPreferenceEditor.cs deleted file mode 100644 index 8980b7e1f614a6d23f23a98880adebbc75e213e4..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/ViewerPreferenceEditor.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using System.Windows.Forms; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Functions -{ - public partial class ViewerPreferenceEditor : UserControl - { - readonly string[] __bookmarkStatus = new string[] { "保持不变", "全部关闭", "全部打开", "打开首层" }; - bool _settingsLockdown; - ViewerOptions _Options; - internal ViewerOptions Options { - get => _Options; - set { - _Options = value; - _settingsLockdown = true; - _ForceRemoveZoomRateBox.Checked = _Options.RemoveZoomRate; - _FitWindowBox.Checked = _Options.FitWindow; - _DisplayDocTitleBox.Checked = _Options.DisplayDocTitle; - _CenterWindowBox.Checked = _Options.CenterWindow; - _HideMenuBox.Checked = _Options.HideMenu; - _HideToolbarBox.Checked = _Options.HideToolbar; - _HideUIBox.Checked = _Options.HideUI; - _OverrideUISettingsBox.Checked = _Options.SpecifyViewerPreferences; - _ForceInternalLinkBox.Checked = _Options.ForceInternalLink; - - _ForceBookmarkOpenBox.SelectedIndex = (int)_Options.CollapseBookmark; - var i = Array.IndexOf(Constants.PageLayoutType.Names, _Options.InitialView); - _ForceInitialViewBox.SelectedIndex = i != -1 ? i : 0; - i = Array.IndexOf(Constants.ViewerPreferencesType.DirectionType.Names, _Options.Direction); - _ForceDirectionBox.SelectedIndex = i != -1 ? i : 0; - i = Array.IndexOf(Constants.PageModes.Names, _Options.InitialMode); - _ForceInitialModeBox.SelectedIndex = i != -1 ? i : 0; - _settingsLockdown = false; - } - } - - public ViewerPreferenceEditor() { - InitializeComponent(); - - _settingsLockdown = true; - _ForceBookmarkOpenBox.FormattingEnabled - = _ForceDirectionBox.FormattingEnabled - = _ForceInitialModeBox.FormattingEnabled - = _ForceInitialViewBox.FormattingEnabled - = false; - _ForceBookmarkOpenBox.AddRange(__bookmarkStatus).Select(0); - _ForceInitialViewBox.AddRange(Constants.PageLayoutType.Names).Select(0); - _ForceDirectionBox.AddRange(Constants.ViewerPreferencesType.DirectionType.Names).Select(0); - _ForceInitialModeBox.AddRange(Constants.PageModes.Names).Select(0); - _settingsLockdown = false; - } - - - void DocumentInfoChanged(object sender, EventArgs e) { - if (_settingsLockdown) { - return; - } - - if (sender == _ForceBookmarkOpenBox) { - Options.CollapseBookmark = (BookmarkStatus)_ForceBookmarkOpenBox.SelectedIndex; - } - else if (sender == _ForceDirectionBox) { - Options.Direction = (string)_ForceDirectionBox.SelectedItem; - } - else if (sender == _ForceInitialModeBox) { - Options.InitialMode = (string)_ForceInitialModeBox.SelectedItem; - } - else if (sender == _ForceInitialViewBox) { - Options.InitialView = (string)_ForceInitialViewBox.SelectedItem; - } - else if (sender == _ForceRemoveZoomRateBox) { - Options.RemoveZoomRate = _ForceRemoveZoomRateBox.Checked; - } - else if (sender == _OverrideUISettingsBox) { - Options.SpecifyViewerPreferences - = _UISettingsPanel.Enabled - = _OverrideUISettingsBox.Checked; - } - else if (sender == _HideMenuBox) { - Options.HideMenu = _HideMenuBox.Checked; - } - else if (sender == _HideToolbarBox) { - Options.HideToolbar = _HideToolbarBox.Checked; - } - else if (sender == _HideUIBox) { - Options.HideUI = _HideUIBox.Checked; - } - else if (sender == _CenterWindowBox) { - Options.CenterWindow = _CenterWindowBox.Checked; - } - else if (sender == _FitWindowBox) { - Options.FitWindow = _FitWindowBox.Checked; - } - else if (sender == _DisplayDocTitleBox) { - Options.DisplayDocTitle = _DisplayDocTitleBox.Checked; - } - else if (sender == _ForceInternalLinkBox) { - Options.ForceInternalLink = _ForceInternalLinkBox.Checked; - } - } - } -} diff --git a/pdfpatcher/App/Functions/ViewerPreferenceEditor.resx b/pdfpatcher/App/Functions/ViewerPreferenceEditor.resx deleted file mode 100644 index d58980a38d71402abe7cf7bbbdeb69d761a29c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Functions/ViewerPreferenceEditor.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/pdfpatcher/App/Lib/ColorPicker.dll b/pdfpatcher/App/Lib/ColorPicker.dll deleted file mode 100644 index 7487ae2797bad29a341dbc02fc061252ad250a6c..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Lib/ColorPicker.dll and /dev/null differ diff --git a/pdfpatcher/App/Lib/FreeImage.NET.chm b/pdfpatcher/App/Lib/FreeImage.NET.chm deleted file mode 100644 index 9054cc9729b6d6b6444b8bf0d51e13119ad7d402..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Lib/FreeImage.NET.chm and /dev/null differ diff --git a/pdfpatcher/App/Lib/FreeImage.NET.chw b/pdfpatcher/App/Lib/FreeImage.NET.chw deleted file mode 100644 index 11e36aa0b1fab8ee175e869f1c84534c5ad9dfd9..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Lib/FreeImage.NET.chw and /dev/null differ diff --git a/pdfpatcher/App/Lib/FreeImage.dll b/pdfpatcher/App/Lib/FreeImage.dll deleted file mode 100644 index 1959c1794126451a43746bc9da05256c06e99c7e..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Lib/FreeImage.dll and /dev/null differ diff --git a/pdfpatcher/App/Lib/FreeImageNET.XML b/pdfpatcher/App/Lib/FreeImageNET.XML deleted file mode 100644 index 85578f98258ae33bcc2465b8222a9956ad9e8180..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Lib/FreeImageNET.XML +++ /dev/null @@ -1,17620 +0,0 @@ - - - - FreeImageNET - - - - An exception which is thrown during image manipulation. - - - Initializes a new instance of the class with a specified error message. - - - Initializes a new instance of the class with a specified error message. - The message that describes the error. - - - Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. - The error message that explains the reason for the exception. - The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. - - - Initializes a new instance of the class with serialized data. - The that holds the serialized object data about the exception being thrown. - The that contains contextual information about the source or destination. - The parameter is null. - The class name is null or is zero (0). - - - - Class representing a FreeImage format. - - - - - Initializes a new instance of this class. - - The FreeImage format to wrap. - - - - Gets the format of this instance. - - - - - Gets or sets whether this plugin is enabled. - - - - - Gets a string describing the format. - - - - - Gets a comma-delimited file extension list describing the bitmap formats - this plugin can read and/or write. - - - - - Gets a descriptive string that describes the bitmap formats - this plugin can read and/or write. - - - - - Returns a regular expression string that can be used by - a regular expression engine to identify the bitmap. - FreeImageQt makes use of this function. - - - - - Gets whether this plugin can load bitmaps. - - - - - Gets whether this plugin can save bitmaps. - - - - - Checks whether this plugin can save a bitmap in the desired data type. - - The desired image type. - True if this plugin can save bitmaps as the desired type, else false. - - - - Checks whether this plugin can save bitmaps in the desired bit depth. - - The desired bit depth. - True if this plugin can save bitmaps in the desired bit depth, else false. - - - - Gets whether this plugin can load or save an ICC profile. - - - - - Checks whether an extension is valid for this format. - - The desired extension. - True if the extension is valid for this format, false otherwise. - - - - Checks whether an extension is valid for this format. - - The desired extension. - The string comparison type. - True if the extension is valid for this format, false otherwise. - - - - Checks whether a filename is valid for this format. - - The desired filename. - True if the filename is valid for this format, false otherwise. - - - - Checks whether a filename is valid for this format. - - The desired filename. - The string comparison type. - True if the filename is valid for this format, false otherwise. - - - - Gets a descriptive string that describes the bitmap formats - this plugin can read and/or write. - - A descriptive string that describes the bitmap formats. - - - - Class representing own FreeImage-Plugins. - - - FreeImages itself is plugin based. Each supported format is integrated by a seperat plugin, - that handles loading, saving, descriptions, identifing ect. - And of course the user can create own plugins and use them in FreeImage. - To do that the above mentioned predefined methodes need to be implemented. - - The class below handles the creation of such a plugin. The class itself is abstract - as well as some core functions that need to be implemented. - The class can be used to enable or disable the plugin in FreeImage after regististration or - retrieve the formatid, assigned by FreeImage. - The class handles the callback functions, garbage collector and pointer operation to make - the implementation as user friendly as possible. - - How to: - There are two functions that need to be implemented: - and - . - is used by the constructor - of the abstract class. FreeImage wants a list of the implemented functions. Each function is - represented by a function pointer (a .NET ). In case a function - is not implemented FreeImage receives an empty delegate). To tell the constructor - which functions have been implemented the information is represented by a disjunction of - . - - For example: - return MethodFlags.LoadProc | MethodFlags.SaveProc; - - The above statement means that LoadProc and SaveProc have been implemented by the user. - Keep in mind, that each function has a standard implementation that has static return - values that may cause errors if listed in - without a real implementation. - - is used by some checks of FreeImage and - must be implemented. for example can be - implemented if the plugin supports reading, but it doesn't have to, the plugin could only - be used to save an already loaded bitmap in a special format. - - - - - Struct containing function pointers. - - - - - Delegate for register callback by FreeImage. - - - - - The format id assiged to the plugin. - - - - - When true the plugin was registered successfully else false. - - - - - A copy of the functions used to register. - - - - - MethodFlags defines values to fill a bitfield telling which - functions have been implemented by a plugin. - - - - - No mothods implemented. - - - - - DescriptionProc has been implemented. - - - - - ExtensionListProc has been implemented. - - - - - RegExprProc has been implemented. - - - - - OpenProc has been implemented. - - - - - CloseProc has been implemented. - - - - - PageCountProc has been implemented. - - - - - PageCapabilityProc has been implemented. - - - - - LoadProc has been implemented. - - - - - SaveProc has been implemented. - - - - - ValidateProc has been implemented. - - - - - MimeProc has been implemented. - - - - - SupportsExportBPPProc has been implemented. - - - - - SupportsExportTypeProc has been implemented. - - - - - SupportsICCProfilesProc has been implemented. - - - - - Function that returns a bitfield containing the - implemented methods. - - Bitfield of the implemented methods. - - - - Implementation of FormatProc - - A string containing the plugins format. - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - The constructor automatically registeres the plugin in FreeImage. - To do this it prepares a FreeImage defined structure with function pointers - to the implemented functions or null if not implemented. - Before registing the functions they are pinned in memory so the garbage collector - can't move them around in memory after we passed there addresses to FreeImage. - - - - - Gets or sets if the plugin is enabled. - - - - - Gets if the plugin was registered successfully. - - - - - Gets the FreeImage assigned to this plugin. - - - - - Reads from an unmanaged stream. - - - - - Reads a single byte from an unmanaged stream. - - - - - Writes to an unmanaged stream. - - - - - Writes a single byte to an unmanaged stream. - - - - - Seeks in an unmanaged stream. - - - - - Retrieves the position of an unmanaged stream. - - - - - Class representing all registered in FreeImage. - - - - - Adds local plugin to this class. - - The registered plugin. - - - - Returns an instance of , representing the given format. - - The representing format. - An instance of . - - - - Returns an instance of , - representing the format at the given index. - - The index of the representing format. - An instance of . - - - - Returns an instance of . - is searched in: - Format, RegExpr, - ValidExtension and ValidFilename. - - The expression to search for. - An instance of . - - - - Returns an instance of for the given format. - - The format of the Plugin. - An instance of . - - - - Returns an instance of for the given filename. - - The valid filename for the plugin. - An instance of . - - - - Returns an instance of for the given mime. - - The valid mime for the plugin. - An instance of . - - - - Gets the number of registered plugins. - - - - - Gets a readonly collection of all plugins. - - - - - Gets a list of plugins that are only able to - read but not to write. - - - - - Gets a list of plugins that are only able to - write but not to read. - - - - - Gets a list of plugins that are not able to - read or write. - - - - - Gets a list of plugins that are able to read. - - - - - Gets a list of plugins that are able to write. - - - - - Gets a list of local plugins. - - - - - Gets a list of built-in plugins. - - - - - Windows or OS/2 Bitmap File (*.BMP) - - - - - Independent JPEG Group (*.JPG, *.JIF, *.JPEG, *.JPE) - - - - - Independent JPEG Group (*.JPG, *.JIF, *.JPEG, *.JPE) - - - - - JPEG Network Graphics (*.JNG) - - - - - Commodore 64 Koala format (*.KOA) - - - - - Amiga IFF (*.IFF, *.LBM) - - - - - Amiga IFF (*.IFF, *.LBM) - - - - - Multiple Network Graphics (*.MNG) - - - - - Portable Bitmap (ASCII) (*.PBM) - - - - - Portable Bitmap (BINARY) (*.PBM) - - - - - Kodak PhotoCD (*.PCD) - - - - - Zsoft Paintbrush PCX bitmap format (*.PCX) - - - - - Portable Graymap (ASCII) (*.PGM) - - - - - Portable Graymap (BINARY) (*.PGM) - - - - - Portable Network Graphics (*.PNG) - - - - - Portable Pixelmap (ASCII) (*.PPM) - - - - - Portable Pixelmap (BINARY) (*.PPM) - - - - - Sun Rasterfile (*.RAS) - - - - - truevision Targa files (*.TGA, *.TARGA) - - - - - Tagged Image File Format (*.TIF, *.TIFF) - - - - - Wireless Bitmap (*.WBMP) - - - - - Adobe Photoshop (*.PSD) - - - - - Dr. Halo (*.CUT) - - - - - X11 Bitmap Format (*.XBM) - - - - - X11 Pixmap Format (*.XPM) - - - - - DirectDraw Surface (*.DDS) - - - - - Graphics Interchange Format (*.GIF) - - - - - High Dynamic Range (*.HDR) - - - - - Raw Fax format CCITT G3 (*.G3) - - - - - Silicon Graphics SGI image format (*.SGI) - - - - - OpenEXR format (*.EXR) - - - - - JPEG-2000 format (*.J2K, *.J2C) - - - - - JPEG-2000 format (*.JP2) - - - - - Portable FloatMap (*.PFM) - - - - - Macintosh PICT (*.PICT) - - - - - RAW camera image (*.*) - - - - - Delegate to a function that returns a string which describes - the plugins format. - - - - - Delegate to a function that returns a string which contains - a more detailed description. - - - - - Delegate to a function that returns a comma seperated list - of file extensions the plugin can read or write. - - - - - Delegate to a function that returns a regular expression that - can be used to idientify whether a file can be handled by the plugin. - - - - - Delegate to a function that opens a file. - - - - - Delegate to a function that closes a previosly opened file. - - - - - Delegate to a function that returns the number of pages of a multipage - bitmap if the plugin is capable of handling multipage bitmaps. - - - - - UNKNOWN - - - - - Delegate to a function that loads and decodes a bitmap into memory. - - - - - Delegate to a function that saves a bitmap. - - - - - Delegate to a function that determines whether the source defined - by and is a valid image. - - - - - Delegate to a function that returns a string which contains - the plugin's mime type. - - - - - Delegate to a function that returns whether the plugin can handle the - specified color depth. - - - - - Delegate to a function that returns whether the plugin can handle the - specified image type. - - - - - Delegate to a function that returns whether the plugin can handle - ICC-Profiles. - - - - - Callback function used by FreeImage to register plugins. - - - - - The structure contains functionpointers that make up a FreeImage plugin. - - - - - Delegate to a function that returns a string which describes - the plugins format. - - - - - Delegate to a function that returns a string which contains - a more detailed description. - - - - - Delegate to a function that returns a comma seperated list - of file extensions the plugin can read or write. - - - - - Delegate to a function that returns a regular expression that - can be used to idientify whether a file can be handled by the plugin. - - - - - Delegate to a function that opens a file. - - - - - Delegate to a function that closes a previosly opened file. - - - - - Delegate to a function that returns the number of pages of a multipage - bitmap if the plugin is capable of handling multipage bitmaps. - - - - - UNKNOWN - - - - - Delegate to a function that loads and decodes a bitmap into memory. - - - - - Delegate to a function that saves a bitmap. - - - - - Delegate to a function that determines whether the source is a valid image. - - - - - Delegate to a function that returns a string which contains - the plugin's mime type. - - - - - Delegate to a function that returns whether the plugin can handle the - specified color depth. - - - - - Delegate to a function that returns whether the plugin can handle the - specified image type. - - - - - Delegate to a function that returns whether the plugin can handle - ICC-Profiles. - - - - - Encapsulates a FreeImage-bitmap. - - - - - Indicates whether this instance is disposed. - - - - - Tab object. - - - - - Object used to syncronize lock methods. - - - - - Holds information used by SaveAdd() methods. - - - - - The stream that this instance was loaded from or - null if it has been cloned or deserialized. - - - - - True if the stream must be disposed with this - instance. - - - - - The number of frames contained by a mutlipage bitmap. - Default value is 1 and only changed if needed. - - - - - The index of the loaded frame. - Default value is 0 and only changed if needed. - - - - - Format of the sourceimage. - - - - - Handle to the encapsulated FreeImage-bitmap. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - For internal use only. - - The operation failed. - - - - Initializes a new instance of the class - bases on the specified image. - - The original to clone from. - The operation failed. - is a null reference. - - - - Initializes a new instance of the class - bases on the specified image with the specified size. - - The original to clone from. - The Size structure that represent the - size of the new . - The operation failed. - is a null reference. - - or are less or equal zero. - - - - - Initializes a new instance of the class - bases on the specified image with the specified size. - - The original to clone from. - Width of the new . - Height of the new . - The operation failed. - is a null reference. - - or are less or equal zero. - - - - Initializes a new instance of the class - bases on the specified image. - - The original to clone from. - - Although this constructor supports creating images in both formats - - and , bitmaps - created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - images respectively. Currently, there is no support for automatic premultiplying images in - . - - The operation failed. - - - - Initializes a new instance of the class - bases on the specified image with the specified size. - - The original to clone from. - The Size structure that represent the - size of the new . - - Although this constructor supports creating images in both formats - - and , bitmaps - created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - images respectively. Currently, there is no support for automatic premultiplying images in - . - - The operation failed. - is a null reference. - - or are less or equal zero. - - - - - Initializes a new instance of the class - bases on the specified image with the specified size. - - The original to clone from. - The width, in pixels, of the new . - The height, in pixels, of the new . - - Although this constructor supports creating images in both formats - - and , bitmaps - created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - images respectively. Currently, there is no support for automatic premultiplying images in - . - - The operation failed. - is a null reference. - - or are less or equal zero. - - - - Initializes a new instance of the class - bases on the specified image. - - The original to clone from. - - Although this constructor supports creating images in both formats - - and , bitmaps - created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - images respectively. Currently, there is no support for automatic premultiplying images in - . - - is a null reference. - The operation failed. - - - - Initializes a new instance of the class - bases on the specified image with the specified size. - - The original to clone from. - The Size structure that represent the - size of the new . - - Although this constructor supports creating images in both formats - - and , bitmaps - created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - images respectively. Currently, there is no support for automatic premultiplying images in - . - - The operation failed. - is a null reference. - - or are less or equal zero. - - - - - Initializes a new instance of the class - bases on the specified image with the specified size. - - The original to clone from. - The width, in pixels, of the new . - The height, in pixels, of the new . - - Although this constructor supports creating images in both formats - - and , bitmaps - created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - images respectively. Currently, there is no support for automatic premultiplying images in - . - - The operation failed. - is a null reference. - - or are less or equal zero. - - - - Initializes a new instance of the class - bases on the specified stream. - - Stream to read from. - Ignored. - The operation failed. - is a null reference. - - You must keep the stream open for the lifetime of the . - - - - - Initializes a new instance of the class - bases on the specified stream. - - Stream to read from. - The operation failed. - is a null reference. - - You must keep the stream open for the lifetime of the . - - - - - Initializes a new instance of the class - bases on the specified stream in the specified format. - - Stream to read from. - Format of the image. - The operation failed. - is a null reference. - - You must keep the stream open for the lifetime of the . - - - - - Initializes a new instance of the class - bases on the specified stream with the specified loading flags. - - Stream to read from. - Flags to enable or disable plugin-features. - The operation failed. - is a null reference. - - You must keep the stream open for the lifetime of the . - - - - - Initializes a new instance of the class - bases on the specified stream in the specified format - with the specified loading flags. - - Stream to read from. - Format of the image. - Flags to enable or disable plugin-features. - The operation failed. - is a null reference. - - You must keep the stream open for the lifetime of the . - - - - - Initializes a new instance of the class bases on the specified file. - - The complete name of the file to load. - The operation failed. - is a null reference. - does not exist. - - - - Initializes a new instance of the class bases on the specified file. - - The complete name of the file to load. - Ignored. - The operation failed. - is a null reference. - does not exist. - - - - Initializes a new instance of the class bases on the specified file - with the specified loading flags. - - The complete name of the file to load. - Flags to enable or disable plugin-features. - The operation failed. - is a null reference. - does not exist. - - - - Initializes a new instance of the class bases on the specified file - in the specified format. - - The complete name of the file to load. - Format of the image. - The operation failed. - is a null reference. - does not exist. - - - - Initializes a new instance of the class bases on the specified file - in the specified format with the specified loading flags. - - The complete name of the file to load. - Format of the image. - Flags to enable or disable plugin-features. - The operation failed. - is a null reference. - does not exist. - - - - Initializes a new instance of the class - bases on the specified size. - - The width, in pixels, of the new . - The height, in pixels, of the new . - The operation failed. - - - - Initializes a new instance of the class bases on the specified resource. - - The class used to extract the resource. - The name of the resource. - The operation failed. - - - - Initializes a new instance of the class bases on the specified size - and with the resolution of the specified object. - - The width, in pixels, of the new . - The height, in pixels, of the new . - The Graphics object that specifies the resolution for the new . - The operation failed. - is a null reference. - - - - Initializes a new instance of the class bases on the specified size and format. - - The width, in pixels, of the new . - The height, in pixels, of the new . - The PixelFormat enumeration for the new . - - Although this constructor supports creating images in both formats - - and , bitmaps - created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - images respectively. Currently, there is no support for automatic premultiplying images in - . - - The operation failed. - is invalid. - - or are less or equal zero. - - - - Initializes a new instance of the class bases on the specified size and type. - Only non standard bitmaps are supported. - - The width, in pixels, of the new . - The height, in pixels, of the new . - The type of the bitmap. - The operation failed. - - is FIT_BITMAP or FIT_UNKNOWN. - is invalid. - - or are less or equal zero. - - - - Initializes a new instance of the class bases on the specified size, - pixel format and pixel data. - - The width, in pixels, of the new . - The height, in pixels, of the new . - Integer that specifies the byte offset between the beginning - of one scan line and the next. This is usually (but not necessarily) - the number of bytes in the pixel format (for example, 2 for 16 bits per pixel) - multiplied by the width of the bitmap. The value passed to this parameter must - be a multiple of four.. - The PixelFormat enumeration for the new . - Pointer to an array of bytes that contains the pixel data. - - Although this constructor supports creating images in both formats - - and , bitmaps - created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - images respectively. Currently, there is no support for automatic premultiplying images in - . - - The operation failed. - is invalid. - - or are less or equal zero. - - - - Initializes a new instance of the class bases on the specified size, - pixel format and pixel data. - - The width, in pixels, of the new . - The height, in pixels, of the new . - Integer that specifies the byte offset between the beginning - of one scan line and the next. This is usually (but not necessarily) - the number of bytes in the pixel format (for example, 2 for 16 bits per pixel) - multiplied by the width of the bitmap. The value passed to this parameter must - be a multiple of four.. - The PixelFormat enumeration for the new . - Array of bytes containing the bitmap data. - - Although this constructor supports creating images in both formats - - and , bitmaps - created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - images respectively. Currently, there is no support for automatic premultiplying images in - . - - The operation failed. - is invalid. - - or are less or equal zero. - is null - - - - Initializes a new instance of the class bases on the specified size, - pixel format and pixel data. - - The width, in pixels, of the new . - The height, in pixels, of the new . - Integer that specifies the byte offset between the beginning - of one scan line and the next. This is usually (but not necessarily) - the number of bytes in the pixel format (for example, 2 for 16 bits per pixel) - multiplied by the width of the bitmap. The value passed to this parameter must - be a multiple of four.. - The color depth of the new - The type for the new . - Pointer to an array of bytes that contains the pixel data. - The operation failed. - or is invalid. - - or are less or equal zero. - - - - Initializes a new instance of the class bases on the specified size, - pixel format and pixel data. - - The width, in pixels, of the new . - The height, in pixels, of the new . - Integer that specifies the byte offset between the beginning - of one scan line and the next. This is usually (but not necessarily) - the number of bytes in the pixel format (for example, 2 for 16 bits per pixel) - multiplied by the width of the bitmap. The value passed to this parameter must - be a multiple of four.. - The color depth of the new - The type for the new . - Array of bytes containing the bitmap data. - The operation failed. - or is invalid. - - or are less or equal zero. - is null - - - - Initializes a new instance of the class. - - The that holds the serialized object data about the exception being thrown. - The that contains contextual information about the source or destination. - The operation failed. - The operation failed. - - - - Frees all managed and unmanaged ressources. - - - - - Converts a instance to a instance. - - A instance. - A new instance of initialized to . - - The explicit conversion from into Bitmap - allows to create an instance on the fly and use it as if - was a Bitmap. This way it can be directly used with a - PixtureBox for example without having to call any - conversion operations. - - - - - Converts a instance to a instance. - - A instance. - A new instance of initialized to . - - The explicit conversion from into - allows to create an instance on the fly to perform - image processing operations and converting it back. - - - - - Determines whether two specified objects have the same value. - - A or a null reference (Nothing in Visual Basic). - A or a null reference (Nothing in Visual Basic). - - true if the value of left is the same as the value of right; otherwise, false. - - - - - Determines whether two specified objects have different values. - - A or a null reference (Nothing in Visual Basic). - A or a null reference (Nothing in Visual Basic). - - true if the value of left is different from the value of right; otherwise, false. - - - - - Type of the bitmap. - - - - - Number of palette entries. - - - - - The number of unique colors actually used by the bitmap. This might be different from - what ColorsUsed returns, which actually returns the palette size for palletised images. - Works for FIT_BITMAP type bitmaps only. - - - - - The size of one pixel in the bitmap in bits. - - - - - Width of the bitmap in pixel units. - - - - - Height of the bitmap in pixel units. - - - - - Returns the width of the bitmap in bytes, rounded to the next 32-bit boundary. - - - - - Size of the bitmap in memory. - - - - - Returns a structure that represents the palette of a FreeImage bitmap. - - is false. - - - - Gets whether the bitmap is RGB 555. - - - - - Gets whether the bitmap is RGB 565. - - - - - Gets the horizontal resolution, in pixels per inch, of this . - - - - - Gets the vertical resolution, in pixels per inch, of this . - - - - - Returns the structure of this . - - - - - Returns the structure of a this . - - - - - Investigates the color type of this - by reading the bitmaps pixel bits and analysing them. - - - - - Bit pattern describing the red color component of a pixel in this . - - - - - Bit pattern describing the green color component of a pixel in this . - - - - - Bit pattern describing the blue color component of a pixel in this . - - - - - Number of transparent colors in a palletised . - - - - - Get or sets transparency table of this . - - - - - Gets or sets whether this is transparent. - - - - - Gets whether this has a file background color. - - - - - Gets or sets the background color of this . - In case the value is null, the background color is removed. - - Get: There is no background color available. - Set: Setting background color failed. - - - - Pointer to the data-bits of this . - - - - - Width, in bytes, of this . - - - - - Pointer to the scanline of the top most pixel row of this . - - - - - Width, in bytes, of this . - In case this is top down Stride will be positive, else negative. - - - - - Gets attribute flags for the pixel data of this . - - - - - Gets the width and height of this . - - - - - Gets the pixel format for this . - - - - - Gets IDs of the property items stored in this . - - - - - Gets all the property items (pieces of metadata) stored in this . - - - - - Gets the format of this . - - - - - Gets the width and height, in pixels, of this . - - - - - Gets or sets an object that provides additional data about the . - - - - - Gets whether this has been disposed. - - - - - Gets a new instance of a metadata representing class. - - - - - Gets or sets the comment of this . - Supported formats are JPEG, PNG and GIF. - - - - - Returns whether this has a palette. - - - - - Gets or sets the entry used as transparent color in this . - Only works for 1-, 4- and 8-bpp. - - - - - Gets the number of frames in this . - - - - - Gets the ICCProfile structure of this . - - - - - Gets the format of the original image in case - this was loaded from a file or stream. - - - - - Gets the encapsulated FIBITMAP. - - - - - Gets the bounds of this in the specified unit. - - One of the values indicating - the unit of measure for the bounding rectangle. - The that represents the bounds of this - , in the specified unit. - - - - Gets the specified property item from this . - - The ID of the property item to get. - The this method gets. - - - - Returns a thumbnail for this . - - The width, in pixels, of the requested thumbnail image. - The height, in pixels, of the requested thumbnail image. - Ignored. - Ignored. - A that represents the thumbnail. - - - - Returns a thumbnail for this , keeping aspect ratio. - defines the maximum width or height - of the thumbnail. - - Thumbnail square size. - When true HDR images are transperantly - converted to standard images. - The thumbnail in a new instance. - - - - Converts this instance to a instance. - - A new instance of initialized this instance. - - - - Returns an instance of , representing the scanline - specified by of this . - Since FreeImage bitmaps are always bottum up aligned, keep in mind that scanline 0 is the - bottom-most line of the image. - - Number of the scanline to retrieve. - An instance of representing the - th scanline. - - List of return-types of T: - - Color Depth / TypeResult Type - 1 () - 4 () - 8 () - 16 () - 16 - 555 () - 16 - 565 () - 24 () - 32 () - - - - - - - - - - - - - - - - FreeImageBitmap bitmap = new FreeImageBitmap(@"C:\Pictures\picture.bmp"); - if (bitmap.ColorDepth == 32) - { - Scanline<RGBQUAD> scanline = bitmap.GetScanline<RGBQUAD>(0); - foreach (RGBQUAD pixel in scanline) - { - Console.WriteLine(pixel); - } - } - - - - The bitmap's type or color depth are not supported. - - - is no valid value. - - - - - Returns an instance of , representing the scanline - specified by of this . - Since FreeImage bitmaps are always bottum up aligned, keep in mind that scanline 0 is the - bottom-most line of the image. - - Number of the scanline to retrieve. - An instance of representing the - th scanline. - - List of return-types of T: - - Color Depth / TypeResult Type - 1 () - 4 () - 8 () - 16 () - 16 - 555 () - 16 - 565 () - 24 () - 32 () - - - - - - - - - - - - - - - - FreeImageBitmap bitmap = new FreeImageBitmap(@"C:\Pictures\picture.bmp"); - if (bitmap.ColorDepth == 32) - { - Scanline<RGBQUAD> scanline = (Scanline<RGBQUAD>)bitmap.GetScanline(0); - foreach (RGBQUAD pixel in scanline) - { - Console.WriteLine(pixel); - } - } - - - - The type of the bitmap or color depth are not supported. - - - is no valid value. - - - - - Returns a pointer to the specified scanline. - Due to FreeImage bitmaps are bottum up, - scanline 0 is the most bottom line of the image. - - Number of the scanline. - Pointer to the scanline. - - - - Returns a list of structures, representing the scanlines of this . - Due to FreeImage bitmaps are bottum up, scanline 0 is the - bottom-most line of the image. - Each color depth has a different representing structure due to different memory layouts. - - - List of return-types of T: - - Color Depth / TypeResult Type of IEnmuerable<Scanline<T>> - 1 () - 4 () - 8 () - 16 () - 16 - 555 () - 16 - 565 () - 24 () - 32 () - - - - - - - - - - - - - - - - - Removes the specified property item from this . - - The ID of the property item to remove. - - - - This method rotates, flips, or rotates and flips this . - - A RotateFlipType member - that specifies the type of rotation and flip to apply to this . - - - - Copies the metadata from another . - - The bitmap to read the metadata from. - - is a null reference. - - - - - Copies the metadata from another using - the provided options. - - The bitmap to read the metadata from. - Specifies the way the metadata is copied. - - is a null reference. - - - - - Saves this to the specified file. - - A string that contains the name of the file to which - to save this . - is null or empty. - Saving the image failed. - - - - Saves this to the specified file in the specified format. - - A string that contains the name of the file to which - to save this . - An that specifies the format of the saved image. - is null or empty. - Saving the image failed. - - - - Saves this to the specified file in the specified format - using the specified saving flags. - - A string that contains the name of the file to which - to save this . - An that specifies the format of the saved image. - Flags to enable or disable plugin-features. - is null or empty. - Saving the image failed. - - - - Saves this to the specified stream in the specified format. - - The stream where this will be saved. - An that specifies the format of the saved image. - is a null reference. - Saving the image failed. - - - - Saves this to the specified stream in the specified format - using the specified saving flags. - - The stream where this will be saved. - An that specifies the format of the saved image. - Flags to enable or disable plugin-features. - is a null reference. - Saving the image failed. - - - - Adds a frame to the file specified in a previous call to the - method. - - - This instance has not been saved to a file using Save(...) before. - - - - Adds a frame to the file specified in a previous call to the method. - - The position at which the frame should be inserted. - - This instance has not yet been saved to a file using the Save(...) method. - is out of range. - - - - Adds a frame to the file specified in a previous call to the method. - - A that contains the frame to add. - - This instance has not yet been saved to a file using the Save(...) method. - - - - Adds a frame to the file specified in a previous call to the method. - - A that contains the frame to add. - The position at which the frame should be inserted. - - This instance has not yet been saved to a file using the Save(...) method. - is out of range. - - - - Adds a frame to the file specified. - - File to add this frame to. - is a null reference. - does not exist. - Saving the image has failed. - - - - Adds a frame to the file specified. - - File to add this frame to. - The position at which the frame should be inserted. - is a null reference. - does not exist. - Saving the image has failed. - is out of range. - - - - Adds a frame to the file specified using the specified parameters. - - File to add this frame to. - Format of the image. - Flags to enable or disable plugin-features. - Flags to enable or disable plugin-features. - is a null reference. - does not exist. - Saving the image has failed. - - - - Adds a frame to the file specified using the specified parameters. - - File to add this frame to. - The position at which the frame should be inserted. - Format of the image. - Flags to enable or disable plugin-features. - Flags to enable or disable plugin-features. - is a null reference. - does not exist. - Saving the image has failed. - is out of range. - - - - Selects the frame specified by the index. - - The index of the active frame. - - is out of range. - The operation failed. - The source of the bitmap is not available. - - - - - Creates a GDI bitmap object from this . - - A handle to the GDI bitmap object that this method creates. - - - - Creates a GDI bitmap object from this . - - A structure that specifies the background color. - This parameter is ignored if the bitmap is totally opaque. - A handle to the GDI bitmap object that this method creates. - - - - Returns the handle to an icon. - - A Windows handle to an icon with the same image as this . - - - - Creates a GDI bitmap object from this with the same - color depth as the primary device. - - A handle to the GDI bitmap object that this method creates. - - - - Gets the of the specified pixel in this . - - The x-coordinate of the pixel to retrieve. - The y-coordinate of the pixel to retrieve. - A structure that represents the color of the specified pixel. - The operation failed. - The type of this bitmap is not supported. - - - - Makes the default transparent color transparent for this . - - - - - Makes the specified color transparent for this . - - The structure that represents - the color to make transparent. - - This method is not implemented. - - - - Sets the of the specified pixel in this . - - The x-coordinate of the pixel to set. - The y-coordinate of the pixel to set. - A structure that represents the color - to assign to the specified pixel. - The operation failed. - The type of this bitmap is not supported. - - - - Sets the resolution for this . - - The horizontal resolution, in dots per inch, of this . - The vertical resolution, in dots per inch, of this . - - - - This function is not yet implemented. - - - This method is not implemented. - - - - This function is not yet implemented. - - - This method is not implemented. - - - - This function is not yet implemented. - - - This method is not implemented. - - - - Converts this into a different color depth. - The parameter specifies color depth, greyscale conversion - and palette reorder. - Adding the flag - will first perform a convesion to greyscale. This can be done with any target - color depth. - Adding the flag - will allow the algorithm to reorder the palette. This operation will not be performed to - non-greyscale images to prevent data loss by mistake. - - A bitfield containing information about the conversion - to perform. - Returns true on success, false on failure. - - - - Converts this to - initializing a new instance. - In case source and destination type are the same, the operation fails. - An error message can be catched using the 'Message' event. - - Destination type. - True to scale linear, else false. - Returns true on success, false on failure. - - - - Converts this to . - In case source and destination type are the same, the operation fails. - An error message can be catched using the 'Message' event. - - Destination type. - True to scale linear, else false. - The converted instance. - - - - Converts this into a different color depth initializing - a new instance. - The parameter specifies color depth, greyscale conversion - and palette reorder. - Adding the flag will - first perform a convesion to greyscale. This can be done with any target color depth. - Adding the flag will - allow the algorithm to reorder the palette. This operation will not be performed to - non-greyscale images to prevent data loss by mistake. - - A bitfield containing information about the conversion - to perform. - The converted instance. - - - - Rescales this to the specified size using the - specified filter. - - The Size structure that represent the - size of the new . - Filter to use for resizing. - Returns true on success, false on failure. - - - - Rescales this to the specified size using the - specified filter. - - Width of the new . - Height of the new . - Filter to use for resizing. - Returns true on success, false on failure. - - - - Rescales this to the specified size using the - specified filter initializing a new instance. - - The Size structure that represent the - size of the new . - Filter to use for resizing. - The rescaled instance. - - - - Rescales this to the specified size using the - specified filter initializing a new instance. - - Width of the new . - Height of the new . - Filter to use for resizing. - The rescaled instance. - - - - Enlarges or shrinks this selectively per side and fills - newly added areas with the specified background color. - See for further details. - - The type of the specified color. - The number of pixels, the image should be enlarged on its left side. - Negative values shrink the image on its left side. - The number of pixels, the image should be enlarged on its top side. - Negative values shrink the image on its top side. - The number of pixels, the image should be enlarged on its right side. - Negative values shrink the image on its right side. - The number of pixels, the image should be enlarged on its bottom side. - Negative values shrink the image on its bottom side. - The color, the enlarged sides of the image should be filled with. - true on success, false on failure. - - - - Enlarges or shrinks this selectively per side and fills - newly added areas with the specified background color. - See for further details. - - The type of the specified color. - The number of pixels, the image should be enlarged on its left side. - Negative values shrink the image on its left side. - The number of pixels, the image should be enlarged on its top side. - Negative values shrink the image on its top side. - The number of pixels, the image should be enlarged on its right side. - Negative values shrink the image on its right side. - The number of pixels, the image should be enlarged on its bottom side. - Negative values shrink the image on its bottom side. - The color, the enlarged sides of the image should be filled with. - Options that affect the color search process for palletized images. - true on success, false on failure. - - - - Enlarges or shrinks this selectively per side and fills - newly added areas with the specified background color returning a new instance. - See for further details. - - The type of the specified color. - The number of pixels, the image should be enlarged on its left side. - Negative values shrink the image on its left side. - The number of pixels, the image should be enlarged on its top side. - Negative values shrink the image on its top side. - The number of pixels, the image should be enlarged on its right side. - Negative values shrink the image on its right side. - The number of pixels, the image should be enlarged on its bottom side. - Negative values shrink the image on its bottom side. - The color, the enlarged sides of the image should be filled with. - The enlarged instance. - - - - Enlarges or shrinks this selectively per side and fills - newly added areas with the specified background color returning a new instance. - See for further details. - - The type of the specified color. - The number of pixels, the image should be enlarged on its left side. - Negative values shrink the image on its left side. - The number of pixels, the image should be enlarged on its top side. - Negative values shrink the image on its top side. - The number of pixels, the image should be enlarged on its right side. - Negative values shrink the image on its right side. - The number of pixels, the image should be enlarged on its bottom side. - Negative values shrink the image on its bottom side. - The color, the enlarged sides of the image should be filled with. - Options that affect the color search process for palletized images. - The enlarged instance. - - - - Quantizes this from 24 bit to 8bit creating a new - palette with the specified using the specified - . - - The color reduction algorithm to be used. - Size of the desired output palette. - Returns true on success, false on failure. - - - - Quantizes this from 24 bit to 8bit creating a new - palette with the specified using the specified - and the specified - palette up to the - specified length. - - The color reduction algorithm to be used. - Size of the desired output palette. - The provided palette. - Returns true on success, false on failure. - - - - Quantizes this from 24 bit to 8bit creating a new - palette with the specified using the specified - and the specified - palette up to the - specified length. - - The color reduction algorithm to be used. - Size of the desired output palette. - Size of the provided palette of ReservePalette. - The provided palette. - Returns true on success, false on failure. - - - - Quantizes this from 24 bit to 8bit creating a new - palette with the specified using the specified - and the specified - palette up to the - specified length. - - The color reduction algorithm to be used. - Size of the desired output palette. - Size of the provided palette of ReservePalette. - The provided palette. - Returns true on success, false on failure. - - - - Quantizes this from 24 bit, using the specified - initializing a new 8 bit instance with the - specified . - - The color reduction algorithm to be used. - Size of the desired output palette. - The quantized instance. - - - - Quantizes this from 24 bit, using the specified - and palette - initializing a new 8 bit instance with the specified . - - The color reduction algorithm to be used. - Size of the desired output palette. - The provided palette. - The quantized instance. - - - - Quantizes this from 24 bit, using the specified - and up to - entries from palette initializing - a new 8 bit instance with the specified . - - The color reduction algorithm to be used. - Size of the desired output palette. - Size of the provided palette. - The provided palette. - The quantized instance. - - - - Quantizes this from 24 bit, using the specified - and up to - entries from palette initializing - a new 8 bit instance with the specified . - - The color reduction algorithm to be used. - Size of the desired output palette. - Size of the provided palette. - The provided palette. - The quantized instance. - - - - Converts a High Dynamic Range image to a 24-bit RGB image using a global - operator based on logarithmic compression of luminance values, imitating - the human response to light. - - A gamma correction that is applied after the tone mapping. - A value of 1 means no correction. - Scale factor allowing to adjust the brightness of the output image. - Returns true on success, false on failure. - - - - Converts a High Dynamic Range image to a 24-bit RGB image using a global operator inspired - by photoreceptor physiology of the human visual system. - - Controls the overall image intensity in the range [-8, 8]. - Controls the overall image contrast in the range [0.3, 1.0[. - Returns true on success, false on failure. - - - - Apply the Gradient Domain High Dynamic Range Compression to a RGBF image and convert to 24-bit RGB. - - Color saturation (s parameter in the paper) in [0.4..0.6] - Atenuation factor (beta parameter in the paper) in [0.8..0.9] - Returns true on success, false on failure. - - - - This method rotates a 1-, 4-, 8-bit greyscale or a 24-, 32-bit color image by means of 3 shears. - For 1- and 4-bit images, rotation is limited to angles whose value is an integer - multiple of 90. - - The angle of rotation. - Returns true on success, false on failure. - - - - This method rotates a 1-, 4-, 8-bit greyscale or a 24-, 32-bit color image by means of 3 shears. - For 1- and 4-bit images, rotation is limited to angles whose value is an integer - multiple of 90. - - The type of the color to use as background. - The angle of rotation. - The color used used to fill the bitmap's background. - Returns true on success, false on failure. - - - - Rotates this by the specified angle initializing a new instance. - For 1- and 4-bit images, rotation is limited to angles whose value is an integer - multiple of 90. - - The type of the color to use as background. - The angle of rotation. - The color used used to fill the bitmap's background. - The rotated instance. - - - - Rotates this by the specified angle initializing a new instance. - For 1- and 4-bit images, rotation is limited to angles whose value is an integer - multiple of 90. - - The angle of rotation. - The rotated instance. - - - - This method performs a rotation and / or translation of an 8-bit greyscale, - 24- or 32-bit image, using a 3rd order (cubic) B-Spline. - - The angle of rotation. - Horizontal image translation. - Vertical image translation. - Rotation center x-coordinate. - Rotation center y-coordinate. - When true the irrelevant part of the image is set to a black color, - otherwise, a mirroring technique is used to fill irrelevant pixels. - Returns true on success, false on failure. - - - - This method performs a rotation and / or translation of an 8-bit greyscale, - 24- or 32-bit image, using a 3rd order (cubic) B-Spline initializing a new instance. - - The angle of rotation. - Horizontal image translation. - Vertical image translation. - Rotation center x-coordinate. - Rotation center y-coordinate. - When true the irrelevant part of the image is set to a black color, - otherwise, a mirroring technique is used to fill irrelevant pixels. - The rotated instance. - - - - Perfoms an histogram transformation on a 8-, 24- or 32-bit image. - - The lookup table (LUT). - It's size is assumed to be 256 in length. - The color channel to be transformed. - Returns true on success, false on failure. - - - - Performs gamma correction on a 8-, 24- or 32-bit image. - - The parameter represents the gamma value to use (gamma > 0). - A value of 1.0 leaves the image alone, less than one darkens it, and greater than one lightens it. - Returns true on success, false on failure. - - - - Adjusts the brightness of a 8-, 24- or 32-bit image by a certain amount. - - A value 0 means no change, - less than 0 will make the image darker and greater than 0 will make the image brighter. - Returns true on success, false on failure. - - - - Adjusts the contrast of a 8-, 24- or 32-bit image by a certain amount. - - A value 0 means no change, - less than 0 will decrease the contrast and greater than 0 will increase the contrast of the image. - Returns true on success, false on failure. - - - - Inverts each pixel data. - - Returns true on success, false on failure. - - - - Computes the image histogram. - - Channel to compute from. - Array of integers containing the histogram. - Returns true on success, false on failure. - - - - Retrieves the red, green, blue or alpha channel of a 24- or 32-bit image. - - The color channel to extract. - The color channel in a new instance. - - - - Insert a 8-bit dib into a 24- or 32-bit image. - Both images must have to same width and height. - - The to insert. - The color channel to replace. - Returns true on success, false on failure. - - - - Retrieves the real part, imaginary part, magnitude or phase of a complex image. - - The color channel to extract. - The color channel in a new instance. - - - - Set the real or imaginary part of a complex image. - Both images must have to same width and height. - - The to insert. - The color channel to replace. - Returns true on success, false on failure. - - - - Copy a sub part of this . - - The subpart to copy. - The sub part in a new instance. - - - - Copy a sub part of this . - - Specifies the left position of the cropped rectangle. - Specifies the top position of the cropped rectangle. - Specifies the right position of the cropped rectangle. - Specifies the bottom position of the cropped rectangle. - The sub part in a new instance. - - - - Alpha blend or combine a sub part image with this . - The bit depth of must be greater than or equal to the bit depth this instance. - - The to paste into this instance. - Specifies the left position of the sub image. - Specifies the top position of the sub image. - alpha blend factor. - The source and destination images are alpha blended if alpha=0..255. - If alpha > 255, then the source image is combined to the destination image. - Returns true on success, false on failure. - - - - Alpha blend or combine a sub part image with tthis . - The bit depth of must be greater than or equal to the bit depth this instance. - - The to paste into this instance. - Specifies the position of the sub image. - alpha blend factor. - The source and destination images are alpha blended if alpha=0..255. - If alpha > 255, then the source image is combined to the destination image. - Returns true on success, false on failure. - - - - This method composite a transparent foreground image against a single background color or - against a background image. - In case is false and - and - are null, a checkerboard will be used as background. - - When true the background of this instance is used - if it contains one. - Backgroundcolor used in case is false - and is not null. - Background used in case - is false and is a null reference. - Returns true on success, false on failure. - - - - Applies the alpha value of each pixel to its color components. - The aplha value stays unchanged. - Only works with 32-bits color depth. - - Returns true on success, false on failure. - - - - Solves a Poisson equation, remap result pixels to [0..1] and returns the solution. - - Number of cycles in the multigrid algorithm (usually 2 or 3) - Returns true on success, false on failure. - - - - Adjusts an image's brightness, contrast and gamma as well as it may - optionally invert the image within a single operation. - - Percentage brightness value where -100 <= brightness <= 100. - A value of 0 means no change, less than 0 will make the image darker and greater - than 0 will make the image brighter. - Percentage contrast value where -100 <= contrast <= 100. - A value of 0 means no change, less than 0 will decrease the contrast - and greater than 0 will increase the contrast of the image. - Gamma value to be used for gamma correction. - A value of 1.0 leaves the image alone, less than one darkens it, - and greater than one lightens it. - This parameter must not be zero or smaller than zero. - If so, it will be ignored and no gamma correction will be performed on the image. - If set to true, the image will be inverted. - Returns true on success, false on failure. - - - - Applies color mapping for one or several colors on a 1-, 4- or 8-bit - palletized or a 16-, 24- or 32-bit high color image. - - Array of colors to be used as the mapping source. - Array of colors to be used as the mapping destination. - If true, 32-bit images and colors are treated as 24-bit. - If true, source and destination colors are swapped, that is, - each destination color is also mapped to the corresponding source color. - The total number of pixels changed. - - or is a null reference. - - - has a different length than . - - - - - Swaps two specified colors on a 1-, 4- or 8-bit palletized - or a 16-, 24- or 32-bit high color image. - - One of the two colors to be swapped. - The other of the two colors to be swapped. - If true, 32-bit images and colors are treated as 24-bit. - The total number of pixels changed. - - - - Applies palette index mapping for one or several indices - on a 1-, 4- or 8-bit palletized image. - - Array of palette indices to be used as the mapping source. - Array of palette indices to be used as the mapping destination. - The number of palette indices to be mapped. This is the size of both - srcindices and dstindices - If true, source and destination palette indices are swapped, that is, - each destination index is also mapped to the corresponding source index. - The total number of pixels changed. - - or is a null reference. - - - has a different length than . - - - - - Swaps two specified palette indices on a 1-, 4- or 8-bit palletized image. - - One of the two palette indices to be swapped. - The other of the two palette indices to be swapped. - The total number of pixels changed. - - - - Sets all pixels of this to the specified color. - See for further details. - - The type of the specified color. - The color to fill this with. - true on success, false on failure. - - - - Sets all pixels of this to the specified color. - See for further details. - - The type of the specified color. - The color to fill this with. - Options that affect the color search process for palletized images. - true on success, false on failure. - - - - Creates a new ICC-Profile. - - The data of the new ICC-Profile. - The new ICC-Profile of the bitmap. - is a null reference. - - - - Creates a new ICC-Profile. - - The data of the new ICC-Profile. - The number of bytes of to use. - The new ICC-Profile of the bitmap. - is null. - - - - Determines whether this and the specified instances are the same. - - The object to test. - true if this instance is the same - or if both are null references; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Returns a value that indicates whether the pixel format for this contains alpha information. - - The to test. - true if pixfmt contains alpha information; otherwise, false. - - - - Returns a value that indicates whether the pixel format is 32 bits per pixel. - - The to test. - true if pixfmt is canonical; otherwise, false. - - - - Returns a value that indicates whether the pixel format is 64 bits per pixel. - - The enumeration to test. - true if pixfmt is extended; otherwise, false. - - - - Creates a from a Windows handle to an icon. - - A handle to an icon. - The that this method creates. - - - - Creates a from the specified Windows resource. - - A handle to an instance of the executable - file that contains the resource. - A string containing the name of the resource bitmap. - The that this method creates. - - - - Creates a from the specified file. - - A string that contains the name of the file - from which to create the . - The this method creates. - - - - Creates a from the specified file - using embedded color management information in that file. - - A string that contains the - name of the file from which to create the . - Ignored. - The this method creates. - - - - Creates a from a handle to a GDI bitmap. - - The GDI bitmap handle from which to create the . - The this method creates. - - - - Creates a from a handle to a GDI bitmap and a handle to a GDI palette. - - The GDI bitmap handle from which to create the . - Ignored. - The this method creates. - - - - Frees a bitmap handle. - - Handle to a bitmap. - true on success, false on failure. - - - - Creates a from the specified data stream. - - A that contains the data for this . - The this method creates. - - - - Creates a from the specified data stream. - - A that contains the data for this . - Ignored. - The this method creates. - - - - Creates a from the specified data stream. - - A that contains the data for this . - Ignored. - Ignored. - The this method creates. - - - - Returns the color depth, in number of bits per pixel, - of the specified pixel format. - - The member that specifies - the format for which to find the size. - The color depth of the specified pixel format. - - - - Performs a lossless rotation or flipping on a JPEG file. - - Source file. - Destination file; can be the source file; will be overwritten. - The operation to apply. - To avoid lossy transformation, you can set the perfect parameter to true. - Returns true on success, false on failure. - - - - Performs a lossless crop on a JPEG file. - - Source filename. - Destination filename. - Specifies the cropped rectangle. - Returns true on success, false on failure. - - or is null. - - - does not exist. - - - - - Performs a lossless crop on a JPEG file. - - Source filename. - Destination filename. - Specifies the left position of the cropped rectangle. - Specifies the top position of the cropped rectangle. - Specifies the right position of the cropped rectangle. - Specifies the bottom position of the cropped rectangle. - Returns true on success, false on failure. - - or is null. - - - does not exist. - - - - - Converts a X11 color name into a corresponding RGB value. - - Name of the color to convert. - Red component. - Green component. - Blue component. - Returns true on success, false on failure. - is null. - - - - Converts a SVG color name into a corresponding RGB value. - - Name of the color to convert. - Red component. - Green component. - Blue component. - Returns true on success, false on failure. - is null. - - - - Creates a lookup table to be used with AdjustCurve() which - may adjusts brightness and contrast, correct gamma and invert the image with a - single call to AdjustCurve(). - - Output lookup table to be used with AdjustCurve(). - The size of is assumed to be 256. - Percentage brightness value where -100 <= brightness <= 100. - A value of 0 means no change, less than 0 will make the image darker and greater - than 0 will make the image brighter. - Percentage contrast value where -100 <= contrast <= 100. - A value of 0 means no change, less than 0 will decrease the contrast - and greater than 0 will increase the contrast of the image. - Gamma value to be used for gamma correction. - A value of 1.0 leaves the image alone, less than one darkens it, - and greater than one lightens it. - If set to true, the image will be inverted. - The number of adjustments applied to the resulting lookup table - compared to a blind lookup table. - is null. - is not 256. - - - - Adds a specified frame to the file specified using the specified parameters. - Use this method to save selected frames from an to a multiple-frame image. - - File to add this frame to. - A that contains the frame to add. - Format of the image. - Flags to enable or disable plugin-features. - Flags to enable or disable plugin-features. - - or is null. - - does not exist. - Saving the image failed. - - - - Adds a specified frame to the file specified using the specified parameters. - Use this method to save selected frames from an image to a multiple-frame image. - - File to add this frame to. - A that contains the frame to add. - The position of the inserted frame. - Format of the image. - Flags to enable or disable plugin-features. - Flags to enable or disable plugin-features. - - or is null. - - does not exist. - Saving the image failed. - is out of range. - - - - Returns a new instance of the class which - has no public accessible constructor. - - A new instace of . - - - - Throws an exception in case the instance has already been disposed. - - - - - Tries to replace the wrapped with a new one. - In case the new dib is null or the same as the already - wrapped one, nothing will be changed and the result will - be false. - Otherwise the wrapped will be unloaded and replaced. - - The new dib. - Returns true on success, false on failure. - - - - Unloads currently wrapped or unlocks the locked page - in case it came from a multipaged bitmap. - - - - - Informs the runtime about unmanaged allocoted memory. - - - - - Opens the stream and reads the number of available pages. - Then loads the first page to this instance. - - - - - Helper class to store informations for . - - - - - Creates a deep copy of this . - - A deep copy of this . - - - - Performs application-defined tasks associated with freeing, - releasing, or resetting unmanaged resources. - - - - - Performs application-defined tasks associated with freeing, - releasing, or resetting unmanaged resources. - - If true managed ressources are released. - - - - Retrieves an object that can iterate through the individual scanlines in this . - - An for the . - The bitmaps's type is not supported. - - - - Class handling non-bitmap related functions. - - - - - Internal callback - - - - - Gets a value indicating if the FreeImage DLL is available or not. - - - - - Internal errors in FreeImage generate a logstring that can be - captured by this event. - - - - - Gets a string containing the current version of the library. - - - - - Gets a string containing a standard copyright message. - - - - - Gets whether the platform is using Little Endian. - - - - - Internal class wrapping stream io functions. - - - FreeImage can read files from a disk or a network drive but also allows the user to - implement their own loading or saving functions to load them directly from an ftp or web - server for example. - - In .NET streams are a common way to handle data. The FreeImageStreamIO class handles - the loading and saving from and to streams. It implements the funtions FreeImage needs - to load data from an an arbitrary source. - - The class is for internal use only. - - - - - structure that can be used to read from streams via - . - - - - - Initializes a new instances which can be used to - create a FreeImage compatible structure. - - - - - Reads the requested data from the stream and writes it to the given address. - - - - - Reads the given data and writes it into the stream. - - - - - Moves the streams position. - - - - - Returns the streams current position - - - - - Class wrapping streams, implementing a buffer for read data, - so that seek operations can be made. - - - FreeImage can load bitmaps from arbitrary sources. - .NET works with different streams like File- or NetConnection-strams. - NetConnection streams, which are used to load files from web servers, - for example cannot seek. - But FreeImage frequently uses the seek operation when loading bitmaps. - StreamWrapper wrapps a stream and makes it seekable by caching all read - data into an internal MemoryStream to jump back- and forward. - StreamWapper is for internal use and only for loading from streams. - - - - - The stream to wrap - - - - - The caching stream - - - - - Indicates if the wrapped stream reached its end - - - - - Tells the wrapper to block readings or not - - - - - Indicates if the wrapped stream is disposed or not - - - - - Initializes a new instance based on the specified . - - The stream to wrap. - When true the wrapper always tries to read the requested - amount of data from the wrapped stream. - - - - Releases all resources used by the instance. - - - - - Delegate to the C++ function fread. - - Pointer to read from. - Item size in bytes. - Maximum number of items to be read. - Handle/stream to read from. - Number of full items actually read, - which may be less than count if an error occurs or - if the end of the file is encountered before reaching count. - - - - Delegate to the C++ function fwrite. - - Pointer to data to be written. - Item size in bytes. - Maximum number of items to be written. - Handle/stream to write to. - Number of full items actually written, - which may be less than count if an error occurs. - Also, if an error occurs, the file-position indicator cannot be determined. - - - - Delegate to the C++ function fseek. - - Handle/stream to seek in. - Number of bytes from origin. - Initial position. - If successful 0 is returned; otherwise a nonzero value. - - - - Delegate to the C++ function ftell. - - Handle/stream to retrieve its currents position from. - The current position. - - - - Wrapper for a custom handle. - - - The fi_handle of FreeImage in C++ is a simple pointer, but in .NET - it's not that simple. This wrapper uses fi_handle in two different ways. - - We implement a new plugin and FreeImage gives us a handle (pointer) that - we can simply pass through to the given functions in a 'FreeImageIO' - structure. - But when we want to use LoadFromhandle or SaveToHandle we need - a fi_handle (that we receive again in our own functions). - This handle is for example a stream (see LoadFromStream / SaveToStream) - that we want to work with. To know which stream a read/write is meant for - we could use a hash value that the wrapper itself handles or we can - go the unmanaged way of using a handle. - Therefor we use a to receive a unique pointer that we can - convert back into a .NET object. - When the fi_handle instance is no longer needed the instance must be disposed - by the creater manually! It is recommended to use the using statement to - be sure the instance is always disposed: - - - using (fi_handle handle = new fi_handle(object)) - { - callSomeFunctions(handle); - } - - - What does that mean? - If we get a fi_handle from unmanaged code we get a pointer to unmanaged - memory that we do not have to care about, and just pass ist back to FreeImage. - If we have to create a handle our own we use the standard constructur - that fills the with an pointer that represents the given object. - With calling the is used to retrieve the original - object we passed through the constructor. - - This way we can implement a fi_handle that works with managed an unmanaged - code. - - - - - The handle to wrap. - - - - - Initializes a new instance wrapping a managed object. - - The object to wrap. - - is null. - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Gets whether the pointer is a null pointer. - - - - - Returns the object assigned to the handle in case this instance - was created by managed code. - - assigned to this handle or null on failure. - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Indicates whether the current object is equal to another object of the same type. - - An object to compare with this object. - True if the current object is equal to the other parameter; otherwise, false. - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Releases all resources used by the instance. - - - - - Structure for implementing access to custom handles. - - - - - Delegate to the C++ function fread. - - - - - Delegate to the C++ function fwrite. - - - - - Delegate to the C++ function fseek. - - - - - Delegate to the C++ function ftell. - - - - - Provides additional information specific for GIF files. This class cannot be inherited. - - - - - Initializes a new instance of the class - with the specified . - - A reference to a instance. - - - - Gets or sets a value indicating whether this frame uses the - GIF image's global palette. If set to false, this - frame uses its local palette. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Creates a global palette for the GIF image, intialized with all entries of the - current local palette. - The property will be set to true when - invoking this method. This effectively enables the newly created global palette. - - - The image does not have a palette. - - - - - Creates a global palette for the GIF image with the specified size, intialized - with the first entries of the current local palette. - The property will be set to true when - invoking this method. This effectively enables the newly created global palette. - - The size of the newly created global palette. - - is a null reference. - - - - Creates a global palette for the GIF image, intialized with the entries - of the specified palette. - The property will be set to true when - invoking this method. This effectively enables the newly created global palette. - - The palette that contains the initial values for - the newly created global palette. - - is a null reference. - - - - Creates a global palette for the GIF image with the specified size, intialized - with the first entries of the specified palette. - The property will be set to true when - invoking this method. This effectively enables the newly created global palette. - - The palette that contains the initial values for - the newly created global palette. - The size of the newly created global palette. - - is a null reference. - - - - Class handling metadata of a FreeImage bitmap. - - - - - Initializes a new instance based on the specified , - showing all known models. - - Handle to a FreeImage bitmap. - - - - Initializes a new instance based on the specified , - showing or hiding empry models. - - Handle to a FreeImage bitmap. - When true, empty metadata models - will be hidden until a tag to this model is added. - - - - Gets or sets the of the specified type. - In case the getter returns null the model is not contained - by the list. - null can be used calling the setter to destroy the model. - - Type of the model. - The object of the specified type. - - - - Gets or sets the at the specified index. - In case the getter returns null the model is not contained - by the list. - null can be used calling the setter to destroy the model. - - Index of the within - this instance. - The - object at the specified index. - - - - Returns a list of all visible - MetadataModels. - - - - - Adds new tag to the bitmap or updates its value in case it already exists. - will be used as key. - - The tag to add or update. - Returns true on success, false on failure. - - is null. - - - - Returns the number of visible - MetadataModels. - - - - - Gets or sets whether empty - MetadataModels are hidden. - - - - - Retrieves an object that can iterate through the individual - MetadataModels - in this . - - An for this . - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Base class that represents a collection of all tags contained in a metadata model. - - - The MetedataModel class is an abstract base class, which is inherited by - several derived classes, one for each existing metadata model. - - - - - Handle to the encapsulated FreeImage-bitmap. - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - is null. - - - - Retrieves the datamodel that this instance represents. - - - - - Adds new tag to the bitmap or updates its value in case it already exists. - will be used as key. - - The tag to add or update. - Returns true on success, false on failure. - - is null. - - The tags model differs from this instances model. - - - - Adds a list of tags to the bitmap or updates their values in case they already exist. - will be used as key. - - A list of tags to add or update. - Returns the number of successfully added tags. - - is null. - - - - Removes the specified tag from the bitmap. - - The key of the tag. - Returns true on success, false on failure. - - is null. - - - - Destroys the metadata model - which will remove all tags of this model from the bitmap. - - Returns true on success, false on failure. - - - - Returns the specified metadata tag. - - The key of the tag. - The metadata tag. - - is null. - - - - Returns whether the specified tag exists. - - The key of the tag. - True in case the tag exists, else false. - - is null. - - - - Returns a list of all metadata tags this instance represents. - - - - - Returns the tag at the given index. - - Index of the tag to return. - The tag at the given index. - - - - Returns the metadata tag at the given index. This operation is slow when accessing all tags. - - Index of the tag. - The metadata tag. - - is greater or equal Count - or index is less than zero. - - - - Retrieves an object that can iterate through the individual MetadataTags in this MetadataModel. - - An for the - . - - - - Returns the number of metadata tags this instance represents. - - - - - Returns whether this model exists in the bitmaps metadata structure. - - - - - Searches for a pattern in each metadata tag and returns the result as a list. - - The regular expression to use for the search. - A bitfield that controls which fields should be searched in. - A list containing all found metadata tags. - - is null. - - is empty. - - - - Returns the value of the specified tag. - - Type of the tag's data. - The key of the tag. - The value of the specified tag. - - - - Returns an array containing the data of the specified tag. - - The type of the tag's data. - The key of the tag. - An array containing the data of the specified tag. - - - - Returns the string contained by the specified tag. - - The key of the tag. - The string contained by the specified tag. - - - - Returns an array containg the data of the specified tag - as unsigned 32bit integer. - - The key of the tag. - An array containg the data of the specified tag - as unsigned 32bit integer. - - - - Returns the value of the tag as unsigned 32bit integer. - - The key of the tag. - The value of the tag as unsigned 32bit integer. - - - - Sets the value of the specified tag. - - The type of the tag's data. - The key of the tag. - The new value of the specified tag or null. - - - - Sets the value of the specified tag. - - The key of the tag. - The new value of the specified tag or null. - - - - Sets the value of the specified tag as undefined. - - The key of the tag. - The new value of the specified tag or null. - - - - Returns the equivalent for the - specified . - - The string containing the . - The equivalent for the - specified . - - - - Returns the equivalent for the - specified . - - The to convert. - The equivalent for the - specified . - - - - Returns the equivalent for the - specified . - - The string containing the . - The equivalent for the - specified . - - - - Returns the equivalent for the - specified . - - The to convert. - The equivalent for the - specified . - - - - Returns the equivalent for the - specified . - - The string containing the . - The equivalent for the - specified . - - - - Returns the equivalent for the - specified . - - The to convert. - The equivalent for the - specified . - - - - Returns the equivalent for the - specified . - - The string containing the . - The equivalent for the - specified . - - - - Returns the equivalent for the - specified . - - The to convert. - The equivalent for the - specified . - - - - Returns the equivalent for the - specified . - - The string containing the . - The equivalent for the - specified . - - - - Returns the equivalent for the - specified . - - The to convert. - The equivalent for the - specified . - - - - Specified different unit types. - - - - - No or unknown type. - - - - - Kilometers per hour. - - - - - Miles per hour. - - - - - Knots. - - - - - Specifies different direction types. - - - - - No or unknown direction type. - - - - - True direction. - - - - - Magnatic direction. - - - - - Specifies the type of a latitude value. - - - - - No or unknown type. - - - - - North. - - - - - South. - - - - - Specifies the type of a longitude value. - - - - - No or unknown type. - - - - - East. - - - - - West. - - - - - Specifies different altitude types. - - - - - No or unknown type. - - - - - East. - - - - - West. - - - - - Specifies interoperability types. - - - - - No or unknown type. - - - - - Indicates a file conforming to R98 file specification of Recommended - Exif Interoperability Rules (ExifR98) or to DCF basic file stipulated - by Design Rule for Camera File System. - - - - - Indicates a file conforming to DCF thumbnail file stipulated by Design - rule for Camera File System. - - - - - Specifies orientation of images. - - - - - Undefinied orientation. - - - - - TopLeft. - - - - - TopRight. - - - - - BottomRight. - - - - - BottomLeft. - - - - - LeftTop. - - - - - RightTop. - - - - - RightBottom. - - - - - LeftBottom. - - - - - Converts the model of the MetadataModel object to its equivalent string representation. - - The string representation of the value of this instance. - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Gets or sets the width of the entire canvas area, that each page is displayed in. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the height of the entire canvas area, that each page is displayed in. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the global palette of the GIF image. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the number of replays for the animation. - Use 0 (zero) to specify an infinte number of replays. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the horizontal offset within the logical canvas area, this frame is to be displayed at. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the vertical offset within the logical canvas area, this frame is to be displayed at. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a flag to supress saving the dib's attached palette - (making it use the global palette). The local palette is the palette used by a page. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a value indicating whether the image is interlaced. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the amout of time in milliseconds this frame is to be displayed. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets this frame's disposal method. Generally, this method defines, how to - remove or replace a frame when the next frame has to be drawn. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Gets or sets the comment of the image. - Supported formats are JPEG, PNG and GIF. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Gets or sets the version of this standard supported. - Constant length or 4. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the Flashpix format version supported by a FPXR file. - Constant length or 4. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the color space information tag. - See remarks for further information. - - - The following values are defined: - - - ID - Description - - - 1 - sRGB (default) - - - 0xFFFF - uncalibrated - - - other - reserved - - - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the valid width of a compressed image. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the valid height of a compressed image. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets components configuration. See remarks for further information. - Constant length of 4. - - - The channels of each component are arranged in order from the 1st component to the 4th. - For uncompressed data the data arrangement is given in the PhotometricInterpretation tag. - However, since PhotometricInterpretation can only express the order of Y,Cb and Cr, - this tag is provided for cases when compressed data uses components other than Y, Cb, - and Cr and to enable support of other sequences. - Default = 4 5 6 0 (if RGB uncompressed) - The following values are defined: - - - ID - Description - - - 0 - does not exist - - - 1 - Y - - - 2 - Cb - - - 3 - Cr - - - 4 - R - - - 5 - R - - - 6 - R - - - other - reserved - - - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets compression mode used for a compressed image is indicated - in unit bits per pixel. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a tag for manufacturers of Exif writers to record any desired information. - The contents are up to the manufacturer, but this tag should not be used for any other - than its intended purpose. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a tag for Exif users to write keywords or comments on the image besides - those in ImageDescription, and without the character code limitations of the ImageDescription tag. - Minimum length of 8. See remarks for further information. - - - The character code used in the UserComment tag is identified based on an ID code in a fixed 8-byte - area at the start of the tag data area. The unused portion of the area is padded with NULL. - The ID code for the UserComment area may be a Defined code such as JIS or ASCII, or may be Undefined. - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the name of an audio file related to the image data. - The format is 8.3. - Constant length of 12 - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the date and time when the original image data was generated. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the date and time when the image was stored as digital data. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a tag used to record fractions of seconds for the DateTime tag. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a tag used to record fractions of seconds for the DateTimeOriginal tag. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a tag used to record fractions of seconds for the DateTimeDigitized tag. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or the exposure time, given in seconds (sec). - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or the F number. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the class of the program used by the camera to set exposure when the - picture is taken. - See remarks for further information. - - - The following values are defined: - - - ID - Description - - - 0 - not defined - - - 1 - manual - - - 2 - normal program - - - 3 - aperture priority - - - 4 - shutter priority - - - 5 - create program - - - 6 - action program - - - 7 - portrait mode - - - 8 - landscape mode - - - others - reserved - - - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the spectral sensitivity of each channel of the camera used. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the the ISO Speed and ISO Latitude of the camera or input device as - specified in ISO 12232. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the Opto-Electric Conversion Function (OECF) specified in ISO 14524. - OECF is the relationship between the camera optical input and the image values. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the shutter speed. The unit is the APEX (Additive System of Photographic Exposure). - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the lens aperture. The unit is the APEX value. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of brightness. The unit is the APEX value. - Ordinarily it is given in the range of -99.99 to 99.99. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the exposure bias. The unit is the APEX value. - Ordinarily it is given in the range of ?9.99 to 99.99. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the smallest F number of the lens. The unit is the APEX value. - Ordinarily it is given in the range of 00.00 to 99.99, - but it is not limited to this range. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets distance to the subject, given in meters. - Note that if the numerator of the recorded value is FFFFFFFF, infinity shall be indicated; - and if the numerator is 0, distance unknown shall be indicated. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the metering mode. See remarks for further information. - - - The following values are defined: - - - ID - Description - - - 0 - unknown - - - 1 - average - - - 2 - center-weighted-average - - - 3 - spot - - - 4 - multi-spot - - - 5 - pattern - - - 6 - partial - - - other - reserved - - - 255 - other - - - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the kind of light source. - See remarks for further information. - - - The following values are defined: - - - ID - Description - - - 0 - unknown - - - 1 - daylight - - - 2 - fluorescent - - - 3 - tungsten - - - 4 - flash - - - 9 - fine weather - - - 10 - cloudy weather - - - 11 - shade - - - 12 - daylight fluorecent (D 5700 - 7100K) - - - 13 - day white fluorescent (N 4600 - 5400K) - - - 14 - cool white fluorescent (W 3900 - 4500K) - - - 15 - white fluorescent (WW 3200 - 3700K) - - - 17 - standard light A - - - 18 - standard light B - - - 19 - standard light C - - - 20 - D55 - - - 21 - D65 - - - 22 - D75 - - - 23 - D50 - - - 24 - ISO studio tungsten - - - 255 - other light source - - - other - reserved - - - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets a value indicating the status of flash when the image was shot. - Bit 0 indicates the flash firing status, bits 1 and 2 indicate the flash return - status, bits 3 and 4 indicate the flash mode, bit 5 indicates whether the flash - function is present, and bit 6 indicates "red eye" mode. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a value indicating the location and area of the main subject in - the overall scene. Variable length between 2 and 4. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the actual focal length of the lens, in mm. - Conversion is not made to the focal length of a 35 mm film camera. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the strobe energy at the time the image is captured, - as measured in Beam Candle Power Seconds (BCPS). - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the camera or input device spatial frequency table and SFR values - in the direction of image width, image height, and diagonal direction, - as specified in ISO 12233. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the number of pixels in the image width (X) direction per - FocalPlaneResolutionUnit on the camera focal plane. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the number of pixels in the image height (Y) direction per - FocalPlaneResolutionUnit on the camera focal plane. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the unit for measuring FocalPlaneXResolution and FocalPlaneYResolution. - This value is the same as the ResolutionUnit. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the location of the main subject in the scene. - The value of this tag represents the pixel at the center of the main subject - relative to the left edge, prior to rotation processing as per the Rotation tag. - The first value indicates the X column number and second indicates the Y row number. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the exposure index selected on the camera or input device at the - time the image was captured. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the image sensor type on the camera or input device. - See remarks for further information. - - - The following values are defined: - - - ID - Description - - - 1 - not defined - - - 2 - one-chip color area sensor - - - 3 - two-chip color area sensor - - - 4 - three-chip color area sensor - - - 5 - color sequential area sensor - - - 7 - trilinear sensor - - - 8 - color sequential linear sensor - - - other - reserved - - - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the image source. If a DSC recorded the image, this tag value of this - tag always be set to 3, indicating that the image was recorded on a DSC. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the type of scene. If a DSC recorded the image, this tag value shall - always be set to 1, indicating that the image was directly photographed. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the color filter array (CFA) geometric pattern of the image sensor - when a one-chip color area sensor is used. It does not apply to all sensing methods. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the use of special processing on image data, such as rendering geared to output. - When special processing is performed, the reader is expected to disable or minimize any - further processing. See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 0 - normal process - - - 1 - custom process - - - other - reserved - - - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the exposure mode set when the image was shot. - In auto-bracketing mode, the camera shoots a series of frames of the same scene - at different exposure settings. See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 0 - auto exposure - - - 1 - manual exposure - - - 2 - auto bracket - - - other - reserved - - - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the white balance mode set when the image was shot. - See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 0 - auto white balance - - - 1 - manual white balance - - - other - reserved - - - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the digital zoom ratio when the image was shot. - If the numerator of the recorded value is 0, this indicates that digital zoom was not used. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the equivalent focal length assuming a 35mm film camera, in mm. - A value of 0 means the focal length is unknown. Note that this tag differs - from the FocalLength tag. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the type of scene that was shot. - It can also be used to record the mode in which the image was shot. - See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 0 - standard - - - 1 - landscape - - - 2 - portrait - - - 3 - night scene - - - other - reserved - - - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the degree of overall image gain adjustment. - See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 0 - none - - - 1 - low gain up - - - 2 - high gain up - - - 3 - low gain down - - - 4 - high gain down - - - other - reserved - - - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the direction of contrast processing applied by the camera - when the image was shot. - See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 0 - normal - - - 1 - soft - - - 2 - hard - - - other - reserved - - - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the direction of saturation processing applied by the camera - when the image was shot. - See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 0 - normal - - - 1 - low saturation - - - 2 - high saturation - - - other - reserved - - - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the direction of sharpness processing applied by the camera - when the image was shot. - See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 0 - normal - - - 1 - soft - - - 2 - hard - - - other - reserved - - - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets information on the picture-taking conditions of a particular camera model. - The tag is used only to indicate the picture-taking conditions in the reader. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the distance to the subject. - See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 0 - unknown - - - 1 - macro - - - 2 - close view - - - 3 - distant view - - - other - reserved - - - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets an identifier assigned uniquely to each image. - It is recorded as an ASCII string equivalent to hexadecimal notation and 128-bit fixed length. - Constant length of 32. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Gets or sets the GPS version ID. Constant length of 4. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a value indicating whether the - is north or south latitude. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the latitude of the image. The latitude is expressed as three rational - values giving the degrees, minutes, and seconds, respectively. Constant length of 3. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets a value indicating whether - is east or west longitude. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the longitude of the image. The longitude is expressed as three rational - values giving the degrees, minutes, and seconds, respectively. Constant length of 3. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets a value indicating whether is sea level and the altitude - is above sea level. If the altitude is below sea level is - indicated as an absolute value. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the altitude based on the reference in . - Altitude is expressed as one rational value. The reference unit is meters. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the sign of the . - - - This is a derived property. There is no metadata tag directly associated - with this property value. - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the signed altitude. - Altitude is expressed as one rational value. The reference unit is meters. - - - Altitude is too large to fit into a FIRational. - - - This is a derived property. There is no metadata tag directly associated - with this property value. - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the time as UTC (Coordinated Universal Time). Constant length of 3. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the GPS satellites used for measurements. This tag can be used to describe - the number of satellites, their ID number, angle of elevation, azimuth, SNR and other - information in ASCII notation. The format is not specified. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a value indicating the status of the GPS receiver when the image was recorded. - true indicates measurement was in progress; - false indicates measurement was Interoperability. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a value indicating the GPS measurement mode. - true indicates three-dimensional measurement; - false indicated two-dimensional measurement was in progress. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the GPS DOP (data degree of precision). An HDOP value is written during - two-dimensional measurement, and PDOP during three-dimensional measurement. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the unit used to express the GPS receiver of movement. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the speed of GPS receiver movement. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the reference for giving the direction of GPS receiver movement. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the direction of GPS receiver movement. - The range of values is from 0.00 to 359.99. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the reference for giving the direction of GPS receiver movement. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the direction of the image when it was captured. - The range of values is from 0.00 to 359.99. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the geodetic survey data used by the GPS receiver. If the survey data - is restricted to Japan, the value of this tag is 'TOKYO' or 'WGS-84'. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a value indicating whether the destination point - is north or south latitude. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the latitude of the destination point. The latitude is expressed as three rational - values giving the degrees, minutes, and seconds, respectively. Constant length of 3. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets a value indicating whether the destination point - is east or west longitude. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the longitude of the destination point. The longitude is expressed as three rational - values giving the degrees, minutes, and seconds, respectively. Constant length of 3. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the reference used for giving the bearing to the destination point. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the bearing to the destination point. - The range of values is from 0.00 to 359.99. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the unit used to express the distance to the destination point. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets a character string recording the name of the method used - for location finding. The first byte indicates the character code used, - and this is followed by the name of the method. Since the Type is not ASCII, - NULL termination is not necessary. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a character string recording the name of the GPS area. - The first byte indicates the character code used, and this is followed by - the name of the GPS area. Since the Type is not ASCII, NULL termination is - not necessary. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets date and time information relative to UTC (Coordinated Universal Time). - - - This is a derived property. There is no metadata tag directly associated - with this property value. - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets date information relative to UTC (Coordinated Universal Time). - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a value indicating whether differential correction was applied to - the GPS receiver. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Gets or sets the identification of the Interoperability rule. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Represents a collection of all tags contained in the metadata model - . - - This class is obsolete. Use class instead. - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Gets or sets the number of columns of image data, equal to the number - of pixels per row. In JPEG compressed data a JPEG marker is used - instead of this tag. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets number of rows of image data. In JPEG compressed data a JPEG marker - is used instead of this tag. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets number of bits per image component. In this standard - each component of the image is 8 bits, so the value for this tag is 8. - Constant length of 3. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets compression scheme used for the image data. When a primary image - is JPEG compressed, this designation is not necessary and is omitted. - When thumbnails use JPEG compression, this tag value is set to 6. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets pixel composition. In JPEG compressed data a JPEG marker is - used instead of this tag. See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 2 - RGB - - - 6 - YCbCr - - - other - reserved - - - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the image orientation viewed in terms of rows and columns. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the number of components per pixel. Since this standard applies - to RGB and YCbCr images, the value set for this tag is 3. In JPEG compressed - data a JPEG marker is used instead of this tag. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a value that indicates whether pixel components are recorded in - chunky or planar format. In JPEG compressed files a JPEG marker is used instead - of this tag. If this field does not exist, the TIFF default of 1 (chunky) is assumed. - See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 1 - chunky format - - - 2 - planar format - - - other - reserved - - - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the sampling ratio of chrominance components in relation to - the luminance component. In JPEG compressed dat a JPEG marker is used - instead of this tag. - See remarks for further information. - - - The following values are definied: - - - ID - Description - - - [2,1] - YCbCr4:2:2 - - - [2,2] - YCbCr4:2:0 - - - other - reserved - - - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets position of chrominance components in relation to the luminance component. - See remarks for further information. - - - This field is designated only for JPEG compressed data or uncompressed YCbCr data. - The TIFF default is 1 (centered); but when Y:Cb:Cr = 4:2:2 it is recommended in - this standard that 2 (co-sited) be used to record data, in order to improve the - image quality when viewed on TV systems. - - When this field does not exist, the reader shall assume the TIFF default. - In the case of Y:Cb:Cr = 4:2:0, the TIFF default (centered) is recommended. - If the reader does not have the capability of supporting both kinds of YCbCrPositioning, - it shall follow the TIFF default regardless of the value in this field. - It is preferable that readers be able to support both centered and co-sited positioning. - - The following values are definied: - - - ID - Description - - - 1 - centered - - - 2 - co-sited - - - other - reserved - - - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the number of pixels per - in the direction. When the image resolution is unknown, - 72 [dpi] is designated. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the number of pixels per - in the direction. When the image resolution is unknown, - 72 [dpi] is designated. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the unit for measuring and . - The same unit is used for both and . - If the image resolution in unknown, 2 (inches) is designated. - See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 2 - inches - - - 3 - YCbCr4:2:0 - - - other - centimeters - - - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the byte offset of that strip. - It is recommended that this be selected so the number of strip bytes - does not exceed 64 Kbytes. - With JPEG compressed data this designation is not needed and is omitted. - Constant length of * StripsPerImage. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - - Gets or sets number of rows per strip. This is the number of rows in the image of - one strip when an image is divided into strips. With JPEG compressed data this - designation is not needed and is omitted. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the total number of bytes in each strip. - With JPEG compressed data this designation is not needed and is omitted. - Constant length of * StripsPerImage. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the offset to the start byte (SOI) of JPEG compressed thumbnail data. - This is not used for primary image JPEG data. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the number of bytes of JPEG compressed thumbnail data. - - - This is not used for primary image JPEG data. - JPEG thumbnails are not divided but are recorded as a continuous - JPEG bitstream from SOI to EOI. APPn and COM markers should not be recorded. - Compressed thumbnails shall be recorded in no more than 64 Kbytes, - including all other data to be recorded in APP1. - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets a transfer function for the image, described in tabular style. - Constant length of 3 * 256. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the chromaticity of the white point of the image. - Constant length of 2. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the chromaticity of the three primary colors of the image. - Constant length of 6. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the matrix coefficients for transformation from RGB to YCbCr image data. - Constant length of 3. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the reference black point value and reference white point value. - Constant length of 6. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the date and time of image creation. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a string giving the title of the image. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the manufacturer of the recording equipment. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the model name or model number of the equipment. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the name and version of the software or firmware of the camera - or image input device used to generate the image. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the name of the camera owner, photographer or image creator. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the photographer and editor copyrights. - Constant length of 1-2. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Gets or sets the value of the GeoTIFF GeoASCIIParamsTag. - - - The GeoASCIIParamsTag is used to store all of the valued - GeoKeys, referenced by the property. Since keys - defined in the GeoKeyDirectoryTag use offsets into this tag, any special - comments may be placed at the beginning of this tag. - For the most part, the only keys that are valued are - Citation keys, giving documentation and references for obscure - projections, datums, etc. - - Special handling is required for -valued keys. While it - is true that TIFF 6.0 permits multiple NULL-delimited strings within a single - ASCII tag, the secondary strings might not appear in the output of naive - tiffdump programs. For this reason, the NULL delimiter of each ASCII key - value shall be converted to a "|" (pipe) character before being installed - back into the holding tag, so that a dump of the tag - will look like this. - - AsciiTag="first_value|second_value|etc...last_value|" - - A baseline GeoTIFF-reader must check for and convert the final "|" pipe - character of a key back into a NULL before returning it to the client - software. - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the value of the GeoTIFF GeoDoubleParamsTag. - - - The GeoDoubleParamsTag is used to store all of the valued - GeoKeys, referenced by the property. The meaning of - any value of this double array is determined from the GeoKeyDirectoryTag reference - pointing to it. values should first be converted to - and stored here. - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the value of the GeoTIFF GeoKeyDirectoryTag. - - - The GeoKeyDirectoryTag may be used to store the GeoKey Directory, which defines and - references the GeoKeys. - - The tag is an array of unsigned values, which are primarily - grouped into blocks of 4. The first 4 values are special, and contain GeoKey directory - header information. The header values consist of the following information, in order: - - Header={KeyDirectoryVersion, KeyRevision, MinorRevision, NumberOfKeys} - - where - - KeyDirectoryVersion indicates the current version of Key implementation, and will - only change if this Tag's Key structure is changed. (Similar to the TIFFVersion (42)). - The current DirectoryVersion number is 1. This value will most likely never change, - and may be used to ensure that this is a valid Key-implementation. - - KeyRevision indicates what revision of Key-Sets are used. - - MinorRevision indicates what set of Key-Codes are used. The complete revision number - is denoted <KeyRevision>.<MinorRevision>. - - NumberOfKeys indicates how many Keys are defined by the rest of this Tag. - - This header is immediately followed by a collection of <NumberOfKeys> KeyEntry - sets, each of which is also 4- long. Each KeyEntry is modeled on the - TIFFEntry format of the TIFF directory header, and is of the form: - - KeyEntry = { KeyID, TIFFTagLocation, Count, Value_Offset } - - where - - KeyID gives the Key-ID value of the Key (identical in function to TIFF tag ID, - but completely independent of TIFF tag-space), - - TIFFTagLocation indicates which TIFF tag contains the value(s) of the Key: if - TIFFTagLocation is 0, then the value is , and is contained in the - Value_Offset entry. Otherwise, the type (format) of the value is implied by the - TIFF-Type of the tag containing the value. - - Count indicates the number of values in this key. - - Value_Offset Value_Offset indicates the index-offset into the TagArray indicated - by TIFFTagLocation, if it is nonzero. If TIFFTagLocation is 0 (zero) , then Value_Offset - contains the actual () value of the Key, and Count=1 is implied. - Note that the offset is not a byte-offset, but rather an index based on the natural data - type of the specified tag array. - - Following the KeyEntry definitions, the KeyDirectory tag may also contain additional - values. For example, if a key requires multiple values, they shall - be placed at the end of this tag, and the KeyEntry will set - TIFFTagLocation=GeoKeyDirectoryTag, with the Value_Offset pointing to the location of the - value(s). - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the value of the GeoTIFF ModelPixelScaleTag. - - - The ModelPixelScaleTag tag may be used to specify the size of raster pixel spacing - in the model space units, when the raster space can be embedded in the model space - coordinate system without rotation, and consists of the following 3 values: - - ModelPixelScaleTag = (ScaleX, ScaleY, ScaleZ) - - where ScaleX and ScaleY give the horizontal and vertical spacing of - raster pixels. The ScaleZ is primarily used to map the pixel value of a - digital elevation model into the correct Z-scale, and so for most other purposes - this value should be zero (since most model spaces are 2-D, with Z=0). - - A single tiepoint in the tag, together with this tag, - completely determine the relationship between raster and model space; thus they - comprise the two tags which Baseline GeoTIFF files most often will use to place a - raster image into a "standard position" in model space. - - Like the tag, this tag information is independent of the - XPosition, YPosition, Resolution and Orientation tags of the standard TIFF 6.0 spec. - However, simple reversals of orientation between raster and model space - (e.g. horizontal or vertical flips) may be indicated by reversal of sign in the - corresponding component of the ModelPixelScaleTag. GeoTIFF compliant readers must - honor this signreversal convention. - - This tag must not be used if the raster image requires rotation or shearing to place - it into the standard model space. In such cases the transformation shall be defined - with the more general . - -
    Naming differences - In the native FreeImage library and thus, in the FreeImage API documentation, this - property's key is named GeoPixelScale. Since the GeoTIFF specification - as well as Java's EXIFTIFFTagSet class call this tag - , this property was renamed accordingly. - However, when accessing this property's tag by its object, - the native FreeImage tag key GeoPixelScale must be used. - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the value of the GeoTIFF GeoTiePointsTag. - - - The GeoTiePointsTag stores raster -> model tiepoint pairs in the order - - ModelTiePoints = (...,I,J,K, X,Y,Z...), - - where (I,J,K) is the point at location (I,J) in raster space with - pixel-value K, and (X,Y,Z) is a vector in model space. In most cases - the model space is only two-dimensional, in which case both K and Z should be set - to zero; this third dimension is provided in anticipation of future support for 3D - digital elevation models and vertical coordinate systems. - - A raster image may be georeferenced simply by specifying its location, size and - orientation in the model coordinate space M. This may be done by specifying the - location of three of the four bounding corner points. However, tiepoints are only - to be considered exact at the points specified; thus defining such a set of - bounding tiepoints does not imply that the model space locations of the interior - of the image may be exactly computed by a linear interpolation of these tiepoints. - - However, since the relationship between the Raster space and the model space will - often be an exact, affine transformation, this relationship can be defined using - one set of tiepoints and the , described below, which - gives the vertical and horizontal raster grid cell size, specified in model units. - - If possible, the first tiepoint placed in this tag shall be the one establishing - the location of the point (0,0) in raster space. However, if this is not possible - (for example, if (0,0) is goes to a part of model space in which the projection is - ill-defined), then there is no particular order in which the tiepoints need be - listed. - - For orthorectification or mosaicking applications a large number of tiepoints may - be specified on a mesh over the raster image. However, the definition of associated - grid interpolation methods is not in the scope of the current GeoTIFF spec. - -
    Naming differences - In the native FreeImage library and thus, in the FreeImage API documentation, this - property's key is named GeoTiePoints. Since the GeoTIFF specification - as well as Java's EXIFTIFFTagSet class call this tag - , this property was renamed accordingly. - However, when accessing this property's tag by its object, - the native FreeImage tag key GeoTiePoints must be used. - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the value of the GeoTIFF ModelTransformationMatrixTag. - - - This tag may be used to specify the transformation matrix between the raster space - (and its dependent pixel-value space) and the (possibly 3D) model space. - -
    Naming differences - In the native FreeImage library and thus, in the FreeImage API documentation, this - property's key is named GeoTransformationMatrix. Since the GeoTIFF specification - as well as Java's EXIFTIFFTagSet class call this tag - , this property was renamed accordingly. - However, when accessing this property's tag by its object, - the native FreeImage tag key GeoTransformationMatrix must be used. - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the value of the GeoTIFF IntergraphTransformationMatrixTag. - - - The IntergraphTransformationMatrixTag conflicts with an internal software implementation - at Intergraph, and so its use is no longer encouraged. A GeoTIFF reader should look first - for the new tag, and only if it is not found should it check for this older tag. If found, - it should only consider it to be contain valid GeoTIFF matrix information if the tag-count - is 16; the Intergraph version uses 17 values. - -
    Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
    -
    - - - Gets or sets the value of the GeoTIFF JPLCartoIFDOffsetTag. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets the Application Record Version. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Object Type Reference. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Object Attribute Reference. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Object Name. - This is also referred to as Title. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Edit Status. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Editorial Update. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Urgency. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Subject Reference. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Category. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Supplemental Categories. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Fixture Identifier. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Keywords. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Content Location Code. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Content Location Name. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Release Date. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Release Time. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Expiration Date. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Expiration Time. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Special Instructions. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Action Advised. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Reference Service. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Reference Date. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Reference Number. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Date Created. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Time Created. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Digital Creation Date. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Digital Creation Time. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Originating Program. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Program Version. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Object Cycle. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag By Line. - This is the author's name. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag By Line Title. - This is the author's position. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag City. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Sub Location. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Province State. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Country Primary Location Code. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Country Primary Location Name. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Original Transmission Reference. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Headline. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Credit. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Source. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Copyright Notice. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Contact. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Caption Abstract. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Writer Editor. - This is also referred to as Caption Writer. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Rasterized Caption. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Image Type. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Image Orientation. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Language Identifier. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Audio Type. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Audio Sampling Rate. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Audio Sampling Resolution. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Audio Duration. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Audio Outcue. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Job I D. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Master Document I D. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Short Document I D. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Unique Document I D. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Owner I D. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Object Preview File Format. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Object Preview File Version. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Object Preview Data. - This is also referred to as Audio Outcue. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Prefs. - This is also referred to as photo-mechanic preferences. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Classify State. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Similarity Index. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Document Notes. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Document History. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Exif Camera Info. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Gets or sets the XMP XML content. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets an initialized to read the XMP XML content. - Returns null, if the metadata tag XMLPacket is not present in - this model. - - - - - Manages metadata objects and operations. - - - - - The encapsulated FreeImage-tag. - - - - - The metadata model of . - - - - - Indicates whether this instance has already been disposed. - - - - - Indicates whether this instance was created by FreeImage or - by the user. - - - - - List linking metadata-model and Type. - - - - - List linking Type and metadata-model. - - - - - Initializes a new instance of this class. - - - - - Initializes a new instance of this class. - - The new model the tag should be of. - - - - Initializes a new instance of this class. - - The to represent. - The bitmap was extracted from. - - - - Initializes a new instance of this class. - - The to represent. - The model of . - - - - Releases all resources used by the instance. - - - - - Determines whether two specified objects have the same value. - - A or a null reference (Nothing in Visual Basic). - A or a null reference (Nothing in Visual Basic). - - true if the value of left is the same as the value of right; otherwise, false. - - - - - Determines whether two specified objects have different values. - - A or a null reference (Nothing in Visual Basic). - A or a null reference (Nothing in Visual Basic). - - true if the value of left is different from the value of right; otherwise, false. - - - - - Extracts the value of a instance to a handle. - - A instance. - A new instance of initialized to . - - - - Gets the model of the metadata. - - - - - Gets or sets the key of the metadata. - - - - - Gets or sets the description of the metadata. - - - - - Gets or sets the ID of the metadata. - - - - - Gets the type of the metadata. - - - - - Gets the number of elements the metadata object contains. - - - - - Gets the length of the value in bytes. - - - - - Gets or sets the value of the metadata. - - - - - Sets the value of the metadata. - In case value is of byte or byte[] is assumed. - In case value is of uint or uint[] is assumed. - - New data of the metadata. - True on success, false on failure. - - The data format is not supported. - - is null. - - - - Sets the value of the metadata. - - New data of the metadata. - Type of the data. - True on success, false on failure. - - The data type is not supported. - - is null. - - and to not fit. - - - - Sets the value of this tag to the value of - using the given type. - - New value of the tag. - Data-type of the tag. - - - is a null reference. - - - is FIDT_ASCII and - is not String. - is not FIDT_ASCII and - is not Array. - - is FIDT_NOTYPE. - - - - Add this metadata to an image. - - Handle to a FreeImage bitmap. - True on success, false on failure. - - - - Gets a .NET PropertyItem for this metadata tag. - - The .NET PropertyItem. - - - - Converts the value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Creates a deep copy of this . - - A deep copy of this . - - - - Tests whether the specified object is a instance - and is equivalent to this instance. - - The object to test. - true if is a instance - equivalent to this instance; otherwise, false. - - - - Tests whether the specified instance is equivalent to this instance. - - A instance to compare to this instance. - true if equivalent to this instance; - otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares the current instance with another object of the same type. - - An object to compare with this instance. - A 32-bit signed integer that indicates the relative order of the objects being compared. - - - - Releases all resources used by the instance. - - - - - Gets whether this instance has already been disposed. - - - - - Throwns an in case - this instance has already been disposed. - - - - - Specifies how a single frame will be handled after being displayed. - - - - - Same behavior as but should not be used. - - - - - The image is left in place and will be overdrawn by the next image. - - - - - The area of the image will be blanked out by its background. - - - - - Restores the the area of the image to the state it was before it - has been dawn. - - - - - Represents unmanaged memory, containing an array of a given structure. - - Structuretype represented by the instance. - - and can not be marshalled. - - Use instead of and - instead of . - - - - - Baseaddress of the wrapped memory. - - - - - Number of elements being wrapped. - - - - - Size, in bytes, of each element. - - - - - Array of T containing a single element. - The array is used as a workaround, because there are no pointer for generic types. - - - - - Pointer to the element of buffer. - - - - - Handle for pinning buffer. - - - - - Indicates whether the wrapped memory is handled like a bitfield. - - - - - Indicates whther the wrapped memory is handles like 4-bit blocks. - - - - - An object that can be used to synchronize access to the . - - - - - Initializes a new instance. - - - - - Initializes a new instance of the class. - - Address of the memory block. - Length of the array. - - is null. - - is less or equal zero. - - The type is not supported. - - - - Initializes a new instance of the class. - - Address of the memory block. - Length of the array. - - is null. - - is less or equal zero. - - The type is not supported. - - - - Frees the allocated . - - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Gets the value at the specified position. - - A 32-bit integer that represents the position - of the array element to get. - The value at the specified position. - - is outside the range of valid indexes - for the unmanaged array. - - - - Sets a value to the element at the specified position. - - The new value for the specified element. - A 32-bit integer that represents the - position of the array element to set. - - is outside the range of valid indexes - for the unmanaged array. - - - - Gets the values at the specified position and length. - - A 32-bit integer that represents the position - of the array elements to get. - A 32-bit integer that represents the length - of the array elements to get. - The values at the specified position and length. - - is outside the range of valid indexes - for the unmanaged array or is greater than the number of elements - from to the end of the unmanaged array. - - - - Sets the values at the specified position. - - An array containing the new values for the specified elements. - A 32-bit integer that represents the position - of the array elements to set. - - is a null reference (Nothing in Visual Basic). - - is outside the range of valid indexes - for the unmanaged array or is greater than the number of elements - from to the end of the array. - - - - Copies the entire array to a compatible one-dimensional , - starting at the specified index of the target array. - - The one-dimensional that is the destination - of the elements copied from . - The must have zero-based indexing. - The zero-based index in - at which copying begins. - - - - Copies a range of elements from the unmanaged array starting at the specified - and pastes them to - starting at the specified . - The length and the indexes are specified as 32-bit integers. - - The array that receives the data. - A 32-bit integer that represents the index - in the unmanaged array at which copying begins. - A 32-bit integer that represents the index in - the destination array at which storing begins. - A 32-bit integer that represents the number of elements to copy. - - is a null reference (Nothing in Visual Basic). - - is outside the range of valid indexes - for the unmanaged array or is greater than the number of elements - from to the end of the unmanaged array - -or- - is outside the range of valid indexes - for the array or is greater than the number of elements - from to the end of the array. - - - - - Copies a range of elements from the array starting at the specified - and pastes them to the unmanaged array - starting at the specified . - The length and the indexes are specified as 32-bit integers. - - The array that holds the data. - A 32-bit integer that represents the index - in the array at which copying begins. - A 32-bit integer that represents the index in - the unmanaged array at which storing begins. - A 32-bit integer that represents the number of elements to copy. - - is a null reference (Nothing in Visual Basic). - - is outside the range of valid indexes - for the array or is greater than the number of elements - from to the end of the array - -or- - is outside the range of valid indexes - for the unmanaged array or is greater than the number of elements - from to the end of the unmanaged array. - - - - - Returns the represented block of memory as an array of . - - The represented block of memory. - - - - Gets or sets the value at the specified position in the array. - - A 32-bit integer that represents the position - of the array element to get. - The value at the specified position in the array. - - is outside the range of valid indexes - for the unmanaged array. - - - - Gets or sets the values of the unmanaged array. - - - - - Gets the length of the unmanaged array. - - - - - Gets the base address of the represented memory block. - - - - - Creates a shallow copy of the . - - A shallow copy of the . - - - - Gets a 32-bit integer that represents the total number of elements - in the . - - - - - Gets a value indicating whether access to the - is synchronized (thread safe). - - - - - Gets an object that can be used to synchronize access to the . - - - - - Retrieves an object that can iterate through the individual - elements in this . - - An for the . - - - - Retrieves an object that can iterate through the individual - elements in this . - - An for the . - - - - Releases all ressources. - - - - - Releases allocated handles associated with this instance. - - true to release managed resources. - - - - Throws an if - this instance is disposed. - - - - - Tests whether the specified structure is equivalent to this - structure. - - The structure to test. - true if is a - instance equivalent to this structure; otherwise, - false. - - - - Tests whether the specified structure is equivalent to this - structure. - - The structure to test. - true if is equivalent to this - structure; otherwise, - false. - - - - Serves as a hash function for a particular type. - - A hash code for the current . - - - - Copies a block of memory from one location to another. - - Pointer to the starting address of the copy destination. - Pointer to the starting address of the block of memory to be copied. - Size of the block of memory to copy, in bytes. - - - - Provides methods for working with the standard bitmap palette. - - - - - Initializes a new instance for the given FreeImage bitmap. - - Handle to a FreeImage bitmap. - is null. - is not - -or- - has more than 8bpp. - - - - Initializes a new instance for the given FITAG that contains - a palette. - - The tag containing the palette. - is null. - is not - . - - - - Initializes a new instance for the given MetadataTag that contains - a palette. - - The tag containing the palette. - is null. - is not - . - - - - Initializes a new instance for the given array of that contains - a palette. - - A RGBQUAD array containing the palette data to initialize this instance. - - - - Initializes a new instance for the given array of that contains - a palette. - - A Color array containing the palette data to initialize this instance. - - - - Initializes a new instance with the specified size. - - The size of the palette. - - - - Gets or sets the palette through an array of . - - - - - Get an array of that the block of memory represents. - This property is used for internal palette operations. - - - - - Returns the palette as an array of . - - The palette as an array of . - - - - Creates a linear palette based on the provided . - - The used to colorize the palette. - - Only call this method on linear palettes. - - - - - Creates a linear palette based on the provided . - - The used to colorize the palette. - The position of the color within the new palette. - 0 < < 1. - - Only call this method on linear palettes. - - - - - Creates a linear palette based on the provided . - - The used to colorize the palette. - The position of the color within the new palette. - 0 < < . - - Only call this method on linear palettes. - - - - - Creates a linear grayscale palette. - - - - - Creates a linear grayscale palette. - - true to create an inverse grayscale palette. - - - - Creates a linear palette with the specified . - - - A linear grayscale palette contains all shades of colors from - black to white. This method creates a similar palette with the white - color being replaced by the specified color. - - The used to create the palette. - true to create an inverse palette. - - - - Reverses the palette. - - - - - Copies the values from the specified to this instance. - - The palette to copy from. - - is a null reference. - - - - Copies the values from the specified to this instance, - starting at the specified . - - The palette to copy from. - The position in this instance where the values - will be copied to. - - is a null reference. - - is outside the range of valid indexes. - - - - Saves this to the specified file. - - - A string that contains the name of the file to which to save this . - - - - - Saves this to the specified stream. - - - The where the image will be saved. - - - - - Saves this using the specified writer. - - - The used to save the image. - - - - - Loads a palette from the specified file. - - The name of the palette file. - - - - Loads a palette from the specified stream. - - The stream to load the palette from. - - - - Loads a palette from the reader. - - The reader to load the palette from. - - - - Releases allocated handles associated with this instance. - - true to release managed resources. - - - - Provides methods for working with generic bitmap scanlines. - - Type of the bitmaps' scanlines. - - - - Initializes a new instance based on the specified FreeImage bitmap. - - Handle to a FreeImage bitmap. - - - - Initializes a new instance based on the specified FreeImage bitmap. - - Handle to a FreeImage bitmap. - Index of the zero based scanline. - - - - Delegate for capturing FreeImage error messages. - - The format of the image. - The errormessage. - - - - Constants used in color filling routines. - - - - - Default value. - - - - - color is RGB color (contains no valid alpha channel). - - - - - color is RGBA color (contains a valid alpha channel). - - - - - Lookup nearest RGB color from palette. - - - - - Lookup equal RGB color from palette. - - - - - contains the palette index to be used. - - - - - Dithering algorithms. - Constants used in FreeImage_Dither. - - - - - Floyd and Steinberg error diffusion - - - - - Bayer ordered dispersed dot dithering (order 2 dithering matrix) - - - - - Bayer ordered dispersed dot dithering (order 3 dithering matrix) - - - - - Ordered clustered dot dithering (order 3 - 6x6 matrix) - - - - - Ordered clustered dot dithering (order 4 - 8x8 matrix) - - - - - Ordered clustered dot dithering (order 8 - 16x16 matrix) - - - - - Bayer ordered dispersed dot dithering (order 4 dithering matrix) - - - - - I/O image format identifiers. - - - - - Unknown format (returned value only, never use it as input value) - - - - - Windows or OS/2 Bitmap File (*.BMP) - - - - - Windows Icon (*.ICO) - - - - - Independent JPEG Group (*.JPG, *.JIF, *.JPEG, *.JPE) - - - - - JPEG Network Graphics (*.JNG) - - - - - Commodore 64 Koala format (*.KOA) - - - - - Amiga IFF (*.IFF, *.LBM) - - - - - Amiga IFF (*.IFF, *.LBM) - - - - - Multiple Network Graphics (*.MNG) - - - - - Portable Bitmap (ASCII) (*.PBM) - - - - - Portable Bitmap (BINARY) (*.PBM) - - - - - Kodak PhotoCD (*.PCD) - - - - - Zsoft Paintbrush PCX bitmap format (*.PCX) - - - - - Portable Graymap (ASCII) (*.PGM) - - - - - Portable Graymap (BINARY) (*.PGM) - - - - - Portable Network Graphics (*.PNG) - - - - - Portable Pixelmap (ASCII) (*.PPM) - - - - - Portable Pixelmap (BINARY) (*.PPM) - - - - - Sun Rasterfile (*.RAS) - - - - - truevision Targa files (*.TGA, *.TARGA) - - - - - Tagged Image File Format (*.TIF, *.TIFF) - - - - - Wireless Bitmap (*.WBMP) - - - - - Adobe Photoshop (*.PSD) - - - - - Dr. Halo (*.CUT) - - - - - X11 Bitmap Format (*.XBM) - - - - - X11 Pixmap Format (*.XPM) - - - - - DirectDraw Surface (*.DDS) - - - - - Graphics Interchange Format (*.GIF) - - - - - High Dynamic Range (*.HDR) - - - - - Raw Fax format CCITT G3 (*.G3) - - - - - Silicon Graphics SGI image format (*.SGI) - - - - - OpenEXR format (*.EXR) - - - - - JPEG-2000 format (*.J2K, *.J2C) - - - - - JPEG-2000 format (*.JP2) - - - - - Portable FloatMap (*.PFM) - - - - - Macintosh PICT (*.PICT) - - - - - RAW camera image (*.*) - - - - - Tone mapping operators. Constants used in FreeImage_ToneMapping. - - - - - Adaptive logarithmic mapping (F. Drago, 2003) - - - - - Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005) - - - - - Gradient domain high dynamic range compression (R. Fattal, 2002) - - - - - Image types used in FreeImage. - - - - - unknown type - - - - - standard image : 1-, 4-, 8-, 16-, 24-, 32-bit - - - - - array of unsigned short : unsigned 16-bit - - - - - array of short : signed 16-bit - - - - - array of unsigned long : unsigned 32-bit - - - - - array of long : signed 32-bit - - - - - array of float : 32-bit IEEE floating point - - - - - array of double : 64-bit IEEE floating point - - - - - array of FICOMPLEX : 2 x 64-bit IEEE floating point - - - - - 48-bit RGB image : 3 x 16-bit - - - - - 64-bit RGBA image : 4 x 16-bit - - - - - 96-bit RGB float image : 3 x 32-bit IEEE floating point - - - - - 128-bit RGBA float image : 4 x 32-bit IEEE floating point - - - - - Color channels. Constants used in color manipulation routines. - - - - - Use red, green and blue channels - - - - - Use red channel - - - - - Use green channel - - - - - Use blue channel - - - - - Use alpha channel - - - - - Use black channel - - - - - Complex images: use real part - - - - - Complex images: use imaginary part - - - - - Complex images: use magnitude - - - - - Complex images: use phase - - - - - Image color types used in FreeImage. - - - - - min value is white - - - - - min value is black - - - - - RGB color model - - - - - color map indexed - - - - - RGB color model with alpha channel - - - - - CMYK color model - - - - - Upsampling / downsampling filters. Constants used in FreeImage_Rescale. - - - - - Box, pulse, Fourier window, 1st order (constant) b-spline - - - - - Mitchell and Netravali's two-param cubic filter - - - - - Bilinear filter - - - - - 4th order (cubic) b-spline - - - - - Catmull-Rom spline, Overhauser spline - - - - - Lanczos3 filter - - - - - Lossless JPEG transformations constants used in FreeImage_JPEGTransform. - - - - - no transformation - - - - - horizontal flip - - - - - vertical flip - - - - - transpose across UL-to-LR axis - - - - - transpose across UR-to-LL axis - - - - - 90-degree clockwise rotation - - - - - 180-degree rotation - - - - - 270-degree clockwise (or 90 ccw) - - - - - Flags used in load functions. - - - - - Default option for all types. - - - - - Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color. - - - - - 'Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading. - - - - - Convert to 32bpp and create an alpha channel from the AND-mask when loading. - - - - - Load the file as fast as possible, sacrificing some quality. - - - - - Load the file with the best quality, sacrificing some speed. - - - - - Load separated CMYK "as is" (use | to combine with other load flags). - - - - - Load and rotate according to Exif 'Orientation' tag if available. - - - - - Load the bitmap sized 768 x 512. - - - - - Load the bitmap sized 384 x 256. - - - - - Load the bitmap sized 192 x 128. - - - - - Avoid gamma correction. - - - - - If set the loader converts RGB555 and ARGB8888 -> RGB888. - - - - - Reads tags for separated CMYK. - - - - - Tries to load the JPEG preview image, embedded in - Exif Metadata or load the image as RGB 24-bit if no - preview image is available. - - - - - Loads the image as RGB 24-bit. - - - - - Metadata models supported by FreeImage. - - - - - No data - - - - - single comment or keywords - - - - - Exif-TIFF metadata - - - - - Exif-specific metadata - - - - - Exif GPS metadata - - - - - Exif maker note metadata - - - - - Exif interoperability metadata - - - - - IPTC/NAA metadata - - - - - Abobe XMP metadata - - - - - GeoTIFF metadata - - - - - Animation metadata - - - - - Used to attach other metadata types to a dib - - - - - Tag data type information (based on TIFF specifications) - Note: RATIONALs are the ratio of two 32-bit integer values. - - - - - placeholder - - - - - 8-bit unsigned integer - - - - - 8-bit bytes w/ last byte null - - - - - 16-bit unsigned integer - - - - - 32-bit unsigned integer - - - - - 64-bit unsigned fraction - - - - - 8-bit signed integer - - - - - 8-bit untyped data - - - - - 16-bit signed integer - - - - - 32-bit signed integer - - - - - 64-bit signed fraction - - - - - 32-bit IEEE floating point - - - - - 64-bit IEEE floating point - - - - - 32-bit unsigned integer (offset) - - - - - 32-bit RGBQUAD - - - - - Color quantization algorithms. - Constants used in FreeImage_ColorQuantize. - - - - - Xiaolin Wu color quantization algorithm - - - - - NeuQuant neural-net quantization algorithm by Anthony Dekker - - - - - Flags used in save functions. - - - - - Default option for all types. - - - - - Save with run length encoding. - - - - - Save data as float instead of as half (not recommended). - - - - - Save with no compression. - - - - - Save with zlib compression, in blocks of 16 scan lines. - - - - - Save with piz-based wavelet compression. - - - - - Save with lossy 24-bit float compression. - - - - - Save with lossy 44% float compression - goes to 22% when combined with EXR_LC. - - - - - Save images with one luminance and two chroma channels, rather than as RGB (lossy compression). - - - - - Save with superb quality (100:1). - - - - - Save with good quality (75:1). - - - - - Save with normal quality (50:1). - - - - - Save with average quality (25:1). - - - - - Save with bad quality (10:1). - - - - - Save as a progressive-JPEG (use | to combine with other save flags). - - - - - Save with high 4x1 chroma subsampling (4:1:1). - - - - - Save with medium 2x2 medium chroma (4:2:0). - - - - - Save with low 2x1 chroma subsampling (4:2:2). - - - - - Save with no chroma subsampling (4:4:4). - - - - - On saving, compute optimal Huffman coding tables (can reduce a few percent of file size). - - - - - save basic JPEG, without metadata or any markers. - - - - - Save using ZLib level 1 compression flag - (default value is ). - - - - - Save using ZLib level 6 compression flag (default recommended value). - - - - - save using ZLib level 9 compression flag - (default value is ). - - - - - Save without ZLib compression. - - - - - Save using Adam7 interlacing (use | to combine with other save flags). - - - - - If set the writer saves in ASCII format (i.e. P1, P2 or P3). - - - - - Stores tags for separated CMYK (use | to combine with compression flags). - - - - - Save using PACKBITS compression. - - - - - Save using DEFLATE compression (a.k.a. ZLIB compression). - - - - - Save using ADOBE DEFLATE compression. - - - - - Save without any compression. - - - - - Save using CCITT Group 3 fax encoding. - - - - - Save using CCITT Group 4 fax encoding. - - - - - Save using LZW compression. - - - - - Save using JPEG compression. - - - - - Flags for ICC profiles. - - - - - Default value. - - - - - The color is CMYK. - - - - - Enumeration used for color conversions. - FREE_IMAGE_COLOR_DEPTH contains several colors to convert to. - The default value 'FICD_AUTO'. - - - - - Unknown. - - - - - Auto selected by the used algorithm. - - - - - 1-bit. - - - - - 1-bit using dithering. - - - - - 1-bit using threshold. - - - - - 4-bit. - - - - - 8-bit. - - - - - 16-bit 555 (1 bit remains unused). - - - - - 16-bit 565 (all bits are used). - - - - - 24-bit. - - - - - 32-bit. - - - - - Reorder palette (make it linear). Only affects 1-, 4- and 8-bit images. - The palette is only reordered in case the image is greyscale - (all palette entries have the same red, green and blue value). - - - - - Converts the image to greyscale. - - - - - Flag to mask out all non color depth flags. - - - - - List of combinable compare modes. - - - - - Compare headers. - - - - - Compare palettes. - - - - - Compare pixel data. - - - - - Compare meta data. - - - - - Compare everything. - - - - - Flags for copying data from a bitmap to another. - - - - - Exisiting metadata will remain unchanged. - - - - - Existing metadata will be cleared. - - - - - Existing metadata will be overwritten. - - - - - List different search modes. - - - - - The key of the metadata. - - - - - The description of the metadata - - - - - The ToString value of the metadata - - - - - The BITMAP structure defines the type, width, height, color format, and bit values of a bitmap. - - - The bitmap formats currently used are monochrome and color. The monochrome bitmap uses a one-bit, - one-plane format. Each scan is a multiple of 32 bits. - - Scans are organized as follows for a monochrome bitmap of height n: - - - Scan 0 - Scan 1 - . - . - . - Scan n-2 - Scan n-1 - - - The pixels on a monochrome device are either black or white. If the corresponding bit in the - bitmap is 1, the pixel is set to the foreground color; if the corresponding bit in the bitmap - is zero, the pixel is set to the background color. - - All devices that have the RC_BITBLT device capability support bitmaps. For more information, - see GetDeviceCaps. - - Each device has a unique color format. To transfer a bitmap from one device to another, - use the GetDIBits and SetDIBits functions. - - - - - Specifies the bitmap type. This member must be zero. - - - - - Specifies the width, in pixels, of the bitmap. The width must be greater than zero. - - - - - Specifies the height, in pixels, of the bitmap. The height must be greater than zero. - - - - - Specifies the number of bytes in each scan line. This value must be divisible by 2, - because the system assumes that the bit values of a bitmap form an array that is word aligned. - - - - - Specifies the count of color planes. - - - - - Specifies the number of bits required to indicate the color of a pixel. - - - - - Pointer to the location of the bit values for the bitmap. - The bmBits member must be a long pointer to an array of character (1-byte) values. - - - - - The BITMAPINFO structure defines the dimensions and color information for a DIB. - - - A DIB consists of two distinct parts: a BITMAPINFO structure describing the dimensions - and colors of the bitmap, and an array of bytes defining the pixels of the bitmap. The bits in - the array are packed together, but each scan line must be padded with zeroes to end on a - LONG data-type boundary. If the height of the bitmap is positive, the bitmap is a - bottom-up DIB and its origin is the lower-left corner. If the height is negative, the bitmap is - a top-down DIB and its origin is the upper left corner. - - A bitmap is packed when the bitmap array immediately follows the BITMAPINFO header. - Packed bitmaps are referenced by a single pointer. For packed bitmaps, the biClrUsed - member must be set to an even number when using the DIB_PAL_COLORS mode so that the DIB bitmap - array starts on a DWORD boundary. - - Note The bmiColors member should not contain palette indexes if the bitmap is to - be stored in a file or transferred to another application. - - Unless the application has exclusive use and control of the bitmap, the bitmap color table - should contain explicit RGB values. - - - - - Specifies a structure that contains information - about the dimensions of color format. - - - - - The bmiColors member contains one of the following: - - - - - An array of . The elements of the array that make up the - color table. - - - - - - An array of 16-bit unsigned integers that specifies indexes into the currently realized - logical palette. This use of bmiColors is allowed for functions that use DIBs. - When bmiColors elements contain indexes to a realized logical palette, they must - also call the following bitmap functions: - - - - - CreateDIBitmap - - CreateDIBPatternBrush - - CreateDIBSection - - The iUsage parameter of CreateDIBSection must be set to DIB_PAL_COLORS. - - The number of entries in the array depends on the values of the biBitCount and - biClrUsed members of the structure. - - The colors in the bmiColors table appear in order of importance. For more information, - see the Remarks section. - - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - This structure contains information about the dimensions and color format - of a device-independent bitmap (DIB). - - - The structure combines the - BITMAPINFOHEADER structure and a color table to provide a complete - definition of the dimensions and colors of a DIB. - - - - - Specifies the size of the structure, in bytes. - - - - - Specifies the width of the bitmap, in pixels. - - Windows 98/Me, Windows 2000/XP: If biCompression is BI_JPEG or BI_PNG, - the biWidth member specifies the width of the decompressed JPEG or PNG image file, - respectively. - - - - - Specifies the height of the bitmap, in pixels. If biHeight is positive, the bitmap - is a bottom-up DIB and its origin is the lower-left corner. If biHeight is negative, - the bitmap is a top-down DIB and its origin is the upper-left corner. - - If biHeight is negative, indicating a top-down DIB, biCompression must be - either BI_RGB or BI_BITFIELDS. Top-down DIBs cannot be compressed. - - Windows 98/Me, Windows 2000/XP: If biCompression is BI_JPEG or BI_PNG, - the biHeight member specifies the height of the decompressed JPEG or PNG image file, - respectively. - - - - - Specifies the number of planes for the target device. This value must be set to 1. - - - - - Specifies the number of bits per pixel.The biBitCount member of the BITMAPINFOHEADER - structure determines the number of bits that define each pixel and the maximum number of - colors in the bitmap. This member must be one of the following values. - - - - - Value - Meaning - - - - 0 - - Windows 98/Me, Windows 2000/XP: The number of bits-per-pixel is specified - or is implied by the JPEG or PNG format. - - - - - 1 - - The bitmap is monochrome, and the bmiColors member of - contains two entries. Each bit in the bitmap array represents a pixel. If the bit is clear, - the pixel is displayed with the color of the first entry in the bmiColors table; if the bit - is set, the pixel has the color of the second entry in the table. - - - - - 4 - - The bitmap has a maximum of 16 colors, and the bmiColors member of BITMAPINFO - contains up to 16 entries. Each pixel in the bitmap is represented by a 4-bit index into the - color table. For example, if the first byte in the bitmap is 0x1F, the byte represents two - pixels. The first pixel contains the color in the second table entry, and the second pixel - contains the color in the sixteenth table entry. - - - - 8 - - The bitmap has a maximum of 256 colors, and the bmiColors member of BITMAPINFO - contains up to 256 entries. In this case, each byte in the array represents a single pixel. - - - - - 16 - - The bitmap has a maximum of 2^16 colors. If the biCompression member of the - BITMAPINFOHEADER is BI_RGB, the bmiColors member of BITMAPINFO is NULL. - Each WORD in the bitmap array represents a single pixel. The relative intensities - of red, green, and blue are represented with five bits for each color component. - The value for blue is in the least significant five bits, followed by five bits each for - green and red. The most significant bit is not used. The bmiColors color table is used - for optimizing colors used on palette-based devices, and must contain the number of entries - specified by the biClrUsed member of the BITMAPINFOHEADER. - - If the biCompression member of the BITMAPINFOHEADER is BI_BITFIELDS, the - bmiColors member contains three DWORD color masks that specify the red, green, - and blue components, respectively, of each pixel. Each WORD in the bitmap array represents - a single pixel. - - Windows NT/Windows 2000/XP: When the biCompression member is BI_BITFIELDS, - bits set in each DWORD mask must be contiguous and should not overlap the bits - of another mask. All the bits in the pixel do not have to be used. - - Windows 95/98/Me: When the biCompression member is BI_BITFIELDS, the system - supports only the following 16bpp color masks: A 5-5-5 16-bit image, where the blue mask is - 0x001F, the green mask is 0x03E0, and the red mask is 0x7C00; and a 5-6-5 16-bit image, - where the blue mask is 0x001F, the green mask is 0x07E0, and the red mask is 0xF800. - - - - - 24 - - The bitmap has a maximum of 2^24 colors, and the bmiColors member of BITMAPINFO - is NULL. Each 3-byte triplet in the bitmap array represents the relative intensities of blue, - green, and red, respectively, for a pixel. The bmiColors color table is used for - optimizing colors used on palette-based devices, and must contain the number of entries - specified by the biClrUsed member of the BITMAPINFOHEADER. - - - - - 32 - - The bitmap has a maximum of 2^32 colors. If the biCompression member of the - BITMAPINFOHEADER is BI_RGB, the bmiColors member of BITMAPINFO is NULL. - Each DWORD in the bitmap array represents the relative intensities of blue, green, and red, - respectively, for a pixel. The high byte in each DWORD is not used. The bmiColors - color table is used for optimizing colors used on palette-based devices, and must contain the - number of entries specified by the biClrUsed member of the BITMAPINFOHEADER. - - If the biCompression member of the BITMAPINFOHEADER is BI_BITFIELDS, - the bmiColors member contains three DWORD color masks that specify the red, green, - and blue components, respectively, of each pixel. Each DWORD in the bitmap array represents - a single pixel. - - Windows NT/ 2000: When the biCompression member is BI_BITFIELDS, bits set in each - DWORD mask must be contiguous and should not overlap the bits of another mask. All the - bits in the pixel do not need to be used. - - Windows 95/98/Me: When the biCompression member is BI_BITFIELDS, the system - supports only the following 32-bpp color mask: The blue mask is 0x000000FF, the green mask is - 0x0000FF00, and the red mask is 0x00FF0000. - - - - - - - - Specifies the type of compression for a compressed bottom-up bitmap (top-down DIBs cannot be - compressed). - - - Value - Meaning - - - - BI_RGB - An uncompressed format. - - - - BI_RLE8 - A run-length encoded (RLE) format for bitmaps with 8 bpp. The compression format - is a 2-byte format consisting of a count byte followed by a byte containing a color index. - - - - - BI_RLE4 - An RLE format for bitmaps with 4 bpp. The compression format is a 2-byte format - consisting of a count byte followed by two word-length color indexes. - - - - BI_BITFIELDS - Specifies that the bitmap is not compressed and that the color table consists - of three DWORD color masks that specify the red, green, and blue components, respectively, - of each pixel. This is valid when used with 16- and 32-bpp bitmaps. - - - - BI_JPEG - Windows 98/Me, Windows 2000/XP: Indicates that the image is a JPEG image. - - - - - BI_PNG - Windows 98/Me, Windows 2000/XP: Indicates that the image is a PNG image. - - - - - - - - - Specifies the size, in bytes, of the image. This may be set to zero for BI_RGB bitmaps. - - Windows 98/Me, Windows 2000/XP: If biCompression is BI_JPEG or BI_PNG, - biSizeImage indicates the size of the JPEG or PNG image buffer, respectively. - - - - - Specifies the horizontal resolution, in pixels-per-meter, of the target device for the bitmap. - An application can use this value to select a bitmap from a resource group that best matches - the characteristics of the current device. - - - - - Specifies the vertical resolution, in pixels-per-meter, of the target device for the bitmap. - - - - - Specifies the number of color indexes in the color table that are actually used by the bitmap. - If this value is zero, the bitmap uses the maximum number of colors corresponding to the value - of the biBitCount member for the compression mode specified by biCompression. - - If iClrUsed is nonzero and the biBitCount member is less than 16, the biClrUsed - member specifies the actual number of colors the graphics engine or device driver accesses. - If biBitCount is 16 or greater, the biClrUsed member specifies the size of the color - table used to optimize performance of the system color palettes. If biBitCount equals 16 or 32, - the optimal color palette starts immediately following the three DWORD masks. - - When the bitmap array immediately follows the structure, it is a packed bitmap. - Packed bitmaps are referenced by a single pointer. Packed bitmaps require that the - biClrUsed member must be either zero or the actual size of the color table. - - - - - Specifies the number of color indexes that are required for displaying the bitmap. If this value - is zero, all colors are required. - - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - The FI16RGB555 structure describes a color consisting of relative - intensities of red, green, blue and alpha value. Each single color - component consumes 5 bits and so, takes values in the range from 0 to 31. - - - For easy integration of the underlying structure into the .NET framework, - the FI16RGB555 structure implements implicit conversion operators to - convert the represented color to and from the - type. This makes the type a real replacement - for the FI16RGB555 structure and my be used in all situations which require - an FI16RGB555 type. - - - - The following code example demonstrates the various conversions between the - FI16RGB555 structure and the structure. - - FI16RGB555 fi16rgb; - // Initialize the structure using a native .NET Color structure. - fi16rgb = new FI16RGB555(Color.Indigo); - // Initialize the structure using the implicit operator. - fi16rgb = Color.DarkSeaGreen; - // Convert the FI16RGB555 instance into a native .NET Color - // using its implicit operator. - Color color = fi16rgb; - // Using the structure's Color property for converting it - // into a native .NET Color. - Color another = fi16rgb.Color; - - - - - - The value of the color. - - - - - Initializes a new instance based on the specified . - - to initialize with. - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Gets or sets the of the structure. - - - - - Gets or sets the red color component. - - - - - Gets or sets the green color component. - - - - - Gets or sets the blue color component. - - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - The FI16RGB565 structure describes a color consisting of relative - intensities of red, green, blue and alpha value. Each single color - component consumes 5 bits and so, takes values in the range from 0 to 31. - - - For easy integration of the underlying structure into the .NET framework, - the FI16RGB565 structure implements implicit conversion operators to - convert the represented color to and from the - type. This makes the type a real replacement - for the FI16RGB565 structure and my be used in all situations which require - an FI16RGB565 type. - - - - The following code example demonstrates the various conversions between the - FI16RGB565 structure and the structure. - - FI16RGB565 fi16rgb; - // Initialize the structure using a native .NET Color structure. - fi16rgb = new FI16RGB565(Color.Indigo); - // Initialize the structure using the implicit operator. - fi16rgb = Color.DarkSeaGreen; - // Convert the FI16RGB565 instance into a native .NET Color - // using its implicit operator. - Color color = fi16rgb; - // Using the structure's Color property for converting it - // into a native .NET Color. - Color another = fi16rgb.Color; - - - - - - The value of the color. - - - - - Initializes a new instance based on the specified . - - to initialize with. - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Gets or sets the of the structure. - - - - - Gets or sets the red color component. - - - - - Gets or sets the green color component. - - - - - Gets or sets the blue color component. - - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - The FI1BIT structure represents a single bit. - It's value can be 0 or 1. - - - - - Represents the largest possible value of . This field is constant. - - - - - Represents the smallest possible value of . This field is constant. - - - - - The value of the structure. - - - - - Initializes a new instance based on the specified value. - - The value to initialize with. - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - The FIBITMAP structure is a handle to a FreeImage bimtap. - - - The handle represented by a FIBITBAP structure provides - access to either a singlepage bitmap or exactly one page of - a multipage bitmap. - - - - - A read-only field that represents a handle that has been initialized to zero. - - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Gets whether the handle is a null or not. - - true if this handle is a null; - otherwise, false. - - - - Sets the handle to null. - - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Determines whether the specified is equal to the current . - - The to compare with the current . - true if the specified is equal to the current ; otherwise, false. - - - - Indicates whether the current object is equal to another object of the same type. - - An object to compare with this object. - true if the current object is equal to the other parameter; otherwise, false. - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - The FICOMPLEX structure describes a color consisting of a real and an imaginary part. - Each part is using 4 bytes of data. - - - - - Real part of the color. - - - - - Imaginary part of the color. - - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - This Structure contains ICC-Profile data. - - - - - Creates a new ICC-Profile for . - - Handle to a FreeImage bitmap. - The ICC-Profile data. - - is null. - - - - Creates a new ICC-Profile for . - - Handle to a FreeImage bitmap. - The ICC-Profile data. - Number of bytes to use from data. - - is null. - - - - Info flag of the profile. - - - - - Profile's size measured in bytes. - - - - - Points to a block of contiguous memory containing the profile. - - - - - Copy of the ICC-Profiles data. - - - - - Indicates whether the profile is CMYK. - - - - - The FIMEMORY structure is a handle to an opened memory stream. - - - - - A read-only field that represents a handle that has been initialized to zero. - - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Gets whether the pointer is a null pointer or not. - - true if this is a null pointer; - otherwise, false. - - - - Sets the handle to null. - - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Determines whether the specified is equal to the current . - - The to compare with the current . - true if the specified is equal to the current ; otherwise, false. - - - - Indicates whether the current object is equal to another object of the same type. - - An object to compare with this object. - true if the current object is equal to the other parameter; otherwise, false. - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - The FIMETADATA structure is an unique search handle for metadata search operations. - - - The FIMETADATA structure is usually returned by the - - function and then used on subsequent calls to - . - When the FIMETADATA handle is no longer used, it needs to be freed by the - function. - - - - - A read-only field that represents a handle that has been initialized to zero. - - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Gets whether the pointer is a null pointer or not. - - true if this is a null pointer; - otherwise, false. - - - - Sets the handle to null. - - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Determines whether the specified is equal to the current . - - The to compare with the current . - true if the specified is equal to the current ; otherwise, false. - - - - Indicates whether the current object is equal to another object of the same type. - - An object to compare with this object. - true if the current object is equal to the other parameter; otherwise, false. - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - The FIMULTIBITMAP structure is a handle to a FreeImage multipaged bimtap. - - - - - A read-only field that represents a handle that has been initialized to zero. - - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Gets whether the handle is a null or not. - - true if this handle is a null; - otherwise, false. - - - - Sets the handle to null. - - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Determines whether the specified is equal to the current . - - The to compare with the current . - true if the specified is equal to the current ; otherwise, false. - - - - Indicates whether the current object is equal to another object of the same type. - - An object to compare with this object. - true if the current object is equal to the other parameter; otherwise, false. - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - The FIRational structure represents a fraction via two - instances which are interpreted as numerator and denominator. - - - The structure tries to approximate the value of - when creating a new instance by using a better algorithm than FreeImage does. - - The structure implements the following operators: - +, -, ++, --, ==, != , >, >==, <, <== and ~ (which switches nominator and denomiator). - - The structure can be converted into all .NET standard types either implicit or - explicit. - - - - - Represents the largest possible value of . This field is constant. - - - - - Represents the smallest possible value of . This field is constant. - - - - - Represents the smallest positive value greater than zero. This field is constant. - - - - - Initializes a new instance based on the specified parameters. - - The numerator. - The denominator. - - - - Initializes a new instance based on the specified parameters. - - The tag to read the data from. - - - - Initializes a new instance based on the specified parameters. - - The value to convert into a fraction. - - cannot be converted into a fraction - represented by two integer values. - - - - The numerator of the fraction. - - - - - The denominator of the fraction. - - - - - Returns the truncated value of the fraction. - - - - - - Returns whether the fraction is representing an integer value. - - - - - Calculated the greatest common divisor of 'a' and 'b'. - - - - - Calculated the smallest common multiple of 'a' and 'b'. - - - - - Normalizes the fraction. - - - - - Normalizes a fraction. - - - - - Returns the digits after the point. - - - - - Creates a continued fraction of a decimal value. - - - - - Creates a fraction from a continued fraction. - - - - - Tries 'brute force' to approximate with a fraction. - - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Returns the reciprocal value of this instance. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Formats the value of the current instance using the specified format. - - The String specifying the format to use. - The IFormatProvider to use to format the value. - A String containing the value of the current instance in the specified format. - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - The FIRGB16 structure describes a color consisting of relative - intensities of red, green, blue and alpha value. Each single color - component consumes 16 bits and so, takes values in the range from 0 to 65535. - - - - The FIRGB16 structure provides access to an underlying FreeImage FIRGB16 - structure. To determine the red, green or blue component of a color, - use the red, green or blue fields, respectively. - - For easy integration of the underlying structure into the .NET framework, - the FIRGB16 structure implements implicit conversion operators to - convert the represented color to and from the - type. This makes the type a real replacement - for the FIRGB16 structure and my be used in all situations which require - an FIRGB16 type. - - - Each color component red, green or blue of FIRGB16 is translated into - it's corresponding color component R, G or B of - by right shifting 8 bits and shifting left 8 bits for the reverse conversion. - When converting from into FIRGB16, the - color's alpha value is ignored and assumed to be 255 when converting from - FIRGB16 into , creating a fully - opaque color. - - - Conversion from System.Drawing.Color to FIRGB16 - - FIRGB16.component = Color.component << 8 - - Conversion from FIRGB16 to System.Drawing.Color - - Color.component = FIRGB16.component >> 8 - - The same conversion is also applied when the - property or the constructor - is invoked. - - - - The following code example demonstrates the various conversions between the - FIRGB16 structure and the structure. - - FIRGB16 firgb16; - // Initialize the structure using a native .NET Color structure. - firgb16 = new FIRGBA16(Color.Indigo); - // Initialize the structure using the implicit operator. - firgb16 = Color.DarkSeaGreen; - // Convert the FIRGB16 instance into a native .NET Color - // using its implicit operator. - Color color = firgb16; - // Using the structure's Color property for converting it - // into a native .NET Color. - Color another = firgb16.Color; - - - - - - The red color component. - - - - - The green color component. - - - - - The blue color component. - - - - - Initializes a new instance based on the specified . - - to initialize with. - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Gets or sets the of the structure. - - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - The FIRGBA16 structure describes a color consisting of relative - intensities of red, green, blue and alpha value. Each single color - component consumes 16 bits and so, takes values in the range from 0 to 65535. - - - - The FIRGBA16 structure provides access to an underlying FreeImage FIRGBA16 - structure. To determine the alpha, red, green or blue component of a color, - use the alpha, red, green or blue fields, respectively. - - For easy integration of the underlying structure into the .NET framework, - the FIRGBA16 structure implements implicit conversion operators to - convert the represented color to and from the - type. This makes the type a real replacement - for the FIRGBA16 structure and my be used in all situations which require - an FIRGBA16 type. - - - Each color component alpha, red, green or blue of FIRGBA16 - is translated into it's corresponding color component A, R, G or B of - by an 8 bit right shift and vice versa. - - - Conversion from System.Drawing.Color to FIRGBA16 - - FIRGBA16.component = Color.component << 8 - - Conversion from FIRGBA16 to System.Drawing.Color - - Color.component = FIRGBA16.component >> 8 - - The same conversion is also applied when the - property or the constructor - is invoked. - - - - The following code example demonstrates the various conversions between the - FIRGBA16 structure and the structure. - - FIRGBA16 firgba16; - // Initialize the structure using a native .NET Color structure. - firgba16 = new FIRGBA16(Color.Indigo); - // Initialize the structure using the implicit operator. - firgba16 = Color.DarkSeaGreen; - // Convert the FIRGBA16 instance into a native .NET Color - // using its implicit operator. - Color color = firgba16; - // Using the structure's Color property for converting it - // into a native .NET Color. - Color another = firgba16.Color; - - - - - - The red color component. - - - - - The green color component. - - - - - The blue color component. - - - - - The alpha color component. - - - - - Initializes a new instance based on the specified . - - to initialize with. - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Gets or sets the of the structure. - - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - The FIRGBAF structure describes a color consisting of relative - intensities of red, green, blue and alpha value. Each single color - component consumes 32 bits and takes values in the range from 0 to 1. - - - - The FIRGBAF structure provides access to an underlying FreeImage FIRGBAF - structure. To determine the alpha, red, green or blue component of a color, - use the alpha, red, green or blue fields, respectively. - - For easy integration of the underlying structure into the .NET framework, - the FIRGBAF structure implements implicit conversion operators to - convert the represented color to and from the - type. This makes the type a real replacement - for the FIRGBAF structure and my be used in all situations which require - an FIRGBAF type. - - - Each color component alpha, red, green or blue of FIRGBAF is translated - into it's corresponding color component A, R, G or B of - by linearly mapping the values of one range - into the other range and vice versa. - - - Conversion from System.Drawing.Color to FIRGBAF - - FIRGBAF.component = (float)Color.component / 255f - - Conversion from FIRGBAF to System.Drawing.Color - - Color.component = (int)(FIRGBAF.component * 255f) - - The same conversion is also applied when the - property or the constructor - is invoked. - - - - The following code example demonstrates the various conversions between the - FIRGBAF structure and the structure. - - FIRGBAF firgbaf; - // Initialize the structure using a native .NET Color structure. - firgbaf = new FIRGBAF(Color.Indigo); - // Initialize the structure using the implicit operator. - firgbaf = Color.DarkSeaGreen; - // Convert the FIRGBAF instance into a native .NET Color - // using its implicit operator. - Color color = firgbaf; - // Using the structure's Color property for converting it - // into a native .NET Color. - Color another = firgbaf.Color; - - - - - - The red color component. - - - - - The green color component. - - - - - The blue color component. - - - - - The alpha color component. - - - - - Initializes a new instance based on the specified . - - to initialize with. - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Gets or sets the of the structure. - - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - The FIRGBF structure describes a color consisting of relative - intensities of red, green, blue and alpha value. Each single color - component consumes 32 bits and takes values in the range from 0 to 1. - - - - The FIRGBF structure provides access to an underlying FreeImage FIRGBF - structure. To determine the red, green or blue component of a color, use the - red, green or blue fields, respectively. - - For easy integration of the underlying structure into the .NET framework, - the FIRGBF structure implements implicit conversion operators to - convert the represented color to and from the - type. This makes the type a real replacement - for the FIRGBF structure and my be used in all situations which require - an FIRGBF type. - - - Each color component alpha, red, green or blue of FIRGBF is translated - into it's corresponding color component A, R, G or B of - by linearly mapping the values of one range - into the other range and vice versa. - When converting from into FIRGBF, the - color's alpha value is ignored and assumed to be 255 when converting from - FIRGBF into , creating a fully - opaque color. - - - Conversion from System.Drawing.Color to FIRGBF - - FIRGBF.component = (float)Color.component / 255f - - Conversion from FIRGBF to System.Drawing.Color - - Color.component = (int)(FIRGBF.component * 255f) - - The same conversion is also applied when the - property or the constructor - is invoked. - - - - The following code example demonstrates the various conversions between the - FIRGBF structure and the structure. - - FIRGBF firgbf; - // Initialize the structure using a native .NET Color structure. - firgbf = new FIRGBF(Color.Indigo); - // Initialize the structure using the implicit operator. - firgbf = Color.DarkSeaGreen; - // Convert the FIRGBF instance into a native .NET Color - // using its implicit operator. - Color color = firgbf; - // Using the structure's Color property for converting it - // into a native .NET Color. - Color another = firgbf.Color; - - - - - - The red color component. - - - - - The green color component. - - - - - The blue color component. - - - - - Initializes a new instance based on the specified . - - to initialize with. - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Gets or sets the of the structure. - - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Static class importing functions from the FreeImage library - and providing additional functions. - - - - - Filename of the FreeImage library. - - - - - Number of bytes to shift left within a 4 byte block. - - - - - Number of bytes to shift left within a 4 byte block. - - - - - Number of bytes to shift left within a 4 byte block. - - - - - Number of bytes to shift left within a 4 byte block. - - - - - Mask indicating the position of the given color. - - - - - Mask indicating the position of the given color. - - - - - Mask indicating the position of the given color. - - - - - Mask indicating the position of the given color. - - - - - Number of bits to shift left within a 32 bit block. - - - - - Number of bits to shift left within a 32 bit block. - - - - - Number of bits to shift left within a 32 bit block. - - - - - Number of bits to shift left within a 32 bit block. - - - - - Mask indicating the position of color components of a 32 bit color. - - - - - Mask indicating the position of the given color. - - - - - Mask indicating the position of the given color. - - - - - Mask indicating the position of the given color. - - - - - Number of bits to shift left within a 16 bit block. - - - - - Number of bits to shift left within a 16 bit block. - - - - - Number of bits to shift left within a 16 bit block. - - - - - Mask indicating the position of the given color. - - - - - Mask indicating the position of the given color. - - - - - Mask indicating the position of the given color. - - - - - Number of bits to shift left within a 16 bit block. - - - - - Number of bits to shift left within a 16 bit block. - - - - - Number of bits to shift left within a 16 bit block. - - - - - Initialises the library. - - - When the is true, FreeImage won't make use of external plugins. - - - - - Deinitialises the library. - - - - - Returns a string containing the current version of the library. - - The current version of the library. - - - - Returns a string containing a standard copyright message. - - A standard copyright message. - - - - Calls the set error message function in FreeImage. - - Format of the bitmaps. - The error message. - - - - You use the function FreeImage_SetOutputMessage to capture the log string - so that you can show it to the user of the program. - The callback is implemented in the event of this class. - - The function is private because FreeImage can only have a single - callback function. To use the callback use the - event of this class. - Handler to the callback function. - - - - Creates a new bitmap in memory. - - Width of the new bitmap. - Height of the new bitmap. - Bit depth of the new Bitmap. - Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - Red part of the color layout. - eg: 0xFF0000 - Green part of the color layout. - eg: 0x00FF00 - Blue part of the color layout. - eg: 0x0000FF - Handle to a FreeImage bitmap. - - - - Creates a new bitmap in memory. - - Type of the image. - Width of the new bitmap. - Height of the new bitmap. - Bit depth of the new Bitmap. - Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - Red part of the color layout. - eg: 0xFF0000 - Green part of the color layout. - eg: 0x00FF00 - Blue part of the color layout. - eg: 0x0000FF - Handle to a FreeImage bitmap. - - - - Makes an exact reproduction of an existing bitmap, including metadata and attached profile if any. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - - - - Deletes a previously loaded FIBITMAP from memory. - - Handle to a FreeImage bitmap. - - - - Decodes a bitmap, allocates memory for it and returns it as a FIBITMAP. - - Type of the bitmap. - Name of the file to decode. - Flags to enable or disable plugin-features. - Handle to a FreeImage bitmap. - - - - Decodes a bitmap, allocates memory for it and returns it as a FIBITMAP. - The filename supports UNICODE. - - Type of the bitmap. - Name of the file to decode. - Flags to enable or disable plugin-features. - Handle to a FreeImage bitmap. - - - - Loads a bitmap from an arbitrary source. - - Type of the bitmap. - A FreeImageIO structure with functionpointers to handle the source. - A handle to the source. - Flags to enable or disable plugin-features. - Handle to a FreeImage bitmap. - - - - Saves a previosly loaded FIBITMAP to a file. - - Type of the bitmap. - Handle to a FreeImage bitmap. - Name of the file to save to. - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - - - Saves a previosly loaded FIBITMAP to a file. - The filename supports UNICODE. - - Type of the bitmap. - Handle to a FreeImage bitmap. - Name of the file to save to. - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - - - Saves a bitmap to an arbitrary source. - - Type of the bitmap. - Handle to a FreeImage bitmap. - A FreeImageIO structure with functionpointers to handle the source. - A handle to the source. - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - - - Open a memory stream. - - Pointer to the data in memory. - Length of the data in byte. - Handle to a memory stream. - - - - Close and free a memory stream. - - Handle to a memory stream. - - - - Decodes a bitmap from a stream, allocates memory for it and returns it as a FIBITMAP. - - Type of the bitmap. - Handle to a memory stream. - Flags to enable or disable plugin-features. - Handle to a FreeImage bitmap. - - - - Saves a previosly loaded FIBITMAP to a stream. - - Type of the bitmap. - Handle to a FreeImage bitmap. - Handle to a memory stream. - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - - - Gets the current position of a memory handle. - - Handle to a memory stream. - The current file position if successful, -1 otherwise. - - - - Moves the memory handle to a specified location. - - Handle to a memory stream. - Number of bytes from origin. - Initial position. - Returns true on success, false on failure. - - - - Provides a direct buffer access to a memory stream. - - The target memory stream. - Pointer to the data in memory. - Size of the data in bytes. - Returns true on success, false on failure. - - - - Reads data from a memory stream. - - The buffer to store the data in. - Size in bytes of the items. - Number of items to read. - The stream to read from. - The memory pointer associated with stream is increased by the number of bytes actually read. - The number of full items actually read. - May be less than count on error or stream-end. - - - - Writes data to a memory stream. - - The buffer to read the data from. - Size in bytes of the items. - Number of items to write. - The stream to write to. - The memory pointer associated with stream is increased by the number of bytes actually written. - The number of full items actually written. - May be less than count on error or stream-end. - - - - Open a multi-page bitmap from a memory stream. - - Type of the bitmap. - The stream to decode. - Flags to enable or disable plugin-features. - Handle to a FreeImage multi-paged bitmap. - - - - Registers a new plugin to be used in FreeImage. - - Pointer to the function that initialises the plugin. - A string describing the format of the plugin. - A string describing the plugin. - A string witha comma sperated list of extensions. f.e: "pl,pl2,pl4" - A regular expression used to identify the bitmap. - The format idientifier assigned by FreeImage. - - - - Registers a new plugin to be used in FreeImage. The plugin is residing in a DLL. - The Init function must be called 揑nit?and must use the stdcall calling convention. - - Complete path to the dll file hosting the plugin. - A string describing the format of the plugin. - A string describing the plugin. - A string witha comma sperated list of extensions. f.e: "pl,pl2,pl4" - A regular expression used to identify the bitmap. - The format idientifier assigned by FreeImage. - - - - Retrieves the number of FREE_IMAGE_FORMAT identifiers being currently registered. - - The number of registered formats. - - - - Enables or disables a plugin. - - The plugin to enable or disable. - True: enable the plugin. false: disable the plugin. - The previous state of the plugin. - 1 - enabled. 0 - disables. -1 plugin does not exist. - - - - Retrieves the state of a plugin. - - The plugin to check. - 1 - enabled. 0 - disables. -1 plugin does not exist. - - - - Returns a identifier from the format string that was used to register the FIF. - - The string that was used to register the plugin. - A identifier from the format. - - - - Returns a identifier from a MIME content type string - (MIME stands for Multipurpose Internet Mail Extension). - - A MIME content type. - A identifier from the MIME. - - - - Returns the string that was used to register a plugin from the system assigned . - - The assigned . - The string that was used to register the plugin. - - - - Returns a comma-delimited file extension list describing the bitmap formats the given plugin can read and/or write. - - The desired . - A comma-delimited file extension list. - - - - Returns a descriptive string that describes the bitmap formats the given plugin can read and/or write. - - The desired . - A descriptive string that describes the bitmap formats. - - - - Returns a regular expression string that can be used by a regular expression engine to identify the bitmap. - FreeImageQt makes use of this function. - - The desired . - A regular expression string. - - - - Given a identifier, returns a MIME content type string (MIME stands for Multipurpose Internet Mail Extension). - - The desired . - A MIME content type string. - - - - This function takes a filename or a file-extension and returns the plugin that can - read/write files with that extension in the form of a identifier. - - The filename or -extension. - The of the plugin. - - - - This function takes a filename or a file-extension and returns the plugin that can - read/write files with that extension in the form of a identifier. - Supports UNICODE filenames. - - The filename or -extension. - The of the plugin. - - - - Checks if a plugin can load bitmaps. - - The of the plugin. - True if the plugin can load bitmaps, else false. - - - - Checks if a plugin can save bitmaps. - - The of the plugin. - True if the plugin can save bitmaps, else false. - - - - Checks if a plugin can save bitmaps in the desired bit depth. - - The of the plugin. - The desired bit depth. - True if the plugin can save bitmaps in the desired bit depth, else false. - - - - Checks if a plugin can save a bitmap in the desired data type. - - The of the plugin. - The desired image type. - True if the plugin can save bitmaps as the desired type, else false. - - - - Checks if a plugin can load or save an ICC profile. - - The of the plugin. - True if the plugin can load or save an ICC profile, else false. - - - - Loads a FreeImage multi-paged bitmap. - Load flags can be provided by the flags parameter. - - Format of the image. - The complete name of the file to load. - When true a new bitmap is created. - When true the bitmap will be loaded read only. - When true performance is increased at the cost of memory. - Flags to enable or disable plugin-features. - Handle to a FreeImage multi-paged bitmap. - - - - Loads a FreeImage multi-pages bitmap from the specified handle - using the specified functions. - Load flags can be provided by the flags parameter. - - Format of the image. - IO functions used to read from the specified handle. - The handle to load the bitmap from. - Flags to enable or disable plugin-features. - Handle to a FreeImage multi-paged bitmap. - - - - Closes a previously opened multi-page bitmap and, when the bitmap was not opened read-only, applies any changes made to it. - - Handle to a FreeImage multi-paged bitmap. - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - - - Returns the number of pages currently available in the multi-paged bitmap. - - Handle to a FreeImage multi-paged bitmap. - Number of pages. - - - - Appends a new page to the end of the bitmap. - - Handle to a FreeImage multi-paged bitmap. - Handle to a FreeImage bitmap. - - - - Inserts a new page before the given position in the bitmap. - - Handle to a FreeImage multi-paged bitmap. - Page has to be a number smaller than the current number of pages available in the bitmap. - Handle to a FreeImage bitmap. - - - - Deletes the page on the given position. - - Handle to a FreeImage multi-paged bitmap. - Number of the page to delete. - - - - Locks a page in memory for editing. - - Handle to a FreeImage multi-paged bitmap. - Number of the page to lock. - Handle to a FreeImage bitmap. - - - - Unlocks a previously locked page and gives it back to the multi-page engine. - - Handle to a FreeImage multi-paged bitmap. - Handle to a FreeImage bitmap. - If true, the page is applied to the multi-page bitmap. - - - - Moves the source page to the position of the target page. - - Handle to a FreeImage multi-paged bitmap. - New position of the page. - Old position of the page. - Returns true on success, false on failure. - - - - Returns an array of page-numbers that are currently locked in memory. - When the pages parameter is null, the size of the array is returned in the count variable. - - - - int[] lockedPages = null; - int count = 0; - GetLockedPageNumbers(dib, lockedPages, ref count); - lockedPages = new int[count]; - GetLockedPageNumbers(dib, lockedPages, ref count); - - - Handle to a FreeImage multi-paged bitmap. - The list of locked pages in the multi-pages bitmap. - If set to null, count will contain the number of pages. - If is set to null count will contain the number of locked pages. - Returns true on success, false on failure. - - - - Orders FreeImage to analyze the bitmap signature. - - Name of the file to analyze. - Reserved parameter - use 0. - Type of the bitmap. - - - - Orders FreeImage to analyze the bitmap signature. - Supports UNICODE filenames. - - Name of the file to analyze. - Reserved parameter - use 0. - Type of the bitmap. - - - - Uses the structure as described in the topic bitmap management functions - to identify a bitmap type. - - A structure with functionpointers to handle the source. - A handle to the source. - Size in bytes of the source. - Type of the bitmap. - - - - Uses a memory handle to identify a bitmap type. - - Pointer to the stream. - Size in bytes of the source. - Type of the bitmap. - - - - Returns whether the platform is using Little Endian. - - Returns true if the platform is using Litte Endian, else false. - - - - Converts a X11 color name into a corresponding RGB value. - - Name of the color to convert. - Red component. - Green component. - Blue component. - Returns true on success, false on failure. - - - - Converts a SVG color name into a corresponding RGB value. - - Name of the color to convert. - Red component. - Green component. - Blue component. - Returns true on success, false on failure. - - - - Returns a pointer to the data-bits of the bitmap. - - Handle to a FreeImage bitmap. - Pointer to the data-bits. - - - - Returns a pointer to the start of the given scanline in the bitmap's data-bits. - - Handle to a FreeImage bitmap. - Number of the scanline. - Pointer to the scanline. - - - - Get the pixel index of a palettized image at position (x, y), including range check (slow access). - - Handle to a FreeImage bitmap. - Pixel position in horizontal direction. - Pixel position in vertical direction. - The pixel index. - Returns true on success, false on failure. - - - - Get the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). - - Handle to a FreeImage bitmap. - Pixel position in horizontal direction. - Pixel position in vertical direction. - The pixel color. - Returns true on success, false on failure. - - - - Set the pixel index of a palettized image at position (x, y), including range check (slow access). - - Handle to a FreeImage bitmap. - Pixel position in horizontal direction. - Pixel position in vertical direction. - The new pixel index. - Returns true on success, false on failure. - - - - Set the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). - - Handle to a FreeImage bitmap. - Pixel position in horizontal direction. - Pixel position in vertical direction. - The new pixel color. - Returns true on success, false on failure. - - - - Retrieves the type of the bitmap. - - Handle to a FreeImage bitmap. - Type of the bitmap. - - - - Returns the number of colors used in a bitmap. - - Handle to a FreeImage bitmap. - Palette-size for palletised bitmaps, and 0 for high-colour bitmaps. - - - - Returns the size of one pixel in the bitmap in bits. - - Handle to a FreeImage bitmap. - Size of one pixel in the bitmap in bits. - - - - Returns the width of the bitmap in pixel units. - - Handle to a FreeImage bitmap. - With of the bitmap. - - - - Returns the height of the bitmap in pixel units. - - Handle to a FreeImage bitmap. - Height of the bitmap. - - - - Returns the width of the bitmap in bytes. - - Handle to a FreeImage bitmap. - With of the bitmap in bytes. - - - - Returns the width of the bitmap in bytes, rounded to the next 32-bit boundary, - also known as pitch or stride or scan width. - - Handle to a FreeImage bitmap. - With of the bitmap in bytes. - - - - Returns the size of the DIB-element of a FIBITMAP in memory. - - Handle to a FreeImage bitmap. - Size of the DIB-element - - - - Returns a pointer to the bitmap's palette. - - Handle to a FreeImage bitmap. - Pointer to the bitmap's palette. - - - - Returns the horizontal resolution, in pixels-per-meter, of the target device for the bitmap. - - Handle to a FreeImage bitmap. - The horizontal resolution, in pixels-per-meter. - - - - Returns the vertical resolution, in pixels-per-meter, of the target device for the bitmap. - - Handle to a FreeImage bitmap. - The vertical resolution, in pixels-per-meter. - - - - Set the horizontal resolution, in pixels-per-meter, of the target device for the bitmap. - - Handle to a FreeImage bitmap. - The new horizontal resolution. - - - - Set the vertical resolution, in pixels-per-meter, of the target device for the bitmap. - - Handle to a FreeImage bitmap. - The new vertical resolution. - - - - Returns a pointer to the of the DIB-element in a FIBITMAP. - - Handle to a FreeImage bitmap. - Poiter to the header of the bitmap. - - - - Alias for FreeImage_GetInfoHeader that returns a pointer to a - rather than to a . - - Handle to a FreeImage bitmap. - Pointer to the structure for the bitmap. - - - - Investigates the color type of the bitmap by reading the bitmap's pixel bits and analysing them. - - Handle to a FreeImage bitmap. - The color type of the bitmap. - - - - Returns a bit pattern describing the red color component of a pixel in a FreeImage bitmap. - - Handle to a FreeImage bitmap. - The bit pattern for RED. - - - - Returns a bit pattern describing the green color component of a pixel in a FreeImage bitmap. - - Handle to a FreeImage bitmap. - The bit pattern for green. - - - - Returns a bit pattern describing the blue color component of a pixel in a FreeImage bitmap. - - Handle to a FreeImage bitmap. - The bit pattern for blue. - - - - Returns the number of transparent colors in a palletised bitmap. - - Handle to a FreeImage bitmap. - The number of transparent colors in a palletised bitmap. - - - - Returns a pointer to the bitmap's transparency table. - - Handle to a FreeImage bitmap. - Pointer to the bitmap's transparency table. - - - - Tells FreeImage if it should make use of the transparency table - or the alpha channel that may accompany a bitmap. - - Handle to a FreeImage bitmap. - True to enable the transparency, false to disable. - - - - Set the bitmap's transparency table. Only affects palletised bitmaps. - - Handle to a FreeImage bitmap. - Pointer to the bitmap's new transparency table. - The number of transparent colors in the new transparency table. - - - - Returns whether the transparency table is enabled. - - Handle to a FreeImage bitmap. - Returns true when the transparency table is enabled (1-, 4- or 8-bit images) - or when the input dib contains alpha values (32-bit images). Returns false otherwise. - - - - Returns whether the bitmap has a file background color. - - Handle to a FreeImage bitmap. - Returns true when the image has a file background color, false otherwise. - - - - Returns the file background color of an image. - For 8-bit images, the color index in the palette is returned in the - rgbReserved member of the bkcolor parameter. - - Handle to a FreeImage bitmap. - The background color. - Returns true on success, false on failure. - - - - Set the file background color of an image. - When saving an image to PNG, this background color is transparently saved to the PNG file. - - Handle to a FreeImage bitmap. - The new background color. - Returns true on success, false on failure. - - - - Set the file background color of an image. - When saving an image to PNG, this background color is transparently saved to the PNG file. - When the bkcolor parameter is null, the background color is removed from the image. - - This overloaded version of the function with an array parameter is provided to allow - passing null in the parameter. This is similar to the - original C/C++ function. Passing null as parameter will - unset the dib's previously set background color. - - - Handle to a FreeImage bitmap. - The new background color. - The first entry in the array is used. - Returns true on success, false on failure. - - - // create a RGBQUAD color - RGBQUAD color = new RGBQUAD(Color.Green); - - // set the dib's background color (using the other version of the function) - FreeImage.SetBackgroundColor(dib, ref color); - - // remove it again (this only works due to the array parameter RGBQUAD[]) - FreeImage.SetBackgroundColor(dib, null); - - - - - - Sets the index of the palette entry to be used as transparent color - for the image specified. Does nothing on high color images. - - Handle to a FreeImage bitmap. - The index of the palette entry to be set as transparent color. - - - - Returns the palette entry used as transparent color for the image specified. - Works for palletised images only and returns -1 for high color - images or if the image has no color set to be transparent. - - Handle to a FreeImage bitmap. - the index of the palette entry used as transparent color for - the image specified or -1 if there is no transparent color found - (e.g. the image is a high color image). - - - - Retrieves the data of the bitmap. - This function can also be called safely, when the original format does not support profiles. - - Handle to a FreeImage bitmap. - The data of the bitmap. - - - - Retrieves a pointer to the data of the bitmap. - This function can also be called safely, when the original format does not support profiles. - - Handle to a FreeImage bitmap. - Pointer to the data of the bitmap. - - - - Creates a new block from ICC profile data previously read from a file - or built by a color management system. The profile data is attached to the bitmap. - - Handle to a FreeImage bitmap. - Pointer to the new data. - Size of the data. - Pointer to the created structure. - - - - This function destroys an previously created by . - After this call the bitmap will contain no profile information. - This function should be called to ensure that a stored bitmap will not contain any profile information. - - Handle to a FreeImage bitmap. - - - - Converts a bitmap to 4 bits. - If the bitmap was a high-color bitmap (16, 24 or 32-bit) or if it was a - monochrome or greyscale bitmap (1 or 8-bit), the end result will be a - greyscale bitmap, otherwise (1-bit palletised bitmaps) it will be a palletised bitmap. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - - - - Converts a bitmap to 8 bits. If the bitmap was a high-color bitmap (16, 24 or 32-bit) - or if it was a monochrome or greyscale bitmap (1 or 4-bit), the end result will be a - greyscale bitmap, otherwise (1 or 4-bit palletised bitmaps) it will be a palletised bitmap. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - - - - Converts a bitmap to a 8-bit greyscale image with a linear ramp. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - - - - Converts a bitmap to 16 bits, where each pixel has a color pattern of - 5 bits red, 5 bits green and 5 bits blue. One bit in each pixel is unused. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - - - - Converts a bitmap to 16 bits, where each pixel has a color pattern of - 5 bits red, 6 bits green and 5 bits blue. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - - - - Converts a bitmap to 24 bits. A clone of the input bitmap is returned for 24-bit bitmaps. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - - - - Converts a bitmap to 32 bits. A clone of the input bitmap is returned for 32-bit bitmaps. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - - - - Quantizes a high-color 24-bit bitmap to an 8-bit palette color bitmap. - - Handle to a FreeImage bitmap. - Specifies the color reduction algorithm to be used. - Handle to a FreeImage bitmap. - - - - ColorQuantizeEx is an extension to the method that - provides additional options used to quantize a 24-bit image to any - number of colors (up to 256), as well as quantize a 24-bit image using a - partial or full provided palette. - - Handle to a FreeImage bitmap. - Specifies the color reduction algorithm to be used. - Size of the desired output palette. - Size of the provided palette of ReservePalette. - The provided palette. - Handle to a FreeImage bitmap. - - - - Converts a bitmap to 1-bit monochrome bitmap using a threshold T between [0..255]. - The function first converts the bitmap to a 8-bit greyscale bitmap. - Then, any brightness level that is less than T is set to zero, otherwise to 1. - For 1-bit input bitmaps, the function clones the input bitmap and builds a monochrome palette. - - Handle to a FreeImage bitmap. - The threshold. - Handle to a FreeImage bitmap. - - - - Converts a bitmap to 1-bit monochrome bitmap using a dithering algorithm. - For 1-bit input bitmaps, the function clones the input bitmap and builds a monochrome palette. - - Handle to a FreeImage bitmap. - The dithering algorithm to use. - Handle to a FreeImage bitmap. - - - - Converts a raw bitmap to a FreeImage bitmap. - - Pointer to the memory block containing the raw bitmap. - The width in pixels of the raw bitmap. - The height in pixels of the raw bitmap. - Defines the total width of a scanline in the raw bitmap, - including padding bytes. - The bit depth (bits per pixel) of the raw bitmap. - The bit mask describing the bits used to store a single - pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The bit mask describing the bits used to store a single - pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The bit mask describing the bits used to store a single - pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - If true, the raw bitmap is stored in top-down order (top-left pixel first) - and in bottom-up order (bottom-left pixel first) otherwise. - Handle to a FreeImage bitmap. - - - - Converts a raw bitmap to a FreeImage bitmap. - - Array of bytes containing the raw bitmap. - The width in pixels of the raw bitmap. - The height in pixels of the raw bitmap. - Defines the total width of a scanline in the raw bitmap, - including padding bytes. - The bit depth (bits per pixel) of the raw bitmap. - The bit mask describing the bits used to store a single - pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The bit mask describing the bits used to store a single - pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The bit mask describing the bits used to store a single - pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - If true, the raw bitmap is stored in top-down order (top-left pixel first) - and in bottom-up order (bottom-left pixel first) otherwise. - Handle to a FreeImage bitmap. - - - - Converts a FreeImage bitmap to a raw bitmap, that is a raw piece of memory. - - Pointer to the memory block receiving the raw bitmap. - Handle to a FreeImage bitmap. - The desired total width in bytes of a scanline in the raw bitmap, - including any padding bytes. - The desired bit depth (bits per pixel) of the raw bitmap. - The desired bit mask describing the bits used to store a single - pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The desired bit mask describing the bits used to store a single - pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The desired bit mask describing the bits used to store a single - pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - If true, the raw bitmap will be stored in top-down order (top-left pixel first) - and in bottom-up order (bottom-left pixel first) otherwise. - - - - Converts a FreeImage bitmap to a raw bitmap, that is a raw piece of memory. - - Array of bytes receiving the raw bitmap. - Handle to a FreeImage bitmap. - The desired total width in bytes of a scanline in the raw bitmap, - including any padding bytes. - The desired bit depth (bits per pixel) of the raw bitmap. - The desired bit mask describing the bits used to store a single - pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The desired bit mask describing the bits used to store a single - pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The desired bit mask describing the bits used to store a single - pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - If true, the raw bitmap will be stored in top-down order (top-left pixel first) - and in bottom-up order (bottom-left pixel first) otherwise. - - - - Converts a 24- or 32-bit RGB(A) standard image or a 48-bit RGB image to a FIT_RGBF type image. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - - - - Converts a non standard image whose color type is FIC_MINISBLACK - to a standard 8-bit greyscale image. - - Handle to a FreeImage bitmap. - When true the conversion is done by scaling linearly - each pixel value from [min, max] to an integer value between [0..255], - where min and max are the minimum and maximum pixel values in the image. - When false the conversion is done by rounding each pixel value to an integer between [0..255]. - - Rounding is done using the following formula: - - dst_pixel = (BYTE) MIN(255, MAX(0, q)) where int q = int(src_pixel + 0.5); - Handle to a FreeImage bitmap. - - - - Converts an image of any type to type dst_type. - - Handle to a FreeImage bitmap. - Destination type. - True to scale linear, else false. - Handle to a FreeImage bitmap. - - - - Converts a High Dynamic Range image (48-bit RGB or 96-bit RGBF) to a 24-bit RGB image, suitable for display. - - Handle to a FreeImage bitmap. - The tone mapping operator to be used. - Parmeter depending on the used algorithm - Parmeter depending on the used algorithm - Handle to a FreeImage bitmap. - - - - Converts a High Dynamic Range image to a 24-bit RGB image using a global - operator based on logarithmic compression of luminance values, imitating the human response to light. - - Handle to a FreeImage bitmap. - A gamma correction that is applied after the tone mapping. - A value of 1 means no correction. - Scale factor allowing to adjust the brightness of the output image. - Handle to a FreeImage bitmap. - - - - Converts a High Dynamic Range image to a 24-bit RGB image using a global operator inspired - by photoreceptor physiology of the human visual system. - - Handle to a FreeImage bitmap. - Controls the overall image intensity in the range [-8, 8]. - Controls the overall image contrast in the range [0.3, 1.0[. - Handle to a FreeImage bitmap. - - - - Apply the Gradient Domain High Dynamic Range Compression to a RGBF image and convert to 24-bit RGB. - - Handle to a FreeImage bitmap. - Color saturation (s parameter in the paper) in [0.4..0.6] - Atenuation factor (beta parameter in the paper) in [0.8..0.9] - Handle to a FreeImage bitmap. - - - - Compresses a source buffer into a target buffer, using the ZLib library. - - Pointer to the target buffer. - Size of the target buffer. - Must be at least 0.1% larger than source_size plus 12 bytes. - Pointer to the source buffer. - Size of the source buffer. - The actual size of the compressed buffer, or 0 if an error occurred. - - - - Decompresses a source buffer into a target buffer, using the ZLib library. - - Pointer to the target buffer. - Size of the target buffer. - Must have been saved outlide of zlib. - Pointer to the source buffer. - Size of the source buffer. - The actual size of the uncompressed buffer, or 0 if an error occurred. - - - - Compresses a source buffer into a target buffer, using the ZLib library. - - Pointer to the target buffer. - Size of the target buffer. - Must be at least 0.1% larger than source_size plus 24 bytes. - Pointer to the source buffer. - Size of the source buffer. - The actual size of the compressed buffer, or 0 if an error occurred. - - - - Decompresses a source buffer into a target buffer, using the ZLib library. - - Pointer to the target buffer. - Size of the target buffer. - Must have been saved outlide of zlib. - Pointer to the source buffer. - Size of the source buffer. - The actual size of the uncompressed buffer, or 0 if an error occurred. - - - - Generates a CRC32 checksum. - - The CRC32 checksum to begin with. - Pointer to the source buffer. - If the value is 0, the function returns the required initial value for the crc. - Size of the source buffer. - - - - - Allocates a new object. - This object must be destroyed with a call to - when no longer in use. - - The new . - - - - Delete a previously allocated object. - - The to destroy. - - - - Creates and returns a copy of a object. - - The to clone. - The new . - - - - Returns the tag field name (unique inside a metadata model). - - The tag field. - The field name. - - - - Returns the tag description. - - The tag field. - The description or NULL if unavailable. - - - - Returns the tag ID. - - The tag field. - The ID or 0 if unavailable. - - - - Returns the tag data type. - - The tag field. - The tag type. - - - - Returns the number of components in the tag (in tag type units). - - The tag field. - The number of components. - - - - Returns the length of the tag value in bytes. - - The tag field. - The length of the tag value. - - - - Returns the tag value. - It is up to the programmer to interpret the returned pointer correctly, - according to the results of GetTagType and GetTagCount. - - The tag field. - Pointer to the value. - - - - Sets the tag field name. - - The tag field. - The new name. - Returns true on success, false on failure. - - - - Sets the tag description. - - The tag field. - The new description. - Returns true on success, false on failure. - - - - Sets the tag ID. - - The tag field. - The new ID. - Returns true on success, false on failure. - - - - Sets the tag data type. - - The tag field. - The new type. - Returns true on success, false on failure. - - - - Sets the number of data in the tag. - - The tag field. - New number of data. - Returns true on success, false on failure. - - - - Sets the length of the tag value in bytes. - - The tag field. - The new length. - Returns true on success, false on failure. - - - - Sets the tag value. - - The tag field. - Pointer to the new value. - Returns true on success, false on failure. - - - - Provides information about the first instance of a tag that matches the metadata model. - - The model to match. - Handle to a FreeImage bitmap. - Tag that matches the metadata model. - Unique search handle that can be used to call FindNextMetadata or FindCloseMetadata. - Null if the metadata model does not exist. - - - - Find the next tag, if any, that matches the metadata model argument in a previous call - to FindFirstMetadata, and then alters the tag object contents accordingly. - - Unique search handle provided by FindFirstMetadata. - Tag that matches the metadata model. - Returns true on success, false on failure. - - - - Closes the specified metadata search handle and releases associated resources. - - The handle to close. - - - - Retrieve a metadata attached to a dib. - - The metadata model to look for. - Handle to a FreeImage bitmap. - The metadata field name. - A FITAG structure returned by the function. - Returns true on success, false on failure. - - - - Attach a new FreeImage tag to a dib. - - The metadata model used to store the tag. - Handle to a FreeImage bitmap. - The tag field name. - The FreeImage tag to be attached. - Returns true on success, false on failure. - - - - Returns the number of tags contained in the model metadata model attached to the input dib. - - The metadata model. - Handle to a FreeImage bitmap. - Number of tags contained in the metadata model. - - - - Copies the metadata of FreeImage bitmap to another. - - The FreeImage bitmap to copy the metadata to. - The FreeImage bitmap to copy the metadata from. - Returns true on success, false on failure. - - - - Converts a FreeImage tag structure to a string that represents the interpreted tag value. - The function is not thread safe. - - The metadata model. - The interpreted tag value. - Reserved. - The representing string. - - - - This function rotates a 1-, 8-bit greyscale or a 24-, 32-bit color image by means of 3 shears. - 1-bit images rotation is limited to integer multiple of 90? - null is returned for other values. - - Handle to a FreeImage bitmap. - The angle of rotation. - Handle to a FreeImage bitmap. - - - - This function performs a rotation and / or translation of an 8-bit greyscale, - 24- or 32-bit image, using a 3rd order (cubic) B-Spline. - - Handle to a FreeImage bitmap. - The angle of rotation. - Horizontal image translation. - Vertical image translation. - Rotation center x-coordinate. - Rotation center y-coordinate. - When true the irrelevant part of the image is set to a black color, - otherwise, a mirroring technique is used to fill irrelevant pixels. - Handle to a FreeImage bitmap. - - - - Flip the input dib horizontally along the vertical axis. - - Handle to a FreeImage bitmap. - Returns true on success, false on failure. - - - - Flip the input dib vertically along the horizontal axis. - - Handle to a FreeImage bitmap. - Returns true on success, false on failure. - - - - Performs a lossless rotation or flipping on a JPEG file. - - Source file. - Destination file; can be the source file; will be overwritten. - The operation to apply. - To avoid lossy transformation, you can set the perfect parameter to true. - Returns true on success, false on failure. - - - - Performs resampling (or scaling, zooming) of a greyscale or RGB(A) image - to the desired destination width and height. - - Handle to a FreeImage bitmap. - Destination width. - Destination height. - The filter to apply. - Handle to a FreeImage bitmap. - - - - Creates a thumbnail from a greyscale or RGB(A) image, keeping aspect ratio. - - Handle to a FreeImage bitmap. - Thumbnail square size. - When true HDR images are transperantly converted to standard images. - Handle to a FreeImage bitmap. - - - - Perfoms an histogram transformation on a 8-, 24- or 32-bit image. - - Handle to a FreeImage bitmap. - The lookup table. - It's size is assumed to be 256 in length. - The color channel to be transformed. - Returns true on success, false on failure. - - - - Performs gamma correction on a 8-, 24- or 32-bit image. - - Handle to a FreeImage bitmap. - The parameter represents the gamma value to use (gamma > 0). - A value of 1.0 leaves the image alone, less than one darkens it, and greater than one lightens it. - Returns true on success, false on failure. - - - - Adjusts the brightness of a 8-, 24- or 32-bit image by a certain amount. - - Handle to a FreeImage bitmap. - A value 0 means no change, - less than 0 will make the image darker and greater than 0 will make the image brighter. - Returns true on success, false on failure. - - - - Adjusts the contrast of a 8-, 24- or 32-bit image by a certain amount. - - Handle to a FreeImage bitmap. - A value 0 means no change, - less than 0 will decrease the contrast and greater than 0 will increase the contrast of the image. - Returns true on success, false on failure. - - - - Inverts each pixel data. - - Handle to a FreeImage bitmap. - Returns true on success, false on failure. - - - - Computes the image histogram. - - Handle to a FreeImage bitmap. - Array of integers with a size of 256. - Channel to compute from. - Returns true on success, false on failure. - - - - Retrieves the red, green, blue or alpha channel of a 24- or 32-bit image. - - Handle to a FreeImage bitmap. - The color channel to extract. - Handle to a FreeImage bitmap. - - - - Insert a 8-bit dib into a 24- or 32-bit image. - Both images must have to same width and height. - - Handle to a FreeImage bitmap. - Handle to the bitmap to insert. - The color channel to replace. - Returns true on success, false on failure. - - - - Retrieves the real part, imaginary part, magnitude or phase of a complex image. - - Handle to a FreeImage bitmap. - The color channel to extract. - Handle to a FreeImage bitmap. - - - - Set the real or imaginary part of a complex image. - Both images must have to same width and height. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - The color channel to replace. - Returns true on success, false on failure. - - - - Copy a sub part of the current dib image. - - Handle to a FreeImage bitmap. - Specifies the left position of the cropped rectangle. - Specifies the top position of the cropped rectangle. - Specifies the right position of the cropped rectangle. - Specifies the bottom position of the cropped rectangle. - Handle to a FreeImage bitmap. - - - - Alpha blend or combine a sub part image with the current dib image. - The bit depth of the dst bitmap must be greater than or equal to the bit depth of the src. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - Specifies the left position of the sub image. - Specifies the top position of the sub image. - alpha blend factor. - The source and destination images are alpha blended if alpha=0..255. - If alpha > 255, then the source image is combined to the destination image. - Returns true on success, false on failure. - - - - This function composite a transparent foreground image against a single background color or - against a background image. - - Handle to a FreeImage bitmap. - When true the background of fg is used if it contains one. - The application background is used if useFileBkg is false. - Image used as background when useFileBkg is false or fg has no background - and appBkColor is null. - Handle to a FreeImage bitmap. - - - - This function composite a transparent foreground image against a single background color or - against a background image. - - Handle to a FreeImage bitmap. - When true the background of fg is used if it contains one. - The application background is used if useFileBkg is false - and 'appBkColor' is not null. - Image used as background when useFileBkg is false or fg has no background - and appBkColor is null. - Handle to a FreeImage bitmap. - - - - Performs a lossless crop on a JPEG file. - - Source filename. - Destination filename. - Specifies the left position of the cropped rectangle. - Specifies the top position of the cropped rectangle. - Specifies the right position of the cropped rectangle. - Specifies the bottom position of the cropped rectangle. - Returns true on success, false on failure. - - - - Applies the alpha value of each pixel to its color components. - The aplha value stays unchanged. - Only works with 32-bits color depth. - - Handle to a FreeImage bitmap. - Returns true on success, false on failure. - - - - Solves a Poisson equation, remap result pixels to [0..1] and returns the solution. - - Handle to a FreeImage bitmap. - Number of cycles in the multigrid algorithm (usually 2 or 3) - Handle to a FreeImage bitmap. - - - - Creates a lookup table to be used with which may adjusts brightness and - contrast, correct gamma and invert the image with a single call to . - - Output lookup table to be used with . - The size of 'lookUpTable' is assumed to be 256. - Percentage brightness value where -100 <= brightness <= 100. - A value of 0 means no change, less than 0 will make the image darker and greater - than 0 will make the image brighter. - Percentage contrast value where -100 <= contrast <= 100. - A value of 0 means no change, less than 0 will decrease the contrast - and greater than 0 will increase the contrast of the image. - Gamma value to be used for gamma correction. - A value of 1.0 leaves the image alone, less than one darkens it, - and greater than one lightens it. - If set to true, the image will be inverted. - The number of adjustments applied to the resulting lookup table - compared to a blind lookup table. - - This function creates a lookup table to be used with which may adjust - brightness and contrast, correct gamma and invert the image with a single call to - . If more than one of these image display properties need to be adjusted, - using a combined lookup table should be preferred over calling each adjustment function - separately. That's particularly true for huge images or if performance is an issue. Then, - the expensive process of iterating over all pixels of an image is performed only once and - not up to four times. - - Furthermore, the lookup table created does not depend on the order, in which each single - adjustment operation is performed. Due to rounding and byte casting issues, it actually - matters in which order individual adjustment operations are performed. Both of the following - snippets most likely produce different results: - - - // snippet 1: contrast, brightness - AdjustContrast(dib, 15.0); - AdjustBrightness(dib, 50.0); - - - - // snippet 2: brightness, contrast - AdjustBrightness(dib, 50.0); - AdjustContrast(dib, 15.0); - - - Better and even faster would be snippet 3: - - - // snippet 3: - byte[] lut = new byte[256]; - GetAdjustColorsLookupTable(lut, 50.0, 15.0, 1.0, false); - AdjustCurve(dib, lut, FREE_IMAGE_COLOR_CHANNEL.FICC_RGB); - - - This function is also used internally by , which does not return the - lookup table, but uses it to call on the passed image. - - - - - Adjusts an image's brightness, contrast and gamma as well as it may - optionally invert the image within a single operation. - - Handle to a FreeImage bitmap. - Percentage brightness value where -100 <= brightness <= 100. - A value of 0 means no change, less than 0 will make the image darker and greater - than 0 will make the image brighter. - Percentage contrast value where -100 <= contrast <= 100. - A value of 0 means no change, less than 0 will decrease the contrast - and greater than 0 will increase the contrast of the image. - Gamma value to be used for gamma correction. - A value of 1.0 leaves the image alone, less than one darkens it, - and greater than one lightens it. - This parameter must not be zero or smaller than zero. - If so, it will be ignored and no gamma correction will be performed on the image. - If set to true, the image will be inverted. - Returns true on success, false on failure. - - This function adjusts an image's brightness, contrast and gamma as well as it - may optionally invert the image within a single operation. If more than one of - these image display properties need to be adjusted, using this function should - be preferred over calling each adjustment function separately. That's particularly - true for huge images or if performance is an issue. - - This function relies on , - which creates a single lookup table, that combines all adjustment operations requested. - - Furthermore, the lookup table created by does - not depend on the order, in which each single adjustment operation is performed. - Due to rounding and byte casting issues, it actually matters in which order individual - adjustment operations are performed. Both of the following snippets most likely produce - different results: - - - // snippet 1: contrast, brightness - AdjustContrast(dib, 15.0); - AdjustBrightness(dib, 50.0); - - - - // snippet 2: brightness, contrast - AdjustBrightness(dib, 50.0); - AdjustContrast(dib, 15.0); - - - Better and even faster would be snippet 3: - - - // snippet 3: - AdjustColors(dib, 50.0, 15.0, 1.0, false); - - - - - - Applies color mapping for one or several colors on a 1-, 4- or 8-bit - palletized or a 16-, 24- or 32-bit high color image. - - Handle to a FreeImage bitmap. - Array of colors to be used as the mapping source. - Array of colors to be used as the mapping destination. - The number of colors to be mapped. This is the size of both - srccolors and dstcolors. - If true, 32-bit images and colors are treated as 24-bit. - If true, source and destination colors are swapped, that is, - each destination color is also mapped to the corresponding source color. - The total number of pixels changed. - - This function maps up to colors specified in - to these specified in . - Thereby, color srccolors[N], if found in the image, will be replaced by color - dstcolors[N]. If is true, additionally all colors - specified in are also mapped to these specified - in . For high color images, the actual image data will be - modified whereas, for palletized images only the palette will be changed. - - The function returns the number of pixels changed or zero, if no pixels were changed. - - Both arrays and are assumed - not to hold less than colors. - - For 16-bit images, all colors specified are transparently converted to their - proper 16-bit representation (either in RGB555 or RGB565 format, which is determined - by the image's red- green- and blue-mask). - - Note, that this behaviour is different from what does, - which modifies the actual image data on palletized images. - - - - - Swaps two specified colors on a 1-, 4- or 8-bit palletized - or a 16-, 24- or 32-bit high color image. - - Handle to a FreeImage bitmap. - One of the two colors to be swapped. - The other of the two colors to be swapped. - If true, 32-bit images and colors are treated as 24-bit. - The total number of pixels changed. - - This function swaps the two specified colors and - on a palletized or high color image. - For high color images, the actual image data will be modified whereas, for palletized - images only the palette will be changed. - - Note, that this behaviour is different from what does, - which modifies the actual image data on palletized images. - - This is just a thin wrapper for and resolves to: - - - return ApplyColorMapping(dib, color_a, color_b, 1, ignore_alpha, true); - - - - - - Applies palette index mapping for one or several indices - on a 1-, 4- or 8-bit palletized image. - - Handle to a FreeImage bitmap. - Array of palette indices to be used as the mapping source. - Array of palette indices to be used as the mapping destination. - The number of palette indices to be mapped. This is the size of both - srcindices and dstindices - If true, source and destination palette indices are swapped, that is, - each destination index is also mapped to the corresponding source index. - The total number of pixels changed. - - This function maps up to palette indices specified in - to these specified in . - Thereby, index srcindices[N], if present in the image, will be replaced by index - dstindices[N]. If is true, additionally all indices - specified in are also mapped to these specified in - . - - The function returns the number of pixels changed or zero, if no pixels were changed. - Both arrays and are assumed not to - hold less than indices. - - Note, that this behaviour is different from what does, which - modifies the actual image data on palletized images. - - - - - Swaps two specified palette indices on a 1-, 4- or 8-bit palletized image. - - Handle to a FreeImage bitmap. - One of the two palette indices to be swapped. - The other of the two palette indices to be swapped. - The total number of pixels changed. - - This function swaps the two specified palette indices index_a and - index_b on a palletized image. Therefore, not the palette, but the - actual image data will be modified. - - Note, that this behaviour is different from what does on palletized images, - which only swaps the colors in the palette. - - This is just a thin wrapper for and resolves to: - - - return ApplyPaletteIndexMapping(dib, index_a, index_b, 1, true); - - - - - - Array containing all 'FREE_IMAGE_MDMODEL's. - - - - - Stores handles used to read from streams. - - - - - Version of the wrapper library. - - - - - An uncompressed format. - - - - - A run-length encoded (RLE) format for bitmaps with 8 bpp. The compression format is a 2-byte - format consisting of a count byte followed by a byte containing a color index. - - - - - An RLE format for bitmaps with 4 bpp. The compression format is a 2-byte format consisting - of a count byte followed by two word-length color indexes. - - - - - Specifies that the bitmap is not compressed and that the color table consists of three - DWORD color masks that specify the red, green, and blue components, respectively, - of each pixel. This is valid when used with 16- and 32-bpp bitmaps. - - - - - Windows 98/Me, Windows 2000/XP: Indicates that the image is a JPEG image. - - - - - Windows 98/Me, Windows 2000/XP: Indicates that the image is a PNG image. - - - - - Returns the internal version of this FreeImage .NET wrapper. - - The internal version of this FreeImage .NET wrapper. - - - - Returns the version of the native FreeImage library. - - The version of the native FreeImage library. - - - - Returns a value indicating if the FreeImage library is available or not. - See remarks for further details. - - false if the file is not available or out of date; - true, otherwise. - - The FreeImage.NET library is a wrapper for the native C++ library - (FreeImage.dll ... dont mix ist up with this library FreeImageNet.dll). - The native library must be either in the same folder as the program's - executable or in a folder contained in the envirent variable PATH - (for example %WINDIR%\System32). - Further more must both libraries, including the program itself, - be the same architecture (x86 or x64). - - - - - Creates a new bitmap in memory. - - Width of the new bitmap. - Height of the new bitmap. - Bit depth of the new Bitmap. - Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - Handle to a FreeImage bitmap. - - - - Creates a new bitmap in memory. - - Type of the image. - Width of the new bitmap. - Height of the new bitmap. - Bit depth of the new Bitmap. - Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - Handle to a FreeImage bitmap. - - - - Allocates a new image of the specified width, height and bit depth and optionally - fills it with the specified color. See remarks for further details. - - Width of the new bitmap. - Height of the new bitmap. - Bit depth of the new bitmap. - Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmaps. - The color to fill the bitmap with or null. - Options to enable or disable function-features. - The palette of the bitmap or null. - Handle to a FreeImage bitmap. - - This function is an extension to , which additionally supports - specifying a palette to be set for the newly create image, as well as specifying a - background color, the newly created image should initially be filled with. - - Basically, this function internally relies on function , followed by a - call to . This is why both parameters - and behave the same as it is - documented for function . - So, please refer to the documentation of to - learn more about parameters and . - - The palette specified through parameter is only copied to the - newly created image, if the desired bit depth is smaller than or equal to 8 bits per pixel. - In other words, the parameter is only taken into account for - palletized images. So, for an 8-bit image, the length is 256, for an 4-bit image it is 16 - and it is 2 for a 1-bit image. In other words, this function does not support partial palettes. - - However, specifying a palette is not necesarily needed, even for palletized images. This - function is capable of implicitly creating a palette, if is null. - If the specified background color is a greyscale value (red = green = blue) or if option - is specified, a greyscale palette - is created. For a 1-bit image, only if the specified background color is either black or white, - a monochrome palette, consisting of black and white only is created. In any case, the darker - colors are stored at the smaller palette indices. - - If the specified background color is not a greyscale value, or is neither black nor white - for a 1-bit image, solely this specified color is injected into the otherwise black-initialized - palette. For this operation, option - is implicit, so the specified is applied to the palette entry, - specified by the background color's field. - The image is then filled with this palette index. - - This function returns a newly created image as function does, if both - parameters and are null. - If only is null, the palette pointed to by - parameter is initially set for the new image, if a palletized - image of type is created. - However, in the latter case, this function returns an image, whose - pixels are all initialized with zeros so, the image will be filled with the color of the - first palette entry. - - - - - Allocates a new image of the specified width, height and bit depth and optionally - fills it with the specified color. See remarks for further details. - - Width of the new bitmap. - Height of the new bitmap. - Bit depth of the new bitmap. - Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmaps. - The color to fill the bitmap with or null. - Options to enable or disable function-features. - The palette of the bitmap or null. - Red part of the color layout. - eg: 0xFF0000 - Green part of the color layout. - eg: 0x00FF00 - Blue part of the color layout. - eg: 0x0000FF - Handle to a FreeImage bitmap. - - This function is an extension to , which additionally supports - specifying a palette to be set for the newly create image, as well as specifying a - background color, the newly created image should initially be filled with. - - Basically, this function internally relies on function , followed by a - call to . This is why both parameters - and behave the same as it is - documented for function . - So, please refer to the documentation of to - learn more about parameters and . - - The palette specified through parameter is only copied to the - newly created image, if the desired bit depth is smaller than or equal to 8 bits per pixel. - In other words, the parameter is only taken into account for - palletized images. So, for an 8-bit image, the length is 256, for an 4-bit image it is 16 - and it is 2 for a 1-bit image. In other words, this function does not support partial palettes. - - However, specifying a palette is not necesarily needed, even for palletized images. This - function is capable of implicitly creating a palette, if is null. - If the specified background color is a greyscale value (red = green = blue) or if option - is specified, a greyscale palette - is created. For a 1-bit image, only if the specified background color is either black or white, - a monochrome palette, consisting of black and white only is created. In any case, the darker - colors are stored at the smaller palette indices. - - If the specified background color is not a greyscale value, or is neither black nor white - for a 1-bit image, solely this specified color is injected into the otherwise black-initialized - palette. For this operation, option - is implicit, so the specified is applied to the palette entry, - specified by the background color's field. - The image is then filled with this palette index. - - This function returns a newly created image as function does, if both - parameters and are null. - If only is null, the palette pointed to by - parameter is initially set for the new image, if a palletized - image of type is created. - However, in the latter case, this function returns an image, whose - pixels are all initialized with zeros so, the image will be filled with the color of the - first palette entry. - - - - - Allocates a new image of the specified type, width, height and bit depth and optionally - fills it with the specified color. See remarks for further details. - - The type of the specified color. - Type of the image. - Width of the new bitmap. - Height of the new bitmap. - Bit depth of the new bitmap. - Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - The color to fill the bitmap with or null. - Options to enable or disable function-features. - The palette of the bitmap or null. - Handle to a FreeImage bitmap. - - This function is an extension to , which additionally supports - specifying a palette to be set for the newly create image, as well as specifying a - background color, the newly created image should initially be filled with. - - Basically, this function internally relies on function , followed by a - call to . This is why both parameters - and behave the same as it is - documented for function . So, please refer to the - documentation of to learn more about parameters color and options. - - The palette specified through parameter palette is only copied to the newly created - image, if its image type is and the desired bit - depth is smaller than or equal to 8 bits per pixel. In other words, the - palette is only taken into account for palletized images. However, if the preceding conditions - match and if is not null, the palette is assumed to be at - least as large as the size of a fully populated palette for the desired bit depth. - So, for an 8-bit image, this length is 256, for an 4-bit image it is 16 and it is - 2 for a 1-bit image. In other words, this function does not support partial palettes. - - However, specifying a palette is not necesarily needed, even for palletized images. This - function is capable of implicitly creating a palette, if is null. - If the specified background color is a greyscale value (red = green = blue) or if option - is specified, a greyscale palette - is created. For a 1-bit image, only if the specified background color is either black or white, - a monochrome palette, consisting of black and white only is created. In any case, the darker - colors are stored at the smaller palette indices. - - If the specified background color is not a greyscale value, or is neither black nor white - for a 1-bit image, solely this specified color is injected into the otherwise black-initialized - palette. For this operation, option - is implicit, so the specified color is applied to the palette entry, specified by the - background color's field. The image is then filled with - this palette index. - - This function returns a newly created image as function does, if both - parameters and are null. - If only is null, the palette pointed to by - parameter is initially set for the new image, if a palletized - image of type is created. - However, in the latter case, this function returns an image, whose - pixels are all initialized with zeros so, the image will be filled with the color of the - first palette entry. - - - - - Allocates a new image of the specified type, width, height and bit depth and optionally - fills it with the specified color. See remarks for further details. - - The type of the specified color. - Type of the image. - Width of the new bitmap. - Height of the new bitmap. - Bit depth of the new bitmap. - Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - The color to fill the bitmap with or null. - Options to enable or disable function-features. - The palette of the bitmap or null. - Red part of the color layout. - eg: 0xFF0000 - Green part of the color layout. - eg: 0x00FF00 - Blue part of the color layout. - eg: 0x0000FF - Handle to a FreeImage bitmap. - - This function is an extension to , which additionally supports - specifying a palette to be set for the newly create image, as well as specifying a - background color, the newly created image should initially be filled with. - - Basically, this function internally relies on function , followed by a - call to . This is why both parameters - and behave the same as it is - documented for function . So, please refer to the - documentation of to learn more about parameters color and options. - - The palette specified through parameter palette is only copied to the newly created - image, if its image type is and the desired bit - depth is smaller than or equal to 8 bits per pixel. In other words, the - palette is only taken into account for palletized images. However, if the preceding conditions - match and if is not null, the palette is assumed to be at - least as large as the size of a fully populated palette for the desired bit depth. - So, for an 8-bit image, this length is 256, for an 4-bit image it is 16 and it is - 2 for a 1-bit image. In other words, this function does not support partial palettes. - - However, specifying a palette is not necesarily needed, even for palletized images. This - function is capable of implicitly creating a palette, if is null. - If the specified background color is a greyscale value (red = green = blue) or if option - is specified, a greyscale palette - is created. For a 1-bit image, only if the specified background color is either black or white, - a monochrome palette, consisting of black and white only is created. In any case, the darker - colors are stored at the smaller palette indices. - - If the specified background color is not a greyscale value, or is neither black nor white - for a 1-bit image, solely this specified color is injected into the otherwise black-initialized - palette. For this operation, option - is implicit, so the specified color is applied to the palette entry, specified by the - background color's field. The image is then filled with - this palette index. - - This function returns a newly created image as function does, if both - parameters and are null. - If only is null, the palette pointed to by - parameter is initially set for the new image, if a palletized - image of type is created. - However, in the latter case, this function returns an image, whose - pixels are all initialized with zeros so, the image will be filled with the color of the - first palette entry. - - - - - Converts a FreeImage bitmap to a .NET . - - Handle to a FreeImage bitmap. - The converted .NET . - Copying metadata has been disabled until a proper way - of reading and storing metadata in a .NET bitmap is found. - - is null. - - The image type of is not FIT_BITMAP. - - - - Converts a FreeImage bitmap to a .NET . - - Handle to a FreeImage bitmap. - When true existing metadata will be copied. - The converted .NET . - Copying metadata has been disabled until a proper way - of reading and storing metadata in a .NET bitmap is found. - - is null. - - The image type of is not FIT_BITMAP. - - - - Converts an .NET into a FreeImage bitmap. - - The to convert. - Handle to a FreeImage bitmap. - Copying metadata has been disabled until a proper way - of reading and storing metadata in a .NET bitmap is found. - - is null. - - The bitmaps pixelformat is invalid. - - - - Converts an .NET into a FreeImage bitmap. - - The to convert. - When true existing metadata will be copied. - Handle to a FreeImage bitmap. - Copying metadata has been disabled until a proper way - of reading and storing metadata in a .NET bitmap is found. - - is null. - - The bitmaps pixelformat is invalid. - - - - Converts a raw bitmap to a FreeImage bitmap. - - Array of bytes containing the raw bitmap. - The type of the raw bitmap. - The width in pixels of the raw bitmap. - The height in pixels of the raw bitmap. - Defines the total width of a scanline in the raw bitmap, - including padding bytes. - The bit depth (bits per pixel) of the raw bitmap. - The bit mask describing the bits used to store a single - pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The bit mask describing the bits used to store a single - pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The bit mask describing the bits used to store a single - pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - If true, the raw bitmap is stored in top-down order (top-left pixel first) - and in bottom-up order (bottom-left pixel first) otherwise. - Handle to a FreeImage bitmap. - - - - Converts a raw bitmap to a FreeImage bitmap. - - Pointer to the memory block containing the raw bitmap. - The type of the raw bitmap. - The width in pixels of the raw bitmap. - The height in pixels of the raw bitmap. - Defines the total width of a scanline in the raw bitmap, - including padding bytes. - The bit depth (bits per pixel) of the raw bitmap. - The bit mask describing the bits used to store a single - pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The bit mask describing the bits used to store a single - pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The bit mask describing the bits used to store a single - pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - If true, the raw bitmap is stored in top-down order (top-left pixel first) - and in bottom-up order (bottom-left pixel first) otherwise. - Handle to a FreeImage bitmap. - - - - Saves a .NET to a file. - - The .NET to save. - Name of the file to save to. - Returns true on success, false on failure. - - or is null. - - The bitmaps pixelformat is invalid. - - - - Saves a .NET to a file. - - The .NET to save. - Name of the file to save to. - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - or is null. - - The bitmaps pixelformat is invalid. - - - - Saves a .NET to a file. - - The .NET to save. - Name of the file to save to. - Format of the bitmap. If the format should be taken from the - filename use . - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - or is null. - - The bitmaps pixelformat is invalid. - - - - Loads a FreeImage bitmap. - The file will be loaded with default loading flags. - - The complete name of the file to load. - Handle to a FreeImage bitmap. - - does not exists. - - - - Loads a FreeImage bitmap. - Load flags can be provided by the flags parameter. - - The complete name of the file to load. - Flags to enable or disable plugin-features. - Handle to a FreeImage bitmap. - - does not exists. - - - - Loads a FreeImage bitmap. - In case the loading format is the files - real format is being analysed. If no plugin can read the file, format remains - and 0 is returned. - The file will be loaded with default loading flags. - - The complete name of the file to load. - Format of the image. If the format is unknown use - . - In case a suitable format was found by LoadEx it will be returned in format. - Handle to a FreeImage bitmap. - - does not exists. - - - - Loads a FreeImage bitmap. - In case the loading format is the files - real format is being analysed. If no plugin can read the file, format remains - and 0 is returned. - Load flags can be provided by the flags parameter. - - The complete name of the file to load. - Flags to enable or disable plugin-features. - Format of the image. If the format is unknown use - . - In case a suitable format was found by LoadEx it will be returned in format. - - Handle to a FreeImage bitmap. - - does not exists. - - - - Loads a .NET from a file. - - Name of the file to be loaded. - Format of the image. If the format should be taken from the - filename use . - Flags to enable or disable plugin-features. - The loaded .NET . - - does not exists. - - The image type of the image is not . - - - - Deletes a previously loaded FreeImage bitmap from memory and resets the handle to 0. - - Handle to a FreeImage bitmap. - - - - Saves a previously loaded FreeImage bitmap to a file. - The format is taken off the filename. - If no suitable format was found false will be returned. - - Handle to a FreeImage bitmap. - The complete name of the file to save to. - The extension will be corrected if it is no valid extension for the - selected format or if no extension was specified. - Returns true on success, false on failure. - - or is null. - - - - Saves a previously loaded FreeImage bitmap to a file. - In case the loading format is - the format is taken off the filename. - If no suitable format was found false will be returned. - - Handle to a FreeImage bitmap. - The complete name of the file to save to. - The extension will be corrected if it is no valid extension for the - selected format or if no extension was specified. - Format of the image. If the format should be taken from the - filename use . - Returns true on success, false on failure. - - or is null. - - - - Saves a previously loaded FreeImage bitmap to a file. - The format is taken off the filename. - If no suitable format was found false will be returned. - - Handle to a FreeImage bitmap. - The complete name of the file to save to. - The extension will be corrected if it is no valid extension for the - selected format or if no extension was specified. - When true the structure will be unloaded on success. - If the function failed and returned false, the bitmap was not unloaded. - Returns true on success, false on failure. - - or is null. - - - - Saves a previously loaded FreeImage bitmap to a file. - The format is taken off the filename. - If no suitable format was found false will be returned. - Save flags can be provided by the flags parameter. - - Handle to a FreeImage bitmap. - The complete name of the file to save to. - The extension will be corrected if it is no valid extension for the - selected format or if no extension was specified - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - or is null. - - - - Saves a previously loaded FreeImage bitmap to a file. - The format is taken off the filename. - If no suitable format was found false will be returned. - Save flags can be provided by the flags parameter. - - Handle to a FreeImage bitmap. - The complete name of the file to save to. - The extension will be corrected if it is no valid extension for the - selected format or if no extension was specified. - Flags to enable or disable plugin-features. - When true the structure will be unloaded on success. - If the function failed and returned false, the bitmap was not unloaded. - Returns true on success, false on failure. - - or is null. - - - - Saves a previously loaded FreeImage bitmap to a file. - In case the loading format is - the format is taken off the filename. - If no suitable format was found false will be returned. - - Handle to a FreeImage bitmap. - The complete name of the file to save to. - The extension will be corrected if it is no valid extension for the - selected format or if no extension was specified. - Format of the image. If the format should be taken from the - filename use . - When true the structure will be unloaded on success. - If the function failed and returned false, the bitmap was not unloaded. - Returns true on success, false on failure. - - or is null. - - - - Saves a previously loaded FreeImage bitmap to a file. - In case the loading format is - the format is taken off the filename. - If no suitable format was found false will be returned. - Save flags can be provided by the flags parameter. - - Handle to a FreeImage bitmap. - The complete name of the file to save to. - The extension will be corrected if it is no valid extension for the - selected format or if no extension was specified. - Format of the image. If the format should be taken from the - filename use . - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - or is null. - - - - Saves a previously loaded FreeImage bitmap to a file. - In case the loading format is - the format is taken off the filename. - If no suitable format was found false will be returned. - Save flags can be provided by the flags parameter. - The bitmaps color depth can be set by 'colorDepth'. - If set to a suitable color depth - will be taken if available. - - Handle to a FreeImage bitmap. - The complete name of the file to save to. - The extension will be corrected if it is no valid extension for the - selected format or if no extension was specified. - Format of the image. If the format should be taken from the - filename use . - Flags to enable or disable plugin-features. - The new color depth of the bitmap. - Set to if Save should take the - best suitable color depth. - If a color depth is selected that the provided format cannot write an - error-message will be thrown. - When true the structure will be unloaded on success. - If the function failed and returned false, the bitmap was not unloaded. - Returns true on success, false on failure. - - A direct color conversion failed. - - or is null. - - - - Loads a FreeImage bitmap. - The stream must be set to the correct position before calling LoadFromStream. - - The stream to read from. - Handle to a FreeImage bitmap. - - is null. - - is not capable of reading. - - - - Loads a FreeImage bitmap. - The stream must be set to the correct position before calling LoadFromStream. - - The stream to read from. - Flags to enable or disable plugin-features. - Handle to a FreeImage bitmap. - - is null. - - is not capable of reading. - - - - Loads a FreeImage bitmap. - In case the loading format is the - bitmaps real format is being analysed. - The stream must be set to the correct position before calling LoadFromStream. - - The stream to read from. - Format of the image. If the format is unknown use - . - In case a suitable format was found by LoadFromStream it will be returned in format. - Handle to a FreeImage bitmap. - - is null. - - is not capable of reading. - - - - Loads a FreeImage bitmap. - In case the loading format is - the bitmaps real format is being analysed. - The stream must be set to the correct position before calling LoadFromStream. - - The stream to read from. - Flags to enable or disable plugin-features. - Format of the image. If the format is unknown use - . - In case a suitable format was found by LoadFromStream it will be returned in format. - Handle to a FreeImage bitmap. - - is null. - - is not capable of reading. - - - - Saves a previously loaded FreeImage bitmap to a stream. - The stream must be set to the correct position before calling SaveToStream. - - Handle to a FreeImage bitmap. - The stream to write to. - Format of the image. - Returns true on success, false on failure. - - or is null. - - cannot write. - - - - Saves a previously loaded FreeImage bitmap to a stream. - The stream must be set to the correct position before calling SaveToStream. - - Handle to a FreeImage bitmap. - The stream to write to. - Format of the image. - When true the structure will be unloaded on success. - Returns true on success, false on failure. - - or is null. - - cannot write. - - - - Saves a previously loaded FreeImage bitmap to a stream. - The stream must be set to the correct position before calling SaveToStream. - - Handle to a FreeImage bitmap. - The stream to write to. - Format of the image. - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - or is null. - - cannot write. - - - - Saves a previously loaded FreeImage bitmap to a stream. - The stream must be set to the correct position before calling SaveToStream. - - Handle to a FreeImage bitmap. - The stream to write to. - Format of the image. - Flags to enable or disable plugin-features. - When true the structure will be unloaded on success. - Returns true on success, false on failure. - - or is null. - - cannot write. - - - - Saves a previously loaded FreeImage bitmap to a stream. - The stream must be set to the correct position before calling SaveToStream. - - Handle to a FreeImage bitmap. - The stream to write to. - Format of the image. - Flags to enable or disable plugin-features. - The new color depth of the bitmap. - Set to if SaveToStream should - take the best suitable color depth. - If a color depth is selected that the provided format cannot write an - error-message will be thrown. - Returns true on success, false on failure. - - or is null. - - cannot write. - - - - Saves a previously loaded FreeImage bitmap to a stream. - The stream must be set to the correct position before calling SaveToStream. - - Handle to a FreeImage bitmap. - The stream to write to. - Format of the image. - Flags to enable or disable plugin-features. - The new color depth of the bitmap. - Set to if SaveToStream should - take the best suitable color depth. - If a color depth is selected that the provided format cannot write an - error-message will be thrown. - When true the structure will be unloaded on success. - Returns true on success, false on failure. - - or is null. - - cannot write. - - - - Checks if an extension is valid for a certain format. - - The desired format. - The desired extension. - True if the extension is valid for the given format, false otherwise. - - is null. - - - - Checks if an extension is valid for a certain format. - - The desired format. - The desired extension. - The string comparison type. - True if the extension is valid for the given format, false otherwise. - - is null. - - - - Checks if a filename is valid for a certain format. - - The desired format. - The desired filename. - True if the filename is valid for the given format, false otherwise. - - is null. - - - - Checks if a filename is valid for a certain format. - - The desired format. - The desired filename. - The string comparison type. - True if the filename is valid for the given format, false otherwise. - - is null. - - - - This function returns the primary (main or most commonly used?) extension of a certain - image format (fif). This is done by returning the first of all possible extensions - returned by GetFIFExtensionList(). - That assumes, that the plugin returns the extensions in ordered form. - The image format to obtain the primary extension for. - The primary extension of the specified image format. - - - - Loads a FreeImage multi-paged bitmap. - - The complete name of the file to load. - Handle to a FreeImage multi-paged bitmap. - - does not exists while opening. - - - - Loads a FreeImage multi-paged bitmap. - - The complete name of the file to load. - When true performance is increased at the cost of memory. - Handle to a FreeImage multi-paged bitmap. - - does not exists while opening. - - - - Loads a FreeImage multi-paged bitmap. - - The complete name of the file to load. - When true the bitmap will be loaded read only. - When true performance is increased at the cost of memory. - Handle to a FreeImage multi-paged bitmap. - - does not exists while opening. - - - - Loads a FreeImage multi-paged bitmap. - - The complete name of the file to load. - When true a new bitmap is created. - When true the bitmap will be loaded read only. - When true performance is increased at the cost of memory. - Handle to a FreeImage multi-paged bitmap. - - does not exists while opening. - - - - Loads a FreeImage multi-paged bitmap. - In case the loading format is the files real - format is being analysed. If no plugin can read the file, format remains - and 0 is returned. - - The complete name of the file to load. - Format of the image. If the format is unknown use - . - In case a suitable format was found by LoadEx it will be returned in format. - When true a new bitmap is created. - When true the bitmap will be loaded read only. - When true performance is increased at the cost of memory. - Handle to a FreeImage multi-paged bitmap. - - does not exists while opening. - - - - Loads a FreeImage multi-paged bitmap. - In case the loading format is the files - real format is being analysed. If no plugin can read the file, format remains - and 0 is returned. - Load flags can be provided by the flags parameter. - - The complete name of the file to load. - Format of the image. If the format is unknown use - . - In case a suitable format was found by LoadEx it will be returned in format. - Flags to enable or disable plugin-features. - When true a new bitmap is created. - When true the bitmap will be loaded read only. - When true performance is increased at the cost of memory. - Handle to a FreeImage multi-paged bitmap. - - does not exists while opening. - - - - Loads a FreeImage multi-paged bitmap. - - The stream to load the bitmap from. - Handle to a FreeImage multi-paged bitmap. - - - - Loads a FreeImage multi-paged bitmap. - In case the loading format is the files - real format is being analysed. If no plugin can read the file, format remains - and 0 is returned. - Load flags can be provided by the flags parameter. - - The stream to load the bitmap from. - Format of the image. If the format is unknown use - . - Flags to enable or disable plugin-features. - Handle to a FreeImage multi-paged bitmap. - - - - Closes a previously opened multi-page bitmap and, when the bitmap was not opened read-only, applies any changes made to it. - - Handle to a FreeImage multi-paged bitmap. - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - - - Closes a previously opened multi-page bitmap and, when the bitmap was not opened read-only, - applies any changes made to it. - On success the handle will be reset to null. - - Handle to a FreeImage multi-paged bitmap. - Returns true on success, false on failure. - - - - Closes a previously opened multi-page bitmap and, when the bitmap was not opened read-only, - applies any changes made to it. - On success the handle will be reset to null. - - Handle to a FreeImage multi-paged bitmap. - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - - - Retrieves the number of pages that are locked in a multi-paged bitmap. - - Handle to a FreeImage multi-paged bitmap. - Number of locked pages. - - is null. - - - - Retrieves a list locked pages of a multi-paged bitmap. - - Handle to a FreeImage multi-paged bitmap. - List containing the indexes of the locked pages. - - is null. - - - - Loads a FreeImage multi-paged bitmap from a stream and returns the - FreeImage memory stream used as temporary buffer. - The bitmap can not be modified by calling - , - , - or - . - - The stream to read from. - Format of the image. - Flags to enable or disable plugin-features. - The temporary memory buffer used to load the bitmap. - Handle to a FreeImage multi-paged bitmap. - - is null. - - can not read. - - - - Orders FreeImage to analyze the bitmap signature. - In case the stream is not seekable, the stream will have been used - and must be recreated for loading. - - Name of the stream to analyze. - Type of the bitmap. - - is null. - - can not read. - - - - Retrieves an hBitmap for a FreeImage bitmap. - Call FreeHbitmap(IntPtr) to free the handle. - - Handle to a FreeImage bitmap. - A reference device context. - Use IntPtr.Zero if no reference is available. - When true dib will be unloaded if the function succeeded. - The hBitmap for the FreeImage bitmap. - - is null. - - - - Returns an HBITMAP created by the CreateDIBitmap() function which in turn - has always the same color depth as the reference DC, which may be provided - through . The desktop DC will be used, - if IntPtr.Zero DC is specified. - Call to free the handle. - - Handle to a FreeImage bitmap. - Handle to a device context. - When true the structure will be unloaded on success. - If the function failed and returned false, the bitmap was not unloaded. - If the function succeeds, the return value is a handle to the - compatible bitmap. If the function fails, the return value is . - - is null. - - - - Creates a FreeImage DIB from a Device Context/Compatible Bitmap. - - Handle to the bitmap. - Handle to a device context. - Handle to a FreeImage bitmap. - - is null. - - - - Frees a bitmap handle. - - Handle to a bitmap. - True on success, false on failure. - - - - Retrieves a DIB's resolution in X-direction measured in 'dots per inch' (DPI) and not in - 'dots per meter'. - - Handle to a FreeImage bitmap. - The resolution in 'dots per inch'. - - is null. - - - - Retrieves a DIB's resolution in Y-direction measured in 'dots per inch' (DPI) and not in - 'dots per meter'. - - Handle to a FreeImage bitmap. - The resolution in 'dots per inch'. - - is null. - - - - Sets a DIB's resolution in X-direction measured in 'dots per inch' (DPI) and not in - 'dots per meter'. - - Handle to a FreeImage bitmap. - The new resolution in 'dots per inch'. - - is null. - - - - Sets a DIB's resolution in Y-direction measured in 'dots per inch' (DPI) and not in - 'dots per meter'. - - Handle to a FreeImage bitmap. - The new resolution in 'dots per inch'. - - is null. - - - - Returns whether the image is a greyscale image or not. - The function scans all colors in the bitmaps palette for entries where - red, green and blue are not all the same (not a grey color). - Supports 1-, 4- and 8-bit bitmaps. - - Handle to a FreeImage bitmap. - True if the image is a greyscale image, else false. - - is null. - - - - Returns a structure that represents the palette of a FreeImage bitmap. - - Handle to a FreeImage bitmap. - A structure representing the bitmaps palette. - - is null. - - - - Returns the structure of a FreeImage bitmap. - The structure is a copy, so changes will have no effect on - the bitmap itself. - - Handle to a FreeImage bitmap. - structure of the bitmap. - - is null. - - - - Returns the structure of a FreeImage bitmap. - The structure is a copy, so changes will have no effect on - the bitmap itself. - - Handle to a FreeImage bitmap. - structure of the bitmap. - - is null. - - - - Returns the pixelformat of the bitmap. - - Handle to a FreeImage bitmap. - of the bitmap. - - is null. - - - - Retrieves all parameters needed to create a new FreeImage bitmap from - the format of a .NET . - - The - of the .NET . - Returns the type used for the new bitmap. - Returns the color depth for the new bitmap. - Returns the red_mask for the new bitmap. - Returns the green_mask for the new bitmap. - Returns the blue_mask for the new bitmap. - True in case a matching conversion exists; else false. - - - - - Returns the for the specified - . - - The - for which to return the corresponding . - The for the specified - - - - - Retrieves all parameters needed to create a new FreeImage bitmap from - raw bits . - - The - of the data in memory. - The color depth for the data. - Returns the red_mask for the data. - Returns the green_mask for the data. - Returns the blue_mask for the data. - True in case a matching conversion exists; else false. - - - - - Compares two FreeImage bitmaps. - - The first bitmap to compare. - The second bitmap to compare. - Determines which components of the bitmaps will be compared. - True in case both bitmaps match the compare conditions, false otherwise. - - - - Returns the FreeImage bitmap's transparency table. - The array is empty in case the bitmap has no transparency table. - - Handle to a FreeImage bitmap. - The FreeImage bitmap's transparency table. - - is null. - - - - Set the FreeImage bitmap's transparency table. Only affects palletised bitmaps. - - Handle to a FreeImage bitmap. - The FreeImage bitmap's new transparency table. - - or is null. - - - - This function returns the number of unique colors actually used by the - specified 1-, 4-, 8-, 16-, 24- or 32-bit image. This might be different from - what function FreeImage_GetColorsUsed() returns, which actually returns the - palette size for palletised images. Works for - type images only. - - Handle to a FreeImage bitmap. - Returns the number of unique colors used by the image specified or - zero, if the image type cannot be handled. - - is null. - - - - Verifies whether the FreeImage bitmap is 16bit 555. - - The FreeImage bitmap to verify. - true if the bitmap is RGB16-555; otherwise false. - - - - Verifies whether the FreeImage bitmap is 16bit 565. - - The FreeImage bitmap to verify. - true if the bitmap is RGB16-565; otherwise false. - - - - Creates a new ICC-Profile for a FreeImage bitmap. - - Handle to a FreeImage bitmap. - The data of the new ICC-Profile. - The new ICC-Profile of the bitmap. - - is null. - - - - Creates a new ICC-Profile for a FreeImage bitmap. - - Handle to a FreeImage bitmap. - The data of the new ICC-Profile. - The number of bytes of to use. - The new ICC-Profile of the FreeImage bitmap. - - is null. - - - - Converts a FreeImage bitmap from one color depth to another. - If the conversion fails the original FreeImage bitmap is returned. - - Handle to a FreeImage bitmap. - The desired output format. - Handle to a FreeImage bitmap. - - is null. - - - - Converts a FreeImage bitmap from one color depth to another. - If the conversion fails the original FreeImage bitmap is returned. - - Handle to a FreeImage bitmap. - The desired output format. - When true the structure will be unloaded on success. - Handle to a FreeImage bitmap. - - is null. - - - - Converts a FreeImage bitmap from one color depth to another. - If the conversion fails the original FreeImage bitmap is returned. - - Handle to a FreeImage bitmap. - The desired output format. - Threshold value when converting with - . - Handle to a FreeImage bitmap. - - is null. - - - - Converts a FreeImage bitmap from one color depth to another. - If the conversion fails the original FreeImage bitmap is returned. - - Handle to a FreeImage bitmap. - The desired output format. - Dither algorithm when converting - with . - Handle to a FreeImage bitmap. - - is null. - - - - Converts a FreeImage bitmap from one color depth to another. - If the conversion fails the original FreeImage bitmap is returned. - - Handle to a FreeImage bitmap. - The desired output format. - The quantization algorithm for conversion to 8-bit color depth. - Handle to a FreeImage bitmap. - - is null. - - - - Converts a FreeImage bitmap from one color depth to another. - If the conversion fails the original FreeImage bitmap is returned. - - Handle to a FreeImage bitmap. - The desired output format. - Threshold value when converting with - . - When true the structure will be unloaded on success. - Handle to a FreeImage bitmap. - - is null. - - - - Converts a FreeImage bitmap from one color depth to another. - If the conversion fails the original FreeImage bitmap is returned. - - Handle to a FreeImage bitmap. - The desired output format. - Dither algorithm when converting with - . - When true the structure will be unloaded on success. - Handle to a FreeImage bitmap. - - is null. - - - - Converts a FreeImage bitmap from one color depth to another. - If the conversion fails the original FreeImage bitmap is returned. - - Handle to a FreeImage bitmap. - The desired output format. - The quantization algorithm for conversion to 8-bit color depth. - When true the structure will be unloaded on success. - Handle to a FreeImage bitmap. - - is null. - - - - Converts a FreeImage bitmap from one color depth to another. - If the conversion fails the original FreeImage bitmap is returned. - - Handle to a FreeImage bitmap. - The desired output format. - Threshold value when converting with - . - Dither algorithm when converting with - . - The quantization algorithm for conversion to 8-bit color depth. - When true the structure will be unloaded on success. - Handle to a FreeImage bitmap. - - is null. - - - - ColorQuantizeEx is an extension to the - method that provides additional options used to quantize a 24-bit image to any - number of colors (up to 256), as well as quantize a 24-bit image using a - provided palette. - - Handle to a FreeImage bitmap. - Specifies the color reduction algorithm to be used. - Size of the desired output palette. - The provided palette. - true to create a bitmap with the smallest possible - color depth for the specified . - Handle to a FreeImage bitmap. - - - - ColorQuantizeEx is an extension to the - method that provides additional options used to quantize a 24-bit image to any - number of colors (up to 256), as well as quantize a 24-bit image using a - partial or full provided palette. - - Handle to a FreeImage bitmap. - Specifies the color reduction algorithm to be used. - Size of the desired output palette. - The provided palette. - The desired color depth of the created image. - Handle to a FreeImage bitmap. - - - - Copies metadata from one FreeImage bitmap to another. - - Source FreeImage bitmap containing the metadata. - FreeImage bitmap to copy the metadata to. - Flags to switch different copy modes. - Returns -1 on failure else the number of copied tags. - - or is null. - - - - Returns the comment of a JPEG, PNG or GIF image. - - Handle to a FreeImage bitmap. - Comment of the FreeImage bitmp, or null in case no comment exists. - - is null. - - - - Sets the comment of a JPEG, PNG or GIF image. - - Handle to a FreeImage bitmap. - New comment of the FreeImage bitmap. - Use null to remove the comment. - Returns true on success, false on failure. - - is null. - - - - Retrieve a metadata attached to a FreeImage bitmap. - - The metadata model to look for. - Handle to a FreeImage bitmap. - The metadata field name. - A structure returned by the function. - Returns true on success, false on failure. - - is null. - - - - Attach a new metadata tag to a FreeImage bitmap. - - The metadata model used to store the tag. - Handle to a FreeImage bitmap. - The tag field name. - The to be attached. - Returns true on success, false on failure. - - is null. - - - - Provides information about the first instance of a tag that matches the metadata model. - - The model to match. - Handle to a FreeImage bitmap. - Tag that matches the metadata model. - Unique search handle that can be used to call FindNextMetadata or FindCloseMetadata. - Null if the metadata model does not exist. - - is null. - - - - Find the next tag, if any, that matches the metadata model argument in a previous call - to FindFirstMetadata, and then alters the tag object contents accordingly. - - Unique search handle provided by FindFirstMetadata. - Tag that matches the metadata model. - Returns true on success, false on failure. - - - - Closes the specified metadata search handle and releases associated resources. - - The handle to close. - - - - This dictionary links FIMETADATA handles and FREE_IMAGE_MDMODEL models. - - - - - This function rotates a 1-, 8-bit greyscale or a 24-, 32-bit color image by means of 3 shears. - 1-bit images rotation is limited to integer multiple of 90? - null is returned for other values. - - Handle to a FreeImage bitmap. - The angle of rotation. - Handle to a FreeImage bitmap. - - - - This function rotates a 1-, 8-bit greyscale or a 24-, 32-bit color image by means of 3 shears. - 1-bit images rotation is limited to integer multiple of 90? - null is returned for other values. - - The type of the color to use as background. - Handle to a FreeImage bitmap. - The angle of rotation. - The color used used to fill the bitmap's background. - Handle to a FreeImage bitmap. - - - - Rotates a 4-bit color FreeImage bitmap. - Allowed values for are 90, 180 and 270. - In case is 0 or 360 a clone is returned. - 0 is returned for other values or in case the rotation fails. - - Handle to a FreeImage bitmap. - The angle of rotation. - Handle to a FreeImage bitmap. - - This function is kind of temporary due to FreeImage's lack of - rotating 4-bit images. It's particularly used by 's - method RotateFlip. This function will be removed as soon as FreeImage - supports rotating 4-bit images. - - - is null. - - - - Enlarges or shrinks the FreeImage bitmap selectively per side and fills newly added areas - with the specified background color. See remarks for further details. - - The type of the specified color. - Handle to a FreeImage bitmap. - The number of pixels, the image should be enlarged on its left side. - Negative values shrink the image on its left side. - The number of pixels, the image should be enlarged on its top side. - Negative values shrink the image on its top side. - The number of pixels, the image should be enlarged on its right side. - Negative values shrink the image on its right side. - The number of pixels, the image should be enlarged on its bottom side. - Negative values shrink the image on its bottom side. - The color, the enlarged sides of the image should be filled with. - Options that affect the color search process for palletized images. - Handle to a FreeImage bitmap. - - This function enlarges or shrinks an image selectively per side. - The main purpose of this function is to add borders to an image. - To add a border to any of the image's sides, a positive integer value must be passed in - any of the parameters , , - or . This value represents the border's - width in pixels. Newly created parts of the image (the border areas) are filled with the - specified . - Specifying a negative integer value for a certain side, will shrink or crop the image on - this side. Consequently, specifying zero for a certain side will not change the image's - extension on that side. - - So, calling this function with all parameters , , - and set to zero, is - effectively the same as calling function ; setting all parameters - , , and - to value equal to or smaller than zero, my easily be substituted - by a call to function . Both these cases produce a new image, which is - guaranteed not to be larger than the input image. Thus, since the specified - is not needed in these cases, - may be null. - - Both parameters and work according to - function . So, please refer to the documentation of - to learn more about parameters - and . For palletized images, the palette of the input image is - transparently copied to the newly created enlarged or shrunken image, so any color look-ups - are performed on this palette. - - - // create a white color
    - RGBQUAD c;
    - c.rgbRed = 0xFF;
    - c.rgbGreen = 0xFF;
    - c.rgbBlue = 0xFF;
    - c.rgbReserved = 0x00;
    -
    - // add a white, symmetric 10 pixel wide border to the image
    - dib2 = FreeImage_EnlargeCanvas(dib, 10, 10, 10, 10, c, FREE_IMAGE_COLOR_OPTIONS.FICO_RGB);
    -
    - // add white, 20 pixel wide stripes to the top and bottom side of the image
    - dib3 = FreeImage_EnlargeCanvas(dib, 0, 20, 0, 20, c, FREE_IMAGE_COLOR_OPTIONS.FICO_RGB);
    -
    - // add white, 30 pixel wide stripes to the right side of the image and
    - // cut off the 40 leftmost pixel columns
    - dib3 = FreeImage_EnlargeCanvas(dib, -40, 0, 30, 0, c, FREE_IMAGE_COLOR_OPTIONS.FICO_RGB);
    -
    -
    - - - Sets all pixels of the specified image to the color provided through the - parameter. See remarks for further details. - - The type of the specified color. - Handle to a FreeImage bitmap. - The color to fill the bitmap with. See remarks for further details. - Options that affect the color search process for palletized images. - true on success, false on failure. - - This function sets all pixels of an image to the color provided through - the parameter. is used for standard type images. - For non standard type images the underlaying structure is used. - - So, must be of type , if the image to be filled is of type - and must be a structure if the - image is of type and so on. - - However, the fill color is always specified through a structure - for all images of type . - So, for 32- and 24-bit images, the red, green and blue members of the - structure are directly used for the image's red, green and blue channel respectively. - Although alpha transparent colors are - supported, the alpha channel of a 32-bit image never gets modified by this function. - A fill color with an alpha value smaller than 255 gets blended with the image's actual - background color, which is determined from the image's bottom-left pixel. - So, currently using alpha enabled colors, assumes the image to be unicolor before the - fill operation. However, the field is only taken into account, - if option has been specified. - - For 16-bit images, the red-, green- and blue components of the specified color are - transparently translated into either the 16-bit 555 or 565 representation. This depends - on the image's actual red- green- and blue masks. - - Special attention must be payed for palletized images. Generally, the RGB color specified - is looked up in the image's palette. The found palette index is then used to fill the image. - There are some option flags, that affect this lookup process: - - - Value - Meaning - - - - - Uses the color, that is nearest to the specified color. - This is the default behavior and should always find a - color in the palette. However, the visual result may - far from what was expected and mainly depends on the - image's palette. - - - - - - Searches the image's palette for the specified color - but only uses the returned palette index, if the specified - color exactly matches the palette entry. Of course, - depending on the image's actual palette entries, this - operation may fail. In this case, the function falls back - to option - and uses the RGBQUAD's rgbReserved member (or its low nibble for 4-bit images - or its least significant bit (LSB) for 1-bit images) as - the palette index used for the fill operation. - - - - - - Does not perform any color lookup from the palette, but - uses the RGBQUAD's alpha channel member rgbReserved as - the palette index to be used for the fill operation. - However, for 4-bit images, only the low nibble of the - rgbReserved member are used and for 1-bit images, only - the least significant bit (LSB) is used. - - - - - - - - Returns the next higher possible color depth. - - Color depth to increase. - The next higher color depth or 0 if there is no valid color depth. - - - - Returns the next lower possible color depth. - - Color depth to decrease. - The next lower color depth or 0 if there is no valid color depth. - - - - Reads a null-terminated c-string. - - Pointer to the first char of the string. - The converted string. - - - - Changes a bitmaps color depth. - Used by SaveEx and SaveToStream. - - - - - Compares blocks of memory. - - A pointer to a block of memory to compare. - A pointer to a block of memory to compare. - Specifies the number of bytes to be compared. - true, if all bytes compare as equal, false otherwise. - - - - Compares blocks of memory. - - A pointer to a block of memory to compare. - A pointer to a block of memory to compare. - Specifies the number of bytes to be compared. - true, if all bytes compare as equal, false otherwise. - - - - Compares blocks of memory. - - A pointer to a block of memory to compare. - A pointer to a block of memory to compare. - Specifies the number of bytes to be compared. - true, if all bytes compare as equal, false otherwise. - - - - Compares blocks of memory. - - A pointer to a block of memory to compare. - A pointer to a block of memory to compare. - Specifies the number of bytes to be compared. - true, if all bytes compare as equal, false otherwise. - - - - Moves a block of memory from one location to another. - - A pointer to the starting address of the move destination. - A pointer to the starting address of the block of memory to be moved. - The size of the block of memory to move, in bytes. - - - - Moves a block of memory from one location to another. - - A pointer to the starting address of the move destination. - A pointer to the starting address of the block of memory to be moved. - The size of the block of memory to move, in bytes. - - - - Moves a block of memory from one location to another. - - A pointer to the starting address of the move destination. - A pointer to the starting address of the block of memory to be moved. - The size of the block of memory to move, in bytes. - - - - Copies a block of memory from one location to another. - - A pointer to the starting address of the copied block's destination. - A pointer to the starting address of the block of memory to copy. - The size of the block of memory to copy, in bytes. - - CopyMemory runs faster than . - However, if both blocks overlap the result is undefined. - - - - - Copies a block of memory from one location to another. - - A pointer to the starting address of the copied block's destination. - A pointer to the starting address of the block of memory to copy. - The size of the block of memory to copy, in bytes. - - CopyMemory runs faster than . - However, if both blocks overlap the result is undefined. - - - - - Copies a block of memory from one location to another. - - A pointer to the starting address of the copied block's destination. - A pointer to the starting address of the block of memory to copy. - The size of the block of memory to copy, in bytes. - - CopyMemory runs faster than . - However, if both blocks overlap the result is undefined. - - - - - Copies a block of memory from one location to another. - - A pointer to the starting address of the copied block's destination. - A pointer to the starting address of the block of memory to copy. - The size of the block of memory to copy, in bytes. - - CopyMemory runs faster than . - However, if both blocks overlap the result is undefined. - - - - - Copies a block of memory from one location to another. - - A pointer to the starting address of the copied block's destination. - A pointer to the starting address of the block of memory to copy. - The size of the block of memory to copy, in bytes. - - CopyMemory runs faster than . - However, if both blocks overlap the result is undefined. - - - - - Copies a block of memory from one location to another. - - A pointer to the starting address of the copied block's destination. - A pointer to the starting address of the block of memory to copy. - The size of the block of memory to copy, in bytes. - - CopyMemory runs faster than . - However, if both blocks overlap the result is undefined. - - - - - Copies a block of memory into an array. - - An array used as the destination of the copy process. - A pointer to the starting address of the block of memory to copy. - The size of the block of memory to copy, in bytes. - - - - Copies a block of memory into an array. - - An array used as the destination of the copy process. - A pointer to the starting address of the block of memory to copy. - The size of the block of memory to copy, in bytes. - - - - Copies a block of memory into an array. - - An array used as the destination of the copy process. - A pointer to the starting address of the block of memory to copy. - The size of the block of memory to copy, in bytes. - - - - Copies a block of memory into an array. - - An array used as the destination of the copy process. - A pointer to the starting address of the block of memory to copy. - The size of the block of memory to copy, in bytes. - - - - Copies the content of an array to a memory location. - - A pointer to the starting address of the copied block's destination. - An array used as the source of the copy process. - The size of the block of memory to copy, in bytes. - - - - Copies the content of an array to a memory location. - - A pointer to the starting address of the copied block's destination. - An array used as the source of the copy process. - The size of the block of memory to copy, in bytes. - - - - Copies the content of an array to a memory location. - - A pointer to the starting address of the copied block's destination. - An array used as the source of the copy process. - The size of the block of memory to copy, in bytes. - - - - Copies the content of an array to a memory location. - - A pointer to the starting address of the copied block's destination. - An array used as the source of the copy process. - The size of the block of memory to copy, in bytes. - - - - Copies the content of one array into another array. - - An array used as the destination of the copy process. - An array used as the source of the copy process. - The size of the content to copy, in bytes. - - - - Copies the content of one array into another array. - - An array used as the destination of the copy process. - An array used as the source of the copy process. - The size of the content to copy, in bytes. - - - - Retrieves a handle to a display device context (DC) for the client area of a specified window - or for the entire screen. You can use the returned handle in subsequent GDI functions to draw in the DC. - - Handle to the window whose DC is to be retrieved. - If this value is IntPtr.Zero, GetDC retrieves the DC for the entire screen. - If the function succeeds, the return value is a handle to the DC for the specified window's client area. - If the function fails, the return value is NULL. - - - - Releases a device context (DC), freeing it for use by other applications. - The effect of the ReleaseDC function depends on the type of DC. It frees only common and window DCs. - It has no effect on class or private DCs. - - Handle to the window whose DC is to be released. - Handle to the DC to be released. - Returns true on success, false on failure. - - - - Creates a DIB that applications can write to directly. - The function gives you a pointer to the location of the bitmap bit values. - You can supply a handle to a file-mapping object that the function will use to create the bitmap, - or you can let the system allocate the memory for the bitmap. - - Handle to a device context. - Pointer to a BITMAPINFO structure that specifies various attributes of the DIB, - including the bitmap dimensions and colors. - Specifies the type of data contained in the bmiColors array member of the BITMAPINFO structure - pointed to by pbmi (either logical palette indexes or literal RGB values). - Pointer to a variable that receives a pointer to the location of the DIB bit values. - Handle to a file-mapping object that the function will use to create the DIB. - This parameter can be NULL. - Specifies the offset from the beginning of the file-mapping object referenced by hSection - where storage for the bitmap bit values is to begin. This value is ignored if hSection is NULL. - If the function succeeds, the return value is a handle to the newly created DIB, - and *ppvBits points to the bitmap bit values. If the function fails, the return value is NULL, and *ppvBits is NULL. - - - - Deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object. - After the object is deleted, the specified handle is no longer valid. - - Handle to a logical pen, brush, font, bitmap, region, or palette. - Returns true on success, false on failure. - - - - Creates a compatible bitmap (DDB) from a DIB and, optionally, sets the bitmap bits. - - Handle to a device context. - Pointer to a bitmap information header structure. - Specifies how the system initializes the bitmap bits - (use 4). - Pointer to an array of bytes containing the initial bitmap data. - Pointer to a BITMAPINFO structure that describes the dimensions - and color format of the array pointed to by the lpbInit parameter. - Specifies whether the bmiColors member of the BITMAPINFO structure - was initialized - (use 0). - Handle to a DIB or null on failure. - - - - Retrieves information for the specified graphics object. - - Handle to the graphics object of interest. - Specifies the number of bytes of information to - be written to the buffer. - Pointer to a buffer that receives the information - about the specified graphics object. - 0 on failure. - - - - Retrieves the bits of the specified compatible bitmap and copies them into a buffer - as a DIB using the specified format. - - Handle to the device context. - Handle to the bitmap. This must be a compatible bitmap (DDB). - Specifies the first scan line to retrieve. - Specifies the number of scan lines to retrieve. - Pointer to a buffer to receive the bitmap data. - Pointer to a BITMAPINFO structure that specifies the desired - format for the DIB data. - Specifies the format of the bmiColors member of the - BITMAPINFO structure - (use 0). - 0 on failure. - - - - Moves a block of memory from one location to another. - - Pointer to the starting address of the move destination. - Pointer to the starting address of the block of memory to be moved. - Size of the block of memory to move, in bytes. - - - - The RtlCompareMemory routine compares blocks of memory - and returns the number of bytes that are equivalent. - - A pointer to a block of memory to compare. - A pointer to a block of memory to compare. - Specifies the number of bytes to be compared. - RtlCompareMemory returns the number of bytes that compare as equal. - If all bytes compare as equal, the input Length is returned. - - - - The FITAG structure is a handle to a FreeImage metadata tag. - - - - - A read-only field that represents a handle that has been initialized to zero. - - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Gets whether the pointer is a null pointer or not. - - true if this is a null pointer; - otherwise, false. - - - - Sets the handle to null. - - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Determines whether the specified is equal to the current . - - The to compare with the current . - true if the specified is equal to the current ; otherwise, false. - - - - Indicates whether the current object is equal to another object of the same type. - - An object to compare with this object. - true if the current object is equal to the other parameter; otherwise, false. - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - The FIURational structure represents a fraction via two - instances which are interpreted as numerator and denominator. - - - The structure tries to approximate the value of - when creating a new instance by using a better algorithm than FreeImage does. - - The structure implements the following operators: - +, ++, --, ==, != , >, >==, <, <== and ~ (which switches nominator and denomiator). - - The structure can be converted into all .NET standard types either implicit or - explicit. - - - - - Represents the largest possible value of . This field is constant. - - - - - Represents the smallest possible value of . This field is constant. - - - - - Represents the smallest positive value greater than zero. This field is constant. - - - - - Initializes a new instance based on the specified parameters. - - The numerator. - The denominator. - - - - Initializes a new instance based on the specified parameters. - - The tag to read the data from. - - - - Initializes a new instance based on the specified parameters. - - The value to convert into a fraction. - - cannot be converted into a fraction - represented by two unsigned integer values. - - - - The numerator of the fraction. - - - - - The denominator of the fraction. - - - - - Returns the truncated value of the fraction. - - - - - - Returns whether the fraction is representing an integer value. - - - - - Calculated the greatest common divisor of 'a' and 'b'. - - - - - Calculated the smallest common multiple of 'a' and 'b'. - - - - - Normalizes the fraction. - - - - - Normalizes a fraction. - - - - - Returns the digits after the point. - - - - - Creates a continued fraction of a decimal value. - - - - - Creates a fraction from a continued fraction. - - - - - Tries 'brute force' to approximate with a fraction. - - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Standard implementation of the operator. - - - - - Returns the reciprocal value of this instance. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Formats the value of the current instance using the specified format. - - The String specifying the format to use. - The IFormatProvider to use to format the value. - A String containing the value of the current instance in the specified format. - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - The FI4BIT structure represents the half of a . - It's valuerange is between 0 and 15. - - - - - Represents the largest possible value of . This field is constant. - - - - - Represents the smallest possible value of . This field is constant. - - - - - The value of the structure. - - - - - Initializes a new instance based on the specified value. - - The value to initialize with. - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - The RGBQUAD structure describes a color consisting of relative - intensities of red, green, blue and alpha value. Each single color - component consumes 8 bits and so, takes values in the range from 0 to 255. - - - - The RGBQUAD structure provides access to an underlying Win32 RGBQUAD - structure. To determine the alpha, red, green or blue component of a color, - use the rgbReserved, rgbRed, rgbGreen or rgbBlue fields, respectively. - - For easy integration of the underlying structure into the .NET framework, - the RGBQUAD structure implements implicit conversion operators to - convert the represented color to and from the - type. This makes the type a real replacement - for the RGBQUAD structure and my be used in all situations which require - an RGBQUAD type. - - - Each color component rgbReserved, rgbRed, rgbGreen or rgbBlue of RGBQUAD - is translated into it's corresponding color component A, R, G or B of - by an one-to-one manner and vice versa. - - - Conversion from System.Drawing.Color to RGBQUAD - - RGBQUAD.component = Color.component - - Conversion from RGBQUAD to System.Drawing.Color - - Color.component = RGBQUAD.component - - The same conversion is also applied when the - property or the constructor - is invoked. - - - - The following code example demonstrates the various conversions between the - RGBQUAD structure and the structure. - - RGBQUAD rgbq; - // Initialize the structure using a native .NET Color structure. - rgbq = new RGBQUAD(Color.Indigo); - // Initialize the structure using the implicit operator. - rgbq = Color.DarkSeaGreen; - // Convert the RGBQUAD instance into a native .NET Color - // using its implicit operator. - Color color = rgbq; - // Using the structure's Color property for converting it - // into a native .NET Color. - Color another = rgbq.Color; - - - - - - The blue color component. - - - - - The green color component. - - - - - The red color component. - - - - - The alpha color component. - - - - - The color's value. - - - - - Initializes a new instance based on the specified . - - to initialize with. - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a Color structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Gets or sets the of the structure. - - - - - Converts an array of into an array of - . - - The array to convert. - An array of . - - - - Converts an array of into an array of - . - - The array to convert. - An array of . - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - The RGBTRIPLE structure describes a color consisting of relative - intensities of red, green and blue value. Each single color component - consumes 8 bits and so, takes values in the range from 0 to 255. - - - - The RGBTRIPLE structure provides access to an underlying Win32 RGBTRIPLE - structure. To determine the red, green or blue component of a color, use the - rgbtRed, rgbtGreen or rgbtBlue fields, respectively. - - For easy integration of the underlying structure into the .NET framework, - the RGBTRIPLE structure implements implicit conversion operators to - convert the represented color to and from the - type. This makes the type a real replacement - for the RGBTRIPLE structure and my be used in all situations which require - an RGBTRIPLE type. - - - Each of the color components rgbtRed, rgbtGreen or rgbtBlue of RGBTRIPLE is - translated into it's corresponding color component R, G or B of - by an one-to-one manner and vice versa. - When converting from into RGBTRIPLE, the - color's alpha value is ignored and assumed to be 255 when converting from - RGBTRIPLE into , creating a fully - opaque color. - - - Conversion from System.Drawing.Color to RGBTRIPLE - - RGBTRIPLE.component = Color.component - - Conversion from RGBTRIPLE to System.Drawing.Color - - Color.component = RGBTRIPLE.component - - The same conversion is also applied when the - property or the constructor - is invoked. - - - - The following code example demonstrates the various conversions between the - RGBTRIPLE structure and the structure. - - RGBTRIPLE rgbt; - // Initialize the structure using a native .NET Color structure. - rgbt = new RGBTRIPLE(Color.Indigo); - // Initialize the structure using the implicit operator. - rgbt = Color.DarkSeaGreen; - // Convert the RGBTRIPLE instance into a native .NET Color - // using its implicit operator. - Color color = rgbt; - // Using the structure's Color property for converting it - // into a native .NET Color. - Color another = rgbt.Color; - - - - - - The blue color component. - - - - - The green color component. - - - - - The red color component. - - - - - Initializes a new instance based on the specified . - - to initialize with. - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Gets or sets the of the structure. - - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified structure is equivalent to this - structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - -
    -
    diff --git a/pdfpatcher/App/Lib/FreeImageNET.dll b/pdfpatcher/App/Lib/FreeImageNET.dll deleted file mode 100644 index 59f722a33a6f08cade897dd808539ae447e4294a..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Lib/FreeImageNET.dll and /dev/null differ diff --git a/pdfpatcher/App/Lib/HtmlRenderer.WinForms.dll b/pdfpatcher/App/Lib/HtmlRenderer.WinForms.dll deleted file mode 100644 index 85c80355a52f53819d83ff5d3f76f79589ee225a..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Lib/HtmlRenderer.WinForms.dll and /dev/null differ diff --git a/pdfpatcher/App/Lib/HtmlRenderer.dll b/pdfpatcher/App/Lib/HtmlRenderer.dll deleted file mode 100644 index d6b6e2bf0d0fb012bc119071149708be788417cf..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Lib/HtmlRenderer.dll and /dev/null differ diff --git a/pdfpatcher/App/Lib/JacksonSoft.CustomTabControl.dll b/pdfpatcher/App/Lib/JacksonSoft.CustomTabControl.dll deleted file mode 100644 index 6065607d55597b97e6bdeee1cfff7ebe0a3858a2..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Lib/JacksonSoft.CustomTabControl.dll and /dev/null differ diff --git a/pdfpatcher/App/Lib/MuPDFLib.dll b/pdfpatcher/App/Lib/MuPDFLib.dll deleted file mode 100644 index 093b282a22cb2c26b6e09c337a51fdb5efde5b28..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Lib/MuPDFLib.dll and /dev/null differ diff --git a/pdfpatcher/App/Lib/PowerJSON.XML b/pdfpatcher/App/Lib/PowerJSON.XML deleted file mode 100644 index 152bc060fecac1bc770ea61980cbe490e092e145..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Lib/PowerJSON.XML +++ /dev/null @@ -1,1985 +0,0 @@ - - - - PowerJson - - - - - A serializer that directly writes out JSON from . - - - - - Writes the JSON array representation from an to the output . - - The data to be serialized. - The output target. - The to control advanced JSON serialization. - - - - Turns an collection into an . - - - - - Creates an instance from a given instance. - - The type of the data. - The data to be read. - An instance. - - - - Experimental Feature: - Converts instances into for . - - References: - 1) https://github.com/matthewschrager/Repository/blob/master/Repository.EntityFramework/EntityDataReader.cs; - 2) http://www.codeproject.com/Articles/876276/Bulk-Insert-Into-SQL-From-Csharp - The data type in the data source. - - - - Initializes a new instance of the class. - - The collection to be exported. - - - - Initializes a new instance of the class. - - The collection. - if set to true, read-only values will be exported to the . - This exception will be thrown when is a scalar type. - - - - Closes the reader. - - - - - Gets the depth of the reader (0 is always returned). - - - - - Gets the schema table. - - The schema table containing the following columns for each member: ColumnName, ColumnOrdinal, DataType, DataTypeName, ColumnSize. - - - - Gets a value indicating whether this instance is closed. - - - true if this instance is closed; otherwise, false. - - - - - Proceed to the next result. - - Always returns false. - - - - Reads an object in the collection. - - True if there is an object being read, otherwise, false. - The instance is disposed. - - - - Gets the records affected (always returns -1). - - - - - Dispose the internal collection enumerator. - - - - - Gets the field count. - - - - - Gets a boolean value at the specific index. - - The index of the field. - The value. - - - - Gets a byte value at the specific index. - - The index of the field. - The value. - - - - Gets the bytes at the specific index. - - The index of the field. - The field offset. - The buffer. - The buffer offset. - The length to read. - The number of bytes copied into the buffer. - - - - Gets a value at the specific index. - - The index of the field. - The value. - - - - Gets a array at the specific index. - - The index of the field. - The field offset. - The buffer. - The buffer offset. - The length to read. - The number of bytes copied into the buffer. - - - - This method is not implemented. - - The index of the field. - - - - - - Gets the name of the data type. - - The index of the field. - - - - - Gets a value at the specific index. - - The index of the field. - The value. - - - - Gets a value at the specific index. - - The index of the field. - The value. - - - - Gets a value at the specific index. - - The index of the field. - The value. - - - - Gets the type of the field. - - The index of the field. - The of the member at specific field index. - - - - Gets a value at the specific index. - - The index of the field. - The value. - - - - Gets a value at the specific index. - - The index of the field. - The value. - - - - Gets a value at the specific index. - - The index of the field. - The value. - - - - Gets a value at the specific index. - - The index of the field. - The value. - - - - Gets a value at the specific index. - - The index of the field. - The value. - - - - Gets the name of the field. - - The index of the field. - The member name at the specific index. - - - - Gets the ordinal index of a member. - - The name of the member. - The field index of the member. - - - - Gets a value at the specific index. - - The index of the field. - The value. - - - - Gets the value at the specific index. - - The index of the field. - The value. - - - - Loads all values into the array. - - The array which holds the field values. - The number of fields loaded into the array. - - - - Determines whether the field at the specific index is . - - The index of the field. - True if the value is - - - - Gets the value of a member with the specified name. - - The name of the field. - The value of the member with the specific name. - - - - Gets the value of a member at the specified index. - - The index of the field. - The value of a member at the specified index. - - - - An which converts between and string. - - - - - An which converts between and string. - - - - - A to convert to JSON strings. Currently deserialization has not yet been implemented. - - - - - A converts boolean values to 1/0 or "1"/"0", rather than the default "true" and "false" values. - - - - - Creates an instance of . - - - - - Creates an instance of , specifying whether the boolean values should be serialized to textual "1"/"0" values. - - When this value is true, the boolean values will be serialized to textual "1"/"0" values. - - - - Gets whether the boolean values should be serialized to textual "1"/"0" values. - - - - - Controls the naming format of serialized enum values. - - - - - The serialized names will be the same as the field name. - - - - - All letters in the serialized names will be changed to lowercase. - - - - - The first letter of each serialized names will be changed to lowercase. - - - - - All letters in the serialized names will be changed to uppercase. - - - - - Enum fields will be serialized numerically. - - - - - Controls the letter case of serialized field names. - - - - - The letter case of the serialized field names will be the same as the field or member name. - - - - - All letters in the serialized field names will be changed to lowercase. - - - - - The first letter of each serialized field names will be changed to lowercase. - - - - - All letters in the serialized field names will be changed to uppercase. - - - - Indicates the state of a setting. - - - Represents the normal behavior. - - - Represents a positive setting. Actions should be taken to the object. - - - Represents a negative setting. Actions may not be taken to the object. - - - - Contains extra s to help serializing extra types. Those converters will not automatically get effective unless they are applied to corresponding types via the method or members via the method. - - - - - - Gets an to convert instances. - - - - - Gets an to convert instances. - - - - - Gets an to convert instances to numeric 1 or 0 rather than the default "true", "false" values. - - - - - Gets an to convert instances to literal "1" or "0" rather than the default "true", "false" values. - - - - - Gets an to convert instances. - - - - - Gets an to convert instances. - - - - - Gets an to convert instances. - - - - - Gets an to serialize or instances. NOTICE: Deserialization is not supported at this moment. - - - Elements will be serialized as a dictionary which contains the following three items: - - XML NodeSerialization Result - Element nameA dictionary entry with a name as the element qualified name surrounded with < and > and the value is its namespace URL. - AttributesA dictionary entry with a name as the attribute name prefixed with an "@" character, and the value of the attribute. - NodesAn array contains the child nodes of the element. The array can contain the following node types and child elements. - Text, CDATA, Entity referenceA text in the nodes array. - Processing Instruction, XML declarationA dictionary containing one name-value pair in the nodes array. - CommentA dictionary in the nodes array with a name "!" and a value as the content of the comment. - - - - - - Converts the member value being serialized or deserialized. - - - During deserialization, the JSON string is parsed and converted to primitive data. - The data could be one of the following six types returned from the JSON Parser: , , , , and . - The method should be able to process the above six types, as well as the null value, and convert the value to match the type of the member being deserialized. - If the method returns a instead of null or the type of , the deserializer will firstly attempt to revert the primitive data to match that type, and then pass the reverted value to the method. - By this means, the implementation of method does not have to cope with primitive data types. - To implement the method, keep in mind that the in the instance will always be primitive data. - - - - - - Returns the expected type from the primitive data in . - If the returned type is not null, the deserializer will attempt to convert the of to match the returned type. - - The item to be deserialized. - The expected data type. - - - - Converts the to a new value during serialization. - - The value to be serialized. - The new value. - - - - Converts the to a new value during deserialization. The new value can be changed to a different type than the original value. - This enables adapting various data types from deserialization. - The could be one of six primitive value types. - For further information, refer to . - - The item to be deserialized. - The new deserialized value. - - - - A helper converter which implements the to convert between two specific types. - - The original type of the data being serialized. - The serialized type of the data. - For further details about implementation, please refer to . - - - - - Creates an instance of . - - - - - Returns the expected type for . The default implementation returns . - - The item to be deserialized. - The type of . - - - - Converts the original value before serialization. If the serialized value is not the type of , the original will be returned. - - The item to be serialized. - The new value. - - - - Reverts the serialized value to . If the serialized value is not the type of , nothing will be changed. - - The item to be deserialized. - The new deserialized value. - - - - Converts to type before serialization. - - The value being serialized. - The converted value. - - - - Reverts the serialized to the type. - - The serialized value. - The reverted value which has the type. - - - - Represents a JSON name-value pair. - - - - - Gets whether the property of this instance can be changed. - - During serialization, the of the property can be changed, and this value is true. During deserialization or serializing an item of an instance, the can not be changed, and this value is false. - - - - The name of the item. During serialization, this property can be changed to serialize the member to another name. If the item is the object initially passed to the method (or its overloads), this value will be an empty string. - - This value is changed during deserialization or serializing an item of an instance. - - - - Gets or sets the value of the item. The type and value of this property can be changed. The serializer and deserializer will take the changed value. - - - - - Creates an instance of . - - The name of the item. - The value of the item. - - - - Deserializes an object. - - The data to be deserialized. - The reflection cache of the type. - The data container. If this value is not null, deserialized members will be written to it. If null, new object will be created. - The deserialized object. - Cannot determine type from . - - - - An interface to intercept various aspects in JSON serialization and deserialization. - It is recommended to inherit from for easier implementation when possible. - - - - - - This method is called before values are written out during serialization. If the method returns false, the object will not be serialized. - - The object being serialized. - Whether the object should be serialized. - - - - This method is called before the serialization is finished. Extra values can be returned and written to the serialized result. - - The object being serialized. - Extra values to be serialized. - - - - This method is called after the object has been fully serialized. - - The object being serialized. - - - - This method is called before serializing a field or a property. If the method returns false, the member will not be serialized. - - The container object. - The item to be serialized. - Whether the member should be serialized. - - - - This method is called between the object has been created and the values are filled during deserialization. - This method provides an opportunity to initialize an object before deserialization. - - The object being deserialized. - - - - This method is called after the object has been fully deserialized. Data validation could be done onto the serialized object. - - The object created from deserialization. - - - - This method is called before deserializing a field or a property. If the method returns false, the member will not be deserialized. - - The container object. - The item to be deserialized. - Whether the member should be deserialized. - - - - This is a default implementation of , which restricts the type of the object being serialized or deserialized. - The default implementation does nothing and returns true for all OnSerializing or OnDeserializing methods. - - The type of the object being serialized or deserialized. - - - - - This method is called before values are written out during serialization. If the method returns false, the object will not be serialized. - - The object being serialized. - Whether the object should be serialized. - - - - This method is called before the serialization is finished. Extra values can be returned and written to the serialized result. - - The object being serialized. - Extra values to be serialized. - - - - This method is called after the object has been fully serialized. - - The object being serialized. - - - - This method is called between the object has been created and the values are filled during deserialization. - This method provides an opportunity to initialize an object before deserialization. - - The object being deserialized. - - - - This method is called after the object has been fully deserialized. Data validation could be done onto the serialized object. - - The object created from deserialization. - - - - This method is called before serializing a field or a property. If the method returns false, the member will not be serialized. - - The container object. - The item being serialized. - Whether the member should be serialized. - - - - This method is called before deserializing a field or a property. If the method returns false, the member will not be deserialized. - - The container object. - The item to be deserialized. - Whether the member should be deserialized. - - - - An exception thrown during serialization or deserialization. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The message that describes the error. - - - - Initializes a new instance of the class. - - The message. - The inner exception. - - - - Initializes a new instance of the class. - - The that holds the serialized object data about the exception being thrown. - The that contains contextual information about the source or destination. - - - - An exception thrown when parser encounters malformed JSON string. - - - - - Gets the index where parse error occurs. - - - - - Gets the context text around the error position. - - - - - Gets the reason which raises the exception. - - - - - The operation center of JSON serialization and deserialization. - - - - - Gets the default serialization manager for controlling the serializer. - - - - - Creates a formatted JSON string (beautified) from an object. - - The object to be serialized. - - - - - Creates a JSON representation for an object with the default settings. - - The object to be serialized. - - - - - Creates a JSON representation for an object with serialization manager override. - - The object to be serialized. - The to control advanced JSON serialization. - The serialized JSON string. - - - - Writes the JSON representation for an object to the output target. - - The object to be serialized. - The output target. - The to control advanced JSON serialization. - - - - Parses a JSON string and generate a or instance. - - The object to be parsed. - The parsed object. - - - - Creates a typed generic object from the JSON with the default settings in . - - The type of the expected object after deserialization. - The JSON string to be deserialized. - The deserialized object of type . - - - - Create a typed generic object from the JSON with serialization manager override on this call. - - The type of the expected object after deserialization. - The JSON string to be deserialized. - The to control advanced JSON deserialization. - The deserialized object of type . - - - - Creates an object from the JSON with the default settings. - - The JSON string to be deserialized. - The serialized object. - - - - Creates an object from the JSON with override on this call. - - The JSON string to be deserialized. - The to control advanced JSON deserialization. - The deserialized object. - - - - Creates an object from the JSON with override on this call. - - The JSON string to be deserialized. - The type of the expected object after deserialization. - The to control advanced JSON deserialization. - The deserialized object. - - - - Creates an object of type from the JSON with the default settings. - - The JSON string to be deserialized. - The type of the expected object after deserialization. - The deserialized object of type . - - - - Fills with the JSON representation with the default settings. - - The object to contain the result of the deserialization. - The JSON representation string to be deserialized. - The object containing deserialized properties and fields from the JSON string. - - - - Deep-copies an object i.e. clones to a new object. - - The object to be deep copied. - The copy of . - - - - Deep-copies an object i.e. clones to a new object. - - The type of the object to be copied. - The object to be deep copied. - The copy of . - - - - Deep-copies an object i.e. clones to a new object. - - The type of the object to be copied. - The object to be deep copied. - The to control advanced JSON deserialization. - The copy of . - - - - Creates a human readable string from the JSON. - - The JSON string to be beautified. - A pretty-printed JSON string. - - - - Create a human readable string from the JSON. - - The JSON string to be beautified. - Indicates whether \uXXXX encoded Unicode notations should be converted into actual Unicode characters. - A pretty-printed JSON string. - - - - Creates a minified string from the JSON. - - The JSON string to be minified. - A minified JSON string. - - - - This class encodes and decodes JSON strings. - Spec. details, see http://www.json.org/ - - - - - This class serves as a lightweight text appender based on an internal . - - - - - Creates a wrapper delegate for the given method. - The delegate should have a similar signature as the , except that an argument in inserted before the method arguments. - - A delegate definition. The first argument of the delegate will be used to invoke the method. - The method to be converted to the delegate. - The wrapper delegate to invoke the method. - (typeof(List).GetMethod("Add"));]]> - - - - Finds a public instance method with the same name as and having arguments match the in the given . - - The type which contains the method. - The method to match. - The types of method arguments. Null value in the array means the corresponding argument can be any type. - The method matches the name and argument types. - - - - Whether the type is an abstract type, an interface, or object type. - - - - - Contains information about a member, used in reflection phase before serialization. - - - - - - The name of the field or property. - - - - - The type of the member. - - - - - True if the member is a property, false for a field. - - - - - Indicates whether the member is read-only. Read-only properties or initialized-only fields returns true. - - - - - Indicates whether the member is static. - - - - - Indicates whether the member is publicly visible. - - - - - Caches reflection information for a member - - - - - The general implementation of , which takes custom attributes such as , , etc. into consideration. - - - - - - Gets a value indicating whether XML serialization attributes should be used to control serialized field names. (default: false) - - - - - Ignore attributes to check for (default : XmlIgnoreAttribute). - - - - - Creates an instance of . For backward compatibility, is added into . - - - - - Creates an instance of and sets whether option is turned on. For backward compatibility, is added into . - - Controls whether and other serialization attributes should be supported to control serialized field names. - - - - This method is called to determine whether the values of the given type should be serialized as its numeric form rather than literal form. The override can be set via the . - - An value type. - If the type should be serialized numerically, returns true, otherwise, false. - - - - Gets the overridden name for an enum value. The overridden name can be set via the . If null or empty string is returned, the original name of the enum value is used. - - The enum value member. - The name of the enum value. - - - - Gets the type alias which can be used to determine derived types for abstract types, interface types or the type during deserialization. - - The type to be serialized. - - The alias denotes the type. - - - - - Gets whether the type is always deserializable. The value can be set via . - - The type to be deserialized. - Whether the type can be deserialized even if it is a non-public type. - - - - Returns the for given type. If no interceptor, null should be returned. The interceptor can be set via . - - The type to be checked. - The interceptor. - - - - This method is called to get the for the type. If no converter, null should be returned. The converter can be set via . - - The type to be checked for . - The interceptor. - - - - Gets the name of the collection container for customized types which implement and have extra members to be serialized. - - The which implements and contains extra members to be serialized. - The name of the collection container. If null is returned, no container will be created. - By default, the serializer serializes types which implement interface as JSON arrays. - Members of the type will be ignored. And so to the types which implements . - To serialize those members, return a non-empty name and the members will be serialized into a field named returned by this method. - - - - Returns whether the specific member is serializable. This value can be set via and . - If true is returned, the member will always get serialized. - If false is returned, the member will be excluded from serialization. - If null is returned, the serialization of the member will be determined by the settings in . - - The member to be serialized. - Reflection information for the member. - True is returned if the member is serializable, otherwise, false. - - - - Gets whether a field or a property is deserializable. If false is returned, the member will be excluded from deserialization. By default, writable fields or properties are deserializable. The value can be set via . - - The member to be serialized. - Reflection information for the member. - True is returned if the member is serializable, otherwise, false. - - - - This method returns possible names for corresponding types of a field or a property. This enables polymorphic serialization and deserialization for abstract classes, interfaces, or object types, with predetermined concrete types. If polymorphic serialization is not used, null or an empty could be returned. The names can be set via . - - The of the field or property. - The dictionary contains types and their corresponding names. - The type does not derive from the member type. - - - - This method returns a series of values that will not be serialized for a field or a property. When the value of the member matches those values, it will not be serialized. If all values can be serialized, null should be returned. The value can be set via . - - The of the field or property. - The values which are not serialized for . - - - - This method returns the to convert values for a field or a property during serialization and deserialization. If no converter is used, null can be returned. The converter can be set via . - - The of the field or property. - The converter. - - - - This method returns an instance to convert item values for a field or a property which is of type during serialization and deserialization. If no converter is used, null can be returned. The converter can be set via . - - The of the field or property. - The converter. - - - - This is an empty implementation of doing nothing but serving as a template class for method-overriding. - - - - - - This method is called to determine whether the values of the given type should be serialized as its numeric form rather than literal form. - - An value type. - If the type should be serialized numerically, returns true, otherwise, false. - - - - This method is called to override the serialized name of an enum value. If null or empty string is returned, the original name of the enum value is used. - - The enum value member. - The name of the enum value. - - - - Gets the type alias which can be used to determine derived types for abstract types, interface types or the type during deserialization. - - The type to be serialized. - - The alias denotes the type. - - - - - This method is called before the constructor of a type is built for deserialization to detect whether the type is deserializable. - When this method returns true, the type can be deserialized regardless it is a non-public type. - Public types are always deserializable and not affected by the value returned from this method. - If the type contains generic parameters (for generic types) or an element type (for array types), the parameters and element types will be checked first. - - The type to be deserialized. - Whether the type can be deserialized even if it is a non-public type. - - - - This method is called to get the for the type. If no interceptor, null should be returned. - - The type to be checked. - The interceptor. - - - - This method is called to get the for the type. If no converter, null should be returned. - - The type to be checked for . - The interceptor. - - - - Gets the name of the collection container for customized types which implement and have extra members to be serialized. - - The which implements and contains extra members to be serialized. - The name of the collection container. If null is returned, no container will be created. - By default, the serializer serializes types which implement interface as JSON arrays. - Members of the type will be ignored. And so to the types which implements . - To serialize those members, return a non-empty name and the members will be serialized into a field named returned by this method. - - - - This method is called to determine whether a field or a property is serializable. - If false is returned, the member will be excluded from serialization. - If true is returned, the member will always get serialized. - If null is returned, the serialization of the member will be determined by the settings in . - - The member to be serialized. - Reflection information for the member. - False is returned if the member is private, otherwise, null is returned. - - - - This method is called to determine whether a field or a property is deserializable. If false is returned, the member will be excluded from deserialization. By default, writable fields or properties are deserializable. - - The member to be serialized. - Reflection information for the member. - True is returned if the member is public, otherwise, false. - - - - This method returns possible names for corresponding types of a field or a property. This enables polymorphic serialization and deserialization for abstract, interface, or object types, with predetermined concrete types. If polymorphic serialization is not used, null or an empty could be returned. - - The of the field or property. - The dictionary contains types and their corresponding names. - - - - This method returns a series of values that will not be serialized for a field or a property. When the value of the member matches those values, it will not be serialized. If all values can be serialized, null should be returned. - - The of the field or property. - The values which are not serialized for . - - - - This method returns the to convert values for a field or a property during serialization and deserialization. If no converter is used, null can be returned. - - The of the field or property. - The converter. - - - - This method returns an instance to convert item values for a field or a property which is of type during serialization and deserialization. If no converter is used, null can be returned. - - The of the field or property. - The converter. - - - - The controller interface to control type reflections for serialization and deserialization. - - - The interface works in the reflection phase. Its methods are executed typically once and the result will be cached. Consequently, changes occur after the reflection phase will not take effect. - It is recommended to inherit from or . - - - - - - This method is called to determine how to format values of the given type. - - An value type. - The format of the enum value. - - - - This method is called to override the serialized name of an enum value. If null or empty string is returned, the original name of the enum value is used. - - The enum value member. - The name of the enum value. - - - - Gets the type alias which can be used to determine derived types for abstract types, interface types or the type during deserialization. - - The type to be serialized. - The alias denotes the type. - - - - This method is called before the constructor of a type is built for deserialization to detect whether the type is deserializable. - When this method returns true, the type can be deserialized regardless it is a non-public type. - Public types are always deserializable and not affected by the value returned from this method. - If the type contains type parameters (for generic types) or an element type (for array types), the parameters and element types will be checked first. - - The type to be deserialized. - Whether the type can be deserialized even if it is a non-public type. - - - - This method is called to get the for the type. If no interceptor, null should be returned. - - The type to be checked for . - The interceptor. - - - - This method is called to get the for the type. If no converter, null should be returned. - - The type to be checked for . - The interceptor. - - - - Gets the name of the collection container for customized types which implement and have extra members to be serialized. - - The which implements and contains extra members to be serialized. - The name of the collection container. If null is returned, no container will be created. - By default, the serializer serializes types which implement interface as JSON arrays. - Members of those types will be ignored. And so to the types which implements . - To serialize those members, return a non-empty name for those types and the members will be serialized into a field with the returned name. - - - - This method is called to determine whether a field or a property is serializable. - If false is returned, the member will be excluded from serialization. - If true is returned, the member will always get serialized. - If null is returned, the serialization of the member will be determined by the settings in . - - The member to be serialized. - Reflection information for the member. - True is returned if the member is serializable, otherwise, false. - - - - This method is called to determine whether a field or a property is deserializable. If false is returned, the member will be excluded from deserialization. By default, writable fields or properties are deserializable. - - The member to be serialized. - Reflection information for the member. - True is returned if the member is serializable, otherwise, false. - - - - Returns possible names for corresponding types of a field or a property. - This enables polymorphic serialization and deserialization for abstract, interface, or object types, with predetermined concrete types. If polymorphic serialization is not used, null or an empty dictionary could be returned. - - The of the field or property. - The dictionary contains types and their corresponding names. - - - - This method returns a series of values that will not be serialized for a field or a property. When the value of the member matches those values, it will not be serialized. If all values can be serialized, null should be returned. - - The of the field or property. - The values which are not serialized for . - - - - This method returns an instance to convert values for a field or a property during serialization and deserialization. If no converter is used, null can be returned. - - The of the field or property. - The converter. - - - - This method returns an instance to convert item values for a field or a property which is of type during serialization and deserialization. If no converter is used, null can be returned. - - The of the field or property. - The converter. - - - - Contains the names for a serialized member. - - - - - - Gets the default name for the serialized member. - - - - - Initializes a new instance of the class. - - - - - A thread-safe . - - The type of the dictionary key. - The type of the dictionary value. - - - - Initializes a new instance of the class that is empty, has the specified initial capacity, and uses the default equality comparer for the key type. - - - - - - Initializes a new instance of the class that is empty, has the default initial capacity, and uses the default equality comparer for the key type. - - - - - Clears all items. - - - - - Gets the value associated with the specified key. - - The key of the value to get. - When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the parameter. This parameter is passed uninitialized. - Returns true if the dictionary contains an element with the specified key; otherwise, false. - - - - Gets the number of key/value pairs contained in the dictionary. - - - - - Gets or sets the value associated with the specified key. - - The key of the value to get or set. - The value associated with the specified key. If the specified key is not found, a get operation throws a , and a set operation creates a new element with the specified key. - - - - Adds the specified key and value to the dictionary. - - The key of the element to add. - The value of the element to add. The value can be null for reference types. - - - - Removes specific key from the dictionary. - - The key of the element to remove. - - - - Indicates whether non-public classes, structs, fields or properties could be serialized and deserialized. - - - - - Indicates whether a field or property should be included in serialization. - To control whether a field or property should be deserialized, use the . - - - - - Gets whether the annotated field or property should be included in serialization disregarding whether it is read-only or not. The default value is true. - - - - - Indicates a member should be included in serialization. - - - - - Indicates whether a member should be included in serialization. - - Indicates whether a member should be included in serialization. - - - - Indicates the name and data type of a field or property. - The same field or property with multiple can have various names mapped to various types. - - - - - Gets the name of the serialized field or property. - The case of the serialized name defined in this attribute will not be changed by setting in . - - - - - Gets the type of the field or property. - - - - - Specifies the name of the serialized field or property. - - The name of the serialized field or property. - - - - Specifies the name of the serialized field or property which has a associated type. - - The name of the serialized field or property. - The name is only used when the value is of this data type. - - - - Indicates the name of the serialized data type, which will be used during polymorphic deserialization for instances of abstract types, interface types or the type. - - - - - Gets the name of the serialized class. - The case of the serialized name defined in this attribute will not be changed by setting in . - - - - - Specifies the name of the serialized type. - - The name of the serialized type. - - - - Specifies a value of the annotated member which is hidden from being serialized. - - - - - Gets the non-serialized value. - - - - - Specifies a value of the annotated member which is hidden from being serialized. - - The non-serialized value. - - - - Indicates the value format of the annotated enum type. - - - - - Specifies the format of an enum type. - - The format of the serialized enum type. - - - - Gets the format of the annotated enum type. - - - - - Controls the serialized name of an Enum value. - - - - - Gets the literal name of the Enum value. - - - - - Specifies the serialized name of the annotated Enum value. - - - - - - Controls the object being serialized or deserialized. - - - - - The type of interceptor. The instance of the type should implement . - During serialization and deserialization, an instance of will be created to process values of the object being serialized or deserialized. - - - - - Marks a class or a struct to be processed by an . - - The type of - The exception will be thrown if the type does not implements . - - - - Controls data conversion in serialization and deserialization. - - - This attribute can be applied to types or type members. - If it is applied to types, the converter will be used in all instances of the type, each property or field that has that data type will use the converter prior to serialization or deserialization. - If both the type member and the type has applied this attribute, the attribute on the type member will have a higher precedence. - - - - - The type of converter to convert string to object. The type should implement . - During serialization and deserialization, an instance of will be used to convert values between their original type and target type. - - - - - Marks the value of a field or a property to be converted by an . - - The type of the . - Exception can be thrown if the type does not implements . - - - - Controls data conversion of items in serialization and deserialization. - - - - - The type of converter to convert string to object. The type should implement . - During serialization and deserialization, an instance of will be used to convert values between their original type and target type. - - - - - Marks the item value of a field or a property to be converted by an . - - The type of the . - Exception can be thrown if the type does not implements . - - - - Denotes a type which implements should be serialized with its members and items being placed to a field named by this attribute. - - - - - Gets the name of the container. - - - - - Initializes a new instance of the class. - - The name of the container. - - - - An overridden copy of . - - - - - Creates an instance of the type by calling its parameterless constructor. - - - The created instance. - - - The type has no constructor, or constructor is not publicly visible, or the constructor takes any argument. - - - - - A class controls special serialization for specified types and members. - - - This class can be used to control serialization and deserialization for specified types and members. - The overriding methods, such as , , etc., must be called before serialization or deserialization. Otherwise, inconsistent serialization results may occur between types. - - - - - - Returns the currently used by the . - - - - - Uses the optimized fast Dataset Schema format (default = True) - - - - - Uses the fast GUID format (default = false) - - - - - Serializes null values to the output (default = True) - - - - - Serializes static fields or properties into the output (default = false). - - - - - Serializes arrays, collections, lists or dictionaries with no element (default = true). - - If the collection is the root object, it is not affected by this setting. Byte arrays are not affected by this setting either. - - - - Use the UTC date format (default = false) - - - - - Shows the read-only properties of types in the output (default = False). has higher precedence than this setting. - - - - - Shows the read-only fields of types in the output (default = False). has higher precedence than this setting. - - - - - Anonymous types have read only properties - - - - - Enables JSON extensions $type, $i (default = True). - This setting must be set to true if circular reference detection is required. - - - - - Use escaped Unicode i.e. \uXXXX format for non ASCII characters (default = false) - - - - - Outputs string key dictionaries as "k"/"v" format (default = False) - - - - - Outputs Enum values instead of names (default = False). - - - - - If you have parametric and no default constructor for you classes (default = False) - - IMPORTANT NOTE : If True then all initial values within the class will be ignored and will be not set. - In this case, you can use to assign an to initialize the object. - - - - - Serializes DateTime milliseconds i.e. yyyy-MM-dd HH:mm:ss.nnn (default = false) - - - - - Maximum depth for circular references in inline mode (default = 20) - - - - - Inlines circular or already seen objects instead of replacement with $i (default = False) - - - - - Controls the case of serialized field names. - - - - - Gets the singleton instance. - - - - - Creates a new instance of . - - The will be initialized to a new instance of . - - - - Creates a new instance of with a specific . - - The controller to control object reflections before serialization. - - - - Clears all cached override information. - - - - - Loads the serialization information into the overrides dictionary and return the information. - - The which holds the serialization information. - The newly loaded . - - - - Overrides reflection result with for the type. If the type is already overridden, either automatically or manually, the will merged into the existing reflected info. - - The type to be overridden. - The override info of the type. - - - - - Overrides reflection result with for the type. - - The type to be overridden. - The override info of the type. - If this value is true, the reflection engine will reflect the type again and apply the , otherwise, is merged into the existing reflection cache. - - - - - Overrides reflection result with for the specific type and optionally purge existing overrides. - - The type to be overridden. - The override info of the type. - If this value is true, the reflection engine will reflect the type again and apply the , otherwise, is merged into the existing reflection cache. - - At this moment, the override only affects the registered type. - If a class has its subclasses, the override will not be applied to its subclasses. - - The parameter or is null. - No member is found for a in . - - - - Assigns an to process a specific type. - This is a simplified version of method replacing the of a type. - - The type to be processed by the interceptor. - The interceptor to intercept the serialization and deserialization. - If the type has already gotten an , the new will replace it. If the new interceptor is null, existing interceptor will be removed from the type. - - - - Assigns an alias for a specific type. - This is a simplified version of method replacing the of a type. - - The alias for the type. - If the type has already gotten an alias, the new alias will replace it. If the new alias is null, existing alias will be removed. - - - - Assigns an to process a specific type. - This is a simplified version of method replacing the of a type. - - The type to be processed by the interceptor. - The converter to convert instances of type before the serialization and deserialization. - If the type has already gotten an , the new will replace it. - If the new converter is null, existing converter will be removed from the type. - - - - Assigns the serialized name of a field or property. - This is a simplified version of method replacing the serialized name of a member. - - The type containing the member. - The name of the field or property. - The serialized name of the member. - If is null or , the field or property name will be used. - - - - Assigns the serialized name of a field or property. - This is a simplified version of method replacing the serialized name of a member. - - The type containing the member. - The name of the field or property. - The serialized name of the member. - If is null or , the field or property name will be used. - - - - Assigns an to convert the value of the specific member. - This is a simplified version of method replacing the of a member. - - The type containing the member. - The member to be assigned. - The converter to process the member value. - If the member has already gotten an , the new will replace it. - If the new converter is null, existing converter will be removed from the type. - No field or property matches in . - - - - Assigns new name mapping for an Enum type . - - The type of the Enum. - The value mapper for the enum type . - The key of the dictionary is the original name of the enum value to be overridden, the value is the new serialized name to be specified to the value. - is not an Enum type. - - - - Assigns new name mapping for an Enum type . - - The type of the Enum. - The Enum value mapper. - The key of the dictionary is the original name of the enum value to be overridden, the value is the new serialized name to be specified to the value. - is not an Enum type. - - - - Contains reflection overriding information, used in type reflection phase before serialization or deserialization. - - - - - - - Specifies the alias to identify the type. - - - - - Specifies whether the type is deserializable disregarding its visibility. - - - - - Gets or sets the for the overridden type. - - - - - Gets or sets the for the overridden type. - - - - - Gets or sets the name of the container for the overridden type which implements or . - - - - - Gets the override information for members. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - - The alias for the type. - - - - Contains reflection override settings for a member. - - - - - - - - Gets the name of the overridden member. - - - - - Gets or sets the serialized name for the member. - - - - - Gets the polymorphic serialization for the member. - The item key is the type and the item value is the serialized name corresponding to the type. - The type should derive from the type of the member. - - - - - Gets or sets whether the member is always serialized (true), never serialized (false) or compliant to the existing behavior (null). - - - - - Gets or sets whether the member can be deserialized (true), never deserialized (false) or compliant to the existing behavior (null). - - - - - Gets the values of the member that should not be serialized. - - - - - Gets or sets the for the member. - - If the member has a converter before the override, and the value of this converter is null, existing converter will be removed after the override. - - - - Gets or sets the for the item of an member. - - If the member has an item converter before the override, and the value of this converter is null, existing converter will be removed after the override. - - - - Creates an instance of . - - The name of the member. - is null or an empty string. - - - - Creates an instance of , setting the property. - - The name of the member. - Whether the member should be serialized. - - - - Creates an instance of , setting the property and property. - - The name of the member. - How the member is serialized. - Whether the member should be deserialized. - - - - Creates an instance of , setting the property. - - The name of the member. - The converter. - - - - Creates an instance of , setting the property. - - The name of the member. - The serialized name of the member. - - - diff --git a/pdfpatcher/App/Lib/PowerJson.dll b/pdfpatcher/App/Lib/PowerJson.dll deleted file mode 100644 index 58525d9b2e06900bf92c55f9af574bf0d4e8fe9f..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Lib/PowerJson.dll and /dev/null differ diff --git a/pdfpatcher/App/Lib/iTextAsian.dll b/pdfpatcher/App/Lib/iTextAsian.dll deleted file mode 100644 index 8cfbb57e3d2b502d0b8b9042dfd02b9ae9e52105..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Lib/iTextAsian.dll and /dev/null differ diff --git a/pdfpatcher/App/Lib/iTextSharp.xml b/pdfpatcher/App/Lib/iTextSharp.xml deleted file mode 100644 index 344177b7de3830c9733a72399dc5c6af170603f1..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Lib/iTextSharp.xml +++ /dev/null @@ -1,57989 +0,0 @@ - - - - itextsharp - - - - Creates a new instance of MemoryLimitsAwareException. - - @param message the detail message. - - - - A - - handles memory allocation and prevents decompressed pdf streams from occupation of more space than allowed. - - - - - Creates a - - which will be used to handle decompression of pdf streams. - The max allowed memory limits will be generated by default. - - - - - Creates a - - which will be used to handle decompression of pdf streams. - The max allowed memory limits will be generated by default, based on the size of the document. - - the size of the document, which is going to be handled by iText. - - - Gets the maximum allowed size which can be occupied by a single decompressed pdf stream. - the maximum allowed size which can be occupied by a single decompressed pdf stream. - - - Sets the maximum allowed size which can be occupied by a single decompressed pdf stream. - - Sets the maximum allowed size which can be occupied by a single decompressed pdf stream. - This value correlates with maximum heap size. This value should not exceed limit of the heap size. - iText will throw an exception if during decompression a pdf stream with two or more filters of identical type - occupies more memory than allowed. - - the maximum allowed size which can be occupied by a single decompressed pdf stream. - - - this - - instance. - - - - Gets the maximum allowed size which can be occupied by all decompressed pdf streams. - the maximum allowed size value which streams may occupy - - - Sets the maximum allowed size which can be occupied by all decompressed pdf streams. - - Sets the maximum allowed size which can be occupied by all decompressed pdf streams. - This value can be limited by the maximum expected PDF file size when it's completely decompressed. - Setting this value correlates with the maximum processing time spent on document reading - iText will throw an exception if during decompression pdf streams with two or more filters of identical type - occupy more memory than allowed. - - he maximum allowed size which can be occupied by all decompressed pdf streams. - - - this - - instance. - - - - Considers the number of bytes which are occupied by the decompressed pdf stream. - - Considers the number of bytes which are occupied by the decompressed pdf stream. - If memory limits have not been faced, throws an exception. - - the number of bytes which are occupied by the decompressed pdf stream. - - this - - instance. - - - - - - - - Begins handling of current pdf stream decompression. - - this - - instance. - - - - Ends handling of current pdf stream decompression. - - Ends handling of current pdf stream decompression. - If memory limits have not been faced, throws an exception. - - - this - - instance. - - - - - - - - This class implements an output stream which can be used for memory limits aware decompression of pdf streams. - - - The maximum size of array to allocate. - Attempts to allocate larger arrays will result in an exception. - - - The maximum size of array to allocate. - Attempts to allocate larger arrays will result in an exception. - - - Creates a new byte array output stream. The buffer capacity is - initially 32 bytes, though its size increases if necessary. - - - Creates a new byte array output stream, with a buffer capacity of - the specified size, in bytes. - - @param size the initial size. - @throws IllegalArgumentException if size is negative. - - - Gets the maximum size which can be occupied by this output stream. - - @return the maximum size which can be occupied by this output stream. - - - Sets the maximum size which can be occupied by this output stream. - - @param maxStreamSize the maximum size which can be occupied by this output stream. - @return this {@link MemoryLimitsAwareOutputStream} - - - {@inheritDoc} - - - Query and change fields in existing documents either by method - calls or by FDF merging. - @author Paulo Soares - - - A field type invalid or not found. - - - A field type. - - - A field type. - - - A field type. - - - A field type. - - - A field type. - - - A field type. - - - A field type. - - - Holds value of property generateAppearances. - - - Holds value of property fieldCache. - - - Gets the list of appearance names. Use it to get the names allowed - with radio and checkbox fields. If the /Opt key exists the values will - also be included. The name 'Off' may also be valid - even if not returned in the list. - - For Comboboxes it will return an array of display values. To extract the - export values of a Combobox, please refer to {@link AcroFields#getListOptionExport(String)} - - @param fieldName the fully qualified field name - @return the list of names or null if the field does not exist - - - Gets the list of export option values from fields of type list or combo. - If the field doesn't exist or the field type is not list or combo it will return - null. - @param fieldName the field name - @return the list of export option values from fields of type list or combo - - - Gets the list of display option values from fields of type list or combo. - If the field doesn't exist or the field type is not list or combo it will return - null. - @param fieldName the field name - @return the list of export option values from fields of type list or combo - - - - - Export the fields as a FDF. - @param writer the FDF writer - - - Renames a field. Only the last part of the name can be renamed. For example, - if the original field is "ab.cd.ef" only the "ef" part can be renamed. - @param oldName the old field name - @param newName the new field name - @return true if the renaming was successful, false - otherwise - - - Retrieve the rich value for the given field - @param name - @return The rich value if present, or null. - @since 5.0.6 - - - Gets the field value. - @param name the fully qualified field name - @return the field value - - - Gets the field values of a Choice field. - @param name the fully qualified field name - @return the field value - @since 2.1.3 - - - - - Merges an XML data structure into this form. - @param n the top node of the data structure - @throws java.io.IOException on error - @throws com.lowagie.text.DocumentException o error - - - Sets the fields by FDF merging. - @param fdf the FDF form - @throws IOException on error - @throws DocumentException on error - - - Sets the fields by XFDF merging. - @param xfdf the XFDF form - @throws IOException on error - @throws DocumentException on error - - - Regenerates the field appearance. - This is usefull when you change a field property, but not its value, - for instance form.SetFieldProperty("f", "bgcolor", BaseColor.BLUE, null); - This won't have any effect, unless you use RegenerateField("f") after changing - the property. - - @param name the fully qualified field name or the partial name in the case of XFA forms - @throws IOException on error - @throws DocumentException on error - @return true if the field was found and changed, - false otherwise - - - Sets the field value. - @param name the fully qualified field name or the partial name in the case of XFA forms - @param value the field value - @throws IOException on error - @throws DocumentException on error - @return true if the field was found and changed, - false otherwise - - - Sets the field value. - @param name the fully qualified field name or the partial name in the case of XFA forms - @param value the field value - @param saveAppearance save the current appearance of the field or not - @throws IOException on error - @throws DocumentException on error - @return true if the field was found and changed, - false otherwise - - - Sets the rich value for the given field. See PDF Reference chapter - 12.7.3.4 (Rich Text) and 12.7.4.3 (Text Fields) for further details. Note that iText doesn't create an appearance for Rich Text fields. - So you either need to use XML Worker to create an appearance (/N entry in the /AP dictionary), or you need to use setGenerateAppearances(false) to tell the viewer - that iText didn't create any appearances. - @param name Field name - @param richValue html markup - @return success/failure (will fail if the field isn't found, isn't a text field, or doesn't support rich text) - @throws DocumentException - @throws IOException - @since 5.0.6 - - - Sets the field value and the display string. The display string - is used to build the appearance in the cases where the value - is modified by Acrobat with JavaScript and the algorithm is - known. - @param name the fully qualified field name or the partial name in the case of XFA forms - @param value the field value - @param display the string that is used for the appearance. If null - the value parameter will be used - @return true if the field was found and changed, - false otherwise - @throws IOException on error - @throws DocumentException on error - - - Sets the field value and the display string. The display string - is used to build the appearance in the cases where the value - is modified by Acrobat with JavaScript and the algorithm is - known. - @param name the fully qualified field name or the partial name in the case of XFA forms - @param value the field value - @param display the string that is used for the appearance. If null - the value parameter will be used - @param saveAppearance save the current appearance of the field or not - @return true if the field was found and changed, - false otherwise - @throws IOException on error - @throws DocumentException on error - - - Sets different values in a list selection. - No appearance is generated yet; nor does the code check if multiple select is allowed. - - @param name the name of the field - @param value an array with values that need to be selected - @return true only if the field value was changed - @since 2.1.4 - - - Gets all the fields. The fields are keyed by the fully qualified field name and - the value is an instance of AcroFields.Item. - @return all the fields - - - Gets the field structure. - @param name the name of the field - @return the field structure or null if the field - does not exist - - - Gets the long XFA translated name. - @param name the name of the field - @return the long field name - - - Gets the field box positions in the document. The return is an array of float - multiple of 5. For each of this groups the values are: [page, llx, lly, urx, - ury]. The coordinates have the page rotation in consideration. - @param name the field name - @return the positions or null if field does not exist - - - Removes all the fields from page. - @param page the page to remove the fields from - @return true if any field was removed, false otherwise - - - Removes a field from the document. If page equals -1 all the fields with this - name are removed from the document otherwise only the fields in - that particular page are removed. - @param name the field name - @param page the page to remove the field from or -1 to remove it from all the pages - @return true if the field exists, false otherwise - - - Removes a field from the document. - @param name the field name - @return true if the field exists, false otherwise - - - Sets the option to generate appearances. Not generating apperances - will speed-up form filling but the results can be - unexpected in Acrobat. Don't use it unless your environment is well - controlled. The default is true. - @param generateAppearances the option to generate appearances - - - The field representations for retrieval and modification. - - - writeToAll constant. - - @since 2.1.5 - - - writeToAll and markUsed constant. - - @since 2.1.5 - - - writeToAll and markUsed constant. - - @since 2.1.5 - - - This function writes the given key/value pair to all the instances - of merged, widget, and/or value, depending on the writeFlags setting - - @since 2.1.5 - - @param key you'll never guess what this is for. - @param value if value is null, the key will be removed - @param writeFlags ORed together WRITE_* flags - - - Mark all the item dictionaries used matching the given flags - - @since 2.1.5 - @param writeFlags WRITE_MERGED is ignored - - - An array of PdfDictionary where the value tag /V - is present. - - - - An array of PdfDictionary with the widgets. - - - - An array of PdfDictionary with the widget references. - - - - An array of PdfDictionary with all the field - and widget tags merged. - - - - An array of Integer with the page numbers where - the widgets are displayed. - - - - An array of Integer with the tab order of the field in the page. - - - - Preferred method of determining the number of instances - of a given field. - - @since 2.1.5 - @return number of instances - - - Remove the given instance from this item. It is possible to - remove all instances using this function. - - @since 2.1.5 - @param killIdx - - - Retrieve the value dictionary of the given instance - - @since 2.1.5 - @param idx instance index - @return dictionary storing this instance's value. It may be shared across instances. - - - Add a value dict to this Item - - @since 2.1.5 - @param value new value dictionary - - - Retrieve the widget dictionary of the given instance - - @since 2.1.5 - @param idx instance index - @return The dictionary found in the appropriate page's Annot array. - - - Add a widget dict to this Item - - @since 2.1.5 - @param widget - - - Retrieve the reference to the given instance - - @since 2.1.5 - @param idx instance index - @return reference to the given field instance - - - Add a widget ref to this Item - - @since 2.1.5 - @param widgRef - - - Retrieve the merged dictionary for the given instance. The merged - dictionary contains all the keys present in parent fields, though they - may have been overwritten (or modified?) by children. - Example: a merged radio field dict will contain /V - - @since 2.1.5 - @param idx instance index - @return the merged dictionary for the given instance - - - Adds a merged dictionary to this Item. - - @since 2.1.5 - @param mergeDict - - - Retrieve the page number of the given instance - - @since 2.1.5 - @param idx - @return remember, pages are "1-indexed", not "0-indexed" like field instances. - - - Adds a page to the current Item. - - @since 2.1.5 - @param pg - - - forces a page value into the Item. - - @since 2.1.5 - @param idx - - - Gets the tabOrder. - - @since 2.1.5 - @param idx - @return tab index of the given field instance - - - Adds a tab order value to this Item. - - @since 2.1.5 - @param order - - - Clears a signed field. - @param name the field name - @return true if the field was signed, false if the field was not signed or not found - @since 5.0.5 - - - Gets the field names that have signatures and are signed. - @return the field names that have signatures and are signed - - - Gets the field names that have blank signatures. - @return the field names that have blank signatures - - - Gets the signature dictionary, the one keyed by /V. - @param name the field name - @return the signature dictionary keyed by /V or null if the field is not - a signature - - - Gets a reference to the normal appearance of a field. - - @param name the field name - @return a reference to the /N entry of the /AP dictionary or null if the field is not found - - - Checks is the signature covers the entire document or just part of it. - @param name the signature field name - @return true if the signature covers the entire document, - false otherwise - - - - Gets the total number of revisions this document has. - @return the total number of revisions - - - Gets this field revision. - @param field the signature field name - @return the revision or zero if it's not a signature field - - - Extracts a revision from the document. - @param field the signature field name - @return an Stream covering the revision. Returns null if - it's not a signature field - @throws IOException on error - - - - Sets extra margins in text fields to better mimic the Acrobat layout. - @param extraMarginLeft the extra marging left - @param extraMarginTop the extra margin top - - - Adds a substitution font to the list. The fonts in this list will be used if the original - font doesn't contain the needed glyphs. - @param font the font - - - Sets a list of substitution fonts. The list is composed of BaseFont and can also be null. The fonts in this list will be used if the original - font doesn't contain the needed glyphs. - @param substitutionFonts the list - - - Gets the XFA form processor. - @return the XFA form processor - - - Removes the XFA stream from the document. - - - Creates a new pushbutton from an existing field. If there are several pushbuttons with the same name - only the first one is used. This pushbutton can be changed and be used to replace - an existing one, with the same name or other name, as long is it is in the same document. To replace an existing pushbutton - call {@link #replacePushbuttonField(String,PdfFormField)}. - @param field the field name that should be a pushbutton - @return a new pushbutton or null if the field is not a pushbutton - - - Creates a new pushbutton from an existing field. This pushbutton can be changed and be used to replace - an existing one, with the same name or other name, as long is it is in the same document. To replace an existing pushbutton - call {@link #replacePushbuttonField(String,PdfFormField,int)}. - @param field the field name that should be a pushbutton - @param order the field order in fields with same name - @return a new pushbutton or null if the field is not a pushbutton - - - Replaces the first field with a new pushbutton. The pushbutton can be created with - {@link #getNewPushbuttonFromField(String)} from the same document or it can be a - generic PdfFormField of the type pushbutton. - @param field the field name - @param button the PdfFormField representing the pushbutton - @return true if the field was replaced, false if the field - was not a pushbutton - - - Replaces the designated field with a new pushbutton. The pushbutton can be created with - {@link #getNewPushbuttonFromField(String,int)} from the same document or it can be a - generic PdfFormField of the type pushbutton. - @param field the field name - @param button the PdfFormField representing the pushbutton - @param order the field order in fields with same name - @return true if the field was replaced, false if the field - was not a pushbutton - - - Checks whether a name exists as a signature field or not. It checks both signed fields and blank signatures. - @param name String - @return boolean does the signature field exist - @since 5.5.1 - - - A class representing a field position - @since 5.0.2 - - - - Summary description for InputMeta. - - - - - Summary description for MetaDo. - - - - Creates new MetaState - - - Getter for property currentBackgroundColor. - @return Value of property currentBackgroundColor. - - - Getter for property currentTextColor. - @return Value of property currentTextColor. - - - Getter for property backgroundMode. - @return Value of property backgroundMode. - - - Getter for property textAlign. - @return Value of property textAlign. - - - Getter for property polyFillMode. - @return Value of property polyFillMode. - - - Came from GIFEncoder initially. - Modified - to allow for output compressed data without the block counts - which breakup the compressed data stream for GIF. - - - - note this also indicates gif format BITFile. * - - - @param output destination for output data - @param blocks GIF LZW requires block counts for output data - - - - - Reads a BMP from an url. - @param url the url - @throws IOException on error - @return the image - - - Reads a BMP from a stream. The stream is not closed. - @param is the stream - @throws IOException on error - @return the image - - - Reads a BMP from a stream. The stream is not closed. - The BMP may not have a header and be considered as a plain DIB. - @param is the stream - @param noHeader true to process a plain DIB - @param size the size of the DIB. Not used for a BMP - @throws IOException on error - @return the image - - - Reads a BMP from a file. - @param file the file - @throws IOException on error - @return the image - - - Reads a BMP from a byte array. - @param data the byte array - @throws IOException on error - @return the image - - - Encodes data in the CCITT G4 FAX format. - - - Creates a new encoder. - @param width the line width - - - Encodes a number of lines. - @param data the data to be encoded - @param offset the offset into the data - @param size the size of the data to be encoded - - - Encodes a full image. - @param data the data to encode - @param width the image width - @param height the image height - @return the encoded image - - - Encodes a number of lines. - @param data the data to be encoded - @param height the number of lines to encode - - - Closes the encoder and returns the encoded data. - @return the encoded data - - - Reads gif images of all types. All the images in a gif are read in the constructors - and can be retrieved with other methods. - @author Paulo Soares - - - Reads gif images from an URL. - @param url the URL - @throws IOException on error - - - Reads gif images from a file. - @param file the file - @throws IOException on error - - - Reads gif images from a byte array. - @param data the byte array - @throws IOException on error - - - Reads gif images from a stream. The stream isp not closed. - @param isp the stream - @throws IOException on error - - - Gets the number of frames the gif has. - @return the number of frames the gif has - - - Gets the image from a frame. The first frame isp 1. - @param frame the frame to get the image from - @return the image - - - Gets the [x,y] position of the frame in reference to the - logical screen. - @param frame the frame - @return the [x,y] position of the frame - - - Gets the logical screen. The images may be smaller and placed - in some position in this screen to playback some animation. - No image will be be bigger that this. - @return the logical screen dimensions as [x,y] - - - Reads GIF file header information. - - - Reads Logical Screen Descriptor - - - Reads next 16-bit value, LSB first - - - Reads next variable length block from input. - - @return number of bytes stored in "buffer" - - - Reads next frame image - - - Resets frame state for reading next image. - - - Reads Graphics Control Extension values - - - Skips variable length blocks up to and including - next zero length block. - - - Support for JBIG2 Images. - This class assumes that we are always embedding into a pdf. - - @since 2.1.5 - - - Gets a byte array that can be used as a /JBIG2Globals, - or null if not applicable to the given jbig2. - @param ra an random access file or array - @return a byte array - - - returns an Image representing the given page. - @param ra the file or array containing the image - @param page the page number of the image - @return an Image object - - - Class to read a JBIG2 file at a basic level: understand all the segments, - understand what segments belong to which pages, how many pages there are, - what the width and height of each page is, and global segments if there - are any. Or: the minimum required to be able to take a normal sequential - or random-access organized file, and be able to embed JBIG2 pages as images - in a PDF. - - TODO: the indeterminate-segment-size value of dataLength, else? - - @since 2.1.5 - - - Inner class that holds information about a JBIG2 segment. - @since 2.1.5 - - - Inner class that holds information about a JBIG2 page. - @since 2.1.5 - - - return as a single byte array the header-data for each segment in segment number - order, EMBEDDED organization, but i am putting the needed segments in SEQUENTIAL organization. - if for_embedding, skip the segment types that are known to be not for acrobat. - @param for_embedding - @return a byte array - @throws IOException - - - - Some PNG specific values. - - - A PNG marker. - - - A PNG marker. - - - A PNG marker. - - - A PNG marker. - - - A PNG marker. - - - A PNG marker. - - - A PNG marker. - - - A PNG marker. - - - A PNG marker. - - - A PNG marker. - - - Creates a new instance of PngImage - - - Reads a PNG from an url. - @param url the url - @throws IOException on error - @return the image - - - Reads a PNG from a stream. - @param is the stream - @throws IOException on error - @return the image - - - Reads a PNG from a file. - @param file the file - @throws IOException on error - @return the image - - - Reads a PNG from a byte array. - @param data the byte array - @throws IOException on error - @return the image - - - Gets an int from an Stream. - - @param is an Stream - @return the value of an int - - - Gets a word from an Stream. - - @param is an Stream - @return the value of an int - - - Gets a String from an Stream. - - @param is an Stream - @return the value of an int - - - A list of constants used in class TIFFImage. - - - - A bool storing the endianness of the stream. - - - The number of entries in the IFD. - - - An array of TIFFFields. - - - A Hashtable indexing the fields by tag number. - - - The offset of this IFD. - - - The offset of the next IFD. - - - The default constructor. - - - Constructs a TIFFDirectory from a SeekableStream. - The directory parameter specifies which directory to read from - the linked list present in the stream; directory 0 is normally - read but it is possible to store multiple images in a single - TIFF file by maintaing multiple directories. - - @param stream a SeekableStream to read from. - @param directory the index of the directory to read. - - - Constructs a TIFFDirectory by reading a SeekableStream. - The ifd_offset parameter specifies the stream offset from which - to begin reading; this mechanism is sometimes used to store - private IFDs within a TIFF file that are not part of the normal - sequence of IFDs. - - @param stream a SeekableStream to read from. - @param ifd_offset the long byte offset of the directory. - @param directory the index of the directory to read beyond the - one at the current stream offset; zero indicates the IFD - at the current offset. - - - Returns the number of directory entries. - - - Returns the value of a given tag as a TIFFField, - or null if the tag is not present. - - - Returns true if a tag appears in the directory. - - - Returns an ordered array of ints indicating the tag - values. - - - Returns an array of TIFFFields containing all the fields - in this directory. - - - Returns the value of a particular index of a given tag as a - byte. The caller is responsible for ensuring that the tag is - present and has type TIFFField.TIFF_SBYTE, TIFF_BYTE, or - TIFF_UNDEFINED. - - - Returns the value of index 0 of a given tag as a - byte. The caller is responsible for ensuring that the tag is - present and has type TIFFField.TIFF_SBYTE, TIFF_BYTE, or - TIFF_UNDEFINED. - - - Returns the value of a particular index of a given tag as a - long. The caller is responsible for ensuring that the tag is - present and has type TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED, - TIFF_SHORT, TIFF_SSHORT, TIFF_SLONG or TIFF_LONG. - - - Returns the value of index 0 of a given tag as a - long. The caller is responsible for ensuring that the tag is - present and has type TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED, - TIFF_SHORT, TIFF_SSHORT, TIFF_SLONG or TIFF_LONG. - - - Returns the value of a particular index of a given tag as a - float. The caller is responsible for ensuring that the tag is - present and has numeric type (all but TIFF_UNDEFINED and - TIFF_ASCII). - - - Returns the value of index 0 of a given tag as a float. The - caller is responsible for ensuring that the tag is present and - has numeric type (all but TIFF_UNDEFINED and TIFF_ASCII). - - - Returns the value of a particular index of a given tag as a - double. The caller is responsible for ensuring that the tag is - present and has numeric type (all but TIFF_UNDEFINED and - TIFF_ASCII). - - - Returns the value of index 0 of a given tag as a double. The - caller is responsible for ensuring that the tag is present and - has numeric type (all but TIFF_UNDEFINED and TIFF_ASCII). - - - Returns the number of image directories (subimages) stored in a - given TIFF file, represented by a SeekableStream. - - - Returns a bool indicating whether the byte order used in the - the TIFF file is big-endian (i.e. whether the byte order is from - the most significant to the least significant) - - - Returns the offset of the IFD corresponding to this - TIFFDirectory. - - - Returns the offset of the next IFD after the IFD corresponding to this - TIFFDirectory. - - - @param fillOrder The fill order of the compressed data bytes. - @param w - @param h - - - The logical order of bits within a byte. -
    -            1 = MSB-to-LSB
    -            2 = LSB-to-MSB (flipped)
    -            
    -
    - - Uncompressed mode flag: 1 if uncompressed, 0 if not. - - - EOL padding flag: 1 if fill bits have been added before an EOL such - that the EOL ends on a byte boundary, 0 otherwise. - - - Coding dimensionality: 1 for 2-dimensional, 0 for 1-dimensional. - - - Invokes the superclass method and then sets instance variables on - the basis of the metadata set on this decompressor. - - - - Flag for 8 bit unsigned integers. - - - Flag for null-terminated ASCII strings. - - - Flag for 16 bit unsigned integers. - - - Flag for 32 bit unsigned integers. - - - Flag for pairs of 32 bit unsigned integers. - - - Flag for 8 bit signed integers. - - - Flag for 8 bit uninterpreted bytes. - - - Flag for 16 bit signed integers. - - - Flag for 32 bit signed integers. - - - Flag for pairs of 32 bit signed integers. - - - Flag for 32 bit IEEE floats. - - - Flag for 64 bit IEEE doubles. - - - The tag number. - - - The tag type. - - - The number of data items present in the field. - - - The field data. - - - The default constructor. - - - - Returns the tag number, between 0 and 65535. - - - Returns the type of the data stored in the IFD. - For a TIFF6.0 file, the value will equal one of the - TIFF_ constants defined in this class. For future - revisions of TIFF, higher values are possible. - - - - Returns the number of elements in the IFD. - - - - - - - - - - - - - - - - - - - - Reads TIFF images - @author Paulo Soares - - - Gets the number of pages the TIFF document has. - @param s the file source - @return the number of pages - - - Reads a page from a TIFF image. - @param s the file source - @param page the page to get. The first page is 1 - @param direct for single strip, CCITT images, generate the image - by direct byte copying. It's faster but may not work - every time - @return the Image - - - Reads a page from a TIFF image. Direct mode is not used. - @param s the file source - @param page the page to get. The first page is 1 - @return the Image - - - Reads a page from a TIFF image. - @param s the file source - @param page the page to get. The first page is 1 - @param direct for single strip, CCITT images, generate the image - by direct byte copying. It's faster but may not work - every time - @return the Image - - - A class for performing LZW decoding. - - - - - Method to decode LZW compressed data. - - @param data The compressed data. - @param uncompData Array to return the uncompressed data in. - @param h The number of rows the compressed data contains. - - - Initialize the string table. - - - Write out the string just uncompressed. - - - Add a new string to the string table. - - - Add a new string to the string table. - - - Append newString to the end of oldString. - - - - @author psoares - - - Modified from original LZWCompressor to change interface to passing a - buffer of data to be compressed. - - - - base underlying code size of data being compressed 8 for TIFF, 1 to 8 for GIF * - - - reserved clear code based on code size * - - - reserved end of data code based on code size * - - - current number bits output for each code * - - - limit at which current number of bits code size has to be increased * - - - the prefix code which represents the predecessor string to current input point * - - - output destination for bit codes * - - - general purpose LZW string table * - - - modify the limits of the code values in LZW encoding due to TIFF bug / feature * - - - @param outp destination for compressed data - @param codeSize the initial code size for the LZW compressor - @param TIFF flag indicating that TIFF lzw fudge needs to be applied - @exception IOException if underlying output stream error - - - - @param buf data to be compressed to output stream - @exception IOException if underlying output stream error - - - - Indicate to compressor that no more data to go so write outp - any remaining buffered data. - - @exception IOException if underlying output stream error - - - - General purpose LZW String Table. - Extracted from GIFEncoder by Adam Doppelt - Comments added by Robin Luiten - expandCode added by Robin Luiten - The strLen_ table to give quick access to the lenght of an expanded - code for use by the expandCode method added by Robin. - - - - codesize + Reserved Codes - - - each entry corresponds to a code and contains the length of data - that the code expands to when decoded. - - - - Constructor allocate memory for string store data - - - - @param index value of -1 indicates no predecessor [used in initialisation] - @param b the byte [character] to add to the string store which follows - the predecessor string specified the index. - @return 0xFFFF if no space in table left for addition of predecesor - index and byte b. Else return the code allocated for combination index + b. - - - - @param index index to prefix string - @param b the character that follws the index prefix - @return b if param index is HASH_FREE. Else return the code - for this prefix and byte successor - - - - @param codesize the size of code to be preallocated for the - string store. - - - - If expanded data doesnt fit into array only what will fit is written - to buf and the return value indicates how much of the expanded code has - been written to the buf. The next call to ExpandCode() should be with - the same code and have the skip parameter set the negated value of the - previous return. Succesive negative return values should be negated and - added together for next skip parameter value with same code. - - @param buf buffer to place expanded data into - @param offset offset to place expanded data - @param code the code to expand to the byte array it represents. - PRECONDITION This code must allready be in the LZSS - @param skipHead is the number of bytes at the start of the expanded code to - be skipped before data is written to buf. It is possible that skipHead is - equal to codeLen. - @return the length of data expanded into buf. If the expanded code is longer - than space left in buf then the value returned is a negative number which when - negated is equal to the number of bytes that were used of the code being expanded. - This negative value also indicates the buffer is full. - - - - - @author psoares - - - - @author psoares - - - - @author psoares - - - - @param seq - @return the cid code or -1 for end - - - - @author psoares - - - - @author psoares - - - - @author psoares - - - This class represents a CMap file. - - @author Ben Litchfield (ben@benlitchfield.com) - @since 2.1.4 - - - Creates a new instance of CMap. - - - This will tell if this cmap has any one byte mappings. - - @return true If there are any one byte mappings, false otherwise. - - - This will tell if this cmap has any two byte mappings. - - @return true If there are any two byte mappings, false otherwise. - - - This will perform a lookup into the map. - - @param code The code used to lookup. - @param offset The offset into the byte array. - @param length The length of the data we are getting. - - @return The string that matches the lookup. - - - - @author psoares - - - - @author psoares - - - Interface providing alternate description for accessible elements. - - - Get the attribute of accessible element (everything in A dictionary + Lang, Alt, ActualText, E). - @param key - @return - - - Set the attribute of accessible element (everything in A dictionary + Lang, Alt, ActualText, E). - @param key - @param value - - - Gets all the properties of accessible element. - @return - - - Role propherty of the accessible element. - Note that all child elements won't also be tagged. - @return - - - Use this methods to get the AcroForm object. - Use this method only if you know what you're doing - @return the PdfAcroform object of the PdfDocument - - - Use this methods to add a PdfAnnotation or a PdfFormField - to the document. Only the top parent of a PdfFormField - needs to be added. - @param annot the PdfAnnotation or the PdfFormField to add - - - Use this method to adds the PdfAnnotation - to the calculation order array. - @param annot the PdfAnnotation to be added - - - Use this method to set the signature flags. - @param f the flags. This flags are ORed with current ones - - - A PDF document can have an open action and other additional actions. - - - When the document opens it will jump to the destination with - this name. - @param name the name of the destination to jump to - - - When the document opens this action will be - invoked. - @param action the action to be invoked - - - Additional-actions defining the actions to be taken in - response to various trigger events affecting the document - as a whole. The actions types allowed are: DOCUMENT_CLOSE, - WILL_SAVE, DID_SAVE, WILL_PRINT - and DID_PRINT. - - @param actionType the action type - @param action the action to execute in response to the trigger - @throws DocumentException on invalid action type - - - Encryption settings are described in section 3.5 (more specifically - section 3.5.2) of the PDF Reference 1.7. - They are explained in section 3.3.3 of the book 'iText in Action'. - The values of the different preferences were originally stored - in class PdfWriter, but they have been moved to this separate interface - for reasons of convenience. - - - Sets the encryption options for this document. The userPassword and the - ownerPassword can be null or have zero length. In this case the ownerPassword - is replaced by a random string. The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - @param userPassword the user password. Can be null or empty - @param ownerPassword the owner password. Can be null or empty - @param permissions the user permissions - @param encryptionType the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128. - Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext - @throws DocumentException if the document is already open - - - Sets the certificate encryption options for this document. An array of one or more public certificates - must be provided together with an array of the same size for the permissions for each certificate. - The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext - @param certs the public certificates to be used for the encryption - @param permissions the user permissions for each of the certicates - @param encryptionType the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128. - @throws DocumentException if the document is already open - - - A PDF page can have an open and/or close action. - - - Sets the open and close page additional action. - @param actionType the action type. It can be PdfWriter.PAGE_OPEN - or PdfWriter.PAGE_CLOSE - @param action the action to perform - @throws DocumentException if the action type is invalid - - - Sets the display duration for the page (for presentations) - @param seconds the number of seconds to display the page - - - Sets the transition for the page - @param transition the Transition object - - - Sets the run direction. This is only used as a placeholder - as it does not affect anything. - @param runDirection the run direction - - - The PDF version is described in the PDF Reference 1.7 p92 - (about the PDF Header) and page 139 (the version entry in - the Catalog). You'll also find info about setting the version - in the book 'iText in Action' sections 2.1.3 (PDF Header) - and 3.3 (Version history). - - - If the PDF Header hasn't been written yet, - this changes the version as it will appear in the PDF Header. - If the PDF header was already written to the Stream, - this changes the version as it will appear in the Catalog. - @param version a character representing the PDF version - - - If the PDF Header hasn't been written yet, - this changes the version as it will appear in the PDF Header, - but only if param refers to a higher version. - If the PDF header was already written to the Stream, - this changes the version as it will appear in the Catalog. - @param version a character representing the PDF version - - - Sets the PDF version as it will appear in the Catalog. - Note that this only has effect if you use a later version - than the one that appears in the header. This method - ignores the parameter if you try to set a lower version - than the one currently set in the Catalog. - @param version the PDF name that will be used for the Version key in the catalog - - - Adds a developer extension to the Extensions dictionary - in the Catalog. - @param de an object that contains the extensions prefix and dictionary - @since 2.1.6 - - - Viewer preferences are described in section 3.6.1 and 8.1 of the - PDF Reference 1.7 (Table 3.25 on p139-142 and Table 8.1 on p579-581). - They are explained in section 13.1 of the book 'iText in Action'. - The values of the different preferences were originally stored - in class PdfWriter, but they have been moved to this separate interface - for reasons of convenience. - - - - - Sets the PDF/X conformance level. - Allowed values are PDFX1A2001, PDFX32002, PDFA1A and PDFA1B. - It must be called before opening the document. - @param pdfxConformance the conformance level - - - Checks if the PDF/X Conformance is necessary. - @return true if the PDF has to be in conformance with any of the PDF/X specifications - - - Checks if any PDF ISO conformance is necessary. - @return true if the PDF has to be in conformance with any of the PDF ISO specifications - - - Shape arabic characters. This code was inspired by an LGPL'ed C library: - Pango ( see http://www.pango.com/ ). Note that the code of this is the - original work of Paulo Soares. Hence it is perfectly justifiable to distribute - it under the MPL. - - @author Paulo Soares - - - Some fonts do not implement ligaturized variations on Arabic characters - e.g. Simplified Arabic has got code point 0xFEED but not 0xFEEE - - - Digit shaping option: Replace European digits (U+0030...U+0039) by Arabic-Indic digits. - - - Digit shaping option: Replace Arabic-Indic digits by European digits (U+0030...U+0039). - - - Digit shaping option: - Replace European digits (U+0030...U+0039) by Arabic-Indic digits - if the most recent strongly directional character - is an Arabic letter (its Bidi direction value is RIGHT_TO_LEFT_ARABIC). - The initial state at the start of the text is assumed to be not an Arabic, - letter, so European digits at the start of the text will not change. - Compare to DIGITS_ALEN2AN_INIT_AL. - - - Digit shaping option: - Replace European digits (U+0030...U+0039) by Arabic-Indic digits - if the most recent strongly directional character - is an Arabic letter (its Bidi direction value is RIGHT_TO_LEFT_ARABIC). - The initial state at the start of the text is assumed to be an Arabic, - letter, so European digits at the start of the text will change. - Compare to DIGITS_ALEN2AN_INT_LR. - - - Not a valid option value. - - - Bit mask for digit shaping options. - - - Digit type option: Use Arabic-Indic digits (U+0660...U+0669). - - - Digit type option: Use Eastern (Extended) Arabic-Indic digits (U+06f0...U+06f9). - - - Bit mask for digit type options. - - - Arabic is written from right to left. - @return true - @see com.itextpdf.text.pdf.languages.LanguageProcessor#isRTL() - - - Signals that a bad PDF format has been used to construct a PdfObject. - - @see PdfException - @see PdfBoolean - @see PdfNumber - @see PdfString - @see PdfName - @see PdfDictionary - @see PdfFont - - - Base class containing properties and methods commom to all - barcode types. - - @author Paulo Soares - - - A type of barcode - - - A type of barcode - - - A type of barcode - - - A type of barcode - - - A type of barcode - - - A type of barcode - - - A type of barcode - - - A type of barcode - - - A type of barcode - - - A type of barcode - - - A type of barcode - - - A type of barcode - - - The minimum bar width. - - - The bar multiplier for wide bars or the distance between - bars for Postnet and Planet. - - - The text font. null if no text. - - - The size of the text or the height of the shorter bar - in Postnet. - - - If positive, the text distance under the bars. If zero or negative, - the text distance above the bars. - - - The height of the bars. - - - The text Element. Can be Element.ALIGN_LEFT, - Element.ALIGN_CENTER or Element.ALIGN_RIGHT. - - - The optional checksum generation. - - - Shows the generated checksum in the the text. - - - Show the start and stop character '*' in the text for - the barcode 39 or 'ABCD' for codabar. - - - Generates extended barcode 39. - - - The code to generate. - - - Show the guard bars for barcode EAN. - - - The code type. - - - The ink spreading. - - - Gets the minimum bar width. - @return the minimum bar width - - - Gets the bar multiplier for wide bars. - @return the bar multiplier for wide bars - - - Gets the text font. null if no text. - @return the text font. null if no text - - - Gets the size of the text. - @return the size of the text - - - Gets the text baseline. - If positive, the text distance under the bars. If zero or negative, - the text distance above the bars. - @return the baseline. - - - Gets the height of the bars. - @return the height of the bars - - - Gets the text Element. Can be Element.ALIGN_LEFT, - Element.ALIGN_CENTER or Element.ALIGN_RIGHT. - @return the text alignment - - - The property for the optional checksum generation. - - - Sets the property to show the generated checksum in the the text. - @param checksumText new value of property checksumText - - - Gets the property to show the start and stop character '*' in the text for - the barcode 39. - @param startStopText new value of property startStopText - - - Sets the property to generate extended barcode 39. - @param extended new value of property extended - - - Gets the code to generate. - @return the code to generate - - - Sets the property to show the guard bars for barcode EAN. - @param guardBars new value of property guardBars - - - Gets the code type. - @return the code type - - - Gets the maximum area that the barcode and the text, if - any, will occupy. The lower left corner is always (0, 0). - @return the size the barcode occupies. - - - - Creates a template with the barcode. - @param cb the PdfContentByte to create the template. It - serves no other use - @param barColor the color of the bars. It can be null - @param textColor the color of the text. It can be null - @return the template - @see #placeBarcode(PdfContentByte cb, BaseColor barColor, BaseColor textColor) - - - Creates an Image with the barcode. - @param cb the PdfContentByte to create the Image. It - serves no other use - @param barColor the color of the bars. It can be null - @param textColor the color of the text. It can be null - @return the Image - @see #placeBarcode(PdfContentByte cb, BaseColor barColor, BaseColor textColor) - - - The alternate text to be used, if present. - - - Sets the alternate text. If present, this text will be used instead of the - text derived from the supplied code. - @param altText the alternate text - - - - The bars to generate the code. - - - The stop bars. - - - The charset code change. - - - The charset code change. - - - The charset code change. - - - The code for UCC/EAN-128. - - - The start code. - - - The start code. - - - The start code. - - - Creates new Barcode128 - - - Removes the FNC1 codes in the text. - @param code the text to clean - @return the cleaned text - - - Gets the human readable text of a sequence of AI. - @param code the text - @return the human readable text - - - Returns true if the next numDigits - starting from index textIndex are numeric skipping any FNC1. - @param text the text to check - @param textIndex where to check from - @param numDigits the number of digits to check - @return the check result - - - Packs the digits for charset C also considering FNC1. It assumes that all the parameters - are valid. - @param text the text to pack - @param textIndex where to pack from - @param numDigits the number of digits to pack. It is always an even number - @return the packed digits, two digits per character - - - Converts the human readable text to the characters needed to - create a barcode using the specified code set. - @param text the text to convert - @param ucc true if it is an UCC/EAN-128. In this case - the character FNC1 is added - @param codeSet forced code set, or AUTO for optimized barcode. - @return the code ready to be fed to getBarsCode128Raw() - - - Converts the human readable text to the characters needed to - create a barcode. Some optimization is done to get the shortest code. - @param text the text to convert - @param ucc true if it is an UCC/EAN-128. In this case - the character FNC1 is added - @return the code ready to be fed to getBarsCode128Raw() - - - Generates the bars. The input has the actual barcodes, not - the human readable text. - @param text the barcode - @return the bars - - - Gets the maximum area that the barcode and the text, if - any, will occupy. The lower left corner is always (0, 0). - @return the size the barcode occupies. - - - - - Implements the code 39 and code 39 extended. The default parameters are: -
    -            x = 0.8f;
    -            n = 2;
    -            font = BaseFont.CreateFont("Helvetica", "winansi", false);
    -            size = 8;
    -            baseline = size;
    -            barHeight = size * 3;
    -            textint= Element.ALIGN_CENTER;
    -            generateChecksum = false;
    -            checksumText = false;
    -            startStopText = true;
    -            extended = false;
    -             
    - - @author Paulo Soares -
    - - The bars to generate the code. - - - The index chars to BARS. - - - The character combinations to make the code 39 extended. - - - Creates a new Barcode39. - - - Creates the bars. - @param text the text to create the bars. This text does not include the start and - stop characters - @return the bars - - - Converts the extended text into a normal, escaped text, - ready to generate bars. - @param text the extended text - @return the escaped text - - - Calculates the checksum. - @param text the text - @return the checksum - - - Gets the maximum area that the barcode and the text, if - any, will occupy. The lower left corner is always (0, 0). - @return the size the barcode occupies. - - - - Implements the code codabar. The default parameters are: -
    -            x = 0.8f;
    -            n = 2;
    -            font = BaseFont.CreateFont("Helvetica", "winansi", false);
    -            size = 8;
    -            baseline = size;
    -            barHeight = size * 3;
    -            textAlignment = Element.ALIGN_CENTER;
    -            generateChecksum = false;
    -            checksumText = false;
    -            startStopText = false;
    -             
    - - @author Paulo Soares -
    - - The bars to generate the code. - - - The index chars to BARS. - - - Creates a new BarcodeCodabar. - - - Creates the bars. - @param text the text to create the bars - @return the bars - - - Gets the maximum area that the barcode and the text, if - any, will occupy. The lower left corner is always (0, 0). - @return the size the barcode occupies. - - - - No error. - - - The text is too big for the symbology capabilities. - - - The dimensions given for the symbol are illegal. - - - An error while parsing an extension. - - - The best encodation will be used. - - - ASCII encodation. - - - C40 encodation. - - - TEXT encodation. - - - Binary encodation. - - - X21 encodation. - - - X12 encodation. - - @deprecated Use {@link BarcodeDataMatrix#DM_X12} instead. - - - EDIFACT encodation. - - - No encodation needed. The bytes provided are already encoded. - - - Allows extensions to be embedded at the start of the text. - - - Doesn't generate the image but returns all the other information. - - - Creates an instance of this class. - - - - - - Gets an Image with the barcode. A successful call to the method generate() - before calling this method is required. - @return the barcode Image - @throws BadElementException on error - - - Gets the generated image. The image is represented as a stream of bytes, each byte representing - 8 pixels, 0 for white and 1 for black, with the high-order bit of each byte first. Each row - is aligned at byte boundaries. The dimensions of the image are defined by height and width - plus 2 * ws. - @return the generated image - - - - - Gets/sets the whitespace border around the barcode. - @param ws the whitespace border around the barcode - - - - Generates barcodes in several formats: EAN13, EAN8, UPCA, UPCE, - supplemental 2 and 5. The default parameters are: -
    -            x = 0.8f;
    -            font = BaseFont.CreateFont("Helvetica", "winansi", false);
    -            size = 8;
    -            baseline = size;
    -            barHeight = size * 3;
    -            guardBars = true;
    -            codeType = EAN13;
    -            code = "";
    -             
    - - @author Paulo Soares -
    - - The bar positions that are guard bars. - - - The bar positions that are guard bars. - - - The bar positions that are guard bars. - - - The bar positions that are guard bars. - - - The bar positions that are guard bars. - - - The x coordinates to place the text. - - - The x coordinates to place the text. - - - The basic bar widths. - - - The total number of bars for EAN13. - - - The total number of bars for EAN8. - - - The total number of bars for UPCE. - - - The total number of bars for supplemental 2. - - - The total number of bars for supplemental 5. - - - Marker for odd parity. - - - Marker for even parity. - - - Sequence of parities to be used with EAN13. - - - Sequence of parities to be used with supplemental 2. - - - Sequence of parities to be used with supplemental 2. - - - Sequence of parities to be used with UPCE. - - - Creates new BarcodeEAN - - - Calculates the EAN parity character. - @param code the code - @return the parity character - - - Converts an UPCA code into an UPCE code. If the code can not - be converted a null is returned. - @param text the code to convert. It must have 12 numeric characters - @return the 8 converted digits or null if the - code could not be converted - - - Creates the bars for the barcode EAN13 and UPCA. - @param _code the text with 13 digits - @return the barcode - - - Creates the bars for the barcode EAN8. - @param _code the text with 8 digits - @return the barcode - - - Creates the bars for the barcode UPCE. - @param _code the text with 8 digits - @return the barcode - - - Creates the bars for the barcode supplemental 2. - @param _code the text with 2 digits - @return the barcode - - - Creates the bars for the barcode supplemental 5. - @param _code the text with 5 digits - @return the barcode - - - Gets the maximum area that the barcode and the text, if - any, will occupy. The lower left corner is always (0, 0). - @return the size the barcode occupies. - - - - - The barcode with the EAN/UPC. - - - The barcode with the supplemental. - - - Creates new combined barcode. - @param ean the EAN/UPC barcode - @param supp the supplemental barcode - - - Gets the maximum area that the barcode and the text, if - any, will occupy. The lower left corner is always (0, 0). - @return the size the barcode occupies. - - - - Implements the code interleaved 2 of 5. The text can include - non numeric characters that are printed but do not generate bars. - The default parameters are: -
    -            x = 0.8f;
    -            n = 2;
    -            font = BaseFont.CreateFont("Helvetica", "winansi", false);
    -            size = 8;
    -            baseline = size;
    -            barHeight = size * 3;
    -            textint= Element.ALIGN_CENTER;
    -            generateChecksum = false;
    -            checksumText = false;
    -             
    - - @author Paulo Soares -
    - - The bars to generate the code. - - - Creates new BarcodeInter25 - - - Deletes all the non numeric characters from text. - @param text the text - @return a string with only numeric characters - - - Calculates the checksum. - @param text the numeric text - @return the checksum - - - Creates the bars for the barcode. - @param text the text. It can contain non numeric characters - @return the barcode - - - Gets the maximum area that the barcode and the text, if - any, will occupy. The lower left corner is always (0, 0). - @return the size the barcode occupies. - - - - Generates the 2D barcode PDF417. Supports dimensioning auto-sizing, fixed - and variable sizes, automatic and manual error levels, raw codeword input, - codeword size optimization and bitmap inversion. The output can - be a CCITT G4 Image or a raw bitmap. - @author Paulo Soares - - - Auto-size is made based on aspectRatio and yHeight. - - - The size of the barcode will be at least codeColumns*codeRows. - - - The size will be at least codeColumns - with a variable number of codeRows. - - - The size will be at least codeRows - with a variable number of codeColumns. - - - The error level correction is set automatically according - to ISO 15438 recomendations. - - - The error level correction is set by the user. It can be 0 to 8. - - - One single binary segment is used - - - No text interpretation is done and the content of codewords - is used directly. - - - Inverts the output bits of the raw bitmap that is normally - bit one for black. It has only effect for the raw bitmap. - - - Use Macro PDF417 Encoding - @see #setMacroFileId(String) - @see #setMacroSegmentId(int) - @see #setMacroSegmentCount(int) - - - Creates a new BarcodePDF417 with the default settings. - - - Sets the segment id for macro PDF417 encoding - @param id the id (starting at 0) - @see #setMacroSegmentCount(int) - - - Sets the segment count for macro PDF417 encoding - @param cnt the number of macro segments - @see #setMacroSegmentId(int) - - - Sets the File ID for macro PDF417 encoding - @param id the file id - - - Set the default settings that correspond to PDF417_USE_ASPECT_RATIO - and PDF417_AUTO_ERROR_LEVEL. - - - Paints the barcode. If no exception was thrown a valid barcode is available. - - - Gets an Image with the barcode. The image will have to be - scaled in the Y direction by yHeightfor the barcode - to have the right printing aspect. - @return the barcode Image - @throws BadElementException on error - - - Gets the raw image bits of the barcode. The image will have to - be scaled in the Y direction by yHeight. - @return The raw barcode image - - - Gets the number of X pixels of outBits. - @return the number of X pixels of outBits - - - Gets the number of Y pixels of outBits. - It is also the number of rows in the barcode. - @return the number of Y pixels of outBits - Sets the number of barcode rows. This number may be changed - to keep the barcode valid. - @param codeRows the number of barcode rows - - - Sets the number of barcode data columns. - This number may be changed to keep the barcode valid. - @param codeColumns the number of barcode data columns - - - Gets the codeword array. This array is always 928 elements long. - It can be writen to if the option PDF417_USE_RAW_CODEWORDS - is set. - @return the codeword array - - - Sets the length of the codewords. - @param lenCodewords the length of the codewords - - - Gets the error level correction used for the barcode. It may different - from the previously set value. - @return the error level correction used for the barcode - Sets the error level correction for the barcode. - @param errorLevel the error level correction for the barcode - - - Sets the bytes that form the barcode. This bytes should - be interpreted in the codepage Cp437. - @param text the bytes that form the barcode - - - Sets the text that will form the barcode. This text is converted - to bytes using the encoding Cp437. - @param s the text that will form the barcode - @throws UnsupportedEncodingException if the encoding Cp437 is not supported - - - Sets the options to generate the barcode. This can be all - the PDF417_* constants. - @param options the options to generate the barcode - - - Sets the barcode aspect ratio. A ratio or 0.5 will make the - barcode width twice as large as the height. - @param aspectRatio the barcode aspect ratio - - - Sets the Y pixel height relative to X. It is usually 3. - @param yHeight the Y pixel height relative to X - - - Holds value of property outBits. - - - Holds value of property bitColumns. - - - Holds value of property codeRows. - - - Holds value of property codeColumns. - - - Holds value of property codewords. - - - Holds value of property lenCodewords. - - - Holds value of property errorLevel. - - - Holds value of property text. - - - Holds value of property options. - - - Holds value of property aspectRatio. - - - Holds value of property yHeight. - - - Gets the size of the barcode grid. - - - Implements the Postnet and Planet barcodes. The default parameters are: -
    -            n = 72f / 22f; // distance between bars
    -            x = 0.02f * 72f; // bar width
    -            barHeight = 0.125f * 72f; // height of the tall bars
    -            size = 0.05f * 72f; // height of the short bars
    -            codeType = POSTNET; // type of code
    -             
    - - @author Paulo Soares -
    - - The bars for each character. - - - Creates new BarcodePostnet - - - Creates the bars for Postnet. - @param text the code to be created without checksum - @return the bars - - - Gets the maximum area that the barcode and the text, if - any, will occupy. The lower left corner is always (0, 0). - @return the size the barcode occupies. - - - - A QRCode implementation based on the zxing code. - @author Paulo Soares - @since 5.0.2 - - - Creates the QR barcode. The barcode is always created with the smallest possible size and is then stretched - to the width and height given. Set the width and height to 1 to get an unscaled barcode. - @param content the text to be encoded - @param width the barcode width - @param height the barcode height - @param hints modifiers to change the way the barcode is create. They can be EncodeHintType.ERROR_CORRECTION - and EncodeHintType.CHARACTER_SET. For EncodeHintType.ERROR_CORRECTION the values can be ErrorCorrectionLevel.L, M, Q, H. - For EncodeHintType.CHARACTER_SET the values are strings and can be Cp437, Shift_JIS and ISO-8859-1 to ISO-8859-16. - You can also use UTF-8, but correct behaviour is not guaranteed as Unicode is not supported in QRCodes. - The default value is ISO-8859-1. - @throws WriterException - - - Gets an Image with the barcode. - @return the barcode Image - @throws BadElementException on error - - - Gets the size of the barcode grid. - - - A thin border with 1 point width. - - - A medium border with 2 point width. - - - A thick border with 3 point width. - - - The field is visible. - - - The field is hidden. - - - The field is visible but does not print. - - - The field is hidden but is printable. - - - The user may not change the value of the field. - - - The field must have a value at the time it is exported by a submit-form - action. - - - The field may contain multiple lines of text. - This flag is only meaningful with text fields. - - - The field will not scroll (horizontally for single-line - fields, vertically for multiple-line fields) to accommodate more text - than will fit within its annotation rectangle. Once the field is full, no - further text will be accepted. - - - The field is intended for entering a secure password that should - not be echoed visibly to the screen. - - - The text entered in the field represents the pathname of - a file whose contents are to be submitted as the value of the field. - - - The text entered in the field will not be spell-checked. - This flag is meaningful only in text fields and in combo - fields with the EDIT flag set. - - - If set the combo box includes an editable text box as well as a drop list; if - clear, it includes only a drop list. - This flag is only meaningful with combo fields. - - - whether or not a list may have multiple selections. Only applies to /CH LIST - fields, not combo boxes. - - - combo box flag. - - - Holds value of property rotation. - - - Holds value of property visibility. - - - Holds value of property fieldName. - - - Holds value of property options. - - - Holds value of property maxCharacterLength. - - - Creates a new TextField. - @param writer the document PdfWriter - @param box the field location and dimensions - @param fieldName the field name. If null only the widget keys - will be included in the field allowing it to be used as a kid field. - - - Sets the border width in points. To eliminate the border - set the border color to null. - @param borderWidth the border width in points - - - Sets the border style. The styles are found in PdfBorderDictionary - and can be STYLE_SOLID, STYLE_DASHED, - STYLE_BEVELED, STYLE_INSET and - STYLE_UNDERLINE. - @param borderStyle the border style - - - Sets the border color. Set to null to remove - the border. - @param borderColor the border color - - - Sets the background color. Set to null for - transparent background. - @param backgroundColor the background color - - - Sets the text color. If null the color used - will be black. - @param textColor the text color - - - Sets the text font. If null then Helvetica - will be used. - @param font the text font - - - Sets the font size. If 0 then auto-sizing will be used but - only for text fields. - @param fontSize the font size - - - Sets the text horizontal alignment. It can be Element.ALIGN_LEFT, - Element.ALIGN_CENTER and Element.ALIGN_RIGHT. - @param alignment the text horizontal alignment - - - Sets the text for text fields. - @param text the text - - - Sets the field dimension and position. - @param box the field dimension and position - - - Sets the field rotation. This value should be the same as - the page rotation where the field will be shown. - @param rotation the field rotation - - - Convenience method to set the field rotation the same as the - page rotation. - @param page the page - - - Sets the field visibility flag. This flags can be one of - VISIBLE, HIDDEN, VISIBLE_BUT_DOES_NOT_PRINT - and HIDDEN_BUT_PRINTABLE. - @param visibility field visibility flag - - - Sets the field name. - @param fieldName the field name. If null only the widget keys - will be included in the field allowing it to be used as a kid field. - - - Sets the option flags. The option flags can be a combination by oring of - READ_ONLY, REQUIRED, - MULTILINE, DO_NOT_SCROLL, - PASSWORD, FILE_SELECTION, - DO_NOT_SPELL_CHECK and EDIT. - @param options the option flags - - - Sets the maximum length of the field�s text, in characters. - It is only meaningful for text fields. - @param maxCharacterLength the maximum length of the field�s text, in characters - - - Moves the field keys from from to to. The moved keys - are removed from from. - @param from the source - @param to the destination. It may be null - - - - Summary description for BaseFont. - - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - The maximum height above the baseline reached by glyphs in this - font, excluding the height of glyphs for accented characters. - - - The y coordinate of the top of flat capital letters, measured from - the baseline. - - - The maximum depth below the baseline reached by glyphs in this - font. The value is a negative number. - - - The angle, expressed in degrees counterclockwise from the vertical, - of the dominant vertical strokes of the font. The value is - negative for fonts that slope to the right, as almost all italic fonts do. - - - The lower left x glyph coordinate. - - - The lower left y glyph coordinate. - - - The upper right x glyph coordinate. - - - The upper right y glyph coordinate. - - - java.awt.Font property - - - java.awt.Font property - - - java.awt.Font property - - - java.awt.Font property - - - The underline position. Usually a negative value. - - - The underline thickness. - - - The strikethrough position. - - - The strikethrough thickness. - - - The recommended vertical size for subscripts for this font. - - - The recommended vertical offset from the baseline for subscripts for this font. Usually a negative value. - - - The recommended vertical size for superscripts for this font. - - - The recommended vertical offset from the baseline for superscripts for this font. - - - The weight class of the font, as defined by the font author - @since 5.0.2 - - - The width class of the font, as defined by the font author - @since 5.0.2 - - - The entry of PDF FontDescriptor dictionary. - (Optional; PDF 1.5; strongly recommended for Type 3 fonts in Tagged PDF documents) - The weight (thickness) component of the fully-qualified font name or font specifier. - A value larger than 500 indicates bold font-weight. - - - The font is Type 1. - - - The font is True Type with a standard encoding. - - - The font is CJK. - - - The font is True Type with a Unicode encoding. - - - A font already inside the document. - - - A Type3 font. - - - The Unicode encoding with horizontal writing. - - - The Unicode encoding with vertical writing. - - - A possible encoding. - - - A possible encoding. - - - A possible encoding. - - - A possible encoding. - - - A possible encoding. - - - default array of six numbers specifying the font matrix, mapping glyph space to text space - - - if the font has to be embedded - - - if the font doesn't have to be embedded - - - if the font has to be cached - - - if the font doesn't have to be cached - - - The path to the font resources. - - - The fake CID code that represents a newline. - - - * Unicode Character 'PARAGRAPH SEPARATOR' (U+2029) - * Treated as a line feed character in XFA rich and plain text. - * @since 5.4.3 - - - The font type. - - - a not defined character in a custom PDF encoding - - - table of characters widths for this encoding - - - encoding names - - - same as differences but with the unicode codes - - - encoding used with this font - - - true if the font is to be embedded in the PDF - - - The compression level for the font stream. - @since 2.1.3 - - - true if the font must use its built in encoding. In that case the - encoding is only used to map a char to the position inside - the font, not to the expected char name. - - - cache for the fonts already used. - - - list of the 14 built in fonts. - - - Forces the output of the width array. Only matters for the 14 - built-in fonts. - - - Converts char directly to byte - by casting. - - - Indicates if all the glyphs and widths for that particular - encoding should be included in the document. - - - Custom encodings use this map to key the Unicode character - to the single byte code. - - - Generates the PDF stream with the Type1 and Truetype fonts returning - a PdfStream. - - - Generates the PDF stream with the Type1 and Truetype fonts returning - a PdfStream. - @param contents the content of the stream - @param lengths an array of int that describes the several lengths of each part of the font - @param compressionLevel the compression level of the Stream - @throws DocumentException error in the stream compression - @since 2.1.3 (replaces the constructor without param compressionLevel) - - - Generates the PDF stream for a font. - @param contents the content of a stream - @param subType the subtype of the font. - @param compressionLevel the compression level of the Stream - @throws DocumentException error in the stream compression - @since 2.1.3 (replaces the constructor without param compressionLevel) - - - Creates new BaseFont - - - Creates a new font. This will always be the default Helvetica font (not embedded). - This method is introduced because Helvetica is used in many examples. - @return a BaseFont object (Helvetica, Winansi, not embedded) - @throws IOException This shouldn't occur ever - @throws DocumentException This shouldn't occur ever - @since 2.1.1 - - - - - - - - Creates a font based on an existing document font. The created font font may not - behave as expected, depending on the encoding or subset. - @param fontRef the reference to the document font - @return the font - - - Indicates whether the font is used for verticl writing or not. - @return true if the writing mode is vertical for the given font, false otherwise. - - - Gets the name without the modifiers Bold, Italic or BoldItalic. - @param name the full name of the font - @return the name without the modifiers Bold, Italic or BoldItalic - - - Normalize the encoding names. "winansi" is changed to "Cp1252" and - "macroman" is changed to "MacRoman". - @param enc the encoding to be normalized - @return the normalized encoding - - - Creates the widths and the differences arrays - @throws UnsupportedEncodingException the encoding is not supported - - - Gets the width from the font according to the Unicode char c - or the name. If the name is null it's a symbolic font. - @param c the unicode char - @param name the glyph name - @return the width of the char - - - Gets the kerning between two Unicode chars. - @param char1 the first char - @param char2 the second char - @return the kerning to be applied - - - Sets the kerning between two Unicode chars. - @param char1 the first char - @param char2 the second char - @param kern the kerning to apply in normalized 1000 units - @return true if the kerning was applied, false otherwise - - - Gets the width of a char in normalized 1000 units. - @param char1 the unicode char to get the width of - @return the width in normalized 1000 units - - - Gets the width of a string in normalized 1000 units. - @param text the string to get the witdth of - @return the width in normalized 1000 units - - - Gets the descent of a String in normalized 1000 units. The descent will always be - less than or equal to zero even if all the characters have an higher descent. - @param text the String to get the descent of - @return the dexcent in normalized 1000 units - - - Gets the ascent of a String in normalized 1000 units. The ascent will always be - greater than or equal to zero even if all the characters have a lower ascent. - @param text the String to get the ascent of - @return the ascent in normalized 1000 units - - - Gets the descent of a String in points. The descent will always be - less than or equal to zero even if all the characters have an higher descent. - @param text the String to get the descent of - @param fontSize the size of the font - @return the dexcent in points - - - Gets the ascent of a String in points. The ascent will always be - greater than or equal to zero even if all the characters have a lower ascent. - @param text the String to get the ascent of - @param fontSize the size of the font - @return the ascent in points - - - Gets the width of a String in points taking kerning - into account. - @param text the String to get the witdth of - @param fontSize the font size - @return the width in points - - - Gets the width of a string in points. - @param text the string to get the witdth of - @param fontSize the font size - @return the width in points - - - Gets the width of a char in points. - @param char1 the char to get the witdth of - @param fontSize the font size - @return the width in points - - - - - Outputs to the writer the font dictionaries and streams. - @param writer the writer for this document - @param ref the font indirect reference - @param params several parameters that depend on the font type - @throws IOException on error - @throws DocumentException error in generating the object - - - Returns a PdfStream object with the full font program (if possible). - This method will return null for some types of fonts (CJKFont, Type3Font) - or if there is no font program available (standard Type 1 fonts). - @return a PdfStream with the font program - @since 2.1.3 - - - Gets the encoding used to convert string into byte[]. - @return the encoding name - - - Gets the font parameter identified by key. Valid values - for key are ASCENT, CAPHEIGHT, DESCENT, - ITALICANGLE, BBOXLLX, BBOXLLY, BBOXURX - and BBOXURY. - @param key the parameter to be extracted - @param fontSize the font size in points - @return the parameter in points - - - Sets the font parameter identified by key. Valid values - for key are ASCENT, CAPHEIGHT, DESCENT, - ITALICANGLE, BBOXLLX, BBOXLLY, BBOXURX - and BBOXURY. - @param key the parameter to be updated - @param value the parameter value - - - Gets the font type. The font types can be: FONT_TYPE_T1, - FONT_TYPE_TT, FONT_TYPE_CJK and FONT_TYPE_TTUNI. - @return the font type - - - Gets the embedded flag. - @return true if the font is embedded. - - - Gets the symbolic flag of the font. - @return true if the font is symbolic - - - Creates a unique subset prefix to be added to the font name when the font is embedded and subset. - @return the subset prefix - - - Gets the Unicode character corresponding to the byte output to the pdf stream. - @param index the byte index - @return the Unicode character - - - Gets the postscript font name. - @return the postscript font name - - - - - - Gets all the names from the font. Only the required tables are read. - @param name the name of the font - @param encoding the encoding of the font - @param ttfAfm the true type font or the afm in a byte array - @throws DocumentException on error - @throws IOException on error - @return an array of Object[] built with {getPostscriptFontName(), GetFamilyFontName(), GetFullFontName()} - - - Gets all the entries of the namestable from the font. Only the required tables are read. - @param name the name of the font - @param encoding the encoding of the font - @param ttfAfm the true type font or the afm in a byte array - @throws DocumentException on error - @throws IOException on error - @return an array of Object[] built with {getPostscriptFontName(), getFamilyFontName(), getFullFontName()} - - - - Gets the code pages supported by the font. This has only meaning - with True Type fonts. - @return the code pages supported by the font - - - Enumerates the postscript font names present inside a - True Type Collection. - @param ttcFile the file name of the font - @throws DocumentException on error - @throws IOException on error - @return the postscript font names - - - Enumerates the postscript font names present inside a - True Type Collection. - @param ttcArray the font as a byte array - @throws DocumentException on error - @throws IOException on error - @return the postscript font names - - - Gets the font width array. - @return the font width array - - - Gets the array with the names of the characters. - @return the array with the names of the characters - - - Gets the array with the unicode characters. - @return the array with the unicode characters - - - Set to true to force the generation of the - widths array. - @param forceWidthsOutput true to force the generation of the - widths array - - - Sets the conversion of char directly to byte - by casting. This is a low level feature to put the bytes directly in - the content stream without passing through string.GetBytes(). - @param directTextToByte New value of property directTextToByte. - - - Indicates if all the glyphs and widths for that particular - encoding should be included in the document. When set to true - only the glyphs used will be included in the font. When set to false - and {@link #addSubsetRange(int[])} was not called the full font will be included - otherwise just the characters ranges will be included. - @param subset new value of property subset - - - - Gets the CID code given an Unicode. - It has only meaning with CJK fonts. - @param c the Unicode - @return the CID equivalent - - - Checks if the font has any kerning pairs. - @return true if the font has any kerning pairs - - - Checks if a character exists in this font. - @param c the character to check - @return true if the character has a glyph, - false otherwise - - - Sets the character advance. - @param c the character - @param advance the character advance normalized to 1000 units - @return true if the advance was set, - false otherwise - - - Gets a list of all document fonts. Each element of the ArrayList - contains a Object[]{String,PRIndirectReference} with the font name - and the indirect reference to it. - @param reader the document where the fonts are to be listed from - @return the list of fonts and references - - - Gets a list of the document fonts in a particular page. Each element of the ArrayList - contains a Object[]{String,PRIndirectReference} with the font name - and the indirect reference to it. - @param reader the document where the fonts are to be listed from - @param page the page to list the fonts from - @return the list of fonts and references - - - Gets the smallest box enclosing the character contours. It will return - null if the font has not the information or the character has no - contours, as in the case of the space, for example. Characters with no contours may - also return [0,0,0,0]. - @param c the character to get the contour bounding box from - @return an array of four floats with the bounding box in the format [llx,lly,urx,ury] or - null - - - Gets default array of six numbers specifying the font matrix, mapping glyph space to text space - @return an array of six values - null - - - iText expects Arabic Diactrics (tashkeel) to have zero advance but some fonts, - most notably those that come with Windows, like times.ttf, have non-zero - advance for those characters. This method makes those character to have zero - width advance and work correctly in the iText Arabic shaping and reordering - context. - - - Adds a character range when subsetting. The range is an int array - where the first element is the start range inclusive and the second element is the - end range inclusive. Several ranges are allowed in the same array. - @param range the character range - - - Sets the compression level to be used for the font streams. - @param compressionLevel a value between 0 (best speed) and 9 (best compression) - @since 2.1.3 - - - Does all the line bidirectional processing with PdfChunk assembly. - - @author Paulo Soares - - - Creates new BidiLine - - - Call this after processLine() to know if any word was split into several lines. - @return - - - Gets the width of a range of characters. - @param startIdx the first index to calculate - @param lastIdx the last inclusive index to calculate - @return the sum of all widths - - - Gets the width of a range of characters. - @param startIdx the first index to calculate - @param lastIdx the last inclusive index to calculate - @param originalWidth the full width of the line. It is used in case of RTL and tab stops - @return the sum of all widths - - - Method that changes a String with Arabic characters into a String in which the ligatures are made. - @param s the original String - @param runDirection - @param arabicOptions - @return the String with the ligaturesc - - - Left-to-right - - - Left-to-Right Embedding - - - Left-to-Right Override - - - Right-to-Left - - - Right-to-Left Arabic - - - Right-to-Left Embedding - - - Right-to-Left Override - - - Pop Directional Format - - - European Number - - - European Number Separator - - - European Number Terminator - - - Arabic Number - - - Common Number Separator - - - Non-Spacing Mark - - - Boundary Neutral - - - Paragraph Separator - - - Segment Separator - - - Whitespace - - - Other Neutrals - - - Minimum bidi type value. - - - Maximum bidi type value. - - - Initialize using an array of direction types. Types range from TYPE_MIN to TYPE_MAX inclusive - and represent the direction codes of the characters in the text. - - @param types the types array - - - Initialize using an array of direction types and an externally supplied paragraph embedding level. - The embedding level may be -1, 0, or 1. -1 means to apply the default algorithm (rules P2 and P3), - 0 is for LTR paragraphs, and 1 is for RTL paragraphs. - - @param types the types array - @param paragraphEmbeddingLevel the externally supplied paragraph embedding level. - - - The algorithm. - Does not include line-based processing (Rules L1, L2). - These are applied later in the line-based phase of the algorithm. - - - - - Rules X9. - Remove explicit codes so that they may be ignored during the remainder - of the main portion of the algorithm. The length of the resulting text - is returned. - @return the length of the data excluding explicit codes and BN. - - - Reinsert levels information for explicit codes. - This is for ease of relating the level information - to the original input data. Note that the levels - assigned to these codes are arbitrary, they're - chosen so as to avoid breaking level runs. - @param textLength the length of the data after compression - @return the length of the data (original length of - types array supplied to constructor) - - - 2) determining explicit levels - Rules X1 - X8 - - The interaction of these rules makes handling them a bit complex. - This examines resultTypes but does not modify it. It returns embedding and - override information in the result array. The low 7 bits are the level, the high - bit is set if the level is an override, and clear if it is an embedding. - - - 3) resolving weak types - Rules W1-W7. - - Note that some weak types (EN, AN) remain after this processing is complete. - - - 6) resolving neutral types - Rules N1-N2. - - - 7) resolving implicit embedding levels - Rules I1, I2. - - - - Return multiline reordering array for a given level array. - Reordering does not occur across a line break. - - - Return reordering array for a given level array. This reorders a single line. - The reordering is a visual to logical map. For example, - the leftmost char is string.CharAt(order[0]). - Rule L2. - - - Return the base level of the paragraph. - - - Return true if the type is considered a whitespace type for the line break rules. - - - Return the strong type (L or R) corresponding to the level. - - - Return the limit of the run starting at index that includes only resultTypes in validSet. - This checks the value at index, and will return index if that value is not in validSet. - - - Return the start of the run including index that includes only resultTypes in validSet. - This assumes the value at index is valid, and does not check it. - - - Set resultTypes from start up to (but not including) limit to newType. - - - Set resultLevels from start up to (but not including) limit to newLevel. - - - Throw exception if type array is invalid. - - - Throw exception if paragraph embedding level is invalid. Special allowance for -1 so that - default processing can still be performed when using this API. - - - Throw exception if line breaks array is invalid. - - - Acts like a StringBuilder but works with byte arrays. - floating point is converted to a format suitable to the PDF. - @author Paulo Soares - - - The count of bytes in the buffer. - - - The buffer where the bytes are stored. - - - If true always output floating point numbers with 6 decimal digits. - If false uses the faster, although less precise, representation. - - - Creates new ByteBuffer with capacity 128 - - - Creates a byte buffer with a certain capacity. - @param size the initial capacity - - - - You can fill the cache in advance if you want to. - - @param decimals - - - Converts an double (multiplied by 100 and cast to an int) into an array of bytes. - - @param i the int - @return a bytearray - - - Appends an int. The size of the array will grow by one. - @param b the int to be appended - @return a reference to this ByteBuffer object - - - Appends the subarray of the byte array. The buffer will grow by - len bytes. - @param b the array to be appended - @param off the offset to the start of the array - @param len the length of bytes to Append - @return a reference to this ByteBuffer object - - - Appends an array of bytes. - @param b the array to be appended - @return a reference to this ByteBuffer object - - - Appends a string to the buffer. The string is - converted according to the encoding ISO-8859-1. - @param str the string to be appended - @return a reference to this ByteBuffer object - - - Appends a char to the buffer. The char is - converted according to the encoding ISO-8859-1. - @param c the char to be appended - @return a reference to this ByteBuffer object - - - Appends another ByteBuffer to this buffer. - @param buf the ByteBuffer to be appended - @return a reference to this ByteBuffer object - - - Appends the string representation of an int. - @param i the int to be appended - @return a reference to this ByteBuffer object - - - Appends the string representation of a long. - @param i the long to be appended - @return a reference to this ByteBuffer object - - - Appends a string representation of a float according - to the Pdf conventions. - @param i the float to be appended - @return a reference to this ByteBuffer object - - - Appends a string representation of a double according - to the Pdf conventions. - @param d the double to be appended - @return a reference to this ByteBuffer object - - - Outputs a double into a format suitable for the PDF. - @param d a double - @return the string representation of the double - - - Outputs a double into a format suitable for the PDF. - @param d a double - @param buf a ByteBuffer - @return the String representation of the double if - buf is null. If buf is not null, - then the double is appended directly to the buffer and this methods returns null. - - - Sets the size to zero. - - - Creates a newly allocated byte array. Its size is the current - size of this output stream and the valid contents of the buffer - have been copied into it. - - @return the current contents of this output stream, as a byte array. - - - Returns the current size of the buffer. - - @return the value of the count field, which is the number of valid bytes in this byte buffer. - - - Converts the buffer's contents into a string, translating bytes into - characters according to the platform's default character encoding. - - @return string translated from the buffer's contents. - - - Writes the complete contents of this byte buffer output to - the specified output stream argument, as if by calling the output - stream's write method using out.Write(buf, 0, count). - - @param out the output stream to which to write the data. - @exception IOException if an I/O error occurs. - - - List items for the linked list that builds the new CID font. - - - remember the current offset and increment by item's size in bytes. - - - Emit the byte stream for this item. - - - Fix up cross references to this item (applies only to markers). - - - set the value of an offset item that was initially unknown. - It will be fixed up latex by a call to xref on some marker. - - - A range item. - - - An index-offset item for the list. - The size denotes the required size in the CFF. A positive - value means that we need a specific size in bytes (for offset arrays) - and a negative value means that this is a dict item that uses a - variable-size representation. - - - - @author orly manor - - TODO To change the template for this generated type comment go to - Window - Preferences - Java - Code Generation - Code and Comments - - - an unknown offset in a dictionary for the list. - We will fix up the offset later; for now, assume it's large. - - - Card24 item. - - - Card32 item. - - - A SID or Card16 item. - - - A Card8 item. - - - A dictionary number on the list. - This implementation is inefficient: it doesn't use the variable-length - representation. - - - An offset-marker item for the list. - It is used to mark an offset and to set the offset list item. - - - a utility that creates a range item for an entire index - - @param indexOffset where the index is - @return a range item representing the entire index - - - get a single CID font. The PDF architecture (1.4) - supports 16-bit strings only with CID CFF fonts, not - in Type-1 CFF fonts, so we convert the font to CID if - it is in the Type-1 format. - Two other tasks that we need to do are to select - only a single font from the CFF package (this again is - a PDF restriction) and to subset the CharStrings glyph - description. - - - A random Access File or an array - (contributed by orly manor) - - - - - The Strings in this array represent Type1/Type2 operator names - - - The Strings in this array represent Type1/Type2 escape operator names - - - Operator codes for unused CharStrings and unused local and global Subrs - - - A HashMap containing the glyphs used in the text after being converted - to glyph number by the CMap - - - The GlyphsUsed keys as an ArrayList - - - A HashMap for keeping the FDArrays being used by the font - - - A HashMaps array for keeping the subroutines used in each FontDict - - - The SubroutinesUsed HashMaps as ArrayLists - - - A HashMap for keeping the Global subroutines used in the font - - - The Global SubroutinesUsed HashMaps as ArrayLists - - - A HashMap for keeping the subroutines used in a non-cid font - - - The SubroutinesUsed HashMap as ArrayList - - - An array of the new Indexs for the local Subr. One index for each FontDict - - - The new subroutines index for a non-cid font - - - The new global subroutines index of the font - - - The new CharString of the font - - - The bias for the global subroutines - - - The linked list for generating the new font stream - - - Number of arguments to the stem operators in a subroutine calculated recursivly - - - C'tor for CFFFontSubset - @param rf - The font file - @param GlyphsUsed - a HashMap that contains the glyph used in the subset - - - Calculates the length of the charset according to its format - @param Offset The Charset Offset - @param NumofGlyphs Number of glyphs in the font - @return the length of the Charset - - - Function calculates the number of ranges in the Charset - @param NumofGlyphs The number of glyphs in the font - @param Type The format of the Charset - @return The number of ranges in the Charset data structure - - - Read the FDSelect of the font and compute the array and its length - @param Font The index of the font being processed - @return The Processed FDSelect of the font - - - Function reads the FDSelect and builds the FDArrayUsed HashMap According to the glyphs used - @param Font the Number of font being processed - - - Read the FDArray count, offsize and Offset array - @param Font - - - The Process function extracts one font out of the CFF file and returns a - subset version of the original. - @param fontName - The name of the font to be taken out of the CFF - @return The new font stream - @throws IOException - - - Function calcs bias according to the CharString type and the count - of the subrs - @param Offset The offset to the relevent subrs index - @param Font the font - @return The calculated Bias - - - Function uses BuildNewIndex to create the new index of the subset charstrings - @param FontIndex the font - @throws IOException - - - - The function finds for the FD array processed the local subr offset and its - offset array. - @param Font the font - @param FD The FDARRAY processed - - - - - The function reads a subrs (glyph info) between begin and end. - Adds calls to a Lsubr to the hSubr and lSubrs. - Adds calls to a Gsubr to the hGSubr and lGSubrs. - @param begin the start point of the subr - @param end the end point of the subr - @param GBias the bias of the Global Subrs - @param LBias the bias of the Local Subrs - @param hSubr the HashMap for the lSubrs - @param lSubr the ArrayList for the lSubrs - - - Function Checks how the current operator effects the run time stack after being run - An operator may increase or decrease the stack size - - - Function checks the key and return the change to the stack after the operator - @return The change in the stack. 2-> flush the stack - - - Empty the Type2 Stack - - - - Pop one element from the stack - - - - Add an item to the stack - - - - The function reads the next command after the file pointer is set - - - The function reads the subroutine and returns the number of the hint in it. - If a call to another subroutine is found the function calls recursively. - @param begin the start point of the subr - @param end the end point of the subr - @param LBias the bias of the Local Subrs - @param GBias the bias of the Global Subrs - @param LSubrsOffsets The Offsets array of the subroutines - @return The number of hints in the subroutine read. - - - Function builds the new offset array, object array and assembles the index. - used for creating the glyph and subrs subsetted index - @param Offsets the offset array of the original index - @param Used the hashmap of the used objects - @param OperatorForUnusedEntries the operator inserted into the data stream for unused entries - @return the new index subset version - @throws IOException - - - Function builds the new offset array, object array and assembles the index. - used for creating the glyph and subrs subsetted index - @param Offsets the offset array of the original index - @param OperatorForUnusedEntries the operator inserted into the data stream for unused entries - @return the new index subset version - @throws IOException - - - Function creates the new index, inserting the count,offsetsize,offset array - and object array. - @param NewOffsets the subsetted offset array - @param NewObjects the subsetted object array - @return the new index created - - - The function builds the new output stream according to the subset process - @param Font the font - @return the subseted font stream - @throws IOException - - - Function Copies the header from the original fileto the output list - - - Function Build the header of an index - @param Count the count field of the index - @param Offsize the offsize field of the index - @param First the first offset of the index - - - Function adds the keys into the TopDict - @param fdarrayRef OffsetItem for the FDArray - @param fdselectRef OffsetItem for the FDSelect - @param charsetRef OffsetItem for the CharSet - @param charstringsRef OffsetItem for the CharString - - - Function takes the original string item and adds the new strings - to accomodate the CID rules - @param Font the font - - - Function creates new FDSelect for non-CID fonts. - The FDSelect built uses a single range for all glyphs - @param fdselectRef OffsetItem for the FDSelect - @param nglyphs the number of glyphs in the font - - - Function creates new CharSet for non-CID fonts. - The CharSet built uses a single range for all glyphs - @param charsetRef OffsetItem for the CharSet - @param nglyphs the number of glyphs in the font - - - Function creates new FDArray for non-CID fonts. - The FDArray built has only the "Private" operator that points to the font's - original private dict - @param fdarrayRef OffsetItem for the FDArray - @param privateRef OffsetItem for the Private Dict - @param Font the font - - - Function reconstructs the FDArray, PrivateDict and LSubr for CID fonts - @param Font the font - @throws IOException - - - Function subsets the FDArray and builds the new one with new offsets - @param Font The font - @param fdPrivate OffsetItem Array (one for each FDArray) - @throws IOException - - - Function Adds the new private dicts (only for the FDs used) to the list - @param Font the font - @param fdPrivate OffsetItem array one element for each private - @param fdPrivateBase IndexBaseItem array one element for each private - @param fdSubrs OffsetItem array one element for each private - @throws IOException - - - Function Adds the new LSubrs dicts (only for the FDs used) to the list - @param Font The index of the font - @param fdPrivateBase The IndexBaseItem array for the linked list - @param fdSubrs OffsetItem array for the linked list - @throws IOException - - - Calculates how many byte it took to write the offset for the subrs in a specific - private dict. - @param Offset The Offset for the private dict - @param Size The size of the private dict - @return The size of the offset of the subrs in the private dict - - - Function computes the size of an index - @param indexOffset The offset for the computed index - @return The size of the index - - - The function creates a private dict for a font that was not CID - All the keys are copied as is except for the subrs key - @param Font the font - @param Subr The OffsetItem for the subrs of the private - - - the function marks the beginning of the subrs index and adds the subsetted subrs - index to the output list. - @param Font the font - @param PrivateBase IndexBaseItem for the private that's referencing to the subrs - @param Subrs OffsetItem for the subrs - @throws IOException - - - Creates a CJK font compatible with the fonts in the Adobe Asian font Pack. - - @author Paulo Soares - - - The encoding used in the PDF document for CJK fonts - - - The path to the font resources. - - - The font name - - - The style modifier - - - The CMap name associated with this font - - - Creates a CJK font. - @param fontName the name of the font - @param enc the encoding of the font - @param emb always false. CJK font and not embedded - @throws DocumentException on error - @throws IOException on error - - - Returns a font compatible with a CJK encoding or null if not found. - @param enc - @return - - - Checks if its a valid CJK font. - @param fontName the font name - @param enc the encoding - @return true if it is CJK font - - - Gets the width of a char in normalized 1000 units. - @param char1 the unicode char to get the width of - @return the width in normalized 1000 units - - - You can't get the FontStream of a CJK font (CJK fonts are never embedded), - so this method always returns null. - @return null - @since 2.1.3 - - - Gets the font parameter identified by key. Valid values - for key are ASCENT, CAPHEIGHT, DESCENT - and ITALICANGLE. - @param key the parameter to be extracted - @param fontSize the font size in points - @return the parameter in points - - - - - - - - Implementation of DocumentFont used while parsing PDF streams. - @since 2.1.4 - - - The font dictionary. - - - the width of a space for this font, in normalized 1000 point units - - - The CMap constructed from the ToUnicode map from the font's dictionary, if present. - This CMap transforms CID values into unicode equivalent - - - Mapping between CID code (single byte only for now) and unicode equivalent - as derived by the font's encoding. Only needed if the ToUnicode CMap is not provided. - - - Creates an instance of a CMapAwareFont based on an indirect reference to a font. - @param refFont the indirect reference to a font - - - Parses the ToUnicode entry, if present, and constructs a CMap for it - @since 2.1.7 - - - Inverts DocumentFont's uni2byte mapping to obtain a cid-to-unicode mapping based - on the font's encoding - @since 2.1.7 - - - For all widths of all glyphs, compute the average width in normalized 1000 point units. - This is used to give some meaningful width in cases where we need an average font width - (such as if the width of a space isn't specified by a given font) - @return the average width of all non-zero width glyphs in the font - - - @since 2.1.5 - Override to allow special handling for fonts that don't specify width of space character - @see com.itextpdf.text.pdf.DocumentFont#getWidth(int) - - - Decodes a single CID (represented by one or two bytes) to a unicode String. - @param bytes the bytes making up the character code to convert - @param offset an offset - @param len a length - @return a String containing the encoded form of the input bytes using the font's encoding. - - - Decodes a string of bytes (encoded in the font's encoding) into a unicode string - This will use the ToUnicode map of the font, if available, otherwise it uses - the font's encoding - @param cidbytes the bytes that need to be decoded - @return the unicode String that results from decoding - @since 2.1.7 - - - ! .NET SPECIFIC; this method is used to avoid unecessary using of StringBuilder because it is slow in .NET ! - Decodes a single character string of bytes (encoded in the font's encoding) into a unicode string - This will use the ToUnicode map of the font, if available, otherwise it uses - the font's encoding - @param cidbytes the bytes that need to be decoded - @return the unicode String that results from decoding - - - Encodes bytes to a String. - @param bytes the bytes from a stream - @param offset an offset - @param len a length - @return a String encoded taking into account if the bytes are in unicode or not. - @deprecated method name is not indicative of what it does. Use decode instead. - - - - @author Paulo Soares - - - A type of PDF Collection - - - A type of PDF Collection - - - A type of PDF Collection - - - A type of PDF Collection - - - Constructs a PDF Collection. - @param type the type of PDF collection. - - - Identifies the document that will be initially presented - in the user interface. - @param description the description that was used when attaching the file to the document - - - Sets the Collection schema dictionary. - @param schema an overview of the collection fields - - - Sets the Collection sort dictionary. - @param sort a collection sort dictionary - - - @author blowagie - - - - A possible type of collection field. - - - A possible type of collection field. - - - A possible type of collection field. - - - A possible type of collection field. - - - A possible type of collection field. - - - A possible type of collection field. - - - A possible type of collection field. - - - A possible type of collection field. - - - The type of the PDF collection field. - - - Creates a PdfCollectionField. - @param name the field name - @param type the field type - - - The relative order of the field name. Fields are sorted in ascending order. - @param i a number indicating the order of the field - - - Sets the initial visibility of the field. - @param visible the default is true (visible) - - - Indication if the field value should be editable in the viewer. - @param editable the default is false (not editable) - - - Checks if the type of the field is suitable for a Collection Item. - - - Returns a PdfObject that can be used as the value of a Collection Item. - @param String value the value that has to be changed into a PdfObject (PdfString, PdfDate or PdfNumber) - - - The PdfCollectionSchema with the names and types of the items. - - - Constructs a Collection Item that can be added to a PdfFileSpecification. - - - Sets the value of the collection item. - @param value - - - Sets the value of the collection item. - @param value - - - Sets the value of the collection item. - @param value - - - Sets the value of the collection item. - @param value - - - Sets the value of the collection item. - @param value - - - Sets the value of the collection item. - @param value - - - Sets the value of the collection item. - @param value - - - Sets the value of the collection item. - @param value - - - Adds a prefix for the Collection item. - You can only use this method after you have set the value of the item. - @param prefix a prefix - - - Creates a Collection Schema dictionary. - - - Adds a Collection field to the Schema. - @param name the name of the collection field - @param field a Collection Field - - - Constructs a PDF Collection Sort Dictionary. - @param key the key of the field that will be used to sort entries - - - Constructs a PDF Collection Sort Dictionary. - @param keys the keys of the fields that will be used to sort entries - - - Defines the sort order of the field (ascending or descending). - @param ascending true is the default, use false for descending order - - - Defines the sort order of the field (ascending or descending). - @param ascending an array with every element corresponding with a name of a field. - - - Creates dictionary referring to a target document that is the parent of the current document. - @param nested null if this is the actual target, another target if this is only an intermediate target. - - - Creates a dictionary referring to a target document. - @param child if false, this refers to the parent document; if true, this refers to a child document, and you'll have to specify where to find the child using the other methods of this class - - - If this dictionary refers to a child that is a document level attachment, - you need to specify the name that was used to attach the document. - @param name the name in the EmbeddedFiles name tree - - - If this dictionary refers to a child that is a file attachment added to a page, - you need to specify the name of the page (or use setFileAttachmentPage to specify the page number). - Once you have specified the page, you still need to specify the attachment using another method. - @param name the named destination referring to the page with the file attachment. - - - If this dictionary refers to a child that is a file attachment added to a page, - you need to specify the page number (or use setFileAttachmentPagename to specify a named destination). - Once you have specified the page, you still need to specify the attachment using another method. - @param page the page number of the page with the file attachment. - - - If this dictionary refers to a child that is a file attachment added to a page, - you need to specify the page with setFileAttachmentPage or setFileAttachmentPageName, - and then specify the name of the attachment added to this page (or use setFileAttachmentIndex). - @param name the name of the attachment - - - If this dictionary refers to a child that is a file attachment added to a page, - you need to specify the page with setFileAttachmentPage or setFileAttachmentPageName, - and then specify the index of the attachment added to this page (or use setFileAttachmentName). - @param name the name of the attachment - - - If this dictionary refers to an intermediate target, you can - add the next target in the sequence. - @param nested the next target in the sequence - - - Each colorSpace in the document will have an instance of this class - - @author Phillip Pan (phillip@formstar.com) - - - The indirect reference to this color - - - The color name that appears in the document body stream - - - The color - - - Each spot color used in a document has an instance of this class. - @param colorName the color name - @param indirectReference the indirect reference to the font - @param scolor the PDfSpotColor - - - Gets the indirect reference to this color. - @return the indirect reference to this color - - - Gets the color name as it appears in the document body. - @return the color name - - - Gets the SpotColor object. - @return the PdfSpotColor - - - - Eliminate the arabic vowels - - - Compose the tashkeel in the ligatures. - - - Do some extra double ligatures. - - - Digit shaping option: Replace European digits (U+0030...U+0039) by Arabic-Indic digits. - - - Digit shaping option: Replace Arabic-Indic digits by European digits (U+0030...U+0039). - - - Digit shaping option: - Replace European digits (U+0030...U+0039) by Arabic-Indic digits - if the most recent strongly directional character - is an Arabic letter (its Bidi direction value is RIGHT_TO_LEFT_ARABIC). - The initial state at the start of the text is assumed to be not an Arabic, - letter, so European digits at the start of the text will not change. - Compare to DIGITS_ALEN2AN_INIT_AL. - - - Digit shaping option: - Replace European digits (U+0030...U+0039) by Arabic-Indic digits - if the most recent strongly directional character - is an Arabic letter (its Bidi direction value is RIGHT_TO_LEFT_ARABIC). - The initial state at the start of the text is assumed to be an Arabic, - letter, so European digits at the start of the text will change. - Compare to DIGITS_ALEN2AN_INT_LR. - - - Digit type option: Use Arabic-Indic digits (U+0660...U+0669). - - - Digit type option: Use Eastern (Extended) Arabic-Indic digits (U+06f0...U+06f9). - - - Signals that there is no more text available. - - - Signals that there is no more column. - - - The column is valid. - - - The line is out the column limits. - - - The line cannot fit this column position. - - - Upper bound of the column. - - - Lower bound of the column. - - - The column Element. Default is left Element. - - - The left column bound. - - - The right column bound. - - - The chunks that form the text. - - - The current y line location. Text will be written at this line minus the leading. - - - The X position after the last line that has been written. - @since 5.0.3 - - - The leading for the current line. - - - The fixed text leading. - - - The text leading that is multiplied by the biggest font size in the line. - - - The PdfContent where the text will be written to. - - - The line status when trying to fit a line to a column. - - - The first paragraph line indent. - - - The following paragraph lines indent. - - - The right paragraph lines indent. - - - The extra space between paragraphs. - - - The width of the line when the column is defined as a simple rectangle. - - - Holds value of property spaceCharRatio. - - - Holds value of property linesWritten. - - - Holds value of property arabicOptions. - - - Pointer for the row in a table that is being dealt with - @since 5.1.0 - - - The index of the last row that needed to be splitted. - @since 5.0.1 changed a boolean into an int - -2 value mean it is the first attempt to split the first row. - -1 means that we try to avoid splitting current row. - - - if true, first line height is adjusted so that the max ascender touches the top - - - @since 5.4.2 - - - Creates a ColumnText. - @param text the place where the text will be written to. Can - be a template. - - - Creates an independent duplicated of the instance org. - @param org the original ColumnText - @return the duplicated - - - Makes this instance an independent copy of org. - @param org the original ColumnText - @return itself - - - Adds a Phrase to the current text array. - @param phrase the text - - - Replaces the current text array with this Phrase. - Anything added previously with AddElement() is lost. - @param phrase the text - - - Adds a Chunk to the current text array. - Will not have any effect if AddElement() was called before. - @param chunk the text - - - - - Finds the intersection between the yLine and the column. It will - set the lineStatus apropriatly. - @param wall the column to intersect - @return the x coordinate of the intersection - - - Finds the intersection between the yLine and the two - column bounds. It will set the lineStatus apropriatly. - @return a float[2]with the x coordinates of the intersection - - - Finds the intersection between the yLine, - the yLine-leadingand the two - column bounds. It will set the lineStatus apropriatly. - @return a float[4]with the x coordinates of the intersection - - - Sets the columns bounds. Each column bound is described by a - float[] with the line points [x1,y1,x2,y2,...]. - The array must have at least 4 elements. - @param leftLine the left column bound - @param rightLine the right column bound - - - Simplified method for rectangular columns. - @param phrase a Phrase - @param llx the lower left x corner - @param lly the lower left y corner - @param urx the upper right x corner - @param ury the upper right y corner - @param leading the leading - @param alignment the column alignment - - - Simplified method for rectangular columns. - @param llx the lower left x corner - @param lly the lower left y corner - @param urx the upper right x corner - @param ury the upper right y corner - @param leading the leading - @param alignment the column alignment - - - Simplified method for rectangular columns. - @param llx - @param lly - @param urx - @param ury - - - Simplified method for rectangular columns. - @param rect the rectangle for the column - - - Sets the leading fixed and variable. The resultant leading will be - fixedLeading+multipliedLeading*maxFontSize where maxFontSize is the - size of the bigest font in the line. - @param fixedLeading the fixed leading - @param multipliedLeading the variable leading - - - Gets the fixed leading - @return the leading - - - Gets the variable leading - @return the leading - - - Gets the yLine. - @return the yLine - - - Gets the number of rows that were drawn when a table is involved. - - - Gets the Element. - @return the alignment - - - Gets the first paragraph line indent. - @return the indent - - - Sets the first paragraph line indent. - - @param indent the indent - @param repeatFirstLineIndent do we need to repeat the indentation of the first line after a newline? - - - Gets the following paragraph lines indent. - @return the indent - - - Gets the right paragraph lines indent. - @return the indent - - - Gets the currentLeading. - - @return the currentLeading - - - Outputs the lines to the document. It is equivalent to go(false). - @return returns the result of the operation. It can be NO_MORE_TEXT - and/or NO_MORE_COLUMN - @throws DocumentException on error - - - Outputs the lines to the document. The output can be simulated. - @param simulate true to simulate the writting to the document - @return returns the result of the operation. It can be NO_MORE_TEXT - and/or NO_MORE_COLUMN - @throws DocumentException on error - - - Call this after go() to know if any word was split into several lines. - @return - - - Sets the extra space between paragraphs. - @return the extra space between paragraphs - - - Clears the chunk array. A call to go() will always return - NO_MORE_TEXT. - - - Gets the space/character extra spacing ratio for - fully justified text. - @return the space/character extra spacing ratio - - - Gets the run direction. - @return the run direction - - - Gets the number of lines written. - @return the number of lines written - - - Gets the X position of the end of the last line that has been written - (will not work in simulation mode!). - @since 5.0.3 - - - Sets the arabic shaping options. The option can be AR_NOVOWEL, - AR_COMPOSEDTASHKEEL and AR_LIG. - @param arabicOptions the arabic shaping options - - - Gets the biggest descender value of the last line written. - @return the biggest descender value of the last line written - - - Gets the width that the line will occupy after writing. - Only the width of the first line is returned. - @param phrase the Phrase containing the line - @param runDirection the run direction - @param arabicOptions the options for the arabic shaping - @return the width of the line - - - Gets the width that the line will occupy after writing. - Only the width of the first line is returned. - @param phrase the Phrase containing the line - @return the width of the line - - - Shows a line of text. Only the first line is written. - @param canvas where the text is to be written to - @param alignment the alignment. It is not influenced by the run direction - @param phrase the Phrase with the text - @param x the x reference position - @param y the y reference position - @param rotation the rotation to be applied in degrees counterclockwise - @param runDirection the run direction - @param arabicOptions the options for the arabic shaping - - - Shows a line of text. Only the first line is written. - @param canvas where the text is to be written to - @param alignment the alignment - @param phrase the Phrase with the text - @param x the x reference position - @param y the y reference position - @param rotation the rotation to be applied in degrees counterclockwise - - - Fits the text to some rectangle adjusting the font size as needed. - @param font the font to use - @param text the text - @param rect the rectangle where the text must fit - @param maxFontSize the maximum font size - @param runDirection the run direction - @return the calculated font size that makes the text fit - - - Sets the canvas. - @param canvas - - - Sets the canvases. - @param canvas - - - Checks if the element has a height of 0. - @return true or false - @since 2.1.2 - - - Enables/Disables adjustment of first line height based on max ascender. - @param use enable adjustment if true - - - Checks the status variable and looks if there's still some text. - - - Holds value of property filledWidth. - - - Sets the real width used by the largest line. Only used to set it - to zero to start another measurement. - @param filledWidth the real width used by the largest line - - - Replaces the filledWidth if greater than the existing one. - @param w the new filledWidth if greater than the existing one - - - Sets the first line adjustment. Some objects have properties, like spacing before, that - behave differently if the object is the first to be written after go() or not. The first line adjustment is - true by default but can be changed if several objects are to be placed one - after the other in the same column calling go() several times. - @param adjustFirstLine true to adjust the first line, false otherwise - - - Creates an AES Cipher with CBC and no padding. - @author Paulo Soares - - - Creates a new instance of AESCipher - - - Creates a new instance of ARCFOUREncryption - - - An initialization vector generator for a CBC block encryption. It's a random generator based on RC4. - @author Paulo Soares - - - Creates a new instance of IVGenerator - - - Gets a 16 byte random initialization vector. - @return a 16 byte random initialization vector - - - Gets a random initialization vector. - @param len the length of the initialization vector - @return a random initialization vector - - - Creates a new instance of StandardDecryption - - - Creates an AES Cipher with CBC and padding PKCS5/7. - @author Paulo Soares - - - Creates a new instance of AESCipher - - - - An instance of the default SplitCharacter. - - - Default constructor, has no custom characters to check. - - - Constructor with one splittable character. - - @param character char - - - Constructor with an array of splittable characters - - @param characters char[] - - - - Returns the current character - - @param current current position in the array - @param ck chunk array - @param cc the character array that has to be checked - @return the current character - - - Creates a new instance of DocumentFont - - - Creates a new instance of DocumentFont - - - Creates a new instance of DocumentFont - - - - Gets the font parameter identified by key. Valid values - for key are ASCENT, CAPHEIGHT, DESCENT, - ITALICANGLE, BBOXLLX, BBOXLLY, BBOXURX - and BBOXURY. - @param key the parameter to be extracted - @param fontSize the font size in points - @return the parameter in points - - - - - - Gets the kerning between two Unicode chars. - @param char1 the first char - @param char2 the second char - @return the kerning to be applied - - - - Gets the postscript font name. - @return the postscript font name - - - - Gets the width from the font according to the Unicode char c - or the name. If the name is null it's a symbolic font. - @param c the unicode char - @param name the glyph name - @return the width of the char - - - - Checks if the font has any kerning pairs. - @return true if the font has any kerning pairs - - - - Outputs to the writer the font dictionaries and streams. - @param writer the writer for this document - @param ref the font indirect reference - @param params several parameters that depend on the font type - @throws IOException on error - @throws DocumentException error in generating the object - - - - Always returns null. - @return null - @since 2.1.3 - - - Gets the width of a char in normalized 1000 units. - @param char1 the unicode char to get the width of - @return the width in normalized 1000 units - - - Exposes the unicode - > CID map that is constructed from the font's encoding - @return the unicode to CID map - @since 2.1.7 - - - Exposes the CID - > unicode map that is constructed from the font's encoding - @return the CID to unicode map - @since 5.4.0 - - - Gets the difference map - @return the difference map - @since 5.0.5 - - - Element that draws a dotted line from left to right. - Can be added directly to a document or column. - Can also be used to create a separator chunk. - @since 2.1.2 - - - the gap between the dots. - - - @see com.lowagie.text.pdf.draw.DrawInterface#draw(com.lowagie.text.pdf.PdfContentByte, float, float, float, float, float) - - - Setter for the gap between the center of the dots of the dotted line. - @param gap the gap between the center of the dots - - - Interface for an Element that allows you to draw something at the current - vertical position. Trivial implementations are LineSeparator and VerticalPositionMark. - It is also used to define what has to be drawn by a separator chunk. - @since 2.1.2 - - - Implement this method if you want to draw something at the current Y position - (for instance a line). - @param canvas the canvas on which you can draw - @param llx the x coordinate of the left page margin - @param lly the y coordinate of the bottom page margin - @param urx the x coordinate of the right page margin - @param ury the y coordinate of the top page margin - @param y the current y position on the page - - - Element that draws a solid line from left to right. - Can be added directly to a document or column. - Can also be used to create a separator chunk. - @author Paulo Soares - @since 2.1.2 - - - The thickness of the line. - - - The width of the line as a percentage of the available page width. - - - The color of the line. - - - The alignment of the line. - - - Creates a new instance of the LineSeparator class. - @param lineWidth the thickness of the line - @param percentage the width of the line as a percentage of the available page width - @param color the color of the line - @param align the alignment - @param offset the offset of the line relative to the current baseline (negative = under the baseline) - - - Creates a new instance of the LineSeparator class. - @param font the font - - - Creates a new instance of the LineSeparator class with - default values: lineWidth 1 user unit, width 100%, centered with offset 0. - - - @see com.lowagie.text.pdf.draw.DrawInterface#draw(com.lowagie.text.pdf.PdfContentByte, float, float, float, float, float) - - - Draws a horizontal line. - @param canvas the canvas to draw on - @param leftX the left x coordinate - @param rightX the right x coordindate - @param y the y coordinate - - - Setter for the line width. - @param lineWidth the thickness of the line that will be drawn. - - - Setter for the width as a percentage of the available width. - @return a width percentage - - - Setter for the color of the line that will be drawn. - @param color a color - - - Setter for the alignment of the line. - @param align an alignment value - - - Helper class implementing the DrawInterface. Can be used to add - horizontal or vertical separators. Won't draw anything unless - you implement the draw method. - @since 2.1.2 - - - Another implementation of the DrawInterface; its draw method will overrule LineSeparator.Draw(). - - - The offset for the line. - - - Creates a vertical position mark that won't draw anything unless - you define a DrawInterface. - - - Creates a vertical position mark that won't draw anything unless - you define a DrawInterface. - @param drawInterface the drawInterface for this vertical position mark. - @param offset the offset for this vertical position mark. - - - @see com.lowagie.text.pdf.draw.DrawInterface#draw(com.lowagie.text.pdf.PdfContentByte, float, float, float, float, float) - - - @see com.lowagie.text.Element#process(com.lowagie.text.ElementListener) - - - @see com.lowagie.text.Element#type() - - - @see com.lowagie.text.Element#isContent() - - - @see com.lowagie.text.Element#isNestable() - - - @see com.lowagie.text.Element#getChunks() - - - Setter for the interface with the overruling Draw() method. - @param drawInterface a DrawInterface implementation - - - Setter for the offset. The offset is relative to the current - Y position. If you want to underline something, you have to - choose a negative offset. - @param offset an offset - - - Enumerates all the fonts inside a True Type Collection. - - @author Paulo Soares - - - Class for an index. - - @author Michael Niedermair - - - Keeps a map with fields that are to be positioned in inGenericTag. - - - Keeps the form field that is to be positioned in a cellLayout event. - - - The PdfWriter to use when a field has to added in a cell event. - - - The PdfFormField that is the parent of the field added in a cell event. - - - Creates a new event. This constructor will be used if you need to position fields with Chunk objects. - - - Some extra padding that will be taken into account when defining the widget. - - - Add a PdfFormField that has to be tied to a generic Chunk. - - - Creates a new event. This constructor will be used if you need to position fields with a Cell Event. - - - Creates a new event. This constructor will be used if you need to position fields with a Cell Event. - - - Creates a new event. This constructor will be used if you need to position fields with a Cell Event. - @throws DocumentException - @throws IOException - - - Creates a new event. This constructor will be used if you need to position fields with a Cell Event. - @throws DocumentException - @throws IOException - - - @param padding The padding to set. - - - @param parent The parent to set. - - - @see com.lowagie.text.pdf.PdfPageEvent#onGenericTag(com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document, com.lowagie.text.Rectangle, java.lang.String) - - - @see com.lowagie.text.pdf.PdfPCellEvent#cellLayout(com.lowagie.text.pdf.PdfPCell, com.lowagie.text.Rectangle, com.lowagie.text.pdf.PdfContentByte[]) - - - Class for an index. - - @author Michael Niedermair - - - keeps the indextag with the pagenumber - - - All the text that is passed to this event, gets registered in the indexentry. - - @see com.lowagie.text.pdf.PdfPageEventHelper#onGenericTag( - com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document, - com.lowagie.text.Rectangle, java.lang.String) - - - indexcounter - - - the list for the index entry - - - Create an index entry. - - @param text The text for the Chunk. - @param in1 The first level. - @param in2 The second level. - @param in3 The third level. - @return Returns the Chunk. - - - Create an index entry. - - @param text The text for the Chunk. - @param in1 The first level. - @return Returns the Chunk. - - - Create an index entry. - - @param text The text for the Chunk. - @param in1 The first level. - @param in2 The second level. - @return Returns the Chunk. - - - Create an index entry. - - @param text The text. - @param in1 The first level. - @param in2 The second level. - @param in3 The third level. - - - Create an index entry. - - @param text The text. - @param in1 The first level. - - - Create an index entry. - - @param text The text. - @param in1 The first level. - @param in2 The second level. - - - Comparator for sorting the index - - - Set the comparator. - @param aComparator The comparator to set. - - - Returns the sorted list with the entries and the collected page numbers. - @return Returns the sorted list with the entries and teh collected page numbers. - - - Class for an index entry. -

    - In the first step, only in1, in2,in3 and tag are used. - After the collections of the index entries, pagenumbers are used. -

    -
    - - first level - - - second level - - - third level - - - the tag - - - the lsit of all page numbers. - - - the lsit of all tags. - - - Create a new object. - @param aIn1 The first level. - @param aIn2 The second level. - @param aIn3 The third level. - @param aTag The tag. - - - Returns the in1. - @return Returns the in1. - - - Returns the in2. - @return Returns the in2. - - - Returns the in3. - @return Returns the in3. - - - Returns the tag. - @return Returns the tag. - - - Returns the pagenumer for this entry. - @return Returns the pagenumer for this entry. - - - Add a pagenumber. - @param number The page number. - @param tag - - - Returns the key for the map-entry. - @return Returns the key for the map-entry. - - - Returns the pagenumbers. - @return Returns the pagenumbers. - - - Returns the tags. - @return Returns the tags. - - - print the entry (only for test) - @return the toString implementation of the entry - - - If you want to add more than one page eventa to a PdfWriter, - you have to construct a PdfPageEventForwarder, add the - different events to this object and add the forwarder to - the PdfWriter. - - - ArrayList containing all the PageEvents that have to be executed. - - - Add a page eventa to the forwarder. - @param eventa an eventa that has to be added to the forwarder. - - - Called when the document is opened. - - @param writer - the PdfWriter for this document - @param document - the document - - - - Called when a page is finished, just before being written to the - document. - - @param writer - the PdfWriter for this document - @param document - the document - - - - - - - - - - - If you want to add more than one event to a cell, - you have to construct a PdfPCellEventForwarder, add the - different events to this object and add the forwarder to - the PdfPCell. - - - ArrayList containing all the PageEvents that have to be executed. - - - Add a page event to the forwarder. - @param event an event that has to be added to the forwarder. - - - @see com.lowagie.text.pdf.PdfPCellEvent#cellLayout(com.lowagie.text.pdf.PdfPCell, com.lowagie.text.Rectangle, com.lowagie.text.pdf.PdfContentByte[]) - - - If you want to add more than one page event to a PdfPTable, - you have to construct a PdfPTableEventForwarder, add the - different events to this object and add the forwarder to - the PdfWriter. - - - ArrayList containing all the PageEvents that have to be executed. - - - Add a page event to the forwarder. - @param event an event that has to be added to the forwarder. - - - @see com.lowagie.text.pdf.PdfPTableEvent#tableLayout(com.lowagie.text.pdf.PdfPTable, float[][], float[], int, int, com.lowagie.text.pdf.PdfContentByte[]) - - - @see com.itextpdf.text.pdf.PdfPTableEventAfterSplit#afterSplitTable(com.itextpdf.text.pdf.PdfPTable, com.itextpdf.text.pdf.PdfPRow, int) - @since iText 5.4.3 - - - - @author Paulo Soares - - - Constructs an extended color of a certain type and a certain color. - @param type - @param red - @param green - @param blue - @param alpha - - - Reads an FDF form and makes the fields available - @author Paulo Soares - - - Reads an FDF form. - @param filename the file name of the form - @throws IOException on error - - - Reads an FDF form. - @param pdfIn the byte array with the form - @throws IOException on error - - - Reads an FDF form. - @param url the URL of the document - @throws IOException on error - - - Reads an FDF form. - @param is the InputStream containing the document. The stream is read to the - end but is not closed - @throws IOException on error - - - Gets all the fields. The map is keyed by the fully qualified - field name and the value is a merged PdfDictionary - with the field content. - @return all the fields - - - Gets the field dictionary. - @param name the fully qualified field name - @return the field dictionary - - - Gets a byte[] containing a file that is embedded in the FDF. - @param name the fully qualified field name - @return the bytes of the file - @throws IOException - @since 5.0.1 - - - Gets the field value or null if the field does not - exist or has no value defined. - @param name the fully qualified field name - @return the field value or null - - - Gets the PDF file specification contained in the FDF. - @return the PDF file specification contained in the FDF - - - Writes an FDF form. - @author Paulo Soares - - - The PDF file associated with the FDF. - - - Creates a new FdfWriter. - - - Writes the content to a stream. - @param os the stream - @throws DocumentException on error - @throws IOException on error - - - Removes the field value. - @param field the field name - @return true if the field was found and removed, - false otherwise - - - Gets all the fields. The map is keyed by the fully qualified - field name and the values are PdfObject. - @return a map with all the fields - - - Gets the field value. - @param field the field name - @return the field value or null if not found - - - Sets the field value as a name. - @param field the fully qualified field name - @param value the value - @return true if the value was inserted, - false if the name is incompatible with - an existing field - - - Sets the field value as a string. - @param field the fully qualified field name - @param value the value - @return true if the value was inserted, - false if the name is incompatible with - an existing field - - - Sets the field value as a PDFAction. - For example, this method allows setting a form submit button action using {@link PdfAction#createSubmitForm(String, Object[], int)}. - This method creates an A entry for the specified field in the underlying FDF file. - Method contributed by Philippe Laflamme (plaflamme) - @param field the fully qualified field name - @param action the field's action - @return true if the value was inserted, - false if the name is incompatible with - an existing field - @since 2.1.5 - - - Sets all the fields from this FdfReader - @param fdf the FdfReader - - - Sets all the fields from this PdfReader - @param pdf the PdfReader - - - Sets all the fields from this AcroFields - @param acro the AcroFields - - - Gets the PDF file name associated with the FDF. - @return the PDF file name associated with the FDF - - - Each font in the document will have an instance of this class - where the characters used will be represented. - - @author Paulo Soares - - - The indirect reference to this font - - - The font name that appears in the document body stream - - - The font - - - The font if its an instance of TrueTypeFontUnicode - - - The array used with single byte encodings - - - The map used with double byte encodings. The key is Int(glyph) and the - value is int[]{glyph, width, Unicode code} - - - The font type - - - true if the font is symbolic - - - Indicates if all the glyphs and widths for that particular - encoding should be included in the document. - - - Each font used in a document has an instance of this class. - This class stores the characters used in the document and other - specifics unique to the current working document. - @param fontName the font name - @param indirectReference the indirect reference to the font - @param baseFont the BaseFont - - - Gets the indirect reference to this font. - @return the indirect reference to this font - - - Gets the font name as it appears in the document body. - @return the font name - - - Gets the BaseFont of this font. - @return the BaseFont of this font - - - Converts the text into bytes to be placed in the document. - The conversion is done according to the font and the encoding and the characters - used are stored. - @param text the text to convert - @return the conversion - - - Writes the font definition to the document. - @param writer the PdfWriter of this document - - - Indicates if all the glyphs and widths for that particular - encoding should be included in the document. Set to false - to include all. - @param subset new value of property subset - - - - Adds a Font to be searched for valid characters. - @param font the Font - - - Process the text so that it will render with a combination of fonts - if needed. - @param text the text - @return a Phrase with one or more chunks - - - - @author Paulo Soares - - - Hyphenates words automatically accordingly to the language and country. - The hyphenator engine was taken from FOP and uses the TEX patterns. If a language - is not provided and a TEX pattern for it exists, it can be easily adapted. - - @author Paulo Soares - - - The hyphenator engine. - - - The second part of the hyphenated word. - - - Creates a new hyphenation instance usable in Chunk. - @param lang the language ("en" for english, for example) - @param country the country ("GB" for Great-Britain or "none" for no country, for example) - @param leftMin the minimun number of letters before the hyphen - @param rightMin the minimun number of letters after the hyphen - - - Gets the hyphen symbol. - @return the hyphen symbol - - - Hyphenates a word and returns the first part of it. To get - the second part of the hyphenated word call getHyphenatedWordPost(). - @param word the word to hyphenate - @param font the font used by this word - @param fontSize the font size used by this word - @param remainingWidth the width available to fit this word in - @return the first part of the hyphenated word including - the hyphen symbol, if any - - - Gets the second part of the hyphenated word. Must be called - after getHyphenatedWordPre(). - @return the second part of the hyphenated word - - - - Capacity increment size - - - The encapsulated array - - - Points to next free item - - - return number of items in array - - - returns current capacity of array - - - This is to implement memory allocation in the array. Like Malloc(). - - - - Capacity increment size - - - The encapsulated array - - - Points to next free item - - - Reset Vector but don't resize or clear elements - - - return number of items in array - - - returns current capacity of array - - - - - number of hyphenation points in word - - - rawWord as made of alternating strings and {@link Hyphen Hyphen} - instances - - - @return the number of hyphenation points in the word - - - @return the pre-break text, not including the hyphen character - - - @return the post-break text - - - @return the hyphenation points - - - - - value space: stores the inteletter values - - - This map stores hyphenation exceptions - - - This map stores the character classes - - - Temporary map to store interletter values on pattern loading. - - - Packs the values by storing them in 4 bits, two values into a byte - Values range is from 0 to 9. We use zero as terminator, - so we'll add 1 to the value. - @param values a string of digits from '0' to '9' representing the - interletter values. - @return the index into the vspace array where the packed values - are stored. - - - String compare, returns 0 if equal or - t is a substring of s - - - - Hyphenate word and return a Hyphenation object. - @param word the word to be hyphenated - @param remainCharCount Minimum number of characters allowed - before the hyphenation point. - @param pushCharCount Minimum number of characters allowed after - the hyphenation point. - @return a {@link Hyphenation Hyphenation} object representing - the hyphenated word or null if word is not hyphenated. - - - w = "****nnllllllnnn*****", - where n is a non-letter, l is a letter, - all n may be absent, the first n is at offset, - the first l is at offset + iIgnoreAtBeginning; - word = ".llllll.'\0'***", - where all l in w are copied into word. - In the first part of the routine len = w.length, - in the second part of the routine len = word.length. - Three indices are used: - Index(w), the index in w, - Index(word), the index in word, - Letterindex(word), the index in the letter part of word. - The following relations exist: - Index(w) = offset + i - 1 - Index(word) = i - iIgnoreAtBeginning - Letterindex(word) = Index(word) - 1 - (see first loop). - It follows that: - Index(w) - Index(word) = offset - 1 + iIgnoreAtBeginning - Index(w) = Letterindex(word) + offset + iIgnoreAtBeginning - Hyphenate word and return an array of hyphenation points. - @param w char array that contains the word - @param offset Offset to first character in word - @param len Length of word - @param remainCharCount Minimum number of characters allowed - before the hyphenation point. - @param pushCharCount Minimum number of characters allowed after - the hyphenation point. - @return a {@link Hyphenation Hyphenation} object representing - the hyphenated word or null if word is not hyphenated. - - - Add a character class to the tree. It is used by - {@link SimplePatternParser SimplePatternParser} as callback to - add character classes. Character classes define the - valid word characters for hyphenation. If a word contains - a character not defined in any of the classes, it is not hyphenated. - It also defines a way to normalize the characters in order - to compare them with the stored patterns. Usually pattern - files use only lower case characters, in this case a class - for letter 'a', for example, should be defined as "aA", the first - character being the normalization char. - - - Add an exception to the tree. It is used by - {@link SimplePatternParser SimplePatternParser} class as callback to - store the hyphenation exceptions. - @param word normalized word - @param hyphenatedword a vector of alternating strings and - {@link Hyphen hyphen} objects. - - - Add a pattern to the tree. Mainly, to be used by - {@link SimplePatternParser SimplePatternParser} class as callback to - add a pattern to the tree. - @param pattern the hyphenation pattern - @param ivalue interletter weight values indicating the - desirability and priority of hyphenating at a given point - within the pattern. It should contain only digit characters. - (i.e. '0' to '9'). - - - - TODO: Don't use statics - - - @param lang - @param country - @param leftMin - @param rightMin - - - @param lang - @param country - @return the hyphenation tree - - - @param key - @return a hyphenation tree - - - @param lang - @param country - @param word - @param leftMin - @param rightMin - @return a hyphenation object - - - @param lang - @param country - @param word - @param offset - @param len - @param leftMin - @param rightMin - @return a hyphenation object - - - @param min - - - @param min - - - @param lang - @param country - - - @param word - @param offset - @param len - @return a hyphenation object - - - @param word - @return a hyphenation object - - - - Add a character class. - A character class defines characters that are considered - equivalent for the purpose of hyphenation (e.g. "aA"). It - usually means to ignore case. - @param chargroup character group - - - Add a hyphenation exception. An exception replaces the - result obtained by the algorithm for cases for which this - fails or the user wants to provide his own hyphenation. - A hyphenatedword is a vector of alternating String's and - {@link Hyphen Hyphen} instances - - - Add hyphenation patterns. - @param pattern the pattern - @param values interletter values expressed as a string of - digit characters. - - - Parses the xml hyphenation pattern. - - @author Paulo Soares - - - Creates a new instance of PatternParser2 - - -

    Ternary Search Tree

    - -

    A ternary search tree is a hibrid between a binary tree and - a digital search tree (trie). Keys are limited to strings. - A data value of type char is stored in each leaf node. - It can be used as an index (or pointer) to the data. - Branches that only contain one key are compressed to one node - by storing a pointer to the trailer substring of the key. - This class is intended to serve as base class or helper class - to implement Dictionary collections or the like. Ternary trees - have some nice properties as the following: the tree can be - traversed in sorted order, partial matches (wildcard) can be - implemented, retrieval of all keys within a given distance - from the target, etc. The storage requirements are higher than - a binary tree but a lot less than a trie. Performance is - comparable with a hash table, sometimes it outperforms a hash - function (most of the time can determine a miss faster than a hash).

    - -

    The main purpose of this java port is to serve as a base for - implementing TeX's hyphenation algorithm (see The TeXBook, - appendix H). Each language requires from 5000 to 15000 hyphenation - patterns which will be keys in this tree. The strings patterns - are usually small (from 2 to 5 characters), but each char in the - tree is stored in a node. Thus memory usage is the main concern. - We will sacrify 'elegance' to keep memory requirenments to the - minimum. Using java's char type as pointer (yes, I know pointer - it is a forbidden word in java) we can keep the size of the node - to be just 8 bytes (3 pointers and the data char). This gives - room for about 65000 nodes. In my tests the english patterns - took 7694 nodes and the german patterns 10055 nodes, - so I think we are safe.

    - -

    All said, this is a map with strings as keys and char as value. - Pretty limited!. It can be extended to a general map by - using the string representation of an object and using the - char value as an index to an array that contains the object - values.

    - - @author cav@uniscope.co.jp -
    - - We use 4 arrays to represent a node. I guess I should have created - a proper node class, but somehow Knuth's pascal code made me forget - we now have a portable language with memory management and - automatic garbage collection! And now is kind of late, furthermore, - if it ain't broken, don't fix it. - Pointer to low branch and to rest of the key when it is - stored directly in this node, we don't have unions in java! - - - Pointer to high branch. - - - Pointer to equal branch and to data when this node is a string terminator. - - -

    The character stored in this node: splitchar - Two special values are reserved:

    -
    • 0x0000 as string terminator
    • -
    • 0xFFFF to indicate that the branch starting at - this node is compressed
    -

    This shouldn't be a problem if we give the usual semantics to - strings since 0xFFFF is garanteed not to be an Unicode character.

    -
    - - This vector holds the trailing of the keys when the branch is compressed. - - - Branches are initially compressed, needing - one node per key plus the size of the string - key. They are decompressed as needed when - another key with same prefix - is inserted. This saves a lot of space, - specially for long keys. - - - The actual insertion function, recursive version. - - - Compares 2 null terminated char arrays - - - Compares a string with null terminated char array - - - Recursively insert the median first and then the median of the - lower and upper halves, and so on in order to get a balanced - tree. The array of keys is assumed to be sorted in ascending - order. - - - Balance the tree for best search performance - - - Each node stores a character (splitchar) which is part of - some Key(s). In a compressed branch (one that only contain - a single string key) the trailer of the key which is not - already in nodes is stored externally in the kv array. - As items are inserted, key substrings decrease. - Some substrings may completely disappear when the whole - branch is totally decompressed. - The tree is traversed to find the key substrings actually - used. In addition, duplicate substrings are removed using - a map (implemented with a TernaryTree!). - - - - current node index - - - current key - - - TernaryTree parent - - - Node stack - - - key stack implemented with a StringBuilder - - - traverse upwards - - - traverse the tree to find next key - - - - Summary description for ICC_Profile. - - - - Classes implementing this interface can create custom encodings or - replace existing ones. It is used in the context of PdfEncoding. - @author Paulo Soares - - - Converts an Unicode string to a byte array according to some encoding. - @param text the Unicode string - @param encoding the requested encoding. It's mainly of use if the same class - supports more than one encoding. - @return the conversion or null if no conversion is supported - - - Converts an Unicode char to a byte array according to some encoding. - @param char1 the Unicode char - @param encoding the requested encoding. It's mainly of use if the same class - supports more than one encoding. - @return the conversion or null if no conversion is supported - - - Converts a byte array to an Unicode string according to some encoding. - @param b the input byte array - @param encoding the requested encoding. It's mainly of use if the same class - supports more than one encoding. - @return the conversion or null if no conversion is supported - - - Called by Chunk to hyphenate a word. - - @author Paulo Soares - - - Gets the hyphen symbol. - @return the hyphen symbol - - - Hyphenates a word and returns the first part of it. To get - the second part of the hyphenated word call getHyphenatedWordPost(). - @param word the word to hyphenate - @param font the font used by this word - @param fontSize the font size used by this word - @param remainingWidth the width available to fit this word in - @return the first part of the hyphenated word including - the hyphen symbol, if any - - - Gets the second part of the hyphenated word. Must be called - after getHyphenatedWordPre(). - @return the second part of the hyphenated word - - - This is the AcroForm object for the complete document. - - - This is the array containing the references to annotations - that were added to the document. - - - This is an array containg references to some delayed annotations - (that were added for a page that doesn't exist yet). - - - Checks if the AcroForm is valid. - - - Gets the AcroForm object. - @return the PdfAcroform object of the PdfDocument - - - Stores the PDF version information, - knows how to write a PDF Header, - and how to add the version to the catalog (if necessary). - - - Contains different strings that are part of the header. - - - Indicates if the header was already written. - - - Indicates if we are working in append mode. - - - The version that was or will be written to the header. - - - The version that will be written to the catalog. - - - The version that user can use to get the actual version of PDF document * - - - The extensions dictionary. - @since 2.1.6 - - - @see com.lowagie.text.pdf.interfaces.PdfVersion#setPdfVersion(char) - - - @see com.lowagie.text.pdf.interfaces.PdfVersion#setAtLeastPdfVersion(char) - - - @see com.lowagie.text.pdf.interfaces.PdfVersion#setPdfVersion(com.lowagie.text.pdf.PdfName) - - - Sets the append mode. - - - Writes the header to the OutputStreamCounter. - @throws IOException - - - Returns the PDF version as a name. - @param version the version character. - - - Returns the version as a byte[]. - @param version the version character - - - Adds the version to the Catalog dictionary. - - - @see com.lowagie.text.pdf.interfaces.PdfVersion#addDeveloperExtension(com.lowagie.text.pdf.PdfDeveloperExtension) - @since 2.1.6 - - - Stores the information concerning viewer preferences, - and contains the business logic that allows you to set viewer preferences. - - - A series of viewer preferences. - - - A series of viewer preferences. - - - A series of viewer preferences. - - - A series of viewer preferences - - - A series of viewer preferences. - - - This value will hold the viewer preferences for the page layout and page mode. - - - This dictionary holds the viewer preferences (other than page layout and page mode). - - - The mask to decide if a ViewerPreferences dictionary is needed - - - Returns the page layout and page mode value. - - - Returns the viewer preferences. - - - Sets the viewer preferences as the sum of several constants. - - @param preferences - the viewer preferences - @see PdfWriter#setViewerPreferences - - - Given a key for a viewer preference (a PdfName object), - this method returns the index in the VIEWER_PREFERENCES array. - @param key a PdfName referring to a viewer preference - @return an index in the VIEWER_PREFERENCES array - - - Checks if some value is valid for a certain key. - - - Sets the viewer preferences for printing. - - - Adds the viewer preferences defined in the preferences parameter to a - PdfDictionary (more specifically the root or catalog of a PDF file). - - @param catalog - - - The value indicating if the PDF has to be in conformance with PDF/X. - - - @see com.lowagie.text.pdf.interfaces.PdfXConformance#setPDFXConformance(int) - - - @see com.itextpdf.text.pdf.interfaces.PdfIsoConformance#isPdfIso() - - - Checks if the PDF/X Conformance is necessary. - @return true if the PDF has to be in conformance with any of the PDF/X specifications - - - Checks if the PDF has to be in conformance with PDF/X-1a:2001 - @return true of the PDF has to be in conformance with PDF/X-1a:2001 - - - Checks if the PDF has to be in conformance with PDF/X-3:2002 - @return true of the PDF has to be in conformance with PDF/X-3:2002 - - - Business logic that checks if a certain object is in conformance with PDF/X. - @param writer the writer that is supposed to write the PDF/X file - @param key the type of PDF ISO conformance that has to be checked - @param obj1 the object that is checked for conformance - - - A key for an aspect that can be checked for PDF ISO Conformance. - - - A key for an aspect that can be checked for PDF ISO Conformance. - - - A key for an aspect that can be checked for PDF ISO Conformance. - - - A key for an aspect that can be checked for PDF ISO Conformance. - - - A key for an aspect that can be checked for PDF ISO Conformance. - - - A key for an aspect that can be checked for PDF ISO Conformance. - - - A key for an aspect that can be checked for PDF ISO Conformance. - - - A key for an aspect that can be checked for PDF ISO Conformance. - - - A key for an aspect that can be checked for PDF ISO Conformance. - - - A key for an aspect that can be checked for PDF ISO Conformance. - - - A key for an aspect that can be checked for PDF ISO Conformance. - - - A key for an aspect that can be checked for PDF ISO Conformance. - - - A key for an aspect that can be checked for PDF ISO Conformance. - - - A key for an aspect that can be checked for PDF ISO Conformance. - - - A key for an aspect that can be checked for PDF ISO Conformance. - - - A key for an aspect that can be checked for PDF ISO Conformance. - - - A key for an aspect that can be checked for PDF ISO Conformance. - - - A key for an aspect that can be checked for PDF ISO Conformance. - - - A key for an aspect that can be checked for PDF ISO Conformance. - - - A key for an aspect that can be checked for PDF ISO Conformance. - - - A Hashtable that uses ints as the keys. - - - The hash table data. - - - The total number of entries in the hash table. - - - Rehashes the table when count exceeds this threshold. - - - The load factor for the hashtable. - - - Constructs a new, empty hashtable with the specified initial - - - Constructs a new, empty hashtable with the specified initial - - - Constructs a new, empty hashtable. A default capacity and load factor - - - Returns the number of elements contained in the hashtable. - - - Returns true if the hashtable contains no elements. - - - Returns true if the specified object is an element of the hashtable. - - - Returns true if the collection contains an element for the key. - - - Gets the object associated with the specified key in the - - - Rehashes the content of the table into a bigger table. - - - Removes the element corresponding to the key. Does nothing if the - - - Clears the hash table so that it has no more elements in it. - - - The interface common to all layer types. - - @author Paulo Soares - - - Gets the PdfIndirectReference that represents this layer. - @return the PdfIndirectReference that represents this layer - - - Gets the object representing the layer. - @return the object representing the layer - - - Allows a class to catch several document events. - - @author Paulo Soares - - - Called when the document is opened. - - @param writer the PdfWriter for this document - @param document the document - - - Called when a page is initialized. -

    - Note that if even if a page is not written this method is still - called. It is preferable to use onEndPage to avoid - infinite loops. -

    -

    - Note that this method isn't called for the first page. You should apply modifications for the first - page either before opening the document or by using the onOpenDocument() method. -

    - - @param writer the PdfWriter for this document - @param document the document -
    - - Called when a page is finished, just before being written to the document. - - @param writer the PdfWriter for this document - @param document the document - - - - - - - - - - - - Summary description for IPdfPCellEvent. - - - - - An interface that can be used to retrieve the position of cells in PdfPTable. - - @author Paulo Soares - - - - Implementation of the IndicLigaturizer for Gujarati. - - - Constructor for the IndicLigaturizer for Gujarati. - - - Hebrew is written from right to left. - @return true - @see com.itextpdf.text.pdf.languages.LanguageProcessor#isRTL() - - - Interface that needs to be implemented by classes that process bytes - representing text in specific languages. Processing involves changing - order to Right to Left and/or applying ligatures. - - - Processes a String - @param s the original String - @return the processed String - - - Indicates if the rundirection is right-to-left. - @return true if text needs to be rendered from right to left. - - - Superclass for processors that can convert a String of bytes in an Indic - language to a String in the same language of which the bytes are reordered - for rendering using a font that contains the necessary glyphs. - - - The table mapping specific character indexes to the characters in a - specific language. - - - Reorders the bytes in a String making Indic ligatures - - @param s - the original String - @return the ligaturized String - - - Indic languages are written from right to left. - - @return false - @see com.itextpdf.text.pdf.languages.LanguageProcessor#isRTL() - - - Checks if a character is vowel letter. - - @param ch - the character that needs to be checked - @return true if the characters is a vowel letter - - - Checks if a character is vowel sign. - - @param ch - the character that needs to be checked - @return true if the characters is a vowel sign - - - Checks if a character is consonant letter. - - @param ch - the character that needs to be checked - @return true if the chracter is a consonant letter - - - Swaps two characters in a StringBuilder object - - @param s - the StringBuilder - @param i - the index of one character - @param j - the index of the other character - - - A class for performing LZW decoding. - - - - - Method to decode LZW compressed data. - - @param data The compressed data. - @param uncompData Array to return the uncompressed data in. - - - Initialize the string table. - - - Write out the string just uncompressed. - - - Add a new string to the string table. - - - Add a new string to the string table. - - - Append newstring to the end of oldstring. - - - Represents a Bezier curve. - - @since 5.5.6 - - - If the distance between a point and a line is less than - this constant, then we consider the point lies on the line. - - - In the case when neither the line ((x1, y1), (x4, y4)) passes - through both (x2, y2) and (x3, y3) nor (x1, y1) = (x4, y4) we - use the square of the sum of the distances mentioned below in - compare to this field as the criterion of good approximation. - 1. The distance between the line and (x2, y2) - 2. The distance between the line and (x3, y3) - - - The Manhattan distance is used in the case when either the line - ((x1, y1), (x4, y4)) passes through both (x2, y2) and (x3, y3) - or (x1, y1) = (x4, y4). The essential observation is that when - the curve is a uniform speed straight line from end to end, the - control points are evenly spaced from beginning to end. Our measure - of how far we deviate from that ideal uses distance of the middle - controls: point 2 should be halfway between points 1 and 3; point 3 - should be halfway between points 2 and 4. - - - Constructs new bezier curve. - @param controlPoints Curve's control points. - - - {@inheritDoc} - - - You can adjust precision of the approximation by varying the following - parameters: {@link #curveCollinearityEpsilon}, {@link #distanceToleranceSquare}, - {@link #distanceToleranceManhattan} - - @return {@link java.util.List} containing points of piecewise linear approximation - for this bezier curve. - @since 5.5.6 - - - @author kevin - @since 5.0.1 - - - Gets the content bytes from a content object, which may be a reference - a stream or an array. - @param contentObject the object to read bytes from - @return the content bytes - @throws IOException - - - Gets the content bytes of a page from a reader - @param reader the reader to get content bytes from - @param pageNum the page number of page you want get the content stream from - @return a byte array with the effective content stream of a page - @throws IOException - @since 5.0.1 - - - Simply extends the {@link com.itextpdf.text.pdf.parser.RenderListener} interface to provide - additional methods. - - {@inheritDoc} - - @since 5.5.6 - - - Called when the current path is being modified. E.g. new segment is being added, - new subpath is being started etc. - - @param renderInfo Contains information about the path segment being added to the current path. - - - Called when the current path should be rendered. - - @param renderInfo Contains information about the current path which should be rendered. - @return The path which can be used as a new clipping path. - - - Called when the current path should be set as a new clipping path. - - @param rule Either {@link PathPaintingRenderInfo#EVEN_ODD_RULE} or {@link PathPaintingRenderInfo#NONZERO_WINDING_RULE} - - - A text render listener that filters text operations before passing them on to a deleg - @since 5.0.1 - - - The deleg that will receive the text render operation if the filters all pass - - - The filters to be applied - - - Construction - @param deleg the deleg {@link RenderListener} that will receive filtered text operations - @param filters the Filter(s) to apply - - - Applies filters, then delegates to the deleg if all filters pass - @param renderInfo contains info to render text - @see com.itextpdf.text.pdf.parser.RenderListener#renderText(com.itextpdf.text.pdf.parser.TextRenderInfo) - - - This class delegates this call - @see com.itextpdf.text.pdf.parser.RenderListener#beginTextBlock() - - - This class delegates this call - @see com.itextpdf.text.pdf.parser.RenderListener#endTextBlock() - - - Applies filters, then delegates to the deleg if all filters pass - @see com.itextpdf.text.pdf.parser.RenderListener#renderImage(com.itextpdf.text.pdf.parser.ImageRenderInfo) - @since 5.0.1 - - - A text render listener that filters text operations before passing them on to a deleg - @since 5.0.1 - - - The deleg that will receive the text render operation if the filters all pass - - - Construction - @param deleg the deleg {@link RenderListener} that will receive filtered text operations - @param filters the Filter(s) to apply - - - This class delegates this call - @see com.itextpdf.text.pdf.parser.TextExtractionStrategy#getResultantText() - - - Keeps all the parameters of the graphics state. - @since 2.1.4 - - - The current transformation matrix. - - - The current character spacing. - - - The current word spacing. - - - The current horizontal scaling - - - The current leading. - - - The active font. - - - The current font size. - - - The current render mode. - - - The current text rise - - - The current knockout value. - - - The current color space for stroke. - - - The current color space for stroke. - - - The current fill color. - - - The current stroke color. - - - The line width for stroking operations - - - The line cap style. For possible values - see {@link PdfContentByte} - - - The line join style. For possible values - see {@link PdfContentByte} - - - The mitir limit value - - - The line dash pattern - - - Constructs a new Graphics State object with the default values. - - - Copy constructor. - @param source another GraphicsState object - - - Getter for the current transformation matrix - @return the ctm - @since iText 5.0.1 - - - Getter for the character spacing. - @return the character spacing - @since iText 5.0.1 - - - Getter for the word spacing - @return the word spacing - @since iText 5.0.1 - - - Getter for the horizontal scaling - @return the horizontal scaling - @since iText 5.0.1 - - - Getter for the leading - @return the leading - @since iText 5.0.1 - - - Getter for the font - @return the font - @since iText 5.0.1 - - - Getter for the font size - @return the font size - @since iText 5.0.1 - - - Getter for the render mode - @return the renderMode - @since iText 5.0.1 - - - Getter for text rise - @return the text rise - @since iText 5.0.1 - - - Getter for knockout - @return the knockout - @since iText 5.0.1 - - - Gets the current color space for fill operations - - - Gets the current color space for stroke operations - - - Gets the current fill color - @return a BaseColor - - - Gets the current stroke color - @return a BaseColor - - - Getter and setter for the line width. - @return The line width - @since 5.5.6 - - - Getter and setter for the line cap style. - For possible values see {@link PdfContentByte} - @return The line cap style. - @since 5.5.6 - - - Getter and setter for the line join style. - For possible values see {@link PdfContentByte} - @return The line join style. - @since 5.5.6 - - - Getter and setter for the miter limit value. - @return The miter limit. - @since 5.5.6 - - - Getter for the line dash pattern. - @return The line dash pattern. - @since 5.5.6 - - - Setter for the line dash pattern. - @param lineDashPattern New line dash pattern. - @since 5.5.6 - - - Interface implemented by a series of content operators - @since 2.1.4 - - - Invokes a content operator. - @param processor the processor that is dealing with the PDF content - @param operator the literal PDF syntax of the operator - @param operands the operands that come with the operator - @throws Exception any exception can be thrown - it will be re-packaged into a runtime exception and re-thrown by the {@link PdfContentStreamProcessor} - - - Represents image data from a PDF - @since 5.0.1 - - - The graphics state that was in effect when the image was rendered - - - A reference to the image XObject - - - A reference to an inline image - - - the color space associated with the image - - - the image object to be rendered, if it has been parsed already. Null otherwise. - - - Array containing marked content info for the text. - @since 5.5.11 - - - Create an ImageRenderInfo object based on an XObject (this is the most common way of including an image in PDF) - @param ctm the coordinate transformation matrix at the time the image is rendered - @param ref a reference to the image XObject - @return the ImageRenderInfo representing the rendered XObject - @since 5.0.1 - - - Create an ImageRenderInfo object based on an XObject (this is the most common way of including an image in PDF) - @param ctm the coordinate transformation matrix at the time the image is rendered - @param ref a reference to the image XObject - @return the ImageRenderInfo representing the rendered XObject - @since 5.0.1 - - - Create an ImageRenderInfo object based on inline image data. This is nowhere near completely thought through - and really just acts as a placeholder. - @param ctm the coordinate transformation matrix at the time the image is rendered - @param imageObject the image object representing the inline image - @return the ImageRenderInfo representing the rendered embedded image - @since 5.0.1 - - - Gets an object containing the image dictionary and bytes. - @return an object containing the image dictionary and byte[] - @since 5.0.2 - - - @return a vector in User space representing the start point of the xobject - - - @return The coordinate transformation matrix active when this image was rendered. Coordinates are in User space. - @since 5.0.3 - - - @return the size of the image, in User space units - - - @return an indirect reference to the image - @since 5.0.2 - - - @return the current fill color from the graphics state at the time this render operation occured - @since 5.5.7 - - - Checks if the image belongs to a marked content sequence - with a given mcid. - @param mcid a marked content id - @return true if the text is marked with this id - @since 5.5.11 - - - * Checks if the image belongs to a marked content sequence - * with a given mcid. - * @param mcid a marked content id - * @param checkTheTopmostLevelOnly indicates whether to check the topmost level of marked content stack only - * @return true if the text is marked with this id - * @since 5.5.11 - - - @return the marked content associated with the ImageRenderInfo instance. - - - - Called when a new text block is beginning (i.e. BT) - @since iText 5.0.1 - - - Called when text should be rendered - @param renderInfo information specifying what to render - - - Called when a text block has ended (i.e. ET) - @since iText 5.0.1 - - - Called when image should be rendered - @param renderInfo information specifying what to render - @since iText 5.0.1 - - - Defines an interface for {@link RenderListener}s that can return text - @since 5.0.2 - - - Returns the result so far. - @return a String with the resulting text. - - - Represents a line. - - @since 5.5.6 - - - Constructs a new zero-length line starting at zero. - - - Constructs a new line based on the given coordinates. - - - Constructs a new line based on the given coordinates. - - - Represents the line dash pattern. The line dash pattern shall control the pattern - of dashes and gaps used to stroke paths. It shall be specified by a dash array and - a dash phase. - - @since 5.5.6 - - - Creates new {@link LineDashPattern} object. - @param dashArray The dash array. See {@link #getDashArray()} - @param dashPhase The dash phase. See {@link #getDashPhase()} - - - Getter and setter for the dash array. - - The dash array’s elements is number that specify the lengths of - alternating dashes and gaps; the numbers are nonnegative. The - elements are expressed in user space units. - - @return The dash array. - - - Getter and setter for the dash phase. - - The dash phase shall specify the distance into the dash pattern at which - to start the dash. The elements are expressed in user space units. - - @return The dash phase. - - - Calculates and returns the next element which is either gap or dash. - @return The next dash array's element. - - - Checks whether the dashed pattern is solid or not. It's solid when the - size of a dash array is even and sum of all the units off in the array - is 0.
    - For example: [3 0 4 0 5 0 6 0] (sum is 0), [3 0 4 0 5 1] (sum is 1). -
    - - Resets the dash array so that the {@link #next()} method will start - from the beginning of the dash array. - - - Represents a line segment in a particular coordinate system. This class is immutable. - @since 5.0.2 - - - Start vector of the segment. - - - End vector of the segment. - - - Creates a new line segment. - @param startPoint the start point of a line segment. - @param endPoint the end point of a line segment. - - - @return the start point - - - @return the end point - - - @return the length of this line segment - @since 5.0.2 - - - Computes the bounding rectangle for this line segment. The rectangle has a rotation 0 degrees - with respect to the coordinate system that the line system is in. For example, if a line segment - is 5 unit long and sits at a 37 degree angle from horizontal, the bounding rectangle will have - origin of the lower left hand end point of the segment, with width = 4 and height = 3. - @return the bounding rectangle - @since 5.0.2 - - - Transforms the segment by the specified matrix - @param m the matrix for the transformation - @return the transformed segment - - - - set to true for debugging - - - a summary of all found text - - - Creates a new text extraction renderer. - - - Creates a new text extraction renderer, with a custom strategy for - creating new TextChunkLocation objects based on the input of the - TextRenderInfo. - @param strat the custom strategy - - - @see com.itextpdf.text.pdf.parser.RenderListener#beginTextBlock() - - - @see com.itextpdf.text.pdf.parser.RenderListener#endTextBlock() - - - @param str - @return true if the string starts with a space character, false if the string is empty or starts with a non-space character - - - @param str - @return true if the string ends with a space character, false if the string is empty or ends with a non-space character - - - Filters the provided list with the provided filter - @param textChunks a list of all TextChunks that this strategy found during processing - @param filter the filter to apply. If null, filtering will be skipped. - @return the filtered list - @since 5.3.3 - - - Determines if a space character should be inserted between a previous chunk and the current chunk. - This method is exposed as a callback so subclasses can fine time the algorithm for determining whether a space should be inserted or not. - By default, this method will insert a space if the there is a gap of more than half the font space character width between the end of the - previous chunk and the beginning of the current chunk. It will also indicate that a space is needed if the starting point of the new chunk - appears *before* the end of the previous chunk (i.e. overlapping text). - @param chunk the new chunk being evaluated - @param previousChunk the chunk that appeared immediately before the current chunk - @return true if the two chunks represent different words (i.e. should have a space between them). False otherwise. - - - Gets text that meets the specified filter - If multiple text extractions will be performed for the same page (i.e. for different physical regions of the page), - filtering at this level is more efficient than filtering using {@link FilteredRenderListener} - but not nearly as powerful - because most of the RenderInfo state is not captured in {@link TextChunk} - @param chunkFilter the filter to to apply - @return the text results so far, filtered using the specified filter - - - Returns the result so far. - @return a String with the resulting text. - - - Used for debugging only - - - - @see com.itextpdf.text.pdf.parser.RenderListener#renderText(com.itextpdf.text.pdf.parser.TextRenderInfo) - - - the starting location of the chunk - - - the ending location of the chunk - - - the orientation as a scalar for quick sorting - - - perpendicular distance to the orientation unit vector (i.e. the Y position in an unrotated coordinate system) - we round to the nearest integer to handle the fuzziness of comparing floats - - - distance of the start of the chunk parallel to the orientation unit vector (i.e. the X position in an unrotated coordinate system) - - - distance of the end of the chunk parallel to the orientation unit vector (i.e. the X position in an unrotated coordinate system) - - - the width of a single space character in the font of the chunk - - - @param comparedLine the location to compare to - @return true is this location is on the the same line as the other - - - Computes the distance between the end of 'other' and the beginning of this chunk - in the direction of this chunk's orientation vector. Note that it's a bad idea - to call this for chunks that aren't on the same line and orientation, but we don't - explicitly check for that condition for performance reasons. - @param other - @return the number of spaces between the end of 'other' and the beginning of this chunk - - - unit vector in the orientation of the chunk - - - Compares based on orientation, perpendicular distance, then parallel distance - @see java.lang.Comparable#compareTo(java.lang.Object) - - - Represents a chunk of text, it's orientation, and location relative to the orientation vector - - - the text of the chunk - - - @return the start location of the text - - - @return the end location of the text - - - @return the width of a single space character as rendered by this chunk - - - Computes the distance between the end of 'other' and the beginning of this chunk - in the direction of this chunk's orientation vector. Note that it's a bad idea - to call this for chunks that aren't on the same line and orientation, but we don't - explicitly check for that condition for performance reasons. - @param other - @return the number of spaces between the end of 'other' and the beginning of this chunk - - - Compares based on orientation, perpendicular distance, then parallel distance - @see java.lang.Comparable#compareTo(java.lang.Object) - - - @param as the location to compare to - @return true is this location is on the the same line as the other - - - - @param int1 - @param int2 - @return comparison of the two integers - - - no-op method - this renderer isn't interested in image events - @see com.itextpdf.text.pdf.parser.RenderListener#renderImage(com.itextpdf.text.pdf.parser.ImageRenderInfo) - @since 5.0.1 - - - Specifies a filter for filtering {@link TextChunk} objects during text extraction - @see LocationTextExtractionStrategy#getResultantText(TextChunkFilter) - @since 5.3.3 - - - @param textChunk the chunk to check - @return true if the chunk should be allowed - - - Represents a Marked Content block in a PDF - @since 5.0.2 - - - Get the tag of this marked content - @return the tag of this marked content - - - Determine if an MCID is available - @return true if the MCID is available, false otherwise - - - Gets the MCID value If the Marked Content contains - an MCID entry, returns that value. Otherwise, a {@link NullPointerException} is thrown. - @return the MCID value - @throws NullPointerException if there is no MCID (see {@link MarkedContentInfo#hasMcid()}) - - - A {@link RenderFilter} that only allows text within a specified marked content sequence. - @since 5.0.2 - - - The MCID to match. - - - Constructs a filter - @param mcid the MCID to match - - - @see com.itextpdf.text.pdf.parser.RenderFilter#allowText(com.itextpdf.text.pdf.parser.TextRenderInfo) - - - Keeps all the values of a 3 by 3 matrix - and allows you to do some math with matrices. - @since 2.1.4 - - - the row=1, col=1 position ('a') in the matrix. - - - the row=1, col=2 position ('b') in the matrix. - - - the row=1, col=3 position (always 0 for 2-D) in the matrix. - - - the row=2, col=1 position ('c') in the matrix. - - - the row=2, col=2 position ('d') in the matrix. - - - the row=2, col=3 position (always 0 for 2-D) in the matrix. - - - the row=3, col=1 ('e', or X translation) position in the matrix. - - - the row=3, col=2 ('f', or Y translation) position in the matrix. - - - the row=3, col=3 position (always 1 for 2-D) in the matrix. - - - the values inside the matrix (the identity matrix by default). - default initialization is performed in the default constructor. - - - constructs a new Matrix with identity. - !shall be called from any other constructor! - - - Constructs a matrix that represents translation - @param tx - @param ty - - - Creates a Matrix with 6 specified entries - @param a - @param b - @param c - @param d - @param e - @param f - - - Gets a specific value inside the matrix. - @param index an array index corresponding with a value inside the matrix - @return the value at that specific position. - - - multiplies this matrix by 'b' and returns the result - See http://en.wikipedia.org/wiki/Matrix_multiplication - @param by The matrix to multiply by - @return the resulting matrix - - - Subtracts a matrix from this matrix and returns the results - @param arg the matrix to subtract from this matrix - @return a Matrix object - - - Computes the determinant of the matrix. - @return the determinant of the matrix - - - Checks equality of matrices. - @param obj the other Matrix that needs to be compared with this matrix. - @return true if both matrices are equal - @see java.lang.Object#equals(java.lang.Object) - - - Generates a hash code for this object. - @return the hash code of this object - @see java.lang.Object#hashCode() - - - Generates a String representation of the matrix. - @return the values, delimited with tabs and newlines. - @see java.lang.Object#toString() - - - Attaches a {@link RenderListener} for the corresponding filter set. - @param delegate RenderListener instance to be attached. - @param filterSet filter set to be attached. The delegate will be invoked if all the filters pass. - - - Paths define shapes, trajectories, and regions of all sorts. They shall be used - to draw lines, define the shapes of filled areas, and specify boundaries for clipping - other graphics. A path shall be composed of straight and curved line segments, which - may connect to one another or may be disconnected. - - @since 5.5.6 - - - @return A {@link java.util.List} of subpaths forming this path. - - - Adds the subpath to this path. - - @param subpath The subpath to be added to this path. - - - Adds the subpaths to this path. - - @param subpaths {@link java.util.List} of subpaths to be added to this path. - - - The current point is the trailing endpoint of the segment most recently added to the current path. - - @return The current point. - - - Begins a new subpath by moving the current point to coordinates (x, y). - - - Appends a straight line segment from the current point to the point (x, y). - - - Appends a cubic Bezier curve to the current path. The curve shall extend from - the current point to the point (x3, y3). - - - Appends a cubic Bezier curve to the current path. The curve shall extend from - the current point to the point (x3, y3) with the note that the current - point represents two control points. - - - Appends a cubic Bezier curve to the current path. The curve shall extend from - the current point to the point (x3, y3) with the note that the (x3, y3) - point represents two control points. - - - Appends a rectangle to the current path as a complete subpath. - - - Closes the current subpath. - - - Closes all subpathes contained in this path. - - - Adds additional line to each closed subpath and makes the subpath unclosed. - The line connects the last and the first points of the subpaths. - - @returns Indices of modified subpaths. - - - Path is empty if it contains no subpaths. - - - Contains information relating to construction the current path. - - @since 5.5.6 - - - See {@link com.itextpdf.text.pdf.parser.Path#moveTo(float, float)} - - - See {@link com.itextpdf.text.pdf.parser.Path#lineTo(float, float)} - - - See {@link com.itextpdf.text.pdf.parser.Path#curveTo(float, float, float, float, float, float)} - - - See {@link com.itextpdf.text.pdf.parser.Path#curveTo(float, float, float, float)} - - - See {@link com.itextpdf.text.pdf.parser.Path#curveFromTo(float, float, float, float)} - - - See {@link com.itextpdf.text.pdf.parser.Path#closeSubpath()} - - - See {@link com.itextpdf.text.pdf.parser.Path#rectangle(float, float, float, float)} - - - @param operation Indicates which path-construction operation should be performed. - @param segmentData Contains data of a new segment being added to the current path. - E.g. x, y, w, h for rectangle; x, y for line etc. - @param ctm Current transformation matrix. - - - See {@link #PathConstructionRenderInfo(int, java.util.List, Matrix)} - - - @return construction operation should be performed on the current path. - - - @return {@link java.util.List} containing data of a new segment (E.g. x, y, w, h for rectangle; - x, y for line etc.) if the specified operation relates to adding the segment to the - current path, null otherwise. - - - @return Current transformation matrix. - - - Contains information relating to painting current path. - - @since 5.5.6 - - - The nonzero winding number rule determines whether a given point is inside a path by - conceptually drawing a ray from that point to infinity in any direction and then examining - the places where a segment of the path crosses the ray. Starting with a count of 0, the rule - adds 1 each time a path segment crosses the ray from left to right and subtracts 1 each time a - segment crosses from right to left. After counting all the crossings, if the result is 0, the - point is outside the path; otherwise, it is inside. - - For more details see PDF spec. - - - The even-odd rule determines whether a point is inside a path by drawing a ray from that point in - any direction and simply counting the number of path segments that cross the ray, regardless of - direction. If this number is odd, the point is inside; if even, the point is outside. - - For more details see PDF spec. - - - End the path object without filling or stroking it. This operator shall be a path-painting no-op, - used primarily for the side effect of changing the current clipping path - - - Value specifying stroke operation to perform on the current path. - - - Value specifying fill operation to perform on the current path. When the fill operation - is performed it should use either nonzero winding or even-odd rule. - - - @param operation One of the possible combinations of {@link #STROKE} and {@link #FILL} values or {@link #NO_OP} - @param rule Either {@link #NONZERO_WINDING_RULE} or {@link #EVEN_ODD_RULE}. - @param gs The graphics state. - - - If the operation is {@link #NO_OP} then the rule is ignored, - otherwise {@link #NONZERO_WINDING_RULE} is used by default. - - See {@link #PathPaintingRenderInfo(int, int, GraphicsState)} - - - @return int value which is either {@link #NO_OP} or one of possible - combinations of {@link #STROKE} and {@link #FILL} - - - @return Either {@link #NONZERO_WINDING_RULE} or {@link #EVEN_ODD_RULE}. - - - @return Current transformation matrix. - - - Tool that parses the content of a PDF document. - @since 2.1.4 - - - Shows the detail of a dictionary. - This is similar to the PdfLister functionality. - @param dic the dictionary of which you want the detail - @return a String representation of the dictionary - - - Shows the detail of a dictionary. - @param dic the dictionary of which you want the detail - @param depth the depth of the current dictionary (for nested dictionaries) - @return a String representation of the dictionary - - - Displays a summary of the entries in the XObject dictionary for the stream - @param resourceDic the resource dictionary for the stream - @return a string with the summary of the entries - @throws IOException - @since 5.0.2 - - - Writes information about a specific page from PdfReader to the specified output stream. - @since 2.1.5 - @param reader the PdfReader to read the page content from - @param pageNum the page number to read - @param out the output stream to send the content to - @throws IOException - - - Writes information about each page in a PDF file to the specified output stream. - @since 2.1.5 - @param pdfFile a File instance referring to a PDF file - @param out the output stream to send the content to - @throws IOException - - - Writes information about the specified page in a PDF file to the specified output stream. - @since 2.1.5 - @param pdfFile a File instance referring to a PDF file - @param pageNum the page number to read - @param out the output stream to send the content to - @throws IOException - - - Writes information about each page in a PDF file to the specified file, or System.out. - @param args - - - Processor for a PDF content Stream. - @since 2.1.4 - - - Default oper - @since 5.0.1 - - - A map with all supported operators (PDF syntax). - - - Resources for the content stream. - - - Stack keeping track of the graphics state. - - - Text matrix. - - - Text line matrix. - - - Listener that will be notified of render events - - - A map with all supported XObject handlers - - - The font cache. - @since 5.0.6 - - - - A stack containing marked content info. - @since 5.0.2 - - - Creates a new PDF Content Stream Processor that will send it's output to the - designated render listener. - - @param renderListener the {@link RenderListener} that will receive rendering notifications - - - - Gets the font pointed to by the indirect reference. The font may have been cached. - @param ind the indirect reference ponting to the font - @return the font - @since 5.0.6 - - - Loads all the supported graphics and text state operators in a map. - - - - @return {@link java.util.Collection} containing all the registered operators strings - @since 5.5.6 - - - Resets the graphics state stack, matrices and resources. - - - Returns the current graphics state. - @return the graphics state - - - Invokes an oper. - @param oper the PDF Syntax of the oper - @param operands a list with operands - - - Add to the marked content stack - @param tag the tag of the marked content - @param dict the PdfDictionary associated with the marked content - @since 5.0.2 - - - Remove the latest marked content from the stack. Keeps track of the BMC, BDC and EMC operators. - @since 5.0.2 - - - Used to trigger beginTextBlock on the renderListener - - - Used to trigger endTextBlock on the renderListener - - - Displays text. - @param string the text to display - - - Displays an XObject using the registered handler for this XObject's subtype - @param xobjectName the name of the XObject to retrieve from the resource dictionary - - - Displays the current path. - - @param operation One of the possible combinations of {@link com.itextpdf.text.pdf.parser.PathPaintingRenderInfo#STROKE} - and {@link com.itextpdf.text.pdf.parser.PathPaintingRenderInfo#FILL} values or - {@link com.itextpdf.text.pdf.parser.PathPaintingRenderInfo#NO_OP} - @param rule Either {@link com.itextpdf.text.pdf.parser.PathPaintingRenderInfo#NONZERO_WINDING_RULE} or - {@link com.itextpdf.text.pdf.parser.PathPaintingRenderInfo#EVEN_ODD_RULE} - In case it isn't applicable pass any int value. - @param close Indicates whether the path should be closed or not. - @since 5.5.6 - - - Modifies the current path. - - @param operation Indicates which path-construction operation should be performed. - @param segmentData Contains x, y components of points of a new segment being added to the current path. - E.g. x1 y1 x2 y2 x3 y3 etc. It's ignored for "close subpath" operarion (h). - - - Adjusts the text matrix for the specified adjustment value (see TJ oper in the PDF spec for information) - @param tj the text adjustment - - - Processes PDF syntax. - Note: If you re-use a given {@link PdfContentStreamProcessor}, you must call {@link PdfContentStreamProcessor#reset()} - @param contentBytes the bytes of a content stream - @param resources the resources that come with the content stream - - - Callback when an inline image is found. This requires special handling because inline images don't follow the standard operator syntax - @param info the inline image - @param colorSpaceDic the color space for the inline immage - - - Property for the RenderListener object maintained in this class. - Necessary for implementing custom ContentOperator implementations. - @return the renderListener - - - A resource dictionary that allows stack-like behavior to support resource dictionary inheritance - - - A content oper implementation (unregistered). - - - A content oper implementation (TJ). - - - A content oper implementation ("). - - - A content oper implementation ('). - - - A content oper implementation (Tj). - - - A content oper implementation (T*). - - - A content oper implementation (Tm). - - - A content oper implementation (TD). - - - A content oper implementation (Td). - - - A content oper implementation (Tf). - - - A content oper implementation (Tr). - - - A content oper implementation (Ts). - - - A content oper implementation (TL). - - - A content oper implementation (Tz). - - - A content oper implementation (Tc). - - - A content oper implementation (Tw). - - - A content oper implementation (gs). - - - A content oper implementation (q). - - - A content oper implementation (cm). - - - Gets a color based on a list of operands. - - - Gets a color based on a list of operands. - - - A content operator implementation (g). - - - A content operator implementation (G). - - - A content operator implementation (rg). - - - A content operator implementation (RG). - - - A content operator implementation (rg). - - - A content operator implementation (RG). - - - A content operator implementation (cs). - - - A content operator implementation (CS). - - - A content operator implementation (sc / scn). - - - A content operator implementation (SC / SCN). - - - A content oper implementation (Q). - - - A content oper implementation (BT). - - - A content oper implementation (ET). - - - A content oper implementation (BMC). - @since 5.0.2 - - - A content oper implementation (BDC). - @since 5.0.2 - - - A content oper implementation (EMC). - @since 5.0.2 - - - A content oper implementation (Do). - - - A content operator implementation (w). - - - A content operator implementation (J). - - - A content operator implementation (j). - - - A content operator implementation (M). - - - A content operator implementation (d). - - - A content operator implementation (m). - - @since 5.5.6 - - - A content operator implementation (l). - - @since 5.5.6 - - - A content operator implementation (c). - - @since 5.5.6 - - - A content operator implementation (v). - - @since 5.5.6 - - - A content operator implementation (y). - - @since 5.5.6 - - - A content operator implementation (h). - - @since 5.5.6 - - - A content operator implementation (re). - - @since 5.5.6 - - - A content operator implementation (S, s, f, F, f*, B, B*, b, b*). - - @since 5.5.6 - - - Constructs PainPath object. - - @param operation One of the possible combinations of {@link com.itextpdf.text.pdf.parser.PathPaintingRenderInfo#STROKE} - and {@link com.itextpdf.text.pdf.parser.PathPaintingRenderInfo#FILL} values or - {@link com.itextpdf.text.pdf.parser.PathPaintingRenderInfo#NO_OP} - @param rule Either {@link com.itextpdf.text.pdf.parser.PathPaintingRenderInfo#NONZERO_WINDING_RULE} or - {@link com.itextpdf.text.pdf.parser.PathPaintingRenderInfo#EVEN_ODD_RULE} - In case it isn't applicable pass any value. - @param close Indicates whether the path should be closed or not. - - - A content operator implementation (n). - - @since 5.5.6 - - - An XObject subtype handler for FORM - - - An XObject subtype handler for IMAGE - - - An XObject subtype handler that does nothing - - - An object that contains an image dictionary and image bytes. - @since 5.0.2 - - - Different types of data that can be stored in the bytes of a {@link PdfImageObject} - @since 5.0.4 - - - the recommended file extension for streams of this type - - - @param fileExtension the recommended file extension for use with data of this type (for example, if the bytes were just saved to a file, what extension should the file have) - - - @return the file extension registered when this type was created - - - A filter that does nothing, but keeps track of the filter type that was used - @since 5.0.4 - - - The image dictionary. - - - The decoded image bytes (after applying filters), or the raw image bytes if unable to decode - - - Tracks the type of data that is actually stored in the streamBytes member - - - @return the type of image data that is returned by getImageBytes() - - - Creates a PdfImage object. - @param stream a PRStream - @throws IOException - - - Creates a PdfImage object. - @param stream a PRStream - @param colorSpaceDic a color space dictionary - @throws IOException - - - Creats a PdfImage object using an explicitly provided dictionary and image bytes - @param dictionary the dictionary for the image - @param samples the samples - @since 5.0.3 - - - Returns an entry from the image dictionary. - @param key a key - @return the value - - - Returns the image dictionary. - @return the dictionary - - - Sets state of this object according to the color space - @param colorspace the colorspace to use - @param allowIndexed whether indexed color spaces will be resolved (used for recursive call) - @throws IOException if there is a problem with reading from the underlying stream - - - decodes the bytes currently captured in the streamBytes and replaces it with an image representation of the bytes - (this will either be a png or a tiff, depending on the color depth of the image) - @throws IOException - - - @return the bytes of the image (the format will be as specified in {@link PdfImageObject#getImageBytesType()} - @throws IOException - @since 5.0.4 - - - A utility class that makes it cleaner to process content from pages of a PdfReader - through a specified RenderListener. - @since 5.0.2 - - - the reader this parser will process - - - - - Extracts text from a PDF file. - @since 2.1.4 - - - Extract text from a specified page using an extraction strategy. - Also allows registration of custom ContentOperators - @param reader the reader to extract text from - @param pageNumber the page to extract text from - @param strategy the strategy to use for extracting text - @param additionalContentOperators an optional dictionary of custom IContentOperators for rendering instructions - @return the extracted text - @throws IOException if any operation fails while reading from the provided PdfReader - - - Extract text from a specified page using an extraction strategy. - @param reader the reader to extract text from - @param pageNumber the page to extract text from - @param strategy the strategy to use for extracting text - @return the extracted text - @throws IOException if any operation fails while reading from the provided PdfReader - @since 5.0.2 - - - - A {@link RenderFilter} that only allows text within a specified rectangular region - @since 5.0.1 - - - the region to allow text from - - - Constructs a filter - @param filterRect the rectangle to filter text against. Note that this is a java.awt.Rectangle ! - - - Constructs a filter - @param filterRect the rectangle to filter text against. - - - @see com.itextpdf.text.pdf.parser.RenderFilter#allowText(com.itextpdf.text.pdf.parser.TextRenderInfo) - - - Interface for defining filters for use with {@link FilteredRenderListener} - @since 5.0.1 - - - @param renderInfo - @return true if the text render operation should be performed - - - - @param renderInfo - @return true if the image render operation should be performed - - - Represents segment from a PDF path. - - @since 5.5.6 - - - Treat base points as the points which are enough to construct a shape. - E.g. for a bezier curve they are control points, for a line segment - the start and the end points - of the segment. - - @return Ordered list consisting of shape's base points. - - - A simple text extraction renderer. - - This renderer keeps track of the current Y position of each string. If it detects - that the y position has changed, it inserts a line break into the output. If the - PDF renders text in a non-top-to-bottom fashion, this will result in the text not - being a true representation of how it appears in the PDF. - - This renderer also uses a simple strategy based on the font metrics to determine if - a blank space should be inserted into the output. - - @since 2.1.5 - - - used to store the resulting String. - - - Creates a new text extraction renderer. - - - @since 5.0.1 - - - @since 5.0.1 - - - Returns the result so far. - @return a String with the resulting text. - - - Used to actually append text to the text results. Subclasses can use this to insert - text that wouldn't normally be included in text parsing (e.g. result of OCR performed against - image content) - @param text the text to append to the text results accumulated so far - - - Captures text using a simplified algorithm for inserting hard returns and spaces - @param renderInfo render info - - - no-op method - this renderer isn't interested in image events - @see com.itextpdf.text.pdf.parser.RenderListener#renderImage(com.itextpdf.text.pdf.parser.ImageRenderInfo) - @since 5.0.1 - - - As subpath is a part of a path comprising a sequence of connected segments. - - @since 5.5.6 - - - Copy constuctor. - @param subpath - - - Constructs a new subpath starting at the given point. - - - Constructs a new subpath starting at the given point. - - - Sets the start point of the subpath. - @param startPoint - - - Sets the start point of the subpath. - @param x - @param y - - - @return The point this subpath starts at. - - - @return The last point of the subpath. - - - Adds a segment to the subpath. - Note: each new segment shall start at the end of the previous segment. - @param segment new segment. - - - @return {@link java.util.List} comprising all the segments - the subpath made on. - - - Checks whether subpath is empty or not. - @return true if the subpath is empty, false otherwise. - - - @return true if this subpath contains only one point and it is not closed, - false otherwise - - - Returns or sets a bool value indicating whether the subpath must be closed or not. - Ignore this value if the subpath is a rectangle because in this case it is already closed - (of course if you paint the path using re operator) - - @return bool value indicating whether the path must be closed or not. - @since 5.5.6 - - - Returns a bool indicating whether the subpath is degenerate or not. - A degenerate subpath is the subpath consisting of a single-point closed path or of - two or more points at the same coordinates. - - @return bool value indicating whether the path is degenerate or not. - @since 5.5.6 - - - @return {@link java.util.List} containing points of piecewise linear approximation - for this subpath. - @since 5.5.6 - - - Converts a tagged PDF document into an XML file. - - @since 5.0.2 - - - The reader obj from which the content streams are read. - - - The writer obj to which the XML will be written - - - Parses a string with structured content. - - @param reader - the PdfReader that has access to the PDF file - @param os - the Stream to which the resulting xml will be written - @param charset - the charset to encode the data - @since 5.0.5 - - - Parses a string with structured content. - - @param reader - the PdfReader that has access to the PDF file - @param os - the Stream to which the resulting xml will be written - - - Inspects a child of a structured element. This can be an array or a - dictionary. - - @param k - the child to inspect - @throws IOException - - - If the child of a structured element is an array, we need to loop over - the elements. - - @param k - the child array to inspect - - - If the child of a structured element is a dictionary, we inspect the - child; we may also draw a tag. - - @param k - the child dictionary to inspect - - - If the child of a structured element is a dictionary, we inspect the - child; we may also draw a tag. - - @param k - the child dictionary to inspect - - - Searches for a tag in a page. - - @param tag - the name of the tag - @param obj - an identifier to find the marked content - @param page - a page dictionary - @throws IOException - - - Allows you to find the rectangle that contains all the text in a page. - @since 5.0.2 - - - Method invokes by the PdfContentStreamProcessor. - Passes a TextRenderInfo for every text chunk that is encountered. - We'll use this object to obtain coordinates. - @see com.itextpdf.text.pdf.parser.RenderListener#renderText(com.itextpdf.text.pdf.parser.TextRenderInfo) - - - Getter for the left margin. - @return the X position of the left margin - - - Getter for the bottom margin. - @return the Y position of the bottom margin - - - Getter for the right margin. - @return the X position of the right margin - - - Getter for the top margin. - @return the Y position of the top margin - - - Gets the width of the text block. - @return a width - - - Gets the height of the text block. - @return a height - - - @see com.itextpdf.text.pdf.parser.RenderListener#beginTextBlock() - - - @see com.itextpdf.text.pdf.parser.RenderListener#endTextBlock() - - - @see com.itextpdf.text.pdf.parser.RenderListener#renderImage(com.itextpdf.text.pdf.parser.ImageRenderInfo) - - - - ! .NET SPECIFIC ! - is used for caching "UTF-16BE" encoding to improve performance - - - Array containing marked content info for the text. - @since 5.0.2 - - - Creates a new TextRenderInfo object - @param string the PDF string that should be displayed - @param gs the graphics state (note: at this time, this is not immutable, so don't cache it) - @param textMatrix the text matrix at the time of the render operation - @param markedContentInfo the marked content sequence, if available - - - Used for creating sub-TextRenderInfos for each individual character - @param parent the parent TextRenderInfo - @param string the content of a TextRenderInfo - @param horizontalOffset the unscaled horizontal offset of the character that this TextRenderInfo represents - @since 5.3.3 - - - @return the text to render - - - @return original PDF string - - - Checks if the text belongs to a marked content sequence - with a given mcid. - @param mcid a marked content id - @return true if the text is marked with this id - @since 5.0.2 - - - * Checks if the text belongs to a marked content sequence - * with a given mcid. - * @param mcid a marked content id - * @param checkTheTopmostLevelOnly indicates whether to check the topmost level of marked content stack only - * @return true if the text is marked with this id - * @since 5.3.5 - - - @return the marked content associated with the TextRenderInfo instance. - - - @return the unscaled (i.e. in Text space) width of the text - - - Gets the baseline for the text (i.e. the line that the text 'sits' on) - This value includes the Rise of the draw operation - see {@link #getRise()} for the amount added by Rise - @return the baseline line segment - @since 5.0.2 - - - Gets the ascentline for the text (i.e. the line that represents the topmost extent that a string of the current font could have) - This value includes the Rise of the draw operation - see {@link #getRise()} for the amount added by Rise - @return the ascentline line segment - @since 5.0.2 - - - Gets the descentline for the text (i.e. the line that represents the bottom most extent that a string of the current font could have) - This value includes the Rise of the draw operation - see {@link #getRise()} for the amount added by Rise - @return the descentline line segment - @since 5.0.2 - - - Getter for the font - @return the font - @since iText 5.0.2 - - - The rise represents how far above the nominal baseline the text should be rendered. The {@link #getBaseline()}, {@link #getAscentLine()} and {@link #getDescentLine()} methods already include Rise. - This method is exposed to allow listeners to determine if an explicit rise was involved in the computation of the baseline (this might be useful, for example, for identifying superscript rendering) - @return The Rise for the text draw operation, in user space units (Ts value, scaled to user space) - @since 5.3.3 - - - - @param width the width, in text space - @return the width in user space - @since 5.3.3 - - - - @param height the height, in text space - @return the height in user space - @since 5.3.3 - - - @return The width, in user space units, of a single space character in the current font - - - @return the text render mode that should be used for the text. From the - PDF specification, this means: -
      -
    • 0 = Fill text
    • -
    • 1 = Stroke text
    • -
    • 2 = Fill, then stroke text
    • -
    • 3 = Invisible
    • -
    • 4 = Fill text and add to path for clipping
    • -
    • 5 = Stroke text and add to path for clipping
    • -
    • 6 = Fill, then stroke text and add to path for clipping
    • -
    • 7 = Add text to padd for clipping
    • -
    - @since iText 5.0.1 -
    - - @return the current fill color. - - - @return the current stroke color. - - - Calculates the width of a space character. If the font does not define - a width for a standard space character \u0020, we also attempt to use - the width of \u00A0 (a non-breaking space in many fonts) - @return the width of a single space character in text space units - - - Gets the width of a String in text space units - @param string the string that needs measuring - @return the width of a String in text space units - - - Gets the width of a PDF string in text space units - @param string the string that needs measuring - @return the width of a String in text space units - - - Provides detail useful if a listener needs access to the position of each individual glyph in the text render operation - @return A list of {@link TextRenderInfo} objects that represent each glyph used in the draw operation. The next effect is if there was a separate Tj opertion for each character in the rendered string - @since 5.3.3 - - - Calculates width and word spacing of a single character PDF string. - @param string a character to calculate width. - @param singleCharString true if PDF string represents single character, false otherwise. - @return array of 2 items: first item is a character width, second item is a calculated word spacing. - - - Decodes a PdfString (which will contain glyph ids encoded in the font's encoding) - based on the active font, and determine the unicode equivalent - @param in the String that needs to be encoded - @return the encoded String - - - ! .NET SPECIFIC; this method is used to avoid unecessary using of StringBuilder because it is slow in .NET ! - Decodes a single character PdfString (which will contain glyph ids encoded in the font's encoding) - based on the active font, and determine the unicode equivalent - @param in the String that needs to be encoded - @return the encoded String - - - Converts a single character string to char code. - - @param string single character string to convert to. - @return char code. - - - Split PDF string into array of single character PDF strings. - @param string PDF string to be splitted. - @return splitted PDF string. - - - - index of the X coordinate - - - index of the Y coordinate - - - index of the Z coordinate - - - the values inside the vector - - - Creates a new Vector - @param x the X coordinate - @param y the Y coordinate - @param z the Z coordinate - - - Gets the value from a coordinate of the vector - @param index the index of the value to get (I1, I2 or I3) - @return a coordinate value - - - Computes the cross product of this vector and the specified matrix - @param by the matrix to cross this vector with - @return the result of the cross product - - - Computes the difference between this vector and the specified vector - @param v the vector to subtract from this one - @return the results of the subtraction - - - Computes the cross product of this vector and the specified vector - @param with the vector to cross this vector with - @return the cross product - - - Normalizes the vector (i.e. returns the unit vector in the same orientation as this vector) - @return the unit vector - @since 5.0.1 - - - Multiplies the vector by a scalar - @param by the scalar to multiply by - @return the result of the scalar multiplication - @since 5.0.1 - - - Computes the dot product of this vector with the specified vector - @param with the vector to dot product this vector with - @return the dot product - - - - - @see java.lang.Object#toString() - - - @since 5.0.1 - @see java.lang.Object#equals(java.lang.Object) - - - @author Kevin Day - @since iText 5.0.1 - - - Represents an inline image from a PDF - @since 5.1.4 - - - @return the image dictionary associated with this inline image - - - @return the raw samples associated with this inline image - - - Utility methods to help with processing of inline images - @since 5.0.4 - - - Simple class in case users need to differentiate an exception from processing - inline images vs other exceptions - @since 5.0.4 - - - Map between key abbreviations allowed in dictionary of inline images and their - equivalent image dictionary keys - - - Map between value abbreviations allowed in dictionary of inline images for COLORSPACE - - - Map between value abbreviations allowed in dictionary of inline images for FILTER - - - Parses an inline image from the provided content parser. The parser must be positioned immediately following the BI operator in the content stream. - The parser will be left with current position immediately following the EI operator that terminates the inline image - @param ps the content parser to use for reading the image. - @return the parsed image - @throws IOException if anything goes wring with the parsing - @throws InlineImageParseException if parsing of the inline image failed due to issues specific to inline image processing - - - Parses the next inline image dictionary from the parser. The parser must be positioned immediately following the EI operator. - The parser will be left with position immediately following the whitespace character that follows the ID operator that ends the inline image dictionary. - @param ps the parser to extract the embedded image information from - @return the dictionary for the inline image, with any abbreviations converted to regular image dictionary keys and values - @throws IOException if the parse fails - - - Transforms value abbreviations into their corresponding real value - @param key the key that the value is for - @param value the value that might be an abbreviation - @return if value is an allowed abbreviation for the key, the expanded value for that abbreviation. Otherwise, value is returned without modification - - - @param colorSpaceName the name of the color space. If null, a bi-tonal (black and white) color space is assumed. - @return the components per pixel for the specified color space - - - Computes the number of unfiltered bytes that each row of the image will contain. - If the number of bytes results in a partial terminating byte, this number is rounded up - per the PDF specification - @param imageDictionary the dictionary of the inline image - @return the number of bytes per row of the image - - - Parses the samples of the image from the underlying content parser, ignoring all filters. - The parser must be positioned immediately after the ID operator that ends the inline image's dictionary. - The parser will be left positioned immediately following the EI operator. - This is primarily useful if no filters have been applied. - @param imageDictionary the dictionary of the inline image - @param ps the content parser - @return the samples of the image - @throws IOException if anything bad happens during parsing - - - Parses the samples of the image from the underlying content parser, accounting for filters - The parser must be positioned immediately after the ID operator that ends the inline image's dictionary. - The parser will be left positioned immediately following the EI operator. - Note:This implementation does not actually apply the filters at this time - @param imageDictionary the dictionary of the inline image - @param ps the content parser - @return the samples of the image - @throws IOException if anything bad happens during parsing - - - Represents a pattern. Can be used in high-level constructs (Paragraph, Cell, etc.). - - - The actual pattern. - - - Creates a color representing a pattern. - @param painter the actual pattern - - - Gets the pattern. - @return the pattern - - - Each PDF document can contain maximum 1 AcroForm. - - - This is a map containing FieldTemplates. - - - This is an array containing DocumentFields. - - - This is an array containing the calculationorder of the fields. - - - Contains the signature flags. - - - Creates new PdfAcroForm - - - Adds fieldTemplates. - - - Adds documentFields. - - - Closes the AcroForm. - - - Adds an object to the calculationOrder. - - - Sets the signature flags. - - - Adds a formfield to the AcroForm. - - - @param field - @param name - @param llx - @param lly - @param urx - @param ury - - - @param field - @param llx - @param lly - @param urx - @param ury - - - A PdfAction defines an action that can be triggered from a PDF file. - - @see PdfDictionary - - - A named action to go to the first page. - - - A named action to go to the previous page. - - - A named action to go to the next page. - - - A named action to go to the last page. - - - A named action to open a print dialog. - - - a possible submitvalue - - - a possible submitvalue - - - a possible submitvalue - - - a possible submitvalue - - - a possible submitvalue - - - a possible submitvalue - - - a possible submitvalue - - - a possible submitvalue - - - a possible submitvalue - - - Create an empty action. - - - Constructs a new PdfAction of Subtype URI. - - @param url the Url to go to - - - Constructs a new PdfAction of Subtype URI. - - @param url the url to go to - - - Constructs a new PdfAction of Subtype GoTo. - @param destination the destination to go to - - - Constructs a new PdfAction of Subtype GoToR. - @param filename the file name to go to - @param name the named destination to go to - - - Constructs a new PdfAction of Subtype GoToR. - @param filename the file name to go to - @param page the page destination to go to - - - Implements name actions. The action can be FIRSTPAGE, LASTPAGE, - NEXTPAGE and PREVPAGE. - @param named the named action - - - Launchs an application or a document. - @param application the application to be launched or the document to be opened or printed. - @param parameters (Windows-specific) A parameter string to be passed to the application. - It can be null. - @param operation (Windows-specific) the operation to perform: "open" - Open a document, - "print" - Print a document. - It can be null. - @param defaultDir (Windows-specific) the default directory in standard DOS syntax. - It can be null. - - - Launchs an application or a document. - @param application the application to be launched or the document to be opened or printed. - @param parameters (Windows-specific) A parameter string to be passed to the application. - It can be null. - @param operation (Windows-specific) the operation to perform: "open" - Open a document, - "print" - Print a document. - It can be null. - @param defaultDir (Windows-specific) the default directory in standard DOS syntax. - It can be null. - @return a Launch action - - - Creates a Rendition action - @param file - @param fs - @param mimeType - @param ref - @return a Media Clip action - @throws IOException - - - Creates a JavaScript action. If the JavaScript is smaller than - 50 characters it will be placed as a string, otherwise it will - be placed as a compressed stream. - @param code the JavaScript code - @param writer the writer for this action - @param unicode select JavaScript unicode. Note that the internal - Acrobat JavaScript engine does not support unicode, - so this may or may not work for you - @return the JavaScript action - - - Creates a JavaScript action. If the JavaScript is smaller than - 50 characters it will be place as a string, otherwise it will - be placed as a compressed stream. - @param code the JavaScript code - @param writer the writer for this action - @return the JavaScript action - - - Add a chained action. - @param na the next action - - - Creates a GoTo action to an internal page. - @param page the page to go. First page is 1 - @param dest the destination for the page - @param writer the writer for this action - @return a GoTo action - - - Creates a GoTo action to a named destination. - @param dest the named destination - @param isName if true sets the destination as a name, if false sets it as a String - @return a GoToR action - - - Creates a GoToR action to a named destination. - @param filename the file name to go to - @param dest the destination name - @param isName if true sets the destination as a name, if false sets it as a String - @param newWindow open the document in a new window if true, if false the current document is replaced by the new document. - @return a GoToR action - - - Creates a GoToE action to an embedded file. - @param filename the root document of the target (null if the target is in the same document) - @param dest the named destination - @param isName if true sets the destination as a name, if false sets it as a String - @return a GoToE action - - - Creates a GoToE action to an embedded file. - @param filename the root document of the target (null if the target is in the same document) - @param target a path to the target document of this action - @param dest the destination inside the target document, can be of type PdfDestination, PdfName, or PdfString - @param newWindow if true, the destination document should be opened in a new window - @return a GoToE action - - - - A PdfAnnotation is a note that is associated with a page. - - @see PdfDictionary - - - flagvalue PDF 1.7 - - - attributevalue - - - Holds value of property used. - - - Holds value of property placeInPage. - - - Constructs a new PdfAnnotation of subtype text. - - - Constructs a new PdfAnnotation of subtype link (Action). - - - Creates a screen PdfAnnotation - @param writer - @param rect - @param clipTitle - @param fs - @param mimeType - @param playOnDisplay - @return a screen PdfAnnotation - @throws IOException - - - Creates a file attachment annotation. - @param writer the PdfWriter - @param rect the dimensions in the page of the annotation - @param contents the file description - @param fileStore an array with the file. If it's null - the file will be read from the disk - @param file the path to the file. It will only be used if - fileStore is not null - @param fileDisplay the actual file name stored in the pdf - @throws IOException on error - @return the annotation - - - Creates a file attachment annotation - @param writer - @param rect - @param contents - @param fs - @return the annotation - @throws IOException - - - Creates a polygon or -line annotation - @param writer the PdfWriter - @param rect the annotation position - @param contents the textual content of the annotation - @param polygon if true, the we're creating a polygon annotation, if false, a polyline - @param vertices an array with the vertices of the polygon or -line - @since 5.0.2 - - - Sets the annotation's highlighting mode. The values can be - HIGHLIGHT_NONE, HIGHLIGHT_INVERT, - HIGHLIGHT_OUTLINE and HIGHLIGHT_PUSH; - @param highlight the annotation's highlighting mode - - - Getter for property form. - @return Value of property form. - - - Getter for property annotation. - @return Value of property annotation. - - - Getter for property placeInPage. - @return Value of property placeInPage. - - - Sets the layer this annotation belongs to. - @param layer the layer this annotation belongs to - - - Sets the name of the annotation. - With this name the annotation can be identified among - all the annotations on a page (it has to be unique). - - - This class processes links from imported pages so that they may be active. The following example code reads a group - of files and places them all on the output PDF, four pages in a single page, keeping the links active. -
    -            String[] files = new String[] {"input1.pdf", "input2.pdf"};
    -            String outputFile = "output.pdf";
    -            int firstPage=1;
    -            Document document = new Document();
    -            PdfWriter writer = PdfWriter.GetInstance(document, new FileOutputStream(outputFile));
    -            document.SetPageSize(PageSize.A4);
    -            float W = PageSize.A4.GetWidth() / 2;
    -            float H = PageSize.A4.GetHeight() / 2;
    -            document.Open();
    -            PdfContentByte cb = writer.GetDirectContent();
    -            for (int i = 0; i < files.length; i++) {
    -               PdfReader currentReader = new PdfReader(files[i]);
    -               currentReader.ConsolidateNamedDestinations();
    -               for (int page = 1; page <= currentReader.GetNumberOfPages(); page++) {
    -                   PdfImportedPage importedPage = writer.GetImportedPage(currentReader, page);
    -                   float a = 0.5f;
    -                   float e = (page % 2 == 0) ? W : 0;
    -                   float f = (page % 4 == 1 || page % 4 == 2) ? H : 0;
    -                   ArrayList links = currentReader.GetLinks(page);
    -                   cb.AddTemplate(importedPage, a, 0, 0, a, e, f);
    -                   for (int j = 0; j < links.Size(); j++) {
    -                       PdfAnnotation.PdfImportedLink link = (PdfAnnotation.PdfImportedLink)links.Get(j);
    -                       if (link.IsInternal()) {
    -                           int dPage = link.GetDestinationPage();
    -                           int newDestPage = (dPage-1)/4 + firstPage;
    -                           float ee = (dPage % 2 == 0) ? W : 0;
    -                           float ff = (dPage % 4 == 1 || dPage % 4 == 2) ? H : 0;
    -                           link.SetDestinationPage(newDestPage);
    -                           link.TransformDestination(a, 0, 0, a, ee, ff);
    -                       }
    -                       link.TransformRect(a, 0, 0, a, e, f);
    -                       writer.AddAnnotation(link.CreateAnnotation(writer));
    -                   }
    -                   if (page % 4 == 0)
    -                   document.NewPage();
    -               }
    -               if (i < files.length - 1)
    -               document.NewPage();
    -               firstPage += (currentReader.GetNumberOfPages()+3)/4;
    -            }
    -            document.Close();
    -            
    -
    - - Returns a String representation of the link. - @return a String representation of the imported link - @since 2.1.6 - - - Implements the appearance stream to be used with form fields.. - - - Creates a PdfAppearance. - - - Creates new PdfTemplate - - @param wr the PdfWriter - - - Creates a new appearance to be used with form fields. - - @param width the bounding box width - @param height the bounding box height - @return the appearance created - - - Set the font and the size for the subsequent text writing. - - @param bf the font - @param size the font size in points - - - - this is the actual array of PdfObjects - - - Constructs an empty PdfArray-object. - - - Constructs an PdfArray-object, containing 1 PdfObject. - - @param object a PdfObject that has to be added to the array - - - Constructs a PdfArray with the elements of an ArrayList. - Throws a ClassCastException if the ArrayList contains something - that isn't a PdfObject. - @param l an ArrayList with PdfObjects - @since 2.1.3 - - - Constructs an PdfArray-object, containing all the PdfObjects in a given PdfArray. - - @param array a PdfArray that has to be added to the array - - - Returns the PDF representation of this PdfArray. - - @return an array of bytes - - - Overwrites a specified location of the array. - - @param idx The index of the element to be overwritten - @param obj new value for the specified index - @throws IndexOutOfBoundsException if the specified position doesn't exist - @return the previous value - @since 2.1.5 - - - Returns the PdfObject with the specified index. - - A possible indirect references is not resolved, so the returned - PdfObject may be either a direct object or an indirect - reference, depending on how the object is stored in the - PdfArray. - - @param idx The index of the PdfObject to be returned - @return A PdfObject - - - Overwrites a specified location of the array, returning the previous - value - - @param idx The index of the element to be overwritten - @param obj new value for the specified index - @throws IndexOutOfBoundsException if the specified position doesn't exist - @return the previous value - @since 2.1.5 - - - Remove the element at the specified position from the array. - - Shifts any subsequent elements to the left (subtracts one from their - indices). - - @param idx The index of the element to be removed. - @throws IndexOutOfBoundsException the specified position doesn't exist - @since 2.1.5 - - - Returns an ArrayList containing PdfObjects. - - @return an ArrayList - - - Returns the number of entries in the array. - - @return the size of the ArrayList - - - Returns true if the array is empty. - - @return true if the array is empty - @since 2.1.5 - - - Adds a PdfObject to the PdfArray. - - @param object PdfObject to add - @return true - - - Inserts the specified element at the specified position. - - Shifts the element currently at that position (if any) and - any subsequent elements to the right (adds one to their indices). - - @param index The index at which the specified element is to be inserted - @param element The element to be inserted - @throws IndexOutOfBoundsException if the specified index is larger than the - last position currently set, plus 1. - @since 2.1.5 - - - Inserts a PdfObject at the beginning of the - PdfArray. - - The PdfObject will be the first element, any other elements - will be shifted to the right (adds one to their indices). - - @param object The PdfObject to add - - - Checks if the PdfArray already contains a certain PdfObject. - - @param object PdfObject to check - @return true - - - - @return this PdfArray's values as a long[] - @since 5.3.5 - - - - @return this PdfArray's values as a double[] - @since 5.5.6 - - - - A possible value of PdfBoolean - - - A possible value of PdfBoolean - - - the bool value of this object - - - Constructs a PdfBoolean-object. - - @param value the value of the new PdfObject - - - Constructs a PdfBoolean-object. - - @param value the value of the new PdfObject, represented as a string - - @throws BadPdfFormatException thrown if the value isn't 'true' or 'false' - - - Returns the primitive value of the PdfBoolean-object. - - @return the actual value of the object. - - - A PdfBorderArray defines the border of a PdfAnnotation. - - @see PdfArray - - - Constructs a new PdfBorderArray. - - - Constructs a new PdfBorderArray. - - - A PdfBorderDictionary define the appearance of a Border (Annotations). - - @see PdfDictionary - - - Constructs a PdfBorderDictionary. - - - - The allowed attributes in variable attributes. - - - The allowed attributes in variable noStroke. - - - The value of this object. - - - The encoding. - - - The font for this PdfChunk. - - - - - true if the chunk split was cause by a newline. - - - The image in this PdfChunk, if it has one - - - The offset in the x direction for the image - - - The offset in the y direction for the image - - - Indicates if the height and offset of the Image has to be taken into account - - - The leading that can overrule the existing leading. - - - Constructs a PdfChunk-object. - - @param string the content of the PdfChunk-object - @param font the PdfFont - @param attributes the metrics attributes - @param noStroke the non metric attributes - - - Constructs a PdfChunk-object. - - @param chunk the original Chunk-object - @param action the PdfAction if the Chunk comes from an Anchor - - - Constructs a PdfChunk-object. - - @param chunk the original Chunk-object - @param action the PdfAction if the Chunk comes from an Anchor - @param tabSettings the Phrase tab settings - - - - - - Returns the font of this Chunk. - - @return a PdfFont - - - Returns the color of this Chunk. - - @return a BaseColor - - - Returns the width of this PdfChunk. - - @return a width - - - Checks if the PdfChunk split was caused by a newline. - @return true if the PdfChunk split was caused by a newline. - - - Gets the width of the PdfChunk taking into account the - extra character and word spacing. - @param charSpacing the extra character spacing - @param wordSpacing the extra word spacing - @return the calculated width - - - Gets the text displacement relatiev to the baseline. - @return a displacement in points - - - Trims the last space. - @return the width of the space trimmed, otherwise 0 - - - Gets an attribute. The search is made in attributes - and noStroke. - @param name the attribute key - @return the attribute value or null if not found - - - Checks if the attribute exists. - @param name the attribute key - @return true if the attribute exists - - - Checks if this PdfChunk needs some special metrics handling. - @return true if this PdfChunk needs some special metrics handling. - - - Checks if this PdfChunk is a Separator Chunk. - @return true if this chunk is a separator. - @since 2.1.2 - - - Checks if this PdfChunk is a horizontal Separator Chunk. - @return true if this chunk is a horizontal separator. - @since 2.1.2 - - - Checks if this PdfChunk is a tab Chunk. - @return true if this chunk is a separator. - @since 2.1.2 - - - Correction for the tab position based on the left starting position. - @param newValue the new value for the left X. - @since 2.1.2 - - - Checks if there is an image in the PdfChunk. - @return true if an image is present - - - Gets the image in the PdfChunk. - @return the image or null - - - Returns a scalePercentage in case the image needs to be scaled. - Sets a scale percentage in case the image needs to be scaled. - - - Gets the image offset in the x direction - @return the image offset in the x direction - - - Gets the image offset in the y direction - @return Gets the image offset in the y direction - - - sets the value. - - - Tells you if this string is in Chinese, Japanese, Korean or Identity-H. - - - Gets the encoding of this string. - - @return a string - - - - A PdfColor defines a Color (it's a PdfArray containing 3 values). - - @see PdfDictionary - - - Constructs a new PdfColor. - - @param red a value between 0 and 255 - @param green a value between 0 and 255 - @param blue a value between 0 and 255 - - - PdfContentByte is an object containing the user positioned - text and graphic contents of a page. It knows how to apply the proper - font encoding. - - - This class keeps the graphic state of the current page - - - This is the font in use - - - This is the color in use - - - This is the font size in use - - - The x position of the text line matrix. - - - The y position of the text line matrix. - - - The current text leading. - - - The current horizontal scaling - - - The current character spacing - - - The current word spacing - - - The alignement is center - - - The alignement is left - - - The alignement is right - - - A possible line cap value - - - A possible line cap value - - - A possible line cap value - - - A possible line join value - - - A possible line join value - - - A possible line join value - - - A possible text rendering value - - - A possible text rendering value - - - A possible text rendering value - - - A possible text rendering value - - - A possible text rendering value - - - A possible text rendering value - - - A possible text rendering value - - - A possible text rendering value - - - This is the actual content - - - This is the writer - - - This is the PdfDocument - - - This is the GraphicState in use - - - The list were we save/restore the layer depth - - - The list were we save/restore the state - - - The separator between commands. - - - Constructs a new PdfContentByte-object. - - @param wr the writer associated to this content - - - Returns the string representation of this PdfContentByte-object. - - @return a string - - - [SUP-1395] If set, prevents iText from marking content and creating structure tags for items added to this content stream. - (By default, iText automatically marks content using BDC/EMC operators, and adds a structure tag for the new content - at the end of the page.) - - - Checks if the content needs to be tagged. - @return false if no tags need to be added - - - Gets the internal buffer. - @return the internal buffer - - - Returns the PDF representation of this PdfContentByte-object. - - @param writer the PdfWriter - @return a byte array with the representation - - - Adds the content of another PdfContent-object to this object. - - @param other another PdfByteContent-object - - - Gets the x position of the text line matrix. - - @return the x position of the text line matrix - - - Gets the y position of the text line matrix. - - @return the y position of the text line matrix - - - Gets the current character spacing. - - @return the current character spacing - - - Gets the current word spacing. - - @return the current word spacing - - - Gets the current character spacing. - - @return the current character spacing - - - Gets the current text leading. - - @return the current text leading - - - - - - Set the rendering intent, possible values are: PdfName.ABSOLUTECOLORIMETRIC, - PdfName.RELATIVECOLORIMETRIC, PdfName.SATURATION, PdfName.PERCEPTUAL. - @param ri - - - - - - - - - - - - - - - - Modify the current clipping path by intersecting it with the current path, using the - nonzero winding number rule to determine which regions lie inside the clipping - path. - - - Modify the current clipping path by intersecting it with the current path, using the - even-odd rule to determine which regions lie inside the clipping path. - - - Changes the currentgray tint for filling paths (device dependent colors!). -

    - Sets the color space to DeviceGray (or the DefaultGray color space), - and sets the gray tint to use for filling paths.

    - - @param gray a value between 0 (black) and 1 (white) -
    - - Changes the current gray tint for filling paths to black. - - - Changes the currentgray tint for stroking paths (device dependent colors!). -

    - Sets the color space to DeviceGray (or the DefaultGray color space), - and sets the gray tint to use for stroking paths.

    - - @param gray a value between 0 (black) and 1 (white) -
    - - Changes the current gray tint for stroking paths to black. - - - Helper to validate and write the RGB color components - @param red the intensity of red. A value between 0 and 1 - @param green the intensity of green. A value between 0 and 1 - @param blue the intensity of blue. A value between 0 and 1 - - - Changes the current color for filling paths (device dependent colors!). -

    - Sets the color space to DeviceRGB (or the DefaultRGB color space), - and sets the color to use for filling paths.

    -

    - Following the PDF manual, each operand must be a number between 0 (minimum intensity) and - 1 (maximum intensity).

    - - @param red the intensity of red. A value between 0 and 1 - @param green the intensity of green. A value between 0 and 1 - @param blue the intensity of blue. A value between 0 and 1 -
    - - Changes the current color for filling paths to black. - - - - Changes the current color for stroking paths to black. - - - - Helper to validate and write the CMYK color components. - - @param cyan the intensity of cyan. A value between 0 and 1 - @param magenta the intensity of magenta. A value between 0 and 1 - @param yellow the intensity of yellow. A value between 0 and 1 - @param black the intensity of black. A value between 0 and 1 - - - Changes the current color for filling paths (device dependent colors!). -

    - Sets the color space to DeviceCMYK (or the DefaultCMYK color space), - and sets the color to use for filling paths.

    -

    - Following the PDF manual, each operand must be a number between 0 (no ink) and - 1 (maximum ink).

    - - @param cyan the intensity of cyan. A value between 0 and 1 - @param magenta the intensity of magenta. A value between 0 and 1 - @param yellow the intensity of yellow. A value between 0 and 1 - @param black the intensity of black. A value between 0 and 1 -
    - - Changes the current color for filling paths to black. - - - - - Changes the current color for stroking paths to black. - - - - Move the current point (x, y), omitting any connecting line segment. - - @param x new x-coordinate - @param y new y-coordinate - - - Move the current point (x, y), omitting any connecting line segment. - - @param x new x-coordinate - @param y new y-coordinate - - - Appends a straight line segment from the current point (x, y). The new current - point is (x, y). - - @param x new x-coordinate - @param y new y-coordinate - - - Appends a straight line segment from the current point (x, y). The new current - point is (x, y). - - @param x new x-coordinate - @param y new y-coordinate - - - Appends a Bezier curve to the path, starting from the current point. - - @param x1 x-coordinate of the first control point - @param y1 y-coordinate of the first control point - @param x2 x-coordinate of the second control point - @param y2 y-coordinate of the second control point - @param x3 x-coordinaat of the ending point (= new current point) - @param y3 y-coordinaat of the ending point (= new current point) - - - Appends a Bezier curve to the path, starting from the current point. - - @param x1 x-coordinate of the first control point - @param y1 y-coordinate of the first control point - @param x2 x-coordinate of the second control point - @param y2 y-coordinate of the second control point - @param x3 x-coordinaat of the ending point (= new current point) - @param y3 y-coordinaat of the ending point (= new current point) - - - Appends a Bezier curve to the path, starting from the current point. - - @param x2 x-coordinate of the second control point - @param y2 y-coordinate of the second control point - @param x3 x-coordinaat of the ending point (= new current point) - @param y3 y-coordinaat of the ending point (= new current point) - - - Appends a Bezier curve to the path, starting from the current point. - - @param x2 x-coordinate of the second control point - @param y2 y-coordinate of the second control point - @param x3 x-coordinaat of the ending point (= new current point) - @param y3 y-coordinaat of the ending point (= new current point) - - - Appends a Bezier curve to the path, starting from the current point. - - @param x1 x-coordinate of the first control point - @param y1 y-coordinate of the first control point - @param x3 x-coordinaat of the ending point (= new current point) - @param y3 y-coordinaat of the ending point (= new current point) - - - Appends a Bezier curve to the path, starting from the current point. - - @param x1 x-coordinate of the first control point - @param y1 y-coordinate of the first control point - @param x3 x-coordinaat of the ending point (= new current point) - @param y3 y-coordinaat of the ending point (= new current point) - - - Draws a circle. The endpoint will (x+r, y). - - @param x x center of circle - @param y y center of circle - @param r radius of circle - - - Draws a circle. The endpoint will (x+r, y). - - @param x x center of circle - @param y y center of circle - @param r radius of circle - - - Adds a rectangle to the current path. - - @param x x-coordinate of the starting point - @param y y-coordinate of the starting point - @param w width - @param h height - - - Adds a rectangle to the current path. - - @param x x-coordinate of the starting point - @param y y-coordinate of the starting point - @param w width - @param h height - - - Adds a variable width border to the current path. - Only use if {@link com.lowagie.text.Rectangle#isUseVariableBorders() Rectangle.isUseVariableBorders} - = true. - @param rect a Rectangle - - - Adds a border (complete or partially) to the current path.. - - @param rectangle a Rectangle - - - Closes the current subpath by appending a straight line segment from the current point - to the starting point of the subpath. - - - Ends the path without filling or stroking it. - - - Strokes the path. - - - Closes the path and strokes it. - - - Fills the path, using the non-zero winding number rule to determine the region to fill. - - - Fills the path, using the even-odd rule to determine the region to fill. - - - Fills the path using the non-zero winding number rule to determine the region to fill and strokes it. - - - Closes the path, fills it using the non-zero winding number rule to determine the region to fill and strokes it. - - - Fills the path, using the even-odd rule to determine the region to fill and strokes it. - - - Closes the path, fills it using the even-odd rule to determine the region to fill and strokes it. - - - Adds an Image to the page. The Image must have - absolute positioning. - @param image the Image object - @throws DocumentException if the Image does not have absolute positioning - - - Adds an Image to the page. The Image must have - absolute positioning. The image can be placed inline. - @param image the Image object - @param inlineImage true to place this image inline, false otherwise - @throws DocumentException if the Image does not have absolute positioning - - - Adds an Image to the page. The positioning of the Image - is done with the transformation matrix. To position an image at (x,y) - use AddImage(image, image_width, 0, 0, image_height, x, y). - @param image the Image object - @param a an element of the transformation matrix - @param b an element of the transformation matrix - @param c an element of the transformation matrix - @param d an element of the transformation matrix - @param e an element of the transformation matrix - @param f an element of the transformation matrix - @throws DocumentException on error - - - Adds an Image to the page. The positioning of the Image - is done with the transformation matrix. To position an image at (x,y) - use AddImage(image, image_width, 0, 0, image_height, x, y). - @param image the Image object - @param a an element of the transformation matrix - @param b an element of the transformation matrix - @param c an element of the transformation matrix - @param d an element of the transformation matrix - @param e an element of the transformation matrix - @param f an element of the transformation matrix - @throws DocumentException on error - - - adds an image with the given matrix. - @param image image to add - @param transform transform to apply to the template prior to adding it. - - - Adds an Image to the page. The positioning of the Image - is done with the transformation matrix. To position an image at (x,y) - use AddImage(image, image_width, 0, 0, image_height, x, y). The image can be placed inline. - @param image the Image object - @param a an element of the transformation matrix - @param b an element of the transformation matrix - @param c an element of the transformation matrix - @param d an element of the transformation matrix - @param e an element of the transformation matrix - @param f an element of the transformation matrix - @param inlineImage true to place this image inline, false otherwise - @throws DocumentException on error - - - Adds an Image to the page. The positioning of the Image - is done with the transformation matrix. To position an image at (x,y) - use AddImage(image, image_width, 0, 0, image_height, x, y). The image can be placed inline. - @param image the Image object - @param a an element of the transformation matrix - @param b an element of the transformation matrix - @param c an element of the transformation matrix - @param d an element of the transformation matrix - @param e an element of the transformation matrix - @param f an element of the transformation matrix - @param inlineImage true to place this image inline, false otherwise - @throws DocumentException on error - - - Adds an Image to the page. The positioning of the Image - is done with the transformation matrix. To position an image at (x,y) - The image can be placed inline. - @param image the Image object - @param a an element of the transformation matrix - @param b an element of the transformation matrix - @param c an element of the transformation matrix - @param d an element of the transformation matrix - @param e an element of the transformation matrix - @param f an element of the transformation matrix - @param inlineImage true to place this image inline, false otherwise - @param isMCBlockOpened true not to open MCBlock, false otherwise - @throws DocumentException on error - - - Makes this PdfContentByte empty. - Calls reset( true ) - - - Makes this PdfContentByte empty. - @param validateContent will call sanityCheck() if true. - @since 2.1.6 - - - Starts the writing of text. - @param restoreTM indicates if to restore text matrix of the previous text block. - - - Starts the writing of text. - - - Ends the writing of text and makes the current font invalid. - - - Saves the graphic state. saveState and - restoreState must be balanced. - - - Restores the graphic state. saveState and - restoreState must be balanced. - - - Sets the character spacing parameter. - - @param charSpace a parameter - - - Sets the word spacing parameter. - - @param wordSpace a parameter - - - Sets the horizontal scaling parameter. - - @param scale a parameter - - - Set the font and the size for the subsequent text writing. - - @param bf the font - @param size the font size in points - - - Sets the text rendering parameter. - - @param rendering a parameter - - - Sets the text rise parameter. -

    - This allows to write text in subscript or basescript mode.

    - - @param rise a parameter -
    - - Sets the text rise parameter. -

    - This allows to write text in subscript or basescript mode.

    - - @param rise a parameter -
    - - A helper to insert into the content stream the text - converted to bytes according to the font's encoding. - - @param text the text to write - - - Shows the text. - - @param text the text to write - - - Constructs a kern array for a text in a certain font - @param text the text - @param font the font - @return a PdfTextArray - - - Shows the text kerned. - - @param text the text to write - - - Moves to the next line and shows text. - - @param text the text to write - - - Moves to the next line and shows text string, using the given values of the character and word spacing parameters. - - @param wordSpacing a parameter - @param charSpacing a parameter - @param text the text to write - - - Changes the text matrix. -

    - Remark: this operation also initializes the current point position.

    - - @param a operand 1,1 in the matrix - @param b operand 1,2 in the matrix - @param c operand 2,1 in the matrix - @param d operand 2,2 in the matrix - @param x operand 3,1 in the matrix - @param y operand 3,2 in the matrix -
    - - - Changes the text matrix. The first four parameters are {1,0,0,1}. -

    - Remark: this operation also initializes the current point position.

    - - @param x operand 3,1 in the matrix - @param y operand 3,2 in the matrix -
    - - Moves to the start of the next line, offset from the start of the current line. - - @param x x-coordinate of the new current point - @param y y-coordinate of the new current point - - - Moves to the start of the next line, offset from the start of the current line. -

    - As a side effect, this sets the leading parameter in the text state.

    - - @param x offset of the new current point - @param y y-coordinate of the new current point -
    - - Moves to the start of the next line. - - - Gets the size of this content. - - @return the size of the content - - - Adds a named outline to the document. - - @param outline the outline - @param name the name for the local destination - - - Gets the root outline. - - @return the root outline - - - Computes the width of the given string taking in account - the current values of "Character spacing", "Word Spacing" - and "Horizontal Scaling". - The additional spacing is not computed for the last character - of the string. - @param text the string to get width of - @param kerned the kerning option - @return the width - - - Computes the width of the given string taking in account - the current values of "Character spacing", "Word Spacing" - and "Horizontal Scaling". - The spacing for the last character is also computed. - It also takes into account kerning that can be specified within TJ operator (e.g. [(Hello) 123 (World)] TJ) - @param text the string to get width of - @param kerned the kerning option - @param kerning the kerning option from TJ array - @return the width - - - Shows text right, left or center aligned with rotation. - @param alignment the alignment can be ALIGN_CENTER, ALIGN_RIGHT or ALIGN_LEFT - @param text the text to show - @param x the x pivot position - @param y the y pivot position - @param rotation the rotation to be applied in degrees counterclockwise - - - Shows text kerned right, left or center aligned with rotation. - @param alignment the alignment can be ALIGN_CENTER, ALIGN_RIGHT or ALIGN_LEFT - @param text the text to show - @param x the x pivot position - @param y the y pivot position - @param rotation the rotation to be applied in degrees counterclockwise - - - - - Concatenate a matrix to the current transformation matrix. - @param transform added to the Current Transformation Matrix - - - - - Draws a partial ellipse inscribed within the rectangle x1,y1,x2,y2, - starting at startAng degrees and covering extent degrees. Angles - start with 0 to the right (+x) and increase counter-clockwise. - - @param x1 a corner of the enclosing rectangle - @param y1 a corner of the enclosing rectangle - @param x2 a corner of the enclosing rectangle - @param y2 a corner of the enclosing rectangle - @param startAng starting angle in degrees - @param extent angle extent in degrees - - - Draws a partial ellipse inscribed within the rectangle x1,y1,x2,y2, - starting at startAng degrees and covering extent degrees. Angles - start with 0 to the right (+x) and increase counter-clockwise. - - @param x1 a corner of the enclosing rectangle - @param y1 a corner of the enclosing rectangle - @param x2 a corner of the enclosing rectangle - @param y2 a corner of the enclosing rectangle - @param startAng starting angle in degrees - @param extent angle extent in degrees - - - Draws an ellipse inscribed within the rectangle x1,y1,x2,y2. - - @param x1 a corner of the enclosing rectangle - @param y1 a corner of the enclosing rectangle - @param x2 a corner of the enclosing rectangle - @param y2 a corner of the enclosing rectangle - - - Draws an ellipse inscribed within the rectangle x1,y1,x2,y2. - - @param x1 a corner of the enclosing rectangle - @param y1 a corner of the enclosing rectangle - @param x2 a corner of the enclosing rectangle - @param y2 a corner of the enclosing rectangle - - - Create a new colored tiling pattern. - - @param width the width of the pattern - @param height the height of the pattern - @param xstep the desired horizontal spacing between pattern cells. - May be either positive or negative, but not zero. - @param ystep the desired vertical spacing between pattern cells. - May be either positive or negative, but not zero. - @return the PdfPatternPainter where the pattern will be created - - - Create a new colored tiling pattern. Variables xstep and ystep are set to the same values - of width and height. - @param width the width of the pattern - @param height the height of the pattern - @return the PdfPatternPainter where the pattern will be created - - - Create a new uncolored tiling pattern. - - @param width the width of the pattern - @param height the height of the pattern - @param xstep the desired horizontal spacing between pattern cells. - May be either positive or negative, but not zero. - @param ystep the desired vertical spacing between pattern cells. - May be either positive or negative, but not zero. - @param color the default color. Can be null - @return the PdfPatternPainter where the pattern will be created - - - Create a new uncolored tiling pattern. - Variables xstep and ystep are set to the same values - of width and height. - @param width the width of the pattern - @param height the height of the pattern - @param color the default color. Can be null - @return the PdfPatternPainter where the pattern will be created - - - - Creates a new appearance to be used with form fields. - - @param width the bounding box width - @param height the bounding box height - @return the appearance created - - - Adds a PostScript XObject to this content. - - @param psobject the object - - - Adds a template to this content. - - @param template the template - @param a an element of the transformation matrix - @param b an element of the transformation matrix - @param c an element of the transformation matrix - @param d an element of the transformation matrix - @param e an element of the transformation matrix - @param f an element of the transformation matrix - - - Adds a template to this content. - - @param template the template - @param a an element of the transformation matrix - @param b an element of the transformation matrix - @param c an element of the transformation matrix - @param d an element of the transformation matrix - @param e an element of the transformation matrix - @param f an element of the transformation matrix - - - Adds a template to this content. - - @param template the template - @param a an element of the transformation matrix - @param b an element of the transformation matrix - @param c an element of the transformation matrix - @param d an element of the transformation matrix - @param e an element of the transformation matrix - @param f an element of the transformation matrix - @param tagContent true - template content will be tagged(all that will be added after), false - only a Do operator will be tagged. - taken into account only if isTagged() - true. - - - Adds a template to this content. - - @param template the template - @param a an element of the transformation matrix - @param b an element of the transformation matrix - @param c an element of the transformation matrix - @param d an element of the transformation matrix - @param e an element of the transformation matrix - @param f an element of the transformation matrix - @param tagContent true - template content will be tagged(all that will be added after), false - only a Do operator will be tagged. - taken into account only if isTagged() - true. - - - Adds a template to this content. - - @param template the template - @param a an element of the transformation matrix - @param b an element of the transformation matrix - @param c an element of the transformation matrix - @param d an element of the transformation matrix - @param e an element of the transformation matrix - @param f an element of the transformation matrix - @param tagContent true - template content will be tagged(all that will be added after), false - only a Do operator will be tagged. - taken into account only if isTagged() - true. - - - Adds a form XObject to this content. - - @param formXObj the form XObject - @param name the name of form XObject in content stream. The name is changed, if if it already exists in page resources - @param a an element of the transformation matrix - @param b an element of the transformation matrix - @param c an element of the transformation matrix - @param d an element of the transformation matrix - @param e an element of the transformation matrix - @param f an element of the transformation matrix - - @return Name under which XObject was stored in resources. See name parameter - - - Adds a form XObject to this content. - - @param formXObj the form XObject - @param name the name of form XObject in content stream. The name is changed, if if it already exists in page resources - @param a an element of the transformation matrix - @param b an element of the transformation matrix - @param c an element of the transformation matrix - @param d an element of the transformation matrix - @param e an element of the transformation matrix - @param f an element of the transformation matrix - - @return Name under which XObject was stored in resources. See name parameter - - - adds a template with the given matrix. - @param template template to add - @param transform transform to apply to the template prior to adding it. - - - adds a template with the given matrix. - @param template template to add - @param transform transform to apply to the template prior to adding it. - @param tagContent true - template content will be tagged(all that will be added after), false - only a Do operator will be tagged. - taken into account only if isTagged() - true. - - - Adds a template to this content. - - @param template the template - @param x the x location of this template - @param y the y location of this template - - - Adds a template to this content. - - @param template the template - @param x the x location of this template - @param y the y location of this template - - - Changes the current color for filling paths (device dependent colors!). -

    - Sets the color space to DeviceCMYK (or the DefaultCMYK color space), - and sets the color to use for filling paths.

    -

    - This method is described in the 'Portable Document Format Reference Manual version 1.3' - section 8.5.2.1 (page 331).

    -

    - Following the PDF manual, each operand must be a number between 0 (no ink) and - 1 (maximum ink). This method however accepts only ints between 0x00 and 0xFF.

    - - @param cyan the intensity of cyan - @param magenta the intensity of magenta - @param yellow the intensity of yellow - @param black the intensity of black -
    - - Changes the current color for stroking paths (device dependent colors!). -

    - Sets the color space to DeviceCMYK (or the DefaultCMYK color space), - and sets the color to use for stroking paths.

    -

    - This method is described in the 'Portable Document Format Reference Manual version 1.3' - section 8.5.2.1 (page 331).

    - Following the PDF manual, each operand must be a number between 0 (miniumum intensity) and - 1 (maximum intensity). This method however accepts only ints between 0x00 and 0xFF. - - @param cyan the intensity of red - @param magenta the intensity of green - @param yellow the intensity of blue - @param black the intensity of black -
    - - Changes the current color for filling paths (device dependent colors!). -

    - Sets the color space to DeviceRGB (or the DefaultRGB color space), - and sets the color to use for filling paths.

    -

    - This method is described in the 'Portable Document Format Reference Manual version 1.3' - section 8.5.2.1 (page 331).

    -

    - Following the PDF manual, each operand must be a number between 0 (miniumum intensity) and - 1 (maximum intensity). This method however accepts only ints between 0x00 and 0xFF.

    - - @param red the intensity of red - @param green the intensity of green - @param blue the intensity of blue -
    - - Changes the current color for stroking paths (device dependent colors!). -

    - Sets the color space to DeviceRGB (or the DefaultRGB color space), - and sets the color to use for stroking paths.

    -

    - This method is described in the 'Portable Document Format Reference Manual version 1.3' - section 8.5.2.1 (page 331).

    - Following the PDF manual, each operand must be a number between 0 (miniumum intensity) and - 1 (maximum intensity). This method however accepts only ints between 0x00 and 0xFF. - - @param red the intensity of red - @param green the intensity of green - @param blue the intensity of blue -
    - - Sets the stroke color. color can be an - ExtendedColor. - @param color the color - - - Sets the fill color. color can be an - ExtendedColor. - @param color the color - - - Sets the fill color to a spot color. - @param sp the spot color - @param tint the tint for the spot color. 0 is no color and 1 - is 100% color - - - Sets the stroke color to a spot color. - @param sp the spot color - @param tint the tint for the spot color. 0 is no color and 1 - is 100% color - - - Sets the fill color to a pattern. The pattern can be - colored or uncolored. - @param p the pattern - - - Outputs the color values to the content. - @param color The color - @param tint the tint if it is a spot color, ignored otherwise - - - Sets the fill color to an uncolored pattern. - @param p the pattern - @param color the color of the pattern - - - Sets the fill color to an uncolored pattern. - @param p the pattern - @param color the color of the pattern - @param tint the tint if the color is a spot color, ignored otherwise - - - Sets the stroke color to an uncolored pattern. - @param p the pattern - @param color the color of the pattern - - - Sets the stroke color to an uncolored pattern. - @param p the pattern - @param color the color of the pattern - @param tint the tint if the color is a spot color, ignored otherwise - - - Sets the stroke color to a pattern. The pattern can be - colored or uncolored. - @param p the pattern - - - Paints using a shading object. - @param shading the shading object - - - Paints using a shading pattern. - @param shading the shading pattern - - - Sets the shading fill pattern. - @param shading the shading pattern - - - Sets the shading stroke pattern - @param shading the shading pattern - - - Check if we have a valid PdfWriter. - - - - Show an array of text. - @param text array of text - - - Gets the PdfWriter in use by this object. - @return the PdfWriter in use by this object - - - Gets the PdfDocument in use by this object. - @return the PdfDocument in use by this object - - - Implements a link to other part of the document. The jump will - be made to a local destination with the same name, that must exist. - @param name the name for this link - @param llx the lower left x corner of the activation area - @param lly the lower left y corner of the activation area - @param urx the upper right x corner of the activation area - @param ury the upper right y corner of the activation area - - - The local destination to where a local goto with the same - name will jump. - @param name the name of this local destination - @param destination the PdfDestination with the jump coordinates - @return true if the local destination was added, - false if a local destination with the same name - already exists - - - Gets a duplicate of this PdfContentByte. All - the members are copied by reference but the buffer stays different. - - @return a copy of this PdfContentByte - - - Implements a link to another document. - @param filename the filename for the remote document - @param name the name to jump to - @param llx the lower left x corner of the activation area - @param lly the lower left y corner of the activation area - @param urx the upper right x corner of the activation area - @param ury the upper right y corner of the activation area - - - Implements a link to another document. - @param filename the filename for the remote document - @param page the page to jump to - @param llx the lower left x corner of the activation area - @param lly the lower left y corner of the activation area - @param urx the upper right x corner of the activation area - @param ury the upper right y corner of the activation area - - - Adds a round rectangle to the current path. - - @param x x-coordinate of the starting point - @param y y-coordinate of the starting point - @param w width - @param h height - @param r radius of the arc corner - - - Adds a round rectangle to the current path. - - @param x x-coordinate of the starting point - @param y y-coordinate of the starting point - @param w width - @param h height - @param r radius of the arc corner - - - Implements an action in an area. - @param action the PdfAction - @param llx the lower left x corner of the activation area - @param lly the lower left y corner of the activation area - @param urx the upper right x corner of the activation area - @param ury the upper right y corner of the activation area - - - Outputs a string directly to the content. - @param s the string - - - Outputs a char directly to the content. - @param c the char - - - Outputs a float directly to the content. - @param n the float - - - Throws an error if it is a pattern. - @param t the object to check - - - Draws a TextField. - - - Draws a TextField. - - - Draws a TextField. - - - Draws a TextField. - - - Draws a button. - - - Draws a button. - - - Sets the graphic state - @param gstate the graphic state - - - - Ends a layer controled graphic block. It will end the most recent open block. - - - Sets the default colorspace. - @param name the name of the colorspace. It can be PdfName.DEFAULTGRAY, PdfName.DEFAULTRGB - or PdfName.DEFAULTCMYK - @param obj the colorspace. A null or PdfNull removes any colorspace with the same name - - - Concatenates a transformation to the current transformation - matrix. - @param af the transformation - - - Begins a marked content sequence. This sequence will be tagged with the structure struc. - The same structure can be used several times to connect text that belongs to the same logical segment - but is in a different location, like the same paragraph crossing to another page, for example. - @param struc the tagging structure - - - Begins a marked content sequence. This sequence will be tagged with the structure struc. - The same structure can be used several times to connect text that belongs to the same logical segment - but is in a different location, like the same paragraph crossing to another page, for example. - @param struc the tagging structure - - - Ends a marked content sequence - - - Begins a marked content sequence. If property is null the mark will be of the type - BMC otherwise it will be BDC. - @param tag the tag - @param property the property - @param inline true to include the property in the content or false - to include the property in the resource dictionary with the possibility of reusing - - - This is just a shorthand to beginMarkedContentSequence(tag, null, false). - @param tag the tag - - - Checks for any dangling state: Mismatched save/restore state, begin/end text, - begin/end layer, or begin/end marked content sequence. - If found, this function will throw. This function is called automatically - during a Reset() (from Document.NewPage() for example), and before writing - itself out in ToPdf(). - One possible cause: not calling myPdfGraphics2D.Dispose() will leave dangling - SaveState() calls. - @since 2.1.6 - @throws IllegalPdfSyntaxException (a runtime exception) - - - Parses the page or template content. - @author Paulo Soares - - - Commands have this type. - - - Holds value of property tokeniser. - - - Creates a new instance of PdfContentParser - @param tokeniser the tokeniser with the content - - - Parses a single command from the content. Each command is output as an array of arguments - having the command itself as the last element. The returned array will be empty if the - end of content was reached. - @param ls an ArrayList to use. It will be cleared before using. If it's - null will create a new ArrayList - @return the same ArrayList given as argument or a new one - @throws IOException on error - - - Gets the tokeniser. - @return the tokeniser. - - - Sets the tokeniser. - @param tokeniser the tokeniser - - - Reads a dictionary. The tokeniser must be positioned past the "<<" token. - @return the dictionary - @throws IOException on error - - - Reads an array. The tokeniser must be positioned past the "[" token. - @return an array - @throws IOException on error - - - Reads a pdf object. - @return the pdf object - @throws IOException on error - - - Reads the next token skipping over the comments. - @return true if a token was read, false if the end of content was reached - @throws IOException on error - - - PdfContents is a PdfStream containing the contents (text + graphics) of a PdfPage. - - - Constructs a PdfContents-object, containing text and general graphics. - - @param under the direct content that is under all others - @param content the graphics in a page - @param text the text in a page - @param secondContent the direct content that is over all others - @throws BadPdfFormatException on error - - - Make copies of PDF documents. Documents can be edited after reading and - before writing them out. - @author Mark Thompson - - - This class holds information about indirect references, since they are - renumbered by iText. - - - Holds value of property rotateContents. - - - Constructor - @param document - @param os outputstream - - - Setting page events isn't possible with Pdf(Smart)Copy. - Use the PageStamp class if you want to add content to copied pages. - @see com.itextpdf.text.pdf.PdfWriter#setPageEvent(com.itextpdf.text.pdf.PdfPageEvent) - - - Checks if the content is automatically adjusted to compensate - the original page rotation. - @return the auto-rotation status - Flags the content to be automatically adjusted to compensate - the original page rotation. The default is true. - @param rotateContents true to set auto-rotation, false - otherwise - - - Grabs a page from the input document - @param reader the reader of the document - @param pageNumber which page to get - @return the page - - - Translate a PRIndirectReference to a PdfIndirectReference - In addition, translates the object numbers, and copies the - referenced object to the output file. - NB: PRIndirectReferences (and PRIndirectObjects) really need to know what - file they came from, because each file has its own namespace. The translation - we do from their namespace to ours is *at best* heuristic, and guaranteed to - fail under some circumstances. - - - Translate a PRIndirectReference to a PdfIndirectReference - In addition, translates the object numbers, and copies the - referenced object to the output file. - NB: PRIndirectReferences (and PRIndirectObjects) really need to know what - file they came from, because each file has its own namespace. The translation - we do from their namespace to ours is *at best* heuristic, and guaranteed to - fail under some circumstances. - - - Translate a PRDictionary to a PdfDictionary. Also translate all of the - objects contained in it. - - - Translate a PRDictionary to a PdfDictionary. Also translate all of the - objects contained in it. - - - Translate a PRStream to a PdfStream. The data part copies itself. - - - Translate a PRArray to a PdfArray. Also translate all of the objects contained - in it - - - Translate a PRArray to a PdfArray. Also translate all of the objects contained - in it - - - Translate a PR-object to a Pdf-object - - - Translate a PR-object to a Pdf-object - - - convenience method. Given an importedpage, set our "globals" - - - convenience method. Given a reader, set our "globals" - - - Add an imported page to our output - @param iPage an imported page - @throws IOException, BadPdfFormatException - - - Adds a blank page. - @param rect The page dimension - @param rotation The rotation angle in degrees - @since 2.1.5 - @throws DocumentException - - - Copy document fields to a destination document. - @param reader a document where fields are copied from. - @throws DocumentException - @throws IOException - - - - - Creates a new instance of StampContent - - - Gets a duplicate of this PdfContentByte. All - the members are copied by reference but the buffer stays different. - - @return a copy of this PdfContentByte - - - Concatenates PDF documents including form fields. The rules for the form field - concatenation are the same as in Acrobat. All the documents are kept in memory unlike - PdfCopy. - @author Paulo Soares - - - Creates a new instance. - @param os the output stream - @throws DocumentException on error - @throws IOException on error - - - Creates a new instance. - @param os the output stream - @param pdfVersion the pdf version the output will have - @throws DocumentException on error - @throws IOException on error - - - Concatenates a PDF document. - @param reader the PDF document - @throws DocumentException on error - - - Concatenates a PDF document selecting the pages to keep. The pages are described as a - List of Integer. The page ordering can be changed but - no page repetitions are allowed. - @param reader the PDF document - @param pagesToKeep the pages to keep - @throws DocumentException on error - - - Concatenates a PDF document selecting the pages to keep. The pages are described as - ranges. The page ordering can be changed but - no page repetitions are allowed. - @param reader the PDF document - @param ranges the comma separated ranges as described in {@link SequenceList} - @throws DocumentException on error - - - Sets the encryption options for this document. The userPassword and the - ownerPassword can be null or have zero length. In this case the ownerPassword - is replaced by a random string. The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - @param userPassword the user password. Can be null or empty - @param ownerPassword the owner password. Can be null or empty - @param permissions the user permissions - @param strength128Bits true for 128 bit key length, false for 40 bit key length - @throws DocumentException if the document is already open - - - Sets the encryption options for this document. The userPassword and the - ownerPassword can be null or have zero length. In this case the ownerPassword - is replaced by a random string. The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - @param strength true for 128 bit key length. false for 40 bit key length - @param userPassword the user password. Can be null or empty - @param ownerPassword the owner password. Can be null or empty - @param permissions the user permissions - @throws DocumentException if the document is already open - - - Closes the output document. - - - Opens the document. This is usually not needed as AddDocument() will do it - automatically. - - - Adds JavaScript to the global document - @param js the JavaScript - - - Sets the bookmarks. The list structure is defined in - {@link SimpleBookmark}. - @param outlines the bookmarks or null to remove any - - - Gets the underlying PdfWriter. - @return the underlying PdfWriter - - - Gets the 1.5 compression status. - @return true if the 1.5 compression is on - - - Sets the document's compression to the new 1.5 mode with object streams and xref - streams. It can be set at any time but once set it can't be unset. - - - @see com.lowagie.text.pdf.interfaces.PdfEncryptionSettings#setEncryption(byte[], byte[], int, int) - - - @see com.lowagie.text.pdf.interfaces.PdfViewerPreferences#addViewerPreference(com.lowagie.text.pdf.PdfName, com.lowagie.text.pdf.PdfObject) - - - @see com.lowagie.text.pdf.interfaces.PdfViewerPreferences#setViewerPreferences(int) - - - @see com.lowagie.text.pdf.interfaces.PdfEncryptionSettings#setEncryption(java.security.cert.Certificate[], int[], int) - - - - @author psoares - - - Sets a reference to "visited" in the copy process. - @param ref the reference that needs to be set to "visited" - @return true if the reference was set to visited - - - Checks if a reference has already been "visited" in the copy process. - @param ref the reference that needs to be checked - @return true if the reference was already visited - - - Checks if a reference refers to a page object. - @param ref the reference that needs to be checked - @return true is the reference refers to a page object. - - - Allows you to add one (or more) existing PDF document(s) to - create a new PDF and add the form of another PDF document to - this new PDF. - @since 2.1.5 - @deprecated since 5.5.2 - - - The class with the actual implementations. - - - Creates a new instance. - @param os the output stream - @throws DocumentException on error - - - Concatenates a PDF document. - @param reader the PDF document - @throws DocumentException on error - - - Concatenates a PDF document selecting the pages to keep. The pages are described as a - List of Integer. The page ordering can be changed but - no page repetitions are allowed. - @param reader the PDF document - @param pagesToKeep the pages to keep - @throws DocumentException on error - - - Concatenates a PDF document selecting the pages to keep. The pages are described as - ranges. The page ordering can be changed but - no page repetitions are allowed. - @param reader the PDF document - @param ranges the comma separated ranges as described in {@link SequenceList} - @throws DocumentException on error - - - Copies the form fields of this PDFDocument onto the PDF-Document which was added - @param reader the PDF document - @throws DocumentException on error - - - Sets the encryption options for this document. The userPassword and the - ownerPassword can be null or have zero length. In this case the ownerPassword - is replaced by a random string. The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - @param userPassword the user password. Can be null or empty - @param ownerPassword the owner password. Can be null or empty - @param permissions the user permissions - @param strength128Bits true for 128 bit key length, false for 40 bit key length - @throws DocumentException if the document is already open - - - Sets the encryption options for this document. The userPassword and the - ownerPassword can be null or have zero length. In this case the ownerPassword - is replaced by a random string. The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - @param strength true for 128 bit key length. false for 40 bit key length - @param userPassword the user password. Can be null or empty - @param ownerPassword the owner password. Can be null or empty - @param permissions the user permissions - @throws DocumentException if the document is already open - - - Closes the output document. - - - Opens the document. This is usually not needed as addDocument() will do it - automatically. - - - Adds JavaScript to the global document - @param js the JavaScript - - - Sets the bookmarks. The list structure is defined in - SimpleBookmark#. - @param outlines the bookmarks or null to remove any - - - Gets the underlying PdfWriter. - @return the underlying PdfWriter - - - Gets the 1.5 compression status. - @return true if the 1.5 compression is on - - - - @see com.lowagie.text.pdf.interfaces.PdfEncryptionSettings#setEncryption(byte[], byte[], int, int) - - - @see com.lowagie.text.pdf.interfaces.PdfViewerPreferences#addViewerPreference(com.lowagie.text.pdf.PdfName, com.lowagie.text.pdf.PdfObject) - - - @see com.lowagie.text.pdf.interfaces.PdfViewerPreferences#setViewerPreferences(int) - - - @see com.lowagie.text.pdf.interfaces.PdfEncryptionSettings#setEncryption(java.security.cert.Certificate[], int[], int) - - - Allows you to add one (or more) existing PDF document(s) - and add the form(s) of (an)other PDF document(s). - @since 2.1.5 - @deprecated since 5.5.2 - - - This sets up the output document - @param os The Outputstream pointing to the output document - @throws DocumentException - - - This method feeds in the source document - @param reader The PDF reader containing the source document - @throws DocumentException - - - This merge fields is slightly different from the mergeFields method - of PdfCopyFields. - - - A PdfDashPattern defines a dash pattern as described in - the PDF Reference Manual version 1.3 p 325 (section 8.4.3). - - @see PdfArray - - - This is the length of a dash. - - - This is the length of a gap. - - - This is the phase. - - - Constructs a new PdfDashPattern. - - - Constructs a new PdfDashPattern. - - - Constructs a new PdfDashPattern. - - - Constructs a new PdfDashPattern. - - - Returns the PDF representation of this PdfArray. - - @return an array of bytes - - - - Constructs a PdfDate-object. - - @param d the date that has to be turned into a PdfDate-object - - - Constructs a PdfDate-object, representing the current day and time. - - - Adds a number of leading zeros to a given string in order to get a string - of a certain length. - - @param i a given number - @param length the length of the resulting string - @return the resulting string - - - Gives the W3C format of the PdfDate. - @return a formatted date - - - Gives the W3C format of the PdfDate. - @param d the date in the format D:YYYYMMDDHHmmSSOHH'mm' - @return a formatted date - - - A PdfColor defines a Color (it's a PdfArray containing 3 values). - - @see PdfDictionary - - - This is a possible destination type - - - This is a possible destination type - - - This is a possible destination type - - - This is a possible destination type - - - This is a possible destination type - - - This is a possible destination type - - - This is a possible destination type - - - This is a possible destination type - - - Is the indirect reference to a page already added? - - - - - - - Creates a PdfDestination based on a String. - Valid Strings are for instance the values returned by SimpleNamedDestination: - "Fit", "XYZ 36 806 0",... - @param dest a String notation of a destination. - @since iText 5.0 - - - Checks if an indirect reference to a page has been added. - - @return true or false - - - Adds the indirect reference of the destination page. - - @param page an indirect reference - @return true if the page reference was added - - - Beginning with BaseVersion 1.7, the extensions dictionary lets developers - designate that a given document contains extensions to PDF. The presence - of the extension dictionary in a document indicates that it may contain - developer-specific PDF properties that extend a particular base version - of the PDF specification. - The extensions dictionary enables developers to identify their own extensions - relative to a base version of PDF. Additionally, the convention identifies - extension levels relative to that base version. The intent of this dictionary - is to enable developers of PDF-producing applications to identify company-specific - specifications (such as this one) that PDF-consuming applications use to - interpret the extensions. - @since 2.1.6 - - - An instance of this class for Adobe 1.7 Extension level 3. - - - An instance of this class for ETSI 1.7 Extension level 2. - - - An instance of this class for ETSI 1.7 Extension level 5. - - - The prefix used in the Extensions dictionary added to the Catalog. - - - The base version. - - - The extension level within the baseversion. - - - Creates a PdfDeveloperExtension object. - @param prefix the prefix referring to the developer - @param baseversion the number of the base version - @param extensionLevel the extension level within the baseverion. - - - Gets the prefix name. - @return a PdfName - - - Gets the baseversion name. - @return a PdfName - - - Gets the extension level within the baseversion. - @return an integer - - - Generations the developer extension dictionary corresponding - with the prefix. - @return a PdfDictionary - - - - This is a possible type of dictionary - - - This is a possible type of dictionary - - - This is a possible type of dictionary - - - This is a possible type of dictionary - - - This is a possible type of dictionary - - - This is the type of this dictionary - - - This is the hashmap that contains all the values and keys of the dictionary - - - Constructs an empty PdfDictionary-object. - - - Constructs a PdfDictionary-object of a certain type. - - @param type a PdfName - - - Returns the PDF representation of this PdfDictionary. - - @return an array of byte - - - Adds a PdfObject and its key to the PdfDictionary. - If the value is null or PdfNull the key is deleted. - - @param key key of the entry (a PdfName) - @param value value of the entry (a PdfObject) - - - Adds a PdfObject and its key to the PdfDictionary. - If the value is null it does nothing. - - @param key key of the entry (a PdfName) - @param value value of the entry (a PdfObject) - - - Copies all of the mappings from the specified PdfDictionary - to this PdfDictionary. - - These mappings will replace any mappings previously contained in this - PdfDictionary. - - @param dic The PdfDictionary with the mappings to be - copied over - - - Removes a PdfObject and its key from the PdfDictionary. - - @param key key of the entry (a PdfName) - - - Removes all the PdfObjects and its keys from the - PdfDictionary. - @since 5.0.2 - - - - Checks if a Dictionary is of the type FONT. - - @return true if it is, false if it isn't. - - - Checks if a Dictionary is of the type PAGE. - - @return true if it is, false if it isn't. - - - Checks if a Dictionary is of the type PAGES. - - @return true if it is, false if it isn't. - - - Checks if a Dictionary is of the type CATALOG. - - @return true if it is, false if it isn't. - - - Checks if a Dictionary is of the type OUTLINES. - - @return true if it is, false if it isn't. - - - Checks the type of the dictionary. - @param type the type you're looking for - @return true if the type of the dictionary corresponds with the type you're looking for - - - This function behaves the same as 'get', but will never return an indirect reference, - it will always look such references up and return the actual object. - @param key - @return null, or a non-indirect object - - - All the getAs functions will return either null, or the specified object type - This function will automatically look up indirect references. There's one obvious - exception, the one that will only return an indirect reference. All direct objects - come back as a null. - Mark A Storer (2/17/06) - @param key - @return the appropriate object in its final type, or null - - - - - Construct a PdfInfo-object. - - - Constructs a PdfInfo-object. - - @param author name of the author of the document - @param title title of the document - @param subject subject of the document - - - Adds the title of the document. - - @param title the title of the document - - - Adds the subject to the document. - - @param subject the subject of the document - - - Adds some keywords to the document. - - @param keywords the keywords of the document - - - Adds the name of the author to the document. - - @param author the name of the author - - - Adds the name of the creator to the document. - - @param creator the name of the creator - - - Adds the name of the producer to the document. - - - Adds the date of creation to the document. - - - - Constructs a PdfCatalog. - - @param pages an indirect reference to the root of the document's Pages tree. - @param writer the writer the catalog applies to - - - Adds the names of the named destinations to the catalog. - @param localDestinations the local destinations - @param documentJavaScript the javascript used in the document - @param writer the writer the catalog applies to - - - Sets the document level additional actions. - @param actions dictionary of actions - - - Constructs a new PDF document. - @throws DocumentException on error - - - The PdfWriter. - - - Adds a PdfWriter to the PdfDocument. - - @param writer the PdfWriter that writes everything - what is added to this document to an outputstream. - @throws DocumentException on error - - - This is the PdfContentByte object, containing the text. - - - This is the PdfContentByte object, containing the borders and other Graphics. - - - This represents the leading of the lines. - - - Getter for the current leading. - @return the current leading - @since 2.1.2 - - - This is the current height of the document. - - - Signals that onParagraph is valid (to avoid that a Chapter/Section title is treated as a Paragraph). - @since 2.1.2 - - - This represents the current alignment of the PDF Elements. - - - The current active PdfAction when processing an Anchor. - - - The current tab settings. - @return the current - @since 5.4.0 - - - Signals that the current leading has to be subtracted from a YMark object when positive - and save current leading - @since 2.1.2 - - - Save current @leading - - - Restore @leading from leadingStack - - - Getter and setter for the current tab stops. - @since 5.4.0 - - - Signals that an Element was added to the Document. - - @param element the element to add - @return true if the element was added, false if not. - @throws DocumentException when a document isn't open yet, or has been closed - - - - - Use this method to set the XMP Metadata. - @param xmpMetadata The xmpMetadata to set. - @throws IOException - - - Makes a new page and sends it to the PdfWriter. - - @return true if new page was added - @throws DocumentException on error - - - Sets the pagesize. - - @param pageSize the new pagesize - @return true if the page size was set - - - margin in x direction starting from the left. Will be valid in the next page - - - margin in x direction starting from the right. Will be valid in the next page - - - margin in y direction starting from the top. Will be valid in the next page - - - margin in y direction starting from the bottom. Will be valid in the next page - - - Sets the margins. - - @param marginLeft the margin on the left - @param marginRight the margin on the right - @param marginTop the margin on the top - @param marginBottom the margin on the bottom - @return a bool - - - @see com.lowagie.text.DocListener#setMarginMirroring(bool) - - - @see com.lowagie.text.DocListener#setMarginMirroring(boolean) - @since 2.1.6 - - - Sets the page number. - - @param pageN the new page number - - - Sets the page number to 0. - - - Signals that OnOpenDocument should be called. - - - - The line that is currently being written. - - - The lines that are written until now. - - - Adds the current line to the list of lines and also adds an empty line. - @throws DocumentException on error - - - line.height() is usually the same as the leading - We should take leading into account if it is not the same as the line.height - - @return float combined height of the line - @since 5.5.1 - - - If the current line is not empty or null, it is added to the arraylist - of lines and a new empty line is added. - @throws DocumentException on error - - - Gets the current vertical page position. - @param ensureNewLine Tells whether a new line shall be enforced. This may cause side effects - for elements that do not terminate the lines they've started because those lines will get - terminated. - @return The current vertical page position. - - - Holds the type of the last element, that has been added to the document. - - - Ensures that a new line has been started. - - - Writes all the lines to the text-object. - - @return the displacement that was caused - @throws DocumentException on error - - - The characters to be applied the hanging punctuation. - - - - This represents the current indentation of the PDF Elements on the left side. - - - Indentation to the left caused by a section. - - - This represents the current indentation of the PDF Elements on the left side. - - - This is the indentation caused by an image on the left. - - - This represents the current indentation of the PDF Elements on the right side. - - - Indentation to the right caused by a section. - - - This is the indentation caused by an image on the right. - - - This represents the current indentation of the PDF Elements on the top side. - - - This represents the current indentation of the PDF Elements on the bottom side. - - - Gets the indentation on the left side. - - @return a margin - - - Gets the indentation on the right side. - - @return a margin - - - Gets the indentation on the top side. - - @return a margin - - - Gets the indentation on the bottom side. - - @return a margin - - - Calls addSpacing(float, float, Font, boolean (false)). - - - Adds extra space. - - - some meta information about the Document. - - - - Gets the PdfCatalog-object. - - @param pages an indirect reference to this document pages - @return PdfCatalog - - - This is the root outline of the document. - - - This is the current PdfOutline in the hierarchy of outlines. - - - Adds a named outline to the document . - @param outline the outline to be added - @param name the name of this local destination - - - Gets the root outline. All the outlines must be created with a parent. - The first level is created with this outline. - @return the root outline - - - Contains the Viewer preferences of this PDF document. - - - @see com.lowagie.text.pdf.interfaces.PdfViewerPreferences#setViewerPreferences(int) - - - @see com.lowagie.text.pdf.interfaces.PdfViewerPreferences#addViewerPreference(com.lowagie.text.pdf.PdfName, com.lowagie.text.pdf.PdfObject) - - - Implements a link to other part of the document. The jump will - be made to a local destination with the same name, that must exist. - @param name the name for this link - @param llx the lower left x corner of the activation area - @param lly the lower left y corner of the activation area - @param urx the upper right x corner of the activation area - @param ury the upper right y corner of the activation area - - - Implements a link to another document. - @param filename the filename for the remote document - @param name the name to jump to - @param llx the lower left x corner of the activation area - @param lly the lower left y corner of the activation area - @param urx the upper right x corner of the activation area - @param ury the upper right y corner of the activation area - - - Implements a link to another document. - @param filename the filename for the remote document - @param page the page to jump to - @param llx the lower left x corner of the activation area - @param lly the lower left y corner of the activation area - @param urx the upper right x corner of the activation area - @param ury the upper right y corner of the activation area - - - Implements an action in an area. - @param action the PdfAction - @param llx the lower left x corner of the activation area - @param lly the lower left y corner of the activation area - @param urx the upper right x corner of the activation area - @param ury the upper right y corner of the activation area - - - Stores the destinations keyed by name. Value is - Object[]{PdfAction,PdfIndirectReference,PdfDestintion}. - - - The local destination to where a local goto with the same - name will jump to. - @param name the name of this local destination - @param destination the PdfDestination with the jump coordinates - @return true if the local destination was added, - false if a local destination with the same name - already existed - - - Stores a list of document level JavaScript actions. - - - Sets the collection dictionary. - @param collection a dictionary of type PdfCollection - - - Gets the AcroForm object. - @return the PdfAcroform object of the PdfDocument - - - This is the size of the next page. - - - This is the size of the several boxes of the current Page. - - - This is the size of the several boxes that will be used in - the next page. - - - Gives the size of a trim, art, crop or bleed box, or null if not defined. - @param boxName crop, trim, art or bleed - - - This checks if the page is empty. - - - Sets the display duration for the page (for presentations) - @param seconds the number of seconds to display the page - - - Sets the transition for the page - @param transition the PdfTransition object - - - This are the page resources of the current Page. - - - Holds value of property strictImageSequence. - - - Setter for property strictImageSequence. - @param strictImageSequence New value of property strictImageSequence. - - - - This is the position where the image ends. - - - Method added by Pelikan Stephan - @see com.lowagie.text.DocListener#clearTextWrap() - - - This is the image that could not be shown on a previous page. - - - Adds an image to the document. - @param image the Image to add - @throws PdfException on error - @throws DocumentException on error - - - Adds a PdfPTable to the document. - @param ptable the PdfPTable to be added to the document. - @throws DocumentException on error - - - @since 5.0.1 - - - Extends PdfStream and should be used to create Streams for Embedded Files - (file attachments). - @since 2.1.3 - - - Creates a Stream object using an InputStream and a PdfWriter object - @param in the InputStream that will be read to get the Stream object - @param writer the writer to which the stream will be added - - - Creates a Stream object using a byte array - @param fileStore the bytes for the stream - - - @see com.lowagie.text.pdf.PdfDictionary#toPdf(com.lowagie.text.pdf.PdfWriter, java.io.OutputStream) - - - Supports fast encodings for winansi and PDFDocEncoding. - - @author Paulo Soares - - - - - Checks is text only has PdfDocEncoding characters. - @param text the String to test - @return true if only PdfDocEncoding characters are present - - - Adds an extra encoding. - @param name the name of the encoding. The encoding recognition is case insensitive - @param enc the conversion class - - - - @author Paulo Soares - - - The encryption key for a particular object/generation - - - The encryption key length for a particular object/generation - - - The global encryption key - - - Work area to prepare the object/generation bytes - - - The message digest algorithm MD5 - - - The encryption key for the owner - - - The encryption key for the user - - - The public key security handler for certificate encryption - - - The generic key length. It may be 40 or 128. - - - Indicates if the encryption is only necessary for embedded files. - @since 2.1.3 - - - Indicates if only the embedded files have to be encrypted. - @return if true only the embedded files will be encrypted - @since 2.1.3 - - - - - - ownerKey, documentID must be setuped - - - - mkey must be setuped - - - - - - - Computes user password if standard encryption handler is used with Standard40, Standard128 or AES128 algorithm (Revision 2 - 4). - - @param ownerPassword owner password of the encrypted document. - @return user password, or null if revision 5 (AES256) or greater of standard encryption handler was used. - - - This class takes any PDF and returns exactly the same but - encrypted. All the content, links, outlines, etc, are kept. - It is also possible to change the info dictionary. - - - Entry point to encrypt a PDF document. The encryption parameters are the same as in - PdfWriter. The userPassword and the - ownerPassword can be null or have zero length. In this case the ownerPassword - is replaced by a random string. The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - @param reader the read PDF - @param os the output destination - @param userPassword the user password. Can be null or empty - @param ownerPassword the owner password. Can be null or empty - @param permissions the user permissions - @param strength128Bits true for 128 bit key length, false for 40 bit key length - @throws DocumentException on error - @throws IOException on error - - - Entry point to encrypt a PDF document. The encryption parameters are the same as in - PdfWriter. The userPassword and the - ownerPassword can be null or have zero length. In this case the ownerPassword - is replaced by a random string. The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - @param reader the read PDF - @param os the output destination - @param userPassword the user password. Can be null or empty - @param ownerPassword the owner password. Can be null or empty - @param permissions the user permissions - @param strength128Bits true for 128 bit key length, false for 40 bit key length - @param newInfo an optional String map to add or change - the info dictionary. Entries with null - values delete the key in the original info dictionary - @throws DocumentException on error - @throws IOException on error - - - Entry point to encrypt a PDF document. The encryption parameters are the same as in - PdfWriter. The userPassword and the - ownerPassword can be null or have zero length. In this case the ownerPassword - is replaced by a random string. The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - @param reader the read PDF - @param os the output destination - @param strength true for 128 bit key length, false for 40 bit key length - @param userPassword the user password. Can be null or empty - @param ownerPassword the owner password. Can be null or empty - @param permissions the user permissions - @throws DocumentException on error - @throws IOException on error - - - Entry point to encrypt a PDF document. The encryption parameters are the same as in - PdfWriter. The userPassword and the - ownerPassword can be null or have zero length. In this case the ownerPassword - is replaced by a random string. The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - @param reader the read PDF - @param os the output destination - @param strength true for 128 bit key length, false for 40 bit key length - @param userPassword the user password. Can be null or empty - @param ownerPassword the owner password. Can be null or empty - @param permissions the user permissions - @param newInfo an optional String map to add or change - the info dictionary. Entries with null - values delete the key in the original info dictionary - @throws DocumentException on error - @throws IOException on error - - - Entry point to encrypt a PDF document. The encryption parameters are the same as in - PdfWriter. The userPassword and the - ownerPassword can be null or have zero length. In this case the ownerPassword - is replaced by a random string. The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - @param reader the read PDF - @param os the output destination - @param type the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128. - Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext - @param userPassword the user password. Can be null or empty - @param ownerPassword the owner password. Can be null or empty - @param permissions the user permissions - @param newInfo an optional String map to add or change - the info dictionary. Entries with null - values delete the key in the original info dictionary - @throws DocumentException on error - @throws IOException on error - - - Entry point to encrypt a PDF document. The encryption parameters are the same as in - PdfWriter. The userPassword and the - ownerPassword can be null or have zero length. In this case the ownerPassword - is replaced by a random string. The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - @param reader the read PDF - @param os the output destination - @param type the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128. - Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext - @param userPassword the user password. Can be null or empty - @param ownerPassword the owner password. Can be null or empty - @param permissions the user permissions - values delete the key in the original info dictionary - @throws DocumentException on error - @throws IOException on error - - - Give you a verbose analysis of the permissions. - @param permissions the permissions value of a PDF file - @return a String that explains the meaning of the permissions value - - - Tells you if printing is allowed. - @param permissions the permissions value of a PDF file - @return true if printing is allowed - - @since 2.0.7 - - - Tells you if modifying content is allowed. - @param permissions the permissions value of a PDF file - @return true if modifying content is allowed - - @since 2.0.7 - - - Tells you if copying is allowed. - @param permissions the permissions value of a PDF file - @return true if copying is allowed - - @since 2.0.7 - - - Tells you if modifying annotations is allowed. - @param permissions the permissions value of a PDF file - @return true if modifying annotations is allowed - - @since 2.0.7 - - - Tells you if filling in fields is allowed. - @param permissions the permissions value of a PDF file - @return true if filling in fields is allowed - - @since 2.0.7 - - - Tells you if repurposing for screenreaders is allowed. - @param permissions the permissions value of a PDF file - @return true if repurposing for screenreaders is allowed - - @since 2.0.7 - - - Tells you if document assembly is allowed. - @param permissions the permissions value of a PDF file - @return true if document assembly is allowed - - @since 2.0.7 - - - Tells you if degraded printing is allowed. - @param permissions the permissions value of a PDF file - @return true if degraded printing is allowed - - @since 2.0.7 - - - Signals that an unspecified problem while constructing a PDF document. - - @see BadPdfFormatException - - - Specifies a file or an URL. The file can be extern or embedded. - - @author Paulo Soares - - - Creates a new instance of PdfFileSpecification. The static methods are preferred. - - - Creates a file specification of type URL. - @param writer the PdfWriter - @param url the URL - @return the file specification - - - Creates a file specification with the file embedded. The file may - come from the file system or from a byte array. The data is flate compressed. - @param writer the PdfWriter - @param filePath the file path - @param fileDisplay the file information that is presented to the user - @param fileStore the byte array with the file. If it is not null - it takes precedence over filePath - @throws IOException on error - @return the file specification - - - Creates a file specification with the file embedded. The file may - come from the file system or from a byte array. The data is flate compressed. - @param writer the PdfWriter - @param filePath the file path - @param fileDisplay the file information that is presented to the user - @param fileStore the byte array with the file. If it is not null - it takes precedence over filePath - @param compressionLevel the compression level to be used for compressing the file - it takes precedence over filePath - @throws IOException on error - @return the file specification - @since 2.1.3 - - - Creates a file specification with the file embedded. The file may - come from the file system or from a byte array. - @param writer the PdfWriter - @param filePath the file path - @param fileDisplay the file information that is presented to the user - @param fileStore the byte array with the file. If it is not null - it takes precedence over filePath - @param compress sets the compression on the data. Multimedia content will benefit little - from compression - @throws IOException on error - @return the file specification - - - Creates a file specification with the file embedded. The file may - come from the file system or from a byte array. - @param writer the PdfWriter - @param filePath the file path - @param fileDisplay the file information that is presented to the user - @param fileStore the byte array with the file. If it is not null - it takes precedence over filePath - @param compress sets the compression on the data. Multimedia content will benefit little - from compression - @param mimeType the optional mimeType - @param fileParameter the optional extra file parameters such as the creation or modification date - @throws IOException on error - @return the file specification - - - Creates a file specification with the file embedded. The file may - come from the file system or from a byte array. - @param writer the PdfWriter - @param filePath the file path - @param fileDisplay the file information that is presented to the user - @param fileStore the byte array with the file. If it is not null - it takes precedence over filePath - @param mimeType the optional mimeType - @param fileParameter the optional extra file parameters such as the creation or modification date - @param compressionLevel the level of compression - @throws IOException on error - @return the file specification - @since 2.1.3 - - - Creates a file specification for an external file. - @param writer the PdfWriter - @param filePath the file path - @return the file specification - - - Gets the indirect reference to this file specification. - Multiple invocations will retrieve the same value. - @throws IOException on error - @return the indirect reference - - - Sets the file name (the key /F) string as an hex representation - to support multi byte file names. The name must have the slash and - backslash escaped according to the file specification rules - @param fileName the file name as a byte array - - - Adds the unicode file name (the key /UF). This entry was introduced - in PDF 1.7. The filename must have the slash and backslash escaped - according to the file specification rules. - @param filename the filename - @param unicode if true, the filename is UTF-16BE encoded; otherwise PDFDocEncoding is used; - - - Sets a flag that indicates whether an external file referenced by the file - specification is volatile. If the value is true, applications should never - cache a copy of the file. - @param volatile_file if true, the external file should not be cached - - - Adds a description for the file that is specified here. - @param description some text - @param unicode if true, the text is added as a unicode string - - - Adds the Collection item dictionary. - - - - the font metrics. - - - the size. - - - Compares this PdfFont with another - - @param object the other PdfFont - @return a value - - - Returns the size of this font. - - @return a size - - - Returns the approximative width of 1 character of this font. - - @return a width in Text Space - - - Returns the width of a certain character of this font. - - @param character a certain character - @return a width in Text Space - - - Implements form fields. - - @author Paulo Soares - - - Allows text fields to support rich text. - @since 5.0.6 - - - Holds value of property parent. - - - Constructs a new PdfAnnotation of subtype link (Action). - - - Creates new PdfFormField - - - Getter for property parent. - @return Value of property parent. - - - Sets the rich value for this field. - It is suggested that the regular value of this field be set to an - equivalent value. Rich text values are only supported since PDF 1.5, - and require that the FF_RV flag be set. See PDF Reference chapter - 12.7.3.4 for details. - @param rv HTML markup for the rich value of this field - @since 5.0.6 - - - PdfFormObject is a type of XObject containing a template-object. - - - This is a PdfNumber representing 0. - - - This is a PdfNumber representing 1. - - - This is the 1 - matrix. - - - Constructs a PdfFormXObject-object. - - @param template the template - @param compressionLevel the compression level for the stream - @since 2.1.3 (Replacing the existing constructor with param compressionLevel) - - - Implements PDF functions. - - @author Paulo Soares - - - Creates new PdfFunction - - - The graphic state dictionary. - - @author Paulo Soares - - - A possible blend mode - - - A possible blend mode - - - A possible blend mode - - - A possible blend mode - - - A possible blend mode - - - A possible blend mode - - - A possible blend mode - - - A possible blend mode - - - A possible blend mode - - - A possible blend mode - - - A possible blend mode - - - A possible blend mode - - - A possible blend mode - - - Sets the flag whether to apply overprint for stroking. - @param ov - - - Sets the flag whether to apply overprint for non stroking painting operations. - @param ov - - - Sets the flag whether to toggle knockout behavior for overprinted objects. - @param ov - accepts 0 or 1 - - - Sets the current stroking alpha constant, specifying the constant shape or - constant opacity value to be used for stroking operations in the transparent - imaging model. - @param n - - - Sets the current stroking alpha constant, specifying the constant shape or - constant opacity value to be used for nonstroking operations in the transparent - imaging model. - @param n - - - The alpha source flag specifying whether the current soft mask - and alpha constant are to be interpreted as shape values (true) - or opacity values (false). - @param v - - - Determines the behaviour of overlapping glyphs within a text object - in the transparent imaging model. - @param v - - - The current blend mode to be used in the transparent imaging model. - @param bm - - - Set the rendering intent, possible values are: PdfName.ABSOLUTECOLORIMETRIC, - PdfName.RELATIVECOLORIMETRIC, PdfName.SATURATION, PdfName.PERCEPTUAL. - @param ri - - - A PdfICCBased defines a ColorSpace - - @see PdfStream - - - Creates an ICC stream. - @param profile an ICC profile - - - Creates an ICC stream. - - @param compressionLevel the compressionLevel - - @param profile an ICC profile - @since 2.1.3 (replacing the constructor without param compressionLevel) - - - PdfImage is a PdfStream containing an image-Dictionary and -stream. - - - This is the PdfName of the image. - - - Constructs a PdfImage-object. - - @param image the Image-object - @param name the PdfName for this image - @throws BadPdfFormatException on error - - - Returns the PdfName of the image. - - @return the name - - - Called when no resource name is provided in our constructor. This generates a - name that is required to be unique within a given resource dictionary. - @since 5.0.1 - - - Represents an imported page. - - @author Paulo Soares - - - True if the imported page has been copied to a writer. - @since iText 5.0.4 - - - Reads the content from this PdfImportedPage-object from a reader. - - @return self - - - - Always throws an error. This operation is not allowed. - @param image dummy - @param a dummy - @param b dummy - @param c dummy - @param d dummy - @param e dummy - @param f dummy - @throws DocumentException dummy - - - Always throws an error. This operation is not allowed. - @param template dummy - @param a dummy - @param b dummy - @param c dummy - @param d dummy - @param e dummy - @param f dummy - - - Always throws an error. This operation is not allowed. - @return dummy - - - Gets the stream representing this page. - - @param compressionLevel the compressionLevel - @return the stream representing this page - @since 2.1.3 (replacing the method without param compressionLevel) - - - Always throws an error. This operation is not allowed. - @param bf dummy - @param size dummy - - - Checks if the page has to be copied. - @return true if the page has to be copied. - @since iText 5.0.4 - - - Indicate that the resources of the imported page have been copied. - @since iText 5.0.4 - - - - The object number - - - the generation number - - - Constructs a PdfIndirectObject. - - @param number the objecti number - @param objecti the direct objecti - - - Constructs a PdfIndirectObject. - - @param number the objecti number - @param generation the generation number - @param objecti the direct objecti - - - Returns a PdfIndirectReference to this PdfIndirectObject. - - @return a PdfIndirectReference - - - Writes eficiently to a stream - - @param os the stream to write to - @throws IOException on write error - - - - the object number - - - the generation number - - - Constructs a PdfIndirectReference. - - @param type the type of the PdfObject that is referenced to - @param number the object number. - @param generation the generation number. - - - Constructs a PdfIndirectReference. - - @param type the type of the PdfObject that is referenced to - @param number the object number. - - - Returns the number of the object. - - @return a number. - - - Returns the generation of the object. - - @return a number. - - - An optional content group is a dictionary representing a collection of graphics - that can be made visible or invisible dynamically by users of viewer applications. - In iText they are referenced as layers. - - @author Paulo Soares - - - Holds value of property on. - - - Holds value of property onPanel. - - - Creates a title layer. A title layer is not really a layer but a collection of layers - under the same title heading. - @param title the title text - @param writer the PdfWriter - @return the title layer - - - Creates a new layer. - @param name the name of the layer - @param writer the writer - - - Adds a child layer. Nested layers can only have one parent. - @param child the child layer - - - Gets the parent layer. - @return the parent layer or null if the layer has no parent - - - Gets the children layers. - @return the children layers or null if the layer has no children - - - Gets the PdfIndirectReference that represents this layer. - @return the PdfIndirectReference that represents this layer - - - Sets the name of this layer. - @param name the name of this layer - - - Gets the dictionary representing the layer. It just returns this. - @return the dictionary representing the layer - - - Gets the initial visibility of the layer. - @return the initial visibility of the layer - - - Used by the creating application to store application-specific - data associated with this optional content group. - @param creator a text string specifying the application that created the group - @param subtype a string defining the type of content controlled by the group. Suggested - values include but are not limited to Artwork, for graphic-design or publishing - applications, and Technical, for technical designs such as building plans or - schematics - - - Specifies the language of the content controlled by this - optional content group - @param lang a language string which specifies a language and possibly a locale - (for example, es-MX represents Mexican Spanish) - @param preferred used by viewer applications when there is a partial match but no exact - match between the system language and the language strings in all usage dictionaries - - - Specifies the recommended state for content in this - group when the document (or part of it) is saved by a viewer application to a format - that does not support optional content (for example, an earlier version of - PDF or a raster image format). - @param export the export state - - - Specifies a range of magnifications at which the content - in this optional content group is best viewed. - @param min the minimum recommended magnification factors at which the group - should be ON. A negative value will set the default to 0 - @param max the maximum recommended magnification factor at which the group - should be ON. A negative value will set the largest possible magnification supported by the - viewer application - - - Specifies that the content in this group is intended for - use in printing - @param subtype a name specifying the kind of content controlled by the group; - for example, Trapping, PrintersMarks and Watermark - @param printstate indicates that the group should be - set to that state when the document is printed from a viewer application - - - Indicates that the group should be set to that state when the - document is opened in a viewer application. - @param view the view state - - - Indicates that the group contains a pagination artifact. - @param pe one of the following names: "HF" (Header Footer), - "FG" (Foreground), "BG" (Background), or "L" (Logo). - @since 5.0.2 - - - One of more users for whom this optional content group is primarily intended. - @param type should be "Ind" (Individual), "Ttl" (Title), or "Org" (Organization). - @param names one or more names - @since 5.0.2 - - - Gets the layer visibility in Acrobat's layer panel - @return the layer visibility in Acrobat's layer panel - Sets the visibility of the layer in Acrobat's layer panel. If false - the layer cannot be directly manipulated by the user. Note that any children layers will - also be absent from the panel. - @param onPanel the visibility of the layer in Acrobat's layer panel - - - Content typically belongs to a single optional content group, - and is visible when the group is ON and invisible when it is OFF. To express more - complex visibility policies, content should not declare itself to belong to an optional - content group directly, but rather to an optional content membership dictionary - represented by this class. - - @author Paulo Soares - - - Visible only if all of the entries are ON. - - - Visible if any of the entries are ON. - - - Visible if any of the entries are OFF. - - - Visible only if all of the entries are OFF. - - - Creates a new, empty, membership layer. - @param writer the writer - - - Gets the PdfIndirectReference that represents this membership layer. - @return the PdfIndirectReference that represents this layer - - - Adds a new member to the layer. - @param layer the new member to the layer - - - Gets the member layers. - @return the member layers - - - Sets the visibility policy for content belonging to this - membership dictionary. Possible values are ALLON, ANYON, ANYOFF and ALLOFF. - The default value is ANYON. - @param type the visibility policy - - - Sets the visibility expression for content belonging to this - membership dictionary. - @param ve A (nested) array of which the first value is /And, /Or, or /Not - followed by a series of indirect references to OCGs or other visibility - expressions. - @since 5.0.2 - - - Gets the dictionary representing the membership layer. It just returns this. - @return the dictionary representing the layer - - - PdfLine defines an array with PdfChunk-objects - that fit into 1 line. - - - The arraylist containing the chunks. - - - The left indentation of the line. - - - The width of the line. - - - The alignment of the line. - - - The heigth of the line. - - - true if the chunk splitting was caused by a newline. - - - The original width. - - - Constructs a new PdfLine-object. - - @param left the limit of the line at the left - @param right the limit of the line at the right - @param alignment the alignment of the line - @param height the height of the line - - - Creates a PdfLine object. - @param left the left offset - @param originalWidth the original width of the line - @param remainingWidth bigger than 0 if the line isn't completely filled - @param alignment the alignment of the line - @param newlineSplit was the line splitted (or does the paragraph end with this line) - @param line an array of PdfChunk objects - @param isRTL do you have to read the line from Right to Left? - - - Adds a PdfChunk to the PdfLine. - - @param chunk the PdfChunk to add - @param currentLeading new value for the height of the line - @return null if the chunk could be added completely; if not - a PdfChunk containing the part of the chunk that could - not be added is returned - - - Adds a PdfChunk to the PdfLine. - - @param chunk the PdfChunk to add - @return null if the chunk could be added completely; if not - a PdfChunk containing the part of the chunk that could - not be added is returned - - - Returns the number of chunks in the line. - - @return a value - - - Returns an iterator of PdfChunks. - - @return an Iterator - - - Returns the height of the line. - - @return a value - - - Returns the left indentation of the line taking the alignment of the line into account. - - @return a value - - - Checks if this line has to be justified. - - @return true if the alignment equals ALIGN_JUSTIFIED and there is some width left. - - - - Adds extra indentation to the left (for Paragraph.setFirstLineIndent). - - - Returns the width that is left, after a maximum of characters is added to the line. - - @return a value - - - Returns the number of space-characters in this line. - - @return a value - - - - Returns the listsymbol of this line. - - @return a PdfChunk if the line has a listsymbol; null otherwise - - - Return the indentation needed to show the listsymbol. - - @return a value - - - Get the string representation of what is in this line. - - @return a string - - - Checks if a newline caused the line split. - @return true if a newline caused the line split - - - Gets the index of the last PdfChunk with metric attributes - @return the last PdfChunk with metric attributes - - - Gets a PdfChunk by index. - @param idx the index - @return the PdfChunk or null if beyond the array - - - Gets the original width of the line. - @return the original width of the line - - - Gets the difference between the "normal" leading and the maximum - size (for instance when there are images in the chunk and the leading - has to be taken into account). - @return an extra leading for images - @since 2.1.5 - - - Gets the number of separators in the line. - Returns -1 if there's a tab in the line. - @return the number of separators in the line - @since 2.1.2 - - - Gets the maximum size of the ascender for all the fonts used - in this line. - @return maximum size of all the ascenders used in this line - - - Gets the biggest descender for all the fonts used - in this line. Note that this is a negative number. - @return maximum size of all the ascenders used in this line - - - a Literal - - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - @since 2.1.5 renamed from ABSOLUTECALORIMETRIC - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - a name used in PDF structure - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 5.4.5 - - - A name - @since 5.0.3 - - - A name - - - A name - - - A name - - - Use ALT to specify alternate texts in Tagged PDF. - For alternate ICC profiles, use {@link #ALTERNATE} - - - Use ALTERNATE only in ICC profiles. It specifies an alternative color - space, in case the primary one is not supported, for legacy purposes. - For various types of alternate texts in Tagged PDF, use {@link #ALT} - - - A name - @since 5.5.8 - - - A name - @since 5.4.5 - - - A name - @since 5.4.3 - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - @since 5.4.2 - - - A name - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 5.4.2 - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - @since 5.3.5 - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - - - A name - @since 5.4.0 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 5.4.5 - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - @since 5.4.4 - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 2.0.7 - - - A name - - - A name - - - A name - - - A name - @since 5.3.2 - - - A name - @since 5.1.0 - - - A name - @since 2.1.6 - - - A name - - - A name - @since 2.1.6 - - - A name - @since 5.3.4 - - - A name - - - A name - - - A name - @since 5.4.4 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 5.4.0 - - - A name - @since 5.4.0 - - - A name - - - A name - @since 2.1.6 - - - A name - @since 5.4.2 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name of a base 14 type 1 font - - - A name of a base 14 type 1 font - - - A name of a base 14 type 1 font - - - A name of a base 14 type 1 font - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name of an attribute. - @since 5.1.0 - - - A name - - - A name - - - A name - - - A name - - - A name of an attribute. - @since 5.1.0 - - - A name - - - A name - @since 5.4.0 - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - @since 2.1.5 renamed from DEFAULTCRYPTFILER - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 5.2.1 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 5.2.1 - - - A name - - - A name - - - A name - @since 5.1.3 - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 2.1.3 - - - A name - @since 2.1.3 - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 5.3.4 - - - A name - @since 5.3.4 - - - A name - - - A name - - - A name of an attribute. - @since 5.1.0 - - - A name - @since 5.4.3 - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - @since 5.1.0 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name of an attribute. - - - A name of an attribute. - - - A name of an attribute. - @since 5.1.0 - - - A name of an attribute. - @since 5.1.0 - - - A name of an attribute. - @since 5.1.0 - - - A name of an attribute. - - - A name of an attribute. - - - A name - @since 5.4.5 - - - A name of an attribute. - - - A name of an attribute. - - - A name of an attribute. - @since 5.1.0 - - - A name of an attribute. - - - A name of an attribute. - - - A name of an attribute. - - - A name of an attribute. - - - A name of an attribute. - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 5.4.5 - - - A name - @since 5.4.5 - - - A name - @since 2.1.6 - - - A name - @since 5.4.0 - - - A name of an attribute. - - - A name - - - A name of a base 14 type 1 font - - - A name of a base 14 type 1 font - - - A name of a base 14 type 1 font - - - A name of a base 14 type 1 font - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - @since 5.4.5 - - - A name - @since 5.4.5 - - - A name - - - A name - @since 5.4.3 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 5.5.3 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - @since 2.1.5 - - - A name - @since 2.1.5 - - - A name - - - A name - - - A name - @since 5.3.4 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 5.1.4 - - - An entry specifying the natural language, and optionally locale. Use this - to specify the Language attribute on a Tagged Pdf element. - For the content usage dictionary, use {@link #LANGUAGE} - - - A dictionary type, strictly for use in the content usage dictionary. For - dictionary entries in Tagged Pdf, use {@link #LANG} - - - A name - - - A name - - - A name - - - A name - - - A name - @since 5.5.0 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - @since 5.3.5 - - - A name - - - A name - @since 5.4.0 - - - A name - - - A name - @since 5.4.0 - - - A name - - - A name - - - A name - @since 2.1.2 - - - A name - @since 5.4.0 - - - A name - @since 5.4.0 - - - A name of an attribute. - @since 5.1.0 - - - A name - - - A name - - - A name - @since 5.2.1 - - - A name - @since 2.1.6 - - - A name - - - A name of an encoding - - - A name of an encoding - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 renamed from MAX - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - - - A name - @since 5.1.0 - - - A name - - - A name - @since 2.1.6 renamed from MIN - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - @since 5.4.3 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - - - A name. - @since 5.4.5 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 5.1.0 - - - A name - - - A name - - - A name - - - A name used with Document Structure - @since 2.1.5 - - - a name used with Document Structure - @since 2.1.5 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 5.4.3 - - - A name - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 5.5.4 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name used in defining Document Structure. - @since 2.1.5 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - @since 5.4.4 - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - @since 5.1.0 - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - @since 5.5.0 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 5.0.2 - - - A name - @since 5.0.2 - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name. - @since 5.4.5 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 5.4.3 - - - A name - @since 5.4.4 - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name of an attribute. - @since 5.1.0 - - - A name - - - A name - - - A name - - - A name - @since 5.1.0 - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - @since 5.4.3 - - - A name - @since 5.4.4 - - - A name - - - A name - - - A name - @since 5.1.0 - - - A name - - - A name - - - A name - - - A name - @since 5.4.4 - - - A name - - - A name - - - A name - - - A name - @since 2.1.5 renamed from RELATIVECALORIMETRIC - - - A name - - - A name - @since 5.5.4 - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 5.1.0 - - - A name - @since 5.4.4 - - - A name - @since 5.4.4 - - - A name - - - A name - - - A name - - - A name - @since 5.4.0 - - - A name - - - A name - @since 5.4.0 - - - A name - @since 5.4.3 - - - A name - @since 5.1.0 - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 5.4.0 - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - @since 5.3.4 - - - A name - @since 5.3.4 - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - @since 2.1.3 - - - A name - @since 5.1.0 - - - A name - - - A name - - - A name - - - A name - @since 5.3.4 - - - A name - @since 5.3.4 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name of a base 14 type 1 font - - - T is very commonly used for various dictionary entries, including title - entries in a Tagged PDF element dictionary, and target dictionaries. - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 2.1.5 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 5.3.5 - - - A name - @since 5.4.3 - - - A name - - - A name - @since 5.3.4 - - - A name - @since 5.3.5 - - - A name - @since 5.3.5 - - - A name - @since 5.3.5 - - - A name - @since 5.3.4 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name of a base 14 type 1 font - - - A name of a base 14 type 1 font - - - A name of a base 14 type 1 font - - - A name of a base 14 type 1 font - - - Use Title for the document's top level title (optional), and for document - outline dictionaries, which can store bookmarks. - For all other uses of a title entry, including Tagged PDF, use {@link #T} - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - @since 5.4.3 - - - A name - - - A name - - - A name - - - A name - - - A name - @since 5.4.4 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name of an attribute. - - - A name of an attribute. - - - A name - - - A name of an attribute. - - - A name of an attribute. - - - A name of an attribute. - - - A name - @since 5.2.1 - - - A name - @since 5.4.0 - - - A name - @since 5.4.0 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - @since 5.4.0 - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - @since 5.0.2 - - - A name - @since 2.1.6 - - - A name - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - @since 5.1.0 - - - A name - - - A name - - - A name - @since 2.1.6 - - - A name - @since 5.1.0 - - - A name of an attribute. - - - A name of an attribute. - - - A name - @since 2.1.6 - - - A name - @since 5.4.5 - - - A name of an attribute. - - - A name of an attribute. - - - A name of an attribute. - - - A name - - - A name of an encoding - - - A name of an encoding - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name of an encoding - - - A name - - - A name of an attribute. - @since 5.1.0 - - - A name - - - A name of an encoding - - - A name - @since 5.4.3 - - - A name - - - A name - @since 2.1.6 - - - A name - @since 2.1.6 - - - A name - - - A name - - - A name - - - A name - @since 5.1.0 - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name - - - A name of a base 14 type 1 font - - - A name - - - map strings to all known static names - @since 2.1.6 - - - Use reflection to cache all the static public readonly names so - future PdfName additions don't have to be "added twice". - A bit less efficient (around 50ms spent here on a 2.2ghz machine), - but Much Less error prone. - @since 2.1.6 - - - Constructs a new PdfName. The name length will be checked. - @param name the new name - - - Constructs a new PdfName. - @param name the new name - @param lengthCheck if true check the lenght validity, if false the name can - have any length - - - - Indicates whether some other object is "equal to" this one. - - @param obj the reference object with which to compare. - @return true if this object is the same as the obj - argument; false otherwise. - - - Returns a hash code value for the object. This method is - supported for the benefit of hashtables such as those provided by - java.util.Hashtable. - - @return a hash code value for this object. - - - Encodes a plain name given in the unescaped form "AB CD" into "/AB#20CD". - - @param name the name to encode - @return the encoded name - @since 2.1.5 - - - Decodes an escaped name in the form "/AB#20CD" into "AB CD". - @param name the name to decode - @return the decoded name - - - Creates a name tree. - @author Paulo Soares - - - Creates a name tree. - @param items the item of the name tree. The key is a String - and the value is a PdfObject. Note that although the - keys are strings only the lower byte is used and no check is made for chars - with the same lower byte and different upper byte. This will generate a wrong - tree name. - @param writer the writer - @throws IOException on error - @return the dictionary with the name tree. This dictionary is the one - generally pointed to by the key /Dests, for example - - - - This is an instance of the PdfNull-object. - - - - - actual value of this PdfNumber, represented as a double - - - Constructs a PdfNumber-object. - - @param content value of the new PdfNumber-object - - - Constructs a new int PdfNumber-object. - - @param value value of the new PdfNumber-object - - - Constructs a new long PdfNumber-object. - - @param value value of the new PdfNumber-object - - - Constructs a new REAL PdfNumber-object. - - @param value value of the new PdfNumber-object - - - Constructs a new REAL PdfNumber-object. - - @param value value of the new PdfNumber-object - - - Returns the primitive int value of this object. - - @return a value - - - Returns the primitive long value of this object. - - @return a value - - - Returns the primitive double value of this object. - - @return a value - - - Increments the value of the PdfNumber-object with 1. - - - Creates a number tree. - @author Paulo Soares - - - Creates a number tree. - @param items the item of the number tree. The key is an Integer - and the value is a PdfObject. - @param writer the writer - @throws IOException on error - @return the dictionary with the number tree. - - - - a possible type of PdfObject - - - a possible type of PdfObject - - - a possible type of PdfObject - - - a possible type of PdfObject - - - a possible type of PdfObject - - - a possible type of PdfObject - - - a possible type of PdfObject - - - a possible type of PdfObject - - - a possible type of PdfObject - - - This is an empty string used for the PdfNull-object and for an empty PdfString-object. - - - This is the default encoding to be used for converting strings into bytes and vice versa. - The default encoding is PdfDocEcoding. - - - This is the encoding to be used to output text in Unicode. - - - the content of this PdfObject - - - the type of this PdfObject - - - Holds value of property indRef. - - - Hash code of the PdfObject instance. - Unfortunately, default C# behavior does not generate unique hash code. - - - Used for generating hash code. - - - Making hash code generation thread safe. - - - Constructs a PdfObject of a certain type without any content. - - @param type type of the new PdfObject - - - Constructs a PdfObject of a certain type with a certain content. - - @param type type of the new PdfObject - @param content content of the new PdfObject as a String. - - - Constructs a PdfObject of a certain type with a certain content. - - @param type type of the new PdfObject - @param bytes content of the new PdfObject as an array of byte. - - - Writes the PDF representation of this PdfObject as an array of bytes to the writer. - @param writer for backwards compatibility - @param os the outputstream to write the bytes to. - @throws IOException - - - Gets the presentation of this object in a byte array - @return a byte array - - - Can this object be in an object stream? - @return true if this object can be in an object stream. - - - Returns the String-representation of this PdfObject. - - @return a String - - - Returns the length of the actual content of the PdfObject. -

    - In some cases, namely for PdfString and PdfStream, - this method differs from the method pdfLength because pdfLength - returns the length of the PDF representation of the object, not of the actual content - as does the method length.

    -

    - Remark: the actual content of an object is in some cases identical to its representation. - The following statement is always true: Length() >= PdfLength().

    - - @return a length -
    - - Changes the content of this PdfObject. - - @param content the new content of this PdfObject - - - Returns the type of this PdfObject. - - @return a type - - - Checks if this PdfObject is of the type PdfNull. - - @return true or false - - - Checks if this PdfObject is of the type PdfBoolean. - - @return true or false - - - Checks if this PdfObject is of the type PdfNumber. - - @return true or false - - - Checks if this PdfObject is of the type PdfString. - - @return true or false - - - Checks if this PdfObject is of the type PdfName. - - @return true or false - - - Checks if this PdfObject is of the type PdfArray. - - @return true or false - - - Checks if this PdfObject is of the type PdfDictionary. - - @return true or false - - - Checks if this PdfObject is of the type PdfStream. - - @return true or false - - - Checks if this is an indirect object. - @return true if this is an indirect object - - - - the PdfIndirectReference of this object - - - value of the Count-key - - - value of the Parent-key - - - value of the Destination-key - - - The PdfAction for this outline. - - - Holds value of property tag. - - - Holds value of property open. - - - Holds value of property color. - - - Holds value of property style. - - - - - - - - - - - - - - - - Helper for the constructors. - @param parent the parent outline - @param title the title for this outline - @param open true if the children are visible - - - Gets the indirect reference of this PdfOutline. - - @return the PdfIndirectReference to this outline. - - - Gets the parent of this PdfOutline. - - @return the PdfOutline that is the parent of this outline. - - - Set the page of the PdfDestination-object. - - @param pageReference indirect reference to the page - @return true if this page was set as the PdfDestination-page. - - - Gets the destination for this outline. - @return the destination - - - returns the level of this outline. - - @return a level - - - Returns the PDF representation of this PdfOutline. - - @param writer the encryption information - @param os - @throws IOException - - - Getter for property tag. - @return Value of property tag. - - - Setter for property open. - @param open New value of property open. - - - - value of the Rotate key for a page in PORTRAIT - - - value of the Rotate key for a page in LANDSCAPE - - - value of the Rotate key for a page in INVERTEDPORTRAIT - - - value of the Rotate key for a page in SEASCAPE - - - value of the MediaBox key - - - Constructs a PdfPage. - - @param mediaBox a value for the MediaBox key - @param resources an indirect reference to a PdfResources-object - @param rotate a value for the Rotate key - @throws DocumentException - - - Constructs a PdfPage. - - @param mediaBox a value for the MediaBox key - @param resources an indirect reference to a PdfResources-object - @throws DocumentException - - - - Adds an indirect reference pointing to a PdfContents-object. - - @param contents an indirect reference to a PdfContents-object - - - Rotates the mediabox, but not the text in it. - - @return a PdfRectangle - - - Returns the MediaBox of this Page. - - @return a PdfRectangle - - - Helps the use of PdfPageEvent by implementing all the interface methods. - A class can extend PdfPageEventHelper and only implement the - needed methods. - - @author Paulo Soares - - - Called when the document is opened. - - @param writer the PdfWriter for this document - @param document the document - - - - Called when a page is finished, just before being written to the document. - - @param writer the PdfWriter for this document - @param document the document - - - - - - - - - - - Page labels are used to identify each - page visually on the screen or in print. - @author Paulo Soares - - - Logical pages will have the form 1,2,3,... - - - Logical pages will have the form I,II,III,IV,... - - - Logical pages will have the form i,ii,iii,iv,... - - - Logical pages will have the form of uppercase letters - (A to Z for the first 26 pages, AA to ZZ for the next 26, and so on) - - - Logical pages will have the form of uppercase letters - (a to z for the first 26 pages, aa to zz for the next 26, and so on) - - - No logical page numbers are generated but fixed text may - still exist - - - Dictionary values to set the logical page styles - - - The sequence of logical pages. Will contain at least a value for page 1 - - - Creates a new PdfPageLabel with a default logical page 1 - - - Adds or replaces a page label. - @param page the real page to start the numbering. First page is 1 - @param numberStyle the numbering style such as LOWERCASE_ROMAN_NUMERALS - @param text the text to prefix the number. Can be null or empty - @param firstPage the first logical page number - - - Adds or replaces a page label. - @param page the real page to start the numbering. First page is 1 - @param numberStyle the numbering style such as LOWERCASE_ROMAN_NUMERALS - @param text the text to prefix the number. Can be null or empty - @param firstPage the first logical page number - @param includeFirstPage If true, the page label will be added to the first page if it is page 1. - If the first page is not page 1 or this value is false, the value will not be added to the dictionary. - - - Adds or replaces a page label. The first logical page has the default - of 1. - @param page the real page to start the numbering. First page is 1 - @param numberStyle the numbering style such as LOWERCASE_ROMAN_NUMERALS - @param text the text to prefix the number. Can be null or empty - - - Adds or replaces a page label. There is no text prefix and the first - logical page has the default of 1. - @param page the real page to start the numbering. First page is 1 - @param numberStyle the numbering style such as LOWERCASE_ROMAN_NUMERALS - - - Adds or replaces a page label. - - - Removes a page label. The first page lagel can not be removed, only changed. - @param page the real page to remove - - - Gets the page label dictionary to insert into the document. - @return the page label dictionary - - - Retrieves the page labels from a PDF as an array of String objects. - @param reader a PdfReader object that has the page labels you want to retrieve - @return a String array or null if no page labels are present - - - Retrieves the page labels from a PDF as an array of {@link PdfPageLabelFormat} objects. - @param reader a PdfReader object that has the page labels you want to retrieve - @return a PdfPageLabelEntry array, containing an entry for each format change - or null if no page labels are present - - - Creates a page label format. - @param physicalPage the real page to start the numbering. First page is 1 - @param numberStyle the numbering style such as LOWERCASE_ROMAN_NUMERALS - @param prefix the text to prefix the number. Can be null or empty - @param logicalPage the first logical page number - - - - Constructs a PdfPages-object. - - - A PdfPattern defines a ColorSpace - - @see PdfStream - - - Creates a PdfPattern object. - @param painter a pattern painter instance - - - Creates a PdfPattern object. - @param painter a pattern painter instance - @param compressionLevel the compressionLevel for the stream - @since 2.1.3 - - - Implements the pattern. - - - Creates a PdfPattern. - - - Creates new PdfPattern - - @param wr the PdfWriter - - - Gets the stream representing this pattern - @return the stream representing this pattern - - - Gets the stream representing this pattern - @param compressionLevel the compression level of the stream - @return the stream representing this pattern - @since 2.1.3 - - - Gets a duplicate of this PdfPatternPainter. All - the members are copied by reference but the buffer stays different. - @return a copy of this PdfPatternPainter - - - @see com.lowagie.text.pdf.PdfContentByte#setGrayFill(float) - - - @see com.lowagie.text.pdf.PdfContentByte#resetGrayFill() - - - @see com.lowagie.text.pdf.PdfContentByte#setGrayStroke(float) - - - @see com.lowagie.text.pdf.PdfContentByte#resetGrayStroke() - - - @see com.lowagie.text.pdf.PdfContentByte#setRGBColorFillF(float, float, float) - - - @see com.lowagie.text.pdf.PdfContentByte#resetRGBColorFill() - - - @see com.lowagie.text.pdf.PdfContentByte#setRGBColorStrokeF(float, float, float) - - - @see com.lowagie.text.pdf.PdfContentByte#resetRGBColorStroke() - - - @see com.lowagie.text.pdf.PdfContentByte#setCMYKColorFillF(float, float, float, float) - - - @see com.lowagie.text.pdf.PdfContentByte#resetCMYKColorFill() - - - @see com.lowagie.text.pdf.PdfContentByte#setCMYKColorStrokeF(float, float, float, float) - - - @see com.lowagie.text.pdf.PdfContentByte#resetCMYKColorStroke() - - - @see com.lowagie.text.pdf.PdfContentByte#addImage(com.lowagie.text.Image, float, float, float, float, float, float) - - - @see com.lowagie.text.pdf.PdfContentByte#setCMYKColorFill(int, int, int, int) - - - @see com.lowagie.text.pdf.PdfContentByte#setCMYKColorStroke(int, int, int, int) - - - @see com.lowagie.text.pdf.PdfContentByte#setRGBColorFill(int, int, int) - - - @see com.lowagie.text.pdf.PdfContentByte#setRGBColorStroke(int, int, int) - - - @see com.lowagie.text.pdf.PdfContentByte#setColorStroke(java.awt.Color) - - - @see com.lowagie.text.pdf.PdfContentByte#setColorFill(java.awt.Color) - - - @see com.lowagie.text.pdf.PdfContentByte#setColorFill(com.lowagie.text.pdf.PdfSpotColor, float) - - - @see com.lowagie.text.pdf.PdfContentByte#setColorStroke(com.lowagie.text.pdf.PdfSpotColor, float) - - - @see com.lowagie.text.pdf.PdfContentByte#setPatternFill(com.lowagie.text.pdf.PdfPatternPainter) - - - @see com.lowagie.text.pdf.PdfContentByte#setPatternFill(com.lowagie.text.pdf.PdfPatternPainter, java.awt.Color, float) - - - @see com.lowagie.text.pdf.PdfContentByte#setPatternStroke(com.lowagie.text.pdf.PdfPatternPainter, java.awt.Color, float) - - - @see com.lowagie.text.pdf.PdfContentByte#setPatternStroke(com.lowagie.text.pdf.PdfPatternPainter) - - - A cell in a PdfPTable. - - - Holds value of property verticalAlignment. - - - Holds value of property paddingLeft. - - - Holds value of property paddingLeft. - - - Holds value of property paddingTop. - - - Holds value of property paddingBottom. - - - Holds value of property fixedHeight. - - - Fixed height of the cell. - - - Holds value of property noWrap. - - - Holds value of property table. - - - Holds value of property minimumHeight. - - - This field is used to cache the height which is calculated on getMaxHeight() method call; - this helps to avoid unnecessary recalculations on table drawing. - - - Holds value of property colspan. - - - Holds value of property rowspan. - @since 2.1.6 - - - Holds value of property image. - - - Holds value of property cellEvent. - - - Holds value of property useDescender. - - - Increases padding to include border if true - - - The text in the cell. - - - The rotation of the cell. Possible values are - 0, 90, 180 and 270. - - - Constructs an empty PdfPCell. - The default padding is 2. - - - Constructs a PdfPCell with a Phrase. - The default padding is 2. - @param phrase the text - - - Constructs a PdfPCell with an Image. - The default padding is 0. - @param image the Image - - - Constructs a PdfPCell with an Image. - The default padding is 0.25 for a border width of 0.5. - @param image the Image - @param fit true to fit the image to the cell - - - Constructs a PdfPCell with a PdfPtable. - This constructor allows nested tables. - The default padding is 0. - @param table The PdfPTable - - - Constructs a PdfPCell with a PdfPtable. - This constructor allows nested tables. - - @param table The PdfPTable - @param style The style to apply to the cell (you could use getDefaultCell()) - @since 2.1.0 - - - Constructs a deep copy of a PdfPCell. - @param cell the PdfPCell to duplicate - - - Adds an iText element to the cell. - @param element - - - Gets the Phrase from this cell. - @return the Phrase - - - Gets the horizontal alignment for the cell. - @return the horizontal alignment for the cell - - - Gets the vertical alignment for the cell. - @return the vertical alignment for the cell - - - Gets the effective left padding. This will include - the left border width if {@link #UseBorderPadding} is true. - @return effective value of property paddingLeft. - - - @return Value of property paddingLeft. - - - Gets the effective right padding. This will include - the right border width if {@link #UseBorderPadding} is true. - @return effective value of property paddingRight. - - - Getter for property paddingRight. - @return Value of property paddingRight. - - - Gets the effective top padding. This will include - the top border width if {@link #isUseBorderPadding()} is true. - @return effective value of property paddingTop. - - - Getter for property paddingTop. - @return Value of property paddingTop. - - - /** Gets the effective bottom padding. This will include - * the bottom border width if {@link #UseBorderPadding} is true. - * @return effective value of property paddingBottom. - - - Getter for property paddingBottom. - @return Value of property paddingBottom. - - - Sets the padding of the contents in the cell (space between content and border). - @param padding - - - Adjusts effective padding to include border widths. - @param use adjust effective padding if true - - - Sets the leading fixed and variable. The resultant leading will be - fixedLeading+multipliedLeading*maxFontSize where maxFontSize is the - size of the bigest font in the line. - @param fixedLeading the fixed leading - @param multipliedLeading the variable leading - - - Gets the fixed leading - @return the leading - - - Gets the variable leading - @return the leading - - - Gets the first paragraph line indent. - @return the indent - - - Gets the extra space between paragraphs. - @return the extra space between paragraphs - - - Getter for property fixedHeight. - @return Value of property fixedHeight. - - - Tells you whether the cell has a fixed height. - - @return true is a fixed height was set. - @since 2.1.5 - - - Gets the height which was calculated on last call of getMaxHeight(). - If cell's bBox and content wasn't changed this value is actual maxHeight of the cell. - @return max height which was calculated on last call of getMaxHeight(); if getMaxHeight() wasn't called the return value is 0 - - - Setter for property noWrap. - @param noWrap New value of property noWrap. - - - Getter for property table. - @return Value of property table. - - - Getter for property minimumHeight. - @return Value of property minimumHeight. - - - Tells you whether the cell has a minimum height. - - @return true if a minimum height was set. - @since 2.1.5 - - - Getter for property colspan. - @return Value of property colspan. - - - Getter for property rowspan. - @return Value of property rowspan. - - - Gets the following paragraph lines indent. - @return the indent - - - Gets the right paragraph lines indent. - @return the indent - - - Gets the space/character extra spacing ratio for - fully justified text. - @return the space/character extra spacing ratio - - - Gets the run direction of the text content in the cell - @return One of the following values: PdfWriter.RUN_DIRECTION_DEFAULT, PdfWriter.RUN_DIRECTION_NO_BIDI, PdfWriter.RUN_DIRECTION_LTR or PdfWriter.RUN_DIRECTION_RTL. - - - Getter for property image. - @return Value of property image. - - - - Gets the cell event for this cell. - @return the cell event - - - - Gets the arabic shaping options. - @return the arabic shaping options - - - Gets state of first line height based on max ascender - @return true if an ascender is to be used. - - - Getter for property useDescender. - @return Value of property useDescender. - - - - Gets the ColumnText with the content of the cell. - @return a columntext object - - - Returns the list of composite elements of the column. - @return a List object. - @since 2.1.1 - - - Sets the rotation of the cell. Possible values are - 0, 90, 180 and 270. - @param rotation the rotation of the cell - - - Returns the height of the cell. - @return the height of the cell - @since 3.0.0 - - - this is a possible style. - - - this is a possible style. - - - this is a possible style. - - - this is a possible style. - - - A row in a PdfPTable. - - @author Paulo Soares - - - True if the table may not break after this row. - - - the bottom limit (bottom right y) - - - the right limit - @since 2.1.5 - - - extra heights that needs to be added to a cell because of rowspans. - @since 2.1.6 - - - Constructs a new PdfPRow with the cells in the array that was passed - as a parameter. - - @param cells - - - Makes a copy of an existing row. - - @param row - - - Sets the widths of the columns in the row. - - @param widths - @return true if everything went right - - - Initializes the extra heights array. - @since 2.1.6 - - - Sets an extra height for a cell. - @param cell the index of the cell that needs an extra height - @param height the extra height - @since 2.1.6 - - - Calculates the heights of each cell in the row. - - @return the maximum height of the row. - - - Writes the border and background of one cell in the row. - - @param xPos The x-coordinate where the table starts on the canvas - @param yPos The y-coordinate where the table starts on the canvas - @param currentMaxHeight The height of the cell to be drawn. - @param cell - @param canvases - @since 2.1.6 extra parameter currentMaxHeight - - - @since 2.1.6 private is now protected - - - @since 2.1.6 private is now protected - - - @since 3.0.0 protected is now public static - - - * Writes a number of cells (not necessarily all cells). - * - * @param colStart The first column to be written. - * Remember that the column index starts with 0. - * @param colEnd The last column to be written. - * Remember that the column index starts with 0. - * If -1, all the columns to the end are written. - * @param xPos The x-coordinate where the table starts on the canvas - * @param yPos The y-coordinate where the table starts on the canvas - * @param reusable if set to false, the content in the cells is "consumed"; - * if true, you can reuse the cells, the row, the parent table as many times you want. - * @since 5.1.0 added the reusable parameter - - - Checks if the dimensions of the columns were calculated. - - @return true if the dimensions of the columns were calculated - - - Gets the maximum height of the row (i.e. of the 'highest' cell). - @return the maximum height of the row - - - Copies the content of a specific row in a table to this row. - Don't do this if the rows have a different number of cells. - @param table the table from which you want to copy a row - @param idx the index of the row that needs to be copied - @since 5.1.0 - - - Splits a row to newHeight. - The returned row is the remainder. It will return null if the newHeight - was so small that only an empty row would result. - - @param new_height the new height - @return the remainder row or null if the newHeight was so small that only - an empty row would result - - - Split rowspan of cells with rowspan on next page by inserting copies with the remaining rowspan - and reducing the previous rowspan appropriately, i.e. if a cell with rowspan 7 gets split after 3 rows - of that rowspan have been laid out, its column on the next page should start with an empty cell - having the same attributes and rowspan 7 - 3 = 4. - - @since iText 5.4.3 - - - Returns the array of cells in the row. - Please be extremely careful with this method. - Use the cells as read only objects. - - @return an array of cells - @since 2.1.1 - - - Checks if a cell in the row has a rowspan greater than 1. - @since 5.1.0 - - - Implements the PostScript XObject. - - - Creates a new instance of PdfPSXObject - - - Constructs a PSXObject - @param wr - - - Gets the stream representing this object. - - @param compressionLevel the compressionLevel - @return the stream representing this template - @since 2.1.3 (replacing the method without param compressionLevel) - @throws IOException - - - Gets a duplicate of this PdfPSXObject. All - the members are copied by reference but the buffer stays different. - @return a copy of this PdfPSXObject - - - This is a table that can be put at an absolute position but can also - be added to the document as the class Table. - In the last case when crossing pages the table always break at full rows; if a - row is bigger than the page it is dropped silently to avoid infinite loops. -

    - A PdfPTableEvent can be associated to the table to do custom drawing - when the table is rendered. - @author Paulo Soares - - - The index of the original PdfcontentByte. - - - The index of the duplicate PdfContentByte where the background will be drawn. - - - The index of the duplicate PdfContentByte where the border lines will be drawn. - - - The index of the duplicate PdfContentByte where the text will be drawn. - - - The current column index. - - @since 5.1.0 renamed from currentColIdx - - - Holds value of property headerRows. - - - Holds value of property widthPercentage. - - - Holds value of property horizontalAlignment. - - - Holds value of property skipFirstHeader. - - - Holds value of property skipLastFooter. - - @since 2.1.6 - - - Holds value of property lockedWidth. - - - Holds value of property splitRows. - - - The spacing before the table. - - - The spacing after the table. - - - Holds value of property extendLastRow. - - - Holds value of property headersInEvent. - - - Holds value of property splitLate. - - - Defines if the table should be kept - on one page if possible - - - Indicates if the PdfPTable is complete once added to the document. - @since iText 2.0.8 - - - Keeps track of the completeness of the current row. - - @since 2.1.6 - - - Constructs a PdfPTable with the relative column widths. - @param relativeWidths the relative column widths - - - Constructs a PdfPTable with numColumns columns. - @param numColumns the number of columns - - - Constructs a copy of a PdfPTable. - @param table the PdfPTable to be copied - - - Makes a shallow copy of a table (format without content). - @param table - @return a shallow copy of the table - - - Copies the format of the sourceTable without copying the content. - @param sourceTable - @since 2.1.6 private is now protected - - - Sets the relative widths of the table. - @param relativeWidths the relative widths of the table. - @throws DocumentException if the number of widths is different than the number - of columns - - - Sets the relative widths of the table. - @param relativeWidths the relative widths of the table. - @throws DocumentException if the number of widths is different than the number - of columns - - - @since 2.1.6 private is now protected - - - Sets the full width of the table from the absolute column width. - @param columnWidth the absolute width of each column - @throws DocumentException if the number of widths is different than the number - of columns - - - Sets the percentage width of the table from the absolute column width. Warning: Don't use this with setLockedWidth(true). These two settings don't mix. - @param columnWidth the absolute width of each column - @param pageSize the page size - @throws DocumentException - - - Gets the full width of the table. - @return the full width of the table - - - Calculates the heights of the table. - - @return the total height of the table. Note that it will be 0 if you didn't - specify the width of the table with SetTotalWidth(). - and made it public - - - Changes the number of columns. Any existing rows will be deleted. - - @param the new number of columns - - - Gets the default PdfPCell that will be used as - reference for all the addCell methods except - addCell(PdfPCell). - @return default PdfPCell - - - Adds a cell element. - - @param cell the cell element - - - When updating the row index, cells with rowspan should be taken into account. - This is what happens in this method. - - @since 2.1.6 - - - Added by timmo3. This will return the correct cell taking it's cellspan into account - - @param row the row index - @param col the column index - @return PdfPCell at the given row and position or null otherwise - - - Checks if there are rows above belonging to a rowspan. - @param currRow the current row to check - @param currCol the current column to check - @return true if there's a cell above that belongs to a rowspan - @since 2.1.6 - - - Adds a cell element. - @param text the text for the cell - - - Adds a nested table. - @param table the table to be added to the cell - - - Adds an Image as Cell. - @param image the Image to add to the table. - This image will fit in the cell - - - Adds a cell element. - @param phrase the Phrase to be added to the cell - - - - - Writes the selected rows and columns to the document. - This method does not clip the columns; this is only important - if there are columns with colspan at boundaries. - canvases is obtained from beginWritingRows(). - The table event is only fired for complete rows. - - @param colStart the first column to be written, zero index - @param colEnd the last column to be written + 1. If it is -1 all the - columns to the end are written - @param rowStart the first row to be written, zero index - @param rowEnd the last row to be written + 1. If it is -1 all the - rows to the end are written - @param xPos the x write coordinate - @param yPos the y write coordinate - @param canvases an array of 4 PdfContentByte obtained from - beginWritingRows() - @param reusable if set to false, the content in the cells is "consumed"; - if true, you can reuse the cells, the row, the parent table as many times you want. - @return the y coordinate position of the bottom of the last row - @see #beginWritingRows(com.itextpdf.text.pdf.PdfContentByte) - @since 5.1.0 added the reusable parameter - - - Writes the selected rows to the document. - - @param rowStart the first row to be written, zero index - @param rowEnd the last row to be written + 1. If it is -1 all the - rows to the end are written - @param xPos the x write coodinate - @param yPos the y write coodinate - @param canvas the PdfContentByte where the rows will - be written to - @return the y coordinate position of the bottom of the last row - - - - Writes the selected rows and columns to the document. - This method clips the columns; this is only important - if there are columns with colspan at boundaries. - The table event is only fired for complete rows. - - @param colStart the first column to be written, zero index - @param colEnd the last column to be written + 1. If it is -1 all the - columns to the end are written - @param rowStart the first row to be written, zero index - @param rowEnd the last row to be written + 1. If it is -1 all the - rows to the end are written - @param xPos the x write coordinate - @param yPos the y write coordinate - @param canvas the PdfContentByte where the rows will - be written to - @return the y coordinate position of the bottom of the last row - @param reusable if set to false, the content in the cells is "consumed"; - if true, you can reuse the cells, the row, the parent table as many times you want. - @since 5.1.0 added the reusable parameter - - - - Finishes writing the table. - @param canvases the array returned by beginWritingRows() - - - Gets the number of rows in this table. - @return the number of rows in this table - - - Gets the total height of the table. - @return the total height of the table - - - Gets the height of a particular row. - @param idx the row index (starts at 0) - @return the height of a particular row - - - Gets the height of a particular row. - - @param idx the row index (starts at 0) - @param firsttime is this the first time the row heigh is calculated? - @return the height of a particular row - @since 5.0.0 - - - Gets the maximum height of a cell in a particular row (will only be different - from getRowHeight is one of the cells in the row has a rowspan > 1). - - @param rowIndex the row index - @param cellIndex the cell index - @return the height of a particular row including rowspan - @since 2.1.6 - - - Checks if a cell in a row has a rowspan greater than 1. - - @since 5.1.0 - - - Makes sure the footers value is lower than the headers value. - - @since 5.0.1 - - - Gets the height of the rows that constitute the header as defined by - setHeaderRows(). - @return the height of the rows that constitute the header and footer - - - Gets the height of the rows that constitute the header as defined by - setFooterRows(). - @return the height of the rows that constitute the footer - @since 2.1.1 - - - Deletes a row from the table. - @param rowNumber the row to be deleted - @return true if the row was deleted - - - Deletes the last row in the table. - @return true if the last row was deleted - - - Removes all of the rows except headers - - - Returns the number of columns. - @return the number of columns. - @since 2.1.1 - - - Gets all the chunks in this element. - - @return an List - - - Gets the type of the text element. - - @return a type - - - @since iText 2.0.8 - @see com.lowagie.text.Element#isContent() - - - @since iText 2.0.8 - @see com.lowagie.text.Element#isNestable() - - - Processes the element by adding it (or the different parts) to an - ElementListener. - - @param listener an ElementListener - @return true if the element was processed successfully - - - Gets a row with a given index. - - @param idx - @return the row at position idx - - - Returns the index of the last completed row. - - @return the index of a row - - - Defines where the table may be broken (if necessary). - - @param breakPoints int[] - @throws System.IndexOutOfRangeException if a row index is passed that is out of bounds - - - Defines which rows should not allow a page break (if possible). - - @param rows int[] - @throws System.IndexOutOfRangeException if a row index is passed that is out of bounds - - - Defines a range of rows that should not allow a page break (if possible). - - @param start int - @param end int - @throws System.IndexOutOfRangeException if a row index is passed that is out of bounds - - - Defines a range of rows (from the parameter to the last row) that should not allow a page break (if possible). - The equivalent of calling {@link #keepRowsTogether(int,int) keepRowsTogether(start, rows.size()}. - - @param start int - @throws System.IndexOutOfRangeException if a row index is passed that is out of bounds - - - Gets an arraylist with all the rows in the table. - @return an arraylist - - - Gets an arraylist with a selection of rows. - @param start the first row in the selection - @param end the first row that isn't part of the selection - @return a selection of rows - @since 2.1.6 - - - Calculates the extra height needed in a row because of rowspans. - @param start the index of the start row (the one to adjust) - @param end the index of the end row on the page - @since 2.1.6 - - - Sets the table event for this table. - - @param event the table event for this table - - - Gets the absolute sizes of each column width. - @return he absolute sizes of each column width - - - Tells you if the last footer needs to be skipped - (for instance if the footer says "continued on the next page") - - @return Value of property skipLastFooter. - @since 2.1.6 - - - When set the last row on every page will be extended to fill - all the remaining space to the bottom boundary; except maybe the - row. - - @param extendLastRows true to extend the last row on each page; false otherwise - @param extendFinalRow false if you don't want to extend the row of the complete table - @since iText 5.0.0 - - - * Gets the value of the last row extension, taking into account - * if the row is reached or not. - * - * @return true if the last row will extend; - * false otherwise - * @since iText 5.0.0 - - - If true the table will be kept on one page if it fits, by forcing a - new page if it doesn't fit on the current page. The default is to - split the table over multiple pages. - - @param p_KeepTogether whether to try to keep the table on one page - - - Completes the current row with the default cell. An incomplete row will be dropped - but calling this method will make sure that it will be present in the table. - - - @since iText 2.0.8 - @see com.lowagie.text.LargeElement#flushContent() - - - @since iText 2.0.8 - @see com.lowagie.text.LargeElement#isComplete() - - - Gets row index where cell overlapping (rowIdx, colIdx) starts - @param rowIdx - @param colIdx - @return row index - @since iText 5.4.3 - - - - @since iText 5.4.3 - - - Correct chosen last fitting row so that the content of all cells with open rowspans will fit on the page, - i.e. the cell content won't be split. - (Only to be used with splitLate == true) - - - - @since iText 5.4.3 - - - Determine which rows fit on the page, respecting isSplitLate(). - Note: sets max heights of the inspected rows as a side effect, - just like PdfPTable.getRowHeight(int, boolean) does. - Respect row.getMaxHeights() if it has been previously set (which might be independent of the height of - individual cells). - The last row written on the page will be chosen by the caller who might choose not - the calculated one but an earlier one (due to mayNotBreak settings on the rows). - The height of the chosen last row has to be corrected if splitLate == true - by calling FittingRows.correctLastRowChosen() by the caller to avoid splitting the content of - cells with open rowspans. - - @since iText 5.4.3 - - - - @author Aiken Sam (aikensam@ieee.org) - - - Reads a PDF document. - @author Paulo Soares - @author Kazuya Ujihara - - - The iText developers are not responsible if you decide to change the - value of this static parameter. - @since 5.0.2 - - - Handler which will be used for decompression of pdf streams. - - - Holds value of property appendable. - - - Constructs a new PdfReader. This is the master constructor. - @param byteSource source of bytes for the reader - @param partialRead if true, the reader is opened in partial mode (PDF is parsed on demand), if false, the entire PDF is parsed into memory as the reader opens - @param ownerPassword the password or null if no password is required - @param certificate the certificate or null if no certificate is required - @param certificateKey the key or null if no certificate key is required - @param certificateKeyProvider the name of the key provider, or null if no key is required - @param closeSourceOnConstructorError if true, the byteSource will be closed if there is an error during construction of this reader - - - Constructs a new PdfReader. This is the master constructor. - @param byteSource source of bytes for the reader - @param properties the properties which will be used to create the reader - - - Reads and parses a PDF document. - @param filename the file name of the document - @throws IOException on error - - - Reads and parses a PDF document. - @param filename the file name of the document - @param properties the properties which will be used to create the reader - @throws IOException on error - - - Reads and parses a PDF document. - @param filename the file name of the document - @param ownerPassword the password to read the document - @throws IOException on error - - - Reads and parses a PDF document. - @param filename the file name of the document - @param ownerPassword the password to read the document - @throws IOException on error - - - Reads and parses a PDF document. - @param pdfIn the byte array with the document - @throws IOException on error - - - Reads and parses a PDF document. - @param pdfIn the byte array with the document - @param ownerPassword the password to read the document - @throws IOException on error - - - Reads and parses a PDF document. - @param filename the file name of the document - @param certificate the certificate to read the document - @param certificateKey the private key of the certificate - @param certificateKeyProvider the security provider for certificateKey - @throws IOException on error - - - Reads and parses a PDF document. - @param url the Uri of the document - @throws IOException on error - - - Reads and parses a PDF document. - @param url the Uri of the document - @param ownerPassword the password to read the document - @throws IOException on error - - - Reads and parses a PDF document. - @param is the InputStream containing the document. The stream is read to the - end but is not closed - @param ownerPassword the password to read the document - @throws IOException on error - - - Reads and parses a PDF document. - @param properties the properties which will be used to create the reader - @param isp the InputStream containing the document. The stream is read to the - end but is not closed - @throws IOException on error - - - Reads and parses a PDF document. - @param isp the InputStream containing the document. The stream is read to the - end but is not closed - @throws IOException on error - - - Reads and parses a pdf document. Contrary to the other constructors only the xref is read - into memory. The reader is said to be working in "partial" mode as only parts of the pdf - are read as needed. - @param raf the document location - @param ownerPassword the password or null for no password - @throws IOException on error - - - Reads and parses a pdf document. - @param raf the document location - @param ownerPassword the password or null for no password - @param partial indicates if the reader needs to read the document only partially. See {@link PdfReader#PdfReader(RandomAccessFileOrArray, byte[])} - @throws IOException on error - - - Creates an independent duplicate. - @param reader the PdfReader to duplicate - - - Utility method that checks the provided byte source to see if it has junk bytes at the beginning. If junk bytes - are found, construct a tokeniser that ignores the junk. Otherwise, construct a tokeniser for the byte source as it is - @param byteSource the source to check - @return a tokeniser that is guaranteed to start at the PDF header - @throws IOException if there is a problem reading the byte source - - - Gets a new file instance of the original PDF - document. - @return a new file instance of the original PDF document - - - Gets the number of pages in the document. - @return the number of pages in the document - - - Returns the document's catalog. This dictionary is not a copy, - any changes will be reflected in the catalog. - @return the document's catalog - - - Returns the document's acroform, if it has one. - @return the document's acroform - - - Gets the page rotation. This value can be 0, 90, 180 or 270. - @param index the page number. The first page is 1 - @return the page rotation - - - Gets the page size, taking rotation into account. This - is a Rectangle with the value of the /MediaBox and the /Rotate key. - @param index the page number. The first page is 1 - @return a Rectangle - - - Gets the rotated page from a page dictionary. - @param page the page dictionary - @return the rotated page - - - Gets the page size without taking rotation into account. This - is the value of the /MediaBox key. - @param index the page number. The first page is 1 - @return the page size - - - Gets the page from a page dictionary - @param page the page dictionary - @return the page - - - Gets the crop box without taking rotation into account. This - is the value of the /CropBox key. The crop box is the part - of the document to be displayed or printed. It usually is the same - as the media box but may be smaller. If the page doesn't have a crop - box the page size will be returned. - @param index the page number. The first page is 1 - @return the crop box - - - Gets the box size. Allowed names are: "crop", "trim", "art", "bleed" and "media". - @param index the page number. The first page is 1 - @param boxName the box name - @return the box rectangle or null - - - Returns the content of the document information dictionary as a Hashtable - of String. - @return content of the document information dictionary - - - Normalizes a Rectangle so that llx and lly are smaller than urx and ury. - @param box the original rectangle - @return a normalized Rectangle - - - Checks if the PDF is a tagged PDF. - - - Parses the entire PDF - - - @throws IOException - - - @param obj - @return a PdfObject - - - Reads a PdfObject resolving an indirect reference - if needed. - @param obj the PdfObject to read - @return the resolved PdfObject - - - Reads a PdfObject resolving an indirect reference - if needed. If the reader was opened in partial mode the object will be released - to save memory. - @param obj the PdfObject to read - @param parent - @return a PdfObject - - - @param obj - @param parent - @return a PdfObject - - - @param idx - @return a PdfObject - - - @param idx - @return aPdfObject - - - - - - - - - @param obj - - - @param obj - @return an indirect reference - - - @return the percentage of the cross reference table that has been read - - - Eliminates the reference to the object freeing the memory used by it and clearing - the xref entry. - @param obj the object. If it's an indirect reference it will be eliminated - @return the object or the already erased dereferenced object - - - Decodes a stream that has the FlateDecode filter. - @param in the input data - @return the decoded data - - - Decodes a stream that has the FlateDecode filter. - @param in the input data - @return the decoded data - - - @param in - @param dicPar - @return a byte array - - - A helper to FlateDecode. - @param in the input data - @param strict true to read a correct stream. false - to try to read a corrupted stream - @return the decoded data - - - A helper to FlateDecode. - @param in the input data - @param strict true to read a correct stream. false - to try to read a corrupted stream - @return the decoded data - - - Decodes a stream that has the ASCIIHexDecode filter. - @param in the input data - @return the decoded data - - - Decodes a stream that has the ASCIIHexDecode filter. - @param in the input data - @return the decoded data - - - Decodes a stream that has the ASCII85Decode filter. - @param in the input data - @return the decoded data - - - Decodes a stream that has the ASCII85Decode filter. - @param in the input data - @return the decoded data - - - Decodes a stream that has the LZWDecode filter. - @param in the input data - @return the decoded data - - - Decodes a stream that has the LZWDecode filter. - @param in the input data - @return the decoded data - - - Checks if the document had errors and was rebuilt. - @return true if rebuilt. - - - - Gets the dictionary that represents a page. - @param pageNum the page number. 1 is the first - @return the page dictionary - - - @param pageNum - @return a Dictionary object - - - @param pageNum - - - - - - Gets the page reference to this page. - @param pageNum the page number. 1 is the first - @return the page reference - - - Gets the contents of the page. - @param pageNum the page number. 1 is the first - @param file the location of the PDF document - @throws IOException on error - @return the content - - - Gets the content from the page dictionary. - @param page the page dictionary - @throws IOException on error - @return the content - @since 5.0.6 - - - Retrieve the given page's resource dictionary - @param pageNum 1-based page number from which to retrieve the resource dictionary - @return The page's resources, or 'null' if the page has none. - @since 5.1 - - - Retrieve the given page's resource dictionary - @param pageDict the given page - @return The page's resources, or 'null' if the page has none. - @since 5.1 - - - Gets the contents of the page. - @param pageNum the page number. 1 is the first - @throws IOException on error - @return the content - - - Sets the contents of the page. - @param content the new page content - @param pageNum the page number. 1 is the first - @throws IOException on error - - - Sets the contents of the page. - @param content the new page content - @param pageNum the page number. 1 is the first - @since 2.1.3 (the method already existed without param compressionLevel) - - - Decode a byte[] applying the filters specified in the provided dictionary using default filter handlers. - @param b the bytes to decode - @param streamDictionary the dictionary that contains filter information - @return the decoded bytes - @throws IOException if there are any problems decoding the bytes - @since 5.0.4 - - - Decode a byte[] applying the filters specified in the provided dictionary using the provided filter handlers. - @param b the bytes to decode - @param streamDictionary the dictionary that contains filter information - @param filterHandlers the map used to look up a handler for each type of filter - @return the decoded bytes - @throws IOException if there are any problems decoding the bytes - @since 5.0.4 - - - Get the content from a stream applying the required filters. - @param stream the stream - @param file the location where the stream is - @throws IOException on error - @return the stream content - - - Get the content from a stream applying the required filters. - @param stream the stream - @throws IOException on error - @return the stream content - - - Get the content from a stream as it is without applying any filter. - @param stream the stream - @param file the location where the stream is - @throws IOException on error - @return the stream content - - - Get the content from a stream as it is without applying any filter. - @param stream the stream - @throws IOException on error - @return the stream content - - - Eliminates shared streams if they exist. - - - Sets the tampered state. A tampered PdfReader cannot be reused in PdfStamper. - @param tampered the tampered state - - - Gets the XML metadata. - @throws IOException on error - @return the XML metadata - - - Gets the byte address of the last xref table. - @return the byte address of the last xref table - - - Gets the number of xref objects. - @return the number of xref objects - - - Gets the byte address of the %%EOF marker. - @return the byte address of the %%EOF marker - - - Gets the PDF version. Only the last version char is returned. For example - version 1.4 is returned as '4'. - @return the PDF version - - - Returns true if the PDF is encrypted. - @return true if the PDF is encrypted - - - Gets the encryption permissions. It can be used directly in - PdfWriter.SetEncryption(). - @return the encryption permissions - - - Returns true if the PDF has a 128 bit key encryption. - @return true if the PDF has a 128 bit key encryption - - - Gets the trailer dictionary - @return the trailer dictionary - - - Finds all the font subsets and changes the prefixes to some - random values. - @return the number of font subsets altered - - - Finds all the fonts not subset but embedded and marks them as subset. - @return the number of fonts altered - - - Gets all the named destinations as an Hashtable. The key is the name - and the value is the destinations array. - @return gets all the named destinations - - - Gets all the named destinations as an HashMap. The key is the name - and the value is the destinations array. - @param keepNames true if you want the keys to be real PdfNames instead of Strings - @return gets all the named destinations - @since 2.1.6 - - - Gets the named destinations from the /Dests key in the catalog as an Hashtable. The key is the name - and the value is the destinations array. - @return gets the named destinations - - - Gets the named destinations from the /Dests key in the catalog as an HashMap. The key is the name - and the value is the destinations array. - @param keepNames true if you want the keys to be real PdfNames instead of Strings - @return gets the named destinations - @since 2.1.6 - - - Gets the named destinations from the /Names key in the catalog as an Hashtable. The key is the name - and the value is the destinations array. - @return gets the named destinations - - - Removes all the fields from the document. - - - Removes all the annotations and fields from the document. - - - Replaces remote named links with local destinations that have the same name. - @since 5.0 - - - Converts a remote named destination GoToR with a local named destination - if there's a corresponding name. - @param obj an annotation that needs to be screened for links to external named destinations. - @param names a map with names of local named destinations - @since iText 5.0 - - - Replaces all the local named links with the actual destinations. - - - Closes the reader, and any underlying stream or data source used to create the reader - - - Removes all the unreachable objects. - @return the number of indirect objects removed - - - Gets a read-only version of AcroFields. - @return a read-only version of AcroFields - - - Gets the global document JavaScript. - @param file the document file - @throws IOException on error - @return the global document JavaScript - - - Gets the global document JavaScript. - @throws IOException on error - @return the global document JavaScript - - - Selects the pages to keep in the document. The pages are described as - ranges. The page ordering can be changed but - no page repetitions are allowed. Note that it may be very slow in partial mode. - @param ranges the comma separated ranges as described in {@link SequenceList} - - - Selects the pages to keep in the document. The pages are described as a - List of Integer. The page ordering can be changed but - no page repetitions are allowed. Note that it may be very slow in partial mode. - @param pagesToKeep the pages to keep in the document - - - Selects the pages to keep in the document. The pages are described as a - List of Integer. The page ordering can be changed but - no page repetitions are allowed. Note that it may be very slow in partial mode. - @param pagesToKeep the pages to keep in the document - @param removeUnused indicate if to remove unsed objects. @see removeUnusedObjects - - - Sets the viewer preferences as the sum of several constants. - @param preferences the viewer preferences - @see PdfViewerPreferences#setViewerPreferences - - - Adds a viewer preference - @param key a key for a viewer preference - @param value a value for the viewer preference - @see PdfViewerPreferences#addViewerPreference - - - Returns a bitset representing the PageMode and PageLayout viewer preferences. - Doesn't return any information about the ViewerPreferences dictionary. - @return an int that contains the Viewer Preferences. - - - Getter for property newXrefType. - @return Value of property newXrefType. - - - Getter for property fileLength. - @return Value of property fileLength. - - - Getter for property hybridXref. - @return Value of property hybridXref. - - - Keeps track of all pages nodes to avoid circular references. - - - Gets the dictionary that represents a page. - @param pageNum the page number. 1 is the first - @return the page dictionary - - - @param pageNum - @return a dictionary object - - - @param pageNum - @return an indirect reference - - - Gets the page reference to this page. - @param pageNum the page number. 1 is the first - @return the page reference - - - @param pageNum - - - - - - Checks if this PDF has usage rights enabled. - - @return true if usage rights are present; false otherwise - - - Removes any usage rights that this PDF may have. Only Adobe can grant usage rights - and any PDF modification with iText will invalidate them. Invalidated usage rights may - confuse Acrobat and it's advisabe to remove them altogether. - - - Gets the certification level for this document. The return values can be PdfSignatureAppearance.NOT_CERTIFIED, - PdfSignatureAppearance.CERTIFIED_NO_CHANGES_ALLOWED, - PdfSignatureAppearance.CERTIFIED_FORM_FILLING and - PdfSignatureAppearance.CERTIFIED_FORM_FILLING_AND_ANNOTATIONS. -

    - No signature validation is made, use the methods availabe for that in AcroFields. -

    - @return gets the certification level for this document -
    - - Checks if the document was opened with the owner password so that the end application - can decide what level of access restrictions to apply. If the document is not encrypted - it will return true. - @return true if the document was opened with the owner password or if it's not encrypted, - false if the document was opened with the user password - - - Computes user password if standard encryption handler is used with Standard40, Standard128 or AES128 encryption algorithm. - - @return user password, or null if not a standard encryption handler was used, - if standard encryption handler was used with AES256 encryption algorithm, - or if ownerPasswordUsed wasn't use to open the document. - - - Instance of PdfReader in each output document. - - @author Paulo Soares - - - Gets the content stream of a page as a PdfStream object. - @param pageNumber the page of which you want the stream - @param compressionLevel the compression level you want to apply to the stream - @return a PdfStream object - @since 2.1.3 (the method already existed without param compressionLevel) - - - - lower left x - - - lower left y - - - upper right x - - - upper right y - - - Constructs a PdfRectangle-object. - - @param llx lower left x - @param lly lower left y - @param urx upper right x - @param ury upper right y - - @since rugPdf0.10 - - - Constructs a PdfRectangle-object starting from the origin (0, 0). - - @param urx upper right x - @param ury upper right y - - - Constructs a PdfRectangle-object with a Rectangle-object. - - @param rectangle a Rectangle - - - Returns the high level version of this PdfRectangle - @return this PdfRectangle translated to class Rectangle - - - Overrides the add-method in PdfArray in order to prevent the adding of extra object to the array. - - @param object PdfObject to add (will not be added here) - @return false - - - Block changes to the underlying PdfArray - @param values stuff we'll ignore. Ha! - @return false. You can't add anything to a PdfRectangle - @since 2.1.5 - - - Block changes to the underlying PdfArray - @param values stuff we'll ignore. Ha! - @return false. You can't add anything to a PdfRectangle - @since 2.1.5 - - - Block changes to the underlying PdfArray - @param object Ignored. - @since 2.1.5 - - - Returns the lower left x-coordinate. - - @return the lower left x-coordinaat - - - Returns the upper right x-coordinate. - - @return the upper right x-coordinate - - - Returns the upper right y-coordinate. - - @return the upper right y-coordinate - - - Returns the lower left y-coordinate. - - @return the lower left y-coordinate - - - Returns the lower left x-coordinate, considering a given margin. - - @param margin a margin - @return the lower left x-coordinate - - - Returns the upper right x-coordinate, considering a given margin. - - @param margin a margin - @return the upper right x-coordinate - - - Returns the upper right y-coordinate, considering a given margin. - - @param margin a margin - @return the upper right y-coordinate - - - Returns the lower left y-coordinate, considering a given margin. - - @param margin a margin - @return the lower left y-coordinate - - - Returns the width of the rectangle. - - @return a width - - - Returns the height of the rectangle. - - @return a height - - - Swaps the values of urx and ury and of lly and llx in order to rotate the rectangle. - - @return a PdfRectangle - - - A Rendition dictionary (pdf spec 1.5) - - - - Constructs a PDF ResourcesDictionary. - - - Implements the shading dictionary (or stream). - - @author Paulo Soares - - - Holds value of property bBox. - - - Holds value of property antiAlias. - - - Creates new PdfShading - - - Implements the shading pattern dictionary. - - @author Paulo Soares - - - Creates new PdfShadingPattern - - - Implements the signature dictionary. - - @author Paulo Soares - - - Creates new PdfSignature - - - Sets the signature creator name in the - {@link PdfSignatureBuildProperties} dictionary. - - @param name - - - Gets the {@link PdfSignatureBuildProperties} instance if it exists, if - not it adds a new one and returns this. - - @return {@link PdfSignatureBuildProperties} - - - Class that takes care of the cryptographic options - and appearances that form a signature. - - - Constructs a PdfSignatureAppearance object. - @param writer the writer to which the signature will be written. - - - Approval signature - - - Author signature, no changes allowed - - - Author signature, form filling allowed - - - Author signature, form filling and annotations allowed - - - The certification level - - - Sets the document type to certified instead of simply signed. - @param certificationLevel the values can be: NOT_CERTIFIED, CERTIFIED_NO_CHANGES_ALLOWED, - CERTIFIED_FORM_FILLING and CERTIFIED_FORM_FILLING_AND_ANNOTATIONS - - - The caption for the reason for signing. - - - The caption for the location of signing. - - - The reason for signing. - - - Holds value of property location. - - - Holds value of property signDate. - - - Gets and setsthe signing reason. - @return the signing reason - - - Sets the caption for signing reason. - @param reasonCaption the signing reason caption - - - Gets and sets the signing location. - @return the signing location - - - Sets the caption for the signing location. - @param locationCaption the signing location caption - - - Holds value of the application that creates the signature - - - Gets the signature creator. - @return the signature creator - - Sets the name of the application used to create the signature. - @param signatureCreator the name of the signature creating application - - - The contact name of the signer. - - - Gets the signing contact. - @return the signing contact - - - Gets the signature date. - @return the signature date - - - The file right before the signature is added (can be null). - - - The bytes of the file right before the signature is added (if raf is null) - - - Array containing the byte positions of the bytes that need to be hashed. - - - - @return the underlying source - @throws IOException - - - The signing certificate - - - Adds the appropriate developer extension. - - - The crypto dictionary - - - Gets the user made signature dictionary. This is the dictionary at the /V key. - @return the user made signature dictionary - - - Sets the certificate used to provide the text in the appearance. - This certificate doesn't take part in the actual signing process. - @param signCertificate the certificate - - - An interface to retrieve the signature dictionary for modification. - - - Allows modification of the signature dictionary. - @param sig the signature dictionary - - - Holds value of property signatureEvent. - - - Sets the signature event to allow modification of the signature dictionary. - @param signatureEvent the signature event - - - The name of the field - - - Gets the field name. - @return the field name - - - Gets a new signature field name that - doesn't clash with any existing name. - @return a new signature field name - - - The page where the signature will appear. - - - Gets the page number of the field. - @return the page number of the field - - - The coordinates of the rectangle for a visible signature, - or a zero-width, zero-height rectangle for an invisible signature. - - - Gets the rectangle representing the signature dimensions. - @return the rectangle representing the signature dimensions. It may be null - or have zero width or height for invisible signatures - - - rectangle that represent the position and dimension of the signature in the page. - - - Gets the rectangle that represent the position and dimension of the signature in the page. - @return the rectangle that represent the position and dimension of the signature in the page - - - Gets the visibility status of the signature. - @return the visibility status of the signature - - - Sets the signature to be visible. It creates a new visible signature field. - @param pageRect the position and dimension of the field in the page - @param page the page to place the field. The fist page is 1 - @param fieldName the field name or null to generate automatically a new field name - - - Sets the signature to be visible. An empty signature field with the same name must already exist. - @param fieldName the existing empty signature field name - - - Signature rendering modes - @since 5.0.1 - - - The rendering mode is just the description. - - - The rendering mode is the name of the signer and the description. - - - The rendering mode is an image and the description. - - - The rendering mode is just an image. - - - The rendering mode chosen for visible signatures - - - Gets the rendering mode for this signature. - @return the rendering mode for this signature - @since 5.0.1 - - - The image that needs to be used for a visible signature - - - Sets the Image object to render when Render is set to RenderingMode.GRAPHIC - or RenderingMode.GRAPHIC_AND_DESCRIPTION. - @param signatureGraphic image rendered. If null the mode is defaulted - to RenderingMode.DESCRIPTION - - - Appearance compliant with the recommendations introduced in Acrobat 6? - - - Acrobat 6.0 and higher recommends that only layer n0 and n2 be present. - Use this method with value false if you want to ignore this recommendation. - @param acro6Layers if true only the layers n0 and n2 will be present - @deprecated Adobe no longer supports Adobe Acrobat / Reader versions older than 9 - - - Layers for a visible signature. - - - - Indicates if we need to reuse the existing appearance as layer 0. - - - Indicates that the existing appearances needs to be reused as layer 0. - - - An appearance that can be used for layer 1 (if acro6Layers is false). - - - A background image for the text in layer 2. - - - Gets the background image for the layer 2. - @return the background image for the layer 2 - - - the scaling to be applied to the background image.t - - - Sets the scaling to be applied to the background image. If it's zero the image - will fully fill the rectangle. If it's less than zero the image will fill the rectangle but - will keep the proportions. If it's greater than zero that scaling will be applied. - In any of the cases the image will always be centered. It's zero by default. - @param imageScale the scaling to be applied to the background image - - - The text that goes in Layer 2 of the signature appearance. - - - Sets the signature text identifying the signer. - @param text the signature text identifying the signer. If null or not set - a standard description will be used - - - Font for the text in Layer 2. - - - Sets the n2 and n4 layer font. If the font size is zero, auto-fit will be used. - @param layer2Font the n2 and n4 font - - - Run direction for the text in layers 2 and 4. - - - Sets the run direction in the n2 and n4 layer. - @param runDirection the run direction - - - The text that goes in Layer 4 of the appearance. - - - Sets the text identifying the signature status. Will be ignored if acro6Layers is true. - @param text the text identifying the signature status. If null or not set - the description "Signature Not Verified" will be used - - - Template containing all layers drawn on top of each other. - - - - extra space at the top. - - - margin for the content inside the signature rectangle. - - - - The PdfStamper that creates the signed PDF. - - - Gets the PdfStamper associated with this instance. - @return the PdfStamper associated with this instance - - - Sets the PdfStamper - @param stamper PdfStamper - - - The PdfStamperImp object corresponding with the stamper. - - - A byte buffer containing the bytes of the Stamper. - - - Getter for the byte buffer. - - - OutputStream for the bytes of the stamper. - - - Temporary file in case you don't want to sign in memory. - - - Gets the temporary file. - @return the temporary file or null is the document is created in memory - - - Name and content of keys that can only be added in the close() method. - - - Length of the output. - - - Indicates if the stamper has already been pre-closed. - - - - Signature field lock dictionary. - - - - - Signature field lock dictionary. - - - If a signature is created on an existing signature field, then its /Lock dictionary - takes the precedence (if it exists). - - - - Checks if the document is in the process of closing. - @return true if the document is in the process of closing, - false otherwise - - - - Adds keys to the signature dictionary that define - the certification level and the permissions. - This method is only used for Certifying signatures. - @param crypto the signature dictionary - - - Adds keys to the signature dictionary that define - the field permissions. - This method is only used for signatures that lock fields. - @param crypto the signature dictionary - - - - PdfSmartCopy has the same functionality as PdfCopy, - but when resources (such as fonts, images,...) are - encountered, a reference to these resources is saved - in a cache, so that they can be reused. - This requires more memory, but reduces the file size - of the resulting PDF document. - - - the cache with the streams and references. - - - Creates a PdfSmartCopy instance. - - - Translate a PRIndirectReference to a PdfIndirectReference - In addition, translates the object numbers, and copies the - referenced object to the output file if it wasn't available - in the cache yet. If it's in the cache, the reference to - the already used stream is returned. - - NB: PRIndirectReferences (and PRIndirectObjects) really need to know what - file they came from, because each file has its own namespace. The translation - we do from their namespace to ours is *at best* heuristic, and guaranteed to - fail under some circumstances. - - - A PdfSpotColor defines a ColorSpace - - @see PdfDictionary - - - Constructs a new PdfSpotColor. - - @param name a string value - @param tint a tint value between 0 and 1 - @param altcs a altnative colorspace value - - - - The writer - - - - - - Gets the optional String map to add or change values in - the info dictionary. - @return the map or null - - An optional String map to add or change values in - the info dictionary. Entries with null - values delete the key in the original info dictionary - @param moreInfo additional entries to the info dictionary - - - - Replaces a page from this document with a page from other document. Only the content - is replaced not the fields and annotations. This method must be called before - getOverContent() or getUndercontent() are called for the same page. - @param r the PdfReader from where the new page will be imported - @param pageImported the page number of the imported page - @param pageReplaced the page to replace in this document - - - Inserts a blank page. All the pages above and including pageNumber will - be shifted up. If pageNumber is bigger than the total number of pages - the new page will be the last one. - @param pageNumber the page number position where the new page will be inserted - @param mediabox the size of the new page - - - Gets the signing instance. The appearances and other parameters can the be set. - @return the signing instance - - - Gets the xml signing instance. The appearances and other parameters can the be set. - @return the signing instance - - - - Gets a PdfContentByte to write under the page of - the original document. - @param pageNum the page number where the extra content is written - @return a PdfContentByte to write under the page of - the original document - - - Gets a PdfContentByte to write over the page of - the original document. - @param pageNum the page number where the extra content is written - @return a PdfContentByte to write over the page of - the original document - - - Checks if the content is automatically adjusted to compensate - the original page rotation. - @return the auto-rotation status - Flags the content to be automatically adjusted to compensate - the original page rotation. The default is true. - @param rotateContents true to set auto-rotation, false - otherwise - - - Sets the encryption options for this document. The userPassword and the - ownerPassword can be null or have zero length. In this case the ownerPassword - is replaced by a random string. The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - @param userPassword the user password. Can be null or empty - @param ownerPassword the owner password. Can be null or empty - @param permissions the user permissions - @param strength128Bits true for 128 bit key length, false for 40 bit key length - @throws DocumentException if anything was already written to the output - - - Sets the encryption options for this document. The userPassword and the - ownerPassword can be null or have zero length. In this case the ownerPassword - is replaced by a random string. The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - @param userPassword the user password. Can be null or empty - @param ownerPassword the owner password. Can be null or empty - @param permissions the user permissions - @param encryptionType the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128. - Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext - @throws DocumentException if the document is already open - - - Sets the encryption options for this document. The userPassword and the - ownerPassword can be null or have zero length. In this case the ownerPassword - is replaced by a random string. The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - @param strength true for 128 bit key length, false for 40 bit key length - @param userPassword the user password. Can be null or empty - @param ownerPassword the owner password. Can be null or empty - @param permissions the user permissions - @throws DocumentException if anything was already written to the output - - - Sets the encryption options for this document. The userPassword and the - ownerPassword can be null or have zero length. In this case the ownerPassword - is replaced by a random string. The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - @param encryptionType the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128. - Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext - @param userPassword the user password. Can be null or empty - @param ownerPassword the owner password. Can be null or empty - @param permissions the user permissions - @throws DocumentException if the document is already open - - - Sets the certificate encryption options for this document. An array of one or more public certificates - must be provided together with an array of the same size for the permissions for each certificate. - The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext - @param certs the public certificates to be used for the encryption - @param permissions the user permissions for each of the certicates - @param encryptionType the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128. - @throws DocumentException if the encryption was set too late - - - Gets a page from other PDF document. Note that calling this method more than - once with the same parameters will retrieve the same object. - @param reader the PDF document where the page is - @param pageNumber the page number. The first page is 1 - @return the template representing the imported page - - - Gets the underlying PdfWriter. - @return the underlying PdfWriter - - - Gets the underlying PdfReader. - @return the underlying PdfReader - - - Gets the AcroFields object that allows to get and set field values - and to merge FDF forms. - @return the AcroFields object - - - Determines if the fields are flattened on close. The fields added with - {@link #addAnnotation(PdfAnnotation,int)} will never be flattened. - @param flat true to flatten the fields, false - to keep the fields - - - Determines if the FreeText annotations are flattened on close. - @param flat true to flatten the FreeText annotations, false - (the default) to keep the FreeText annotations as active content. - - - Flatten annotations with an appearance stream on close(). - - @param flat boolean to indicate whether iText should flatten annotations or not. - - - Adds an annotation of form field in a specific page. This page number - can be overridden with {@link PdfAnnotation#setPlaceInPage(int)}. - @param annot the annotation - @param page the page - - - Adds an empty signature. - @param name the name of the signature - @param page the page number - @param llx lower left x coordinate of the signature's position - @param lly lower left y coordinate of the signature's position - @param urx upper right x coordinate of the signature's position - @param ury upper right y coordinate of the signature's position - @return a signature form field - @since 2.1.4 - - - Adds the comments present in an FDF file. - @param fdf the FDF file - @throws IOException on error - - - Sets the bookmarks. The list structure is defined in - {@link SimpleBookmark}. - @param outlines the bookmarks or null to remove any - - - Sets the thumbnail image for a page. - @param image the image - @param page the page - @throws PdfException on error - @throws DocumentException on error - - - - Adds a JavaScript action at the document level. When the document - opens all this JavaScript runs. The existing JavaScript will be replaced. - @param js the JavaScript code - - - Adds a JavaScript action at the document level. When the document - opens all this JavaScript runs. The existing JavaScript will be replaced. - @param name the name for the JavaScript snippet in the name tree - @param js the JavaScript code - - - Adds a file attachment at the document level. Existing attachments will be kept. - @param description the file description - @param fileStore an array with the file. If it's null - the file will be read from the disk - @param file the path to the file. It will only be used if - fileStore is not null - @param fileDisplay the actual file name stored in the pdf - @throws IOException on error - - - Adds a file attachment at the document level. Existing attachments will be kept. - @param description the file description - @param fs the file specification - - - - Adds or replaces the Collection Dictionary in the Catalog. - @param collection the new collection dictionary. - - - Sets the viewer preferences. - @param preferences the viewer preferences - @see PdfViewerPreferences#setViewerPreferences(int) - - - Adds a viewer preference - @param preferences the viewer preferences - @see PdfViewerPreferences#addViewerPreference - - - Sets the XMP metadata. - @param xmp - @see PdfWriter#setXmpMetadata(byte[]) - - - Gets the 1.5 compression status. - @return true if the 1.5 compression is on - - - Sets the document's compression to the new 1.5 mode with object streams and xref - streams. Be attentive!!! If you want set full compression , you should set immediately after creating PdfStamper, - before editing the document.It can be set once and it can't be unset. - - - Sets the open and close page additional action. - @param actionType the action type. It can be PdfWriter.PAGE_OPEN - or PdfWriter.PAGE_CLOSE - @param action the action to perform - @param page the page where the action will be applied. The first page is 1 - @throws PdfException if the action type is invalid - - - Sets the display duration for the page (for presentations) - @param seconds the number of seconds to display the page. A negative value removes the entry - @param page the page where the duration will be applied. The first page is 1 - - - Sets the transition for the page - @param transition the transition object. A null removes the transition - @param page the page where the transition will be applied. The first page is 1 - - - - - - Gets the PdfLayer objects in an existing document as a Map - with the names/titles of the layers as keys. - @return a Map with all the PdfLayers in the document (and the name/title of the layer as key) - @since 2.1.2 - - - Integer(page number) -> PageStamp - - - Holds value of property rotateContents. - - - Creates new PdfStamperImp. - @param reader the read PDF - @param os the output destination - @param pdfVersion the new pdf version or '\0' to keep the same version as the original - document - @param append - @throws DocumentException on error - @throws IOException - - - @param reader - @param openFile - @throws IOException - - - @param reader - - - @param fdf - @throws IOException - - - If true, annotations with an appearance stream will be flattened. - - @since 5.5.3 - @param flatAnnotations boolean - - - @see com.lowagie.text.pdf.PdfWriter#getPageReference(int) - - - @see com.lowagie.text.pdf.PdfWriter#addAnnotation(com.lowagie.text.pdf.PdfAnnotation) - - - Adds or replaces the Collection Dictionary in the Catalog. - @param collection the new collection dictionary. - - - Sets the viewer preferences. - @param preferences the viewer preferences - @see PdfWriter#setViewerPreferences(int) - - - Adds a viewer preference - @param preferences the viewer preferences - @see PdfViewerPreferences#addViewerPreference - - - Set the signature flags. - @param f the flags. This flags are ORed with current ones - - - Always throws an UnsupportedOperationException. - @param actionType ignore - @param action ignore - @throws PdfException ignore - @see PdfStamper#setPageAction(PdfName, PdfAction, int) - - - Sets the open and close page additional action. - @param actionType the action type. It can be PdfWriter.PAGE_OPEN - or PdfWriter.PAGE_CLOSE - @param action the action to perform - @param page the page where the action will be applied. The first page is 1 - @throws PdfException if the action type is invalid - - - Always throws an UnsupportedOperationException. - @param seconds ignore - - - Always throws an UnsupportedOperationException. - @param transition ignore - - - Sets the display duration for the page (for presentations) - @param seconds the number of seconds to display the page. A negative value removes the entry - @param page the page where the duration will be applied. The first page is 1 - - - Sets the transition for the page - @param transition the transition object. A null removes the transition - @param page the page where the transition will be applied. The first page is 1 - - - Getter for property append. - @return Value of property append. - - - Additional-actions defining the actions to be taken in - response to various trigger events affecting the document - as a whole. The actions types allowed are: DOCUMENT_CLOSE, - WILL_SAVE, DID_SAVE, WILL_PRINT - and DID_PRINT. - - @param actionType the action type - @param action the action to execute in response to the trigger - @throws PdfException on invalid action type - - - @see com.lowagie.text.pdf.PdfWriter#setOpenAction(com.lowagie.text.pdf.PdfAction) - - - @see com.lowagie.text.pdf.PdfWriter#setOpenAction(java.lang.String) - - - @see com.lowagie.text.pdf.PdfWriter#setThumbnail(com.lowagie.text.Image) - - - Reads the OCProperties dictionary from the catalog of the existing document - and fills the documentOCG, documentOCGorder and OCGRadioGroup variables in PdfWriter. - Note that the original OCProperties of the existing document can contain more information. - @since 2.1.2 - - - Recursive method to reconstruct the documentOCGorder variable in the writer. - @param parent a parent PdfLayer (can be null) - @param arr an array possibly containing children for the parent PdfLayer - @param ocgmap a Hashtable with indirect reference Strings as keys and PdfLayer objects as values. - @since 2.1.2 - - - Gets the PdfLayer objects in an existing document as a Map - with the names/titles of the layers as keys. - @return a Map with all the PdfLayers in the document (and the name/title of the layer as key) - @since 2.1.2 - - - - A possible compression level. - @since 2.1.3 - - - A possible compression level. - @since 2.1.3 - - - A possible compression level. - @since 2.1.3 - - - A possible compression level. - @since 2.1.3 - - - is the stream compressed? - - - The level of compression. - @since 2.1.3 - - - Constructs a PdfStream-object. - - @param bytes content of the new PdfObject as an array of byte. - - - Creates an efficient stream. No temporary array is ever created. The InputStream - is totally consumed but is not closed. The general usage is: -
    -            InputStream in = ...;
    -            PdfStream stream = new PdfStream(in, writer);
    -            stream.FlateCompress();
    -            writer.AddToBody(stream);
    -            stream.WriteLength();
    -            in.Close();
    -            
    - @param inputStream the data to write to this stream - @param writer the PdfWriter for this stream -
    - - Constructs a PdfStream-object. - - - Writes the stream length to the PdfWriter. -

    - This method must be called and can only be called if the contructor {@link #PdfStream(InputStream,PdfWriter)} - is used to create the stream. -

    - @throws IOException on error - @see #PdfStream(InputStream,PdfWriter) -
    - - Compresses the stream. - - - Compresses the stream. - @param compressionLevel the compression level (0 = best speed, 9 = best compression, -1 is default) - @since 2.1.3 - - - Writes the data content to an Stream. - @param os the destination to write to - @throws IOException on error - - - @see com.lowagie.text.pdf.PdfObject#toString() - - - - The value of this object. - - - The encoding. - - - Constructs an empty PdfString-object. - - - Constructs a PdfString-object. - - @param value the content of the string - - - Constructs a PdfString-object. - - @param value the content of the string - @param encoding an encoding - - - Constructs a PdfString-object. - - @param bytes an array of byte - - - Returns the PDF representation of this PdfString. - - @return an array of bytes - - - Returns the string value of the PdfString-object. - - @return a string - - - Gets the encoding of this string. - - @return a string - - - This is a node in a document logical structure. It may contain a mark point or it may contain - other nodes. - @author Paulo Soares - - - Holds value of property kids. - - - Holds value of property reference. - - - Creates a new instance of PdfStructureElement. - @param parent the parent of this node - @param structureType the type of structure. It may be a standard type or a user type mapped by the role map - - - Creates a new instance of PdfStructureElement. - @param root the structure tree root - @param structureType the type of structure. It may be a standard type or a user type mapped by the role map - - - Gets the parent of this node. - @return the parent of this node - - - Gets the reference this object will be written to. - @return the reference this object will be written to - - - Gets the first entarance of attribute. - @returns PdfObject - @since 5.3.4 - - - Sets the attribute value. - @since 5.3.4 - - - The structure tree root corresponds to the highest hierarchy level in a tagged PDF. - @author Paulo Soares - - - Holds value of property writer. - - - Creates a new instance of PdfStructureTreeRoot - - - Maps the user tags to the standard tags. The mapping will allow a standard application to make some sense of the tagged - document whatever the user tags may be. - @param used the user tag - @param standard the standard tag - - - Gets the writer. - @return the writer - - - Gets the reference this object will be written to. - @return the reference this object will be written to - - - Gets the first entarance of attribute. - @returns PdfObject - @since 5.3.4 - - - Sets the attribute value. - @since 5.3.4 - - - Implements the form XObject. - - - The indirect reference to this template - - - The resources used by this template - - - The bounding box of this template - - - A dictionary with additional information - @since 5.1.0 - - - Creates a PdfTemplate. - - - Creates new PdfTemplate - - @param wr the PdfWriter - - - - Gets the bounding width of this template. - - @return width the bounding width - - - Gets the bounding heigth of this template. - - @return heigth the bounding height - - - Gets the layer this template belongs to. - @return the layer this template belongs to or null for no layer defined - - - Gets the indirect reference to this template. - - @return the indirect reference to this template - - - Constructs the resources used by this template. - - @return the resources used by this template - - - Gets the stream representing this template. - - @param compressionLevel the compressionLevel - @return the stream representing this template - @since 2.1.3 (replacing the method without param compressionLevel) - - - Gets a duplicate of this PdfTemplate. All - the members are copied by reference but the buffer stays different. - @return a copy of this PdfTemplate - - - Sets/gets a dictionary with extra entries, for instance /Measure. - - @param additional - a PdfDictionary with additional information. - @since 5.1.0 - - - - Adds a PdfNumber to the PdfArray. - - @param number displacement of the string - - - Out Vertical Split - - - Out Horizontal Split - - - In Vertical Split - - - IN Horizontal Split - - - Vertical Blinds - - - Vertical Blinds - - - Inward Box - - - Outward Box - - - Left-Right Wipe - - - Right-Left Wipe - - - Bottom-Top Wipe - - - Top-Bottom Wipe - - - Dissolve - - - Left-Right Glitter - - - Top-Bottom Glitter - - - Diagonal Glitter - - - duration of the transition effect - - - type of the transition effect - - - Constructs a Transition. - - - - Constructs a Transition. - - @param type type of the transition effect - - - Constructs a Transition. - - @param type type of the transition effect - @param duration duration of the transition effect - - - The transparency group dictionary. - - @author Paulo Soares - - - Constructs a transparencyGroup. - - - Determining the initial backdrop against which its stack is composited. - @param isolated - - - Determining whether the objects within the stack are composited with one another or only with the group's backdrop. - @param knockout - - - An array specifying a visibility expression, used to compute visibility - of content based on a set of optional content groups. - @since 5.0.2 - - - A boolean operator. - - - A boolean operator. - - - A boolean operator. - - - Creates a visibility expression. - @param type should be AND, OR, or NOT - - - @see com.itextpdf.text.pdf.PdfArray#add(int, com.itextpdf.text.pdf.PdfObject) - - - @see com.itextpdf.text.pdf.PdfArray#add(com.itextpdf.text.pdf.PdfObject) - - - @see com.itextpdf.text.pdf.PdfArray#addFirst(com.itextpdf.text.pdf.PdfObject) - - - @see com.itextpdf.text.pdf.PdfArray#add(float[]) - - - @see com.itextpdf.text.pdf.PdfArray#add(int[]) - - - A DocWriter class for PDF. -

    - When this PdfWriter is added - to a certain PdfDocument, the PDF representation of every Element - added to this Document will be written to the outputstream.

    -
    - - The highest generation number possible. - @since iText 2.1.6 - - - - PdfCrossReference is an entry in the PDF Cross-Reference table. - - - Byte offset in the PDF file. - - - generation of the object. - - - Constructs a cross-reference element for a PdfIndirectObject. - @param refnum - @param offset byte offset of the object - @param generation generationnumber of the object - - - Constructs a cross-reference element for a PdfIndirectObject. - @param refnum - @param offset byte offset of the object - - - Returns the PDF representation of this PdfObject. - @param os - @throws IOException - - - Writes PDF syntax to the Stream - @param midSize - @param os - @throws IOException - - - @see java.lang.Comparable#compareTo(java.lang.Object) - - - @see java.lang.Object#equals(java.lang.Object) - - - array containing the cross-reference table of the normal objects. - - - the current byteposition in the body. - - - Constructs a new PdfBody. - @param writer - - - - Gets a PdfIndirectReference for an object that will be created in the future. - @return a PdfIndirectReference - - - - Returns the offset of the Cross-Reference table. - - @return an offset - - - Returns the total number of objects contained in the CrossReferenceTable of this Body. - - @return a number of objects - - - Returns the CrossReferenceTable of the Body. - @param os - @param root - @param info - @param encryption - @param fileID - @param prevxref - @throws IOException - - - - Constructs a PDF-Trailer. - - @param size the number of entries in the PdfCrossReferenceTable - @param offset offset of the PdfCrossReferenceTable - @param root an indirect reference to the root of the PDF document - @param info an indirect reference to the info object of the PDF document - @param encryption - @param fileID - @param prevxref - - - Returns the PDF representation of this PdfObject. - @param writer - @param os - @throws IOException - - - Constructs a PdfWriter. - - - - Use this method to get an instance of the PdfWriter. - - @param document The Document that has to be written - @param os The Stream the writer has to write to. - @return a new PdfWriter - - @throws DocumentException on error - - - Use this method to get an instance of the PdfWriter. - - @return a new PdfWriter - @param document The Document that has to be written - @param os The Stream the writer has to write to. - @param listener A DocListener to pass to the PdfDocument. - @throws DocumentException on error - - - the pdfdocument object. - - - Gets the PdfDocument associated with this writer. - @return the PdfDocument - - - Use this method to get the info dictionary if you want to - change it directly (add keys and values to the info dictionary). - @return the info dictionary - - - Use this method to get the current vertical page position. - @param ensureNewLine Tells whether a new line shall be enforced. This may cause side effects - for elements that do not terminate the lines they've started because those lines will get - terminated. - @return The current vertical page position. - - - Sets the initial leading for the PDF document. - This has to be done before the document is opened. - @param leading the initial leading - @since 2.1.6 - @throws DocumentException if you try setting the leading after the document was opened. - - - The direct content in this document. - - - The direct content under in this document. - - - Use this method to get the direct content for this document. - There is only one direct content, multiple calls to this method - will allways retrieve the same object. - @return the direct content - - - Use this method to get the direct content under for this document. - There is only one direct content, multiple calls to this method - will allways retrieve the same object. - @return the direct content - - - Resets all the direct contents to empty. - This happens when a new page is started. - - - body of the PDF document - - - Adds the local destinations to the body of the document. - @param dest the Hashtable containing the destinations - @throws IOException on error - - - Adds an object to the PDF body. - @param object - @return a PdfIndirectObject - @throws IOException - - - Adds an object to the PDF body. - @param object - @param inObjStm - @return a PdfIndirectObject - @throws IOException - - - Adds an object to the PDF body. - @param object - @param ref - @return a PdfIndirectObject - @throws IOException - - - Adds an object to the PDF body. - @param object - @param ref - @param inObjStm - @return a PdfIndirectObject - @throws IOException - - - Adds an object to the PDF body. - @param object - @param refNumber - @return a PdfIndirectObject - @throws IOException - - - Adds an object to the PDF body. - @param object - @param refNumber - @param inObjStm - @return a PdfIndirectObject - @throws IOException - - - Use this method for caching objects. - @param iobj @see PdfIndirectObject - - - Gets a PdfIndirectReference for an object that - will be created in the future. - @return the PdfIndirectReference - - - Returns the outputStreamCounter. - @return the outputStreamCounter - - - Holds value of property extraCatalog. - - - Sets extra keys to the catalog. - @return the catalog to change - - - The root of the page tree. - - - The PdfIndirectReference to the pages. - - - The current page number. - - - The value of the Tabs entry in the page dictionary. - @since 2.1.5 - - - Additional page dictionary entries. - @since 5.1.0 - - - Adds an additional entry for the page dictionary. - @since 5.1.0 - - - Gets the additional pageDictEntries. - @since 5.1.0 - - - Resets the additional pageDictEntries. - @since 5.1.0 - - - Use this method to make sure the page tree has a lineair structure - (every leave is attached directly to the root). - Use this method to allow page reordering with method reorderPages. - - - Use this method to reorder the pages in the document. - A null argument value only returns the number of pages to process. - It is advisable to issue a Document.NewPage() before using this method. - @return the total number of pages - @param order an array with the new page sequence. It must have the - same size as the number of pages. - @throws DocumentException if all the pages are not present in the array - - - Use this method to get a reference to a page existing or not. - If the page does not exist yet the reference will be created - in advance. If on closing the document, a page number greater - than the total number of pages was requested, an exception - is thrown. - @param page the page number. The first page is 1 - @return the reference to the page - - - Gets the pagenumber of this document. - This number can be different from the real pagenumber, - if you have (re)set the page number previously. - @return a page number - - - Sets the Viewport for the next page. - @param viewport an array consisting of Viewport dictionaries. - @since 5.1.0 - - - Sets the value for the Tabs entry in the page tree. - @param tabs Can be PdfName.R, PdfName.C or PdfName.S. - Since the Adobe Extensions Level 3, it can also be PdfName.A - or PdfName.W - @since 2.1.5 - - - - The PdfPageEvent for this document. - - - Gets the PdfPageEvent for this document or null - if none is set. - @return the PdfPageEvent for this document or null - if none is set - - - A number refering to the previous Cross-Reference Table. - - - The original file ID (if present). - - - - - Use this method to get the root outline - and construct bookmarks. - @return the root outline - - - Sets the bookmarks. The list structure is defined in - {@link SimpleBookmark}. - @param outlines the bookmarks or null to remove any - - - possible PDF version (header) - - - possible PDF version (header) - - - possible PDF version (header) - - - possible PDF version (header) - - - possible PDF version (header) - - - possible PDF version (header) - - - possible PDF version (catalog) - - - possible PDF version (catalog) - - - possible PDF version (catalog) - - - possible PDF version (catalog) - - - possible PDF version (catalog) - - - possible PDF version (catalog) - - - Stores the version information for the header and the catalog. - - - @see com.lowagie.text.pdf.interfaces.PdfVersion#setPdfVersion(char) - - - @see com.lowagie.text.pdf.interfaces.PdfVersion#setAtLeastPdfVersion(char) - - - @see com.lowagie.text.pdf.interfaces.PdfVersion#setPdfVersion(com.lowagie.text.pdf.PdfName) - - - @see com.lowagie.text.pdf.interfaces.PdfVersion#addDeveloperExtension(com.lowagie.text.pdf.PdfDeveloperExtension) - @since 2.1.6 - - - Returns the version information. - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - A viewer preference - - - Sets the viewer preferences as the sum of several constants. - @param preferences the viewer preferences - @see PdfViewerPreferences#setViewerPreferences - - - Adds a viewer preference - @param preferences the viewer preferences - @see PdfViewerPreferences#addViewerPreference - - - Use this method to add page labels - @param pageLabels the page labels - - - Adds named destinations in bulk. - Valid keys and values of the map can be found in the map - that is created by SimpleNamedDestination. - @param map a map with strings as keys for the names, - and structured strings as values for the destinations - @param page_offset number of pages that has to be added to - the page numbers in the destinations (useful if you - use this method in combination with PdfCopy). - @since iText 5.0 - - - Adds one named destination. - @param name the name for the destination - @param page the page number where you want to jump to - @param dest an explicit destination - @since iText 5.0 - - - Use this method to add a JavaScript action at the document level. - When the document opens, all this JavaScript runs. - @param js The JavaScript action - - - Adds a JavaScript action at the document level. When the document - opens all this JavaScript runs. - @param code the JavaScript code - @param unicode select JavaScript unicode. Note that the internal - Acrobat JavaScript engine does not support unicode, - so this may or may not work for you - - - Adds a JavaScript action at the document level. When the document - opens all this JavaScript runs. - @param code the JavaScript code - - - Use this method to add a JavaScript action at the document level. - When the document opens, all this JavaScript runs. - @param name The name of the JS Action in the name tree - @param js The JavaScript action - - - Use this method to add a JavaScript action at the document level. - When the document opens, all this JavaScript runs. - @param name The name of the JS Action in the name tree - @param code the JavaScript code - @param unicode select JavaScript unicode. Note that the internal - Acrobat JavaScript engine does not support unicode, - so this may or may not work for you - - - Use this method to adds a JavaScript action at the document level. - When the document opens, all this JavaScript runs. - @param name The name of the JS Action in the name tree - @param code the JavaScript code - - - Adds a file attachment at the document level. - @param description the file description - @param fileStore an array with the file. If it's null - the file will be read from the disk - @param file the path to the file. It will only be used if - fileStore is not null - @param fileDisplay the actual file name stored in the pdf - @throws IOException on error - - - Adds a file attachment at the document level. - @param description the file description - @param fs the file specification - - - Adds a file attachment at the document level. - @param fs the file specification - - - action value - - - action value - - - action value - - - action value - - - action value - - - When the document opens it will jump to the destination with - this name. - @param name the name of the destination to jump to - - - When the document opens this action will be - invoked. - @param action the action to be invoked - - - Additional-actions defining the actions to be taken in - response to various trigger events affecting the document - as a whole. The actions types allowed are: DOCUMENT_CLOSE, - WILL_SAVE, DID_SAVE, WILL_PRINT - and DID_PRINT. - - @param actionType the action type - @param action the action to execute in response to the trigger - @throws PdfException on invalid action type - - - Sets the Collection dictionary. - @param collection a dictionary of type PdfCollection - - - signature value - - - signature value - - - Gets the AcroForm object. - @return the PdfAcroForm - - - Adds a PdfAnnotation or a PdfFormField - to the document. Only the top parent of a PdfFormField - needs to be added. - @param annot the PdfAnnotation or the PdfFormField to add - - - Adds the PdfAnnotation to the calculation order - array. - @param annot the PdfAnnotation to be added - - - Set the signature flags. - @param f the flags. This flags are ORed with current ones - - - XMP Metadata for the document. - - - Sets XMP Metadata. - @param xmpMetadata The xmpMetadata to set. - - - Use this method to set the XMP Metadata for each page. - @param xmpMetadata The xmpMetadata to set. - - - Use this method to creates XMP Metadata based - on the metadata in the PdfDocument. - @since 5.4.4 just creates XmpWriter instance which will be serialized in close. - - - PDF/X level - - - PDF/X level - - - PDF/X level - - - Stores the PDF ISO conformance. - - - Sets the PDFX conformance level. Allowed values are PDFX1A2001 and PDFX32002. It - must be called before opening the document. - @param pdfxConformance the conformance level - - - Checks if any PDF ISO conformance is necessary. - @return true if the PDF has to be in conformance with any of the PDF ISO specifications - - - @see com.lowagie.text.pdf.interfaces.PdfXConformance#isPdfX() - - - Sets the values of the output intent dictionary. Null values are allowed to - suppress any key. - @param outputConditionIdentifier a value - @param outputCondition a value - @param registryName a value - @param info a value - @param destOutputProfile a value - @throws IOException on error - - - Sets the values of the output intent dictionary. Null values are allowed to - suppress any key. - - Prefer the ICC_Profile-based version of this method. - @param outputConditionIdentifier a value - @param outputCondition a value, "PDFA/A" to force GTS_PDFA1, otherwise cued by pdfxConformance. - @param registryName a value - @param info a value - @param destOutputProfile a value - @since 1.x - - @throws IOException - - - Copies the output intent dictionary from other document to this one. - @param reader the other document - @param checkExistence true to just check for the existence of a valid output intent - dictionary, false to insert the dictionary if it exists - @throws IOException on error - @return true if the output intent dictionary exists, false - otherwise - - - Type of encryption - - - Type of encryption - - - Type of encryption - - - Type of encryption - - - Mask to separate the encryption type from the encryption mode. - - - Add this to the mode to keep the metadata in clear text - - - Add this to the mode to keep encrypt only the embedded files. - @since 2.1.3 - - - The operation permitted when the document is opened with the user password - - @since 2.0.7 - - - The operation permitted when the document is opened with the user password - - @since 2.0.7 - - - The operation permitted when the document is opened with the user password - - @since 2.0.7 - - - The operation permitted when the document is opened with the user password - - @since 2.0.7 - - - The operation permitted when the document is opened with the user password - - @since 2.0.7 - - - The operation permitted when the document is opened with the user password - - @since 2.0.7 - - - The operation permitted when the document is opened with the user password - - @since 2.0.7 - - - The operation permitted when the document is opened with the user password - - @since 2.0.7 - - - @deprecated As of iText 2.0.7, use {@link #ALLOW_PRINTING} instead. Scheduled for removal at or after 2.2.0 - - - @deprecated As of iText 2.0.7, use {@link #ALLOW_MODIFY_CONTENTS} instead. Scheduled for removal at or after 2.2.0 - - - @deprecated As of iText 2.0.7, use {@link #ALLOW_COPY} instead. Scheduled for removal at or after 2.2.0 - - - @deprecated As of iText 2.0.7, use {@link #ALLOW_MODIFY_ANNOTATIONS} instead. Scheduled for removal at or after 2.2.0 - - - @deprecated As of iText 2.0.7, use {@link #ALLOW_FILL_IN} instead. Scheduled for removal at or after 2.2.0 - - - @deprecated As of iText 2.0.7, use {@link #ALLOW_SCREENREADERS} instead. Scheduled for removal at or after 2.2.0 - - - @deprecated As of iText 2.0.7, use {@link #ALLOW_ASSEMBLY} instead. Scheduled for removal at or after 2.2.0 - - - @deprecated As of iText 2.0.7, use {@link #ALLOW_DEGRADED_PRINTING} instead. Scheduled for removal at or after 2.2.0 - - - @deprecated As of iText 2.0.7, use {@link #STANDARD_ENCRYPTION_40} instead. Scheduled for removal at or after 2.2.0 - - - @deprecated As of iText 2.0.7, use {@link #STANDARD_ENCRYPTION_128} instead. Scheduled for removal at or after 2.2.0 - - - Contains the business logic for cryptography. - - - Sets the encryption options for this document. The userPassword and the - ownerPassword can be null or have zero length. In this case the ownerPassword - is replaced by a random string. The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - @param userPassword the user password. Can be null or empty - @param ownerPassword the owner password. Can be null or empty - @param permissions the user permissions - @param encryptionType the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128. - Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext - @throws DocumentException if the document is already open - - - Sets the certificate encryption options for this document. An array of one or more public certificates - must be provided together with an array of the same size for the permissions for each certificate. - The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext - @param certs the public certificates to be used for the encryption - @param permissions the user permissions for each of the certicates - @param encryptionType the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128. - @throws DocumentException if the document is already open - - - Sets the encryption options for this document. The userPassword and the - ownerPassword can be null or have zero length. In this case the ownerPassword - is replaced by a random string. The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - @param userPassword the user password. Can be null or empty - @param ownerPassword the owner password. Can be null or empty - @param permissions the user permissions - @param strength128Bits true for 128 bit key length, false for 40 bit key length - @throws DocumentException if the document is already open - - - Sets the encryption options for this document. The userPassword and the - ownerPassword can be null or have zero length. In this case the ownerPassword - is replaced by a random string. The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - @param strength true for 128 bit key length, false for 40 bit key length - @param userPassword the user password. Can be null or empty - @param ownerPassword the owner password. Can be null or empty - @param permissions the user permissions - @throws DocumentException if the document is already open - - - Sets the encryption options for this document. The userPassword and the - ownerPassword can be null or have zero length. In this case the ownerPassword - is replaced by a random string. The open permissions for the document can be - AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, - AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. - The permissions can be combined by ORing them. - @param encryptionType the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128. - Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext - @param userPassword the user password. Can be null or empty - @param ownerPassword the owner password. Can be null or empty - @param permissions the user permissions - @throws DocumentException if the document is already open - - - Holds value of property fullCompression. - - - Gets the 1.5 compression status. - @return true if the 1.5 compression is on - - - Sets the document's compression to the new 1.5 mode with object streams and xref - streams. It can be set at any time but once set it can't be unset. - - - The compression level of the content streams. - @since 2.1.3 - - - Sets the compression level to be used for streams written by this writer. - @param compressionLevel a value between 0 (best speed) and 9 (best compression) - @since 2.1.3 - - - The fonts of this document - - - The font number counter for the fonts in the document. - - - Adds a BaseFont to the document but not to the page resources. - It is used for templates. - @param bf the BaseFont to add - @return an Object[] where position 0 is a PdfName - and position 1 is an PdfIndirectReference - - - The form XObjects in this document. The key is the xref and the value - is Object[]{PdfName, template}. - - - The name counter for the form XObjects name. - - - Adds a template to the document but not to the page resources. - @param template the template to add - @param forcedName the template name, rather than a generated one. Can be null - @return the PdfName for this template - - - Releases the memory used by a template by writing it to the output. The template - can still be added to any content but changes to the template itself won't have - any effect. - @param tp the template to release - @throws IOException on error - - - Gets a page from other PDF document. The page can be used as - any other PdfTemplate. Note that calling this method more than - once with the same parameters will retrieve the same object. - @param reader the PDF document where the page is - @param pageNumber the page number. The first page is 1 - @return the template representing the imported page - - - Returns the PdfReaderInstance associated with the specified reader. - Multiple calls with the same reader object will return the same - PdfReaderInstance. - @param reader the PDF reader that you want an instance for - @return the instance for the provided reader - @since 5.0.3 - - - Writes the reader to the document and frees the memory used by it. - The main use is when concatenating multiple documents to keep the - memory usage restricted to the current appending document. - @param reader the PdfReader to free - @throws IOException on error - - - Gets the current document size. This size only includes - the data already writen to the output stream, it does not - include templates or fonts. It is usefull if used with - freeReader() when concatenating many documents - and an idea of the current size is needed. - @return the approximate size without fonts or templates - - - The colors of this document - - - The color number counter for the colors in the document. - - - Adds a SpotColor to the document but not to the page resources. - @param spc the SpotColor to add - @return an Object[] where position 0 is a PdfName - and position 1 is an PdfIndirectReference - - - The patterns of this document - - - The patten number counter for the colors in the document. - - - Mark this document for tagging. It must be called before open. - - - Check if the document is marked for tagging. - @return true if the document is marked for tagging - - - Fix structure of tagged document: remove unused objects, remove unused items from class map, - fix xref table due to removed objects. - - - Flushes merged AcroFields to document (if any). - - - Gets the structure tree root. If the document is not marked for tagging it will return null. - @return the structure tree root - - - Gets the Optional Content Properties Dictionary. Each call fills the dictionary with the current layer - state. It's advisable to only call this method right before close and do any modifications - at that time. - @return the Optional Content Properties Dictionary - - - Sets a collection of optional content groups whose states are intended to follow - a "radio button" paradigm. That is, the state of at most one optional - content group in the array should be ON at a time: if one group is turned - ON, all others must be turned OFF. - @param group the radio group - - - Use this method to lock an optional content group. - The state of a locked group cannot be changed through the user interface - of a viewer application. Producers can use this entry to prevent the visibility - of content that depends on these groups from being changed by users. - @param layer the layer that needs to be added to the array of locked OCGs - @since 2.1.2 - - - Gives the size of the media box. - @return a Rectangle - - - Sets the crop box. The crop box should not be rotated even if the - page is rotated. This change only takes effect in the next - page. - @param crop the crop box - - - Sets the page box sizes. Allowed names are: "crop", "trim", "art" and "bleed". - @param boxName the box size - @param size the size - - - Gives the size of a trim, art, crop or bleed box, or null if not defined. - @param boxName crop, trim, art or bleed - - - Returns the intersection between the crop, trim art or bleed box and the parameter intersectingRectangle. - This method returns null when - - there is no intersection - - any of the above boxes are not defined - - the parameter intersectingRectangle is null - - @param boxName crop, trim, art, bleed - @param intersectingRectangle the rectangle that intersects the rectangle associated to the boxName - @return the intersection of the two rectangles - - - Use this method to make sure a page is added, - even if it's empty. If you use SetPageEmpty(false), - invoking NewPage() after a blank page will add a newPage. - SetPageEmpty(true) won't have any effect. - @param pageEmpty the state - - - action value - - - action value - - - Sets the open and close page additional action. - @param actionType the action type. It can be PdfWriter.PAGE_OPEN - or PdfWriter.PAGE_CLOSE - @param action the action to perform - @throws PdfException if the action type is invalid - - - Sets the display duration for the page (for presentations) - @param seconds the number of seconds to display the page - - - Sets the transition for the page - @param transition the Transition object - - - Sets the the thumbnail image for the current page. - @param image the image - @throws PdfException on error - @throws DocumentException or error - - - A group attributes dictionary specifying the attributes - of the page�s page group for use in the transparent - imaging model - - - The default space-char ratio. - - - Disable the inter-character spacing. - - - The ratio between the extra word spacing and the extra character spacing. - Extra word spacing will grow ratio times more than extra character spacing. - - - Sets the ratio between the extra word spacing and the extra character spacing - when the text is fully justified. - Extra word spacing will grow spaceCharRatio times more than extra character spacing. - If the ratio is PdfWriter.NO_SPACE_CHAR_RATIO then the extra character spacing - will be zero. - @param spaceCharRatio the ratio between the extra word spacing and the extra character spacing - - - Use the default run direction. - - - Do not use bidirectional reordering. - - - Use bidirectional reordering with left-to-right - preferential run direction. - - - Use bidirectional reordering with right-to-left - preferential run direction. - - - Sets the run direction. This is only used as a placeholder - as it does not affect anything. - @param runDirection the run direction - - - A UserUnit is a value that defines the default user space unit. - The minimum UserUnit is 1 (1 unit = 1/72 inch). - The maximum UserUnit is 75,000. - Remark that this userunit only works starting with PDF1.6! - - - Gets the default colorspaces. - @return the default colorspaces - - - - Sets the image sequence to follow the text in strict order. - @param strictImageSequence new value of property strictImageSequence - - - - Clears text wrapping around images (if applicable). - Method suggested by Pelikan Stephan - @throws DocumentException - - - Dictionary, containing all the images of the PDF document - - - This is the list with all the images in the document. - - - Adds an image to the document but not to the page resources. It is used with - templates and Document.Add(Image). - @param image the Image to add - @return the name of the image added - @throws PdfException on error - @throws DocumentException on error - - - Adds an image to the document but not to the page resources. It is used with - templates and Document.Add(Image). - @param image the Image to add - @param fixedRef the reference to used. It may be null, - a PdfIndirectReference or a PRIndirectReference. - @return the name of the image added - @throws PdfException on error - @throws DocumentException on error - - - Writes a PdfImage to the outputstream. - - @param pdfImage the image to be added - @return a PdfIndirectReference to the encapsulated image - @throws PdfException when a document isn't open yet, or has been closed - - - return the PdfIndirectReference to the image with a given name. - - @param name the name of the image - @return a PdfIndirectReference - - - A Hashtable with Stream objects containing JBIG2 Globals - @since 2.1.5 - - - Gets an indirect reference to a JBIG2 Globals stream. - Adds the stream if it hasn't already been added to the writer. - @param content a byte array that may already been added to the writer inside a stream object. - @since 2.1.5 - - - A flag indicating the presence of structure elements that contain user properties attributes. - - - Sets the flag indicating the presence of structure elements that contain user properties attributes. - @param userProperties the user properties flag - - - Holds value of property RGBTranparency. - - - Sets the transparency blending colorspace to RGB. The default blending colorspace is - CMYK and will result in faded colors in the screen and in printing. Calling this method - will return the RGB colors to what is expected. The RGB blending will be applied to all subsequent pages - until other value is set. - Note that this is a generic solution that may not work in all cases. - @param rgbTransparencyBlending true to set the transparency blending colorspace to RGB, false - to use the default blending colorspace - - - A wrapper around PdfAnnotation constructor. - It is recommended to use this wrapper instead of direct constructor as this is a convenient way to override PdfAnnotation construction when needed. - - @param rect - @param subtype - @return - - - A wrapper around PdfAnnotation constructor. - It is recommended to use this wrapper instead of direct constructor as this is a convenient way to override PdfAnnotation construction when needed. - - @param llx - @param lly - @param urx - @param ury - @param title - @param content - @param subtype - @return - - - A wrapper around PdfAnnotation constructor. - It is recommended to use this wrapper instead of direct constructor as this is a convenient way to override PdfAnnotation construction when needed. - - @param llx - @param lly - @param urx - @param ury - @param action - @param subtype - @return - - - Gets the list of the standard structure element names (roles). - @return - - - - @author psoares - - - Creates a new instance of PdfXConformanceException. - - - Creates a new instance of PdfXConformanceException. - @param s - - - Converts a PFM file into an AFM file. - - - Creates a new instance of Pfm2afm - - - Converts a PFM file into an AFM file. - @param inp the PFM file - @param outp the AFM file - @throws IOException on error - - - Translate table from 1004 to psstd. 1004 is an extension of the - Windows translate table used in PM. - - - Character class. This is a minor attempt to overcome the problem that - in the pfm file, all unused characters are given the width of space. - Note that this array isn't used in iText. - - - Windows character names. Give a name to the used locations - for when the all flag is specified. - - - This class captures an AcroForm on input. Basically, it extends Dictionary - by indexing the fields of an AcroForm - @author Mark Thompson - - - This class holds the information for a single field - - - Returns the name of the widget annotation (the /NM entry). - @return a String or null (if there's no /NM key) - - - Constructor - @param reader reader of the input file - - - Number of fields found - @return size - - - Given the title (/T) of a reference, return the associated reference - @param name a string containing the path - @return a reference to the field, or null - - - Read, and comprehend the acroform - @param root the docment root - - - After reading, we index all of the fields. Recursive. - @param fieldlist An array of fields - @param fieldDict the last field dictionary we encountered (recursively) - @param parentPath the pathname of the field, up to this point or null - - - merge field attributes from two dictionaries - @param parent one dictionary - @param child the other dictionary - @return a merged dictionary - - - stack a level of dictionary. Merge in a dictionary from this level - - - Constructs a PdfIndirectReference. - - @param reader a PdfReader - @param number the object number. - @param generation the generation number. - - - Constructs a PdfIndirectReference. - - @param reader a PdfReader - @param number the object number. - - - Creates a new PDF stream object that will replace a stream - in a existing PDF file. - @param reader the reader that holds the existing PDF - @param conts the new content - @param compressionLevel the compression level for the content - @since 2.1.3 (replacing the existing constructor without param compressionLevel) - - - Sets the data associated with the stream, either compressed or - uncompressed. Note that the data will never be compressed if - Document.compress is set to false. - - @param data raw data, decrypted and uncompressed. - @param compress true if you want the stream to be compresssed. - @since iText 2.1.1 - - - Sets the data associated with the stream, either compressed or - uncompressed. Note that the data will never be compressed if - Document.compress is set to false. - - @param data raw data, decrypted and uncompressed. - @param compress true if you want the stream to be compresssed. - @param compressionLevel a value between -1 and 9 (ignored if compress == false) - @since iText 2.1.3 - - - Sets the data associated with the stream, as-is. This method will not - remove or change any existing filter: the data has to match an existing - filter or an appropriate filter has to be set. - - @param data data, possibly encrypted and/or compressed - @since 5.5.0 - - - Sets the data associated with the stream - @param data raw data, decrypted and uncompressed. - - - - @author Paulo Soares - - - Creates a PRTokeniser for the specified {@link RandomAccessSource}. - The beginning of the file is read to determine the location of the header, and the data source is adjusted - as necessary to account for any junk that occurs in the byte source before the header - @param file the source - - - Is a certain character a whitespace? Currently checks on the following: '0', '9', '10', '12', '13', '32'. -
    The same as calling {@link #isWhitespace(int, boolean) isWhiteSpace(ch, true)}. - @param ch int - @return boolean - @since 5.5.1 -
    - - Checks whether a character is a whitespace. Currently checks on the following: '0', '9', '10', '12', '13', '32'. - @param ch int - @param isWhitespace boolean - @return boolean - @since 5.5.1 - - - Gets current reference number. If parsing was failed with NumberFormatException -1 will be return. - - - Reads data into the provided byte[]. Checks on leading whitespace. - See {@link #isWhitespace(int) isWhiteSpace(int)} or {@link #isWhitespace(int, boolean) isWhiteSpace(int, boolean)} - for a list of whitespace characters. -
    The same as calling {@link #readLineSegment(byte[], boolean) readLineSegment(input, true)}. - - @param input byte[] - @return boolean - @throws IOException - @since 5.5.1 -
    - - Reads data into the provided byte[]. Checks on leading whitespace. - See {@link #isWhitespace(int) isWhiteSpace(int)} or {@link #isWhitespace(int, boolean) isWhiteSpace(int, boolean)} - for a list of whitespace characters. - - @param input byte[] - @param isNullWhitespace boolean to indicate whether '0' is whitespace or not. - If in doubt, use true or overloaded method {@link #readLineSegment(byte[]) readLineSegment(input)} - @return boolean - @throws IOException - @since 5.5.1 - - - - A layout option - - - A layout option - - - A layout option - - - A layout option - - - A layout option - - - A layout option - - - A layout option - - - An icon scaling option - - - An icon scaling option - - - An icon scaling option - - - An icon scaling option - - - Holds value of property layout. - - - Holds value of property image. - - - Holds value of property template. - - - Holds value of property scaleIcon. - - - Holds value of property proportionalIcon. - - - Holds value of property iconVerticalAdjustment. - - - Holds value of property iconHorizontalAdjustment. - - - Holds value of property iconFitToBounds. - - - Creates a new instance of PushbuttonField - @param writer the document PdfWriter - @param box the field location and dimensions - @param fieldName the field name. If null only the widget keys - will be included in the field allowing it to be used as a kid field. - - - Sets the icon and label layout. Possible values are LAYOUT_LABEL_ONLY, - LAYOUT_ICON_ONLY, LAYOUT_ICON_TOP_LABEL_BOTTOM, - LAYOUT_LABEL_TOP_ICON_BOTTOM, LAYOUT_ICON_LEFT_LABEL_RIGHT, - LAYOUT_LABEL_LEFT_ICON_RIGHT and LAYOUT_LABEL_OVER_ICON. - The default is LAYOUT_LABEL_ONLY. - @param layout New value of property layout. - - - Sets the icon as an image. - @param image the image - - - Sets the icon as a template. - @param template the template - - - Sets the way the icon will be scaled. Possible values are - SCALE_ICON_ALWAYS, SCALE_ICON_NEVER, - SCALE_ICON_IS_TOO_BIG and SCALE_ICON_IS_TOO_SMALL. - The default is SCALE_ICON_ALWAYS. - @param scaleIcon the way the icon will be scaled - - - Sets the way the icon is scaled. If true the icon is scaled proportionally, - if false the scaling is done anamorphicaly. - @param proportionalIcon the way the icon is scaled - - - A number between 0 and 1 indicating the fraction of leftover space to allocate at the bottom of the icon. - A value of 0 positions the icon at the bottom of the annotation rectangle. - A value of 0.5 centers it within the rectangle. The default is 0.5. - @param iconVerticalAdjustment a number between 0 and 1 indicating the fraction of leftover space to allocate at the bottom of the icon - - - A number between 0 and 1 indicating the fraction of leftover space to allocate at the left of the icon. - A value of 0 positions the icon at the left of the annotation rectangle. - A value of 0.5 centers it within the rectangle. The default is 0.5. - @param iconHorizontalAdjustment a number between 0 and 1 indicating the fraction of leftover space to allocate at the left of the icon - - - Gets the button appearance. - @throws IOException on error - @throws DocumentException on error - @return the button appearance - - - Gets the pushbutton field. - @throws IOException on error - @throws DocumentException on error - @return the pushbutton field - - - If true the icon will be scaled to fit fully within the bounds of the annotation, - if false the border width will be taken into account. The default - is false. - @param iconFitToBounds if true the icon will be scaled to fit fully within the bounds of the annotation, - if false the border width will be taken into account - - - Holds value of property iconReference. - - - Sets the reference to an existing icon. - @param iconReference the reference to an existing icon - - -

    A simple, fast array of bits, represented compactly by an array of ints internally.

    - - @author Sean Owen -
    - - @param i bit to get - @return true iff bit i is set - - - Sets bit i. - - @param i bit to set - - - Flips bit i. - - @param i bit to set - - - Sets a block of 32 bits, starting at bit i. - - @param i first bit to set - @param newBits the new value of the next 32 bits. Note again that the least-significant bit - corresponds to bit i, the next-least-significant to i+1, and so on. - - - Clears all bits (sets to false). - - - Efficient method to check if a range of bits is set, or not set. - - @param start start of range, inclusive. - @param end end of range, exclusive - @param value if true, checks that bits in range are set, otherwise checks that they are not set - @return true iff all bits are set or not set in range, according to value argument - @throws IllegalArgumentException if end is less than or equal to start - - - @return underlying array of ints. The first element holds the first 32 bits, and the least - significant bit is bit 0. - - - Reverses all bits in the array. - - -

    Represents a 2D matrix of bits. In function arguments below, and throughout the common - module, x is the column position, and y is the row position. The ordering is always x, y. - The origin is at the top-left.

    - -

    Internally the bits are represented in a 1-D array of 32-bit ints. However, each row begins - with a new int. This is done intentionally so that we can copy out a row into a BitArray very - efficiently.

    - -

    The ordering of bits is row-major. Within each int, the least significant bits are used first, - meaning they represent lower x values. This is compatible with BitArray's implementation.

    - - @author Sean Owen - @author dswitkin@google.com (Daniel Switkin) -
    - -

    Gets the requested bit, where true means black.

    - - @param x The horizontal component (i.e. which column) - @param y The vertical component (i.e. which row) - @return value of given bit in matrix -
    - -

    Sets the given bit to true.

    - - @param x The horizontal component (i.e. which column) - @param y The vertical component (i.e. which row) -
    - -

    Flips the given bit.

    - - @param x The horizontal component (i.e. which column) - @param y The vertical component (i.e. which row) -
    - - Clears all bits (sets to false). - - -

    Sets a square region of the bit matrix to true.

    - - @param left The horizontal position to begin at (inclusive) - @param top The vertical position to begin at (inclusive) - @param width The width of the region - @param height The height of the region -
    - - A fast method to retrieve one row of data from the matrix as a BitArray. - - @param y The row to retrieve - @param row An optional caller-allocated BitArray, will be allocated if null or too small - @return The resulting BitArray - this reference should always be used even when passing - your own row - - - @return The width of the matrix - - - @return The height of the matrix - - - This method is for compatibility with older code. It's only logical to call if the matrix - is square, so I'm throwing if that's not the case. - - @return row/column dimension of this matrix - - - JAVAPORT: This should be combined with BitArray in the future, although that class is not yet - dynamically resizeable. This implementation is reasonable but there is a lot of function calling - in loops I'd like to get rid of. - - @author satorux@google.com (Satoru Takabayashi) - creator - @author dswitkin@google.com (Daniel Switkin) - ported from C++ - - - This class implements an array of unsigned bytes. - - @author dswitkin@google.com (Daniel Switkin) - - - Access an unsigned byte at location index. - @param index The index in the array to access. - @return The unsigned value of the byte as an int. - - - - Encapsulates a Character Set ECI, according to "Extended Channel Interpretations" 5.3.1.1 - of ISO 18004. - - @author Sean Owen - - - @param name character set ECI encoding name - @return {@link CharacterSetECI} representing ECI for character encoding, or null if it is legal - but unsupported - - - These are a set of hints that you may pass to Writers to specify their behavior. - - @author dswitkin@google.com (Daniel Switkin) - - - Specifies what degree of error correction to use, for example in QR Codes (type Integer). - - - Specifies what character encoding to use where applicable (type String) - - - @author satorux@google.com (Satoru Takabayashi) - creator - @author dswitkin@google.com (Daniel Switkin) - ported from C++ - - - Encode "bytes" with the error correction level "ecLevel". The encoding mode will be chosen - internally by ChooseMode(). On success, store the result in "qrCode". - - We recommend you to use QRCode.EC_LEVEL_L (the lowest level) for - "getECLevel" since our primary use is to show QR code on desktop screens. We don't need very - strong error correction for this purpose. - - Note that there is no way to encode bytes in MODE_KANJI. We might want to add EncodeWithMode() - with which clients can specify the encoding mode. For now, we don't need the functionality. - - - @return the code point of the table used in alphanumeric mode or - -1 if there is no corresponding code in the table. - - - Choose the best mode by examining the content. Note that 'encoding' is used as a hint; - if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}. - - - Initialize "qrCode" according to "numInputBytes", "ecLevel", and "mode". On success, - modify "qrCode". - - - Terminate bits as described in 8.4.8 and 8.4.9 of JISX0510:2004 (p.24). - - - Get number of data bytes and number of error correction bytes for block id "blockID". Store - the result in "numDataBytesInBlock", and "numECBytesInBlock". See table 12 in 8.5.1 of - JISX0510:2004 (p.30) - - - Interleave "bits" with corresponding error correction bytes. On success, store the result in - "result". The interleave rule is complicated. See 8.6 of JISX0510:2004 (p.37) for details. - - - Append mode info. On success, store the result in "bits". - - - Append length info. On success, store the result in "bits". - - - Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits". - - -

    See ISO 18004:2006, 6.5.1. This enum encapsulates the four error correction levels - defined by the QR code standard.

    - - @author Sean Owen -
    - - L = ~7% correction - - - M = ~15% correction - - - Q = ~25% correction - - - H = ~30% correction - - - @param bits int containing the two bits encoding a QR Code's error correction level - @return {@link ErrorCorrectionLevel} representing the encoded error correction level - - -

    Encapsulates a QR Code's format information, including the data mask used and - error correction level.

    - - @author Sean Owen - @see ErrorCorrectionLevel -
    - - See ISO 18004:2006, Annex C, Table C.1 - - - Offset i holds the number of 1 bits in the binary representation of i - - - @param maskedFormatInfo1 format info indicator, with mask still applied - @param maskedFormatInfo2 second copy of same info; both are checked at the same time - to establish best match - @return information about the format it specifies, or null - if doesn't seem to match any known pattern - - -

    This class contains utility methods for performing mathematical operations over - the Galois Field GF(256). Operations use a given primitive polynomial in calculations.

    - -

    Throughout this package, elements of GF(256) are represented as an int - for convenience and speed (but at the cost of memory). - Only the bottom 8 bits are really used.

    - - @author Sean Owen -
    - - Create a representation of GF(256) using the given primitive polynomial. - - @param primitive irreducible polynomial whose coefficients are represented by - the bits of an int, where the least-significant bit represents the constant - coefficient - - - @return the monomial representing coefficient * x^degree - - - Implements both addition and subtraction -- they are the same in GF(256). - - @return sum/difference of a and b - - - @return 2 to the power of a in GF(256) - - - @return base 2 log of a in GF(256) - - - @return multiplicative inverse of a - - - @param a - @param b - @return product of a and b in GF(256) - - -

    Represents a polynomial whose coefficients are elements of GF(256). - Instances of this class are immutable.

    - -

    Much credit is due to William Rucklidge since portions of this code are an indirect - port of his C++ Reed-Solomon implementation.

    - - @author Sean Owen -
    - - @param field the {@link GF256} instance representing the field to use - to perform computations - @param coefficients coefficients as ints representing elements of GF(256), arranged - from most significant (highest-power term) coefficient to least significant - @throws IllegalArgumentException if argument is null or empty, - or if leading coefficient is 0 and this is not a - constant polynomial (that is, it is not the monomial "0") - - - @return degree of this polynomial - - - @return true iff this polynomial is the monomial "0" - - - @return coefficient of x^degree term in this polynomial - - - @return evaluation of this polynomial at a given point - - - @author satorux@google.com (Satoru Takabayashi) - creator - @author dswitkin@google.com (Daniel Switkin) - ported from C++ - - - @author satorux@google.com (Satoru Takabayashi) - creator - @author dswitkin@google.com (Daniel Switkin) - ported from C++ - - -

    See ISO 18004:2006, 6.4.1, Tables 2 and 3. This enum encapsulates the various modes in which - data can be encoded to bits in the QR code standard.

    - - @author Sean Owen -
    - - @param bits four bits encoding a QR Code data mode - @return {@link Mode} encoded by these bits - @throws IllegalArgumentException if bits do not correspond to a known mode - - - @param version version in question - @return number of bits used, in this QR Code symbol {@link Version}, to encode the - count of characters that will follow encoded in this {@link Mode} - - - @author satorux@google.com (Satoru Takabayashi) - creator - @author dswitkin@google.com (Daniel Switkin) - ported from C++ - - - This object renders a QR Code as a ByteMatrix 2D array of greyscale values. - - @author dswitkin@google.com (Daniel Switkin) - - -

    Implements Reed-Solomon enbcoding, as the name implies.

    - - @author Sean Owen - @author William Rucklidge -
    - -

    Thrown when an exception occurs during Reed-Solomon decoding, such as when - there are too many errors to correct.

    - - @author Sean Owen -
    - - See ISO 18004:2006 Annex D - - @author Sean Owen - - - See ISO 18004:2006 Annex D. - Element i represents the raw version bits that specify version i + 7 - - -

    Deduces version information purely from QR Code dimensions.

    - - @param dimension dimension in modules - @return {@link Version} for a QR Code of that dimension - @throws FormatException if dimension is not 1 mod 4 -
    - - See ISO 18004:2006 Annex E - - -

    Encapsulates a set of error-correction blocks in one symbol version. Most versions will - use blocks of differing sizes within one version, so, this encapsulates the parameters for - each set of blocks. It also holds the number of error-correction codewords per block since it - will be the same across all blocks within one version.

    -
    - -

    Encapsualtes the parameters for one error-correction block in one symbol version. - This includes the number of data codewords, and the number of times a block with these - parameters is used consecutively in the QR code version's format.

    -
    - - See ISO 18004:2006 6.5.1 Table 9 - - - A base class which covers the range of exceptions which may occur when encoding a barcode using - the Writer framework. - - @author dswitkin@google.com (Daniel Switkin) - - - - A field with the symbol check - - - A field with the symbol circle - - - A field with the symbol cross - - - A field with the symbol diamond - - - A field with the symbol square - - - A field with the symbol star - - - Holds value of property checkType. - - - Holds value of property onValue. - - - Holds value of property checked. - - - Creates a new instance of RadioCheckField - @param writer the document PdfWriter - @param box the field location and dimensions - @param fieldName the field name. It must not be null - @param onValue the value when the field is checked - - - Sets the checked symbol. It can be - TYPE_CHECK, - TYPE_CIRCLE, - TYPE_CROSS, - TYPE_DIAMOND, - TYPE_SQUARE and - TYPE_STAR. - @param checkType the checked symbol - - - Sets the value when the field is checked. - @param onValue the value when the field is checked - - - Sets the state of the field to checked or unchecked. - @param checked the state of the field, true for checked - and false for unchecked - - - Gets the field appearance. - @param isRadio true for a radio field and false - for a check field - @param on true for the checked state, false - otherwise - @throws IOException on error - @throws DocumentException on error - @return the appearance - - - Gets the special field appearance for the radio circle. - @param on true for the checked state, false - otherwise - @return the appearance - - - Gets a radio group. It's composed of the field specific keys, without the widget - ones. This field is to be used as a field aggregator with {@link PdfFormField#addKid(PdfFormField) AddKid()}. - @param noToggleToOff if true, exactly one radio button must be selected at all - times; clicking the currently selected button has no effect. - If false, clicking - the selected button deselects it, leaving no button selected. - @param radiosInUnison if true, a group of radio buttons within a radio button field that - use the same value for the on state will turn on and off in unison; that is if - one is checked, they are all checked. If false, the buttons are mutually exclusive - (the same behavior as HTML radio buttons) - @return the radio group - - - Gets the radio field. It's only composed of the widget keys and must be used - with {@link #getRadioGroup(bool,bool)}. - @return the radio field - @throws IOException on error - @throws DocumentException on error - - - Gets the check field. - @return the check field - @throws IOException on error - @throws DocumentException on error - - - Gets a radio or check field. - @param isRadio true to get a radio field, false to get - a check field - @throws IOException on error - @throws DocumentException on error - @return the field - - - Intended to be layered on top of a low level RandomAccessSource object. Provides - functionality useful during parsing: -
      -
    • tracks current position in the file
    • -
    • allows single byte pushback
    • -
    • allows reading of multi-byte data structures (int, long, String) for both Big and Little Endian representations
    • -
    • allows creation of independent 'views' of the underlying data source
    • -
    - - @author Paulo Soares, Kevin Day -
    - - The source that backs this object - - - The physical location in the underlying byte source. - - - the pushed back byte, if any - - - Whether there is a pushed back byte - - - @deprecated use {@link RandomAccessFileOrArray#RandomAccessFileOrArray(RandomAccessSource)} instead - @param filename - @throws IOException - - - Creates an independent view of the specified source. Closing the new object will not close the source. - Closing the source will have adverse effect on the behavior of the new view. - @deprecated use {@link RandomAccessFileOrArray#createView()} instead - @param source the source for the new independent view - - - Creates an independent view of this object (with it's own file pointer and pushback queue). Closing the new object will not close this object. - Closing this object will have adverse effect on the view. - @return the new view - - - Creates a RandomAccessFileOrArray that wraps the specified byte source. The byte source will be closed when - this RandomAccessFileOrArray is closed. - @param byteSource the byte source to wrap - - - Constructs a new RandomAccessFileOrArrayObject - @param filename the file to open (can be a file system file or one of the following url strings: file://, http://, https://, jar:, wsjar:, vfszip: - @param forceRead if true, the entire file will be read into memory - @param plainRandomAccess if true, a regular RandomAccessFile is used to access the file contents. If false, a memory mapped file will be used, unless the file cannot be mapped into memory, in which case regular RandomAccessFile will be used - @throws IOException if there is a failure opening or reading the file - @deprecated use {@link RandomAccessSourceFactory#createBestSource(String)} and {@link RandomAccessFileOrArray#RandomAccessFileOrArray(RandomAccessSource)} instead - - - @param url - @throws IOException - @deprecated use {@link RandomAccessSourceFactory#createSource(URL)} and {@link RandomAccessFileOrArray#RandomAccessFileOrArray(RandomAccessSource)} instead - - - @param is - @throws IOException - @deprecated use {@link RandomAccessSourceFactory#createSource(InputStream)} and {@link RandomAccessFileOrArray#RandomAccessFileOrArray(RandomAccessSource)} instead - - - @param arrayIn - @throws IOException - @deprecated use {@link RandomAccessSourceFactory#createSource(byte[])} and {@link RandomAccessFileOrArray#RandomAccessFileOrArray(RandomAccessSource)} instead - - - Pushes a byte back. The next get() will return this byte instead of the value from the underlying data source - @param b the byte to push - - - Reads a single byte - @return the byte, or -1 if EOF is reached - @throws IOException - - - - - - - - - This class allows you to sign with either an RSACryptoServiceProvider/DSACryptoServiceProvider from a X509Certificate2, - or from manually created RSACryptoServiceProvider/DSACryptoServiceProvider. - Depending on the certificate's CSP, sometimes you will not be able to sign with SHA-256/SHA-512 hash algorithm with - RSACryptoServiceProvider taken directly from the certificate. - This class allows you to use a workaround in this case and sign with certificate's private key and SHA-256/SHA-512 anyway. - - An example of a workaround for CSP that does not support SHA-256/SHA-512: - - if (certificate.PrivateKey is RSACryptoServiceProvider) - { - RSACryptoServiceProvider rsa = (RSACryptoServiceProvider)certificate.PrivateKey; - - // Modified by J. Arturo - // Workaround for SHA-256 and SHA-512 - - if (rsa.CspKeyContainerInfo.ProviderName == "Microsoft Strong Cryptographic Provider" || - rsa.CspKeyContainerInfo.ProviderName == "Microsoft Enhanced Cryptographic Provider v1.0" || - rsa.CspKeyContainerInfo.ProviderName == "Microsoft Base Cryptographic Provider v1.0") - { - string providerName = "Microsoft Enhanced RSA and AES Cryptographic Provider"; - int providerType = 24; - - Type CspKeyContainerInfo_Type = typeof(CspKeyContainerInfo); - - FieldInfo CspKeyContainerInfo_m_parameters = CspKeyContainerInfo_Type.GetField("m_parameters", BindingFlags.NonPublic | BindingFlags.Instance); - CspParameters parameters = (CspParameters)CspKeyContainerInfo_m_parameters.GetValue(rsa.CspKeyContainerInfo); - - var cspparams = new CspParameters(providerType, providerName, rsa.CspKeyContainerInfo.KeyContainerName); - cspparams.Flags = parameters.Flags; - - using (var rsaKey = new RSACryptoServiceProvider(cspparams)) - { - // use rsaKey now - } - } - else - { - // Use rsa directly - } - } - - - - - - - - - - The hash algorithm. - - - The encryption algorithm (obtained from the private key) - - - Returns the encryption algorithm used for signing. - @return the encryption algorithm ("RSA" or "DSA") - @see com.itextpdf.text.pdf.security.ExternalSignature#getEncryptionAlgorithm() - - - Interface to sign a document. The signing is fully done externally, including the container composition. - @author Paulo Soares - - - Produces the container with the signature. - @param data the data to sign - @return a container with the signature and other objects, like CRL and OCSP. The container will generally be a PKCS7 one. - @throws GeneralSecurityException - - - Modifies the signature dictionary to suit the container. At least the keys PdfName.FILTER and - PdfName.SUBFILTER will have to be set. - @param signDic the signature dictionary - - - Helps to locate xml stream - - - Constructor for XPath2 expression - - - Get XPath2 expression - - - Get XmlNamespaceManager to resolve namespace conflicts - - - Class that signs your XML. - - - Signs the xml using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance). - @param sap the XmlSignatureAppearance - @param externalSignature the interface providing the actual signing - @param keyInfo KeyInfo for verification - @throws GeneralSecurityException - @throws IOException - @throws DocumentException - - - Signs the xml with XAdES BES using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance). - @param sap the XmlSignatureAppearance - @param externalSignature the interface providing the actual signing - @param chain the certificate chain - @param includeSignaturePolicy if true SignaturePolicyIdentifier will be included (XAdES-EPES) - @throws GeneralSecurityException - @throws IOException - @throws DocumentException - - - Signs the xml with XAdES BES using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance). - @param sap the XmlSignatureAppearance - @param externalSignature the interface providing the actual signing - @param chain the certificate chain - @throws GeneralSecurityException - @throws IOException - @throws DocumentException - - - Signs the xml with XAdES BES using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance). - @param sap the XmlSignatureAppearance - @param externalSignature the interface providing the actual signing - @param chain the certificate chain - @throws GeneralSecurityException - @throws IOException - @throws DocumentException - - - Signs the xml using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance). - @param sap the XmlSignatureAppearance - @param externalSignature the interface providing the actual signing - @param chain the certificate chain - @throws GeneralSecurityException - @throws IOException - @throws DocumentException - - - Signs the xml using the enveloped mode, with optional xpath transform (see XmlSignatureAppearance). - @param sap the XmlSignatureAppearance - @param externalSignature the interface providing the actual signing - @param publicKey PublicKey for verification - @throws GeneralSecurityException - @throws IOException - @throws DocumentException - - - A dictionary that stores the name of the application that signs the PDF. - - - Creates new PdfSignatureAppDictionary - - - Sets the signature created property in the Prop_Build dictionary's App - dictionary - - @param name - - - Dictionary that stores signature build properties. - @author Kwinten Pisman - - - Creates new PdfSignatureBuildProperties - - - Sets the signatureCreator property in the underlying - {@link PdfSignatureAppDictionary} dictionary. - - @param name - - - Gets the {@link PdfSignatureAppDictionary} from this dictionary. If it - does not exist, it adds a new {@link PdfSignatureAppDictionary} and - returns this instance. - - @return {@link PdfSignatureAppDictionary} - - - Class that encapsulates the signature policy information - @author J. Arturo - - Sample: - - SignaturePolicyInfo spi = new SignaturePolicyInfo("2.16.724.1.3.1.1.2.1.9", - "G7roucf600+f03r/o0bAOQ6WAs0=", "SHA-1", "https://sede.060.gob.es/politica_de_firma_anexo_1.pdf"); - - - Class containing static methods that allow you to get information from - an X509 Certificate: the issuer and the subject. - - - a class that holds an X509 name - - - country code - StringType(SIZE(2)) - - - organization - StringType(SIZE(1..64)) - - - organizational unit name - StringType(SIZE(1..64)) - - - Title - - - common name - StringType(SIZE(1..64)) - - - device serial number name - StringType(SIZE(1..64)) - - - locality name - StringType(SIZE(1..64)) - - - state, or province name - StringType(SIZE(1..64)) - - - Naming attribute of type X520name - - - Naming attribute of type X520name - - - Naming attribute of type X520name - - - Naming attribute of type X520name - - - Naming attribute of type X520name - - - - email address in Verisign certificates - - - object identifier - - - LDAP User id. - - - A Hashtable with default symbols - - - A Hashtable with values - - - Constructs an X509 name - @param seq an Asn1 Sequence - - - Constructs an X509 name - @param dirName a directory name - - - gets a field array from the values Hashmap - @param name - @return an ArrayList - - - getter for values - @return a Hashtable with the fields of the X509 name - - - @see java.lang.Object#toString() - - - class for breaking up an X500 Name into it's component tokens, ala - java.util.StringTokenizer. We need this class as some of the - lightweight Java environment don't support classes like - StringTokenizer. - - - Get the issuer fields from an X509 Certificate - @param cert an X509Certificate - @return an X509Name - - - Get the "issuer" from the TBSCertificate bytes that are passed in - @param enc a TBSCertificate in a byte array - @return a DERObject - - - Get the subject fields from an X509 Certificate - @param cert an X509Certificate - @return an X509Name - - - Get the "subject" from the TBSCertificate bytes that are passed in - @param enc A TBSCertificate in a byte array - @return a DERObject - - - This class contains a series of static methods that - allow you to retrieve information from a Certificate. - - - Gets the URL of the Certificate Revocation List for a Certificate - @param certificate the Certificate - @return the String where you can check if the certificate was revoked - @throws CertificateParsingException - @throws IOException - - - Retrieves the OCSP URL from the given certificate. - @param certificate the certificate - @return the URL or null - @throws IOException - - - Gets the URL of the TSA if it's available on the certificate - @param certificate a certificate - @return a TSA URL - @throws IOException - - - @param certificate the certificate from which we need the ExtensionValue - @param oid the Object Identifier value for the extension. - @return the extension value as an ASN1Primitive object - @throws IOException - - - Gets a String from an ASN1Primitive - @param names the ASN1Primitive - @return a human-readable String - @throws IOException - - - This class consists of some methods that allow you to verify certificates. - - - Verifies a single certificate. - @param cert the certificate to verify - @param crls the certificate revocation list or null - @param calendar the date or null for the current date - @return a String with the error description or null - if no error - - - Verifies a certificate chain against a KeyStore. - @param certs the certificate chain - @param keystore the KeyStore - @param crls the certificate revocation list or null - @param calendar the date or null for the current date - @return null if the certificate chain could be validated or a - Object[]{cert,error} where cert is the - failed certificate and error is the error message - - - Verifies a certificate chain against a KeyStore. - @param certs the certificate chain - @param keystore the KeyStore - @param calendar the date or null for the current date - @return null if the certificate chain could be validated or a - Object[]{cert,error} where cert is the - failed certificate and error is the error message - - - Verifies an OCSP response against a KeyStore. - @param ocsp the OCSP response - @param keystore the KeyStore - @param provider the provider or null to use the BouncyCastle provider - @return true is a certificate was found - - - Verifies a time stamp against a KeyStore. - @param ts the time stamp - @param keystore the KeyStore - @param provider the provider or null to use the BouncyCastle provider - @return true is a certificate was found - - - The previous CertificateVerifier in the chain of verifiers. - - - Indicates if going online to verify a certificate is allowed. - - - Creates the CertificateVerifier in a chain of verifiers. - @param verifier the previous verifier in the chain - - - Decide whether or not online checking is allowed. - @param onlineCheckingAllowed - - - Checks the validity of the certificate, and calls the next - verifier in the chain, if any. - @param signCert the certificate that needs to be checked - @param issuerCert its issuer - @param signDate the date the certificate needs to be valid - @return a list of VerificationOK objects. - The list will be empty if the certificate couldn't be verified. - @throws GeneralSecurityException - @throws IOException - - - An implementation of the CrlClient that handles offline - Certificate Revocation Lists. - @author Paulo Soares - - - The CRL as a byte array. - - - Creates an instance of a CrlClient in case you - have a local cache of the Certificate Revocation List. - @param crlEncoded the CRL bytes - - - Returns the CRL bytes (the parameters are ignored). - @see com.itextpdf.text.pdf.security.CrlClient#getEncoded(java.security.cert.X509Certificate, java.lang.String) - - - An implementation of the CrlClient that fetches the CRL bytes - from an URL. - @author Paulo Soares - - - The Logger instance. - - - The URLs of the CRLs. - - - Creates a CrlClientOnline instance that will try to find - a single CRL by walking through the certificate chain. - - - Creates a CrlClientOnline instance using one or more URLs. - - - Creates a CrlClientOnline instance using a certificate chain. - - - Adds an URL to the list of CRL URLs - @param url an URL in the form of a String - - - Fetches the CRL bytes from an URL. - If no url is passed as parameter, the url will be obtained from the certificate. - If you want to load a CRL from a local file, subclass this method and pass an - URL with the path to the local file to this method. An other option is to use - the CrlClientOffline class. - @see com.itextpdf.text.pdf.security.CrlClient#getEncoded(java.security.cert.X509Certificate, java.lang.String) - - - The Logger instance - - - The list of CRLs to check for revocation date. - - - Creates a CRLVerifier instance. - @param verifier the next verifier in the chain - @param crls a list of CRLs - - - Verifies if a a valid CRL is found for the certificate. - If this method returns false, it doesn't mean the certificate isn't valid. - It means we couldn't verify it against any CRL that was available. - @param signCert the certificate that needs to be checked - @param issuerCert its issuer - @return a list of VerificationOK objects. - The list will be empty if the certificate couldn't be verified. - @see com.itextpdf.text.pdf.security.RootStoreVerifier#verify(java.security.cert.X509Certificate, java.security.cert.X509Certificate, java.util.Date) - - - Verifies a certificate against a single CRL. - @param crl the Certificate Revocation List - @param signCert a certificate that needs to be verified - @param issuerCert its issuer - @param signDate the sign date - @return true if the verification succeeded - @throws GeneralSecurityException - - - Fetches a CRL for a specific certificate online (without further checking). - @param signCert the certificate - @param issuerCert its issuer - @return an X509CRL object - - - Checks if a CRL verifies against the issuer certificate or a trusted anchor. - @param crl the CRL - @param crlIssuer the trusted anchor - @return true if the CRL can be trusted - - - Class that contains a map with the different message digest algorithms. - - - Algorithm available for signatures since PDF 1.3 - - - Algorithm available for signatures since PDF 1.6 - - - Algorithm available for signatures since PDF 1.7 - - - Algorithm available for signatures since PDF 1.7 - - - Algorithm available for signatures since PDF 1.7 - - - Maps the digest IDs with the human-readable name of the digest algorithm. - - - Maps the name of a digest algorithm with its ID. - - - Creates a MessageDigest object that can be used to create a hash. - @param hashAlgorithm the algorithm you want to use to create a hash - @param provider the provider you want to use to create the hash - @return a MessageDigest object - @throws NoSuchAlgorithmException - @throws NoSuchProviderException - @throws GeneralSecurityException - - - Creates a hash using a specific digest algorithm and a provider. - @param data the message of which you want to create a hash - @param hashAlgorithm the algorithm used to create the hash - @param provider the provider used to create the hash - @return the hash - @throws GeneralSecurityException - @throws IOException - - - Gets the digest name for a certain id - @param oid an id (for instance "1.2.840.113549.2.5") - @return a digest name (for instance "MD5") - - - Returns the id of a digest algorithms that is allowed in PDF, - or null if it isn't allowed. - @param name the name of the digest algorithm - @return an oid - - - Class that contains a map with the different encryption algorithms. - - - Maps IDs of encryption algorithms with its human-readable name. - - - Gets the algorithm name for a certain id. - @param oid an id (for instance "1.2.840.113549.1.1.1") - @return an algorithm name (for instance "RSA") - @since 2.1.6 - - - Interface that needs to be implemented if you want to embed - Certificate Revocation Lists into your PDF. - @author Paulo Soares - - - Gets a collection of byte array each representing a crl. - @param checkCert the certificate from which a CRL URL can be obtained - @param url a CRL url if you don't want to obtain it from the certificate - @return a collection of byte array each representing a crl. It may return null or an empty collection - - - Interface that needs to be implemented to do the actual signing. - For instance: you'll have to implement this interface if you want - to sign a PDF using a smart card. - @author Paulo Soares - - - Returns the hash algorithm. - @return the hash algorithm (e.g. "SHA-1", "SHA-256,...") - - - Returns the encryption algorithm used for signing. - @return the encryption algorithm ("RSA" or "DSA") - - - Signs it using the encryption algorithm in combination with - the digest algorithm. - @param message the message you want to be hashed and signed - @return a signed message digest - @throws GeneralSecurityException - - - Interface for the OCSP Client. - @since 2.1.6 - - - * Gets an encoded byte array with OCSP validation. The method should not throw an exception. - * @param checkCert to certificate to check - * @param rootCert the parent certificate - * @param url the url to get the verification. It it's null it will be taken - * from the check cert or from other implementation specific source - * @return a byte array with the validation or null if the validation could not be obtained - - - - Get the time stamp token size estimate. - Implementation must return value large enough to accomodate the entire token - returned by getTimeStampToken() _prior_ to actual getTimeStampToken() call. - @return an estimate of the token size - - - Gets the MessageDigest to digest the data imprint - @return the digest algorithm name - - - Get RFC 3161 timeStampToken. - Method may return null indicating that timestamp should be skipped. - @param imprint byte[] - data imprint to be time-stamped - @return byte[] - encoded, TSA signed data of the timeStampToken - @throws Exception - TSA request failed - - - PAdES-LTV Timestamp - @author Pulo Soares - - - Signs a document with a PAdES-LTV Timestamp. The document is closed at the end. - @param sap the signature appearance - @param tsa the timestamp generator - @param signatureName the signature name or null to have a name generated - automatically - @throws Exception - - - Add verification according to PAdES-LTV (part 4) - @author psoares - - - What type of verification to include - - - Include only OCSP - - - Include only CRL - - - Include both OCSP and CRL - - - Include CRL only if OCSP can't be read - - - Options for how many certificates to include - - - Include verification just for the signing certificate - - - Include verification for the whole chain of certificates - - - Certificate inclusion in the DSS and VRI dictionaries in the CERT and CERTS - keys - - - Include certificates in the DSS and VRI dictionaries - - - Do not include certificates in the DSS and VRI dictionaries - - - The verification constructor. This class should only be created with - PdfStamper.getLtvVerification() otherwise the information will not be - added to the Pdf. - @param stp the PdfStamper to apply the validation to - - - Add verification for a particular signature - @param signatureName the signature to validate (it may be a timestamp) - @param ocsp the interface to get the OCSP - @param crl the interface to get the CRL - @param certOption - @param level the validation options to include - @param certInclude - @return true if a validation was generated, false otherwise - @throws Exception - - - Returns the issuing certificate for a child certificate. - @param cert the certificate for which we search the parent - @param certs an array with certificates that contains the parent - @return the partent certificate - - - Alternative addVerification. - I assume that inputs are deduplicated. - - @throws IOException - @throws GeneralSecurityException - - - - Merges the validation with any validation already in the document or creates - a new one. - @throws IOException - - - The Logger instance - - - Do we need to check all certificate, or only the signing certificate? - - - Verify root. - - - A reader object for the revision that is being verified. - - - The fields in the revision that is being verified. - - - The date the revision was signed, or null for the highest revision. - - - The signature that covers the revision. - - - The PdfPKCS7 object for the signature. - - - Indicates if we're working with the latest revision. - - - The document security store for the revision that is being verified - - - Creates a VerificationData object for a PdfReader - @param reader a reader for the document we want to verify. - @throws GeneralSecurityException - - - Sets an extra verifier. - @param verifier the verifier to set - - - Sets the certificate option. - @param option Either CertificateOption.SIGNING_CERTIFICATE (default) or CertificateOption.WHOLE_CHAIN - - - Set the verifyRootCertificate to false if you can't verify the root certificate. - - - Checks if the signature covers the whole document - and throws an exception if the document was altered - @return a PdfPKCS7 object - @throws GeneralSecurityException - - - Verifies all the document-level timestamps and all the signatures in the document. - @throws IOException - @throws GeneralSecurityException - - - Verifies a document level timestamp. - @throws GeneralSecurityException - @throws IOException - - - Checks the certificates in a certificate chain: - are they valid on a specific date, and - do they chain up correctly? - @param chain - @throws GeneralSecurityException - - - Verifies certificates against a list of CRLs and OCSP responses. - @param signingCert - @param issuerCert - @return a list of VerificationOK objects. - The list will be empty if the certificate couldn't be verified. - @throws GeneralSecurityException - @throws IOException - @see com.itextpdf.text.pdf.security.RootStoreVerifier#verify(java.security.cert.X509Certificate, java.security.cert.X509Certificate) - - - Switches to the previous revision. - @throws IOException - @throws GeneralSecurityException - - - Gets a list of X509CRL objects from a Document Security Store. - @return a list of CRLs - @throws GeneralSecurityException - @throws IOException - - - Gets OCSP responses from the Document Security Store. - @return a list of BasicOCSPResp objects - @throws IOException - @throws GeneralSecurityException - - - Class that signs your PDF. - @author Paulo Soares - - - The Logger instance. - - - Signs the document using the detached mode, CMS or CAdES equivalent. - @param sap the PdfSignatureAppearance - @param externalSignature the interface providing the actual signing - @param chain the certificate chain - @param crlList the CRL list - @param ocspClient the OCSP client - @param tsaClient the Timestamp client - @param provider the provider or null - @param estimatedSize the reserved size for the signature. It will be estimated if 0 - @param cades true to sign CAdES equivalent PAdES-BES, false to sign CMS - @throws DocumentException - @throws IOException - @throws GeneralSecurityException - @throws NoSuchAlgorithmException - @throws Exception - - - Signs the document using the detached mode, CMS or CAdES equivalent. - @param sap the PdfSignatureAppearance - @param externalSignature the interface providing the actual signing - @param chain the certificate chain - @param crlList the CRL list - @param ocspClient the OCSP client - @param tsaClient the Timestamp client - @param provider the provider or null - @param estimatedSize the reserved size for the signature. It will be estimated if 0 - @param cades true to sign CAdES equivalent PAdES-BES, false to sign CMS - @param signaturePolicy the signature policy (for EPES signatures) - @throws DocumentException - @throws IOException - @throws GeneralSecurityException - @throws NoSuchAlgorithmException - @throws Exception - - - Signs the document using the detached mode, CMS or CAdES equivalent. - @param sap the PdfSignatureAppearance - @param externalSignature the interface providing the actual signing - @param chain the certificate chain - @param crlList the CRL list - @param ocspClient the OCSP client - @param tsaClient the Timestamp client - @param provider the provider or null - @param estimatedSize the reserved size for the signature. It will be estimated if 0 - @param cades true to sign CAdES equivalent PAdES-BES, false to sign CMS - @param signaturePolicy the signature policy (for EPES signatures) - @throws DocumentException - @throws IOException - @throws GeneralSecurityException - @throws NoSuchAlgorithmException - @throws Exception - - - Processes a CRL list. - @param cert a Certificate if one of the CrlList implementations needs to retrieve the CRL URL from it. - @param crlList a list of CrlClient implementations - @return a collection of CRL bytes that can be embedded in a PDF. - - - Sign the document using an external container, usually a PKCS7. The signature is fully composed - externally, iText will just put the container inside the document. - @param sap the PdfSignatureAppearance - @param externalSignatureContainer the interface providing the actual signing - @param estimatedSize the reserved size for the signature - @throws GeneralSecurityException - @throws IOException - @throws DocumentException - - - Signs a PDF where space was already reserved. - @param reader the original PDF - @param fieldName the field to sign. It must be the last field - @param outs the output PDF - @param externalSignatureContainer the signature container doing the actual signing. Only the - method ExternalSignatureContainer.sign is used - @throws DocumentException - @throws IOException - @throws GeneralSecurityException - - - OcspClient implementation using BouncyCastle. - @author Paulo Soares - - - Create default implemention of {@code OcspClient}. - Note, if you use this constructor, OCSP response will not be verified. - - - Create {@code OcspClient} - @param verifier will be used for response verification. {@see OCSPVerifier}. - - - Gets OCSP response. If {@see OCSPVerifier} was set, the response will be checked. - - - Gets an encoded byte array with OCSP validation. The method should not throw an exception. - - @param checkCert to certificate to check - @param rootCert the parent certificate - @param url to get the verification. It it's null it will be taken - from the check cert or from other implementation specific source - @return a byte array with the validation or null if the validation could not be obtained - - - Generates an OCSP request using BouncyCastle. - @param issuerCert certificate of the issues - @param serialNumber serial number - @return an OCSP request - @throws OCSPException - @throws IOException - - - The Logger instance - - - The list of OCSP responses. - - - Creates an OCSPVerifier instance. - @param verifier the next verifier in the chain - @param ocsps a list of OCSP responses - - - Verifies if a a valid OCSP response is found for the certificate. - If this method returns false, it doesn't mean the certificate isn't valid. - It means we couldn't verify it against any OCSP response that was available. - @param signCert the certificate that needs to be checked - @param issuerCert its issuer - @return a list of VerificationOK objects. - The list will be empty if the certificate couldn't be verified. - @see com.itextpdf.text.pdf.security.RootStoreVerifier#verify(java.security.cert.X509Certificate, java.security.cert.X509Certificate, java.util.Date) - - - Verifies a certificate against a single OCSP response - @param ocspResp the OCSP response - @param signCert the certificate that needs to be checked - @param issuerCert the certificate of CA - @param signDate sign date - @return {@code true}, in case successful check, otherwise false. - @throws GeneralSecurityException - @throws IOException - - - Verifies if an OCSP response is genuine - If it doesn't verify against the issuer certificate and response's certificates, it may verify - using a trusted anchor or cert. - @param ocspResp the OCSP response - @param issuerCert the issuer certificate - @throws GeneralSecurityException - @throws IOException - - - Verifies if the response is valid. - If it doesn't verify against the issuer certificate and response's certificates, it may verify - using a trusted anchor or cert. - NOTE. Use {@code isValidResponse()} instead. - @param ocspResp the response object - @param issuerCert the issuer certificate - @return true if the response can be trusted - - - Checks if an OCSP response is genuine - @param ocspResp the OCSP response - @param responderCert the responder certificate - @return true if the OCSP response verifies against the responder certificate - - - Gets an OCSP response online and returns it if the status is GOOD - (without further checking). - @param signCert the signing certificate - @param issuerCert the issuer certificate - @return an OCSP response - - - This class does all the processing related to signing - and verifying a PKCS#7 signature. - - - Assembles all the elements needed to create a signature, except for the data. - @param privKey the private key - @param certChain the certificate chain - @param interfaceDigest the interface digest - @param hashAlgorithm the hash algorithm - @param provider the provider or null for the default provider - @param hasRSAdata true if the sub-filter is adbe.pkcs7.sha1 - @throws InvalidKeyException on error - @throws NoSuchProviderException on error - @throws NoSuchAlgorithmException on error - - - Use this constructor if you want to verify a signature using the sub-filter adbe.x509.rsa_sha1. - @param contentsKey the /Contents key - @param certsKey the /Cert key - - - Use this constructor if you want to verify a signature. - @param contentsKey the /Contents key - @param filterSubtype the filtersubtype - @param provider the provider or null for the default provider - - - Holds value of property signName. - - - Holds value of property reason. - - - Holds value of property location. - - - Holds value of property signDate. - - - Getter/setter for property sigName. - @return Value of property sigName. - - - Getter for property reason. - @return Value of property reason. - - - Getter for property location. - @return Value of property location. - - - Getter for property signDate. - @return Value of property signDate. - - - Version of the PKCS#7 object - - - Version of the PKCS#7 "SignerInfo" object. - - - Get the version of the PKCS#7 object. - @return the version of the PKCS#7 object. - - - Get the version of the PKCS#7 "SignerInfo" object. - @return the version of the PKCS#7 "SignerInfo" object. - - - The ID of the digest algorithm, e.g. "2.16.840.1.101.3.4.2.1". - - - The object that will create the digest - - - The digest algorithms - - - The digest attributes - - - Getter for the ID of the digest algorithm, e.g. "2.16.840.1.101.3.4.2.1" - - - Returns the name of the digest algorithm, e.g. "SHA256". - @return the digest algorithm name, e.g. "SHA256" - - - The encryption algorithm. - - - Getter for the digest encryption algorithm - - - Get the algorithm used to calculate the message digest, e.g. "SHA1withRSA". - @return the algorithm used to calculate the message digest - - - The signed digest if created outside this class - - - External RSA data - - - Sets the digest/signature to an external calculated value. - @param digest the digest. This is the actual signature - @param RSAdata the extra data that goes into the data tag in PKCS#7 - @param digestEncryptionAlgorithm the encryption algorithm. It may must be null if the digest - is also null. If the digest is not null - then it may be "RSA" or "DSA" - - - Class from the Java SDK that provides the functionality of a digital signature algorithm. - - - The signed digest as calculated by this class (or extracted from an existing PDF) - - - The RSA data - - - Update the digest with the specified bytes. - This method is used both for signing and verifying - @param buf the data buffer - @param off the offset in the data buffer - @param len the data length - @throws SignatureException on error - - - Gets the bytes for the PKCS#1 object. - @return a byte array - - - Gets the bytes for the PKCS7SignedData object. - @return the bytes for the PKCS7SignedData object - - - Gets the bytes for the PKCS7SignedData object. Optionally the authenticatedAttributes - in the signerInfo can also be set. If either of the parameters is null, none will be used. - @param secondDigest the digest in the authenticatedAttributes - @return the bytes for the PKCS7SignedData object - - - Gets the bytes for the PKCS7SignedData object. Optionally the authenticatedAttributes - in the signerInfo can also be set, OR a time-stamp-authority client - may be provided. - @param secondDigest the digest in the authenticatedAttributes - @param tsaClient TSAClient - null or an optional time stamp authority client - @return byte[] the bytes for the PKCS7SignedData object - @since 2.1.6 - - - Added by Aiken Sam, 2006-11-15, modifed by Martin Brunecky 07/12/2007 - to start with the timeStampToken (signedData 1.2.840.113549.1.7.2). - Token is the TSA response without response status, which is usually - handled by the (vendor supplied) TSA request/response interface). - @param timeStampToken byte[] - time stamp token, DER encoded signedData - @return ASN1EncodableVector - @throws IOException - - - - This method provides that encoding and the parameters must be - exactly the same as in {@link #getEncodedPKCS7(byte[],Calendar)}. - - @param secondDigest the content digest - @return the byte array representation of the authenticatedAttributes ready to be signed - - - Signature attributes - - - Signature attributes (maybe not necessary, but we use it as fallback) - - - encrypted digest - - - Indicates if a signature has already been verified - - - The result of the verification - - - Verify the digest. - @throws SignatureException on error - @return true if the signature checks out, false otherwise - - - Checks if the timestamp refers to this document. - @throws java.security.NoSuchAlgorithmException on error - @return true if it checks false otherwise - @since 2.1.6 - - - All the X.509 certificates in no particular order. - - - All the X.509 certificates used for the main signature. - - - The X.509 certificate that is used to sign the digest. - - - Get all the X.509 certificates associated with this PKCS#7 object in no particular order. - Other certificates, from OCSP for example, will also be included. - @return the X.509 certificates associated with this PKCS#7 object - - - Get the X.509 sign certificate chain associated with this PKCS#7 object. - Only the certificates used for the main signature will be returned, with - the signing certificate first. - @return the X.509 certificates associated with this PKCS#7 object - @since 2.1.6 - - - Get the X.509 certificate actually used to sign the digest. - @return the X.509 certificate actually used to sign the digest - - - Helper method that creates the collection of certificates - used for the main signature based on the complete list - of certificates and the sign certificate. - - - Get the X.509 certificate revocation lists associated with this PKCS#7 object - @return the X.509 certificate revocation lists associated with this PKCS#7 object - - - Helper method that tries to construct the CRLs. - - - BouncyCastle BasicOCSPResp - - - Gets the OCSP basic response if there is one. - @return the OCSP basic response or null - @since 2.1.6 - - - Checks if OCSP revocation refers to the document signing certificate. - @return true if it checks, false otherwise - @since 2.1.6 - - - Helper method that creates the BasicOCSPResp object. - @param seq - @throws IOException - - - True if there's a PAdES LTV time stamp. - - - BouncyCastle TimeStampToken. - - - Check if it's a PAdES-LTV time stamp. - @return true if it's a PAdES-LTV time stamp, false otherwise - - - Gets the timestamp token if there is one. - @return the timestamp token or null - @since 2.1.6 - - - Gets the timestamp date - @return a date - @since 2.1.6 - - - Returns the filter subtype. - - - Returns the encryption algorithm - @return the name of an encryption algorithm - - - Implementation of the ExternalSignature interface that can be used - when you have a PrivateKey object. - @author Paulo Soares - - - The private key object. - - - The hash algorithm. - - - The encryption algorithm (obtained from the private key) - - - Creates an ExternalSignature instance - @param pk a PrivateKey object - @param hashAlgorithm the hash algorithm (e.g. "SHA-1", "SHA-256",...) - @param provider the security provider (e.g. "BC") - - - Creates a message digest using the hash algorithm - and signs it using the encryption algorithm. - @param message the message you want to be hashed and signed - @return a signed message digest - @see com.itextpdf.text.pdf.security.ExternalSignature#sign(byte[]) - - - Returns the hash algorithm. - @return the hash algorithm (e.g. "SHA-1", "SHA-256,...") - @see com.itextpdf.text.pdf.security.ExternalSignature#getHashAlgorithm() - - - Returns the encryption algorithm used for signing. - @return the encryption algorithm ("RSA" or "DSA") - @see com.itextpdf.text.pdf.security.ExternalSignature#getEncryptionAlgorithm() - - - The Logger instance - - - A key store against which certificates can be verified. - - - Creates a RootStoreVerifier in a chain of verifiers. - - @param verifier - the next verifier in the chain - - - Sets the Key Store against which a certificate can be checked. - - @param keyStore - a root store - - - Verifies a single certificate against a key store (if present). - - @param signCert - the certificate to verify - @param issuerCert - the issuer certificate - @param signDate - the date the certificate needs to be valid - @return a list of VerificationOK objects. - The list will be empty if the certificate couldn't be verified. - - - A list of IDs that are used by the security classes - - - Class that contains a field lock action and - an array of the fields that are involved. - - - Can be /All, /Exclude or /Include - - - An array of PdfString values with fieldnames - - - Creates a FieldLock instance - - - Getter for the field lock action. - - - Getter for the fields involved in the lock action. - - - toString method - - - Is the signature a cerification signature (true) or an approval signature (false)? - - - Is form filling allowed by this signature? - - - Is adding annotations allowed by this signature? - - - Does this signature lock specific fields? - - - Creates an object that can inform you about the type of signature - in a signature dictionary as well as some of the permissions - defined by the signature. - - - Getter to find out if the signature is a certification signature. - @return true if the signature is a certification signature, false for an approval signature. - - - Getter to find out if filling out fields is allowed after signing. - @return true if filling out fields is allowed - - - Getter to find out if adding annotations is allowed after signing. - @return true if adding annotations is allowed - - - Getter for the field lock actions, and fields that are impacted by the action - @return an Array with field names - - - Time Stamp Authority Client interface implementation using Bouncy Castle - org.bouncycastle.tsp package. -

    - Created by Aiken Sam, 2006-11-15, refactored by Martin Brunecky, 07/15/2007 - for ease of subclassing. -

    - @since 2.1.6 -
    - - The Logger instance. - - - URL of the Time Stamp Authority - - - TSA Username - - - TSA password - - - An interface that allows you to inspect the timestamp info. - - - The default value for the hash algorithm - - - Estimate of the received time stamp token - - - The default value for the hash algorithm - - - Hash algorithm - - - TSA request policy - - - Creates an instance of a TSAClient that will use BouncyCastle. - @param url String - Time Stamp Authority URL (i.e. "http://tsatest1.digistamp.com/TSA") - - - Creates an instance of a TSAClient that will use BouncyCastle. - @param url String - Time Stamp Authority URL (i.e. "http://tsatest1.digistamp.com/TSA") - @param username String - user(account) name - @param password String - password - - - Constructor. - Note the token size estimate is updated by each call, as the token - size is not likely to change (as long as we call the same TSA using - the same imprint length). - @param url String - Time Stamp Authority URL (i.e. "http://tsatest1.digistamp.com/TSA") - @param username String - user(account) name - @param password String - password - @param tokSzEstimate int - estimated size of received time stamp token (DER encoded) - - - @param tsaInfo the tsaInfo to set - - - Get the token size estimate. - Returned value reflects the result of the last succesfull call, padded - @return an estimate of the token size - - - Gets the MessageDigest to digest the data imprint - @return the digest algorithm name - - - Get RFC 3161 timeStampToken. - Method may return null indicating that timestamp should be skipped. - @param imprint data imprint to be time-stamped - @return encoded, TSA signed data of the timeStampToken - - - Get timestamp token - communications layer - @return - byte[] - TSA response, raw bytes (RFC 3161 encoded) - - - Interface you can implement and pass to TSAClientBouncyCastle in case - you want to do something with the information returned - - - When a timestamp is created using TSAClientBouncyCastle, - this method is triggered passing an object that contains - info about the timestamp and the time stamping authority. - @param info a TimeStampTokenInfo object - - - An exception that is thrown when something is wrong with a certificate. - - - Creates a VerificationException - - - The certificate that was verified successfully. - - - The CertificateVerifier that was used for verifying. - - - The reason why the certificate verified successfully. - - - Creates a VerificationOK object - @param certificate the certificate that was successfully verified - @param verifierClass the class that was used for verification - @param message the reason why the certificate could be verified - - - A single String explaining which certificate was verified, how and why. - @see java.lang.Object#toString() - - - - Creates a signature using a X509Certificate2. It supports smartcards without - exportable private keys. - - - - - The certificate with the private key - - - - The hash algorithm. - - - The encryption algorithm (obtained from the private key) - - - - Creates a signature using a X509Certificate2. It supports smartcards without - exportable private keys. - - The certificate with the private key - The hash algorithm for the signature. As the Windows CAPI is used - to do the signature the only hash guaranteed to exist is SHA-1 - - - Returns the hash algorithm. - @return the hash algorithm (e.g. "SHA-1", "SHA-256,...") - @see com.itextpdf.text.pdf.security.ExternalSignature#getHashAlgorithm() - - - Returns the encryption algorithm used for signing. - @return the encryption algorithm ("RSA" or "DSA") - @see com.itextpdf.text.pdf.security.ExternalSignature#getEncryptionAlgorithm() - - - - Generates a list of numbers from a string. - @param ranges the comma separated ranges - @param maxNumber the maximum number in the range - @return a list with the numbers as Integer - - - Implements a shading pattern as a Color. - - @author Paulo Soares - - - - Creates a new instance of SimpleBookmark - - - Gets number of indirect. If type of directed indirect is PAGES, it refers PAGE object through KIDS. - (Contributed by Kazuya Ujihara) - @param indirect - 2004-06-13 - - - Gets a List with the bookmarks. It returns null if - the document doesn't have any bookmarks. - @param reader the document - @return a List with the bookmarks or null if the - document doesn't have any - - - Gets a List with the bookmarks that are children of outline. It returns null if - the document doesn't have any bookmarks. - @param reader the document - @param outline the outline dictionary to get bookmarks from - @param includeRoot indicates if to include outline parameter itself into returned list of bookmarks - @return a List with the bookmarks or null if the - document doesn't have any - - - Removes the bookmark entries for a number of page ranges. The page ranges - consists of a number of pairs with the start/end page range. The page numbers - are inclusive. - @param list the bookmarks - @param pageRange the page ranges, always in pairs. - - - For the pages in range add the pageShift to the page number. - The page ranges - consists of a number of pairs with the start/end page range. The page numbers - are inclusive. - @param list the bookmarks - @param pageShift the number to add to the pages in range - @param pageRange the page ranges, always in pairs. It can be null - to include all the pages - - - Exports the bookmarks to XML. Only of use if the generation is to be include in - some other XML document. - @param list the bookmarks - @param out the export destination. The writer is not closed - @param indent the indentation level. Pretty printing significant only. Use -1 for no indents. - @param onlyASCII codes above 127 will always be escaped with &#nn; if true, - whatever the encoding - @throws IOException on error - - - - Exports the bookmarks to XML. - @param list the bookmarks - @param wrt the export destination. The writer is not closed - @param encoding the encoding according to IANA conventions - @param onlyASCII codes above 127 will always be escaped with &#nn; if true, - whatever the encoding - @throws IOException on error - - - Import the bookmarks from XML. - @param in the XML source. The stream is not closed - @throws IOException on error - @return the bookmarks - - - Import the bookmarks from XML. - @param in the XML source. The reader is not closed - @throws IOException on error - @return the bookmarks - - - - @author Paulo Soares - - - - Exports the bookmarks to XML. - @param names the names - @param wrt the export destination. The writer is not closed - @param encoding the encoding according to IANA conventions - @param onlyASCII codes above 127 will always be escaped with &#nn; if true, - whatever the encoding - @throws IOException on error - - - Import the names from XML. - @param inp the XML source. The stream is not closed - @throws IOException on error - @return the names - - - Import the names from XML. - @param inp the XML source. The reader is not closed - @throws IOException on error - @return the names - - - - @author psoares - - - Creates a new instance of StampContent - - - Gets a duplicate of this PdfContentByte. All - the members are copied by reference but the buffer stays different. - - @return a copy of this PdfContentByte - - - Escapes a byte array according to the PDF conventions. - - @param b the byte array to escape - @return an escaped byte array - - - Escapes a byte array according to the PDF conventions. - - @param b the byte array to escape - - - Converts an array of unsigned 16bit numbers to an array of bytes. - The input values are presented as chars for convenience. - - @param chars the array of 16bit numbers that should be converted - @return the resulting byte array, twice as large as the input - - - Supports text, combo and list fields generating the correct appearances. - All the option in the Acrobat GUI are supported in an easy to use API. - @author Paulo Soares - - - Holds value of property defaultText. - - - Holds value of property choices. - - - Holds value of property choiceExports. - - - Holds value of property choiceSelection. - - - Represents the /TI value - - - Creates a new TextField. - @param writer the document PdfWriter - @param box the field location and dimensions - @param fieldName the field name. If null only the widget keys - will be included in the field allowing it to be used as a kid field. - - - Obfuscates a password String. - Every character is replaced by an asterisk (*). - - @param text - @return String - @since 2.1.5 - - - Get the PdfAppearance of a text or combo field - @throws IOException on error - @throws DocumentException on error - @return A PdfAppearance - - - Get the PdfAppearance of a list field - @throws IOException on error - @throws DocumentException on error - @return A PdfAppearance - - - Gets a new text field. - @throws IOException on error - @throws DocumentException on error - @return a new text field - - - Gets a new combo field. - @throws IOException on error - @throws DocumentException on error - @return a new combo field - - - Gets a new list field. - @throws IOException on error - @throws DocumentException on error - @return a new list field - - - Sets the default text. It is only meaningful for text fields. - @param defaultText the default text - - - Sets the choices to be presented to the user in list/combo - fields. - @param choices the choices to be presented to the user - - - Sets the export values in list/combo fields. If this array - is null then the choice values will also be used - as the export values. - @param choiceExports the export values in list/combo fields - - - Sets the zero based index of the selected item. - @param choiceSelection the zero based index of the selected item - - - Sets the top visible choice for lists; - - @since 5.5.3 - @param visibleTopChoice index of the first visible item (zero-based array) - Returns the index of the top visible choice of a list. Default is -1. - @return the index of the top visible choice - - - - Sets extra margins in text fields to better mimic the Acrobat layout. - @param extraMarginLeft the extra marging left - @param extraMarginTop the extra margin top - - - Holds value of property substitutionFonts. - - - Sets a list of substitution fonts. The list is composed of BaseFont and can also be null. The fonts in this list will be used if the original - font doesn't contain the needed glyphs. - @param substitutionFonts the list - - - Holds value of property extensionFont. - - - Sets the extensionFont. This font will be searched before the - substitution fonts. It may be null. - @param extensionFont New value of property extensionFont. - - - Reads a Truetype font - - @author Paulo Soares - - - The code pages possible for a True Type font. - - - Contains the location of the several tables. The key is the name of - the table and the value is an int[2] where position 0 - is the offset from the start of the file and position 1 is the length - of the table. - - - The file in use. - - - The file name. - - - The offset from the start of the file to the table directory. - It is 0 for TTF and may vary for TTC depending on the chosen font. - - - The index for the TTC font. It is an empty string for a - TTF file. - - - The style modifier - - - The content of table 'head'. - - - The content of table 'hhea'. - - - The content of table 'OS/2'. - - - The width of the glyphs. This is essentially the content of table - 'hmtx' normalized to 1000 units. - - - The map containing the code information for the table 'cmap', encoding 1.0. - The key is the code and the value is an int[2] where position 0 - is the glyph number and position 1 is the glyph width normalized to 1000 - units. - - - - - By James for unicode Ext.B - - - - The map containing the kerning information. It represents the content of - table 'kern'. The key is an Integer where the top 16 bits - are the glyph number for the first character and the lower 16 bits are the - glyph number for the second character. The value is the amount of kerning in - normalized 1000 units as an Integer. This value is usually negative. - - - The font name. - This name is usually extracted from the table 'name' with - the 'Name ID' 6. - - - The font subfamily - This subFamily name is usually extracted from the table 'name' with - the 'Name ID' 2 or 'Name ID' 17. - - - The full name of the font 'Name ID' 1 or 'Name ID' 16 - - - All the names auf the Names-Table - - - The family name of the font - - - - true if all the glyphs have the same width. - - - The components of table 'head'. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - The components of table 'hhea'. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - The components of table 'OS/2'. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - This constructor is present to allow extending the class. - - - Creates a new TrueType font. - @param ttFile the location of the font on file. The file must end in '.ttf' or - '.ttc' but can have modifiers after the name - @param enc the encoding to be applied to this font - @param emb true if the font is to be embedded in the PDF - @param ttfAfm the font as a byte array - @throws DocumentException the font is invalid - @throws IOException the font file could not be read - - - Gets the name from a composed TTC file name. - If I have for input "myfont.ttc,2" the return will - be "myfont.ttc". - @param name the full name - @return the simple file name - - - Reads the tables 'head', 'hhea', 'OS/2', 'post' and 'maxp' filling several variables. - @throws DocumentException the font is invalid - @throws IOException the font file could not be read - - - Gets the Postscript font name. - @throws DocumentException the font is invalid - @throws IOException the font file could not be read - @return the Postscript font name - - - Extracts the names of the font in all the languages available. - @param id the name id to retrieve - @throws DocumentException on error - @throws IOException on error - - - Extracts all the names of the names-Table - @param id the name id to retrieve - @throws DocumentException on error - @throws IOException on error - - - Reads the font data. - @param ttfAfm the font as a byte array, possibly null - @throws DocumentException the font is invalid - @throws IOException the font file could not be read - - - Reads a string from the font file as bytes using the Cp1252 - encoding. - @param length the length of bytes to read - @return the string read - @throws IOException the font file could not be read - - - Reads a Unicode string from the font file. Each character is - represented by two bytes. - @param length the length of bytes to read. The string will have length/2 - characters - @return the string read - @throws IOException the font file could not be read - - - Reads the glyphs widths. The widths are extracted from the table 'hmtx'. - The glyphs are normalized to 1000 units. - @throws DocumentException the font is invalid - @throws IOException the font file could not be read - - - Gets a glyph width. - @param glyph the glyph to get the width of - @return the width of the glyph in normalized 1000 units - - - Reads the several maps from the table 'cmap'. The maps of interest are 1.0 for symbolic - fonts and 3.1 for all others. A symbolic font is defined as having the map 3.0. - @throws DocumentException the font is invalid - @throws IOException the font file could not be read - - - The information in the maps of the table 'cmap' is coded in several formats. - Format 0 is the Apple standard character to glyph index mapping table. - @return a Hashtable representing this map - @throws IOException the font file could not be read - - - The information in the maps of the table 'cmap' is coded in several formats. - Format 4 is the Microsoft standard character to glyph index mapping table. - @return a Hashtable representing this map - @throws IOException the font file could not be read - - - The information in the maps of the table 'cmap' is coded in several formats. - Format 6 is a trimmed table mapping. It is similar to format 0 but can have - less than 256 entries. - @return a Hashtable representing this map - @throws IOException the font file could not be read - - - Reads the kerning information from the 'kern' table. - @throws IOException the font file could not be read - - - Gets the kerning between two Unicode chars. - @param char1 the first char - @param char2 the second char - @return the kerning to be applied - - - Gets the width from the font according to the unicode char c. - If the name is null it's a symbolic font. - @param c the unicode char - @param name the glyph name - @return the width of the char - - - Generates the font descriptor for this font. - @return the PdfDictionary containing the font descriptor or null - @param subsetPrefix the subset prefix - @param fontStream the indirect reference to a PdfStream containing the font or null - @throws DocumentException if there is an error - - - Generates the font dictionary for this font. - @return the PdfDictionary containing the font dictionary - @param subsetPrefix the subset prefx - @param firstChar the first valid character - @param lastChar the last valid character - @param shortTag a 256 bytes long byte array where each unused byte is represented by 0 - @param fontDescriptor the indirect reference to a PdfDictionary containing the font descriptor or null - @throws DocumentException if there is an error - - - Outputs to the writer the font dictionaries and streams. - @param writer the writer for this document - @param ref the font indirect reference - @param params several parameters that depend on the font type - @throws IOException on error - @throws DocumentException error in generating the object - - - If this font file is using the Compact Font File Format, then this method - will return the raw bytes needed for the font stream. If this method is - ever made public: make sure to add a test if (cff == true). - @return a byte array - @since 2.1.3 - - - Returns a PdfStream object with the full font program. - @return a PdfStream with the font program - @since 2.1.3 - - - Gets the font parameter identified by key. Valid values - for key are ASCENT, CAPHEIGHT, DESCENT - and ITALICANGLE. - @param key the parameter to be extracted - @param fontSize the font size in points - @return the parameter in points - - - Gets the glyph index and metrics for a character. - @param c the character - @return an int array with {glyph index, width} - - - Gets the postscript font name. - @return the postscript font name - - - Gets the code pages supported by the font. - @return the code pages supported by the font - - - - - - - Checks if the font has any kerning pairs. - @return true if the font has any kerning pairs - - - Sets the kerning between two Unicode chars. - @param char1 the first char - @param char2 the second char - @param kern the kerning to apply in normalized 1000 units - @return true if the kerning was applied, false otherwise - - - Checks whether this font may be used with winansi encoding. - - @return true if the font can be correctly used with winansi encodings - - - Subsets a True Type font by removing the unneeded glyphs from - the font. - - @author Paulo Soares - - - Contains the location of the several tables. The key is the name of - the table and the value is an int[3] where position 0 - is the checksum, position 1 is the offset from the start of the file - and position 2 is the length of the table. - - - The file in use. - - - The file name. - - - Creates a new TrueTypeFontSubSet - @param directoryOffset The offset from the start of the file to the table directory - @param fileName the file name of the font - @param glyphsUsed the glyphs used - @param includeCmap true if the table cmap is to be included in the generated font - - - Does the actual work of subsetting the font. - @throws IOException on error - @throws DocumentException on error - @return the subset font - - - Reads a string from the font file as bytes using the Cp1252 - encoding. - @param length the length of bytes to read - @return the string read - @throws IOException the font file could not be read - - - Represents a True Type font with Unicode encoding. All the character - in the font can be used directly by using the encoding Identity-H or - Identity-V. This is the only way to represent some character sets such - as Thai. - @author Paulo Soares - - - Creates a new TrueType font addressed by Unicode characters. The font - will always be embedded. - @param ttFile the location of the font on file. The file must end in '.ttf'. - The modifiers after the name are ignored. - @param enc the encoding to be applied to this font - @param emb true if the font is to be embedded in the PDF - @param ttfAfm the font as a byte array - @throws DocumentException the font is invalid - @throws IOException the font file could not be read - - - Gets the width of a char in normalized 1000 units. - @param char1 the unicode char to get the width of - @return the width in normalized 1000 units - - - Gets the width of a string in normalized 1000 units. - @param text the string to get the witdth of - @return the width in normalized 1000 units - - - Creates a ToUnicode CMap to allow copy and paste from Acrobat. - @param metrics metrics[0] contains the glyph index and metrics[2] - contains the Unicode code - @throws DocumentException on error - @return the stream representing this CMap or null - - - Gets an hex string in the format "<HHHH>". - @param n the number - @return the hex string - - - Generates the CIDFontTyte2 dictionary. - @param fontDescriptor the indirect reference to the font descriptor - @param subsetPrefix the subset prefix - @param metrics the horizontal width metrics - @return a stream - - - Generates the font dictionary. - @param descendant the descendant dictionary - @param subsetPrefix the subset prefix - @param toUnicode the ToUnicode stream - @return the stream - - - The method used to sort the metrics array. - @param o1 the first element - @param o2 the second element - @return the comparisation - - - Outputs to the writer the font dictionaries and streams. - @param writer the writer for this document - @param ref the font indirect reference - @param parms several parameters that depend on the font type - @throws IOException on error - @throws DocumentException error in generating the object - - - Returns a PdfStream object with the full font program. - @return a PdfStream with the font program - @since 2.1.3 - - - A forbidden operation. Will throw a null pointer exception. - @param text the text - @return always null - - - Gets the glyph index and metrics for a character. - @param c the character - @return an int array with {glyph index, width} - - - Checks if a character exists in this font. - @param c the character to check - @return true if the character has a glyph, - false otherwise - - - Sets the character advance. - @param c the character - @param advance the character advance normalized to 1000 units - @return true if the advance was set, - false otherwise - - - Reads a Type1 font - - @author Paulo Soares - - - The PFB file if the input was made with a byte array. - - - The Postscript font name. - - - The full name of the font. - - - The family name of the font. - - - The weight of the font: normal, bold, etc. - - - The italic angle of the font, usually 0.0 or negative. - - - true if all the characters have the same - width. - - - The character set of the font. - - - The llx of the FontBox. - - - The lly of the FontBox. - - - The lurx of the FontBox. - - - The ury of the FontBox. - - - The underline position. - - - The underline thickness. - - - The font's encoding name. This encoding is 'StandardEncoding' or - 'AdobeStandardEncoding' for a font that can be totally encoded - according to the characters names. For all other names the - font is treated as symbolic. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - A variable. - - - Represents the section CharMetrics in the AFM file. Each - value of this array contains a Object[4] with an - Integer, Integer, String and int[]. This is the code, width, name and char bbox. - The key is the name of the char and also an Integer with the char number. - - - Represents the section KernPairs in the AFM file. The key is - the name of the first character and the value is a Object[] - with 2 elements for each kern pair. Position 0 is the name of - the second character and position 1 is the kerning distance. This is - repeated for all the pairs. - - - The file in use. - - - true if this font is one of the 14 built in fonts. - - - Types of records in a PFB file. ASCII is 1 and BINARY is 2. - They have to appear in the PFB file in this sequence. - - - Creates a new Type1 font. - @param ttfAfm the AFM file if the input is made with a byte array - @param pfb the PFB file if the input is made with a byte array - @param afmFile the name of one of the 14 built-in fonts or the location of an AFM file. The file must end in '.afm' - @param enc the encoding to be applied to this font - @param emb true if the font is to be embedded in the PDF - @throws DocumentException the AFM file is invalid - @throws IOException the AFM file could not be read - - - Gets the width from the font according to the name or, - if the name is null, meaning it is a symbolic font, - the char c. - @param c the char if the font is symbolic - @param name the glyph name - @return the width of the char - - - Gets the kerning between two Unicode characters. The characters - are converted to names and this names are used to find the kerning - pairs in the Hashtable KernPairs. - @param char1 the first char - @param char2 the second char - @return the kerning to be applied - - - Reads the font metrics - @param rf the AFM file - @throws DocumentException the AFM file is invalid - @throws IOException the AFM file could not be read - - - If the embedded flag is false or if the font is - one of the 14 built in types, it returns null, - otherwise the font is read and output in a PdfStream object. - @return the PdfStream containing the font or null - @throws DocumentException if there is an error reading the font - - - Generates the font descriptor for this font or null if it is - one of the 14 built in fonts. - @param fontStream the indirect reference to a PdfStream containing the font or null - @return the PdfDictionary containing the font descriptor or null - - - Generates the font dictionary for this font. - @return the PdfDictionary containing the font dictionary - @param firstChar the first valid character - @param lastChar the last valid character - @param shortTag a 256 bytes long byte array where each unused byte is represented by 0 - @param fontDescriptor the indirect reference to a PdfDictionary containing the font descriptor or null - - - Outputs to the writer the font dictionaries and streams. - @param writer the writer for this document - @param ref the font indirect reference - @param parms several parameters that depend on the font type - @throws IOException on error - @throws DocumentException error in generating the object - - - Gets the font parameter identified by key. Valid values - for key are ASCENT, CAPHEIGHT, DESCENT, - ITALICANGLE, BBOXLLX, BBOXLLY, BBOXURX - and BBOXURY. - @param key the parameter to be extracted - @param fontSize the font size in points - @return the parameter in points - - - Sets the font parameter identified by key. Valid values - for key are ASCENT, CAPHEIGHT, DESCENT, - ITALICANGLE, BBOXLLX, BBOXLLY, BBOXURX - and BBOXURY. - @param key the parameter to be updated - @param value the parameter value - - - Gets the postscript font name. - @return the postscript font name - - - - - - Checks if the font has any kerning pairs. - @return true if the font has any kerning pairs - - - Sets the kerning between two Unicode chars. - @param char1 the first char - @param char2 the second char - @param kern the kerning to apply in normalized 1000 units - @return true if the kerning was applied, false otherwise - - - A class to support Type3 fonts. - - - Creates a Type3 font. - @param writer the writer - @param chars an array of chars corresponding to the glyphs used (not used, prisent for compability only) - @param colorized if true the font may specify color, if false no color commands are allowed - and only images as masks can be used - - - - Defines a glyph. If the character was already defined it will return the same content - @param c the character to match this glyph. - @param wx the advance this character will have - @param llx the X lower left corner of the glyph bounding box. If the colorize option is - true the value is ignored - @param lly the Y lower left corner of the glyph bounding box. If the colorize option is - true the value is ignored - @param urx the X upper right corner of the glyph bounding box. If the colorize option is - true the value is ignored - @param ury the Y upper right corner of the glyph bounding box. If the colorize option is - true the value is ignored - @return a content where the glyph can be defined - - - Always returns null, because you can't get the FontStream of a Type3 font. - @return null - @since 2.1.3 - - - The content where Type3 glyphs are written to. - - - Writes text vertically. Note that the naming is done according - to horizontal text although it referrs to vertical text. - A line with the alignment Element.LEFT_ALIGN will actually - be top aligned. - - - Signals that there are no more text available. - - - Signals that there is no more column. - - - The chunks that form the text. - - - The PdfContent where the text will be written to. - - - The column Element. Default is left Element. - - - Marks the chunks to be eliminated when the line is written. - - - The chunk created by the splitting. - - - The chunk created by the splitting. - - - The leading - - - The X coordinate. - - - The Y coordinate. - - - The maximum number of vertical lines. - - - The height of the text. - - - Creates new VerticalText - @param text the place where the text will be written to. Can - be a template. - - - Adds a Phrase to the current text array. - @param phrase the text - - - Adds a Chunk to the current text array. - @param chunk the text - - - Sets the layout. - @param startX the top right X line position - @param startY the top right Y line position - @param height the height of the lines - @param maxLines the maximum number of lines - @param leading the separation between the lines - - - Gets the separation between the vertical lines. - @return the vertical line separation - - - Creates a line from the chunk array. - @param width the width of the line - @return the line or null if no more chunks - - - Normalizes the list of chunks when the line is accepted. - - - Outputs the lines to the document. It is equivalent to go(false). - @return returns the result of the operation. It can be NO_MORE_TEXT - and/or NO_MORE_COLUMN - @throws DocumentException on error - - - Outputs the lines to the document. The output can be simulated. - @param simulate true to simulate the writting to the document - @return returns the result of the operation. It can be NO_MORE_TEXT - and/or NO_MORE_COLUMN - @throws DocumentException on error - - - Sets the new text origin. - @param startX the X coordinate - @param startY the Y coordinate - - - Gets the X coordinate where the next line will be writen. This value will change - after each call to go(). - @return the X coordinate - - - Gets the Y coordinate where the next line will be writen. - @return the Y coordinate - - - Gets the maximum number of available lines. This value will change - after each call to go(). - @return Value of property maxLines. - - - Gets the height of the line - @return the height - - - Gets the Element. - @return the alignment - - - Processes XFA forms. - @author Paulo Soares - - - An empty constructor to build on. - - - Return the XFA Object, could be an array, could be a Stream. - Returns null f no XFA Object is present. - @param reader a PdfReader instance - @return the XFA object - @since 2.1.3 - - - A constructor from a PdfReader. It basically does everything - from finding the XFA stream to the XML parsing. - @param reader the reader - @throws java.io.IOException on error - @throws javax.xml.parsers.ParserConfigurationException on error - @throws org.xml.sax.SAXException on error - - - Extracts the nodes from the domDocument. - @since 2.1.5 - - - Some XFA forms don't have a datasets node. - If this is the case, we have to add one. - - - Sets the XFA key from a byte array. The old XFA is erased. - @param form the data - @param reader the reader - @param writer the writer - @throws java.io.IOException on error - - - Sets the XFA key from the instance data. The old XFA is erased. - @param writer the writer - @throws java.io.IOException on error - - - Serializes a XML document to a byte array. - @param n the XML document - @throws java.io.IOException on error - @return the serialized XML document - - - Returns true if it is a XFA form. - @return true if it is a XFA form - - - Gets the top level DOM document. - @return the top level DOM document - - - Finds the complete field name contained in the "classic" forms from a partial - name. - @param name the complete or partial name - @param af the fields - @return the complete name or null if not found - - - Finds the complete SOM name contained in the datasets section from a - possibly partial name. - @param name the complete or partial name - @return the complete name or null if not found - - - Finds the Node contained in the datasets section from a - possibly partial name. - @param name the complete or partial name - @return the Node or null if not found - - - Gets all the text contained in the child nodes of this node. - @param n the Node - @return the text found or "" if no text was found - - - Sets the text of this node. All the child's node are deleted and a new - child text node is created. - @param n the Node to add the text to - @param text the text to add - - - Sets the PdfReader to be used by this instance. - @param reader the PdfReader to be used by this instance - - - Checks if this XFA form was changed. - @return true if this XFA form was changed - - - A structure to store each part of a SOM name and link it to the next part - beginning from the lower hierarchie. - - - Gets the full name by traversing the hiearchie using only the - index 0. - @return the full name - - - Search the current node for a similar name. A similar name starts - with the same name but has a differnt index. For example, "detail[3]" - is similar to "detail[9]". The main use is to discard names that - correspond to out of bounds records. - @param name the name to search - @return true if a similitude was found - - - Another stack implementation. The main use is to facilitate - the porting to other languages. - - - Looks at the object at the top of this stack without removing it from the stack. - @return the object at the top of this stack - - - Removes the object at the top of this stack and returns that object as the value of this function. - @return the object at the top of this stack - - - Pushes an item onto the top of this stack. - @param item the item to be pushed onto this stack - @return the item argument - - - Tests if this stack is empty. - @return true if and only if this stack contains no items; false otherwise - - - A class for some basic SOM processing. - - - The order the names appear in the XML, depth first. - - - The mapping of full names to nodes. - - - The data to do a search from the bottom hierarchie. - - - A stack to be used when parsing. - - - A temporary store for the repetition count. - - - Escapes a SOM string fragment replacing "." with "\.". - @param s the unescaped string - @return the escaped string - - - Unescapes a SOM string fragment replacing "\." with ".". - @param s the escaped string - @return the unescaped string - - - Outputs the stack as the sequence of elements separated - by '.'. - @return the stack as the sequence of elements separated by '.' - - - Gets the name with the #subform removed. - @param s the long name - @return the short name - - - Adds a SOM name to the search node chain. - @param unstack the SOM name - - - Adds a SOM name to the search node chain. - @param inverseSearch the start point - @param stack the stack with the separeted SOM parts - @param unstack the full name - - - Searchs the SOM hiearchie from the bottom. - @param parts the SOM parts - @return the full name or null if not found - - - Splits a SOM name in the individual parts. - @param name the full SOM name - @return the split name - - - Gets the order the names appear in the XML, depth first. - @return the order the names appear in the XML, depth first - - - Gets the mapping of full names to nodes. - @return the mapping of full names to nodes - - - Gets the data to do a search from the bottom hierarchie. - @return the data to do a search from the bottom hierarchie - - - Processes the datasets section in the XFA form. - - - Creates a new instance from the datasets node. This expects - not the datasets but the data node that comes below. - @param n the datasets node - - - Inserts a new Node that will match the short name. - @param n the datasets top Node - @param shortName the short name - @return the new Node of the inserted name - - - A class to process "classic" fields. - - - Creates a new instance from a Collection with the full names. - @param items the Collection - - - Gets the mapping from short names to long names. A long - name may contain the #subform name part. - @return the mapping from short names to long names - - - Processes the template section in the XFA form. - - - Creates a new instance from the datasets node. - @param n the template node - - - Gets the field type as described in the template section of the XFA. - @param s the exact template name - @return the field type or null if not found - - - true if it's a dynamic form; false - if it's a static form. - @return true if it's a dynamic form; false - if it's a static form - - - Gets the class that contains the template processing section of the XFA. - @return the class that contains the template processing section of the XFA - - - Gets the class that contains the datasets processing section of the XFA. - @return the class that contains the datasets processing section of the XFA - - - Gets the class that contains the "classic" fields processing. - @return the class that contains the "classic" fields processing - - - Gets the Node that corresponds to the datasets part. - @return the Node that corresponds to the datasets part - - - Replaces the data under datasets/data. - @since iText 5.0.0 - - - Helps to locate xml stream inside PDF document with Xfa form. - - - Gets Document to sign - - - Save document as single XML stream in AcroForm. - @param document signed document - @throws IOException - @throws DocumentException - - - Constructor for xpath expression for signing XfaForm - - - Possible xdp packages to sign - - - Empty constructor, no transform. - - - Construct for Xpath expression. Depends from selected xdp package. - @param xdpPackage - - - Get XPath expression - - - Reads a XFDF. - @author Leonard Rosenthol (leonardr@pdfsages.com) - - - Storage for field values if there's more than one value for a field. - @since 2.1.4 - - - Reads an XFDF form. - @param filename the file name of the form - @throws IOException on error - - - Reads an XFDF form. - @param xfdfIn the byte array with the form - @throws IOException on error - - - Reads an XFDF form. - @param is an InputStream to read the form - @throws IOException on error - @since 5.0.1 - - - Gets all the fields. The map is keyed by the fully qualified - field name and the value is a merged PdfDictionary - with the field content. - @return all the fields - - - Gets the field value. - @param name the fully qualified field name - @return the field's value - - - Gets the field value or null if the field does not - exist or has no value defined. - @param name the fully qualified field name - @return the field value or null - - - Gets the field values for a list or null if the field does not - exist or has no value defined. - @param name the fully qualified field name - @return the field values or null - @since 2.1.4 - - - Gets the PDF file specification contained in the FDF. - @return the PDF file specification contained in the FDF - - - Called when a start tag is found. - @param tag the tag name - @param h the tag's attributes - - - Called when an end tag is found. - @param tag the tag name - - - Called when the document starts to be parsed. - - - Called after the document is parsed. - - - Called when a text element is found. - @param str the text element, probably a fragment. - - - Constructs XmlSignatureAppearance object. - @param writer the writer to which the signature will be written. - - - Holds value of property xades:SigningTime. - - - Holds value of property xades:Description. - - - Holds value of property xades:MimeType. - - - Sets the certificate used to provide the text in the appearance. - This certificate doesn't take part in the actual signing process. - @param signCertificate the certificate - - - Gets the signature date. - @return the signature date - - - Sets the signature date. - @param signDate the signature date - - - Helps to locate xml stream - @return XmlLocator, cannot be null. - - - Constructor for xpath expression in case signing only part of XML document. - @return XpathConstructor, can be null - - - Close PdfStamper - @throws IOException - @throws DocumentException - - - A Hashtable that uses ints as the keys. - - - The hash table data. - - - The total number of entries in the hash table. - - - Rehashes the table when count exceeds this threshold. - - - The load factor for the hashtable. - - - Constructs a new, empty hashtable with the specified initial - - - Constructs a new, empty hashtable with the specified initial - - - Constructs a new, empty hashtable. A default capacity and load factor - - - Returns the number of elements contained in the hashtable. - - - Returns true if the hashtable contains no elements. - - - Returns true if the specified object is an element of the hashtable. - - - Returns true if the collection contains an element for the key. - - - Gets the object associated with the specified key in the - - - Rehashes the content of the table into a bigger table. - - - Removes the element corresponding to the key. Does nothing if the - - - Clears the hash table so that it has no more elements in it. - - - Encapsulates filter behavior for PDF streams. Classes generally interace with this - using the static GetDefaultFilterHandlers() method, then obtain the desired {@link IFilterHandler} - via a lookup. - @since 5.0.4 - - - The main interface for creating a new {@link IFilterHandler} - - - The default {@link IFilterHandler}s used by iText - - - @return the default {@link IFilterHandler}s used by iText - - - Creates a {@link MemoryLimitsAwareOutputStream} which will be used for decompression of the passed pdf stream. - - @param streamDictionary the pdf stream which is going to be decompressed. - @return the {@link ByteArrayOutputStream} which will be used for decompression of the passed pdf stream - - - Handles FLATEDECODE filter - - - Handles ASCIIHEXDECODE filter - - - Handles ASCIIHEXDECODE filter - - - Handles LZWDECODE filter - - - Handles CCITTFAXDECODE filter - - - A filter that doesn't modify the stream at all - - - Handles RUNLENGTHDECODE filter - - - A PdfArray object consisting of nothing but PdfNumber objects - @since 5.1.0 - - - Creates a PdfArray consisting of PdfNumber objects. - @param numbers float values - - - Creates a PdfArray consisting of PdfNumber objects. - @param numbers a List containing PdfNumber objects - - - Signals that a table will continue in the next page. - - @since 5.0.6 - - - This method is called to indicate that table is being split. It's called - before the tableLayout method and before the table is drawn. - - @param table the PdfPTable in use - - - Wrapper class for PdfCopy and PdfSmartCopy. - Allows you to concatenate existing PDF documents with much less code. - - - The Document object for PdfCopy. - - - The actual PdfWriter - - - Creates an instance of the concatenation class. - @param os the Stream for the PDF document - - - Creates an instance of the concatenation class. - @param os the Stream for the PDF document - @param smart do we want PdfCopy to detect redundant content? - - - Adds the pages from an existing PDF document. - @param reader the reader for the existing PDF document - @return the number of pages that were added - @throws DocumentException - @throws IOException - - - Gets the PdfCopy instance so that you can add bookmarks or change preferences before you close PdfConcatenate. - - - Opens the document (if it isn't open already). - Opening the document is done implicitly. - - - We've finished writing the concatenated document. - - - The spacing before the table. - - - The spacing after the table. - - - Defines if the div should be kept on one page if possible - - - IMPROTANT NOTE: be careful with this method because it would return correct result - only in case if {@link PdfDiv#layout(PdfContentByte, boolean, boolean, float, float, float, float)} - was already called. - @return the actual height the div would require to layout it's content - - - IMPROTANT NOTE: be careful with this method because it would return correct result - only in case if {@link PdfDiv#layout(PdfContentByte, boolean, boolean, float, float, float, float)} - was already called. - @return the actual width the div would require to layout it's content - - - Image will be scaled to fit in the div occupied area. - - - Gets all the chunks in this element. - - @return an ArrayList - - - Gets the type of the text element. - - @return a type - - - @see com.itextpdf.text.Element#isContent() - @since iText 2.0.8 - - - @see com.itextpdf.text.Element#isNestable() - @since iText 2.0.8 - - - Processes the element by adding it (or the different parts) to an - ElementListener. - - @param listener an ElementListener - @return true if the element was processed successfully - - - Serial version UID - - - Creates a new instance of PdfIsoConformanceException. - - - Creates a new instance of PdfIsoConformanceException. - @param s - - - A signature field lock dictionary. - - - Enumerates the different actions of a signature lock. - Indicates the set of fields that should be locked: - all the fields in the document, - all the fields specified in the /Fields array - all the fields except those specified in the /Fields array - - - Enumerates the different levels of permissions. - - - Creates a signature lock valid for all fields in the document. - - - Creates a signature lock for all fields in the document, - setting specific permissions. - - - Creates a signature lock for specific fields in the document. - - - Creates a signature lock for specific fields in the document. - - - Add kid to structureTreeRoot from structTreeRoot - - - - An Anchor can be a reference or a destination of a reference. - - - An Anchor is a special kind of . - It is constructed in the same way. - - - - - - - This is the name of the Anchor. - - - - - This is the reference of the Anchor. - - - - - Constructs an Anchor without specifying a leading. - - - Has nine overloads. - - - - - Constructs an Anchor with a certain leading. - - the leading - - - - Constructs an Anchor with a certain Chunk. - - a Chunk - - - - Constructs an Anchor with a certain string. - - a string - - - - Constructs an Anchor with a certain string - and a certain Font. - - a string - a Font - - - - Constructs an Anchor with a certain Chunk - and a certain leading. - - the leading - a Chunk - - - - Constructs an Anchor with a certain leading - and a certain string. - - the leading - a string - - - - Constructs an Anchor with a certain leading, - a certain string and a certain Font. - - the leading - a string - a Font - - - Constructs an Anchor with a certain Phrase. - - @param phrase a Phrase - - - - Processes the element by adding it (or the different parts) to an - - - an IElementListener - true if the element was processed successfully - - - - Gets all the chunks in this element. - - an ArrayList - - - Applies the properties of the Anchor to a Chunk. - @param chunk the Chunk (part of the Anchor) - @param notGotoOK if true, this chunk will determine the local destination - @param localDestination true if the chunk is a local goto and the reference a local destination - @return the value of notGotoOK or false, if a previous Chunk was used to determine the local destination - - - - Gets the type of the text element. - - a type - - - - Name of this Anchor. - - - - - reference of this Anchor. - - - - - reference of this Anchor. - - an Uri - - - - An Annotation is a little note that can be added to a page - on a document. - - - - - - This is a possible annotation type. - - - This is a possible annotation type. - - - This is a possible annotation type. - - - This is a possible annotation type. - - - This is a possible annotation type. - - - This is a possible annotation type. - - - This is a possible annotation type. - - - This is a possible annotation type. - - - This is a possible attribute. - - - This is a possible attribute. - - - This is a possible attribute. - - - This is a possible attribute. - - - This is a possible attribute. - - - This is a possible attribute. - - - This is a possible attribute. - - - This is a possible attribute. - - - This is a possible attribute. - - - This is a possible attribute. - - - This is a possible attribute. - - - This is a possible attribute. - - - This is a possible attribute. - - - This is a possible attribute. - - - This is a possible attribute. - - - This is a possible attribute. - - - This is the type of annotation. - - - This is the title of the Annotation. - - - This is the lower left x-value - - - This is the lower left y-value - - - This is the upper right x-value - - - This is the upper right y-value - - - - Constructs an Annotation with a certain title and some text. - - the lower left x-value - the lower left y-value - the upper right x-value - the upper right y-value - - - - Constructs an Annotation with a certain title and some text. - - the title of the annotation - the content of the annotation - - - - Constructs an Annotation with a certain title and some text. - - the title of the annotation - the content of the annotation - the lower left x-value - the lower left y-value - the upper right x-value - the upper right y-value - - - - Constructs an Annotation. - - the lower left x-value - the lower left y-value - the upper right x-value - the upper right y-value - the external reference - - - - Constructs an Annotation. - - the lower left x-value - the lower left y-value - the upper right x-value - the upper right y-value - the external reference - - - - Constructs an Annotation. - - the lower left x-value - the lower left y-value - the upper right x-value - the upper right y-value - an external PDF file - the destination in this file - - - - Creates a Screen anotation to embed media clips - - the lower left x-value - the lower left y-value - the upper right x-value - the upper right y-value - path to the media clip file - mime type of the media - if true play on display of the page - - - - Constructs an Annotation. - - the lower left x-value - the lower left y-value - the upper right x-value - the upper right y-value - an external PDF file - a page number in this file - - - - Constructs an Annotation. - - the lower left x-value - the lower left y-value - the upper right x-value - the upper right y-value - a named destination in this file - - Has nine overloads. - - - - - Constructs an Annotation. - - the lower left x-value - the lower left y-value - the upper right x-value - the upper right y-value - an external application - parameters to pass to this application - the operation to pass to this application - the default directory to run this application in - - - - Gets the type of the text element - - - - - Processes the element by adding it (or the different parts) to an - IElementListener. - - an IElementListener - true if the element was process successfully - - - - Gets all the chunks in this element. - - an ArrayList - - - - Sets the dimensions of this annotation. - - the lower left x-value - the lower left y-value - the upper right x-value - the upper right y-value - - - - Returns the lower left x-value. - - a value - - - - Returns the lower left y-value. - - a value - - - - Returns the uppper right x-value. - - a value - - - - Returns the uppper right y-value. - - a value - - - - Returns the lower left x-value. - - the default value - a value - - - - Returns the lower left y-value. - - the default value - a value - - - - Returns the upper right x-value. - - the default value - a value - - - - Returns the upper right y-value. - - the default value - a value - - - - Returns the type of this Annotation. - - a type - - - - Returns the title of this Annotation. - - a name - - - - Gets the content of this Annotation. - - a reference - - - - Gets the content of this Annotation. - - a reference - - - @see com.lowagie.text.Element#isContent() - @since iText 2.0.8 - - - @see com.lowagie.text.Element#isNestable() - @since iText 2.0.8 - - - - Signals an attempt to create an Element that hasn't got the right form. - - - - - - - Base class for Color, serves as wrapper class for - to allow extension. - - - - Construct a new BaseColor. - @param red the value for the red gamma - @param green the value for the green gamma - @param blue the value for the blue gamma - @param alpha the value for the alpha gamma - - - @param red - @param green - @param blue - - - Construct a BaseColor with float values. - @param red - @param green - @param blue - @param alpha - - - Construct a BaseColor with float values. - @param red - @param green - @param blue - - - Construct a BaseColor by setting the combined value. - @param argb - - - @return the combined color value - - - - @return the value for red - - - - @return the value for green - - - - @return the value for blue - - - - @return the value for the alpha channel - - - Make this BaseColor brighter. Factor used is 0.7. - @return the new BaseColor - - - Make this color darker. Factor used is 0.7 - @return the new BaseColor - - - - A Chapter is a special Section. - - - A chapter number has to be created using a Paragraph as title - and an int as chapter number. The chapter number is shown be - default. If you don't want to see the chapter number, you have to set the - numberdepth to 0. - - - - Paragraph title2 = new Paragraph("This is Chapter 2", FontFactory.GetFont(FontFactory.HELVETICA, 18, Font.BOLDITALIC, new BaseColor(0, 0, 255))); - Chapter chapter2 = new Chapter(title2, 2); - chapter2.SetNumberDepth(0); - Paragraph someText = new Paragraph("This is some text"); - chapter2.Add(someText); - Paragraph title21 = new Paragraph("This is Section 1 in Chapter 2", FontFactory.GetFont(FontFactory.HELVETICA, 16, Font.BOLD, new BaseColor(255, 0, 0))); - Section section1 = chapter2.AddSection(title21); - Paragraph someSectionText = new Paragraph("This is some silly paragraph in a chapter and/or section. It contains some text to test the functionality of Chapters and Section."); - section1.Add(someSectionText); - - - - - Constructs a new Chapter. - @param number the Chapter number - - - - Constructs a new Chapter. - - the Chapter title (as a Paragraph) - the Chapter number - - Has three overloads. - - - - - Constructs a new Chapter. - - the Chapter title (as a string) - the Chapter number - - Has three overloads. - - - - - Gets the type of the text element. - - a type - - - @see com.lowagie.text.Element#isNestable() - @since iText 2.0.8 - - - Chapter with auto numbering. - - @author Michael Niedermair - - - Is the chapter number already set? - @since 2.1.4 - - - Create a new object. - - @param para the Chapter title (as a Paragraph) - - - Create a new objet. - - @param title the Chapter title (as a String) - - - Create a new section for this chapter and ad it. - - @param title the Section title (as a String) - @return Returns the new section. - - - Create a new section for this chapter and add it. - - @param title the Section title (as a Paragraph) - @return Returns the new section. - - - Changes the Chapter number. - @param number the new chapter number - @since 2.1.4 - - - - This is the smallest significant part of text that can be added to a document. - - - Most elements can be divided in one or more Chunks. - A chunk is a string with a certain Font. - all other layoutparameters should be defined in the object to which - this chunk of text is added. - - - - Chunk chunk = new Chunk("Hello world", FontFactory.GetFont(FontFactory.COURIER, 20, Font.ITALIC, new BaseColor(255, 0, 0))); - document.Add(chunk); - - - - - The character stand in for an image or a separator. - - - This is a Chunk containing a newline. - - - This is a Chunk containing a newpage. - - - This is the content of this chunk of text. - - - This is the Font of this chunk of text. - - - Contains some of the attributes for this Chunk. - - - - Empty constructor. - - - Has six overloads. - - - - A Chunk copy constructor. - @param ck the Chunk to be copied - - - - Constructs a chunk of text with a certain content and a certain Font. - - the content - the font - - - - Constructs a chunk of text with a certain content, without specifying a Font. - - the content - - - Constructs a chunk of text with a char and a certain Font. - - @param c the content - @param font the font - - - Constructs a chunk of text with a char, without specifying a Font. - - @param c the content - - - - Constructs a chunk containing an Image. - - the image - the image offset in the x direction - the image offset in the y direction - - - Key for drawInterface of the Separator. - @since 2.1.2 - - - Creates a separator Chunk. - Note that separator chunks can't be used in combination with tab chunks! - @param separator the drawInterface to use to draw the separator. - @since 2.1.2 - - - Creates a separator Chunk. - Note that separator chunks can't be used in combination with tab chunks! - @param separator the drawInterface to use to draw the separator. - @param vertical true if this is a vertical separator - @since 2.1.2 - - - Key for drawInterface of the tab. - @since 2.1.2 - - - Key for tab stops of the tab. - @since 5.4.1 - - - Creates a tab Chunk. - Note that separator chunks can't be used in combination with tab chunks! - @param separator the drawInterface to use to draw the tab. - @param tabPosition an X coordinate that will be used as start position for the next Chunk. - @since 2.1.2 - - - Creates a tab Chunk. - Note that separator chunks can't be used in combination with tab chunks! - @param separator the drawInterface to use to draw the tab. - @param tabPosition an X coordinate that will be used as start position for the next Chunk. - @param newline if true, a newline will be added if the tabPosition has already been reached. - @since 2.1.2 - - - Creates a tab Chunk. - - @param tabInterval an interval that will be used if tab stops are omitted. - @param isWhitespace if true, the current tab is treated as white space. - @since 5.4.1 - - - - Constructs a chunk containing an Image. - - the image - the image offset in the x direction - the image offset in the y direction - true if the leading has to be adapted to the image - - - - Processes the element by adding it (or the different parts) to an - IElementListener. - - an IElementListener - true if the element was processed successfully - - - - Gets the type of the text element. - - a type - - - - Gets all the chunks in this element. - - an ArrayList - - - - appends some text to this Chunk. - - a string - a StringBuilder - - - - Get/set the font of this Chunk. - - a Font - - - - Returns the content of this Chunk. - - a string - - - - Checks is this Chunk is empty. - - false if the Chunk contains other characters than space. - - - Gets the width of the Chunk in points. - @return a width in points - - - - Checks the attributes of this Chunk. - - false if there aren't any. - - - Checks the accessible attributes of this Chunk. - - @return false if there aren't any. - - - - Sets/Gets the attributes for this Chunk. - - - It may be null. - - a Hashtable - - - - Sets an arbitrary attribute. - - the key for the attribute - the value of the attribute - this Chunk - - - Key for text horizontal scaling. - - - Sets the text horizontal scaling. A value of 1 is normal and a value of 0.5f - shrinks the text to half it's width. - @param scale the horizontal scaling factor - @return this Chunk - - - Gets the horizontal scaling. - @return a percentage in float - - - Key for underline. - - - Sets an horizontal line that can be an underline or a strikethrough. - Actually, the line can be anywhere vertically and has always the - Chunk width. Multiple call to this method will - produce multiple lines. - @param thickness the absolute thickness of the line - @param yPosition the absolute y position relative to the baseline - @return this Chunk - - - Sets an horizontal line that can be an underline or a strikethrough. - Actually, the line can be anywhere vertically and has always the - Chunk width. Multiple call to this method will - produce multiple lines. - @param color the color of the line or null to follow - the text color - @param thickness the absolute thickness of the line - @param thicknessMul the thickness multiplication factor with the font size - @param yPosition the absolute y position relative to the baseline - @param yPositionMul the position multiplication factor with the font size - @param cap the end line cap. Allowed values are - PdfContentByte.LINE_CAP_BUTT, PdfContentByte.LINE_CAP_ROUND and - PdfContentByte.LINE_CAP_PROJECTING_SQUARE - @return this Chunk - - - Key for sub/basescript. - - - - Sets the text displacement relative to the baseline. Positive values rise the text, - negative values lower the text. - - - It can be used to implement sub/basescript. - - the displacement in points - this Chunk - - - Key for text skewing. - - - Skews the text to simulate italic and other effects. - Try alpha=0 and beta=12. - @param alpha the first angle in degrees - @param beta the second angle in degrees - @return this Chunk - - - Key for background. - - - - Sets the color of the background Chunk. - - the color of the background - this Chunk - - - Sets the color and the size of the background Chunk. - @param color the color of the background - @param extraLeft increase the size of the rectangle in the left - @param extraBottom increase the size of the rectangle in the bottom - @param extraRight increase the size of the rectangle in the right - @param extraTop increase the size of the rectangle in the top - @return this Chunk - - - Key for text rendering mode. - - - Sets the text rendering mode. It can outline text, simulate bold and make - text invisible. - @param mode the text rendering mode. It can be PdfContentByte.TEXT_RENDER_MODE_FILL, - PdfContentByte.TEXT_RENDER_MODE_STROKE, PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE - and PdfContentByte.TEXT_RENDER_MODE_INVISIBLE. - @param strokeWidth the stroke line width for the modes PdfContentByte.TEXT_RENDER_MODE_STROKE and - PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE. - @param strokeColor the stroke color or null to follow the text color - @return this Chunk - - - Key for split character. - - - - Sets the split characters. - - the SplitCharacter interface - this Chunk - - - Key for hyphenation. - - - - sets the hyphenation engine to this Chunk. - - the hyphenation engine - this Chunk - - - Key for remote goto. - - - - Sets a goto for a remote destination for this Chunk. - - the file name of the destination document - the name of the destination to go to - this Chunk - - - - Sets a goto for a remote destination for this Chunk. - - the file name of the destination document - the page of the destination to go to. First page is 1 - this Chunk - - - Key for local goto. - - - - Sets a local goto for this Chunk. - - - There must be a local destination matching the name. - - the name of the destination to go to - this Chunk - - - Key for local destination. - - - - Sets a local destination for this Chunk. - - the name for this destination - this Chunk - - - Key for generic tag. - - - - Sets the generic tag Chunk. - - - The text for this tag can be retrieved with PdfPageEvent. - - the text for the tag - this Chunk - - - Key for line-height (alternative for leading in Phrase). - - - Sets a line height tag. - - @return this Chunk - - - Key for image. - - - - Returns the image. - - an Image - - - Key for Action. - - - - Sets an action for this Chunk. - - the action - this Chunk - - - - Sets an anchor for this Chunk. - - the Uri to link to - this Chunk - - - - Sets an anchor for this Chunk. - - the url to link to - this Chunk - - - Key for newpage. - - - - Sets a new page tag. - - this Chunk - - - Key for annotation. - - - - Sets a generic annotation to this Chunk. - - the annotation - this Chunk - - - @see com.lowagie.text.Element#isContent() - @since iText 2.0.8 - - - @see com.lowagie.text.Element#isNestable() - @since iText 2.0.8 - - - Returns the hyphenation (if present). - @param hyphenation a HyphenationEvent instance - @since 2.1.2 - - - Key for color. - - - Key for encoding. - - - Key for character spacing. - - - Sets the character spacing. - - @param charSpace the character spacing value - @return this Chunk - - - Gets the character spacing. - - @return a value in float - - - Key for word spacing. - - - Sets the word spacing. - - @param wordSpace the word spacing value - @return this Chunk - - - Gets the word spacing. - - @return a value in float - - - Sets the textual expansion of the abbreviation or acronym. - It is highly recommend to set textuual expansion when generating PDF/UA documents. - @param value - - - - A generic Document class. - - - All kinds of Text-elements can be added to a HTMLDocument. - The Document signals all the listeners when an element - has been added.

    -

      -
    1. Once a document is created you can add some meta information. -
    2. You can also set the headers/footers. -
    3. You have to open the document before you can write content. -
    4. You can only write content (no more meta-formation!) once a document is opened. -
    5. When you change the header/footer on a certain page, this will be effective starting on the next page. -
    6. Ater closing the document, every listener (as well as its OutputStream) is closed too. -
    -
    - - - // creation of the document with a certain size and certain margins - Document document = new Document(PageSize.A4, 50, 50, 50, 50); - try { - // creation of the different writers - HtmlWriter.GetInstance(document, System.out); - PdfWriter.GetInstance(document, new FileOutputStream("text.pdf")); - // we add some meta information to the document - document.AddAuthor("Bruno Lowagie"); - document.AddSubject("This is the result of a Test."); - - // we define a header and a footer - HeaderFooter header = new HeaderFooter(new Phrase("This is a header."), false); - HeaderFooter footer = new HeaderFooter(new Phrase("This is page "), new Phrase(".")); - footer.SetAlignment(Element.ALIGN_CENTER); - document.SetHeader(header); - document.SetFooter(footer); - // we open the document for writing - document.Open(); - document.Add(new Paragraph("Hello world")); - } - catch (DocumentException de) { - Console.Error.WriteLine(de.Message); - } - document.Close(); - - -
    - - Allows the pdf documents to be produced without compression for debugging purposes. - - - Scales the WMF font size. The default value is 0.86. - - - The IDocListener. - - - Is the document open or not? - - - Has the document already been closed? - - - The size of the page. - - - margin in x direction starting from the left - - - margin in x direction starting from the right - - - margin in y direction starting from the top - - - margin in y direction starting from the bottom - - - mirroring of the top/bottom margins - @since 2.1.6 - - - Content of JavaScript onLoad function - - - Content of JavaScript onUnLoad function - - - Style class in HTML body tag - - - Current pagenumber - - - This is a chapter number in case ChapterAutoNumber is used. - - - - Constructs a new Document-object. - - - Has three overloads. - - - - - Constructs a new Document-object. - - the pageSize - - - - Constructs a new Document-object. - - the pageSize - the margin on the left - the margin on the right - the margin on the top - the margin on the bottom - - - - Adds a IDocListener to the Document. - - the new IDocListener - - - - Removes a IDocListener from the Document. - - the IDocListener that has to be removed. - - - - Adds an Element to the Document. - - the Element to add - true if the element was added, false if not - - - - Opens the document. - - - Once the document is opened, you can't write any Header- or Meta-information - anymore. You have to open the document before you can begin to add content - to the body of the document. - - - - - Opens the document. - - - Version for languages that are not case-dependant. - Once the document is opened, you can't write any Header- or Meta-information - anymore. You have to open the document before you can begin to add content - to the body of the document. - - - - - Sets the pagesize. - - the new pagesize - a bool - - - - Sets the margins. - - the margin on the left - the margin on the right - the margin on the top - the margin on the bottom - - - - - Signals that an new page has to be started. - - true if the page was added, false if not. - - - - Sets the page number to 0. - - - - - Sets the page number. - - an int - - - - Returns the current page number. - - an int - - - - Closes the document. - - - Once all the content has been written in the body, you have to close - the body. After that nothing can be written to the body anymore. - - - - - Closes the document. - - - Version for languages that are not case-dependant. - Once all the content has been written in the body, you have to close - the body. After that nothing can be written to the body anymore. - - - - - Adds a user defined header to the document. - - the name of the header - the content of the header - true if successful, false otherwise - - - - Adds the title to a Document. - - the title - true if successful, false otherwise - - - - Adds the subject to a Document. - - the subject - true if successful, false otherwise - - - - Adds the keywords to a Document. - - keywords to add - true if successful, false otherwise - - - - Adds the author to a Document. - - the name of the author - true if successful, false otherwise - - - - Adds the creator to a Document. - - the name of the creator - true if successful, false otherwise - - - - Adds the producer to a Document. - - true if successful, false otherwise - - - Adds a language to th document. Required for PDF/UA compatible documents. - @param language - @return true if successfull, false otherwise - - - - Adds the current date and time to a Document. - - true if successful, false otherwise - - - - Returns the left margin. - - the left margin - - - - Return the right margin. - - the right margin - - - - Returns the top margin. - - the top margin - - - - Returns the bottom margin. - - the bottom margin - - - - Returns the lower left x-coordinate. - - the lower left x-coordinate - - - - Returns the upper right x-coordinate. - - the upper right x-coordinate. - - - - Returns the upper right y-coordinate. - - the upper right y-coordinate. - - - - Returns the lower left y-coordinate. - - the lower left y-coordinate. - - - - Returns the lower left x-coordinate considering a given margin. - - a margin - the lower left x-coordinate - - - - Returns the upper right x-coordinate, considering a given margin. - - a margin - the upper right x-coordinate - - - - Returns the upper right y-coordinate, considering a given margin. - - a margin - the upper right y-coordinate - - - - Returns the lower left y-coordinate, considering a given margin. - - a margin - the lower left y-coordinate - - - - Gets the pagesize. - - the page size - - - - Checks if the document is open. - - true if the document is open - - - - Gets the JavaScript onLoad command. - - the JavaScript onLoad command. - - - - Gets the JavaScript onUnLoad command. - - the JavaScript onUnLoad command - - - - Gets the style class of the HTML body tag - - the style class of the HTML body tag - - - - - Gets the margin mirroring flag. - - @return the margin mirroring flag - - - - Signals that an error has occurred in a Document. - - - - - - - - - Constructs a new DocumentException - - - Has two overloads. - - - - - Construct a new DocumentException - - error message - - - - Constructs a DocumentException with a message and a Exception. - - a message describing the exception - an exception that has to be turned into a DocumentException - - - - An abstract Writer class for documents. - - - DocWriter is the abstract class of several writers such - as PdfWriter and HtmlWriter. - A DocWriter can be added as a DocListener - to a certain Document by getting an instance (see method - GetInstance() in the specific writer-classes). - Every Element added to the original Document - will be written to the stream of the listening - DocWriter. - - - - - - This is some byte that is often used. - - - This is some byte that is often used. - - - This is some byte that is often used. - - - This is some byte that is often used. - - - This is some byte that is often used. - - - This is some byte that is often used. - - - This is some byte that is often used. - - - This is some byte that is often used. - - - The pageSize. - - - This is the document that has to be written. - - - The stream of this writer. - - - Is the writer open for writing? - - - Do we have to pause all writing actions? - - - Closes the stream on document close - - - - Constructs a DocWriter. - - The Document that has to be written - The Stream the writer has to write to. - - - - Signals that an Element was added to the Document. - - - This method should be overriden in the specific DocWriter classes - derived from this abstract class. - - - false - - - - Signals that the Document was opened. - - - - - Sets the pagesize. - - the new pagesize - a boolean - - - - Sets the margins. - - - This does nothing. Has to be overridden if needed. - - the margin on the left - the margin on the right - the margin on the top - the margin on the bottom - - - - - Signals that an new page has to be started. - - - This does nothing. Has to be overridden if needed. - - true if the page was added, false if not. - - - - Sets the page number to 0. - - - This method should be overriden in the specific DocWriter classes - derived from this abstract class if they actually support the use of - pagenumbers. - - - - - Sets the page number. - - - This method should be overriden in the specific DocWriter classes - derived from this abstract class if they actually support the use of - pagenumbers. - - - - - Signals that the Document was closed and that no other - Elements will be added. - - - - - Converts a string into a Byte array - according to the ISO-8859-1 codepage. - - the text to be converted - the conversion result - - - - Let the writer know that all writing has to be paused. - - - - Checks if writing is paused. - - @return true if writing temporarely has to be paused, false otherwise. - - - - Let the writer know that writing may be resumed. - - - - - Flushes the Stream. - - - - - Writes a string to the stream. - - the string to write - - - - Writes a number of tabs. - - the number of tabs to add - - - - Writes a key-value pair to the stream. - - the name of an attribute - the value of an attribute - - - - Writes a starttag to the stream. - - the name of the tag - - - - Writes an endtag to the stream. - - the name of the tag - - - - Writes an endtag to the stream. - - - - - Writes the markup attributes of the specified MarkupAttributes - object to the stream. - - the MarkupAttributes to write. - - - - @see com.lowagie.text.DocListener#setMarginMirroring(boolean) - @since 2.1.6 - - - - Interface for a text element. - - - - - - - - - - - - - - - - - - - - - - This is a possible type of Element. - - - This is a possible type of Element. - - - This is a possible type of Element. - - - This is a possible type of Element. - - - This is a possible type of Element. - - - This is a possible type of Element. - - - This is a possible type of Element. - - - This is a possible type of Element. - - - This is a possible type of Element. - - - This is a possible type of Element. - - - This is a possible type of Element. - - - This is a possible type of Element. - - - This is a possible type of Element - - - This is a possible type of Element - - - This is a possible type of Element - - - This is a possible type of Element - - - This is a possible type of Element - - - This is a possible type of Element. - - - This is a possible type of Element. - - - This is a possible type of Element. - - - This is a possible type of Element. - - - This is a possible type of Element. - - - This is a possible type of Element. - - - This is a possible type of Element. - - - This is a possible type of Element. - @since 2.1.5 - - - This is a possible type of Element. - @since 5.3.0 - - - This is a possible type of Element. - - - This is a possible type of Element. - @since 2.1.2 - - - This is an element thats not an element. - @see WritableDirectElement - - - - A possible value for paragraph Element. This - specifies that the text is aligned to the left - indent and extra whitespace should be placed on - the right. - - - - - A possible value for paragraph Element. This - specifies that the text is aligned to the left - indent and extra whitespace should be placed on - the right. - - - - - A possible value for paragraph Element. This - specifies that the text is aligned to the center - and extra whitespace should be placed equally on - the left and right. - - - - - A possible value for paragraph Element. This - specifies that the text is aligned to the right - indent and extra whitespace should be placed on - the left. - - - - - A possible value for paragraph Element. This - specifies that extra whitespace should be spread - out through the rows of the paragraph with the - text lined up with the left and right indent - except on the last line which should be aligned - to the left. - - - - - A possible value for vertical Element. - - - - - A possible value for vertical Element. - - - - - A possible value for vertical Element. - - - - - A possible value for vertical Element. - - - - - Does the same as ALIGN_JUSTIFIED but the last line is also spread out. - - - - - Pure two-dimensional encoding (Group 4) - - - - - Pure one-dimensional encoding (Group 3, 1-D) - - - - - Mixed one- and two-dimensional encoding (Group 3, 2-D) - - - - - A flag indicating whether 1-bits are to be interpreted as black pixels - and 0-bits as white pixels, - - - - - A flag indicating whether the filter expects extra 0-bits before each - encoded line so that the line begins on a byte boundary. - - - - - A flag indicating whether end-of-line bit patterns are required to be - present in the encoding. - - - - - A flag indicating whether the filter expects the encoded data to be - terminated by an end-of-block pattern, overriding the Rows - parameter. The use of this flag will set the key /EndOfBlock to false. - - - - Localizes error messages. The messages are located in the package - com.lowagie.text.error_messages in the form language_country.lng. - The internal file encoding is UTF-8 without any escape chars, it's not a - normal property file. See en.lng for more information on the internal format. - @author Paulo Soares (psoares@glintt.com) - - - Get a message without parameters. - @param key the key to the message - @return the message - - - Get a message with parameters. The parameters will replace the strings - "{1}", "{2}", ..., "{n}" found in the message. - @param key the key to the message - @param p the variable parameter - @return the message - - - Sets the language to be used globally for the error messages. The language - is a two letter lowercase country designation like "en" or "pt". The country - is an optional two letter uppercase code like "US" or "PT". - @param language the language - @param country the country - @return true if the language was found, false otherwise - @throws IOException on error - - - Sets the error messages directly from a Reader. - @param r the Reader - @throws IOException on error - - - Typed exception used when opening an existing PDF document. - Gets thrown when the document isn't a valid PDF document. - @since 2.1.5 It was written for iText 2.0.8, but moved to another package - - - Creates an exception saying the user password was incorrect. - - - Typed exception used when creating PDF syntax that isn't valid. - @since 2.1.6 - - - Creates an exception saying the PDF syntax isn't correct. - @param message some extra info about the exception - - - RuntimeException to indicate that the provided Image is invalid/corrupted. - Should only be thrown/not caught when ignoring invalid images. - @since 5.4.2 - - - Typed exception used when opening an existing PDF document. - Gets thrown when the document isn't a valid PDF document. - @since 2.1.5 - - - Creates an instance of with a message and no cause - @param message the reason why the document isn't a PDF document according to iText. - - - Creates an exception with a message and a cause - @param message the reason why the document isn't a PDF document according to iText. - @param cause the cause of the exception, if any - - - Typed exception used when opening an existing PDF document. - Gets thrown when the document isn't a valid PDF document according to iText, - but it's different from the InvalidPdfException in the sense that it may - be an iText limitation (most of the times it isn't but you might have - bumped into something that has been added to the PDF specs, but that isn't - supported in iText yet). - @since 2.1.5 - - - Creates an instance of an UnsupportedPdfException. - @param message the reason why the document isn't a PDF document according to iText. - - - This class can produce String combinations representing a number built with - Greek letters (from alpha to omega, then alpha alpha, alpha beta, alpha gamma). - We are aware of the fact that the original Greek numbering is different; - See http://www.cogsci.indiana.edu/farg/harry/lan/grknum.htm#ancient - but this isn't implemented yet; the main reason being the fact that we - need a font that has the obsolete Greek characters qoppa and sampi. - - - Changes an int into a lower case Greek letter combination. - @param index the original number - @return the letter combination - - - Changes an int into a lower case Greek letter combination. - @param index the original number - @return the letter combination - - - Changes an int into a upper case Greek letter combination. - @param index the original number - @return the letter combination - - - Changes an int into a Greek letter combination. - @param index the original number - @return the letter combination - - - This class can produce String combinations representing a number. - "a" to "z" represent 1 to 26, "AA" represents 27, "AB" represents 28, - and so on; "ZZ" is followed by "AAA". - - - Translates a positive integer (not equal to zero) - into a String using the letters 'a' to 'z'; - 1 = a, 2 = b, ..., 26 = z, 27 = aa, 28 = ab,... - - - Translates a positive integer (not equal to zero) - into a String using the letters 'a' to 'z'; - 1 = a, 2 = b, ..., 26 = z, 27 = aa, 28 = ab,... - - - Translates a positive integer (not equal to zero) - into a String using the letters 'A' to 'Z'; - 1 = A, 2 = B, ..., 26 = Z, 27 = AA, 28 = AB,... - - - Translates a positive integer (not equal to zero) - into a String using the letters 'a' to 'z' - (a = 1, b = 2, ..., z = 26, aa = 27, ab = 28,...). - - - This class can produce String combinations representing a roman number. - - - Helper class for Roman Digits - - - part of a roman number - - - value of the roman digit - - - can the digit be used as a prefix - - - Constructs a roman digit - @param digit the roman digit - @param value the value - @param pre can it be used as a prefix - - - Array with Roman digits. - - - Changes an int into a lower case roman number. - @param index the original number - @return the roman number (lower case) - - - Changes an int into a lower case roman number. - @param index the original number - @return the roman number (lower case) - - - Changes an int into an upper case roman number. - @param index the original number - @return the roman number (lower case) - - - Changes an int into a roman number. - @param index the original number - @return the roman number (lower case) - - - - Contains all the specifications of a font: fontfamily, size, style and color. - - - - Paragraph p = new Paragraph("This is a paragraph", - new Font(Font.HELVETICA, 18, Font.BOLDITALIC, new BaseColor(0, 0, 255))); - - - - - this is a possible style. - - - this is a possible style. - - - this is a possible style. - - - this is a possible style. - - - this is a possible style. - - - this is a possible style. - - - the value of an undefined attribute. - - - the value of the default size. - - - the value of the fontfamily. - - - the value of the fontsize. - - - the value of the style. - - - the value of the color. - - - the external font - - - Copy constructor of a Font - @param other the font that has to be copied - - - - Constructs a Font. - - the family to which this font belongs - the size of this font - the style of this font - the BaseColor of this font. - - - - Constructs a Font. - - the external font - the size of this font - the style of this font - the BaseColor of this font. - - - - Constructs a Font. - - the external font - the size of this font - the style of this font - - - - Constructs a Font. - - the external font - the size of this font - - - - Constructs a Font. - - the external font - - - - Constructs a Font. - - the family to which this font belongs - the size of this font - the style of this font - - - - Constructs a Font. - - the family to which this font belongs - the size of this font - - - - Constructs a Font. - - the family to which this font belongs - - - - Constructs a Font. - - - Has nine overloads. - - - - - Compares this Font with another - - the other Font - a value - - - - Gets the family of this font. - - the value of the family - - - - Gets the familyname as a string. - - the familyname - - - - Sets the family using a String ("Courier", - "Helvetica", "Times New Roman", "Symbol" or "ZapfDingbats"). - - A String representing a certain font-family. - - - - Translates a string-value of a certain family - into the index that is used for this family in this class. - - A string representing a certain font-family - the corresponding index - - - - Get/set the size of this font. - - the size of this font - - - Gets the size that can be used with the calculated BaseFont. - @return the size that can be used with the calculated BaseFont - - - Gets the leading that can be used with this font. - - @param multipliedLeading - a certain multipliedLeading - @return the height of a line - - - - Gets the style of this font. - - the style of this font - - - Gets the style that can be used with the calculated BaseFont. - @return the style that can be used with the calculated BaseFont - - - - checks if this font is Bold. - - a boolean - - - - checks if this font is Bold. - - a boolean - - - - checks if this font is underlined. - - a boolean - - - - checks if the style of this font is STRIKETHRU. - - a boolean - - - - Sets the style using a String containing one of - more of the following values: normal, bold, italic, underline, strike. - - A String representing a certain style. - - - Sets the style. - @param style the style. - - - - Translates a string-value of a certain style - into the index value is used for this style in this class. - - a string - the corresponding value - - - - Get/set the color of this font. - - the color of this font - - - - Sets the color. - - the red-value of the new color - the green-value of the new color - the blue-value of the new color - - - - Gets the BaseFont inside this object. - - the BaseFont - - - Gets the BaseFont this class represents. - For the built-in fonts a BaseFont is calculated. - @param specialEncoding true to use the special encoding for Symbol and ZapfDingbats, - false to always use Cp1252 - @return the BaseFont this class represents - - - - Checks if the properties of this font are undefined or null. -

    - If so, the standard should be used. -

    - a boolean -
    - - - - If you are using True Type fonts, you can declare the paths of the different ttf- and ttc-files - to this static class first and then create fonts in your code using one of the static getFont-method - without having to enter a path as parameter. - - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is a possible value of a base 14 type 1 font - - - This is the default encoding to use. - - - This is the default value of the embedded variable. - - - Creates new FontFactory - - - - Constructs a Font-object. - - the name of the font - the encoding of the font - true if the font is to be embedded in the PDF - the size of this font - the style of this font - the BaseColor of this font - a Font object - - - - Constructs a Font-object. - - the name of the font - the encoding of the font - true if the font is to be embedded in the PDF - the size of this font - the style of this font - the BaseColor of this font - true if the font comes from the cache or is added to the cache if new, false if the font is always created new - a Font object - - - - Constructs a Font-object. - - the name of the font - the encoding of the font - true if the font is to be embedded in the PDF - the size of this font - the style of this font - a Font object - - - - Constructs a Font-object. - - the name of the font - the encoding of the font - true if the font is to be embedded in the PDF - the size of this font - - - - - Constructs a Font-object. - - the name of the font - the encoding of the font - true if the font is to be embedded in the PDF - a Font object - - - - Constructs a Font-object. - - the name of the font - the encoding of the font - the size of this font - the style of this font - the BaseColor of this font - a Font object - - - - Constructs a Font-object. - - the name of the font - the encoding of the font - the size of this font - the style of this font - a Font object - - - - Constructs a Font-object. - - the name of the font - the encoding of the font - the size of this font - a Font object - - - - Constructs a Font-object. - - the name of the font - the encoding of the font - a Font object - - - - Constructs a Font-object. - - the name of the font - the size of this font - the style of this font - the BaseColor of this font - a Font object - - - - Constructs a Font-object. - - the name of the font - the size of this font - the BaseColor of this font - a Font object - - - - Constructs a Font-object. - - the name of the font - the size of this font - the style of this font - a Font object - - - - Constructs a Font-object. - - the name of the font - the size of this font - a Font object - - - - Constructs a Font-object. - - the name of the font - a Font object - - - Register a font by giving explicitly the font family and name. - @param familyName the font family - @param fullName the font name - @param path the font path - - - - Register a ttf- or a ttc-file. - - the path to a ttf- or ttc-file - - - - Register a ttf- or a ttc-file and use an alias for the font contained in the ttf-file. - - the path to a ttf- or ttc-file - the alias you want to use for the font - - - Register all the fonts in a directory. - @param dir the directory - @return the number of fonts registered - - - - Register fonts in some probable directories. It usually works in Windows, - Linux and Solaris. - @return the number of fonts registered - - - - Gets a set of registered fontnames. - - a set of registered fontnames - - - - Gets a set of registered font families. - - a set of registered font families - - - - Checks whether the given font is contained within the object - - the name of the font - true if font is contained within the object - - - - Checks if a certain font is registered. - - the name of the font that has to be checked - true if the font is found - - - - If you are using True Type fonts, you can declare the paths of the different ttf- and ttc-files - to this class first and then create fonts in your code using one of the getFont method - without having to enter a path as parameter. - - - - - This is a map of postscriptfontnames of True Type fonts and the path of their ttf- or ttc-file. - - - This is a map of fontfamilies. - - - This is the default encoding to use. - - - This is the default value of the embedded variable. - - - Creates new FontFactory - - - - Constructs a Font-object. - - the name of the font - the encoding of the font - true if the font is to be embedded in the PDF - the size of this font - the style of this font - the BaseColor of this font - a Font object - - - - Constructs a Font-object. - - the name of the font - the encoding of the font - true if the font is to be embedded in the PDF - the size of this font - the style of this font - the BaseColor of this font - true if the font comes from the cache or is added to the cache if new, false if the font is always created new - a Font object - - - - Constructs a Font-object. - - the name of the font - the encoding of the font - true if the font is to be embedded in the PDF - the size of this font - the style of this font - a Font object - - - - Constructs a Font-object. - - the name of the font - the encoding of the font - true if the font is to be embedded in the PDF - the size of this font - - - - - Constructs a Font-object. - - the name of the font - the encoding of the font - true if the font is to be embedded in the PDF - a Font object - - - - Constructs a Font-object. - - the name of the font - the encoding of the font - the size of this font - the style of this font - the BaseColor of this font - a Font object - - - - Constructs a Font-object. - - the name of the font - the encoding of the font - the size of this font - the style of this font - a Font object - - - - Constructs a Font-object. - - the name of the font - the encoding of the font - the size of this font - a Font object - - - - Constructs a Font-object. - - the name of the font - the encoding of the font - a Font object - - - - Constructs a Font-object. - - the name of the font - the size of this font - the style of this font - the BaseColor of this font - a Font object - - - - Constructs a Font-object. - - the name of the font - the size of this font - the BaseColor of this font - a Font object - - - - Constructs a Font-object. - - the name of the font - the size of this font - the style of this font - a Font object - - - - Constructs a Font-object. - - the name of the font - the size of this font - a Font object - - - - Constructs a Font-object. - - the name of the font - a Font object - - - Register a font by giving explicitly the font family and name. - @param familyName the font family - @param fullName the font name - @param path the font path - - - - Register a ttf- or a ttc-file. - - the path to a ttf- or ttc-file - - - - Register a ttf- or a ttc-file and use an alias for the font contained in the ttf-file. - - the path to a ttf- or ttc-file - the alias you want to use for the font - - - Register all the fonts in a directory. - @param dir the directory - @return the number of fonts registered - - - - Register fonts in windows - @return the number of fonts registered - - - - Gets a set of registered fontnames. - - a set of registered fontnames - - - - Gets a set of registered font families. - - a set of registered font families - - - - Checks if a certain font is registered. - - the name of the font that has to be checked - true if the font is found - - - - A special-version of LIST whitch use greek-letters. - - @see com.lowagie.text.List - - - Initialization - - @param symbolIndent indent - - - Initialisierung - - @param symbolIndent indent - - - Initialisierung - @param greeklower greek-char in lowercase - @param symbolIndent indent - - - change the font to SYMBOL - - - Adds an Object to the List. - - @param o the object to add. - @return true if adding the object succeeded - - - - This is an Element that contains - some userdefined meta information about the document. - - - - Header header = new Header("inspired by", "William Shakespeare"); - - - - - This is the content of this chunk of text. - - - - Constructs a Header. - - the name of the meta-information - the content - - - - Returns the name of the meta information. - - a string - - - - List with the HTML translation of all the characters. - - - Set containing tags that trigger a new line. - @since iText 5.0.6 - - - Converts a String to the HTML-format of this String. - - @param string The String to convert - @return a String - - - Converts a BaseColor into a HTML representation of this BaseColor. - - @param color the BaseColor that has to be converted. - @return the HTML representation of this BaseColor - - - Translates the alignment value. - - @param alignment the alignment value - @return the translated value - - - Returns true if the tag causes a new line like p, br etc. - @since iText 5.0.6 - - - Static final values of supported HTML tags and attributes. - @since 5.0.6 - @deprecated since 5.5.2 - - - name of a tag. - @since 5.0.6 (reorganized all constants) - - - name of a tag - - - name of a tag - - - name of a tag. - @since 5.0.6 (reorganized all constants) - - - name of a tag. - @since 5.0.6 (reorganized all constants) - - - name of a tag - - - name of a tag - - - name of a tag - - - name of a tag. - @since 5.0.6 (reorganized all constants) - - - name of a tag. - @since 5.0.6 (reorganized all constants) - - - name of a tag. - @since 5.0.6 (reorganized all constants) - - - name of a tag. - @since 5.0.6 (reorganized all constants) - - - name of a tag. - @since 5.0.6 (reorganized all constants) - - - name of a tag. - @since 5.0.6 (reorganized all constants) - - - name of a tag. - @since 5.0.6 (reorganized all constants) - - - name of a tag - - - name of a tag. - @since 5.0.6 (reorganized all constants) - - - name of a tag. - @since 5.0.6 (reorganized all constants) - - - name of a tag. - @since 5.0.6 (reorganized all constants) - - - name of a tag. - @since 5.0.6 (reorganized all constants) - - - name of a tag - - - name of a tag - - - name of a tag - - - name of a tag. - @since 5.0.6 (reorganized all constants) - - - name of a tag - - - name of a tag - - - name of a tag - - - name of a tag - - - name of a tag. - @since 5.0.6 (reorganized all constants) - - - name of a tag. - @since 5.0.6 (reorganized all constants) - - - name of a tag. - @since 5.0.6 (reorganized all constants) - - - name of a tag - - - name of a tag. - @since 5.0.6 (reorganized all constants) - - - name of an attribute - - - name of an attribute - @since 5.0.6 - - - name of an attribute - @since 5.0.6 - - - name of an attribute - - - name of an attribute - - - name of an attribute - @since 5.0.6 - - - name of an attribute - @since 5.0.6 - - - name of an attribute - @since 5.0.6 - - - Name of an attribute. - @since 5.0.6 - - - Name of an attribute. - @since 5.0.6 - - - Name of an attribute. - @since 5.0.6 - - - Name of an attribute. - @since 5.0.6 - - - Name of an attribute. - @since 5.0.6 - - - Name of an attribute. - @since 5.0.6 - - - name of an attribute - - - name of an attribute - - - Name of an attribute. - @since 5.0.6 - - - Name of an attribute. - @since 5.0.6 - - - name of an attribute - - - the possible value of an alignment attribute - - - the possible value of an alignment attribute - - - the possible value of an alignment attribute - - - The possible value of an alignment attribute. - @since 5.0.6 - - - The possible value of an alignment attribute. - @since 5.0.6 - - - the possible value of an alignment attribute - - - the possible value of an alignment attribute - - - the possible value of an alignment attribute - - - the possible value of an alignment attribute - - - This is used for inline css style information - - - Attribute for specifying externally defined CSS class. - @since 5.0.6 - - - the CSS tag for text color - - - The CSS tag for the font size. - @since 5.0.6 - - - The CSS tag for the font size. - @since 5.0.6 - - - The CSS tag for the font size. - @since 5.0.6 - - - The CSS tag for the font size. - @since 5.0.6 - - - The CSS tag for the font size. - @since 5.0.6 - - - The CSS tag for the font size. - @since 5.0.6 - - - The CSS tag for the font size. - @since 5.0.6 - - - The CSS tag for the font size. - @since 5.0.6 - - - the CSS tag for text decorations - - - a CSS value for text decoration - @since 5.0.6 - - - a CSS value for text decoration - @since 5.0.6 - - - a CSS value for text decoration - @since 5.0.6 - - - a CSS value for text decoration - @since 5.0.6 - - - a CSS value for text decoration - @since 5.0.6 - - - a CSS value for text decoration - @since 5.0.6 - - - A possible attribute. - @since 5.0.6 - - - A possible attribute. - @since 5.0.6 - - - Stores the hierarchy of tags along with the attributes of each tag. - @since 5.0.6 renamed from ChainedProperties - @deprecated since 5.5.2 - - - Class that stores the info about one tag in the chain. - - - A possible tag - - - The styles corresponding with the tag - - - Constructs a chained property. - @param tag an XML/HTML tag - @param attrs the tag's attributes - - - A list of chained properties representing the tag hierarchy. - - - Creates a new instance of ChainedProperties - - - Walks through the hierarchy (bottom-up) looking for - a property key. Returns a value as soon as a match - is found or null if the key can't be found. - @param key the key of the property - @return the value of the property - - - Walks through the hierarchy (bottom-up) looking for - a property key. Returns true as soon as a match is - found or false if the key can't be found. - @param key the key of the property - @return true if the key is found - - - Adds a tag and its corresponding properties to the chain. - @param tag the tags that needs to be added to the chain - @param props the tag's attributes - - - If the properties contain a font size, the size may need to - be adjusted based on font sizes higher in the hierarchy. - @param attrs the attributes that may have to be updated - @since 5.0.6 (renamed) - - - Old iText class that allows you to convert HTML to PDF. - We've completely rewritten HTML to PDF conversion and we made it a separate project named XML Worker. - @deprecated since 5.5.2; please switch to XML Worker instead (this is a separate project) - - - DocListener that will listen to the Elements - produced by parsing the HTML. - This can be a com.lowagie.text.Document adding - the elements to a Document directly, or an - HTMLWorker instance strong the objects in a List - - - The map with all the supported tags. - @since 5.0.6 - - - The object defining all the styles. - - - Creates a new instance of HTMLWorker - @param document A class that implements DocListener - - - Creates a new instance of HTMLWorker - @param document A class that implements DocListener - @param tags A map containing the supported tags - @param style A StyleSheet - @since 5.0.6 - - - Sets the map with supported tags. - @param tags - @since 5.0.6 - - - Setter for the StyleSheet - @param style the StyleSheet - - - Parses content read from a java.io.Reader object. - @param reader the content - @throws IOException - - - Stack with the Elements that already have been processed. - @since iText 5.0.6 (private => protected) - - - Keeps the content of the current paragraph - @since iText 5.0.6 (private => protected) - - - The current hierarchy chain of tags. - @since 5.0.6 - - - @see com.itextpdf.text.xml.simpleparser.SimpleXMLDocHandler#startDocument() - - - @see com.itextpdf.text.xml.simpleparser.SimpleXMLDocHandler#startElement(java.lang.String, java.util.Dictionary) - - - @see com.itextpdf.text.xml.simpleparser.SimpleXMLDocHandler#text(java.lang.String) - - - @see com.itextpdf.text.xml.simpleparser.SimpleXMLDocHandler#endElement(java.lang.String) - - - @see com.itextpdf.text.xml.simpleparser.SimpleXMLDocHandler#endDocument() - - - Adds a new line to the currentParagraph. - @since 5.0.6 - - - Flushes the current paragraph, indicating that we're starting - a new block. - If the stack is empty, the paragraph is added to the document. - Otherwise the Paragraph is added to the stack. - @since 5.0.6 - - - Stacks the current paragraph, indicating that we're starting - a new span. - @since 5.0.6 - - - Pushes an element to the Stack. - @param element - @since 5.0.6 - - - Updates the chain with a new tag and new attributes. - @param tag the new tag - @param attrs the corresponding attributes - @since 5.0.6 - - - Updates the chain by removing a tag. - @param tag the new tag - @since 5.0.6 - - - Key used to store the image provider in the providers map. - @since 5.0.6 - - - Key used to store the image processor in the providers map. - @since 5.0.6 - - - Key used to store the image store in the providers map. - @since 5.0.6 - - - Key used to store the image baseurl provider in the providers map. - @since 5.0.6 - - - Key used to store the font provider in the providers map. - @since 5.0.6 - - - Key used to store the link provider in the providers map. - @since 5.0.6 - - - IDictionary containing providers such as a FontProvider or ImageProvider. - @since 5.0.6 (renamed from interfaceProps) - - - Setter for the providers. - If a FontProvider is added, the ElementFactory is updated. - @param providers a IDictionary with different providers - @since 5.0.6 - - - Factory that is able to create iText Element objects. - @since 5.0.6 - - - Creates a Chunk using the factory. - @param content the content of the chunk - @return a Chunk with content - @since 5.0.6 - - - Creates a Paragraph using the factory. - @return a Paragraph without any content - @since 5.0.6 - - - Creates a List object. - @param tag should be "ol" or "ul" - @return a List object - @since 5.0.6 - - - Creates a ListItem object. - @return a ListItem object - @since 5.0.6 - - - Creates a LineSeparator object. - @param attrs properties of the LineSeparator - @return a LineSeparator object - @since 5.0.6 - - - Creates an Image object. - @param attrs properties of the Image - @return an Image object (or null if the Image couldn't be found) - @throws DocumentException - @throws IOException - @since 5.0.6 - - - Creates a Cell. - @param tag the tag - @return a CellWrapper object - @since 5.0.6 - - - Adds a link to the current paragraph. - @since 5.0.6 - - - Fetches the List from the Stack and adds it to - the TextElementArray on top of the Stack, - or to the Document if the Stack is empty. - @throws DocumentException - @since 5.0.6 - - - Looks for the List object on the Stack, - and adds the ListItem to the List. - @throws DocumentException - @since 5.0.6 - - - Processes an Image. - @param img - @param attrs - @throws DocumentException - @since 5.0.6 - - - Processes the Table. - @throws DocumentException - @since 5.0.6 - - - Gets the TableWrapper from the Stack and adds a new row. - @since 5.0.6 - - - Stack to keep track of table tags. - - - Boolean to keep track of TR tags. - - - Boolean to keep track of TD and TH tags - - - Boolean to keep track of LI tags - - - Boolean to keep track of PRE tags - @since 5.0.6 renamed from isPRE - - - Indicates if text needs to be skipped. - @since iText 5.0.6 (private => protected) - - - Pushes the values of pendingTR and pendingTD - to a state stack. - @since 5.0.6 - - - Pops the values of pendingTR and pendingTD - from a state stack. - @since 5.0.6 - - - @return the pendingTR - @since 5.0.6 - - - @param pendingTR the pendingTR to set - @since 5.0.6 - - - @return the pendingTD - @since 5.0.6 - - - @param pendingTD the pendingTD to set - @since 5.0.6 - - - @return the pendingLI - @since 5.0.6 - - - @param pendingLI the pendingLI to set - @since 5.0.6 - - - @return the insidePRE - @since 5.0.6 - - - @param insidePRE the insidePRE to set - @since 5.0.6 - - - @return the skipText - @since 5.0.6 - - - @param skipText the skipText to set - @since 5.0.6 - - - The resulting list of elements. - - - Parses an HTML source to a List of Element objects - @param reader the HTML source - @param style a StyleSheet object - @return a List of Element objects - @throws IOException - - - Parses an HTML source to a List of Element objects - @param reader the HTML source - @param style a StyleSheet object - @param providers map containing classes with extra info - @return a List of Element objects - @throws IOException - - - Parses an HTML source to a List of Element objects - @param reader the HTML source - @param style a StyleSheet object - @param tags a map containing supported tags and their processors - @param providers map containing classes with extra info - @return a List of Element objects - @throws IOException - @since 5.0.6 - - - @see com.itextpdf.text.ElementListener#add(com.itextpdf.text.Element) - - - @see com.itextpdf.text.DocListener#close() - - - @see com.itextpdf.text.DocListener#newPage() - - - @see com.itextpdf.text.DocListener#open() - - - @see com.itextpdf.text.DocListener#resetPageCount() - - - @see com.itextpdf.text.DocListener#setMarginMirroring(bool) - - - @see com.itextpdf.text.DocListener#setMarginMirroring(bool) - @since 2.1.6 - - - @see com.itextpdf.text.DocListener#setMargins(float, float, float, float) - - - @see com.itextpdf.text.DocListener#setPageCount(int) - - - @see com.itextpdf.text.DocListener#setPageSize(com.itextpdf.text.Rectangle) - - - Sets the providers. - @deprecated use SetProviders() instead - - - Gets the providers - @deprecated use GetProviders() instead - - - @deprecated since 5.5.2 - - - Old class to define styles for HTMLWorker. - We've completely rewritten HTML to PDF functionality; see project XML Worker. - XML Worker is able to parse CSS files and "style" attribute values. - @deprecated since 5.5.2 - - - IDictionary storing tags and their corresponding styles. - @since 5.0.6 (changed Dictionary => IDictionary) - - - IDictionary storing possible names of the "class" attribute - and their corresponding styles. - @since 5.0.6 (changed Dictionary => IDictionary) - - - Creates a new instance of StyleSheet - - - Associates a IDictionary containing styles with a tag. - @param tag the name of the HTML/XML tag - @param attrs a map containing styles - - - Adds an extra style key-value pair to the styles IDictionary - of a specific tag - @param tag the name of the HTML/XML tag - @param key the key specifying a specific style - @param value the value defining the style - - - Associates a IDictionary containing styles with a class name. - @param className the value of the class attribute - @param attrs a map containing styles - - - Adds an extra style key-value pair to the styles IDictionary - of a specific tag - @param className the name of the HTML/XML tag - @param key the key specifying a specific style - @param value the value defining the style - - - Resolves the styles based on the tag name and the value - of the class attribute. - @param tag the tag that needs to be resolved - @param attrs existing style map that will be updated - - - Method contributed by Lubos Strapko - @param h - @param chain - @since 2.1.3 - - - We use a CellWrapper because we need some extra info - that isn't available in PdfPCell. - @author psoares - @since 5.0.6 (renamed) - @deprecated since 5.5.2 - - - The cell that is wrapped in this stub. - - - The width of the cell. - @since iText 5.0.6 - - - Indicates if the width is a percentage. - @since iText 5.0.6 - - - Creates a new instance of IncCell. - @param tag the cell that is wrapped in this object. - @param chain properties such as width - @since 5.0.6 - - - Creates a PdfPCell element based on a tag and its properties. - @param tag a cell tag - @param chain the hierarchy chain - - - @see com.lowagie.text.Element#isContent() - @since iText 2.0.8 - - - @see com.lowagie.text.Element#isNestable() - @since iText 2.0.8 - - - Factory that produces iText Element objects, - based on tags and their properties. - @author blowagie - @author psoares - @since 5.0.6 (renamed) - @deprecated since 5.5.2 - - - The font provider that will be used to fetch fonts. - @since iText 5.0 This used to be a FontFactoryImp - - - Creates a new instance of FactoryProperties. - - - Setter for the font provider - @param provider - @since 5.0.6 renamed from setFontImp - - - Creates a Font object based on a chain of properties. - @param chain chain of properties - @return an iText Font object - - - Creates an iText Chunk - @param content the content of the Chunk - @param chain the hierarchy chain - @return a Chunk - - - Creates an iText Paragraph object using the properties - of the different tags and properties in the hierarchy chain. - @param chain the hierarchy chain - @return a Paragraph without any content - - - Creates an iText Paragraph object using the properties - of the different tags and properties in the hierarchy chain. - @param chain the hierarchy chain - @return a ListItem without any content - - - Method that does the actual Element creating for - the createParagraph and createListItem method. - @param paragraph - @param chain - - - Sets the leading of a Paragraph object. - @param paragraph the Paragraph for which we set the leading - @param leading the String value of the leading - - - Gets a HyphenationEvent based on the hyphenation entry in - the hierarchy chain. - @param chain the hierarchy chain - @return a HyphenationEvent - @since 2.1.2 - - - Creates a LineSeparator. - @since 5.0.6 - - - This class maps tags such as div and span to their corresponding - TagProcessor classes. - @deprecated since 5.5.2 - - - Creates a Map containing supported tags. - - - Object that processes the following tags: - i, em, b, strong, s, strike, u, sup, sub - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String) - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String) - - - Maps em to i, strong to b, and strike to s. - This is a convention: the style parser expects i, b and s. - @param tag the original tag - @return the mapped tag - - - Object that processes the a tag. - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String) - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String) - - - Object that processes the br tag. - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map) - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String) - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map) - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String) - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map) - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String) - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map) - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String) - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map) - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String) - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map) - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String) - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map) - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String) - - - @throws DocumentException - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map) - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String) - - - @throws DocumentException - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map) - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String) - - - @throws DocumentException - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map) - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String) - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#startElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String, java.util.Map) - - - @see com.itextpdf.text.html.simpleparser.HTMLTagProcessors#endElement(com.itextpdf.text.html.simpleparser.HTMLWorker, java.lang.String) - - - Interface that needs to be implemented by every tag that is supported by HTMLWorker. - @deprecated since 5.5.2 - - - Implement this class to tell the HTMLWorker what to do - when an open tag is encountered. - @param worker the HTMLWorker - @param tag the tag that was encountered - @param attrs the current attributes of the tag - @throws DocumentException - @throws IOException - - - Implement this class to tell the HTMLWorker what to do - when an close tag is encountered. - @param worker the HTMLWorker - @param tag the tag that was encountered - @throws DocumentException - - - Implement this interface to process images and - to indicate if the image needs to be added or - skipped. - @since 5.0.6 (renamed) - @deprecated since 5.5.2 - - - Allows you to (pre)process the image before (or instead of) - adding it to the DocListener with HTMLWorker. - @param img the Image object - @param attrs attributes of the image - @param chain hierarchy of attributes - @param doc the DocListener to which the Image needs to be added - @return false if you still want HTMLWorker to add the Image - - - Allows you to do additional processing on a Paragraph that contains a link. - @author psoares - @since 5.0.6 (renamed) - @deprecated since 5.5.2 - - - Does additional processing on a link paragraph - @param current the Paragraph that has the link - @param attrs the attributes - @return false if the Paragraph no longer needs processing - - - @since 5.0.6 - @deprecated since 5.5.2 - - - We use a TableWrapper because PdfPTable is rather complex - to put on the HTMLWorker stack. - @author psoares - @since 5.0.6 (renamed) - @deprecated since 5.5.2 - - - The styles that need to be applied to the table - @since 5.0.6 renamed from props - - - Nested list containing the PdfPCell elements that are part of this table. - - - Array containing the widths of the columns. - @since iText 5.0.6 - - - Creates a new instance of IncTable. - @param attrs a Map containing attributes - - - Adds a new row to the table. - @param row a list of PdfPCell elements - - - Setter for the column widths - @since iText 5.0.6 - - - Creates a new PdfPTable based on the info assembled - in the table stub. - @return a PdfPTable - - - This class is a HashMap that contains the names of colors as a key and the - corresponding Color as value. (Source: Wikipedia - http://en.wikipedia.org/wiki/Web_colors ) - - @author blowagie - @deprecated since 5.5.2 - - - A web color string without the leading # will be 3 or 6 characters long - and all those characters will be hex digits. NOTE: colStr must be all - lower case or the current hex letter test will fail. - - @param colStr - A non-null, lower case string that might describe an RGB color - in hex. - @return Is this a web color hex string without the leading #? - @since 5.0.6 - - - Gives you a BaseColor based on a name. - - @param name - a name such as black, violet, cornflowerblue or #RGB or - #RRGGBB or RGB or RRGGBB or rgb(R,G,B) - @return the corresponding BaseColor object. Never returns null. - @throws IllegalArgumentException - if the String isn't a know representation of a color. - - - A class that contains some utilities to parse HTML attributes and content. - @since 5.0.6 (some of these methods used to be in the Markup class) - @deprecated since 5.5.2 - - - a default value for font-size - @since 2.1.3 - - - Parses a length. - - @param str - a length in the form of an optional + or -, followed by a - number and a unit. - @return a float - - - New method contributed by: Lubos Strapko - - @since 2.1.3 - - - Converts a BaseColor into a HTML representation of this - BaseColor. - - @param s - the BaseColor that has to be converted. - @return the HTML representation of this BaseColor - - - This method parses a String with attributes and returns a Properties - object. - - @param str - a String of this form: 'key1="value1"; key2="value2";... - keyN="valueN" ' - @return a Properties object - - - Removes the comments sections of a String. - - @param str - the original String - @param startComment - the String that marks the start of a Comment section - @param endComment - the String that marks the end of a Comment section. - @return the String stripped of its comment section - - - Helper class that reduces the white space in a String - @param content content containing whitespace - @return the content without all unnecessary whitespace - - - A series of predefined font sizes. - @since 5.0.6 (renamed) - - - Picks a font size from a series of predefined font sizes. - @param value the new value of a font, expressed as an index - @param previous the previous value of the font size - @return a new font size. - - - Translates a String value to an alignment value. - (written by Norman Richards, integrated into iText by Bruno) - @param alignment a String (one of the ALIGN_ constants of this class) - @return an alignment value (one of the ALIGN_ constants of the Element interface) - - - - A class that implements DocListener will perform some - actions when some actions are performed on a Document. - - - - - - - - Signals that the Document has been opened and that - Elements can be added. - - - - - Signals that the Document was closed and that no other - Elements will be added. - - - The output stream of every writer implementing IDocListener will be closed. - - - - - Signals that an new page has to be started. - - true if the page was added, false if not. - - - - Sets the pagesize. - - the new pagesize - a boolean - - - - Sets the margins. - - the margin on the left - the margin on the right - the margin on the top - the margin on the bottom - - - - Parameter that allows you to do margin mirroring (odd/even pages) - @param marginMirroring - @return true if succesfull - - - Parameter that allows you to do top/bottom margin mirroring (odd/even pages) - @param marginMirroringTopBottom - @return true if successful - @since 2.1.6 - - - - Sets the page number. - - the new page number - - - - Sets the page number to 0. - - - - - Interface for a text element. - - - - - - - - - - - - - - - - - - - - - - - Processes the element by adding it (or the different parts) to an - IElementListener. - - an IElementListener - true if the element was processed successfully - - - - Gets the type of the text element. - - a type - - - Checks if this element is a content object. - If not, it's a metadata object. - @since iText 2.0.8 - @return true if this is a 'content' element; false if this is a 'medadata' element - - - Checks if this element is nestable. - @since iText 2.0.8 - @return true if this element can be nested inside other elements. - - - - Gets all the chunks in this element. - - an ArrayList - - - - Gets the content of the text element. - - the content of the text element - - - - A class that implements ElementListener will perform some - actions when an Element is added. - - - - - Signals that an Element was added to the Document. - - Element added - true if the element was added, false if not. - - - These two methods are used by FactoryProperties (for HTMLWorker). - It's implemented by FontFactoryImp. - @since iText 5.0 - - - Checks if a certain font is registered. - - @param fontname the name of the font that has to be checked. - @return true if the font is found - - - Constructs a Font-object. - - @param fontname the name of the font - @param encoding the encoding of the font - @param embedded true if the font is to be embedded in the PDF - @param size the size of this font - @param style the style of this font - @param color the BaseColor of this font. - @return the Font constructed based on the parameters - - - Interface implemented by Element objects that can potentially consume - a lot of memory. Objects implementing the LargeElement interface can - be added to a Document more than once. If you have invoked setCompleted(false), - they will be added partially and the content that was added will be - removed until you've invoked setCompleted(true); - @since iText 2.0.8 - - - If you invoke setCompleted(false), you indicate that the content - of the object isn't complete yet; it can be added to the document - partially, but more will follow. If you invoke setCompleted(true), - you indicate that you won't add any more data to the object. - @since iText 2.0.8 - @param complete false if you'll be adding more data after - adding the object to the document. - - - Flushes the content that has been added. - - - - An Image is the representation of a graphic element (JPEG, PNG or GIF) - that has to be inserted into the document - - - - - - this is a kind of image Element. - - - this is a kind of image Element. - - - this is a kind of image Element. - - - this is a kind of image Element. - - - this is a kind of image Element. - - - this is a kind of image Element. - - - This represents a coordinate in the transformation matrix. - - - This represents a coordinate in the transformation matrix. - - - This represents a coordinate in the transformation matrix. - - - This represents a coordinate in the transformation matrix. - - - This represents a coordinate in the transformation matrix. - - - This represents a coordinate in the transformation matrix. - - - This represents a coordinate in the transformation matrix. - - - This represents a coordinate in the transformation matrix. - - - type of image - - - type of image - - - type of image - - - type of image - - - type of image - - - type of image - - - type of image - - - type of image - - - type of image - @since 2.1.5 - - - Image color inversion - - - The imagetype. - - - The URL of the image. - - - The raw data of the image. - - - The template to be treated as an image. - - - The alignment of the Image. - - - Text that can be shown instead of the image. - - - This is the absolute X-position of the image. - - - This is the absolute Y-position of the image. - - - This is the width of the image without rotation. - - - This is the width of the image without rotation. - - - This is the scaled width of the image taking rotation into account. - - - This is the original height of the image taking rotation into account. - - - The compression level of the content streams. - @since 2.1.3 - - - This is the rotation of the image. - - - this is the colorspace of a jpeg-image. - - - this is the bits per component of the raw image. It also flags a CCITT image. - - - this is the transparency information of the raw image - - - the indentation to the left. - - - the indentation to the right. - - - Holds value of property dpiX. - - - Holds value of property dpiY. - - - Holds value of property interpolation. - - - if the annotation is not null the image will be clickable. - - - ICC Profile attached - - - Holds value of property deflated. - - - Holds value of property smask. - - - Holds value of property XYRatio. - - - Holds value of property originalType. - - - Holds value of property originalData. - - - The spacing before the image. - - - The spacing after the image. - - - Holds value of property widthPercentage. - - - Holds value of property initialRotation. - - - - Constructs an Image-object, using an url. - - the URL where the image can be found. - - - - Constructs an Image object duplicate. - - another Image object. - - - - Gets an instance of an Image. - - an Image - an object of type Gif, Jpeg or Png - - - - Gets an instance of an Image. - - an URL - an object of type Gif, Jpeg or Png - - - - Gets an instance of an Image. - - an URL - an object of type Gif, Jpeg or Png - - - - Gets an instance of an Image. - - a byte array - an object of type Gif, Jpeg or Png - - - - Gets an instance of an Image. - - a filename - an object of type Gif, Jpeg or Png - - - - Gets an instance of an Image in raw mode. - - the width of the image in pixels - the height of the image in pixels - 1,3 or 4 for GrayScale, RGB and CMYK - bits per component - the image data - an object of type ImgRaw - - - Creates a JBIG2 Image. - @param width the width of the image - @param height the height of the image - @param data the raw image data - @param globals JBIG2 globals - @since 2.1.5 - - - Reuses an existing image. - @param ref the reference to the image dictionary - @throws BadElementException on error - @return the image - - - - Gets an instance of an Image in raw mode. - - - - - - - Gets an instance of an Image in raw mode. - - the width of the image in pixels - the height of the image in pixels - - - - - - - - - - - - - - - - - - - - - - Gets an instance of an Image in raw mode. - - the width of the image in pixels - the height of the image in pixels - 1,3 or 4 for GrayScale, RGB and CMYK - bits per component - the image data - - transparency information in the Mask format of the - image dictionary - - an object of type ImgRaw - - - - Sets the absolute position of the Image. - - - - - - - Scale the image to the dimensions of the rectangle - - dimensions to scale the Image - - - - Scale the image to an absolute width and an absolute height. - - the new width - the new height - - - - Scale the image to an absolute width. - - the new width - - - - Scale the image to an absolute height. - - the new height - - - - Scale the image to a certain percentage. - - the scaling percentage - - - - Scale the width and height of an image to a certain percentage. - - the scaling percentage of the width - the scaling percentage of the height - - - - Scales the images to the dimensions of the rectangle. - - the dimensions to fit - - - - Scales the image so that it fits a certain width and height. - - the width to fit - the height to fit - - - Gets the current image rotation in radians. - @return the current image rotation in radians - - - - Sets the rotation of the image in radians. - - rotation in radians - - - - Sets the rotation of the image in degrees. - - rotation in degrees - - - - Get/set the annotation. - - the Annotation - - - - Gets the bpc for the image. - - - this only makes sense for Images of the type RawImage. - - a bpc value - - - - Gets the raw data for the image. - - - this only makes sense for Images of the type RawImage. - - the raw data - - - - Get/set the template to be used as an image. - - - this only makes sense for Images of the type ImgTemplate. - - the template - - - - Checks if the Images has to be added at an absolute position. - - a bool - - - - Checks if the Images has to be added at an absolute X position. - - a bool - - - - Returns the absolute X position. - - a position - - - - Returns the absolute Y position. - - a position - - - - Returns the type. - - a type - - - @see com.lowagie.text.Element#isNestable() - @since iText 2.0.8 - - - - Returns true if the image is a Jpeg-object. - - a bool - - - - Returns true if the image is a ImgRaw-object. - - a bool - - - - Returns true if the image is an ImgTemplate-object. - - a bool - - - - Gets the string-representation of the reference to the image. - - a string - - - - Get/set the alignment for the image. - - a value - - - - Get/set the alternative text for the image. - - a string - - - - Gets the scaled width of the image. - - a value - - - - Gets the scaled height of the image. - - a value - - - - Gets the colorspace for the image. - - - this only makes sense for Images of the type Jpeg. - - a colorspace value - - - - Returns the transformation matrix of the image. - - an array [AX, AY, BX, BY, CX, CY, DX, DY] - - - Returns the transformation matrix of the image. - - @return an array [AX, AY, BX, BY, CX, CY, DX, DY] - - - - Returns the transparency. - - the transparency - - - - Gets the plain width of the image. - - a value - - - - Gets the plain height of the image. - - a value - - - - generates new serial id - - - - - returns serial id for this object - - - - - Gets the dots-per-inch in the X direction. Returns 0 if not available. - - the dots-per-inch in the X direction - - - - Gets the dots-per-inch in the Y direction. Returns 0 if not available. - - the dots-per-inch in the Y direction - - - Sets the dots per inch value - - @param dpiX - dpi for x coordinates - @param dpiY - dpi for y coordinates - - - - Returns true if this Image has the - requisites to be a mask. - - true if this Image can be a mask - - - - Make this Image a mask. - - - - - Get/set the explicit masking. - - the explicit masking - - - - Returns true if this Image is a mask. - - true if this Image is a mask - - - - Inverts the meaning of the bits of a mask. - - true to invert the meaning of the bits of a mask - - - - Sets the image interpolation. Image interpolation attempts to - produce a smooth transition between adjacent sample values. - - New value of property interpolation. - - - Tags this image with an ICC profile. - @param profile the profile - - - Checks is the image has an ICC profile. - @return the ICC profile or null - - - Indicates if the image should be scaled to fit the line - when the image exceeds the available width. - @since iText 5.0.6 - - - Indicates if the image should be scaled to fit - when the image exceeds the available height. - @since iText 5.4.2 - - - Gets and sets the value of scaleToFitHeight. - @return true if the image size has to scale to the available height - @since iText 5.4.2 - - - Replaces CalRGB and CalGray colorspaces with DeviceRGB and DeviceGray. - - - Some image formats, like TIFF may present the images rotated that have - to be compensated. - - - Sets the compression level to be used if the image is written as a compressed stream. - @param compressionLevel a value between 0 (best speed) and 9 (best compression) - @since 2.1.3 - - - CCITT Image data that has to be inserted into the document - - @see Element - @see Image - - @author Paulo Soares - - CCITT Image data that has to be inserted into the document - - - - - - - Creats an Image in CCITT mode. - - the exact width of the image - the exact height of the image - - reverses the bits in data. - Bit 0 is swapped with bit 7 and so on - - - the type of compression in data. It can be - CCITTG4, CCITTG31D, CCITTG32D - - - parameters associated with this stream. Possible values are - CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFLINE and CCITT_ENDOFBLOCK or a - combination of them - - the image data - - - Support for JBIG2 images. - @since 2.1.5 - - - JBIG2 globals - - - A unique hash - - - Copy contstructor. - @param image another Image - - - Empty constructor. - - - Actual constructor for ImgJBIG2 images. - @param width the width of the image - @param height the height of the image - @param data the raw image data - @param globals JBIG2 globals - - - Getter for the JBIG2 global data. - @return an array of bytes - - - Getter for the unique hash. - @return an array of bytes - - - - Raw Image data that has to be inserted into the document - - - - - - - Creats an Image in raw mode. - - the exact width of the image - the exact height of the image - 1,3 or 4 for GrayScale, RGB and CMYK - bits per component. Must be 1,2,4 or 8 - data the image data - - - - PdfTemplate that has to be inserted into the document - - - - - - - Creats an Image from a PdfTemplate. - - the Image - - - - Creats an Image from a PdfTemplate. - - the PdfTemplate - - - An ImgWMF is the representation of a windows metafile - that has to be inserted into the document - - @see Element - @see Image - @see Gif - @see Png - - An ImgWMF is the representation of a windows metafile - that has to be inserted into the document - - - - - Constructs an ImgWMF-object - - a Image - - - - Constructs an ImgWMF-object, using an url. - - the URL where the image can be found - - - - Constructs an ImgWMF-object, using a filename. - - a string-representation of the file that contains the image. - - - - Constructs an ImgWMF-object from memory. - - the memory image - - - - This method checks if the image is a valid WMF and processes some parameters. - - - - - Reads the WMF into a template. - - the template to read to - - - A RandomAccessSource that is based on an underlying byte array - @since 5.3.5 - - - @since 5.3.5 - - - The source - - - Constructs a new OffsetRandomAccessSource - @param source the source - - - {@inheritDoc} - - - {@inheritDoc} - - - {@inheritDoc} - - - {@inheritDoc} - - - A RandomAccessSource that is based on a set of underlying sources, treating the sources as if they were a contiguous block of data. - @since 5.3.5 - - - The underlying sources (along with some meta data to quickly determine where each source begins and ends) - - - Cached value to make multiple reads from the same underlying source more efficient - - - Cached size of the underlying channel - - - Constructs a new {@link GroupedRandomAccessSource} based on the specified set of sources - @param sources the sources used to build this group - - - For a given offset, return the index of the source that contains the specified offset. - This is an optimization feature to help optimize the access of the correct source without having to iterate - through every single source each time. It is safe to always return 0, in which case the full set of sources will be searched. - Subclasses should override this method if they are able to compute the source index more efficiently (for example {@link FileChannelRandomAccessSource} takes advantage of fixed size page buffers to compute the index) - @param offset the offset - @return the index of the input source that contains the specified offset, or 0 if unknown - - - Returns the SourceEntry that contains the byte at the specified offset - sourceReleased is called as a notification callback so subclasses can take care of cleanup when the source is no longer the active source - @param offset the offset of the byte to look for - @return the SourceEntry that contains the byte at the specified offset - @throws IOException if there is a problem with IO (usually the result of the sourceReleased() call) - - - Called when a given source is no longer the active source. This gives subclasses the abilty to release resources, if appropriate. - @param source the source that is no longer the active source - @throws IOException if there are any problems - - - Called when a given source is about to become the active source. This gives subclasses the abilty to retrieve resources, if appropriate. - @param source the source that is about to become the active source - @throws IOException if there are any problems - - - {@inheritDoc} - The source that contains the byte at position is retrieved, the correct offset into that source computed, then the value - from that offset in the underlying source is returned. - - - {@inheritDoc} - - - {@inheritDoc} - - - {@inheritDoc} - Closes all of the underlying sources - - - Used to track each source, along with useful meta data - - - The underlying source - - - The first byte (in the coordinates of the GroupedRandomAccessSource) that this source contains - - - The last byte (in the coordinates of the GroupedRandomAccessSource) that this source contains - - - The index of this source in the GroupedRandomAccessSource - - - Standard constructor - @param index the index - @param source the source - @param offset the offset of the source in the GroupedRandomAccessSource - - - Given an absolute offset (in the GroupedRandomAccessSource coordinates), calculate the effective offset in the underlying source - @param absoluteOffset the offset in the parent GroupedRandomAccessSource - @return the effective offset in the underlying source - - - A RandomAccessSource that is wraps another RandomAccessSouce but does not propagate close(). This is useful when - passing a RandomAccessSource to a method that would normally close the source. - @since 5.3.5 - - - The source - - - Constructs a new OffsetRandomAccessSource - @param source the source - - - {@inheritDoc} - - - {@inheritDoc} - - - {@inheritDoc} - - - Does nothing - the underlying source is not closed - - - Represents an abstract source that bytes can be read from. This class forms the foundation for all byte input in iText. - Implementations do not keep track of a current 'position', but rather provide absolute get methods. Tracking position - should be handled in classes that use RandomAccessSource internally (via composition). - @since 5.3.5 - - - Gets a byte at the specified position - @param position - @return the byte, or -1 if EOF is reached - - - Gets an array at the specified position. If the number of bytes requested cannot be read, the bytes that can be - read will be placed in bytes and the number actually read will be returned. - @param position the position in the RandomAccessSource to read from - @param bytes output buffer - @param off offset into the output buffer where results will be placed - @param len the number of bytes to read - @return the number of bytes actually read, or -1 if the file is at EOF - - - @return the length of this source - - - Closes this source. The underlying data structure or source (if any) will also be closed - @throws IOException - - - - A RandomAccessSource that uses a {@link RandomAccessFile} as it's source - Note: Unlike most of the RandomAccessSource implementations, this class is not thread safe - - - The source - - - The length of the underling RAF. Note that the length is cached at construction time to avoid the possibility - of IOExceptions when reading the length. - - - Creates this object - @param raf the source for this RandomAccessSource - @throws IOException if the RAF can't be read - - - {@inheritDoc} - - - {@inheritDoc} - - - {@inheritDoc} - Note: the length is determined when the {@link RAFRandomAccessSource} is constructed. If the file length changes - after construction, that change will not be reflected in this call. - - - Closes the underlying RandomAccessFile - - - Factory to create {@link RandomAccessSource} objects based on various types of sources - @since 5.3.5 - - - - whether the full content of the source should be read into memory at construction - - - Whether {@link RandomAccessFile} should be used instead of a {@link FileChannel}, where applicable - - - Whether the underlying file should have a RW lock on it or just an R lock - - - Creates a factory that will give preference to accessing the underling data source using memory mapped files - - - Determines whether the full content of the source will be read into memory - @param forceRead true if the full content will be read, false otherwise - @return this object (this allows chaining of method calls) - - - Creates a {@link RandomAccessSource} based on a byte array - @param data the byte array - @return the newly created {@link RandomAccessSource} - - - Creates a {@link RandomAccessSource} based on a URL. The data available at the URL is read into memory and used - as the source for the {@link RandomAccessSource} - @param url the url to read from - @return the newly created {@link RandomAccessSource} - - - Creates a {@link RandomAccessSource} based on an {@link InputStream}. The full content of the InputStream is read into memory and used - as the source for the {@link RandomAccessSource} - @param is the stream to read from - @return the newly created {@link RandomAccessSource} - - - Creates a {@link RandomAccessSource} based on a filename string. - If the filename describes a URL, a URL based source is created - If the filename describes a file on disk, the contents may be read into memory (if forceRead is true), opened using memory mapped file channel (if usePlainRandomAccess is false), or opened using {@link RandomAccessFile} access (if usePlainRandomAccess is true) - This call will automatically failover to using {@link RandomAccessFile} if the memory map operation fails - @param filename the name of the file or resource to create the {@link RandomAccessSource} for - @return the newly created {@link RandomAccessSource} - - - Creates a new {@link RandomAccessSource} by reading the specified file/resource into memory - @param filename the name of the resource to read - @return the newly created {@link RandomAccessSource} - @throws IOException if reading the underling file or stream fails - - - Creates a new {@link RandomAccessSource} by reading the specified file/resource into memory - @param filename the name of the resource to read - @return the newly created {@link RandomAccessSource} - @throws IOException if reading the underling file or stream fails - - - An input stream that uses a RandomAccessSource as it's underlying source - @since 5.3.5 - - - The source - - - The current position in the source - - - Creates an input stream based on the source - @param source the source - - - Utility class with commonly used stream operations - @since 5.3.5 - - - - Reads the full content of a stream and returns them in a byte array - @param is the stream to read - @return a byte array containing all of the bytes from the stream - @throws IOException if there is a problem reading from the input stream - - - Gets the font resources. - @param key the name of the resource - @return the Stream to get the resource or - null if not found - - - A RandomAccessSource that wraps another RandomAccessSouce and provides a window of it at a specific offset and over - a specific length. Position 0 becomes the offset position in the underlying source. - @since 5.3.5 - - - The source - - - The amount to offset the source by - - - The length - - - Constructs a new OffsetRandomAccessSource that extends to the end of the underlying source - @param source the source - @param offset the amount of the offset to use - - - Constructs a new OffsetRandomAccessSource with an explicit length - @param source the source - @param offset the amount of the offset to use - @param length the number of bytes to be included in this RAS - - - {@inheritDoc} - Note that the position will be adjusted to read from the corrected location in the underlying source - - - {@inheritDoc} - Note that the position will be adjusted to read from the corrected location in the underlying source - - - {@inheritDoc} - Note that the length will be adjusted to read from the corrected location in the underlying source - - - {@inheritDoc} - - - The RTF jar depends on the iText jar, but the iText jar may not - depend on the RTF jar. This interface offers a temporary solution - until we find a more elegant way to solve this. - - - - Interface for customizing the split character. - - - - - - Interface for a text element to which other objects can be added. - - - - - - - - - - - - Adds an object to the TextElementArray. - - an object that has to be added - true if the addition succeeded; false otherwise - - - - An Jpeg is the representation of a graphic element (JPEG) - that has to be inserted into the document - - - - - - - - This is a type of marker. - - - This is a type of marker. - - - Acceptable Jpeg markers. - - - This is a type of marker. - - - Unsupported Jpeg markers. - - - This is a type of marker. - - - Jpeg markers without additional parameters. - - - Marker value for Photoshop IRB - - - sequence preceding Photoshop resolution data - - - - Construct a Jpeg-object, using a Image - - a Image - - - - Constructs a Jpeg-object, using an Uri. - - - Deprecated, use Image.GetInstance(...) to create an Image - - the Uri where the image can be found - - - - Constructs a Jpeg-object from memory. - - the memory image - - - - Constructs a Jpeg-object from memory. - - the memory image. - the width you want the image to have - the height you want the image to have - - - - Reads a short from the Stream. - - the Stream - an int - - - - Reads an inverted short from the Stream. - - the Stream - an int - - - - Returns a type of marker. - - an int - a type: VALID_MARKER, UNSUPPORTED_MARKER or NOPARAM_MARKER - - - - This method checks if the image is a valid JPEG and processes some parameters. - - - - An Jpeg2000 is the representation of a graphic element (JPEG) - that has to be inserted into the document - - @see Element - @see Image - - - Constructs a Jpeg2000-object, using an url. - - @param url the URL where the image can be found - @throws BadElementException - @throws IOException - - - Constructs a Jpeg2000-object from memory. - - @param img the memory image - @throws BadElementException - @throws IOException - - - Constructs a Jpeg2000-object from memory. - - @param img the memory image. - @param width the width you want the image to have - @param height the height you want the image to have - @throws BadElementException - @throws IOException - - - This method checks if the image is a valid JPEG and processes some parameters. - @throws BadElementException - @throws IOException - - - @return true if the image is JP2, false if a codestream. - - - - A List contains several ListItems. - - - Example 1: - - List list = new List(true, 20); - list.Add(new ListItem("First line")); - list.Add(new ListItem("The second line is longer to see what happens once the end of the line is reached. Will it start on a new line?")); - list.Add(new ListItem("Third line")); - - - The result of this code looks like this: -
      -
    1. - First line -
    2. -
    3. - The second line is longer to see what happens once the end of the line is reached. Will it start on a new line? -
    4. -
    5. - Third line -
    6. -
    - - Example 2: - - List overview = new List(false, 10); - overview.Add(new ListItem("This is an item")); - overview.Add("This is another item"); - - - The result of this code looks like this: -
      -
    • - This is an item -
    • -
    • - This is another item -
    • -
    -
    - - -
    - - a possible value for the numbered parameter - - - a possible value for the numbered parameter - - - a possible value for the lettered parameter - - - a possible value for the lettered parameter - - - a possible value for the lettered parameter - - - a possible value for the lettered parameter - - - This is the ArrayList containing the different ListItems. - - - Indicates if the list has to be numbered. - - - Indicates if the listsymbols are numerical or alphabetical. - - - Indicates if the listsymbols are lowercase or uppercase. - - - Indicates if the indentation has to be set automatically. - - - Indicates if the indentation of all the items has to be aligned. - - - This variable indicates the first number of a numbered list. - - - This is the listsymbol of a list that is not numbered. - - - In case you are using numbered/lettered lists, this String is added before the number/letter. - @since iText 2.1.1 - - - In case you are using numbered/lettered lists, this String is added after the number/letter. - @since iText 2.1.1 - - - The indentation of this list on the left side. - - - The indentation of this list on the right side. - - - The indentation of the listitems. - - - Constructs a List. - - - Constructs a List with a specific symbol indentation. - @param symbolIndent the symbol indentation - @since iText 2.0.8 - - - Constructs a List. - - @param numbered a bool - - - Constructs a List. - - @param numbered a bool - @param lettered has the list to be 'numbered' with letters - - - - Constructs a List. - - - the parameter symbolIndent is important for instance when - generating PDF-documents; it indicates the indentation of the listsymbol. - - a bool - the indentation that has to be used for the listsymbol - - - - Constructs a List. - - a bool - a bool - the indentation that has to be used for the listsymbol - - - - Processes the element by adding it (or the different parts) to an - IElementListener. - - an IElementListener - true if the element was processed successfully - - - - Gets the type of the text element. - - a type - - - - Gets all the chunks in this element. - - an ArrayList - - - - Adds an Object to the List. - - the object to add - true is successful - - - Makes sure all the items in the list have the same indentation. - - - - Alias for VB.NET compatibility. - - - - - Get/set the first number - - an int - - - - Sets the symbol - - a Chunk - - - - Sets the listsymbol. - - - This is a shortcut for SetListSymbol(Chunk symbol). - - a string - - - - Get/set the indentation of this paragraph on the left side. - - the indentation - - - - Get/set the indentation of this paragraph on the right side. - - the indentation - - - - Gets the symbol indentation. - - the symbol indentation - - - @see com.lowagie.text.Element#isContent() - @since iText 2.0.8 - - - @see com.lowagie.text.Element#isNestable() - @since iText 2.0.8 - - - - Gets all the items in the list. - - an ArrayList containing ListItems - - - - Gets the size of the list. - - a size - - - Returns true if the list is empty. - - @return true if the list is empty - - - - Gets the leading of the first listitem. - - a leading - - - - Get/set the symbol indentation. - - a Chunk - - - Returns the String that is after a number or letter in the list symbol. - @return the String that is after a number or letter in the list symbol - @since iText 2.1.1 - - - Sets the String that has to be added after a number or letter in the list symbol. - @since iText 2.1.1 - @param postSymbol the String that has to be added after a number or letter in the list symbol. - - - Sets the String that has to be added before a number or letter in the list symbol. - @since iText 2.1.1 - @param preSymbol the String that has to be added before a number or letter in the list symbol. - - - - A ListItem is a Paragraph - that can be added to a List. - - - Example 1: - - List list = new List(true, 20); - list.Add(new ListItem("First line")); - list.Add(new ListItem("The second line is longer to see what happens once the end of the line is reached. Will it start on a new line?")); - list.Add(new ListItem("Third line")); - - - The result of this code looks like this: -
      -
    1. - First line -
    2. -
    3. - The second line is longer to see what happens once the end of the line is reached. Will it start on a new line? -
    4. -
    5. - Third line -
    6. -
    - - Example 2: - - List overview = new List(false, 10); - overview.Add(new ListItem("This is an item")); - overview.Add("This is another item"); - - - The result of this code looks like this: -
      -
    • - This is an item -
    • -
    • - This is another item -
    • -
    -
    - - - -
    - - this is the symbol that wil proceed the listitem. - - - - Constructs a ListItem. - - - - - Constructs a ListItem with a certain leading. - - the leading - - - - Constructs a ListItem with a certain Chunk. - - a Chunk - - - - Constructs a ListItem with a certain string. - - a string - - - - Constructs a ListItem with a certain string - and a certain Font. - - a string - a string - - - - Constructs a ListItem with a certain Chunk - and a certain leading. - - the leading - a Chunk - - - - Constructs a ListItem with a certain string - and a certain leading. - - the leading - a string - - - Constructs a ListItem with a certain leading, string - and Font. - - @param leading the leading - @param string a string - @param font a Font - - Constructs a ListItem with a certain leading, string - and Font. - - the leading - a string - a Font - - - - Constructs a ListItem with a certain Phrase. - - a Phrase - - - - Gets the type of the text element. - - a type - - - - Get/set the listsymbol. - - a Chunk - - - Sets the indentation of this paragraph on the left side. - - @param indentation the new indentation - - - Changes the font of the list symbol to the font of the first chunk - in the list item. - @since 5.0.6 - - - Factory that creates a counter for every reader or writer class. - You can implement your own counter and declare it like this: - CounterFactory.getInstance().setCounter(new SysoCounter()); - SysoCounter is just an example of a Counter implementation. - It writes info about files being read and written to the System.out. - - This functionality can be used to create metrics in a SaaS context. - - - The singleton instance. - - - The current counter implementation. - - - The empty constructor. - - - Returns the singleton instance of the factory. - - - Returns a counter factory. - - - Getter for the counter. - - - Setter for the counter. - - - Implementation of the Counter interface that doesn't do anything. - - - @param klass - @return this Counter implementation - @see com.itextpdf.text.log.Counter#getCounter(java.lang.Class) - - - @see com.itextpdf.text.log.Counter#read(long) - - - @see com.itextpdf.text.log.Counter#written(long) - - - Interface that can be implemented if you want to count the number of documents - that are being processed by iText. - - Implementers may use this method to record actual system usage for licensing purposes - (e.g. count the number of documents or the volumne in bytes in the context of a SaaS license). - - - Gets a Counter instance for a specific class. - - - This method gets triggered if a file is read. - @param l the length of the file that was written - - - This method gets triggered if a file is written. - @param l the length of the file that was written - - - Implementation of the Counter interface that doesn't do anything. - - - @param klass The Class asking for the Counter - @return the Counter instance - @see com.itextpdf.text.log.Counter#getCounter(java.lang.Class) - - - @see com.itextpdf.text.log.Counter#read(long) - - - @see com.itextpdf.text.log.Counter#written(long) - - - The name of the class for which the Counter was created - (or iText if no name is available) - - - Empty SysoCounter constructor. - - - Constructs a SysoCounter for a specific class. - @param klass - - - @see com.itextpdf.text.log.Counter#getCounter(java.lang.Class) - - - @see com.itextpdf.text.log.Counter#read(long) - - - @see com.itextpdf.text.log.Counter#written(long) - - - Logger interface - {@link LoggerFactory#setLogger(Logger)}. - - @author redlab_b - - - - @param klass - @return the logger for the given klass - - - @param level - @return true if there should be logged for the given level - - - Log a warning message. - @param message - - - Log a trace message. - @param message - - - Log a debug message. - @param message - - - Log an info message. - @param message - - - Log an error message. - @param message - - - Log an error message and exception. - @param message - @param e - - - The different log levels. - @author redlab_b - - - - LoggerFactory can be used to set a logger. The logger should be created by - implementing {@link Logger}. In the implementation users can choose how they - log received messages. Added for developers. For some cases it can be handy - to receive logging statements while developing applications with iText - - @author redlab_b - - - - Returns the logger set in this LoggerFactory. Defaults to {@link NoOpLogger} - @param klass - @return the logger. - - - Returns the logger set in this LoggerFactory. Defaults to {@link NoOpLogger} - @param name - @return the logger. - - - Returns the LoggerFactory - @return singleton instance of this LoggerFactory - - - Set the global logger to process logging statements with. - - @param logger the logger - - - Get the logger. - - @return the logger - - - The no-operation logger, it does nothing with the received logging - statements. And returns false by default for {@link NoOpLogger#isLogging(Level)} - - @author redlab_b - - - - A Simple System.out logger. - @author redlab_be - - - - Defaults packageReduce to 1. - - - Amount of characters each package name should be reduced with. - @param packageReduce - - - - @param klass - @param shorten - - - @param name2 - @return - - - Wrapper that allows to add properties to 'basic building block' objects. - Before iText 1.5 every 'basic building block' implemented the MarkupAttributes interface. - By setting attributes, you could add markup to the corresponding XML and/or HTML tag. - This functionality was hardly used by anyone, so it was removed, and replaced by - the MarkedObject functionality. - - @deprecated since 5.5.9. This class is no longer used. - - - The element that is wrapped in a MarkedObject. - - - Contains extra markupAttributes - - - This constructor is for internal use only. - - - Creates a MarkedObject. - - - Gets all the chunks in this element. - - @return an ArrayList - - - Processes the element by adding it (or the different parts) to an - ElementListener. - - @param listener an ElementListener - @return true if the element was processed successfully - - - Gets the type of the text element. - - @return a type - - - @see com.lowagie.text.Element#isContent() - @since iText 2.0.8 - - - @see com.lowagie.text.Element#isNestable() - @since iText 2.0.8 - - - @return the markupAttributes - - - Wrapper that allows to add properties to a Chapter/Section object. - Before iText 1.5 every 'basic building block' implemented the MarkupAttributes interface. - By setting attributes, you could add markup to the corresponding XML and/or HTML tag. - This functionality was hardly used by anyone, so it was removed, and replaced by - the MarkedObject functionality. - - @deprecated since 5.5.9. This class is no longer used. - - - This is the title of this section. - - - Creates a MarkedObject with a Section or Chapter object. - @param section the marked section - - - Adds a Paragraph, List or Table - to this Section. - - @param index index at which the specified element is to be inserted - @param o an object of type Paragraph, List or Table= - @throws ClassCastException if the object is not a Paragraph, List or Table - - - Adds a Paragraph, List, Table or another Section - to this Section. - - @param o an object of type Paragraph, List, Table or another Section - @return a bool - @throws ClassCastException if the object is not a Paragraph, List, Table or Section - - - Processes the element by adding it (or the different parts) to an - ElementListener. - - @param listener an ElementListener - @return true if the element was processed successfully - - - Adds a collection of Elements - to this Section. - - @param collection a collection of Paragraphs, Lists and/or Tables - @return true if the action succeeded, false if not. - @throws ClassCastException if one of the objects isn't a Paragraph, List, Table - - - Creates a Section, adds it to this Section and returns it. - - @param indentation the indentation of the new section - @param numberDepth the numberDepth of the section - @return a new Section object - - - Creates a Section, adds it to this Section and returns it. - - @param indentation the indentation of the new section - @return a new Section object - - - Creates a Section, add it to this Section and returns it. - - @param numberDepth the numberDepth of the section - @return a new Section object - - - Creates a Section, adds it to this Section and returns it. - - @return a new Section object - - - Sets the title of this section. - - @param title the new title - - - - Sets the indentation of this Section on the left side. - - @param indentation the indentation - - - Sets the indentation of this Section on the right side. - - @param indentation the indentation - - - Sets the indentation of the content of this Section. - - @param indentation the indentation - - - Setter for property bookmarkOpen. - @param bookmarkOpen false if the bookmark children are not - visible. - - - Setter for property triggerNewPage. - @param triggerNewPage true if a new page has to be triggered. - - - Sets the bookmark title. The bookmark title is the same as the section title but - can be changed with this method. - @param bookmarkTitle the bookmark title - - - Adds a new page to the section. - @since 2.1.1 - - - - This is an Element that contains - some meta information about the document. - - - An object of type Meta can not be constructed by the user. - Userdefined meta information should be placed in a Header-object. - Meta is reserved for: Subject, Keywords, Author, Title, Producer - and Creationdate information. - - - - - - This is the type of Meta-information this object contains. - - - This is the content of the Meta-information. - - - The possible value of an alignment attribute. - @since 5.0.6 (moved from ElementTags) - - - The possible value of an alignment attribute. - @since 5.0.6 (moved from ElementTags) - - - The possible value of an alignment attribute. - @since 5.0.6 (moved from ElementTags) - - - The possible value of an alignment attribute. - @since 5.0.6 (moved from ElementTags) - - - The possible value of an alignment attribute. - @since 5.0.6 (moved from ElementTags) - - - The possible value of an alignment attribute. - @since 5.0.6 (moved from ElementTags) - - - The possible value of an alignment attribute. - @since 5.0.6 (moved from ElementTags) - - - - Constructs a Meta. - - the type of meta-information - the content - - - - Constructs a Meta. - - the tagname of the meta-information - the content - - - - Processes the element by adding it (or the different parts) to a - IElementListener. - - the IElementListener - true if the element was processed successfully - - - - Gets the type of the text element. - - a type - - - - Gets all the chunks in this element. - - an ArrayList - - - @see com.lowagie.text.Element#isContent() - @since iText 2.0.8 - - - @see com.lowagie.text.Element#isNestable() - @since iText 2.0.8 - - - - appends some text to this Meta. - - a string - a StringBuilder - - - - Returns the content of the meta information. - - a string - - - - Returns the name of the meta information. - - a string - - - - Returns the name of the meta information. - - name to match - a string - - - - The PageSize-object contains a number of read only rectangles representing the most common paper sizes. - - - - - This is the letter format - - - This is the note format - - - This is the legal format - - - This is the tabloid format - - - This is the executive format - - - This is the postcard format - - - This is the a0 format - - - This is the a1 format - - - This is the a2 format - - - This is the a3 format - - - This is the a4 format - - - This is the a5 format - - - This is the a6 format - - - This is the a7 format - - - This is the a8 format - - - This is the a9 format - - - This is the a10 format - - - This is the b0 format - - - This is the b1 format - - - This is the b2 format - - - This is the b3 format - - - This is the b4 format - - - This is the b5 format - - - This is the b6 format - - - This is the b7 format - - - This is the b8 format - - - This is the b9 format - - - This is the b10 format - - - This is the archE format - - - This is the archD format - - - This is the archC format - - - This is the archB format - - - This is the archA format - - - This is the American Foolscap format - - - This is the European Foolscap format - - - This is the halfletter format - - - This is the 11x17 format - - - This is the ISO 7810 ID-1 format (85.60 x 53.98 mm or 3.370 x 2.125 inch) - - - This is the ISO 7810 ID-2 format (A7 rotated) - - - This is the ISO 7810 ID-3 format (B7 rotated) - - - This is the ledger format - - - This is the Crown Quarto format - - - This is the Large Crown Quarto format - - - This is the Demy Quarto format. - - - This is the Royal Quarto format. - - - This is the Crown Octavo format - - - This is the Large Crown Octavo format - - - This is the Demy Octavo format - - - This is the Royal Octavo format. - - - This is the small paperback format. - - - This is the Pengiun small paperback format. - - - This is the Penguin large paparback format. - - - This is the letter format - @since iText 5.0.6 - - - This is the legal format - @since iText 5.0.6 - - - This is the a4 format - @since iText 5.0.6 - - - This method returns a Rectangle based on a String. - Possible values are the the names of a constant in this class - (for instance "A4", "LETTER",...) or a value like "595 842" - - - - A Paragraph is a series of Chunks and/or Phrases. - - - A Paragraph has the same qualities of a Phrase, but also - some additional layout-parameters: -
      -
    • the indentation -
    • the alignment of the text -
    -
    - - - Paragraph p = new Paragraph("This is a paragraph", - FontFactory.GetFont(FontFactory.HELVETICA, 18, Font.BOLDITALIC, new BaseColor(0, 0, 255))); - - - - - -
    - - The alignment of the text. - - - The indentation of this paragraph on the left side. - - - The indentation of this paragraph on the right side. - - - Holds value of property firstLineIndent. - - - The spacing before the paragraph. - - - The spacing after the paragraph. - - - Holds value of property extraParagraphSpace. - - - Does the paragraph has to be kept together on 1 page. - - - - Constructs a Paragraph. - - - - - Constructs a Paragraph with a certain leading. - - the leading - - - - Constructs a Paragraph with a certain Chunk. - - a Chunk - - - - Constructs a Paragraph with a certain Chunk - and a certain leading. - - the leading - a Chunk - - - - Constructs a Paragraph with a certain string. - - a string - - - - Constructs a Paragraph with a certain string - and a certain Font. - - a string - a Font - - - - Constructs a Paragraph with a certain string - and a certain leading. - - the leading - a string - - - - Constructs a Paragraph with a certain leading, string - and Font. - - the leading - a string - a Font - - - - Constructs a Paragraph with a certain Phrase. - - a Phrase - - - Creates a shallow clone of the Paragraph. - @return - - - Creates a shallow clone of the Paragraph. - @return - - - Breaks this Paragraph up in different parts, separating paragraphs, lists and tables from each other. - @return - - - Breaks this Paragraph up in different parts, separating paragraphs, lists and tables from each other. - @return - - - - Gets the type of the text element. - - a type - - - - Adds an Object to the Paragraph. - - the object to add - a bool - - - - Get/set the alignment of this paragraph. - - a integer - - - - Get/set the indentation of this paragraph on the left side. - - a float - - - - Get/set the indentation of this paragraph on the right side. - - a float - - - - Set/get if this paragraph has to be kept together on one page. - - a bool - - - - A Phrase is a series of Chunks. - - - A Phrase has a main Font, but some chunks - within the phrase can have a Font that differs from the - main Font. All the Chunks in a Phrase - have the same leading. - - - - // When no parameters are passed, the default leading = 16 - Phrase phrase0 = new Phrase(); - Phrase phrase1 = new Phrase("this is a phrase"); - // In this example the leading is passed as a parameter - Phrase phrase2 = new Phrase(16, "this is a phrase with leading 16"); - // When a Font is passed (explicitely or embedded in a chunk), the default leading = 1.5 * size of the font - Phrase phrase3 = new Phrase("this is a phrase with a red, normal font Courier, size 12", FontFactory.GetFont(FontFactory.COURIER, 12, Font.NORMAL, new Color(255, 0, 0))); - Phrase phrase4 = new Phrase(new Chunk("this is a phrase")); - Phrase phrase5 = new Phrase(18, new Chunk("this is a phrase", FontFactory.GetFont(FontFactory.HELVETICA, 16, Font.BOLD, new Color(255, 0, 0))); - - - - - This is the leading of this phrase. - - - The text leading that is multiplied by the biggest font size in the line. - - - This is the font of this phrase. - - - Null, unless the Phrase has to be hyphenated. - @since 2.1.2 - - - Predefined tab position and properties(alignment, leader and etc.); - @since 5.4.1 - - - - Constructs a Phrase without specifying a leading. - - - Has nine overloads. - - - - Copy constructor for Phrase. - - - - Constructs a Phrase with a certain leading. - - the leading - - - - Constructs a Phrase with a certain Chunk. - - a Chunk - - - - Constructs a Phrase with a certain Chunk and a certain leading. - - the leading - a Chunk - - - - Constructs a Phrase with a certain string. - - a string - - - - Constructs a Phrase with a certain string and a certain Font. - - a string - a Font - - - - Constructs a Phrase with a certain leading and a certain string. - - the leading - a string - - - - Processes the element by adding it (or the different parts) to an - . - - an IElementListener - true if the element was processed successfully - - - - Gets the type of the text element. - - a type - - - - Gets all the chunks in this element. - - an ArrayList - - - @see com.lowagie.text.Element#isContent() - @since iText 2.0.8 - - - @see com.lowagie.text.Element#isNestable() - @since iText 2.0.8 - - - - Adds a Chunk, an Anchor or another Phrase - to this Phrase. - - index at which the specified element is to be inserted - an object of type Chunk, Anchor, or Phrase - - - Adds a String to this Phrase. - - @param s a string - @return a boolean - @since 5.0.1 - - - - Adds a Chunk, Anchor or another Phrase - to this Phrase. - - an object of type Chunk, Anchor or Phrase - a bool - - - - Adds a collection of Chunks - to this Phrase. - - a collection of Chunks, Anchors and Phrases. - true if the action succeeded, false if not. - - - - Adds a Chunk. - - - This method is a hack to solve a problem I had with phrases that were split between chunks - in the wrong place. - - a Chunk - a bool - - - - Adds a Object to the Paragraph. - - the object to add. - - - - Checks is this Phrase contains no or 1 empty Chunk. - - - false if the Phrase - contains more than one or more non-emptyChunks. - - - - - - - Gets/sets the leading of this phrase. - - the linespacing - - - Gets the total leading. - This method is based on the assumption that the - font of the Paragraph is the font of all the elements - that make part of the paragraph. This isn't necessarily - true. - @return the total leading (fixed and multiplied) - - - - Gets the font of the first Chunk that appears in this Phrase. - - a Font - - - Returns the content as a String object. - This method differs from toString because toString will return an ArrayList with the toString value of the Chunks in this Phrase. - - - Setter/getter for the hyphenation. - @param hyphenation a HyphenationEvent instance - @since 2.1.2 - - - Setter/getter for the tabSettings. - @param tabSettings a TabSettings instance - @since 5.4.1 - - - Constructs a Phrase that can be used in the static GetInstance() method. - @param dummy a dummy parameter - - - Gets a special kind of Phrase that changes some characters into corresponding symbols. - @param string - @return a newly constructed Phrase - - - Gets a special kind of Phrase that changes some characters into corresponding symbols. - @param leading - @param string - @return a newly constructed Phrase - - - Gets a special kind of Phrase that changes some characters into corresponding symbols. - @param leading - @param string - @param font - @return a newly constructed Phrase - - - - A Rectangle is the representation of a geometric figure. - - - - - - - - This is the value that will be used as undefined. - - - This represents one side of the border of the Rectangle. - - - This represents one side of the border of the Rectangle. - - - This represents one side of the border of the Rectangle. - - - This represents one side of the border of the Rectangle. - - - This represents a rectangle without borders. - - - This represents a type of border. - - - the lower left x-coordinate. - - - the lower left y-coordinate. - - - the upper right x-coordinate. - - - the upper right y-coordinate. - - - This represents the status of the 4 sides of the rectangle. - - - This is the width of the border around this rectangle. - - - This is the color of the border of this rectangle. - - - The color of the left border of this rectangle. - - - The color of the right border of this rectangle. - - - The color of the top border of this rectangle. - - - The color of the bottom border of this rectangle. - - - The width of the left border of this rectangle. - - - The width of the right border of this rectangle. - - - The width of the top border of this rectangle. - - - The width of the bottom border of this rectangle. - - - Whether variable width borders are used. - - - This is the color of the background of this rectangle. - - - This is the rotation value of this rectangle. - - - - Constructs a Rectangle-object. - - lower left x - lower left y - upper right x - upper right y - - - Constructs a Rectangle-object. - - @param llx lower left x - @param lly lower left y - @param urx upper right x - @param ury upper right y - @param rotation the rotation (0, 90, 180, or 270) - @since iText 5.0.6 - - - - Constructs a Rectangle-object starting from the origin (0, 0). - - upper right x - upper right y - - - Constructs a Rectangle-object starting from the origin - (0, 0) and with a specific rotation (valid values are 0, 90, 180, 270). - - @param urx upper right x - @param ury upper right y - @param rotation the rotation of the rectangle - @since iText 5.0.6 - - - - Constructs a Rectangle-object. - - another Rectangle - - - Constructs a Rectangle-object based on a com.itextpdf.awt.geom.Rectangle object - @param rect com.itextpdf.awt.geom.Rectangle - - - Copies all of the parameters from a Rectangle object - except the position. - - @param rect - Rectangle to copy from - - - Copies all of the parameters from a Rectangle object - except the position. - - @param rect - Rectangle to copy from - - - - Processes the element by adding it (or the different parts) to an - IElementListener. - - an IElementListener - true if the element was processed successfully - - - - Gets the type of the text element. - - a type - - - - Gets all the chunks in this element. - - an ArrayList - - - @see com.lowagie.text.Element#isContent() - @since iText 2.0.8 - - - @see com.lowagie.text.Element#isNestable() - @since iText 2.0.8 - - - Switches lowerleft with upperright - - - - Gets a Rectangle that is altered to fit on the page. - - the top position - the bottom position - a Rectangle - - - - Swaps the values of urx and ury and of lly and llx in order to rotate the rectangle. - - a Rectangle - - - - Get/set the upper right y-coordinate. - - a float - - - Enables the border on the specified side. - - @param side - the side to enable. One of LEFT, RIGHT, TOP, BOTTOM - - - - Disables the border on the specified side. - - @param side - the side to disable. One of LEFT, RIGHT, TOP, BOTTOM - - - - - Get/set the border - - a int - - - - Get/set the grayscale of the rectangle. - - a float - - - - Get/set the lower left x-coordinate. - - a float - - - - Get/set the upper right x-coordinate. - - a float - - - - Get/set the lower left y-coordinate. - - a float - - - - Returns the lower left x-coordinate, considering a given margin. - - a margin - the lower left x-coordinate - - - - Returns the upper right x-coordinate, considering a given margin. - - a margin - the upper right x-coordinate - - - - Returns the upper right y-coordinate, considering a given margin. - - a margin - the upper right y-coordinate - - - - Returns the lower left y-coordinate, considering a given margin. - - a margin - the lower left y-coordinate - - - - Returns the width of the rectangle. - - a width - - - - Returns the height of the rectangle. - - a height - - - - Indicates if the table has borders. - - a bool - - - - Indicates if the table has a some type of border. - - the type of border - a bool - - - - Get/set the borderwidth. - - a float - - - Gets the color of the border. - - @return a value - - Get/set the color of the border. - - a BaseColor - - - Gets the backgroundcolor. - - @return a value - - Get/set the backgroundcolor. - - a BaseColor - - - - Set/gets the rotation - - a int - - - Updates the border flag for a side based on the specified width. A width - of 0 will disable the border on that side. Any other width enables it. - - @param width - width of border - @param side - border side constant - - - Sets a parameter indicating if the rectangle has variable borders - - @param useVariableBorders - indication if the rectangle has variable borders - - - - A RectangleReadOnly is the representation of a geometric figure. - It's the same as a Rectangle but immutable. - - - - - - - - - Constructs a RectangleReadOnly-object. - - lower left x - lower left y - upper right x - upper right y - - - Constructs a RectangleReadOnly -object. - - @param llx lower left x - @param lly lower left y - @param urx upper right x - @param ury upper right y - @param rotation the rotation of the Rectangle (0, 90, 180, 270) - @since iText 5.0.6 - - - - Constructs a RectangleReadOnly-object starting from the origin (0, 0). - - upper right x - upper right y - - - Constructs a RectangleReadOnly-object starting from the origin - (0, 0) and with a specific rotation (valid values are 0, 90, 180, 270). - - @param urx upper right x - @param ury upper right y - @since iText 5.0.6 - - - - Constructs a RectangleReadOnly-object. - - another Rectangle - - - Copies all of the parameters from a Rectangle object - except the position. - - @param rect - Rectangle to copy from - - - Copies all of the parameters from a Rectangle object - except the position. - - @param rect - Rectangle to copy from - - - Switches lowerleft with upperright - - - - Get/set the upper right y-coordinate. - - a float - - - Enables the border on the specified side. - - @param side - the side to enable. One of LEFT, RIGHT, TOP, BOTTOM - - - - Disables the border on the specified side. - - @param side - the side to disable. One of LEFT, RIGHT, TOP, BOTTOM - - - - - Get/set the border - - a int - - - - Get/set the grayscale of the rectangle. - - a float - - - - Get/set the lower left x-coordinate. - - a float - - - - Get/set the upper right x-coordinate. - - a float - - - - Get/set the lower left y-coordinate. - - a float - - - - Get/set the borderwidth. - - a float - - - Gets the color of the border. - - @return a value - - Get/set the color of the border. - - a BaseColor - - - Gets the backgroundcolor. - - @return a value - - Get/set the backgroundcolor. - - a BaseColor - - - - Set/gets the rotation - - a int - - - Sets a parameter indicating if the rectangle has variable borders - - @param useVariableBorders - indication if the rectangle has variable borders - - - - A special-version of LIST which use roman-letters. - - @see com.lowagie.text.List - @version 2003-06-22 - @author Michael Niedermair - - - Initialization - - - Initialization - - @param symbolIndent indent - - - Initialization - @param romanlower roman-char in lowercase - @param symbolIndent indent - - - Adds an Object to the List. - - @param o the object to add. - @return true if adding the object succeeded - - - - A Section is a part of a Document containing - other Sections, Paragraphs, List - and/or Tables. - - - You can not construct a Section yourself. - You will have to ask an instance of Section to the - Chapter or Section to which you want to - add the new Section. - - - - Paragraph title2 = new Paragraph("This is Chapter 2", FontFactory.GetFont(FontFactory.HELVETICA, 18, Font.BOLDITALIC, new Color(0, 0, 255))); - Chapter chapter2 = new Chapter(title2, 2); - Paragraph someText = new Paragraph("This is some text"); - chapter2.Add(someText); - Paragraph title21 = new Paragraph("This is Section 1 in Chapter 2", FontFactory.GetFont(FontFactory.HELVETICA, 16, Font.BOLD, new Color(255, 0, 0))); - Section section1 = chapter2.AddSection(title21); - Paragraph someSectionText = new Paragraph("This is some silly paragraph in a chapter and/or section. It contains some text to test the functionality of Chapters and Section."); - section1.Add(someSectionText); - Paragraph title211 = new Paragraph("This is SubSection 1 in Section 1 in Chapter 2", FontFactory.GetFont(FontFactory.HELVETICA, 14, Font.BOLD, new Color(255, 0, 0))); - Section section11 = section1.AddSection(40, title211, 2); - section11.Add(someSectionText);strong> - - - - - A possible number style. The default number style: "1.2.3." - @since iText 2.0.8 - - - A possible number style. For instance: "1.2.3" - @since iText 2.0.8 - - - This is the title of this section. - - - This is the number of sectionnumbers that has to be shown before the section title. - - - The style for sectionnumbers. - @since iText 2.0.8 - - - The indentation of this section on the left side. - - - The indentation of this section on the right side. - - - The additional indentation of the content of this section. - - - This is the number of subsections. - - - This is the complete list of sectionnumbers of this section and the parents of this section. - - - Indicates if the Section will be complete once added to the document. - @since iText 2.0.8 - - - Indicates if the Section was added completely to the document. - @since iText 2.0.8 - - - Indicates if this is the first time the section was added. - @since iText 2.0.8 - - - false if the bookmark children are not visible - - - true if the section has to trigger a new page - - - The bookmark title if different from the content title - - - - Constructs a new Section. - - - Has 2 overloads. - - - - - Constructs a new Section. - - a Paragraph - the numberDepth - - - - Sets the number of this section. - - the number of this section - an ArrayList, containing the numbers of the Parent - - - - Processes the element by adding it (or the different parts) to an - IElementListener. - - the IElementListener - true if the element was processed successfully - - - - Gets the type of the text element. - - a type - - - - Gets all the chunks in this element. - - an ArrayList - - - @see com.lowagie.text.Element#isContent() - @since iText 2.0.8 - - - @see com.lowagie.text.Element#isNestable() - @since iText 2.0.8 - - - - Adds a Paragraph, List or Table - to this Section. - - index at which the specified element is to be inserted - an object of type Paragraph, List or Table - - - - Adds a Paragraph, List, Table or another Section - to this Section. - - an object of type Paragraph, List, Table or another Section - a bool - - - - Adds a collection of Elements - to this Section. - - a collection of Paragraphs, Lists and/or Tables - true if the action succeeded, false if not. - - - - Creates a Section, adds it to this Section and returns it. - - the indentation of the new section - the title of the new section - the numberDepth of the section - the newly added Section - - - - Creates a Section, adds it to this Section and returns it. - - the indentation of the new section - the title of the new section - the newly added Section - - - - Creates a Section, add it to this Section and returns it. - - the title of the new section - the numberDepth of the section - the newly added Section - - - Adds a marked section. For use in class MarkedSection only! - - - - Creates a Section, adds it to this Section and returns it. - - the title of the new section - the newly added Section - - - Adds a Section to this Section and returns it. - - @param indentation the indentation of the new section - @param title the title of the new section - @param numberDepth the numberDepth of the section - - Adds a Section to this Section and returns it. - - the indentation of the new section - the title of the new section - the numberDepth of the section - the newly added Section - - - Adds a Section to this Section and returns it. - - @param title the title of the new section - @param numberDepth the numberDepth of the section - - Adds a Section to this Section and returns it. - - the title of the new section - the numberDepth of the section - the newly added Section - - - - Adds a Section to this Section and returns it. - - the indentation of the new section - the title of the new section - the newly added Section - - - - Adds a Section to this Section and returns it. - - the title of the new section - the newly added Section - - - - Get/set the title of this section - - a Paragraph - - - Sets the style for numbering sections. - Possible values are NUMBERSTYLE_DOTTED: 1.2.3. (the default) - or NUMBERSTYLE_DOTTED_WITHOUT_FINAL_DOT: 1.2.3 - @since iText 2.0.8 - - - Constructs a Paragraph that will be used as title for a Section or Chapter. - @param title the title of the section - @param numbers a list of sectionnumbers - @param numberDepth how many numbers have to be shown - @param numberStyle the numbering style - @return a Paragraph object - @since iText 2.0.8 - - - - Checks if this object is a Chapter. - - - true if it is a Chapter, - false if it is a Section - - - - - Checks if this object is a Section. - - - true if it is a Section, - false if it is a Chapter. - - - - - Get/set the numberdepth of this Section. - - a int - - - - Get/set the indentation of this Section on the left side. - - the indentation - - - - Get/set the indentation of this Section on the right side. - - the indentation - - - - Get/set the indentation of the content of this Section. - - the indentation - - - - Returns the depth of this section. - - the depth - - - - Get/set the bookmark - - a bool - - - Gets the bookmark title. - @return the bookmark title - - - Sets the bookmark title. The bookmark title is the same as the section title but - can be changed with this method. - @param bookmarkTitle the bookmark title - - - Changes the Chapter number. - - - Indicates if this is the first time the section is added. - @since iText2.0.8 - @return true if the section wasn't added yet - - - @see com.lowagie.text.LargeElement#isAddedCompletely() - @since iText 2.0.8 - - - @since iText 2.0.8 - @see com.lowagie.text.LargeElement#flushContent() - - - @since iText 2.0.8 - @see com.lowagie.text.LargeElement#isComplete() - - - Adds a new page to the section. - @since 2.1.1 - - - Returns the first occurrence of a special symbol in a String. - - @param string a String - @return an index of -1 if no special symbol was found - - - Gets a chunk with a symbol character. - @param c a character that has to be changed into a symbol - @param font Font if there is no SYMBOL character corresponding with c - @return a SYMBOL version of a character - - - Looks for the corresponding symbol in the font Symbol. - - @param c the original ASCII-char - @return the corresponding symbol in font Symbol - - - A collection of convenience methods that were present in many different iText - classes. - - - - - - - - - - Utility method to extend an array. - @param original the original array or null - @param item the item to be added to the array - @return a new array with the item appended - - - Checks for a true/false value of a key in a Properties object. - @param attributes - @param key - @return - - - - This method makes a valid URL from a given filename. - - - - - a given filename - a valid URL - - - Unescapes an URL. All the "%xx" are replaced by the 'xx' hex char value. - @param src the url to unescape - @return the eunescaped value - - - - This method is an alternative for the Stream.Skip()-method - that doesn't seem to work properly for big values of size. - - the stream - the number of bytes to skip - - - Measurement conversion from millimeters to points. - @param value a value in millimeters - @return a value in points - @since 2.1.2 - - - Measurement conversion from millimeters to inches. - @param value a value in millimeters - @return a value in inches - @since 2.1.2 - - - Measurement conversion from points to millimeters. - @param value a value in points - @return a value in millimeters - @since 2.1.2 - - - Measurement conversion from points to inches. - @param value a value in points - @return a value in inches - @since 2.1.2 - - - Measurement conversion from inches to millimeters. - @param value a value in inches - @return a value in millimeters - @since 2.1.2 - - - Measurement conversion from inches to points. - @param value a value in inches - @return a value in points - @since 2.1.2 - - - Reads the contents of a file to a String. - @param path the path to the file - @return a String with the contents of the file - @since iText 5.0.0 - - - Converts an array of bytes to a String of hexadecimal values - @param bytes a byte array - @return the same bytes expressed as hexadecimal values - - - - The ParserBase-class provides XML document parsing. - - - - - Begins the process of processing an XML document - - the XML document to parse - - - - This method gets called when a start tag is encountered. - - - - the name of the tag that is encountered - the list of attributes - - - - This method gets called when an end tag is encountered. - - - - the name of the tag that ends - - - - This method gets called when characters are encountered. - - an array of characters - the start position in the array - the number of characters to read from the array - - - This class contains entities that can be used in an entity tag. - - - This is a map that contains all possible id values of the entity tag - that can be translated to a character in font Symbol. - - - Gets a chunk with a symbol character. - @param e a symbol value (see Entities class: alfa is greek alfa,...) - @param font the font if the symbol isn't found (otherwise Font.SYMBOL) - @return a Chunk - - - Looks for the corresponding symbol in the font Symbol. - - @param name the name of the entity - @return the corresponding character in font Symbol - - - This class contains entities that can be used in an entity tag. - - - This is a map that contains the names of entities and their unicode value. - - - Translates an entity to a unicode character. - - @param name the name of the entity - @return the corresponding unicode character - - - - Translates a IANA encoding name to a Java encoding. - - - The object that maps IANA to Java encodings. - - - The handler for the events fired by SimpleXMLParser. - @author Paulo Soares - - - Called when a start tag is found. - @param tag the tag name - @param h the tag's attributes - - - Called when an end tag is found. - @param tag the tag name - - - Called when the document starts to be parsed. - - - Called after the document is parsed. - - - Called when a text element is found. - @param str the text element, probably a fragment. - - - The handler for the events fired by SimpleXMLParser. - @author Paulo Soares - - - Called when a comment is found. - @param text the comment text - - - - possible states - - - the state stack - - - The current character. - - - The previous character. - - - the line we are currently reading - - - the column where the current character occurs - - - was the last character equivalent to a newline? - - - A boolean indicating if the next character should be taken into account - if it's a space character. When nospace is false, the previous character - wasn't whitespace. - @since 2.1.5 - - - the current state - - - Are we parsing HTML? - - - current text (whatever is encountered between tags) - - - - current tagname - - - current attributes - - - The handler to which we are going to forward document content - - - The handler to which we are going to forward comments. - - - Keeps track of the number of tags that are open. - - - the quote character that was used to open the quote. - - - the attribute key. - - - the attribute value. - - - Creates a Simple XML parser object. - Call Go(BufferedReader) immediately after creation. - - - Does the actual parsing. Perform this immediately - after creating the parser object. - - - Gets a state from the stack - @return the previous state - - - Adds a state to the stack. - @param s a state to add to the stack - - - Flushes the text that is currently in the buffer. - The text can be ignored, added to the document - as content or as comment,... depending on the current state. - - - Initialized the tag name and attributes. - - - Sets the name of the tag. - - - processes the tag. - @param start if true we are dealing with a tag that has just been opened; if false we are closing a tag. - - - Throws an exception - - - Parses the XML document firing the events to the handler. - @param doc the document handler - @param r the document. The encoding is already resolved. The reader is not closed - @throws IOException on error - - - Parses the XML document firing the events to the handler. - @param doc the document handler - @param in the document. The encoding is deduced from the stream. The stream is not closed - @throws IOException on error - - - Escapes a string with the appropriated XML codes. - @param s the string to be escaped - @param onlyASCII codes above 127 will always be escaped with &#nn; if true - @return the escaped string - - - This {@link NewLineHandler} returns true on the tags p, - blockqouteand br - - @author Balder - - - - Default constructor - - @since 5.0.6 - - - Always returns false. - @author Balder - @since 5.0.6 - - - - A NewLineHandler determines if an encountered tag should result in a new line - in a document. - - @author Balder - @since 5.0.6 - - - @param tag the tag to check if after this one a new line should be in a document - @return true in case a new line should be added. - @since 5.0.6 - - - An implementation of an XmpSchema. - - - default namespace identifier - - - default namespace uri - - - External Contributors to the resource (other than the authors). - - - The extent or scope of the resource. - - - The authors of the resource (listed in order of precedence, if significant). - - - Date(s) that something interesting happened to the resource. - - - A textual description of the content of the resource. Multiple values may be present for different languages. - - - The file format used when saving the resource. Tools and applications should set this property to the save format of the data. It may include appropriate qualifiers. - - - Unique identifier of the resource. - - - An unordered array specifying the languages used in the resource. - - - Publishers. - - - Relationships to other documents. - - - Informal rights statement, selected by language. - - - Unique identifier of the work from which this resource was derived. - - - An unordered array of descriptive phrases or keywords that specify the topic of the content of the resource. - - - The title of the document, or the name given to the resource. Typically, it will be a name by which the resource is formally known. - - - A document type; for example, novel, poem, or working paper. - - - @param shorthand - @throws IOException - - - Adds a title. - @param title - - - Adds a title. - @param title - - - Adds a description. - @param desc - - - Adds a description. - @param desc - - - Adds a subject. - @param subject - - - Adds a subject. - @param subject array of subjects - - - Adds a single author. - @param author - - - Adds an array of authors. - @param author - - - Adds a single publisher. - @param publisher - - - Adds an array of publishers. - @param publisher - - - - A wrapper for an Encoding to suppress the preamble. - - - - Key for the default language. - - - Creates a Properties object that stores languages for use in an XmpSchema - - - Creates a Properties object that stores languages for use in an XmpSchema - - - Add a language. - - - Process a property. - - - Creates a String that can be used in an XmpSchema. - - - An implementation of an XmpSchema. - - - default namespace identifier - - - default namespace uri - - - Keywords. - - - The PDF file version (for example: 1.0, 1.3, and so on). - - - The Producer. - - - @throws IOException - - - Adds keywords. - @param keywords - - - Adds the producer. - @param producer - - - Adds the version. - @param version - - - StringBuilder to construct an XMP array. - - - An array that is unordered. - - - An array that is ordered. - - - An array with alternatives. - - - the type of array. - - - Creates an XmpArray. - @param type the type of array: UNORDERED, ORDERED or ALTERNATIVE. - - - Returns the String representation of the XmpArray. - @return a String representation - - - An implementation of an XmpSchema. - - - default namespace identifier - - - default namespace uri - - - An unordered array specifying properties that were edited outside the authoring application. Each item should contain a single namespace and XPath separated by one ASCII space (U+0020). - - - The base URL for relative URLs in the document content. If this document contains Internet links, and those links are relative, they are relative to this base URL. This property provides a standard way for embedded relative URLs to be interpreted by tools. Web authoring tools should set the value based on their notion of where URLs will be interpreted. - - - The date and time the resource was originally created. - - - The name of the first known tool used to create the resource. If history is present in the metadata, this value should be equivalent to that of xmpMM:History�s softwareAgent property. - - - An unordered array of text strings that unambiguously identify the resource within a given context. - - - The date and time that any metadata for this resource was last changed. - - - The date and time the resource was last modified. - - - A short informal name for the resource. - - - An alternative array of thumbnail images for a file, which can differ in characteristics such as size or image encoding. - - - @param shorthand - @throws IOException - - - Adds the creatortool. - @param creator - - - Adds the creation date. - @param date - - - Adds the modification date. - @param date - - - Adds the meta data date. - @param date - - - Adds the identifier. - @param id - - - Adds the nickname. - @param name - - - An implementation of an XmpSchema. - - - default namespace identifier - - - default namespace uri - - - A reference to the original document from which this one is derived. It is a minimal reference; missing components can be assumed to be unchanged. For example, a new version might only need to specify the instance ID and version number of the previous version, or a rendition might only need to specify the instance ID and rendition class of the original. - - - The common identifier for all versions and renditions of a document. - - - An ordered array of high-level user actions that resulted in this resource. It is intended to give human readers a general indication of the steps taken to make the changes from the previous version to this one. The list should be at an abstract level; it is not intended to be an exhaustive keystroke or other detailed history. - - - A reference to the document as it was prior to becoming managed. It is set when a managed document is introduced to an asset management system that does not currently own it. It may or may not include references to different management systems. - - - The name of the asset management system that manages this resource. - - - A URI identifying the managed resource to the asset management system; the presence of this property is the formal indication that this resource is managed. The form and content of this URI is private to the asset management system. - - - A URI that can be used to access information about the managed resource through a web browser. It might require a custom browser plugin. - - - Specifies a particular variant of the asset management system. The format of this property is private to the specific asset management system. - - - The rendition class name for this resource. - - - Can be used to provide additional rendition parameters that are too complex or verbose to encode in xmpMM: RenditionClass. - - - The document version identifier for this resource. - - - The version history associated with this resource. - - - @throws IOException - - - Reads an XMP stream into an org.w3c.dom.Document objects. - Allows you to replace the contents of a specific tag. - @since 2.1.3 - - - String used to fill the extra space. - - - Processing Instruction required at the start of an XMP stream - @since iText 2.1.6 - - - Processing Instruction required at the end of an XMP stream for XMP streams that can be updated - @since iText 2.1.6 - - - Constructs an XMP reader - @param bytes the XMP content - @throws ExceptionConverter - @throws IOException - @throws SAXException - - - Replaces the content of a tag. - @param namespaceURI the URI of the namespace - @param localName the tag name - @param value the new content for the tag - @return true if the content was successfully replaced - @since 2.1.6 the return type has changed from void to boolean - - - Replaces the content of an attribute in the description tag. - @param namespaceURI the URI of the namespace - @param localName the tag name - @param value the new content for the tag - @return true if the content was successfully replaced - @since 5.0.0 the return type has changed from void to boolean - - - Adds a tag. - @param namespaceURI the URI of the namespace - @param parent the tag name of the parent - @param localName the name of the tag to add - @param value the new content for the tag - @return true if the content was successfully added - @since 2.1.6 - - - Sets the text of this node. All the child's node are deleted and a new - child text node is created. - @param domDocument the Document that contains the node - @param n the Node to add the text to - @param value the text to add - - - Writes the document to a byte array. - - - Abstract superclass of the XmpSchemas supported by iText. - - - the namesspace - - - Constructs an XMP schema. - @param xmlns - - - The String representation of the contents. - @return a String representation. - - - Processes a property - @param buf - @param p - - - @return Returns the xmlns. - - - @param key - @param value - @return the previous property (null if there wasn't one) - - - @see java.util.Properties#setProperty(java.lang.String, java.lang.String) - - @param key - @param value - @return the previous property (null if there wasn't one) - - - @param content - @return - - - With this class you can create an Xmp Stream that can be used for adding - Metadata to a PDF Dictionary. Remark that this class doesn't cover the - complete XMP specification. - - - A possible charset for the XMP. - - - A possible charset for the XMP. - - - A possible charset for the XMP. - - - A possible charset for the XMP. - - - Creates an XmpWriter. - @param os - @param utfEncoding - @param extraSpace - @throws IOException - - - Creates an XmpWriter. - @param os - @throws IOException - - - @param os - @param info - @throws IOException - - - @param os - @param info - @throws IOException - @since 5.0.1 (generic type in signature) - - - Sets the XMP to read-only - - - @param about The about to set. - - - Adds an rdf:Description. - @param xmlns - @param content - @throws IOException - - - Adds an rdf:Description. - @param s - @throws IOException - - - @param schemaNS The namespace URI for the property. Has the same usage as in getProperty. - @param propName The name of the property. - Has the same usage as in getProperty(). - @param value the value for the property (only leaf properties have a value). - Arrays and non-leaf levels of structs do not have values. - Must be null if the value is not relevant.
    - The value is automatically detected: Boolean, Integer, Long, Double, XMPDateTime and - byte[] are handled, on all other toString() is called. - @throws XMPException Wraps all errors and exceptions that may occur. -
    - - Simplifies the construction of an array by not requiring that you pre-create an empty array. - The array that is assigned is created automatically if it does not yet exist. Each call to - AppendArrayItem() appends an item to the array. - - @param schemaNS The namespace URI for the array. - @param arrayName The name of the array. May be a general path expression, must not be null or - the empty string. - @param value the value of the array item. - @throws XMPException Wraps all errors and exceptions that may occur. - - - Simplifies the construction of an ordered array by not requiring that you pre-create an empty array. - The array that is assigned is created automatically if it does not yet exist. Each call to - AppendArrayItem() appends an item to the array. - - @param schemaNS The namespace URI for the array. - @param arrayName The name of the array. May be a general path expression, must not be null or - the empty string. - @param value the value of the array item. - @throws XMPException Wraps all errors and exceptions that may occur. - - - Simplifies the construction of an alternate array by not requiring that you pre-create an empty array. - The array that is assigned is created automatically if it does not yet exist. Each call to - AppendArrayItem() appends an item to the array. - - @param schemaNS The namespace URI for the array. - @param arrayName The name of the array. May be a general path expression, must not be null or - the empty string. - @param value the value of the array item. - @throws XMPException Wraps all errors and exceptions that may occur. - - - Flushes and closes the XmpWriter. - @throws IOException - - - Flushes and closes the XmpWriter. - @throws IOException - - - External Contributors to the resource (other than the authors). - - - The extent or scope of the resource. - - - The authors of the resource (listed in order of precedence, if significant). - - - Date(s) that something interesting happened to the resource. - - - A textual description of the content of the resource. Multiple values may be present for different languages. - - - The file format used when saving the resource. Tools and applications should set this property to the save format of the data. It may include appropriate qualifiers. - - - Unique identifier of the resource. - - - An unordered array specifying the languages used in the resource. - - - Publishers. - - - Relationships to other documents. - - - Informal rights statement, selected by language. - - - Unique identifier of the work from which this resource was derived. - - - An unordered array of descriptive phrases or keywords that specify the topic of the content of the resource. - - - The title of the document, or the name given to the resource. Typically, it will be a name by which the resource is formally known. - - - A document type; for example, novel, poem, or working paper. - - - Adds a title. - - @param xmpMeta - @param title - - - Sets a title. - - @param xmpMeta - @param title - @param genericLang The name of the generic language - @param specificLang The name of the specific language - - - Adds a description. - - @param xmpMeta - @param desc - - - Sets a description. - - @param xmpMeta - @param desc - @param genericLang The name of the generic language - @param specificLang The name of the specific language - - - Adds a subject. - - @param xmpMeta - @param subject - - - Sets a subject. - - @param xmpMeta - @param subject array of subjects - - - Adds a single author. - - @param xmpMeta - @param author - - - Sets an array of authors. - - @param xmpMeta - @param author - - - Adds a single publisher. - - @param xmpMeta - @param publisher - - - Sets an array of publishers. - - @param xmpMeta - @param publisher - - - Keywords. - - - The PDF file version (for example: 1.0, 1.3, and so on). - - - The Producer. - - - Adds keywords. - - @param xmpMeta - @param keywords - - - Adds the producer. - - @param xmpMeta - @param producer - - - Adds the version. - - @param xmpMeta - @param version - - - An unordered array specifying properties that were edited outside the authoring application. Each item should contain a single namespace and XPath separated by one ASCII space (U+0020). - - - The base URL for relative URLs in the document content. If this document contains Internet links, and those links are relative, they are relative to this base URL. This property provides a standard way for embedded relative URLs to be interpreted by tools. Web authoring tools should set the value based on their notion of where URLs will be interpreted. - - - The date and time the resource was originally created. - - - The name of the first known tool used to create the resource. If history is present in the metadata, this value should be equivalent to that of xmpMM:History's softwareAgent property. - - - An unordered array of text strings that unambiguously identify the resource within a given context. - - - The date and time that any metadata for this resource was last changed. - - - The date and time the resource was last modified. - - - A short informal name for the resource. - - - An alternative array of thumbnail images for a file, which can differ in characteristics such as size or image encoding. - - - Adds the creatortool. - - @param xmpMeta - @param creator - - - Adds the creation date. - - @param xmpMeta - @param date - - - Adds the modification date. - - @param xmpMeta - @param date - - - Adds the meta data date. - - @param xmpMeta - @param date - - - Sets the identifier. - - @param xmpMeta - @param id - - - Adds the nickname. - - @param xmpMeta - @param name - - - A reference to the original document from which this one is derived. It is a minimal reference; missing components can be assumed to be unchanged. For example, a new version might only need to specify the instance ID and version number of the previous version, or a rendition might only need to specify the instance ID and rendition class of the original. - - - The common identifier for all versions and renditions of a document. - - - An ordered array of high-level user actions that resulted in this resource. It is intended to give human readers a general indication of the steps taken to make the changes from the previous version to this one. The list should be at an abstract level; it is not intended to be an exhaustive keystroke or other detailed history. - - - A reference to the document as it was prior to becoming managed. It is set when a managed document is introduced to an asset management system that does not currently own it. It may or may not include references to different management systems. - - - The name of the asset management system that manages this resource. - - - A URI identifying the managed resource to the asset management system; the presence of this property is the formal indication that this resource is managed. The form and content of this URI is private to the asset management system. - - - A URI that can be used to access information about the managed resource through a web browser. It might require a custom browser plugin. - - - Specifies a particular variant of the asset management system. The format of this property is private to the specific asset management system. - - - The rendition class name for this resource. - - - Can be used to provide additional rendition parameters that are too complex or verbose to encode in xmpMM: RenditionClass. - - - The document version identifier for this resource. - - - The version history associated with this resource. - - - - @author psoares - - - Print writer. - - - Canonical output. - - - Processing XML 1.1 document. - - - Default constructor. - - - Sets whether output is canonical. - - - Sets the output stream for printing. - - - Sets the output writer. - - - Writes the specified node, recursively. - - - Returns a sorted list of attributes. - - - Normalizes and prints the given string. - - - Normalizes and print the given character. - - - This class converts XML into plain text stripping all tags. - - - Buffer that stores all content that is encountered. - - - Static method that parses an XML Stream. - @param is the XML input that needs to be parsed - @return a String obtained by removing all tags from the XML - - - Creates an instance of XML to TXT. - - - @return the String after parsing. - - - @see com.itextpdf.text.xml.simpleparser.SimpleXMLDocHandler#startElement(java.lang.String, java.util.Map) - - - @see com.itextpdf.text.xml.simpleparser.SimpleXMLDocHandler#endElement(java.lang.String) - - - @see com.itextpdf.text.xml.simpleparser.SimpleXMLDocHandler#startDocument() - - - @see com.itextpdf.text.xml.simpleparser.SimpleXMLDocHandler#endDocument() - - - @see com.itextpdf.text.xml.simpleparser.SimpleXMLDocHandler#text(java.lang.String) - - - Contains utility methods for XML. - @author Balder - @since 5.0.6 - - - - Escapes a string with the appropriated XML codes. - @param s the string to be escaped - @param onlyASCII codes above 127 will always be escaped with &#nn; if true - @return the escaped string - @since 5.0.6 - - - - Unescapes 'lt', 'gt', 'apos', 'quote' and 'amp' to the - corresponding character values. - @param s a string representing a character - @return a character value - - - Checks if a character value should be escaped/unescaped. - @param s the String representation of an integer - @return true if it's OK to escape or unescape this value - - - Checks if a character value should be escaped/unescaped. - @param c a character value - @return true if it's OK to escape or unescape this value - - - Looks for a character in a character array, starting from a certain position - @param needle the character you're looking for - @param haystack the character array - @param start the start position - @return the position where the character was found, or -1 if it wasn't found. - - - Returns the IANA encoding name that is auto-detected from - the bytes specified, with the endian-ness of that encoding where appropriate. - (method found in org.apache.xerces.impl.XMLEntityManager, originally published - by the Apache Software Foundation under the Apache Software License; now being - used in iText under the MPL) - @param b4 The first four bytes of the input. - @return an IANA-encoding string - @since 5.0.6 - - - - A special-version of LIST whitch use zapfdingbats-letters. - - @see com.lowagie.text.List - @author Michael Niedermair and Bruno Lowagie - - - char-number in zapfdingbats - - - Creates a ZapfDingbatsList - - @param zn a char-number - - - Creates a ZapfDingbatsList - - @param zn a char-number - @param symbolIndent indent - - - Sets the dingbat's color. - - @param zapfDingbatColor color for the ZapfDingbat - - - set the char-number - @param zn a char-number - - - Adds an Object to the List. - - @param o the object to add. - @return true if adding the object succeeded - - - - A special-version of LIST whitch use zapfdingbats-numbers (1..10). - - @see com.lowagie.text.List - @version 2003-06-22 - @author Michael Niedermair - - - which type - - - Creates a ZapdDingbatsNumberList - @param type the type of list - @param symbolIndent indent - - - Creates a ZapdDingbatsNumberList - @param type the type of list - @param symbolIndent indent - - - get the type - - @return char-number - - - Adds an Object to the List. - - @param o the object to add. - @return true if adding the object succeeded - - - Objects implementing Indentable allow to set indentation left and right. - - - Sets the indentation on the left side. - - @param indentation the new indentation - - - Sets the indentation on the right side. - - @param indentation the new indentation - - - Objects implementing Spaceable allow setting spacing before and after. - - - Sets the spacing before. - - @param spacing the new spacing - - - Sets the spacing after. - - @param spacing the new spacing - - - @author itextpdf.com - - - - Receive a writer and the document to do certain operations on them. - @param writer the PdfWriter - @param doc the document - @throws DocumentException - - - This class contains version information about iText. - DO NOT CHANGE THE VERSION INFORMATION WITHOUT PERMISSION OF THE COPYRIGHT HOLDERS OF ITEXT. - Changing the version makes it extremely difficult to debug an application. - Also, the nature of open source software is that you honor the copyright of the original creators of the software. - - - String that will indicate if the AGPL version is used. - - - The iText version instance. - - - This String contains the name of the product. - iText is a registered trademark by iText Group NV. - Please don't change this constant. - - - This String contains the version number of this iText release. - For debugging purposes, we request you NOT to change this constant. - - - This String contains the iText version as shown in the producer line. - iText is a product developed by iText Group NV. - iText Group requests that you retain the iText producer line - in every PDF that is created or manipulated using iText. - - - The license key. - - - Gets an instance of the iText version that is currently used. - Note that iText Group requests that you retain the iText producer line - in every PDF that is created or manipulated using iText. - - - * Gets the product name. - * iText Group requests that you retain the iText producer line - * in every PDF that is created or manipulated using iText. - * @return the product name - - - * Gets the release number. - * iText Group requests that you retain the iText producer line - * in every PDF that is created or manipulated using iText. - * @return the release number - - - * Returns the iText version as shown in the producer line. - * iText is a product developed by iText Group NV. - * iText Group requests that you retain the iText producer line - * in every PDF that is created or manipulated using iText. - * @return iText version - - - Returns a license key if one was provided, or null if not. - @return a license key. - - - Checks if the AGPL version is used. - @return returns true if the AGPL version is used. - - - An element that is not an element, it holds {@link Element#WRITABLE_DIRECT} - as Element type. It implements WriterOperation to do operations on the - {@link PdfWriter} and the {@link Document} that must be done at the time of - the writing. Much like a {@link VerticalPositionMark} but little different. - - @author itextpdf.com - - - - @return {@link Element#WRITABLE_DIRECT} - - - The TYPE_UNKNOWN is an initial type value - - - The min value equivalent to zero. If absolute value less then ZERO it considered as zero. - - - The values of transformation matrix - - - The transformation type - - - Multiply matrix of two AffineTransform objects - @param t1 - the AffineTransform object is a multiplicand - @param t2 - the AffineTransform object is a multiplier - @return an AffineTransform object that is a result of t1 multiplied by matrix t2. - - - Gets the name of the resultant PDF file. - This name will be passed to makePdf, assertPdf and comparePdf methods. - @return - - - Gets the name of the compare PDF file. - This name will be passed to comparePdf method. - @return - - - Sets the maximum errors count which will be returned as the result of the comparison. - @param compareByContentMaxErrorCount the errors count. - @return Returns this. - - - Sets the absolute error parameter which will be used in floating point numbers comparison. - @param error the epsilon new value. - @return Returns this. - - - Sets the relative error parameter which will be used in floating point numbers comparison. - @param error the epsilon new value. - @return Returns this. - - - - A utility class to perform base64 encoding and decoding as specified - in RFC-1521. See also RFC 1421. - - @version $Revision: 1.4 $ - - - - - marker for invalid bytes - - - - marker for accepted whitespace bytes - - - - marker for an equal symbol - - - - Encode the given byte[]. - - the source string. - the base64-encoded data. - - - - Encode the given byte[]. - - the source string. - a linefeed is added after linefeed characters; - must be dividable by four; 0 means no linefeeds - the base64-encoded data. - - - - Encode the given string. - the source string. - the base64-encoded string. - - - - Decode the given byte[]. - - - the base64-encoded data. - the decoded data. - - - - Decode the given string. - - the base64-encoded string. - the decoded string. - - - - Byte buffer container including length of valid data. - - @since 11.10.2006 - - - - the initial capacity for this buffer - - - a byte array that will be wrapped with ByteBuffer. - - - a byte array that will be wrapped with ByteBuffer. - the length of valid bytes in the array - - - - Loads the stream into a buffer. - - an InputStream - If the stream cannot be read. - - - a byte array that will be wrapped with ByteBuffer. - the offset of the provided buffer. - the length of valid bytes in the array - - - Returns a byte stream that is limited to the valid amount of bytes. - - - Returns the length, that means the number of valid bytes, of the buffer; - the inner byte array might be bigger than that. - - - - Detects the encoding of the byte buffer, stores and returns it. - Only UTF-8, UTF-16LE/BE and UTF-32LE/BE are recognized. - Note: UTF-32 flavors are not supported by Java, the XML-parser will complain. - - Returns the encoding string. - - - the index to retrieve the byte from - Returns a byte from the buffer - - - the index to retrieve a byte as int or char. - Returns a byte from the buffer - - - - Appends a byte to the buffer. - a byte - - - - Appends a byte array or part of to the buffer. - - a byte array - an offset with - - - - - Append a byte array to the buffer - a byte array - - - - Append another buffer to this buffer. - another ByteBuffer - - - - Ensures the requested capacity by increasing the buffer size when the - current length is exceeded. - - requested new buffer length - - - - An OutputStream that counts the written bytes. - - @since 08.11.2006 - - - - - the decorated output stream - - - - the byte counter - - - - Constructor with providing the output stream to decorate. - an OutputStream - - - the bytesWritten - - - - - - - Abstract class for reading filtered character streams. - The abstract class FilterReader itself - provides default methods that pass all requests to - the contained stream. Subclasses of FilterReader - should override some of these methods and may also provide - additional methods and fields. - - @author Mark Reinhold - @since JDK1.1 - - - - Reads a single character. - - @exception IOException If an I/O error occurs - - - Reads characters into a portion of an array. - - @exception IOException If an I/O error occurs - - - ** - - - - @since 22.08.2006 - - - - - the result of the escaping sequence - - - - count the digits of the sequence - - - - the state of the automaton - - - - - - Processes numeric escaped chars to find out if they are a control character. - a char - Returns the char directly or as replacement for the escaped sequence. - - - - Converts between ISO 8601 Strings and Calendar with millisecond resolution. - - @since 16.02.2006 - - - - - a date string that is ISO 8601 conform. - an existing XMPDateTime to set with the parsed date - Returns an XMPDateTime-object containing the ISO8601-date. - Is thrown when the string is non-conform. - - - - - @since 22.08.2006 - - - - initializes the parser container - - - Returns the length of the input. - - - Returns whether there are more chars to come. - - - index of char - Returns char at a certain index. - - - Returns the current char or 0x0000 if there are no more chars. - - - - Skips the next char. - - - - Returns the current position. - - - - Parses a integer from the source and sets the pointer after it. - Error message to put in the exception if no number can be found - the max value of the number to return - Returns the parsed integer. - Thrown if no integer can be found. - - - - @since 12.10.2006 - - - - - Private constructor - - - - - - Converts a Cp1252 char (contains all Latin-1 chars above 0x80) into a - UTF-8 byte sequence. The bytes 0x81, 0x8D, 0x8F, 0x90, and 0x9D are - formally undefined by Windows 1252 and therefore replaced by a space - (0x20). - - - an Cp1252 / Latin-1 byte - Returns a byte array containing a UTF-8 byte sequence. - - - - @since 11.08.2006 - - - - - private constructor - - - - - Asserts that an array name is set. - an array name - Array name is null or empty - - - - Asserts that a property name is set. - a property name or path - Property name is null or empty - - - - Asserts that a schema namespace is set. - a schema namespace - Schema is null or empty - - - - Asserts that a prefix is set. - a prefix - Prefix is null or empty - - - - Asserts that a specific language is set. - a specific lang - Specific language is null or empty - - - - Asserts that a struct name is set. - a struct name - Struct name is null or empty - - - - Asserts that any string parameter is set. - any string parameter - Thrown if the parameter is null or has length 0. - - - - Asserts that the xmp object is of this implemention - (). - the XMP object - A wrong implentaion is used. - - - - Parser for "normal" XML serialisation of RDF. - - @since 14.07.2006 - - - - - Start of coreSyntaxTerms. - - - - End of coreSyntaxTerms - - - - Start of additions for syntax Terms. - - - - End of of additions for syntaxTerms. - - - - Start of oldTerms. - - - - End of oldTerms. - - - - ! Yes, the syntax terms include the core terms. - - - - this prefix is used for default namespaces - - - - The main parsing method. The XML tree is walked through from the root node and and XMP tree - is created. This is a raw parse, the normalisation of the XMP tree happens outside. - - the XML root node - Returns an XMP metadata object (not normalized) - Occurs if the parsing fails for any reason. - - - - Each of these parsing methods is responsible for recognizing an RDF - syntax production and adding the appropriate structure to the XMP tree. - They simply return for success, failures will throw an exception. - - the xmp metadata object that is generated - the top-level xml node - thown on parsing errors - - - - - 7.2.5 nodeElementURIs - anyURI - ( coreSyntaxTerms | rdf:li | oldTerms ) - - 7.2.11 nodeElement - start-element ( URI == nodeElementURIs, - attributes == set ( ( idAttr | nodeIdAttr | aboutAttr )?, propertyAttr* ) ) - propertyEltList - end-element() - - A node element URI is rdf:Description or anything else that is not an RDF - term. - - the xmp metadata object that is generated - the parent xmp node - the currently processed XML node - Flag if the node is a top-level node - thown on parsing errors - - - - - 7.2.7 propertyAttributeURIs - anyURI - ( coreSyntaxTerms | rdf:Description | rdf:li | oldTerms ) - - 7.2.11 nodeElement - start-element ( URI == nodeElementURIs, - attributes == set ( ( idAttr | nodeIdAttr | aboutAttr )?, propertyAttr* ) ) - propertyEltList - end-element() - - Process the attribute list for an RDF node element. A property attribute URI is - anything other than an RDF term. The rdf:ID and rdf:nodeID attributes are simply ignored, - as are rdf:about attributes on inner nodes. - - the xmp metadata object that is generated - the parent xmp node - the currently processed XML node - Flag if the node is a top-level node - thown on parsing errors - - - - 7.2.13 propertyEltList - ws* ( propertyElt ws* )* - - the xmp metadata object that is generated - the parent xmp node - the currently processed XML node - Flag if the node is a top-level node - thown on parsing errors - - - - 7.2.14 propertyElt - - resourcePropertyElt | literalPropertyElt | parseTypeLiteralPropertyElt | - parseTypeResourcePropertyElt | parseTypeCollectionPropertyElt | - parseTypeOtherPropertyElt | emptyPropertyElt - - 7.2.15 resourcePropertyElt - start-element ( URI == propertyElementURIs, attributes == set ( idAttr? ) ) - ws* nodeElement ws* - end-element() - - 7.2.16 literalPropertyElt - start-element ( - URI == propertyElementURIs, attributes == set ( idAttr?, datatypeAttr?) ) - text() - end-element() - - 7.2.17 parseTypeLiteralPropertyElt - start-element ( - URI == propertyElementURIs, attributes == set ( idAttr?, parseLiteral ) ) - literal - end-element() - - 7.2.18 parseTypeResourcePropertyElt - start-element ( - URI == propertyElementURIs, attributes == set ( idAttr?, parseResource ) ) - propertyEltList - end-element() - - 7.2.19 parseTypeCollectionPropertyElt - start-element ( - URI == propertyElementURIs, attributes == set ( idAttr?, parseCollection ) ) - nodeElementList - end-element() - - 7.2.20 parseTypeOtherPropertyElt - start-element ( URI == propertyElementURIs, attributes == set ( idAttr?, parseOther ) ) - propertyEltList - end-element() - - 7.2.21 emptyPropertyElt - start-element ( URI == propertyElementURIs, - attributes == set ( idAttr?, ( resourceAttr | nodeIdAttr )?, propertyAttr* ) ) - end-element() - - The various property element forms are not distinguished by the XML element name, - but by their attributes for the most part. The exceptions are resourcePropertyElt and - literalPropertyElt. They are distinguished by their XML element content. - - NOTE: The RDF syntax does not explicitly include the xml:lang attribute although it can - appear in many of these. We have to allow for it in the attibute counts below. - - the xmp metadata object that is generated - the parent xmp node - the currently processed XML node - Flag if the node is a top-level node - thown on parsing errors - - - - 7.2.15 resourcePropertyElt - start-element ( URI == propertyElementURIs, attributes == set ( idAttr? ) ) - ws* nodeElement ws* - end-element() - - This handles structs using an rdf:Description node, - arrays using rdf:Bag/Seq/Alt, and typedNodes. It also catches and cleans up qualified - properties written with rdf:Description and rdf:value. - - the xmp metadata object that is generated - the parent xmp node - the currently processed XML node - Flag if the node is a top-level node - thown on parsing errors - - - - 7.2.16 literalPropertyElt - start-element ( URI == propertyElementURIs, - attributes == set ( idAttr?, datatypeAttr?) ) - text() - end-element() - - Add a leaf node with the text value and qualifiers for the attributes. - the xmp metadata object that is generated - the parent xmp node - the currently processed XML node - Flag if the node is a top-level node - thown on parsing errors - - - - 7.2.17 parseTypeLiteralPropertyElt - start-element ( URI == propertyElementURIs, - attributes == set ( idAttr?, parseLiteral ) ) - literal - end-element() - - thown on parsing errors - - - - 7.2.18 parseTypeResourcePropertyElt - start-element ( URI == propertyElementURIs, - attributes == set ( idAttr?, parseResource ) ) - propertyEltList - end-element() - - Add a new struct node with a qualifier for the possible rdf:ID attribute. - Then process the XML child nodes to get the struct fields. - - the xmp metadata object that is generated - the parent xmp node - the currently processed XML node - Flag if the node is a top-level node - thown on parsing errors - - - - 7.2.19 parseTypeCollectionPropertyElt - start-element ( URI == propertyElementURIs, - attributes == set ( idAttr?, parseCollection ) ) - nodeElementList - end-element() - - thown on parsing errors - - - - 7.2.20 parseTypeOtherPropertyElt - start-element ( URI == propertyElementURIs, attributes == set ( idAttr?, parseOther ) ) - propertyEltList - end-element() - - thown on parsing errors - - - - - Adds a child node. - - the xmp metadata object that is generated - the parent xmp node - the currently processed XML node - Node value - Flag if the node is a top-level node - Returns the newly created child node. - thown on parsing errors - - - - Adds a qualifier node. - - the parent xmp node - the name of the qualifier which has to be - QName including the default prefix - the value of the qualifier - Returns the newly created child node. - thown on parsing errors - - - - The parent is an RDF pseudo-struct containing an rdf:value field. Fix the - XMP data model. The rdf:value node must be the first child, the other - children are qualifiers. The form, value, and children of the rdf:value - node are the real ones. The rdf:value node's qualifiers must be added to - the others. - - the parent xmp node - thown on parsing errors - - - - Checks if the node is a white space. - an XML-node - Returns whether the node is a whitespace node, - i.e. a text node that contains only whitespaces. - - - - 7.2.6 propertyElementURIs - anyURI - ( coreSyntaxTerms | rdf:Description | oldTerms ) - - the term id - Return true if the term is a property element name. - - - - - - Determines the ID for a certain RDF Term. - Arranged to hopefully minimize the parse time for large XMP. - - an XML node - Returns the term ID. - - - - A character-stream reader that allows characters to be pushed back into the - stream. - - @author Mark Reinhold - @since JDK1.1 - - - - - Pushback buffer - - - - Current position in buffer - - - - - Creates a new pushback reader with a one-character pushback buffer. - - The reader from which characters will be read - - - - Checks to make sure that the stream has not been closed. - - - - Reads a single character. - - The character read, or -1 if the end of the stream has been - reached - - If an I/O error occurs - - - - Reads characters into a portion of an array. - - Destination buffer - Offset at which to start writing characters - Maximum number of characters to read - - The number of characters read, or -1 if the end of the - stream has been reached - - If an I/O error occurs - - - - Pushes back a single character by copying it to the front of the - pushback buffer. After this method returns, the next character to be read - will have the value (char)c. - - The int value representing a character to be pushed back - - If the pushback buffer is full, - or if some other I/O error occurs - - - - Pushes back a portion of an array of characters by copying it to the - front of the pushback buffer. After this method returns, the next - character to be read will have the value cbuf[off], the - character after that will have the value cbuf[off+1], and - so forth. - - Character array - Offset of first character to push back - Number of characters to push back - - If there is insufficient room in the pushback - buffer, or if some other I/O error occurs - - - - Pushes back an array of characters by copying it to the front of the - pushback buffer. After this method returns, the next character to be - read will have the value cbuf[0], the character after that - will have the value cbuf[1], and so forth. - - Character array to push back - - If there is insufficient room in the pushback - buffer, or if some other I/O error occurs - - - - Closes the stream and releases any system resources associated with - it. Once the stream has been closed, further read(), - unread(), ready(), or skip() invocations will throw an IOException. - Closing a previously closed stream has no effect. - - If an I/O error occurs - - - - @since 09.11.2006 - - - - - XML localname - - - - XML namespace prefix - - - - Splits a qname into prefix and localname. - a QName - - - - Constructor that initializes the fields - the prefix - the name - - - the localName - - - the prefix - - - Returns whether the QName has a prefix. - - - - Utility functions for the XMPToolkit implementation. - - @since 06.06.2006 - - - - - segments of a UUID - - - - length of a UUID - - - - - - init char tables - - - - Private constructor - - - - - - - - a schema namespace - - an XMP Property - Returns true if the property is defined as "Internal - Property", see XMP Specification. - - - - Check some requirements for an UUID: -
      -
    • Length of the UUID is 32
    • -
    • The Delimiter count is 4 and all the 4 delimiter are on their right - position (8,13,18,23)
    • -
    - -
    - uuid to test - true - this is a well formed UUID, false - UUID has not the expected format -
    - - - - Checks if the value is a legal "unqualified" XML name, as - defined in the XML Namespaces proposed recommendation. - These are XML names, except that they must not contain a colon. - the value to check - Returns true if the name is a valid "unqualified" XML name. - - - a char - Returns true if the char is an ASCII control char. - - - - - Replaces the ASCII control chars with a space. - - - a node value - Returns the cleaned up value - - - - Simple check if a character is a valid XML start name char. - All characters according to the XML Spec 1.1 are accepted: - http://www.w3.org/TR/xml11/#NT-NameStartChar - - a character - Returns true if the character is a valid first char of an XML name. - - - - Simple check if a character is a valid XML name char - (every char except the first one), according to the XML Spec 1.1: - http://www.w3.org/TR/xml11/#NT-NameChar - - a character - Returns true if the character is a valid char of an XML name. - - - - Initializes the char tables for the chars 0x00-0xFF for later use, - according to the XML 1.1 specification - http://www.w3.org/TR/xml11 - - - - - The implementation of XMPDateTime. Internally a calendar is used - plus an additional nano seconds field, because Calendar supports only milli - seconds. The nanoSeconds convers only the resolution beyond a milli second. - - @since 16.02.2006 - - - - - The nano seconds take micro and nano seconds, while the milli seconds are in the calendar. - - - - - Use NO time zone as default - - - - Creates an XMPDateTime-instance with the current time in the default time - zone. - - - - - Creates an XMPDateTime-instance from a calendar. - - a Calendar - - - - Creates an XMPDateTime-instance from - a Date and a TimeZone. - - a date describing an absolute point in time - a TimeZone how to interpret the date - - - - Creates an XMPDateTime-instance from an ISO 8601 string. - - an ISO 8601 string - If the string is a non-conform ISO 8601 string, an exception is thrown - - - - - - - - - - - - - - - - - Returns the ISO string representation. - - - - The XMPIterator implementation. - Iterates the XMP Tree according to a set of options. - During the iteration the XMPMeta-object must not be changed. - Calls to skipSubtree() / skipSiblings() will affect the iteration. - - @since 29.06.2006 - - - - - the node iterator doing the work - - - - stores the iterator options - - - - the base namespace of the property path, will be changed during the iteration - - - - flag to indicate that skipSiblings() has been called. - - - - flag to indicate that skipSiblings() has been called. - - - - Constructor with optionsl initial values. If propName is provided, - schemaNs has also be provided. - the iterated metadata object. - the iteration is reduced to this schema (optional) - the iteration is redurce to this property within the schemaNs - advanced iteration options, see - If the node defined by the paramters is not existing. - - - Exposes the options for inner class. - - - Exposes the options for inner class. - - - - - - - - The XMPIterator implementation. - It first returns the node itself, then recursivly the children and qualifier of the node. - - @since 29.06.2006 - - - - - iteration state - - - - iteration state - - - - iteration state - - - - the recursively accumulated path - - - - the currently visited node - - - - the iterator that goes through the children and qualifier list - - - - index of node with parent, only interesting for arrays - - - - the cached PropertyInfo to return - - - - the state of the iteration - - - - the iterator for each child - - - - Constructor for the node iterator. - the currently visited node - the accumulated path of the node - the index within the parent node (only for arrays) - - - the childrenIterator - - - Returns the returnProperty. - - - - - Sets the returnProperty as next item or recurses into hasNext(). - Returns if there is a next item to return. - - - - Handles the iteration of the children or qualfier - an iterator - Returns if there are more elements available. - - - the node that will be added to the path. - the path up to this node. - the current array index if an arrey is traversed - Returns the updated path. - - - - Creates a property info object from an XMPNode. - an XMPNode - the base namespace to report - the full property path - Returns a XMPProperty-object that serves representation of the node. - - - - This iterator is derived from the default NodeIterator, - and is only used for the option . - - @since 02.10.2006 - - - - - Constructor - the node which children shall be iterated. - the full path of the former node without the leaf node. - - - - - Implementation for . - - @since 17.02.2006 - - - - - Property values are Strings by default - - - - root of the metadata tree - - - - the xpacket processing instructions content - - - - Constructor for an empty metadata object. - - - - - Constructor for a cloned metadata tree. - - - an prefilled metadata tree which fulfills all - XMPNode contracts. - - - Returns the root node of the XMP tree. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Locate or create the item node and set the value. Note the index - parameter is one-based! The index can be in the range [1..size + 1] or - "last()", normalize it and check the insert flags. The order of the - normalization checks is important. If the array is empty we end up with - an index and location to set item size + 1. - - an array node - the index where to insert the item - the item value - the options for the new item - insert oder overwrite at index position? - - - - - The internals for SetProperty() and related calls, used after the node is - found or created. - - - the newly created node - - the node value, can be null - - options for the new node, must not be null. - flag if the existing value is to be overwritten - thrown if options and value do not correspond - - - - Evaluates a raw node value to the given value type, apply special - conversions for defined types in XMP. - - - an int indicating the value type - - the node containing the value - Returns a literal value for the node. - - - - - This class replaces the ExpatAdapter.cpp and does the - XML-parsing and fixes the prefix. After the parsing several normalisations - are applied to the XMPTree. - - @since 01.02.2006 - - - - - Hidden constructor, initialises the SAX parser handler. - - - - - Parses the input source into an XMP metadata object, including - de-aliasing and normalisation. - - the input can be an InputStream, a String or - a byte buffer containing the XMP packet. - the parse options - Returns the resulting XMP metadata object - Thrown if parsing or normalisation fails. - - - - - Parses XML from an , - fixing the encoding (Latin-1 to UTF-8) and illegal control character optionally. - - an InputStream - the parsing options - Returns an XML DOM-Document. - Thrown when the parsing fails. - - - - Parses XML from a byte buffer, - fixing the encoding (Latin-1 to UTF-8) and illegal control character optionally. - - a byte buffer containing the XMP packet - the parsing options - Returns an XML DOM-Document. - Thrown when the parsing fails. - - - - Parses XML from a , - fixing the illegal control character optionally. - - a String containing the XMP packet - the parsing options - Returns an XML DOM-Document. - Thrown when the parsing fails. - - - - - A node in the internally XMP tree, which can be a schema node, a property node, an array node, - an array item, a struct node or a qualifier node (without '?'). - - Possible improvements: - - 1. The kind Node of node might be better represented by a class-hierarchy of different nodes. - 2. The array type should be an enum - 3. isImplicitNode should be removed completely and replaced by return values of fi. - 4. hasLanguage, hasType should be automatically maintained by XMPNode - - @since 21.02.2006 - - - - - flag if the node is an alias - - - - list of child nodes, lazy initialized - - - - flag if the node has aliases - - - - flag if the node has an "rdf:value" child node. - - - - flag if the node is implicitly created - - - - name of the node, contains different information depending of the node kind - - - - options describing the kind of the node - - - - link to the parent node - - - - list of qualifier of the node, lazy initialized - - - - value of the node, contains different information depending of the node kind - - - - Creates an XMPNode with initial values. - - the name of the node - the value of the node - the options of the node - - - - Constructor for the node without value. - - the name of the node - the options of the node - - - Returns the parent node. - - - Returns the number of children without neccessarily creating a list. - - - Returns the number of qualifier without neccessarily creating a list. - - - Returns the name. - - - Returns the value. - - - Returns the options. - - - Returns the implicit flag - - - Returns if the node contains aliases (applies only to schema nodes) - - - Returns if the node contains aliases (applies only to schema nodes) - - - the hasValueChild - - - Returns whether this node is a language qualifier. - - - Returns whether this node is a type qualifier. - - - - Note: This method should always be called when accessing 'children' to be sure - that its initialized. - Returns list of children that is lazy initialized. - - - Returns a read-only copy of child nodes list. - - - Returns list of qualifier that is lazy initialized. - - - - - - Resets the node. - - - - an index [1..size] - Returns the child with the requested index. - - - - Adds a node as child to this node. - an XMPNode - - - - - Adds a node as child to this node. - the index of the node before which the new one is inserted. - Note: The node children are indexed from [1..size]! - An index of size + 1 appends a node. - an XMPNode - - - - - Replaces a node with another one. - the index of the node that will be replaced. - Note: The node children are indexed from [1..size]! - the replacement XMPNode - - - - Removes a child at the requested index. - the index to remove [1..size] - - - - Removes a child node. - If its a schema node and doesn't have any children anymore, its deleted. - - the child node to delete. - - - - Removes the children list if this node has no children anymore; - checks if the provided node is a schema node and doesn't have any children anymore, - its deleted. - - - - - Removes all children from the node. - - - - child node name to look for - Returns an XMPNode if node has been found, null otherwise. - - - an index [1..size] - Returns the qualifier with the requested index. - - - - Appends a qualifier to the qualifier list and sets respective options. - a qualifier node. - - - - - Removes one qualifier node and fixes the options. - qualifier to remove - - - - Removes all qualifiers from the node and sets the options appropriate. - - - - qualifier node name to look for - Returns a qualifier XMPNode if node has been found, - null otherwise. - - - Returns whether the node has children. - - - Returns an iterator for the children. - Note: take care to use it.remove(), as the flag are not adjusted in that case. - - - Returns whether the node has qualifier attached. - - - Returns an iterator for the qualifier. - Note: take care to use it.remove(), as the flag are not adjusted in that case. - - - - Performs a deep clone of the complete subtree (children and - qualifier )into and add it to the destination node. - - the node to add the cloned subtree - - - - Renders this node and the tree unter this node in a human readable form. - Flag is qualifier and child nodes shall be rendered too - Returns a multiline string containing the dump. - - - - - Dumps this node and its qualifier and children recursively. - Note: It creats empty options on every node. - - the buffer to append the dump. - Flag is qualifier and child nodes shall be rendered too - the current indent level. - the index within the parent node (important for arrays) - - - - Internal find. - the list to search in - the search expression - Returns the found node or nulls. - - - - Checks that a node name is not existing on the same level, except for array items. - the node name to check - Thrown if a node with the same name is existing. - - - - Checks that a qualifier name is not existing on the same level. - the new qualifier name - Thrown if a node with the same name is existing. - - - - Utilities for XMPNode. - - @since Aug 28, 2006 - - - - - Private Constructor - - - - - Find or create a schema node if createNodes is false and - - the root of the xmp tree. - a namespace - a flag indicating if the node shall be created if not found. - Note: The namespace must be registered prior to this call. - - Returns the schema node if found, null otherwise. - Note: If createNodes is true, it is always - returned a valid node. - An exception is only thrown if an error occurred, not if a - node was not found. - - - - Find or create a schema node if createNodes is true. - - the root of the xmp tree. - a namespace - If a prefix is suggested, the namespace is allowed to be registered. - a flag indicating if the node shall be created if not found. - Note: The namespace must be registered prior to this call. - - Returns the schema node if found, null otherwise. - Note: If createNodes is true, it is always - returned a valid node. - An exception is only thrown if an error occurred, not if a - node was not found. - - - - Find or create a child node under a given parent node. If the parent node is no - Returns the found or created child node. - - - the parent node - - the node name to find - - flag, if new nodes shall be created. - Returns the found or created node or null. - Thrown if - - - - Follow an expanded path expression to find or create a node. - - the node to begin the search. - the complete xpath - flag if nodes shall be created - (when called by setProperty()) - the options for the created leaf nodes (only when - createNodes == true). - Returns the node if found or created or null. - An exception is only thrown if an error occurred, - not if a node was not found. - - - - Deletes the the given node and its children from its parent. - Takes care about adjusting the flags. - the top-most node to delete. - - - - This is setting the value of a leaf node. - - an XMPNode - a value - - - - Verifies the PropertyOptions for consistancy and updates them as needed. - If options are null they are created with default values. - - the PropertyOptions - the node value to set - Returns the updated options. - If the options are not consistant. - - - - Converts the node value to String, apply special conversions for defined - types in XMP. - - - the node value to set - Returns the String representation of the node value. - - - - - Find or create a qualifier node under a given parent node. Returns a pointer to the - qualifier node, and optionally an iterator for the node's position in - the parent's vector of qualifiers. The iterator is unchanged if no qualifier node (null) - is returned. - Note: On entry, the qualName parameter must not have the leading '?' from the - XmpPath step. - - the parent XMPNode - the qualifier name - flag if nodes shall be created - Returns the qualifier node if found or created, null otherwise. - - - - an array node - the segment containing the array index - flag if new nodes are allowed to be created. - Returns the index or index = -1 if not found - Throws Exceptions - - - - Searches for a field selector in a node: - [fieldName="value] - an element in an array of structs, chosen by a field value. - No implicit nodes are created by field selectors. - - - - - Returns the index of the field if found, otherwise -1. - - - - - Searches for a qualifier selector in a node: - [?qualName="value"] - an element in an array, chosen by a qualifier value. - No implicit nodes are created for qualifier selectors, - except for an alias to an x-default item. - - an array node - the qualifier name - the qualifier value - in case the qual selector results from an alias, - an x-default node is created if there has not been one. - Returns the index of th - - - - - Make sure the x-default item is first. Touch up "single value" - arrays that have a default plus one real language. This case should have - the same value for both items. Older Adobe apps were hardwired to only - use the "x-default" item, so we copy that value to the other - item. - - - an alt text array node - - - - See if an array is an alt-text array. If so, make sure the x-default item - is first. - - - the array node to check if its an alt-text array - - - - Appends a language item to an alt text array. - - the language array - the language of the item - the content of the item - Thrown if a duplicate property is added - - - - - Looks for the appropriate language item in a text alternative array.item - - - an array node - - the requested language - Returns the index if the language has been found, -1 otherwise. - - - - - @since Aug 18, 2006 - - - - - caches the correct dc-property array forms - - - - init char tables - - - - Hidden constructor - - - - - Normalizes a raw parsed XMPMeta-Object - the raw metadata object - the parsing options - Returns the normalized metadata object - Collects all severe processing errors. - - - - Tweak old XMP: Move an instance ID from rdf:about to the - xmpMM:InstanceID property. An old instance ID usually looks - like "uuid:bac965c4-9d87-11d9-9a30-000d936b79c4", plus InDesign - 3.0 wrote them like "bac965c4-9d87-11d9-9a30-000d936b79c4". If - the name looks like a UUID simply move it to xmpMM:InstanceID, - don't worry about any existing xmpMM:InstanceID. Both will - only be present when a newer file with the xmpMM:InstanceID - property is updated by an old app that uses rdf:about. - - the root of the metadata tree - Thrown if tweaking fails. - - - - Visit all schemas to do general fixes and handle special cases. - - the metadata object implementation - Thrown if the normalisation fails. - - - - - Make sure that the array is well-formed AltText. Each item must be simple - and have an "xml:lang" qualifier. If repairs are needed, keep simple - non-empty items by adding the "xml:lang" with value "x-repair". - the property node of the array to repair. - Forwards unexpected exceptions. - - - - Visit all of the top level nodes looking for aliases. If there is - no base, transplant the alias subtree. If there is a base and strict - aliasing is on, make sure the alias and base subtrees match. - - the root of the metadata tree - th parsing options - Forwards XMP errors - - - - Moves an alias node of array form to another schema into an array - the node to be moved - the base array for the array item - Forwards XMP errors - - - - Fixes the GPS Timestamp in EXIF. - the EXIF schema node - Thrown if the date conversion fails. - - - - Remove all empty schemas from the metadata tree that were generated during the rdf parsing. - the root of the metadata tree - - - - The outermost call is special. The names almost certainly differ. The - qualifiers (and hence options) will differ for an alias to the x-default - item of a langAlt array. - - the alias node - the base node of the alias - marks the outer call of the recursion - Forwards XMP errors - - - - The initial support for WAV files mapped a legacy ID3 audio copyright - into a new xmpDM:copyright property. This is special case code to migrate - that into dc:rights['x-default']. The rules: - -
    -            1. If there is no dc:rights array, or an empty array -
    -               Create one with dc:rights['x-default'] set from double linefeed and xmpDM:copyright.
    -            
    -            2. If there is a dc:rights array but it has no x-default item -
    -               Create an x-default item as a copy of the first item then apply rule #3.
    -            
    -            3. If there is a dc:rights array with an x-default item, 
    -               Look for a double linefeed in the value.
    -                A. If no double linefeed, compare the x-default value to the xmpDM:copyright value.
    -                    A1. If they match then leave the x-default value alone.
    -                    A2. Otherwise, append a double linefeed and 
    -                        the xmpDM:copyright value to the x-default value.
    -                B. If there is a double linefeed, compare the trailing text to the xmpDM:copyright value.
    -                    B1. If they match then leave the x-default value alone.
    -                    B2. Otherwise, replace the trailing x-default text with the xmpDM:copyright value.
    -            
    -            4. In all cases, delete the xmpDM:copyright property.
    -            
    -
    - the metadata object - the "dm:copyright"-property -
    - - - Initializes the map that contains the known arrays, that are fixed by - . - - - - - The schema registry handles the namespaces, aliases and global options for the XMP Toolkit. There - is only one single instance used by the toolkit. - - @since 27.01.2006 - - - - - a map of all registered aliases. - The map is a relationship from a qname to an XMPAliasInfo-object. - - - - - a map from a namespace URI to its registered prefix - - - - a map from a prefix to the associated namespace URI - - - - The pattern that must not be contained in simple properties - - - - Performs the initialisation of the registry with the default namespaces, aliases and global - options. - - - - - - - - - - - - - - - Register the standard namespaces of schemas and types that are included in the XMP - Specification and some other Adobe private namespaces. - Note: This method is not lock because only called by the constructor. - - Forwards processing exceptions - - - - - Register the standard aliases. - Note: This method is not lock because only called by the constructor. - - If the registrations of at least one alias fails. - - - - - Serializes the XMPMeta-object to an OutputStream according to the - SerializeOptions. - - @since 11.07.2006 - - - - - Static method to Serialize the metadata object. For each serialisation, a new XMPSerializer - instance is created, either XMPSerializerRDF or XMPSerializerPlain so thats its possible to - serialialize the same XMPMeta objects in two threads. - - a metadata implementation object - the output stream to Serialize to - serialization options, can be null for default. - - - - - Serializes an XMPMeta-object as RDF into a string. - Note: Encoding is forced to UTF-16 when serializing to a - string to ensure the correctness of "exact packet size". - - a metadata implementation object - Options to control the serialization (see - ). - Returns a string containing the serialized RDF. - on serializsation errors. - - - - Serializes an XMPMeta-object as RDF into a byte buffer. - - a metadata implementation object - Options to control the serialization (see ). - Returns a byte buffer containing the serialized RDF. - on serializsation errors. - - - - Serializes the XMPMeta-object using the standard RDF serialization format. - The output is written to an OutputStream - according to the SerializeOptions. - - @since 11.07.2006 - - - - - default padding - - - - The w/r is missing inbetween - - - - a set of all rdf attribute qualifier - - - - the stored serialization options - - - - the output stream to Serialize to - - - - the padding in the XMP Packet, or the length of the complete packet in - case of option exactPacketLength. - - - - - the size of one unicode char, for UTF-8 set to 1 - (Note: only valid for ASCII chars lower than 0x80), - set to 2 in case of UTF-16 - - - - - this writer is used to do the actual serialization - - - - the metadata object to be serialized. - - - - The actual serialization. - - the metadata object to be serialized - outputStream the output stream to Serialize to - the serialization options - - If case of wrong options or any other serialization error. - - - - Calculates the padding according to the options and write it to the stream. - the length of the tail string - thrown if packet size is to small to fit the padding - forwards writer errors - - - - Checks if the supplied options are consistent. - Thrown if options are conflicting - - - - Writes the (optional) packet header and the outer rdf-tags. - Returns the packet end processing instraction to be written after the padding. - Forwarded writer exceptions. - - - - - Serializes the metadata in pretty-printed manner. - indent level - Forwarded writer exceptions - - - - - - - - Serializes the metadata in compact manner. - indent level to start with - Forwarded writer exceptions - - - - - Write each of the parent's simple unqualified properties as an attribute. Returns true if all - of the properties are written as attributes. - - the parent property node - the current indent level - Returns true if all properties can be rendered as RDF attribute. - - - - - Recursively handles the "value" for a node that must be written as an RDF - property element. It does not matter if it is a top level property, a - field of a struct, or an item of an array. The indent is that for the - property element. The patterns bwlow ignore attribute qualifiers such as - xml:lang, they don't affect the output form. - -
    - -
    -             	<ns:UnqualifiedStructProperty-1
    -             		... The fields as attributes, if all are simple and unqualified
    -             	/>
    -             
    -             	<ns:UnqualifiedStructProperty-2 rdf:parseType="Resource">
    -             		... The fields as elements, if none are simple and unqualified
    -             	</ns:UnqualifiedStructProperty-2>
    -             
    -             	<ns:UnqualifiedStructProperty-3>
    -             		<rdf:Description
    -             			... The simple and unqualified fields as attributes
    -             		>
    -             			... The compound or qualified fields as elements
    -             		</rdf:Description>
    -             	</ns:UnqualifiedStructProperty-3>
    -             
    -             	<ns:UnqualifiedArrayProperty>
    -             		<rdf:Bag> or Seq or Alt
    -             			... Array items as rdf:li elements, same forms as top level properties
    -             		</rdf:Bag>
    -             	</ns:UnqualifiedArrayProperty>
    -             
    -             	<ns:QualifiedProperty rdf:parseType="Resource">
    -             		<rdf:value> ... Property "value" 
    -             			following the unqualified forms ... </rdf:value>
    -             		... Qualifiers looking like named struct fields
    -             	</ns:QualifiedProperty>
    -            
    - -
    - - *** Consider numbered array items, but has compatibility problems. *** - Consider qualified form with rdf:Description and attributes. -
    - the parent node - the current indent level - Forwards writer exceptions - If qualifier and element fields are mixed. -
    - - - Serializes a simple property. - - an XMPNode - Returns an array containing the flags emitEndTag and indentEndTag. - Forwards the writer exceptions. - - - - Serializes an array property. - - an XMPNode - the current indent level - Forwards the writer exceptions. - If qualifier and element fields are mixed. - - - - Serializes a struct property. - - an XMPNode - the current indent level - Flag if the element has resource qualifier - Returns true if an end flag shall be emitted. - Forwards the writer exceptions. - If qualifier and element fields are mixed. - - - - Serializes the general qualifier. - the root node of the subtree - the current indent level - Forwards all writer exceptions. - If qualifier and element fields are mixed. - - - - - Writes all used namespaces of the subtree in node to the output. - The subtree is recursivly traversed. - the root node of the subtree - a set containing currently used prefixes - the current indent level - Forwards all writer exceptions. - - - - Writes one namespace declaration to the output. - a namespace prefix (without colon) or a complete qname (when namespace == null) - the a namespace - a set containing currently used prefixes - the current indent level - Forwards all writer exceptions. - - - - Start the outer rdf:Description element, including all needed xmlns attributes. - Leave the element open so that the compact form can add property attributes. - - If the writing to - - - - - Recursively handles the "value" for a node. It does not matter if it is a - top level property, a field of a struct, or an item of an array. The - indent is that for the property element. An xml:lang qualifier is written - as an attribute of the property start tag, not by itself forcing the - qualified property form. The patterns below mostly ignore attribute - qualifiers like xml:lang. Except for the one struct case, attribute - qualifiers don't affect the output form. - -
    - -
    -            	<ns:UnqualifiedSimpleProperty>value</ns:UnqualifiedSimpleProperty>
    -            
    -            	<ns:UnqualifiedStructProperty> (If no rdf:resource qualifier)
    -            		<rdf:Description>
    -            			... Fields, same forms as top level properties
    -            		</rdf:Description>
    -            	</ns:UnqualifiedStructProperty>
    -            
    -            	<ns:ResourceStructProperty rdf:resource="URI"
    -            		... Fields as attributes
    -            	>
    -            
    -            	<ns:UnqualifiedArrayProperty>
    -            		<rdf:Bag> or Seq or Alt
    -            			... Array items as rdf:li elements, same forms as top level properties
    -            		</rdf:Bag>
    -            	</ns:UnqualifiedArrayProperty>
    -            
    -            	<ns:QualifiedProperty>
    -            		<rdf:Description>
    -            			<rdf:value> ... Property "value" following the unqualified 
    -            				forms ... </rdf:value>
    -            			... Qualifiers looking like named struct fields
    -            		</rdf:Description>
    -            	</ns:QualifiedProperty>
    -            
    - -
    -
    - the property node - property shall be rendered as attribute rather than tag - use canonical form with inner description tag or - the compact form with rdf:ParseType="resource" attribute. - the current indent level - Forwards all writer exceptions. - If "rdf:resource" and general qualifiers are mixed. -
    - - - Writes the array start and end tags. - - an array node - flag if its the start or end tag - the current indent level - forwards writer exceptions - - - - Serializes the node value in XML encoding. Its used for tag bodies and - attributes. Note: The attribute is always limited by quotes, - thats why &apos; is never serialized. Note: - Control chars are written unescaped, but if the user uses others than tab, LF - and CR the resulting XML will become invalid. - - the value of the node - flag if value is an attribute value - - - - - - Writes indents and automatically includes the baseindend from the options. - number of indents to write - forwards exception - - - - Writes a char to the output. - a char - forwards writer exceptions - - - - Writes a String to the output. - a String - forwards writer exceptions - - - - Writes an amount of chars, mostly spaces - number of chars - a char - - - - - Writes a newline according to the options. - Forwards exception - - - - @since 11.08.2006 - - - - - - - - - - Private constructor, as - - - - - - see {@link XMPUtils#separateArrayItems(XMPMeta, String, String, String, - PropertyOptions, boolean)} - - - The XMP object containing the array to be updated. - - The schema namespace URI for the array. Must not be null or - the empty string. - - The name of the array. May be a general path expression, must - not be null or the empty string. Each item in the array must - be a simple string value. - - The string to be separated into the array items. - - Option flags to control the separation. - - Flag if commas shall be preserved - - - Forwards the Exceptions from the metadata processing - - - - Utility to find or create the array used by separateArrayItems(). - a the namespace fo the array - the name of the array - the options for the array if newly created - the xmp object - Returns the array node. - Forwards exceptions - - - - - - Remove all schema children according to the flag - doAllProperties. Empty schemas are automatically remove - by XMPNode - - - a schema node - - flag if all properties or only externals shall be removed. - Returns true if the schema is empty after the operation. - - - - - Compares two nodes including its children and qualifier. - an XMPNode - an XMPNode - Returns true if the nodes are equal, false otherwise. - Forwards exceptions to the calling method. - - - - Make sure the separator is OK. It must be one semicolon surrounded by - zero or more spaces. Any of the recognized semicolons or spaces are - allowed. - - - - - - - Make sure the open and close quotes are a legitimate pair and return the - correct closing quote or an exception. - - - opened and closing quote in a string - - the open quote - Returns a corresponding closing quote. - - - - - Classifies the character into normal chars, spaces, semicola, quotes, - control chars. - - - a char - Return the character kind. - - - - the open quote char - Returns the matching closing quote for an open quote. - - - - Add quotes to the item. - - - the array item - - the open quote character - - the closing quote character - - flag if commas are allowed - Returns the value in quotes. - - - a character - the opening quote char - the closing quote char - Return it the character is a surrounding quote. - - - a character - the opening quote char - the closing quote char - Returns true if the character is a closing quote. - - - - Representates an XMP XmpPath with segment accessor methods. - - @since 28.02.2006 - - - - - Marks a struct field step , also for top level nodes (schema "fields"). - - - - Marks a qualifier step. - Note: Order is significant to separate struct/qual from array kinds! - - - - - Marks an array index step - - - - stores the segments of an XmpPath - - - - Append a path segment - - the segment to add - - - the index of the segment to return - Returns a path segment. - - - Returns the size of the xmp path. - - - - Parser for XMP XPaths. - - @since 01.03.2006 - - - Private constructor - - - - @param path - @param pos - @throws XmpException - - - Parses a struct segment - @param pos the current position in the path - @return Retusn the segment or an errror - @throws XmpException If the sement is empty - - - Parses an array index segment. - - @param pos the xmp path - @return Returns the segment or an error - @throws XmpException thrown on xmp path errors - - - - Parses the root node of an XMP Path, checks if namespace and prefix fit together - and resolve the property to the base property if it is an alias. - @param schemaNs the root namespace - @param pos the parsing position helper - @param expandedXPath the path to contribute to - @throws XmpException If the path is not valid. - - - Verifies whether the qualifier name is not XML conformant or the - namespace prefix has not been registered. - - @param qualName - a qualifier name - @throws XmpException - If the name is not conformant - - - Verify if an XML name is conformant. - - @param name - an XML name - @throws XmpException - When the name is not XML conformant - - - - This objects contains all needed char positions to parse. - - - the complete path - the end of a segment name - - - the begin of a step - - - the end of a step - - - - A segment of a parsed XmpPath. - - @since 23.06.2006 - - - - - flag if segment is an alias - - - - alias form if applicable - - - - kind of the path segment - - - - name of the path segment - - - - Constructor with initial values. - - the name of the segment - - - - Constructor with initial values. - - the name of the segment - the kind of the segment - - - Returns the kind. - - - Returns the name. - - - the flag to set - - - Returns the aliasForm if this segment has been created by an alias. - - - - - Returns the year, can be negative. - - - Returns The month in the range 1..12. - - - Returns the day of the month in the range 1..31. - - - Returns hour - The hour in the range 0..23. - - - Returns the minute in the range 0..59. - - - Returns the second in the range 0..59. - - - Returns milli-, micro- and nano seconds. - Nanoseconds within a second, often left as zero? - - - Returns the time zone. - - - - Returns the ISO 8601 string representation of the date and time. - - - - This flag is set either by parsing or by setting year, month or day. - Returns true if the XMPDateTime object has a date portion. - - - - This flag is set either by parsing or by setting hours, minutes, seconds or milliseconds. - Returns true if the XMPDateTime object has a time portion. - - - - This flag is set either by parsing or by setting hours, minutes, seconds or milliseconds. - Returns true if the XMPDateTime object has a defined timezone. - - - - - Skip the subtree below the current node when next() is - called. - - - - - Skip the subtree below and remaining siblings of the current node when - next() is called. - - - - - This class represents the set of XMP metadata as a DOM representation. It has methods to read and - modify all kinds of properties, create an iterator over all properties and Serialize the metadata - to a String, byte-array or OutputStream. - - @since 20.01.2006 - - - - - This correlates to the about-attribute, - returns the empty String if no name is set. - - Returns the name of the XMP object. - - - Returns the unparsed content of the <?xpacket> processing instruction. - This contains normally the attribute-like elements 'begin="<BOM>" - id="W5M0MpCehiHzreSzNTczkc9d"' and possibly the deprecated elements 'bytes="1234"' or - 'encoding="XXX"'. If the parsed packet has not been wrapped into an xpacket, - null is returned. - - - - - Provides access to items within an array. The index is passed as an integer, you need not - worry about the path string syntax for array items, convert a loop index to a string, etc. - - The namespace URI for the array. Has the same usage as in GetProperty. - The name of the array. May be a general path expression, must not be - null or the empty string. Has the same namespace prefix usage as - propName in GetProperty(). - The index of the desired item. Arrays in XMP are indexed from 1. The - constant always refers to the last existing array - item. - Returns a XMPProperty containing the value and the options or - null if the property does not exist. - Wraps all errors and exceptions that may occur. - - - - Returns the number of items in the array. - - The namespace URI for the array. Has the same usage as in GetProperty. - The name of the array. May be a general path expression, must not be - null or the empty string. Has the same namespace prefix usage as - propName in GetProperty(). - Returns the number of items in the array. - Wraps all errors and exceptions that may occur. - - - - - - - - Replaces an item within an array. The index is passed as an integer, you need not worry about - the path string syntax for array items, convert a loop index to a string, etc. The array - passed must already exist. In normal usage the selected array item is modified. A new item is - automatically appended if the index is the array size plus 1. - - The namespace URI for the array. Has the same usage as in GetProperty. - The name of the array. May be a general path expression, must not be - null or the empty string. Has the same namespace prefix usage as - propName in GetProperty. - The index of the desired item. Arrays in XMP are indexed from 1. To address - the last existing item, use to find - out the length of the array. - the new value of the array item. Has the same usage as propValue in - SetProperty(). - the set options for the item. - Wraps all errors and exceptions that may occur. - - - - - Inserts an item into an array previous to the given index. The index is passed as an integer, - you need not worry about the path string syntax for array items, convert a loop index to a - string, etc. The array passed must already exist. In normal usage the selected array item is - modified. A new item is automatically appended if the index is the array size plus 1. - - The namespace URI for the array. Has the same usage as in GetProperty. - The name of the array. May be a general path expression, must not be - null or the empty string. Has the same namespace prefix usage as - propName in GetProperty. - The index to insert the new item. Arrays in XMP are indexed from 1. Use - XmpConst.ARRAY_LAST_ITEM to append items. - the new value of the array item. Has the same usage as - propValue in SetProperty(). - the set options that decide about the kind of the node. - Wraps all errors and exceptions that may occur. - - - - - - - Provides access to fields within a nested structure. The namespace for the field is passed as - a URI, you need not worry about the path string syntax. The names of fields should be XML - qualified names, that is within an XML namespace. The path syntax for a qualified name uses - the namespace prefix, which is unreliable because the prefix is never guaranteed. The URI is - the formal name, the prefix is just a local shorthand in a given sequence of XML text. - - The namespace URI for the struct. Has the same usage as in GetProperty. - The name of the struct. May be a general path expression, must not be null - or the empty string. Has the same namespace prefix usage as propName in GetProperty. - The namespace URI for the field. Has the same URI and prefix usage as the - schemaNs parameter. - The name of the field. Must be a single XML name, must not be null or the - empty string. Has the same namespace prefix usage as the structName parameter. - the value of thefield, if the field has a value. - Has the same usage as propValue in GetProperty. - Option flags describing the field. See the earlier description. - Wraps all errors and exceptions that may occur. - - - - - Provides access to a qualifier attached to a property. The namespace for the qualifier is - passed as a URI, you need not worry about the path string syntax. In many regards qualifiers - are like struct fields. See the introductory discussion of qualified properties for more - information. The names of qualifiers should be XML qualified names, that is within an XML - namespace. The path syntax for a qualified name uses the namespace prefix, which is - unreliable because the prefix is never guaranteed. The URI is the formal name, the prefix is - just a local shorthand in a given sequence of XML text. The property the qualifier - will be attached has to exist. - - The namespace URI for the struct. Has the same usage as in GetProperty. - The name of the property to which the qualifier is attached. Has the same - usage as in GetProperty. - The namespace URI for the qualifier. Has the same URI and prefix usage as the - schemaNs parameter. - The name of the qualifier. Must be a single XML name, must not be - null or the empty string. Has the same namespace prefix usage as the - propName parameter. - A pointer to the null terminated UTF-8 string that is the - value of the qualifier, if the qualifier has a value. Has the same usage as propValue - in GetProperty. - Option flags describing the qualifier. See the earlier description. - Wraps all errors and exceptions that may occur. - - - - - Deletes the given XMP subtree rooted at the given property. It is not an error if the - property does not exist. - - The namespace URI for the property. Has the same usage as in - GetProperty(). - The name of the property. Has the same usage as in GetProperty. - - - - Deletes the given XMP subtree rooted at the given array item. It is not an error if the array - item does not exist. - - The namespace URI for the array. Has the same usage as in GetProperty. - The name of the array. May be a general path expression, must not be - null or the empty string. Has the same namespace prefix usage as - propName in GetProperty(). - The index of the desired item. Arrays in XMP are indexed from 1. The - constant XmpConst.ARRAY_LAST_ITEM always refers to the last - existing array item. - - - - Deletes the given XMP subtree rooted at the given struct field. It is not an error if the - field does not exist. - - The namespace URI for the struct. Has the same usage as in - GetProperty(). - The name of the struct. May be a general path expression, must not be - null or the empty string. Has the same namespace prefix usage as - propName in GetProperty. - The namespace URI for the field. Has the same URI and prefix usage as the - schemaNs parameter. - The name of the field. Must be a single XML name, must not be - null or the empty string. Has the same namespace prefix usage as the - structName parameter. - - - - Deletes the given XMP subtree rooted at the given qualifier. It is not an error if the - qualifier does not exist. - - The namespace URI for the struct. Has the same usage as in - GetProperty(). - The name of the property to which the qualifier is attached. Has the same - usage as in GetProperty. - The namespace URI for the qualifier. Has the same URI and prefix usage as the - schemaNs parameter. - The name of the qualifier. Must be a single XML name, must not be - null or the empty string. Has the same namespace prefix usage as the - propName parameter. - - - - Returns whether the property exists. - - The namespace URI for the property. Has the same usage as in - GetProperty(). - The name of the property. - Has the same usage as in GetProperty(). - Returns true if the property exists. - - - - Tells if the array item exists. - - The namespace URI for the array. Has the same usage as in - GetProperty(). - The name of the array. May be a general path expression, must not be - null or the empty string. Has the same namespace prefix usage as - propName in GetProperty(). - The index of the desired item. Arrays in XMP are indexed from 1. The - constant XmpConst.ARRAY_LAST_ITEM always refers to the last - existing array item. - Returns true if the array exists, false otherwise. - - - - DoesStructFieldExist tells if the struct field exists. - - The namespace URI for the struct. Has the same usage as in - GetProperty(). - The name of the struct. May be a general path expression, must not be - null or the empty string. Has the same namespace prefix usage as - propName in GetProperty(). - The namespace URI for the field. Has the same URI and prefix usage as the - schemaNs parameter. - The name of the field. Must be a single XML name, must not be - null or the empty string. Has the same namespace prefix usage as the - structName parameter. - Returns true if the field exists. - - - - DoesQualifierExist tells if the qualifier exists. - - The namespace URI for the struct. Has the same usage as in - GetProperty(). - The name of the property to which the qualifier is attached. Has the same - usage as in GetProperty(). - The namespace URI for the qualifier. Has the same URI and prefix usage as the - schemaNs parameter. - The name of the qualifier. Must be a single XML name, must not be - null or the empty string. Has the same namespace prefix usage as the - propName parameter. - Returns true if the qualifier exists. - - - - - Modifies the value of a selected item in an alt-text array. Creates an appropriate array item - if necessary, and handles special cases for the x-default item. If the selected item is from - a match with the specific language, the value of that item is modified. If the existing value - of that item matches the existing value of the x-default item, the x-default item is also - modified. If the array only has 1 existing item (which is not x-default), an x-default item - is added with the given value. If the selected item is from a match with the generic language - and there are no other generic matches, the value of that item is modified. If the existing - value of that item matches the existing value of the x-default item, the x-default item is - also modified. If the array only has 1 existing item (which is not x-default), an x-default - item is added with the given value. If the selected item is from a partial match with the - generic language and there are other partial matches, a new item is created for the specific - language. The x-default item is not modified. If the selected item is from the last 2 rules - then a new item is created for the specific language. If the array only had an x-default - item, the x-default item is also modified. If the array was empty, items are created for the - specific language and x-default. - - Note: In a future version of this API a method - using Java java.lang.Locale will be added. - - - The namespace URI for the alt-text array. Has the same usage as in - GetProperty(). - The name of the alt-text array. May be a general path expression, must not - be null or the empty string. Has the same namespace prefix usage as - propName in GetProperty(). - The name of the generic language as an RFC 3066 primary subtag. May be - null or the empty string if no generic language is wanted. - The name of the specific language as an RFC 3066 tag. Must not be - null or the empty string. - A pointer to the null terminated UTF-8 string that is the new - value for the appropriate array item. - Option flags, none are defined at present. - Wraps all errors and exceptions that may occur. - - - - - These are very similar to GetProperty() and SetProperty() above, - but the value is returned or provided in a literal form instead of as a UTF-8 string. - The path composition functions in XMPPathFactory may be used to compose an path - expression for fields in nested structures, items in arrays, or qualifiers. - - The namespace URI for the property. Has the same usage as in - GetProperty(). - The name of the property. - Has the same usage as in GetProperty(). - Returns a Boolean value or null - if the property does not exist. - Wraps all exceptions that may occur, - especially conversion errors. - - - - Convenience method to retrieve the literal value of a property. - - The namespace URI for the property. Has the same usage as in - GetProperty(). - The name of the property. - Has the same usage as in GetProperty(). - Returns an Integer value or null - if the property does not exist. - Wraps all exceptions that may occur, - especially conversion errors. - - - - Convenience method to retrieve the literal value of a property. - - The namespace URI for the property. Has the same usage as in - GetProperty(). - The name of the property. - Has the same usage as in GetProperty(). - Returns a Long value or null - if the property does not exist. - Wraps all exceptions that may occur, - especially conversion errors. - - - - Convenience method to retrieve the literal value of a property. - - The namespace URI for the property. Has the same usage as in - GetProperty(). - The name of the property. - Has the same usage as in GetProperty(). - Returns a Double value or null - if the property does not exist. - Wraps all exceptions that may occur, - especially conversion errors. - - - - Convenience method to retrieve the literal value of a property. - - The namespace URI for the property. Has the same usage as in - GetProperty(). - The name of the property. - Has the same usage as in GetProperty(). - Returns a XMPDateTime-object or null - if the property does not exist. - Wraps all exceptions that may occur, - especially conversion errors. - - - - Convenience method to retrieve the literal value of a property. - - The namespace URI for the property. Has the same usage as in - GetProperty(). - The name of the property. - Has the same usage as in GetProperty(). - Returns a Java Calendar-object or null - if the property does not exist. - Wraps all exceptions that may occur, - especially conversion errors. - - - - Convenience method to retrieve the literal value of a property. - - The namespace URI for the property. Has the same usage as in - GetProperty(). - The name of the property. - Has the same usage as in GetProperty(). - Returns a byte[]-array contained the decoded base64 value - or null if the property does not exist. - Wraps all exceptions that may occur, - especially conversion errors. - - - - Convenience method to retrieve the literal value of a property. - Note: There is no SetPropertyString(), - because SetProperty() sets a string value. - - The namespace URI for the property. Has the same usage as in - GetProperty(). - The name of the property. - Has the same usage as in GetProperty(). - Returns a String value or null - if the property does not exist. - Wraps all exceptions that may occur, - especially conversion errors. - - - - Convenience method to set a property to a literal boolean value. - - The namespace URI for the property. Has the same usage as in - SetProperty(). - The name of the property. - Has the same usage as in GetProperty(). - the literal property value as boolean. - options of the property to set (optional). - Wraps all exceptions that may occur. - - - - - Convenience method to set a property to a literal int value. - - The namespace URI for the property. Has the same usage as in - SetProperty(). - The name of the property. - Has the same usage as in GetProperty(). - the literal property value as int. - options of the property to set (optional). - Wraps all exceptions that may occur. - - - - - Convenience method to set a property to a literal long value. - - The namespace URI for the property. Has the same usage as in - SetProperty(). - The name of the property. - Has the same usage as in GetProperty(). - the literal property value as long. - options of the property to set (optional). - Wraps all exceptions that may occur. - - - - - Convenience method to set a property to a literal double value. - - The namespace URI for the property. Has the same usage as in - SetProperty(). - The name of the property. - Has the same usage as in GetProperty(). - the literal property value as double. - options of the property to set (optional). - Wraps all exceptions that may occur. - - - - - Convenience method to set a property with an XMPDateTime-object, - which is serialized to an ISO8601 date. - - The namespace URI for the property. Has the same usage as in - SetProperty(). - The name of the property. - Has the same usage as in GetProperty(). - the property value as XMPDateTime. - options of the property to set (optional). - Wraps all exceptions that may occur. - - - - - Convenience method to set a property with a Java Calendar-object, - which is serialized to an ISO8601 date. - - The namespace URI for the property. Has the same usage as in - SetProperty(). - The name of the property. - Has the same usage as in GetProperty(). - the property value as Java Calendar. - options of the property to set (optional). - Wraps all exceptions that may occur. - - - - - Convenience method to set a property from a binary byte[]-array, - which is serialized as base64-string. - - The namespace URI for the property. Has the same usage as in - SetProperty(). - The name of the property. - Has the same usage as in GetProperty(). - the literal property value as byte array. - options of the property to set (optional). - Wraps all exceptions that may occur. - - - - - - - Construct an iterator for the properties within an XMP object. According to the parameters it iterates the entire data tree, - properties within a specific schema, or a subtree rooted at a specific node. - - Optional schema namespace URI to restrict the iteration. Omitted (visit all - schema) by passing null or empty String. - Optional property name to restrict the iteration. May be an arbitrary path - expression. Omitted (visit all properties) by passing null or empty - String. If no schema URI is given, it is ignored. - Option flags to control the iteration. See for - details. - Returns an XMPIterator for this XMPMeta-object - considering the given options. - Wraps all errors and exceptions that may occur. - - - - - Perform the normalization as a separate parsing step. - Normally it is done during parsing, unless the parsing option - is set to true. - Note: It does no harm to call this method to an already normalized xmp object. - It was a PDF/A requirement to get hand on the unnormalized XMPMeta object. - - optional parsing options. - Wraps all errors and exceptions that may occur. - - - - Renders this node and the tree unter this node in a human readable form. - Returns a multiline string containing the dump. - - - - - - - Returns the registered prefix/namespace-pairs as map, where the keys are the - namespaces and the values are the prefixes. - - - Returns the registered namespace/prefix-pairs as map, where the keys are the - prefixes and the values are the namespaces. - - - - - Determines if a name is an alias, and what it is aliased to. - - - The namespace URI of the alias. Must not be null or the empty - string. - - The name of the alias. May be an arbitrary path expression - path, must not be null or the empty string. - Returns the XMPAliasInfo for the given alias namespace and property or - null if there is no such alias. - - - - Collects all aliases that are contained in the provided namespace. - If nothing is found, an empty array is returned. - - a schema namespace URI - Returns all alias infos from aliases that are contained in the provided namespace. - - - - Searches for registered aliases. - - - an XML conform qname - Returns if an alias definition for the given qname to another - schema and property is registered. - - - Returns the registered aliases as map, where the key is the "qname" (prefix and name) - and the value an XMPAliasInfo-object. - - - - Returns the primary release number, the "1" in version "1.2.3". - - - Returns the secondary release number, the "2" in version "1.2.3". - - - Returns the tertiary release number, the "3" in version "1.2.3". - - - Returns a rolling build number, monotonically increasing in a release. - - - Returns true if this is a debug build. - - - Returns a comprehensive version information string. - - - - Options for XMPSchemaRegistryImpl#registerAlias. - - @since 20.02.2006 - - - - - This is a direct mapping. The actual data type does not matter. - - - - The actual is an unordered array, the alias is to the first element of the array. - - - - The actual is an ordered array, the alias is to the first element of the array. - - - - The actual is an alternate array, the alias is to the first element of the array. - - - - The actual is an alternate text array, the alias is to the 'x-default' element of the array. - - - - - the options to init with - If options are not consistant - - - Returns if the alias is of the simple form. - - - Returns the option. - - - Returns the option. - - - Returns the option. - - - Returns the option. - - - - returns a s object - If the options are not consistant. - - - - - Options for XMPIterator construction. - - @since 24.01.2006 - - - - - Just do the immediate children of the root, default is subtree. - - - - Just do the leaf nodes, default is all nodes in the subtree. - Bugfix #2658965: If this option is set the Iterator returns the namespace - of the leaf instead of the namespace of the base property. - - - - - Return just the leaf part of the path, default is the full path. - - - - Omit all qualifiers. - - - Returns whether the option is set. - - - Returns whether the option is set. - - - Returns whether the option is set. - - - Returns whether the option is set. - - - - - - Options for . - - @since 24.01.2006 - - - - - Require a surrounding "x:xmpmeta" element in the xml-document. - - - - Do not reconcile alias differences, throw an exception instead. - - - - Convert ASCII control characters 0x01 - 0x1F (except tab, cr, and lf) to spaces. - - - - If the input is not unicode, try to parse it as ISO-8859-1. - - - - Do not carry run the XMPNormalizer on a packet, leave it as it is. - - - - Sets the options to the default values. - - - - Returns the requireXMPMeta. - - - Returns the strictAliasing. - - - Returns the strictAliasing. - - - Returns the strictAliasing. - - - Returns the option "omit normalization". - - - - - - The property flags are used when properties are fetched from the XMPMeta-object - and provide more detailed information about the property. - - @since 03.07.2006 - - - - - may be used in the future - - - - Updated by iText. Indicates if the property should be writted as a separate node - - - - - Default constructor - - - - - Intialization constructor - - the initialization options - If the options are not valid - - - Return whether the property value is a URI. It is serialized to RDF using the - rdf:resource attribute. Not mandatory for URIs, but considered RDF-savvy. - - - Return whether the property has qualifiers. These could be an xml:lang - attribute, an rdf:type property, or a general qualifier. See the - introductory discussion of qualified properties for more information. - - - Return whether this property is a qualifier for some other property. Note that if the - qualifier itself has a structured value, this flag is only set for the top node of - the qualifier's subtree. Qualifiers may have arbitrary structure, and may even have - qualifiers. - - - Return whether this property has an xml:lang qualifier. - - - Return whether this property has an rdf:type qualifier. - - - Return whether this property contains nested fields. - - - Return whether this property is an array. By itself this indicates a general - unordered array. It is serialized using an rdf:Bag container. - - - Return whether this property is an ordered array. Appears in conjunction with - getPropValueIsArray(). It is serialized using an rdf:Seq container. - - - Return whether this property is an alternative array. Appears in conjunction with - getPropValueIsArray(). It is serialized using an rdf:Alt container. - - - Return whether this property is an alt-text array. Appears in conjunction with - getPropArrayIsAlternate(). It is serialized using an rdf:Alt container. - Each array element is a simple property with an xml:lang attribute. - - - the value to set - Returns this to enable cascaded options. - Returns whether the SCHEMA_NODE option is set. - - - Returns whether the property is of composite type - an array or a struct. - - - Returns whether the property is of composite type - an array or a struct. - - - Returns true if only array options are set. - - - - - Compares two options set for array compatibility. - - other options - Returns true if the array options of the sets are equal. - - - - Merges the set options of a another options object with this. - If the other options set is null, this objects stays the same. - other options - If illegal options are provided - - - - - Checks that a node not a struct and array at the same time; - and URI cannot be a struct. - - the bitmask to check. - Thrown if the options are not consistent. - - - - Options for . - - @since 24.01.2006 - - - - - Omit the XML packet wrapper. - - - - Mark packet as read-only. Default is a writeable packet. - - - - Use a compact form of RDF. - The compact form is the default serialization format (this flag is technically ignored). - To Serialize to the canonical form, set the flag USE_CANONICAL_FORMAT. - If both flags "compact" and "canonical" are set, canonical is used. - - - - - Use the canonical form of RDF if set. By default the compact form is used - - - - Include a padding allowance for a thumbnail image. If no xmp:Thumbnails property - is present, the typical space for a JPEG thumbnail is used. - - - - - The padding parameter provides the overall packet length. The actual amount of padding is - computed. An exception is thrown if the packet exceeds this length with no padding. - - - - - - Sort the struct properties and qualifier before serializing - - - - Bit indicating little endian encoding, unset is big endian - - - - Bit indication UTF16 encoding. - - - - UTF8 encoding; this is the default - - - - UTF16BE encoding - - - - UTF16LE encoding - - - - The number of levels of indentation to be used for the outermost XML element in the - serialized RDF. This is convenient when embedding the RDF in other text, defaults to 0. - - - - - The string to be used for each level of indentation in the serialized - RDF. If empty it defaults to two ASCII spaces, U+0020. - - - - - The string to be used as a line terminator. If empty it defaults to; linefeed, U+000A, the - standard XML newline. - - - - - Omits the Toolkit version attribute, not published, only used for Unit tests. - - - - The amount of padding to be added if a writeable XML packet is created. If zero is passed - (the default) an appropriate amount of padding is computed. - - - - - Default constructor. - - - - - Constructor using inital options - the inital options - Thrown if options are not consistant. - - - Returns the option. - - - Returns the option. - - - Returns the option. - - - Returns the option. - - - Returns the option. - - - Returns the option. - - - Returns the option. - - - Returns the option. - - - Returns the option. - - - Returns the option. - - - Returns the baseIndent. - - - Returns the indent. - - - Returns the newline. - - - Returns the padding. - - - Returns whether the Toolkit version attribute shall be omitted. - Note: This options can only be set by unit tests. - - - Returns the encoding as Java encoding String. - - - - - Returns clone of this SerializeOptions-object with the same options set. - - - - - The base class for a collection of 32 flag bits. Individual flags are defined as enum value bit - masks. Inheriting classes add convenience accessor methods. - - @since 24.01.2006 - - - - - a map containing the bit names - - - - the internal int containing all options - - - - The default constructor. - - - - - Constructor with the options bit mask. - - the options bit mask - If the options are not correct - - - - Is friendly to access it during the tests. - Returns the options. - - - - Creates a human readable string from the set options. Note: This method is quite - expensive and should only be used within tests or as - Returns a String listing all options that are set to true by their name, - like "option1 | option4". - - - - To be implemeted by inheritants. - Returns a bit mask where all valid option bits are set. - - - - Resets the options. - - - - an option bitmask - Returns true, if this object is equal to the given options. - - - an option bitmask - Returns true, if this object contains all given options. - - - an option bitmask - Returns true, if this object contain at least one of the given options. - - - the binary bit or bits that are requested - Returns if all of the requested bits are set or not. - - - the binary bit or bits that shall be set to the given value - the boolean value to set - - - - - Returns the options as hex bitmask. - - - - To be implemeted by inheritants. - a single, valid option bit. - Returns a human readable name for an option bit. - - - - The inheriting option class can do additional checks on the options. - Note: For performance reasons this method is only called - when setting bitmasks directly. - When get- and set-methods are used, this method must be called manually, - normally only when the Options-object has been created from a client - (it has to be made public therefore). - - the bitmask to check. - Thrown if the options are not consistent. - - - - Checks options before they are set. - First it is checked if only defined options are used, - second the additional -method is called. - - the options to check - Thrown if the options are invalid. - - - - Looks up or asks the inherited class for the name of an option bit. - Its save that there is only one valid option handed into the method. - a single option bit - Returns the option name or undefined. - - - Returns the optionNames map and creates it if required. - - - - This interface is used to return info about an alias. - - @since 27.01.2006 - - - - Returns Returns the namespace URI for the base property. - - - Returns the default prefix for the given base property. - - - Returns the path of the base property. - - - Returns the kind of the alias. This can be a direct alias - (ARRAY), a simple property to an ordered array - (ARRAY_ORDERED), to an alternate array - (ARRAY_ALTERNATE) or to an alternate text array - (ARRAY_ALT_TEXT). - - - - This interface is used to return a text property together with its and options. - - @since 23.01.2006 - - - - Returns the value of the property. - - - Returns the options of the property. - - - - Only set by . - Returns the language of the alt-text item. - - - - This interface is used to return a property together with its path and namespace. - It is returned when properties are iterated with the XMPIterator. - - @since 06.07.2006 - - - - Returns the namespace of the property - - - Returns the path of the property, but only if returned by the iterator. - - - - Common constants for the XMP Toolkit. - - @since 20.01.2006 - - - - - The XML namespace for XML. - - - - The XML namespace for RDF. - - - - The XML namespace for the Dublin Core schema. - - - - The XML namespace for the IPTC Core schema. - - - - The XML namespace for the IPTC Extension schema. - - - - The XML namespace for the DICOM medical schema. - - - - The XML namespace for the PLUS (Picture Licensing Universal System, http://www.useplus.org) - - - - The XML namespace Adobe XMP Metadata. - - - - The XML namespace for the XMP "basic" schema. - - - - The XML namespace for the XMP copyright schema. - - - - The XML namespace for the XMP digital asset management schema. - - - - The XML namespace for the job management schema. - - - - The XML namespace for the job management schema. - - - - The XML namespace for the PDF schema. - - - - The XML namespace for the PDF schema. - - - - The XML namespace for the Photoshop custom schema. - - - - The XML namespace for the Photoshop Album schema. - - - - The XML namespace for Adobe's EXIF schema. - - - - NS for the CIPA XMP for Exif document v1.1 - - - - The XML namespace for Adobe's TIFF schema. - - - - BExt Schema - - - - RIFF Info Schema - - - - Transform XMP - - - - Adobe Flash SWF - - - - legacy Dublin Core NS, will be converted to NS_DC - - - - The XML namespace for qualifiers of the xmp:Identifier property. - - - - The XML namespace for fields of the Dimensions type. - - - - The XML namespace for fields of a graphical image. Used for the Thumbnail type. - - - - The XML namespace for fields of the ResourceEvent type. - - - - The XML namespace for fields of the ResourceRef type. - - - - The XML namespace for fields of the Version type. - - - - The XML namespace for fields of the JobRef type. - - - - The canonical true string value for Booleans in serialized XMP. Code that converts from the - string to a bool should be case insensitive, and even allow "1". - - - - - The canonical false string value for Booleans in serialized XMP. Code that converts from the - string to a bool should be case insensitive, and even allow "0". - - - - - Index that has the meaning to be always the last item in an array. - - - - Node name of an array item. - - - - The x-default string for localized properties - - - - xml:lang qualfifier - - - - rdf:type qualfifier - - - - Processing Instruction (PI) for xmp packet - - - - XMP meta tag version new - - - - XMP meta tag version old - - - - A factory to create XMPDateTime-instances from a Calendar or an - ISO 8601 string or for the current time. - - @since 16.02.2006 - - - - - Obtain the current date and time. - - Returns The returned time is UTC, properly adjusted for the local time zone. The - resolution of the time is not guaranteed to be finer than seconds. - - - - Creates an XMPDateTime from a Calendar-object. - - a Calendar-object. - An XMPDateTime-object. - - - - Creates an empty XMPDateTime-object. - Returns an XMPDateTime-object. - - - - - - Creates an XMPDateTime from an ISO 8601 string. - - The ISO 8601 string representation of the date/time. - An XMPDateTime-object. - When the ISO 8601 string is non-conform - - - - Sets the local time zone without touching any other Any existing time zone value is replaced, - the other date/time fields are not adjusted in any way. - - the XMPDateTime variable containing the value to be modified. - Returns an updated XMPDateTime-object. - - - - Make sure a time is UTC. If the time zone is not UTC, the time is - adjusted and the time zone set to be UTC. - - - the XMPDateTime variable containing the time to - be modified. - Returns an updated XMPDateTime-object. - - - - Make sure a time is local. If the time zone is not the local zone, the time is adjusted and - the time zone set to be local. - - the XMPDateTime variable containing the time to be modified. - Returns an updated XMPDateTime-object. - - - - @since 21.09.2006 - - - - - Note: This is an error code introduced by Java. - - - - This exception wraps all errors that occur in the XMP Toolkit. - - @since 16.02.2006 - - - - - the errorCode of the XMP toolkit - - - - Constructs an exception with a message and an error code. - the message - the error code - - - - Constructs an exception with a message, an error code and a Throwable - the error message. - the error code - the exception source - - - Returns the errorCode. - - - - Creates XMPMeta-instances from an InputStream - - @since 30.01.2006 - - - - - The singleton instance of the XMPSchemaRegistry. - - - - - cache for version info - - - - Returns the singleton instance of the XMPSchemaRegistry. - - - Returns an empty XMPMeta-object. - - - - - - - - - - Serializes an XMPMeta-object as RDF into an OutputStream - with default options. - - a metadata object - an OutputStream to write the serialized RDF to. - on serializsation errors. - - - - Serializes an XMPMeta-object as RDF into an OutputStream. - - a metadata object - Options to control the serialization (see ). - an OutputStream to write the serialized RDF to. - on serializsation errors. - - - - Serializes an XMPMeta-object as RDF into a byte buffer. - - a metadata object - Options to control the serialization (see ). - Returns a byte buffer containing the serialized RDF. - on serializsation errors. - - - - Serializes an XMPMeta-object as RDF into a string. Note: Encoding - is ignored when serializing to a string. - - a metadata object - Options to control the serialization (see ). - Returns a string containing the serialized RDF. - on serializsation errors. - - - Asserts that xmp is compatible to XMPMetaImpl.s - - - - Resets the _schema registry to its original state (creates a new one). - Be careful this might break all existing XMPMeta-objects and should be used - only for testing purpurses. - - - - - Obtain version information. The XMPVersionInfo singleton is created the first time - its requested. - - Returns the version information. - - - - - Compose the path expression for an item in an array. - - The name of the array. May be a general path expression, must not be - null or the empty string. - The index of the desired item. Arrays in XMP are indexed from 1. - 0 and below means last array item and renders as [last()]. - - Returns the composed path basing on fullPath. This will be of the form - ns:arrayName[i], where "ns" is the prefix for schemaNs and - "i" is the decimal representation of itemIndex. - Throws exeption if index zero is used. - - - - Compose the path expression for a field in a struct. The result can be added to the - path of - - - The namespace URI for the field. Must not be null or the empty - string. - The name of the field. Must be a simple XML name, must not be - null or the empty string. - Returns the composed path. This will be of the form - ns:structName/fNS:fieldName, where "ns" is the prefix for - schemaNs and "fNS" is the prefix for fieldNs. - Thrown if the path to create is not valid. - - - - Compose the path expression for a qualifier. - - The namespace URI for the qualifier. May be null or the empty - string if the qualifier is in the XML empty namespace. - The name of the qualifier. Must be a simple XML name, must not be - null or the empty string. - Returns the composed path. This will be of the form - ns:propName/?qNS:qualName, where "ns" is the prefix for - schemaNs and "qNS" is the prefix for qualNs. - Thrown if the path to create is not valid. - - - - Compose the path expression to select an alternate item by language. The - path syntax allows two forms of "content addressing" that may - be used to select an item in an array of alternatives. The form used in - ComposeLangSelector lets you select an item in an alt-text array based on - the value of its xml:lang qualifier. The other form of content - addressing is shown in ComposeFieldSelector. \note ComposeLangSelector - does not supplant SetLocalizedText or GetLocalizedText. They should - generally be used, as they provide extra logic to choose the appropriate - language and maintain consistency with the 'x-default' value. - ComposeLangSelector gives you an path expression that is explicitly and - only for the language given in the langName parameter. - - - The name of the array. May be a general path expression, must - not be null or the empty string. - - The RFC 3066 code for the desired language. - Returns the composed path. This will be of the form - ns:arrayName[@xml:lang='langName'], where - "ns" is the prefix for schemaNs. - - - - - ParameterAsserts that a qualifier namespace is set. - a qualifier namespace - Qualifier schema is null or empty - - - - ParameterAsserts that a qualifier name is set. - a qualifier name or path - Qualifier name is null or empty - - - - ParameterAsserts that a struct field namespace is set. - a struct field namespace - Struct field schema is null or empty - - - - ParameterAsserts that a struct field name is set. - a struct field name or path - Struct field name is null or empty - - - - Utility methods for XMP. I included only those that are different from the - Java default conversion utilities. - - @since 21.02.2006 - - - - - Private constructor - - - - Create a single edit string from an array of strings. - - - The XMP object containing the array to be catenated. - - The schema namespace URI for the array. Must not be null or - the empty string. - - The name of the array. May be a general path expression, must - not be null or the empty string. Each item in the array must - be a simple string value. - - The string to be used to separate the items in the catenated - string. Defaults to "; ", ASCII semicolon and space - (U+003B, U+0020). - - The characters to be used as quotes around array items that - contain a separator. Defaults to '"' - - Option flag to control the catenation. - Returns the string containing the catenated array items. - Forwards the Exceptions from the metadata processing - - - - Separate a single edit string into an array of strings. - - - The XMP object containing the array to be updated. - - The schema namespace URI for the array. Must not be null or - the empty string. - - The name of the array. May be a general path expression, must - not be null or the empty string. Each item in the array must - be a simple string value. - - The string to be separated into the array items. - Option flags to control the separation. - Flag if commas shall be preserved - Forwards the Exceptions from the metadata processing - - - - - Alias without the new option deleteEmptyValues. - The source XMP object. - The destination XMP object. - Do internal properties in addition to external properties. - Replace the values of existing properties. - Forwards the Exceptions from the metadata processing - - - - - - Convert from boolean to string. - - - a boolean value - The XMP string representation of the boolean. The values used are - given by the constnts and - . - - - - Converts a string value to an int. - - - the string value - Returns an int. - - If the rawValue is null or empty or the - conversion fails. - - - - Convert from int to string. - - - an int value - The string representation of the int. - - - - Converts a string value to a long. - - - the string value - Returns a long. - - If the rawValue is null or empty or the - conversion fails. - - - - Convert from long to string. - - - a long value - The string representation of the long. - - - - Converts a string value to a double. - - - the string value - Returns a double. - - If the rawValue is null or empty or the - conversion fails. - - - - Convert from long to string. - - - a long value - The string representation of the long. - - - - Converts a string value to an XMPDateTime. - - - the string value - Returns an XMPDateTime-object. - - If the rawValue is null or empty or the - conversion fails. - - - - Convert from XMPDateTime to string. - - - an XMPDateTime - The string representation of the long. - - - - Convert from a byte array to a base64 encoded string. - - - the byte array to be converted - Returns the base64 string. - - - - Decode from Base64 encoded string to raw data. - - - a base64 encoded string - Returns a byte array containg the decoded string. - Thrown if the given string is not property base64 encoded - - - - Implementation of the IndicLigaturizer for Devanagari. - - Warning: this is an incomplete and experimental implementation of Devanagari. This implementation should not be used in production. - - - Constructor for the IndicLigaturizer for Devanagari. - - - Produces a blank (or empty) signature. Useful for deferred signing with - MakeSignature.signExternalContainer(). - @author Paulo Soares - - - Return the DER encoding of the object, null if the DER encoding can not be made. - - @return a DER byte array, null otherwise. - - - a general purpose ASN.1 decoder - note: this class differs from the - others in that it returns null after it has read the last object in - the stream. If an ASN.1 Null is encountered a Der/BER Null object is - returned. - - - Create an ASN1InputStream where no DER object will be longer than limit. - - @param input stream containing ASN.1 encoded data. - @param limit maximum size of a DER encoded object. - - - Create an ASN1InputStream based on the input byte array. The length of DER objects in - the stream is automatically limited to the length of the input array. - - @param input array containing ASN.1 encoded data. - - - build an object given its tag and the number of bytes to construct it from. - - - A Null object. - - - Create a base ASN.1 object from a byte array. - The byte array to parse. - The base ASN.1 object represented by the byte array. - If there is a problem parsing the data. - - - Read a base ASN.1 object from a stream. - The stream to parse. - The base ASN.1 object represented by the byte array. - If there is a problem parsing the data. - - - return an Octet string from a tagged object. - - @param obj the tagged object holding the object we want. - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the tagged object cannot - be converted. - - - return an Octet string from the given object. - - @param obj the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - @param string the octets making up the octet string. - - - return an Asn1Sequence from the given object. - - @param obj the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - Return an ASN1 sequence from a tagged object. There is a special - case here, if an object appears to have been explicitly tagged on - reading but we were expecting it to be implicitly tagged in the - normal course of events it indicates that we lost the surrounding - sequence - so we need to add it back (this will happen if the tagged - object is a sequence that contains other sequences). If you are - dealing with implicitly tagged sequences you really should - be using this method. - - @param obj the tagged object. - @param explicitly true if the object is meant to be explicitly tagged, - false otherwise. - @exception ArgumentException if the tagged object cannot - be converted. - - - return the object at the sequence position indicated by index. - - @param index the sequence number (starting at zero) of the object - @return the object at the sequence position indicated by index. - - - return an ASN1Set from the given object. - - @param obj the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - Return an ASN1 set from a tagged object. There is a special - case here, if an object appears to have been explicitly tagged on - reading but we were expecting it to be implicitly tagged in the - normal course of events it indicates that we lost the surrounding - set - so we need to add it back (this will happen if the tagged - object is a sequence that contains other sequences). If you are - dealing with implicitly tagged sets you really should - be using this method. - - @param obj the tagged object. - @param explicitly true if the object is meant to be explicitly tagged - false otherwise. - @exception ArgumentException if the tagged object cannot - be converted. - - - return the object at the set position indicated by index. - - @param index the set number (starting at zero) of the object - @return the object at the set position indicated by index. - - - return true if a <= b (arrays are assumed padded with zeros). - - - ASN.1 TaggedObject - in ASN.1 notation this is any object preceded by - a [n] where n is some number - these are assumed to follow the construction - rules (as with sequences). - - - @param tagNo the tag number for this object. - @param obj the tagged object. - - - @param explicitly true if the object is explicitly tagged. - @param tagNo the tag number for this object. - @param obj the tagged object. - - - return whether or not the object may be explicitly tagged. -

    - Note: if the object has been read from an input stream, the only - time you can be sure if isExplicit is returning the true state of - affairs is if it returns false. An implicitly tagged object may appear - to be explicitly tagged, so you need to understand the context under - which the reading was done as well, see GetObject below.

    -
    - - return whatever was following the tag. -

    - Note: tagged objects are generally context dependent if you're - trying to extract a tagged object you should be going via the - appropriate GetInstance method.

    -
    - - Return the object held in this tagged object as a parser assuming it has - the type of the passed in tag. If the object doesn't have a parser - associated with it, the base object is returned. - - - A BER Null object. - - - convert a vector of octet strings into a single byte string - - - The octets making up the octet string. - - - return the DER octets that make up this string. - - - create an empty sequence - - - create a sequence containing one object - - - create a sequence containing a vector of objects. - - - create an empty sequence - - - create a set containing one object - - - create a set containing a vector of objects. - - - BER TaggedObject - in ASN.1 notation this is any object preceded by - a [n] where n is some number - these are assumed to follow the construction - rules (as with sequences). - - - @param tagNo the tag number for this object. - @param obj the tagged object. - - - @param explicitly true if an explicitly tagged object. - @param tagNo the tag number for this object. - @param obj the tagged object. - - - create an implicitly tagged object that contains a zero - length sequence. - - -
    -            PKIFailureInfo ::= BIT STRING {
    -            badAlg               (0),
    -              -- unrecognized or unsupported Algorithm Identifier
    -            badMessageCheck      (1), -- integrity check failed (e.g., signature did not verify)
    -            badRequest           (2),
    -              -- transaction not permitted or supported
    -            badTime              (3), -- messageTime was not sufficiently close to the system time, as defined by local policy
    -            badCertId            (4), -- no certificate could be found matching the provided criteria
    -            badDataFormat        (5),
    -              -- the data submitted has the wrong format
    -            wrongAuthority       (6), -- the authority indicated in the request is different from the one creating the response token
    -            incorrectData        (7), -- the requester's data is incorrect (for notary services)
    -            missingTimeStamp     (8), -- when the timestamp is missing but should be there (by policy)
    -            badPOP               (9)  -- the proof-of-possession failed
    -            timeNotAvailable    (14),
    -              -- the TSA's time source is not available
    -            unacceptedPolicy    (15),
    -              -- the requested TSA policy is not supported by the TSA
    -            unacceptedExtension (16),
    -              -- the requested extension is not supported by the TSA
    -             addInfoNotAvailable (17)
    -               -- the additional information requested could not be understood
    -               -- or is not available
    -             systemFailure       (25)
    -               -- the request cannot be handled due to system failure
    -            
    -
    - - Basic constructor. - - - Return the number of string elements present. - - @return number of elements present. - - - Return the UTF8STRING at index. - - @param index index of the string of interest - @return the string at index. - - -
    -            PkiFreeText ::= SEQUENCE SIZE (1..MAX) OF UTF8String
    -            
    -
    - - @param status - - - @param status - @param statusString - - -
    -             PkiStatusInfo ::= SEQUENCE {
    -                 status        PKIStatus,                (INTEGER)
    -                 statusString  PkiFreeText     OPTIONAL,
    -                 failInfo      PkiFailureInfo  OPTIONAL  (BIT STRING)
    -             }
    -            
    -             PKIStatus:
    -               granted                (0), -- you got exactly what you asked for
    -               grantedWithMods        (1), -- you got something like what you asked for
    -               rejection              (2), -- you don't get it, more information elsewhere in the message
    -               waiting                (3), -- the request body part has not yet been processed, expect to hear more later
    -               revocationWarning      (4), -- this message contains a warning that a revocation is imminent
    -               revocationNotification (5), -- notification that a revocation has occurred
    -               keyUpdateWarning       (6)  -- update already done for the oldCertId specified in CertReqMsg
    -            
    -             PkiFailureInfo:
    -               badAlg           (0), -- unrecognized or unsupported Algorithm Identifier
    -               badMessageCheck  (1), -- integrity check failed (e.g., signature did not verify)
    -               badRequest       (2), -- transaction not permitted or supported
    -               badTime          (3), -- messageTime was not sufficiently close to the system time, as defined by local policy
    -               badCertId        (4), -- no certificate could be found matching the provided criteria
    -               badDataFormat    (5), -- the data submitted has the wrong format
    -               wrongAuthority   (6), -- the authority indicated in the request is different from the one creating the response token
    -               incorrectData    (7), -- the requester's data is incorrect (for notary services)
    -               missingTimeStamp (8), -- when the timestamp is missing but should be there (by policy)
    -               badPOP           (9)  -- the proof-of-possession failed
    -            
    -             
    -
    - -
    -            CAKeyUpdAnnContent ::= SEQUENCE {
    -                                        oldWithNew   CmpCertificate, -- old pub signed with new priv
    -                                        newWithOld   CmpCertificate, -- new pub signed with old priv
    -                                        newWithNew   CmpCertificate  -- new pub signed with new priv
    -             }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            CertConfirmContent ::= SEQUENCE OF CertStatus
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            CertifiedKeyPair ::= SEQUENCE {
    -                                             certOrEncCert       CertOrEncCert,
    -                                             privateKey      [0] EncryptedValue      OPTIONAL,
    -                                             -- see [CRMF] for comment on encoding
    -                                             publicationInfo [1] PKIPublicationInfo  OPTIONAL
    -                  }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            CertOrEncCert ::= CHOICE {
    -                                 certificate     [0] CMPCertificate,
    -                                 encryptedCert   [1] EncryptedValue
    -                      }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            CertRepMessage ::= SEQUENCE {
    -                                     caPubs       [1] SEQUENCE SIZE (1..MAX) OF CMPCertificate
    -                                                                                        OPTIONAL,
    -                                     response         SEQUENCE OF CertResponse
    -            }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            CertResponse ::= SEQUENCE {
    -                                       certReqId           INTEGER,
    -                                       -- to match this response with corresponding request (a value
    -                                       -- of -1 is to be used if certReqId is not specified in the
    -                                       -- corresponding request)
    -                                       status              PKIStatusInfo,
    -                                       certifiedKeyPair    CertifiedKeyPair    OPTIONAL,
    -                                       rspInfo             OCTET STRING        OPTIONAL
    -                                       -- analogous to the id-regInfo-utf8Pairs string defined
    -                                       -- for regInfo in CertReqMsg [CRMF]
    -                        }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            CertStatus ::= SEQUENCE {
    -                              certHash    OCTET STRING,
    -                              -- the hash of the certificate, using the same hash algorithm
    -                              -- as is used to create and verify the certificate signature
    -                              certReqId   INTEGER,
    -                              -- to match this confirmation with the corresponding req/rep
    -                              statusInfo  PKIStatusInfo OPTIONAL
    -            }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -             Challenge ::= SEQUENCE {
    -                             owf                 AlgorithmIdentifier  OPTIONAL,
    -            
    -                             -- MUST be present in the first Challenge; MAY be omitted in
    -                             -- any subsequent Challenge in POPODecKeyChallContent (if
    -                             -- omitted, then the owf used in the immediately preceding
    -                             -- Challenge is to be used).
    -            
    -                             witness             OCTET STRING,
    -                             -- the result of applying the one-way function (owf) to a
    -                             -- randomly-generated INTEGER, A.  [Note that a different
    -                             -- INTEGER MUST be used for each Challenge.]
    -                             challenge           OCTET STRING
    -                             -- the encryption (under the public key for which the cert.
    -                             -- request is being made) of Rand, where Rand is specified as
    -                             --   Rand ::= SEQUENCE {
    -                             --      int      INTEGER,
    -                             --       - the randomly-generated INTEGER A (above)
    -                             --      sender   GeneralName
    -                             --       - the sender's name (as included in PKIHeader)
    -                             --   }
    -                  }
    -             
    - @return a basic ASN.1 object representation. -
    - - Note: the addition of attribute certificates is a BC extension. - - -
    -             CMPCertificate ::= CHOICE {
    -                        x509v3PKCert        Certificate
    -                        x509v2AttrCert      [1] AttributeCertificate
    -              }
    -             
    - Note: the addition of attribute certificates is a BC extension. - - @return a basic ASN.1 object representation. -
    - -
    -            CrlAnnContent ::= SEQUENCE OF CertificateList
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            ErrorMsgContent ::= SEQUENCE {
    -                                   pKIStatusInfo          PKIStatusInfo,
    -                                   errorCode              INTEGER           OPTIONAL,
    -                                   -- implementation-specific error codes
    -                                   errorDetails           PKIFreeText       OPTIONAL
    -                                   -- implementation-specific error details
    -            }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            GenMsgContent ::= SEQUENCE OF InfoTypeAndValue
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            GenRepContent ::= SEQUENCE OF InfoTypeAndValue
    -            
    - @return a basic ASN.1 object representation. -
    - - Example InfoTypeAndValue contents include, but are not limited - to, the following (un-comment in this ASN.1 module and use as - appropriate for a given environment): -
    -               id-it-caProtEncCert    OBJECT IDENTIFIER ::= {id-it 1}
    -                  CAProtEncCertValue      ::= CMPCertificate
    -               id-it-signKeyPairTypes OBJECT IDENTIFIER ::= {id-it 2}
    -                 SignKeyPairTypesValue   ::= SEQUENCE OF AlgorithmIdentifier
    -               id-it-encKeyPairTypes  OBJECT IDENTIFIER ::= {id-it 3}
    -                 EncKeyPairTypesValue    ::= SEQUENCE OF AlgorithmIdentifier
    -               id-it-preferredSymmAlg OBJECT IDENTIFIER ::= {id-it 4}
    -                  PreferredSymmAlgValue   ::= AlgorithmIdentifier
    -               id-it-caKeyUpdateInfo  OBJECT IDENTIFIER ::= {id-it 5}
    -                  CAKeyUpdateInfoValue    ::= CAKeyUpdAnnContent
    -               id-it-currentCRL       OBJECT IDENTIFIER ::= {id-it 6}
    -                  CurrentCRLValue         ::= CertificateList
    -               id-it-unsupportedOIDs  OBJECT IDENTIFIER ::= {id-it 7}
    -                  UnsupportedOIDsValue    ::= SEQUENCE OF OBJECT IDENTIFIER
    -               id-it-keyPairParamReq  OBJECT IDENTIFIER ::= {id-it 10}
    -                  KeyPairParamReqValue    ::= OBJECT IDENTIFIER
    -               id-it-keyPairParamRep  OBJECT IDENTIFIER ::= {id-it 11}
    -                  KeyPairParamRepValue    ::= AlgorithmIdentifer
    -               id-it-revPassphrase    OBJECT IDENTIFIER ::= {id-it 12}
    -                  RevPassphraseValue      ::= EncryptedValue
    -               id-it-implicitConfirm  OBJECT IDENTIFIER ::= {id-it 13}
    -                  ImplicitConfirmValue    ::= NULL
    -               id-it-confirmWaitTime  OBJECT IDENTIFIER ::= {id-it 14}
    -                  ConfirmWaitTimeValue    ::= GeneralizedTime
    -               id-it-origPKIMessage   OBJECT IDENTIFIER ::= {id-it 15}
    -                  OrigPKIMessageValue     ::= PKIMessages
    -               id-it-suppLangTags     OBJECT IDENTIFIER ::= {id-it 16}
    -                  SuppLangTagsValue       ::= SEQUENCE OF UTF8String
    -            
    -             where
    -            
    -               id-pkix OBJECT IDENTIFIER ::= {
    -                  iso(1) identified-organization(3)
    -                  dod(6) internet(1) security(5) mechanisms(5) pkix(7)}
    -             and
    -                  id-it   OBJECT IDENTIFIER ::= {id-pkix 4}
    -             
    -
    - -
    -            InfoTypeAndValue ::= SEQUENCE {
    -                                    infoType               OBJECT IDENTIFIER,
    -                                    infoValue              ANY DEFINED BY infoType  OPTIONAL
    -            }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            KeyRecRepContent ::= SEQUENCE {
    -                                    status                  PKIStatusInfo,
    -                                    newSigCert          [0] CMPCertificate OPTIONAL,
    -                                    caCerts             [1] SEQUENCE SIZE (1..MAX) OF
    -                                                                      CMPCertificate OPTIONAL,
    -                                    keyPairHist         [2] SEQUENCE SIZE (1..MAX) OF
    -                                                                      CertifiedKeyPair OPTIONAL
    -                         }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            OobCertHash ::= SEQUENCE {
    -                                 hashAlg     [0] AlgorithmIdentifier     OPTIONAL,
    -                                 certId      [1] CertId                  OPTIONAL,
    -                                 hashVal         BIT STRING
    -                                 -- hashVal is calculated over the Der encoding of the
    -                                 -- self-signed certificate with the identifier certID.
    -                  }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -             PbmParameter ::= SEQUENCE {
    -                                   salt                OCTET STRING,
    -                                   -- note:  implementations MAY wish to limit acceptable sizes
    -                                   -- of this string to values appropriate for their environment
    -                                   -- in order to reduce the risk of denial-of-service attacks
    -                                   owf                 AlgorithmIdentifier,
    -                                   -- AlgId for a One-Way Function (SHA-1 recommended)
    -                                   iterationCount      INTEGER,
    -                                   -- number of times the OWF is applied
    -                                   -- note:  implementations MAY wish to limit acceptable sizes
    -                                   -- of this integer to values appropriate for their environment
    -                                   -- in order to reduce the risk of denial-of-service attacks
    -                                   mac                 AlgorithmIdentifier
    -                                   -- the MAC AlgId (e.g., DES-MAC, Triple-DES-MAC [PKCS11],
    -               }   -- or HMAC [RFC2104, RFC2202])
    -            
    - @return a basic ASN.1 object representation. -
    - - Creates a new PkiBody. - @param type one of the TYPE_* constants - @param content message content - - -
    -            PkiBody ::= CHOICE {       -- message-specific body elements
    -                   ir       [0]  CertReqMessages,        --Initialization Request
    -                   ip       [1]  CertRepMessage,         --Initialization Response
    -                   cr       [2]  CertReqMessages,        --Certification Request
    -                   cp       [3]  CertRepMessage,         --Certification Response
    -                   p10cr    [4]  CertificationRequest,   --imported from [PKCS10]
    -                   popdecc  [5]  POPODecKeyChallContent, --pop Challenge
    -                   popdecr  [6]  POPODecKeyRespContent,  --pop Response
    -                   kur      [7]  CertReqMessages,        --Key Update Request
    -                   kup      [8]  CertRepMessage,         --Key Update Response
    -                   krr      [9]  CertReqMessages,        --Key Recovery Request
    -                   krp      [10] KeyRecRepContent,       --Key Recovery Response
    -                   rr       [11] RevReqContent,          --Revocation Request
    -                   rp       [12] RevRepContent,          --Revocation Response
    -                   ccr      [13] CertReqMessages,        --Cross-Cert. Request
    -                   ccp      [14] CertRepMessage,         --Cross-Cert. Response
    -                   ckuann   [15] CAKeyUpdAnnContent,     --CA Key Update Ann.
    -                   cann     [16] CertAnnContent,         --Certificate Ann.
    -                   rann     [17] RevAnnContent,          --Revocation Ann.
    -                   crlann   [18] CRLAnnContent,          --CRL Announcement
    -                   pkiconf  [19] PKIConfirmContent,      --Confirmation
    -                   nested   [20] NestedMessageContent,   --Nested Message
    -                   genm     [21] GenMsgContent,          --General Message
    -                   genp     [22] GenRepContent,          --General Response
    -                   error    [23] ErrorMsgContent,        --Error Message
    -                   certConf [24] CertConfirmContent,     --Certificate confirm
    -                   pollReq  [25] PollReqContent,         --Polling request
    -                   pollRep  [26] PollRepContent          --Polling response
    -            }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            PkiConfirmContent ::= NULL
    -            
    - @return a basic ASN.1 object representation. -
    - - Value for a "null" recipient or sender. - - -
    -             PkiHeader ::= SEQUENCE {
    -                       pvno                INTEGER     { cmp1999(1), cmp2000(2) },
    -                       sender              GeneralName,
    -                       -- identifies the sender
    -                       recipient           GeneralName,
    -                       -- identifies the intended recipient
    -                       messageTime     [0] GeneralizedTime         OPTIONAL,
    -                       -- time of production of this message (used when sender
    -                       -- believes that the transport will be "suitable"; i.e.,
    -                       -- that the time will still be meaningful upon receipt)
    -                       protectionAlg   [1] AlgorithmIdentifier     OPTIONAL,
    -                       -- algorithm used for calculation of protection bits
    -                       senderKID       [2] KeyIdentifier           OPTIONAL,
    -                       recipKID        [3] KeyIdentifier           OPTIONAL,
    -                       -- to identify specific keys used for protection
    -                       transactionID   [4] OCTET STRING            OPTIONAL,
    -                       -- identifies the transaction; i.e., this will be the same in
    -                       -- corresponding request, response, certConf, and PKIConf
    -                       -- messages
    -                       senderNonce     [5] OCTET STRING            OPTIONAL,
    -                       recipNonce      [6] OCTET STRING            OPTIONAL,
    -                       -- nonces used to provide replay protection, senderNonce
    -                       -- is inserted by the creator of this message; recipNonce
    -                       -- is a nonce previously inserted in a related message by
    -                       -- the intended recipient of this message
    -                       freeText        [7] PKIFreeText             OPTIONAL,
    -                       -- this may be used to indicate context-specific instructions
    -                       -- (this field is intended for human consumption)
    -                       generalInfo     [8] SEQUENCE SIZE (1..MAX) OF
    -                                            InfoTypeAndValue     OPTIONAL
    -                       -- this may be used to convey context-specific information
    -                       -- (this field not primarily intended for human consumption)
    -            }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -             PKIHeader ::= SEQUENCE {
    -                       pvno                INTEGER     { cmp1999(1), cmp2000(2) },
    -                       sender              GeneralName,
    -                       -- identifies the sender
    -                       recipient           GeneralName,
    -                       -- identifies the intended recipient
    -                       messageTime     [0] GeneralizedTime         OPTIONAL,
    -                       -- time of production of this message (used when sender
    -                       -- believes that the transport will be "suitable"; i.e.,
    -                       -- that the time will still be meaningful upon receipt)
    -                       protectionAlg   [1] AlgorithmIdentifier     OPTIONAL,
    -                       -- algorithm used for calculation of protection bits
    -                       senderKID       [2] KeyIdentifier           OPTIONAL,
    -                       recipKID        [3] KeyIdentifier           OPTIONAL,
    -                       -- to identify specific keys used for protection
    -                       transactionID   [4] OCTET STRING            OPTIONAL,
    -                       -- identifies the transaction; i.e., this will be the same in
    -                       -- corresponding request, response, certConf, and PKIConf
    -                       -- messages
    -                       senderNonce     [5] OCTET STRING            OPTIONAL,
    -                       recipNonce      [6] OCTET STRING            OPTIONAL,
    -                       -- nonces used to provide replay protection, senderNonce
    -                       -- is inserted by the creator of this message; recipNonce
    -                       -- is a nonce previously inserted in a related message by
    -                       -- the intended recipient of this message
    -                       freeText        [7] PKIFreeText             OPTIONAL,
    -                       -- this may be used to indicate context-specific instructions
    -                       -- (this field is intended for human consumption)
    -                       generalInfo     [8] SEQUENCE SIZE (1..MAX) OF
    -                                            InfoTypeAndValue     OPTIONAL
    -                       -- this may be used to convey context-specific information
    -                       -- (this field not primarily intended for human consumption)
    -            }
    -            
    - @return a basic ASN.1 object representation. -
    - - Creates a new PkiMessage. - - @param header message header - @param body message body - @param protection message protection (may be null) - @param extraCerts extra certificates (may be null) - - -
    -            PkiMessage ::= SEQUENCE {
    -                             header           PKIHeader,
    -                             body             PKIBody,
    -                             protection   [0] PKIProtection OPTIONAL,
    -                             extraCerts   [1] SEQUENCE SIZE (1..MAX) OF CMPCertificate
    -                                                                                OPTIONAL
    -            }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            PkiMessages ::= SEQUENCE SIZE (1..MAX) OF PkiMessage
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            PollRepContent ::= SEQUENCE OF SEQUENCE {
    -                    certReqId              INTEGER,
    -                    checkAfter             INTEGER,  -- time in seconds
    -                    reason                 PKIFreeText OPTIONAL
    -                }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            PollReqContent ::= SEQUENCE OF SEQUENCE {
    -                                   certReqId              INTEGER
    -            }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            PopoDecKeyChallContent ::= SEQUENCE OF Challenge
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            PopoDecKeyRespContent ::= SEQUENCE OF INTEGER
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            ProtectedPart ::= SEQUENCE {
    -                               header    PKIHeader,
    -                               body      PKIBody
    -            }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            RevAnnContent ::= SEQUENCE {
    -                  status              PKIStatus,
    -                  certId              CertId,
    -                  willBeRevokedAt     GeneralizedTime,
    -                  badSinceDate        GeneralizedTime,
    -                  crlDetails          Extensions  OPTIONAL
    -                   -- extra CRL details (e.g., crl number, reason, location, etc.)
    -            }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            RevDetails ::= SEQUENCE {
    -                             certDetails         CertTemplate,
    -                              -- allows requester to specify as much as they can about
    -                              -- the cert. for which revocation is requested
    -                              -- (e.g., for cases in which serialNumber is not available)
    -                              crlEntryDetails     Extensions       OPTIONAL
    -                              -- requested crlEntryExtensions
    -                        }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            RevRepContent ::= SEQUENCE {
    -                   status       SEQUENCE SIZE (1..MAX) OF PKIStatusInfo,
    -                   -- in same order as was sent in RevReqContent
    -                   revCerts [0] SEQUENCE SIZE (1..MAX) OF CertId OPTIONAL,
    -                   -- IDs for which revocation was requested
    -                   -- (same order as status)
    -                   crls     [1] SEQUENCE SIZE (1..MAX) OF CertificateList OPTIONAL
    -                   -- the resulting CRLs (there may be more than one)
    -              }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            RevReqContent ::= SEQUENCE OF RevDetails
    -            
    - @return a basic ASN.1 object representation. -
    - - return an Attribute object from the given object. - - @param o the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -            Attribute ::= SEQUENCE {
    -                attrType OBJECT IDENTIFIER,
    -                attrValues SET OF AttributeValue
    -            }
    -            
    -
    - - Return the first attribute matching the given OBJECT IDENTIFIER - - - Return all the attributes matching the OBJECT IDENTIFIER oid. The vector will be - empty if there are no attributes of the required type present. - - @param oid type of attribute required. - @return a vector of all the attributes found of type oid. - - - Return a new table with the passed in attribute added. - - @param attrType - @param attrValue - @return - - - return an AuthenticatedData object from a tagged object. - - @param obj the tagged object holding the object we want. - @param isExplicit true if the object is meant to be explicitly - tagged false otherwise. - @throws ArgumentException if the object held by the - tagged object cannot be converted. - - - return an AuthenticatedData object from the given object. - - @param obj the object we want converted. - @throws ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -             AuthenticatedData ::= SEQUENCE {
    -                   version CMSVersion,
    -                   originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
    -                   recipientInfos RecipientInfos,
    -                   macAlgorithm MessageAuthenticationCodeAlgorithm,
    -                   digestAlgorithm [1] DigestAlgorithmIdentifier OPTIONAL,
    -                   encapContentInfo EncapsulatedContentInfo,
    -                   authAttrs [2] IMPLICIT AuthAttributes OPTIONAL,
    -                   mac MessageAuthenticationCode,
    -                   unauthAttrs [3] IMPLICIT UnauthAttributes OPTIONAL }
    -            
    -             AuthAttributes ::= SET SIZE (1..MAX) OF Attribute
    -            
    -             UnauthAttributes ::= SET SIZE (1..MAX) OF Attribute
    -            
    -             MessageAuthenticationCode ::= OCTET STRING
    -             
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -             AuthenticatedData ::= SEQUENCE {
    -                   version CMSVersion,
    -                   originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
    -                   recipientInfos RecipientInfos,
    -                   macAlgorithm MessageAuthenticationCodeAlgorithm,
    -                   digestAlgorithm [1] DigestAlgorithmIdentifier OPTIONAL,
    -                   encapContentInfo EncapsulatedContentInfo,
    -                   authAttrs [2] IMPLICIT AuthAttributes OPTIONAL,
    -                   mac MessageAuthenticationCode,
    -                   unauthAttrs [3] IMPLICIT UnauthAttributes OPTIONAL }
    -            
    -             AuthAttributes ::= SET SIZE (1..MAX) OF Attribute
    -            
    -             UnauthAttributes ::= SET SIZE (1..MAX) OF Attribute
    -            
    -             MessageAuthenticationCode ::= OCTET STRING
    -             
    -
    - - return an AuthEnvelopedData object from a tagged object. - - @param obj the tagged object holding the object we want. - @param isExplicit true if the object is meant to be explicitly - tagged false otherwise. - @throws ArgumentException if the object held by the - tagged object cannot be converted. - - - return an AuthEnvelopedData object from the given object. - - @param obj the object we want converted. - @throws ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -            AuthEnvelopedData ::= SEQUENCE {
    -              version CMSVersion,
    -              originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
    -              recipientInfos RecipientInfos,
    -              authEncryptedContentInfo EncryptedContentInfo,
    -              authAttrs [1] IMPLICIT AuthAttributes OPTIONAL,
    -              mac MessageAuthenticationCode,
    -              unauthAttrs [2] IMPLICIT UnauthAttributes OPTIONAL }
    -            
    -
    - - Produce an object suitable for an Asn1OutputStream. - -
    -            AuthEnvelopedData ::= SEQUENCE {
    -              version CMSVersion,
    -              originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
    -              recipientInfos RecipientInfos,
    -              authEncryptedContentInfo EncryptedContentInfo,
    -              authAttrs [1] IMPLICIT AuthAttributes OPTIONAL,
    -              mac MessageAuthenticationCode,
    -              unauthAttrs [2] IMPLICIT UnauthAttributes OPTIONAL }
    -            
    -
    - - The other Revocation Info arc - id-ri OBJECT IDENTIFIER ::= { iso(1) identified-organization(3) - dod(6) internet(1) security(5) mechanisms(5) pkix(7) ri(16) } - - - RFC 3274 - CMS Compressed Data. -
    -            CompressedData ::= Sequence {
    -             version CMSVersion,
    -             compressionAlgorithm CompressionAlgorithmIdentifier,
    -             encapContentInfo EncapsulatedContentInfo
    -            }
    -            
    -
    - - return a CompressedData object from a tagged object. - - @param ato the tagged object holding the object we want. - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the object held by the - tagged object cannot be converted. - - - return a CompressedData object from the given object. - - @param _obj the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - RFC 3274 - CMS Compressed Data. -
    -            CompressedData ::= SEQUENCE {
    -             version CMSVersion,
    -             compressionAlgorithm CompressionAlgorithmIdentifier,
    -             encapContentInfo EncapsulatedContentInfo
    -            }
    -            
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -            ContentInfo ::= Sequence {
    -                     contentType ContentType,
    -                     content
    -                     [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
    -            
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -            ContentInfo ::= SEQUENCE {
    -                     contentType ContentType,
    -                     content
    -                     [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
    -            
    -
    - - return an AuthEnvelopedData object from a tagged object. - - @param obj the tagged object holding the object we want. - @param isExplicit true if the object is meant to be explicitly - tagged false otherwise. - @throws ArgumentException if the object held by the - tagged object cannot be converted. - - - return an AuthEnvelopedData object from the given object. - - @param obj the object we want converted. - @throws ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -            MQVuserKeyingMaterial ::= SEQUENCE {
    -              ephemeralPublicKey OriginatorPublicKey,
    -              addedukm [0] EXPLICIT UserKeyingMaterial OPTIONAL  }
    -            
    -
    - - return an EncryptedContentInfo object from the given object. - - @param obj the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -            EncryptedContentInfo ::= Sequence {
    -                contentType ContentType,
    -                contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
    -                encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL
    -            }
    -            
    -
    - -
    -            EncryptedContentInfo ::= SEQUENCE {
    -                contentType ContentType,
    -                contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
    -                encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL
    -            }
    -            
    -
    - -
    -                  EncryptedData ::= SEQUENCE {
    -                                version CMSVersion,
    -                                encryptedContentInfo EncryptedContentInfo,
    -                                unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }
    -            
    - @return a basic ASN.1 object representation. -
    - - return an EnvelopedData object from a tagged object. - - @param obj the tagged object holding the object we want. - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the object held by the - tagged object cannot be converted. - - - return an EnvelopedData object from the given object. - - @param obj the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -            EnvelopedData ::= Sequence {
    -                version CMSVersion,
    -                originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
    -                recipientInfos RecipientInfos,
    -                encryptedContentInfo EncryptedContentInfo,
    -                unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL
    -            }
    -            
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -            EnvelopedData ::= SEQUENCE {
    -                version CMSVersion,
    -                originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
    -                recipientInfos RecipientInfos,
    -                encryptedContentInfo EncryptedContentInfo,
    -                unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL
    -            }
    -            
    -
    - - return a KekIdentifier object from a tagged object. - - @param obj the tagged object holding the object we want. - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the object held by the - tagged object cannot be converted. - - - return a KekIdentifier object from the given object. - - @param obj the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -            KekIdentifier ::= Sequence {
    -                keyIdentifier OCTET STRING,
    -                date GeneralizedTime OPTIONAL,
    -                other OtherKeyAttribute OPTIONAL
    -            }
    -            
    -
    - - return a KekRecipientInfo object from a tagged object. - - @param obj the tagged object holding the object we want. - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the object held by the - tagged object cannot be converted. - - - return a KekRecipientInfo object from the given object. - - @param obj the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -            KekRecipientInfo ::= Sequence {
    -                version CMSVersion,  -- always set to 4
    -                kekID KekIdentifier,
    -                keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
    -                encryptedKey EncryptedKey
    -            }
    -            
    -
    - - return an KeyAgreeRecipientIdentifier object from a tagged object. - - @param obj the tagged object holding the object we want. - @param isExplicit true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the object held by the - tagged object cannot be converted. - - - return an KeyAgreeRecipientIdentifier object from the given object. - - @param obj the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -            KeyAgreeRecipientIdentifier ::= CHOICE {
    -                issuerAndSerialNumber IssuerAndSerialNumber,
    -                rKeyId [0] IMPLICIT RecipientKeyIdentifier
    -            }
    -            
    -
    - - return a KeyAgreeRecipientInfo object from a tagged object. - - @param obj the tagged object holding the object we want. - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the object held by the - tagged object cannot be converted. - - - return a KeyAgreeRecipientInfo object from the given object. - - @param obj the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - * Produce an object suitable for an Asn1OutputStream. - *
    -                     * KeyAgreeRecipientInfo ::= Sequence {
    -                     *     version CMSVersion,  -- always set to 3
    -                     *     originator [0] EXPLICIT OriginatorIdentifierOrKey,
    -                     *     ukm [1] EXPLICIT UserKeyingMaterial OPTIONAL,
    -                     *     keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
    -                     *     recipientEncryptedKeys RecipientEncryptedKeys
    -                     * }
    -            		 *
    -            		 * UserKeyingMaterial ::= OCTET STRING
    -                     * 
    -
    - - return a KeyTransRecipientInfo object from the given object. - - @param obj the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -            KeyTransRecipientInfo ::= Sequence {
    -                version CMSVersion,  -- always set to 0 or 2
    -                rid RecipientIdentifier,
    -                keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
    -                encryptedKey EncryptedKey
    -            }
    -            
    -
    - - return an OriginatorIdentifierOrKey object from a tagged object. - - @param o the tagged object holding the object we want. - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the object held by the - tagged object cannot be converted. - - - return an OriginatorIdentifierOrKey object from the given object. - - @param o the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -             OriginatorIdentifierOrKey ::= CHOICE {
    -                 issuerAndSerialNumber IssuerAndSerialNumber,
    -                 subjectKeyIdentifier [0] SubjectKeyIdentifier,
    -                 originatorKey [1] OriginatorPublicKey
    -             }
    -            
    -             SubjectKeyIdentifier ::= OCTET STRING
    -             
    -
    - - return an OriginatorInfo object from a tagged object. - - @param obj the tagged object holding the object we want. - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the object held by the - tagged object cannot be converted. - - - return an OriginatorInfo object from the given object. - - @param obj the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -            OriginatorInfo ::= Sequence {
    -                certs [0] IMPLICIT CertificateSet OPTIONAL,
    -                crls [1] IMPLICIT CertificateRevocationLists OPTIONAL
    -            }
    -            
    -
    - - return an OriginatorPublicKey object from a tagged object. - - @param obj the tagged object holding the object we want. - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the object held by the - tagged object cannot be converted. - - - return an OriginatorPublicKey object from the given object. - - @param obj the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -            OriginatorPublicKey ::= Sequence {
    -                algorithm AlgorithmIdentifier,
    -                publicKey BIT STRING
    -            }
    -            
    -
    - - return an OtherKeyAttribute object from the given object. - - @param o the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -            OtherKeyAttribute ::= Sequence {
    -                keyAttrId OBJECT IDENTIFIER,
    -                keyAttr ANY DEFINED BY keyAttrId OPTIONAL
    -            }
    -            
    -
    - - return a OtherRecipientInfo object from a tagged object. - - @param obj the tagged object holding the object we want. - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the object held by the - tagged object cannot be converted. - - - return a OtherRecipientInfo object from the given object. - - @param obj the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -            OtherRecipientInfo ::= Sequence {
    -               oriType OBJECT IDENTIFIER,
    -               oriValue ANY DEFINED BY oriType }
    -            
    -
    - - return a OtherRevocationInfoFormat object from a tagged object. - - @param obj the tagged object holding the object we want. - @param explicit true if the object is meant to be explicitly - tagged false otherwise. - @exception IllegalArgumentException if the object held by the - tagged object cannot be converted. - - - return a OtherRevocationInfoFormat object from the given object. - - @param obj the object we want converted. - @exception IllegalArgumentException if the object cannot be converted. - - - Produce an object suitable for an ASN1OutputStream. -
    -            OtherRevocationInfoFormat ::= SEQUENCE {
    -                 otherRevInfoFormat OBJECT IDENTIFIER,
    -                 otherRevInfo ANY DEFINED BY otherRevInfoFormat }
    -            
    -
    - - return a PasswordRecipientInfo object from a tagged object. - - @param obj the tagged object holding the object we want. - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the object held by the - tagged object cannot be converted. - - - return a PasswordRecipientInfo object from the given object. - - @param obj the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -            PasswordRecipientInfo ::= Sequence {
    -              version CMSVersion,   -- Always set to 0
    -              keyDerivationAlgorithm [0] KeyDerivationAlgorithmIdentifier
    -                                        OPTIONAL,
    -             keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
    -             encryptedKey EncryptedKey }
    -            
    -
    - - return an RecipientEncryptedKey object from a tagged object. - - @param obj the tagged object holding the object we want. - @param isExplicit true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the object held by the - tagged object cannot be converted. - - - return a RecipientEncryptedKey object from the given object. - - @param obj the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -            RecipientEncryptedKey ::= SEQUENCE {
    -                rid KeyAgreeRecipientIdentifier,
    -                encryptedKey EncryptedKey
    -            }
    -            
    -
    - - return a RecipientIdentifier object from the given object. - - @param o the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -             RecipientIdentifier ::= CHOICE {
    -                 issuerAndSerialNumber IssuerAndSerialNumber,
    -                 subjectKeyIdentifier [0] SubjectKeyIdentifier
    -             }
    -            
    -             SubjectKeyIdentifier ::= OCTET STRING
    -             
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -            RecipientInfo ::= CHOICE {
    -                ktri KeyTransRecipientInfo,
    -                kari [1] KeyAgreeRecipientInfo,
    -                kekri [2] KekRecipientInfo,
    -                pwri [3] PasswordRecipientInfo,
    -                ori [4] OtherRecipientInfo }
    -            
    -
    - - return a RecipientKeyIdentifier object from a tagged object. - - @param _ato the tagged object holding the object we want. - @param _explicit true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the object held by the - tagged object cannot be converted. - - - return a RecipientKeyIdentifier object from the given object. - - @param _obj the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -             RecipientKeyIdentifier ::= Sequence {
    -                 subjectKeyIdentifier SubjectKeyIdentifier,
    -                 date GeneralizedTime OPTIONAL,
    -                 other OtherKeyAttribute OPTIONAL
    -             }
    -            
    -             SubjectKeyIdentifier ::= OCTET STRING
    -             
    -
    - -
    -               ScvpReqRes ::= SEQUENCE {
    -               request  [0] EXPLICIT ContentInfo OPTIONAL,
    -               response     ContentInfo }
    -            
    - @return the ASN.1 primitive representation. -
    - - a signed data object. - - - Produce an object suitable for an Asn1OutputStream. -
    -            SignedData ::= Sequence {
    -                version CMSVersion,
    -                digestAlgorithms DigestAlgorithmIdentifiers,
    -                encapContentInfo EncapsulatedContentInfo,
    -                certificates [0] IMPLICIT CertificateSet OPTIONAL,
    -                crls [1] IMPLICIT CertificateRevocationLists OPTIONAL,
    -                signerInfos SignerInfos
    -              }
    -            
    -
    - -
    -            SignedData ::= SEQUENCE {
    -                version CMSVersion,
    -                digestAlgorithms DigestAlgorithmIdentifiers,
    -                encapContentInfo EncapsulatedContentInfo,
    -                certificates [0] IMPLICIT CertificateSet OPTIONAL,
    -                crls [1] IMPLICIT CertificateRevocationLists OPTIONAL,
    -                signerInfos SignerInfos
    -              }
    -            
    -
    - - return a SignerIdentifier object from the given object. - - @param o the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -             SignerIdentifier ::= CHOICE {
    -                 issuerAndSerialNumber IssuerAndSerialNumber,
    -                 subjectKeyIdentifier [0] SubjectKeyIdentifier
    -             }
    -            
    -             SubjectKeyIdentifier ::= OCTET STRING
    -             
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -              SignerInfo ::= Sequence {
    -                  version Version,
    -                  SignerIdentifier sid,
    -                  digestAlgorithm DigestAlgorithmIdentifier,
    -                  authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL,
    -                  digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier,
    -                  encryptedDigest EncryptedDigest,
    -                  unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL
    -              }
    -            
    -              EncryptedDigest ::= OCTET STRING
    -            
    -              DigestAlgorithmIdentifier ::= AlgorithmIdentifier
    -            
    -              DigestEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
    -             
    -
    - - creates a time object from a given date - if the date is between 1950 - and 2049 a UTCTime object is Generated, otherwise a GeneralizedTime - is used. - - - Produce an object suitable for an Asn1OutputStream. -
    -            Time ::= CHOICE {
    -                        utcTime        UTCTime,
    -                        generalTime    GeneralizedTime }
    -            
    -
    - -
    -            Attributes ::=
    -              SET SIZE(1..MAX) OF Attribute -- according to RFC 5652
    -            
    - @return -
    - -
    -            MetaData ::= SEQUENCE {
    -              hashProtected        BOOLEAN,
    -              fileName             UTF8String OPTIONAL,
    -              mediaType            IA5String OPTIONAL,
    -              otherMetaData        Attributes OPTIONAL
    -            }
    -            
    - @return -
    - -
    -            TimeStampAndCRL ::= SEQUENCE {
    -                timeStamp   TimeStampToken,          -- according to RFC 3161
    -                crl         CertificateList OPTIONAL -- according to RFC 5280
    -             }
    -            
    - @return -
    - -
    -            TimeStampedData ::= SEQUENCE {
    -              version              INTEGER { v1(1) },
    -              dataUri              IA5String OPTIONAL,
    -              metaData             MetaData OPTIONAL,
    -              content              OCTET STRING OPTIONAL,
    -              temporalEvidence     Evidence
    -            }
    -            
    - @return -
    - -
    -            TimeStampTokenEvidence ::=
    -               SEQUENCE SIZE(1..MAX) OF TimeStampAndCrl
    -            
    - @return -
    - - table of the available named parameters for GOST 3410-2001. - - - return the ECDomainParameters object for the given OID, null if it - isn't present. - - @param oid an object identifier representing a named parameters, if present. - - - returns an enumeration containing the name strings for curves - contained in this structure. - - - return the named curve name represented by the given object identifier. - - -
    -             Gost28147-89-Parameters ::=
    -                           SEQUENCE {
    -                                   iv                   Gost28147-89-IV,
    -                                   encryptionParamSet   OBJECT IDENTIFIER
    -                            }
    -            
    -               Gost28147-89-IV ::= OCTET STRING (SIZE (8))
    -             
    -
    - - table of the available named parameters for GOST 3410-94. - - - return the GOST3410ParamSetParameters object for the given OID, null if it - isn't present. - - @param oid an object identifier representing a named parameters, if present. - - - returns an enumeration containing the name strings for parameters - contained in this structure. - - - Base class for an application specific object - - - Return the enclosed object assuming explicit tagging. - - @return the resulting object - @throws IOException if reconstruction fails. - - - Return the enclosed object assuming implicit tagging. - - @param derTagNo the type tag that should be applied to the object's contents. - @return the resulting object - @throws IOException if reconstruction fails. - - - return the correct number of pad bits for a bit string defined in - a 32 bit constant - - - return the correct number of bytes for a bit string defined in - a 32 bit constant - - - return a Bit string from the passed in object - - @exception ArgumentException if the object cannot be converted. - - - return a Bit string from a tagged object. - - @param obj the tagged object holding the object we want - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the tagged object cannot - be converted. - - - @param data the octets making up the bit string. - @param padBits the number of extra bits at the end of the string. - - - @return the value of the bit string as an int (truncating if necessary) - - - Der BMPString object. - - - return a BMP string from the given object. - - @param obj the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - return a BMP string from a tagged object. - - @param obj the tagged object holding the object we want - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the tagged object cannot - be converted. - - - basic constructor - byte encoded string. - - - basic constructor - - - return a bool from the passed in object. - - @exception ArgumentException if the object cannot be converted. - - - return a DerBoolean from the passed in bool. - - - return a Boolean from a tagged object. - - @param obj the tagged object holding the object we want - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the tagged object cannot - be converted. - - - return an integer from the passed in object - - @exception ArgumentException if the object cannot be converted. - - - return an Enumerated from a tagged object. - - @param obj the tagged object holding the object we want - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the tagged object cannot - be converted. - - - Class representing the DER-type External - - - Creates a new instance of DerExternal - See X.690 for more informations about the meaning of these parameters - @param directReference The direct reference or null if not set. - @param indirectReference The indirect reference or null if not set. - @param dataValueDescriptor The data value descriptor or null if not set. - @param externalData The external data in its encoded form. - - - Creates a new instance of DerExternal. - See X.690 for more informations about the meaning of these parameters - @param directReference The direct reference or null if not set. - @param indirectReference The indirect reference or null if not set. - @param dataValueDescriptor The data value descriptor or null if not set. - @param encoding The encoding to be used for the external data - @param externalData The external data - - - The encoding of the content. Valid values are -
      -
    • 0 single-ASN1-type
    • -
    • 1 OCTET STRING
    • -
    • 2 BIT STRING
    • -
    -
    - - Generalized time object. - - - return a generalized time from the passed in object - - @exception ArgumentException if the object cannot be converted. - - - return a Generalized Time object from a tagged object. - - @param obj the tagged object holding the object we want - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the tagged object cannot - be converted. - - - The correct format for this is YYYYMMDDHHMMSS[.f]Z, or without the Z - for local time, or Z+-HHMM on the end, for difference between local - time and UTC time. The fractional second amount f must consist of at - least one number with trailing zeroes removed. - - @param time the time string. - @exception ArgumentException if string is an illegal format. - - - base constructor from a local time object - - - Return the time. - @return The time string as it appeared in the encoded object. - - - return the time - always in the form of - YYYYMMDDhhmmssGMT(+hh:mm|-hh:mm). -

    - Normally in a certificate we would expect "Z" rather than "GMT", - however adding the "GMT" means we can just use: -

    -                dateF = new SimpleDateFormat("yyyyMMddHHmmssz");
    -            
    - To read in the time and Get a date which is compatible with our local - time zone.

    -
    - - Der IA5String object - this is an ascii string. - - - return a IA5 string from the passed in object - - @exception ArgumentException if the object cannot be converted. - - - return an IA5 string from a tagged object. - - @param obj the tagged object holding the object we want - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the tagged object cannot - be converted. - - - basic constructor - with bytes. - - - basic constructor - without validation. - - - Constructor with optional validation. - - @param string the base string to wrap. - @param validate whether or not to check the string. - @throws ArgumentException if validate is true and the string - contains characters that should not be in an IA5String. - - - return true if the passed in String can be represented without - loss as an IA5String, false otherwise. - - @return true if in printable set, false otherwise. - - - return an integer from the passed in object - - @exception ArgumentException if the object cannot be converted. - - - return an Integer from a tagged object. - - @param obj the tagged object holding the object we want - @param isExplicit true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the tagged object cannot - be converted. - - - in some cases positive values Get crammed into a space, - that's not quite big enough... - - - A Null object. - - - Der NumericString object - this is an ascii string of characters {0,1,2,3,4,5,6,7,8,9, }. - - - return a Numeric string from the passed in object - - @exception ArgumentException if the object cannot be converted. - - - return an Numeric string from a tagged object. - - @param obj the tagged object holding the object we want - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the tagged object cannot - be converted. - - - basic constructor - with bytes. - - - basic constructor - without validation.. - - - Constructor with optional validation. - - @param string the base string to wrap. - @param validate whether or not to check the string. - @throws ArgumentException if validate is true and the string - contains characters that should not be in a NumericString. - - - Return true if the string can be represented as a NumericString ('0'..'9', ' ') - - @param str string to validate. - @return true if numeric, fale otherwise. - - - return an Oid from the passed in object - - @exception ArgumentException if the object cannot be converted. - - - return an object Identifier from a tagged object. - - @param obj the tagged object holding the object we want - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the tagged object cannot - be converted. - - - Return true if this oid is an extension of the passed in branch, stem. - @param stem the arc or branch that is a possible parent. - @return true if the branch is on the passed in stem, false otherwise. - - - The octets making up the octet string. - - - Der PrintableString object. - - - return a printable string from the passed in object. - - @exception ArgumentException if the object cannot be converted. - - - return a Printable string from a tagged object. - - @param obj the tagged object holding the object we want - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the tagged object cannot - be converted. - - - basic constructor - byte encoded string. - - - basic constructor - this does not validate the string - - - Constructor with optional validation. - - @param string the base string to wrap. - @param validate whether or not to check the string. - @throws ArgumentException if validate is true and the string - contains characters that should not be in a PrintableString. - - - return true if the passed in String can be represented without - loss as a PrintableString, false otherwise. - - @return true if in printable set, false otherwise. - - - create an empty sequence - - - create a sequence containing one object - - - create a sequence containing a vector of objects. - - - A Der encoded set object - - - create an empty set - - - @param obj - a single object that makes up the set. - - - @param v - a vector of objects making up the set. - - - Der T61String (also the teletex string) - 8-bit characters - - - return a T61 string from the passed in object. - - @exception ArgumentException if the object cannot be converted. - - - return an T61 string from a tagged object. - - @param obj the tagged object holding the object we want - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the tagged object cannot - be converted. - - - basic constructor - with bytes. - - - basic constructor - with string. - - - DER TaggedObject - in ASN.1 notation this is any object preceded by - a [n] where n is some number - these are assumed to follow the construction - rules (as with sequences). - - - @param tagNo the tag number for this object. - @param obj the tagged object. - - - @param explicitly true if an explicitly tagged object. - @param tagNo the tag number for this object. - @param obj the tagged object. - - - create an implicitly tagged object that contains a zero - length sequence. - - - Der UniversalString object. - - - return a Universal string from the passed in object. - - @exception ArgumentException if the object cannot be converted. - - - return a Universal string from a tagged object. - - @param obj the tagged object holding the object we want - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the tagged object cannot - be converted. - - - basic constructor - byte encoded string. - - - We insert one of these when we find a tag we don't recognise. - - - @param tag the tag value. - @param data the contents octets. - - - UTC time object. - - - return an UTC Time from the passed in object. - - @exception ArgumentException if the object cannot be converted. - - - return an UTC Time from a tagged object. - - @param obj the tagged object holding the object we want - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the tagged object cannot - be converted. - - - The correct format for this is YYMMDDHHMMSSZ (it used to be that seconds were - never encoded. When you're creating one of these objects from scratch, that's - what you want to use, otherwise we'll try to deal with whatever Gets read from - the input stream... (this is why the input format is different from the GetTime() - method output). -

    - @param time the time string.

    -
    - - base constructor from a DateTime object - - - return the time as a date based on whatever a 2 digit year will return. For - standardised processing use ToAdjustedDateTime(). - - @return the resulting date - @exception ParseException if the date string cannot be parsed. - - - return the time as an adjusted date - in the range of 1950 - 2049. - - @return a date in the range of 1950 to 2049. - @exception ParseException if the date string cannot be parsed. - - - return the time - always in the form of - YYMMDDhhmmssGMT(+hh:mm|-hh:mm). -

    - Normally in a certificate we would expect "Z" rather than "GMT", - however adding the "GMT" means we can just use: -

    -                dateF = new SimpleDateFormat("yyMMddHHmmssz");
    -            
    - To read in the time and Get a date which is compatible with our local - time zone.

    -

    - Note: In some cases, due to the local date processing, this - may lead to unexpected results. If you want to stick the normal - convention of 1950 to 2049 use the GetAdjustedTime() method.

    -
    - - - Return a time string as an adjusted date with a 4 digit year. - This goes in the range of 1950 - 2049. - - - - Der UTF8String object. - - - return an UTF8 string from the passed in object. - - @exception ArgumentException if the object cannot be converted. - - - return an UTF8 string from a tagged object. - - @param obj the tagged object holding the object we want - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the tagged object cannot - be converted. - - - basic constructor - byte encoded string. - - - basic constructor - - - Der VisibleString object. - - - return a Visible string from the passed in object. - - @exception ArgumentException if the object cannot be converted. - - - return a Visible string from a tagged object. - - @param obj the tagged object holding the object we want - @param explicitly true if the object is meant to be explicitly - tagged false otherwise. - @exception ArgumentException if the tagged object cannot - be converted. - - - basic constructor - byte encoded string. - - - basic constructor - - - - RFC 3126: 4.3.1 Certificate Values Attribute Definition - - CertificateValues ::= SEQUENCE OF Certificate - - - - -
    -            CommitmentTypeIndication ::= SEQUENCE {
    -                 commitmentTypeId   CommitmentTypeIdentifier,
    -                 commitmentTypeQualifier   SEQUENCE SIZE (1..MAX) OF
    -                         CommitmentTypeQualifier OPTIONAL }
    -            
    -
    - - Commitment type qualifiers, used in the Commitment-Type-Indication attribute (RFC3126). - -
    -               CommitmentTypeQualifier ::= SEQUENCE {
    -                   commitmentTypeIdentifier  CommitmentTypeIdentifier,
    -                   qualifier          ANY DEFINED BY commitmentTypeIdentifier OPTIONAL }
    -             
    -
    - - Creates a new CommitmentTypeQualifier instance. - - @param commitmentTypeIdentifier a CommitmentTypeIdentifier value - - - Creates a new CommitmentTypeQualifier instance. - - @param commitmentTypeIdentifier a CommitmentTypeIdentifier value - @param qualifier the qualifier, defined by the above field. - - - Creates a new CommitmentTypeQualifier instance. - - @param as CommitmentTypeQualifier structure - encoded as an Asn1Sequence. - - - Returns a DER-encodable representation of this instance. - - @return a Asn1Object value - - - - RFC 3126: 4.2.1 Complete Certificate Refs Attribute Definition - - CompleteCertificateRefs ::= SEQUENCE OF OtherCertID - - - - - - RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition - - CompleteRevocationRefs ::= SEQUENCE OF CrlOcspRef - - - - - - RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition - - CrlIdentifier ::= SEQUENCE - { - crlissuer Name, - crlIssuedTime UTCTime, - crlNumber INTEGER OPTIONAL - } - - - - - - RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition - - CRLListID ::= SEQUENCE - { - crls SEQUENCE OF CrlValidatedID - } - - - - - - RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition - - CrlOcspRef ::= SEQUENCE { - crlids [0] CRLListID OPTIONAL, - ocspids [1] OcspListID OPTIONAL, - otherRev [2] OtherRevRefs OPTIONAL - } - - - - - - RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition - - CrlValidatedID ::= SEQUENCE { - crlHash OtherHash, - crlIdentifier CrlIdentifier OPTIONAL} - - - - - - RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition - - OcspIdentifier ::= SEQUENCE { - ocspResponderID ResponderID, - -- As in OCSP response data - producedAt GeneralizedTime - -- As in OCSP response data - } - - - - - - RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition - - OcspListID ::= SEQUENCE { - ocspResponses SEQUENCE OF OcspResponsesID - } - - - - - - RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition - - OcspResponsesID ::= SEQUENCE { - ocspIdentifier OcspIdentifier, - ocspRepHash OtherHash OPTIONAL - } - - - - - - - OtherCertID ::= SEQUENCE { - otherCertHash OtherHash, - issuerSerial IssuerSerial OPTIONAL - } - - - - - - - OtherHash ::= CHOICE { - sha1Hash OtherHashValue, -- This contains a SHA-1 hash - otherHash OtherHashAlgAndValue - } - - OtherHashValue ::= OCTET STRING - - - - - - Summary description for OtherHashAlgAndValue. - - - - OtherHashAlgAndValue ::= SEQUENCE { - hashAlgorithm AlgorithmIdentifier, - hashValue OtherHashValue - } - - OtherHashValue ::= OCTET STRING - - - - - - RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition - - OtherRevRefs ::= SEQUENCE - { - otherRevRefType OtherRevRefType, - otherRevRefs ANY DEFINED BY otherRevRefType - } - - OtherRevRefType ::= OBJECT IDENTIFIER - - - - - - RFC 3126: 4.3.2 Revocation Values Attribute Definition - - OtherRevVals ::= SEQUENCE - { - otherRevValType OtherRevValType, - otherRevVals ANY DEFINED BY otherRevValType - } - - OtherRevValType ::= OBJECT IDENTIFIER - - - - - - - OtherSigningCertificate ::= SEQUENCE { - certs SEQUENCE OF OtherCertID, - policies SEQUENCE OF PolicyInformation OPTIONAL - } - - - - - - RFC 5126: 6.3.4. revocation-values Attribute Definition - - RevocationValues ::= SEQUENCE { - crlVals [0] SEQUENCE OF CertificateList OPTIONAL, - ocspVals [1] SEQUENCE OF BasicOCSPResponse OPTIONAL, - otherRevVals [2] OtherRevVals OPTIONAL - } - - - - - - - SignaturePolicyId ::= SEQUENCE { - sigPolicyIdentifier SigPolicyId, - sigPolicyHash SigPolicyHash, - sigPolicyQualifiers SEQUENCE SIZE (1..MAX) OF SigPolicyQualifierInfo OPTIONAL - } - - SigPolicyId ::= OBJECT IDENTIFIER - - SigPolicyHash ::= OtherHashAlgAndValue - - - - - - - SignaturePolicyIdentifier ::= CHOICE { - SignaturePolicyId SignaturePolicyId, - SignaturePolicyImplied SignaturePolicyImplied - } - - SignaturePolicyImplied ::= NULL - - - - - -
    -              SignerAttribute ::= SEQUENCE OF CHOICE {
    -                  claimedAttributes   [0] ClaimedAttributes,
    -                  certifiedAttributes [1] CertifiedAttributes }
    -            
    -              ClaimedAttributes ::= SEQUENCE OF Attribute
    -              CertifiedAttributes ::= AttributeCertificate -- as defined in RFC 3281: see clause 4.1.
    -             
    -
    - - Signer-Location attribute (RFC3126). - -
    -               SignerLocation ::= SEQUENCE {
    -                   countryName        [0] DirectoryString OPTIONAL,
    -                   localityName       [1] DirectoryString OPTIONAL,
    -                   postalAddress      [2] PostalAddress OPTIONAL }
    -            
    -               PostalAddress ::= SEQUENCE SIZE(1..6) OF DirectoryString
    -             
    -
    - -
    -               SignerLocation ::= SEQUENCE {
    -                   countryName        [0] DirectoryString OPTIONAL,
    -                   localityName       [1] DirectoryString OPTIONAL,
    -                   postalAddress      [2] PostalAddress OPTIONAL }
    -            
    -               PostalAddress ::= SEQUENCE SIZE(1..6) OF DirectoryString
    -            
    -               DirectoryString ::= CHOICE {
    -                     teletexString           TeletexString (SIZE (1..MAX)),
    -                     printableString         PrintableString (SIZE (1..MAX)),
    -                     universalString         UniversalString (SIZE (1..MAX)),
    -                     utf8String              UTF8String (SIZE (1.. MAX)),
    -                     bmpString               BMPString (SIZE (1..MAX)) }
    -             
    -
    - - - - SigPolicyQualifierInfo ::= SEQUENCE { - sigPolicyQualifierId SigPolicyQualifierId, - sigQualifier ANY DEFINED BY sigPolicyQualifierId - } - - SigPolicyQualifierId ::= OBJECT IDENTIFIER - - - - - constructor - - -
    -            ContentHints ::= SEQUENCE {
    -              contentDescription UTF8String (SIZE (1..MAX)) OPTIONAL,
    -              contentType ContentType }
    -            
    -
    - - Create from OCTET STRING whose octets represent the identifier. - - - Create from byte array representing the identifier. - - - The definition of ContentIdentifier is -
    -            ContentIdentifier ::=  OCTET STRING
    -            
    - id-aa-contentIdentifier OBJECT IDENTIFIER ::= { iso(1) - member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) - smime(16) id-aa(2) 7 } -
    - - constructor - - -
    -            EssCertID ::= SEQUENCE {
    -                certHash Hash,
    -                issuerSerial IssuerSerial OPTIONAL }
    -            
    -
    - -
    -             EssCertIDv2 ::=  SEQUENCE {
    -                 hashAlgorithm     AlgorithmIdentifier
    -                          DEFAULT {algorithm id-sha256},
    -                 certHash          Hash,
    -                 issuerSerial      IssuerSerial OPTIONAL
    -             }
    -            
    -             Hash ::= OCTET STRING
    -            
    -             IssuerSerial ::= SEQUENCE {
    -                 issuer         GeneralNames,
    -                 serialNumber   CertificateSerialNumber
    -             }
    -             
    -
    - - constructor - - -
    -             OtherCertID ::= SEQUENCE {
    -                 otherCertHash    OtherHash,
    -                 issuerSerial     IssuerSerial OPTIONAL }
    -            
    -             OtherHash ::= CHOICE {
    -                 sha1Hash     OCTET STRING,
    -                 otherHash    OtherHashAlgAndValue }
    -            
    -             OtherHashAlgAndValue ::= SEQUENCE {
    -                 hashAlgorithm    AlgorithmIdentifier,
    -                 hashValue        OCTET STRING }
    -            
    -             
    -
    - - constructors - - - The definition of OtherSigningCertificate is -
    -            OtherSigningCertificate ::=  SEQUENCE {
    -                 certs        SEQUENCE OF OtherCertID,
    -                 policies     SEQUENCE OF PolicyInformation OPTIONAL
    -            }
    -            
    - id-aa-ets-otherSigCert OBJECT IDENTIFIER ::= { iso(1) - member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) - smime(16) id-aa(2) 19 } -
    - - constructors - - - The definition of SigningCertificate is -
    -            SigningCertificate ::=  SEQUENCE {
    -                 certs        SEQUENCE OF EssCertID,
    -                 policies     SEQUENCE OF PolicyInformation OPTIONAL
    -            }
    -            
    - id-aa-signingCertificate OBJECT IDENTIFIER ::= { iso(1) - member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) - smime(16) id-aa(2) 12 } -
    - - The definition of SigningCertificateV2 is -
    -            SigningCertificateV2 ::=  SEQUENCE {
    -                 certs        SEQUENCE OF EssCertIDv2,
    -                 policies     SEQUENCE OF PolicyInformation OPTIONAL
    -            }
    -            
    - id-aa-signingCertificateV2 OBJECT IDENTIFIER ::= { iso(1) - member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) - smime(16) id-aa(2) 47 } -
    - - Marker interface for CHOICE objects - if you implement this in a roll-your-own - object, any attempt to tag the object implicitly will convert the tag to an - explicit one as the encoding rules require. -

    - If you use this interface your class should also implement the getInstance - pattern which takes a tag object and the tagging mode used. -

    -
    - - basic interface for Der string objects. - - - The DataGroupHash object. -
    -             DataGroupHash  ::=  SEQUENCE {
    -                  dataGroupNumber         DataGroupNumber,
    -                  dataGroupHashValue     OCTET STRING }
    -            
    -             DataGroupNumber ::= INTEGER {
    -                     dataGroup1    (1),
    -                     dataGroup1    (2),
    -                     dataGroup1    (3),
    -                     dataGroup1    (4),
    -                     dataGroup1    (5),
    -                     dataGroup1    (6),
    -                     dataGroup1    (7),
    -                     dataGroup1    (8),
    -                     dataGroup1    (9),
    -                     dataGroup1    (10),
    -                     dataGroup1    (11),
    -                     dataGroup1    (12),
    -                     dataGroup1    (13),
    -                     dataGroup1    (14),
    -                     dataGroup1    (15),
    -                     dataGroup1    (16) }
    -            
    -             
    -
    - - The LDSSecurityObject object (V1.8). -
    -             LDSSecurityObject ::= SEQUENCE {
    -               version                LDSSecurityObjectVersion,
    -               hashAlgorithm          DigestAlgorithmIdentifier,
    -               dataGroupHashValues    SEQUENCE SIZE (2..ub-DataGroups) OF DataHashGroup,
    -               ldsVersionInfo         LDSVersionInfo OPTIONAL
    -                 -- if present, version MUST be v1 }
    -            
    -             DigestAlgorithmIdentifier ::= AlgorithmIdentifier,
    -            
    -             LDSSecurityObjectVersion :: INTEGER {V0(0)}
    -             
    -
    - - The CscaMasterList object. This object can be wrapped in a - CMSSignedData to be published in LDAP. - -
    -             CscaMasterList ::= SEQUENCE {
    -               version                CscaMasterListVersion,
    -               certList               SET OF Certificate }
    -               
    -             CscaMasterListVersion :: INTEGER {v0(0)}
    -             
    -
    - -
    -            LDSVersionInfo ::= SEQUENCE {
    -               ldsVersion PRINTABLE STRING
    -               unicodeVersion PRINTABLE STRING
    -             }
    -            
    - @return -
    - - The id-isismtt-cp-accredited OID indicates that the certificate is a - qualified certificate according to Directive 1999/93/EC of the European - Parliament and of the Council of 13 December 1999 on a Community - Framework for Electronic Signatures, which additionally conforms the - special requirements of the SigG and has been issued by an accredited CA. - - - Certificate extensionDate of certificate generation - -
    -            		DateOfCertGenSyntax ::= GeneralizedTime
    -             
    -
    - - Attribute to indicate that the certificate holder may sign in the name of - a third person. May also be used as extension in a certificate. - - - Attribute to indicate admissions to certain professions. May be used as - attribute in attribute certificate or as extension in a certificate - - - Monetary limit for transactions. The QcEuMonetaryLimit QC statement MUST - be used in new certificates in place of the extension/attribute - MonetaryLimit since January 1, 2004. For the sake of backward - compatibility with certificates already in use, SigG conforming - components MUST support MonetaryLimit (as well as QcEuLimitValue). - - - A declaration of majority. May be used as attribute in attribute - certificate or as extension in a certificate - - - - Serial number of the smart card containing the corresponding private key - -
    -            		ICCSNSyntax ::= OCTET STRING (SIZE(8..20))
    -             
    -
    - - - Reference for a file of a smartcard that stores the public key of this - certificate and that is used as �security anchor�. - -
    -            		PKReferenceSyntax ::= OCTET STRING (SIZE(20))
    -             
    -
    - - Some other restriction regarding the usage of this certificate. May be - used as attribute in attribute certificate or as extension in a - certificate. - -
    -            		RestrictionSyntax ::= DirectoryString (SIZE(1..1024))
    -             
    - - @see Org.BouncyCastle.Asn1.IsisMtt.X509.Restriction -
    - - - (Single)Request extension: Clients may include this extension in a - (single) Request to request the responder to send the certificate in the - response message along with the status information. Besides the LDAP - service, this extension provides another mechanism for the distribution - of certificates, which MAY optionally be provided by certificate - repositories. - -
    -            		RetrieveIfAllowed ::= BOOLEAN
    -             
    -
    - - SingleOCSPResponse extension: The certificate requested by the client by - inserting the RetrieveIfAllowed extension in the request, will be - returned in this extension. - - @see Org.BouncyCastle.Asn1.IsisMtt.Ocsp.RequestedCertificate - - - Base ObjectIdentifier for naming authorities - - - SingleOCSPResponse extension: Date, when certificate has been published - in the directory and status information has become available. Currently, - accrediting authorities enforce that SigG-conforming OCSP servers include - this extension in the responses. - -
    -            		CertInDirSince ::= GeneralizedTime
    -             
    -
    - - Hash of a certificate in OCSP. - - @see Org.BouncyCastle.Asn1.IsisMtt.Ocsp.CertHash - - -
    -            		NameAtBirth ::= DirectoryString(SIZE(1..64)
    -             
    - - Used in - {@link Org.BouncyCastle.Asn1.X509.SubjectDirectoryAttributes SubjectDirectoryAttributes} -
    - - Some other information of non-restrictive nature regarding the usage of - this certificate. May be used as attribute in atribute certificate or as - extension in a certificate. - -
    -                          AdditionalInformationSyntax ::= DirectoryString (SIZE(1..2048))
    -            
    - - @see Org.BouncyCastle.Asn1.IsisMtt.X509.AdditionalInformationSyntax -
    - - Indicates that an attribute certificate exists, which limits the - usability of this public key certificate. Whenever verifying a signature - with the help of this certificate, the content of the corresponding - attribute certificate should be concerned. This extension MUST be - included in a PKC, if a corresponding attribute certificate (having the - PKC as base certificate) contains some attribute that restricts the - usability of the PKC too. Attribute certificates with restricting content - MUST always be included in the signed document. - -
    -            		LiabilityLimitationFlagSyntax ::= BOOLEAN
    -             
    -
    - - ISIS-MTT PROFILE: The responder may include this extension in a response to - send the hash of the requested certificate to the responder. This hash is - cryptographically bound to the certificate and serves as evidence that the - certificate is known to the responder (i.e. it has been issued and is present - in the directory). Hence, this extension is a means to provide a positive - statement of availability as described in T8.[8]. As explained in T13.[1], - clients may rely on this information to be able to validate signatures after - the expiry of the corresponding certificate. Hence, clients MUST support this - extension. If a positive statement of availability is to be delivered, this - extension syntax and OID MUST be used. -

    -

    -

    -                CertHash ::= SEQUENCE {
    -                  hashAlgorithm AlgorithmIdentifier,
    -                  certificateHash OCTET STRING
    -                }
    -            
    -
    - - Constructor from Asn1Sequence. -

    - The sequence is of type CertHash: -

    -

    -                 CertHash ::= SEQUENCE {
    -                   hashAlgorithm AlgorithmIdentifier,
    -                   certificateHash OCTET STRING
    -                 }
    -             
    - - @param seq The ASN.1 sequence. -
    - - Constructor from a given details. - - @param hashAlgorithm The hash algorithm identifier. - @param certificateHash The hash of the whole DER encoding of the certificate. - - - Produce an object suitable for an Asn1OutputStream. -

    - Returns: -

    -

    -                 CertHash ::= SEQUENCE {
    -                   hashAlgorithm AlgorithmIdentifier,
    -                   certificateHash OCTET STRING
    -                 }
    -             
    - - @return an Asn1Object -
    - - ISIS-MTT-Optional: The certificate requested by the client by inserting the - RetrieveIfAllowed extension in the request, will be returned in this - extension. -

    - ISIS-MTT-SigG: The signature act allows publishing certificates only then, - when the certificate owner gives his isExplicit permission. Accordingly, there - may be �nondownloadable� certificates, about which the responder must provide - status information, but MUST NOT include them in the response. Clients may - get therefore the following three kind of answers on a single request - including the RetrieveIfAllowed extension: -

      -
    • a) the responder supports the extension and is allowed to publish the - certificate: RequestedCertificate returned including the requested - certificate
    • -
    • b) the responder supports the extension but is NOT allowed to publish - the certificate: RequestedCertificate returned including an empty OCTET - STRING
    • -
    • c) the responder does not support the extension: RequestedCertificate is - not included in the response
    • -
    - Clients requesting RetrieveIfAllowed MUST be able to handle these cases. If - any of the OCTET STRING options is used, it MUST contain the DER encoding of - the requested certificate. -

    -

    -                       RequestedCertificate ::= CHOICE {
    -                         Certificate Certificate,
    -                         publicKeyCertificate [0] EXPLICIT OCTET STRING,
    -                         attributeCertificate [1] EXPLICIT OCTET STRING
    -                       }
    -            
    -
    - - Constructor from a given details. -

    - Only one parameter can be given. All other must be null. - - @param certificate Given as Certificate - - - Produce an object suitable for an Asn1OutputStream. -

    - Returns: -

    -

    -                        RequestedCertificate ::= CHOICE {
    -                          Certificate Certificate,
    -                          publicKeyCertificate [0] EXPLICIT OCTET STRING,
    -                          attributeCertificate [1] EXPLICIT OCTET STRING
    -                        }
    -             
    - - @return an Asn1Object -
    - - Some other information of non-restrictive nature regarding the usage of this - certificate. - -
    -               AdditionalInformationSyntax ::= DirectoryString (SIZE(1..2048))
    -            
    -
    - - Constructor from a given details. - - @param information The describtion of the information. - - - Produce an object suitable for an Asn1OutputStream. -

    - Returns: -

    -

    -               AdditionalInformationSyntax ::= DirectoryString (SIZE(1..2048))
    -             
    - - @return an Asn1Object -
    - - An Admissions structure. -

    -

    -                        Admissions ::= SEQUENCE
    -                        {
    -                          admissionAuthority [0] EXPLICIT GeneralName OPTIONAL
    -                          namingAuthority [1] EXPLICIT NamingAuthority OPTIONAL
    -                          professionInfos SEQUENCE OF ProfessionInfo
    -                        }
    -             

    -

    - - @see Org.BouncyCastle.Asn1.IsisMtt.X509.AdmissionSyntax - @see Org.BouncyCastle.Asn1.IsisMtt.X509.ProfessionInfo - @see Org.BouncyCastle.Asn1.IsisMtt.X509.NamingAuthority -
    - - Constructor from Asn1Sequence. -

    - The sequence is of type ProcurationSyntax: -

    -

    -                        Admissions ::= SEQUENCE
    -                        {
    -                          admissionAuthority [0] EXPLICIT GeneralName OPTIONAL
    -                          namingAuthority [1] EXPLICIT NamingAuthority OPTIONAL
    -                          professionInfos SEQUENCE OF ProfessionInfo
    -                        }
    -             
    - - @param seq The ASN.1 sequence. -
    - - Constructor from a given details. -

    - Parameter professionInfos is mandatory. - - @param admissionAuthority The admission authority. - @param namingAuthority The naming authority. - @param professionInfos The profession infos. - - - Produce an object suitable for an Asn1OutputStream. -

    - Returns: -

    -

    -                   Admissions ::= SEQUENCE
    -                   {
    -                     admissionAuthority [0] EXPLICIT GeneralName OPTIONAL
    -                     namingAuthority [1] EXPLICIT NamingAuthority OPTIONAL
    -                     professionInfos SEQUENCE OF ProfessionInfo
    -                   }
    -             

    -

    - - @return an Asn1Object -
    - - Attribute to indicate admissions to certain professions. -

    -

    -                 AdmissionSyntax ::= SEQUENCE
    -                 {
    -                   admissionAuthority GeneralName OPTIONAL,
    -                   contentsOfAdmissions SEQUENCE OF Admissions
    -                 }
    -             

    - Admissions ::= SEQUENCE - { - admissionAuthority [0] EXPLICIT GeneralName OPTIONAL - namingAuthority [1] EXPLICIT NamingAuthority OPTIONAL - professionInfos SEQUENCE OF ProfessionInfo - } -

    - NamingAuthority ::= SEQUENCE - { - namingAuthorityId OBJECT IDENTIFIER OPTIONAL, - namingAuthorityUrl IA5String OPTIONAL, - namingAuthorityText DirectoryString(SIZE(1..128)) OPTIONAL - } -

    - ProfessionInfo ::= SEQUENCE - { - namingAuthority [0] EXPLICIT NamingAuthority OPTIONAL, - professionItems SEQUENCE OF DirectoryString (SIZE(1..128)), - professionOIDs SEQUENCE OF OBJECT IDENTIFIER OPTIONAL, - registrationNumber PrintableString(SIZE(1..128)) OPTIONAL, - addProfessionInfo OCTET STRING OPTIONAL - } -

    -

    -

    - ISIS-MTT PROFILE: The relatively complex structure of AdmissionSyntax - supports the following concepts and requirements: -

      -
    • External institutions (e.g. professional associations, chambers, unions, - administrative bodies, companies, etc.), which are responsible for granting - and verifying professional admissions, are indicated by means of the data - field admissionAuthority. An admission authority is indicated by a - GeneralName object. Here an X.501 directory name (distinguished name) can be - indicated in the field directoryName, a URL address can be indicated in the - field uniformResourceIdentifier, and an object identifier can be indicated in - the field registeredId.
    • -
    • The names of authorities which are responsible for the administration of - title registers are indicated in the data field namingAuthority. The name of - the authority can be identified by an object identifier in the field - namingAuthorityId, by means of a text string in the field - namingAuthorityText, by means of a URL address in the field - namingAuthorityUrl, or by a combination of them. For example, the text string - can contain the name of the authority, the country and the name of the title - register. The URL-option refers to a web page which contains lists with - �officially� registered professions (text and possibly OID) as well as - further information on these professions. Object identifiers for the - component namingAuthorityId are grouped under the OID-branch - id-isis-at-namingAuthorities and must be applied for.
    • -
    • See http://www.teletrust.de/anwend.asp?Id=30200&Sprache=E_&HomePG=0 - for an application form and http://www.teletrust.de/links.asp?id=30220,11 - for an overview of registered naming authorities.
    • -
    • By means of the data type ProfessionInfo certain professions, - specializations, disciplines, fields of activity, etc. are identified. A - profession is represented by one or more text strings, resp. profession OIDs - in the fields professionItems and professionOIDs and by a registration number - in the field registrationNumber. An indication in text form must always be - present, whereas the other indications are optional. The component - addProfessionInfo may contain additional applicationspecific information in - DER-encoded form.
    • -
    -

    - By means of different namingAuthority-OIDs or profession OIDs hierarchies of - professions, specializations, disciplines, fields of activity, etc. can be - expressed. The issuing admission authority should always be indicated (field - admissionAuthority), whenever a registration number is presented. Still, - information on admissions can be given without indicating an admission or a - naming authority by the exclusive use of the component professionItems. In - this case the certification authority is responsible for the verification of - the admission information. -

    -

    -

    - This attribute is single-valued. Still, several admissions can be captured in - the sequence structure of the component contentsOfAdmissions of - AdmissionSyntax or in the component professionInfos of Admissions. The - component admissionAuthority of AdmissionSyntax serves as default value for - the component admissionAuthority of Admissions. Within the latter component - the default value can be overwritten, in case that another authority is - responsible. The component namingAuthority of Admissions serves as a default - value for the component namingAuthority of ProfessionInfo. Within the latter - component the default value can be overwritten, in case that another naming - authority needs to be recorded. -

    - The length of the string objects is limited to 128 characters. It is - recommended to indicate a namingAuthorityURL in all issued attribute - certificates. If a namingAuthorityURL is indicated, the field professionItems - of ProfessionInfo should contain only registered titles. If the field - professionOIDs exists, it has to contain the OIDs of the professions listed - in professionItems in the same order. In general, the field professionInfos - should contain only one entry, unless the admissions that are to be listed - are logically connected (e.g. they have been issued under the same admission - number). - - @see Org.BouncyCastle.Asn1.IsisMtt.X509.Admissions - @see Org.BouncyCastle.Asn1.IsisMtt.X509.ProfessionInfo - @see Org.BouncyCastle.Asn1.IsisMtt.X509.NamingAuthority - - - Constructor from Asn1Sequence. -

    - The sequence is of type ProcurationSyntax: -

    -

    -                 AdmissionSyntax ::= SEQUENCE
    -                 {
    -                   admissionAuthority GeneralName OPTIONAL,
    -                   contentsOfAdmissions SEQUENCE OF Admissions
    -                 }
    -             

    - Admissions ::= SEQUENCE - { - admissionAuthority [0] EXPLICIT GeneralName OPTIONAL - namingAuthority [1] EXPLICIT NamingAuthority OPTIONAL - professionInfos SEQUENCE OF ProfessionInfo - } -

    - NamingAuthority ::= SEQUENCE - { - namingAuthorityId OBJECT IDENTIFIER OPTIONAL, - namingAuthorityUrl IA5String OPTIONAL, - namingAuthorityText DirectoryString(SIZE(1..128)) OPTIONAL - } -

    - ProfessionInfo ::= SEQUENCE - { - namingAuthority [0] EXPLICIT NamingAuthority OPTIONAL, - professionItems SEQUENCE OF DirectoryString (SIZE(1..128)), - professionOIDs SEQUENCE OF OBJECT IDENTIFIER OPTIONAL, - registrationNumber PrintableString(SIZE(1..128)) OPTIONAL, - addProfessionInfo OCTET STRING OPTIONAL - } -

    - - @param seq The ASN.1 sequence. -
    - - Constructor from given details. - - @param admissionAuthority The admission authority. - @param contentsOfAdmissions The admissions. - - - Produce an object suitable for an Asn1OutputStream. -

    - Returns: -

    -

    -                 AdmissionSyntax ::= SEQUENCE
    -                 {
    -                   admissionAuthority GeneralName OPTIONAL,
    -                   contentsOfAdmissions SEQUENCE OF Admissions
    -                 }
    -             

    - Admissions ::= SEQUENCE - { - admissionAuthority [0] EXPLICIT GeneralName OPTIONAL - namingAuthority [1] EXPLICIT NamingAuthority OPTIONAL - professionInfos SEQUENCE OF ProfessionInfo - } -

    - NamingAuthority ::= SEQUENCE - { - namingAuthorityId OBJECT IDENTIFIER OPTIONAL, - namingAuthorityUrl IA5String OPTIONAL, - namingAuthorityText DirectoryString(SIZE(1..128)) OPTIONAL - } -

    - ProfessionInfo ::= SEQUENCE - { - namingAuthority [0] EXPLICIT NamingAuthority OPTIONAL, - professionItems SEQUENCE OF DirectoryString (SIZE(1..128)), - professionOIDs SEQUENCE OF OBJECT IDENTIFIER OPTIONAL, - registrationNumber PrintableString(SIZE(1..128)) OPTIONAL, - addProfessionInfo OCTET STRING OPTIONAL - } -

    - - @return an Asn1Object -
    - - @return Returns the admissionAuthority if present, null otherwise. - - - @return Returns the contentsOfAdmissions. - - - A declaration of majority. -

    -

    -                      DeclarationOfMajoritySyntax ::= CHOICE
    -                      {
    -                        notYoungerThan [0] IMPLICIT INTEGER,
    -                        fullAgeAtCountry [1] IMPLICIT SEQUENCE
    -                        {
    -                          fullAge BOOLEAN DEFAULT TRUE,
    -                          country PrintableString (SIZE(2))
    -                        }
    -                        dateOfBirth [2] IMPLICIT GeneralizedTime
    -                      }
    -            
    -

    - fullAgeAtCountry indicates the majority of the owner with respect to the laws - of a specific country. - - - Produce an object suitable for an Asn1OutputStream. -

    - Returns: -

    -

    -                       DeclarationOfMajoritySyntax ::= CHOICE
    -                       {
    -                         notYoungerThan [0] IMPLICIT INTEGER,
    -                         fullAgeAtCountry [1] IMPLICIT SEQUENCE
    -                         {
    -                           fullAge BOOLEAN DEFAULT TRUE,
    -                           country PrintableString (SIZE(2))
    -                         }
    -                         dateOfBirth [2] IMPLICIT GeneralizedTime
    -                       }
    -             
    - - @return an Asn1Object -
    - - @return notYoungerThan if that's what we are, -1 otherwise - - - Monetary limit for transactions. The QcEuMonetaryLimit QC statement MUST be - used in new certificates in place of the extension/attribute MonetaryLimit - since January 1, 2004. For the sake of backward compatibility with - certificates already in use, components SHOULD support MonetaryLimit (as well - as QcEuLimitValue). -

    - Indicates a monetary limit within which the certificate holder is authorized - to act. (This value DOES NOT express a limit on the liability of the - certification authority). -

    -

    -               MonetaryLimitSyntax ::= SEQUENCE
    -               {
    -                 currency PrintableString (SIZE(3)),
    -                 amount INTEGER,
    -                 exponent INTEGER
    -               }
    -            
    -

    - currency must be the ISO code. -

    - value = amount�10*exponent - - - Constructor from a given details. -

    -

    - value = amount�10^exponent - - @param currency The currency. Must be the ISO code. - @param amount The amount - @param exponent The exponent - - - Produce an object suitable for an Asn1OutputStream. -

    - Returns: -

    -

    -                MonetaryLimitSyntax ::= SEQUENCE
    -                {
    -                  currency PrintableString (SIZE(3)),
    -                  amount INTEGER,
    -                  exponent INTEGER
    -                }
    -             
    - - @return an Asn1Object -
    - - Names of authorities which are responsible for the administration of title - registers. - -
    -                        NamingAuthority ::= SEQUENCE 
    -                        {
    -                          namingAuthorityID OBJECT IDENTIFIER OPTIONAL,
    -                          namingAuthorityUrl IA5String OPTIONAL,
    -                          namingAuthorityText DirectoryString(SIZE(1..128)) OPTIONAL
    -                        }
    -            
    - @see Org.BouncyCastle.Asn1.IsisMtt.X509.AdmissionSyntax - -
    - - Profession OIDs should always be defined under the OID branch of the - responsible naming authority. At the time of this writing, the work group - �Recht, Wirtschaft, Steuern� (�Law, Economy, Taxes�) is registered as the - first naming authority under the OID id-isismtt-at-namingAuthorities. - - - Constructor from Asn1Sequence. -

    -

    -

    -                         NamingAuthority ::= SEQUENCE
    -                         {
    -                           namingAuthorityID OBJECT IDENTIFIER OPTIONAL,
    -                           namingAuthorityUrl IA5String OPTIONAL,
    -                           namingAuthorityText DirectoryString(SIZE(1..128)) OPTIONAL
    -                         }
    -             
    - - @param seq The ASN.1 sequence. -
    - - @return Returns the namingAuthorityID. - - - @return Returns the namingAuthorityText. - - - @return Returns the namingAuthorityUrl. - - - Constructor from given details. -

    - All parameters can be combined. - - @param namingAuthorityID ObjectIdentifier for naming authority. - @param namingAuthorityUrl URL for naming authority. - @param namingAuthorityText Textual representation of naming authority. - - - Produce an object suitable for an Asn1OutputStream. -

    - Returns: -

    -

    -                         NamingAuthority ::= SEQUENCE
    -                         {
    -                           namingAuthorityID OBJECT IDENTIFIER OPTIONAL,
    -                           namingAuthorityUrl IA5String OPTIONAL,
    -                           namingAuthorityText DirectoryString(SIZE(1..128)) OPTIONAL
    -                         }
    -             
    - - @return an Asn1Object -
    - - Attribute to indicate that the certificate holder may sign in the name of a - third person. -

    - ISIS-MTT PROFILE: The corresponding ProcurationSyntax contains either the - name of the person who is represented (subcomponent thirdPerson) or a - reference to his/her base certificate (in the component signingFor, - subcomponent certRef), furthermore the optional components country and - typeSubstitution to indicate the country whose laws apply, and respectively - the type of procuration (e.g. manager, procuration, custody). -

    -

    - ISIS-MTT PROFILE: The GeneralName MUST be of type directoryName and MAY only - contain: - RFC3039 attributes, except pseudonym (countryName, commonName, - surname, givenName, serialNumber, organizationName, organizationalUnitName, - stateOrProvincename, localityName, postalAddress) and - SubjectDirectoryName - attributes (title, dateOfBirth, placeOfBirth, gender, countryOfCitizenship, - countryOfResidence and NameAtBirth). -

    -
    -                          ProcurationSyntax ::= SEQUENCE {
    -                            country [1] EXPLICIT PrintableString(SIZE(2)) OPTIONAL,
    -                            typeOfSubstitution [2] EXPLICIT DirectoryString (SIZE(1..128)) OPTIONAL,
    -                            signingFor [3] EXPLICIT SigningFor 
    -                          }
    -                          
    -                          SigningFor ::= CHOICE 
    -                          { 
    -                            thirdPerson GeneralName,
    -                            certRef IssuerSerial 
    -                          }
    -            
    - -
    - - Constructor from Asn1Sequence. -

    - The sequence is of type ProcurationSyntax: -

    -

    -                           ProcurationSyntax ::= SEQUENCE {
    -                             country [1] EXPLICIT PrintableString(SIZE(2)) OPTIONAL,
    -                             typeOfSubstitution [2] EXPLICIT DirectoryString (SIZE(1..128)) OPTIONAL,
    -                             signingFor [3] EXPLICIT SigningFor
    -                           }
    -             

    - SigningFor ::= CHOICE - { - thirdPerson GeneralName, - certRef IssuerSerial - } -

    - - @param seq The ASN.1 sequence. -
    - - Constructor from a given details. -

    -

    - Either generalName or certRef MUST be - null. - - @param country The country code whose laws apply. - @param typeOfSubstitution The type of procuration. - @param certRef Reference to certificate of the person who is represented. - - - Constructor from a given details. -

    -

    - Either generalName or certRef MUST be - null. - - @param country The country code whose laws apply. - @param typeOfSubstitution The type of procuration. - @param thirdPerson The GeneralName of the person who is represented. - - - Produce an object suitable for an Asn1OutputStream. -

    - Returns: -

    -

    -                           ProcurationSyntax ::= SEQUENCE {
    -                             country [1] EXPLICIT PrintableString(SIZE(2)) OPTIONAL,
    -                             typeOfSubstitution [2] EXPLICIT DirectoryString (SIZE(1..128)) OPTIONAL,
    -                             signingFor [3] EXPLICIT SigningFor
    -                           }
    -             

    - SigningFor ::= CHOICE - { - thirdPerson GeneralName, - certRef IssuerSerial - } -

    - - @return an Asn1Object -
    - - Professions, specializations, disciplines, fields of activity, etc. - -
    -                          ProfessionInfo ::= SEQUENCE 
    -                          {
    -                            namingAuthority [0] EXPLICIT NamingAuthority OPTIONAL,
    -                            professionItems SEQUENCE OF DirectoryString (SIZE(1..128)),
    -                            professionOids SEQUENCE OF OBJECT IDENTIFIER OPTIONAL,
    -                            registrationNumber PrintableString(SIZE(1..128)) OPTIONAL,
    -                            addProfessionInfo OCTET STRING OPTIONAL 
    -                          }
    -            
    - - @see Org.BouncyCastle.Asn1.IsisMtt.X509.AdmissionSyntax -
    - - Rechtsanw�ltin - - - Rechtsanwalt - - - Rechtsbeistand - - - Steuerberaterin - - - Steuerberater - - - Steuerbevollm�chtigte - - - Steuerbevollm�chtigter - - - Notarin - - - Notar - - - Notarvertreterin - - - Notarvertreter - - - Notariatsverwalterin - - - Notariatsverwalter - - - Wirtschaftspr�ferin - - - Wirtschaftspr�fer - - - Vereidigte Buchpr�ferin - - - Vereidigter Buchpr�fer - - - Patentanw�ltin - - - Patentanwalt - - - Constructor from Asn1Sequence. -

    -

    -

    -                           ProfessionInfo ::= SEQUENCE
    -                           {
    -                             namingAuthority [0] EXPLICIT NamingAuthority OPTIONAL,
    -                             professionItems SEQUENCE OF DirectoryString (SIZE(1..128)),
    -                             professionOids SEQUENCE OF OBJECT IDENTIFIER OPTIONAL,
    -                             registrationNumber PrintableString(SIZE(1..128)) OPTIONAL,
    -                             addProfessionInfo OCTET STRING OPTIONAL
    -                           }
    -             
    - - @param seq The ASN.1 sequence. -
    - - Constructor from given details. -

    - professionItems is mandatory, all other parameters are - optional. - - @param namingAuthority The naming authority. - @param professionItems Directory strings of the profession. - @param professionOids DERObjectIdentfier objects for the - profession. - @param registrationNumber Registration number. - @param addProfessionInfo Additional infos in encoded form. - - - Produce an object suitable for an Asn1OutputStream. -

    - Returns: -

    -

    -                           ProfessionInfo ::= SEQUENCE
    -                           {
    -                             namingAuthority [0] EXPLICIT NamingAuthority OPTIONAL,
    -                             professionItems SEQUENCE OF DirectoryString (SIZE(1..128)),
    -                             professionOids SEQUENCE OF OBJECT IDENTIFIER OPTIONAL,
    -                             registrationNumber PrintableString(SIZE(1..128)) OPTIONAL,
    -                             addProfessionInfo OCTET STRING OPTIONAL
    -                           }
    -             
    - - @return an Asn1Object -
    - - @return Returns the addProfessionInfo. - - - @return Returns the namingAuthority. - - - @return Returns the professionItems. - - - @return Returns the professionOids. - - - @return Returns the registrationNumber. - - - Some other restriction regarding the usage of this certificate. -

    -

    -             RestrictionSyntax ::= DirectoryString (SIZE(1..1024))
    -            
    -
    - - Constructor from DirectoryString. -

    - The DirectoryString is of type RestrictionSyntax: -

    -

    -                  RestrictionSyntax ::= DirectoryString (SIZE(1..1024))
    -             
    - - @param restriction A IAsn1String. -
    - - Constructor from a given details. - - @param restriction The description of the restriction. - - - Produce an object suitable for an Asn1OutputStream. -

    - Returns: -

    -

    -                  RestrictionSyntax ::= DirectoryString (SIZE(1..1024))
    -             

    -

    - - @return an Asn1Object -
    - - Produce an object suitable for an Asn1OutputStream. -
    -            cast5CBCParameters ::= Sequence {
    -                                      iv         OCTET STRING DEFAULT 0,
    -                                             -- Initialization vector
    -                                      keyLength  Integer
    -                                             -- Key length, in bits
    -                                 }
    -            
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -            IDEA-CBCPar ::= Sequence {
    -                                 iv    OCTET STRING OPTIONAL -- exactly 8 octets
    -                             }
    -            
    -
    - - The NetscapeCertType object. -
    -               NetscapeCertType ::= BIT STRING {
    -                    SSLClient               (0),
    -                    SSLServer               (1),
    -                    S/MIME                  (2),
    -                    Object Signing          (3),
    -                    Reserved                (4),
    -                    SSL CA                  (5),
    -                    S/MIME CA               (6),
    -                    Object Signing CA       (7) }
    -            
    -
    - - Basic constructor. - - @param usage - the bitwise OR of the Key Usage flags giving the - allowed uses for the key. - e.g. (X509NetscapeCertType.sslCA | X509NetscapeCertType.smimeCA) - - - This is designed to parse - the PublicKeyAndChallenge created by the KEYGEN tag included by - Mozilla based browsers. -
    -              PublicKeyAndChallenge ::= SEQUENCE {
    -                spki SubjectPublicKeyInfo,
    -                challenge IA5STRING
    -              }
    -            
    -              
    -
    - - Utility class for fetching curves using their NIST names as published in FIPS-PUB 186-3 - - - return the X9ECParameters object for the named curve represented by - the passed in object identifier. Null if the curve isn't present. - - @param oid an object identifier representing a named curve, if present. - - - return the object identifier signified by the passed in name. Null - if there is no object identifier associated with name. - - @return the object identifier associated with name, if present. - - - return the named curve name represented by the given object identifier. - - - returns an enumeration containing the name strings for curves - contained in this structure. - - - From RFC 3657 - - - Produce an object suitable for an Asn1OutputStream. -
    -            BasicOcspResponse       ::= Sequence {
    -                 tbsResponseData      ResponseData,
    -                 signatureAlgorithm   AlgorithmIdentifier,
    -                 signature            BIT STRING,
    -                 certs                [0] EXPLICIT Sequence OF Certificate OPTIONAL }
    -            
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -            CertID          ::=     Sequence {
    -                hashAlgorithm       AlgorithmIdentifier,
    -                issuerNameHash      OCTET STRING, -- Hash of Issuer's DN
    -                issuerKeyHash       OCTET STRING, -- Hash of Issuers public key
    -                serialNumber        CertificateSerialNumber }
    -            
    -
    - - create a CertStatus object with a tag of zero. - - - Produce an object suitable for an Asn1OutputStream. -
    -             CertStatus ::= CHOICE {
    -                             good        [0]     IMPLICIT Null,
    -                             revoked     [1]     IMPLICIT RevokedInfo,
    -                             unknown     [2]     IMPLICIT UnknownInfo }
    -            
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -            CrlID ::= Sequence {
    -                crlUrl               [0]     EXPLICIT IA5String OPTIONAL,
    -                crlNum               [1]     EXPLICIT Integer OPTIONAL,
    -                crlTime              [2]     EXPLICIT GeneralizedTime OPTIONAL }
    -            
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -            OcspRequest     ::=     Sequence {
    -                tbsRequest                  TBSRequest,
    -                optionalSignature   [0]     EXPLICIT Signature OPTIONAL }
    -            
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -            OcspResponse ::= Sequence {
    -                responseStatus         OcspResponseStatus,
    -                responseBytes          [0] EXPLICIT ResponseBytes OPTIONAL }
    -            
    -
    - - The OcspResponseStatus enumeration. -
    -            OcspResponseStatus ::= Enumerated {
    -                successful            (0),  --Response has valid confirmations
    -                malformedRequest      (1),  --Illegal confirmation request
    -                internalError         (2),  --Internal error in issuer
    -                tryLater              (3),  --Try again later
    -                                            --(4) is not used
    -                sigRequired           (5),  --Must sign the request
    -                unauthorized          (6)   --Request unauthorized
    -            }
    -            
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -            Request         ::=     Sequence {
    -                reqCert                     CertID,
    -                singleRequestExtensions     [0] EXPLICIT Extensions OPTIONAL }
    -            
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -            ResponderID ::= CHOICE {
    -                 byName          [1] Name,
    -                 byKey           [2] KeyHash }
    -            
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -            ResponseBytes ::=       Sequence {
    -                responseType   OBJECT IDENTIFIER,
    -                response       OCTET STRING }
    -            
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -            ResponseData ::= Sequence {
    -                version              [0] EXPLICIT Version DEFAULT v1,
    -                responderID              ResponderID,
    -                producedAt               GeneralizedTime,
    -                responses                Sequence OF SingleResponse,
    -                responseExtensions   [1] EXPLICIT Extensions OPTIONAL }
    -            
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -            RevokedInfo ::= Sequence {
    -                 revocationTime              GeneralizedTime,
    -                 revocationReason    [0]     EXPLICIT CRLReason OPTIONAL }
    -            
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -            ServiceLocator ::= Sequence {
    -                issuer    Name,
    -                locator   AuthorityInfoAccessSyntax OPTIONAL }
    -            
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -            Signature       ::=     Sequence {
    -                signatureAlgorithm      AlgorithmIdentifier,
    -                signature               BIT STRING,
    -                certs               [0] EXPLICIT Sequence OF Certificate OPTIONAL}
    -            
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -             SingleResponse ::= Sequence {
    -                     certID                       CertID,
    -                     certStatus                   CertStatus,
    -                     thisUpdate                   GeneralizedTime,
    -                     nextUpdate         [0]       EXPLICIT GeneralizedTime OPTIONAL,
    -                     singleExtensions   [1]       EXPLICIT Extensions OPTIONAL }
    -            
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -            TBSRequest      ::=     Sequence {
    -                version             [0]     EXPLICIT Version DEFAULT v1,
    -                requestorName       [1]     EXPLICIT GeneralName OPTIONAL,
    -                requestList                 Sequence OF Request,
    -                requestExtensions   [2]     EXPLICIT Extensions OPTIONAL }
    -            
    -
    - - class for breaking up an Oid into it's component tokens, ala - java.util.StringTokenizer. We need this class as some of the - lightweight Java environment don't support classes like - StringTokenizer. - - - return an Attribute object from the given object. - - @param o the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -            Attr ::= Sequence {
    -                attrType OBJECT IDENTIFIER,
    -                attrValues Set OF AttributeValue
    -            }
    -            
    -
    - - Pkcs10 Certfication request object. -
    -            CertificationRequest ::= Sequence {
    -              certificationRequestInfo  CertificationRequestInfo,
    -              signatureAlgorithm        AlgorithmIdentifier{{ SignatureAlgorithms }},
    -              signature                 BIT STRING
    -            }
    -            
    -
    - - Pkcs10 CertificationRequestInfo object. -
    -              CertificationRequestInfo ::= Sequence {
    -               version             Integer { v1(0) } (v1,...),
    -               subject             Name,
    -               subjectPKInfo   SubjectPublicKeyInfo{{ PKInfoAlgorithms }},
    -               attributes          [0] Attributes{{ CRIAttributes }}
    -              }
    -            
    -              Attributes { ATTRIBUTE:IOSet } ::= Set OF Attr{{ IOSet }}
    -            
    -              Attr { ATTRIBUTE:IOSet } ::= Sequence {
    -                type    ATTRIBUTE.&id({IOSet}),
    -                values  Set SIZE(1..MAX) OF ATTRIBUTE.&Type({IOSet}{\@type})
    -              }
    -             
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -            ContentInfo ::= Sequence {
    -                     contentType ContentType,
    -                     content
    -                     [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
    -            
    -
    - - The EncryptedData object. -
    -                  EncryptedData ::= Sequence {
    -                       version Version,
    -                       encryptedContentInfo EncryptedContentInfo
    -                  }
    -            
    -            
    -                  EncryptedContentInfo ::= Sequence {
    -                      contentType ContentType,
    -                      contentEncryptionAlgorithm  ContentEncryptionAlgorithmIdentifier,
    -                      encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL
    -                }
    -            
    -                EncryptedContent ::= OCTET STRING
    -             
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -             EncryptedPrivateKeyInfo ::= Sequence {
    -                  encryptionAlgorithm AlgorithmIdentifier {{KeyEncryptionAlgorithms}},
    -                  encryptedData EncryptedData
    -             }
    -            
    -             EncryptedData ::= OCTET STRING
    -            
    -             KeyEncryptionAlgorithms ALGORITHM-IDENTIFIER ::= {
    -                      ... -- For local profiles
    -             }
    -             
    -
    - -
    -            MacData ::= SEQUENCE {
    -                mac      DigestInfo,
    -                macSalt  OCTET STRING,
    -                iterations INTEGER DEFAULT 1
    -                -- Note: The default is for historic reasons and its use is deprecated. A
    -                -- higher value, like 1024 is recommended.
    -            
    - @return the basic DERObject construction. -
    - - the infamous Pfx from Pkcs12 - - - write out an RSA private key with its associated information - as described in Pkcs8. -
    -                  PrivateKeyInfo ::= Sequence {
    -                                          version Version,
    -                                          privateKeyAlgorithm AlgorithmIdentifier {{PrivateKeyAlgorithms}},
    -                                          privateKey PrivateKey,
    -                                          attributes [0] IMPLICIT Attributes OPTIONAL
    -                                      }
    -                  Version ::= Integer {v1(0)} (v1,...)
    -            
    -                  PrivateKey ::= OCTET STRING
    -            
    -                  Attributes ::= Set OF Attr
    -             
    -
    - - The default version - - -
    -              RSAES-OAEP-params ::= SEQUENCE {
    -                 hashAlgorithm      [0] OAEP-PSSDigestAlgorithms     DEFAULT sha1,
    -                 maskGenAlgorithm   [1] PKCS1MGFAlgorithms  DEFAULT mgf1SHA1,
    -                 pSourceAlgorithm   [2] PKCS1PSourceAlgorithms  DEFAULT pSpecifiedEmpty
    -               }
    -            
    -               OAEP-PSSDigestAlgorithms    ALGORITHM-IDENTIFIER ::= {
    -                 { OID id-sha1 PARAMETERS NULL   }|
    -                 { OID id-sha256 PARAMETERS NULL }|
    -                 { OID id-sha384 PARAMETERS NULL }|
    -                 { OID id-sha512 PARAMETERS NULL },
    -                 ...  -- Allows for future expansion --
    -               }
    -               PKCS1MGFAlgorithms    ALGORITHM-IDENTIFIER ::= {
    -                 { OID id-mgf1 PARAMETERS OAEP-PSSDigestAlgorithms },
    -                ...  -- Allows for future expansion --
    -               }
    -               PKCS1PSourceAlgorithms    ALGORITHM-IDENTIFIER ::= {
    -                 { OID id-pSpecified PARAMETERS OCTET STRING },
    -                 ...  -- Allows for future expansion --
    -              }
    -             
    - @return the asn1 primitive representing the parameters. -
    - - This outputs the key in Pkcs1v2 format. -
    -                  RsaPrivateKey ::= Sequence {
    -                                      version Version,
    -                                      modulus Integer, -- n
    -                                      publicExponent Integer, -- e
    -                                      privateExponent Integer, -- d
    -                                      prime1 Integer, -- p
    -                                      prime2 Integer, -- q
    -                                      exponent1 Integer, -- d mod (p-1)
    -                                      exponent2 Integer, -- d mod (q-1)
    -                                      coefficient Integer -- (inverse of q) mod p
    -                                  }
    -            
    -                  Version ::= Integer
    -             
    -

    This routine is written to output Pkcs1 version 0, private keys.

    -
    - - The default version - - -
    -             RSASSA-PSS-params ::= SEQUENCE {
    -               hashAlgorithm      [0] OAEP-PSSDigestAlgorithms  DEFAULT sha1,
    -                maskGenAlgorithm   [1] PKCS1MGFAlgorithms  DEFAULT mgf1SHA1,
    -                saltLength         [2] INTEGER  DEFAULT 20,
    -                trailerField       [3] TrailerField  DEFAULT trailerFieldBC
    -              }
    -            
    -             OAEP-PSSDigestAlgorithms    ALGORITHM-IDENTIFIER ::= {
    -                { OID id-sha1 PARAMETERS NULL   }|
    -                { OID id-sha256 PARAMETERS NULL }|
    -                { OID id-sha384 PARAMETERS NULL }|
    -                { OID id-sha512 PARAMETERS NULL },
    -                ...  -- Allows for future expansion --
    -             }
    -            
    -             PKCS1MGFAlgorithms    ALGORITHM-IDENTIFIER ::= {
    -               { OID id-mgf1 PARAMETERS OAEP-PSSDigestAlgorithms },
    -                ...  -- Allows for future expansion --
    -             }
    -            
    -             TrailerField ::= INTEGER { trailerFieldBC(1) }
    -             
    - @return the asn1 primitive representing the parameters. -
    - - a Pkcs#7 signed data object. - - - Produce an object suitable for an Asn1OutputStream. -
    -             SignedData ::= Sequence {
    -                 version Version,
    -                 digestAlgorithms DigestAlgorithmIdentifiers,
    -                 contentInfo ContentInfo,
    -                 certificates
    -                     [0] IMPLICIT ExtendedCertificatesAndCertificates
    -                              OPTIONAL,
    -                 crls
    -                     [1] IMPLICIT CertificateRevocationLists OPTIONAL,
    -                 signerInfos SignerInfos }
    -            
    -
    - - a Pkcs#7 signer info object. - - - Produce an object suitable for an Asn1OutputStream. -
    -              SignerInfo ::= Sequence {
    -                  version Version,
    -                  issuerAndSerialNumber IssuerAndSerialNumber,
    -                  digestAlgorithm DigestAlgorithmIdentifier,
    -                  authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL,
    -                  digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier,
    -                  encryptedDigest EncryptedDigest,
    -                  unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL
    -              }
    -            
    -              EncryptedDigest ::= OCTET STRING
    -            
    -              DigestAlgorithmIdentifier ::= AlgorithmIdentifier
    -            
    -              DigestEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
    -             
    -
    - - the elliptic curve private key object from SEC 1 - - - ECPrivateKey ::= SEQUENCE { - version INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1), - privateKey OCTET STRING, - parameters [0] Parameters OPTIONAL, - publicKey [1] BIT STRING OPTIONAL } - - - return the X9ECParameters object for the named curve represented by - the passed in object identifier. Null if the curve isn't present. - - @param oid an object identifier representing a named curve, if present. - - - return the object identifier signified by the passed in name. Null - if there is no object identifier associated with name. - - @return the object identifier associated with name, if present. - - - return the named curve name represented by the given object identifier. - - - returns an enumeration containing the name strings for curves - contained in this structure. - - - EllipticCurve OBJECT IDENTIFIER ::= { - iso(1) identified-organization(3) certicom(132) curve(0) - } - - - Handler class for dealing with S/MIME Capabilities - - - general preferences - - - encryption algorithms preferences - - - return an Attr object from the given object. - - @param o the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - returns an ArrayList with 0 or more objects of all the capabilities - matching the passed in capability Oid. If the Oid passed is null the - entire set is returned. - - - Produce an object suitable for an Asn1OutputStream. -
    -            SMIMECapabilities ::= Sequence OF SMIMECapability
    -            
    -
    - - general preferences - - - encryption algorithms preferences - - - Produce an object suitable for an Asn1OutputStream. -
    -            SMIMECapability ::= Sequence {
    -                capabilityID OBJECT IDENTIFIER,
    -                parameters ANY DEFINED BY capabilityID OPTIONAL
    -            }
    -            
    -
    - - Handler for creating a vector S/MIME Capabilities - - - The SmimeEncryptionKeyPreference object. -
    -            SmimeEncryptionKeyPreference ::= CHOICE {
    -                issuerAndSerialNumber   [0] IssuerAndSerialNumber,
    -                receipentKeyId          [1] RecipientKeyIdentifier,
    -                subjectAltKeyIdentifier [2] SubjectKeyIdentifier
    -            }
    -            
    -
    - - @param sKeyId the subjectKeyIdentifier value (normally the X.509 one) - - - elliptic curves defined in "ECC Brainpool Standard Curves and Curve Generation" - http://www.ecc-brainpool.org/download/draft_pkix_additional_ecc_dp.txt - - - return the X9ECParameters object for the named curve represented by - the passed in object identifier. Null if the curve isn't present. - - @param oid an object identifier representing a named curve, if present. - - - return the object identifier signified by the passed in name. Null - if there is no object identifier associated with name. - - @return the object identifier associated with name, if present. - - - return the named curve name represented by the given object identifier. - - - returns an enumeration containing the name strings for curves - contained in this structure. - - -
    -            Accuracy ::= SEQUENCE {
    -                        seconds        INTEGER              OPTIONAL,
    -                        millis     [0] INTEGER  (1..999)    OPTIONAL,
    -                        micros     [1] INTEGER  (1..999)    OPTIONAL
    -                        }
    -            
    -
    - - @param o - @return a MessageImprint object. - - -
    -               MessageImprint ::= SEQUENCE  {
    -                  hashAlgorithm                AlgorithmIdentifier,
    -                  hashedMessage                OCTET STRING  }
    -            
    -
    - -
    -            TimeStampReq ::= SEQUENCE  {
    -             version                      INTEGER  { v1(1) },
    -             messageImprint               MessageImprint,
    -               --a hash algorithm OID and the hash value of the data to be
    -               --time-stamped
    -             reqPolicy             TSAPolicyId              OPTIONAL,
    -             nonce                 INTEGER                  OPTIONAL,
    -             certReq               BOOLEAN                  DEFAULT FALSE,
    -             extensions            [0] IMPLICIT Extensions  OPTIONAL
    -            }
    -            
    -
    - -
    -            TimeStampResp ::= SEQUENCE  {
    -              status                  PkiStatusInfo,
    -              timeStampToken          TimeStampToken     OPTIONAL  }
    -            
    -
    - -
    -            
    -                 TstInfo ::= SEQUENCE  {
    -                    version                      INTEGER  { v1(1) },
    -                    policy                       TSAPolicyId,
    -                    messageImprint               MessageImprint,
    -                      -- MUST have the same value as the similar field in
    -                      -- TimeStampReq
    -                    serialNumber                 INTEGER,
    -                     -- Time-Stamping users MUST be ready to accommodate integers
    -                     -- up to 160 bits.
    -                    genTime                      GeneralizedTime,
    -                    accuracy                     Accuracy                 OPTIONAL,
    -                    ordering                     BOOLEAN             DEFAULT FALSE,
    -                    nonce                        INTEGER                  OPTIONAL,
    -                      -- MUST be present if the similar field was present
    -                      -- in TimeStampReq.  In that case it MUST have the same value.
    -                    tsa                          [0] GeneralName          OPTIONAL,
    -                    extensions                   [1] IMPLICIT Extensions   OPTIONAL  }
    -            
    -             
    -
    - - dump a Der object as a formatted string with indentation - - @param obj the Asn1Object to be dumped out. - - - dump out a DER object as a formatted string, in non-verbose mode - - @param obj the Asn1Encodable to be dumped out. - @return the resulting string. - - - Dump out the object as a string - - @param obj the Asn1Encodable to be dumped out. - @param verbose if true, dump out the contents of octet and bit strings. - @return the resulting string. - - -
    -             DirectoryString ::= CHOICE {
    -               teletexString               TeletexString (SIZE (1..MAX)),
    -               printableString             PrintableString (SIZE (1..MAX)),
    -               universalString             UniversalString (SIZE (1..MAX)),
    -               utf8String                  UTF8String (SIZE (1..MAX)),
    -               bmpString                   BMPString (SIZE (1..MAX))  }
    -            
    -
    - - The AccessDescription object. -
    -            AccessDescription  ::=  SEQUENCE {
    -                  accessMethod          OBJECT IDENTIFIER,
    -                  accessLocation        GeneralName  }
    -            
    -
    - - create an AccessDescription with the oid and location provided. - - - - @return the access method. - - - - @return the access location - - - Produce an object suitable for an Asn1OutputStream. -
    -                 AlgorithmIdentifier ::= Sequence {
    -                                       algorithm OBJECT IDENTIFIER,
    -                                       parameters ANY DEFINED BY algorithm OPTIONAL }
    -            
    -
    - - - Don't use this one if you are trying to be RFC 3281 compliant. - Use it for v1 attribute certificates only. - - Our GeneralNames structure - - - Produce an object suitable for an Asn1OutputStream. -
    -             AttCertIssuer ::= CHOICE {
    -                  v1Form   GeneralNames,  -- MUST NOT be used in this
    -                                          -- profile
    -                  v2Form   [0] V2Form     -- v2 only
    -             }
    -            
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -             AttCertValidityPeriod  ::= Sequence {
    -                  notBeforeTime  GeneralizedTime,
    -                  notAfterTime   GeneralizedTime
    -             }
    -            
    -
    - - return an Attr object from the given object. - - @param o the object we want converted. - @exception ArgumentException if the object cannot be converted. - - - Produce an object suitable for an Asn1OutputStream. -
    -            Attr ::= Sequence {
    -                attrType OBJECT IDENTIFIER,
    -                attrValues Set OF AttributeValue
    -            }
    -            
    -
    - - @param obj - @return - - - Produce an object suitable for an Asn1OutputStream. -
    -             AttributeCertificate ::= Sequence {
    -                  acinfo               AttributeCertificateInfo,
    -                  signatureAlgorithm   AlgorithmIdentifier,
    -                  signatureValue       BIT STRING
    -             }
    -            
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -              AttributeCertificateInfo ::= Sequence {
    -                   version              AttCertVersion -- version is v2,
    -                   holder               Holder,
    -                   issuer               AttCertIssuer,
    -                   signature            AlgorithmIdentifier,
    -                   serialNumber         CertificateSerialNumber,
    -                   attrCertValidityPeriod   AttCertValidityPeriod,
    -                   attributes           Sequence OF Attr,
    -                   issuerUniqueID       UniqueIdentifier OPTIONAL,
    -                   extensions           Extensions OPTIONAL
    -              }
    -            
    -              AttCertVersion ::= Integer { v2(1) }
    -             
    -
    - - The AuthorityInformationAccess object. -
    -             id-pe-authorityInfoAccess OBJECT IDENTIFIER ::= { id-pe 1 }
    -            
    -             AuthorityInfoAccessSyntax  ::=
    -                  Sequence SIZE (1..MAX) OF AccessDescription
    -             AccessDescription  ::=  Sequence {
    -                   accessMethod          OBJECT IDENTIFIER,
    -                   accessLocation        GeneralName  }
    -            
    -             id-ad OBJECT IDENTIFIER ::= { id-pkix 48 }
    -             id-ad-caIssuers OBJECT IDENTIFIER ::= { id-ad 2 }
    -             id-ad-ocsp OBJECT IDENTIFIER ::= { id-ad 1 }
    -             
    -
    - - create an AuthorityInformationAccess with the oid and location provided. - - - The AuthorityKeyIdentifier object. -
    -             id-ce-authorityKeyIdentifier OBJECT IDENTIFIER ::=  { id-ce 35 }
    -            
    -               AuthorityKeyIdentifier ::= Sequence {
    -                  keyIdentifier             [0] IMPLICIT KeyIdentifier           OPTIONAL,
    -                  authorityCertIssuer       [1] IMPLICIT GeneralNames            OPTIONAL,
    -                  authorityCertSerialNumber [2] IMPLICIT CertificateSerialNumber OPTIONAL  }
    -            
    -               KeyIdentifier ::= OCTET STRING
    -             
    - -
    - - * - * Calulates the keyidentifier using a SHA1 hash over the BIT STRING - * from SubjectPublicKeyInfo as defined in RFC2459. - * - * Example of making a AuthorityKeyIdentifier: - *
    -            	     *   SubjectPublicKeyInfo apki = new SubjectPublicKeyInfo((ASN1Sequence)new ASN1InputStream(
    -            		 *       publicKey.getEncoded()).readObject());
    -                     *   AuthorityKeyIdentifier aki = new AuthorityKeyIdentifier(apki);
    -                     * 
    - * - * -
    - - create an AuthorityKeyIdentifier with the GeneralNames tag and - the serial number provided as well. - - - create an AuthorityKeyIdentifier with the GeneralNames tag and - the serial number provided. - - - create an AuthorityKeyIdentifier with a precomputed key identifier - - - create an AuthorityKeyIdentifier with a precomupted key identifier - and the GeneralNames tag and the serial number provided as well. - - - Produce an object suitable for an Asn1OutputStream. - - - create a cA=true object for the given path length constraint. - - @param pathLenConstraint - - - Produce an object suitable for an Asn1OutputStream. -
    -            BasicConstraints := Sequence {
    -               cA                  Boolean DEFAULT FALSE,
    -               pathLenConstraint   Integer (0..MAX) OPTIONAL
    -            }
    -            
    -
    - - PKIX RFC-2459 - - The X.509 v2 CRL syntax is as follows. For signature calculation, - the data that is to be signed is ASN.1 Der encoded. - -
    -             CertificateList  ::=  Sequence  {
    -                  tbsCertList          TbsCertList,
    -                  signatureAlgorithm   AlgorithmIdentifier,
    -                  signatureValue       BIT STRING  }
    -             
    -
    - - This class helps to support crossCerfificatePairs in a LDAP directory - according RFC 2587 - -
    -                 crossCertificatePairATTRIBUTE::={
    -                   WITH SYNTAX   CertificatePair
    -                   EQUALITY MATCHING RULE certificatePairExactMatch
    -                   ID joint-iso-ccitt(2) ds(5) attributeType(4) crossCertificatePair(40)}
    -             
    - -
    The forward elements of the crossCertificatePair attribute of a - CA's directory entry shall be used to store all, except self-issued - certificates issued to this CA. Optionally, the reverse elements of the - crossCertificatePair attribute, of a CA's directory entry may contain a - subset of certificates issued by this CA to other CAs. When both the forward - and the reverse elements are present in a single attribute value, issuer name - in one certificate shall match the subject name in the other and vice versa, - and the subject public key in one certificate shall be capable of verifying - the digital signature on the other certificate and vice versa. - - When a reverse element is present, the forward element value and the reverse - element value need not be stored in the same attribute value; in other words, - they can be stored in either a single attribute value or two attribute - values.
    - -
    -                   CertificatePair ::= SEQUENCE {
    -                     forward		[0]	Certificate OPTIONAL,
    -                     reverse		[1]	Certificate OPTIONAL,
    -                     -- at least one of the pair shall be present -- }
    -             
    -
    - - Constructor from Asn1Sequence. -

    - The sequence is of type CertificatePair: -

    -

    -                   CertificatePair ::= SEQUENCE {
    -                     forward		[0]	Certificate OPTIONAL,
    -                     reverse		[1]	Certificate OPTIONAL,
    -                     -- at least one of the pair shall be present -- }
    -             
    - - @param seq The ASN.1 sequence. -
    - - Constructor from a given details. - - @param forward Certificates issued to this CA. - @param reverse Certificates issued by this CA to other CAs. - - - Produce an object suitable for an Asn1OutputStream. -

    - Returns: -

    -

    -                   CertificatePair ::= SEQUENCE {
    -                     forward		[0]	Certificate OPTIONAL,
    -                     reverse		[1]	Certificate OPTIONAL,
    -                     -- at least one of the pair shall be present -- }
    -             
    - - @return a DERObject -
    - - @return Returns the forward. - - - @return Returns the reverse. - - - Construct a CertificatePolicies object containing one PolicyInformation. - - @param name the name to be contained. - - - Produce an object suitable for an ASN1OutputStream. -
    -            CertificatePolicies ::= SEQUENCE SIZE {1..MAX} OF PolicyInformation
    -            
    -
    - - CertPolicyId, used in the CertificatePolicies and PolicyMappings - X509V3 Extensions. - -
    -                 CertPolicyId ::= OBJECT IDENTIFIER
    -             
    -
    - - Return the distribution points making up the sequence. - - @return DistributionPoint[] - - - Produce an object suitable for an Asn1OutputStream. -
    -            CrlDistPoint ::= Sequence SIZE {1..MAX} OF DistributionPoint
    -            
    -
    - - The CRLNumber object. -
    -            CRLNumber::= Integer(0..MAX)
    -            
    -
    - - The CRLReason enumeration. -
    -            CRLReason ::= Enumerated {
    -             unspecified             (0),
    -             keyCompromise           (1),
    -             cACompromise            (2),
    -             affiliationChanged      (3),
    -             superseded              (4),
    -             cessationOfOperation    (5),
    -             certificateHold         (6),
    -             removeFromCRL           (8),
    -             privilegeWithdrawn      (9),
    -             aACompromise           (10)
    -            }
    -            
    -
    - - The DigestInfo object. -
    -            DigestInfo::=Sequence{
    -                     digestAlgorithm  AlgorithmIdentifier,
    -                     digest OCTET STRING }
    -            
    -
    - - DisplayText class, used in - CertificatePolicies X509 V3 extensions (in policy qualifiers). - -

    It stores a string in a chosen encoding. -

    -             DisplayText ::= CHOICE {
    -                  ia5String        IA5String      (SIZE (1..200)),
    -                  visibleString    VisibleString  (SIZE (1..200)),
    -                  bmpString        BMPString      (SIZE (1..200)),
    -                  utf8String       UTF8String     (SIZE (1..200)) }
    -             

    - @see PolicyQualifierInfo - @see PolicyInformation -
    - - Constant corresponding to ia5String encoding. - - - - Constant corresponding to bmpString encoding. - - - - Constant corresponding to utf8String encoding. - - - - Constant corresponding to visibleString encoding. - - - - Describe constant DisplayTextMaximumSize here. - - - - Creates a new DisplayText instance. - - @param type the desired encoding type for the text. - @param text the text to store. Strings longer than 200 - characters are truncated. - - - Creates a new DisplayText instance. - - @param text the text to encapsulate. Strings longer than 200 - characters are truncated. - - - Creates a new DisplayText instance. -

    Useful when reading back a DisplayText class - from it's Asn1Encodable form.

    - - @param contents an Asn1Encodable instance. -
    - - Returns the stored string object. - - @return the stored text as a string. - - - The DistributionPoint object. -
    -            DistributionPoint ::= Sequence {
    -                 distributionPoint [0] DistributionPointName OPTIONAL,
    -                 reasons           [1] ReasonFlags OPTIONAL,
    -                 cRLIssuer         [2] GeneralNames OPTIONAL
    -            }
    -            
    -
    - - The DistributionPointName object. -
    -            DistributionPointName ::= CHOICE {
    -                fullName                 [0] GeneralNames,
    -                nameRelativeToCRLIssuer  [1] RDN
    -            }
    -            
    -
    - - The extendedKeyUsage object. -
    -                 extendedKeyUsage ::= Sequence SIZE (1..MAX) OF KeyPurposeId
    -            
    -
    - - Returns all extended key usages. - The returned ArrayList contains DerObjectIdentifier instances. - @return An ArrayList with all key purposes. - - - The GeneralName object. -
    -             GeneralName ::= CHOICE {
    -                  otherName                       [0]     OtherName,
    -                  rfc822Name                      [1]     IA5String,
    -                  dNSName                         [2]     IA5String,
    -                  x400Address                     [3]     ORAddress,
    -                  directoryName                   [4]     Name,
    -                  ediPartyName                    [5]     EDIPartyName,
    -                  uniformResourceIdentifier       [6]     IA5String,
    -                  iPAddress                       [7]     OCTET STRING,
    -                  registeredID                    [8]     OBJECT IDENTIFIER}
    -            
    -             OtherName ::= Sequence {
    -                  type-id    OBJECT IDENTIFIER,
    -                  value      [0] EXPLICIT ANY DEFINED BY type-id }
    -            
    -             EDIPartyName ::= Sequence {
    -                  nameAssigner            [0]     DirectoryString OPTIONAL,
    -                  partyName               [1]     DirectoryString }
    -             
    -
    - - When the subjectAltName extension contains an Internet mail address, - the address MUST be included as an rfc822Name. The format of an - rfc822Name is an "addr-spec" as defined in RFC 822 [RFC 822]. - - When the subjectAltName extension contains a domain name service - label, the domain name MUST be stored in the dNSName (an IA5String). - The name MUST be in the "preferred name syntax," as specified by RFC - 1034 [RFC 1034]. - - When the subjectAltName extension contains a URI, the name MUST be - stored in the uniformResourceIdentifier (an IA5String). The name MUST - be a non-relative URL, and MUST follow the URL syntax and encoding - rules specified in [RFC 1738]. The name must include both a scheme - (e.g., "http" or "ftp") and a scheme-specific-part. The scheme- - specific-part must include a fully qualified domain name or IP - address as the host. - - When the subjectAltName extension contains a iPAddress, the address - MUST be stored in the octet string in "network byte order," as - specified in RFC 791 [RFC 791]. The least significant bit (LSB) of - each octet is the LSB of the corresponding byte in the network - address. For IP Version 4, as specified in RFC 791, the octet string - MUST contain exactly four octets. For IP Version 6, as specified in - RFC 1883, the octet string MUST contain exactly sixteen octets [RFC - 1883]. - - - Create a GeneralName for the given tag from the passed in string. -

    - This constructor can handle: -

      -
    • rfc822Name
    • -
    • iPAddress
    • -
    • directoryName
    • -
    • dNSName
    • -
    • uniformResourceIdentifier
    • -
    • registeredID
    • -
    - For x400Address, otherName and ediPartyName there is no common string - format defined. -

    - Note: A directory name can be encoded in different ways into a byte - representation. Be aware of this if the byte representation is used for - comparing results. -

    - - @param tag tag number - @param name string representation of name - @throws ArgumentException if the string encoding is not correct or - not supported. -
    - - Construct a GeneralNames object containing one GeneralName. - The name to be contained. - - - Produce an object suitable for an Asn1OutputStream. -
    -            GeneralNames ::= Sequence SIZE {1..MAX} OF GeneralName
    -            
    -
    - - Class for containing a restriction object subtrees in NameConstraints. See - RFC 3280. - -
    -            
    -                   GeneralSubtree ::= SEQUENCE
    -                   {
    -                     baseName                    GeneralName,
    -                     minimum         [0]     BaseDistance DEFAULT 0,
    -                     maximum         [1]     BaseDistance OPTIONAL
    -                   }
    -             
    - - @see org.bouncycastle.asn1.x509.NameConstraints - -
    - - Constructor from a given details. - - According RFC 3280, the minimum and maximum fields are not used with any - name forms, thus minimum MUST be zero, and maximum MUST be absent. -

    - If minimum is null, zero is assumed, if - maximum is null, maximum is absent.

    - - @param baseName - A restriction. - @param minimum - Minimum - - @param maximum - Maximum -
    - - Produce an object suitable for an Asn1OutputStream. - - Returns: - -
    -                   GeneralSubtree ::= SEQUENCE
    -                   {
    -                     baseName                    GeneralName,
    -                     minimum         [0]     BaseDistance DEFAULT 0,
    -                     maximum         [1]     BaseDistance OPTIONAL
    -                   }
    -             
    - - @return a DERObject -
    - - The Holder object. -

    - For an v2 attribute certificate this is: - -

    -                       Holder ::= SEQUENCE {
    -                             baseCertificateID   [0] IssuerSerial OPTIONAL,
    -                                      -- the issuer and serial number of
    -                                      -- the holder's Public Key Certificate
    -                             entityName          [1] GeneralNames OPTIONAL,
    -                                      -- the name of the claimant or role
    -                             objectDigestInfo    [2] ObjectDigestInfo OPTIONAL
    -                                      -- used to directly authenticate the holder,
    -                                      -- for example, an executable
    -                       }
    -            
    -

    -

    - For an v1 attribute certificate this is: - -

    -                    subject CHOICE {
    -                     baseCertificateID [0] IssuerSerial,
    -                     -- associated with a Public Key Certificate
    -                     subjectName [1] GeneralNames },
    -                     -- associated with a name
    -            
    -

    -
    - - Constructor for a holder for an v1 attribute certificate. - - @param tagObj The ASN.1 tagged holder object. - - - Constructor for a holder for an v2 attribute certificate. * - - @param seq The ASN.1 sequence. - - - Constructs a holder from a IssuerSerial. - @param baseCertificateID The IssuerSerial. - @param version The version of the attribute certificate. - - - Returns 1 for v2 attribute certificates or 0 for v1 attribute - certificates. - @return The version of the attribute certificate. - - - Constructs a holder with an entityName for v2 attribute certificates or - with a subjectName for v1 attribute certificates. - - @param entityName The entity or subject name. - - - Constructs a holder with an entityName for v2 attribute certificates or - with a subjectName for v1 attribute certificates. - - @param entityName The entity or subject name. - @param version The version of the attribute certificate. - - - Constructs a holder from an object digest info. - - @param objectDigestInfo The object digest info object. - - - Returns the entityName for an v2 attribute certificate or the subjectName - for an v1 attribute certificate. - - @return The entityname or subjectname. - - - The Holder object. -
    -             Holder ::= Sequence {
    -                   baseCertificateID   [0] IssuerSerial OPTIONAL,
    -                            -- the issuer and serial number of
    -                            -- the holder's Public Key Certificate
    -                   entityName          [1] GeneralNames OPTIONAL,
    -                            -- the name of the claimant or role
    -                   objectDigestInfo    [2] ObjectDigestInfo OPTIONAL
    -                            -- used to directly authenticate the holder,
    -                            -- for example, an executable
    -             }
    -            
    -
    - - Implementation of IetfAttrSyntax as specified by RFC3281. - - - - - - -
    -            
    -              IetfAttrSyntax ::= Sequence {
    -                policyAuthority [0] GeneralNames OPTIONAL,
    -                values Sequence OF CHOICE {
    -                  octets OCTET STRING,
    -                  oid OBJECT IDENTIFIER,
    -                  string UTF8String
    -                }
    -              }
    -            
    -             
    -
    - - Produce an object suitable for an Asn1OutputStream. -
    -             IssuerSerial  ::=  Sequence {
    -                  issuer         GeneralNames,
    -                  serial         CertificateSerialNumber,
    -                  issuerUid      UniqueIdentifier OPTIONAL
    -             }
    -            
    -
    - -
    -            IssuingDistributionPoint ::= SEQUENCE { 
    -              distributionPoint          [0] DistributionPointName OPTIONAL, 
    -              onlyContainsUserCerts      [1] BOOLEAN DEFAULT FALSE, 
    -              onlyContainsCACerts        [2] BOOLEAN DEFAULT FALSE, 
    -              onlySomeReasons            [3] ReasonFlags OPTIONAL, 
    -              indirectCRL                [4] BOOLEAN DEFAULT FALSE,
    -              onlyContainsAttributeCerts [5] BOOLEAN DEFAULT FALSE }
    -            
    -
    - - Constructor from given details. - - @param distributionPoint - May contain an URI as pointer to most current CRL. - @param onlyContainsUserCerts Covers revocation information for end certificates. - @param onlyContainsCACerts Covers revocation information for CA certificates. - - @param onlySomeReasons - Which revocation reasons does this point cover. - @param indirectCRL - If true then the CRL contains revocation - information about certificates ssued by other CAs. - @param onlyContainsAttributeCerts Covers revocation information for attribute certificates. - - - Constructor from Asn1Sequence - - - @return Returns the distributionPoint. - - - @return Returns the onlySomeReasons. - - - The KeyPurposeID object. -
    -                KeyPurposeID ::= OBJECT IDENTIFIER
    -            
    -
    - - The KeyUsage object. -
    -                id-ce-keyUsage OBJECT IDENTIFIER ::=  { id-ce 15 }
    -            
    -                KeyUsage ::= BIT STRING {
    -                     digitalSignature        (0),
    -                     nonRepudiation          (1),
    -                     keyEncipherment         (2),
    -                     dataEncipherment        (3),
    -                     keyAgreement            (4),
    -                     keyCertSign             (5),
    -                     cRLSign                 (6),
    -                     encipherOnly            (7),
    -                     decipherOnly            (8) }
    -             
    -
    - - Basic constructor. - - @param usage - the bitwise OR of the Key Usage flags giving the - allowed uses for the key. - e.g. (KeyUsage.keyEncipherment | KeyUsage.dataEncipherment) - - - Constructor from a given details. - -

    permitted and excluded are Vectors of GeneralSubtree objects.

    - - @param permitted Permitted subtrees - @param excluded Excluded subtrees -
    - - NoticeReference class, used in - CertificatePolicies X509 V3 extensions - (in policy qualifiers). - -
    -              NoticeReference ::= Sequence {
    -                  organization     DisplayText,
    -                  noticeNumbers    Sequence OF Integer }
    -            
    -             
    - - @see PolicyQualifierInfo - @see PolicyInformation -
    - - Creates a new NoticeReference instance. - - @param orgName a string value - @param numbers a ArrayList value - - - Creates a new NoticeReference instance. - - @param orgName a string value - @param numbers an Asn1Sequence value - - - Creates a new NoticeReference instance. - - @param displayTextType an int value - @param orgName a string value - @param numbers an Asn1Sequence value - - - Creates a new NoticeReference instance. -

    Useful for reconstructing a NoticeReference - instance from its encodable/encoded form.

    - - @param as an Asn1Sequence value obtained from either - calling @{link ToAsn1Object()} for a NoticeReference - instance or from parsing it from a Der-encoded stream. -
    - - Describe ToAsn1Object method here. - - @return a Asn1Object value - - - ObjectDigestInfo ASN.1 structure used in v2 attribute certificates. - -
    -             
    -               ObjectDigestInfo ::= SEQUENCE {
    -                    digestedObjectType  ENUMERATED {
    -                            publicKey            (0),
    -                            publicKeyCert        (1),
    -                            otherObjectTypes     (2) },
    -                                    -- otherObjectTypes MUST NOT
    -                                    -- be used in this profile
    -                    otherObjectTypeID   OBJECT IDENTIFIER OPTIONAL,
    -                    digestAlgorithm     AlgorithmIdentifier,
    -                    objectDigest        BIT STRING
    -               }
    -              
    -            
    - -
    - - The public key is hashed. - - - The public key certificate is hashed. - - - An other object is hashed. - - - Constructor from given details. -

    - If digestedObjectType is not {@link #publicKeyCert} or - {@link #publicKey} otherObjectTypeID must be given, - otherwise it is ignored.

    - - @param digestedObjectType The digest object type. - @param otherObjectTypeID The object type ID for - otherObjectDigest. - @param digestAlgorithm The algorithm identifier for the hash. - @param objectDigest The hash value. -
    - - Produce an object suitable for an Asn1OutputStream. - -
    -             
    -               ObjectDigestInfo ::= SEQUENCE {
    -                    digestedObjectType  ENUMERATED {
    -                            publicKey            (0),
    -                            publicKeyCert        (1),
    -                            otherObjectTypes     (2) },
    -                                    -- otherObjectTypes MUST NOT
    -                                    -- be used in this profile
    -                    otherObjectTypeID   OBJECT IDENTIFIER OPTIONAL,
    -                    digestAlgorithm     AlgorithmIdentifier,
    -                    objectDigest        BIT STRING
    -               }
    -              
    -            
    -
    - - PolicyMappings V3 extension, described in RFC3280. -
    -                PolicyMappings ::= Sequence SIZE (1..MAX) OF Sequence {
    -                  issuerDomainPolicy      CertPolicyId,
    -                  subjectDomainPolicy     CertPolicyId }
    -             
    - - @see RFC 3280, section 4.2.1.6 -
    - - Creates a new PolicyMappings instance. - - @param seq an Asn1Sequence constructed as specified - in RFC 3280 - - - Creates a new PolicyMappings instance. - - @param mappings a HashMap value that maps - string oids - to other string oids. - - - PolicyQualifierId, used in the CertificatePolicies - X509V3 extension. - -
    -                id-qt          OBJECT IDENTIFIER ::=  { id-pkix 2 }
    -                id-qt-cps      OBJECT IDENTIFIER ::=  { id-qt 1 }
    -                id-qt-unotice  OBJECT IDENTIFIER ::=  { id-qt 2 }
    -              PolicyQualifierId ::=
    -                   OBJECT IDENTIFIER ( id-qt-cps | id-qt-unotice )
    -             
    -
    - - Policy qualifiers, used in the X509V3 CertificatePolicies - extension. - -
    -               PolicyQualifierInfo ::= Sequence {
    -                   policyQualifierId  PolicyQualifierId,
    -                   qualifier          ANY DEFINED BY policyQualifierId }
    -             
    -
    - - Creates a new PolicyQualifierInfo instance. - - @param policyQualifierId a PolicyQualifierId value - @param qualifier the qualifier, defined by the above field. - - - Creates a new PolicyQualifierInfo containing a - cPSuri qualifier. - - @param cps the CPS (certification practice statement) uri as a - string. - - - Creates a new PolicyQualifierInfo instance. - - @param as PolicyQualifierInfo X509 structure - encoded as an Asn1Sequence. - - - Returns a Der-encodable representation of this instance. - - @return a Asn1Object value - - - -
    -            PrivateKeyUsagePeriod ::= SEQUENCE
    -            {
    -            notBefore       [0]     GeneralizedTime OPTIONAL,
    -            notAfter        [1]     GeneralizedTime OPTIONAL }
    -            
    -
    -
    - - The BiometricData object. -
    -            BiometricData  ::=  SEQUENCE {
    -                  typeOfBiometricData  TypeOfBiometricData,
    -                  hashAlgorithm        AlgorithmIdentifier,
    -                  biometricDataHash    OCTET STRING,
    -                  sourceDataUri        IA5String OPTIONAL  }
    -            
    -
    - - The Iso4217CurrencyCode object. -
    -            Iso4217CurrencyCode  ::=  CHOICE {
    -                  alphabetic              PrintableString (SIZE 3), --Recommended
    -                  numeric              INTEGER (1..999) }
    -            -- Alphabetic or numeric currency code as defined in ISO 4217
    -            -- It is recommended that the Alphabetic form is used
    -            
    -
    - - The MonetaryValue object. -
    -            MonetaryValue  ::=  SEQUENCE {
    -                  currency              Iso4217CurrencyCode,
    -                  amount               INTEGER,
    -                  exponent             INTEGER }
    -            -- value = amount * 10^exponent
    -            
    -
    - - The QCStatement object. -
    -            QCStatement ::= SEQUENCE {
    -              statementId        OBJECT IDENTIFIER,
    -              statementInfo      ANY DEFINED BY statementId OPTIONAL}
    -            
    -
    - - The SemanticsInformation object. -
    -                   SemanticsInformation ::= SEQUENCE {
    -                     semanticsIdentifier        OBJECT IDENTIFIER   OPTIONAL,
    -                     nameRegistrationAuthorities NameRegistrationAuthorities
    -                                                                     OPTIONAL }
    -                     (WITH COMPONENTS {..., semanticsIdentifier PRESENT}|
    -                      WITH COMPONENTS {..., nameRegistrationAuthorities PRESENT})
    -            
    -                 NameRegistrationAuthorities ::=  SEQUENCE SIZE (1..MAX) OF
    -                     GeneralName
    -             
    -
    - - The TypeOfBiometricData object. -
    -             TypeOfBiometricData ::= CHOICE {
    -               predefinedBiometricType   PredefinedBiometricType,
    -               biometricDataOid          OBJECT IDENTIFIER }
    -            
    -             PredefinedBiometricType ::= INTEGER {
    -               picture(0),handwritten-signature(1)}
    -               (picture|handwritten-signature)
    -             
    -
    - - The ReasonFlags object. -
    -            ReasonFlags ::= BIT STRING {
    -               unused(0),
    -               keyCompromise(1),
    -               cACompromise(2),
    -               affiliationChanged(3),
    -               superseded(4),
    -               cessationOfOperation(5),
    -               certficateHold(6)
    -            }
    -            
    -
    - - @param reasons - the bitwise OR of the Key Reason flags giving the - allowed uses for the key. - - - Implementation of the RoleSyntax object as specified by the RFC3281. - -
    -             RoleSyntax ::= SEQUENCE {
    -                             roleAuthority  [0] GeneralNames OPTIONAL,
    -                             roleName       [1] GeneralName
    -                       }
    -             
    -
    - - RoleSyntax factory method. - @param obj the object used to construct an instance of - RoleSyntax. It must be an instance of RoleSyntax - or Asn1Sequence. - @return the instance of RoleSyntax built from the - supplied object. - @throws java.lang.ArgumentException if the object passed - to the factory is not an instance of RoleSyntax or - Asn1Sequence. - - - Constructor. - @param roleAuthority the role authority of this RoleSyntax. - @param roleName the role name of this RoleSyntax. - - - Constructor. Invoking this constructor is the same as invoking - new RoleSyntax(null, roleName). - @param roleName the role name of this RoleSyntax. - - - Utility constructor. Takes a string argument representing - the role name, builds a GeneralName to hold the role name - and calls the constructor that takes a GeneralName. - @param roleName - - - Constructor that builds an instance of RoleSyntax by - extracting the encoded elements from the Asn1Sequence - object supplied. - @param seq an instance of Asn1Sequence that holds - the encoded elements used to build this RoleSyntax. - - - Gets the role authority of this RoleSyntax. - @return an instance of GeneralNames holding the - role authority of this RoleSyntax. - - - Gets the role name of this RoleSyntax. - @return an instance of GeneralName holding the - role name of this RoleSyntax. - - - Gets the role name as a java.lang.string object. - @return the role name of this RoleSyntax represented as a - string object. - - - Gets the role authority as a string[] object. - @return the role authority of this RoleSyntax represented as a - string[] array. - - - Implementation of the method ToAsn1Object as - required by the superclass ASN1Encodable. - -
    -             RoleSyntax ::= SEQUENCE {
    -                             roleAuthority  [0] GeneralNames OPTIONAL,
    -                             roleName       [1] GeneralName
    -                       }
    -             
    -
    - - This outputs the key in Pkcs1v2 format. -
    -                 RSAPublicKey ::= Sequence {
    -                                     modulus Integer, -- n
    -                                     publicExponent Integer, -- e
    -                                 }
    -            
    -
    - - Structure for a name or pseudonym. - -
    -                  NameOrPseudonym ::= CHOICE {
    -                	   surAndGivenName SEQUENCE {
    -                	     surName DirectoryString,
    -                	     givenName SEQUENCE OF DirectoryString 
    -                    },
    -                	   pseudonym DirectoryString 
    -                  }
    -            
    - - @see org.bouncycastle.asn1.x509.sigi.PersonalData - -
    - - Constructor from DERString. -

    - The sequence is of type NameOrPseudonym: -

    -

    -                  NameOrPseudonym ::= CHOICE {
    -                	   surAndGivenName SEQUENCE {
    -                	     surName DirectoryString,
    -                	     givenName SEQUENCE OF DirectoryString
    -                    },
    -                	   pseudonym DirectoryString
    -                  }
    -            
    - @param pseudonym pseudonym value to use. -
    - - Constructor from Asn1Sequence. -

    - The sequence is of type NameOrPseudonym: -

    -

    -                   NameOrPseudonym ::= CHOICE {
    -                 	   surAndGivenName SEQUENCE {
    -                 	     surName DirectoryString,
    -                 	     givenName SEQUENCE OF DirectoryString
    -                     },
    -                 	   pseudonym DirectoryString
    -                   }
    -             
    - - @param seq The ASN.1 sequence. -
    - - Constructor from a given details. - - @param pseudonym The pseudonym. - - - Constructor from a given details. - - @param surname The surname. - @param givenName A sequence of directory strings making up the givenName - - - Produce an object suitable for an Asn1OutputStream. -

    - Returns: -

    -

    -                   NameOrPseudonym ::= CHOICE {
    -                 	   surAndGivenName SEQUENCE {
    -                 	     surName DirectoryString,
    -                 	     givenName SEQUENCE OF DirectoryString
    -                     },
    -                 	   pseudonym DirectoryString
    -                   }
    -             
    - - @return an Asn1Object -
    - - Contains personal data for the otherName field in the subjectAltNames - extension. -

    -

    -                 PersonalData ::= SEQUENCE {
    -                   nameOrPseudonym NameOrPseudonym,
    -                   nameDistinguisher [0] INTEGER OPTIONAL,
    -                   dateOfBirth [1] GeneralizedTime OPTIONAL,
    -                   placeOfBirth [2] DirectoryString OPTIONAL,
    -                   gender [3] PrintableString OPTIONAL,
    -                   postalAddress [4] DirectoryString OPTIONAL
    -                   }
    -             
    - - @see org.bouncycastle.asn1.x509.sigi.NameOrPseudonym - @see org.bouncycastle.asn1.x509.sigi.SigIObjectIdentifiers -
    - - Constructor from Asn1Sequence. -

    - The sequence is of type NameOrPseudonym: -

    -

    -                 PersonalData ::= SEQUENCE {
    -                   nameOrPseudonym NameOrPseudonym,
    -                   nameDistinguisher [0] INTEGER OPTIONAL,
    -                   dateOfBirth [1] GeneralizedTime OPTIONAL,
    -                   placeOfBirth [2] DirectoryString OPTIONAL,
    -                   gender [3] PrintableString OPTIONAL,
    -                   postalAddress [4] DirectoryString OPTIONAL
    -                   }
    -             
    - - @param seq The ASN.1 sequence. -
    - - Constructor from a given details. - - @param nameOrPseudonym Name or pseudonym. - @param nameDistinguisher Name distinguisher. - @param dateOfBirth Date of birth. - @param placeOfBirth Place of birth. - @param gender Gender. - @param postalAddress Postal Address. - - - Produce an object suitable for an Asn1OutputStream. -

    - Returns: -

    -

    -                 PersonalData ::= SEQUENCE {
    -                   nameOrPseudonym NameOrPseudonym,
    -                   nameDistinguisher [0] INTEGER OPTIONAL,
    -                   dateOfBirth [1] GeneralizedTime OPTIONAL,
    -                   placeOfBirth [2] DirectoryString OPTIONAL,
    -                   gender [3] PrintableString OPTIONAL,
    -                   postalAddress [4] DirectoryString OPTIONAL
    -                   }
    -             
    - - @return an Asn1Object -
    - - Object Identifiers of SigI specifciation (German Signature Law - Interoperability specification). - - - Key purpose IDs for German SigI (Signature Interoperability - Specification) - - - Certificate policy IDs for German SigI (Signature Interoperability - Specification) - - - Other Name IDs for German SigI (Signature Interoperability Specification) - - - To be used for for the generation of directory service certificates. - - - ID for PersonalData - - - Certificate is conform to german signature law. - - - This extension may contain further X.500 attributes of the subject. See also - RFC 3039. - -
    -                 SubjectDirectoryAttributes ::= Attributes
    -                 Attributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
    -                 Attribute ::= SEQUENCE
    -                 {
    -                   type AttributeType
    -                   values SET OF AttributeValue
    -                 }
    -            
    -                 AttributeType ::= OBJECT IDENTIFIER
    -                 AttributeValue ::= ANY DEFINED BY AttributeType
    -             
    - - @see org.bouncycastle.asn1.x509.X509Name for AttributeType ObjectIdentifiers. -
    - - Constructor from Asn1Sequence. - - The sequence is of type SubjectDirectoryAttributes: - -
    -                  SubjectDirectoryAttributes ::= Attributes
    -                  Attributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
    -                  Attribute ::= SEQUENCE
    -                  {
    -                    type AttributeType
    -                    values SET OF AttributeValue
    -                  }
    -            
    -                  AttributeType ::= OBJECT IDENTIFIER
    -                  AttributeValue ::= ANY DEFINED BY AttributeType
    -             
    - - @param seq - The ASN.1 sequence. -
    - - Constructor from an ArrayList of attributes. - - The ArrayList consists of attributes of type {@link Attribute Attribute} - - @param attributes The attributes. - - - - Produce an object suitable for an Asn1OutputStream. - - Returns: - -
    -                  SubjectDirectoryAttributes ::= Attributes
    -                  Attributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
    -                  Attribute ::= SEQUENCE
    -                  {
    -                    type AttributeType
    -                    values SET OF AttributeValue
    -                  }
    -            
    -                  AttributeType ::= OBJECT IDENTIFIER
    -                  AttributeValue ::= ANY DEFINED BY AttributeType
    -             
    - - @return a DERObject -
    - - @return Returns the attributes. - - - The SubjectKeyIdentifier object. -
    -            SubjectKeyIdentifier::= OCTET STRING
    -            
    -
    - - Calculates the keyIdentifier using a SHA1 hash over the BIT STRING - from SubjectPublicKeyInfo as defined in RFC3280. - - @param spki the subject public key info. - - - Return a RFC 3280 type 1 key identifier. As in: -
    -            (1) The keyIdentifier is composed of the 160-bit SHA-1 hash of the
    -            value of the BIT STRING subjectPublicKey (excluding the tag,
    -            length, and number of unused bits).
    -            
    - @param keyInfo the key info object containing the subjectPublicKey field. - @return the key identifier. -
    - - Return a RFC 3280 type 2 key identifier. As in: -
    -            (2) The keyIdentifier is composed of a four bit type field with
    -            the value 0100 followed by the least significant 60 bits of the
    -            SHA-1 hash of the value of the BIT STRING subjectPublicKey.
    -            
    - @param keyInfo the key info object containing the subjectPublicKey field. - @return the key identifier. -
    - - The object that contains the public key stored in a certficate. -

    - The GetEncoded() method in the public keys in the JCE produces a DER - encoded one of these.

    -
    - - for when the public key is an encoded object - if the bitstring - can't be decoded this routine raises an IOException. - - @exception IOException - if the bit string doesn't represent a Der - encoded object. - - - for when the public key is raw bits... - - - Produce an object suitable for an Asn1OutputStream. -
    -            SubjectPublicKeyInfo ::= Sequence {
    -                                     algorithm AlgorithmIdentifier,
    -                                     publicKey BIT STRING }
    -            
    -
    - - Target structure used in target information extension for attribute - certificates from RFC 3281. - -
    -                Target  ::= CHOICE {
    -                  targetName          [0] GeneralName,
    -                  targetGroup         [1] GeneralName,
    -                  targetCert          [2] TargetCert
    -                }
    -            
    - -

    - The targetCert field is currently not supported and must not be used - according to RFC 3281.

    -
    - - Creates an instance of a Target from the given object. -

    - obj can be a Target or a {@link Asn1TaggedObject}

    - - @param obj The object. - @return A Target instance. - @throws ArgumentException if the given object cannot be - interpreted as Target. -
    - - Constructor from Asn1TaggedObject. - - @param tagObj The tagged object. - @throws ArgumentException if the encoding is wrong. - - - Constructor from given details. -

    - Exactly one of the parameters must be not null.

    - - @param type the choice type to apply to the name. - @param name the general name. - @throws ArgumentException if type is invalid. -
    - - @return Returns the targetGroup. - - - @return Returns the targetName. - - - Produce an object suitable for an Asn1OutputStream. - - Returns: - -
    -                Target  ::= CHOICE {
    -                  targetName          [0] GeneralName,
    -                  targetGroup         [1] GeneralName,
    -                  targetCert          [2] TargetCert
    -                }
    -            
    - - @return an Asn1Object -
    - - Target information extension for attributes certificates according to RFC - 3281. - -
    -                      SEQUENCE OF Targets
    -            
    - -
    - - Creates an instance of a TargetInformation from the given object. -

    - obj can be a TargetInformation or a {@link Asn1Sequence}

    - - @param obj The object. - @return A TargetInformation instance. - @throws ArgumentException if the given object cannot be interpreted as TargetInformation. -
    - - Constructor from a Asn1Sequence. - - @param seq The Asn1Sequence. - @throws ArgumentException if the sequence does not contain - correctly encoded Targets elements. - - - Returns the targets in this target information extension. -

    - The ArrayList is cloned before it is returned.

    - - @return Returns the targets. -
    - - Constructs a target information from a single targets element. - According to RFC 3281 only one targets element must be produced. - - @param targets A Targets instance. - - - According to RFC 3281 only one targets element must be produced. If - multiple targets are given they must be merged in - into one targets element. - - @param targets An array with {@link Targets}. - - - Produce an object suitable for an Asn1OutputStream. - - Returns: - -
    -                     SEQUENCE OF Targets
    -            
    - -

    - According to RFC 3281 only one targets element must be produced. If - multiple targets are given in the constructor they are merged into one - targets element. If this was produced from a - {@link Org.BouncyCastle.Asn1.Asn1Sequence} the encoding is kept.

    - - @return an Asn1Object -
    - - Targets structure used in target information extension for attribute - certificates from RFC 3281. - -
    -                       Targets ::= SEQUENCE OF Target
    -                      
    -                       Target  ::= CHOICE {
    -                         targetName          [0] GeneralName,
    -                         targetGroup         [1] GeneralName,
    -                         targetCert          [2] TargetCert
    -                       }
    -                      
    -                       TargetCert  ::= SEQUENCE {
    -                         targetCertificate    IssuerSerial,
    -                         targetName           GeneralName OPTIONAL,
    -                         certDigestInfo       ObjectDigestInfo OPTIONAL
    -                       }
    -            
    - - @see org.bouncycastle.asn1.x509.Target - @see org.bouncycastle.asn1.x509.TargetInformation -
    - - Creates an instance of a Targets from the given object. -

    - obj can be a Targets or a {@link Asn1Sequence}

    - - @param obj The object. - @return A Targets instance. - @throws ArgumentException if the given object cannot be interpreted as Target. -
    - - Constructor from Asn1Sequence. - - @param targets The ASN.1 SEQUENCE. - @throws ArgumentException if the contents of the sequence are - invalid. - - - Constructor from given targets. -

    - The ArrayList is copied.

    - - @param targets An ArrayList of {@link Target}s. - @see Target - @throws ArgumentException if the ArrayList contains not only Targets. -
    - - Returns the targets in an ArrayList. -

    - The ArrayList is cloned before it is returned.

    - - @return Returns the targets. -
    - - Produce an object suitable for an Asn1OutputStream. - - Returns: - -
    -                       Targets ::= SEQUENCE OF Target
    -            
    - - @return an Asn1Object -
    - - The TbsCertificate object. -
    -            TbsCertificate ::= Sequence {
    -                 version          [ 0 ]  Version DEFAULT v1(0),
    -                 serialNumber            CertificateSerialNumber,
    -                 signature               AlgorithmIdentifier,
    -                 issuer                  Name,
    -                 validity                Validity,
    -                 subject                 Name,
    -                 subjectPublicKeyInfo    SubjectPublicKeyInfo,
    -                 issuerUniqueID    [ 1 ] IMPLICIT UniqueIdentifier OPTIONAL,
    -                 subjectUniqueID   [ 2 ] IMPLICIT UniqueIdentifier OPTIONAL,
    -                 extensions        [ 3 ] Extensions OPTIONAL
    -                 }
    -            
    -

    - Note: issuerUniqueID and subjectUniqueID are both deprecated by the IETF. This class - will parse them, but you really shouldn't be creating new ones.

    -
    - - PKIX RFC-2459 - TbsCertList object. -
    -            TbsCertList  ::=  Sequence  {
    -                 version                 Version OPTIONAL,
    -                                              -- if present, shall be v2
    -                 signature               AlgorithmIdentifier,
    -                 issuer                  Name,
    -                 thisUpdate              Time,
    -                 nextUpdate              Time OPTIONAL,
    -                 revokedCertificates     Sequence OF Sequence  {
    -                      userCertificate         CertificateSerialNumber,
    -                      revocationDate          Time,
    -                      crlEntryExtensions      Extensions OPTIONAL
    -                                                    -- if present, shall be v2
    -                                           }  OPTIONAL,
    -                 crlExtensions           [0]  EXPLICIT Extensions OPTIONAL
    -                                                    -- if present, shall be v2
    -                                           }
    -            
    -
    - - creates a time object from a given date - if the date is between 1950 - and 2049 a UTCTime object is Generated, otherwise a GeneralizedTime - is used. - - - - Return our time as DateTime. - - A date time. - - - Produce an object suitable for an Asn1OutputStream. -
    -            Time ::= CHOICE {
    -                        utcTime        UTCTime,
    -                        generalTime    GeneralizedTime }
    -            
    -
    - - UserNotice class, used in - CertificatePolicies X509 extensions (in policy - qualifiers). -
    -             UserNotice ::= Sequence {
    -                  noticeRef        NoticeReference OPTIONAL,
    -                  explicitText     DisplayText OPTIONAL}
    -            
    -             
    - - @see PolicyQualifierId - @see PolicyInformation -
    - - Creates a new UserNotice instance. - - @param noticeRef a NoticeReference value - @param explicitText a DisplayText value - - - Creates a new UserNotice instance. - - @param noticeRef a NoticeReference value - @param str the explicitText field as a string. - - - Creates a new UserNotice instance. -

    Useful from reconstructing a UserNotice instance - from its encodable/encoded form. - - @param as an ASN1Sequence value obtained from either - calling @{link toASN1Object()} for a UserNotice - instance or from parsing it from a DER-encoded stream.

    -
    - - Generator for Version 1 TbsCertificateStructures. -
    -             TbsCertificate ::= Sequence {
    -                  version          [ 0 ]  Version DEFAULT v1(0),
    -                  serialNumber            CertificateSerialNumber,
    -                  signature               AlgorithmIdentifier,
    -                  issuer                  Name,
    -                  validity                Validity,
    -                  subject                 Name,
    -                  subjectPublicKeyInfo    SubjectPublicKeyInfo,
    -                  }
    -             
    - -
    - - Generator for Version 2 AttributeCertificateInfo -
    -             AttributeCertificateInfo ::= Sequence {
    -                   version              AttCertVersion -- version is v2,
    -                   holder               Holder,
    -                   issuer               AttCertIssuer,
    -                   signature            AlgorithmIdentifier,
    -                   serialNumber         CertificateSerialNumber,
    -                   attrCertValidityPeriod   AttCertValidityPeriod,
    -                   attributes           Sequence OF Attr,
    -                   issuerUniqueID       UniqueIdentifier OPTIONAL,
    -                   extensions           Extensions OPTIONAL
    -             }
    -             
    - -
    - - @param attribute - - - Produce an object suitable for an Asn1OutputStream. -
    -             V2Form ::= Sequence {
    -                  issuerName            GeneralNames  OPTIONAL,
    -                  baseCertificateID     [0] IssuerSerial  OPTIONAL,
    -                  objectDigestInfo      [1] ObjectDigestInfo  OPTIONAL
    -                    -- issuerName MUST be present in this profile
    -                    -- baseCertificateID and objectDigestInfo MUST NOT
    -                    -- be present in this profile
    -             }
    -            
    -
    - - Generator for Version 2 TbsCertList structures. -
    -              TbsCertList  ::=  Sequence  {
    -                   version                 Version OPTIONAL,
    -                                                -- if present, shall be v2
    -                   signature               AlgorithmIdentifier,
    -                   issuer                  Name,
    -                   thisUpdate              Time,
    -                   nextUpdate              Time OPTIONAL,
    -                   revokedCertificates     Sequence OF Sequence  {
    -                        userCertificate         CertificateSerialNumber,
    -                        revocationDate          Time,
    -                        crlEntryExtensions      Extensions OPTIONAL
    -                                                      -- if present, shall be v2
    -                                             }  OPTIONAL,
    -                   crlExtensions           [0]  EXPLICIT Extensions OPTIONAL
    -                                                      -- if present, shall be v2
    -                                             }
    -             
    - - Note: This class may be subject to change -
    - - Generator for Version 3 TbsCertificateStructures. -
    -             TbsCertificate ::= Sequence {
    -                  version          [ 0 ]  Version DEFAULT v1(0),
    -                  serialNumber            CertificateSerialNumber,
    -                  signature               AlgorithmIdentifier,
    -                  issuer                  Name,
    -                  validity                Validity,
    -                  subject                 Name,
    -                  subjectPublicKeyInfo    SubjectPublicKeyInfo,
    -                  issuerUniqueID    [ 1 ] IMPLICIT UniqueIdentifier OPTIONAL,
    -                  subjectUniqueID   [ 2 ] IMPLICIT UniqueIdentifier OPTIONAL,
    -                  extensions        [ 3 ] Extensions OPTIONAL
    -                  }
    -             
    - -
    - - an X509Certificate structure. -
    -             Certificate ::= Sequence {
    -                 tbsCertificate          TbsCertificate,
    -                 signatureAlgorithm      AlgorithmIdentifier,
    -                 signature               BIT STRING
    -             }
    -            
    -
    - - The default converter for X509 DN entries when going from their - string value to ASN.1 strings. - - - Apply default conversion for the given value depending on the oid - and the character range of the value. - - @param oid the object identifier for the DN entry - @param value the value associated with it - @return the ASN.1 equivalent for the string value. - - - an object for the elements in the X.509 V3 extension block. - - - Convert the value of the passed in extension to an object. - The extension to parse. - The object the value string contains. - If conversion is not possible. - - - Subject Directory Attributes - - - Subject Key Identifier - - - Key Usage - - - Private Key Usage Period - - - Subject Alternative Name - - - Issuer Alternative Name - - - Basic Constraints - - - CRL Number - - - Reason code - - - Hold Instruction Code - - - Invalidity Date - - - Delta CRL indicator - - - Issuing Distribution Point - - - Certificate Issuer - - - Name Constraints - - - CRL Distribution Points - - - Certificate Policies - - - Policy Mappings - - - Authority Key Identifier - - - Policy Constraints - - - Extended Key Usage - - - Freshest CRL - - - Inhibit Any Policy - - - Authority Info Access - - - Subject Info Access - - - Logo Type - - - BiometricInfo - - - QCStatements - - - Audit identity extension in attribute certificates. - - - NoRevAvail extension in attribute certificates. - - - TargetInformation extension in attribute certificates. - - - Constructor from Asn1Sequence. - - the extensions are a list of constructed sequences, either with (Oid, OctetString) or (Oid, Boolean, OctetString) - - - constructor from a table of extensions. -

    - it's is assumed the table contains Oid/string pairs.

    -
    - - Constructor from a table of extensions with ordering. -

    - It's is assumed the table contains Oid/string pairs.

    -
    - - Constructor from two vectors - - @param objectIDs an ArrayList of the object identifiers. - @param values an ArrayList of the extension values. - - - constructor from a table of extensions. -

    - it's is assumed the table contains Oid/string pairs.

    -
    - - Constructor from a table of extensions with ordering. -

    - It's is assumed the table contains Oid/string pairs.

    -
    - - Constructor from two vectors - - @param objectIDs an ArrayList of the object identifiers. - @param values an ArrayList of the extension values. - - - return an Enumeration of the extension field's object ids. - - - return the extension represented by the object identifier - passed in. - - @return the extension if it's present, null otherwise. - - -
    -                 Extensions        ::=   SEQUENCE SIZE (1..MAX) OF Extension
    -            
    -                 Extension         ::=   SEQUENCE {
    -                    extnId            EXTENSION.&id ({ExtensionSet}),
    -                    critical          BOOLEAN DEFAULT FALSE,
    -                    extnValue         OCTET STRING }
    -             
    -
    - - Generator for X.509 extensions - - - Reset the generator - - - - Add an extension with the given oid and the passed in value to be included - in the OCTET STRING associated with the extension. - - OID for the extension. - True if critical, false otherwise. - The ASN.1 object to be included in the extension. - - - - Add an extension with the given oid and the passed in byte array to be wrapped - in the OCTET STRING associated with the extension. - - OID for the extension. - True if critical, false otherwise. - The byte array to be wrapped. - - - Return true if there are no extension present in this generator. - True if empty, false otherwise - - - Generate an X509Extensions object based on the current state of the generator. - An X509Extensions object - - -
    -                 RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
    -            
    -                 RelativeDistinguishedName ::= SET SIZE (1..MAX) OF AttributeTypeAndValue
    -            
    -                 AttributeTypeAndValue ::= SEQUENCE {
    -                                               type  OBJECT IDENTIFIER,
    -                                               value ANY }
    -             
    -
    - - country code - StringType(SIZE(2)) - - - organization - StringType(SIZE(1..64)) - - - organizational unit name - StringType(SIZE(1..64)) - - - Title - - - common name - StringType(SIZE(1..64)) - - - street - StringType(SIZE(1..64)) - - - device serial number name - StringType(SIZE(1..64)) - - - locality name - StringType(SIZE(1..64)) - - - state, or province name - StringType(SIZE(1..64)) - - - Naming attributes of type X520name - - - businessCategory - DirectoryString(SIZE(1..128) - - - postalCode - DirectoryString(SIZE(1..40) - - - dnQualifier - DirectoryString(SIZE(1..64) - - - RFC 3039 Pseudonym - DirectoryString(SIZE(1..64) - - - RFC 3039 DateOfBirth - GeneralizedTime - YYYYMMDD000000Z - - - RFC 3039 PlaceOfBirth - DirectoryString(SIZE(1..128) - - - RFC 3039 DateOfBirth - PrintableString (SIZE(1)) -- "M", "F", "m" or "f" - - - RFC 3039 CountryOfCitizenship - PrintableString (SIZE (2)) -- ISO 3166 - codes only - - - RFC 3039 CountryOfCitizenship - PrintableString (SIZE (2)) -- ISO 3166 - codes only - - - ISIS-MTT NameAtBirth - DirectoryString(SIZE(1..64) - - - RFC 3039 PostalAddress - SEQUENCE SIZE (1..6) OF - DirectoryString(SIZE(1..30)) - - - RFC 2256 dmdName - - - id-at-telephoneNumber - - - id-at-name - - - Email address (RSA PKCS#9 extension) - IA5String. -

    Note: if you're trying to be ultra orthodox, don't use this! It shouldn't be in here.

    -
    - - more from PKCS#9 - - - email address in Verisign certificates - - - LDAP User id. - - - determines whether or not strings should be processed and printed - from back to front. - - - default look up table translating OID values into their common symbols following - the convention in RFC 2253 with a few extras - - - look up table translating OID values into their common symbols following the convention in RFC 2253 - - - look up table translating OID values into their common symbols following the convention in RFC 1779 - - - - look up table translating common symbols into their OIDS. - - - Return a X509Name based on the passed in tagged object. - - @param obj tag object holding name. - @param explicitly true if explicitly tagged false otherwise. - @return the X509Name - - - Constructor from Asn1Sequence - - the principal will be a list of constructed sets, each containing an (OID, string) pair. - - - Constructor from a table of attributes with ordering. -

    - it's is assumed the table contains OID/string pairs, and the contents - of the table are copied into an internal table as part of the - construction process. The ordering ArrayList should contain the OIDs - in the order they are meant to be encoded or printed in ToString.

    -
    - - Constructor from a table of attributes with ordering. -

    - it's is assumed the table contains OID/string pairs, and the contents - of the table are copied into an internal table as part of the - construction process. The ordering ArrayList should contain the OIDs - in the order they are meant to be encoded or printed in ToString.

    -

    - The passed in converter will be used to convert the strings into their - ASN.1 counterparts.

    -
    - - Takes two vectors one of the oids and the other of the values. - - - Takes two vectors one of the oids and the other of the values. -

    - The passed in converter will be used to convert the strings into their - ASN.1 counterparts.

    -
    - - Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or - some such, converting it into an ordered set of name attributes. - - - Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or - some such, converting it into an ordered set of name attributes with each - string value being converted to its associated ASN.1 type using the passed - in converter. - - - Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or - some such, converting it into an ordered set of name attributes. If reverse - is true, create the encoded version of the sequence starting from the - last element in the string. - - - Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or - some such, converting it into an ordered set of name attributes with each - string value being converted to its associated ASN.1 type using the passed - in converter. If reverse is true the ASN.1 sequence representing the DN will - be built by starting at the end of the string, rather than the start. - - - Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or - some such, converting it into an ordered set of name attributes. lookUp - should provide a table of lookups, indexed by lowercase only strings and - yielding a DerObjectIdentifier, other than that OID. and numeric oids - will be processed automatically. -
    - If reverse is true, create the encoded version of the sequence - starting from the last element in the string. - @param reverse true if we should start scanning from the end (RFC 2553). - @param lookUp table of names and their oids. - @param dirName the X.500 string to be parsed. -
    - - Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or - some such, converting it into an ordered set of name attributes. lookUp - should provide a table of lookups, indexed by lowercase only strings and - yielding a DerObjectIdentifier, other than that OID. and numeric oids - will be processed automatically. The passed in converter is used to convert the - string values to the right of each equals sign to their ASN.1 counterparts. -
    - @param reverse true if we should start scanning from the end, false otherwise. - @param lookUp table of names and oids. - @param dirName the string dirName - @param converter the converter to convert string values into their ASN.1 equivalents -
    - - return an ArrayList of the oids in the name, in the order they were found. - - - return an IList of the oids in the name, in the order they were found. - - - return an ArrayList of the values found in the name, in the order they - were found. - - - return an IList of the values found in the name, in the order they - were found. - - - return an ArrayList of the values found in the name, in the order they - were found, with the DN label corresponding to passed in oid. - - - return an IList of the values found in the name, in the order they - were found, with the DN label corresponding to passed in oid. - - - The X509Name object to test equivalency against. - If true, the order of elements must be the same, - as well as the values associated with each element. - - - test for equivalence - note: case is ignored. - - - convert the structure to a string - if reverse is true the - oids and values are listed out starting with the last element - in the sequence (ala RFC 2253), otherwise the string will begin - with the first element of the structure. If no string definition - for the oid is found in oidSymbols the string value of the oid is - added. Two standard symbol tables are provided DefaultSymbols, and - RFC2253Symbols as part of this class. - - @param reverse if true start at the end of the sequence and work back. - @param oidSymbols look up table strings for oids. - - - * It turns out that the number of standard ways the fields in a DN should be - * encoded into their ASN.1 counterparts is rapidly approaching the - * number of machines on the internet. By default the X509Name class - * will produce UTF8Strings in line with the current recommendations (RFC 3280). - *

    - * An example of an encoder look like below: - *

    -                 * public class X509DirEntryConverter
    -                 *     : X509NameEntryConverter
    -                 * {
    -                 *     public Asn1Object GetConvertedValue(
    -                 *         DerObjectIdentifier  oid,
    -                 *         string               value)
    -                 *     {
    -                 *         if (str.Length() != 0 && str.charAt(0) == '#')
    -                 *         {
    -                 *             return ConvertHexEncoded(str, 1);
    -                 *         }
    -                 *         if (oid.Equals(EmailAddress))
    -                 *         {
    -                 *             return new DerIA5String(str);
    -                 *         }
    -                 *         else if (CanBePrintable(str))
    -                 *         {
    -                 *             return new DerPrintableString(str);
    -                 *         }
    -                 *         else if (CanBeUTF8(str))
    -                 *         {
    -                 *             return new DerUtf8String(str);
    -                 *         }
    -                 *         else
    -                 *         {
    -                 *             return new DerBmpString(str);
    -                 *         }
    -                 *     }
    -                 * }
    -            	 * 
    - *

    -
    - - Convert an inline encoded hex string rendition of an ASN.1 - object back into its corresponding ASN.1 object. - - @param str the hex encoded object - @param off the index at which the encoding starts - @return the decoded object - - - return true if the passed in string can be represented without - loss as a PrintableString, false otherwise. - - - Convert the passed in string value into the appropriate ASN.1 - encoded object. - - @param oid the oid associated with the value in the DN. - @param value the value of the particular DN component. - @return the ASN.1 equivalent for the value. - - - class for breaking up an X500 Name into it's component tokens, ala - java.util.StringTokenizer. We need this class as some of the - lightweight Java environment don't support classes like - StringTokenizer. - - - ASN.1 def for Diffie-Hellman key exchange KeySpecificInfo structure. See - RFC 2631, or X9.42, for further details. - - - Produce an object suitable for an Asn1OutputStream. -
    -             KeySpecificInfo ::= Sequence {
    -                 algorithm OBJECT IDENTIFIER,
    -                 counter OCTET STRING SIZE (4..4)
    -             }
    -            
    -
    - - ANS.1 def for Diffie-Hellman key exchange OtherInfo structure. See - RFC 2631, or X9.42, for further details. - - - Produce an object suitable for an Asn1OutputStream. -
    -             OtherInfo ::= Sequence {
    -                 keyInfo KeySpecificInfo,
    -                 partyAInfo [0] OCTET STRING OPTIONAL,
    -                 suppPubInfo [2] OCTET STRING
    -             }
    -            
    -
    - - table of the current named curves defined in X.962 EC-DSA. - - - return the X9ECParameters object for the named curve represented by - the passed in object identifier. Null if the curve isn't present. - - @param oid an object identifier representing a named curve, if present. - - - return the object identifier signified by the passed in name. Null - if there is no object identifier associated with name. - - @return the object identifier associated with name, if present. - - - return the named curve name represented by the given object identifier. - - - returns an enumeration containing the name strings for curves - contained in this structure. - - - Produce an object suitable for an Asn1OutputStream. -
    -            Parameters ::= CHOICE {
    -               ecParameters ECParameters,
    -               namedCurve   CURVES.&id({CurveNames}),
    -               implicitlyCA Null
    -            }
    -            
    -
    - - ASN.1 def for Elliptic-Curve Curve structure. See - X9.62, for further details. - - - Produce an object suitable for an Asn1OutputStream. -
    -             Curve ::= Sequence {
    -                 a               FieldElement,
    -                 b               FieldElement,
    -                 seed            BIT STRING      OPTIONAL
    -             }
    -            
    -
    - - ASN.1 def for Elliptic-Curve ECParameters structure. See - X9.62, for further details. - - - Produce an object suitable for an Asn1OutputStream. -
    -             ECParameters ::= Sequence {
    -                 version         Integer { ecpVer1(1) } (ecpVer1),
    -                 fieldID         FieldID {{FieldTypes}},
    -                 curve           X9Curve,
    -                 base            X9ECPoint,
    -                 order           Integer,
    -                 cofactor        Integer OPTIONAL
    -             }
    -            
    -
    - - class for describing an ECPoint as a Der object. - - - Produce an object suitable for an Asn1OutputStream. -
    -             ECPoint ::= OCTET STRING
    -            
    -

    - Octet string produced using ECPoint.GetEncoded().

    -
    - - Class for processing an ECFieldElement as a DER object. - - - Produce an object suitable for an Asn1OutputStream. -
    -             FieldElement ::= OCTET STRING
    -            
    -

    -

      -
    1. if q is an odd prime then the field element is - processed as an Integer and converted to an octet string - according to x 9.62 4.3.1.
    2. -
    3. if q is 2m then the bit string - contained in the field element is converted into an octet - string with the same ordering padded at the front if necessary. -
    4. -
    -

    -
    - - ASN.1 def for Elliptic-Curve Field ID structure. See - X9.62, for further details. - - - Constructor for elliptic curves over prime fields - F2. - @param primeP The prime p defining the prime field. - - - Constructor for elliptic curves over binary fields - F2m. - @param m The exponent m of - F2m. - @param k1 The integer k1 where xm + - xk3 + xk2 + xk1 + 1 - represents the reduction polynomial f(z). - @param k2 The integer k2 where xm + - xk3 + xk2 + xk1 + 1 - represents the reduction polynomial f(z). - @param k3 The integer k3 where xm + - xk3 + xk2 + xk1 + 1 - represents the reduction polynomial f(z).. - - - Produce a Der encoding of the following structure. -
    -             FieldID ::= Sequence {
    -                 fieldType       FIELD-ID.&id({IOSet}),
    -                 parameters      FIELD-ID.&Type({IOSet}{@fieldType})
    -             }
    -            
    -
    - - id-dsa-with-sha1 OBJECT IDENTIFIER ::= { iso(1) member-body(2) - us(840) x9-57 (10040) x9cm(4) 3 } - - - X9.63 - - - X9.42 - - -
    -            AttributeTypeAndValue ::= SEQUENCE {
    -                      type         OBJECT IDENTIFIER,
    -                      value        ANY DEFINED BY type }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            CertId ::= SEQUENCE {
    -                            issuer           GeneralName,
    -                            serialNumber     INTEGER }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            CertReqMessages ::= SEQUENCE SIZE (1..MAX) OF CertReqMsg
    -            
    - @return a basic ASN.1 object representation. -
    - - Creates a new CertReqMsg. - @param certReq CertRequest - @param popo may be null - @param regInfo may be null - - -
    -            CertReqMsg ::= SEQUENCE {
    -                               certReq   CertRequest,
    -                               pop       ProofOfPossession  OPTIONAL,
    -                               -- content depends upon key type
    -                               regInfo   SEQUENCE SIZE(1..MAX) OF AttributeTypeAndValue OPTIONAL }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            CertRequest ::= SEQUENCE {
    -                                 certReqId     INTEGER,          -- ID for matching request and reply
    -                                 certTemplate  CertTemplate,  -- Selected fields of cert to be issued
    -                                 controls      Controls OPTIONAL }   -- Attributes affecting issuance
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -             CertTemplate ::= SEQUENCE {
    -                 version      [0] Version               OPTIONAL,
    -                 serialNumber [1] INTEGER               OPTIONAL,
    -                 signingAlg   [2] AlgorithmIdentifier   OPTIONAL,
    -                 issuer       [3] Name                  OPTIONAL,
    -                 validity     [4] OptionalValidity      OPTIONAL,
    -                 subject      [5] Name                  OPTIONAL,
    -                 publicKey    [6] SubjectPublicKeyInfo  OPTIONAL,
    -                 issuerUID    [7] UniqueIdentifier      OPTIONAL,
    -                 subjectUID   [8] UniqueIdentifier      OPTIONAL,
    -                 extensions   [9] Extensions            OPTIONAL }
    -            
    - @return a basic ASN.1 object representation. -
    - - Sets the X.509 version. Note: for X509v3, use 2 here. - - - Sets the issuer unique ID (deprecated in X.509v3) - - - Sets the subject unique ID (deprecated in X.509v3) - - -
    -             CertTemplate ::= SEQUENCE {
    -                 version      [0] Version               OPTIONAL,
    -                 serialNumber [1] INTEGER               OPTIONAL,
    -                 signingAlg   [2] AlgorithmIdentifier   OPTIONAL,
    -                 issuer       [3] Name                  OPTIONAL,
    -                 validity     [4] OptionalValidity      OPTIONAL,
    -                 subject      [5] Name                  OPTIONAL,
    -                 publicKey    [6] SubjectPublicKeyInfo  OPTIONAL,
    -                 issuerUID    [7] UniqueIdentifier      OPTIONAL,
    -                 subjectUID   [8] UniqueIdentifier      OPTIONAL,
    -                 extensions   [9] Extensions            OPTIONAL }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            Controls  ::= SEQUENCE SIZE(1..MAX) OF AttributeTypeAndValue
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            EncKeyWithID ::= SEQUENCE {
    -                 privateKey           PrivateKeyInfo,
    -                 identifier CHOICE {
    -                    string               UTF8String,
    -                    generalName          GeneralName
    -                } OPTIONAL
    -            }
    -            
    - @return -
    - -
    -               EncryptedKey ::= CHOICE {
    -                   encryptedValue        EncryptedValue, -- deprecated
    -                   envelopedData     [0] EnvelopedData }
    -                   -- The encrypted private key MUST be placed in the envelopedData
    -                   -- encryptedContentInfo encryptedContent OCTET STRING.
    -            
    -
    - -
    -            EncryptedValue ::= SEQUENCE {
    -                                intendedAlg   [0] AlgorithmIdentifier  OPTIONAL,
    -                                -- the intended algorithm for which the value will be used
    -                                symmAlg       [1] AlgorithmIdentifier  OPTIONAL,
    -                                -- the symmetric algorithm used to encrypt the value
    -                                encSymmKey    [2] BIT STRING           OPTIONAL,
    -                                -- the (encrypted) symmetric key used to encrypt the value
    -                                keyAlg        [3] AlgorithmIdentifier  OPTIONAL,
    -                                -- algorithm used to encrypt the symmetric key
    -                                valueHint     [4] OCTET STRING         OPTIONAL,
    -                                -- a brief description or identifier of the encValue content
    -                                -- (may be meaningful only to the sending entity, and used only
    -                                -- if EncryptedValue might be re-examined by the sending entity
    -                                -- in the future)
    -                                encValue       BIT STRING }
    -                                -- the encrypted value itself
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            OptionalValidity ::= SEQUENCE {
    -                                   notBefore  [0] Time OPTIONAL,
    -                                   notAfter   [1] Time OPTIONAL } --at least one MUST be present
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -             PkiArchiveOptions ::= CHOICE {
    -                 encryptedPrivKey     [0] EncryptedKey,
    -                 -- the actual value of the private key
    -                 keyGenParameters     [1] KeyGenParameters,
    -                 -- parameters which allow the private key to be re-generated
    -                 archiveRemGenPrivKey [2] BOOLEAN }
    -                 -- set to TRUE if sender wishes receiver to archive the private
    -                 -- key of a key pair that the receiver generates in response to
    -                 -- this request; set to FALSE if no archival is desired.
    -            
    -
    - -
    -            PkiPublicationInfo ::= SEQUENCE {
    -                             action     INTEGER {
    -                                            dontPublish (0),
    -                                            pleasePublish (1) },
    -                             pubInfos  SEQUENCE SIZE (1..MAX) OF SinglePubInfo OPTIONAL }
    -            -- pubInfos MUST NOT be present if action is "dontPublish"
    -            -- (if action is "pleasePublish" and pubInfos is omitted,
    -            -- "dontCare" is assumed)
    -            
    - @return a basic ASN.1 object representation. -
    - - Password-based MAC value for use with POPOSigningKeyInput. - - - Creates a new PKMACValue. - @param params parameters for password-based MAC - @param value MAC of the DER-encoded SubjectPublicKeyInfo - - - Creates a new PKMACValue. - @param aid CMPObjectIdentifiers.passwordBasedMAC, with PBMParameter - @param value MAC of the DER-encoded SubjectPublicKeyInfo - - -
    -            PKMACValue ::= SEQUENCE {
    -                 algId  AlgorithmIdentifier,
    -                 -- algorithm value shall be PasswordBasedMac 1.2.840.113533.7.66.13
    -                 -- parameter value is PBMParameter
    -                 value  BIT STRING }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            PopoPrivKey ::= CHOICE {
    -                   thisMessage       [0] BIT STRING,         -- Deprecated
    -                    -- possession is proven in this message (which contains the private
    -                    -- key itself (encrypted for the CA))
    -                   subsequentMessage [1] SubsequentMessage,
    -                    -- possession will be proven in a subsequent message
    -                   dhMAC             [2] BIT STRING,         -- Deprecated
    -                   agreeMAC          [3] PKMACValue,
    -                   encryptedKey      [4] EnvelopedData }
    -            
    -
    - - Creates a new Proof of Possession object for a signing key. - @param poposkIn the PopoSigningKeyInput structure, or null if the - CertTemplate includes both subject and publicKey values. - @param aid the AlgorithmIdentifier used to sign the proof of possession. - @param signature a signature over the DER-encoded value of poposkIn, - or the DER-encoded value of certReq if poposkIn is null. - - -
    -            PopoSigningKey ::= SEQUENCE {
    -                                 poposkInput           [0] PopoSigningKeyInput OPTIONAL,
    -                                 algorithmIdentifier   AlgorithmIdentifier,
    -                                 signature             BIT STRING }
    -             -- The signature (using "algorithmIdentifier") is on the
    -             -- DER-encoded value of poposkInput.  NOTE: If the CertReqMsg
    -             -- certReq CertTemplate contains the subject and publicKey values,
    -             -- then poposkInput MUST be omitted and the signature MUST be
    -             -- computed on the DER-encoded value of CertReqMsg certReq.  If
    -             -- the CertReqMsg certReq CertTemplate does not contain the public
    -             -- key and subject values, then poposkInput MUST be present and
    -             -- MUST be signed.  This strategy ensures that the public key is
    -             -- not present in both the poposkInput and CertReqMsg certReq
    -             -- CertTemplate fields.
    -            
    - @return a basic ASN.1 object representation. -
    - - Creates a new PopoSigningKeyInput with sender name as authInfo. - - - Creates a new PopoSigningKeyInput using password-based MAC. - - - Returns the sender field, or null if authInfo is publicKeyMac - - - Returns the publicKeyMac field, or null if authInfo is sender - - -
    -            PopoSigningKeyInput ::= SEQUENCE {
    -                   authInfo             CHOICE {
    -                                            sender              [0] GeneralName,
    -                                            -- used only if an authenticated identity has been
    -                                            -- established for the sender (e.g., a DN from a
    -                                            -- previously-issued and currently-valid certificate
    -                                            publicKeyMac        PKMacValue },
    -                                            -- used if no authenticated GeneralName currently exists for
    -                                            -- the sender; publicKeyMac contains a password-based MAC
    -                                            -- on the DER-encoded value of publicKey
    -                   publicKey           SubjectPublicKeyInfo }  -- from CertTemplate
    -            
    - @return a basic ASN.1 object representation. -
    - - Creates a ProofOfPossession with type raVerified. - - - Creates a ProofOfPossession for a signing key. - - - Creates a ProofOfPossession for key encipherment or agreement. - @param type one of TYPE_KEY_ENCIPHERMENT or TYPE_KEY_AGREEMENT - - -
    -            ProofOfPossession ::= CHOICE {
    -                                      raVerified        [0] NULL,
    -                                      -- used if the RA has already verified that the requester is in
    -                                      -- possession of the private key
    -                                      signature         [1] PopoSigningKey,
    -                                      keyEncipherment   [2] PopoPrivKey,
    -                                      keyAgreement      [3] PopoPrivKey }
    -            
    - @return a basic ASN.1 object representation. -
    - -
    -            SinglePubInfo ::= SEQUENCE {
    -                   pubMethod    INTEGER {
    -                      dontCare    (0),
    -                      x500        (1),
    -                      web         (2),
    -                      ldap        (3) },
    -                  pubLocation  GeneralName OPTIONAL }
    -            
    - @return a basic ASN.1 object representation. -
    - - reader for Base64 armored objects - read the headers and then start returning - bytes when the data is reached. An IOException is thrown if the CRC check - fails. - - - decode the base 64 encoded input data. - - @return the offset the data starts in out. - - - Create a stream for reading a PGP armoured message, parsing up to a header - and then reading the data that follows. - - @param input - - - Create an armoured input stream which will assume the data starts - straight away, or parse for headers first depending on the value of - hasHeaders. - - @param input - @param hasHeaders true if headers are to be looked for, false otherwise. - - - @return true if we are inside the clear text section of a PGP - signed message. - - - @return true if the stream is actually at end of file. - - - Return the armor header line (if there is one) - @return the armor header line, null if none present. - - - Return the armor headers (the lines after the armor header line), - @return an array of armor headers, null if there aren't any. - - - Basic output stream. - - - encode the input data producing a base 64 encoded byte array. - - - Set an additional header entry. - - @param name the name of the header entry. - @param v the value of the header entry. - - - Reset the headers to only contain a Version string. - - - Start a clear text signed message. - @param hashAlgorithm - - - Note: close does nor close the underlying stream. So it is possible to write - multiple objects using armoring to a single stream. - - - Basic type for a image attribute packet. - - - Reader for PGP objects. - - - Returns the next packet tag in the stream. - - - - A stream that overlays our input stream, allowing the user to only read a segment of it. - NB: dataLength will be negative if the segment length is in the upper range above 2**31. - - - - Base class for a PGP object. - - - Basic output stream. - - - Create a stream representing a general packet. - Output stream to write to. - - - Create a stream representing an old style partial object. - Output stream to write to. - The packet tag for the object. - - - Create a stream representing a general packet. - Output stream to write to. - Packet tag. - Size of chunks making up the packet. - If true, the header is written out in old format. - - - Create a new style partial input stream buffered into chunks. - Output stream to write to. - Packet tag. - Size of chunks making up the packet. - - - Create a new style partial input stream buffered into chunks. - Output stream to write to. - Packet tag. - Buffer to use for collecting chunks. - - - Flush the underlying stream. - - - Finish writing out the current packet without closing the underlying stream. - - - Generic compressed data object. - - - The algorithm tag value. - - - Basic tags for compression algorithms. - - - Basic type for a PGP packet. - - - Base class for a DSA public key. - - - The stream to read the packet from. - - - The format, as a string, always "PGP". - - - Return the standard PGP encoding of the key. - - - Base class for a DSA secret key. - - - @param in - - - The format, as a string, always "PGP". - - - Return the standard PGP encoding of the key. - - - @return x - - - Base class for an ElGamal public key. - - - The format, as a string, always "PGP". - - - Return the standard PGP encoding of the key. - - - Base class for an ElGamal secret key. - - - @param in - - - @param x - - - The format, as a string, always "PGP". - - - Return the standard PGP encoding of the key. - - - Basic packet for an experimental packet. - - - Basic tags for hash algorithms. - - - Base interface for a PGP key. - - - - The base format for this key - in the case of the symmetric keys it will generally - be raw indicating that the key is just a straight byte representation, for an asymmetric - key the format will be PGP, indicating the key is a string of MPIs encoded in PGP format. - - "RAW" or "PGP". - - - Note: you can only read from this once... - - - Generic literal data packet. - - - The format tag value. - - - The modification time of the file in milli-seconds (since Jan 1, 1970 UTC) - - - Basic type for a marker packet. - - - Basic packet for a modification detection code packet. - - - A multiple precision integer - - - Generic signature object - - - The encryption algorithm tag. - - - The hash algorithm tag. - - - Basic PGP packet tag types. - - - Public Key Algorithm tag numbers. - - - Basic packet for a PGP public key. - - - Basic packet for a PGP public key. - - - Construct a version 4 public key packet. - - - Basic packet for a PGP public subkey - - - Construct a version 4 public subkey packet. - - - Base class for an RSA public key. - - - Construct an RSA public key from the passed in stream. - - - The modulus. - The public exponent. - - - The format, as a string, always "PGP". - - - Return the standard PGP encoding of the key. - - - Base class for an RSA secret (or priate) key. - - - The format, as a string, always "PGP". - - - Return the standard PGP encoding of the key. - - - The string to key specifier class. - - - The hash algorithm. - - - The IV for the key generation algorithm. - - - The iteration count - - - The protection mode - only if GnuDummyS2K - - - Basic packet for a PGP secret key. - - - Basic packet for a PGP secret key. - - - Generic signature packet. - - - Generate a version 4 signature packet. - - @param signatureType - @param keyAlgorithm - @param hashAlgorithm - @param hashedData - @param unhashedData - @param fingerprint - @param signature - - - Generate a version 2/3 signature packet. - - @param signatureType - @param keyAlgorithm - @param hashAlgorithm - @param fingerprint - @param signature - - - return the keyId - @return the keyId that created the signature. - - - return the signature trailer that must be included with the data - to reconstruct the signature - - @return byte[] - - - * return the signature as a set of integers - note this is normalised to be the - * ASN.1 encoding of what appears in the signature packet. - - - Return the byte encoding of the signature section. - @return uninterpreted signature bytes. - - - Return the creation time in milliseconds since 1 Jan., 1970 UTC. - - - Basic type for a PGP Signature sub-packet. - - - Return the generic data making up the packet. - - - reader for signature sub-packets - - - Basic PGP signature sub-packet tag types. - - - Packet embedded signature - - - packet giving signature creation time. - - - packet giving signature creation time. - - - packet giving time after creation at which the key expires. - - - Return the number of seconds after creation time a key is valid for. - - @return second count for key validity. - - - Packet holding the key flag values. - - - - Return the flag values contained in the first 4 octets (note: at the moment - the standard only uses the first one). - - - - Class provided a NotationData object according to - RFC2440, Chapter 5.2.3.15. Notation Data - - - packet giving signature creation time. - - - packet giving whether or not the signature is signed using the primary user ID for the key. - - - packet giving whether or not is revocable. - - - packet giving signature creation time. - - - packet giving signature expiration time. - - - return time in seconds before signature expires after creation time. - - - packet giving the User ID of the signer. - - - packet giving trust. - - - Basic type for a symmetric key encrypted packet. - - - Basic tags for symmetric key algorithms - - - Basic type for a symmetric encrypted session key packet - - - @return int - - - @return S2k - - - @return byte[] - - - @return int - - - Basic type for a trust packet. - - - Basic type for a user attribute packet. - - - Basic type for a user attribute sub-packet. - - - return the generic data making up the packet. - - - reader for user attribute sub-packets - - - Basic PGP user attribute sub-packet tag types. - - - Basic type for a user ID packet. - - - Compressed data objects - - - The algorithm used for compression - - - Get the raw input stream contained in the object. - - - Return an uncompressed input stream which allows reading of the compressed data. - - - Class for producing compressed data packets. - - - -

    - Return an output stream which will save the data being written to - the compressed object. -

    -

    - The stream created can be closed off by either calling Close() - on the stream or Close() on the generator. Closing the returned - stream does not close off the Stream parameter outStr. -

    -
    - Stream to be used for output. - A Stream for output of the compressed data. - - - -
    - - -

    - Return an output stream which will compress the data as it is written to it. - The stream will be written out in chunks according to the size of the passed in buffer. -

    -

    - The stream created can be closed off by either calling Close() - on the stream or Close() on the generator. Closing the returned - stream does not close off the Stream parameter outStr. -

    -

    - Note: if the buffer is not a power of 2 in length only the largest power of 2 - bytes worth of the buffer will be used. -

    -

    - Note: using this may break compatibility with RFC 1991 compliant tools. - Only recent OpenPGP implementations are capable of accepting these streams. -

    -
    - Stream to be used for output. - The buffer to use. - A Stream for output of the compressed data. - - - - -
    - - Close the compressed object.summary> - - - - Thrown if the IV at the start of a data stream indicates the wrong key is being used. - - - - Return the raw input stream for the data stream. - - - Return true if the message is integrity protected. - True, if there is a modification detection code namespace associated - with this stream. - - - Note: This can only be called after the message has been read. - True, if the message verifies, false otherwise - - - Generator for encrypted objects. - - - Existing SecureRandom constructor. - The symmetric algorithm to use. - Source of randomness. - - - Creates a cipher stream which will have an integrity packet associated with it. - - - Base constructor. - The symmetric algorithm to use. - Source of randomness. - PGP 2.6.x compatibility required. - - - - Add a PBE encryption method to the encrypted object using the default algorithm (S2K_SHA1). - - - - Add a PBE encryption method to the encrypted object. - - - Add a public key encrypted session key to the encrypted object. - - - -

    - If buffer is non null stream assumed to be partial, otherwise the length will be used - to output a fixed length packet. -

    -

    - The stream created can be closed off by either calling Close() - on the stream or Close() on the generator. Closing the returned - stream does not close off the Stream parameter outStr. -

    -
    -
    - - -

    - Return an output stream which will encrypt the data as it is written to it. -

    -

    - The stream created can be closed off by either calling Close() - on the stream or Close() on the generator. Closing the returned - stream does not close off the Stream parameter outStr. -

    -
    -
    - - -

    - Return an output stream which will encrypt the data as it is written to it. - The stream will be written out in chunks according to the size of the passed in buffer. -

    -

    - The stream created can be closed off by either calling Close() - on the stream or Close() on the generator. Closing the returned - stream does not close off the Stream parameter outStr. -

    -

    - Note: if the buffer is not a power of 2 in length only the largest power of 2 - bytes worth of the buffer will be used. -

    -
    -
    - - -

    - Close off the encrypted object - this is equivalent to calling Close() on the stream - returned by the Open() method. -

    -

    - Note: This does not close the underlying output stream, only the stream on top of - it created by the Open() method. -

    -
    -
    - - A holder for a list of PGP encryption method packets. - - - Generic exception class for PGP encoding/decoding problems. - - - Key flag values for the KeyFlags subpacket. - - - - General class to handle JCA key pairs and convert them into OpenPGP ones. -

    - A word for the unwary, the KeyId for an OpenPGP public key is calculated from - a hash that includes the time of creation, if you pass a different date to the - constructor below with the same public private key pair the KeyIs will not be the - same as for previous generations of the key, so ideally you only want to do - this once. -

    -
    -
    - - Create a key pair from a PgpPrivateKey and a PgpPublicKey. - The public key. - The private key. - - - The keyId associated with this key pair. - - - - Generator for a PGP master and subkey ring. - This class will generate both the secret and public key rings - - - - - Create a new key ring generator using old style checksumming. It is recommended to use - SHA1 checksumming where possible. - - The certification level for keys on this ring. - The master key pair. - The id to be associated with the ring. - The algorithm to be used to protect secret keys. - The passPhrase to be used to protect secret keys. - Packets to be included in the certification hash. - Packets to be attached unhashed to the certification. - input secured random. - - - - Create a new key ring generator. - - The certification level for keys on this ring. - The master key pair. - The id to be associated with the ring. - The algorithm to be used to protect secret keys. - The passPhrase to be used to protect secret keys. - Checksum the secret keys with SHA1 rather than the older 16 bit checksum. - Packets to be included in the certification hash. - Packets to be attached unhashed to the certification. - input secured random. - - - Add a subkey to the key ring to be generated with default certification. - - - - Add a subkey with specific hashed and unhashed packets associated with it and - default certification. - - Public/private key pair. - Hashed packet values to be included in certification. - Unhashed packets values to be included in certification. - - - - Return the secret key ring. - - - Return the public key ring that corresponds to the secret key ring. - - - - Thrown if the key checksum is invalid. - - - - Class for processing literal data objects. - - - The special name indicating a "for your eyes only" packet. - - - The format of the data stream - Binary or Text - - - The file name that's associated with the data stream. - - - Return the file name as an unintrepreted byte array. - - - The modification time for the file. - - - The raw input stream for the data stream. - - - The input stream representing the data stream. - - - Class for producing literal data packets. - - - The special name indicating a "for your eyes only" packet. - - - - Generates literal data objects in the old format. - This is important if you need compatibility with PGP 2.6.x. - - If true, uses old format. - - - -

    - Open a literal data packet, returning a stream to store the data inside the packet. -

    -

    - The stream created can be closed off by either calling Close() - on the stream or Close() on the generator. Closing the returned - stream does not close off the Stream parameter outStr. -

    -
    - The stream we want the packet in. - The format we are using. - The name of the 'file'. - The length of the data we will write. - The time of last modification we want stored. -
    - - -

    - Open a literal data packet, returning a stream to store the data inside the packet, - as an indefinite length stream. The stream is written out as a series of partial - packets with a chunk size determined by the size of the passed in buffer. -

    -

    - The stream created can be closed off by either calling Close() - on the stream or Close() on the generator. Closing the returned - stream does not close off the Stream parameter outStr. -

    -

    - Note: if the buffer is not a power of 2 in length only the largest power of 2 - bytes worth of the buffer will be used.

    -
    - The stream we want the packet in. - The format we are using. - The name of the 'file'. - The time of last modification we want stored. - The buffer to use for collecting data to put into chunks. -
    - - -

    - Open a literal data packet for the passed in FileInfo object, returning - an output stream for saving the file contents. -

    -

    - The stream created can be closed off by either calling Close() - on the stream or Close() on the generator. Closing the returned - stream does not close off the Stream parameter outStr. -

    -
    - The stream we want the packet in. - The format we are using. - The FileInfo object containg the packet details. -
    - - - Close the literal data packet - this is equivalent to calling Close() - on the stream returned by the Open() method. - - - - - A PGP marker packet - in general these should be ignored other than where - the idea is to preserve the original input stream. - - - - - General class for reading a PGP object stream. -

    - Note: if this class finds a PgpPublicKey or a PgpSecretKey it - will create a PgpPublicKeyRing, or a PgpSecretKeyRing for each - key found. If all you are trying to do is read a key ring file use - either PgpPublicKeyRingBundle or PgpSecretKeyRingBundle.

    -
    -
    - - Return the next object in the stream, or null if the end is reached. - On a parse error - - - - Return all available objects in a list. - - An IList containing all objects from this factory, in order. - - - A one pass signature object. - - - Initialise the signature object for verification. - - - Verify the calculated signature against the passed in PgpSignature. - - - Holder for a list of PgpOnePassSignature objects. - - - A password based encryption object. - - - Return the raw input stream for the data stream. - - - Return the decrypted input stream, using the passed in passphrase. - - - General class to contain a private key for use with other OpenPGP objects. - - - - Create a PgpPrivateKey from a regular private key and the ID of its - associated public key. - - Private key to use. - ID of the corresponding public key. - - - The keyId associated with the contained private key. - - - The contained private key. - - - General class to handle a PGP public key object. - - - - Create a PgpPublicKey from the passed in lightweight one. - - - Note: the time passed in affects the value of the key's keyId, so you probably only want - to do this once for a lightweight key, or make sure you keep track of the time you used. - - Asymmetric algorithm type representing the public key. - Actual public key to associate. - Date of creation. - If pubKey is not public. - On key creation problem. - - - Constructor for a sub-key. - - - Copy constructor. - The public key to copy. - - - The version of this key. - - - The creation time of this key. - - - The number of valid days from creation time - zero means no expiry. - - - Return the trust data associated with the public key, if present. - A byte array with trust data, null otherwise. - - - The number of valid seconds from creation time - zero means no expiry. - - - The keyId associated with the public key. - - - The fingerprint of the key - - - - Check if this key has an algorithm type that makes it suitable to use for encryption. - - - Note: with version 4 keys KeyFlags subpackets should also be considered when present for - determining the preferred use of the key. - - - true if this key algorithm is suitable for encryption. - - - - True, if this is a master key. - - - The algorithm code associated with the public key. - - - The strength of the key in bits. - - - The public key contained in the object. - A lightweight public key. - If the key algorithm is not recognised. - - - Allows enumeration of any user IDs associated with the key. - An IEnumerable of string objects. - - - Allows enumeration of any user attribute vectors associated with the key. - An IEnumerable of PgpUserAttributeSubpacketVector objects. - - - Allows enumeration of any signatures associated with the passed in id. - The ID to be matched. - An IEnumerable of PgpSignature objects. - - - Allows enumeration of signatures associated with the passed in user attributes. - The vector of user attributes to be matched. - An IEnumerable of PgpSignature objects. - - - Allows enumeration of signatures of the passed in type that are on this key. - The type of the signature to be returned. - An IEnumerable of PgpSignature objects. - - - Allows enumeration of all signatures/certifications associated with this key. - An IEnumerable with all signatures/certifications. - - - Check whether this (sub)key has a revocation signature on it. - True, if this (sub)key has been revoked. - - - Add a certification for an id to the given public key. - The key the certification is to be added to. - The ID the certification is associated with. - The new certification. - The re-certified key. - - - Add a certification for the given UserAttributeSubpackets to the given public key. - The key the certification is to be added to. - The attributes the certification is associated with. - The new certification. - The re-certified key. - - - - Remove any certifications associated with a user attribute subpacket on a key. - - The key the certifications are to be removed from. - The attributes to be removed. - - The re-certified key, or null if the user attribute subpacket was not found on the key. - - - - Remove any certifications associated with a given ID on a key. - The key the certifications are to be removed from. - The ID that is to be removed. - The re-certified key, or null if the ID was not found on the key. - - - Remove a certification associated with a given ID on a key. - The key the certifications are to be removed from. - The ID that the certfication is to be removed from. - The certfication to be removed. - The re-certified key, or null if the certification was not found. - - - Remove a certification associated with a given user attributes on a key. - The key the certifications are to be removed from. - The user attributes that the certfication is to be removed from. - The certification to be removed. - The re-certified key, or null if the certification was not found. - - - Add a revocation or some other key certification to a key. - The key the revocation is to be added to. - The key signature to be added. - The new changed public key object. - - - Remove a certification from the key. - The key the certifications are to be removed from. - The certfication to be removed. - The modified key, null if the certification was not found. - - - A public key encrypted data object. - - - The key ID for the key used to encrypt the data. - - - - Return the algorithm code for the symmetric algorithm used to encrypt the data. - - - - Return the decrypted data stream for the packet. - - - - Class to hold a single master public key and its subkeys. -

    - Often PGP keyring files consist of multiple master keys, if you are trying to process - or construct one of these you should use the PgpPublicKeyRingBundle class. -

    -
    -
    - - Return the first public key in the ring. - - - Return the public key referred to by the passed in key ID if it is present. - - - Allows enumeration of all the public keys. - An IEnumerable of PgpPublicKey objects. - - - - Returns a new key ring with the public key passed in either added or - replacing an existing one. - - The public key ring to be modified. - The public key to be inserted. - A new PgpPublicKeyRing - - - Returns a new key ring with the public key passed in removed from the key ring. - The public key ring to be modified. - The public key to be removed. - A new PgpPublicKeyRing, or null if pubKey is not found. - - - - Often a PGP key ring file is made up of a succession of master/sub-key key rings. - If you want to read an entire public key file in one hit this is the class for you. - - - - Build a PgpPublicKeyRingBundle from the passed in input stream. - Input stream containing data. - If a problem parsing the stream occurs. - If an object is encountered which isn't a PgpPublicKeyRing. - - - Return the number of key rings in this collection. - - - Allow enumeration of the public key rings making up this collection. - - - Allow enumeration of the key rings associated with the passed in userId. - The user ID to be matched. - An IEnumerable of key rings which matched (possibly none). - - - Allow enumeration of the key rings associated with the passed in userId. - The user ID to be matched. - If true, userId need only be a substring of an actual ID string to match. - An IEnumerable of key rings which matched (possibly none). - - - Allow enumeration of the key rings associated with the passed in userId. - The user ID to be matched. - If true, userId need only be a substring of an actual ID string to match. - If true, case is ignored in user ID comparisons. - An IEnumerable of key rings which matched (possibly none). - - - Return the PGP public key associated with the given key id. - The ID of the public key to return. - - - Return the public key ring which contains the key referred to by keyId - key ID to match against - - - - Return true if a key matching the passed in key ID is present, false otherwise. - - key ID to look for. - - - - Return a new bundle containing the contents of the passed in bundle and - the passed in public key ring. - - The PgpPublicKeyRingBundle the key ring is to be added to. - The key ring to be added. - A new PgpPublicKeyRingBundle merging the current one with the passed in key ring. - If the keyId for the passed in key ring is already present. - - - - Return a new bundle containing the contents of the passed in bundle with - the passed in public key ring removed. - - The PgpPublicKeyRingBundle the key ring is to be removed from. - The key ring to be removed. - A new PgpPublicKeyRingBundle not containing the passed in key ring. - If the keyId for the passed in key ring is not present. - - - General class to handle a PGP secret key object. - - - - Check if this key has an algorithm type that makes it suitable to use for signing. - - - Note: with version 4 keys KeyFlags subpackets should also be considered when present for - determining the preferred use of the key. - - - true if this key algorithm is suitable for use with signing. - - - - True, if this is a master key. - - - The algorithm the key is encrypted with. - - - The key ID of the public key associated with this key. - - - The public key associated with this key. - - - Allows enumeration of any user IDs associated with the key. - An IEnumerable of string objects. - - - Allows enumeration of any user attribute vectors associated with the key. - An IEnumerable of string objects. - - - Extract a PgpPrivateKey from this secret key's encrypted contents. - - - - Return a copy of the passed in secret key, encrypted using a new password - and the passed in algorithm. - - The PgpSecretKey to be copied. - The current password for the key. - The new password for the key. - The algorithm to be used for the encryption. - Source of randomness. - - - Replace the passed the public key on the passed in secret key. - Secret key to change. - New public key. - A new secret key. - If KeyId's do not match. - - - - Class to hold a single master secret key and its subkeys. -

    - Often PGP keyring files consist of multiple master keys, if you are trying to process - or construct one of these you should use the PgpSecretKeyRingBundle class. -

    -
    -
    - - Return the public key for the master key. - - - Return the master private key. - - - Allows enumeration of the secret keys. - An IEnumerable of PgpSecretKey objects. - - - - Return an iterator of the public keys in the secret key ring that - have no matching private key. At the moment only personal certificate data - appears in this fashion. - - An IEnumerable of unattached, or extra, public keys. - - - - Replace the public key set on the secret ring with the corresponding key off the public ring. - - Secret ring to be changed. - Public ring containing the new public key set. - - - - Return a copy of the passed in secret key ring, with the master key and sub keys encrypted - using a new password and the passed in algorithm. - - The PgpSecretKeyRing to be copied. - The current password for key. - The new password for the key. - The algorithm to be used for the encryption. - Source of randomness. - - - - Returns a new key ring with the secret key passed in either added or - replacing an existing one with the same key ID. - - The secret key ring to be modified. - The secret key to be inserted. - A new PgpSecretKeyRing - - - Returns a new key ring with the secret key passed in removed from the key ring. - The secret key ring to be modified. - The secret key to be removed. - A new PgpSecretKeyRing, or null if secKey is not found. - - - - Often a PGP key ring file is made up of a succession of master/sub-key key rings. - If you want to read an entire secret key file in one hit this is the class for you. - - - - Build a PgpSecretKeyRingBundle from the passed in input stream. - Input stream containing data. - If a problem parsing the stream occurs. - If an object is encountered which isn't a PgpSecretKeyRing. - - - Return the number of rings in this collection. - - - Allow enumeration of the secret key rings making up this collection. - - - Allow enumeration of the key rings associated with the passed in userId. - The user ID to be matched. - An IEnumerable of key rings which matched (possibly none). - - - Allow enumeration of the key rings associated with the passed in userId. - The user ID to be matched. - If true, userId need only be a substring of an actual ID string to match. - An IEnumerable of key rings which matched (possibly none). - - - Allow enumeration of the key rings associated with the passed in userId. - The user ID to be matched. - If true, userId need only be a substring of an actual ID string to match. - If true, case is ignored in user ID comparisons. - An IEnumerable of key rings which matched (possibly none). - - - Return the PGP secret key associated with the given key id. - The ID of the secret key to return. - - - Return the secret key ring which contains the key referred to by keyId - The ID of the secret key - - - - Return true if a key matching the passed in key ID is present, false otherwise. - - key ID to look for. - - - - Return a new bundle containing the contents of the passed in bundle and - the passed in secret key ring. - - The PgpSecretKeyRingBundle the key ring is to be added to. - The key ring to be added. - A new PgpSecretKeyRingBundle merging the current one with the passed in key ring. - If the keyId for the passed in key ring is already present. - - - - Return a new bundle containing the contents of the passed in bundle with - the passed in secret key ring removed. - - The PgpSecretKeyRingBundle the key ring is to be removed from. - The key ring to be removed. - A new PgpSecretKeyRingBundle not containing the passed in key ring. - If the keyId for the passed in key ring is not present. - - - A PGP signature object. - - - The OpenPGP version number for this signature. - - - The key algorithm associated with this signature. - - - The hash algorithm associated with this signature. - - - - Verify the signature as certifying the passed in public key as associated - with the passed in user attributes. - - User attributes the key was stored under. - The key to be verified. - True, if the signature matches, false otherwise. - - - - Verify the signature as certifying the passed in public key as associated - with the passed in ID. - - ID the key was stored under. - The key to be verified. - True, if the signature matches, false otherwise. - - - Verify a certification for the passed in key against the passed in master key. - The key we are verifying against. - The key we are verifying. - True, if the certification is valid, false otherwise. - - - Verify a key certification, such as revocation, for the passed in key. - The key we are checking. - True, if the certification is valid, false otherwise. - - - The ID of the key that created the signature. - - - The creation time of this signature. - - - - Return true if the signature has either hashed or unhashed subpackets. - - - - Generator for PGP signatures. - - - Create a generator for the passed in keyAlgorithm and hashAlgorithm codes. - - - Initialise the generator for signing. - - - Initialise the generator for signing. - - - Return the one pass header associated with the current signature. - - - Return a signature object containing the current signature state. - - - Generate a certification for the passed in ID and key. - The ID we are certifying against the public key. - The key we are certifying against the ID. - The certification. - - - Generate a certification for the passed in userAttributes. - The ID we are certifying against the public key. - The key we are certifying against the ID. - The certification. - - - Generate a certification for the passed in key against the passed in master key. - The key we are certifying against. - The key we are certifying. - The certification. - - - Generate a certification, such as a revocation, for the passed in key. - The key we are certifying. - The certification. - - - A list of PGP signatures - normally in the signature block after literal data. - - - Generator for signature subpackets. - - - - Add a TrustSignature packet to the signature. The values for depth and trust are largely - installation dependent but there are some guidelines in RFC 4880 - 5.2.3.13. - - true if the packet is critical. - depth level. - trust amount. - - - - Set the number of seconds a key is valid for after the time of its creation. - A value of zero means the key never expires. - - True, if should be treated as critical, false otherwise. - The number of seconds the key is valid, or zero if no expiry. - - - - Set the number of seconds a signature is valid for after the time of its creation. - A value of zero means the signature never expires. - - True, if should be treated as critical, false otherwise. - The number of seconds the signature is valid, or zero if no expiry. - - - - Set the creation time for the signature. -

    - Note: this overrides the generation of a creation time when the signature - is generated.

    -
    -
    - - - Sets revocation reason sub packet - - - - - Sets revocation key sub packet - - - - - Sets issuer key sub packet - - - - Container for a list of signature subpackets. - - - Return true if a particular subpacket type exists. - - @param type type to look for. - @return true if present, false otherwise. - - - Return all signature subpackets of the passed in type. - @param type subpacket type code - @return an array of zero or more matching subpackets. - - - - Return the number of seconds a signature is valid for after its creation date. - A value of zero means the signature never expires. - - Seconds a signature is valid for. - - - - Return the number of seconds a key is valid for after its creation date. - A value of zero means the key never expires. - - Seconds a signature is valid for. - - - Return the number of packets this vector contains. - - - Container for a list of user attribute subpackets. - - - Basic utility class. - - - Write out the passed in file as a literal data packet. - - - Write out the passed in file as a literal data packet in partial packet format. - - - - Return either an ArmoredInputStream or a BcpgInputStream based on whether - the initial characters of the stream are binary PGP encodings or not. - - - - Generator for old style PGP V3 Signatures. - - - Create a generator for the passed in keyAlgorithm and hashAlgorithm codes. - - - Initialise the generator for signing. - - - Initialise the generator for signing. - - - Return the one pass header associated with the current signature. - - - Return a V3 signature object containing the current signature state. - - - - Represents revocation key OpenPGP signature sub packet. - - - - - Represents revocation reason OpenPGP signature sub packet. - - - - - The 'Signature' parameter is only available when generating unsigned attributes. - - - - containing class for an CMS Authenticated Data object - - - return the object identifier for the content MAC algorithm. - - - return a store of the intended recipients for this message - - - return the ContentInfo - - - return a table of the digested attributes indexed by - the OID of the attribute. - - - return a table of the undigested attributes indexed by - the OID of the attribute. - - - return the ASN.1 encoded representation of this object. - - - General class for generating a CMS authenticated-data message. - - A simple example of usage. - -
    -                  CMSAuthenticatedDataGenerator  fact = new CMSAuthenticatedDataGenerator();
    -            
    -                  fact.addKeyTransRecipient(cert);
    -            
    -                  CMSAuthenticatedData         data = fact.generate(content, algorithm, "BC");
    -             
    -
    - - base constructor - - - constructor allowing specific source of randomness - @param rand instance of SecureRandom to use - - - generate an enveloped object that contains an CMS Enveloped Data - object using the given provider and the passed in key generator. - - - generate an authenticated object that contains an CMS Authenticated Data object - - - Parsing class for an CMS Authenticated Data object from an input stream. -

    - Note: that because we are in a streaming mode only one recipient can be tried and it is important - that the methods on the parser are called in the appropriate order. -

    -

    - Example of use - assuming the first recipient matches the private key we have. -

    -                  CMSAuthenticatedDataParser     ad = new CMSAuthenticatedDataParser(inputStream);
    -            
    -                  RecipientInformationStore  recipients = ad.getRecipientInfos();
    -            
    -                  Collection  c = recipients.getRecipients();
    -                  Iterator    it = c.iterator();
    -            
    -                  if (it.hasNext())
    -                  {
    -                      RecipientInformation   recipient = (RecipientInformation)it.next();
    -            
    -                      CMSTypedStream recData = recipient.getContentStream(privateKey, "BC");
    -            
    -                      processDataStream(recData.getContentStream());
    -            
    -                      if (!Arrays.equals(ad.getMac(), recipient.getMac())
    -                      {
    -                          System.err.println("Data corrupted!!!!");
    -                      }
    -                  }
    -              
    - Note: this class does not introduce buffering - if you are processing large files you should create - the parser with: -
    -                      CMSAuthenticatedDataParser     ep = new CMSAuthenticatedDataParser(new BufferedInputStream(inputStream, bufSize));
    -              
    - where bufSize is a suitably large buffer size. -

    -
    - - return the object identifier for the mac algorithm. - - - return the ASN.1 encoded encryption algorithm parameters, or null if - there aren't any. - - - return a store of the intended recipients for this message - - - return a table of the unauthenticated attributes indexed by - the OID of the attribute. - @exception java.io.IOException - - - return a table of the unauthenticated attributes indexed by - the OID of the attribute. - @exception java.io.IOException - - - General class for generating a CMS authenticated-data message stream. -

    - A simple example of usage. -

    -                  CMSAuthenticatedDataStreamGenerator edGen = new CMSAuthenticatedDataStreamGenerator();
    -            
    -                  edGen.addKeyTransRecipient(cert);
    -            
    -                  ByteArrayOutputStream  bOut = new ByteArrayOutputStream();
    -            
    -                  OutputStream out = edGen.open(
    -                                          bOut, CMSAuthenticatedDataGenerator.AES128_CBC, "BC");*
    -                  out.write(data);
    -            
    -                  out.close();
    -             
    -

    -
    - - base constructor - - - constructor allowing specific source of randomness - @param rand instance of SecureRandom to use - - - Set the underlying string size for encapsulated data - - @param bufferSize length of octet strings to buffer the data. - - - Use a BER Set to store the recipient information - - - generate an enveloped object that contains an CMS Enveloped Data - object using the given provider and the passed in key generator. - @throws java.io.IOException - - - generate an enveloped object that contains an CMS Enveloped Data object - - - generate an enveloped object that contains an CMS Enveloped Data object - - - base constructor - - - constructor allowing specific source of randomness - - @param rand instance of SecureRandom to use - - - containing class for an CMS AuthEnveloped Data object - - - containing class for an CMS Compressed Data object - - - Return the uncompressed content. - - @return the uncompressed content - @throws CmsException if there is an exception uncompressing the data. - - - Return the uncompressed content, throwing an exception if the data size - is greater than the passed in limit. If the content is exceeded getCause() - on the CMSException will contain a StreamOverflowException - - @param limit maximum number of bytes to read - @return the content read - @throws CMSException if there is an exception uncompressing the data. - - - return the ContentInfo - - - return the ASN.1 encoded representation of this object. - - - * General class for generating a compressed CMS message. - *

    - * A simple example of usage.

    - *

    - *

    -                *      CMSCompressedDataGenerator fact = new CMSCompressedDataGenerator();
    -                *      CMSCompressedData data = fact.Generate(content, algorithm);
    -                * 
    - *

    -
    - - Generate an object that contains an CMS Compressed Data - - - Class for reading a CMS Compressed Data stream. -
    -                 CMSCompressedDataParser cp = new CMSCompressedDataParser(inputStream);
    -            
    -                 process(cp.GetContent().GetContentStream());
    -             
    - Note: this class does not introduce buffering - if you are processing large files you should create - the parser with: -
    -                  CMSCompressedDataParser     ep = new CMSCompressedDataParser(new BufferedInputStream(inputStream, bufSize));
    -              
    - where bufSize is a suitably large buffer size. -
    - - General class for generating a compressed CMS message stream. -

    - A simple example of usage. -

    -
    -                  CMSCompressedDataStreamGenerator gen = new CMSCompressedDataStreamGenerator();
    -            
    -                  Stream cOut = gen.Open(outputStream, CMSCompressedDataStreamGenerator.ZLIB);
    -            
    -                  cOut.Write(data);
    -            
    -                  cOut.Close();
    -             
    -
    - - base constructor - - - Set the underlying string size for encapsulated data - - @param bufferSize length of octet strings to buffer the data. - - - Close the underlying data stream. - @throws IOException if the close fails. - - - containing class for an CMS Enveloped Data object - - - return the object identifier for the content encryption algorithm. - - - return a store of the intended recipients for this message - - - return the ContentInfo - - - return a table of the unprotected attributes indexed by - the OID of the attribute. - - - return the ASN.1 encoded representation of this object. - - - - General class for generating a CMS enveloped-data message. - - A simple example of usage. - -
    -                  CmsEnvelopedDataGenerator  fact = new CmsEnvelopedDataGenerator();
    -            
    -                  fact.AddKeyTransRecipient(cert);
    -            
    -                  CmsEnvelopedData         data = fact.Generate(content, algorithm);
    -             
    -
    -
    - - Constructor allowing specific source of randomness - Instance of SecureRandom to use. - - - - Generate an enveloped object that contains a CMS Enveloped Data - object using the passed in key generator. - - - - Generate an enveloped object that contains an CMS Enveloped Data object. - - - Generate an enveloped object that contains an CMS Enveloped Data object. - - - Parsing class for an CMS Enveloped Data object from an input stream. -

    - Note: that because we are in a streaming mode only one recipient can be tried and it is important - that the methods on the parser are called in the appropriate order. -

    -

    - Example of use - assuming the first recipient matches the private key we have. -

    -                  CmsEnvelopedDataParser     ep = new CmsEnvelopedDataParser(inputStream);
    -            
    -                  RecipientInformationStore  recipients = ep.GetRecipientInfos();
    -            
    -                  Collection  c = recipients.getRecipients();
    -                  Iterator    it = c.iterator();
    -            
    -                  if (it.hasNext())
    -                  {
    -                      RecipientInformation   recipient = (RecipientInformation)it.next();
    -            
    -                      CMSTypedStream recData = recipient.getContentStream(privateKey);
    -            
    -                      processDataStream(recData.getContentStream());
    -                  }
    -              
    - Note: this class does not introduce buffering - if you are processing large files you should create - the parser with: -
    -                      CmsEnvelopedDataParser     ep = new CmsEnvelopedDataParser(new BufferedInputStream(inputStream, bufSize));
    -              
    - where bufSize is a suitably large buffer size. -

    -
    - - return the object identifier for the content encryption algorithm. - - - return the ASN.1 encoded encryption algorithm parameters, or null if - there aren't any. - - - return a store of the intended recipients for this message - - - return a table of the unprotected attributes indexed by - the OID of the attribute. - @throws IOException - - - General class for generating a CMS enveloped-data message stream. -

    - A simple example of usage. -

    -                  CmsEnvelopedDataStreamGenerator edGen = new CmsEnvelopedDataStreamGenerator();
    -            
    -                  edGen.AddKeyTransRecipient(cert);
    -            
    -                  MemoryStream  bOut = new MemoryStream();
    -            
    -                  Stream out = edGen.Open(
    -                                          bOut, CMSEnvelopedDataGenerator.AES128_CBC);*
    -                  out.Write(data);
    -            
    -                  out.Close();
    -             
    -

    -
    - - Constructor allowing specific source of randomness - Instance of SecureRandom to use. - - - Set the underlying string size for encapsulated data. - Length of octet strings to buffer the data. - - - Use a BER Set to store the recipient information. - - - - Generate an enveloped object that contains an CMS Enveloped Data - object using the passed in key generator. - - - - generate an enveloped object that contains an CMS Enveloped Data object - @throws IOException - - - generate an enveloped object that contains an CMS Enveloped Data object - @throws IOException - - - General class for generating a CMS enveloped-data message. - - A simple example of usage. - -
    -                  CMSEnvelopedDataGenerator  fact = new CMSEnvelopedDataGenerator();
    -            
    -                  fact.addKeyTransRecipient(cert);
    -            
    -                  CMSEnvelopedData         data = fact.generate(content, algorithm, "BC");
    -             
    -
    - - Constructor allowing specific source of randomness - Instance of SecureRandom to use. - - - add a recipient. - - @param cert recipient's public key certificate - @exception ArgumentException if there is a problem with the certificate - - - add a recipient - - @param key the public key used by the recipient - @param subKeyId the identifier for the recipient's public key - @exception ArgumentException if there is a problem with the key - - - add a KEK recipient. - @param key the secret key to use for wrapping - @param keyIdentifier the byte string that identifies the key - - - add a KEK recipient. - @param key the secret key to use for wrapping - @param keyIdentifier the byte string that identifies the key - - - Add a key agreement based recipient. - - @param agreementAlgorithm key agreement algorithm to use. - @param senderPrivateKey private key to initialise sender side of agreement with. - @param senderPublicKey sender public key to include with message. - @param recipientCert recipient's public key certificate. - @param cekWrapAlgorithm OID for key wrapping algorithm to use. - @exception SecurityUtilityException if the algorithm requested cannot be found - @exception InvalidKeyException if the keys are inappropriate for the algorithm specified - - - Add multiple key agreement based recipients (sharing a single KeyAgreeRecipientInfo structure). - - @param agreementAlgorithm key agreement algorithm to use. - @param senderPrivateKey private key to initialise sender side of agreement with. - @param senderPublicKey sender public key to include with message. - @param recipientCerts recipients' public key certificates. - @param cekWrapAlgorithm OID for key wrapping algorithm to use. - @exception SecurityUtilityException if the algorithm requested cannot be found - @exception InvalidKeyException if the keys are inappropriate for the algorithm specified - - - - Generic routine to copy out the data we want processed. - - - This routine may be called multiple times. - - - - a holding class for a byte array of data to be processed. - - - A clone of the byte array - - - a holding class for a file of data to be processed. - - - The file handle - - - general class for handling a pkcs7-signature message. - - A simple example of usage - note, in the example below the validity of - the certificate isn't verified, just the fact that one of the certs - matches the given signer... - -
    -              IX509Store              certs = s.GetCertificates();
    -              SignerInformationStore  signers = s.GetSignerInfos();
    -            
    -              foreach (SignerInformation signer in signers.GetSigners())
    -              {
    -                  ArrayList       certList = new ArrayList(certs.GetMatches(signer.SignerID));
    -                  X509Certificate cert = (X509Certificate) certList[0];
    -            
    -                  if (signer.Verify(cert.GetPublicKey()))
    -                  {
    -                      verified++;
    -                  }
    -              }
    -             
    -
    - - Content with detached signature, digests precomputed - - @param hashes a map of precomputed digests for content indexed by name of hash. - @param sigBlock the signature object. - - - base constructor - content with detached signature. - - @param signedContent the content that was signed. - @param sigData the signature object. - - - base constructor - with encapsulated content - - - Return the version number for this object. - - - return the collection of signers that are associated with the - signatures for the message. - - - return a X509Store containing the attribute certificates, if any, contained - in this message. - - @param type type of store to create - @return a store of attribute certificates - @exception NoSuchStoreException if the store type isn't available. - @exception CmsException if a general exception prevents creation of the X509Store - - - return a X509Store containing the public key certificates, if any, contained - in this message. - - @param type type of store to create - @return a store of public key certificates - @exception NoSuchStoreException if the store type isn't available. - @exception CmsException if a general exception prevents creation of the X509Store - - - return a X509Store containing CRLs, if any, contained - in this message. - - @param type type of store to create - @return a store of CRLs - @exception NoSuchStoreException if the store type isn't available. - @exception CmsException if a general exception prevents creation of the X509Store - - - - Return the DerObjectIdentifier associated with the encapsulated - content info structure carried in the signed data. - - - - return the ContentInfo - - - return the ASN.1 encoded representation of this object. - - - Replace the signerinformation store associated with this - CmsSignedData object with the new one passed in. You would - probably only want to do this if you wanted to change the unsigned - attributes associated with a signer, or perhaps delete one. - - @param signedData the signed data object to be used as a base. - @param signerInformationStore the new signer information store to use. - @return a new signed data object. - - - Replace the certificate and CRL information associated with this - CmsSignedData object with the new one passed in. - - @param signedData the signed data object to be used as a base. - @param x509Certs the new certificates to be used. - @param x509Crls the new CRLs to be used. - @return a new signed data object. - @exception CmsException if there is an error processing the stores - - - * general class for generating a pkcs7-signature message. - *

    - * A simple example of usage. - * - *

    -                 *      IX509Store certs...
    -                 *      IX509Store crls...
    -                 *      CmsSignedDataGenerator gen = new CmsSignedDataGenerator();
    -                 *
    -                 *      gen.AddSigner(privKey, cert, CmsSignedGenerator.DigestSha1);
    -                 *      gen.AddCertificates(certs);
    -                 *      gen.AddCrls(crls);
    -                 *
    -                 *      CmsSignedData data = gen.Generate(content);
    -                 * 
    - *

    -
    - - Constructor allowing specific source of randomness - Instance of SecureRandom to use. - - - * add a signer - no attributes other than the default ones will be - * provided here. - * - * @param key signing key to use - * @param cert certificate containing corresponding public key - * @param digestOID digest algorithm OID - - - add a signer, specifying the digest encryption algorithm to use - no attributes other than the default ones will be - provided here. - - @param key signing key to use - @param cert certificate containing corresponding public key - @param encryptionOID digest encryption algorithm OID - @param digestOID digest algorithm OID - - - add a signer - no attributes other than the default ones will be - provided here. - - - add a signer, specifying the digest encryption algorithm to use - no attributes other than the default ones will be - provided here. - - - * add a signer with extra signed/unsigned attributes. - * - * @param key signing key to use - * @param cert certificate containing corresponding public key - * @param digestOID digest algorithm OID - * @param signedAttr table of attributes to be included in signature - * @param unsignedAttr table of attributes to be included as unsigned - - - add a signer, specifying the digest encryption algorithm, with extra signed/unsigned attributes. - - @param key signing key to use - @param cert certificate containing corresponding public key - @param encryptionOID digest encryption algorithm OID - @param digestOID digest algorithm OID - @param signedAttr table of attributes to be included in signature - @param unsignedAttr table of attributes to be included as unsigned - - - * add a signer with extra signed/unsigned attributes. - * - * @param key signing key to use - * @param subjectKeyID subjectKeyID of corresponding public key - * @param digestOID digest algorithm OID - * @param signedAttr table of attributes to be included in signature - * @param unsignedAttr table of attributes to be included as unsigned - - - add a signer, specifying the digest encryption algorithm, with extra signed/unsigned attributes. - - @param key signing key to use - @param subjectKeyID subjectKeyID of corresponding public key - @param encryptionOID digest encryption algorithm OID - @param digestOID digest algorithm OID - @param signedAttr table of attributes to be included in signature - @param unsignedAttr table of attributes to be included as unsigned - - - add a signer with extra signed/unsigned attributes based on generators. - - - add a signer, specifying the digest encryption algorithm, with extra signed/unsigned attributes based on generators. - - - add a signer with extra signed/unsigned attributes based on generators. - - - add a signer, including digest encryption algorithm, with extra signed/unsigned attributes based on generators. - - - generate a signed object that for a CMS Signed Data object - - - generate a signed object that for a CMS Signed Data - object - if encapsulate is true a copy - of the message will be included in the signature. The content type - is set according to the OID represented by the string signedContentType. - - - generate a signed object that for a CMS Signed Data - object - if encapsulate is true a copy - of the message will be included in the signature with the - default content type "data". - - - generate a set of one or more SignerInformation objects representing counter signatures on - the passed in SignerInformation object. - - @param signer the signer to be countersigned - @param sigProvider the provider to be used for counter signing. - @return a store containing the signers. - - - Parsing class for an CMS Signed Data object from an input stream. -

    - Note: that because we are in a streaming mode only one signer can be tried and it is important - that the methods on the parser are called in the appropriate order. -

    -

    - A simple example of usage for an encapsulated signature. -

    -

    - Two notes: first, in the example below the validity of - the certificate isn't verified, just the fact that one of the certs - matches the given signer, and, second, because we are in a streaming - mode the order of the operations is important. -

    -
    -                  CmsSignedDataParser     sp = new CmsSignedDataParser(encapSigData);
    -            
    -                  sp.GetSignedContent().Drain();
    -            
    -                  IX509Store              certs = sp.GetCertificates();
    -                  SignerInformationStore  signers = sp.GetSignerInfos();
    -            
    -                  foreach (SignerInformation signer in signers.GetSigners())
    -                  {
    -                      ArrayList       certList = new ArrayList(certs.GetMatches(signer.SignerID));
    -                      X509Certificate cert = (X509Certificate) certList[0];
    -            
    -                      Console.WriteLine("verify returns: " + signer.Verify(cert));
    -                  }
    -             
    - Note also: this class does not introduce buffering - if you are processing large files you should create - the parser with: -
    -                      CmsSignedDataParser     ep = new CmsSignedDataParser(new BufferedInputStream(encapSigData, bufSize));
    -              
    - where bufSize is a suitably large buffer size. -
    - - base constructor - with encapsulated content - - - base constructor - - @param signedContent the content that was signed. - @param sigData the signature object. - - - Return the version number for the SignedData object - - @return the version number - - - return the collection of signers that are associated with the - signatures for the message. - @throws CmsException - - - return a X509Store containing the attribute certificates, if any, contained - in this message. - - @param type type of store to create - @return a store of attribute certificates - @exception org.bouncycastle.x509.NoSuchStoreException if the store type isn't available. - @exception CmsException if a general exception prevents creation of the X509Store - - - return a X509Store containing the public key certificates, if any, contained - in this message. - - @param type type of store to create - @return a store of public key certificates - @exception NoSuchStoreException if the store type isn't available. - @exception CmsException if a general exception prevents creation of the X509Store - - - return a X509Store containing CRLs, if any, contained - in this message. - - @param type type of store to create - @return a store of CRLs - @exception NoSuchStoreException if the store type isn't available. - @exception CmsException if a general exception prevents creation of the X509Store - - - - Return the DerObjectIdentifier associated with the encapsulated - content info structure carried in the signed data. - - - - Replace the signerinformation store associated with the passed - in message contained in the stream original with the new one passed in. - You would probably only want to do this if you wanted to change the unsigned - attributes associated with a signer, or perhaps delete one. -

    - The output stream is returned unclosed. -

    - @param original the signed data stream to be used as a base. - @param signerInformationStore the new signer information store to use. - @param out the stream to Write the new signed data object to. - @return out. -
    - - Replace the certificate and CRL information associated with this - CMSSignedData object with the new one passed in. -

    - The output stream is returned unclosed. -

    - @param original the signed data stream to be used as a base. - @param certsAndCrls the new certificates and CRLs to be used. - @param out the stream to Write the new signed data object to. - @return out. - @exception CmsException if there is an error processing the CertStore -
    - - General class for generating a pkcs7-signature message stream. -

    - A simple example of usage. -

    -
    -                  IX509Store                   certs...
    -                  CmsSignedDataStreamGenerator gen = new CmsSignedDataStreamGenerator();
    -            
    -                  gen.AddSigner(privateKey, cert, CmsSignedDataStreamGenerator.DIGEST_SHA1);
    -            
    -                  gen.AddCertificates(certs);
    -            
    -                  Stream sigOut = gen.Open(bOut);
    -            
    -                  sigOut.Write(Encoding.UTF8.GetBytes("Hello World!"));
    -            
    -                  sigOut.Close();
    -             
    -
    - - Constructor allowing specific source of randomness - Instance of SecureRandom to use. - - - Set the underlying string size for encapsulated data - - @param bufferSize length of octet strings to buffer the data. - - - add a signer - no attributes other than the default ones will be - provided here. - @throws NoSuchAlgorithmException - @throws InvalidKeyException - - - add a signer, specifying the digest encryption algorithm - no attributes other than the default ones will be - provided here. - @throws NoSuchProviderException - @throws NoSuchAlgorithmException - @throws InvalidKeyException - - - add a signer with extra signed/unsigned attributes. - @throws NoSuchAlgorithmException - @throws InvalidKeyException - - - add a signer with extra signed/unsigned attributes - specifying digest - encryption algorithm. - @throws NoSuchProviderException - @throws NoSuchAlgorithmException - @throws InvalidKeyException - - - add a signer - no attributes other than the default ones will be - provided here. - @throws NoSuchAlgorithmException - @throws InvalidKeyException - - - add a signer - no attributes other than the default ones will be - provided here. - @throws NoSuchProviderException - @throws NoSuchAlgorithmException - @throws InvalidKeyException - - - add a signer with extra signed/unsigned attributes. - @throws NoSuchAlgorithmException - @throws InvalidKeyException - - - generate a signed object that for a CMS Signed Data object - - - generate a signed object that for a CMS Signed Data - object - if encapsulate is true a copy - of the message will be included in the signature with the - default content type "data". - - - generate a signed object that for a CMS Signed Data - object using the given provider - if encapsulate is true a copy - of the message will be included in the signature with the - default content type "data". If dataOutputStream is non null the data - being signed will be written to the stream as it is processed. - @param out stream the CMS object is to be written to. - @param encapsulate true if data should be encapsulated. - @param dataOutputStream output stream to copy the data being signed to. - - - generate a signed object that for a CMS Signed Data - object - if encapsulate is true a copy - of the message will be included in the signature. The content type - is set according to the OID represented by the string signedContentType. - - - generate a signed object that for a CMS Signed Data - object using the given provider - if encapsulate is true a copy - of the message will be included in the signature. The content type - is set according to the OID represented by the string signedContentType. - @param out stream the CMS object is to be written to. - @param signedContentType OID for data to be signed. - @param encapsulate true if data should be encapsulated. - @param dataOutputStream output stream to copy the data being signed to. - - - Default type for the signed data. - - - Constructor allowing specific source of randomness - Instance of SecureRandom to use. - - - Add the attribute certificates contained in the passed in store to the - generator. - - @param store a store of Version 2 attribute certificates - @throws CmsException if an error occurse processing the store. - - - Add a store of precalculated signers to the generator. - - @param signerStore store of signers - - - Return a map of oids and byte arrays representing the digests calculated on the content during - the last generate. - - @return a map of oids (as String objects) and byte[] representing digests. - - - Return the digest algorithm using one of the standard JCA string - representations rather than the algorithm identifier (if possible). - - - Return the digest encryption algorithm using one of the standard - JCA string representations rather than the algorithm identifier (if - possible). - - - Default signed attributes generator. - - - Initialise to use all defaults - - - Initialise with some extra attributes or overrides. - - @param attributeTable initial attribute table to use. - - - Create a standard attribute table from the passed in parameters - this will - normally include contentType, signingTime, and messageDigest. If the constructor - using an AttributeTable was used, entries in it for contentType, signingTime, and - messageDigest will override the generated ones. - - @param parameters source parameters for table generation. - - @return a filled in Hashtable of attributes. - - - @param parameters source parameters - @return the populated attribute table - - - the RecipientInfo class for a recipient who has been sent a message - encrypted using a secret key known to the other side. - - - decrypt the content and return an input stream. - - - the RecipientInfo class for a recipient who has been sent a message - encrypted using key agreement. - - - decrypt the content and return an input stream. - - - the KeyTransRecipientInformation class for a recipient who has been sent a secret - key encrypted using their public key that needs to be used to - extract the message. - - - decrypt the content and return it as a byte array. - - - a basic index for an originator. - - - the RecipientInfo class for a recipient who has been sent a message - encrypted using a password. - - - return the object identifier for the key derivation algorithm, or null - if there is none present. - - @return OID for key derivation algorithm, if present. - - - decrypt the content and return an input stream. - - - - PKCS5 scheme-2 - password converted to bytes assuming ASCII. - - - - PKCS5 scheme-2 - password converted to bytes using UTF-8. - - - - Generate a RecipientInfo object for the given key. - - - A - - - A - - - A - - - - - * return the object identifier for the key encryption algorithm. - * - * @return OID for key encryption algorithm. - - - * return the ASN.1 encoded key encryption algorithm parameters, or null if - * there aren't any. - * - * @return ASN.1 encoding of key encryption algorithm parameters. - - - Return the MAC calculated for the content stream. Note: this call is only meaningful once all - the content has been read. - - @return byte array containing the mac. - - - Return the first RecipientInformation object that matches the - passed in selector. Null if there are no matches. - - @param selector to identify a recipient - @return a single RecipientInformation object. Null if none matches. - - - Return the number of recipients in the collection. - - @return number of recipients identified. - - - Return all recipients in the collection - - @return a collection of recipients. - - - Return possible empty collection with recipients matching the passed in RecipientID - - @param selector a recipient id to select against. - @return a collection of RecipientInformation objects. - - - a basic index for a signer. - - - an expanded SignerInfo block from a CMS Signed message - - - return the version number for this objects underlying SignerInfo structure. - - - return the object identifier for the signature. - - - return the signature parameters, or null if there aren't any. - - - return the content digest that was calculated during verification. - - - return the object identifier for the signature. - - - return the signature/encryption algorithm parameters, or null if - there aren't any. - - - return a table of the signed attributes - indexed by - the OID of the attribute. - - - return a table of the unsigned attributes indexed by - the OID of the attribute. - - - return the encoded signature - - - Return a SignerInformationStore containing the counter signatures attached to this - signer. If no counter signatures are present an empty store is returned. - - - return the DER encoding of the signed attributes. - @throws IOException if an encoding error occurs. - - - verify that the given public key successfully handles and confirms the - signature associated with this signer. - - - verify that the given certificate successfully handles and confirms - the signature associated with this signer and, if a signingTime - attribute is available, that the certificate was valid at the time the - signature was generated. - - - Return the base ASN.1 CMS structure that this object contains. - - @return an object containing a CMS SignerInfo structure. - - - Return a signer information object with the passed in unsigned - attributes replacing the ones that are current associated with - the object passed in. - - @param signerInformation the signerInfo to be used as the basis. - @param unsignedAttributes the unsigned attributes to add. - @return a copy of the original SignerInformationObject with the changed attributes. - - - Return a signer information object with passed in SignerInformationStore representing counter - signatures attached as an unsigned attribute. - - @param signerInformation the signerInfo to be used as the basis. - @param counterSigners signer info objects carrying counter signature. - @return a copy of the original SignerInformationObject with the changed attributes. - - - Return the first SignerInformation object that matches the - passed in selector. Null if there are no matches. - - @param selector to identify a signer - @return a single SignerInformation object. Null if none matches. - - - The number of signers in the collection. - - - An ICollection of all signers in the collection - - - Return possible empty collection with signers matching the passed in SignerID - - @param selector a signer id to select against. - @return a collection of SignerInformation objects. - - - Basic generator that just returns a preconstructed attribute table - - - Default authenticated attributes generator. - - - Initialise to use all defaults - - - Initialise with some extra attributes or overrides. - - @param attributeTable initial attribute table to use. - - - Create a standard attribute table from the passed in parameters - this will - normally include contentType and messageDigest. If the constructor - using an AttributeTable was used, entries in it for contentType and - messageDigest will override the generated ones. - - @param parameters source parameters for table generation. - - @return a filled in IDictionary of attributes. - - - @param parameters source parameters - @return the populated attribute table - - - Return the certificates stored in the underlying OriginatorInfo object. - - @return a Store of X509CertificateHolder objects. - - - Return the CRLs stored in the underlying OriginatorInfo object. - - @return a Store of X509CRLHolder objects. - - - Return the underlying ASN.1 object defining this SignerInformation object. - - @return a OriginatorInfo. - - - a Diffie-Hellman key exchange engine. -

    - note: This uses MTI/A0 key agreement in order to make the key agreement - secure against passive attacks. If you're doing Diffie-Hellman and both - parties have long term public keys you should look at using this. For - further information have a look at RFC 2631.

    -

    - It's possible to extend this to more than two parties as well, for the moment - that is left as an exercise for the reader.

    -
    - - calculate our initial message. - - - given a message from a given party and the corresponding public key - calculate the next message in the agreement sequence. In this case - this will represent the shared secret. - - - a Diffie-Hellman key agreement class. -

    - note: This is only the basic algorithm, it doesn't take advantage of - long term public keys if they are available. See the DHAgreement class - for a "better" implementation.

    -
    - - given a short term public key from a given party calculate the next - message in the agreement sequence. - - - P1363 7.2.1 ECSVDP-DH - - ECSVDP-DH is Elliptic Curve Secret Value Derivation Primitive, - Diffie-Hellman version. It is based on the work of [DH76], [Mil86], - and [Kob87]. This primitive derives a shared secret value from one - party's private key and another party's public key, where both have - the same set of EC domain parameters. If two parties correctly - execute this primitive, they will produce the same output. This - primitive can be invoked by a scheme to derive a shared secret key; - specifically, it may be used with the schemes ECKAS-DH1 and - DL/ECKAS-DH2. It assumes that the input keys are valid (see also - Section 7.2.2). - - - P1363 7.2.2 ECSVDP-DHC - - ECSVDP-DHC is Elliptic Curve Secret Value Derivation Primitive, - Diffie-Hellman version with cofactor multiplication. It is based on - the work of [DH76], [Mil86], [Kob87], [LMQ98] and [Kal98a]. This - primitive derives a shared secret value from one party's private key - and another party's public key, where both have the same set of EC - domain parameters. If two parties correctly execute this primitive, - they will produce the same output. This primitive can be invoked by a - scheme to derive a shared secret key; specifically, it may be used - with the schemes ECKAS-DH1 and DL/ECKAS-DH2. It does not assume the - validity of the input public key (see also Section 7.2.1). -

    - Note: As stated P1363 compatibility mode with ECDH can be preset, and - in this case the implementation doesn't have a ECDH compatibility mode - (if you want that just use ECDHBasicAgreement and note they both implement - BasicAgreement!).

    -
    - - RFC 2631 Diffie-hellman KEK derivation function. - - - X9.63 based key derivation function for ECDH CMS. - - - Implements the client side SRP-6a protocol. Note that this class is stateful, and therefore NOT threadsafe. - This implementation of SRP is based on the optimized message sequence put forth by Thomas Wu in the paper - "SRP-6: Improvements and Refinements to the Secure Remote Password Protocol, 2002" - - - Initialises the client to begin new authentication attempt - @param N The safe prime associated with the client's verifier - @param g The group parameter associated with the client's verifier - @param digest The digest algorithm associated with the client's verifier - @param random For key generation - - - Generates client's credentials given the client's salt, identity and password - @param salt The salt used in the client's verifier. - @param identity The user's identity (eg. username) - @param password The user's password - @return Client's public value to send to server - - - Generates client's verification message given the server's credentials - @param serverB The server's credentials - @return Client's verification message for the server - @throws CryptoException If server's credentials are invalid - - - Implements the server side SRP-6a protocol. Note that this class is stateful, and therefore NOT threadsafe. - This implementation of SRP is based on the optimized message sequence put forth by Thomas Wu in the paper - "SRP-6: Improvements and Refinements to the Secure Remote Password Protocol, 2002" - - - Initialises the server to accept a new client authentication attempt - @param N The safe prime associated with the client's verifier - @param g The group parameter associated with the client's verifier - @param v The client's verifier - @param digest The digest algorithm associated with the client's verifier - @param random For key generation - - - Generates the server's credentials that are to be sent to the client. - @return The server's public value to the client - - - Processes the client's credentials. If valid the shared secret is generated and returned. - @param clientA The client's credentials - @return A shared secret BigInteger - @throws CryptoException If client's credentials are invalid - - - Generates new SRP verifier for user - - - Initialises generator to create new verifiers - @param N The safe prime to use (see DHParametersGenerator) - @param g The group parameter to use (see DHParametersGenerator) - @param digest The digest to use. The same digest type will need to be used later for the actual authentication - attempt. Also note that the final session key size is dependent on the chosen digest. - - - Creates a new SRP verifier - @param salt The salt to use, generally should be large and random - @param identity The user's identifying information (eg. username) - @param password The user's password - @return A new verifier for use in future SRP authentication - - - a holding class for public/private parameter pairs. - - - basic constructor. - - @param publicParam a public key parameters object. - @param privateParam the corresponding private key parameters. - - - return the public key parameters. - - @return the public key parameters. - - - return the private key parameters. - - @return the private key parameters. - - - The AEAD block ciphers already handle buffering internally, so this class - just takes care of implementing IBufferedCipher methods. - - - initialise the cipher. - - @param forEncryption if true the cipher is initialised for - encryption, if false for decryption. - @param param the key and other data required by the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - return the blocksize for the underlying cipher. - - @return the blocksize for the underlying cipher. - - - return the size of the output buffer required for an update - an input of len bytes. - - @param len the length of the input. - @return the space required to accommodate a call to update - with len bytes of input. - - - return the size of the output buffer required for an update plus a - doFinal with an input of len bytes. - - @param len the length of the input. - @return the space required to accommodate a call to update and doFinal - with len bytes of input. - - - process a single byte, producing an output block if neccessary. - - @param in the input byte. - @param out the space for any output that might be produced. - @param outOff the offset from which the output will be copied. - @return the number of output bytes copied to out. - @exception DataLengthException if there isn't enough space in out. - @exception InvalidOperationException if the cipher isn't initialised. - - - process an array of bytes, producing output if necessary. - - @param in the input byte array. - @param inOff the offset at which the input data starts. - @param len the number of bytes to be copied out of the input array. - @param out the space for any output that might be produced. - @param outOff the offset from which the output will be copied. - @return the number of output bytes copied to out. - @exception DataLengthException if there isn't enough space in out. - @exception InvalidOperationException if the cipher isn't initialised. - - - Process the last block in the buffer. - - @param out the array the block currently being held is copied into. - @param outOff the offset at which the copying starts. - @return the number of output bytes copied to out. - @exception DataLengthException if there is insufficient space in out for - the output, or the input is not block size aligned and should be. - @exception InvalidOperationException if the underlying cipher is not - initialised. - @exception InvalidCipherTextException if padding is expected and not found. - @exception DataLengthException if the input is not block size - aligned. - - - Reset the buffer and cipher. After resetting the object is in the same - state as it was after the last init (if there was one). - - - a buffer wrapper for an asymmetric block cipher, allowing input - to be accumulated in a piecemeal fashion until final processing. - - - base constructor. - - @param cipher the cipher this buffering object wraps. - - - return the amount of data sitting in the buffer. - - @return the amount of data sitting in the buffer. - - - initialise the buffer and the underlying cipher. - - @param forEncryption if true the cipher is initialised for - encryption, if false for decryption. - @param param the key and other data required by the cipher. - - - process the contents of the buffer using the underlying - cipher. - - @return the result of the encryption/decryption process on the - buffer. - @exception InvalidCipherTextException if we are given a garbage block. - - - Reset the buffer - - - A wrapper class that allows block ciphers to be used to process data in - a piecemeal fashion. The BufferedBlockCipher outputs a block only when the - buffer is full and more data is being added, or on a doFinal. -

    - Note: in the case where the underlying cipher is either a CFB cipher or an - OFB one the last block may not be a multiple of the block size. -

    -
    - - constructor for subclasses - - - Create a buffered block cipher without padding. - - @param cipher the underlying block cipher this buffering object wraps. - false otherwise. - - - initialise the cipher. - - @param forEncryption if true the cipher is initialised for - encryption, if false for decryption. - @param param the key and other data required by the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - return the blocksize for the underlying cipher. - - @return the blocksize for the underlying cipher. - - - return the size of the output buffer required for an update - an input of len bytes. - - @param len the length of the input. - @return the space required to accommodate a call to update - with len bytes of input. - - - return the size of the output buffer required for an update plus a - doFinal with an input of len bytes. - - @param len the length of the input. - @return the space required to accommodate a call to update and doFinal - with len bytes of input. - - - process a single byte, producing an output block if neccessary. - - @param in the input byte. - @param out the space for any output that might be produced. - @param outOff the offset from which the output will be copied. - @return the number of output bytes copied to out. - @exception DataLengthException if there isn't enough space in out. - @exception InvalidOperationException if the cipher isn't initialised. - - - process an array of bytes, producing output if necessary. - - @param in the input byte array. - @param inOff the offset at which the input data starts. - @param len the number of bytes to be copied out of the input array. - @param out the space for any output that might be produced. - @param outOff the offset from which the output will be copied. - @return the number of output bytes copied to out. - @exception DataLengthException if there isn't enough space in out. - @exception InvalidOperationException if the cipher isn't initialised. - - - Process the last block in the buffer. - - @param out the array the block currently being held is copied into. - @param outOff the offset at which the copying starts. - @return the number of output bytes copied to out. - @exception DataLengthException if there is insufficient space in out for - the output, or the input is not block size aligned and should be. - @exception InvalidOperationException if the underlying cipher is not - initialised. - @exception InvalidCipherTextException if padding is expected and not found. - @exception DataLengthException if the input is not block size - aligned. - - - Reset the buffer and cipher. After resetting the object is in the same - state as it was after the last init (if there was one). - - - The base class for symmetric, or secret, cipher key generators. - - - initialise the key generator. - - @param param the parameters to be used for key generation - - - Generate a secret key. - - @return a byte array containing the key value. - - - this exception is thrown if a buffer that is meant to have output - copied into it turns out to be too short, or if we've been given - insufficient input. In general this exception will Get thrown rather - than an ArrayOutOfBounds exception. - - - base constructor. - - - create a DataLengthException with the given message. - - @param message the message to be carried with the exception. - - - base implementation of MD4 family style digest as outlined in - "Handbook of Applied Cryptography", pages 344 - 347. - - - implementation of GOST R 34.11-94 - - - Standard constructor - - - Constructor to allow use of a particular sbox with GOST28147 - @see GOST28147Engine#getSBox(String) - - - Copy constructor. This will copy the state of the provided - message digest. - - - reset the chaining variables to the IV values. - - - Base class for SHA-384 and SHA-512. - - - Constructor for variable length word - - - Copy constructor. We are using copy constructors in place - of the object.Clone() interface as this interface is not - supported by J2ME. - - - adjust the byte counts so that byteCount2 represents the - upper long (less 3 bits) word of the byte count. - - - implementation of MD2 - as outlined in RFC1319 by B.Kaliski from RSA Laboratories April 1992 - - - return the algorithm name - - @return the algorithm name - - - Close the digest, producing the final digest value. The doFinal - call leaves the digest reset. - - @param out the array the digest is to be copied into. - @param outOff the offset into the out array the digest is to start at. - - - reset the digest back to it's initial state. - - - update the message digest with a single byte. - - @param in the input byte to be entered. - - - update the message digest with a block of bytes. - - @param in the byte array containing the data. - @param inOff the offset into the byte array where the data starts. - @param len the length of the data. - - - implementation of MD4 as RFC 1320 by R. Rivest, MIT Laboratory for - Computer Science and RSA Data Security, Inc. -

    - NOTE: This algorithm is only included for backwards compatibility - with legacy applications, it's not secure, don't use it for anything new!

    -
    - - Standard constructor - - - Copy constructor. This will copy the state of the provided - message digest. - - - reset the chaining variables to the IV values. - - - implementation of MD5 as outlined in "Handbook of Applied Cryptography", pages 346 - 347. - - - Copy constructor. This will copy the state of the provided - message digest. - - - reset the chaining variables to the IV values. - - - implementation of RipeMD128 - - - Standard constructor - - - Copy constructor. This will copy the state of the provided - message digest. - - - reset the chaining variables to the IV values. - - - implementation of RipeMD see, - http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.html - - - Standard constructor - - - Copy constructor. This will copy the state of the provided - message digest. - - - reset the chaining variables to the IV values. - - - -

    Implementation of RipeMD256.

    -

    Note: this algorithm offers the same level of security as RipeMD128.

    -
    -
    - - Standard constructor - - - Copy constructor. This will copy the state of the provided - message digest. - - - - reset the chaining variables to the IV values. - - - -

    Implementation of RipeMD 320.

    -

    Note: this algorithm offers the same level of security as RipeMD160.

    -
    -
    - - Standard constructor - - - Copy constructor. This will copy the state of the provided - message digest. - - - - reset the chaining variables to the IV values. - - - implementation of SHA-1 as outlined in "Handbook of Applied Cryptography", pages 346 - 349. - - It is interesting to ponder why the, apart from the extra IV, the other difference here from MD5 - is the "endianness" of the word processing! - - - Copy constructor. This will copy the state of the provided - message digest. - - - reset the chaining variables - - - SHA-224 as described in RFC 3874 -
    -                    block  word  digest
    -            SHA-1   512    32    160
    -            SHA-224 512    32    224
    -            SHA-256 512    32    256
    -            SHA-384 1024   64    384
    -            SHA-512 1024   64    512
    -            
    -
    - - Standard constructor - - - Copy constructor. This will copy the state of the provided - message digest. - - - reset the chaining variables - - - Draft FIPS 180-2 implementation of SHA-256. Note: As this is - based on a draft this implementation is subject to change. - -
    -                     block  word  digest
    -             SHA-1   512    32    160
    -             SHA-256 512    32    256
    -             SHA-384 1024   64    384
    -             SHA-512 1024   64    512
    -             
    -
    - - Copy constructor. This will copy the state of the provided - message digest. - - - reset the chaining variables - - - Draft FIPS 180-2 implementation of SHA-384. Note: As this is - based on a draft this implementation is subject to change. - -
    -                     block  word  digest
    -             SHA-1   512    32    160
    -             SHA-256 512    32    256
    -             SHA-384 1024   64    384
    -             SHA-512 1024   64    512
    -             
    -
    - - Copy constructor. This will copy the state of the provided - message digest. - - - reset the chaining variables - - - - Implementation of SHA-3 based on following KeccakNISTInterface.c from http://keccak.noekeon.org/ - - - Following the naming conventions used in the C source code to enable easy review of the implementation. - - - - Return the size of block that the compression function is applied to in bytes. - - @return internal byte length of a block. - - - Draft FIPS 180-2 implementation of SHA-512. Note: As this is - based on a draft this implementation is subject to change. - -
    -                     block  word  digest
    -             SHA-1   512    32    160
    -             SHA-256 512    32    256
    -             SHA-384 1024   64    384
    -             SHA-512 1024   64    512
    -             
    -
    - - Copy constructor. This will copy the state of the provided - message digest. - - - reset the chaining variables - - - FIPS 180-4 implementation of SHA-512/t - - - Standard constructor - - - Copy constructor. This will copy the state of the provided - message digest. - - - reset the chaining variables - - - Wrapper class that reduces the output length of a particular digest to - only the first n bytes of the digest function. - - - Base constructor. - - @param baseDigest underlying digest to use. - @param length length in bytes of the output of doFinal. - @exception ArgumentException if baseDigest is null, or length is greater than baseDigest.GetDigestSize(). - - - implementation of Tiger based on: - - http://www.cs.technion.ac.il/~biham/Reports/Tiger - - - Standard constructor - - - Copy constructor. This will copy the state of the provided - message digest. - - - reset the chaining variables - - - Implementation of WhirlpoolDigest, based on Java source published by Barreto - and Rijmen. - - - - Copy constructor. This will copy the state of the provided message - digest. - - - Reset the chaining variables - - - ISO 9796-1 padding. Note in the light of recent results you should - only use this with RSA (rather than the "simpler" Rabin keys) and you - should never use it with anything other than a hash (ie. even if the - message is small don't sign the message, sign it's hash) or some "random" - value. See your favorite search engine for details. - - - return the input block size. The largest message we can process - is (key_size_in_bits + 3)/16, which in our world comes to - key_size_in_bytes / 2. - - - return the maximum possible size for the output. - - - set the number of bits in the next message to be treated as - pad bits. - - - retrieve the number of pad bits in the last decoded message. - - - @exception InvalidCipherTextException if the decrypted block is not a valid ISO 9796 bit string - - - Optimal Asymmetric Encryption Padding (OAEP) - see PKCS 1 V 2. - - - @exception InvalidCipherTextException if the decrypted block turns out to - be badly formatted. - - - int to octet string. - - - mask generator function, as described in PKCS1v2. - - - this does your basic Pkcs 1 v1.5 padding - whether or not you should be using this - depends on your application - see Pkcs1 Version 2 for details. - - - some providers fail to include the leading zero in PKCS1 encoded blocks. If you need to - work with one of these set the system property Org.BouncyCastle.Pkcs1.Strict to false. - - - The same effect can be achieved by setting the static property directly -

    - The static property is checked during construction of the encoding object, it is set to - true by default. -

    -
    - - Basic constructor. - @param cipher - - - @exception InvalidCipherTextException if the decrypted block is not in Pkcs1 format. - - - an implementation of the AES (Rijndael), from FIPS-197. -

    - For further details see: http://csrc.nist.gov/encryption/aes/. - - This implementation is based on optimizations from Dr. Brian Gladman's paper and C code at - http://fp.gladman.plus.com/cryptography_technology/rijndael/ - - There are three levels of tradeoff of speed vs memory - Because java has no preprocessor, they are written as three separate classes from which to choose - - The fastest uses 8Kbytes of static tables to precompute round calculations, 4 256 word tables for encryption - and 4 for decryption. - - The middle performance version uses only one 256 word table for each, for a total of 2Kbytes, - adding 12 rotate operations per round to compute the values contained in the other tables from - the contents of the first. - - The slowest version uses no static tables at all and computes the values in each round. -

    -

    - This file contains the middle performance version with 2Kbytes of static tables for round precomputation. -

    -
    - - Calculate the necessary round keys - The number of calculations depends on key size and block size - AES specified a fixed block size of 128 bits and key sizes 128/192/256 bits - This code is written assuming those are the only possible values - - - default constructor - 128 bit block size. - - - initialise an AES cipher. - - @param forEncryption whether or not we are for encryption. - @param parameters the parameters required to set up the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - an implementation of the AES (Rijndael)), from FIPS-197. -

    - For further details see: http://csrc.nist.gov/encryption/aes/. - - This implementation is based on optimizations from Dr. Brian Gladman's paper and C code at - http://fp.gladman.plus.com/cryptography_technology/rijndael/ - - There are three levels of tradeoff of speed vs memory - Because java has no preprocessor), they are written as three separate classes from which to choose - - The fastest uses 8Kbytes of static tables to precompute round calculations), 4 256 word tables for encryption - and 4 for decryption. - - The middle performance version uses only one 256 word table for each), for a total of 2Kbytes), - adding 12 rotate operations per round to compute the values contained in the other tables from - the contents of the first - - The slowest version uses no static tables at all and computes the values in each round -

    -

    - This file contains the fast version with 8Kbytes of static tables for round precomputation -

    -
    - - Calculate the necessary round keys - The number of calculations depends on key size and block size - AES specified a fixed block size of 128 bits and key sizes 128/192/256 bits - This code is written assuming those are the only possible values - - - default constructor - 128 bit block size. - - - initialise an AES cipher. - - @param forEncryption whether or not we are for encryption. - @param parameters the parameters required to set up the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - an implementation of the AES (Rijndael), from FIPS-197. -

    - For further details see: http://csrc.nist.gov/encryption/aes/. - - This implementation is based on optimizations from Dr. Brian Gladman's paper and C code at - http://fp.gladman.plus.com/cryptography_technology/rijndael/ - - There are three levels of tradeoff of speed vs memory - Because java has no preprocessor, they are written as three separate classes from which to choose - - The fastest uses 8Kbytes of static tables to precompute round calculations, 4 256 word tables for encryption - and 4 for decryption. - - The middle performance version uses only one 256 word table for each, for a total of 2Kbytes, - adding 12 rotate operations per round to compute the values contained in the other tables from - the contents of the first - - The slowest version uses no static tables at all and computes the values - in each round. -

    -

    - This file contains the slowest performance version with no static tables - for round precomputation, but it has the smallest foot print. -

    -
    - - Calculate the necessary round keys - The number of calculations depends on key size and block size - AES specified a fixed block size of 128 bits and key sizes 128/192/256 bits - This code is written assuming those are the only possible values - - - default constructor - 128 bit block size. - - - initialise an AES cipher. - - @param forEncryption whether or not we are for encryption. - @param parameters the parameters required to set up the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - - An implementation of the AES Key Wrapper from the NIST Key Wrap Specification. -

    - For further details see: http://csrc.nist.gov/encryption/kms/key-wrap.pdf. - - - - A class that provides Blowfish key encryption operations, - such as encoding data and generating keys. - All the algorithms herein are from Applied Cryptography - and implement a simplified cryptography interface. - - - initialise a Blowfish cipher. - - @param forEncryption whether or not we are for encryption. - @param parameters the parameters required to set up the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - apply the encryption cycle to each value pair in the table. - - - Encrypt the given input starting at the given offset and place - the result in the provided buffer starting at the given offset. - The input will be an exact multiple of our blocksize. - - - Decrypt the given input starting at the given offset and place - the result in the provided buffer starting at the given offset. - The input will be an exact multiple of our blocksize. - - - Camellia - based on RFC 3713. - - - Camellia - based on RFC 3713, smaller implementation, about half the size of CamelliaEngine. - - - - An implementation of the Camellia key wrapper based on RFC 3657/RFC 3394. -

    - For further details see: http://www.ietf.org/rfc/rfc3657.txt. - - - - A class that provides CAST key encryption operations, - such as encoding data and generating keys. - - All the algorithms herein are from the Internet RFC's - - RFC2144 - Cast5 (64bit block, 40-128bit key) - RFC2612 - CAST6 (128bit block, 128-256bit key) - - and implement a simplified cryptography interface. - - - initialise a CAST cipher. - - @param forEncryption whether or not we are for encryption. - @param parameters the parameters required to set up the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - Encrypt the given input starting at the given offset and place - the result in the provided buffer starting at the given offset. - - @param src The plaintext buffer - @param srcIndex An offset into src - @param dst The ciphertext buffer - @param dstIndex An offset into dst - - - Decrypt the given input starting at the given offset and place - the result in the provided buffer starting at the given offset. - - @param src The plaintext buffer - @param srcIndex An offset into src - @param dst The ciphertext buffer - @param dstIndex An offset into dst - - - The first of the three processing functions for the - encryption and decryption. - - @param D the input to be processed - @param Kmi the mask to be used from Km[n] - @param Kri the rotation value to be used - - - - The second of the three processing functions for the - encryption and decryption. - - @param D the input to be processed - @param Kmi the mask to be used from Km[n] - @param Kri the rotation value to be used - - - - The third of the three processing functions for the - encryption and decryption. - - @param D the input to be processed - @param Kmi the mask to be used from Km[n] - @param Kri the rotation value to be used - - - - Does the 16 rounds to encrypt the block. - - @param L0 the LH-32bits of the plaintext block - @param R0 the RH-32bits of the plaintext block - - - A class that provides CAST6 key encryption operations, - such as encoding data and generating keys. - - All the algorithms herein are from the Internet RFC - - RFC2612 - CAST6 (128bit block, 128-256bit key) - - and implement a simplified cryptography interface. - - - Encrypt the given input starting at the given offset and place - the result in the provided buffer starting at the given offset. - - @param src The plaintext buffer - @param srcIndex An offset into src - @param dst The ciphertext buffer - @param dstIndex An offset into dst - - - Decrypt the given input starting at the given offset and place - the result in the provided buffer starting at the given offset. - - @param src The plaintext buffer - @param srcIndex An offset into src - @param dst The ciphertext buffer - @param dstIndex An offset into dst - - - Does the 12 quad rounds rounds to encrypt the block. - - @param A the 00-31 bits of the plaintext block - @param B the 32-63 bits of the plaintext block - @param C the 64-95 bits of the plaintext block - @param D the 96-127 bits of the plaintext block - @param result the resulting ciphertext - - - Does the 12 quad rounds rounds to decrypt the block. - - @param A the 00-31 bits of the ciphertext block - @param B the 32-63 bits of the ciphertext block - @param C the 64-95 bits of the ciphertext block - @param D the 96-127 bits of the ciphertext block - @param result the resulting plaintext - - - A class that provides a basic DESede (or Triple DES) engine. - - - initialise a DESede cipher. - - @param forEncryption whether or not we are for encryption. - @param parameters the parameters required to set up the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - * Wrap keys according to - * - * draft-ietf-smime-key-wrap-01.txt. - *

    - * Note: - *

      - *
    • this is based on a draft, and as such is subject to change - don't use this class for anything requiring long term storage.
    • - *
    • if you are using this to wrap triple-des keys you need to set the - * parity bits on the key and, if it's a two-key triple-des key, pad it - * yourself.
    • - *
    - *

    -
    - - Field engine - - - Field param - - - Field paramPlusIV - - - Field iv - - - Field forWrapping - - - Field IV2 - - - Method init - - @param forWrapping - @param param - - - Method GetAlgorithmName - - @return - - - Method wrap - - @param in - @param inOff - @param inLen - @return - - - Method unwrap - - @param in - @param inOff - @param inLen - @return - @throws InvalidCipherTextException - - - Some key wrap algorithms make use of the Key Checksum defined - in CMS [CMS-Algorithms]. This is used to provide an integrity - check value for the key being wrapped. The algorithm is - - - Compute the 20 octet SHA-1 hash on the key being wrapped. - - Use the first 8 octets of this hash as the checksum value. - - @param key - @return - @throws Exception - @see http://www.w3.org/TR/xmlenc-core/#sec-CMSKeyChecksum - - - @param key - @param checksum - @return - @see http://www.w3.org/TR/xmlenc-core/#sec-CMSKeyChecksum - - - A class that provides a basic DES engine. - - - initialise a DES cipher. - - @param forEncryption whether or not we are for encryption. - @param parameters the parameters required to set up the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - what follows is mainly taken from "Applied Cryptography", by - Bruce Schneier, however it also bears great resemblance to Richard - Outerbridge's D3DES... - - - Generate an integer based working key based on our secret key - and what we processing we are planning to do. - - Acknowledgements for this routine go to James Gillogly and Phil Karn. - (whoever, and wherever they are!). - - - the DES engine. - - - this does your basic ElGamal algorithm. - - - initialise the ElGamal engine. - - @param forEncryption true if we are encrypting, false otherwise. - @param param the necessary ElGamal key parameters. - - - Return the maximum size for an input block to this engine. - For ElGamal this is always one byte less than the size of P on - encryption, and twice the length as the size of P on decryption. - - @return maximum size for an input block. - - - Return the maximum size for an output block to this engine. - For ElGamal this is always one byte less than the size of P on - decryption, and twice the length as the size of P on encryption. - - @return maximum size for an output block. - - - Process a single block using the basic ElGamal algorithm. - - @param in the input array. - @param inOff the offset into the input buffer where the data starts. - @param length the length of the data to be processed. - @return the result of the ElGamal process. - @exception DataLengthException the input block is too large. - - - implementation of GOST 28147-89 - - - standard constructor. - - - initialise an Gost28147 cipher. - - @param forEncryption whether or not we are for encryption. - @param parameters the parameters required to set up the cipher. - @exception ArgumentException if the parameters argument is inappropriate. - - - Return the S-Box associated with SBoxName - @param sBoxName name of the S-Box - @return byte array representing the S-Box - - - HC-128 is a software-efficient stream cipher created by Hongjun Wu. It - generates keystream from a 128-bit secret key and a 128-bit initialization - vector. -

    - http://www.ecrypt.eu.org/stream/p3ciphers/hc/hc128_p3.pdf -

    - It is a third phase candidate in the eStream contest, and is patent-free. - No attacks are known as of today (April 2007). See - - http://www.ecrypt.eu.org/stream/hcp3.html -

    -
    - - Initialise a HC-128 cipher. - - @param forEncryption whether or not we are for encryption. Irrelevant, as - encryption and decryption are the same. - @param params the parameters required to set up the cipher. - @throws ArgumentException if the params argument is - inappropriate (ie. the key is not 128 bit long). - - - HC-256 is a software-efficient stream cipher created by Hongjun Wu. It - generates keystream from a 256-bit secret key and a 256-bit initialization - vector. -

    - http://www.ecrypt.eu.org/stream/p3ciphers/hc/hc256_p3.pdf -

    - Its brother, HC-128, is a third phase candidate in the eStream contest. - The algorithm is patent-free. No attacks are known as of today (April 2007). - See - - http://www.ecrypt.eu.org/stream/hcp3.html -

    -
    - - Initialise a HC-256 cipher. - - @param forEncryption whether or not we are for encryption. Irrelevant, as - encryption and decryption are the same. - @param params the parameters required to set up the cipher. - @throws ArgumentException if the params argument is - inappropriate (ie. the key is not 256 bit long). - - - support class for constructing intergrated encryption ciphers - for doing basic message exchanges on top of key agreement ciphers - - - set up for use with stream mode, where the key derivation function - is used to provide a stream of bytes to xor with the message. - - @param agree the key agreement used as the basis for the encryption - @param kdf the key derivation function used for byte generation - @param mac the message authentication code generator for the message - - - set up for use in conjunction with a block cipher to handle the - message. - - @param agree the key agreement used as the basis for the encryption - @param kdf the key derivation function used for byte generation - @param mac the message authentication code generator for the message - @param cipher the cipher to used for encrypting the message - - - Initialise the encryptor. - - @param forEncryption whether or not this is encryption/decryption. - @param privParam our private key parameters - @param pubParam the recipient's/sender's public key parameters - @param param encoding and derivation parameters. - - - Implementation of Bob Jenkin's ISAAC (Indirection Shift Accumulate Add and Count). - see: http://www.burtleburtle.net/bob/rand/isaacafa.html - - - initialise an ISAAC cipher. - - @param forEncryption whether or not we are for encryption. - @param params the parameters required to set up the cipher. - @exception ArgumentException if the params argument is - inappropriate. - - - NaccacheStern Engine. For details on this cipher, please see - http://www.gemplus.com/smart/rd/publications/pdf/NS98pkcs.pdf - - - Initializes this algorithm. Must be called before all other Functions. - - @see org.bouncycastle.crypto.AsymmetricBlockCipher#init(bool, - org.bouncycastle.crypto.CipherParameters) - - - Returns the input block size of this algorithm. - - @see org.bouncycastle.crypto.AsymmetricBlockCipher#GetInputBlockSize() - - - Returns the output block size of this algorithm. - - @see org.bouncycastle.crypto.AsymmetricBlockCipher#GetOutputBlockSize() - - - Process a single Block using the Naccache-Stern algorithm. - - @see org.bouncycastle.crypto.AsymmetricBlockCipher#ProcessBlock(byte[], - int, int) - - - Encrypts a BigInteger aka Plaintext with the public key. - - @param plain - The BigInteger to encrypt - @return The byte[] representation of the encrypted BigInteger (i.e. - crypted.toByteArray()) - - - Adds the contents of two encrypted blocks mod sigma - - @param block1 - the first encrypted block - @param block2 - the second encrypted block - @return encrypt((block1 + block2) mod sigma) - @throws InvalidCipherTextException - - - Convenience Method for data exchange with the cipher. - - Determines blocksize and splits data to blocksize. - - @param data the data to be processed - @return the data after it went through the NaccacheSternEngine. - @throws InvalidCipherTextException - - - Computes the integer x that is expressed through the given primes and the - congruences with the chinese remainder theorem (CRT). - - @param congruences - the congruences c_i - @param primes - the primes p_i - @return an integer x for that x % p_i == c_i - - - A Noekeon engine, using direct-key mode. - - - Create an instance of the Noekeon encryption algorithm - and set some defaults - - - initialise - - @param forEncryption whether or not we are for encryption. - @param params the parameters required to set up the cipher. - @exception ArgumentException if the params argument is - inappropriate. - - - Re-key the cipher. - - @param key the key to be used - - - The no-op engine that just copies bytes through, irrespective of whether encrypting and decrypting. - Provided for the sake of completeness. - - - an implementation of RC2 as described in RFC 2268 - "A Description of the RC2(r) Encryption Algorithm" R. Rivest. - - - initialise a RC2 cipher. - - @param forEncryption whether or not we are for encryption. - @param parameters the parameters required to set up the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - return the result rotating the 16 bit number in x left by y - - - Wrap keys according to RFC 3217 - RC2 mechanism - - - Field engine - - - Field param - - - Field paramPlusIV - - - Field iv - - - Field forWrapping - - - Field IV2 - - - Method init - - @param forWrapping - @param param - - - Method GetAlgorithmName - - @return - - - Method wrap - - @param in - @param inOff - @param inLen - @return - - - Method unwrap - - @param in - @param inOff - @param inLen - @return - @throws InvalidCipherTextException - - - Some key wrap algorithms make use of the Key Checksum defined - in CMS [CMS-Algorithms]. This is used to provide an integrity - check value for the key being wrapped. The algorithm is - - - Compute the 20 octet SHA-1 hash on the key being wrapped. - - Use the first 8 octets of this hash as the checksum value. - - @param key - @return - @throws Exception - @see http://www.w3.org/TR/xmlenc-core/#sec-CMSKeyChecksum - - - @param key - @param checksum - @return - @see http://www.w3.org/TR/xmlenc-core/#sec-CMSKeyChecksum - - - initialise a RC4 cipher. - - @param forEncryption whether or not we are for encryption. - @param parameters the parameters required to set up the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - The specification for RC5 came from the RC5 Encryption Algorithm - publication in RSA CryptoBytes, Spring of 1995. - http://www.rsasecurity.com/rsalabs/cryptobytes. -

    - This implementation has a word size of 32 bits.

    -
    - - Create an instance of the RC5 encryption algorithm - and set some defaults - - - initialise a RC5-32 cipher. - - @param forEncryption whether or not we are for encryption. - @param parameters the parameters required to set up the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - Re-key the cipher. - - @param key the key to be used - - - Encrypt the given block starting at the given offset and place - the result in the provided buffer starting at the given offset. - - @param in in byte buffer containing data to encrypt - @param inOff offset into src buffer - @param out out buffer where encrypted data is written - @param outOff offset into out buffer - - - Perform a left "spin" of the word. The rotation of the given - word x is rotated left by y bits. - Only the lg(32) low-order bits of y - are used to determine the rotation amount. Here it is - assumed that the wordsize used is a power of 2. - - @param x word to rotate - @param y number of bits to rotate % 32 - - - Perform a right "spin" of the word. The rotation of the given - word x is rotated left by y bits. - Only the lg(32) low-order bits of y - are used to determine the rotation amount. Here it is - assumed that the wordsize used is a power of 2. - - @param x word to rotate - @param y number of bits to rotate % 32 - - - The specification for RC5 came from the RC5 Encryption Algorithm - publication in RSA CryptoBytes, Spring of 1995. - http://www.rsasecurity.com/rsalabs/cryptobytes. -

    - This implementation is set to work with a 64 bit word size.

    -
    - - Create an instance of the RC5 encryption algorithm - and set some defaults - - - initialise a RC5-64 cipher. - - @param forEncryption whether or not we are for encryption. - @param parameters the parameters required to set up the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - Re-key the cipher. - - @param key the key to be used - - - Encrypt the given block starting at the given offset and place - the result in the provided buffer starting at the given offset. - - @param in in byte buffer containing data to encrypt - @param inOff offset into src buffer - @param out out buffer where encrypted data is written - @param outOff offset into out buffer - - - Perform a left "spin" of the word. The rotation of the given - word x is rotated left by y bits. - Only the lg(wordSize) low-order bits of y - are used to determine the rotation amount. Here it is - assumed that the wordsize used is a power of 2. - - @param x word to rotate - @param y number of bits to rotate % wordSize - - - Perform a right "spin" of the word. The rotation of the given - word x is rotated left by y bits. - Only the lg(wordSize) low-order bits of y - are used to determine the rotation amount. Here it is - assumed that the wordsize used is a power of 2. - - @param x word to rotate - @param y number of bits to rotate % wordSize - - - An RC6 engine. - - - Create an instance of the RC6 encryption algorithm - and set some defaults - - - initialise a RC5-32 cipher. - - @param forEncryption whether or not we are for encryption. - @param parameters the parameters required to set up the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - Re-key the cipher. - - @param inKey the key to be used - - - Perform a left "spin" of the word. The rotation of the given - word x is rotated left by y bits. - Only the lg(wordSize) low-order bits of y - are used to determine the rotation amount. Here it is - assumed that the wordsize used is a power of 2. - - @param x word to rotate - @param y number of bits to rotate % wordSize - - - Perform a right "spin" of the word. The rotation of the given - word x is rotated left by y bits. - Only the lg(wordSize) low-order bits of y - are used to determine the rotation amount. Here it is - assumed that the wordsize used is a power of 2. - - @param x word to rotate - @param y number of bits to rotate % wordSize - - - an implementation of the RFC 3211 Key Wrap - Specification. - - - - An implementation of the AES Key Wrapper from the NIST Key Wrap - Specification as described in RFC 3394. -

    - For further details see: http://www.ietf.org/rfc/rfc3394.txt - and http://csrc.nist.gov/encryption/kms/key-wrap.pdf. - - - - an implementation of Rijndael, based on the documentation and reference implementation - by Paulo Barreto, Vincent Rijmen, for v2.0 August '99. -

    - Note: this implementation is based on information prior to readonly NIST publication. -

    -
    - - multiply two elements of GF(2^m) - needed for MixColumn and InvMixColumn - - - xor corresponding text input and round key input bytes - - - Row 0 remains unchanged - The other three rows are shifted a variable amount - - - Replace every byte of the input by the byte at that place - in the nonlinear S-box - - - Mix the bytes of every column in a linear way - - - Mix the bytes of every column in a linear way - This is the opposite operation of Mixcolumn - - - Calculate the necessary round keys - The number of calculations depends on keyBits and blockBits - - - default constructor - 128 bit block size. - - - basic constructor - set the cipher up for a given blocksize - - @param blocksize the blocksize in bits, must be 128, 192, or 256. - - - initialise a Rijndael cipher. - - @param forEncryption whether or not we are for encryption. - @param parameters the parameters required to set up the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - this does your basic RSA algorithm with blinding - - - initialise the RSA engine. - - @param forEncryption true if we are encrypting, false otherwise. - @param param the necessary RSA key parameters. - - - Return the maximum size for an input block to this engine. - For RSA this is always one byte less than the key size on - encryption, and the same length as the key size on decryption. - - @return maximum size for an input block. - - - Return the maximum size for an output block to this engine. - For RSA this is always one byte less than the key size on - decryption, and the same length as the key size on encryption. - - @return maximum size for an output block. - - - Process a single block using the basic RSA algorithm. - - @param inBuf the input array. - @param inOff the offset into the input buffer where the data starts. - @param inLen the length of the data to be processed. - @return the result of the RSA process. - @exception DataLengthException the input block is too large. - - - This does your basic RSA Chaum's blinding and unblinding as outlined in - "Handbook of Applied Cryptography", page 475. You need to use this if you are - trying to get another party to generate signatures without them being aware - of the message they are signing. - - - Initialise the blinding engine. - - @param forEncryption true if we are encrypting (blinding), false otherwise. - @param param the necessary RSA key parameters. - - - Return the maximum size for an input block to this engine. - For RSA this is always one byte less than the key size on - encryption, and the same length as the key size on decryption. - - @return maximum size for an input block. - - - Return the maximum size for an output block to this engine. - For RSA this is always one byte less than the key size on - decryption, and the same length as the key size on encryption. - - @return maximum size for an output block. - - - Process a single block using the RSA blinding algorithm. - - @param in the input array. - @param inOff the offset into the input buffer where the data starts. - @param inLen the length of the data to be processed. - @return the result of the RSA process. - @throws DataLengthException the input block is too large. - - - this does your basic RSA algorithm. - - - initialise the RSA engine. - - @param forEncryption true if we are encrypting, false otherwise. - @param param the necessary RSA key parameters. - - - Return the maximum size for an input block to this engine. - For RSA this is always one byte less than the key size on - encryption, and the same length as the key size on decryption. - - @return maximum size for an input block. - - - Return the maximum size for an output block to this engine. - For RSA this is always one byte less than the key size on - decryption, and the same length as the key size on encryption. - - @return maximum size for an output block. - - - this does your basic RSA algorithm. - - - initialise the RSA engine. - - @param forEncryption true if we are encrypting, false otherwise. - @param param the necessary RSA key parameters. - - - Return the maximum size for an input block to this engine. - For RSA this is always one byte less than the key size on - encryption, and the same length as the key size on decryption. - - @return maximum size for an input block. - - - Return the maximum size for an output block to this engine. - For RSA this is always one byte less than the key size on - decryption, and the same length as the key size on encryption. - - @return maximum size for an output block. - - - Process a single block using the basic RSA algorithm. - - @param inBuf the input array. - @param inOff the offset into the input buffer where the data starts. - @param inLen the length of the data to be processed. - @return the result of the RSA process. - @exception DataLengthException the input block is too large. - - - Implementation of Daniel J. Bernstein's Salsa20 stream cipher, Snuffle 2005 - - - Constants - - - initialise a Salsa20 cipher. - - @param forEncryption whether or not we are for encryption. - @param params the parameters required to set up the cipher. - @exception ArgumentException if the params argument is - inappropriate. - - - Implementation of the SEED algorithm as described in RFC 4009 - - - - An implementation of the SEED key wrapper based on RFC 4010/RFC 3394. -

    - For further details see: http://www.ietf.org/rfc/rfc4010.txt. - - - - * Serpent is a 128-bit 32-round block cipher with variable key lengths, - * including 128, 192 and 256 bit keys conjectured to be at least as - * secure as three-key triple-DES. - *

    - * Serpent was designed by Ross Anderson, Eli Biham and Lars Knudsen as a - * candidate algorithm for the NIST AES Quest.> - *

    - *

    - * For full details see the The Serpent home page - *

    -
    - - initialise a Serpent cipher. - - @param forEncryption whether or not we are for encryption. - @param parameters the parameters required to set up the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - Process one block of input from the array in and write it to - the out array. - - @param in the array containing the input data. - @param inOff offset into the in array the data starts at. - @param out the array the output data will be copied into. - @param outOff the offset into the out array the output will start at. - @exception DataLengthException if there isn't enough data in in, or - space in out. - @exception InvalidOperationException if the cipher isn't initialised. - @return the number of bytes processed and produced. - - - Expand a user-supplied key material into a session key. - - @param key The user-key bytes (multiples of 4) to use. - @exception ArgumentException - - - Encrypt one block of plaintext. - - @param in the array containing the input data. - @param inOff offset into the in array the data starts at. - @param out the array the output data will be copied into. - @param outOff the offset into the out array the output will start at. - - - Decrypt one block of ciphertext. - - @param in the array containing the input data. - @param inOff offset into the in array the data starts at. - @param out the array the output data will be copied into. - @param outOff the offset into the out array the output will start at. - - - S0 - { 3, 8,15, 1,10, 6, 5,11,14,13, 4, 2, 7, 0, 9,12 } - 15 terms. - - - InvSO - {13, 3,11, 0,10, 6, 5,12, 1,14, 4, 7,15, 9, 8, 2 } - 15 terms. - - - S1 - {15,12, 2, 7, 9, 0, 5,10, 1,11,14, 8, 6,13, 3, 4 } - 14 terms. - - - InvS1 - { 5, 8, 2,14,15, 6,12, 3,11, 4, 7, 9, 1,13,10, 0 } - 14 steps. - - - S2 - { 8, 6, 7, 9, 3,12,10,15,13, 1,14, 4, 0,11, 5, 2 } - 16 terms. - - - InvS2 - {12, 9,15, 4,11,14, 1, 2, 0, 3, 6,13, 5, 8,10, 7 } - 16 steps. - - - S3 - { 0,15,11, 8,12, 9, 6, 3,13, 1, 2, 4,10, 7, 5,14 } - 16 terms. - - - InvS3 - { 0, 9,10, 7,11,14, 6,13, 3, 5,12, 2, 4, 8,15, 1 } - 15 terms - - - S4 - { 1,15, 8, 3,12, 0,11, 6, 2, 5, 4,10, 9,14, 7,13 } - 15 terms. - - - InvS4 - { 5, 0, 8, 3,10, 9, 7,14, 2,12,11, 6, 4,15,13, 1 } - 15 terms. - - - S5 - {15, 5, 2,11, 4,10, 9,12, 0, 3,14, 8,13, 6, 7, 1 } - 16 terms. - - - InvS5 - { 8,15, 2, 9, 4, 1,13,14,11, 6, 5, 3, 7,12,10, 0 } - 16 terms. - - - S6 - { 7, 2,12, 5, 8, 4, 6,11,14, 9, 1,15,13, 3,10, 0 } - 15 terms. - - - InvS6 - {15,10, 1,13, 5, 3, 6, 0, 4, 9,14, 7, 2,12, 8,11 } - 15 terms. - - - S7 - { 1,13,15, 0,14, 8, 2,11, 7, 4,12,10, 9, 3, 5, 6 } - 16 terms. - - - InvS7 - { 3, 0, 6,13, 9,14,15, 8, 5,12,11, 7,10, 1, 4, 2 } - 17 terms. - - - Apply the linear transformation to the register set. - - - Apply the inverse of the linear transformation to the register set. - - - a class that provides a basic SKIPJACK engine. - - - initialise a SKIPJACK cipher. - - @param forEncryption whether or not we are for encryption. - @param parameters the parameters required to set up the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - The G permutation - - - the inverse of the G permutation. - - - An TEA engine. - - - Create an instance of the TEA encryption algorithm - and set some defaults - - - initialise - - @param forEncryption whether or not we are for encryption. - @param params the parameters required to set up the cipher. - @exception ArgumentException if the params argument is - inappropriate. - - - Re-key the cipher. - - @param key the key to be used - - - A class that provides Twofish encryption operations. - - This Java implementation is based on the Java reference - implementation provided by Bruce Schneier and developed - by Raif S. Naffah. - - - Define the fixed p0/p1 permutations used in keyed S-box lookup. - By changing the following constant definitions, the S-boxes will - automatically Get changed in the Twofish engine. - - - gSubKeys[] and gSBox[] are eventually used in the - encryption and decryption methods. - - - initialise a Twofish cipher. - - @param forEncryption whether or not we are for encryption. - @param parameters the parameters required to set up the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - Encrypt the given input starting at the given offset and place - the result in the provided buffer starting at the given offset. - The input will be an exact multiple of our blocksize. - - encryptBlock uses the pre-calculated gSBox[] and subKey[] - arrays. - - - Decrypt the given input starting at the given offset and place - the result in the provided buffer starting at the given offset. - The input will be an exact multiple of our blocksize. - - - Use (12, 8) Reed-Solomon code over GF(256) to produce - a key S-box 32-bit entity from 2 key material 32-bit - entities. - - @param k0 first 32-bit entity - @param k1 second 32-bit entity - @return Remainder polynomial Generated using RS code - - - * Reed-Solomon code parameters: (12,8) reversible code: - *

    - *

    -                    * G(x) = x^4 + (a+1/a)x^3 + ax^2 + (a+1/a)x + 1
    -                    * 
    - * where a = primitive root of field generator 0x14D - *

    -
    - - initialise a VMPC cipher. - - @param forEncryption - whether or not we are for encryption. - @param params - the parameters required to set up the cipher. - @exception ArgumentException - if the params argument is inappropriate. - - - An XTEA engine. - - - Create an instance of the TEA encryption algorithm - and set some defaults - - - initialise - - @param forEncryption whether or not we are for encryption. - @param params the parameters required to set up the cipher. - @exception ArgumentException if the params argument is - inappropriate. - - - Re-key the cipher. - - @param key the key to be used - - - Basic KDF generator for derived keys and ivs as defined by IEEE P1363a/ISO 18033 -
    - This implementation is based on ISO 18033/P1363a. -
    - - Construct a KDF Parameters generator. - - @param counterStart value of counter. - @param digest the digest to be used as the source of derived keys. - - - return the underlying digest. - - - fill len bytes of the output buffer with bytes generated from - the derivation function. - - @throws ArgumentException if the size of the request will cause an overflow. - @throws DataLengthException if the out buffer is too small. - - - initialise the key generator - if strength is set to zero - the key Generated will be 192 bits in size, otherwise - strength can be 128 or 192 (or 112 or 168 if you don't count - parity bits), depending on whether you wish to do 2-key or 3-key - triple DES. - - @param param the parameters to be used for key generation - - - initialise the key generator - if strength is set to zero - the key generated will be 64 bits in size, otherwise - strength can be 64 or 56 bits (if you don't count the parity bits). - - @param param the parameters to be used for key generation - - - a basic Diffie-Hellman key pair generator. - - This generates keys consistent for use with the basic algorithm for - Diffie-Hellman. - - - a Diffie-Hellman key pair generator. - - This generates keys consistent for use in the MTI/A0 key agreement protocol - as described in "Handbook of Applied Cryptography", Pages 516-519. - - - which Generates the p and g values from the given parameters, - returning the DHParameters object. -

    - Note: can take a while...

    -
    - - * a DSA key pair generator. - * - * This Generates DSA keys in line with the method described - * in FIPS 186-3 B.1 FFC Key Pair Generation. - - - Generate suitable parameters for DSA, in line with FIPS 186-2, or FIPS 186-3. - - - initialise the key generator. - - @param size size of the key (range 2^512 -> 2^1024 - 64 bit increments) - @param certainty measure of robustness of prime (for FIPS 186-2 compliance this should be at least 80). - @param random random byte source. - - - Initialise the key generator for DSA 2. -

    - Use this init method if you need to generate parameters for DSA 2 keys. -

    - - @param params DSA 2 key generation parameters. -
    - - which Generates the p and g values from the given parameters, - returning the DsaParameters object. -

    - Note: can take a while...

    -
    - - generate suitable parameters for DSA, in line with - FIPS 186-3 A.1 Generation of the FFC Primes p and q. - - - Given the domain parameters this routine Generates an EC key - pair in accordance with X9.62 section 5.2.1 pages 26, 27. - - - a ElGamal key pair generator. -

    - This Generates keys consistent for use with ElGamal as described in - page 164 of "Handbook of Applied Cryptography".

    -
    - - * which Generates the p and g values from the given parameters, - * returning the ElGamalParameters object. - *

    - * Note: can take a while... - *

    -
    - - a GOST3410 key pair generator. - This generates GOST3410 keys in line with the method described - in GOST R 34.10-94. - - - generate suitable parameters for GOST3410. - - - initialise the key generator. - - @param size size of the key - @param typeProcedure type procedure A,B = 1; A',B' - else - @param random random byte source. - - - Procedure C - procedure generates the a value from the given p,q, - returning the a value. - - - which generates the p , q and a values from the given parameters, - returning the Gost3410Parameters object. - - - KFD2 generator for derived keys and ivs as defined by IEEE P1363a/ISO 18033 -
    - This implementation is based on IEEE P1363/ISO 18033. -
    - - Construct a KDF1 byte generator. - - @param digest the digest to be used as the source of derived keys. - - - KDF2 generator for derived keys and ivs as defined by IEEE P1363a/ISO 18033 -
    - This implementation is based on IEEE P1363/ISO 18033. -
    - - Construct a KDF2 bytes generator. Generates key material - according to IEEE P1363 or ISO 18033 depending on the initialisation. - - @param digest the digest to be used as the source of derived keys. - - - Generator for MGF1 as defined in Pkcs 1v2 - - - @param digest the digest to be used as the source of Generated bytes - - - return the underlying digest. - - - int to octet string. - - - fill len bytes of the output buffer with bytes Generated from - the derivation function. - - @throws DataLengthException if the out buffer is too small. - - - Key generation parameters for NaccacheStern cipher. For details on this cipher, please see - - http://www.gemplus.com/smart/rd/publications/pdf/NS98pkcs.pdf - - - Generates a permuted ArrayList from the original one. The original List - is not modified - - @param arr - the ArrayList to be permuted - @param rand - the source of Randomness for permutation - @return a new IList with the permuted elements. - - - Finds the first 'count' primes starting with 3 - - @param count - the number of primes to find - @return a vector containing the found primes as Integer - - - Generator for PBE derived keys and ivs as usd by OpenSSL. -

    - The scheme is a simple extension of PKCS 5 V2.0 Scheme 1 using MD5 with an - iteration count of 1. -

    -
    - - Construct a OpenSSL Parameters generator. - - - Initialise - note the iteration count for this algorithm is fixed at 1. - - @param password password to use. - @param salt salt to use. - - - the derived key function, the ith hash of the password and the salt. - - - Generate a key parameter derived from the password, salt, and iteration - count we are currently initialised with. - - @param keySize the size of the key we want (in bits) - @return a KeyParameter object. - @exception ArgumentException if the key length larger than the base hash size. - - - Generate a key with initialisation vector parameter derived from - the password, salt, and iteration count we are currently initialised - with. - - @param keySize the size of the key we want (in bits) - @param ivSize the size of the iv we want (in bits) - @return a ParametersWithIV object. - @exception ArgumentException if keySize + ivSize is larger than the base hash size. - - - Generate a key parameter for use with a MAC derived from the password, - salt, and iteration count we are currently initialised with. - - @param keySize the size of the key we want (in bits) - @return a KeyParameter object. - @exception ArgumentException if the key length larger than the base hash size. - - - Generator for Pbe derived keys and ivs as defined by Pkcs 12 V1.0. -

    - The document this implementation is based on can be found at - - RSA's Pkcs12 Page -

    -
    - - Construct a Pkcs 12 Parameters generator. - - @param digest the digest to be used as the source of derived keys. - @exception ArgumentException if an unknown digest is passed in. - - - add a + b + 1, returning the result in a. The a value is treated - as a BigInteger of length (b.Length * 8) bits. The result is - modulo 2^b.Length in case of overflow. - - - generation of a derived key ala Pkcs12 V1.0. - - - Generate a key parameter derived from the password, salt, and iteration - count we are currently initialised with. - - @param keySize the size of the key we want (in bits) - @return a KeyParameter object. - - - Generate a key with initialisation vector parameter derived from - the password, salt, and iteration count we are currently initialised - with. - - @param keySize the size of the key we want (in bits) - @param ivSize the size of the iv we want (in bits) - @return a ParametersWithIV object. - - - Generate a key parameter for use with a MAC derived from the password, - salt, and iteration count we are currently initialised with. - - @param keySize the size of the key we want (in bits) - @return a KeyParameter object. - - - Generator for Pbe derived keys and ivs as defined by Pkcs 5 V2.0 Scheme 1. - Note this generator is limited to the size of the hash produced by the - digest used to drive it. -

    - The document this implementation is based on can be found at - - RSA's Pkcs5 Page -

    -
    - - Construct a Pkcs 5 Scheme 1 Parameters generator. - - @param digest the digest to be used as the source of derived keys. - - - the derived key function, the ith hash of the mPassword and the mSalt. - - - Generate a key parameter derived from the mPassword, mSalt, and iteration - count we are currently initialised with. - - @param keySize the size of the key we want (in bits) - @return a KeyParameter object. - @exception ArgumentException if the key length larger than the base hash size. - - - Generate a key with initialisation vector parameter derived from - the mPassword, mSalt, and iteration count we are currently initialised - with. - - @param keySize the size of the key we want (in bits) - @param ivSize the size of the iv we want (in bits) - @return a ParametersWithIV object. - @exception ArgumentException if keySize + ivSize is larger than the base hash size. - - - Generate a key parameter for use with a MAC derived from the mPassword, - mSalt, and iteration count we are currently initialised with. - - @param keySize the size of the key we want (in bits) - @return a KeyParameter object. - @exception ArgumentException if the key length larger than the base hash size. - - - Generator for Pbe derived keys and ivs as defined by Pkcs 5 V2.0 Scheme 2. - This generator uses a SHA-1 HMac as the calculation function. -

    - The document this implementation is based on can be found at - - RSA's Pkcs5 Page

    -
    - - construct a Pkcs5 Scheme 2 Parameters generator. - - - Generate a key parameter derived from the password, salt, and iteration - count we are currently initialised with. - - @param keySize the size of the key we want (in bits) - @return a KeyParameter object. - - - Generate a key with initialisation vector parameter derived from - the password, salt, and iteration count we are currently initialised - with. - - @param keySize the size of the key we want (in bits) - @param ivSize the size of the iv we want (in bits) - @return a ParametersWithIV object. - - - Generate a key parameter for use with a MAC derived from the password, - salt, and iteration count we are currently initialised with. - - @param keySize the size of the key we want (in bits) - @return a KeyParameter object. - - - Generate a random factor suitable for use with RSA blind signatures - as outlined in Chaum's blinding and unblinding as outlined in - "Handbook of Applied Cryptography", page 475. - - - Initialise the factor generator - - @param param the necessary RSA key parameters. - - - Generate a suitable blind factor for the public key the generator was initialised with. - - @return a random blind factor - - - an RSA key pair generator. - - - Base interface for a public/private key block cipher. - - - The name of the algorithm this cipher implements. - - - Initialise the cipher. - Initialise for encryption if true, for decryption if false. - The key or other data required by the cipher. - - - The maximum size, in bytes, an input block may be. - - - The maximum size, in bytes, an output block will be. - - - Process a block. - The input buffer. - The offset into inBuf that the input block begins. - The length of the input block. - Input decrypts improperly. - Input is too large for the cipher. - - - interface that a public/private key pair generator should conform to. - - - intialise the key pair generator. - - @param the parameters the key pair is to be initialised with. - - - return an AsymmetricCipherKeyPair containing the Generated keys. - - @return an AsymmetricCipherKeyPair containing the Generated keys. - - - The basic interface that basic Diffie-Hellman implementations - conforms to. - - - initialise the agreement engine. - - - return the field size for the agreement algorithm in bytes. - - - given a public key from a given party calculate the next - message in the agreement sequence. - - - Base interface for a symmetric key block cipher. - - - The name of the algorithm this cipher implements. - - - Initialise the cipher. - Initialise for encryption if true, for decryption if false. - The key or other data required by the cipher. - - - The block size for this cipher, in bytes. - - - Indicates whether this cipher can handle partial blocks. - - - Process a block. - The input buffer. - The offset into inBuf that the input block begins. - The output buffer. - The offset into outBuf to write the output block. - If input block is wrong size, or outBuf too small. - The number of bytes processed and produced. - - - - Reset the cipher to the same state as it was after the last init (if there was one). - - - - Block cipher engines are expected to conform to this interface. - - - The name of the algorithm this cipher implements. - - - Initialise the cipher. - If true the cipher is initialised for encryption, - if false for decryption. - The key and other data required by the cipher. - - - - Reset the cipher. After resetting the cipher is in the same state - as it was after the last init (if there was one). - - - - all parameter classes implement this. - - - base interface for general purpose byte derivation functions. - - - return the message digest used as the basis for the function - - - Parameters for key/byte stream derivation classes - - - interface that a message digest conforms to. - - - return the algorithm name - - @return the algorithm name - - - return the size, in bytes, of the digest produced by this message digest. - - @return the size, in bytes, of the digest produced by this message digest. - - - return the size, in bytes, of the internal buffer used by this digest. - - @return the size, in bytes, of the internal buffer used by this digest. - - - update the message digest with a single byte. - - @param inByte the input byte to be entered. - - - update the message digest with a block of bytes. - - @param input the byte array containing the data. - @param inOff the offset into the byte array where the data starts. - @param len the length of the data. - - - Close the digest, producing the final digest value. The doFinal - call leaves the digest reset. - - @param output the array the digest is to be copied into. - @param outOff the offset into the out array the digest is to start at. - - - reset the digest back to it's initial state. - - - interface for classes implementing the Digital Signature Algorithm - - - initialise the signer for signature generation or signature - verification. - - @param forSigning true if we are generating a signature, false - otherwise. - @param param key parameters for signature generation. - - - sign the passed in message (usually the output of a hash function). - - @param message the message to be signed. - @return two big integers representing the r and s values respectively. - - - verify the message message against the signature values r and s. - - @param message the message that was supposed to have been signed. - @param r the r signature value. - @param s the s signature value. - - - The base interface for implementations of message authentication codes (MACs). - - - Initialise the MAC. - - @param param the key and other data required by the MAC. - @exception ArgumentException if the parameters argument is - inappropriate. - - - Return the name of the algorithm the MAC implements. - - @return the name of the algorithm the MAC implements. - - - Return the block size for this MAC (in bytes). - - @return the block size for this MAC in bytes. - - - add a single byte to the mac for processing. - - @param in the byte to be processed. - @exception InvalidOperationException if the MAC is not initialised. - - - @param in the array containing the input. - @param inOff the index in the array the data begins at. - @param len the length of the input starting at inOff. - @exception InvalidOperationException if the MAC is not initialised. - @exception DataLengthException if there isn't enough data in in. - - - Compute the final stage of the MAC writing the output to the out - parameter. -

    - doFinal leaves the MAC in the same state it was after the last init. -

    - @param out the array the MAC is to be output to. - @param outOff the offset into the out buffer the output is to start at. - @exception DataLengthException if there isn't enough space in out. - @exception InvalidOperationException if the MAC is not initialised. -
    - - Reset the MAC. At the end of resetting the MAC should be in the - in the same state it was after the last init (if there was one). - - - this exception is thrown whenever we find something we don't expect in a - message. - - - base constructor. - - - create a InvalidCipherTextException with the given message. - - @param message the message to be carried with the exception. - - - Return the name of the algorithm the signer implements. - - @return the name of the algorithm the signer implements. - - - Initialise the signer for signing or verification. - - @param forSigning true if for signing, false otherwise - @param param necessary parameters. - - - update the internal digest with the byte b - - - update the internal digest with the byte array in - - - Generate a signature for the message we've been loaded with using - the key we were initialised with. - - - return true if the internal state represents the signature described - in the passed in array. - - - reset the internal state - - - Signer with message recovery. - - - Returns true if the signer has recovered the full message as - part of signature verification. - - @return true if full message recovered. - - - Returns a reference to what message was recovered (if any). - - @return full/partial message, null if nothing. - - - Perform an update with the recovered message before adding any other data. This must - be the first update method called, and calling it will result in the signer assuming - that further calls to update will include message content past what is recoverable. - - @param signature the signature that we are in the process of verifying. - @throws IllegalStateException - - - The interface stream ciphers conform to. - - - The name of the algorithm this cipher implements. - - - Initialise the cipher. - If true the cipher is initialised for encryption, - if false for decryption. - The key and other data required by the cipher. - - If the parameters argument is inappropriate. - - - - encrypt/decrypt a single byte returning the result. - the byte to be processed. - the result of processing the input byte. - - - - Process a block of bytes from input putting the result into output. - - The input byte array. - - The offset into input where the data to be processed starts. - - The number of bytes to be processed. - The output buffer the processed bytes go into. - - The offset into output the processed data starts at. - - If the output buffer is too small. - - - - Reset the cipher to the same state as it was after the last init (if there was one). - - - - The name of the algorithm this cipher implements. - - - The base class for parameters to key generators. - - - initialise the generator with a source of randomness - and a strength (in bits). - - @param random the random byte source. - @param strength the size, in bits, of the keys we want to produce. - - - return the random source associated with this - generator. - - @return the generators random source. - - - return the bit strength for keys produced by this generator, - - @return the strength of the keys this generator produces (in bits). - - - standard CBC Block Cipher MAC - if no padding is specified the default of - pad of zeroes is used. - - - create a standard MAC based on a CBC block cipher. This will produce an - authentication code half the length of the block size of the cipher. - - @param cipher the cipher to be used as the basis of the MAC generation. - - - create a standard MAC based on a CBC block cipher. This will produce an - authentication code half the length of the block size of the cipher. - - @param cipher the cipher to be used as the basis of the MAC generation. - @param padding the padding to be used to complete the last block. - - - create a standard MAC based on a block cipher with the size of the - MAC been given in bits. This class uses CBC mode as the basis for the - MAC generation. -

    - Note: the size of the MAC must be at least 24 bits (FIPS Publication 81), - or 16 bits if being used as a data authenticator (FIPS Publication 113), - and in general should be less than the size of the block cipher as it reduces - the chance of an exhaustive attack (see Handbook of Applied Cryptography). -

    - @param cipher the cipher to be used as the basis of the MAC generation. - @param macSizeInBits the size of the MAC in bits, must be a multiple of 8. -
    - - create a standard MAC based on a block cipher with the size of the - MAC been given in bits. This class uses CBC mode as the basis for the - MAC generation. -

    - Note: the size of the MAC must be at least 24 bits (FIPS Publication 81), - or 16 bits if being used as a data authenticator (FIPS Publication 113), - and in general should be less than the size of the block cipher as it reduces - the chance of an exhaustive attack (see Handbook of Applied Cryptography). -

    - @param cipher the cipher to be used as the basis of the MAC generation. - @param macSizeInBits the size of the MAC in bits, must be a multiple of 8. - @param padding the padding to be used to complete the last block. -
    - - Reset the mac generator. - - - implements a Cipher-FeedBack (CFB) mode on top of a simple cipher. - - - Basic constructor. - - @param cipher the block cipher to be used as the basis of the - feedback mode. - @param blockSize the block size in bits (note: a multiple of 8) - - - Initialise the cipher and, possibly, the initialisation vector (IV). - If an IV isn't passed as part of the parameter, the IV will be all zeros. - An IV which is too short is handled in FIPS compliant fashion. - - @param param the key and other data required by the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - return the algorithm name and mode. - - @return the name of the underlying algorithm followed by "/CFB" - and the block size in bits. - - - return the block size we are operating at. - - @return the block size we are operating at (in bytes). - - - Process one block of input from the array in and write it to - the out array. - - @param in the array containing the input data. - @param inOff offset into the in array the data starts at. - @param out the array the output data will be copied into. - @param outOff the offset into the out array the output will start at. - @exception DataLengthException if there isn't enough data in in, or - space in out. - @exception InvalidOperationException if the cipher isn't initialised. - @return the number of bytes processed and produced. - - - reset the chaining vector back to the IV and reset the underlying - cipher. - - - create a standard MAC based on a CFB block cipher. This will produce an - authentication code half the length of the block size of the cipher, with - the CFB mode set to 8 bits. - - @param cipher the cipher to be used as the basis of the MAC generation. - - - create a standard MAC based on a CFB block cipher. This will produce an - authentication code half the length of the block size of the cipher, with - the CFB mode set to 8 bits. - - @param cipher the cipher to be used as the basis of the MAC generation. - @param padding the padding to be used. - - - create a standard MAC based on a block cipher with the size of the - MAC been given in bits. This class uses CFB mode as the basis for the - MAC generation. -

    - Note: the size of the MAC must be at least 24 bits (FIPS Publication 81), - or 16 bits if being used as a data authenticator (FIPS Publication 113), - and in general should be less than the size of the block cipher as it reduces - the chance of an exhaustive attack (see Handbook of Applied Cryptography). -

    - @param cipher the cipher to be used as the basis of the MAC generation. - @param cfbBitSize the size of an output block produced by the CFB mode. - @param macSizeInBits the size of the MAC in bits, must be a multiple of 8. -
    - - create a standard MAC based on a block cipher with the size of the - MAC been given in bits. This class uses CFB mode as the basis for the - MAC generation. -

    - Note: the size of the MAC must be at least 24 bits (FIPS Publication 81), - or 16 bits if being used as a data authenticator (FIPS Publication 113), - and in general should be less than the size of the block cipher as it reduces - the chance of an exhaustive attack (see Handbook of Applied Cryptography). -

    - @param cipher the cipher to be used as the basis of the MAC generation. - @param cfbBitSize the size of an output block produced by the CFB mode. - @param macSizeInBits the size of the MAC in bits, must be a multiple of 8. - @param padding a padding to be used. -
    - - Reset the mac generator. - - - CMAC - as specified at www.nuee.nagoya-u.ac.jp/labs/tiwata/omac/omac.html -

    - CMAC is analogous to OMAC1 - see also en.wikipedia.org/wiki/CMAC -

    - CMAC is a NIST recomendation - see - csrc.nist.gov/CryptoToolkit/modes/800-38_Series_Publications/SP800-38B.pdf -

    - CMAC/OMAC1 is a blockcipher-based message authentication code designed and - analyzed by Tetsu Iwata and Kaoru Kurosawa. -

    - CMAC/OMAC1 is a simple variant of the CBC MAC (Cipher Block Chaining Message - Authentication Code). OMAC stands for One-Key CBC MAC. -

    - It supports 128- or 64-bits block ciphers, with any key size, and returns - a MAC with dimension less or equal to the block size of the underlying - cipher. -

    -
    - - create a standard MAC based on a CBC block cipher (64 or 128 bit block). - This will produce an authentication code the length of the block size - of the cipher. - - @param cipher the cipher to be used as the basis of the MAC generation. - - - create a standard MAC based on a block cipher with the size of the - MAC been given in bits. -

    - Note: the size of the MAC must be at least 24 bits (FIPS Publication 81), - or 16 bits if being used as a data authenticator (FIPS Publication 113), - and in general should be less than the size of the block cipher as it reduces - the chance of an exhaustive attack (see Handbook of Applied Cryptography). - - @param cipher the cipher to be used as the basis of the MAC generation. - @param macSizeInBits the size of the MAC in bits, must be a multiple of 8 and @lt;= 128. - - - Reset the mac generator. - - - implementation of GOST 28147-89 MAC - - - HMAC implementation based on RFC2104 - - H(K XOR opad, H(K XOR ipad, text)) - - - Reset the mac generator. - - - DES based CBC Block Cipher MAC according to ISO9797, algorithm 3 (ANSI X9.19 Retail MAC) - - This could as well be derived from CBCBlockCipherMac, but then the property mac in the base - class must be changed to protected - - - create a Retail-MAC based on a CBC block cipher. This will produce an - authentication code of the length of the block size of the cipher. - - @param cipher the cipher to be used as the basis of the MAC generation. This must - be DESEngine. - - - create a Retail-MAC based on a CBC block cipher. This will produce an - authentication code of the length of the block size of the cipher. - - @param cipher the cipher to be used as the basis of the MAC generation. - @param padding the padding to be used to complete the last block. - - - create a Retail-MAC based on a block cipher with the size of the - MAC been given in bits. This class uses single DES CBC mode as the basis for the - MAC generation. -

    - Note: the size of the MAC must be at least 24 bits (FIPS Publication 81), - or 16 bits if being used as a data authenticator (FIPS Publication 113), - and in general should be less than the size of the block cipher as it reduces - the chance of an exhaustive attack (see Handbook of Applied Cryptography). -

    - @param cipher the cipher to be used as the basis of the MAC generation. - @param macSizeInBits the size of the MAC in bits, must be a multiple of 8. -
    - - create a standard MAC based on a block cipher with the size of the - MAC been given in bits. This class uses single DES CBC mode as the basis for the - MAC generation. The final block is decrypted and then encrypted using the - middle and right part of the key. -

    - Note: the size of the MAC must be at least 24 bits (FIPS Publication 81), - or 16 bits if being used as a data authenticator (FIPS Publication 113), - and in general should be less than the size of the block cipher as it reduces - the chance of an exhaustive attack (see Handbook of Applied Cryptography). -

    - @param cipher the cipher to be used as the basis of the MAC generation. - @param macSizeInBits the size of the MAC in bits, must be a multiple of 8. - @param padding the padding to be used to complete the last block. -
    - - Reset the mac generator. - - - - Implementation of SipHash as specified in "SipHash: a fast short-input PRF", by Jean-Philippe - Aumasson and Daniel J. Bernstein (https://131002.net/siphash/siphash.pdf). - - - "SipHash is a family of PRFs SipHash-c-d where the integer parameters c and d are the number of - compression rounds and the number of finalization rounds. A compression round is identical to a - finalization round and this round function is called SipRound. Given a 128-bit key k and a - (possibly empty) byte string m, SipHash-c-d returns a 64-bit value..." - - - - SipHash-2-4 - - - SipHash-c-d - the number of compression rounds - the number of finalization rounds - - - - This exception is thrown whenever a cipher requires a change of key, iv - or similar after x amount of bytes enciphered - - - - implements Cipher-Block-Chaining (CBC) mode on top of a simple cipher. - - - Basic constructor. - - @param cipher the block cipher to be used as the basis of chaining. - - - return the underlying block cipher that we are wrapping. - - @return the underlying block cipher that we are wrapping. - - - Initialise the cipher and, possibly, the initialisation vector (IV). - If an IV isn't passed as part of the parameter, the IV will be all zeros. - - @param forEncryption if true the cipher is initialised for - encryption, if false for decryption. - @param param the key and other data required by the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - return the algorithm name and mode. - - @return the name of the underlying algorithm followed by "/CBC". - - - return the block size of the underlying cipher. - - @return the block size of the underlying cipher. - - - Process one block of input from the array in and write it to - the out array. - - @param in the array containing the input data. - @param inOff offset into the in array the data starts at. - @param out the array the output data will be copied into. - @param outOff the offset into the out array the output will start at. - @exception DataLengthException if there isn't enough data in in, or - space in out. - @exception InvalidOperationException if the cipher isn't initialised. - @return the number of bytes processed and produced. - - - reset the chaining vector back to the IV and reset the underlying - cipher. - - - Do the appropriate chaining step for CBC mode encryption. - - @param in the array containing the data to be encrypted. - @param inOff offset into the in array the data starts at. - @param out the array the encrypted data will be copied into. - @param outOff the offset into the out array the output will start at. - @exception DataLengthException if there isn't enough data in in, or - space in out. - @exception InvalidOperationException if the cipher isn't initialised. - @return the number of bytes processed and produced. - - - Do the appropriate chaining step for CBC mode decryption. - - @param in the array containing the data to be decrypted. - @param inOff offset into the in array the data starts at. - @param out the array the decrypted data will be copied into. - @param outOff the offset into the out array the output will start at. - @exception DataLengthException if there isn't enough data in in, or - space in out. - @exception InvalidOperationException if the cipher isn't initialised. - @return the number of bytes processed and produced. - - - Implements the Counter with Cipher Block Chaining mode (CCM) detailed in - NIST Special Publication 800-38C. -

    - Note: this mode is a packet mode - it needs all the data up front. -

    -
    - - Basic constructor. - - @param cipher the block cipher to be used. - - - return the underlying block cipher that we are wrapping. - - @return the underlying block cipher that we are wrapping. - - - Returns a byte array containing the mac calculated as part of the - last encrypt or decrypt operation. - - @return the last mac calculated. - - - implements a Cipher-FeedBack (CFB) mode on top of a simple cipher. - - - Basic constructor. - - @param cipher the block cipher to be used as the basis of the - feedback mode. - @param blockSize the block size in bits (note: a multiple of 8) - - - return the underlying block cipher that we are wrapping. - - @return the underlying block cipher that we are wrapping. - - - Initialise the cipher and, possibly, the initialisation vector (IV). - If an IV isn't passed as part of the parameter, the IV will be all zeros. - An IV which is too short is handled in FIPS compliant fashion. - - @param forEncryption if true the cipher is initialised for - encryption, if false for decryption. - @param param the key and other data required by the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - return the algorithm name and mode. - - @return the name of the underlying algorithm followed by "/CFB" - and the block size in bits. - - - return the block size we are operating at. - - @return the block size we are operating at (in bytes). - - - Process one block of input from the array in and write it to - the out array. - - @param in the array containing the input data. - @param inOff offset into the in array the data starts at. - @param out the array the output data will be copied into. - @param outOff the offset into the out array the output will start at. - @exception DataLengthException if there isn't enough data in in, or - space in out. - @exception InvalidOperationException if the cipher isn't initialised. - @return the number of bytes processed and produced. - - - Do the appropriate processing for CFB mode encryption. - - @param in the array containing the data to be encrypted. - @param inOff offset into the in array the data starts at. - @param out the array the encrypted data will be copied into. - @param outOff the offset into the out array the output will start at. - @exception DataLengthException if there isn't enough data in in, or - space in out. - @exception InvalidOperationException if the cipher isn't initialised. - @return the number of bytes processed and produced. - - - Do the appropriate processing for CFB mode decryption. - - @param in the array containing the data to be decrypted. - @param inOff offset into the in array the data starts at. - @param out the array the encrypted data will be copied into. - @param outOff the offset into the out array the output will start at. - @exception DataLengthException if there isn't enough data in in, or - space in out. - @exception InvalidOperationException if the cipher isn't initialised. - @return the number of bytes processed and produced. - - - reset the chaining vector back to the IV and reset the underlying - cipher. - - - A Cipher Text Stealing (CTS) mode cipher. CTS allows block ciphers to - be used to produce cipher text which is the same outLength as the plain text. - - - Create a buffered block cipher that uses Cipher Text Stealing - - @param cipher the underlying block cipher this buffering object wraps. - - - return the size of the output buffer required for an update of 'length' bytes. - - @param length the outLength of the input. - @return the space required to accommodate a call to update - with length bytes of input. - - - return the size of the output buffer required for an update plus a - doFinal with an input of length bytes. - - @param length the outLength of the input. - @return the space required to accommodate a call to update and doFinal - with length bytes of input. - - - process a single byte, producing an output block if neccessary. - - @param in the input byte. - @param out the space for any output that might be produced. - @param outOff the offset from which the output will be copied. - @return the number of output bytes copied to out. - @exception DataLengthException if there isn't enough space in out. - @exception InvalidOperationException if the cipher isn't initialised. - - - process an array of bytes, producing output if necessary. - - @param in the input byte array. - @param inOff the offset at which the input data starts. - @param length the number of bytes to be copied out of the input array. - @param out the space for any output that might be produced. - @param outOff the offset from which the output will be copied. - @return the number of output bytes copied to out. - @exception DataLengthException if there isn't enough space in out. - @exception InvalidOperationException if the cipher isn't initialised. - - - Process the last block in the buffer. - - @param out the array the block currently being held is copied into. - @param outOff the offset at which the copying starts. - @return the number of output bytes copied to out. - @exception DataLengthException if there is insufficient space in out for - the output. - @exception InvalidOperationException if the underlying cipher is not - initialised. - @exception InvalidCipherTextException if cipher text decrypts wrongly (in - case the exception will never Get thrown). - - - A Two-Pass Authenticated-Encryption Scheme Optimized for Simplicity and - Efficiency - by M. Bellare, P. Rogaway, D. Wagner. - - http://www.cs.ucdavis.edu/~rogaway/papers/eax.pdf - - EAX is an AEAD scheme based on CTR and OMAC1/CMAC, that uses a single block - cipher to encrypt and authenticate data. It's on-line (the length of a - message isn't needed to begin processing it), has good performances, it's - simple and provably secure (provided the underlying block cipher is secure). - - Of course, this implementations is NOT thread-safe. - - - Constructor that accepts an instance of a block cipher engine. - - @param cipher the engine to use - - - - Implements the Galois/Counter mode (GCM) detailed in - NIST Special Publication 800-38D. - - - - implements the GOST 28147 OFB counter mode (GCTR). - - - Basic constructor. - - @param cipher the block cipher to be used as the basis of the - counter mode (must have a 64 bit block size). - - - return the underlying block cipher that we are wrapping. - - @return the underlying block cipher that we are wrapping. - - - Initialise the cipher and, possibly, the initialisation vector (IV). - If an IV isn't passed as part of the parameter, the IV will be all zeros. - An IV which is too short is handled in FIPS compliant fashion. - - @param encrypting if true the cipher is initialised for - encryption, if false for decryption. - @param parameters the key and other data required by the cipher. - @exception ArgumentException if the parameters argument is inappropriate. - - - return the algorithm name and mode. - - @return the name of the underlying algorithm followed by "/GCTR" - and the block size in bits - - - return the block size we are operating at (in bytes). - - @return the block size we are operating at (in bytes). - - - Process one block of input from the array in and write it to - the out array. - - @param in the array containing the input data. - @param inOff offset into the in array the data starts at. - @param out the array the output data will be copied into. - @param outOff the offset into the out array the output will start at. - @exception DataLengthException if there isn't enough data in in, or - space in out. - @exception InvalidOperationException if the cipher isn't initialised. - @return the number of bytes processed and produced. - - - reset the feedback vector back to the IV and reset the underlying - cipher. - - - - A block cipher mode that includes authenticated encryption with a streaming mode - and optional associated data. - - - - The name of the algorithm this cipher implements. - - - Initialise the cipher. - Parameter can either be an AeadParameters or a ParametersWithIV object. - Initialise for encryption if true, for decryption if false. - The key or other data required by the cipher. - - - The block size for this cipher, in bytes. - - - Add a single byte to the associated data check. - If the implementation supports it, this will be an online operation and will not retain the associated data. - The byte to be processed. - - - Add a sequence of bytes to the associated data check. - If the implementation supports it, this will be an online operation and will not retain the associated data. - The input byte array. - The offset into the input array where the data to be processed starts. - The number of bytes to be processed. - - - Encrypt/decrypt a single byte. - - @param input the byte to be processed. - @param outBytes the output buffer the processed byte goes into. - @param outOff the offset into the output byte array the processed data starts at. - @return the number of bytes written to out. - @exception DataLengthException if the output buffer is too small. - - - Process a block of bytes from in putting the result into out. - - @param inBytes the input byte array. - @param inOff the offset into the in array where the data to be processed starts. - @param len the number of bytes to be processed. - @param outBytes the output buffer the processed bytes go into. - @param outOff the offset into the output byte array the processed data starts at. - @return the number of bytes written to out. - @exception DataLengthException if the output buffer is too small. - - - Finish the operation either appending or verifying the MAC at the end of the data. - - @param outBytes space for any resulting output data. - @param outOff offset into out to start copying the data at. - @return number of bytes written into out. - @throws InvalidOperationException if the cipher is in an inappropriate state. - @throws InvalidCipherTextException if the MAC fails to match. - - - Return the value of the MAC associated with the last stream processed. - - @return MAC for plaintext data. - - - Return the size of the output buffer required for a ProcessBytes - an input of len bytes. - - @param len the length of the input. - @return the space required to accommodate a call to ProcessBytes - with len bytes of input. - - - Return the size of the output buffer required for a ProcessBytes plus a - DoFinal with an input of len bytes. - - @param len the length of the input. - @return the space required to accommodate a call to ProcessBytes and DoFinal - with len bytes of input. - - - - Reset the cipher to the same state as it was after the last init (if there was one). - - - - An implementation of the "work in progress" Internet-Draft The OCB Authenticated-Encryption - Algorithm, licensed per: - -

    License for - Open-Source Software Implementations of OCB (Jan 9, 2013) - 'License 1'
    - Under this license, you are authorized to make, use, and distribute open-source software - implementations of OCB. This license terminates for you if you sue someone over their open-source - software implementation of OCB claiming that you have a patent covering their implementation. -

    - This is a non-binding summary of a legal document (the link above). The parameters of the license - are specified in the license document and that document is controlling.

    -
    - - implements a Output-FeedBack (OFB) mode on top of a simple cipher. - - - Basic constructor. - - @param cipher the block cipher to be used as the basis of the - feedback mode. - @param blockSize the block size in bits (note: a multiple of 8) - - - return the underlying block cipher that we are wrapping. - - @return the underlying block cipher that we are wrapping. - - - Initialise the cipher and, possibly, the initialisation vector (IV). - If an IV isn't passed as part of the parameter, the IV will be all zeros. - An IV which is too short is handled in FIPS compliant fashion. - - @param forEncryption if true the cipher is initialised for - encryption, if false for decryption. - @param param the key and other data required by the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - return the algorithm name and mode. - - @return the name of the underlying algorithm followed by "/OFB" - and the block size in bits - - - return the block size we are operating at (in bytes). - - @return the block size we are operating at (in bytes). - - - Process one block of input from the array in and write it to - the out array. - - @param in the array containing the input data. - @param inOff offset into the in array the data starts at. - @param out the array the output data will be copied into. - @param outOff the offset into the out array the output will start at. - @exception DataLengthException if there isn't enough data in in, or - space in out. - @exception InvalidOperationException if the cipher isn't initialised. - @return the number of bytes processed and produced. - - - reset the feedback vector back to the IV and reset the underlying - cipher. - - - * Implements OpenPGP's rather strange version of Cipher-FeedBack (CFB) mode - * on top of a simple cipher. This class assumes the IV has been prepended - * to the data stream already, and just accomodates the reset after - * (blockSize + 2) bytes have been read. - *

    - * For further info see RFC 2440. - *

    -
    - - Basic constructor. - - @param cipher the block cipher to be used as the basis of the - feedback mode. - - - return the underlying block cipher that we are wrapping. - - @return the underlying block cipher that we are wrapping. - - - return the algorithm name and mode. - - @return the name of the underlying algorithm followed by "/PGPCFB" - and the block size in bits. - - - return the block size we are operating at. - - @return the block size we are operating at (in bytes). - - - Process one block of input from the array in and write it to - the out array. - - @param in the array containing the input data. - @param inOff offset into the in array the data starts at. - @param out the array the output data will be copied into. - @param outOff the offset into the out array the output will start at. - @exception DataLengthException if there isn't enough data in in, or - space in out. - @exception InvalidOperationException if the cipher isn't initialised. - @return the number of bytes processed and produced. - - - reset the chaining vector back to the IV and reset the underlying - cipher. - - - Initialise the cipher and, possibly, the initialisation vector (IV). - If an IV isn't passed as part of the parameter, the IV will be all zeros. - An IV which is too short is handled in FIPS compliant fashion. - - @param forEncryption if true the cipher is initialised for - encryption, if false for decryption. - @param parameters the key and other data required by the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - Encrypt one byte of data according to CFB mode. - @param data the byte to encrypt - @param blockOff offset in the current block - @returns the encrypted byte - - - Do the appropriate processing for CFB IV mode encryption. - - @param in the array containing the data to be encrypted. - @param inOff offset into the in array the data starts at. - @param out the array the encrypted data will be copied into. - @param outOff the offset into the out array the output will start at. - @exception DataLengthException if there isn't enough data in in, or - space in out. - @exception InvalidOperationException if the cipher isn't initialised. - @return the number of bytes processed and produced. - - - Do the appropriate processing for CFB IV mode decryption. - - @param in the array containing the data to be decrypted. - @param inOff offset into the in array the data starts at. - @param out the array the encrypted data will be copied into. - @param outOff the offset into the out array the output will start at. - @exception DataLengthException if there isn't enough data in in, or - space in out. - @exception InvalidOperationException if the cipher isn't initialised. - @return the number of bytes processed and produced. - - - Implements the Segmented Integer Counter (SIC) mode on top of a simple - block cipher. - - - Basic constructor. - - @param c the block cipher to be used. - - - return the underlying block cipher that we are wrapping. - - @return the underlying block cipher that we are wrapping. - - - Block cipher padders are expected to conform to this interface - - - Initialise the padder. - - @param param parameters, if any required. - - - Return the name of the algorithm the cipher implements. - - @return the name of the algorithm the cipher implements. - - - add the pad bytes to the passed in block, returning the - number of bytes added. - - - return the number of pad bytes present in the block. - @exception InvalidCipherTextException if the padding is badly formed - or invalid. - - - A padder that adds ISO10126-2 padding to a block. - - - Initialise the padder. - - @param random a SecureRandom if available. - - - Return the name of the algorithm the cipher implements. - - @return the name of the algorithm the cipher implements. - - - add the pad bytes to the passed in block, returning the - number of bytes added. - - - return the number of pad bytes present in the block. - - - A padder that adds the padding according to the scheme referenced in - ISO 7814-4 - scheme 2 from ISO 9797-1. The first byte is 0x80, rest is 0x00 - - - Initialise the padder. - - @param random - a SecureRandom if available. - - - Return the name of the algorithm the padder implements. - - @return the name of the algorithm the padder implements. - - - add the pad bytes to the passed in block, returning the - number of bytes added. - - - return the number of pad bytes present in the block. - - - A wrapper class that allows block ciphers to be used to process data in - a piecemeal fashion with padding. The PaddedBufferedBlockCipher - outputs a block only when the buffer is full and more data is being added, - or on a doFinal (unless the current block in the buffer is a pad block). - The default padding mechanism used is the one outlined in Pkcs5/Pkcs7. - - - Create a buffered block cipher with the desired padding. - - @param cipher the underlying block cipher this buffering object wraps. - @param padding the padding type. - - - Create a buffered block cipher Pkcs7 padding - - @param cipher the underlying block cipher this buffering object wraps. - - - initialise the cipher. - - @param forEncryption if true the cipher is initialised for - encryption, if false for decryption. - @param param the key and other data required by the cipher. - @exception ArgumentException if the parameters argument is - inappropriate. - - - return the minimum size of the output buffer required for an update - plus a doFinal with an input of len bytes. - - @param len the length of the input. - @return the space required to accommodate a call to update and doFinal - with len bytes of input. - - - return the size of the output buffer required for an update - an input of len bytes. - - @param len the length of the input. - @return the space required to accommodate a call to update - with len bytes of input. - - - process a single byte, producing an output block if neccessary. - - @param in the input byte. - @param out the space for any output that might be produced. - @param outOff the offset from which the output will be copied. - @return the number of output bytes copied to out. - @exception DataLengthException if there isn't enough space in out. - @exception InvalidOperationException if the cipher isn't initialised. - - - process an array of bytes, producing output if necessary. - - @param in the input byte array. - @param inOff the offset at which the input data starts. - @param len the number of bytes to be copied out of the input array. - @param out the space for any output that might be produced. - @param outOff the offset from which the output will be copied. - @return the number of output bytes copied to out. - @exception DataLengthException if there isn't enough space in out. - @exception InvalidOperationException if the cipher isn't initialised. - - - Process the last block in the buffer. If the buffer is currently - full and padding needs to be added a call to doFinal will produce - 2 * GetBlockSize() bytes. - - @param out the array the block currently being held is copied into. - @param outOff the offset at which the copying starts. - @return the number of output bytes copied to out. - @exception DataLengthException if there is insufficient space in out for - the output or we are decrypting and the input is not block size aligned. - @exception InvalidOperationException if the underlying cipher is not - initialised. - @exception InvalidCipherTextException if padding is expected and not found. - - - A padder that adds Pkcs7/Pkcs5 padding to a block. - - - Initialise the padder. - - @param random - a SecureRandom if available. - - - Return the name of the algorithm the cipher implements. - - @return the name of the algorithm the cipher implements. - - - add the pad bytes to the passed in block, returning the - number of bytes added. - - - return the number of pad bytes present in the block. - - - A padder that adds Trailing-Bit-Compliment padding to a block. -

    - This padding pads the block out compliment of the last bit - of the plain text. -

    -
    -
    - - Return the name of the algorithm the cipher implements. - the name of the algorithm the cipher implements. - - - - Initialise the padder. - - a SecureRandom if available. - - - - add the pad bytes to the passed in block, returning the - number of bytes added. -

    - Note: this assumes that the last block of plain text is always - passed to it inside in. i.e. if inOff is zero, indicating the - entire block is to be overwritten with padding the value of in - should be the same as the last block of plain text. -

    -
    -
    - - return the number of pad bytes present in the block. - - - A padder that adds X9.23 padding to a block - if a SecureRandom is - passed in random padding is assumed, otherwise padding with zeros is used. - - - Initialise the padder. - - @param random a SecureRandom if one is available. - - - Return the name of the algorithm the cipher implements. - - @return the name of the algorithm the cipher implements. - - - add the pad bytes to the passed in block, returning the - number of bytes added. - - - return the number of pad bytes present in the block. - - - A padder that adds Null byte padding to a block. - - - Return the name of the algorithm the cipher implements. - - - the name of the algorithm the cipher implements. - - - - Initialise the padder. - - - - a SecureRandom if available. - - - - add the pad bytes to the passed in block, returning the - number of bytes added. - - - - return the number of pad bytes present in the block. - - - Base constructor. - - @param key key to be used by underlying cipher - @param macSize macSize in bits - @param nonce nonce to be used - - - Base constructor. - - @param key key to be used by underlying cipher - @param macSize macSize in bits - @param nonce nonce to be used - @param associatedText associated text, if any - - - Base constructor. - - @param key key to be used by underlying cipher - @param macSize macSize in bits - @param nonce nonce to be used - @param associatedText associated text, if any - - - return true if the passed in key is a DES-EDE weak key. - - @param key bytes making up the key - @param offset offset into the byte array the key starts at - @param length number of bytes making up the key - - - return true if the passed in key is a DES-EDE weak key. - - @param key bytes making up the key - @param offset offset into the byte array the key starts at - - - DES has 16 weak keys. This method will check - if the given DES key material is weak or semi-weak. - Key material that is too short is regarded as weak. -

    - See "Applied - Cryptography" by Bruce Schneier for more information. -

    - @return true if the given DES key material is weak or semi-weak, - false otherwise. -
    - - DES Keys use the LSB as the odd parity bit. This can - be used to check for corrupt keys. - - @param bytes the byte array to set the parity on. - - - The minimum bitlength of the private value. - - - The bitlength of the private value. - - - Construct without a usage index, this will do a random construction of G. - - @param L desired length of prime P in bits (the effective key size). - @param N desired length of prime Q in bits. - @param certainty certainty level for prime number generation. - @param random the source of randomness to use. - - - Construct for a specific usage index - this has the effect of using verifiable canonical generation of G. - - @param L desired length of prime P in bits (the effective key size). - @param N desired length of prime Q in bits. - @param certainty certainty level for prime number generation. - @param random the source of randomness to use. - @param usageIndex a valid usage index. - - - return the generator - g - - - return private value limit - l - - - parameters for using an integrated cipher in stream mode. - - - @param derivation the derivation parameter for the KDF function. - @param encoding the encoding parameter for the KDF function. - @param macKeySize the size of the MAC key (in bits). - - - @param derivation the derivation parameter for the KDF function. - @param encoding the encoding parameter for the KDF function. - @param macKeySize the size of the MAC key (in bits). - @param cipherKeySize the size of the associated Cipher key (in bits). - - - parameters for Key derivation functions for ISO-18033 - - - parameters for Key derivation functions for IEEE P1363a - - - Parameters for mask derivation functions. - - - Parameters for NaccacheStern public private key generation. For details on - this cipher, please see - - http://www.gemplus.com/smart/rd/publications/pdf/NS98pkcs.pdf - - - Parameters for generating a NaccacheStern KeyPair. - - @param random - The source of randomness - @param strength - The desired strength of the Key in Bits - @param certainty - the probability that the generated primes are not really prime - as integer: 2^(-certainty) is then the probability - @param countSmallPrimes - How many small key factors are desired - - - Parameters for a NaccacheStern KeyPair. - - @param random - The source of randomness - @param strength - The desired strength of the Key in Bits - @param certainty - the probability that the generated primes are not really prime - as integer: 2^(-certainty) is then the probability - @param cntSmallPrimes - How many small key factors are desired - @param debug - Turn debugging on or off (reveals secret information, use with - caution) - - - @return Returns the certainty. - - - @return Returns the countSmallPrimes. - - - Public key parameters for NaccacheStern cipher. For details on this cipher, - please see - - http://www.gemplus.com/smart/rd/publications/pdf/NS98pkcs.pdf - - - @param privateKey - - - @return Returns the g. - - - @return Returns the lowerSigmaBound. - - - @return Returns the n. - - - Private key parameters for NaccacheStern cipher. For details on this cipher, - please see - - http://www.gemplus.com/smart/rd/publications/pdf/NS98pkcs.pdf - - - Constructs a NaccacheSternPrivateKey - - @param g - the public enryption parameter g - @param n - the public modulus n = p*q - @param lowerSigmaBound - the public lower sigma bound up to which data can be encrypted - @param smallPrimes - the small primes, of which sigma is constructed in the right - order - @param phi_n - the private modulus phi(n) = (p-1)(q-1) - - - Cipher parameters with a fixed salt value associated with them. - - - super class for all Password Based Encyrption (Pbe) parameter generator classes. - - - base constructor. - - - initialise the Pbe generator. - - @param password the password converted into bytes (see below). - @param salt the salt to be mixed with the password. - @param iterationCount the number of iterations the "mixing" function - is to be applied for. - - - return the password byte array. - - @return the password byte array. - - - return the salt byte array. - - @return the salt byte array. - - - return the iteration count. - - @return the iteration count. - - - Generate derived parameters for a key of length keySize. - - @param keySize the length, in bits, of the key required. - @return a parameters object representing a key. - - - Generate derived parameters for a key of length keySize, and - an initialisation vector (IV) of length ivSize. - - @param keySize the length, in bits, of the key required. - @param ivSize the length, in bits, of the iv required. - @return a parameters object representing a key and an IV. - - - Generate derived parameters for a key of length keySize, specifically - for use with a MAC. - - @param keySize the length, in bits, of the key required. - @return a parameters object representing a key. - - - converts a password to a byte array according to the scheme in - Pkcs5 (ascii, no padding) - - @param password a character array representing the password. - @return a byte array representing the password. - - - converts a password to a byte array according to the scheme in - PKCS5 (UTF-8, no padding) - - @param password a character array representing the password. - @return a byte array representing the password. - - - converts a password to a byte array according to the scheme in - Pkcs12 (unicode, big endian, 2 zero pad bytes at the end). - - @param password a character array representing the password. - @return a byte array representing the password. - - - - Uses Microsoft's RNGCryptoServiceProvider - - - - Random generation based on the digest with counter. Calling AddSeedMaterial will - always increase the entropy of the hash. -

    - Internal access to the digest is synchronized so a single one of these can be shared. -

    -
    - - Generic interface for objects generating random bytes. - - - Add more seed material to the generator. - A byte array to be mixed into the generator's state. - - - Add more seed material to the generator. - A long value to be mixed into the generator's state. - - - Fill byte array with random values. - Array to be filled. - - - Fill byte array with random values. - Array to receive bytes. - Index to start filling at. - Length of segment to fill. - - - - Takes bytes generated by an underling RandomGenerator and reverses the order in - each small window (of configurable size). -

    - Access to internals is synchronized so a single one of these can be shared. -

    -
    -
    - - Add more seed material to the generator. - A byte array to be mixed into the generator's state. - - - Add more seed material to the generator. - A long value to be mixed into the generator's state. - - - Fill byte array with random values. - Array to be filled. - - - Fill byte array with random values. - Array to receive bytes. - Index to start filling at. - Length of segment to fill. - - - A thread based seed generator - one source of randomness. -

    - Based on an idea from Marcus Lippert. -

    -
    - - Generate seed bytes. Set fast to false for best quality. -

    - If fast is set to true, the code should be round about 8 times faster when - generating a long sequence of random bytes. 20 bytes of random values using - the fast mode take less than half a second on a Nokia e70. If fast is set to false, - it takes round about 2500 ms. -

    - @param numBytes the number of bytes to generate - @param fast true if fast mode should be used -
    - - - Permutation generated by code: - - // First 1850 fractional digit of Pi number. - byte[] key = new BigInteger("14159265358979323846...5068006422512520511").ToByteArray(); - s = 0; - P = new byte[256]; - for (int i = 0; i < 256; i++) - { - P[i] = (byte) i; - } - for (int m = 0; m < 768; m++) - { - s = P[(s + P[m & 0xff] + key[m % key.length]) & 0xff]; - byte temp = P[m & 0xff]; - P[m & 0xff] = P[s & 0xff]; - P[s & 0xff] = temp; - } - - - - Value generated in the same way as P. - - - update the internal digest with the byte b - - - update the internal digest with the byte array in - - - Generate a signature for the message we've been loaded with using - the key we were initialised with. - - - true if the internal state represents the signature described in the passed in array. - - - Reset the internal state - - - The Digital Signature Algorithm - as described in "Handbook of Applied - Cryptography", pages 452 - 453. - - - Generate a signature for the given message using the key we were - initialised with. For conventional DSA the message should be a SHA-1 - hash of the message of interest. - - @param message the message that will be verified later. - - - return true if the value r and s represent a DSA signature for - the passed in message for standard DSA the message should be a - SHA-1 hash of the real message to be verified. - - - EC-DSA as described in X9.62 - - - Generate a signature for the given message using the key we were - initialised with. For conventional DSA the message should be a SHA-1 - hash of the message of interest. - - @param message the message that will be verified later. - - - return true if the value r and s represent a DSA signature for - the passed in message (for standard DSA the message should be - a SHA-1 hash of the real message to be verified). - - - GOST R 34.10-2001 Signature Algorithm - - - generate a signature for the given message using the key we were - initialised with. For conventional GOST3410 the message should be a GOST3411 - hash of the message of interest. - - @param message the message that will be verified later. - - - return true if the value r and s represent a GOST3410 signature for - the passed in message (for standard GOST3410 the message should be - a GOST3411 hash of the real message to be verified). - - - EC-NR as described in IEEE 1363-2000 - - - generate a signature for the given message using the key we were - initialised with. Generally, the order of the curve should be at - least as long as the hash of the message of interest, and with - ECNR it *must* be at least as long. - - @param digest the digest to be signed. - @exception DataLengthException if the digest is longer than the key allows - - - return true if the value r and s represent a signature for the - message passed in. Generally, the order of the curve should be at - least as long as the hash of the message of interest, and with - ECNR, it *must* be at least as long. But just in case the signer - applied mod(n) to the longer digest, this implementation will - apply mod(n) during verification. - - @param digest the digest to be verified. - @param r the r value of the signature. - @param s the s value of the signature. - @exception DataLengthException if the digest is longer than the key allows - - - initialise the signer for signing or verification. - - @param forSigning - true if for signing, false otherwise - @param parameters - necessary parameters. - - - update the internal digest with the byte b - - - update the internal digest with the byte array in - - - Generate a signature for the message we've been loaded with using the key - we were initialised with. - - - return true if the internal state represents the signature described in - the passed in array. - - - update the internal digest with the byte b - - - update the internal digest with the byte array in - - - Generate a signature for the message we've been loaded with using - the key we were initialised with. - - - true if the internal state represents the signature described in the passed in array. - - - Reset the internal state - - - Gost R 34.10-94 Signature Algorithm - - - generate a signature for the given message using the key we were - initialised with. For conventional Gost3410 the message should be a Gost3411 - hash of the message of interest. - - @param message the message that will be verified later. - - - return true if the value r and s represent a Gost3410 signature for - the passed in message for standard Gost3410 the message should be a - Gost3411 hash of the real message to be verified. - - - ISO9796-2 - mechanism using a hash function with recovery (scheme 2 and 3). -

    - Note: the usual length for the salt is the length of the hash - function used in bytes.

    -
    -
    - - - Return a reference to the recoveredMessage message. - - The full/partial recoveredMessage message. - - - - - Generate a signer for the with either implicit or explicit trailers - for ISO9796-2, scheme 2 or 3. - - base cipher to use for signature creation/verification - digest to use. - length of salt in bytes. - whether or not the trailer is implicit or gives the hash. - - - Constructor for a signer with an explicit digest trailer. - - - cipher to use. - - digest to sign with. - - length of salt in bytes. - - - - Initialise the signer. - true if for signing, false if for verification. - parameters for signature generation/verification. If the - parameters are for generation they should be a ParametersWithRandom, - a ParametersWithSalt, or just an RsaKeyParameters object. If RsaKeyParameters - are passed in a SecureRandom will be created. - - if wrong parameter type or a fixed - salt is passed in which is the wrong length. - - - - compare two byte arrays - constant time. - - - clear possible sensitive data - - - update the internal digest with the byte b - - - update the internal digest with the byte array in - - - reset the internal state - - - Generate a signature for the loaded message using the key we were - initialised with. - - - - return true if the signature represents a ISO9796-2 signature - for the passed in message. - - - - - Return true if the full message was recoveredMessage. - - true on full message recovery, false otherwise, or if not sure. - - - - int to octet string. - int to octet string. - - - long to octet string. - - - mask generator function, as described in Pkcs1v2. - - - ISO9796-2 - mechanism using a hash function with recovery (scheme 1) - - - - Return a reference to the recoveredMessage message. - - The full/partial recoveredMessage message. - - - - - Generate a signer for the with either implicit or explicit trailers - for ISO9796-2. - - base cipher to use for signature creation/verification - digest to use. - whether or not the trailer is implicit or gives the hash. - - - Constructor for a signer with an explicit digest trailer. - - - cipher to use. - - digest to sign with. - - - - compare two byte arrays - constant time. - - - clear possible sensitive data - - - update the internal digest with the byte b - - - update the internal digest with the byte array in - - - reset the internal state - - - Generate a signature for the loaded message using the key we were - initialised with. - - - - return true if the signature represents a ISO9796-2 signature - for the passed in message. - - - - - Return true if the full message was recoveredMessage. - - true on full message recovery, false otherwise. - - - - RSA-PSS as described in Pkcs# 1 v 2.1. -

    - Note: the usual value for the salt length is the number of - bytes in the hash function.

    -
    -
    - - Basic constructor - the asymmetric cipher to use. - the digest to use. - the length of the salt to use (in bytes). - - - clear possible sensitive data - - - update the internal digest with the byte b - - - update the internal digest with the byte array in - - - reset the internal state - - - Generate a signature for the message we've been loaded with using - the key we were initialised with. - - - - return true if the internal state represents the signature described - in the passed in array. - - - - int to octet string. - - - mask generator function, as described in Pkcs1v2. - - - - Load oid table. - - - - Initialise the signer for signing or verification. - - @param forSigning true if for signing, false otherwise - @param param necessary parameters. - - - update the internal digest with the byte b - - - update the internal digest with the byte array in - - - Generate a signature for the message we've been loaded with using - the key we were initialised with. - - - return true if the internal state represents the signature described - in the passed in array. - - - a wrapper for block ciphers with a single byte block size, so that they - can be treated like stream ciphers. - - - basic constructor. - - @param cipher the block cipher to be wrapped. - @exception ArgumentException if the cipher has a block size other than - one. - - - initialise the underlying cipher. - - @param forEncryption true if we are setting up for encryption, false otherwise. - @param param the necessary parameters for the underlying cipher to be initialised. - - - return the name of the algorithm we are wrapping. - - @return the name of the algorithm we are wrapping. - - - encrypt/decrypt a single byte returning the result. - - @param in the byte to be processed. - @return the result of processing the input byte. - - - process a block of bytes from in putting the result into out. - - @param in the input byte array. - @param inOff the offset into the in array where the data to be processed starts. - @param len the number of bytes to be processed. - @param out the output buffer the processed bytes go into. - @param outOff the offset into the output byte array the processed data stars at. - @exception DataLengthException if the output buffer is too small. - - - reset the underlying cipher. This leaves it in the same state - it was at after the last init (if there was one). - - - - A certificate verifyer, that will always return true. -
    -            DO NOT USE THIS FILE UNLESS YOU KNOW EXACTLY WHAT YOU ARE DOING.
    -            
    -
    -
    - - Return true. - - - - A queue for bytes. -

    - This file could be more optimized. -

    -
    -
    - - The smallest number which can be written as 2^x which is bigger than i. - - - The initial size for our buffer. - - - The buffer where we store our data. - - - How many bytes at the beginning of the buffer are skipped. - - - How many bytes in the buffer are valid data. - - - Read data from the buffer. - The buffer where the read data will be copied to. - How many bytes to skip at the beginning of buf. - How many bytes to read at all. - How many bytes from our data to skip. - - - Add some data to our buffer. - A byte-array to read data from. - How many bytes to skip at the beginning of the array. - How many bytes to read from the array. - - - Remove some bytes from our data from the beginning. - How many bytes to remove. - - - The number of bytes which are available in this buffer. - - - A representation for a certificate chain. - - - The certificates. - - - Parse the ServerCertificate message. - - @param inStr The stream where to parse from. - @return A Certificate object with the certs, the server has sended. - @throws IOException If something goes wrong during parsing. - - - Encodes version of the ClientCertificate message - - @param outStr stream to write the message to - @throws IOException If something goes wrong - - - Private constructor from a cert array. - - @param certs The certs the chain should contain. - - - An array which contains the certs, this chain contains. - - - A combined hash, which implements md5(m) || sha1(m). - - - - - - - - - - - - - - - - - - - - - - - - - This should be implemented by any class which can find out, if a given - certificate chain is being accepted by an client. - - - - The certs, which are part of the chain. - True, if the chain is accepted, false otherwise - - - An implementation of the TLS 1.0 record layer. - - - - A generic TLS 1.0 block cipher. This can be used for AES or 3DES for example. - - - - - - - - - - - Called at the start of a new TLS session, before any other methods. - - - A - - - - - Get the list of cipher suites that this client supports. - - - An array of , each specifying a supported cipher suite. - - - - - Get the list of compression methods that this client supports. - - - An array of , each specifying a supported compression method. - - - - - Get the (optional) table of client extensions to be included in (extended) client hello. - - - A ( -> byte[]). May be null. - - - - - - Reports the session ID once it has been determined. - - - A - - - - - Report the cipher suite that was selected by the server. - - - The protocol handler validates this value against the offered cipher suites - - - - A - - - - - Report the compression method that was selected by the server. - - - The protocol handler validates this value against the offered compression methods - - - - A - - - - - Report whether the server supports secure renegotiation - - - The protocol handler automatically processes the relevant extensions - - - A , true if the server supports secure renegotiation - - - - - - Report the extensions from an extended server hello. - - - Will only be called if we returned a non-null result from . - - - A ( -> byte[]) - - - - - Return an implementation of to negotiate the key exchange - part of the protocol. - - - A - - - - - - Return an implementation of to handle authentication - part of the protocol. - - - - - - Return an implementation of to handle record compression. - - - - - - Return an implementation of to use for encryption/decryption. - - - A - - - - - - TLS 1.0 DH key exchange. - - - - - A generic interface for key exchange implementations in TLS 1.0. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A generic TLS MAC implementation, which can be used with any kind of - IDigest to act as an HMAC. - - - - Generate a new instance of an TlsMac. - - @param digest The digest to use. - @param key_block A byte-array where the key for this mac is located. - @param offset The number of bytes to skip, before the key starts in the buffer. - @param len The length of the key. - - - @return the MAC write secret - - - @return the current write sequence number - - - Increment the current write sequence number - - - @return The Keysize of the mac. - - - Calculate the mac for some given data. -

    - TlsMac will keep track of the sequence number internally. - - @param type The message type of the message. - @param message A byte-buffer containing the message. - @param offset The number of bytes to skip, before the message starts. - @param len The length of the message. - @return A new byte-buffer containing the mac value. - - -

    - A NULL cipher suite, for use during handshake. - -
    - - An implementation of all high level protocols in TLS 1.0. - - - Both streams can be the same object - - - Both streams can be the same object - - - This method is called, when a change cipher spec message is received. - - @throws IOException If the message has an invalid content or the - handshake is not in the correct state. - - - Connects to the remote system. - Will be used when a certificate is received to verify - that this certificate is accepted by the client. - If handshake was not successful - - - Read data from the network. The method will return immediately, if there is - still some data left in the buffer, or block until some application - data has been read from the network. - - @param buf The buffer where the data will be copied to. - @param offset The position where the data will be placed in the buffer. - @param len The maximum number of bytes to read. - @return The number of bytes read. - @throws IOException If something goes wrong during reading data. - - - Send some application data to the remote system. -

    - The method will handle fragmentation internally. - - @param buf The buffer with the data. - @param offset The position in the buffer where the data is placed. - @param len The length of the data. - @throws IOException If something goes wrong during sending. - - -

    A Stream which can be used to send data. -
    - - A Stream which can be used to read data. - - - The secure bidirectional stream for this connection - - - Terminate this connection with an alert. -

    - Can be used for normal closure too. - - @param alertLevel The level of the alert, an be AlertLevel.fatal or AL_warning. - @param alertDescription The exact alert message. - @throws IOException If alert was fatal. - - -

    Closes this connection - If something goes wrong during closing. -
    - - Make sure the Stream is now empty. Fail otherwise. - - @param is The Stream to check. - @throws IOException If is is not empty. - - - - TLS 1.0 RSA key exchange. - - - - - TLS 1.1 SRP key exchange. - - - - Some helper functions for MicroTLS. - - - - RFC 2246 7.2 - - - - - RFC 2246 7.2 - - - - A of X509Name - - - - RFC 2246 A.5 - - - - - RFC 2246 7.4.4 - - - - - RFC 2246 6.1 - - - - - RFC 2246 6.2.1 - - - - - - - - - - - - - - - - - RFC 4492 5.4 - - - - Indicates the elliptic curve domain parameters are conveyed verbosely, and the - underlying finite field is a prime field. - - - Indicates the elliptic curve domain parameters are conveyed verbosely, and the - underlying finite field is a characteristic-2 field. - - - Indicates that a named curve is used. This option SHOULD be used when applicable. - - - - RFC 4492 5.1.2 - - - - - RFC 4366 2.3 - - - - - RFC 2246 7.4 - - - - - A temporary class to wrap old CertificateVerifyer stuff for new TlsAuthentication. - - - - - A temporary class to use LegacyTlsAuthentication - - - - - RFC 4492 5.1.1 - The named curves defined here are those specified in SEC 2 [13]. Note that many of - these curves are also recommended in ANSI X9.62 [7] and FIPS 186-2 [11]. Values 0xFE00 - through 0xFEFF are reserved for private use. Values 0xFF01 and 0xFF02 indicate that the - client supports arbitrary prime and characteristic-2 curves, respectively (the curve - parameters must be encoded explicitly in ECParameters). - - - - HMAC implementation based on original internet draft for HMAC (RFC 2104) - - The difference is that padding is concatentated versus XORed with the key - - H(K + opad, H(K + ipad, text)) - - - Base constructor for one of the standard digest algorithms that the byteLength of - the algorithm is know for. Behaviour is undefined for digests other than MD5 or SHA1. - - @param digest the digest. - - - Reset the mac generator. - - - - - - - Called by the protocol handler to report the server certificate. - - - This method is responsible for certificate verification and validation - - The server received - - - - - Return client credentials in response to server's certificate request - - - A containing server certificate request details - - - A to be used for client authentication - (or null for no client authentication) - - - - - - - - ECDHE key exchange (see RFC 4492) - - - ECDH key exchange (see RFC 4492) - - - - - - return a = a + b - b preserved. - - - unsigned comparison on two arrays - note the arrays may - start with leading zeros. - - - return z = x / y - done in place (z value preserved, x contains the - remainder) - - - return whether or not a BigInteger is probably prime with a - probability of 1 - (1/2)**certainty. -

    From Knuth Vol 2, pg 395.

    -
    - - Calculate the numbers u1, u2, and u3 such that: - - u1 * a + u2 * b = u3 - - where u3 is the greatest common divider of a and b. - a and b using the extended Euclid algorithm (refer p. 323 - of The Art of Computer Programming vol 2, 2nd ed). - This also seems to have the side effect of calculating - some form of multiplicative inverse. - - @param a First number to calculate gcd for - @param b Second number to calculate gcd for - @param u1Out the return object for the u1 value - @param u2Out the return object for the u2 value - @return The greatest common divisor of a and b - - - return w with w = x * x - w is assumed to have enough space. - - - return x with x = y * z - x is assumed to have enough space. - - - Calculate mQuote = -m^(-1) mod b with b = 2^32 (32 = word size) - - - Montgomery multiplication: a = x * y * R^(-1) mod m -
    - Based algorithm 14.36 of Handbook of Applied Cryptography. -
    -
  • m, x, y should have length n
  • -
  • a should have length (n + 1)
  • -
  • b = 2^32, R = b^n
  • -
    - The result is put in x -
    - NOTE: the indices of x, y, m, a different in HAC and in Java -
    - - return x = x % y - done in place (y value preserved) - - - do a left shift - this returns a new array. - - - do a right shift - this does it in place. - - - do a right shift by one - this does it in place. - - - returns x = x - y - we assume x is >= y - - - Class representing a simple version of a big decimal. A - SimpleBigDecimal is basically a - {@link java.math.BigInteger BigInteger} with a few digits on the right of - the decimal point. The number of (binary) digits on the right of the decimal - point is called the scale of the SimpleBigDecimal. - Unlike in {@link java.math.BigDecimal BigDecimal}, the scale is not adjusted - automatically, but must be set manually. All SimpleBigDecimals - taking part in the same arithmetic operation must have equal scale. The - result of a multiplication of two SimpleBigDecimals returns a - SimpleBigDecimal with double scale. - - - Returns a SimpleBigDecimal representing the same numerical - value as value. - @param value The value of the SimpleBigDecimal to be - created. - @param scale The scale of the SimpleBigDecimal to be - created. - @return The such created SimpleBigDecimal. - - - Constructor for SimpleBigDecimal. The value of the - constructed SimpleBigDecimal Equals bigInt / - 2scale. - @param bigInt The bigInt value parameter. - @param scale The scale of the constructed SimpleBigDecimal. - - - Class holding methods for point multiplication based on the window - τ-adic nonadjacent form (WTNAF). The algorithms are based on the - paper "Improved Algorithms for Arithmetic on Anomalous Binary Curves" - by Jerome A. Solinas. The paper first appeared in the Proceedings of - Crypto 1997. - - - The window width of WTNAF. The standard value of 4 is slightly less - than optimal for running time, but keeps space requirements for - precomputation low. For typical curves, a value of 5 or 6 results in - a better running time. When changing this value, the - αu's must be computed differently, see - e.g. "Guide to Elliptic Curve Cryptography", Darrel Hankerson, - Alfred Menezes, Scott Vanstone, Springer-Verlag New York Inc., 2004, - p. 121-122 - - - 24 - - - The αu's for a=0 as an array - of ZTauElements. - - - The αu's for a=0 as an array - of TNAFs. - - - The αu's for a=1 as an array - of ZTauElements. - - - The αu's for a=1 as an array - of TNAFs. - - - Computes the norm of an element λ of - Z[τ]. - @param mu The parameter μ of the elliptic curve. - @param lambda The element λ of - Z[τ]. - @return The norm of λ. - - - Computes the norm of an element λ of - R[τ], where λ = u + vτ - and u and u are real numbers (elements of - R). - @param mu The parameter μ of the elliptic curve. - @param u The real part of the element λ of - R[τ]. - @param v The τ-adic part of the element - λ of R[τ]. - @return The norm of λ. - - - Rounds an element λ of R[τ] - to an element of Z[τ], such that their difference - has minimal norm. λ is given as - λ = λ0 + λ1τ. - @param lambda0 The component λ0. - @param lambda1 The component λ1. - @param mu The parameter μ of the elliptic curve. Must - equal 1 or -1. - @return The rounded element of Z[τ]. - @throws ArgumentException if lambda0 and - lambda1 do not have same scale. - - - Approximate division by n. For an integer - k, the value λ = s k / n is - computed to c bits of accuracy. - @param k The parameter k. - @param s The curve parameter s0 or - s1. - @param vm The Lucas Sequence element Vm. - @param a The parameter a of the elliptic curve. - @param m The bit length of the finite field - Fm. - @param c The number of bits of accuracy, i.e. the scale of the returned - SimpleBigDecimal. - @return The value λ = s k / n computed to - c bits of accuracy. - - - Computes the τ-adic NAF (non-adjacent form) of an - element λ of Z[τ]. - @param mu The parameter μ of the elliptic curve. - @param lambda The element λ of - Z[τ]. - @return The τ-adic NAF of λ. - - - Applies the operation τ() to an - F2mPoint. - @param p The F2mPoint to which τ() is applied. - @return τ(p) - - - Returns the parameter μ of the elliptic curve. - @param curve The elliptic curve from which to obtain μ. - The curve must be a Koblitz curve, i.e. a Equals - 0 or 1 and b Equals - 1. - @return μ of the elliptic curve. - @throws ArgumentException if the given ECCurve is not a Koblitz - curve. - - - Calculates the Lucas Sequence elements Uk-1 and - Uk or Vk-1 and - Vk. - @param mu The parameter μ of the elliptic curve. - @param k The index of the second element of the Lucas Sequence to be - returned. - @param doV If set to true, computes Vk-1 and - Vk, otherwise Uk-1 and - Uk. - @return An array with 2 elements, containing Uk-1 - and Uk or Vk-1 - and Vk. - - - Computes the auxiliary value tw. If the width is - 4, then for mu = 1, tw = 6 and for - mu = -1, tw = 10 - @param mu The parameter μ of the elliptic curve. - @param w The window width of the WTNAF. - @return the auxiliary value tw - - - Computes the auxiliary values s0 and - s1 used for partial modular reduction. - @param curve The elliptic curve for which to compute - s0 and s1. - @throws ArgumentException if curve is not a - Koblitz curve (Anomalous Binary Curve, ABC). - - - Partial modular reduction modulo - m - 1)/(τ - 1). - @param k The integer to be reduced. - @param m The bitlength of the underlying finite field. - @param a The parameter a of the elliptic curve. - @param s The auxiliary values s0 and - s1. - @param mu The parameter μ of the elliptic curve. - @param c The precision (number of bits of accuracy) of the partial - modular reduction. - @return ρ := k partmod (τm - 1)/(τ - 1) - - - Multiplies a {@link org.bouncycastle.math.ec.F2mPoint F2mPoint} - by a BigInteger using the reduced τ-adic - NAF (RTNAF) method. - @param p The F2mPoint to Multiply. - @param k The BigInteger by which to Multiply p. - @return k * p - - - Multiplies a {@link org.bouncycastle.math.ec.F2mPoint F2mPoint} - by an element λ of Z[τ] - using the τ-adic NAF (TNAF) method. - @param p The F2mPoint to Multiply. - @param lambda The element λ of - Z[τ]. - @return λ * p - - - Multiplies a {@link org.bouncycastle.math.ec.F2mPoint F2mPoint} - by an element λ of Z[τ] - using the τ-adic NAF (TNAF) method, given the TNAF - of λ. - @param p The F2mPoint to Multiply. - @param u The the TNAF of λ.. - @return λ * p - - - Computes the [τ]-adic window NAF of an element - λ of Z[τ]. - @param mu The parameter μ of the elliptic curve. - @param lambda The element λ of - Z[τ] of which to compute the - [τ]-adic NAF. - @param width The window width of the resulting WNAF. - @param pow2w 2width. - @param tw The auxiliary value tw. - @param alpha The αu's for the window width. - @return The [τ]-adic window NAF of - λ. - - - Does the precomputation for WTNAF multiplication. - @param p The ECPoint for which to do the precomputation. - @param a The parameter a of the elliptic curve. - @return The precomputation array for p. - - - Class representing an element of Z[τ]. Let - λ be an element of Z[τ]. Then - λ is given as λ = u + vτ. The - components u and v may be used directly, there - are no accessor methods. - Immutable class. - - - The "real" part of λ. - - - The "τ-adic" part of λ. - - - Constructor for an element λ of - Z[τ]. - @param u The "real" part of λ. - @param v The "τ-adic" part of - λ. - - - Base class for an elliptic curve. - - - Decode a point on this curve from its ASN.1 encoding. The different - encodings are taken account of, including point compression for - Fp (X9.62 s 4.2.1 pg 17). - @return The decoded point. - - - Elliptic curve over Fp - - - Elliptic curves over F2m. The Weierstrass equation is given by - y2 + xy = x3 + ax2 + b. - - - The exponent m of F2m. - - - TPB: The integer k where xm + - xk + 1 represents the reduction polynomial - f(z).
    - PPB: The integer k1 where xm + - xk3 + xk2 + xk1 + 1 - represents the reduction polynomial f(z).
    -
    - - TPB: Always set to 0
    - PPB: The integer k2 where xm + - xk3 + xk2 + xk1 + 1 - represents the reduction polynomial f(z).
    -
    - - TPB: Always set to 0
    - PPB: The integer k3 where xm + - xk3 + xk2 + xk1 + 1 - represents the reduction polynomial f(z).
    -
    - - The order of the base point of the curve. - - - The cofactor of the curve. - - - The point at infinity on this curve. - - - The parameter μ of the elliptic curve if this is - a Koblitz curve. - - - The auxiliary values s0 and - s1 used for partial modular reduction for - Koblitz curves. - - - Constructor for Trinomial Polynomial Basis (TPB). - @param m The exponent m of - F2m. - @param k The integer k where xm + - xk + 1 represents the reduction - polynomial f(z). - @param a The coefficient a in the Weierstrass equation - for non-supersingular elliptic curves over - F2m. - @param b The coefficient b in the Weierstrass equation - for non-supersingular elliptic curves over - F2m. - - - Constructor for Trinomial Polynomial Basis (TPB). - @param m The exponent m of - F2m. - @param k The integer k where xm + - xk + 1 represents the reduction - polynomial f(z). - @param a The coefficient a in the Weierstrass equation - for non-supersingular elliptic curves over - F2m. - @param b The coefficient b in the Weierstrass equation - for non-supersingular elliptic curves over - F2m. - @param n The order of the main subgroup of the elliptic curve. - @param h The cofactor of the elliptic curve, i.e. - #Ea(F2m) = h * n. - - - Constructor for Pentanomial Polynomial Basis (PPB). - @param m The exponent m of - F2m. - @param k1 The integer k1 where xm + - xk3 + xk2 + xk1 + 1 - represents the reduction polynomial f(z). - @param k2 The integer k2 where xm + - xk3 + xk2 + xk1 + 1 - represents the reduction polynomial f(z). - @param k3 The integer k3 where xm + - xk3 + xk2 + xk1 + 1 - represents the reduction polynomial f(z). - @param a The coefficient a in the Weierstrass equation - for non-supersingular elliptic curves over - F2m. - @param b The coefficient b in the Weierstrass equation - for non-supersingular elliptic curves over - F2m. - - - Constructor for Pentanomial Polynomial Basis (PPB). - @param m The exponent m of - F2m. - @param k1 The integer k1 where xm + - xk3 + xk2 + xk1 + 1 - represents the reduction polynomial f(z). - @param k2 The integer k2 where xm + - xk3 + xk2 + xk1 + 1 - represents the reduction polynomial f(z). - @param k3 The integer k3 where xm + - xk3 + xk2 + xk1 + 1 - represents the reduction polynomial f(z). - @param a The coefficient a in the Weierstrass equation - for non-supersingular elliptic curves over - F2m. - @param b The coefficient b in the Weierstrass equation - for non-supersingular elliptic curves over - F2m. - @param n The order of the main subgroup of the elliptic curve. - @param h The cofactor of the elliptic curve, i.e. - #Ea(F2m) = h * n. - - - Returns true if this is a Koblitz curve (ABC curve). - @return true if this is a Koblitz curve (ABC curve), false otherwise - - - Returns the parameter μ of the elliptic curve. - @return μ of the elliptic curve. - @throws ArgumentException if the given ECCurve is not a - Koblitz curve. - - - @return the auxiliary values s0 and - s1 used for partial modular reduction for - Koblitz curves. - - - Solves a quadratic equation z2 + z = beta(X9.62 - D.1.6) The other solution is z + 1. - - @param beta - The value to solve the qradratic equation for. - @return the solution for z2 + z = beta or - null if no solution exists. - - - Return true if curve uses a Trinomial basis. - - @return true if curve Trinomial, false otherwise. - - - return the field name for this field. - - @return the string "Fp". - - - return a sqrt root - the routine verifies that the calculation - returns the right value - if none exists it returns null. - - - Class representing the Elements of the finite field - F2m in polynomial basis (PB) - representation. Both trinomial (Tpb) and pentanomial (Ppb) polynomial - basis representations are supported. Gaussian normal basis (GNB) - representation is not supported. - - - Indicates gaussian normal basis representation (GNB). Number chosen - according to X9.62. GNB is not implemented at present. - - - Indicates trinomial basis representation (Tpb). Number chosen - according to X9.62. - - - Indicates pentanomial basis representation (Ppb). Number chosen - according to X9.62. - - - Tpb or Ppb. - - - The exponent m of F2m. - - - Tpb: The integer k where xm + - xk + 1 represents the reduction polynomial - f(z).
    - Ppb: The integer k1 where xm + - xk3 + xk2 + xk1 + 1 - represents the reduction polynomial f(z).
    -
    - - Tpb: Always set to 0
    - Ppb: The integer k2 where xm + - xk3 + xk2 + xk1 + 1 - represents the reduction polynomial f(z).
    -
    - - Tpb: Always set to 0
    - Ppb: The integer k3 where xm + - xk3 + xk2 + xk1 + 1 - represents the reduction polynomial f(z).
    -
    - - The IntArray holding the bits. - - - The number of ints required to hold m bits. - - - Constructor for Ppb. - @param m The exponent m of - F2m. - @param k1 The integer k1 where xm + - xk3 + xk2 + xk1 + 1 - represents the reduction polynomial f(z). - @param k2 The integer k2 where xm + - xk3 + xk2 + xk1 + 1 - represents the reduction polynomial f(z). - @param k3 The integer k3 where xm + - xk3 + xk2 + xk1 + 1 - represents the reduction polynomial f(z). - @param x The BigInteger representing the value of the field element. - - - Constructor for Tpb. - @param m The exponent m of - F2m. - @param k The integer k where xm + - xk + 1 represents the reduction - polynomial f(z). - @param x The BigInteger representing the value of the field element. - - - Checks, if the ECFieldElements a and b - are elements of the same field F2m - (having the same representation). - @param a field element. - @param b field element to be compared. - @throws ArgumentException if a and b - are not elements of the same field - F2m (having the same - representation). - - - @return the representation of the field - F2m, either of - {@link F2mFieldElement.Tpb} (trinomial - basis representation) or - {@link F2mFieldElement.Ppb} (pentanomial - basis representation). - - - @return the degree m of the reduction polynomial - f(z). - - - @return Tpb: The integer k where xm + - xk + 1 represents the reduction polynomial - f(z).
    - Ppb: The integer k1 where xm + - xk3 + xk2 + xk1 + 1 - represents the reduction polynomial f(z).
    -
    - - @return Tpb: Always returns 0
    - Ppb: The integer k2 where xm + - xk3 + xk2 + xk1 + 1 - represents the reduction polynomial f(z).
    -
    - - @return Tpb: Always set to 0
    - Ppb: The integer k3 where xm + - xk3 + xk2 + xk1 + 1 - represents the reduction polynomial f(z).
    -
    - - base class for points on elliptic curves. - - - Sets the PreCompInfo. Used by ECMultipliers - to save the precomputation for this ECPoint to store the - precomputation result for use by subsequent multiplication. - @param preCompInfo The values precomputed by the - ECMultiplier. - - - Sets the appropriate ECMultiplier, unless already set. - - - return the field element encoded with point compression. (S 4.3.6) - - - Multiplies this ECPoint by the given number. - @param k The multiplicator. - @return k * this. - - - Elliptic curve points over Fp - - - Create a point which encodes with point compression. - - @param curve the curve to use - @param x affine x co-ordinate - @param y affine y co-ordinate - - - Create a point that encodes with or without point compresion. - - @param curve the curve to use - @param x affine x co-ordinate - @param y affine y co-ordinate - @param withCompression if true encode with point compression - - - Sets the default ECMultiplier, unless already set. - - - Elliptic curve points over F2m - - - @param curve base curve - @param x x point - @param y y point - - - @param curve base curve - @param x x point - @param y y point - @param withCompression true if encode with point compression. - - - Constructor for point at infinity - - - Check, if two ECPoints can be added or subtracted. - @param a The first ECPoint to check. - @param b The second ECPoint to check. - @throws IllegalArgumentException if a and b - cannot be added. - - - Adds another ECPoints.F2m to this without - checking if both points are on the same curve. Used by multiplication - algorithms, because there all points are a multiple of the same point - and hence the checks can be omitted. - @param b The other ECPoints.F2m to add to - this. - @return this + b - - - Subtracts another ECPoints.F2m from this - without checking if both points are on the same curve. Used by - multiplication algorithms, because there all points are a multiple - of the same point and hence the checks can be omitted. - @param b The other ECPoints.F2m to subtract from - this. - @return this - b - - - Sets the appropriate ECMultiplier, unless already set. - - - Interface for classes encapsulating a point multiplication algorithm - for ECPoints. - - - Multiplies the ECPoint p by k, i.e. - p is added k times to itself. - @param p The ECPoint to be multiplied. - @param k The factor by which p i multiplied. - @return p multiplied by k. - - - Class implementing the NAF (Non-Adjacent Form) multiplication algorithm. - - - D.3.2 pg 101 - @see org.bouncycastle.math.ec.multiplier.ECMultiplier#multiply(org.bouncycastle.math.ec.ECPoint, java.math.BigInteger) - - - Interface for classes storing precomputation data for multiplication - algorithms. Used as a Memento (see GOF patterns) for - WNafMultiplier. - - - Simple shift-and-add multiplication. Serves as reference implementation - to verify (possibly faster) implementations in - {@link org.bouncycastle.math.ec.ECPoint ECPoint}. - - @param p The point to multiply. - @param k The factor by which to multiply. - @return The result of the point multiplication k * p. - - - Class implementing the WNAF (Window Non-Adjacent Form) multiplication - algorithm. - - - Computes the Window NAF (non-adjacent Form) of an integer. - @param width The width w of the Window NAF. The width is - defined as the minimal number w, such that for any - w consecutive digits in the resulting representation, at - most one is non-zero. - @param k The integer of which the Window NAF is computed. - @return The Window NAF of the given width, such that the following holds: - k = −i=0l-1 ki2i - , where the ki denote the elements of the - returned sbyte[]. - - - Multiplies this by an integer k using the - Window NAF method. - @param k The integer by which this is multiplied. - @return A new ECPoint which equals this - multiplied by k. - - - Class holding precomputation data for the WNAF (Window Non-Adjacent Form) - algorithm. - - - Array holding the precomputed ECPoints used for the Window - NAF multiplication in - {@link org.bouncycastle.math.ec.multiplier.WNafMultiplier.multiply() - WNafMultiplier.multiply()}. - - - Holds an ECPoint representing twice(this). Used for the - Window NAF multiplication in - {@link org.bouncycastle.math.ec.multiplier.WNafMultiplier.multiply() - WNafMultiplier.multiply()}. - - - Class implementing the WTNAF (Window - τ-adic Non-Adjacent Form) algorithm. - - - Multiplies a {@link org.bouncycastle.math.ec.F2mPoint F2mPoint} - by k using the reduced τ-adic NAF (RTNAF) - method. - @param p The F2mPoint to multiply. - @param k The integer by which to multiply k. - @return p multiplied by k. - - - Multiplies a {@link org.bouncycastle.math.ec.F2mPoint F2mPoint} - by an element λ of Z[τ] using - the τ-adic NAF (TNAF) method. - @param p The F2mPoint to multiply. - @param lambda The element λ of - Z[τ] of which to compute the - [τ]-adic NAF. - @return p multiplied by λ. - - - Multiplies a {@link org.bouncycastle.math.ec.F2mPoint F2mPoint} - by an element λ of Z[τ] - using the window τ-adic NAF (TNAF) method, given the - WTNAF of λ. - @param p The F2mPoint to multiply. - @param u The the WTNAF of λ.. - @return λ * p - - - Class holding precomputation data for the WTNAF (Window - τ-adic Non-Adjacent Form) algorithm. - - - Array holding the precomputed F2mPoints used for the - WTNAF multiplication in - {@link org.bouncycastle.math.ec.multiplier.WTauNafMultiplier.multiply() - WTauNafMultiplier.multiply()}. - - - Constructor for WTauNafPreCompInfo - @param preComp Array holding the precomputed F2mPoints - used for the WTNAF multiplication in - {@link org.bouncycastle.math.ec.multiplier.WTauNafMultiplier.multiply() - WTauNafMultiplier.multiply()}. - - - @return the array holding the precomputed F2mPoints - used for the WTNAF multiplication in - {@link org.bouncycastle.math.ec.multiplier.WTauNafMultiplier.multiply() - WTauNafMultiplier.multiply()}. - - - - - BasicOcspResponse ::= SEQUENCE { - tbsResponseData ResponseData, - signatureAlgorithm AlgorithmIdentifier, - signature BIT STRING, - certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL - } - - - - - The DER encoding of the tbsResponseData field. - In the event of an encoding error. - - - The certificates, if any, associated with the response. - In the event of an encoding error. - - - - Verify the signature against the tbsResponseData object we contain. - - - - The ASN.1 encoded representation of this object. - - - Generator for basic OCSP response objects. - - - basic constructor - - - construct with the responderID to be the SHA-1 keyHash of the passed in public key. - - - Add a response for a particular Certificate ID. - - @param certID certificate ID details - @param certStatus status of the certificate - null if okay - - - Add a response for a particular Certificate ID. - - @param certID certificate ID details - @param certStatus status of the certificate - null if okay - @param singleExtensions optional extensions - - - Add a response for a particular Certificate ID. - - @param certID certificate ID details - @param nextUpdate date when next update should be requested - @param certStatus status of the certificate - null if okay - @param singleExtensions optional extensions - - - Add a response for a particular Certificate ID. - - @param certID certificate ID details - @param thisUpdate date this response was valid on - @param nextUpdate date when next update should be requested - @param certStatus status of the certificate - null if okay - @param singleExtensions optional extensions - - - Set the extensions for the response. - - @param responseExtensions the extension object to carry. - - - Return an IEnumerable of the signature names supported by the generator. - - @return an IEnumerable containing recognised names. - - - create from an issuer certificate and the serial number of the - certificate it signed. - @exception OcspException if any problems occur creating the id fields. - - - return the serial number for the certificate associated - with this request. - - - Create a new CertificateID for a new serial number derived from a previous one - calculated for the same CA certificate. - - @param original the previously calculated CertificateID for the CA. - @param newSerialNumber the serial number for the new certificate of interest. - - @return a new CertificateID for newSerialNumber - - -
    -             OcspRequest     ::=     SEQUENCE {
    -                   tbsRequest                  TBSRequest,
    -                   optionalSignature   [0]     EXPLICIT Signature OPTIONAL }
    -            
    -               TBSRequest      ::=     SEQUENCE {
    -                   version             [0]     EXPLICIT Version DEFAULT v1,
    -                   requestorName       [1]     EXPLICIT GeneralName OPTIONAL,
    -                   requestList                 SEQUENCE OF Request,
    -                   requestExtensions   [2]     EXPLICIT Extensions OPTIONAL }
    -            
    -               Signature       ::=     SEQUENCE {
    -                   signatureAlgorithm      AlgorithmIdentifier,
    -                   signature               BIT STRING,
    -                   certs               [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL}
    -            
    -               Version         ::=             INTEGER  {  v1(0) }
    -            
    -               Request         ::=     SEQUENCE {
    -                   reqCert                     CertID,
    -                   singleRequestExtensions     [0] EXPLICIT Extensions OPTIONAL }
    -            
    -               CertID          ::=     SEQUENCE {
    -                   hashAlgorithm       AlgorithmIdentifier,
    -                   issuerNameHash      OCTET STRING, -- Hash of Issuer's DN
    -                   issuerKeyHash       OCTET STRING, -- Hash of Issuers public key
    -                   serialNumber        CertificateSerialNumber }
    -             
    -
    - - Return the DER encoding of the tbsRequest field. - @return DER encoding of tbsRequest - @throws OcspException in the event of an encoding error. - - - return the object identifier representing the signature algorithm - - - If the request is signed return a possibly empty CertStore containing the certificates in the - request. If the request is not signed the method returns null. - - @return null if not signed, a CertStore otherwise - @throws OcspException - - - Return whether or not this request is signed. - - @return true if signed false otherwise. - - - Verify the signature against the TBSRequest object we contain. - - - return the ASN.1 encoded representation of this object. - - - Add a request for the given CertificateID. - - @param certId certificate ID of interest - - - Add a request with extensions - - @param certId certificate ID of interest - @param singleRequestExtensions the extensions to attach to the request - - - Set the requestor name to the passed in X509Principal - - @param requestorName a X509Principal representing the requestor name. - - - Generate an unsigned request - - @return the OcspReq - @throws OcspException - - - Return an IEnumerable of the signature names supported by the generator. - - @return an IEnumerable containing recognised names. - - - return the ASN.1 encoded representation of this object. - - - base generator for an OCSP response - at the moment this only supports the - generation of responses containing BasicOCSP responses. - - - note 4 is not used. - - - Carrier for a ResponderID. - - - wrapper for the RevokedInfo object - - - return the revocation reason. Note: this field is optional, test for it - with hasRevocationReason() first. - @exception InvalidOperationException if a reason is asked for and none is avaliable - - - Return the status object for the response - null indicates good. - - @return the status object for the response, null if it is good. - - - return the NextUpdate value - note: this is an optional field so may - be returned as null. - - @return nextUpdate, or null if not present. - - - wrapper for the UnknownInfo object - - - - Utility class for creating IBasicAgreement objects from their names/Oids - - - - - Cipher Utility class contains methods that can not be specifically grouped into other classes. - - - - - Returns a ObjectIdentifier for a give encoding. - - A string representation of the encoding. - A DerObjectIdentifier, null if the Oid is not available. - - - - Utility class for creating IDigest objects from their names/Oids - - - - - Returns a ObjectIdentifier for a given digest mechanism. - - A string representation of the digest meanism. - A DerObjectIdentifier, null if the Oid is not available. - - - - A class containing methods to interface the BouncyCastle world to the .NET Crypto world. - - - - - Create an System.Security.Cryptography.X509Certificate from an X509Certificate Structure. - - - A System.Security.Cryptography.X509Certificate. - - - - Utility class for creating HMac object from their names/Oids - - - - - - - - - - Returns a ObjectIdentifier for a give encoding. - - A string representation of the encoding. - A DerObjectIdentifier, null if the Oid is not available. - - - Use the specified instance of IRandomGenerator as random source. - - This constructor performs no seeding of either the IRandomGenerator or the - constructed SecureRandom. It is the responsibility of the client to provide - proper seed material as necessary/appropriate for the given IRandomGenerator - implementation. - - The source to generate all random bytes from. - - - base constructor. - - - create a SecurityUtilityException with the given message. - - @param message the message to be carried with the exception. - - - - Signer Utility class contains methods that can not be specifically grouped into other classes. - - - - - Returns a ObjectIdentifier for a give encoding. - - A string representation of the encoding. - A DerObjectIdentifier, null if the Oid is not available. - - - - Utility class for creating IWrapper objects from their names/Oids - - - - Class for reading OpenSSL PEM encoded streams containing - X509 certificates, PKCS8 encoded keys and PKCS7 objects. -

    - In the case of PKCS7 objects the reader will return a CMS ContentInfo object. Keys and - Certificates will be returned using the appropriate java.security type.

    -
    - - Create a new PemReader - - @param reader the Reader - - - Create a new PemReader with a password finder - - @param reader the Reader - @param pFinder the password finder - - - Reads in a X509Certificate. - - @return the X509Certificate - @throws IOException if an I/O error occured - - - Reads in a X509CRL. - - @return the X509Certificate - @throws IOException if an I/O error occured - - - Reads in a PKCS10 certification request. - - @return the certificate request. - @throws IOException if an I/O error occured - - - Reads in a X509 Attribute Certificate. - - @return the X509 Attribute Certificate - @throws IOException if an I/O error occured - - - Reads in a PKCS7 object. This returns a ContentInfo object suitable for use with the CMS - API. - - @return the X509Certificate - @throws IOException if an I/O error occured - - - Read a Key Pair - - - General purpose writer for OpenSSL PEM objects. - - - The TextWriter object to write the output to. - - - PEM generator for the original set of PEM objects used in Open SSL. - - - Constructor for an unencrypted private key PEM object. - - @param key private key to be encoded. - - - Constructor for an encrypted private key PEM object. - - @param key private key to be encoded - @param algorithm encryption algorithm to use - @param provider provider to use - @throws NoSuchAlgorithmException if algorithm/mode cannot be found - - - - A class for verifying and creating Pkcs10 Certification requests. - - - CertificationRequest ::= Sequence { - certificationRequestInfo CertificationRequestInfo, - signatureAlgorithm AlgorithmIdentifier{{ SignatureAlgorithms }}, - signature BIT STRING - } - - CertificationRequestInfo ::= Sequence { - version Integer { v1(0) } (v1,...), - subject Name, - subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }}, - attributes [0] Attributes{{ CRIAttributes }} - } - - Attributes { ATTRIBUTE:IOSet } ::= Set OF Attr{{ IOSet }} - - Attr { ATTRIBUTE:IOSet } ::= Sequence { - type ATTRIBUTE.&id({IOSet}), - values Set SIZE(1..MAX) OF ATTRIBUTE.&Type({IOSet}{\@type}) - } - - see - - - - Instantiate a Pkcs10CertificationRequest object with the necessary credentials. - - Name of Sig Alg. - X509Name of subject eg OU="My unit." O="My Organisatioin" C="au" - Public Key to be included in cert reqest. - ASN1Set of Attributes. - Matching Private key for nominated (above) public key to be used to sign the request. - - - - Get the public key. - - The public key. - - - - Verify Pkcs10 Cert Request is valid. - - true = valid. - - - - A class for creating and verifying Pkcs10 Certification requests (this is an extension on ). - The requests are made using delay signing. This is useful for situations where - the private key is in another environment and not directly accessible (e.g. HSM) - So the first step creates the request, then the signing is done outside this - object and the signature is then used to complete the request. - - - CertificationRequest ::= Sequence { - certificationRequestInfo CertificationRequestInfo, - signatureAlgorithm AlgorithmIdentifier{{ SignatureAlgorithms }}, - signature BIT STRING - } - - CertificationRequestInfo ::= Sequence { - version Integer { v1(0) } (v1,...), - subject Name, - subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }}, - attributes [0] Attributes{{ CRIAttributes }} - } - - Attributes { ATTRIBUTE:IOSet } ::= Set OF Attr{{ IOSet }} - - Attr { ATTRIBUTE:IOSet } ::= Sequence { - type ATTRIBUTE.&id({IOSet}), - values Set SIZE(1..MAX) OF ATTRIBUTE.&Type({IOSet}{\@type}) - } - - see - - - - Instantiate a Pkcs10CertificationRequest object with the necessary credentials. - - Name of Sig Alg. - X509Name of subject eg OU="My unit." O="My Organisatioin" C="au" - Public Key to be included in cert reqest. - ASN1Set of Attributes. - - After the object is constructed use the and finally the - SignRequest methods to finalize the request. - - - - simply return the cert entry for the private key - - - Utility class for reencoding PKCS#12 files to definite length. - - - Just re-encode the outer layer of the PKCS#12 file to definite length encoding. - - @param berPKCS12File - original PKCS#12 file - @return a byte array representing the DER encoding of the PFX structure - @throws IOException - - - Re-encode the PKCS#12 structure to definite length encoding at the inner layer - as well, recomputing the MAC accordingly. - - @param berPKCS12File - original PKCS12 file. - @param provider - provider to use for MAC calculation. - @return a byte array representing the DER encoding of the PFX structure. - @throws IOException on parsing, encoding errors. - - - - Returns the revocationDate. - - - - - Returns the certStatus. - - - - Returns an immutable Set of X.509 attribute certificate - extensions that this PkixAttrCertChecker supports or - null if no extensions are supported. -

    - Each element of the set is a String representing the - Object Identifier (OID) of the X.509 extension that is supported. -

    -

    - All X.509 attribute certificate extensions that a - PkixAttrCertChecker might possibly be able to process - should be included in the set. -

    - - @return an immutable Set of X.509 extension OIDs (in - String format) supported by this - PkixAttrCertChecker, or null if no - extensions are supported -
    - - Performs checks on the specified attribute certificate. Every handled - extension is rmeoved from the unresolvedCritExts - collection. - - @param attrCert The attribute certificate to be checked. - @param certPath The certificate path which belongs to the attribute - certificate issuer public key certificate. - @param holderCertPath The certificate path which belongs to the holder - certificate. - @param unresolvedCritExts a Collection of OID strings - representing the current set of unresolved critical extensions - @throws CertPathValidatorException if the specified attribute certificate - does not pass the check. - - - Returns a clone of this object. - - @return a copy of this PkixAttrCertChecker - - - Build and validate a CertPath using the given parameter. - - @param params PKIXBuilderParameters object containing all information to - build the CertPath - - - CertPathValidatorSpi implementation for X.509 Attribute Certificates la RFC 3281. - - @see org.bouncycastle.x509.ExtendedPkixParameters - - - Validates an attribute certificate with the given certificate path. - -

    - params must be an instance of - ExtendedPkixParameters. -

    - The target constraints in the params must be an - X509AttrCertStoreSelector with at least the attribute - certificate criterion set. Obey that also target informations may be - necessary to correctly validate this attribute certificate. -

    - The attribute certificate issuer must be added to the trusted attribute - issuers with {@link ExtendedPkixParameters#setTrustedACIssuers(Set)}. -

    - @param certPath The certificate path which belongs to the attribute - certificate issuer public key certificate. - @param params The PKIX parameters. - @return A PKIXCertPathValidatorResult of the result of - validating the certPath. - @throws InvalidAlgorithmParameterException if params is - inappropriate for this validator. - @throws CertPathValidatorException if the verification fails. -
    - - - Summary description for PkixBuilderParameters. - - - - Returns an instance of PkixBuilderParameters. -

    - This method can be used to get a copy from other - PKIXBuilderParameters, PKIXParameters, - and ExtendedPKIXParameters instances. -

    - - @param pkixParams The PKIX parameters to create a copy of. - @return An PkixBuilderParameters instance. -
    - - - Excluded certificates are not used for building a certification path. - - the excluded certificates. - - - - Sets the excluded certificates which are not used for building a - certification path. If the ISet is null an - empty set is assumed. - - - The given set is cloned to protect it against subsequent modifications. - - The excluded certificates to set. - - - Can alse handle ExtendedPKIXBuilderParameters and - PKIXBuilderParameters. - - @param params Parameters to set. - @see org.bouncycastle.x509.ExtendedPKIXParameters#setParams(java.security.cert.PKIXParameters) - - - Makes a copy of this PKIXParameters object. Changes to the - copy will not affect the original and vice versa. - - @return a copy of this PKIXParameters object - - - An immutable sequence of certificates (a certification path).
    -
    - This is an abstract class that defines the methods common to all CertPaths. - Subclasses can handle different kinds of certificates (X.509, PGP, etc.).
    -
    - All CertPath objects have a type, a list of Certificates, and one or more - supported encodings. Because the CertPath class is immutable, a CertPath - cannot change in any externally visible way after being constructed. This - stipulation applies to all public fields and methods of this class and any - added or overridden by subclasses.
    -
    - The type is a string that identifies the type of Certificates in the - certification path. For each certificate cert in a certification path - certPath, cert.getType().equals(certPath.getType()) must be true.
    -
    - The list of Certificates is an ordered List of zero or more Certificates. - This List and all of the Certificates contained in it must be immutable.
    -
    - Each CertPath object must support one or more encodings so that the object - can be translated into a byte array for storage or transmission to other - parties. Preferably, these encodings should be well-documented standards - (such as PKCS#7). One of the encodings supported by a CertPath is considered - the default encoding. This encoding is used if no encoding is explicitly - requested (for the {@link #getEncoded()} method, for instance).
    -
    - All CertPath objects are also Serializable. CertPath objects are resolved - into an alternate {@link CertPathRep} object during serialization. This - allows a CertPath object to be serialized into an equivalent representation - regardless of its underlying implementation.
    -
    - CertPath objects can be created with a CertificateFactory or they can be - returned by other classes, such as a CertPathBuilder.
    -
    - By convention, X.509 CertPaths (consisting of X509Certificates), are ordered - starting with the target certificate and ending with a certificate issued by - the trust anchor. That is, the issuer of one certificate is the subject of - the following one. The certificate representing the - {@link TrustAnchor TrustAnchor} should not be included in the certification - path. Unvalidated X.509 CertPaths may not follow these conventions. PKIX - CertPathValidators will detect any departure from these conventions that - cause the certification path to be invalid and throw a - CertPathValidatorException.
    -
    - Concurrent Access
    -
    - All CertPath objects must be thread-safe. That is, multiple threads may - concurrently invoke the methods defined in this class on a single CertPath - object (or more than one) with no ill effects. This is also true for the List - returned by CertPath.getCertificates.
    -
    - Requiring CertPath objects to be immutable and thread-safe allows them to be - passed around to various pieces of code without worrying about coordinating - access. Providing this thread-safety is generally not difficult, since the - CertPath and List objects in question are immutable. - - @see CertificateFactory - @see CertPathBuilder - - CertPath implementation for X.509 certificates. - -
    - - @param certs - - - Creates a CertPath of the specified type. - This constructor is protected because most users should use - a CertificateFactory to create CertPaths. - @param type the standard name of the type of Certificatesin this path - - - - Creates a CertPath of the specified type. - This constructor is protected because most users should use - a CertificateFactory to create CertPaths. - - @param type the standard name of the type of Certificatesin this path - - - - Returns an iteration of the encodings supported by this - certification path, with the default encoding - first. Attempts to modify the returned Iterator via its - remove method result in an UnsupportedOperationException. - - @return an Iterator over the names of the supported encodings (as Strings) - - - - Compares this certification path for equality with the specified object. - Two CertPaths are equal if and only if their types are equal and their - certificate Lists (and by implication the Certificates in those Lists) - are equal. A CertPath is never equal to an object that is not a CertPath.
    -
    - This algorithm is implemented by this method. If it is overridden, the - behavior specified here must be maintained. - - @param other - the object to test for equality with this certification path - - @return true if the specified object is equal to this certification path, - false otherwise - - @see Object#hashCode() Object.hashCode() -
    - - Returns the encoded form of this certification path, using - the default encoding. - - @return the encoded bytes - @exception CertificateEncodingException if an encoding error occurs - - - - Returns the encoded form of this certification path, using - the specified encoding. - - @param encoding the name of the encoding to use - @return the encoded bytes - @exception CertificateEncodingException if an encoding error - occurs or the encoding requested is not supported - - - - - Returns the list of certificates in this certification - path. - - - - Return a DERObject containing the encoded certificate. - - @param cert the X509Certificate object to be encoded - - @return the DERObject - - - - Implements the PKIX CertPathBuilding algorithm for BouncyCastle. - - @see CertPathBuilderSpi - - - Build and validate a CertPath using the given parameter. - - @param params PKIXBuilderParameters object containing all information to - build the CertPath - - - - Summary description for PkixCertPathBuilderException. - - - - - Summary description for PkixCertPathBuilderResult. - - - - * Initializes the internal state of this PKIXCertPathChecker. - *

    - * The forward flag specifies the order that certificates - * will be passed to the {@link #check check} method (forward or reverse). A - * PKIXCertPathChecker must support reverse checking - * and may support forward checking. - *

    - * - * @param forward - * the order that certificates are presented to the - * check method. If true, - * certificates are presented from target to most-trusted CA - * (forward); if false, from most-trusted CA to - * target (reverse). - * @exception CertPathValidatorException - * if this PKIXCertPathChecker is unable to - * check certificates in the specified order; it should never - * be thrown if the forward flag is false since reverse - * checking must be supported -
    - - Indicates if forward checking is supported. Forward checking refers to - the ability of the PKIXCertPathChecker to perform its - checks when certificates are presented to the check method - in the forward direction (from target to most-trusted CA). - - @return true if forward checking is supported, - false otherwise - - - * Returns an immutable Set of X.509 certificate extensions - * that this PKIXCertPathChecker supports (i.e. recognizes, - * is able to process), or null if no extensions are - * supported. - *

    - * Each element of the set is a String representing the - * Object Identifier (OID) of the X.509 extension that is supported. The OID - * is represented by a set of nonnegative integers separated by periods. - *

    - * All X.509 certificate extensions that a PKIXCertPathChecker - * might possibly be able to process should be included in the set. - *

    - * - * @return an immutable Set of X.509 extension OIDs (in - * String format) supported by this - * PKIXCertPathChecker, or null if no - * extensions are supported -
    - - Performs the check(s) on the specified certificate using its internal - state and removes any critical extensions that it processes from the - specified collection of OID strings that represent the unresolved - critical extensions. The certificates are presented in the order - specified by the init method. - - @param cert - the Certificate to be checked - @param unresolvedCritExts - a Collection of OID strings representing the - current set of unresolved critical extensions - @exception CertPathValidatorException - if the specified certificate does not pass the check - - - Returns a clone of this object. Calls the Object.clone() - method. All subclasses which maintain state must support and override - this method, if necessary. - - @return a copy of this PKIXCertPathChecker - - - The Service Provider Interface (SPI) - for the {@link CertPathValidator CertPathValidator} class. All - CertPathValidator implementations must include a class (the - SPI class) that extends this class (CertPathValidatorSpi) - and implements all of its methods. In general, instances of this class - should only be accessed through the CertPathValidator class. - For details, see the Java Cryptography Architecture.
    -
    - Concurrent Access
    -
    - Instances of this class need not be protected against concurrent - access from multiple threads. Threads that need to access a single - CertPathValidatorSpi instance concurrently should synchronize - amongst themselves and provide the necessary locking before calling the - wrapping CertPathValidator object.
    -
    - However, implementations of CertPathValidatorSpi may still - encounter concurrency issues, since multiple threads each - manipulating a different CertPathValidatorSpi instance need not - synchronize. - - CertPathValidatorSpi implementation for X.509 Certificate validation a la RFC - 3280. - -
    - - An exception indicating one of a variety of problems encountered when - validating a certification path.
    -
    - A CertPathValidatorException provides support for wrapping - exceptions. The {@link #getCause getCause} method returns the throwable, - if any, that caused this exception to be thrown.
    -
    - A CertPathValidatorException may also include the - certification path that was being validated when the exception was thrown - and the index of the certificate in the certification path that caused the - exception to be thrown. Use the {@link #getCertPath getCertPath} and - {@link #getIndex getIndex} methods to retrieve this information.
    -
    - Concurrent Access
    -
    - Unless otherwise specified, the methods defined in this class are not - thread-safe. Multiple threads that need to access a single - object concurrently should synchronize amongst themselves and - provide the necessary locking. Multiple threads each manipulating - separate objects need not synchronize. - - @see CertPathValidator - -
    - - - Creates a PkixCertPathValidatorException with the given detail - message. A detail message is a String that describes this - particular exception. - - the detail message - - - - Creates a PkixCertPathValidatorException with the specified - detail message and cause. - - the detail message - the cause (which is saved for later retrieval by the - {@link #getCause getCause()} method). (A null - value is permitted, and indicates that the cause is - nonexistent or unknown.) - - - - Creates a PkixCertPathValidatorException with the specified - detail message, cause, certification path, and index. - - the detail message (or null if none) - the cause (or null if none) - the certification path that was in the process of being - validated when the error was encountered - the index of the certificate in the certification path that * - - - - Returns the detail message for this CertPathValidatorException. - - the detail message, or null if neither the message nor cause were specified - - - Returns the certification path that was being validated when the - exception was thrown. - - @return the CertPath that was being validated when the - exception was thrown (or null if not specified) - - - Returns the index of the certificate in the certification path that - caused the exception to be thrown. Note that the list of certificates in - a CertPath is zero based. If no index has been set, -1 is - returned. - - @return the index that has been set, or -1 if none has been set - - - - Summary description for PkixCertPathValidatorResult. - - - - - Summary description for PkixCertPathValidatorUtilities. - - - - - key usage bits - - - - - Search the given Set of TrustAnchor's for one that is the - issuer of the given X509 certificate. - - the X509 certificate - a Set of TrustAnchor's - the TrustAnchor object if found or - null if not. - - @exception - - - - Returns the issuer of an attribute certificate or certificate. - - The attribute certificate or certificate. - The issuer as X500Principal. - - - Return the next working key inheriting DSA parameters if necessary. -

    - This methods inherits DSA parameters from the indexed certificate or - previous certificates in the certificate chain to the returned - PublicKey. The list is searched upwards, meaning the end - certificate is at position 0 and previous certificates are following. -

    -

    - If the indexed certificate does not contain a DSA key this method simply - returns the public key. If the DSA key already contains DSA parameters - the key is also only returned. -

    - - @param certs The certification path. - @param index The index of the certificate which contains the public key - which should be extended with DSA parameters. - @return The public key of the certificate in list position - index extended with DSA parameters if applicable. - @throws Exception if DSA parameters cannot be inherited. -
    - - - Return a Collection of all certificates or attribute certificates found - in the X509Store's that are matching the certSelect criteriums. - - a {@link Selector} object that will be used to select - the certificates - a List containing only X509Store objects. These - are used to search for certificates. - a Collection of all found or - org.bouncycastle.x509.X509AttributeCertificate objects. - May be empty but never null. - - - - Add the CRL issuers from the cRLIssuer field of the distribution point or - from the certificate if not given to the issuer criterion of the - selector. -

    - The issuerPrincipals are a collection with a single - X500Principal for X509Certificates. For - {@link X509AttributeCertificate}s the issuer may contain more than one - X500Principal. -

    - - @param dp The distribution point. - @param issuerPrincipals The issuers of the certificate or attribute - certificate which contains the distribution point. - @param selector The CRL selector. - @param pkixParams The PKIX parameters containing the cert stores. - @throws Exception if an exception occurs while processing. - @throws ClassCastException if issuerPrincipals does not - contain only X500Principals. -
    - - Fetches complete CRLs according to RFC 3280. - - @param dp The distribution point for which the complete CRL - @param cert The X509Certificate or - {@link org.bouncycastle.x509.X509AttributeCertificate} for - which the CRL should be searched. - @param currentDate The date for which the delta CRLs must be valid. - @param paramsPKIX The extended PKIX parameters. - @return A Set of X509CRLs with complete - CRLs. - @throws Exception if an exception occurs while picking the CRLs - or no CRLs are found. - - - Fetches delta CRLs according to RFC 3280 section 5.2.4. - - @param currentDate The date for which the delta CRLs must be valid. - @param paramsPKIX The extended PKIX parameters. - @param completeCRL The complete CRL the delta CRL is for. - @return A Set of X509CRLs with delta CRLs. - @throws Exception if an exception occurs while picking the delta - CRLs. - - - Find the issuer certificates of a given certificate. - - @param cert - The certificate for which an issuer should be found. - @param pkixParams - @return A Collection object containing the issuer - X509Certificates. Never null. - - @exception Exception - if an error occurs. - - - - Extract the value of the given extension, if it exists. - - The extension object. - The object identifier to obtain. - Asn1Object - if the extension cannot be read. - - - Returns the intersection of the permitted IP ranges in - permitted with ip. - - @param permitted A Set of permitted IP addresses with - their subnet mask as byte arrays. - @param ips The IP address with its subnet mask. - @return The Set of permitted IP ranges intersected with - ip. - - - Returns the union of the excluded IP ranges in excluded - with ip. - - @param excluded A Set of excluded IP addresses with their - subnet mask as byte arrays. - @param ip The IP address with its subnet mask. - @return The Set of excluded IP ranges unified with - ip as byte arrays. - - - Calculates the union if two IP ranges. - - @param ipWithSubmask1 The first IP address with its subnet mask. - @param ipWithSubmask2 The second IP address with its subnet mask. - @return A Set with the union of both addresses. - - - Calculates the interesction if two IP ranges. - - @param ipWithSubmask1 The first IP address with its subnet mask. - @param ipWithSubmask2 The second IP address with its subnet mask. - @return A Set with the single IP address with its subnet - mask as a byte array or an empty Set. - - - Concatenates the IP address with its subnet mask. - - @param ip The IP address. - @param subnetMask Its subnet mask. - @return The concatenated IP address with its subnet mask. - - - Splits the IP addresses and their subnet mask. - - @param ipWithSubmask1 The first IP address with the subnet mask. - @param ipWithSubmask2 The second IP address with the subnet mask. - @return An array with two elements. Each element contains the IP address - and the subnet mask in this order. - - - Based on the two IP addresses and their subnet masks the IP range is - computed for each IP address - subnet mask pair and returned as the - minimum IP address and the maximum address of the range. - - @param ip1 The first IP address. - @param subnetmask1 The subnet mask of the first IP address. - @param ip2 The second IP address. - @param subnetmask2 The subnet mask of the second IP address. - @return A array with two elements. The first/second element contains the - min and max IP address of the first/second IP address and its - subnet mask. - - - Checks if the IP ip is included in the permitted ISet - permitted. - - @param permitted A Set of permitted IP addresses with - their subnet mask as byte arrays. - @param ip The IP address. - @throws PkixNameConstraintValidatorException - if the IP is not permitted. - - - Checks if the IP ip is included in the excluded ISet - excluded. - - @param excluded A Set of excluded IP addresses with their - subnet mask as byte arrays. - @param ip The IP address. - @throws PkixNameConstraintValidatorException - if the IP is excluded. - - - Checks if the IP address ip is constrained by - constraint. - - @param ip The IP address. - @param constraint The constraint. This is an IP address concatenated with - its subnetmask. - @return true if constrained, false - otherwise. - - - The common part of email1 and email2 is - added to the union union. If email1 and - email2 have nothing in common they are added both. - - @param email1 Email address constraint 1. - @param email2 Email address constraint 2. - @param union The union. - - - The most restricting part from email1 and - email2 is added to the intersection intersect. - - @param email1 Email address constraint 1. - @param email2 Email address constraint 2. - @param intersect The intersection. - - - Checks if the given GeneralName is in the permitted ISet. - - @param name The GeneralName - @throws PkixNameConstraintValidatorException - If the name - - - Check if the given GeneralName is contained in the excluded ISet. - - @param name The GeneralName. - @throws PkixNameConstraintValidatorException - If the name is - excluded. - - - Updates the permitted ISet of these name constraints with the intersection - with the given subtree. - - @param permitted The permitted subtrees - - - Adds a subtree to the excluded ISet of these name constraints. - - @param subtree A subtree with an excluded GeneralName. - - - Returns the maximum IP address. - - @param ip1 The first IP address. - @param ip2 The second IP address. - @return The maximum IP address. - - - Returns the minimum IP address. - - @param ip1 The first IP address. - @param ip2 The second IP address. - @return The minimum IP address. - - - Compares IP address ip1 with ip2. If ip1 - is equal to ip2 0 is returned. If ip1 is bigger 1 is returned, -1 - otherwise. - - @param ip1 The first IP address. - @param ip2 The second IP address. - @return 0 if ip1 is equal to ip2, 1 if ip1 is bigger, -1 otherwise. - - - Returns the logical OR of the IP addresses ip1 and - ip2. - - @param ip1 The first IP address. - @param ip2 The second IP address. - @return The OR of ip1 and ip2. - - - Stringifies an IPv4 or v6 address with subnet mask. - - @param ip The IP with subnet mask. - @return The stringified IP address. - - - - Summary description for PkixParameters. - - - - This is the default PKIX validity model. Actually there are two variants - of this: The PKIX model and the modified PKIX model. The PKIX model - verifies that all involved certificates must have been valid at the - current time. The modified PKIX model verifies that all involved - certificates were valid at the signing time. Both are indirectly choosen - with the {@link PKIXParameters#setDate(java.util.Date)} method, so this - methods sets the Date when all certificates must have been - valid. - - - This model uses the following validity model. Each certificate must have - been valid at the moment where is was used. That means the end - certificate must have been valid at the time the signature was done. The - CA certificate which signed the end certificate must have been valid, - when the end certificate was signed. The CA (or Root CA) certificate must - have been valid, when the CA certificate was signed and so on. So the - {@link PKIXParameters#setDate(java.util.Date)} method sets the time, when - the end certificate must have been valid.

    It is used e.g. - in the German signature law. - - - Creates an instance of PKIXParameters with the specified Set of - most-trusted CAs. Each element of the set is a TrustAnchor.
    -
    - Note that the Set is copied to protect against subsequent modifications. - - @param trustAnchors - a Set of TrustAnchors - - @exception InvalidAlgorithmParameterException - if the specified Set is empty - (trustAnchors.isEmpty() == true) - @exception NullPointerException - if the specified Set is null - @exception ClassCastException - if any of the elements in the Set are not of type - java.security.cert.TrustAnchor -
    - - Returns the required constraints on the target certificate. The - constraints are returned as an instance of CertSelector. If - null, no constraints are defined.
    -
    - Note that the CertSelector returned is cloned to protect against - subsequent modifications. - - @return a CertSelector specifying the constraints on the target - certificate (or null) - - @see #setTargetCertConstraints(CertSelector) -
    - - Sets the required constraints on the target certificate. The constraints - are specified as an instance of CertSelector. If null, no constraints are - defined.
    -
    - Note that the CertSelector specified is cloned to protect against - subsequent modifications. - - @param selector - a CertSelector specifying the constraints on the target - certificate (or null) - - @see #getTargetCertConstraints() -
    - - Returns an immutable Set of initial policy identifiers (OID strings), - indicating that any one of these policies would be acceptable to the - certificate user for the purposes of certification path processing. The - default return value is an empty Set, which is - interpreted as meaning that any policy would be acceptable. - - @return an immutable Set of initial policy OIDs in String - format, or an empty Set (implying any policy is - acceptable). Never returns null. - - @see #setInitialPolicies(java.util.Set) - - - Sets the Set of initial policy identifiers (OID strings), - indicating that any one of these policies would be acceptable to the - certificate user for the purposes of certification path processing. By - default, any policy is acceptable (i.e. all policies), so a user that - wants to allow any policy as acceptable does not need to call this - method, or can call it with an empty Set (or - null).
    -
    - Note that the Set is copied to protect against subsequent modifications.
    -
    - - @param initialPolicies - a Set of initial policy OIDs in String format (or - null) - - @exception ClassCastException - if any of the elements in the set are not of type String - - @see #getInitialPolicies() -
    - - Sets a List of additional certification path checkers. If - the specified List contains an object that is not a PKIXCertPathChecker, - it is ignored.
    -
    - Each PKIXCertPathChecker specified implements additional - checks on a certificate. Typically, these are checks to process and - verify private extensions contained in certificates. Each - PKIXCertPathChecker should be instantiated with any - initialization parameters needed to execute the check.
    -
    - This method allows sophisticated applications to extend a PKIX - CertPathValidator or CertPathBuilder. Each - of the specified PKIXCertPathCheckers will be called, in turn, by a PKIX - CertPathValidator or CertPathBuilder for - each certificate processed or validated.
    -
    - Regardless of whether these additional PKIXCertPathCheckers are set, a - PKIX CertPathValidator or CertPathBuilder - must perform all of the required PKIX checks on each certificate. The one - exception to this rule is if the RevocationEnabled flag is set to false - (see the {@link #setRevocationEnabled(boolean) setRevocationEnabled} - method).
    -
    - Note that the List supplied here is copied and each PKIXCertPathChecker - in the list is cloned to protect against subsequent modifications. - - @param checkers - a List of PKIXCertPathCheckers. May be null, in which case no - additional checkers will be used. - @exception ClassCastException - if any of the elements in the list are not of type - java.security.cert.PKIXCertPathChecker - @see #getCertPathCheckers() -
    - - Returns the List of certification path checkers. Each PKIXCertPathChecker - in the returned IList is cloned to protect against subsequent modifications. - - @return an immutable List of PKIXCertPathCheckers (may be empty, but not - null) - - @see #setCertPathCheckers(java.util.List) - - - Adds a PKIXCertPathChecker to the list of certification - path checkers. See the {@link #setCertPathCheckers setCertPathCheckers} - method for more details. -

    - Note that the PKIXCertPathChecker is cloned to protect - against subsequent modifications.

    - - @param checker a PKIXCertPathChecker to add to the list of - checks. If null, the checker is ignored (not added to list). -
    - - Method to support Clone() under J2ME. - super.Clone() does not exist and fields are not copied. - - @param params Parameters to set. If this are - ExtendedPkixParameters they are copied to. - - - Whether delta CRLs should be used for checking the revocation status. - Defaults to false. - - - The validity model. - @see #CHAIN_VALIDITY_MODEL - @see #PKIX_VALIDITY_MODEL - - - Sets the Bouncy Castle Stores for finding CRLs, certificates, attribute - certificates or cross certificates. -

    - The IList is cloned. -

    - - @param stores A list of stores to use. - @see #getStores - @throws ClassCastException if an element of stores is not - a {@link Store}. -
    - - Adds a Bouncy Castle {@link Store} to find CRLs, certificates, attribute - certificates or cross certificates. -

    - This method should be used to add local stores, like collection based - X.509 stores, if available. Local stores should be considered first, - before trying to use additional (remote) locations, because they do not - need possible additional network traffic. -

    - If store is null it is ignored. -

    - - @param store The store to add. - @see #getStores -
    - - Adds an additional Bouncy Castle {@link Store} to find CRLs, certificates, - attribute certificates or cross certificates. -

    - You should not use this method. This method is used for adding additional - X.509 stores, which are used to add (remote) locations, e.g. LDAP, found - during X.509 object processing, e.g. in certificates or CRLs. This method - is used in PKIX certification path processing. -

    - If store is null it is ignored. -

    - - @param store The store to add. - @see #getStores() -
    - - Returns an IList of additional Bouncy Castle - Stores used for finding CRLs, certificates, attribute - certificates or cross certificates. - - @return an immutable IList of additional Bouncy Castle - Stores. Never null. - - @see #addAddionalStore(Store) - - - Returns an IList of Bouncy Castle - Stores used for finding CRLs, certificates, attribute - certificates or cross certificates. - - @return an immutable IList of Bouncy Castle - Stores. Never null. - - @see #setStores(IList) - - - Returns if additional {@link X509Store}s for locations like LDAP found - in certificates or CRLs should be used. - - @return Returns true if additional stores are used. - - - Sets if additional {@link X509Store}s for locations like LDAP found in - certificates or CRLs should be used. - - @param enabled true if additional stores are used. - - - Returns the required constraints on the target certificate or attribute - certificate. The constraints are returned as an instance of - IX509Selector. If null, no constraints are - defined. - -

    - The target certificate in a PKIX path may be a certificate or an - attribute certificate. -

    - Note that the IX509Selector returned is cloned to protect - against subsequent modifications. -

    - @return a IX509Selector specifying the constraints on the - target certificate or attribute certificate (or null) - @see #setTargetConstraints - @see X509CertStoreSelector - @see X509AttributeCertStoreSelector -
    - - Sets the required constraints on the target certificate or attribute - certificate. The constraints are specified as an instance of - IX509Selector. If null, no constraints are - defined. -

    - The target certificate in a PKIX path may be a certificate or an - attribute certificate. -

    - Note that the IX509Selector specified is cloned to protect - against subsequent modifications. -

    - - @param selector a IX509Selector specifying the constraints on - the target certificate or attribute certificate (or - null) - @see #getTargetConstraints - @see X509CertStoreSelector - @see X509AttributeCertStoreSelector -
    - - Returns the trusted attribute certificate issuers. If attribute - certificates is verified the trusted AC issuers must be set. -

    - The returned ISet consists of TrustAnchors. -

    - The returned ISet is immutable. Never null -

    - - @return Returns an immutable set of the trusted AC issuers. -
    - - Sets the trusted attribute certificate issuers. If attribute certificates - is verified the trusted AC issuers must be set. -

    - The trustedACIssuers must be a ISet of - TrustAnchor -

    - The given set is cloned. -

    - - @param trustedACIssuers The trusted AC issuers to set. Is never - null. - @throws ClassCastException if an element of stores is not - a TrustAnchor. -
    - - Returns the neccessary attributes which must be contained in an attribute - certificate. -

    - The returned ISet is immutable and contains - Strings with the OIDs. -

    - - @return Returns the necessary AC attributes. -
    - - Sets the neccessary which must be contained in an attribute certificate. -

    - The ISet must contain Strings with the - OIDs. -

    - The set is cloned. -

    - - @param necessaryACAttributes The necessary AC attributes to set. - @throws ClassCastException if an element of - necessaryACAttributes is not a - String. -
    - - Returns the attribute certificates which are not allowed. -

    - The returned ISet is immutable and contains - Strings with the OIDs. -

    - - @return Returns the prohibited AC attributes. Is never null. -
    - - Sets the attribute certificates which are not allowed. -

    - The ISet must contain Strings with the - OIDs. -

    - The set is cloned. -

    - - @param prohibitedACAttributes The prohibited AC attributes to set. - @throws ClassCastException if an element of - prohibitedACAttributes is not a - String. -
    - - Returns the attribute certificate checker. The returned set contains - {@link PKIXAttrCertChecker}s and is immutable. - - @return Returns the attribute certificate checker. Is never - null. - - - Sets the attribute certificate checkers. -

    - All elements in the ISet must a {@link PKIXAttrCertChecker}. -

    -

    - The given set is cloned. -

    - - @param attrCertCheckers The attribute certificate checkers to set. Is - never null. - @throws ClassCastException if an element of attrCertCheckers - is not a PKIXAttrCertChecker. -
    - - - Summary description for PkixPolicyNode. - - - - Constructors - - - - This class helps to handle CRL revocation reasons mask. Each CRL handles a - certain set of revocation reasons. - - - - - Constructs are reason mask with the reasons. - - The reasons. - - - - A reason mask with no reason. - - - - - A mask with all revocation reasons. - - - - Adds all reasons from the reasons mask to this mask. - - @param mask The reasons mask to add. - - - - Returns true if this reasons mask contains all possible - reasons. - - true if this reasons mask contains all possible reasons. - - - - - Intersects this mask with the given reasons mask. - - mask The mask to intersect with. - The intersection of this and teh given mask. - - - - Returns true if the passed reasons mask has new reasons. - - The reasons mask which should be tested for new reasons. - true if the passed reasons mask has new reasons. - - - - Returns the reasons in this mask. - - - - If the complete CRL includes an issuing distribution point (IDP) CRL - extension check the following: -

    - (i) If the distribution point name is present in the IDP CRL extension - and the distribution field is present in the DP, then verify that one of - the names in the IDP matches one of the names in the DP. If the - distribution point name is present in the IDP CRL extension and the - distribution field is omitted from the DP, then verify that one of the - names in the IDP matches one of the names in the cRLIssuer field of the - DP. -

    -

    - (ii) If the onlyContainsUserCerts boolean is asserted in the IDP CRL - extension, verify that the certificate does not include the basic - constraints extension with the cA boolean asserted. -

    -

    - (iii) If the onlyContainsCACerts boolean is asserted in the IDP CRL - extension, verify that the certificate includes the basic constraints - extension with the cA boolean asserted. -

    -

    - (iv) Verify that the onlyContainsAttributeCerts boolean is not asserted. -

    - - @param dp The distribution point. - @param cert The certificate. - @param crl The CRL. - @throws AnnotatedException if one of the conditions is not met or an error occurs. -
    - - If the DP includes cRLIssuer, then verify that the issuer field in the - complete CRL matches cRLIssuer in the DP and that the complete CRL - contains an - g distribution point extension with the indirectCRL - boolean asserted. Otherwise, verify that the CRL issuer matches the - certificate issuer. - - @param dp The distribution point. - @param cert The certificate ot attribute certificate. - @param crl The CRL for cert. - @throws AnnotatedException if one of the above conditions does not apply or an error - occurs. - - - Obtain and validate the certification path for the complete CRL issuer. - If a key usage extension is present in the CRL issuer's certificate, - verify that the cRLSign bit is set. - - @param crl CRL which contains revocation information for the certificate - cert. - @param cert The attribute certificate or certificate to check if it is - revoked. - @param defaultCRLSignCert The issuer certificate of the certificate cert. - @param defaultCRLSignKey The public key of the issuer certificate - defaultCRLSignCert. - @param paramsPKIX paramsPKIX PKIX parameters. - @param certPathCerts The certificates on the certification path. - @return A Set with all keys of possible CRL issuer - certificates. - @throws AnnotatedException if the CRL is not valid or the status cannot be checked or - some error occurs. - - - Checks a distribution point for revocation information for the - certificate cert. - - @param dp The distribution point to consider. - @param paramsPKIX PKIX parameters. - @param cert Certificate to check if it is revoked. - @param validDate The date when the certificate revocation status should be - checked. - @param defaultCRLSignCert The issuer certificate of the certificate cert. - @param defaultCRLSignKey The public key of the issuer certificate - defaultCRLSignCert. - @param certStatus The current certificate revocation status. - @param reasonMask The reasons mask which is already checked. - @param certPathCerts The certificates of the certification path. - @throws AnnotatedException if the certificate is revoked or the status cannot be checked - or some error occurs. - - - Checks a certificate if it is revoked. - - @param paramsPKIX PKIX parameters. - @param cert Certificate to check if it is revoked. - @param validDate The date when the certificate revocation status should be - checked. - @param sign The issuer certificate of the certificate cert. - @param workingPublicKey The public key of the issuer certificate sign. - @param certPathCerts The certificates of the certification path. - @throws AnnotatedException if the certificate is revoked or the status cannot be checked - or some error occurs. - - - If use-deltas is set, verify the issuer and scope of the delta CRL. - - @param deltaCRL The delta CRL. - @param completeCRL The complete CRL. - @param pkixParams The PKIX paramaters. - @throws AnnotatedException if an exception occurs. - - - Checks if an attribute certificate is revoked. - - @param attrCert Attribute certificate to check if it is revoked. - @param paramsPKIX PKIX parameters. - @param issuerCert The issuer certificate of the attribute certificate - attrCert. - @param validDate The date when the certificate revocation status should - be checked. - @param certPathCerts The certificates of the certification path to be - checked. - - @throws CertPathValidatorException if the certificate is revoked or the - status cannot be checked or some error occurs. - - - Searches for a holder public key certificate and verifies its - certification path. - - @param attrCert the attribute certificate. - @param pkixParams The PKIX parameters. - @return The certificate path of the holder certificate. - @throws Exception if -
      -
    • no public key certificate can be found although holder - information is given by an entity name or a base certificate - ID
    • -
    • support classes cannot be created
    • -
    • no certification path for the public key certificate can - be built
    • -
    -
    - - - Checks a distribution point for revocation information for the - certificate attrCert. - - @param dp The distribution point to consider. - @param attrCert The attribute certificate which should be checked. - @param paramsPKIX PKIX parameters. - @param validDate The date when the certificate revocation status should - be checked. - @param issuerCert Certificate to check if it is revoked. - @param reasonMask The reasons mask which is already checked. - @param certPathCerts The certificates of the certification path to be - checked. - @throws Exception if the certificate is revoked or the status - cannot be checked or some error occurs. - - - - A trust anchor or most-trusted Certification Authority (CA). - - This class represents a "most-trusted CA", which is used as a trust anchor - for validating X.509 certification paths. A most-trusted CA includes the - public key of the CA, the CA's name, and any constraints upon the set of - paths which may be validated using this key. These parameters can be - specified in the form of a trusted X509Certificate or as individual - parameters. - - - - - Creates an instance of TrustAnchor with the specified X509Certificate and - optional name constraints, which are intended to be used as additional - constraints when validating an X.509 certification path. - The name constraints are specified as a byte array. This byte array - should contain the DER encoded form of the name constraints, as they - would appear in the NameConstraints structure defined in RFC 2459 and - X.509. The ASN.1 definition of this structure appears below. - -
    -            	NameConstraints ::= SEQUENCE {
    -            		permittedSubtrees       [0]     GeneralSubtrees OPTIONAL,
    -            		excludedSubtrees        [1]     GeneralSubtrees OPTIONAL }
    -            	   
    -             GeneralSubtrees ::= SEQUENCE SIZE (1..MAX) OF GeneralSubtree
    -             
    -            		GeneralSubtree ::= SEQUENCE {
    -            		base                    GeneralName,
    -            		minimum         [0]     BaseDistance DEFAULT 0,
    -            		maximum         [1]     BaseDistance OPTIONAL }
    -            		
    -            		BaseDistance ::= INTEGER (0..MAX)
    -            
    -            		GeneralName ::= CHOICE {
    -            		otherName                       [0]     OtherName,
    -            		rfc822Name                      [1]     IA5String,
    -            		dNSName                         [2]     IA5String,
    -            		x400Address                     [3]     ORAddress,
    -            		directoryName                   [4]     Name,
    -            		ediPartyName                    [5]     EDIPartyName,
    -            		uniformResourceIdentifier       [6]     IA5String,
    -            		iPAddress                       [7]     OCTET STRING,
    -            		registeredID                    [8]     OBJECT IDENTIFIER}
    -            	
    - - Note that the name constraints byte array supplied is cloned to protect - against subsequent modifications. -
    - a trusted X509Certificate - a byte array containing the ASN.1 DER encoding of a - NameConstraints extension to be used for checking name - constraints. Only the value of the extension is included, not - the OID or criticality flag. Specify null to omit the - parameter. - if the specified X509Certificate is null -
    - - - Creates an instance of TrustAnchor where the - most-trusted CA is specified as an X500Principal and public key. - - -

    - Name constraints are an optional parameter, and are intended to be used - as additional constraints when validating an X.509 certification path. -

    - The name constraints are specified as a byte array. This byte array - contains the DER encoded form of the name constraints, as they - would appear in the NameConstraints structure defined in RFC 2459 - and X.509. The ASN.1 notation for this structure is supplied in the - documentation for the other constructors. -

    - Note that the name constraints byte array supplied here is cloned to - protect against subsequent modifications. -

    -
    - the name of the most-trusted CA as X509Name - the public key of the most-trusted CA - - a byte array containing the ASN.1 DER encoding of a NameConstraints extension to - be used for checking name constraints. Only the value of the extension is included, - not the OID or criticality flag. Specify null to omit the parameter. - - - if caPrincipal or pubKey is null - -
    - - - Creates an instance of TrustAnchor where the most-trusted - CA is specified as a distinguished name and public key. Name constraints - are an optional parameter, and are intended to be used as additional - constraints when validating an X.509 certification path. -
    - The name constraints are specified as a byte array. This byte array - contains the DER encoded form of the name constraints, as they would - appear in the NameConstraints structure defined in RFC 2459 and X.509. -
    - the X.500 distinguished name of the most-trusted CA in RFC - 2253 string format - the public key of the most-trusted CA - a byte array containing the ASN.1 DER encoding of a - NameConstraints extension to be used for checking name - constraints. Only the value of the extension is included, not - the OID or criticality flag. Specify null to omit the - parameter. - throws NullPointerException, IllegalArgumentException -
    - - - Returns the most-trusted CA certificate. - - - - - Returns the name of the most-trusted CA as an X509Name. - - - - - Returns the name of the most-trusted CA in RFC 2253 string format. - - - - - Returns the public key of the most-trusted CA. - - - - - Decode the name constraints and clone them if not null. - - - - - Returns a formatted string describing the TrustAnchor. - - a formatted string describing the TrustAnchor - - - - crl checking - Return a Collection of all CRLs found in the X509Store's that are - matching the crlSelect criteriums. - - a {@link X509CRLStoreSelector} object that will be used - to select the CRLs - a List containing only {@link org.bouncycastle.x509.X509Store - X509Store} objects. These are used to search for CRLs - a Collection of all found {@link X509CRL X509CRL} objects. May be - empty but never null. - - - - Base class for an RFC 3161 Time Stamp Request. - - - Create a TimeStampRequest from the past in byte array. - - @param req byte array containing the request. - @throws IOException if the request is malformed. - - - Create a TimeStampRequest from the past in input stream. - - @param in input stream containing the request. - @throws IOException if the request is malformed. - - - Validate the timestamp request, checking the digest to see if it is of an - accepted type and whether it is of the correct length for the algorithm specified. - - @param algorithms a set of string OIDS giving accepted algorithms. - @param policies if non-null a set of policies we are willing to sign under. - @param extensions if non-null a set of extensions we are willing to accept. - @throws TspException if the request is invalid, or processing fails. - - - return the ASN.1 encoded representation of this object. - - - Generator for RFC 3161 Time Stamp Request objects. - - - add a given extension field for the standard extensions tag (tag 3) - @throws IOException - - - add a given extension field for the standard extensions tag - The value parameter becomes the contents of the octet string associated - with the extension. - - - add a given extension field for the standard extensions tag (tag 3) - @throws IOException - - - add a given extension field for the standard extensions tag - The value parameter becomes the contents of the octet string associated - with the extension. - - - Base class for an RFC 3161 Time Stamp Response object. - - - Create a TimeStampResponse from a byte array containing an ASN.1 encoding. - - @param resp the byte array containing the encoded response. - @throws TspException if the response is malformed. - @throws IOException if the byte array doesn't represent an ASN.1 encoding. - - - Create a TimeStampResponse from an input stream containing an ASN.1 encoding. - - @param input the input stream containing the encoded response. - @throws TspException if the response is malformed. - @throws IOException if the stream doesn't represent an ASN.1 encoding. - - - Check this response against to see if it a well formed response for - the passed in request. Validation will include checking the time stamp - token if the response status is GRANTED or GRANTED_WITH_MODS. - - @param request the request to be checked against - @throws TspException if the request can not match this response. - - - return the ASN.1 encoded representation of this object. - - - Generator for RFC 3161 Time Stamp Responses. - - - Return an appropriate TimeStampResponse. -

    - If genTime is null a timeNotAvailable error response will be returned. - - @param request the request this response is for. - @param serialNumber serial number for the response token. - @param genTime generation time for the response token. - @param provider provider to use for signature calculation. - @return - @throws NoSuchAlgorithmException - @throws NoSuchProviderException - @throws TSPException -

    -
    - - Generate a TimeStampResponse with chosen status and FailInfoField. - - @param status the PKIStatus to set. - @param failInfoField the FailInfoField to set. - @param statusString an optional string describing the failure. - @return a TimeStampResponse with a failInfoField and optional statusString - @throws TSPException in case the response could not be created - - - Validate the time stamp token. -

    - To be valid the token must be signed by the passed in certificate and - the certificate must be the one referred to by the SigningCertificate - attribute included in the hashed attributes of the token. The - certificate must also have the ExtendedKeyUsageExtension with only - KeyPurposeID.IdKPTimeStamping and have been valid at the time the - timestamp was created. -

    -

    - A successful call to validate means all the above are true. -

    -
    - - Return the underlying CmsSignedData object. - - @return the underlying CMS structure. - - - Return a ASN.1 encoded byte stream representing the encoded object. - - @throws IOException if encoding fails. - - - basic creation - only the default attributes will be included here. - - - create with a signer with extra signed/unsigned attributes. - - - @return the nonce value, null if there isn't one. - - - Recognised hash algorithms for the time stamp protocol. - - - Fetches the signature time-stamp attributes from a SignerInformation object. - Checks that the MessageImprint for each time-stamp matches the signature field. - (see RFC 3161 Appendix A). - - @param signerInfo a SignerInformation to search for time-stamps - @return a collection of TimeStampToken objects - @throws TSPValidationException - - - Validate the passed in certificate as being of the correct type to be used - for time stamping. To be valid it must have an ExtendedKeyUsage extension - which has a key purpose identifier of id-kp-timeStamping. - - @param cert the certificate of interest. - @throws TspValidationException if the certicate fails on one of the check points. - - - - Return the digest algorithm using one of the standard JCA string - representations rather than the algorithm identifier (if possible). - - - - Exception thrown if a TSP request or response fails to validate. -

    - If a failure code is associated with the exception it can be retrieved using - the getFailureCode() method.

    -
    - - Return the failure code associated with this exception - if one is set. - - @return the failure code if set, -1 otherwise. - - - General array utilities. - - - - Are two arrays equal. - - Left side. - Right side. - True if equal. - - - - A constant time equals comparison - does not terminate early if - test will fail. - - first array - second array - true if arrays equal, false otherwise. - - - BigInteger utilities. - - - Return the passed in value as an unsigned byte array. - - @param value value to be converted. - @return a byte array without a leading zero byte if present in the signed encoding. - - - Return the passed in value as an unsigned byte array of specified length, zero-extended as necessary. - - @param length desired length of result array. - @param n value to be converted. - @return a byte array of specified length, with leading zeroes as necessary given the size of n. - - - Return a random BigInteger not less than 'min' and not greater than 'max' - - @param min the least value that may be generated - @param max the greatest value that may be generated - @param random the source of randomness - @return a random BigInteger value in the range [min,max] - - - - Return the number of milliseconds since the Unix epoch (1 Jan., 1970 UTC) for a given DateTime value. - - A UTC DateTime value not before epoch. - Number of whole milliseconds after epoch. - 'dateTime' is before epoch. - - - - Create a DateTime value from the number of milliseconds since the Unix epoch (1 Jan., 1970 UTC). - - Number of milliseconds since the epoch. - A UTC DateTime value - - - - Return the current number of milliseconds since the Unix epoch (1 Jan., 1970 UTC). - - - - encode the input data producing a base 64 encoded byte array. - - @return a byte array containing the base 64 encoded data. - - - encode the input data producing a base 64 encoded byte array. - - @return a byte array containing the base 64 encoded data. - - - Encode the byte data to base 64 writing it to the given output stream. - - @return the number of bytes produced. - - - Encode the byte data to base 64 writing it to the given output stream. - - @return the number of bytes produced. - - - decode the base 64 encoded input data. It is assumed the input data is valid. - - @return a byte array representing the decoded data. - - - decode the base 64 encoded string data - whitespace will be ignored. - - @return a byte array representing the decoded data. - - - decode the base 64 encoded string data writing it to the given output stream, - whitespace characters will be ignored. - - @return the number of bytes produced. - - - encode the input data producing a base 64 output stream. - - @return the number of bytes produced. - - - decode the base 64 encoded byte data writing it to the given output stream, - whitespace characters will be ignored. - - @return the number of bytes produced. - - - decode the base 64 encoded string data writing it to the given output stream, - whitespace characters will be ignored. - - @return the number of bytes produced. - - - - A buffering class to allow translation from one format to another to - be done in discrete chunks. - - - - - Create a buffered Decoder. - - The translater to use. - The size of the buffer. - - - - Process one byte of data. - - Data in. - Byte array for the output. - The offset in the output byte array to start writing from. - The amount of output bytes. - - - - Process data from a byte array. - - The input data. - Start position within input data array. - Amount of data to process from input data array. - Array to store output. - Position in output array to start writing from. - The amount of output bytes. - - - - A class that allows encoding of data using a specific encoder to be processed in chunks. - - - - - Create. - - The translator to use. - Size of the chunks. - - - - Process one byte of data. - - The byte. - An array to store output in. - Offset within output array to start writing from. - - - - - Process data from a byte array. - - Input data Byte array containing data to be processed. - Start position within input data array. - Amount of input data to be processed. - Output data array. - Offset within output data array to start writing to. - The amount of data written. - - - - Class to decode and encode Hex. - - - - encode the input data producing a Hex encoded byte array. - - @return a byte array containing the Hex encoded data. - - - encode the input data producing a Hex encoded byte array. - - @return a byte array containing the Hex encoded data. - - - Hex encode the byte data writing it to the given output stream. - - @return the number of bytes produced. - - - Hex encode the byte data writing it to the given output stream. - - @return the number of bytes produced. - - - decode the Hex encoded input data. It is assumed the input data is valid. - - @return a byte array representing the decoded data. - - - decode the Hex encoded string data - whitespace will be ignored. - - @return a byte array representing the decoded data. - - - decode the Hex encoded string data writing it to the given output stream, - whitespace characters will be ignored. - - @return the number of bytes produced. - - - encode the input data producing a Hex output stream. - - @return the number of bytes produced. - - - decode the Hex encoded byte data writing it to the given output stream, - whitespace characters will be ignored. - - @return the number of bytes produced. - - - decode the Hex encoded string data writing it to the given output stream, - whitespace characters will be ignored. - - @return the number of bytes produced. - - - - A hex translator. - - - - - Return encoded block size. - - 2 - - - - Encode some data. - - Input data array. - Start position within input data array. - The amount of data to process. - The output data array. - The offset within the output data array to start writing from. - Amount of data encoded. - - - - Returns the decoded block size. - - 1 - - - - Decode data from a byte array. - - The input data array. - Start position within input data array. - The amounty of data to process. - The output data array. - The position within the output data array to start writing from. - The amount of data written. - - - Encode and decode byte arrays (typically from binary to 7-bit ASCII - encodings). - - - - Translator interface. - - - - Convert binary data to and from UrlBase64 encoding. This is identical to - Base64 encoding, except that the padding character is "." and the other - non-alphanumeric characters are "-" and "_" instead of "+" and "/". -

    - The purpose of UrlBase64 encoding is to provide a compact encoding of binary - data that is safe for use as an URL parameter. Base64 encoding does not - produce encoded values that are safe for use in URLs, since "/" can be - interpreted as a path delimiter; "+" is the encoded form of a space; and - "=" is used to separate a name from the corresponding value in an URL - parameter. -

    -
    - - Encode the input data producing a URL safe base 64 encoded byte array. - - @return a byte array containing the URL safe base 64 encoded data. - - - Encode the byte data writing it to the given output stream. - - @return the number of bytes produced. - - - Decode the URL safe base 64 encoded input data - white space will be ignored. - - @return a byte array representing the decoded data. - - - decode the URL safe base 64 encoded byte data writing it to the given output stream, - whitespace characters will be ignored. - - @return the number of bytes produced. - - - decode the URL safe base 64 encoded string data - whitespace will be ignored. - - @return a byte array representing the decoded data. - - - Decode the URL safe base 64 encoded string data writing it to the given output stream, - whitespace characters will be ignored. - - @return the number of bytes produced. - - - Convert binary data to and from UrlBase64 encoding. This is identical to - Base64 encoding, except that the padding character is "." and the other - non-alphanumeric characters are "-" and "_" instead of "+" and "/". -

    - The purpose of UrlBase64 encoding is to provide a compact encoding of binary - data that is safe for use as an URL parameter. Base64 encoding does not - produce encoded values that are safe for use in URLs, since "/" can be - interpreted as a path delimiter; "+" is the encoded form of a space; and - "=" is used to separate a name from the corresponding value in an URL - parameter. -

    -
    - - - Pipe all bytes from inStr to outStr, throwing StreamFlowException if greater - than limit bytes in inStr. - - - A - - - A - - - A - - The number of bytes actually transferred, if not greater than limit - - - - - A - - - - - - A - - - A - - - - - - A - - - - - A generic PEM writer, based on RFC 1421 - - - Base constructor. - - @param out output stream to use. - - - Return the number of bytes or characters required to contain the - passed in object if it is PEM encoded. - - @param obj pem object to be output - @return an estimate of the number of bytes - - - Validate the given IPv4 or IPv6 address. - - @param address the IP address as a string. - - @return true if a valid address, false otherwise - - - Validate the given IPv4 or IPv6 address and netmask. - - @param address the IP address as a string. - - @return true if a valid address with netmask, false otherwise - - - Validate the given IPv4 address. - - @param address the IP address as a string. - - @return true if a valid IPv4 address, false otherwise - - - Validate the given IPv6 address. - - @param address the IP address as a string. - - @return true if a valid IPv4 address, false otherwise - - - General string utilities. - - - - Summary description for DeflaterOutputStream. - - - - - Summary description for DeflaterOutputStream. - - - - Base class for both the compress and decompress classes. - Holds common arrays, and static data. - - @author
    Keiron Liddle - - - An input stream that decompresses from the BZip2 format (with the file - header chars) to be read as any other stream. - - @author Keiron Liddle - - NB: note this class has been modified to read the leading BZ from the - start of the BZIP2 stream to make it compatible with other PGP programs. - - - An output stream that compresses into the BZip2 format (with the file - header chars) into another stream. - - @author Keiron Liddle - - TODO: Update to BZip2 1.0.1 - NB: note this class has been modified to add a leading BZ to the - start of the BZIP2 stream to make it compatible with other PGP programs. - - - - modified by Oliver Merkel, 010128 - - - - A simple class the hold and calculate the CRC for sanity checking - of the data. - - @author Keiron Liddle - - - - The Holder object. -
    -            Holder ::= SEQUENCE {
    -            	baseCertificateID   [0] IssuerSerial OPTIONAL,
    -            		-- the issuer and serial number of
    -            		-- the holder's Public Key Certificate
    -            	entityName          [1] GeneralNames OPTIONAL,
    -            		-- the name of the claimant or role
    -            	objectDigestInfo    [2] ObjectDigestInfo OPTIONAL
    -            		-- used to directly authenticate the holder,
    -            		-- for example, an executable
    -            }
    -            
    -
    -
    - - Constructs a holder for v2 attribute certificates with a hash value for - some type of object. -

    - digestedObjectType can be one of the following: -

      -
    • 0 - publicKey - A hash of the public key of the holder must be - passed.
    • -
    • 1 - publicKeyCert - A hash of the public key certificate of the - holder must be passed.
    • -
    • 2 - otherObjectDigest - A hash of some other object type must be - passed. otherObjectTypeID must not be empty.
    • -
    -

    -

    This cannot be used if a v1 attribute certificate is used.

    - - @param digestedObjectType The digest object type. - @param digestAlgorithm The algorithm identifier for the hash. - @param otherObjectTypeID The object type ID if - digestedObjectType is - otherObjectDigest. - @param objectDigest The hash value. -
    - - Returns the digest object type if an object digest info is used. -

    -

      -
    • 0 - publicKey - A hash of the public key of the holder must be - passed.
    • -
    • 1 - publicKeyCert - A hash of the public key certificate of the - holder must be passed.
    • -
    • 2 - otherObjectDigest - A hash of some other object type must be - passed. otherObjectTypeID must not be empty.
    • -
    -

    - - @return The digest object type or -1 if no object digest info is set. -
    - - Returns the other object type ID if an object digest info is used. - - @return The other object type ID or null if no object - digest info is set. - - - Returns the hash if an object digest info is used. - - @return The hash or null if no object digest info is set. - - - Returns the digest algorithm ID if an object digest info is used. - - @return The digest algorithm ID or null if no object - digest info is set. - - - Return any principal objects inside the attribute certificate holder entity names field. - - @return an array of IPrincipal objects (usually X509Name), null if no entity names field is set. - - - Return the principals associated with the issuer attached to this holder - - @return an array of principals, null if no BaseCertificateID is set. - - - Return the serial number associated with the issuer attached to this holder. - - @return the certificate serial number, null if no BaseCertificateID is set. - - - Carrying class for an attribute certificate issuer. - - - Set the issuer directly with the ASN.1 structure. - - @param issuer The issuer - - - Return any principal objects inside the attribute certificate issuer object. - An array of IPrincipal objects (usually X509Principal). - - - A high level authority key identifier. - - - Constructor which will take the byte[] returned from getExtensionValue() - - @param encodedValue a DER octet encoded string with the extension structure in it. - @throws IOException on parsing errors. - - - Create an AuthorityKeyIdentifier using the passed in certificate's public - key, issuer and serial number. - - @param certificate the certificate providing the information. - @throws CertificateParsingException if there is a problem processing the certificate - - - Create an AuthorityKeyIdentifier using just the hash of the - public key. - - @param pubKey the key to generate the hash from. - @throws InvalidKeyException if there is a problem using the key. - - - A high level subject key identifier. - - - Constructor which will take the byte[] returned from getExtensionValue() - - @param encodedValue a DER octet encoded string with the extension structure in it. - @throws IOException on parsing errors. - - - Interface for an X.509 Attribute Certificate. - - - The version number for the certificate. - - - The serial number for the certificate. - - - The UTC DateTime before which the certificate is not valid. - - - The UTC DateTime after which the certificate is not valid. - - - The holder of the certificate. - - - The issuer details for the certificate. - - - Return the attributes contained in the attribute block in the certificate. - An array of attributes. - - - Return the attributes with the same type as the passed in oid. - The object identifier we wish to match. - An array of matched attributes, null if there is no match. - - - Return an ASN.1 encoded byte array representing the attribute certificate. - An ASN.1 encoded byte array. - If the certificate cannot be encoded. - - - - Get all critical extension values, by oid - - IDictionary with string (OID) keys and Asn1OctetString values - - - - Get all non-critical extension values, by oid - - IDictionary with string (OID) keys and Asn1OctetString values - - - - A utility class that will extract X509Principal objects from X.509 certificates. -

    - Use this in preference to trying to recreate a principal from a string, not all - DNs are what they should be, so it's best to leave them encoded where they - can be.

    -
    -
    - - Return the issuer of the given cert as an X509Principal. - - - Return the subject of the given cert as an X509Principal. - - - Return the issuer of the given CRL as an X509Principal. - - - This class is an Selector like implementation to select - attribute certificates from a given set of criteria. - - @see org.bouncycastle.x509.X509AttributeCertificate - @see org.bouncycastle.x509.X509Store - - - - Decides if the given attribute certificate should be selected. - - The attribute certificate to be checked. - true if the object matches this selector. - - - The attribute certificate which must be matched. - If null is given, any will do. - - - The criteria for validity - If null is given any will do. - - - The holder. - If null is given any will do. - - - The issuer. - If null is given any will do. - - - The serial number. - If null is given any will do. - - - Adds a target name criterion for the attribute certificate to the target - information extension criteria. The X509AttributeCertificate - must contain at least one of the specified target names. -

    - Each attribute certificate may contain a target information extension - limiting the servers where this attribute certificate can be used. If - this extension is not present, the attribute certificate is not targeted - and may be accepted by any server. -

    - - @param name The name as a GeneralName (not null) -
    - - Adds a target name criterion for the attribute certificate to the target - information extension criteria. The X509AttributeCertificate - must contain at least one of the specified target names. -

    - Each attribute certificate may contain a target information extension - limiting the servers where this attribute certificate can be used. If - this extension is not present, the attribute certificate is not targeted - and may be accepted by any server. -

    - - @param name a byte array containing the name in ASN.1 DER encoded form of a GeneralName - @throws IOException if a parsing error occurs. -
    - - Adds a collection with target names criteria. If null is - given any will do. -

    - The collection consists of either GeneralName objects or byte[] arrays representing - DER encoded GeneralName structures. -

    - - @param names A collection of target names. - @throws IOException if a parsing error occurs. - @see #AddTargetName(byte[]) - @see #AddTargetName(GeneralName) -
    - - Gets the target names. The collection consists of Lists - made up of an Integer in the first entry and a DER encoded - byte array or a String in the second entry. -

    The returned collection is immutable.

    - - @return The collection of target names - @see #setTargetNames(Collection) -
    - - Adds a target group criterion for the attribute certificate to the target - information extension criteria. The X509AttributeCertificate - must contain at least one of the specified target groups. -

    - Each attribute certificate may contain a target information extension - limiting the servers where this attribute certificate can be used. If - this extension is not present, the attribute certificate is not targeted - and may be accepted by any server. -

    - - @param group The group as GeneralName form (not null) -
    - - Adds a target group criterion for the attribute certificate to the target - information extension criteria. The X509AttributeCertificate - must contain at least one of the specified target groups. -

    - Each attribute certificate may contain a target information extension - limiting the servers where this attribute certificate can be used. If - this extension is not present, the attribute certificate is not targeted - and may be accepted by any server. -

    - - @param name a byte array containing the group in ASN.1 DER encoded form of a GeneralName - @throws IOException if a parsing error occurs. -
    - - Adds a collection with target groups criteria. If null is - given any will do. -

    - The collection consists of GeneralName objects or byte[] - representing DER encoded GeneralNames. -

    - - @param names A collection of target groups. - @throws IOException if a parsing error occurs. - @see #AddTargetGroup(byte[]) - @see #AddTargetGroup(GeneralName) -
    - - Gets the target groups. The collection consists of Lists - made up of an Integer in the first entry and a DER encoded - byte array or a String in the second entry. -

    The returned collection is immutable.

    - - @return The collection of target groups. - @see #setTargetGroups(Collection) -
    - - - This class is an IX509Selector implementation to select - certificate pairs, which are e.g. used for cross certificates. The set of - criteria is given from two X509CertStoreSelector objects, - each of which, if present, must match the respective component of a pair. - - - - The certificate pair which is used for testing on equality. - - - The certificate selector for the forward part. - - - The certificate selector for the reverse part. - - - - Decides if the given certificate pair should be selected. If - obj is not a X509CertificatePair, this method - returns false. - - The X509CertificatePair to be tested. - true if the object matches this selector. - - - - An ISet of DerObjectIdentifier objects. - - - - A simple collection backed store. - - - Basic constructor. - - @param collection - initial contents for the store, this is copied. - - - Return the matches in the collection for the passed in selector. - - @param selector the selector to match against. - @return a possibly empty collection of matching objects. - - - This class contains a collection for collection based X509Stores. - - - - Constructor. -

    - The collection is copied. -

    -
    - The collection containing X.509 object types. - If collection is null. -
    - - Returns a copy of the ICollection. - - - Returns a formatted string describing the parameters. - - - - An ICollection of X509Name objects - - - - The attribute certificate being checked. This is not a criterion. - Rather, it is optional information that may help a {@link X509Store} find - CRLs that would be relevant when checking revocation for the specified - attribute certificate. If null is specified, then no such - optional information is provided. - - @param attrCert the IX509AttributeCertificate being checked (or - null) - @see #getAttrCertificateChecking() - - - If true only complete CRLs are returned. Defaults to - false. - - @return true if only complete CRLs are returned. - - - Returns if this selector must match CRLs with the delta CRL indicator - extension set. Defaults to false. - - @return Returns true if only CRLs with the delta CRL - indicator extension are selected. - - - The issuing distribution point. -

    - The issuing distribution point extension is a CRL extension which - identifies the scope and the distribution point of a CRL. The scope - contains among others information about revocation reasons contained in - the CRL. Delta CRLs and complete CRLs must have matching issuing - distribution points.

    -

    - The byte array is cloned to protect against subsequent modifications.

    -

    - You must also enable or disable this criteria with - {@link #setIssuingDistributionPointEnabled(bool)}.

    - - @param issuingDistributionPoint The issuing distribution point to set. - This is the DER encoded OCTET STRING extension value. - @see #getIssuingDistributionPoint() -
    - - Whether the issuing distribution point criteria should be applied. - Defaults to false. -

    - You may also set the issuing distribution point criteria if not a missing - issuing distribution point should be assumed.

    - - @return Returns if the issuing distribution point check is enabled. -
    - - The maximum base CRL number. Defaults to null. - - @return Returns the maximum base CRL number. - @see #setMaxBaseCRLNumber(BigInteger) - - - - A factory to produce Public Key Info Objects. - - - - - Create a Subject Public Key Info object for a given public key. - - One of ElGammalPublicKeyParameters, DSAPublicKeyParameter, DHPublicKeyParameters, RsaKeyParameters or ECPublicKeyParameters - A subject public key info object. - Throw exception if object provided is not one of the above. - - - - Create loading data from byte array. - - - - - - Create loading data from byte array. - - - - - Generates a certificate object and initializes it with the data - read from the input stream inStream. - - - Returns a (possibly empty) collection view of the certificates - read from the given input stream inStream. - - - Class for carrying the values in an X.509 Attribute. - - - @param at an object representing an attribute. - - - Create an X.509 Attribute with the type given by the passed in oid and - the value represented by an ASN.1 Set containing value. - - @param oid type of the attribute - @param value value object to go into the atribute's value set. - - - Create an X.59 Attribute with the type given by the passed in oid and the - value represented by an ASN.1 Set containing the objects in value. - - @param oid type of the attribute - @param value vector of values to go in the attribute's value set. - - - - An Object representing an X509 Certificate. - Has static methods for loading Certificates encoded in many forms that return X509Certificate Objects. - - - - - Return true if the current time is within the start and end times nominated on the certificate. - - true id certificate is valid for the current time. - - - - Return true if the nominated time is within the start and end times nominated on the certificate. - - The time to test validity against. - True if certificate is valid for nominated time. - - - - Checks if the current date is within certificate's validity period. - - - - - Checks if the given date is within certificate's validity period. - - if the certificate is expired by given date - if the certificate is not yet valid on given date - - - - Return the certificate's version. - - An integer whose value Equals the version of the cerficate. - - - - Return a BigInteger containing the serial number. - - The Serial number. - - - - Get the Issuer Distinguished Name. (Who signed the certificate.) - - And X509Object containing name and value pairs. - - - - Get the subject of this certificate. - - An X509Name object containing name and value pairs. - - - - The time that this certificate is valid from. - - A DateTime object representing that time in the local time zone. - - - - The time that this certificate is valid up to. - - A DateTime object representing that time in the local time zone. - - - - Return the Der encoded TbsCertificate data. - This is the certificate component less the signature. - To Get the whole certificate call the GetEncoded() member. - - A byte array containing the Der encoded Certificate component. - - - - The signature. - - A byte array containg the signature of the certificate. - - - - A meaningful version of the Signature Algorithm. (EG SHA1WITHRSA) - - A sting representing the signature algorithm. - - - - Get the Signature Algorithms Object ID. - - A string containg a '.' separated object id. - - - - Get the signature algorithms parameters. (EG DSA Parameters) - - A byte array containing the Der encoded version of the parameters or null if there are none. - - - - Get the issuers UID. - - A DerBitString. - - - - Get the subjects UID. - - A DerBitString. - - - - Get a key usage guidlines. - - - - - Get the public key of the subject of the certificate. - - The public key parameters. - - - - Return a Der encoded version of this certificate. - - A byte array. - - - - Verify the certificate's signature using the nominated public key. - - An appropriate public key parameter object, RsaPublicKeyParameters, DsaPublicKeyParameters or ECDsaPublicKeyParameters - True if the signature is valid. - If key submitted is not of the above nominated types. - - - - This class contains a cross certificate pair. Cross certificates pairs may - contain two cross signed certificates from two CAs. A certificate from the - other CA to this CA is contained in the forward certificate, the certificate - from this CA to the other CA is contained in the reverse certificate. - - - - Constructor - Certificate from the other CA to this CA. - Certificate from this CA to the other CA. - - - Constructor from a ASN.1 CertificatePair structure. - The CertificatePair ASN.1 object. - - - Returns the certificate from the other CA to this CA. - - - Returns the certificate from this CA to the other CA. - - - class for dealing with X509 certificates. -

    - At the moment this will deal with "-----BEGIN CERTIFICATE-----" to "-----END CERTIFICATE-----" - base 64 encoded certs, as well as the BER binaries of certificates and some classes of PKCS#7 - objects.

    -
    - - - Create loading data from byte array. - - - - - - Create loading data from byte array. - - - - - Generates a certificate object and initializes it with the data - read from the input stream inStream. - - - Returns a (possibly empty) collection view of the certificates - read from the given input stream inStream. - - - - Create loading data from byte array. - - - - - - Create loading data from byte array. - - - - - The following extensions are listed in RFC 2459 as relevant to CRLs - - Authority Key Identifier - Issuer Alternative Name - CRL Number - Delta CRL Indicator (critical) - Issuing Distribution Point (critical) - - - Returns a string representation of this CRL. - - @return a string representation of this CRL. - - - Checks whether the given certificate is on this CRL. - - @param cert the certificate to check for. - @return true if the given certificate is on this CRL, - false otherwise. - - - The following extensions are listed in RFC 2459 as relevant to CRL Entries - - ReasonCode Hode Instruction Code Invalidity Date Certificate Issuer - (critical) - - - Constructor for CRLEntries of indirect CRLs. If isIndirect - is false {@link #getCertificateIssuer()} will always - return null, previousCertificateIssuer is - ignored. If this isIndirect is specified and this CrlEntry - has no certificate issuer CRL entry extension - previousCertificateIssuer is returned by - {@link #getCertificateIssuer()}. - - @param c - TbsCertificateList.CrlEntry object. - @param isIndirect - true if the corresponding CRL is a indirect - CRL. - @param previousCertificateIssuer - Certificate issuer of the previous CrlEntry. - - - - Create loading data from byte array. - - - - - - Create loading data from byte array. - - - - - Generates a certificate revocation list (CRL) object and initializes - it with the data read from the input stream inStream. - - - Returns a (possibly empty) collection view of the CRLs read from - the given input stream inStream. - - The inStream may contain a sequence of DER-encoded CRLs, or - a PKCS#7 CRL set. This is a PKCS#7 SignedData object, with the - only significant field being crls. In particular the signature - and the contents are ignored. - - - - Get non critical extensions. - - A set of non critical extension oids. - - - - Get any critical extensions. - - A sorted list of critical entension. - - - - Get the value of a given extension. - - The object ID of the extension. - An Asn1OctetString object if that extension is found or null if not. - - - A holding class for constructing an X509 Key Usage extension. - -
    -                id-ce-keyUsage OBJECT IDENTIFIER ::=  { id-ce 15 }
    -            
    -                KeyUsage ::= BIT STRING {
    -                     digitalSignature        (0),
    -                     nonRepudiation          (1),
    -                     keyEncipherment         (2),
    -                     dataEncipherment        (3),
    -                     keyAgreement            (4),
    -                     keyCertSign             (5),
    -                     cRLSign                 (6),
    -                     encipherOnly            (7),
    -                     decipherOnly            (8) }
    -             
    -
    - - Basic constructor. - - @param usage - the bitwise OR of the Key Usage flags giving the - allowed uses for the key. - e.g. (X509KeyUsage.keyEncipherment | X509KeyUsage.dataEncipherment) - - - Return the digest algorithm using one of the standard JCA string - representations rather than the algorithm identifier (if possible). - - - - Class to Generate X509V1 Certificates. - - - - - Default Constructor. - - - - - Reset the generator. - - - - - Set the certificate's serial number. - - Make serial numbers long, if you have no serial number policy make sure the number is at least 16 bytes of secure random data. - You will be surprised how ugly a serial number collision can get. - The serial number. - - - - Set the issuer distinguished name. - The issuer is the entity whose private key is used to sign the certificate. - - The issuers DN. - - - - Set the date that this certificate is to be valid from. - - - - - - Set the date after which this certificate will no longer be valid. - - - - - - Set the subject distinguished name. - The subject describes the entity associated with the public key. - - - - - - Set the public key that this certificate identifies. - - - - - - Set the signature algorithm that will be used to sign this certificate. - This can be either a name or an OID, names are treated as case insensitive. - - string representation of the algorithm name - - - - Generate a new X509Certificate. - - The private key of the issuer used to sign this certificate. - An X509Certificate. - - - - Generate a new X509Certificate specifying a SecureRandom instance that you would like to use. - - The private key of the issuer used to sign this certificate. - The Secure Random you want to use. - An X509Certificate. - - - - Allows enumeration of the signature names supported by the generator. - - - - An implementation of a version 2 X.509 Attribute Certificate. - - - Class to produce an X.509 Version 2 AttributeCertificate. - - - Reset the generator - - - Set the Holder of this Attribute Certificate. - - - Set the issuer. - - - Set the serial number for the certificate. - - - - Set the signature algorithm. This can be either a name or an OID, names - are treated as case insensitive. - - The algorithm name. - - - Add an attribute. - - - Add a given extension field for the standard extensions tag. - - - - Add a given extension field for the standard extensions tag. - The value parameter becomes the contents of the octet string associated - with the extension. - - - - - Generate an X509 certificate, based on the current issuer and subject. - - - - - Generate an X509 certificate, based on the current issuer and subject, - using the supplied source of randomness, if required. - - - - - Allows enumeration of the signature names supported by the generator. - - - - class to produce an X.509 Version 2 CRL. - - - reset the generator - - - Set the issuer distinguished name - the issuer is the entity whose private key is used to sign the - certificate. - - - Reason being as indicated by CrlReason, i.e. CrlReason.KeyCompromise - or 0 if CrlReason is not to be used - - - - Add a CRL entry with an Invalidity Date extension as well as a CrlReason extension. - Reason being as indicated by CrlReason, i.e. CrlReason.KeyCompromise - or 0 if CrlReason is not to be used - - - - Add a CRL entry with extensions. - - - - Add the CRLEntry objects contained in a previous CRL. - - @param other the X509Crl to source the other entries from. - - - Set the signature algorithm. This can be either a name or an oid, names - are treated as case insensitive. - - @param signatureAlgorithm string representation of the algorithm name. - - - add a given extension field for the standard extensions tag (tag 0) - - - add a given extension field for the standard extensions tag (tag 0) - - - add a given extension field for the standard extensions tag (tag 0) - - - add a given extension field for the standard extensions tag (tag 0) - - - Generate an X509 CRL, based on the current issuer and subject. - The key used for signing. - - - Generate an X509 CRL, based on the current issuer and subject. - The key used for signing. - A user-defined source of randomness. - - - - Allows enumeration of the signature names supported by the generator. - - - - - A class to Generate Version 3 X509Certificates. - - - - - Reset the Generator. - - - - - Set the certificate's serial number. - - Make serial numbers long, if you have no serial number policy make sure the number is at least 16 bytes of secure random data. - You will be surprised how ugly a serial number collision can Get. - The serial number. - - - - Set the distinguished name of the issuer. - The issuer is the entity which is signing the certificate. - - The issuer's DN. - - - - Set the date that this certificate is to be valid from. - - - - - - Set the date after which this certificate will no longer be valid. - - - - - - Set the DN of the entity that this certificate is about. - - - - - - Set the public key that this certificate identifies. - - - - - - Set the signature algorithm that will be used to sign this certificate. - - - - - - Set the subject unique ID - note: it is very rare that it is correct to do this. - - - - - - Set the issuer unique ID - note: it is very rare that it is correct to do this. - - - - - - Add a given extension field for the standard extensions tag (tag 3). - - string containing a dotted decimal Object Identifier. - Is it critical. - The value. - - - - Add an extension to this certificate. - - Its Object Identifier. - Is it critical. - The value. - - - - Add an extension using a string with a dotted decimal OID. - - string containing a dotted decimal Object Identifier. - Is it critical. - byte[] containing the value of this extension. - - - - Add an extension to this certificate. - - Its Object Identifier. - Is it critical. - byte[] containing the value of this extension. - - - - Add a given extension field for the standard extensions tag (tag 3), - copying the extension value from another certificate. - - - - add a given extension field for the standard extensions tag (tag 3) - copying the extension value from another certificate. - @throws CertificateParsingException if the extension cannot be extracted. - - - - Generate an X509Certificate. - - The private key of the issuer that is signing this certificate. - An X509Certificate. - - - - Generate an X509Certificate using your own SecureRandom. - - The private key of the issuer that is signing this certificate. - You Secure Random instance. - An X509Certificate. - - - - Allows enumeration of the signature names supported by the generator. - - - - - Add - args: ByVal key As IComparable, ByVal data As Object - key is object that implements IComparable interface - performance tip: change to use use int type (such as the hashcode) - - - - - RestoreAfterInsert - Additions to red-black trees usually destroy the red-black - properties. Examine the tree and restore. Rotations are normally - required to restore it - - - - - RotateLeft - Rebalance the tree by rotating the nodes to the left - - - - - RotateRight - Rebalance the tree by rotating the nodes to the right - - - - - - - - - - - - - - - - - RestoreAfterDelete - Deletions from red-black trees may destroy the red-black - properties. Examine the tree and restore. Rotations are normally - required to restore it - - - - - - - - Key - - - - - Data - - - - - Determine order, walk the tree and push the nodes onto the stack - - - - - HasMoreElements - - - - - NextElement - - - - - MoveNext - For .NET compatibility - - - - - Key - - - - - Data - - - - - Color - - - - - Left - - - - - Right - - - - - Provides the base class for a generic read-only dictionary. - - - The type of keys in the dictionary. - - - The type of values in the dictionary. - - - - An instance of the ReadOnlyDictionary generic class is - always read-only. A dictionary that is read-only is simply a - dictionary with a wrapper that prevents modifying the - dictionary; therefore, if changes are made to the underlying - dictionary, the read-only dictionary reflects those changes. - See for a modifiable version of - this class. - - - Notes to Implementers This base class is provided to - make it easier for implementers to create a generic read-only - custom dictionary. Implementers are encouraged to extend this - base class instead of creating their own. - - - - - - Initializes a new instance of the - class that wraps - the supplied . - - The - that will be wrapped. - - Thrown when the dictionary is null. - - - - - Gets the number of key/value pairs contained in the - . - - The number of key/value pairs. - The number of key/value pairs contained in the - . - - - Gets a collection containing the keys in the - . - A - containing the keys. - A - - containing the keys in the - . - - - - - Gets a collection containing the values of the - . - - The collection of values. - - - Gets a value indicating whether the dictionary is read-only. - This value will always be true. - - - - Gets a value indicating whether access to the dictionary - is synchronized (thread safe). - - - - - Gets an object that can be used to synchronize access to dictionary. - - - - - Gets or sets the value associated with the specified key. - - - The value associated with the specified key. If the specified key - is not found, a get operation throws a - , - and a set operation creates a new element with the specified key. - - The key of the value to get or set. - - Thrown when the key is null. - - - The property is retrieved and key does not exist in the collection. - - - - This method is not supported by the - . - - The object to use as the key of the element to add. - - The object to use as the value of the element to add. - - - Determines whether the - contains the specified key. - - True if the contains - an element with the specified key; otherwise, false. - - The key to locate in the - . - - Thrown when the key is null. - - - - - This method is not supported by the . - - The key of the element to remove. - - True if the element is successfully removed; otherwise, false. - - - - - Gets the value associated with the specified key. - - The key of the value to get. - When this method returns, contains the value - associated with the specified key, if the key is found; - otherwise, the default value for the type of the value parameter. - This parameter is passed uninitialized. - - true if the contains - an element with the specified key; otherwise, false. - - - - This method is not supported by the - . - - The object to add to the . - - - - This method is not supported by the - . - - - - Determines whether the contains a - specific value. - - - The object to locate in the . - - - true if item is found in the ICollection; - otherwise, false. - - - - - Copies the elements of the ICollection to an Array, starting at a - particular Array index. - - The one-dimensional Array that is the - destination of the elements copied from ICollection. - The Array must have zero-based indexing. - - - The zero-based index in array at which copying begins. - - - - This method is not supported by the - . - - The object to remove from the ICollection. - - Will never return a value. - - - - Returns an enumerator that iterates through the collection. - - - A IEnumerator that can be used to iterate through the collection. - - - - - Returns an enumerator that iterates through a collection. - - - An IEnumerator that can be used to iterate through the collection. - - - - - For a description of this member, see . - - - The one-dimensional Array that is the destination of the elements copied from - ICollection. The Array must have zero-based indexing. - - - The zero-based index in Array at which copying begins. - - - - - Summary description for ListIterator. - - - - - Summary description for Properties. - - - - - Summary description for Util. - - - - - Summary description for DeflaterOutputStream. - - - - - Summary description for DeflaterOutputStream. - - -
    -
    diff --git a/pdfpatcher/App/Lib/itextsharp.dll b/pdfpatcher/App/Lib/itextsharp.dll deleted file mode 100644 index e0545a75165c05472f166229f03d2d34a5ebb596..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Lib/itextsharp.dll and /dev/null differ diff --git a/pdfpatcher/App/MainForm.Designer.cs b/pdfpatcher/App/MainForm.Designer.cs deleted file mode 100644 index 0ef8886d292861a503f631aa019309689026d0e4..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/MainForm.Designer.cs +++ /dev/null @@ -1,760 +0,0 @@ -namespace PDFPatcher -{ - partial class MainForm - { - /// - /// 必需的设计器变量。 - /// - private System.ComponentModel.IContainer components = null; - - /// - /// 清理所有正在使用的资源。 - /// - /// 如果应释放托管资源,为 true;否则为 false。 - protected override void Dispose (bool disposing) { - if (disposing && (components != null)) { - components.Dispose (); - } - base.Dispose (disposing); - } - - #region Windows 窗体设计器生成的代码 - - /// - /// 设计器支持所需的方法 - 不要 - /// 使用代码编辑器修改此方法的内容。 - /// - private void InitializeComponent () { - this.components = new System.ComponentModel.Container(); - System.Windows.Forms.ToolStripMenuItem _Select; - System.Windows.Forms.ToolStripMenuItem _Copy; - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); - System.Windows.Forms.ToolStripMenuItem _Delete; - System.Windows.Forms.ToolStripSeparator toolStripSeparator3; - System.Windows.Forms.ToolStripMenuItem _SelectAllPdfFiles; - System.Windows.Forms.ToolStripMenuItem _SelectAllImages; - System.Windows.Forms.ToolStripMenuItem _SelectAllFolders; - System.Windows.Forms.ToolStripSeparator _ItemTypeSeparator; - System.Windows.Forms.ToolStripMenuItem _SelectAll; - System.Windows.Forms.ToolStripMenuItem _InvertSelect; - System.Windows.Forms.ToolStripMenuItem _SelectNone; - System.Windows.Forms.ToolStripMenuItem _ToolBox; - System.Windows.Forms.ToolStripMenuItem toolStripMenuItem23; - System.Windows.Forms.ToolStripMenuItem _Patcher; - System.Windows.Forms.ToolStripMenuItem _Merger; - System.Windows.Forms.ToolStripMenuItem _Rename; - System.Windows.Forms.ToolStripMenuItem _OcrImages; - System.Windows.Forms.ToolStripMenuItem _GenerateBookmark; - System.Windows.Forms.ToolStripMenuItem _InfoExchanger; - System.Windows.Forms.ToolStripMenuItem _Imaging; - System.Windows.Forms.ToolStripMenuItem _Extract; - System.Windows.Forms.ToolStripMenuItem _ExtractImages; - System.Windows.Forms.ToolStripMenuItem _RenderPages; - System.Windows.Forms.ToolStripMenuItem _Explorer; - System.Windows.Forms.ToolStripMenuItem _ExportInfoFile; - System.Windows.Forms.ToolStripSeparator toolStripSeparator5; - System.Windows.Forms.ToolStripMenuItem _ShowGeneralToolbar; - System.Windows.Forms.ToolStripMenuItem _CustomizeToolbarCommand; - System.Windows.Forms.ToolStripMenuItem _LogWindow; - System.Windows.Forms.ToolStripMenuItem _Help; - System.Windows.Forms.ToolStripMenuItem _CreateShortcut; - System.Windows.Forms.ToolStripMenuItem _CheckUpdate; - System.Windows.Forms.ToolStripMenuItem _VisitHomePage; - System.Windows.Forms.ToolStripMenuItem _About; - System.Windows.Forms.ToolStripMenuItem _Open; - System.Windows.Forms.ToolStripMenuItem dummyToolStripMenuItem; - System.Windows.Forms.ToolStripMenuItem _ImportBookmark; - System.Windows.Forms.ToolStripSeparator toolStripSeparator2; - System.Windows.Forms.ToolStripMenuItem _Action; - System.Windows.Forms.ToolStripMenuItem _SaveBookmark; - System.Windows.Forms.ToolStripMenuItem _SaveAsInfoFile; - System.Windows.Forms.ToolStripSeparator _configSeparator; - System.Windows.Forms.ToolStripMenuItem _AppOptions; - System.Windows.Forms.ToolStripMenuItem _RestoreOptions; - System.Windows.Forms.ToolStripMenuItem _SaveOptions; - System.Windows.Forms.ToolStripSeparator toolStripSeparator11; - System.Windows.Forms.ToolStripMenuItem _Exit; - System.Windows.Forms.ToolStripMenuItem _Close; - System.Windows.Forms.ToolStripSeparator toolStripSeparator1; - System.Windows.Forms.ToolStripMenuItem _Options; - System.Windows.Forms.ToolStripButton _CustomizeToolbar; - System.Windows.Forms.ToolStripMenuItem _Properties; - this.toolStripSeparator14 = new System.Windows.Forms.ToolStripSeparator(); - this._ToolTip = new System.Windows.Forms.ToolTip(this.components); - this._SaveConfigDialog = new System.Windows.Forms.SaveFileDialog(); - this._OpenConfigDialog = new System.Windows.Forms.OpenFileDialog(); - this._MainMenu = new System.Windows.Forms.MenuStrip(); - this._File = new System.Windows.Forms.ToolStripMenuItem(); - this._RecentFiles = new System.Windows.Forms.ToolStripMenuItem(); - this._ResetOptions = new System.Windows.Forms.ToolStripMenuItem(); - this._OpenPdfDialog = new System.Windows.Forms.OpenFileDialog(); - this.statusStrip1 = new System.Windows.Forms.StatusStrip(); - this._MainStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); - this._GeneralToolbar = new System.Windows.Forms.ToolStrip(); - this._FunctionContainer = new System.Windows.Forms.CustomTabControl(); - _Select = new System.Windows.Forms.ToolStripMenuItem(); - _Copy = new System.Windows.Forms.ToolStripMenuItem(); - _Delete = new System.Windows.Forms.ToolStripMenuItem(); - toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); - _SelectAllPdfFiles = new System.Windows.Forms.ToolStripMenuItem(); - _SelectAllImages = new System.Windows.Forms.ToolStripMenuItem(); - _SelectAllFolders = new System.Windows.Forms.ToolStripMenuItem(); - _ItemTypeSeparator = new System.Windows.Forms.ToolStripSeparator(); - _SelectAll = new System.Windows.Forms.ToolStripMenuItem(); - _InvertSelect = new System.Windows.Forms.ToolStripMenuItem(); - _SelectNone = new System.Windows.Forms.ToolStripMenuItem(); - _ToolBox = new System.Windows.Forms.ToolStripMenuItem(); - toolStripMenuItem23 = new System.Windows.Forms.ToolStripMenuItem(); - _Patcher = new System.Windows.Forms.ToolStripMenuItem(); - _Merger = new System.Windows.Forms.ToolStripMenuItem(); - _Rename = new System.Windows.Forms.ToolStripMenuItem(); - _OcrImages = new System.Windows.Forms.ToolStripMenuItem(); - _GenerateBookmark = new System.Windows.Forms.ToolStripMenuItem(); - _InfoExchanger = new System.Windows.Forms.ToolStripMenuItem(); - _Imaging = new System.Windows.Forms.ToolStripMenuItem(); - _Extract = new System.Windows.Forms.ToolStripMenuItem(); - _ExtractImages = new System.Windows.Forms.ToolStripMenuItem(); - _RenderPages = new System.Windows.Forms.ToolStripMenuItem(); - _Explorer = new System.Windows.Forms.ToolStripMenuItem(); - _ExportInfoFile = new System.Windows.Forms.ToolStripMenuItem(); - toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); - _ShowGeneralToolbar = new System.Windows.Forms.ToolStripMenuItem(); - _CustomizeToolbarCommand = new System.Windows.Forms.ToolStripMenuItem(); - _LogWindow = new System.Windows.Forms.ToolStripMenuItem(); - _Help = new System.Windows.Forms.ToolStripMenuItem(); - _CreateShortcut = new System.Windows.Forms.ToolStripMenuItem(); - _CheckUpdate = new System.Windows.Forms.ToolStripMenuItem(); - _VisitHomePage = new System.Windows.Forms.ToolStripMenuItem(); - _About = new System.Windows.Forms.ToolStripMenuItem(); - _Open = new System.Windows.Forms.ToolStripMenuItem(); - dummyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - _ImportBookmark = new System.Windows.Forms.ToolStripMenuItem(); - toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - _Action = new System.Windows.Forms.ToolStripMenuItem(); - _SaveBookmark = new System.Windows.Forms.ToolStripMenuItem(); - _SaveAsInfoFile = new System.Windows.Forms.ToolStripMenuItem(); - _configSeparator = new System.Windows.Forms.ToolStripSeparator(); - _AppOptions = new System.Windows.Forms.ToolStripMenuItem(); - _RestoreOptions = new System.Windows.Forms.ToolStripMenuItem(); - _SaveOptions = new System.Windows.Forms.ToolStripMenuItem(); - toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator(); - _Exit = new System.Windows.Forms.ToolStripMenuItem(); - _Close = new System.Windows.Forms.ToolStripMenuItem(); - toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - _Options = new System.Windows.Forms.ToolStripMenuItem(); - _CustomizeToolbar = new System.Windows.Forms.ToolStripButton(); - _Properties = new System.Windows.Forms.ToolStripMenuItem(); - this._MainMenu.SuspendLayout(); - this.statusStrip1.SuspendLayout(); - this._GeneralToolbar.SuspendLayout(); - this.SuspendLayout(); - // - // _Select - // - _Select.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - _Select.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - _Copy, - _Delete, - toolStripSeparator3, - _SelectAllPdfFiles, - _SelectAllImages, - _SelectAllFolders, - _ItemTypeSeparator, - _SelectAll, - _InvertSelect, - _SelectNone}); - _Select.Image = ((System.Drawing.Image)(resources.GetObject("_Select.Image"))); - _Select.ImageTransparentColor = System.Drawing.Color.Magenta; - _Select.Name = "_Select"; - _Select.Size = new System.Drawing.Size(59, 24); - _Select.Text = "选择(&Z)"; - _Select.DropDownOpening += new System.EventHandler(this.MenuOpening); - _Select.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.MenuCommand); - // - // _Copy - // - _Copy.Image = ((System.Drawing.Image)(resources.GetObject("_Copy.Image"))); - _Copy.Name = "_Copy"; - _Copy.ShortcutKeyDisplayString = "Ctrl+C"; - _Copy.Size = new System.Drawing.Size(181, 22); - _Copy.Text = "复制选中项"; - // - // _Delete - // - _Delete.Image = ((System.Drawing.Image)(resources.GetObject("_Delete.Image"))); - _Delete.ImageTransparentColor = System.Drawing.Color.Magenta; - _Delete.Name = "_Delete"; - _Delete.ShortcutKeyDisplayString = "Delete"; - _Delete.Size = new System.Drawing.Size(185, 26); - _Delete.Text = "删除选中项"; - // - // toolStripSeparator3 - // - toolStripSeparator3.Name = "toolStripSeparator3"; - toolStripSeparator3.Size = new System.Drawing.Size(182, 6); - // - // _SelectAllPdfFiles - // - _SelectAllPdfFiles.Image = ((System.Drawing.Image)(resources.GetObject("_SelectAllPdfFiles.Image"))); - _SelectAllPdfFiles.Name = "_SelectAllPdfFiles"; - _SelectAllPdfFiles.Size = new System.Drawing.Size(185, 26); - _SelectAllPdfFiles.Text = "选中所有 PDF 文件"; - // - // _SelectAllImages - // - _SelectAllImages.Image = ((System.Drawing.Image)(resources.GetObject("_SelectAllImages.Image"))); - _SelectAllImages.Name = "_SelectAllImages"; - _SelectAllImages.Size = new System.Drawing.Size(185, 26); - _SelectAllImages.Text = "选中所有图片"; - // - // _SelectAllFolders - // - _SelectAllFolders.Image = ((System.Drawing.Image)(resources.GetObject("_SelectAllFolders.Image"))); - _SelectAllFolders.Name = "_SelectAllFolders"; - _SelectAllFolders.Size = new System.Drawing.Size(185, 26); - _SelectAllFolders.Text = "选中所有文件夹"; - // - // _ItemTypeSeparator - // - _ItemTypeSeparator.Name = "_ItemTypeSeparator"; - _ItemTypeSeparator.Size = new System.Drawing.Size(182, 6); - // - // _SelectAll - // - _SelectAll.Image = ((System.Drawing.Image)(resources.GetObject("_SelectAll.Image"))); - _SelectAll.Name = "_SelectAll"; - _SelectAll.ShortcutKeyDisplayString = "Ctrl+A"; - _SelectAll.Size = new System.Drawing.Size(185, 26); - _SelectAll.Text = "全部选中"; - // - // _InvertSelect - // - _InvertSelect.Name = "_InvertSelect"; - _InvertSelect.Size = new System.Drawing.Size(185, 26); - _InvertSelect.Text = "反转选择"; - // - // _SelectNone - // - _SelectNone.Name = "_SelectNone"; - _SelectNone.Size = new System.Drawing.Size(185, 26); - _SelectNone.Text = "取消选择"; - // - // _ToolBox - // - _ToolBox.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - _ToolBox.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - toolStripMenuItem23, - _Imaging, - _Explorer, - _ExportInfoFile, - toolStripSeparator5, - _ShowGeneralToolbar, - _CustomizeToolbarCommand, - _LogWindow}); - _ToolBox.Image = ((System.Drawing.Image)(resources.GetObject("_ToolBox.Image"))); - _ToolBox.ImageTransparentColor = System.Drawing.Color.Magenta; - _ToolBox.Name = "_ToolBox"; - _ToolBox.Size = new System.Drawing.Size(73, 24); - _ToolBox.Text = "工具箱(&G)"; - _ToolBox.DropDownOpening += new System.EventHandler(this.MenuOpening); - _ToolBox.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.MenuCommand); - // - // toolStripMenuItem23 - // - toolStripMenuItem23.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - _Patcher, - _Merger, - _Rename, - _OcrImages, - _GenerateBookmark, - _InfoExchanger}); - toolStripMenuItem23.Name = "toolStripMenuItem23"; - toolStripMenuItem23.Size = new System.Drawing.Size(202, 26); - toolStripMenuItem23.Text = "处理PDF文件(&C)"; - toolStripMenuItem23.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.MenuCommand); - // - // _Patcher - // - _Patcher.Image = ((System.Drawing.Image)(resources.GetObject("_Patcher.Image"))); - _Patcher.Name = "_Patcher"; - _Patcher.Size = new System.Drawing.Size(233, 22); - _Patcher.Tag = "Patcher"; - _Patcher.Text = "批量修改 &PDF 文件..."; - // - // _Merger - // - _Merger.Image = ((System.Drawing.Image)(resources.GetObject("_Merger.Image"))); - _Merger.Name = "_Merger"; - _Merger.Size = new System.Drawing.Size(233, 22); - _Merger.Tag = "Merger"; - _Merger.Text = "合并 P&DF 和图片文件..."; - // - // _Rename - // - _Rename.Image = ((System.Drawing.Image)(resources.GetObject("_Rename.Image"))); - _Rename.Name = "_Rename"; - _Rename.Size = new System.Drawing.Size(233, 22); - _Rename.Tag = "Rename"; - _Rename.Text = "批量重命名 PD&F 文件..."; - _Rename.ToolTipText = "根据 PDF 文档的属性重命名 PDF 文件"; - // - // _OcrImages - // - _OcrImages.Image = ((System.Drawing.Image)(resources.GetObject("_OcrImages.Image"))); - _OcrImages.Name = "_OcrImages"; - _OcrImages.Size = new System.Drawing.Size(233, 22); - _OcrImages.Tag = "Ocr"; - _OcrImages.Text = "识别图像文本(&S)..."; - // - // _GenerateBookmark - // - _GenerateBookmark.Image = global::PDFPatcher.Properties.Resources.AutoBookmark; - _GenerateBookmark.Name = "_GenerateBookmark"; - _GenerateBookmark.Size = new System.Drawing.Size(233, 22); - _GenerateBookmark.Tag = "BookmarkGenerator"; - _GenerateBookmark.Text = "自动生成书签(&Z)..."; - // - // _InfoExchanger - // - _InfoExchanger.Image = ((System.Drawing.Image)(resources.GetObject("_InfoExchanger.Image"))); - _InfoExchanger.Name = "_InfoExchanger"; - _InfoExchanger.Size = new System.Drawing.Size(233, 22); - _InfoExchanger.Tag = "InfoExchanger"; - _InfoExchanger.Text = "批量导出或导入信息文件(&X)..."; - _InfoExchanger.Visible = false; - // - // _Imaging - // - _Imaging.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - _Extract, - _ExtractImages, - _RenderPages}); - _Imaging.Name = "_Imaging"; - _Imaging.Size = new System.Drawing.Size(202, 26); - _Imaging.Text = "提取文档内容(&T)"; - _Imaging.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.MenuCommand); - // - // _Extract - // - _Extract.Image = ((System.Drawing.Image)(resources.GetObject("_Extract.Image"))); - _Extract.Name = "_Extract"; - _Extract.Size = new System.Drawing.Size(208, 22); - _Extract.Tag = "ExtractPages"; - _Extract.Text = "提取页面或拆分文档(&Y)..."; - // - // _ExtractImages - // - _ExtractImages.Image = ((System.Drawing.Image)(resources.GetObject("_ExtractImages.Image"))); - _ExtractImages.Name = "_ExtractImages"; - _ExtractImages.Size = new System.Drawing.Size(208, 22); - _ExtractImages.Tag = "ExtractImages"; - _ExtractImages.Text = "提取图片(&T)..."; - // - // _RenderPages - // - _RenderPages.Image = global::PDFPatcher.Properties.Resources.RenderDocument; - _RenderPages.Name = "_RenderPages"; - _RenderPages.Size = new System.Drawing.Size(208, 22); - _RenderPages.Tag = "RenderPages"; - _RenderPages.Text = "转换页面为图片(&Z)..."; - // - // _Explorer - // - _Explorer.Image = ((System.Drawing.Image)(resources.GetObject("_Explorer.Image"))); - _Explorer.Name = "_Explorer"; - _Explorer.Size = new System.Drawing.Size(202, 26); - _Explorer.Tag = "Inspector"; - _Explorer.Text = "文档结构探查器(&W)..."; - // - // _ExportInfoFile - // - _ExportInfoFile.Image = ((System.Drawing.Image)(resources.GetObject("_ExportInfoFile.Image"))); - _ExportInfoFile.Name = "_ExportInfoFile"; - _ExportInfoFile.Size = new System.Drawing.Size(202, 26); - _ExportInfoFile.Tag = "InfoExchanger"; - _ExportInfoFile.Text = "导出导入信息文件(&D)..."; - // - // toolStripSeparator5 - // - toolStripSeparator5.Name = "toolStripSeparator5"; - toolStripSeparator5.Size = new System.Drawing.Size(199, 6); - // - // _ShowGeneralToolbar - // - _ShowGeneralToolbar.Name = "_ShowGeneralToolbar"; - _ShowGeneralToolbar.Size = new System.Drawing.Size(202, 26); - _ShowGeneralToolbar.Text = "显示常用工具栏(&G)"; - // - // _CustomizeToolbarCommand - // - _CustomizeToolbarCommand.Image = ((System.Drawing.Image)(resources.GetObject("_CustomizeToolbarCommand.Image"))); - _CustomizeToolbarCommand.Name = "_CustomizeToolbarCommand"; - _CustomizeToolbarCommand.Size = new System.Drawing.Size(202, 26); - _CustomizeToolbarCommand.Text = "自定义常用工具栏(&Z)..."; - // - // _LogWindow - // - _LogWindow.Image = ((System.Drawing.Image)(resources.GetObject("_LogWindow.Image"))); - _LogWindow.Name = "_LogWindow"; - _LogWindow.Size = new System.Drawing.Size(202, 26); - _LogWindow.Tag = ""; - _LogWindow.Text = "程序输出信息(&S)..."; - // - // _Help - // - _Help.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - _CreateShortcut, - this.toolStripSeparator14, - _CheckUpdate, - _VisitHomePage, - _About}); - _Help.Name = "_Help"; - _Help.Size = new System.Drawing.Size(60, 24); - _Help.Text = "帮助(&B)"; - _Help.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.MenuCommand); - // - // _CreateShortcut - // - _CreateShortcut.Image = ((System.Drawing.Image)(resources.GetObject("_CreateShortcut.Image"))); - _CreateShortcut.Name = "_CreateShortcut"; - _CreateShortcut.Size = new System.Drawing.Size(202, 26); - _CreateShortcut.Text = "创建桌面快捷方式(&C)"; - // - // toolStripSeparator14 - // - this.toolStripSeparator14.Name = "toolStripSeparator14"; - this.toolStripSeparator14.Size = new System.Drawing.Size(199, 6); - // - // _CheckUpdate - // - _CheckUpdate.Image = ((System.Drawing.Image)(resources.GetObject("_CheckUpdate.Image"))); - _CheckUpdate.Name = "_CheckUpdate"; - _CheckUpdate.Size = new System.Drawing.Size(202, 26); - _CheckUpdate.Text = "检查新的版本(&X)..."; - // - // _VisitHomePage - // - _VisitHomePage.Image = ((System.Drawing.Image)(resources.GetObject("_VisitHomePage.Image"))); - _VisitHomePage.Name = "_VisitHomePage"; - _VisitHomePage.Size = new System.Drawing.Size(202, 26); - _VisitHomePage.Text = "访问程序主页(&Z)..."; - // - // _About - // - _About.Image = ((System.Drawing.Image)(resources.GetObject("_About.Image"))); - _About.Name = "_About"; - _About.Size = new System.Drawing.Size(202, 26); - _About.Tag = "About"; - _About.Text = "关于本程序及作者(&G)..."; - // - // _Open - // - _Open.Image = ((System.Drawing.Image)(resources.GetObject("_Open.Image"))); - _Open.Name = "_Open"; - _Open.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D))); - _Open.Size = new System.Drawing.Size(227, 26); - _Open.Text = "打开文件..."; - // - // dummyToolStripMenuItem - // - dummyToolStripMenuItem.Enabled = false; - dummyToolStripMenuItem.Name = "dummyToolStripMenuItem"; - dummyToolStripMenuItem.Size = new System.Drawing.Size(184, 22); - dummyToolStripMenuItem.Text = "最近打开的文件列表"; - // - // _ImportBookmark - // - _ImportBookmark.Image = ((System.Drawing.Image)(resources.GetObject("_ImportBookmark.Image"))); - _ImportBookmark.Name = "_ImportBookmark"; - _ImportBookmark.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R))); - _ImportBookmark.Size = new System.Drawing.Size(227, 26); - _ImportBookmark.Text = "导入书签(&D)..."; - _ImportBookmark.ToolTipText = "从其它文件导入书签到当前文档"; - // - // toolStripSeparator2 - // - toolStripSeparator2.Name = "toolStripSeparator2"; - toolStripSeparator2.Size = new System.Drawing.Size(224, 6); - // - // _Action - // - _Action.Image = global::PDFPatcher.Properties.Resources.Save; - _Action.Name = "_Action"; - _Action.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); - _Action.Size = new System.Drawing.Size(227, 26); - _Action.Text = "保存 PDF 文件(&C)..."; - // - // _SaveBookmark - // - _SaveBookmark.Image = global::PDFPatcher.Properties.Resources.ExportInfoFile; - _SaveBookmark.Name = "_SaveBookmark"; - _SaveBookmark.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Q))); - _SaveBookmark.Size = new System.Drawing.Size(227, 26); - _SaveBookmark.Text = "保存书签文件(&Q)"; - _SaveBookmark.ToolTipText = "将书签保存为 XML 格式的信息文件,可用于迁移书签"; - // - // _SaveAsInfoFile - // - _SaveAsInfoFile.Image = ((System.Drawing.Image)(resources.GetObject("_SaveAsInfoFile.Image"))); - _SaveAsInfoFile.Name = "_SaveAsInfoFile"; - _SaveAsInfoFile.Size = new System.Drawing.Size(227, 26); - _SaveAsInfoFile.Text = "换名保存书签文件(&H)..."; - // - // _configSeparator - // - _configSeparator.Name = "_configSeparator"; - _configSeparator.Size = new System.Drawing.Size(224, 6); - // - // _AppOptions - // - _AppOptions.Image = ((System.Drawing.Image)(resources.GetObject("_AppOptions.Image"))); - _AppOptions.Name = "_AppOptions"; - _AppOptions.Size = new System.Drawing.Size(227, 26); - _AppOptions.Tag = "Options"; - _AppOptions.Text = "程序配置(&P)..."; - // - // _RestoreOptions - // - _RestoreOptions.Name = "_RestoreOptions"; - _RestoreOptions.Size = new System.Drawing.Size(227, 26); - _RestoreOptions.Text = "加载程序配置(&J)..."; - // - // _SaveOptions - // - _SaveOptions.Name = "_SaveOptions"; - _SaveOptions.Size = new System.Drawing.Size(227, 26); - _SaveOptions.Text = "保存程序配置(&B)..."; - // - // toolStripSeparator11 - // - toolStripSeparator11.Name = "toolStripSeparator11"; - toolStripSeparator11.Size = new System.Drawing.Size(224, 6); - // - // _Exit - // - _Exit.Name = "_Exit"; - _Exit.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4))); - _Exit.Size = new System.Drawing.Size(227, 26); - _Exit.Text = "退出程序(&T)"; - // - // _Close - // - _Close.Image = global::PDFPatcher.Properties.Resources.Close; - _Close.Name = "_Close"; - _Close.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F4))); - _Close.Size = new System.Drawing.Size(227, 26); - _Close.Text = "关闭当前功能(&G)"; - // - // toolStripSeparator1 - // - toolStripSeparator1.Name = "toolStripSeparator1"; - toolStripSeparator1.Size = new System.Drawing.Size(224, 6); - // - // _Options - // - _Options.Image = ((System.Drawing.Image)(resources.GetObject("_Options.Image"))); - _Options.Name = "_Options"; - _Options.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.G))); - _Options.Size = new System.Drawing.Size(227, 26); - _Options.Tag = "PatcherOptions"; - _Options.Text = "功能设置(&S)..."; - // - // _CustomizeToolbar - // - _CustomizeToolbar.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - _CustomizeToolbar.Image = ((System.Drawing.Image)(resources.GetObject("_CustomizeToolbar.Image"))); - _CustomizeToolbar.ImageTransparentColor = System.Drawing.Color.Magenta; - _CustomizeToolbar.Name = "_CustomizeToolbar"; - _CustomizeToolbar.Size = new System.Drawing.Size(24, 24); - _CustomizeToolbar.Text = "修改常用工具栏按钮"; - // - // _Properties - // - _Properties.Image = global::PDFPatcher.Properties.Resources.Property; - _Properties.Name = "_Properties"; - _Properties.Size = new System.Drawing.Size(227, 26); - _Properties.Text = "文档属性(&X)..."; - _Properties.ToolTipText = "查看并编辑当前文档的元数据属性"; - // - // _ToolTip - // - this._ToolTip.IsBalloon = true; - this._ToolTip.ShowAlways = true; - // - // _SaveConfigDialog - // - this._SaveConfigDialog.DefaultExt = "json"; - this._SaveConfigDialog.Title = "保存应用程序配置信息"; - // - // _OpenConfigDialog - // - this._OpenConfigDialog.DefaultExt = "json"; - this._OpenConfigDialog.Title = "打开应用程序配置文件"; - // - // _MainMenu - // - this._MainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._File, - _ToolBox, - _Select, - _Help}); - this._MainMenu.Location = new System.Drawing.Point(0, 0); - this._MainMenu.Name = "_MainMenu"; - this._MainMenu.Padding = new System.Windows.Forms.Padding(1, 0, 0, 0); - this._MainMenu.Size = new System.Drawing.Size(604, 24); - this._MainMenu.TabIndex = 0; - // - // _File - // - this._File.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - this._File.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - _Open, - this._RecentFiles, - _ImportBookmark, - toolStripSeparator1, - _Close, - toolStripSeparator2, - _Action, - _SaveBookmark, - _SaveAsInfoFile, - _configSeparator, - _Properties, - _Options, - this._ResetOptions, - _AppOptions, - _RestoreOptions, - _SaveOptions, - toolStripSeparator11, - _Exit}); - this._File.Image = ((System.Drawing.Image)(resources.GetObject("_File.Image"))); - this._File.ImageTransparentColor = System.Drawing.Color.Magenta; - this._File.Name = "_File"; - this._File.Size = new System.Drawing.Size(64, 24); - this._File.Text = "文件(&W)"; - this._File.DropDownOpening += new System.EventHandler(this.MenuOpening); - this._File.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.MenuCommand); - // - // _RecentFiles - // - this._RecentFiles.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - dummyToolStripMenuItem}); - this._RecentFiles.Name = "_RecentFiles"; - this._RecentFiles.Size = new System.Drawing.Size(227, 26); - this._RecentFiles.Text = "最近打开的文件"; - this._RecentFiles.DropDownOpening += new System.EventHandler(this.RecentFileMenuOpening); - this._RecentFiles.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.MenuCommand); - // - // _ResetOptions - // - this._ResetOptions.Image = ((System.Drawing.Image)(resources.GetObject("_ResetOptions.Image"))); - this._ResetOptions.Name = "_ResetOptions"; - this._ResetOptions.Size = new System.Drawing.Size(227, 26); - this._ResetOptions.Text = "重置当前功能(&Z)..."; - // - // _OpenPdfDialog - // - this._OpenPdfDialog.Title = "请选择需要打开的 PDF 文档"; - // - // statusStrip1 - // - this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); - this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this._MainStatusLabel}); - this.statusStrip1.Location = new System.Drawing.Point(0, 453); - this.statusStrip1.Name = "statusStrip1"; - this.statusStrip1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0); - this.statusStrip1.Size = new System.Drawing.Size(604, 22); - this.statusStrip1.TabIndex = 3; - // - // _MainStatusLabel - // - this._MainStatusLabel.Name = "_MainStatusLabel"; - this._MainStatusLabel.Size = new System.Drawing.Size(0, 0); - // - // _GeneralToolbar - // - this._GeneralToolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - _CustomizeToolbar}); - this._GeneralToolbar.Location = new System.Drawing.Point(0, 24); - this._GeneralToolbar.Name = "_GeneralToolbar"; - this._GeneralToolbar.Padding = new System.Windows.Forms.Padding(0); - this._GeneralToolbar.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; - this._GeneralToolbar.Size = new System.Drawing.Size(604, 27); - this._GeneralToolbar.TabIndex = 1; - // - // _FunctionContainer - // - this._FunctionContainer.DisplayStyle = System.Windows.Forms.TabStyle.IE8; - // - // - // - this._FunctionContainer.DisplayStyleProvider.BorderColor = System.Drawing.SystemColors.ControlDark; - this._FunctionContainer.DisplayStyleProvider.BorderColorHot = System.Drawing.SystemColors.ControlDark; - this._FunctionContainer.DisplayStyleProvider.BorderColorSelected = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(157)))), ((int)(((byte)(185))))); - this._FunctionContainer.DisplayStyleProvider.CloserColor = System.Drawing.Color.DarkGray; - this._FunctionContainer.DisplayStyleProvider.CloserColorActive = System.Drawing.Color.Red; - this._FunctionContainer.DisplayStyleProvider.FocusTrack = false; - this._FunctionContainer.DisplayStyleProvider.HotTrack = true; - this._FunctionContainer.DisplayStyleProvider.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; - this._FunctionContainer.DisplayStyleProvider.Opacity = 1F; - this._FunctionContainer.DisplayStyleProvider.Overlap = 0; - this._FunctionContainer.DisplayStyleProvider.Padding = new System.Drawing.Point(6, 5); - this._FunctionContainer.DisplayStyleProvider.Radius = 3; - this._FunctionContainer.DisplayStyleProvider.SelectedTextStyle = System.Drawing.FontStyle.Regular; - this._FunctionContainer.DisplayStyleProvider.ShowTabCloser = true; - this._FunctionContainer.DisplayStyleProvider.TextColor = System.Drawing.SystemColors.ControlText; - this._FunctionContainer.DisplayStyleProvider.TextColorDisabled = System.Drawing.SystemColors.ControlDark; - this._FunctionContainer.DisplayStyleProvider.TextColorSelected = System.Drawing.SystemColors.ControlText; - this._FunctionContainer.Dock = System.Windows.Forms.DockStyle.Fill; - this._FunctionContainer.DrawMode = System.Windows.Forms.TabDrawMode.OwnerDrawFixed; - this._FunctionContainer.HotTrack = true; - this._FunctionContainer.Location = new System.Drawing.Point(0, 51); - this._FunctionContainer.Margin = new System.Windows.Forms.Padding(0, 1, 0, 1); - this._FunctionContainer.Name = "_FunctionContainer"; - this._FunctionContainer.SelectedIndex = 0; - this._FunctionContainer.Size = new System.Drawing.Size(604, 402); - this._FunctionContainer.TabIndex = 2; - // - // MainForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(604, 475); - this.Controls.Add(this._FunctionContainer); - this.Controls.Add(this.statusStrip1); - this.Controls.Add(this._GeneralToolbar); - this.Controls.Add(this._MainMenu); - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MainMenuStrip = this._MainMenu; - this.Margin = new System.Windows.Forms.Padding(0, 1, 0, 1); - this.Name = "MainForm"; - this.Text = "PDF 补丁丁"; - this._MainMenu.ResumeLayout(false); - this._MainMenu.PerformLayout(); - this.statusStrip1.ResumeLayout(false); - this.statusStrip1.PerformLayout(); - this._GeneralToolbar.ResumeLayout(false); - this._GeneralToolbar.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.ToolTip _ToolTip; - private System.Windows.Forms.SaveFileDialog _SaveConfigDialog; - private System.Windows.Forms.OpenFileDialog _OpenConfigDialog; - private System.Windows.Forms.MenuStrip _MainMenu; - private System.Windows.Forms.ToolStripMenuItem _File; - private System.Windows.Forms.ToolStripMenuItem _RecentFiles; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator14; - private System.Windows.Forms.OpenFileDialog _OpenPdfDialog; - private System.Windows.Forms.StatusStrip statusStrip1; - private System.Windows.Forms.ToolStripMenuItem _ResetOptions; - private System.Windows.Forms.ToolStrip _GeneralToolbar; - private System.Windows.Forms.CustomTabControl _FunctionContainer; - private System.Windows.Forms.ToolStripStatusLabel _MainStatusLabel; - } -} - diff --git a/pdfpatcher/App/MainForm.cs b/pdfpatcher/App/MainForm.cs deleted file mode 100644 index e0f312217ddd8c518d5943dc9b0b4db0917a252e..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/MainForm.cs +++ /dev/null @@ -1,569 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Windows.Forms; -using PDFPatcher.Common; -using PDFPatcher.Functions; - -namespace PDFPatcher -{ - public partial class MainForm : Form - { - static readonly Dictionary __FunctionControls = new Dictionary(); - - ReportControl _LogControl; - #region 公共功能 - BackgroundWorker _Worker; - readonly FormState _formState = new FormState(); - bool _FullScreen; - ///获取或指定全屏显示的值。 - [Browsable(false)] - public bool FullScreen { - get => _FullScreen; - set { - if (value == _FullScreen) { - return; - } - _FullScreen = value; - if (value) { - _MainMenu.Visible = _GeneralToolbar.Visible = false; - _formState.Maximize(this); - } - else { - _MainMenu.Visible = true; - _GeneralToolbar.Visible = AppContext.Toolbar.ShowGeneralToolbar; - _formState.Restore(this); - } - } - } - - /// - /// 设置控件的提示信息。 - /// - internal void SetTooltip(Control control, string text) { - _ToolTip.SetToolTip(control, text); - } - - /// - /// 获取或设置状态栏文本。 - /// - internal string StatusText { - get => _MainStatusLabel.Text; - set => _MainStatusLabel.Text = value; - } - - #region Worker - ///获取或指定后台进程。 - internal BackgroundWorker GetWorker() { - if (_Worker == null) { - _Worker = new BackgroundWorker { - WorkerReportsProgress = true, - WorkerSupportsCancellation = true - }; - _Worker.DoWork += Worker_DoWork; - _Worker.ProgressChanged += Worker_ProgressChanged; - _Worker.RunWorkerCompleted += Worker_RunWorkerCompleted; - Tracker.SetWorker(_Worker); - } - return _Worker; - } - internal bool IsWorkerBusy => _Worker?.IsBusy == true; - - void Worker_DoWork(object sender, DoWorkEventArgs e) { - _Worker.ReportProgress(0); - FileHelper.ResetOverwriteMode(); - AppContext.Abort = false; - } - - void Worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { - _MainMenu.Enabled = _GeneralToolbar.Enabled = _FunctionContainer.Enabled = true; - foreach (TabPage item in _FunctionContainer.TabPages) { - item.Enabled = true; - } - if (e.Error == null || e.Cancelled == false) { - _LogControl.Complete(); - } - } - - public void ResetWorker() { - if (_Worker != null) { - if (_Worker.IsBusy) { - throw new InvalidOperationException("Worker is busy. Can't be reset."); - } - _Worker.Dispose(); - _Worker = null; - } - } - - void Worker_ProgressChanged(object sender, ProgressChangedEventArgs e) { - var s = e.UserState as string; - if (s == "INC") { - _LogControl.IncrementProgress(e.ProgressPercentage); - return; - } - else if (s == "GOAL") { - _LogControl.SetGoal(e.ProgressPercentage); - return; - } - else if (s == "TINC") { - _LogControl.IncrementTotalProgress(); - } - else if (s == "TGOAL") { - _LogControl.SetTotalGoal(e.ProgressPercentage); - } - if (e.ProgressPercentage > 0) { - _LogControl.SetProgress(e.ProgressPercentage); - } - else if (e.ProgressPercentage == 0) { - _MainMenu.Enabled = _GeneralToolbar.Enabled = _FunctionContainer.Enabled = false; - foreach (TabPage item in _FunctionContainer.TabPages) { - item.Enabled = false; - } - _LogControl.Reset(); - ShowLogControl(); - } - else if (s != null) { - _LogControl.PrintMessage(s, (Tracker.Category)e.ProgressPercentage); - } - } - #endregion - - internal FunctionControl GetFunctionControl(Function functionName) { - if (__FunctionControls.TryGetValue(functionName, out FunctionControl f) && f.IsDisposed == false) { - return f; - } - switch (functionName) { - case Function.FrontPage: - return __FunctionControls[functionName] = new FrontPageControl(); - case Function.Patcher: - return __FunctionControls[functionName] = new PatcherControl(); - case Function.Merger: - return __FunctionControls[functionName] = new MergerControl(); - case Function.BookmarkGenerator: - return __FunctionControls[functionName] = new AutoBookmarkControl(); - case Function.InfoExchanger: - return __FunctionControls[functionName] = new InfoExchangerControl(); - case Function.ExtractPages: - return __FunctionControls[functionName] = new ExtractPageControl(); - case Function.ExtractImages: - return __FunctionControls[functionName] = new ExtractImageControl(); - case Function.Editor: - var b = new EditorControl(); - b.DocumentChanged += OnDocumentChanged; - return b; - case Function.Ocr: - return __FunctionControls[functionName] = new OcrControl(); - case Function.RenderPages: - return __FunctionControls[functionName] = new RenderImageControl(); - case Function.About: - return __FunctionControls[functionName] = new AboutControl(); - case Function.Inspector: - var d = new DocumentInspectorControl(); - d.DocumentChanged += OnDocumentChanged; - return d; - case Function.Rename: - return __FunctionControls[functionName] = new RenameControl(); - default: - return null; - } - } - - void OnDocumentChanged(object sender, DocumentChangedEventArgs args) { - var p = args.Path; - _MainStatusLabel.Text = p ?? String.Empty; - if (!FileHelper.IsPathValid(p)) { - return; - } - - p = System.IO.Path.GetFileNameWithoutExtension(p); - if (p.Length > 20) { - p = p.Substring(0, 17) + "..."; - } - if (sender is Control f) { - f = f.Parent; - if (f == null) { - return; - } - f.Text = p; - } - } - - #endregion - - public MainForm() { - InitializeComponent(); - this.OnFirstLoad(OnLoad); - } - - protected override void WndProc(ref Message m) { - base.WndProc(ref m); - if (m.Msg == FormHelper.ProcMsg) { - OpenFiles(FormHelper.GetCopyDataContent(ref m).Split('\n')); - Activate(); - } - } - - void OnLoad() { - Processor.PdfHelper.ToggleReaderDebugMode(true); // 打开容错模式 - Processor.PdfHelper.ToggleUnethicalMode(true); // 打开强制读取加密文档模式 - - bool firstLoad; - try { - firstLoad = AppContext.Load(null) == false; - } - catch (Exception) { - // ignore loading exception - firstLoad = true; - } - _MainMenu.ScaleIcons(16); - Text = Constants.AppName + " [" + Application.ProductVersion + "]"; - MinimumSize = Size; - AllowDrop = true; - DragEnter += (s, args) => args.FeedbackDragFileOver(Constants.FileExtensions.Pdf); - DragDrop += (s, args) => OpenFiles(args.DropFileOver(Constants.FileExtensions.Pdf)); - FormClosed += MainForm_FormClosed; - - AppContext.WindowStatus.Position(this); - SetupCustomizeToolbar(); - if (_GeneralToolbar.Visible = AppContext.Toolbar.ShowGeneralToolbar) { - ScaleToolbar(); - } - - _OpenPdfDialog.DefaultExt = Constants.FileExtensions.Pdf; - _OpenPdfDialog.Filter = Constants.FileExtensions.PdfFilter; - - _LogControl = new ReportControl { - Location = _FunctionContainer.Location, - Size = _FunctionContainer.Size, - Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right - }; - Controls.Add(_LogControl); - HideLogControl(); - _LogControl.VisibleChanged += (s, args) => _FunctionContainer.Visible = !_LogControl.Visible; - _OpenConfigDialog.FileName = _SaveConfigDialog.FileName = Constants.AppName + "配置文件" + Constants.FileExtensions.Json; - _OpenConfigDialog.Filter = _SaveConfigDialog.Filter = Constants.FileExtensions.JsonFilter; - _FunctionContainer.Font = new Font(SystemFonts.CaptionFont.FontFamily.Name, 9); - _FunctionContainer.ImageList = new ImageList(); - _FunctionContainer.DisplayStyleProvider.SelectedTextStyle = FontStyle.Bold; - _FunctionContainer.AllowDrop = true; - _FunctionContainer.MouseClick += (s, args) => { - if (args.Button == MouseButtons.Middle) { ClickCloseTab(args); } - }; - _FunctionContainer.MouseDoubleClick += (s, args) => { ClickCloseTab(args); }; - _FunctionContainer.TabClosing += (s, args) => { - var t = _FunctionContainer.SelectedTab; - Tracker.DebugMessage(args.Action.ToString()); - if (t.Tag.CastOrDefault() == Function.FrontPage) { - args.Cancel = true; - return; - } - var i = args.TabPageIndex; - var c = _FunctionContainer.TabCount; - if (i == 0 && c > 1) { - _FunctionContainer.SelectedIndex = 1; - } - else if (i < c) { - _FunctionContainer.SelectedIndex = i - 1; - } - _FunctionContainer.TabPages.RemoveAt(i); - t.Dispose(); - _MainStatusLabel.Text = String.Empty; - }; - _FunctionContainer.Selected += SelectedFunctionChanged; - _FunctionContainer.Deselected += FunctionDeselected; - - // 关闭启动屏幕窗口 - using (var closeSplashEvent = new System.Threading.EventWaitHandle(false, - System.Threading.EventResetMode.ManualReset, "CloseSplashScreenEvent" + Constants.AppEngName)) { - closeSplashEvent.Set(); - } - - SelectFunctionList(Function.FrontPage); - if (firstLoad) { - SelectFunctionList(Function.About); - } - - _GeneralToolbar.ItemClicked += MenuCommand; - if (AppContext.CheckUpdateDate < DateTime.Today) { - CheckUpdate(); - if (AppContext.CheckUpdateInterval != Int32.MaxValue) { - AppContext.CheckUpdateDate = DateTime.Today + TimeSpan.FromDays(AppContext.CheckUpdateInterval); - } - } - var ca = Environment.GetCommandLineArgs(); - if (ca.HasContent()) { - OpenFiles(ca); - } -#if DEBUG - iTextSharp.text.io.StreamUtil.AddToResourceSearch("iTextAsian.dll"); -#endif - } - - void OpenFiles(string[] files) { - foreach (var item in files) { - var p = new FilePath(item); - if (p.ExistsFile && p.HasExtension(Constants.FileExtensions.Pdf)) { - OpenFileWithEditor(p.ToFullPath()); - } - } - } - - void CheckUpdate() { - var client = new System.Net.WebClient(); - client.DownloadDataCompleted += (s, args) => { - if (args.Error != null) { - goto Exit; - } - try { - var x = new System.Xml.XmlDocument(); - x.Load(new System.IO.MemoryStream(args.Result)); - var r = x.DocumentElement; - var u = r.GetAttribute("url"); - if (String.IsNullOrEmpty(u) == false - && new Version(ProductVersion) < new Version(r.GetAttribute("version")) - && this.ConfirmOKBox("发现新版本,是否前往下载?")) { - ShowDialogWindow(new UpdateForm()); - } - } - catch (Exception) { - FormHelper.ErrorBox("版本信息文件格式错误,请稍候重试。"); - } - Exit: - client.Dispose(); - client = null; - }; - client.DownloadDataAsync(new Uri(Constants.AppUpdateFile)); - } - - void ClickCloseTab(MouseEventArgs args) { - for (int i = _FunctionContainer.TabCount - 1; i >= 0; i--) { - if (_FunctionContainer.GetTabRect(i).Contains(args.Location) == false) { - continue; - } - if (_FunctionContainer.TabPages[i].Tag.CastOrDefault() != Function.FrontPage) { - _FunctionContainer.TabPages[i].Dispose(); - } - } - } - - void MenuCommand(object sender, ToolStripItemClickedEventArgs e) { - var ci = e.ClickedItem; - var t = ci.Tag as string; - if (String.IsNullOrEmpty(t) == false) { - SelectFunctionList((Function)Enum.Parse(typeof(Function), t)); - return; - } - ci.HidePopupMenu(); - if (ci.OwnerItem == _RecentFiles) { - var f = GetActiveFunctionControl() as FunctionControl; - f.RecentFileItemClicked?.Invoke(_MainMenu, e); - } - else { - ExecuteCommand(ci.Name); - } - } - - internal void ExecuteCommand(string commandName) { - if (commandName == Commands.ResetOptions) { - if (GetActiveFunctionControl() is IResettableControl f - && FormHelper.YesNoBox("是否将当前功能恢复为默认设置?") == DialogResult.Yes) { - f.Reset(); - } - } - else if (commandName == Commands.RestoreOptions && _OpenConfigDialog.ShowDialog() == DialogResult.OK) { - if (AppContext.Load(_OpenConfigDialog.FileName) == false) { - FormHelper.ErrorBox("无法加载指定的配置文件。"); - return; - } - foreach (Control item in __FunctionControls.Values) { - (item as IResettableControl)?.Reload(); - } - SetupCustomizeToolbar(); - } - else if (commandName == Commands.SaveOptions && _SaveConfigDialog.ShowDialog() == DialogResult.OK) { - AppContext.Save(_SaveConfigDialog.FileName, false, false); - } - else if (commandName == Commands.LogWindow) { - ShowLogControl(); - } - else if (commandName == Commands.CreateShortcut) { - CommonCommands.CreateShortcut(); - } - else if (commandName == Commands.VisitHomePage) { - CommonCommands.VisitHomePage(); - } - else if (commandName == Commands.CheckUpdate) { - ShowDialogWindow(new UpdateForm()); - } - else if (commandName == Commands.Close) { - if (_FunctionContainer.SelectedTab.Tag.CastOrDefault() == Function.FrontPage) { - return; - } - _FunctionContainer.SelectedTab.Dispose(); - } - else if (commandName == Commands.CustomizeToolbar || commandName == "_CustomizeToolbarCommand") { - ShowDialogWindow(new CustomizeToolbarForm()); - SetupCustomizeToolbar(); - } - else if (commandName == Commands.ShowGeneralToolbar) { - _FunctionContainer.SuspendLayout(); - if (_GeneralToolbar.Visible = AppContext.Toolbar.ShowGeneralToolbar = !AppContext.Toolbar.ShowGeneralToolbar) { - ScaleToolbar(); - } - _FunctionContainer.PerformLayout(); - } - else if (commandName == Commands.Exit) { - Close(); - } - else if (GetActiveFunctionControl() is FunctionControl f) { - if (commandName == Commands.Action && f.DefaultButton != null) { - f.DefaultButton.PerformClick(); - } - else { - f.ExecuteCommand(commandName); - } - } - } - - void SetupCustomizeToolbar() { - AppContext.Toolbar.RemoveInvalidButtons(); - for (int i = _GeneralToolbar.Items.Count - 1; i > 0; i--) { - _GeneralToolbar.Items[i].Dispose(); - } - foreach (var item in AppContext.Toolbar.Buttons) { - if (item.Visible == false) { - continue; - } - _GeneralToolbar.Items.Add(item.CreateButton()); - } - } - - void ScaleToolbar() { - _GeneralToolbar.ScaleIcons(16); - } - - DialogResult ShowDialogWindow(Form window) { - using (var f = window) { - f.StartPosition = FormStartPosition.CenterParent; - return f.ShowDialog(this); - } - } - - Control GetActiveFunctionControl() { - var t = _FunctionContainer.SelectedTab; - return t == null || t.HasChildren == false ? null : t.Controls[0]; - } - - internal void OpenFileWithEditor(string path) { - SelectFunctionList(Function.Editor); - var c = GetActiveFunctionControl() as EditorControl; - if (String.IsNullOrEmpty(path)) { - c.ExecuteCommand(Commands.Open); - } - else { - c.ExecuteCommand(Commands.OpenFile, path); - } - } - - internal void SelectFunctionList(Function func) { - if (func == Function.PatcherOptions) { - ShowDialogWindow(new PatcherOptionForm(false) { Options = AppContext.Patcher }); - } - else if (func == Function.MergerOptions) { - ShowDialogWindow(new MergerOptionForm()); - } - else if (func == Function.InfoFileOptions) { - ShowDialogWindow(new InfoFileOptionControl()); - } - else if (func == Function.EditorOptions) { - ShowDialogWindow(new PatcherOptionForm(true) { Options = AppContext.Editor }); - } - else if (func == Function.Options) { - ShowDialogWindow(new AppOptionForm()); - } - else { - HideLogControl(); - var p = (GetActiveFunctionControl() as IDocumentEditor)?.DocumentPath; - var c = GetFunctionControl(func); - foreach (TabPage item in _FunctionContainer.TabPages) { - if (item.Controls.Count > 0 && item.Controls[0] == c) { - _FunctionContainer.SelectedTab = item; - if (String.IsNullOrEmpty(p) == false) { - c.ExecuteCommand(Commands.OpenFile, p); - } - return; - } - } - var t = new TabPage(c.FunctionName) { - Font = SystemFonts.SmallCaptionFont - }; - var im = _FunctionContainer.ImageList.Images; - for (int i = im.Count - 1; i >= 0; i--) { - if (im[i] == c.IconImage) { - t.ImageIndex = i; - break; - } - } - if (t.ImageIndex < 0) { - im.Add(c.IconImage); - t.ImageIndex = im.Count - 1; - } - t.Tag = func; - _FunctionContainer.TabPages.Add(t); - c.Size = t.ClientSize; - c.Dock = DockStyle.Fill; - t.Controls.Add(c); - _FunctionContainer.SelectedTab = t; - if (String.IsNullOrEmpty(p) == false) { - c.ExecuteCommand(Commands.OpenFile, p); - } - AcceptButton = c.DefaultButton; - } - } - - void FunctionDeselected(object sender, TabControlEventArgs args) { - if (GetActiveFunctionControl() is FunctionControl c) { - c.OnDeselected(); - } - } - - void SelectedFunctionChanged(object sender, TabControlEventArgs args) { - if (GetActiveFunctionControl() is FunctionControl c) { - //foreach (ToolStripMenuItem item in _MainMenu.Items) { - // c.SetupMenu (item); - //} - c.OnSelected(); - _MainStatusLabel.Text = c is IDocumentEditor b ? b.DocumentPath : Messages.Welcome; - AcceptButton = c.DefaultButton; - } - } - - internal string ShowPdfFileDialog() { - return _OpenPdfDialog.ShowDialog() == DialogResult.OK ? _OpenPdfDialog.FileName : null; - } - - void MainForm_FormClosed(object sender, FormClosedEventArgs e) { - AppContext.Save(null, true, true); - } - - void HideLogControl() { - _LogControl.Hide(); - } - void ShowLogControl() { - _LogControl.Show(); - } - - void MenuOpening(object sender, EventArgs e) { - if (GetActiveFunctionControl() is FunctionControl f) { - f.SetupMenu(sender as ToolStripMenuItem); - } - } - - void RecentFileMenuOpening(object sender, EventArgs e) { - if (GetActiveFunctionControl() is FunctionControl f && f.ListRecentFiles != null) { - f.ListRecentFiles(sender, e); - } - } - } -} diff --git a/pdfpatcher/App/MainForm.resx b/pdfpatcher/App/MainForm.resx deleted file mode 100644 index 4a8849216d2cdc83a5c6ffcbf9b7dd7dfcb26074..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/MainForm.resx +++ /dev/null @@ -1,3990 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAH/SURBVDhPnZHfS1NhHMbf29F9QXcWBOJFBPZjYQzToqhB - UAssvMhk1WIVi5EeXUtK648I+gOii6AfN5uIttbyOFOHiJmNpdWazcZ29sOd7el9DpxDQjfbCw883xc+ - D8/7fcXFQMDpCgbdzYisuDA0dA1NHrLinKJcr8uhWwW6pus4/rGGzpgOR3QLxyJldEwVcXRSw5GJPA6N - 53Aw/AftoU2QISvO+v0evV43Ap5kYQSMZnQ8+lU1AoLrRQS+FYwAJZnDwOqmEUCGrDjt892s1GpWg/64 - htH5DB5+SmMk/gMP1HXcn17DcCwFJZrE4PuvGIisggxZcdLr9ZZ03WowNr+BLTlTkcVFy0/MzVk+NDMD - MmRFl8dzq1Cton9sA5eGU3DeTsBx5R0OnH+DfadeYE/3c+w98RKtZ8LyToX98md0Xv0JMmSFw+2+k6tU - jABFvnnw9W+EVM3Qs7dJyz999cXyDCBDVnT09fmy5XLDDciQFYd7e+9mSqVtO8jJmeIOTM8dmJ47IENW - tPf0+NPFovULDIgtLyO6tAR1ZQVTiQQmFxbwQc7js7MIx+NGABmyYr/Lde+7pm1rkJUzxQamZwPTM4AM - WdHqdCprhcJ/GzDAbMCAfxuQISt22e0jabnRVD7fkMiQFbaWlhs72toeNyOyQh6b1E6p3Q1KMsL2FzoD - tHKcosAUAAAAAElFTkSuQmCC - - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAG8SURBVDhPjZFNSwJRFIZnWyBF+3a6kDCjFm0Ci4Iy - KjIK3LgJSguJjIoKwWU/IPwFfRIStSgEMU33Ltu1CKECow91/Na3c6a8jGOCA+/MudxzHu5zRwIgLfl8 - s5TVFtEveL3S/P4+9ymZWxyXpvs6lVnlRQ0uuVLBR6GAt1wOyUwGz+k0bmIx8B7FoAbUgQJAi7VsqYT3 - bBYvX194SqXw+PqK07s72gZ4n2JoCZjZ2VmXy2V8yrICCSUSOI9GceD3i4y5XNc03KAkAFMejztPCt/5 - vAK5isfRjpIATLjdG0UayNIAQ66osR0lARh1OjdL1SpyNMSQwMMD1Ep1yNHJiYjBavUKwMjy8lalVkOB - hhgSiESgVtKehHVYWwCGHY7tKgHKNMSQy3AYaiUtJEk1awvAoN2+W6OiQhoMuQiFoFbSQvhiWVsATDbb - Hn1Ro1Mw5CwYhFpJC/ksFsHaAtBrsfgYwA+f5Pj2FmolLSRNa9am1l9Al9m8ojOZDuvRT07eq5W0EP7F - rC0ANCR1GI1KeoaGmpS0kBzVfz2NAF1/P+s0KbEO3wlfLP+dItV/PY2A7oEBJVql/8I9AKQf6RnM9xYG - na4AAAAASUVORK5CYII= - - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFsSURBVDhPrVG7SgNBFL2QIoVWWmgXdAkiioIRFINmQsR0 - plALtYgYfBQ2KaxEWNDCysbC0srGX4kPMNgoaJFCQURsFBG5zpl7s2TZtdIDh5nzWnYT+jfwWsHn9Wnm - jYJRKwJkrmO7agm+K3nfkvnsgHF+VXKRh8Br7WCjEdFnedIFfLrnTuiPcjZ4CO5xHY1tYXnMvC+NM5/s - Cm0BGn6QYax5M9O54HUuY97mR5iPt4V2AO08jNWHRldnYTyXBszL7CDz4ZYQQ1A1MnS0Ho/Homeeimnm - /dUQ4SHT2u9o5FKmkU8xH1WZdxaF9g4Pmdbi8ZDtMvcT3fLa1VKY1kOGjtbDuMt0mtvRDhlvzjhCO081 - Mmh0dSaoD7eZm6F2Ga9MOULDDzL10WlmOie67k/KGP+3JXS9LxkUcHcdzdGF1pjoIp3wL9MJ5oUM47zy - EpHvhNfawUYjQa2H/PNe4ppH8T+SBTLXsV21/gqiH0YlVZLkitJ3AAAAAElFTkSuQmCC - - - - False - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAAixJREFUOE+Nkk1IVHEUxS+IK9sHrlw0CwVpEYRECylIFxNkWrhwoeA4SQ058Shw - RgfatGpju9KIaYIoEhWSgiwybKiwMj/QSm2KNzMMg+l8f9/OHf/zHhEMHfjBu++dc978512q6PzIyOlz - Hs9ANbo8nkPK/q+6XC57slDg39ksR1Ip1hMJ/hmPcyAWKzM9P8/iOet2W1RkXx+Jbq4T8TfwHWyAVfAZ - vAeLo6O8ouv8YHaWRWeGhy/8VSLmXyACoiAEtsEa+ABeg9VgkG/5fAaWtja3ihMtwfADBEG4tpa5VOJA - QwOvYH4H5sBGOFwukV8ix7Fq2kUVJ1qE4SvYAnpzM+eWlznU38+fML8Bz8B2NGqUSMEpp/OSihO9heEL - kKOE7XbW+/o47ffzWmsrv8C9GRDa2zNK5I896XA4VJzoJQx+sNXRwcXNTd71ejm9sMAM87qm8WM8i+KL - VErk65wYHLys4kRPYXgOOBDg0NgYL1mt/Kq+nmdqavgJ7t8HO8mkURJJp/m4zeZUcaJJGIRpxRSQoLz5 - EZgAu9iLSonsybHe3isqTvQQe+CDyQvugbtgHNwBt8Hc0BDH8NZKSSyX46M9PZqKmzrS3X21hEUpFIuc - B1lsZSaf5xQCiUzGKIljFq+KmTrc2XlNNq2EPahWksQsXhUzZWlvd0mBqFpJCtfiVTFTB1tarqt8WXKc - ohQBKcqBDMqymMWrYqYONDXZ6hobb/wP4t1PEf0B0acbCXs9gqQAAAAASUVORK5CYII= - - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAIzSURBVDhPjZJdSFNhGMd3NZNqGOsD8ybDUyqOQRmb - UV0EYQOTRAMvJPDiaKMNWYwGy7GIYHYTQRdZN2GsoA+IkgyNcA2j6CKIPBejSNrYGjY09+k+/z3PWifG - WdSBP8/7nPf//M57nvdRASjrlNt9gjTyD7X0u1yqPqdTrpMXtDGaKhSwms1iOZ1GOJlEMJHA13i8rCd+ - P9hDEmoC6OWZRC6HGBV+W1vDUiyGQDQKKRLBYjiMuzMzZAPYRxJ+18mAXofDnCTASipVE3Ld65UlmEzj - CkCP3X42nc/jBx3/bxA+Cf8OexWA4zabJUM9eP9IW0Nb5TUD2KsAHLNaresEWHzaWCVpeiekZySKnHNj - 2asAHDWbx3LFIny3WxF43oxPs7vwea4ZS74WBN+0lSPnfDvsVQCOiKItTwCx+zAeX92HoG8vQq9a8f2j - Aeur/YhJXQj527CcyYC9CsDB4eFzhVIJvTodLD0G+poOkdd6JCMnaXsM6Wgfom/15TlhrwJgGBqyFwlw - QKtFtyDg9KFOXDF34cOCSNvXEA5Y8GXeiDhdNXsVgP2Dg+dLtJhyb8Cdi/W4d3kz7ns0WHi4HSuh3Xg3 - 3YQXNxvAw8ZeBUA/MOCgiNkbmj+a1MA31QBpfhv83i2YozxFs1LxVgP2mEwXKMIjqmVNjKgx6azDywf1 - uOWqw8SoGjxsFW81YIfReImi/PDvcE+4sXw7fMU8J1nKK95qwKaODnFje7vnf8TeX3VQ/QQocLSW8bqV - FAAAAABJRU5ErkJggg== - - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAKvSURBVDhPjZJbSJNhGMefi8gOGBEWKJHVhVE3ZVl0 - kzdFqSCUJHpRS8sTauqwzDIPm1sTD8NytHQ6MM9maSbpMrNEQVyWpZQ1LE2T3NR5mGfnv+97qa9WXfTA - D/7wPO+P/8VLABgv0yiQQ/KfBOoVRL5JSSQIOhSUajGkYeRFAIzN52DpToF1MB8YvmuLsRT8bawkwFbQ - Lic5JquwYr6H+S8qjLVHQac+iif1Shsan+ZAIfF4zD0O5fAWBG0yUljHK7A8Usywjlfi7cNorHDLf8HP - qYSEMEHQIqX0ZVMploYLGXzOkIXghArwyQMulADh5UCxHqjtBpZXVuAdFxcuCJqTKWvpWxEWBgsYfM6X - e0JWpUfaAz0klXoklutR0dYLgwmYt1rhKRZHCoLGRMpe+KrF7Oc7DD63aP3/ql3yrAPGacCytIRjERFR - gqAhgVRzAxpYDCoGn6tT7PD6/mYOBwZfO69eh1HLHMwLC3APDhYLgrp4Us9+UmOqN5vB5xrpevQ174Sh - cTs+NDiz2vFlOlQaFmGam8NhkShWENTEkcby8RYmejIYfH6UsQWL0/4Y6z2CodY9rHaMVoeCrmUMz8xg - v59fnCCoiiXt1DslxroUDD5Xp+/gVjKY+oMw0HKI1dbU1WFoehpGLu/y8koQBGXRVDzRnQ5Tp5TB56Kr - qzH83gkd1Q5oyt/AaotiRNgmVsLDw7lnk5tbkCDIDaFa8xsFRjqSGWauhfriKrTW2qP4xjrcvrSW1dbk - XQZ/qwkl942urr++cpaIlE03D072NYQtjuolGH8lQ6HUndX9CV/7tM/uPv6Wk5CNIPMsUW4wnVQHUW7F - ta3PO0t8+q/42g1wR/LfsXdxiTy+l8j7ANEaR0dbAfeYcs4TKUW0L/MMXU/1o9tE5PQH9hw/hug7muSh - bCuCcYIAAAAASUVORK5CYII= - - - - False - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHQSURBVDhPpZPdS1NxHMa/99F91yKEmOSFFzK6KJBE - 40gjdtEIb5YuWmZuzbmJiDf5P/SuRRfJam1asxYKERhF0KWIoubb1HzZ+3Du8Tw/+J0br7YOPPD8Ds/n - 8DkHjjiGhw0z3VXGkBtDQ25UeZEVeyh0p2webj/arShkyEpHIHC3VC7j5uAKQt8LuB7JI/gthwEzRjgD - /2waD2dSaH97CO/XA/Ql9tWWDFm55vN5isfHaL/3B/ZIAV2xFIKTuxiI7aA/uo3+D0n4I1vwvd+E990G - vOF1tSVDVlp7e3vypRJst2aVQXDqH2Z+51RefFq2+tPJRatzS4astHg89zNHR7jQEVUGfMDY9Cpexlfw - JrGO5x+X8GxqCa8+/8WT2AIeRxfUlgxZuex2PzgsFlF7dcIySPzKqtBAdxrozi0ZsnLJ5fLuFQqoaQmf - Mnj9Zc0yGDfvaQNuyZCV5s5O304+j/Ntcctg+mdahQa600B3bsmQlSan05/M5XDRPnfKgO+tDcbMszbg - lgxZaXQ4AhvZLJqd85ZB/EdKhQa600B3bsmQlTrDCK1lMrji2qwoZMjKOZttJGl+0dV0uqKQIStnGxq6 - ztTXj1YTsmL+E/8RyAkWl85tVYbA9AAAAABJRU5ErkJggg== - - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAALFSURBVDhPfdNbSFNxHAfwf4jQxfBRsB4E80FFlHrIl0AT - VHSGt6UGEoq5vHQRRoa3QSD2IojtyWzEXHe6TFPK8o4btdk275d52ebcUkfh3eb27XeOJ6OCfvB5OP/z - +/7O/5z9x37VxerqFLFMVvg/mTLZKaH930qrrJRs7u3h2+4ulre2YN/YgHV9HZa1NZ66vx9cT3pVVYgQ - 2a8vjNVPMoYZYiZTZIwYyWcyVFODUbsdjzo6wFVqRcXVP4ZwzTayTFaJg8yTcaIjfWRsaQn3VKoDIQkJ - VUKcMRM1LJAl4vT1BbxeWIKCMErXn0gXmXI6+SHcTrjXEUmlJUKcsSFqmCZzxB4RgR8jI3AUFMBA1wPk - HZlfXT0Ywg2ILysrFeKMaahhmHCv4pRIYM/Lw7ZWi/GYGHyktVbyurcX3QYD2jUa/sPGlZRcE+KMdVOD - lsylpcEzO4vvSiW2BwcBeuKkVIoXdG/YZoPJaoVhYYH/dc4XFd0Q4oy1U8N7AosFjsZGmEQi9AQGotXH - By9pvYX0Go3oH6zHwNtyuDrVkGfltzScvR7AD3hFDRy14A3hgtyTn5MHZMQ6C6O+FMs9WfAoFNDKWnYe - X1Yp+AFP6RyoqElJHhJaRTO5T5qIKjcXXZpmGGyFmJiTo/pmMdQN3TDdNtn1tU3n+CFcncnOvuWlg2J2 - uXgz9OWnV1awSSfTte2E8mstknJiEZecCqViEfJi9/Slo4tRQpyxyIyMcu6kfdDr0anTQWc2o294GDtu - NyxOO2IzY3E6PQEymwX5Sps7LsctZ+zZESHOWEhiYiU3gCsvHaY9jwdu4qRdpKRcQFKyCE8cRjTTWlRd - W9tJydQJIbpfAdHRd4Q8X9zreGiQWCxGfHw8P2iH/mxbtCOuV4j9Lr+wsCvHQkPr/nbc33/icHBwA38d - Hn6X1PlFRhbS9z3EGGM/AW7DE6lHSW6SAAAAAElFTkSuQmCC - - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAAsdJREFUOE9901lIVGEUB/CvRGixF18E60EwH1REqYd8CTRhFB3DbVIDCcM0lxZh - yHDUgUCsB0FsnsyGGCdsoWU0pTR3VGq0Wdx1XGbGcSYXCneb5d+515tRQQd+D/e753/ud+98w37VpfLy - RIlcnvs/aXL5aaH930qWyfK2XC5829vD8vY2bJubsGxswLy+ztP09oLrSSkrCxIi+/WFsepJxjBDTGSK - jBE9+UyGKyowarPhaWsruEoqLb3+xxCu2UqWySqxk3kyTrSkh4wtLeGhWn0gKDa2TIgzZqCGBbJEHN7e - gMcDc0AARun6E+kgUw4HP4TbCfc6Yqm0UIgzNkwN02SO2MLC8GNkBPacHOjouo+8J/OrqwdDuAGi4uIi - Ic7YADUYCfcqjrw82LKzsTM4iPGoKHyktSbyprsbnTodWgYG+A8bU1h4Q4gz1kkNg2QuORnu2Vl8V6mw - 098P0BMnpVK8pHtGqxUGiwW6hQX+17mQn39LiDPWQg0fCMxm2GtrYRCL0eXvjyYvL7yi9QbSrdejt78a - fe9KsNamgSL9akPNuZt+/IDX1MDRCN4SLsg9+QV5TEYss9APFWG5Kx1upRKDDxp3G6+olWA4zJ7ROVBT - k4o8IUpSTx6ROqLOykLHQD101lxMzClQfrsAmppOGO4abEOVdef5XXB1NiPjjocOimltjTdDX356ZQVb - dDLXdhxQfa1EfGY0YhKSoFIuQlHgnr58bDFCiDMWnppawp209qEhtGm10JpM6DEaset0wuywITotGmdS - YiG3miFrdzljMp0Kxp4fFeKMBcXFybgBXHnoMLncbjiJg3aRmHgR8QliNNr1qKe1iKrm5lN5UyeF6H75 - RUbeE/J8ca/jpkESiQQikYgftEt/tm3aEdcrxH6XT0jItePBwVV/O+HrO3EkMLCGvw4NvU+qfMLDc+n7 - HmKMsZ/XiRYLs2lecgAAAABJRU5ErkJggg== - - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAAwBJREFUOE+N0mtIU2EYB/B3qxCpoE9Z+CG1DDHtQgQS9iGDSFDwFhnUB8GaWZAu - L2FOw1UqmpULL0XZxjLFS5rOu07HaLg506biPZdtWqSWWmbo+fecOl2gD/XA78M57/N/ec97Hvazjqem - BpKz/7BDaP+7QpKTJZ9WVjC3vIx3nz/DtriI1wsLsM7Pf1et04HvCZXJ3IXIj+pm7OYgYxgho2SI9JMe - YiTmlBT02Wx4XFcHvoKTkqLI70345knyjrwnU+QVGSAm0kH67XYo1Opf3P39k4U4Y73UMEHsZHrdOoDj - YHVxwcs1DDWbGMqJ9n4mWgrT0VxwAx1FOYj32/Ukw41J8o6wAGam4DAZJzZvb3y1WDAVGYl2etbEhkJX - Xoy26nK0VVWgvboC+lqiqVgy1ZfO5+wX6dlzanxJ+E+Zlkhgi4jAksEAk68vjHlpuNr5BecbOcQ0cUjU - ckh7zqHeusINTUyvZnqJTKyNggYyHhyM1bExfFCp0H/3OlpkUpRFHcYdeTzy5VehvpkBZVYm7sll6DV3 - 4+37j6vJ20VGpqFwI4HViqncXPQGBKBVJkGXRo2uBiWM9Q9gbijCi2YVLB2lMJTehvaBHPPLHBe7RWxk - lRTmVQuqiC7nGt6Y/THY6AxLrSuhS322DX31WzGkz0dORhZGFrB6abO4k5XQHKgppCKPyEPSfkuOovST - 0Cvd8abDFfbO3Zgd88O0eSeG9XmoKszFEs3EaQexRfiZjO0PD0/g6OXozAwsujqcCwpBQpg3nmbvxbgp - iFZSMDt8FJOWEiT5eszFHfLRBjkyhRBnbE9YWCI/ac1dXTC1aFClcENhLEMBqcymyWxmKMsSw9J+HxEH - PZoiXZ0cAh3ZWiHOmPuxY1f4Dfga1LdirLcGfQYl+jvVGO1Rw/6qGMPdSkwOGBG+z02rkkaKzzozByHO - mJOPT5qQh0p2GYroaBTESOkEUuRdlEJxQYr8mDhknDqBA67OlUHrRaLQjX+cYIOX15n1np7p/4Pv/ZFi - 7BuU0iASw/TUhgAAAABJRU5ErkJggg== - - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJdSURBVDhPjZPdS5NhFMAP3rYudpF15QeogUwKusiE - dSGNHJTQWs3YCCabtnSsza2xtSkULZsaiH9ANy4ZQygvRBFi6EXzMqyLuhkFcyqj2qf7Pp3z4IYDpR74 - cXgfzvm95z3P84J6crKBe1NTt4mRf9Bx1+uFO243wGWFAvjhGKPZchl/Fwp4kMthLJPBn+k0/kilBB82 - N5FziE4hkEgk0NzeLmxHPEoXi5igwngyidFEAr/t7eHX3V38EothYHUVeXEe0SkETU1N0NzWBoNOJ2PK - kODj1hbOzc/jWjiML+fmcHl9XUgWFhfrdCqVnrqAOdfaCrfs9rFcqYR/qP1f2SxOU/FJnfDncC5IpdIH - JHHWuNDSsjBLRTOzs+gnpv1+fD0zg28DgQYJCwas1nGQy+VPotEonobP5xMxsLTU0AkPVmE2m0GlUpnj - 8TjqX+xjvyGCXQPLeFG5hte035H3vV6viO9XVhoGy6fTbzJZYHh4eCxJmycJeN/hcIi4vrEhZlKTHBwe - 4nWj0QoWi8VUpKmfBnUpYpjOvzZYlvA96dPrbeByuQbdbvdojXG73b+9vY0RJhJBg8GAnyh+3tnBFL21 - JkmR9KpOZwcqAo/HI3g8MQFXhoaeVumilCsVLBFanQ7zdKw5Ksjk83UJXzbOrQtMNhtcUqsZJ9+0UCiE - Go0GgxTvU3wXDDZIsiTlXCEYsVigS6ms8YwFvKrVar2TAv0fxzvhy8a5cFOjgfO9vcd5flQvFn9OhUUE - i4pEnmQFeuZc6NO+gY4bD+FsT49AIpMZz3R3v/ofJDKZ8S9oxY1XC8E7XAAAAABJRU5ErkJggg== - - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAu - IgAALiIBquLdkgAAAllJREFUOE91019IU2EYBvBHqoOnTs3NFroGcxelLWMVXkgRRRDioF1ZYUS6KHUm - jCjGTNlGRhGpWIrrD7TMgplSFgmuWlEzlC7qprKLLoKZEF1ITNMyt55vOpIxBz/2/Tnvs3ffx0E8Hk8B - YSUptIrk+bXU5+alWUwUV5BjwRHKJvEx0sYF0lIB4pcdjWZ0tljgm5vFPc7LIhHdeqMxb1qSpJhWq/3L - gLyUAGTQclpLp7++Q1cFEO6ug4/zVjo3NpZ70WDQTVqtpU3JusXFObSVDtIlekJPv39BoNWCCwzz+avh - YkDUYFD2pAZkUsnH5yh/dB62pmJ4HLnoFh3YVbh/djMudxxA44dncIoAnU7alS5gPx+0n9LD9eIaPDNT - eHwyG33ubbjFvQ6qIYter/upVks70wXsI0eNAvdxCc0cD9WqMRjqxB2Oz9A6ylSplEmz2VyQEpAIUZO4 - PrevHN6GQvTwL4zO/kGIa4eI1xsHb2HabrfnLwpIEB2oyEQu6qsvQK8NeMtrHOG8i4pJIwIcjlo+9z9A - FO8lJ135FcVNz3bcYHGozYrb1QrefPuEIe4NU7MsS78Dgd0lHK+mDBEgz0RR2l4GJ0/8Otvu9R1GO1vv - 4V7/Qy/6ufajfhOCgz4lqChybHxcFeReHWWldtBGV6mFKslGr0dfInRCwvujwIQsy7GGHaoHUxOJg9WI - gGSIaCmLxGGKb/ESrSERfpdGBgbwWZKWzYXD6lecJztI3sJSsII0lFNUtGXYZMqPVFUdG/X7K8WBizNI - V5Se1+vV0QYqJL6NcfwD7Csg08GXW4UAAAAASUVORK5CYII= - - - - False - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAINSURBVDhPjZJfSFNhGMbPfUnd2Z2BLWg4JpQ4Vwg2 - koQ2igxURBBcNdaSxXRsZYYXeeGVSGRXQTjc5ZSQvPBG9DYICgkvIuEsjVG5//+fnvfQzpFy2gcPh/N9 - z/M77/eeVwGg6c7kpJO6e4zO3Z6YUG6Fw8rNUEiTDuDBvUy5jJ+FAr5ns1DTaeykUviaTGpaWl+HeCjT - oQBu3k8Vi0gw+G1/H18SCXze3cWneBwfVRWRlRXaAPFRpn8ArmDQkybgRyZzKGRuYUGXqafnCaWIdMCN - QMCbLZXwi+XXg0glch3xUpIxANf9/gc59iCZyx0JEYB4KckYgGs+ny9PQDqfrwt5u7GB6OoqHF7vw86R - EcU2NGQArno8o8VKBVn2oR7kdSxGK9A2MDB2qb+/zexyGYBOt9tfIiDPPtQgKr/6YXsb7zY38WZ5GS+j - Uah7exqE4dAFp7NdB9iHhx+Vq1UUeI0aJMOZyPEpexWe/b3OOhxPdUD74GBATFJFDRJnBe+3thBbW8OL - SATT8/PYYSNlNXZ0TJ2x2y/rgIt9fePyjTIBByEHe/JsdlayOGW1Pj/d2nqFEKMH1t7eoBxWWUU9yKvF - RYRnZnCeg9TU1aU0d3cbAG4+FoCsoyAybOKlJGMAGm22KS39Z8l1pCfSWAHJL5Y5KfBdvJRkDMDJlhb3 - CbN5+n8k3gaLRWmwWJTfD6TTCWZqcZ4AAAAASUVORK5CYII= - - - - False - - - False - - - False - - - False - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAAfdJREFUOE+FkT1IW1EYhjM5ZZeCU9HJiDi5iCI6VFBRac1iHASNhlRqNWIwmKWt - U4fqIAgKglGSQRHUiAi28QcEKSr4Cw7JJSooSgj3kh+S1++7SY75Uy+83HN5v/PwnHM1AHLy2W5vovS8 - kuL02YyNqbTZbL1KLIbHcBh3igIpGISXsuLxgDtKSWo2ZzOnxWrtkyMRPMgybgIBXN/f4+z2Fo71daoB - 7ikqRN1AWhnKbaOjC2sHB1jZ38e5JAnI5Py8SHFDg00A3lJe3t3Fmc+XYcLdp4EBswC8p7xEoNM0iERz - 9WZzvwA0WiwmJRrFk6xkQNKVf8/NiY4ta4zGbwLAOiE6QiAUyoGklF3b26J7Ituqrq7vAsA6EQLIdAf5 - IKzs3NoSXZAAlQbDkACwTjQeh0JFPggrL25uqt2Pv48Yc/1DhV4/LACsE6NFmO4hH4SVHW632hmcfjRN - n6PCMusUANaJ0yJKx8iGjK160T5ziS/JtM9eYcoPlNo9/rKfRx0qIKmDGB0jG9I8+R8TEmA6BQzHLxm8 - AD5adw5VgK61dYQB/GRDBh0nqB/fSeSXR31X7gGFprXDD2Z3wqCoutqe2J54+Dh8J3yx/HcitE7OaKps - G9Dqp2+0nc4O/lYB2vLybq1ON/5maIZnC+osRwW1X//wGoDmGf2OAjpoA1ceAAAAAElFTkSuQmCC - - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAAi1JREFUOE+lk19IU2EYh8/VQBhEeBG7iFVELKJQmAgigSRIg0lFuZspREo5LdCh - FovRhf8giFbWYrSUSppCZDZx6cSYStbUlhJpK8p0XjgyaizmRJ/ON8UYBE068PA7L/x4Oc/h+yTgv0ga - TlqtepmzW0CftOC4xXJOzpQf0U9aoK+tNa3KL3k2KGiRC471PCHnmXYwueChH7qnQPREP2nB0aqqyuW1 - NZqe/8IxAq5xePAaOieg9SXcGQb/VwiGQfREP8m7sK7O5R4d5VhjDeV2Gw7PK9q8ftoH/dztW0+3f5rF - CERXVsivqLiwZW9nn5dv0Rjf43EOl5VVbXq/eZz+T0TP0jlAZzBOOBYju6TEvOkdeKLmfc9OZno38Kj5 - 6N3Fp8HdBPvViVn0zPe9OAOrLESjZBoMtZLwED6n83JoLs/m84CGOZ+G0MgBInMFrEQMLE3nMj+8P+Fd - /2KJi48GWVyOs0+ns0jCQ/jkqlToNBqsxkzarmjxtubwI1wtf3Q94S+lzPqyEt7FHSGymkd/7i29+nS7 - VlsqCQ/h03UtLUH39TSe2ZT02pVM9adjdc9S5Jzh1AZF9z5gD8Ghpsmxgw0BoyQ8hE9LtWKTW2YF9hoF - XbfTKLw5wY05+RC9g+K3fzBPw55LQ2OS8BA+85HIXzG3T5LfNLROoy+R2fIh22HqGVNV9hol4bEtI6Mh - VXIve1AaHAvKkg6j/IOSb2MqKI7UBBR55+XbImak38qMwNWohUA+AAAAAElFTkSuQmCC - - - - False - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAAr1JREFUOE+N01tIk2Ecx/HdiMS6EbQu8sLBvBGlQCXdRUIkKdiFtsCLeeGFmWXE - 0krNE4ZIUUQKXZiplcd5auk8zDTdcsPmPO6gttmm23zzgOAJT9uv/zv0BemiXviwh/H8v3sfeMYD4HWr - qOgGuf0PwpP9J7hFUn5++s7RETb297Gyuwvn9jYWt7Zg39z0kqtUYPfcLCgIPhUY5/FezVLnJ7GQOWIk - k+QH0RcWwuB0or67m/YDiXl5dwgX4bGbl8gKWSPL5BcxER0ZJkaXCxV1dZzg+Ph8LjBFG2zERRgfH8Dj - gVUgQJ+fHz4EBqIiKAgtCgWUWi0mbTbvcRKys+9xAT0NzpMF4gwLw87EBHpSUiC7ngBlaTlm5EqY7Azk - Ayq00DEs6+uIk0ozuYCGBqcJexQmPR1qiQRfZR0Ybh2Arq0P8980mHOsQm9h8J79fnwc1zIz73OBQRrU - koXERLitVsiLizGqmYHOzECl1KGnuh1DJheGjC6oDDbIurpwNSPjARdQ0HAfgd2O5fJyvImNxeCnL+it - 7sBoRz/M9AZWZgMG+xq+G5dQ09iIK2lpUi7QTsMs+bFif38oXrz1/vIsDZuIbXXTa8RgRadSCVFq6kMu - 0ET3oI4GP5Ja8ozPx8v4BPQ3dmNmYATmqVks0BvYfm/gXX0TNHo9Lksk2VzgZBGenPzYQwsjXZrXlZWo - aW7D/CKD9a09WOxONDTL0NrajgaZDOFiceFfgYti8RP6RP/YGDrValTU1uJuVhZycnNRWVWFHnr10rIy - 9PYO4lJMzOfo6OhzpwLBcXFP2QD7eOgyHbndOCT79P/YOzzE7sEBluhGFpWUQKudRkREhFQkEl3gAuej - okq808cPexw3GyJs6IDsUczmcIAfEKA2mx2IjIx8xAXOhoam8UNCyv7HGYEgx9fX97lQKEz6A0bGn34K - 6LnaAAAAAElFTkSuQmCC - - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAAjJJREFUOE+Fk0FIU3Ecx3cKhN08SNcwCLG6JA/kgYgbc85NRrqD6C6zLbacsZHD - 4RJhtUO3RnWqkx6kk1Ful0gmnXoLtRStIa3xGO3girHhNrdv/99/8tzzBf3hw//33vv9Pu/3/v//0wFQ - Iet0y4zXZyxffH4RJRhfWrIy3FJnZxrRKAiK6V4b3e3FhBLcjkQ8lWYTst0ORCKc7NgYsqUSZz2VAuUw - rv5TYA+H75ZrNfy02YBwmJOxWLCfz+OrLGN1Y4OlAZTHUCSKwBYKeSv1On5YrWjOz3MyIyPIFApcEl9Z - Ueg2mxc1Aksw6CPB0egoGoEAhzrIFYuKhDqhz6FcjcA0NzdbbTTwnb217vdzDs1mFFhBu4QElKsRGHw+ - f40t4gErqnm9nP3hYRyXyypJjl1TrkYw4PHcrzPBnsmEmtvN+WI0oliuqCR5FlOuRiC6XIFTFuywoqrL - xdk2GvDn5EQliW4eQ1x4ntYIBKcz2GRBemgIjZkZjjQ4iFK1qpJMr8kQnki/hfjRlEpwa3LyAQk2RRGf - WCHxgcUP32bheHmIiTMcr77hhQzciO1K1x9tTymCmxPjITbjjSAgl0wim0hgva8PtvhnPM0B3j1geuec - 4AFwZWFLUgTXrFZ2/FqDOmmwBa2zbQ2u7sIQ22rxOMVn4SPQ5X0nXb6XOO+gq7+f/jxlkISghaXdoS2m - cyIuJqF3PCvpnWvqNdD39t7p6OmJ/Y9LA7O/OkTn+1YddH8B7KTLCzNS/AAAAAAASUVORK5CYII= - - - - False - - - False - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAAQ9JREFUOE/lUDFqhFAU9Ao2CpZb5BLeQExnkaQQTLGumyA2CaigeAR7T2DpQWwC - ewILFUELEUHhxfkYIYteIBkY3vsz834x3B9BGIanIAiel3m+56qfkPM879H3fRPEzo4B13Vfqqr6oh1A - h4+caZrXeZ4JxM6OAcdxLhCnafrFLMtYGD5yiqLYy4f4lLCzY8CyrOs4jjQMw8Y0TSmOY4IOHzlJkp54 - nv8EsbNjwDCMt77vKUkS6rqOzSiK2A4d/hrdh6Zp723bkm3bG+u6ZoQOH7nDElVVtZumoaIoSNd1Nn8I - HT5yhyXKsvya5/kN5ZRluRFv6PCROyxxKeRBEISzKIof94QOf83tl/ivwXHfxSsWzwVUgTEAAAAASUVO - RK5CYII= - - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGKSURBVDhPpZNPi0FRGIff8gXkI9jYm42VlY2FQllM - s53MnyalqbGY9XyIKUkpaUhEEkldwzWN0VU0o6wkikRRJPrNeW/RTFnMNaeefqfznqfeczqHAPwL8ng8 - RsG5wKsRdozkdrsvarVau9frodv9QqfTQauloNFooF6vQ9RQrTJvYv4BWW7h/f0T+fxrm11yOp03xWIR - hUJBLOaRy+WQyWSQSqWQTCYRj8cRi8UQjUYRiUQQDocRCoUQDAah0+m8fIQrcZaTBrvkcrmud7sdzl6M - 2G63qFQqavt7uDvOwWCg1vewwy45HI7bzWaD9XqtCXbYJbvdfrdarSD5fVgul+odyLJ8oFwu/0pGURSw - wy7ZbDbfYrHAbDbTBDvsktVq9c/nc3ifgclkAkmSkE6n1fw5bzaban0PO+ySxWK5n06nGA6HmmCHXTKb - zQ/j8RiBQAD9fh+JREI8mqqapVLpQDabVZP3MOywSyaT6ZFbGo1GmmCHXTIYDJd6vf7pFNg9+sO0cHTx - 74C+Ae2m7hiEPU+bAAAAAElFTkSuQmCC - - - - False - - - False - - - False - - - False - - - False - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAADzSURBVDhPY/j//z9FGKsgKRirICkYqyApGEPAdvYz - EDa2n/viDDK2m/N8JrpaEMYQsJr+CISNA1Y8vznz6f//dRe+f54BpC2m3D+DrhaEMQQksrYyKFceZtBt - vdDqPvHE/6rb//9nHvv8Wa/9EvEGKJUfLNDvu3wz7Pz//84TTvwvu/X/P9BQ4gwQz9hcoNly4qbnqf// - FRqO35TM2d4KooEGE2cAb8zyM7bH//+XKttzky9uZQHIRULJ64xBGF0tCGMIcIYuMGYNmH2GLXBOAdAw - sJeAmsEYXS0IYxUkBWMVJAVjFSQFYxUkBWMVJB7/ZwAAMnjTFsqoud8AAAAASUVORK5CYII= - - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHuSURBVDhPpU/Ba9JxHBW8h/kn7CIddpEFHoYnY3j4 - hQpCm6dGrBUxiMCICuoQGZ2CLgMnCM6DSInDpXgowv1sU0JxDsN2kVDQRElBEe31ex/6eanDxr7wfu/3 - Pp/33u/7MwC4EAxer3dBw6qGjXOA/gUp8Hg8PlVVK/V6HbVaDcfHFZRKX1EoHCGfz+PgQEUu90XjgqZL - ODw8QTqdqzAnBS6X6042m0Umk9EWaaRSKSSTSSQSCcTjccRiMUSjUUQiEYTDYYRCIQSDQRiNxg39F25r - L/+cb9Uq9rQwmefH6Ymwfv7mDAa32705m80wnU7nqJbLWHe58NLvF6Yuf96b7+lnTgoURbk7mUwwHo8F - pWIRN1ZWEH31BKfFrDD1u503cw/9zEmB0+m8NxqNMBwOUVBVXF9exnYggNz2QwQcl4WpOeeePvqZkwKH - w7E1GAzQ6/VwbWlJrs0vf/+4i5/1I2Fqzrmnj37mpMBut9/v9/vodDqCT+9DmLTr+PB6C4+uXhKm5lz3 - 0M+cFNhstgfdbhfNZlOwv/sWv3+1sLN6BblnijA157qHfuakwGq1+tvtNhqNhuD52hpuLi7iqc+HdUUR - puZc99DPnBRYLJbHvFar1Toz6GdOCsxm8y2TyfTivGBOCvi4CP47PDtg+AP5hsNBK4PnIQAAAABJRU5E - rkJggg== - - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAIoSURBVDhPfdHtS1NxFAfwM9ifUD4UBK2gB3tRECW0 - rfLWYpFW1n0R5itBYgnS0HBQWDGQBmUNC1cUKcYoo16sIihBKqUHpRRBMNR8As1IK4uk9HS+p/sbEdWL - D/fcc7/fHz+4lEFEmSLL5aJssUgs/sUrbjm8uRkusleTXxQ6T7zTvw7wizs36usZMGN39eiu0Nz0KOMp - CP52wGaRul5Xx/0dDxVm7Cpt35VPQ685HsorFwR/HrBVPLhWW6vFgc5HCjN2B4JBvtt4kU8Vb6gQBL8f - YImWy7GYFprK8jjVmFCYscM327L4oH9lcseqTAoIc8B28fhCNKrB4a5WTtgefjU4pTBjh2/I7Pb5GB10 - cUBAtJ+rrtbAWM8ThdLgxBeF2eyRQRYddHHAi+Vud438ktKZkW4e721XuPbT1E2F2eyRQRYddGmh3GKb - J4uSxwsPfR3r4cm+5/+FDLLooEu5SxZQQ1UBhL6N9/LUQKdqazrDkU3ZCrPZI4MsOujSpXDQKJt994Y/ - D3ep+L4cflmzX2E2e2SQNT2KH7aM8u/v+/WKcD5/KbedLODus0V8P2yl98gga3p0usRrhOc+vOVZuSIk - 7BXcEglw67F8LvVQeo8MsqZHJ4rWG5Xz0yP8Y7JPNRSv4XtH/PwsulcO2ZneI4Os6VHFnhwjwjMTPP9x - VCVL1vHt0EaF2eyRQdb0aIv8CUdCdMBaudgyt7tZxBzN2JnvTlY6RD8Bq4z5p17q7ucAAAAASUVORK5C - YII= - - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAG6SURBVDhPnYxPKINxGMff3y5qBxclfy7UxkWtLGnv - amtTS69thx1QDmqlXdw4MAlJuUikjINycdhBNDcXB0nIxa4k9BYlOVjRy+P5/sxv795y8atPPb/v83m+ - GhFpTUI4cTcLkWa2yqSRORx5+1dBJtrRcTmZyZTG0ulS0Ou9ROZwKgUN/HFQGIzF3jP9/TScTFJc19+R - OZxKwUCbUAy2C61e04pnO7NUutiQYEaGnd1VBbm4S7GRcM211Na+fBS36e08J8GMDDu7qwrW+WNjPhuq - Ocbh6/GKBDMy7OyuKljrc1Wxari2Hg5mSk+HiwQwI3N6qgDPWye00W6hLfdKYvvjXcX7wiwBzMiwgwMX - r6rA8RoXesTJ3rRBADOyn1Xl/VUQZw6yyVbzdneKQDbRaiIr79RzFnQym8x5KpWioWSEno+WJJiRYVd2 - 4FYVDLjd7iuPx/NoGIaUw+Ew5fN5SSgUkhl2cODixl5wGggErGAwSNFoVMr8J8uyJJiRRSIRgqPruoUb - e8EdJF6oAr/fT6ZpSjD/FsCBixt7wQTzxbwxj8w1c+Xz+UYAz0Xmhnli4HwyE6rg/5D2DXLVhphIeTwb - AAAAAElFTkSuQmCC - - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJSSURBVDhPjZBdSFNhHIfPorvoootugm6SXSR4Y5GR - hgWGrk8NCvtYhGkyN8od19xyOKTFkuzDrJFkLmXLPlxOw036WDWpKILZGrNlUrnSyFCbc27T7df7ngvP - RhO6eOA5nP/7nPf8GQAcSwqr9xHk/wmdpWcYPrCnmjW8GARrfgbW5MCVp25YBkbQ4xlNwu77BTpLoGcS - AruVCjrQ9X4ExlefUNv5EiKtAfpOexIN3U+w8oDqXHqZmllbqkoI7FIqre7v6HgzxGF1/0BNey8mwmH8 - DIXgn57Gt0AA3U4nMiWnH+zVaISFanVCYOcptcXlh4l8nUKdbbbidzCI0akpDI+Pwzs2BrPNRsYBclhC - EPKBHYqae+9G0Nbv46AubbyPyZmZpEiTybSAUCTS8IHtVbV33n6FkSySQl1y8S7+zM7+E6E3ob9TIJfL - +EBBVZ359Re0OLwc1I83dCBIdpAq4ieeJ5Od4AP5rK6tfxjXH3k4qJfV30YoGk0ZoYvdUl5eyQe2yfWt - zz/jmv0DB/VjehPCc3MpI5ORCHJKSlg+kFd5vsUxhKZeNwf1o7p2zM3Pp4wEyHOWWKzgA1tPXmp+7MPl - ngEO6kfqbmE+FksZCRLPLC5WLgQEObIbhr6PuNDl4qB+WGtEPB5PGQkRzygqUvGBjRLNZpnBpWp1TjQ+ - 9OCqbRAHNTfJKyBOiNEQIUpiERKLEF+dm6vlA1kSeot8Qbb07Jr9Zyzieqt36fpD3uUZGfrFWJaWVpEc - yJYygk0V1NMFGyQywbpSHcMwqxaHWfEXhcCu4hm3kHoAAAAASUVORK5CYII= - - - - False - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAH0SURBVDhPjZLPSyJhGMftHB2D/oA8RAR7WCrCIPpl - ZmNIeOnQxVZDyULZhCEJIdg/YP8F99SpDtWt6FpB0W60rCyZiCCElM46M45+e543HWaYXdiBD+/MO9/n - M++87+MCIAjt7QlKPT1Z4qBDtjvfZSWTcQVl2ayzCiQictXff439fTB8z3MWBv8poBdRpdVCKRgEMhlB - YXkZhddXweHFBThDuP8qoMmNuq7jKRBAW5YFeb8f9+UyvpdK+HZ8TDGAc4S7W2cKAul0TGk28ShJaO3s - CPKLi8hXKkLyNZczcft8uw6BP5WK/yHB76UlGMmkgFdQrFZNCa+Ef4ezDoF3a2tTNQz8oq82EwnBT58P - lVrNJmEBZx2C2Xg8odEmPlCRHosJ7hcW8Fyv2yRFeuasQzAVjW7rJPjh9UKLRAR38/OoKopNUqZnzjoE - nnA42Wy3cUtFajgsuJmbw0ujYZM8qyo46xCMr62lWiS4npmBsb4uuJqeRo0KrJIXTQNnHYKPq6ufWXA+ - OYlLKmTOPB4oVGCV1KhXOOsQfAiF0jTiaGwMxdNTFE5OcDg6igYVWCXcbJ2sXTAkSTKNaNMqeCUGbahO - x6pRb1gl3GydrF0wMDGRpdG8WMLwxvLp8BFzn6g0drJ2Qd/IyKfe4eEv/wNn3+vgegOoFsiZQGyBOgAA - AABJRU5ErkJggg== - - - - False - - - False - - - False - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAI7SURBVDhPdY7dS5NhGMaf993YiTvZyf6E+gc66WAe - hH2CCmvLj2LilDbJF2NuiGNrljFzNVHLdqBkXxuOUjqwDMwoN93qICIpUGiLAkcE4gpJhu3quZ+a+A73 - wI/r4X6u+/e+TK/XM1mWVUiSxPg5xHGUpeoAYPsKSvwXdVLqdDpWVVUlOKXpZHbN8D+BwWBo4pKeSnCB - i5J6RqOREbS8KzCZTBez2SwqEQwGRVKPw2oVRS0wm81KLpdDa/93HGlP48CJaRw8+RyHz66B5n6/XyT1 - LN3dzBoIqAV2u/1CPp/fV0Bzj8cjMjw2tsKXzxN8+TrHKQRdXV0dhUIBlVAURWQimcSfYhFFvrUa+4lW - zVBYCHp7e+u8Xq+jxMRALDP/OIHldBpLqRTsbW0i36+s4Nf2Nn7v7ODD5A+0aG4MCwFfYj6fT+Cx9TGb - JnTz3XgOG7y8vrkJa2OjyBI0p3fqqQRuW4CdkweIyNvIN9wK30W9xYI7U1Mix6NRrG9t4UsmD3qn3q7A - bbvEmuWrJcaXRjN4MfixIvROPSFwVvtZg3x5L5Ovh9YweOY+rlnvqaBZqOEB3tz+CuoJgVX2l/OQvhJu - jmF5OYXFxYSA7jQbbXmE5MhnUE8ITsvecuIkoOLc3AJ6akYwMzMr7jSb6HiKV+FVUE8I6iWPijrJXV0r - uWb7jk9sTE/Pi1+Px5+B7pH2J4i6XmIh9AnUEYIm+Qqnn1lknxDwB3ZMctYclRxJrVYb2gvNSvDOKAD2 - FwTf/mk2rA8eAAAAAElFTkSuQmCC - - - - False - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGRSURBVDhPpZO/S4JRFIYv+A+IEbQEIZG0BNni5OTi - IKjgEK1hP4gggpagrabWpkw+kERSRBBF/HDJ/LQ0UVBS0MVBQxEFBUWUt+9cqElE7cLDeziXB+653MsA - /Atms9nUMvsy9gUhR82sVuuBJEmFSqWCcrmEYrGIfD6HTCaDVCoFeQ+JBPEu159IJvNIp78QibwVyGVm - s/lEFEVEo1G5GUE4HEYwGEQgEIDf74fX64XH44Hb7YbL5YIgCHA6nXA4HFAoFHYa4UieZalFLrNYLMeT - yQQf3xLG4zHPvRc1r2dBDrnMZDKdjkYj7Ho28JC75zkcDlGtVkGj0V38Eo/H/5IccpnRaDwbDAbo9/vY - eV7nOQ/kkMsMBsN5r9dDp9NZCHLIZXq9/qLb7UIshdFqtXhuC2u8ngU55DKdTnfZbrex9bSKu9cbnvV6 - HdlsFj6fj78Dylgs9kcoFAI55DKtVnvVbDZRq9Ww+bjCcx7IIZdpNJprOlKj0VgIcshlKpXqUKlU3i4D - uVN/2CJMbc4P2A8Zf+kAI/4jBAAAAABJRU5ErkJggg== - - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAAqtJREFUOE+F0ktIVFEABuABcVG5cxGICxeKIEpCmyEJRAtUnIWl4FawTDLK1EQb - FXugJdqgmzIzNYfx0UMFLTXNTGes8a0jMz6bdGbE1MInljN//7npjRbRhY9zH//57z2HqwAgicvLU9HF - //A9zB+ST86p1Unb+/v4treHlZ0d2La28GVzE9aNDUlzby9E5nxOjt9fBcMKRbGZPTM0SxYy0Sh9oqHc - XEzabNC2tTEPxGRnXyK5RCHCi7RCq+SgBZoiI70nk92OstpamV9kpFouGGPgM9lp2d0dcLlg9fHBJK8/ - UhdZlpelEvElYjnR6emX5YIhBqZpnmxBQfgxMQFHYiJGeP2B3tDC6qpcIgoiUlNT5AI9A+MklrKclARb - QgJ2DQZMhYbiLe+10KueHnSPjKBVr5c29kxKyhW5oJsBA83HxMA5N4fvNTXY7e8H+EZzejoa+Wx8cRGv - +/rwRKeDgV8Ylpx8VS5oZaCdYLXCUVqKsehovPPyQoubG17wflF4OCq1WmjKy+F0OlHX1ISM3Nz+rKys - B1LBS4aE5gNNJCaKNzfQvagorK+vob2zA0tLS+jq7oLdboNarS6XCur4H9QyWENVVEkV9Jhue3ggQ6VC - w/NGmM1mzHGJYqysrvoaEhJyXalUnpLWIZyMj7/h4sns2ppkhjt/v6wMw8PD0HPzZmasuJaWJo393CNx - Pzg4OFMuOBEbm8kRnYOD6DAaYZydRUV9PTTcl+qaZzCZ5uFwbEtjiaZ0zdfXV+3v739aLvCLiLgpCsTh - 4s+0zw37ScUlGoyNTeNplRYDA6N4+KhSuo6Li9cxyoUeFBxXKm+JyYeHWI6TRXfuFqCwsAh5+fmwWBzS - GB6lMoWFna1l5E+BR2DghWMBAQX/ctTbW3fE09MgRpH9PQ+KX6DEi0hG/YRhAAAAAElFTkSuQmCC - - - - False - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEPSURBVDhP5VAxaoRQFPQKNgqWW+QS3kBMZ5GkEEyxrpsg - NgmooHgEe09g6UFsAnsCCxVBCxFB4cX5GCGLXiAZGN77M/N+MdwfQRiGpyAInpd5vueqn5DzPO/R930T - xM6OAdd1X6qq+qIdQIePnGma13meCcTOjgHHcS4Qp2n6xSzLWBg+coqi2MuH+JSws2PAsqzrOI40DMPG - NE0pjmOCDh85SZKeeJ7/BLGzY8AwjLe+7ylJEuq6js0oitgOHf4a3Yemae9t25Jt2xvrumaEDh+5wxJV - VbWbpqGiKEjXdTZ/CB0+coclyrL8muf5DeWUZbkRb+jwkTsscSnkQRCEsyiKH/eEDn/N7Zf4r8Fx38Ur - Fs8FVIExAAAAAElFTkSuQmCC - - - - False - - - 17, 17 - - - 118, 17 - - - 275, 17 - - - 432, 17 - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIsSURBVDhPjZJNSFRxFMUviCvbB65cNAsFaRGERAspSBcT - ZFq4cKHgOEkNOfEocEYH2rRqY7vSiGmCKBIVkoIsMmyosDI/0EptijczDIPpfH/fzh3/8x4RDB34wbvv - nXPe/Oddquj8yMjpcx7PQDW6PJ5Dyv6vulwue7JQ4N/ZLEdSKdYTCf4Zj3MgFiszPT/P4jnrdltUZF8f - iW6uE/E38B1sgFXwGbwHi6OjvKLr/GB2lkVnhocv/FUi5l8gAqIgBLbBGvgAXoPVYJBv+XwGlrY2t4oT - LcHwAwRBuLaWuVTiQEMDr2B+B+bARjhcLpFfIsexatpFFSdahOEr2AJ6czPnlpc51N/PnzC/Ac/AdjRq - lEjBKafzkooTvYXhC5CjhO121vv6OO3381prK7/AvRkQ2tszSuSPPelwOFSc6CUMfrDV0cHFzU3e9Xo5 - vbDADPO6pvFjPIvii1RK5OucGBy8rOJET2F4DjgQ4NDYGC9Zrfyqvp5namr4Ce7fBzvJpFESSaf5uM3m - VHGiSRiEacUUkKC8+RGYALvYi0qJ7Mmx3t4rKk70EHvgg8kL7oG7YBzcAbfB3NAQx/DWSkksl+OjPT2a - ips60t19tYRFKRSLnAdZbGUmn+cUAolMxiiJYxavipk63Nl5TTathD2oVpLELF4VM2Vpb3dJgahaSQrX - 4lUxUwdbWq6rfFlynKIUASnKgQzKspjFq2KmDjQ12eoaG2/8D+LdTxH9AdGnGwl7PYKkAAAAAElFTkSu - QmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAALASURBVDhPXZLdS5NhGMafMxHxQKfOKSp44IHIFFQm - ky2YzIbivqUT5wd5oowOXAcOxD4OrMOQoqxsukjUlpaGmWROZ6m1fJ2taXMwQbNl4EH/wNVzP00SX/ix - i/v+XTcvL2Mmk4mZzWZmtVqZzWZjdrs9u7m5Wcuh53ISerS0I4dc6lD37IEUvtS4XK7e9fX17ePjYxwd - HQkor62tbff09PSSQ+75AykWi6XJ4/GMUuHr+Dg+ulxY1OkElLf57PDwAMPDw6PkUkccMBqNxAW+8Mbj - cSx3dEAyGPCL//7p7hYk2tuxWV8vdrHYHoaGhrzUoS5rbGyUO53Ovv39ON61OvDdZsPPtjZ80etx+lD+ - 4XDgm9EonN3dXXR1dfVRlxkMBt3S0vvw6qOH+FRXh6jVKgr+mppkHSLTLMIPBDQaBIYeYHZ2Jkxdptfr - W+i15jo7ETGZsKRSCWZKS5FIJBCNRvEkOxuPMzMFc0qlcIPBz6Au0+l0TkmS8KK6GtsNDZjngq+gAKNc - DgaDCIVCGMnIgDfJVFGRcAOBAKjLtFrtFRInKiuxUVuLqaws+Lg4zqFyLBYTmWbEK4VCuH6/H9RlarW6 - Q5K2MNXahmX+2vNcOmUyydnZa7lcuH7/CqjLVCrVxclJ387C4D28LC7Gem4uVrm4wKFvcHJyIjLNiOd5 - eZi/cxcej3eHuqyqqkphsdgGNjfDmDCa8TY/HyGZDCtcpjJBeYvzJidHOBsbWzCbLQPUZRUVFay8vNzQ - 33/TFwrt4WlDE55x+QMnnIQyzWgnSVH09d3wUYe6TKlUsrKystSSkpIWt/v6dCRyiMX7I/BecuC2Ik9A - mWaRyAHc7mvT5FKHuqcHWGFhYapcLjep1ZrBsbGZWDT6m/8H/kMz2pFDLnXOH2AymYylp6cXpKWl2TlX - ObeSULbTjhxy/x1Qsr+c8frHFzb/LgAAAABJRU5ErkJggg== - - - - 539, 17 - - - 677, 17 - - - 793, 17 - - - - AAABAAcAEBAAAAAAAABoBAAAdgAAACAgAAAAAAAAqAgAAN4EAABAQAAAAAAAAChCAACGDQAAwMAAAAAA - AAAoUgIArk8AABAQAAAAAAAAaAQAANahAgAgIAAAAAAAAKgQAAA+pgIAMDAAAAAAAACoJQAA5rYCACgA - AAAQAAAAIAAAAAEAIAAAAAAAAAQAACMuAAAjLgAAAAAAAAAAAAAAAAAAAAAAACwsDGUqKguHKioLhyoq - C4cxPCCNToRyqGzQydV049/kb9fR2lmfkbZCZlCcQWNLeH///xl///8LAAAAAAAAAAA4OBeC//////// - ///+////9P/+/8H+/v+7zP7//gj//7fb/f+O//7/pP/9/3DWz9V///+Kf///QQAAAAAAAAAASUkme/// - ///+////+P7+/+H9/f+s/v7/ldT///8A///dSP//f////4P4//+qlfDuorn/9X///50AAAAAAAAAAFRU - L3f+////x8/A/7bZzf+h8uz/iPr4/4ns////AP///wD//+BT/v/4FP///wD//7KZ//d///+yAAAAAAAA - AABYWDN2/P/+/9rw4v+t+PD/s+Hy/62r/v/fb/3//wD///8A////AP///wD//8du/v1////yf///iAAA - qI0AAKT/AACi/wMGov8dO7T/YKvi//sA/v//AP///wD///8A////AP///wD///gQ//+F9P//f///53// - /2oAAK7/AACu/wAAsf8CBLL/Fy+//1Ch4f9om+f/paX8/7VM8f//AP///wD///8A////AP//1VL+/X// - //N///+LAAC1/wAAuf/h4f//kpPn/09Y1P83XNH/U6Xk/3Hj9v+J7P///wD///8A///ZUfv/9xT///8A - //+7iP/3f///sgAAvv8AAMf/UVHe/93d/f+io/D/wcj3/9Lt//97zPH/ldT///8A///rQ/j/f////4P4 - //+sn/n0orn/83///5YAAMb/AADS/wAA1f9nZ+j/YWHl/8fH9/9FT9n/O3fb/4+5+f/3EP//lNr8/4j3 - 9f+f/Pf/fOXezn///4l///87AADN/wAA2v8AAN7/LS3l/9PT+v9kZOf/BgzR/yRI1P9Wrej/kfz6/5v5 - 9f+78Ob/3fTn/3WXeYB///8Zf///CwAA0f8AAOD/AADm/wUF6P/+/v//ICDh/wED1f8KFM3/GzfL/8nv - 5P/Q697/3efX//Dy4f90eFFtf///An///wEAANX/AADj/wAA6v8AAOz/AADn/wAA3/8AANb/AQLL/wIF - wv/k59b/o6WV/6SllP+kpJP/SUklfAAAAAAAAAAAAADOjQAA2P8AANv/AADc/wAA2f8AANX/AADQ/wAA - yv9+fs3/5eXU/7a2pf//////enpRaHp6USUAAAAAAAAAAAAAAAAAAAAAfX1TZ/z89f/5+e//9vbq//T0 - 5f/z8+L/8vLh//Ly4f/CwrH/fX1TZ319UyUAAAAAAAAAAAAAAAAAAAAAAAAAAH9/VU1/f1Vmf39VZn9/ - VWZ/f1Vmf39VZn9/VWZ/f1Vmf39VZn9/VSQAAAAAAAAAAAAAAAAAAAAA4Af//8AB4AfgAMAB4ADgAOAA - 4AAAAeAAAAAAAQAAAAAAAAAAAAEAAAADAAEABwADAAcABwAPAAfgHwAP///gHygAAAAgAAAAQAAAAAEA - CAAAAAAAAAQAACMuAAAjLgAAAAAAAAAAAAAAAAAA5+foAOXl5gDj4+QA4ODgAN7e3gDb29wA2dnbANfX - 2gDT09QAzc3QAMfHzwDBwckAtra8AK6usADV1dYA2trcANjY2gDR0dEA0M/QAM7O0QDLy88AurrEAKmo - sACsq68A0tLSAN3d3QDc3N0As7O2AN/f3wBCP+wAOjjdAIeG6ACMjO0AionrAIiI6QDJyc8AzMzQAP7Z - /gD98v0AUU7pAKSj5ACop+AAn57lAJOS7ACYl+kAZ2bgAOHh4QD+v/4A/lbUAPr6+gD8+/wATEnvAGVj - 4wCpqckA3t7fANbW2gB+feQAhYTcAFJQ5wD+xv4A/gT9AO/u7gD+5v0A9vX1ADQy1wBAPeYAqanXALi3 - wQA9O+AAnJviAG5t2ACioeQAX13jAP4a+AD+D/sAHx27ACUkwwAjIcEAWVmGAENCoAAyMLEAg4LZAElI - mgA9O6gAKCa2ACgnxQBwb90A/gf9AO3s6wAfHbcAWlqEAFpZggBWU3wAUlGQAP4u6wDx8fEAOzmsADo4 - rQA5NqwA/iLzAPLy8gALBhIALiy1ADYzqwBNTJYAqKi0AO/v8AD+BvwA+fn5AFZOcwCxsbQA/kHdAPX0 - 9AD+y8gA/szTAPDw8ADu7e0A7OrqAPj4+AD+w7kA/lgvAPf29QDz8/IA8fHwAL69ygD+MwAA/p6bAPv7 - +wD+rpsA/qmYAEhE8AB1dOIA9PPzAMXFzAD+y98A/jUDAPxiPAD+PAwA+Pf2AEpH8ADk5OUA/k4iAO3r - 6gBFQu8A5ubnAP5BEgD+NgQA6unpAP4/DwD+kKIA/rOgAFdU4gBPTOoA/sa/AP34/ABEQO8Ae3niAP7A - swBcWd8AVlPhAFRS4wBiYOQAeHbhAGtq2gDi4uIA////AP///wD///8A////AP///wD///8A////AP// - /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// - /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// - /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// - /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// - /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// - /wD///8A////AP///wD///8A////AP///wD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACUQBhoFHR0JJQYDA6UvBAUaGxsG - BwkMAAAAAAAAAAAACQF2j1l1ATajFo1ZWY92AQGRjaUdB4YAAAAAAAAAAAAIj3U+a2BZnYOfhll0az51 - j3YBkQMbJAAAAAAAAAAAAAd1dGB7cXsgoJ+kEGtlZXRrdXYBjQUlAAAAAAAAAAAXhgF7cUB6elmjHow6 - hhoBdVkvEgwMGQoAAAAAAAAAAICAC3t6i3dtbXd9oplHahwNHBdHn58WCgAAAAAAAAAznoJ1CXdAAwcP - bTICnyg0mKChg4MoKH0UAAAAAAAAAACaiocPGgGAmwFZgG0rSYZSnJ05IC0VLxMAAAAAAAAAAHN+iTOL - l4mCi0AzgI2YR5kqcXFla3YvFAAAAAAAJBFZj35+iZV+ljOLMzMzdyIeLHp6cWVrdgQUAAAAADM+eH+J - fn5+fokzeoAzMzNtQ4wli3pxdHWUHRQAAAAzc4mSfn5+fn6TcwEGMoCAgHpGHkhxQGVrWQEdCgAAAAAz - MzNzgn5+fn6OjwcdbTJtYDqQOWBgdT52kQUlAAAAAAAAADOHfoiBiYp5fBI+d4tgOYxXWY0SDwGNBiQA - AAAAAAAAAHN+f4AzcYGCcQF6emAgg4SFJicKBS8IhgAAAAAAAAAAeHltWWVAMjN6e3F7fH01DHEwMW0M - GyQUGw0AAAAAADNyc3RrdHR0dHR0dGs+dVl2YDw9MAEFdz8wYAAAAAAAbh0Fbxwcb28cHG9vb28WEAYd - Jj1KPzBwSzxxAAAAAGZnaGlpaWlpaWlpaWlpXmoQazMmPT1sPWwwbQAAAAAAVWFiYmJhYmNjYmJiYWFG - PzAxZD09PT09MGUAAAAAAABaWlpbWlpaXFtdWl5aWlI/MDFfPT09PT0wYBgAAAAAAExNTjpPUFFSQVJT - UlRVVlcqQDM/PT1YPT0wWRcAAAAAQUJCQzpELkNFRkcMSElCQkUTHSY9Sj8wMUs8LwAAAAA0NTUTNhEi - NzY4ORA2OjU1OxMaPD0wPgEzPzBAAAAAACghISkqKywqKi0sKiorISMuEy8wMTIlAAAAMwAAAAAAAB4f - ICEhISEiIiIjIyMgICQlBiYnBgAAAAAAAAAAAAAAAAAJBB0dBRobBgcRCA8ZFAwcAQUAAAAAAAAAAAAA - AAAAABkFGhsGBxEIDwkZExUMHBgMAAAAAAAAAAAAAAAAAAAADxARDwkSExQKFQsMFg4XGAAAAAAAAAAA - AAAAAAAAAAABAgMEBQYHCAkKCwwNDg4AAAAAAAAAAAAAAP/////8AAAP/AAAB/wAAAf8AAAH/AAAB/gA - AAf4AAAH8AAAB/gAAAf4AAAHwAAAB4AAAAcAAAAHgAAAB/AAAAf4AAAH+AAAAfAAAAHwAAAB4AAAA+AA - AAfgAAAD4AAAAeAAAAHgAAAB4AAAO/AAAH/8AAD//AAB//wAA//8AAf/KAAAAEAAAACAAAAAAQAgAAAA - AAAAQAAAIy4AACMuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAOzs7AS0tLQctLS0MLCwsDSwsLA0sLCwNLCwsDSwsLA0sLCwNLCwsDSws - LA0sLCwNLCwsDSwsLA0sLCwNLCwsDSwsLA0sLCwNLCwsDSwsLA0sLCwNLCwsDSwsLA0sLCwNLCwsDSws - LA0sLCwNLCwsDSwsLA0sLCwNLCwsDSwsLA0sLCwNLCwsDSwsLA0sLCwNLCwsDSwsLA0sLCwNLCwsDSws - LA0sLCwNLCwsDSwsLA0sLCwNLy8vCywsLAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAA7AAAAXQAAAGAAAABgAAAAYAAA - AGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAA - AGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYAAA - AGAAAABgAAAAYAAAAGAAAABgAAAAYAAAAGAAAABgAAAAYQAAAFIAAAAkJycnAwAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAwMYAwMDbQAA - AKsAAACyAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAA - ALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAA - ALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAAALIAAACYAAAAQC8v - LwUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAGBYWFoCjo6P0rKys9ampqfWrq6v1q6ur9aysrPWsrKz1ra2t9a2trfWurq71rq6u9a+v - r/Wurq71r6+v9a+vr/Wrq6v1q6ur9bCwsPW0tLT1tra29ba2tvW2trb1tbW19bW1tfW1tbX1tbW19bS0 - tPW0tLT1s7Oz9bKysvWysrL1srKy9bGxsfWwsLD1r6+v9bGxsfWysrL1sbGx9bGxsfWxsbH1sLCw9a+v - r/WsrKz1rq6u8JiYmMxEREQSAAAAAP///wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABcaGhqB2tra/+7u7v/t7e3/7+/v/+/v7//w8PD/8PDw//Ly - 8v/y8vL/8vLy//Pz8//z8/P/8/Pz//Hx8f/o6Of/2tjc/9TU1v/c293/5OXn//Dx8P/08/P/8/Pz//Pz - 8//z8/P/8vLy//Ly8v/x8fH/8PDw//Dw8P/v7+//7u7u/+7u7v/t7e3/7Ozs/+vr6//q6ur/6enp/+np - 6f/o6Oj/6Ojo/+fn5//l5eX/4uLi/+Li4v/GxsbvSUlJFgAAAAD///8BAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAXGRkZgdHR0f/l5eX/5OTk/+fn - 5//m5ub/5+fn/+jo6P/p6en/6urq/+rq6v/q6ur/6urq/+rq6v/j4+P/zczM/7e5rP+pqKT/tbit/8rK - xf/a2Nz/6Ojo/+rq6v/q6ur/6+vr/+rq6v/p6en/6Ojo/+jo6P/o6Oj/5+fn/+bm5v/l5eX/5OTk/+Tk - 5P/k5OT/4+Pj/+Hh4f/i4uL/4eHh/+Dg4P/e3t7/3Nzc/9nZ2f7Z2dn/v7+/6klJSRgAAAAA////AQAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFxkZ - GYHU1NT/6urq/+jo6P/r6+v/7e3t/+3t7f/t7e3/7e3t/+7u7v/v7+//7+/v/+/v7//u7u7/4N/g/8HD - vf9racT/UEvd/2pnzf+pqLX/zs/I/+Hh4//s7e3/7+/v/+/v7//v7+//7u7u/+7u7v/t7e3/7e3t/+zs - 7P/r6+v/6+vr/+rq6v/p6en/6Ojo/+fn5//m5ub/5+fn/+Xl5f/k5OT/4+Pj/+Dg4P/c3Nz+3Nzc/8PD - w+tJSUkZAAAAAP///wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAABcZGRmB1tbW/+zs7P/r6+v/7e3t/+7u7v/u7u7/7+/v/+/v7//w8PD/8fHx//Hx - 8f/x8fL/8PDy/+jo3v+UlNP/ODT3/0M9//9IQP//WVTo/6ysvP/Y2dL/5ufp//Dw7//x8fH/8PDw//Dw - 8P/v7+//8PDw/+/v7//v7+//7u7u/+3t7f/s7Oz/7Ozs/+rq6v/p6en/6enp/+jo6P/n5+f/5eXl/+Xl - 5f/i4uL/3t7e/t7e3v/ExMTsSEhIGQAAAAD///8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAXGRkZgdfX1//t7e3/7Ozs/+7u7v/v7+//7+/v//Dw - 8P/x8fH/8fHx//Pz8//z8/P/8/Pz//Hx8//w8OX/i4rk/1NS+/9IR9v/Skri/0hB//9VUef/sbO7/97e - 2v/r6+3/8vHx//Pz8//y8vL/8fHx//Hx8f/x8fH/8PDw/+/v7//u7u7/7u7u/+3t7f/s7Oz/6+vr/+vr - 6//p6en/6Ojo/+fn5//m5ub/4+Pj/9/f3/7f39//x8fH7kpKShwAAAAA////AQAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEBGBoaGoLY2Nj/7e3t/+3t - 7f/w8PD/8fHx//Hx8f/y8vL/8/Pz//Pz8//09PT/9PT0//X19f/y8vT//Pzu/42N7P8oIv//XFzb/46Q - ov9HRez/SED//2Jg2f/HyL//5eTm//Ly8v/09PT/9PT0//Pz8//y8vL/8vLy//Ly8v/x8fH/8PDw/+/v - 7//v7+//7u7u/+3t7f/r6+v/6+vr/+rq6v/p6en/6Ojo/+Xl5f/h4eH+4eHh/8jIyO5KSkocAAAAAP// - /wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzMzMAQAA - ABcWFhZ+3d3d//Hx8f/t7e3/8fHx//Ly8v/z8/P/9PT0//X19f/09PT/9fX1//b29v/39/f/9fT2//z8 - 9P/My/L/My/4/zQu/v9pZ8v/eXqy/1JO9/9HQP7/hYXC/9bVyv/n5un/8PDw//T09P/19fX/8/Pz//T0 - 9P/09PT/8/Pz//Ly8v/x8fH/8PDw/+/v7//u7u7/7e3t/+zs7P/q6uv/6Ojo/+fn5//k5OT/4eHh/uHh - 4f/JycnvSkpKHQAAAAD///8CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAA////AQAAAAATExMaMzMzksnJyf/q6ur/8vLy//Ly8v/09PT/9PT0//X19f/29vb/9vb2//b2 - 9v/39/f/9/f3//b29v/19fj////0/6Sk8/81MfT/NDH8/1ZU3P9PTuH/UU79/0xG7f+hoq7/zMzJ/9zd - 3v/n5+f/7+/v//Ly8//z8/P/9vb2//X19f/z8/P/8vLy//Dx8P/v7u7/6+vr/+fn5//g4OD/2dna/9PT - 1P/V1db/19fX/9ra2v7h4eH/y8vL8UtLSx8AAAAA////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC5ubkJnZ2dlr69vfG6ubn/srKy/+Pj4//29vb/9PT0//X1 - 9f/29vb/9/f3//f39//39/f/+Pj4//j4+P/4+Pj/+Pj4//f2+f////b/v774/09L9P8zLfr/MCz5/05L - 9v9RSv//X1zC/6OjlP+1tLb/wsLG/9LS0//c3d3/5eXl/+vr6//t7e3/7+/v//Dw8P/s7Oz/4uLj/9jX - 2f/My8//w8PF/7q6uP+4uLP/uLiz/769v//KzM3+3t7d/8zLy/FLS0sfAAAAAP///wIAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wIAAAAAw8PDhf///////////////9jY - 2P+vr6//7e3t//j4+P/29vb/9/f3//f39//39/f/+Pj4//n5+f/5+fn/+fn5//j5+f/6+fn/+fj7//// - +f/l5vr/hIT1/0VA9/85Nff/WVT4/0pE9/9nZqD/lpiQ/66uov+3trD/u7u7/8LCxf/IyMr/0tLU/9bW - 1//X1tf/z87Q/7y+wP+ysav/qKmb/56gl/+Skpz/ioqc/4eImf+jpKH/wMC5/tfW2f/MzMzyTExLIAAA - AAD///8CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3NvcGPz8 - /PT////+/vr5/v//////////xcXF/8DAwP/5+fn/+Pj4//j4+P/5+fn/+Pj4//n5+f/5+fn/+/v7//7+ - /v///////P38//r6+v/59/z////5////+//W1/j/dXT0/0ZE9/9aVPz/OjT7/0ZD2/9wbsb/kpS2/62u - rP+0taj/s7On/62upf+qqqb/qamo/6Wmnf+Yloz/c3SV/1pYsv9GQtj/OTTw/zs48f85NvD/Skbd/6+w - wP7Z2tb/zM3N9ExMTCIAAAAA////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAD///8CAAAAAPPz8zP9/Pz///////9uSv//yLr///////r5+P+wsLD/2dnZ//z8/P/4+Pj/+fn5//n5 - +f/9/f3//v7+//f39//p6en/4eHh//Hx8f/9/v3//Pv7//n6+v/6+fv////7////8P+Njuv/Ukz2/1BI - /f8/Of7/QDj//zw39v9QT+X/amfU/3Z5vf94eqH/goGN/4mLif9zcZ7/R0TN/zo09f9IQ///UlH8/2Bd - 8v9VU/D/RUH6/zcz/v+Xl9z+5ufa/8vLzvNNTUwiAAAAAP///wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAA////AgAAAADo5+ct+/r6////////Viz//0og///49v//////4+Pj/6+v - r//w8PD//f39//7+/v/8/Pz/7u7u/9nZ2f/Ozs7/zMvL/8PDw/+wsLD/3d3d//7////7+/v/+/v8//n5 - /P/7/Pf/4ODs/11b8v9TSvv/T0rz/3Bu6/9hWPv/SUH+/z43//8+OP//Qj70/zQw6v8yLeX/Qj34/1JO - /v9YVfv/Pz71/0JC5/9QUeD/RUPo/0dA+/9aVPf/v77h/+np4P/Nzs/1TU1NJAAAAAD///8CAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wIAAAAA6ejoIfz6+fj//////3dV//8Z - AP//knX////////////Gxsb/vr6+//Pz8//i4uL/0dHR/9LS0v/k4uH/+fb2////////////5eXl/7a2 - tv/y8vL//v7+//z8/P/9/f3/+Pr8///+8f+amez/TUr4/1FK+P+jpcn/zc7c/6ys6f+Df+P/ambi/0dB - /f83MP//Qz///0NA+/82Mvj/Pzj4/0M++f9KQ/v/T0f9/19V/v+Oh/j/yMjq/+fp4v/k4+X/z8/P901N - TSUAAAAA////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8BAAAAAPj4 - +Bj++/vu//////+CYv7/JwH//zAD///Owf//////+vn5/7S0tP/Ix8f/3t3d//Lv7/////////////// - ////9fP//vn3///////T09P/29vb///////8/Pz//f39//z7/f/9/fr/3N3r/11c8f9MRf//bGfk/83P - wv/S0Mf/vb2o/2Bdz/81MP7/Tk32/4iG8v+rqvT/oJ34/6Gg+P+kovf/qqj1/7a19v/MzfD/7e7s/+/w - 6v/j4+T/5OTk/87OzvZNTU0mAAAAAP///wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/v7+Af// - /wH///8C////A////wH///8J//794v//////kHP+/yYA//8vAf//UCb///b0///////59vX//Pr5//// - ///////////////Owf//gmX//0Ma///c0///////6Obm/+rq6v///////f39//39/f/9/f3/+/v+//39 - 8f+Uk+n/Tkn3/0tF+P+RkbD/qaud/11Y0v88OP//Wlb4/5ub8//3+fL////2////9f////X//P3z//v8 - 8P/6+/D/9ffv/+3t7v/p6Or/5OXk/+Pj4//Ozs75TU1NKAAAAAD///8CAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAA////AgAAAAAAAAAAAAAAAAAAAAAAAAAAs7OzEfr29dz//////56F/v8kAP//Ogj//yUA//+M - bv//////////////////6eT//6WR//9bNv//MQD//xkA//+dhP///////////+zs7P/5+fn//v7+//z8 - /P/9/f3//Pz8//z8/f/9/vr/1dPo/1pZ8f9MQv//YGC+/1tYw/88Nv//XVn2/7W07v////f/+fj3//T0 - 9//19Pb/9PP1//Lx8//x8PP/8O/x/+/u8P/t7e3/6urp/+Tk5P/j4+P/zs7O+k1NTSkAAAAA////AgAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADGxsYEq6urHKGhoT6ZmZlsn5+fl6ysrMHy7+35//39//+p - lP//JwD//zYE//80A///LQD//8O0///Lv///d1n//z0Q//8mAP//LgD//yYA//+Xff////////////f2 - 9v/29vb///////39/f/9/f3//f39//z8/P/8/f3/+/v9//j47f+Cguv/TUj6/zw3+P82MPv/U0/5/6Cd - 7/////T/9/f5//j4+P/49/f/9vb3//X19f/09PT/8/Pz//Hx8v/w8PD/7e3t/+rq6v/l5eX/4uLi/87O - zvpNTU0pAAAAAP///wIAAAAAAAAAAAAAAAAAAAAA////AQAAAACdnZ1Op6enrLu6utrQz87y5uPj//bz - 8v//////////////////xrf//ykA//81Av//NAH//zEA//83BP//LwD//yYA//8xAP//Ogj//yYA//+G - aP////////7+//j39//19fX//v7+//39/f/+/v7///////7+/v/9/f3//fz9//z8/P/+/vf/vLzj/05K - 8v9KQ/3/Qj76/31+6v/y8+3/+fj4//n5+f/5+Pj/9/f3//b29v/19fX/9PPz//Ly8v/x8fH/7+/v/+zs - 7P/p6en/5OTk/+Li4v/Pz8/8Tk5OKwAAAAD///8CAAAAAAAAAAAAAAAAAAAAAAAAAACxsbFy7e3t+f/+ - /f/////////////////////9/////v/v6///0sf//4tu//8uAP//NAL//zMA//80AP//MgD//zQB//82 - A///NwT//yQA//94Vv/////////+//n4+P/09PT//v7+//39/f/8/Pz//f39//39/f/9/f3//Pz8//z8 - /P/9/f3/+fn5/97f3f9hYuf/TEb8/0NA9v/Bw9b/9/by//j4+v/5+fj/+Pj4//f39//29vb/9fX1//Pz - 8//y8vL/8fHx/+/v7//s7Oz/6enp/+Pj4//h4eH/zs7O/E5OTiwAAAAA////AgAAAAAAAAAAAAAAAAAA - AADj4+Mi+fn59v/////////8//79/v7h2f7+uKf//45y//9kPf//RBb//y4A//8qAP//NAD//zMA//8z - AP//MwD//zQB//8zAP//NQL//ygA//9pRP//+/r///////38/P/z8/P//f39//39/f/9/f3//f39//z8 - /P/8/Pz//Pz8//39/f/9/P3//f38//f2+f/j5Nf/fHvR/0pE+/9OSPX/v8LS//bz8v/4+fn/+Pj5//f3 - 9//39/f/9vb2//T09P/y8vL/8fHx//Dw8P/u7u7/6+vr/+jo6P/i4uL/4eHh/8/Pz/1OTk4sAAAAAP// - /wIAAAAAAAAAAAAAAAAAAAAA////XP//////+vn8/35d//88Ef//KwD//yMA//8lAP//LAD//zIA//82 - A///NgP//zMA//8zAP//MwD//zMA//8zAP//NQL//y0A//9VLP//+/r///////j39//Cw8P/8PDw//// - ///7+/v//Pz8//z8/P/8/Pz//f39//z8/P/8/Pz//fz9//z9/P/z8/b/39/Q/1pZ2P8+Ovv/R0L7/5WS - 3//y9Of/9vX4//j4+P/4+Pj/9vb2//X19f/09PT/8vLy//Dw8P/v7+//7e3t/+vr6//n5+f/4uLi/+Dg - 4P/Pz8//T09PLgAAAAD///8CAAAAAAAAAAAAAAAAAAAAAP///0T///////39+/++rvz/jHH+/2lE//9K - H///NAH//ykA//8nAP//KwD//zEA//8zAP//MwD//zMA//8zAP//MwD//zQB//8xAf//PhT//8y+//// - ///9+/v/xcXF/7e3t//39/f//f39//v7+//8/Pz/+/v7//z8/P/8/Pz/+/v7//z8/P/6+/z/7+/v/9DQ - y/9BPur/PDb9/0lE+v9xben/6uvf//b1+P/39/f/9/f3//X19f/09PT/8/Pz//Ly8v/w8PD/7u7u/+3t - 7f/r6+v/5+fn/+Li4v/g4OD/z8/P/k9PTy8AAAAA////AgAAAAAAAAAAAAAAAAAAAAD///8G////v/// - ////////////////////9PL9/9fN+/+smP3/gmX//1oy//89Df//MgD//zMA//8zAP//MwD//zUC//81 - Av//NQH//y0A//84Df//1cr////////////AwMD/vLy8//n5+f/9/f3/+/v7//v7+//8/Pz/+/v7//r6 - +v/7+/v/+Pn6/+/u6v+6vcv/PTnz/0RA+P9MR/v/WVTw/9jb3f/39vX/9vb3//X19f/09PT/8/Pz//Pz - 8//w8PD/7+/v/+3t7f/s7Oz/6urq/+fn5//h4eH/4ODg/87Ozv9PT08wAAAAAP///wIAAAAAAAAAAAAA - AAAAAAAAAAAAAP///wr///9q//39sv/8+93//v7/////////////////////////////t6X//ysA//81 - Av//MwD//zUB//8sAP//KwD//zUC//85Bv//LgD//0EX///g1/////////39/7u7u//AwMD/+fn5//v7 - +//6+vr/+/v7//r6+v/6+vr/+vr6//j4+v/w8Of/q6rR/z45+f88PPf/SUf3/0tF+v/HyN7/9vbx//X1 - 9v/29vb/8fHx/+/v7//z8/P/8PDw/+7u7v/s7Oz/6+vr/+np6f/m5ub/4ODg/9/f3//Ozs7/UFBQMgAA - AAD///8CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8H////K////lz//v2Q//z7xf/6 - +ff//////7mo//8pAP//NQP//zUB//8rAP//XjX//1ow//8pAP//JgD//zQA//8uAP//TCP//+nj//// - ///8+/v/tbW1/8nJyf/7+/v/+vr6//r6+v/6+vr/+fn5//n5+v/49/n/8fHm/6Sj0/86Nv3/QUHs/0lF - 9P9CPfr/urnd//f38P/y8vP/2dnZ/8fHx/+2trb/w8PD/+vr6//t7e3/6+vr/+np6f/n5+f/5eXl/9/f - 3//e3t7/zc3N/1BQUDIAAAAA////AgAAAAAAAAAAAAAAAAAAAAAAAAAA////Af///wT///8BAAAAAAAA - AAAAAAAAAAAAAAAAAADz8O/S//////+mj/3/JgD//zgF//8vAf//Qhb///Ds///8+///wbL//3hY//88 - D///KQD//yAA//9VLv//8+////////f29v+ysrL/5eXl//z8/P/4+Pj/+Pj4//j4+P/4+Pj/9/b4//Lz - 5/+npdj/NzL+/0pJ3f9NSuv/Ozb8/7S04//49+7/5ubo/+3t7f/28/b/7uzu/7+/v/+7u7v/6+vr/+rq - 6v/o6Oj/5ubm/+Pj4//e3t7/3Nzc/8zMzP9QUFAzAAAAAP7+/gMAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAP///wH///8C////Bf///wT29vYH/Pj33f//////mX/+/yQA//85B///KAD//72s//// - ////////////////////6eT//6SP//9eN///IQD//1Qq///w7f//////2NfX/9jY2P/8/Pz/9/f3//f3 - 9//39/f/+Pj3//b3+f/09ej/qqra/zMv//9QT9f/TErm/zcz/v+6uuf/+Pjt//n5+/////////////// - ///+/v7/tLS0/8nJyf/s7Oz/5ubm/+Xl5f/h4eH/3Nzc/9ra2v/Jycn/UFBQNgAAAAAAAAAAAAAAAP// - /wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wEAAAAA6enpEvv49+j//////4tt//8o - AP//KQD//3xa/////////v3/9PLy//36+v///v3//////////////////9DE//+BZP//4dn//////+Xj - 4//k5OT/+vr6//b29v/29vb/9vb2//b29v/29fb/9/bu/7i45P88Nfz/SEbq/0hG7v8+OPr/zc3p//X3 - 7/////////////+J///+4v7//////+3r7f+qqqr/2tra/+fn5//k5OT/4ODg/9ra2v/W1tb/ycnJ/05O - Ti4AAAAAxMTEDgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8CAAAAAOPj - 4xz6+Pfz//////9+Xf//IgH//0cb///v6///////9PLy/+bm5v/29vb/9/f3//v6+v///Pv///////// - ///////////////////u7u7/8/Pz//b29v/29vb/9fX1//T09P/19fb/8/P0//T28f/a2u3/NTH4/zg1 - +v9HQ/b/aGjx/+/w6//x8PD/////////////Hf///03/////////////0M/Q/7Kysv/k5OT/4+Pj/+Dg - 4P/b29v/0dHR/729vf+NjY2FoaGhn6GhocaRkZGWq6urJQAAAAD///8BAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAA/v7+AgAAAADb2tom+vj4/f//////cU7//x8A///Bsf///////fv6/+Tl5f/09PT/9PT0//Pz - 8//z8/P/9PT0//j39//8+vr///z7//7+/v/4+Pj/8/Pz//X19f/19fX/9fX1//T09P/z8/P/8/Pz//P0 - 8//w8PH/+Pfx/5OS9f9WU/f/g4L1/9rZ7v/w8ev/7+/w///9/////////03///8A////rP////////79 - /v+1trX/w8PD/+Xl5f/V1dX/wsLC/7y8vP/Lysv/6ebp//r3+v/4+Pj/0dHR/5WVlazAwMAJAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wP///8B//7+M/z7+////////0oc//91Uf////////79/+np - 6P/t7e3/9PT0//Ly8v/y8vL/8vLy//Ly8v/x8fH/8vLy//Pz8//z8/P/8vLy//Pz8//y8vL/8/Pz//Pz - 8//y8vL/8fHx//Hx8f/y8vL/8vLy/+/v8P/4+e7/7u/v//T17v/x8uz/6+vt/+7t7f/+/P7///////9d - ////Af///xn////p////////7ezt/6ioqP+/v7//ycnJ/93b3f/28/b////////////////9/////f// - //7CwsLyl5eXQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADc3NwBAAAAAJqamjL//////f39/v6j - jf/+6+b///7+//Tz8//m5ub/9fX1//Pz8//z8/P/8/Pz//Pz8//y8vL/8vLy//Ly8v/y8vL/8vLy//Pz - 8//z8/P/8vLy//Pz8//z8/P/8vLy//Hx8f/x8fH/8fHx//Dw8P/v8O//7u3v/+/u7v/r6+z/6+rs/+rq - 6v/p6ur//fn+////////bf///wD///8A////VP/////////////k4+T/6ufq///+///////////////4 - ///+tv7//1z///7V/v/+/v7+4N7g86CgoDkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgYGCQAA - ABoGBgYv6enq3v/////////////////////Y2Nn/3d3e/9/f4P/e3t//3t7f/97e3//e3t//3t7f/9/e - 3//f3+D/39/g/9/f3//f3+D/397f/97e3//e3t//3t7f/93d3v/d3d7/3d3e/9zc3f/c3N3/4ODg/+bm - 5//r6+z/7e3t/+3t7f/s7Oz/6urq//z4/P///////3////8A////B////wD///+m//////////////// - /////////tn+//+C////LP///wD///85///+7/79/////8/Pz8Ourq4IAAAAAAAAAAAAAAAAAAAAAAAA - AABLS0sBAAAAFAICA0UFBQZ1AAAAgTAxLJ2/wLvl6OXh9urp5f+3t7P/nZ2Z/6Kinv+hoZ3/oaKd/6Gi - nf+goZz/oKCc/6CgnP+goZz/oaGc/6ChnP+goZz/oaGd/6Ghnf+goZz/oKGc/5+gm/+fn5v/n5+b/5+f - m/+fn5v/oKCc/6Skov+0tLT/0dHR/93d3f/W1tb/y8vL/8HBwf/07/T///////+Q////AP///wX///8C - ////E////+f///72/v//qf///0////8J////AP///wD///88////9//+//////b29vS3t7c6AAAAAP// - /wIAAAAAAAAAAAAAAAAAAAAAAAAADAYGB0oAAACTBAUAthERG8wPDSDPEA8hzCsrPttXWGz9W1pu/1xc - b/9dXXD/XV1w/11dcP9dXXD/XF1w/1xdcP9bXG//XFxv/1tcb/9cXG//XFxv/1xcb/9cXG//XFxv/1xc - b/9cXG//XFxv/1tbb/9bW2//XF1v/1pbbv9mZ3H/iomJ/6qrqv/CwcL/zs3O/9rX2v/s6Oz//ff9//// - ////qf///wD///8D////Af///wD///8v////KP///wD///8A////Af///wD///8t////6////////vv6 - +/q9vb1RAAAAAP///wIAAAAAAAAAAAAAAAAAAAAAAAAAAAICAiQDAwF7DAsTwSMgdvE2NKf/REGz/0RB - s/89Oar/PTmq/z07qv88Oqv/PDur/zw6q/88Oqv/PDqr/z06qv89Oqr/PDqq/zw6qv88Oqr/PDqq/zw6 - qv88Oqv/PDqq/zw6qv88Oqr/PDqr/zw6q/88Oqv/Pjur/zg1qv9TUKr/t7bL/+fl5//18fb///7///// - /////////////////////v///6D///8A////Av///wD///8B////AP///wD///8C////Bv///wD///8f - ////4f////////37/f+6urphAAAAAP///wMAAAAAAAAAAAAAAAAAAAAAAAAAAHt7fAEAAAA0CgoKliQh - hfU9OsP/V1fB/1pZwP9cWcL/XlvD/15dxv9eXcf/XVzD/11aw/9cW8L/XFvD/11bwv9eXMX/X13H/2Bc - x/9gXMb/X13H/15cxP9eWsL/XlrD/15cxP9fXMf/XVzE/1xcwv9dW8P/XlvD/1xaw/9hXsP/5OTz//// - ////////////////////6f///sL+//+O////Wv///yn///8I////AP///wD///8A////AP///wL///8C - ////Av///wD///8U////1P///////v////vGxsZxAAAAAP///wMAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAB+foADAAAANCAgQLQkILj/MC6z/i0qs/8sKbP/LSqy/y0qs/8nIqD/JSCd/yopsP8sKrP/LCqz/ywq - s/8sK7T/KCao/yMgl/8jH5n/IiCY/yIfnf8nI6z/LSu2/y4qtf8pJaf/Ix+a/ysoq/8sKrX/LSm1/zAt - tP8hHrD/cG7L///////8+P7//p/+//9l////OP///xX///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////Af///wH///8Y////yf///////vz7/P+/v7/BAAAAAP///wL9/f0CAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAfn6ABAAAADQnJlfAFRK9/w8Lr/0QDrL/EA6y/xEPs/8NCqr/Pj54/0xN - bP8UEKD/EAy0/xAOsP8RDrH/DAmx/yooiP9TVGj/UU9m/09PZf9JSGX/Kipr/w0Llf8NCbP/LSuE/1NU - aP8ZGJL/Dwq0/xEOr/8TEbL/AgCt/2Vjzv//////+/b///9m////Gf///wD///8A////AP///wD///8A - ////Av///wP///8A////AP///wD///8A////AP///wL///8A////Kf////P////////6+fr/sLCw8ZSU - lHMAAAAA////AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH5+gAQAAAA1JCJawBYTx/8QDrb9EA+7/xAP - uv8QELv/DQq3/21slP+Gh4n/Gxm3/xEQw/8VE7//FxK6/woHu/9DQqD/k5OH/4uKmf+SlaD/k5SY/4+P - g/9DQ3r/AgCt/0xLnf+UlIL/KCan/w8MwP8TErz/EhK7/wwMuv8iIb//7u77/////////////v////3f - /v//tP///33///9H////Hv///wD///8A////AP///wD///8A////AP///wH///8A////Av///wD///85 - ////9P////////f29/+srKz2mJiYZgAAAAD///8BAAAAAAAAAAAAAAAAAAAAAAAAAAB+foEEAAAANSQj - X8IdGtP/HBvD/Rwbxf8cG8X/HhzH/xcVxP93dqT/jY+a/xUUof8MDKT/Dw2t/xsaxf8XFMr/TUuw/6Gh - l/9TUr7/RUHX/1NR1f+Hhqz/lJWT/xgWqv9SUK3/oqCV/ygnr/8QDb7/FBS9/xkYxf8gHsf/ExPE/09O - 0//DwvH/8e78//////////////////////////////L////Q////dv///wD///8C////AP///wD///8A - ////AP///wP///8F////AP///0n////7///////+8/Lz/6enp/CWlpZbAAAAAP///wEAAAAAAAAAAAAA - AAAAAAAAfn6BBAAAADYkI2DDJCLd/yko0f0oJ9L/KCfS/yop1P8jIc//iIe2/7Szr/94eJL/dXSM/2Rk - iv8wMI//GhjG/11cwf+8va//SUnB/x8d0P8eHtX/YmHF/76+rv87Orj/Xly7/728r/9WVpL/PT2D/0ZF - hf8xL6T/JSTS/ysq0/8fHtD/IiHQ/0A/1/9XVd//p6Te//Xz7//59fv///3//////////////7b///8A - ////Av///wH///8A////CP///wD///8A////AP///wf///8A////Wf///v/+//////7t7e3/o6Oj65mZ - mU0AAAAA////AgAAAAAAAAAAAAAAAH5+gQQAAAA3IyNmxC4r6v86ONz9Nzbd/zg23f85N9//MTDZ/5qZ - yv/Q0Mz/xsbX/87N2P/b3NT/tLO4/y4tsf9pZ8//1NbI/19dz/80M93/MzLf/2hozf/W2Mr/VFXQ/29t - zP/V1Mr/zs3J/9DPxv/X18b/e3vI/y4t3v86ON7/Ojje/zg33v85Ntz/FhXb/09Ovv/b28r/2Njb/9nZ - 2f/49Pj///3///+U////AP///wT///8D////Af///7v////I////Yf///xX///8A////AP///wD///9t - ///+//7//////uno6f+amprPr6+vHAAAAAAAAAAAAAAAAAAAAAB+foEEAAAANyIiasU4NvT/TErl/UhH - 6P9JR+j/S0np/0A/4/+wsdv/09Xh/2Jh6/9iYu//jYze/+7w4f9radP/cXDZ/+zu4P9ra93/QULr/zQy - 1P+CgMb/7u7k/1pa4/+BgNz/6erg/5CN6f+JiPT/j47w/2pq8P9JSOr/Skjp/0lI6f9JR+n/UU/o/zEy - 6v9cXMj/29vM/9TU1//MzMz/9/L3////////hf///wD///8I////AP///3T////////////////////r - //3/nv/+/0H///8F////AP///3P///78/v/////+ycnJ95WVlUwAAAAAAAAAAAAAAAAAAAAAf3+CAwAA - AC4kInC/QkL9/11c7f5ZWPH/Wlnw/1xb8v9QT+v/vr/q/+Lj6v9PTab/OTiU/5WUxP/9/vb/gH7u/4GC - 5v/8/PP/eHa+/z4+nP9VVZn/19ne/+Pk9v9cWu7/k5Pm//r88v9kYrT/PTyg/0ZEov9HR63/VVPi/1pb - 8v9aWfD/WVjw/2Fg8P88PPT/XFvN/9vczP/S0tX/zMzM//j0+P///////3P///8A////Af///yv////3 - /////v//+vb6///8//7///////////////3/zv/8/3X///8d///+0/7//v7+/d7c3vKenp42AAAAAAAA - AAAAAAAAAAAAAHx8fwIAAAIUJid4sFBP//5wcPP9amv3/2xs9v9tbvf/Zmb0/83N9f////n/6ejn/+zs - 5/////j/5Ob5/3p49/+dnfL////7/+3v7f/m5+H/+/vy//v9/v+qrPb/ZmP2/6qq8/////z/7e7o/+fo - 4f/t7uP/1Nbf/21t5f9qbPn/bW32/2tr9/9zcvf/TEv3/19f2f/f387/zs7S/8zMzP/79/v///////9i - ////Af///wP////F////////+vj6/83Nzf3Kysr/7u3ut//8/9n//v//////////////+f/9//n/+/// - ///GxsanwMDABv///wEAAAAAAAAAAAAAAADMzM4CAAAAACcna3lLS///jI33/H5++/9/fvv/fn76/4B/ - /P+0tP7/z8/9/9DQ///R0P//w8P8/5uc+/99ffz/oJ7+/83N/P/Q0f//0tH//8nJ//+op/z/g4P8/3x7 - /P+jpP3/zs78/8/Q///S0f//09L//8bF//+IiP7/fX36/39/+/99ffr/kZH6/0hI/P9xcN//4+PS/8zM - z//Ozs7//vv+////////Vf///wD///96//////////7//9ra2vzBwcH/zc3NmAAAAAD///8L////Uv/9 - /63//P/z///////////s7OzHysvKFwAAAAD///8BAAAAAAAAAAAAAAAA////AV5fXAEBAQUZMTDr42pq - /v+fn/79nqD9/p2d/P6fn/3/oaH//6Cg/v+eoP3/n6D9/5+f/v+fn///oaH+/6Kg/v+hoP7/oKH+/5+f - /f+dn/7/nZ7//6Gg//+hov7/oaD+/6Gg/v+foP7/n6D9/5+f/v+fn/z/oKH+/6Kh/v+gof7/oaH//3p5 - //8qKvj/uLna/9va1P/Ly83/0NDQ///+/////////yv///8j////+f///////+zr7PzCwsL/0dHRowAA - AAD///8DAAAAAAAAAAAAAAAA////Hv/+/1f///9N9PT0BgAAAAD///8BAAAAAAAAAAAAAAAAAAAAAAAA - AAD//v8CAAAAAFpagTZWUv/UQkL7/1NS//9gX///WFf//1BP//9PT///T0///09P//9QT///UE///09P - //9PT///T0///1BP//9QT///UE///1BQ//9QT///UE///09P//9PT///UE///1BP//9QT///UE///09P - //9QT///UFD//0dG//85OPX/pKTe/93d1P/R0dT/ycnJ/9HQ0f////////////9M////v/////////r5 - +vzHx8f/0dHRrQAAAAD///8C////Af///wH///8D////AgAAAAAAAAAAAAAAAAAAAAD///8BAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wIAAAAA+Pn+CM7O/zasreg/LzBqThoaVZehot38srPv/6us - 6P+sren/q6zo/6ys6f+rrOj/qqvn/6ur5/+rrOj/qqvn/6mq5v+oqeX/qanm/6ip5f+nqOT/p6jk/6en - 4/+mpuL/pabi/6Sl4f+kpOH/o6Tg/6Kj3/+oqN7/0NHY/9/g0//Q0dP/0NDP/8fHx//Dw8P//Pz8//// - /////f////////////zV1dX/zs7Ot/z8/AYAAAAA////AgAAAAAAAAAAAAAAAAAAAAD///8C////A/// - /wMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AgAAAAAAAAAAAAAAAAEB - AQkREQVu4ODT+vb26f/t7d//7u7g/+3t3//t7eD/7e3f/+zs3//s7N//7O3f/+vr3v/r693/6urc/+rq - 3P/p6dz/6Ojb/+fo2v/n59r/5ubZ/+bm2P/l5dj/5eXX/+Tj1v/j4tb/4ODU/9fX1P/Q0NT/0dHQ/8zM - zP/ExMX/sbGx/9HR0f////////////////zj4+P/zMzMvfr6+goAAAAA////AgAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAD9/f4B/v7/BM/P0QMCAgQXEhIUd9LS1Pvn5+n/3d3g/97e4f/e3uD/3t7h/97e4P/d3eD/3d3g/93d - 3//c3N//29ve/9vb3f/b293/2trd/9rZ3P/Z2dv/2Njb/9jY2v/X19n/1tbZ/9bW2P/U1Nf/09TW/9LS - 1f/R0dL/0NDP/8zMzP/Gxsb/vLy8/6urq/+1tbX/3t7e/97d3vzR0dH/zMzMw/n5+Q0AAAAA////AgAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wEAAAAAAAAAFBEREXXT09P66Ojo/97e3v/g4OD/39/f/9/f - 3//f39//39/f/97e3v/d3d3/3d3d/9zc3P/c3Nz/3Nzc/9vb2//a2tr/2dnZ/9nZ2f/Z2dn/19fX/9bW - 1v/W1tb/1NTU/9PT0//R0dH/zs7O/8vLy//Gxsb/vr6+/7S0tP+kpKT/ubm5/83Nzfy/v7//yMjIyPn5 - +RAAAAAA////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8BAAAAAAAAABQRERF109PT++fn - 5//d3d3/39/f/97e3v/e3t7/3d3d/93d3f/c3Nz/29vb/9ra2v/Z2dn/2dnZ/9jY2P/X19f/1tbW/9fX - 1//W1tb/1dXV/9XV1f/U1NT/0tLS/9HR0f/Pz8//zMzM/8nJyf/ExMT/vr6+/7W1tf+rq6v/oKCg/7y8 - vPy+vr7/v7+/zvX19RQAAAAA////AwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AQAA - AAABAQEUEhISdNTU1Prl5eX/3Nzc/97e3v/d3d3/3Nzc/9vb2//a2tr/2dnZ/9jY2P/X19f/1tbW/9XV - 1f/V1dX/1NTU/9PT0//T09P/0tLS/9HR0f/Q0ND/z8/P/83Nzf/MzMz/ycnJ/8XFxf/BwcH/u7u7/7S0 - tP+tra3/oaGh/6Wlpfu1tbX/t7e30/Dw8BcAAAAA////AwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAADBoaGlXb29vw4ODg+9jY2PvZ2dn72NjY+9bW1vvV1dX71NTU+9LS - 0vvR0dH7z8/P+87OzvvOzs77zs7O+83NzfvMzMz7zMzM+8zMzPvLy8v7ycnJ+8jIyPvGxsb7w8PD+8DA - wPu8vLz7t7e3+7Gxsfuqqqr7oKCg/ZmZmf+np6f/tbW11+3t7RoAAAAA////AwAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA29vbAQMDAwEhISEj6+vr/uHh4f/e3t7/39/f/97e - 3v/c3Nz/29vb/9ra2v/X19f/1tbW/9XV1f/S0tL/0tLS/9HR0f/Pz8//zc3N/8zMzP/Kysr/x8fH/8PD - w//BwcH/vb29/7q6uv+2trb/sbGx/6urq/+lpaX/n5+f/52dnf+ysrLxzc3Nn/X19RgAAAAA////AwAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wEAAAAA19fXB/r6 - +mr39/d1+Pj4dfj4+HX39/d19/f3dfb29nX29vZ19vb2dfX19XX19fV19PT0dfT09HXz8/N18/PzdfLy - 8nXx8fF17+/vde7u7nXs7Ox17Ozsderq6nXp6el16Ojodebm5nXk5OR14uLidePj42/u7u5O+vr6HgAA - AAAAAAAA////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////8AAAAAAA///g - AAAAAAB//+AAAAAAAH//4AAAAAAAf//gAAAAAAB//+AAAAAAAH//4AAAAAAAf//gAAAAAAB///AAAAAA - AH//4AAAAAAAf//AAAAAAAB//4AAAAAAAH//gAAAAAAAf/+AAAAAAAB//4AAAAAAAH//gAAAAAAAf/+A - AAAAAAB//4AAAAAAAH//gAAAAAAAf/4AAAAAAAB/4AAAAAAAAH/AAAAAAAAAf4AAAAAAAAB/gAAAAAAA - AH+AAAAAAAAAf4AAAAAAAAB/4AAAAAAAAH/+AAAAAAAAf/+AAAAAAAB//4AAAAAAAH//gAAAAAAAf/+A - AAAAAAAH/4AAAAAAAAP/gAAAAAAAA/+AAAAAAAAD/4AAAAAAAAP/AAAAAAAAB/wAAAAAAAAP/AAAAAAA - AB/4AAAAAAAAP/gAAAAAAAA/+AAAAAAAAD/4AAAAAAAAH/gAAAAAAAAP+AAAAAAAAAf4AAAAAAAAA/gA - AAAAAAAD+AAAAAAAAAP4AAAAAAAAA/wAAAAAAAcH/AAAAAAAD//+AAAAAAAf///gAAAAAD////AAAAAA - f///8AAAAAD////wAAAAAf////AAAAAD////8AAAAAf////wAAAAD/////AAAAAf/////////////ygA - AADAAAAAgAEAAAEAIAAAAAAAAEACACMuAAAjLgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAQAAAAEAAAADAAAABAAAAAUAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAA - AAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAA - AAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAA - AAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAA - AAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAA - AAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAA - AAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAA - AAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAA - AAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAA - AAcAAAAHAAAABwAAAAYAAAAFAAAABAAAAAIAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAA - AAQAAAAIAAAADAAAABAAAAATAAAAFgAAABYAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAA - ABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAA - ABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAA - ABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAA - ABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAA - ABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAA - ABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAA - ABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAA - ABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAXAAAAFwAAABcAAAAWAAAAFQAA - ABMAAAAPAAAACgAAAAcAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAABAAAAAkAAAAQAAAAGAAA - ACAAAAAmAAAAKwAAAC0AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAA - AC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAA - AC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAA - AC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAA - AC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAA - AC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAA - AC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAA - AC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAA - AC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAtAAAAKgAAACUAAAAeAAAAFgAA - AA0AAAAHAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAABwAAAA8AAAAaAAAAKAAAADYAAABAAAAARwAA - AEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAA - AEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAA - AEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAA - AEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAA - AEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAA - AEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAA - AEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAA - AEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABMAAAATAAA - AEwAAABMAAAATAAAAEwAAABMAAAATAAAAEwAAABKAAAARgAAAD0AAAAyAAAAJAAAABYAAAANAAAABQAA - AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAADAAAACgAAABYAAAAoAAAAPQAAAFEAAABgAAAAawAAAHEAAABzAAAAcwAA - AHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAA - AHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAA - AHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAA - AHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAA - AHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAA - AHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAA - AHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAA - AHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAAAHMAAABzAAAAcwAA - AHMAAABzAAAAcwAAAHMAAABwAAAAaAAAAFwAAABLAAAANgAAACIAAAATAAAABwAAAAEAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAEAAAADQAAABwAAAAyAAAATQAAAGYAAAB5AAAAiAAAAI8AAACRAAAAkQAAAJEAAACRAAAAkQAA - AJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAA - AJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAA - AJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAA - AJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAA - AJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAA - AJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAA - AJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAA - AJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAAAJEAAACRAAAAkQAA - AJEAAACOAAAAhAAAAHUAAABfAAAARAAAACsAAAAXAAAACgAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAEAAA - ACEAAAA6AAAAWQAAAHYAAACNAAAAnQAAAKYAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAA - AKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAA - AKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAA - AKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAA - AKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAA - AKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAA - AKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAA - AKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAA - AKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACoAAAAqAAAAKgAAACkAAAAmQAA - AIcAAABuAAAATwAAADIAAAAcAAAACwAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAEAAAACQAAAA/AAAAYQAA - AIEAAACaAAAAqwAAALUAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAA - ALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAA - ALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAA - ALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAA - ALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAA - ALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAA - ALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAA - ALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAA - ALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAAC4AAAAuAAAALgAAACzAAAApwAAAJQAAAB5AAAAVwAA - ADcAAAAeAAAADQAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIYAAACgAAAAsgAA - ALwAAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAA - AL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAA - AL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAA - AL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAA - AL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAA - AL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAA - AL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAA - AL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAA - AL8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAL8AAAC7AAAArgAAAJoAAAB+AAAAWwAAADkAAAAfAAAADQAA - AAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTdxMTE/8bGxv/AwMD/vr6+/7u7 - u/+3t7f/tra2/7e3t/+4uLj/ubm5/7m5uf+5ubn/ubm5/7q6uv+6urr/u7u7/7u7u/+7u7v/vLy8/7y8 - vP+8vLz/vLy8/729vf+9vb3/vb29/729vf+9vb3/vr6+/76+vv++vr7/vr6+/76+vv+/v7//v7+//7+/ - v/++vr7/v7+//7+/v/+/v7//v7+//7+/v//AwMD/wMDA/8HBwf/AwMD/v7+//7+/v/+/v7//wMDA/8DA - wP/AwMD/x8fH/8rKyv/Pz8//0dHR/9LS0v/S0tL/0tLS/9PT0//S0tL/0tLS/9LS0v/S0tL/0dHR/9HR - 0f/R0dH/0dHR/9HR0f/R0dH/0dHR/9HR0f/R0dH/0dHR/9HR0f/R0dH/0dHR/9HR0f/R0dH/0dHR/9HR - 0f/Q0ND/0NDQ/9DQ0P/Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/87Ozv/Ozs7/zc3N/83N - zf/Nzc3/zc3N/8zMzP/MzMz/y8vL/8vLy//Ly8v/y8vL/8zMzP/Nzc3/z8/P/9DQ0P/V1dX/1dXV/9XV - 1f/V1dX/1dXV/9XV1f/U1NT/1NTU/9TU1P/U1NT/1NTU/9PT0//T09P/09PT/9PT0//T09P/0dHR/9HR - 0f/Q0ND/z8/P/83Nzf/Nzc3/zs7O/8/Pz//IyMj/yMjI/8PDw/+cnJxuAAAADQAAAAMAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTdzMzM/9nZ2f/a2tr/29vb/9vb2//b29v/29vb/9zc - 3P/e3t7/3t7e/97e3v/c3Nz/3d3d/93d3f/e3t7/3t7e/97e3v/f39//39/f/9/f3//f39//4ODg/+Dg - 4P/g4OD/4ODg/+Dg4P/h4eH/4eHh/+Hh4f/h4eH/4uLi/+Li4v/i4uL/4uLi/+Li4v/i4uL/4uLi/+Li - 4v/i4uL/4uLi/+Li4v/i4uL/4uLi/9/f3//e3t7/3d3d/9vb2//a2tr/29vb/9zc3P/c3Nz/4eHh/+Dg - 4P/g4OD/4eHh/+Li4v/j4+P/4+Pj/+Li4v/l5eX/5eXl/+Xl5f/l5eX/5eXl/+Tk5P/k5OT/5OTk/+Tk - 5P/k5OT/5OTk/+Tk5P/j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//i4uL/4uLi/+Li4v/i4uL/4uLi/+Hh - 4f/g4OD/4ODg/+Dg4P/f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/97e3v/e3t7/3d3d/93d - 3f/d3d3/3d3d/93d3f/c3Nz/29vb/9vb2//c3Nz/3d3d/97e3v/a2tr/2tra/9ra2v/a2tr/2tra/9ra - 2v/a2tr/2tra/9nZ2f/Z2dn/2dnZ/9nZ2f/Y2Nj/2NjY/9jY2P/Y2Nj/19fX/9fX1//X19f/1dXV/9PT - 0//S0tL/0NDQ/8/Pz//Pz8//zc3N/8fHx/+ZmZlvAAAADQAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAA - ACUAAABCAAAAZQAAAIaUlJTdzs7O/93d3f/d3d3/3d3d/97e3v/f39//39/f/+Dg4P/h4eH/4eHh/+Hh - 4f/h4eH/4eHh/+Li4v/i4uL/4uLi/+Li4v/j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//k5OT/5OTk/+Tk - 5P/k5OT/5OTk/+Tk5P/k5OT/5OTk/+Xl5f/l5eX/5eXl/+Xl5f/m5ub/5eXl/+Xl5f/k5OT/5OTk/+Pj - 4//j4+P/4+Pj/+Dg4P/e3t7/29vb/9jY2P/V1dX/1dXV/9fX1//Z2dn/39/f/93d3f/c3Nz/3t7e/+Hh - 4f/k5OT/5ubm/+bm5v/n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+bm5v/m5ub/5ubm/+bm - 5v/m5ub/5ubm/+bm5v/m5ub/5OTk/+Tk5P/k5OT/5OTk/+Pj4//j4+P/4+Pj/+Pj4//k5OT/5OTk/+Pj - 4//j4+P/4+Pj/+Pj4//i4uL/4uLi/+Hh4f/h4eH/4eHh/+Hh4f/g4OD/4ODg/+Dg4P/g4OD/4eHh/+Dg - 4P/f39//3t7e/97e3v/d3d3/3Nzc/9zc3P/d3d3/3d3d/93d3f/d3d3/3d3d/93d3f/d3d3/3d3d/93d - 3f/d3d3/3Nzc/9zc3P/c3Nz/3Nzc/9vb2//b29v/2dnZ/9nZ2f/Z2dn/2NjY/9bW1v/W1tb/1NTU/9HR - 0f/S0tL/0NDQ/8rKyv+ZmZlvAAAADQAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAA - AIaUlJTd0NDQ/9/f3//e3t7/3d3d/+Dg4P/h4eH/4eHh/+Hh4f/j4+P/5OTk/+Tk5P/j4+P/4+Pj/+Pj - 4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Tk5P/k5OT/5OTk/+Tk5P/l5eX/5eXl/+Xl5f/l5eX/5ubm/+bm - 5v/m5ub/5ubm/+fn5//n5+f/5+fn/+fn5//o6Oj/5+fn/+fn5//m5ub/5eXl/+Tk5P/j4+P/4uLi/9ra - 2v/Y2Nj/1NTU/8/Pz//MzMz/y8vL/83Nzf/Pz8//1NTU/9TU1P/W1tb/2NjY/9zc3P/h4eH/5OTk/+fn - 5//m5ub/5ubm/+bm5v/m5ub/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn - 5//n5+f/5ubm/+bm5v/m5ub/5ubm/+Xl5f/l5eX/5eXl/+Xl5f/k5OT/5OTk/+Pj4//j4+P/4+Pj/+Li - 4v/i4uL/4uLi/+Li4v/i4uL/4uLi/+Li4v/i4uL/4uLi/+Li4v/h4eH/4ODg/+Dg4P/g4OD/4ODg/+Dg - 4P/g4OD/39/f/97e3v/e3t7/3t7e/97e3v/e3t7/3t7e/97e3v/e3t7/3t7e/93d3f/d3d3/3Nzc/9zc - 3P/c3Nz/3Nzc/9vb2//b29v/29vb/9vb2//a2tr/2NjY/9fX1//W1tb/1NTU/9LS0v/R0dH/0NDQ/8rK - yv+YmJhvAAAADQAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd0tLS/+Hh - 4f/i4uL/4ODg/+Hh4f/h4eH/4+Pj/+Tk5P/k5OT/5eXl/+Xl5f/l5eX/5eXl/+Xl5f/l5eX/5eXl/+bm - 5v/m5ub/5ubm/+fn5//n5+f/5+fn/+fn5//o6Oj/6Ojo/+jo6P/o6Oj/6Ojo/+jo6P/o6Oj/6enp/+np - 6f/p6en/6enp/+np6f/o6Oj/6enp/+fn5//n5+f/5ubm/+Xl5f/j4+P/2tra/9XZzv/Szs3/08zR/83F - z//Fxsr/vsPG/8TGx//Kxcf/z83D/9PPzv/X09j/0tTV/9fb3P/c3eH/6Ozh/+Xn2//o6Oj/5ubm/+rq - 6v/p6en/6enp/+vr6//p6en/6urq/+np6f/p6en/6enp/+np6f/p6en/6enp/+jo6P/o6Oj/6Ojo/+jo - 6P/o6Oj/6Ojo/+jo6P/n5+f/5+fn/+fn5//n5+f/5ubm/+bm5v/m5ub/5ubm/+bm5v/l5eX/5eXl/+Xl - 5f/l5eX/5OTk/+Tk5P/k5OT/5OTk/+Pj4//j4+P/4uLi/+Li4v/i4uL/4eHh/+Hh4f/i4uL/4uLi/+Li - 4v/h4eH/4eHh/+Hh4f/h4eH/4ODg/+Dg4P/g4OD/4ODg/9/f3//f39//39/f/9/f3//e3t7/3t7e/93d - 3f/d3d3/3Nzc/9vb2//a2tr/2dnZ/9nZ2f/X19f/1dXV/9TU1P/S0tL/0dHR/83Nzf+YmJhvAAAADgAA - AAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd0tLS/+Hh4f/i4uL/4eHh/+Li - 4v/j4+P/5OTk/+Xl5f/l5eX/5ubm/+bm5v/m5ub/5ubm/+bm5v/m5ub/5+fn/+fn5//n5+f/5+fn/+jo - 6P/o6Oj/6Ojo/+jo6P/p6en/6enp/+np6f/p6en/6urq/+rq6v/q6ur/6urq/+rq6v/q6ur/6urq/+rq - 6v/q6ur/6+vr/+rq6v/p6en/6Ojo/+bm5v/j4+P/2dnZ/83P0P/O0ND/xMbG/8XGxP+6uLf/v7y4/728 - uP+9u7r/vby+/8XGwv/My83/1dXb/8/U0v/e4+H/2NXe/+fe6P/p6en/6enp/+zs7P/q6ur/6enp/+rq - 6v/o6Oj/6enp/+rq6v/q6ur/6urq/+rq6v/q6ur/6urq/+np6f/p6en/6Ojo/+jo6P/o6Oj/6Ojo/+jo - 6P/o6Oj/6Ojo/+jo6P/o6Oj/5+fn/+fn5//n5+f/5+fn/+fn5//m5ub/5ubm/+Xl5f/l5eX/5eXl/+Xl - 5f/k5OT/5OTk/+Tk5P/k5OT/4+Pj/+Pj4//j4+P/4+Pj/+Li4v/i4uL/4+Pj/+Pj4//h4eH/4eHh/+Hh - 4f/h4eH/4eHh/+Hh4f/g4OD/4ODg/+Dg4P/g4OD/4ODg/9/f3//f39//3t7e/97e3v/d3d3/3d3d/9zc - 3P/b29v/2tra/9nZ2f/Y2Nj/1tbW/9TU1P/T09P/0tLS/87Ozv+amppxAAAADgAAAAMAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd09PT/+Hh4f/j4+P/4uLi/+Pj4//k5OT/5eXl/+bm - 5v/n5+f/5+fn/+fn5//o6Oj/6Ojo/+jo6P/o6Oj/6Ojo/+jo6P/o6Oj/6Ojo/+np6f/p6en/6urq/+rq - 6v/q6ur/6urq/+rq6v/r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/7e3t/+vr - 6//q6ur/5+fn/+Tk5P/f39//1NTU/9PL0v/IycX/uL65/7S3rv+2rLj/tq+0/7e1u/+vtrH/tLm6/7m8 - xP/Excn/yMTD/9jR1v/V1Mr/2NTf/9/h6f/n5+f/6urq/+3t7f/r6+v/6+vr/+zs7P/q6ur/6+vr/+vr - 6//r6+v/6+vr/+zs7P/r6+v/6+vr/+vr6//q6ur/6enp/+np6f/p6en/6enp/+np6f/p6en/6enp/+np - 6f/p6en/6Ojo/+jo6P/o6Oj/6Ojo/+jo6P/n5+f/5+fn/+bm5v/m5ub/5ubm/+bm5v/l5eX/5eXl/+Xl - 5f/l5eX/5eXl/+Xl5f/k5OT/5OTk/+Tk5P/k5OT/5OTk/+Tk5P/i4uL/4uLi/+Li4v/i4uL/4uLi/+Li - 4v/i4uL/4uLi/+Dg4P/h4eH/4ODg/+Dg4P/g4OD/39/f/9/f3//e3t7/3t7e/93d3f/c3Nz/29vb/9ra - 2v/Z2dn/1tbW/9XV1f/T09P/0tLS/87Ozv+enp58AAAADgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAA - ACUAAABCAAAAZQAAAIaUlJTd09PT/+Li4v/k5OT/4+Pj/+Tk5P/l5eX/5ubm/+fn5//n5+f/6Ojo/+np - 6f/p6en/6enp/+np6f/p6en/6enp/+rq6v/q6ur/6urq/+rq6v/q6ur/6+vr/+vr6//r6+v/6+vr/+zs - 7P/s7Oz/6+vr/+vr6//r6+v/7Ozs/+zs7P/s7Oz/7Ozs/+zs7P/t7e3/7u7u/+vr6//p6en/5eXl/+Dg - 4P/Z2dn/zs7O/8fBzP+8u7//s7qr/6OkqP+pqqH/qaSm/6Wpnv+boJ7/trOu/6utrv+0vrL/wcS7/8zJ - u//by9z/2dfW/9Xd3P/g4OD/5ubm/+rq6v/q6ur/6+vr/+3t7f/t7e3/7e3t/+zs7P/s7Oz/7e3t/+3t - 7f/s7Oz/7Ozs/+zs7P/s7Oz/6urq/+rq6v/q6ur/6urq/+rq6v/q6ur/6urq/+rq6v/q6ur/6enp/+np - 6f/p6en/6enp/+np6f/o6Oj/6Ojo/+jo6P/n5+f/5+fn/+fn5//n5+f/5ubm/+bm5v/m5ub/5ubm/+bm - 5v/m5ub/5eXl/+Xl5f/l5eX/5eXl/+Xl5f/j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Li - 4v/i4uL/4uLi/+Hh4f/h4eH/4ODg/+Dg4P/f39//3t7e/93d3f/c3Nz/29vb/9vb2//Z2dn/19fX/9XV - 1f/U1NT/09PT/87Ozv+enp58AAAADgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAA - AIaUlJTd09PT/+Pj4//k5OT/5OTk/+Xl5f/m5ub/5+fn/+fn5//o6Oj/6enp/+np6f/q6ur/6urq/+rq - 6v/q6ur/6urq/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+zs7P/s7Oz/7Ozs/+zs7P/s7Oz/7Ozs/+zs - 7P/s7Oz/7Ozs/+zs7P/t7e3/7e3t/+3t7f/u7u7/7u7u/+vr6//p6en/4+Pj/93d3f/W1tb/ysrK/7vA - vv+rsK7/pqip/6OpqP+TmKf/j5Kn/4yKoP+hoKr/qKOk/6+usv+qrbL/srqv/77Ev//Gyr//1tXL/9zZ - 1f/a2tr/4+Pj/+jo6P/o6Oj/6urq/+zs7P/t7e3/7e3t/+3t7f/t7e3/7e3t/+3t7f/t7e3/7e3t/+3t - 7f/s7Oz/7Ozs/+zs7P/s7Oz/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6urq/+rq6v/q6ur/6urq/+rq - 6v/p6en/6enp/+np6f/p6en/6enp/+jo6P/o6Oj/6Ojo/+jo6P/n5+f/5+fn/+fn5//n5+f/5ubm/+bm - 5v/m5ub/5ubm/+bm5v/k5OT/5OTk/+Tk5P/k5OT/5OTk/+Tk5P/k5OT/5OTk/+Pj4//j4+P/4+Pj/+Li - 4v/i4uL/4eHh/+Hh4f/g4OD/39/f/97e3v/d3d3/3Nzc/9vb2//Z2dn/19fX/9XV1f/V1dX/1NTU/8/P - z/+fn598AAAADgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd1NTU/+Pj - 4//l5eX/5OTk/+bm5v/n5+f/6Ojo/+jo6P/p6en/6enp/+rq6v/r6+v/6+vr/+vr6//r6+v/6+vr/+vr - 6//s7Oz/7Ozs/+zs7P/s7Oz/7Ozs/+zs7P/s7Oz/7e3t/+3t7f/t7e3/7u7u/+7u7v/u7u7/7u7u/+7u - 7v/u7u7/7u7u/+7u7v/t7e3/7e3t/+rq6v/n5+f/4uLi/9vb2//T09P/x8fH/8C+tP+0r7D/oZ+y/32I - o/9aXr3/TEjQ/0g80P9aVL//Zm+4/42Zo/+pnrj/vbS+/7m1wP+4usX/u7zG/9PVyf/Y2Nj/4+Pj/+fn - 5//o6Oj/6+vr/+3t7f/u7u7/7e3t/+7u7v/u7u7/7u7u/+7u7v/u7u7/7u7u/+3t7f/t7e3/7e3t/+3t - 7f/t7e3/7e3t/+zs7P/s7Oz/7Ozs/+zs7P/s7Oz/6+vr/+vr6//r6+v/6+vr/+vr6//q6ur/6urq/+rq - 6v/q6ur/6urq/+rq6v/p6en/6enp/+np6f/p6en/6Ojo/+jo6P/n5+f/5+fn/+fn5//m5ub/5ubm/+bm - 5v/l5eX/5eXl/+Xl5f/l5eX/5eXl/+Xl5f/l5eX/5eXl/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4uLi/+Hh - 4f/h4eH/4ODg/97e3v/d3d3/3Nzc/9vb2//a2tr/19fX/9XV1f/W1tb/1dXV/8/Pz/+fn598AAAADgAA - AAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd1NTU/+Tk5P/m5ub/5eXl/+bm - 5v/o6Oj/6enp/+np6f/p6en/6urq/+vr6//s7Oz/7Ozs/+zs7P/s7Oz/7Ozs/+zs7P/t7e3/7e3t/+zs - 7P/t7e3/7e3t/+3t7f/t7e3/7u7u/+7u7v/u7u7/7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v - 7//t7e3/7u7u/+vr6//o6Oj/4uLi/9ra2v/R0dH/xMTE/7+7uv+oq7P/dXq5/zcg7v8uGv//OC///0dM - 7/9BOfj/MSv8/zIZ5f+Diaz/o6So/7a1sf+7vb7/vsHF/8bNxv/T09P/4ODg/+Tk5P/m5ub/6+vr/+3t - 7f/v7+//7u7u/+7u7v/v7+//7+/v/+/v7//v7+//7u7u/+7u7v/u7u7/7u7u/+7u7v/u7u7/7e3t/+3t - 7f/t7e3/7e3t/+3t7f/t7e3/7Ozs/+zs7P/s7Oz/7Ozs/+zs7P/r6+v/6+vr/+vr6//r6+v/6+vr/+vr - 6//q6ur/6urq/+rq6v/q6ur/6enp/+np6f/o6Oj/6Ojo/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+bm - 5v/m5ub/5ubm/+bm5v/m5ub/5ubm/+Tk5P/k5OT/5OTk/+Pj4//j4+P/4uLi/+Li4v/i4uL/4ODg/9/f - 3//e3t7/3d3d/9zc3P/a2tr/2NjY/9bW1v/X19f/1dXV/9DQ0P+enp59AAAADgAAAAQAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd1NTU/+Tk5P/m5ub/5ubm/+fn5//p6en/6enp/+np - 6f/q6ur/6+vr/+zs7P/t7e3/7e3t/+3t7f/t7e3/7e3t/+3t7f/t7e3/7e3t/+3t7f/t7e3/7e3t/+7u - 7v/u7u7/7u7u/+7u7v/u7u7/7+/v/+/v7//v7+//7+/v/+/v7//w8PD/8PDw//Dw8P/w8PD/8fHx/+/v - 7//r6+v/5OTk/9vb2//R0dH/w8PD/6G1uv9oadn/Jhbw/yQg+/85OP//Skj//1lO//9fWP//WFj//z86 - +/8tHPX/ZmvI/5qjrf+2rLj/xbrE/8nIxP/Kysr/2dnZ/97e3v/h4eH/6Ojo/+vr6//u7u7/7Ozs/+/v - 7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//u7u7/7u7u/+7u7v/u7u7/7u7u/+7u7v/u7u7/7u7u/+7u - 7v/u7u7/7e3t/+3t7f/t7e3/7e3t/+3t7f/s7Oz/7Ozs/+zs7P/s7Oz/6+vr/+vr6//r6+v/6+vr/+rq - 6v/q6ur/6urq/+rq6v/p6en/6Ojo/+jo6P/o6Oj/6Ojo/+jo6P/n5+f/5+fn/+fn5//n5+f/5ubm/+bm - 5v/m5ub/5ubm/+Tk5P/k5OT/5OTk/+Tk5P/j4+P/4+Pj/+Li4v/i4uL/4eHh/+Dg4P/f39//3t7e/93d - 3f/b29v/2NjY/9fX1//Y2Nj/1dXV/9DQ0P+enp59AAAADwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAA - ACUAAABCAAAAZQAAAIaUlJTd1tbW/+fn5//m5ub/5ubm/+fn5//p6en/6urq/+vr6//s7Oz/7Ozs/+zs - 7P/t7e3/7e3t/+3t7f/t7e3/7e3t/+3t7f/t7e3/7e3t/+7u7v/u7u7/7+/v/+7u7v/u7u7/7u7u/+/v - 7//v7+//8PDw//Dw8P/w8PD/8PDw//Hx8f/x8fH/8fHx//Hx8f/w8PD/7+/v/+/w7v/s7ev/4eHh/9rZ - 2//T0tb/xcTI/5Gaxv8UEvT/Nzbg/zE09P9FN///TTn+/0dC+/9QSv3/Yln//2Zo9v9rYP//NB///1Zh - 0P+aobX/sLSu/8fEvP/E0L7/0tHT/9vV1v/o5ef/2+Dj/+ft8v/q6e3/8ubs//Hx8f/u7u7/8vLy//Dw - 8P/v7+//8fHx//Dw8P/v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7u7u/+7u7v/u7u7/7u7u/+7u - 7v/u7u7/7e3t/+3t7f/t7e3/7e3t/+3t7f/s7Oz/7Ozs/+vr6//r6+v/7Ozs/+vr6//r6+v/6urq/+rq - 6v/q6ur/6urq/+np6f/p6en/6enp/+jo6P/o6Oj/6Ojo/+jo6P/o6Oj/5+fn/+fn5//m5ub/5ubm/+Xl - 5f/l5eX/5eXl/+Tk5P/k5OT/4+Pj/+Pj4//j4+P/4uLi/+Hh4f/f39//39/f/97e3v/c3Nz/2dnZ/9jY - 2P/Y2Nj/2NjY/9HR0f+dnZ19AAAADwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAA - AIaUlJTd19fX/+fn5//m5ub/5+fn/+jo6P/p6en/6+vr/+zs7P/s7Oz/7e3t/+3t7f/t7e3/7e3t/+3t - 7f/t7e3/7e3t/+3t7f/u7u7/7u7u/+7u7v/v7+//7+/v/+/v7//u7u7/7u7u/+/v7//w8PD/8PDw//Dw - 8P/w8PD/8PDw//Dw8P/w8PD/8fHx//Hx8f/y8vL/8fHx//Dx7//t7uz/4uLi/9rZ2//T0tb/xMPH/2ln - 2P8yMPj/Vk7u/0tM9P9FP/L/Rz31/zg27v9AO///Sj/6/1xR//9YVvz/X17//zsu//9VUtD/q6W8/7i3 - u//ExcP/xsnH/9LQ3P/d3tX/6e3h/9/h6f/t7+//8e/n//Hx8f/u7u7/8fHx//Hx8f/w8PD/8PDw/+/v - 7//w8PD/7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+7u7v/u7u7/7u7u/+7u - 7v/u7u7/7e3t/+3t7f/t7e3/7Ozs/+zs7P/s7Oz/7Ozs/+zs7P/r6+v/6+vr/+vr6//q6ur/6urq/+rq - 6v/p6en/6enp/+np6f/p6en/6Ojo/+jo6P/o6Oj/5+fn/+fn5//n5+f/5+fn/+bm5v/l5eX/5eXl/+Xl - 5f/k5OT/5OTk/+Tk5P/k5OT/4uLi/+Hh4f/g4OD/39/f/97e3v/c3Nz/2tra/9jY2P/Z2dn/2NjY/9LS - 0v+dnZ19AAAADwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd19fX/+fn - 5//m5ub/6Ojo/+jo6P/q6ur/6+vr/+zs7P/t7e3/7e3t/+3t7f/t7e3/7e3t/+7u7v/u7u7/7u7u/+7u - 7v/u7u7/7u7u/+/v7//v7+//7+/v/+/v7//v7+//7+/v//Dw8P/w8PD/8PDw//Dw8P/x8fH/8fHx//Hx - 8f/x8fH/8fHx//Hx8f/y8vL/8fHx//Dx7//u7+3/5eXl/97d3//W1dn/xsXJ/0M67/9MR/b/cGft/2Ji - 8v9fYfX/T1fw/zs18v8wNfX/Pjz0/0g89P9DQ/v/V1n0/2JZ/f86Mf3/W1vR/6mmv/+4tLr/xc3C/8XH - z//d3Nj/6OLj/+Li3P/m6+L/7/Lw//Hx8f/t7e3/8PDw//Ly8v/x8fH/8PDw//Dw8P/y8vL/8PDw//Dw - 8P/w8PD/8PDw/+/v7//v7+//7+/v/+/v7//w8PD/7+/v/+/v7//v7+//7+/v/+7u7v/u7u7/7u7u/+7u - 7v/t7e3/7Ozs/+zs7P/s7Oz/7Ozs/+zs7P/s7Oz/6+vr/+vr6//r6+v/6+vr/+rq6v/q6ur/6enp/+np - 6f/p6en/6enp/+np6f/o6Oj/6Ojo/+fn5//n5+f/5+fn/+bm5v/m5ub/5ubm/+bm5v/l5eX/5eXl/+Tk - 5P/k5OT/4uLi/+Hh4f/g4OD/39/f/97e3v/c3Nz/2tra/9jY2P/Z2dn/2dnZ/9LS0v+ioqKHAAAADwAA - AAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd19fX/+jo6P/n5+f/6Ojo/+np - 6f/q6ur/6+vr/+zs7P/t7e3/7e3t/+3t7f/u7u7/7u7u/+7u7v/u7u7/7u7u/+/v7//v7+//7+/v//Dw - 8P/w8PD/8PDw//Dw8P/v7+//8PDw//Dw8P/x8fH/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly - 8v/y8vL/8vLy//Hy8P/v8O7/6enp/+Lh4//Z2Nz/ysnN/y0u7v9lZe//eW/4/2509f9OTvT/IyPr/0M3 - 4/8lFez/Lif+/0hL9P9AOvP/Qz71/1xL//9gWv//LSr1/2Fb0v+lqrn/sre2/8TDxf/RzNX/2t7L/+zi - 8v/m5ef/4efm/+/v7//u7u7/8PDw//Ly8v/y8vL/8fHx//Hx8f/y8vL/8fHx//Dw8P/w8PD/8PDw//Dw - 8P/w8PD/8PDw//Dw8P/w8PD/8PDw//Dw8P/v7+//7+/v/+/v7//v7+//7+/v/+7u7v/u7u7/7e3t/+3t - 7f/t7e3/7e3t/+3t7f/s7Oz/7Ozs/+zs7P/s7Oz/6+vr/+vr6//q6ur/6urq/+rq6v/q6ur/6enp/+np - 6f/p6en/6Ojo/+jo6P/o6Oj/5+fn/+fn5//n5+f/5ubm/+bm5v/m5ub/5eXl/+Xl5f/l5eX/4+Pj/+Li - 4v/h4eH/4ODg/9/f3//d3d3/29vb/9nZ2f/a2tr/2tra/9LS0v+jo6OKAAAADwAAAAQAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd19fX/+jo6P/n5+f/6Ojo/+np6f/q6ur/6+vr/+zs - 7P/t7e3/7e3t/+3t7f/v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v//Dw8P/x8fH/8fHx//Dw - 8P/w8PD/8PDw//Hx8f/y8vL/8vLy//Ly8v/y8vL/8/Pz//Pz8//z8/P/8/Pz//Pz8//09PT/8/Pz//Hy - 8P/w8e//6+vr/+Tj5f/b2t7/zczQ/yst/f9mYvf/dXn2/1FW+f8mFv3/FAj8/3iNrP93ha//RD7f/zY6 - 7f9YVvD/TUf0/z00//9VSfv/Y13//yUp7P9nacf/pqe7/765tv/Aw8H/z9XU/+Ld3//n3+r/4efm/+zs - 7P/v7+//8PDw//Hx8f/y8vL/8vLy//Pz8//y8vL/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Dw - 8P/w8PD/8PDw//Dw8P/w8PD/8PDw/+/v7//v7+//7+/v/+/v7//u7u7/7u7u/+3t7f/u7u7/7u7u/+3t - 7f/t7e3/7e3t/+3t7f/t7e3/7Ozs/+zs7P/r6+v/6+vr/+vr6//q6ur/6urq/+rq6v/p6en/6enp/+jo - 6P/o6Oj/6Ojo/+fn5//n5+f/5+fn/+bm5v/m5ub/5ubm/+Xl5f/l5eX/4+Pj/+Li4v/h4eH/4ODg/9/f - 3//d3d3/29vb/9nZ2f/b29v/2tra/9PT0/+kpKSKAAAADwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAA - ACUAAABCAAAAZQAAAIaUlJTd2NjY/+np6f/o6Oj/6Ojo/+np6f/q6ur/7Ozs/+3t7f/t7e3/7u7u/+7u - 7v/v7+//7+/v//Dw8P/w8PD/8PDw//Dw8P/w8PD/8PDw//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Ly - 8v/y8vL/8vLy//Ly8v/z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Dx7//w8e//7e3t/+jn - 6f/g3+P/09LW/ygx7f9hXvr/anX1/ykn/f8yKv//GAv7/3+RqP+Wlqb/h46h/0A21v86PPT/XVr9/0JH - 6v9EQ/3/WVD7/09R//8wIO//f4W0/66ru/+8v8P/xs3K/83Pyf/g29z/6Orq/+np6f/v7+//8PDw//Dw - 8P/y8vL/8/Pz//T09P/y8vL/8vLy//Ly8v/y8vL/8vLy//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx - 8f/w8PD/8PDw//Dw8P/w8PD/7+/v//Dw8P/v7+//7u7u/+7u7v/u7u7/7u7u/+7u7v/u7u7/7u7u/+7u - 7v/t7e3/7e3t/+zs7P/s7Oz/7Ozs/+zs7P/r6+v/6urq/+rq6v/q6ur/6enp/+np6f/p6en/6Ojo/+jo - 6P/o6Oj/5+fn/+fn5//m5ub/5ubm/+bm5v/m5ub/5OTk/+Pj4//i4uL/4eHh/+Dg4P/e3t7/3Nzc/9ra - 2v/c3Nz/29vb/9PT0/+kpKSKAAAADwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAA - AIaUlJTd2NjY/+np6f/o6Oj/6enp/+np6f/r6+v/7Ozs/+3t7f/u7u7/7u7u/+7u7v/w8PD/8PDw//Dw - 8P/w8PD/8PDw//Dw8P/x8fH/8fHx//Hx8f/y8vL/8vLy//Ly8v/x8fH/8fHx//Ly8v/z8/P/8/Pz//Pz - 8//z8/P/8/Pz//Pz8//z8/P/9PT0//T09P/y8vL/8/Pz//Hy8P/x8vD/8PDw/+3s7v/n5ur/29re/ycn - 7/9QTvz/SEX4/ygm/P9XV///JBv0/3WBt/+ippv/m56c/4aOrP8lEvH/SEbz/15c9v86QO3/RTv//2NS - //9CPvv/PCTu/5Cdtf+wtLX/wr7E/8vMyP/b3Nj/4d/f/+jo6P/u7u7/7+/v//Hx8f/z8/P/8vLy//Pz - 8//z8/P/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8fHx//Hx8f/x8fH/8fHx//Hx - 8f/w8PD/8PDw//Dw8P/w8PD/7+/v/+/v7//v7+//7+/v/+/v7//u7u7/7u7u/+7u7v/u7u7/7e3t/+3t - 7f/t7e3/7Ozs/+zs7P/r6+v/6+vr/+vr6//q6ur/6urq/+np6f/p6en/6enp/+jo6P/o6Oj/6Ojo/+jo - 6P/n5+f/5+fn/+fn5//m5ub/5OTk/+Pj4//i4uL/4eHh/+Dg4P/e3t7/3Nzc/9ra2v/d3d3/29vb/9PT - 0/+kpKSKAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd2NjY/+np - 6f/o6Oj/6enp/+rq6v/r6+v/7e3t/+7u7v/u7u7/7+/v/+/v7//w8PD/8PDw//Dw8P/w8PD/8fHx//Hx - 8f/x8fH/8fHx//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/z8/P/9PT0//T09P/09PT/9PT0//T0 - 9P/09PT/9PT0//T09P/19fX/9vb2//P08v/z9PL/8vLy/+/u8P/q6e3/397i/z0++v8vHv//MCH4/z5B - +v9TSv7/OTL//1BI0f+ema7/lZyl/5KYl/9zc6n/Jxf4/05b9/9fWO//RTX0/05I+/9cWf//ODH4/1hZ - y/+nqq7/w7i7/8bHxf/O0dn/5N/g/+jo6P/t7e3/7e3t//Hx8f/09PT/8fHx//Pz8//09PT/8/Pz//Pz - 8//y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8fHx//Hx8f/x8fH/8fHx//Hx - 8f/w8PD/7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+7u7v/u7u7/7u7u/+3t7f/t7e3/7e3t/+3t - 7f/r6+v/6+vr/+vr6//q6ur/6urq/+rq6v/p6en/6enp/+np6f/p6en/6enp/+jo6P/o6Oj/5+fn/+fn - 5//n5+f/5eXl/+Tk5P/i4uL/4eHh/+Dg4P/f39//3Nzc/9ra2v/d3d3/3Nzc/9PT0/+kpKSKAAAAEAAA - AAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd2tra/+rq6v/q6ur/6enp/+rq - 6v/s7Oz/7e3t/+7u7v/v7+//8PDw//Dw8P/w8PD/8fHx//Hx8f/x8fH/8fHx//Ly8v/y8vL/8vLy//Pz - 8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/9PT0//T09P/19fX/9fX1//X19f/19fX/9fX1//X1 - 9f/29vb/9vb2//X19f/z8/P/8fHx/+/v7//s7Oz/6enp/3OH8v8uIfP/DQX5/0VD//9NQv//Oj7//xkd - /v9ZYsn/qaCj/6KXof+VlpT/UFPA/y8r7v9mafP/WVT3/0Y5+f9RTP//XFj9/yAd//9vc8T/pqjA/7y+ - xv/Rysf/0tLM/+Li4v/l5eX/7e3t//T09P/v7+//8vLy//T09P/y8vL/9PT0//T09P/z8/P/8/Pz//Pz - 8//z8/P/8vLy//Ly8v/y8vL/8fHx//T09P/z8/P/8/Pz//Pz8//w8PD/8PDw//Hx8f/x8fH/8PDw//Dw - 8P/w8PD/8PDw//Dw8P/w8PD/8PDw/+/v7//v7+//7+/v/+3t7f/t7e3/7u7u/+zs7P/r6+v/6+vr/+vr - 6//r6+v/6urq/+rq6v/r6+v/6+vr/+np6f/q6ur/6Ojo/+jo6P/q6ur/6Ojo/+bm5v/n5+f/5ubm/+Tk - 5P/l5eX/5OTk/+Dg4P/e3t7/3d3d/9ra2v/d3d3/3d3d/9PT0/+jo6OLAAAAEAAAAAQAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAFAAAAEQAAACUAAABCAAAAZQAAAIaUlJTd29vb/+vr6//q6ur/6urq/+vr6//s7Oz/7e3t/+7u - 7v/v7+//8PDw//Dw8P/x8fH/8fHx//Hx8f/x8fH/8fHx//Ly8v/y8vL/8vLy//Pz8//z8/P/8/Pz//Pz - 8//z8/P/8/Pz//Pz8//z8/P/9PT0//T09P/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9fX1//T0 - 9P/z8/P/8/Pz//Ly8v/w8PD/7e3t/8LF8f8bE/r/NTH8/z0z//89Ov//OD3w/0Mu9f8hEv//ZmrQ/5+i - p/+ampr/hYmb/0pFyv89QvX/XF/9/1VM8P9JO/7/VFf//1RK+v8rIPL/lqSi/7GtuP+5vb7/1tHQ/9nZ - 2f/e3t7/5eXl/+zs7P/r6+v/8fHx//T09P/19fX/8PDw//Ly8v/19fX/9fX1//X19f/09PT/8/Pz//Ly - 8v/z8/P/8vLy//T09P/y8vL/8vLy//Pz8//x8fH/8vLy//Ly8v/y8vL/8fHx//Hx8f/w8PD/8PDw//Dw - 8P/w8PD/7+/v/+7u7v/v7+//7+/v/+3t7f/t7e3/7u7u/+3t7f/s7Oz/7Ozs/+zs7P/s7Oz/7Ozs/+vr - 6//q6ur/6enp/+rq6v/r6+v/6Ojo/+fn5//o6Oj/6Ojo/+bm5v/l5eX/4+Pj/+Li4v/j4+P/4uLi/9/f - 3//d3d3/3Nzc/9ra2v/d3d3/3d3d/9TU1P+jo6OLAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAA - ACUAAABCAAAAZQAAAIaUlJTd29vb/+vr6//q6ur/6+vr/+vr6//t7e3/7u7u/+7u7v/v7+//8PDw//Dw - 8P/x8fH/8fHx//Hx8f/y8vL/8vLy//Ly8v/y8vL/8vLy//Pz8//z8/P/8/Pz//Pz8//09PT/9PT0//T0 - 9P/09PT/9PT0//T09P/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9fX1//T09P/09PT/9fX1//b2 - 9v/09PT/8vLy/+3m8/+Lg/j/HR/2/zQz9P84M+z/STv1/z09+/85Lf//FhP4/2tzzP+YoZ7/oJOh/3aB - of8pGfP/VVj3/2Fh8f9IPe3/R0D//2Vc//87NP//UljD/6inq/+qrrn/ycTB/87Ozv/Y2Nj/4eHh/+jo - 6P/p6en/7u7u/+3t7f/s7Oz/7u7u//Ly8v/09PT/8/Pz//Ly8v/y8vL/8/Pz//Pz8//z8/P/8vLy//T0 - 9P/z8/P/8/Pz//T09P/y8vL/8/Pz//Ly8v/y8vL/8vLy//Hx8f/x8fH/8fHx//Hx8f/x8fH/7+/v/+/v - 7//w8PD/7+/v/+7u7v/t7e3/7u7u/+7u7v/u7u7/7e3t/+vr6//r6+v/6urq/+rq6v/p6en/6Ojo/+rq - 6v/o6Oj/5ubm/+Xl5f/l5eX/5+fn/+fn5//k5OT/4uLi/+Hh4f/i4uL/4eHh/9/f3//e3t7/3d3d/9vb - 2//d3d3/3t7e/9TU1P+lpaWNAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQAAACUAAABCAAAAZQAA - AIaUlJTd29vb/+vr6//r6+v/6+vr/+zs7P/t7e3/7u7u/+/v7//v7+//8PDw//Hx8f/y8vL/8vLy//Ly - 8v/y8vL/8vLy//Pz8//z8/P/8/Pz//T09P/09PT/9PT0//T09P/09PT/9PT0//T09P/09PT/9fX1//X1 - 9f/19fX/9fX1//X19f/19fX/9fX1//X19f/29vb/9vb2//X19f/19fX/9vb2//f39//19fX/8vLy//f2 - 6P/a4fL/aWP2/yEj8/8/P/H/QT/t/zkz8P87Ovz/OzD//xUW+v9aWNr/n6Gp/5qZuf9VV8P/OSz8/2pw - 7f9eU/D/Qzr8/01Q+f9iWf//LyT9/29zrf+sqLP/tby5/8TExP/Q0ND/1tbW/9zc3P/g4OD/6Ojo/+rq - 6v/s7Oz/8PDw//Pz8//09PT/8/Pz//Ly8v/z8/P/8/Pz//Pz8//z8/P/8vLy//X19f/19fX/9fX1//b2 - 9v/z8/P/9PT0//Ly8v/y8vL/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8PDw//Dw8P/x8fH/8PDw/+7u - 7v/t7e3/7e3t/+3t7f/u7u7/7Ozs/+rq6v/p6en/6Ojo/+fn5//l5eX/5OTk/+bm5v/i4uL/4ODg/97e - 3v/d3d3/4eHh/+Pj4//f39//3t7e/97e3v/f39//39/f/9/f3//e3t7/3d3d/9zc3P/e3t7/3t7e/9TU - 1P+pqamXAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAEQQEBCYJCQlFCAgIaAgICImUlJTe2NjY/+fn - 5//n5+f/6urq/+zs7P/u7u7/7+/v/+/v7//w8PD/8fHx//Hx8f/y8vL/8vLy//Ly8v/z8/P/8/Pz//Pz - 8//z8/P/8/Pz//T09P/09PT/9PT0//T09P/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9fX1//X1 - 9f/29vb/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//f39//19fX/8vLy/+jv+P/59uH/z8/t/ycW - //8rK/P/SEP9/0ZA8/81NvL/Ozb9/zg19v8wK/j/OTnj/31+uv+GjqX/QULa/0lE8/9xbfT/RkXz/0E8 - /f9YVPr/Uk77/ygX8P+bnqP/nqmt/7e3t//Dw8P/ysrK/9HR0f/X19f/4eHh/+Tk5P/o6Oj/6enp/+zs - 7P/v7+//8fHx//Pz8//z8/P/8vLy//Hx8f/w8PD/7+/v//Ly8v/y8vL/8/Pz//T09P/y8vL/8/Pz//Pz - 8//z8/P/8vLy//Ly8v/x8fH/8fHx//Hx8f/x8fH/8PDw//Hx8f/w8PD/7+/v/+7u7v/t7e3/7Ozs/+zs - 7P/r6+v/6urq/+jo6P/n5+f/5ubm/+Pj4//f39//3d3d/97e3v/Z2dn/19fX/9XV1f/T09P/19fX/9ra - 2v/W1tb/2NjY/9nZ2f/a2tr/2tra/9vb2//b29v/2tra/9ra2v/e3t7/3t7e/9XV1f+qqqqXAAAAEAAA - AAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAFKioqFzAwMDI1NTVXMTExfC0tLZuWlpbkzc3N/9nZ2f/a2tr/4ODg/+fn - 5//s7Oz/7+/v//Dw8P/x8fH/8fHx//Ly8v/z8/P/8/Pz//Pz8//z8/P/8/Pz//T09P/09PT/9PT0//X1 - 9f/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//b2 - 9v/19fX/9vb2//b29v/29vb/9/f3//f39//29vb/9PT0//T3/P/o7fD/8vX6/8W+9/8gGPH/NCr4/01J - 7v9GS+3/RDvp/z89+/88Qfz/MS72/ycg8/9YVdD/dHiz/x8V//9gYPr/Wl7z/0FB7f9MQv//YFv//zwy - 9v9UT8r/j5al/6urq/+3t7f/v7+//8fHx//Ozs7/1tbW/9jY2P/c3Nz/4ODg/+Dg4P/k5OT/6enp/+3t - 7f/u7u7/8PDw//Hx8f/v7+//7+/v//Hx8f/x8fH/8vLy//T09P/z8/P/9PT0//X19f/09PT/8/Pz//Ly - 8v/y8vL/8fHx//Hx8f/x8fH/7u7u/+/v7//u7u7/7e3t/+zs7P/r6+v/6Ojo/+jo6P/n5+f/5eXl/+Li - 4v/f39//3Nzc/9ra2v/Y2Nj/19fX/9LS0v/Nzc3/zc3N/87Ozv/MzMz/z8/P/9LS0v/Q0ND/0NDQ/9LS - 0v/U1NT/1tbW/9nZ2f/Z2dn/2dnZ/9ra2v/e3t7/39/f/9XV1f+qqqqXAAAAEAAAAAQAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AABQUFAKZGRkKWtra1dxcXGMcXFxsXFxccqbm5vytLS0/7i4uP+7u7v/yMjI/9nZ2f/m5ub/7u7u//Dw - 8P/x8fH/8vLy//Pz8//z8/P/8/Pz//Pz8//09PT/9PT0//T09P/09PT/9PT0//X19f/19fX/9fX1//X1 - 9f/19fX/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//f39//39/f/9/f3//f39//19fX/9vb2//b2 - 9v/29vb/9/f3//f39//39/f/9vb2//b69f/w9vH/+f3y/+bv8//d2/j/ZGXz/zMs8/9MSO7/UEj5/0k/ - 7f8uM/r/Qz///0k2//8rJv7/FRDv/0M/5P82Mf7/b3Xy/05I9f9JPvj/Tkz//2Vm9P8rF/n/eX+u/5ub - m/+kpKT/rKys/7a2tv+8vLz/x8fH/83Nzf/S0tL/19fX/9fX1//a2tr/4eHh/+Xl5f/m5ub/6urq/+/v - 7//u7u7/7u7u//Hx8f/y8vL/8/Pz//X19f/09PT/9fX1//Pz8//z8/P/8vLy//Hx8f/x8fH/8fHx//Hx - 8f/x8fH/7e3t/+7u7v/r6+v/6enp/+np6f/m5ub/4+Pj/+Li4v/f39//3Nzc/9jY2P/U1NT/0NDQ/87O - zv/Nzc3/zMzM/8XFxf/CwsL/xMTE/8bGxv/FxcX/xsbG/8jIyP/IyMj/ycnJ/8zMzP/Ozs7/0tLS/9bW - 1v/Y2Nj/2dnZ/9vb2//e3t7/39/f/9XV1f+oqKiYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnweJiYkgiYmJVouL - i5KNjY3Bj4+P3ZCQkOyenp77pKSk/6SkpP+np6f/srKy/8PDw//W1tb/5OTk/+7u7v/y8vL/8vLy//Pz - 8//z8/P/8/Pz//Pz8//09PT/9PT0//T09P/09PT/9fX1//X19f/19fX/9fX1//b29v/29vb/9vb2//b2 - 9v/29vb/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//29vb/9/f3//f39//39/f/9vb2//f3 - 9//4+Pj/+Pj4//Dy/P/89/T/9u75//b48v/r8/P/5+n7/4F9+/8fIPT/RUL1/0xM9P9XRu3/PTL6/zU8 - /f89Pfv/NDT+/xcU/f8XC/3/WV3x/29p7P9EPvf/TEX//1RW+v9WSfn/SkfF/4mJif+Tk5P/np6e/6ur - q/+xsbH/urq6/76+vv/CwsL/y8vL/8vLy//Q0ND/2dnZ/9vb2//a2tr/3d3d/+Pj4//k5OT/5eXl/+vr - 6//t7e3/7u7u/+/v7//t7e3/7e3t//Dw8P/w8PD/8PDw//Dw8P/w8PD/8fHx//Hx8f/x8fH/7u7u/+3t - 7f/q6ur/5+fn/+bm5v/j4+P/3t7e/93d3f/U1NT/09PT/9LS0v/Pz8//y8vL/8bGxv/CwsL/wMDA/729 - vf+7u7v/vb29/8DAwP++vr7/u7u7/7u7u/+9vb3/w8PD/8bGxv/Jycn/zc3N/9PT0//W1tb/19fX/9nZ - 2f/e3t7/39/f/9bW1v+oqKiYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAn5+fBp+fnxqYmJhNl5eXlKamptjIyMj12tra/dra - 2v7Pz8//ycnJ/6ampv+fn5//pKSk/66urv+/v7//1NTU/+Xl5f/v7+//8/Pz//T09P/09PT/9PT0//X1 - 9f/19fX/9fX1//X19f/19fX/9fX1//b29v/29vb/9vb2//b29v/29vb/9vb2//b29v/29vb/9/f3//f3 - 9//39/f/9/f3//f39//39/f/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//r5 - 9f/59/b/9fX1//X29P/y9fP/9vX//+Xg/f+9suD/ERf+/zIt9P9ZUO3/VUnv/0E79P84N+v/QTz1/0M9 - +v8pJ/3/HSD+/2xv+f9kWfX/Qz3u/05M+v9dX///PC3z/1tbp/+OgpT/kZSS/5ydof+qoK3/qq6i/6+r - t/+stK3/vLe4/8TCwf/BxcD/xsvJ/8nPzv/P0tb/0dLW/9bX2//Y2Nj/2tra/+Dg4P/j4+P/5OTk/+bm - 5v/o6Oj/5+fn/+bm5v/o6Oj/6urq/+3t7f/q6ur/6urq/+/v7//v7+//5+vg/+Lj3//h4t7/3+LZ/9rY - 2P/Y0t3/19PY/9LUyP/Qzs3/ycfH/8PCxv/Bwsb/v8HB/7u+vP+5ubn/tLO1/7Szt/+vrrD/r6+v/6+w - rv+srav/rq6u/7Kxs/+ysbX/uLm1/766wP/Cvcz/vcPC/8bP0v/O2dH/2NfT/+PX1//c3Nz/3t7e/9bW - 1v+pqamYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAACfn58Cn5+fFp+fn0K/v7+q7Ozs8/////////////////////////////////z8 - /P/V1dX/ra2t/6Ojo/+srKz/vr6+/9PT0//m5ub/8fHx//T09P/19fX/9fX1//X19f/19fX/9fX1//X1 - 9f/19fX/9fX1//b29v/29vb/9vb2//b29v/29vb/9vb2//b29v/29vb/9/f3//f39//39/f/9/f3//f3 - 9//4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//v5+f/7+fn/+Pj4//n6 - +P/2+vX/9vj5//Ly///m4fz/1tP6/3V5/f8kJPr/Oj3z/1pV+P9LQPv/Q0Dz/zky8f83Mfz/MSb//05G - /v9rbOz/UkT2/049//9bUP//VVf8/yAY7v9fd4P/kYmT/5yRk/+XlJD/lZmT/6itrP+qpKn/q6ux/7e2 - uv/BvL7/yMHE/8jBxP/Kxcb/x8nD/8vRxv/Ozs7/1dXV/9nZ2f/X19f/1tbW/9zc3P/f39//3Nzc/+Xl - 5f/m5ub/5ubm/+fn5//k5OT/4+Pj/+jo6P/n5+f/5eHn/+Te6f/b2OH/1NXZ/9PV1v/MzdH/wsTE/8LD - v/+/wLz/urq6/7q1t/+4s7X/trGy/7CwsP+prLD/oqWt/6WkqP+ioqL/o6Sg/6SmoP+ho53/oaKe/6Oj - o/+joqb/qquh/7Kzt/+xta//v7y3/8/Lxv/Q1Mn/y8rU/9XV1f/c3Nz/3d3d/9bW1v+pqamYAAAAEAAA - AAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AACfn58Hn5+fLby8vIL7+/v8////////////////////////////////////////////////+fn5/66u - rv+ioqL/ra2t/7+/v//a2tr/7Ozs//Pz8//19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9vb2//b2 - 9v/29vb/9vb2//b29v/29vb/9/f3//f39//39/f/9/f3//f39//39/f/+Pj4//j4+P/4+Pj/+Pj4//j4 - +P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//z5+//8+fv/+Pf5//n6+P/4/Pb/9Pjy//T2 - 9v/29/v/9Pn3/+rt8f+mpvT/KBzw/yMc+f9MSez/WVD6/0pP8f9VR/P/OC7z/yAe+v9ubfL/bF75/zY8 - 7f9IR/H/cmH//00/8f9BSLv/dX2K/3+Gf/+LkI//m5ed/5OYmf+inZz/ra+p/6ysrP+tq7H/srGz/7i4 - sv/Awbf/xMW8/8XDwv/Hx8f/yMjI/8zMzP/Ozs7/zc3N/8/Pz//U1NT/19fX/9ra2v/b29v/2tra/9zc - 3P/a2tr/2tra/93d3f/d3d3/2tLc/9bU1P/Kz8b/xMzB/8PKxf+8v8P/s7K7/7Cwtv+tq7H/q6ix/6ik - r/+joKn/n5+f/6Ghm/+hopn/n5yX/5udl/+Zmpj/mpmb/5qYnv+WlJr/lpWX/5mamP+Zm5X/o52Y/6iq - qv+rrbX/xL+8/8q+vP/Mws7/y8/J/8zO2P/b29v/3d3d/9bW1v+pqamYAAAAEAAAAAQAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwGfn58OxcXFYvr6 - +vX///////////////////////////////////////////////////////////Dw8P+lpaX/o6Oj/6+v - r//Kysr/4eHh//Hx8f/19fX/9fX1//X19f/19fX/9vb2//b29v/29vb/9vb2//b29v/29vb/9/f3//f3 - 9//39/f/9/f3//f39//39/f/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/5+fn/+fn5//n5 - +f/5+fn/+fn5//n5+f/5+fn/+fn5//r4+P/6+fv/+fj6//n4+v/8/fv/+Pz3//X58//1+fP/9/f//+7x - 9f/6+fv/7PHw/5yd+P8kHPL/Lij9/1hO9P9UX/f/U1Ts/y4r8/9IRPv/a2/z/0tN8v9LQf//XVD6/2Nd - //8tG/L/YWaX/4OFhf99g4j/i5eL/42Slf+cmJ3/nKSZ/6Knnv+ur63/s7Cy/6qprf+tq7H/r7G5/7K1 - vf++vr7/urq6/729vf/CwsL/wsLC/8HBwf/Gxsb/zMzM/87Ozv/Pz8//zs7O/8/Pz//Pz8//zc3N/83N - zf/Ly8v/0M7G/8TCwf+6vbv/trq1/6+xsf+tq7H/rKmr/6mnn/+copf/m5+Z/5ibmf+Ul5X/kZWP/5SW - kP+Yl5P/m5aX/4+Rmf+NkJX/jI+U/4qNkf+GiY3/h4qP/4yPlP+OkJj/oZ2i/6akpP+orKf/sriz/7q+ - sv/NyMf/19HW/9PQ3//c3Nz/3t7e/9fX1/+tra2jAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwHW1tYo+vr65/////////////////// - ///////////////////////////////////////////////////i4uL/oKCg/6enp/+4uLj/0dHR/+np - 6f/09PT/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//f39//39/f/9/f3//f39//39/f/9/f3//j4 - +P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5 - +f/5+fn/+fn5//j4+P/5+fn/+/r8//r5/f/49/v/+fj8//r6+v/6+/f/9/b4//z3///39/f/8fL8/+Xr - 8v/g7Pj/ioz4/ycY9f8oKvT/VFb6/09Q+P8gG/j/YWP9/3Bo9f8/PPD/Q0L8/2Jg//89QvX/Gwv4/0s4 - 1f9sa63/fYSd/5CLoP+LlZX/pZ6b/6Kdn/+ko6z/oqWt/6Knqv+nrKv/sK6t/7Svrv+0tLT/tLS0/7W1 - tf+1tbX/tra2/7q6uv+9vb3/u7u7/7+/v//AwMD/wMDA/8LCwv/CwsL/wMDA/76+vv+7u7v/uLyw/7Kx - tf+vq7f/qamp/6Khnf+emJ3/nJSb/5mRkf+WkJH/k5GR/42Skf+KlZP/hpKW/36Lm/94fqH/dnep/2dl - sf9mY7P/ZmC5/2Rcu/9hWbj/Yly1/2Visv9nZbH/e4ml/5uepv+xrLX/srq6/7/Kwv/Hwcb/zsbH/9jf - 0v/c3Nz/3t7e/9fX1/+vr6+lAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwL29vaE//////////////////////////////////////// - ////////////////////////////////////////w8PD/6Kiov+rq6v/wcHB/9vb2//t7e3/9vb2//b2 - 9v/29vb/9vb2//f39//39/f/9/f3//f39//39/f/9/f3//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//n5 - +f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//v8 - +v/3+Pb/+fr4//r5+//39P3/9/T9//n4/P/6+vr///nu///6///y8v//9Pv+//H39v/y8///3+T9/9Pj - +v+SkPT/NiD0/zQt+v8dK+//Ozr7/3Rn//9SU/H/Rz/3/01P//9dYv3/LSX//ywk7f8fGPX/HhL4/19Y - x/98fan/n52z/6Chr/+lqqv/oKih/6erpf+srav/rqqp/6+qqf+urq7/rKys/6ysrP+vr6//sLCw/7Ky - sv+ysrL/sLCw/62trf+vr6//rq6u/7Gxsf+0tLT/srKy/7CwsP+urq7/oqem/6WnqP+joaH/nZqV/5qX - k/+VkJH/iouH/4iNfv9+h4v/fIKJ/3h7iv9ycZj/ZmCx/0lCzf8rH+n/Gwv8/xwb+/8eHfz/HyD6/x8h - +P8eIPf/HR74/xwb+v8bGvr/JxX2/2t1q/+io7f/sre6/7vAv//OxtH/1NDV/8vWzv/b29v/3t7e/9fX - 1/+vr6+lAAAAEQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAJ+fnwP6+vqw//////////////////////////////////////////////////////// - ////////////////////////+fn5/6qqqv+jo6P/srKy/8jIyP/i4uL/8fHx//b29v/39/f/9/f3//f3 - 9//39/f/9/f3//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+fn5//n5+f/5+fn/+fn5//n5 - +f/5+fn/+fn5//n5+f/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//z7/f/3+Pb/+fr2//v8 - +v/7+v7//vr///z5+//9/Pj//P37//r49////fX//f70//T6///r9/n/+v/0//rv8f/o6f7/zM/u/46H - //8gHPf/Fhjy/2lq+P9vYvT/TT/4/0pG+f9iWv//TUr+/zAl//9CRvP/ODb0/ysi9P8oHf3/Ni3o/1pX - 3P+Hisf/nJ+u/66tr/+vrbP/pKit/6Gtrf+srKz/pqam/6ampv+qqqr/qamp/6Wlpf+jo6P/pKSk/6Cg - oP+ioqL/np6e/5+fn/+hoaH/n5+f/5+fn/+enp7/mpyk/56env+Yk5T/j4eR/4yHkP+DiIv/cn6K/2dy - kP9mY6H/U0+2/zgw0f8jGuz/IRf9/ygg//81Lvv/QDn4/zk4+v87Ovz/Ozn9/zs5/f87Of3/Ozn9/zk4 - +v82Nff/IRv8/y4d9v9VRdj/qbK7/7+7xv/HycP/ztHP/87Q2P/b29v/3t7e/9fX1/+vr6+lAAAAEQAA - AAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+f - nwP9/f3Y/////////////////////////////////9/X//+cg///7Of///////////////////////// - /////////////+Li4v+goKD/p6en/7a2tv/S0tL/5+fn//T09P/39/f/9/f3//f39//39/f/9/f3//j4 - +P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+vr6//r6 - +v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//r5/f/7/Pr//f/5//n79f/7+fn//fr8//r5 - 9f/7/PP/9vn9//f79f/6+vr///r////99P//+fX//vb///b4+f/v+ez/6unr/+Lk7P+3t+X/S0jy/zE1 - +P9xdfL/YFrv/0k4+f9YSvz/ZmT//yQi/v86N/H/UUnq/0VJ9v9DR+z/Oj7x/y8r9v8lGfX/Jx3i/1xX - 4v+NjtL/oqW0/7KwqP+vr6//rq6u/62trf+oqKj/o6Oj/6Ghof+enp7/mJiY/5WVlf+VlZX/kJCQ/5CQ - kP+Tk5P/lJSU/5WVlf+Wlpb/jY6S/42Pif+QjIv/jYaN/3+Egv9ueIn/Tkm2/zER5v8VF/H/JCP7/zQu - //88Nv//QDz//z49/v84O///Njr//0I4/f9COPz/Pzf2/z028f8+N/L/Pzf2/z81+f89M/j/ODn5/yQm - /P8lFvP/nKLP/8DDwf/O18r/0dbV/9jT0P/b29v/3t7e/9jY2P+wsLClAAAAEQAAAAQAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM/Pzwb////7//////// - /////////////////////////1wz//8zAP//ZT////z7//////////////////////////////////// - ///Dw8P/oaGh/6qqqv/CwsL/2tra/+7u7v/19fX/9/f3//f39//39/f/9/f3//j4+P/4+Pj/+Pj4//j4 - +P/4+Pj/+Pj4//j4+P/4+Pj/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/6+vr/+fn5//j4 - +P/29vb/9PT0//Ly8v/19fX/9/f3//n5+f/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//r6 - +v/6+vr/+vr6//v7+//7+/v/+vr6//n5+f/49O//7e/v/+Xq6//n5OD/wMTg/yIX+f9rYfv/a2j0/0RB - 9f9JQ///WVP//1hS/f8lHfb/QTH6/zw+8P9HO+3/TUbv/0pC8/9ERO7/PD73/yss+P8fHfP/Ghbr/z5F - 8P+Hhcv/k5rB/5qewf+borH/pK2q/5mapP+Ulpf/lJeO/42Slf+Nloz/iJKG/4aKhf+MiYT/kJCC/42R - i/+DhZD/i4aD/4uJif99gpH/ZW2i/zpCvf8bF/L/IR///ywn//9DOP//RDv//0U8/v9DOvz/QTb2/0U8 - 8f9VTvL/ZmP1/3ty8f97e+//dnj0/3J38v9zcv7/cWz9/3Bt+f9rbu7/aV76/01P8/8DE/n/nprb/8rG - y//Z0dz/1NfO/9PQ2f/a2tr/3d3d/9fX1/+xsbGlAAAAEQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPf39yL///////////////////////////// - /////////zkH//8zAP//MwD//6KL///////////////////////////////////////5+fn/qamp/6Oj - o/+wsLD/yMjI/+Tk5P/x8fH/9/f3//f39//4+Pj/+Pj4//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5 - +f/5+fn/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+Pj4//X19f/y8vL/7u7u/+rq6v/l5eX/4eHh/9/f - 3//j4+P/6urq//Dw8P/19fX/+fn5//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+/v7//v7 - +//7+/v/+vr6//n5+f/7/Pj//Pf///Xx/f/k7Ov/1tnn/4KH3P8vL/n/fXn2/1pf8P9EOfP/VUj3/2Jd - /v84Mv3/PTr//1NL//9OR/z/RTv//zwy+v9DQvD/Qjzv/0o/+v9KR/H/Q0D0/zUx9f8hJOv/HhH7/yIP - 7v9QS+L/ZWTM/3p5u/+Lkqb/goOd/4WFl/+Khov/jYWF/42FjP+Ig5L/hYaQ/4eKjv+LiYn/gYKW/29u - pv9DOsr/IRX3/ywp+v9AOPr/Qjf5/0I6/f9EPPX/QD3x/0ZK7/9dZvP/dX/1/36F8v95e/H/cHHx/1BJ - /v9BOPr/NCj8/ygi/f8bFv//Iyn0/yof/f9BMv//YmT4/2tv7P8ZE/z/mpLZ/8zX1f/X1t//2Nnd/9Pc - 2f/b29v/3t7e/9jY2P+xsbGlAAAAEQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAANnZ2QX//////////////////////////////////////0IT//8z - AP//MwD//zkH///f1///////////////////////////////////////4uLi/6CgoP+np6f/uLi4/9LS - 0v/p6en/9vb2//j4+P/4+Pj/+Pj4//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+vr6//r6 - +v/6+vr/+fn5//f39//09PT/7e3t/+Pj4//Y2Nj/zc3N/8TExP/AwMD/vb29/7y8vP/BwcH/ysrK/9jY - 2P/m5ub/8vLy//n5+f/7+/v/+/v7//v7+//7+/v/+vr6//r6+v/6+vr/+/v7//v7+//7+/v/+vr6//r6 - +v/0+fj/+fTx//b08//m8Or/4+Pv/8fN1P8lJvL/Y1j6/2pr6/9MP/X/UT7//15X//9XTP//GhP2/15X - 9P9ga///bmD7/2ZZ+/9XTP//Qzj//0E8+/8+OvH/RT32/0tF6v9LQ/T/TUrz/0RB9f8zNPD/Jyj0/xob - +f8SFfn/Cg73/0o/y/9NRr//U1Kw/2Jkpf9udJf/dn6P/3mAlP92d53/QELE/yUX+f8vKP//RDz//0w6 - //9GN///Qj30/0pE9/9qZ/n/dnj1/32B+P9qbf7/RkX//y4q+P8vMOz/PULk/2Jj1f90dcv/h46//3V7 - xP9TVNr/Jhrw/y4s8P8zLfD/KCP6/0dA+/8YEPH/pqbU/8/S2v/k4Nv/4+DS/9rU3//d3d3/39/f/9jY - 2P+ysrKlAAAAEQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAJ+fnwH//////////////////////////////////////0wf//8zAP//MwD//zMA//9f - N////Pv//////////////////////////////////////8PDw/+hoaH/rKys/7+/v//c3Nz/7+/v//f3 - 9//4+Pj/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//j4+P/09PT/7+/v/+fn - 5//f39//1dXV/8nJyf+8vLz/sbGx/6mpqf+np6f/paWl/6Wlpf+oqKj/sLCw/729vf/Ozs7/4ODg//Hx - 8f/4+Pj/+/v7//v7+//7+/v/+vr6//r6+v/7+/v/+/v7//v7+//7+/v/+vr6//r6+v/5+f//+vfz//L0 - 9P/y7u3/7e3z/93f6v+Ijer/NSz+/3Jx9v9mX/b/Oy/z/0tD//9sY///Oiz8/zou5v81J/v/WUr//2pi - /f92c/H/dnT8/11Y+/9RT/3/T0r//0c8/P9GPfH/Qjjw/0tA+v9JRO3/UFDw/05J+P9JQvf/RT/w/zAs - 9/8qKvj/ICH7/xsW+/8bEPL/GxPq/x0Y7/8YFPX/LDD7/zY0/P9DQvb/PDf4/z476/9ZVPf/bm/7/3R/ - +P9pbP3/SkT9/zIl9f88MuP/X1/L/3uBvP9/hMH/eXrL/2x5z/9iaNH/SELd/ygZ8f8lI/j/KS/6/zg6 - 9/9OTff/dnf//1JJ//8mHvT/v7/d/+Tf3v/h3N7/2uTT/9ne3//e3t7/4ODg/9jY2P+0tLSqAAAAEQAA - AAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+f - nwL+/v7i/////////////////////////////////2I7//8zAP//MwD//zMA//8zAP//mX////////// - //////////////////////////////n5+f+rq6v/pKSk/6+vr//Kysr/4+Pj//T09P/5+fn/+fn5//r6 - +v/6+vr/+vr6//r6+v/6+vr/+vr6//n5+f/29vb/8/Pz/+7u7v/m5ub/29vb/8vLy/+9vb3/srKy/7Cw - sP++vr7/yMjI/9XV1f/j4+P/4eHh/7q6uv+goKD/oqKi/6enp/+xsbH/xMTE/+Li4v/z8/P/+vr6//v7 - +//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//3+/D/9Pvs//n7/P/48vP/9fDx/+Dh - 9f/PzeD/Jh3v/1ZW//9xcfP/UU3z/0U7//9dWfj/YVT8/zk96v99jc//YWvh/0xN8f82K/f/UD///21Z - //9+bvz/enD//2pf//9TVvj/U1D//0Y/+v9JQvf/Qjzp/0c97v9LP/P/TEXp/0ZJ8v9HRPT/RUH0/zo5 - 8/8hIPL/EQz3/yUd/v89Ofz/RTv//0I99P9BPvH/Vlj6/3F87v95eP3/YFv8/zo28/8MDP//Dwz8/xIL - 9v8QCvf/Dgv6/xEQ+v8dGPX/KSDy/y0l9P8vKfj/PD/1/zs99v8+Nvn/Szr//2ld/f+Hgv3/hIT//0gx - 9/96h+n/1NXj/9vP4f/i4tb/3OHf/9Xc2f/f39//4ODg/9jY2P+0tLSyAAAAEgAAAAUAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwH+/v7a//////// - /////////////////////////2xH//8zAP//MwD//zMA//8zAP//NQP//9nP//////////////////// - ///////////////////n5+f/oKCg/6ampv+3t7f/0dHR/+vr6//29vb/+fn5//r6+v/6+vr/+vr6//r6 - +v/4+Pj/9fX1//Dw8P/m5ub/29vb/8/Pz//ExMT/urq6/7Gxsf+9vb3/29vb//v7+/////////////// - ///////////////////t7e3/vr6+/6Ghof+kpKT/s7Oz/9HR0f/p6en/+Pj4//v7+//7+/v/+/v7//v7 - +//7+/v/+/v7//v7+//7+/v/+/v7//v7+//+/f//9fj8///7/f/1+vj/8+3u//H25//g3+H/iZPq/y8t - +/9scun/Zlr6/0A16f9QUP//Ylv//zQs//+Bf8v/r7bH/73Az/+0sNr/lpbi/2dq8f8uJPL/Myb2/1NJ - 9/9sX/v/cGf+/3Jv+/9rZv//Xlj9/1dS//9NQ///ST///0RD9/8+Pvb/MCv4/ygd//8oH///NjD//0M8 - //9DOP//PTf0/1tP//97cfr/gH3w/1BT8v8hG///MCr5/1ZD8P9RS/D/SEjw/0JG8v9ER/b/TEr4/05L - 9f9MTPT/Rkzx/0dI8P9ERPb/PkDy/z868/9cVfr/e23//5iS/f+Hd/r/QzD5/4eE4P/H0eL/3d/p/+Dn - 4P/h2+D/6ODh/+Hc3f/g4OD/4ODg/9jY2P+0tLSyAAAAEgAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD9/f3D//////////////////////// - /////////39f//8zAP//MwD//zMA//8zAP//MwD//1kv///8+/////////////////////////////// - ////////x8fH/6Ghof+qqqr/v7+//9vb2//u7u7/9/f3//r6+v/5+fn/9vb2//Hx8f/q6ur/4eHh/9jY - 2P/MzMz/wMDA/7S0tP+0tLT/z8/P//Dw8P////////////////////////////////////////////// - /////////////+vr6/+jo6P/qamp/8DAwP/d3d3/9PT0//v7+//8/Pz//Pz8//v7+//7+/v/+/v7//z8 - /P/8/Pz/+/v7//v7+//+/Pz/9fj8//v+7//4//j/8e/1//f26P/b2Oj/0tvo/ygX9P9bXPT/b231/1RM - 7f9AOv3/WVr//1FO8f9XUNv/tLm4/7fBwf+/ytL/z9jb/97d7f/Nzev/sb3n/4mT6v9QXvT/KB31/zYm - //9FOf3/XVH//29p/v94dPz/fHf8/3py//9LPf//KBr8/zAr/P9CPfz/Qzn9/0Q8+/9FRPL/enD//3J1 - 9f9JT/b/IiT+/y4w8v9JP/f/T0T0/0NF6v9DQPP/Qz/y/0Q+8f9BPfD/PDvv/zs58P9BOPP/Rzj3/0Y7 - /f9YS/r/Z1D+/4Zz//+RhP//hoH8/1pF+P9eUvL/qKfp/93j4v/s6N3/4ePk/9/m4//d3en/293e/93j - 3v/g4OD/4ODg/9jY2P+0tLSyAAAAEgAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwH9/f23/////////////////////////////////4xv//8z - AP//MwD//zMA//8zAP//MwD//zMA//+Zf///////////////////////////////////////+vr6/6ur - q/+jo6P/sLCw/8fHx//h4eH/8PDw//Pz8//w8PD/6Ojo/93d3f/Pz8//wcHB/7W1tf+vr6//xMTE/+Tk - 5P/+/v7///////////////////////////////////////////////////////////////////////// - ///Y2Nj/pKSk/7Gxsf/Pz8//7Ozs//j4+P/8/Pz//Pz8//v7+//7+/v/+/v7//z8/P/8/Pz//Pz8//v7 - +///+/r//fz///T7+P/99v3/7Pj6//v19v/y7+r/3Njj/4eM6f89Mv7/ZXD2/11b9P9ENvn/Skf//3Nl - +f8pJPv/oJbB/7+9w//Oysn/2NjS/9fW2P/a1+f/3Nvd/+Db3P/Hx9X/trfM/5mexf9/gNb/WFrX/zY1 - 3/8jGvf/Kyv//ywi//8vJf//NjD//z49//86Ovz/QDzz/2Fc9f+Affj/S1P0/ykf//8oIfj/Ny37/zoy - 9P9APPn/Rkf7/0dH//9TS///Uk///1NT+/9YVvz/YFf//2hd//9vZv3/dm77/4F+/P+Ihf//gHn//2hj - //9ANvv/VE/w/5ad7P/T3fX/4N70/9vk5//m5ub/4uPf/+nl4P/k5N7/4eDk/+Le3f/g4OD/4ODg/9fX - 1/+0tLSyAAAAEgAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAJ+fnwH8/Pyk/////////////////////////////////5l///8zAP//MwD//zMA//8z - AP//MwD//zMA//81A///2c///////////////////////////////////////+fn5/+fn5//pqam/7W1 - tf/Ozs7/29vb/9zc3P/S0tL/yMjI/729vf+0tLT/urq6/9fX1//4+Pj///////////////////////// - ////////////////////////////////////////////////////////////////////////wcHB/6io - qP/CwsL/39/f//Pz8//7+/v//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz/+/v7//r6 - +v/4+Pj/9vb2//X19f/u7u7/5eXl/8/a2P8hE///aGft/2xo9/9DSu3/RDz//2ZU//9WU/3/SVDj/7a4 - wv/Bxcb/1MnF/9zV0v/K3Nv/3Nvd/9PO0P/Ix9D/w8PD/8G3xP+0qrf/pKOl/5OXqv9VW8z/Agz//zUo - //9FO///QTj//zk8/P9JT+7/eXT3/2tq8P8rL///FRb6/xwb+/8mI/v/NS/+/0hA//9bUf//amD//3Jp - //94bf//eW///3x1//+AeP//gHf//39y//95av//dmP//0pJ/f86MPX/QCzw/3Nm9/+usPD/2OLp/+Tq - 5f/p5+3/5+fn/+fn5//m5ub/5eXl/+Pj4//i4uL/4ODg/97e3v/g4OD/4ODg/9fX1/+zs7OzAAAAEgAA - AAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAD8/PyT/////////////////////////////////6+b//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//WS////z7///////////////////////////////////////Hx8f/oaGh/6ioqP+5ubn/wsLC/8HB - wf+3t7f/srKy/8vLy//s7Oz///////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////8/Pz/6SkpP+6urr/1tbW//Dw - 8P/7+/v//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz/+/v7//z8/P/8/Pz/+vr6//f3 - 9//09PT/7+/v/9PZ5P+Ag+v/Oy///3Fw9f9TV+z/RDr+/1JM/f9hWv7/MiH7/5CYvf/AwMb/0s3E/8bI - yP/T0tz/zNDK/8nAyv/IxcH/ubi6/6myqP+pqaP/n5ms/1pZ0f8kHPz/OjP6/0ZB+v85Of//PT3v/2Nc - 8/9+dfv/Tkz6/ycg8/+Yjuv/lpXz/42M8/+AfvX/b231/15c9f9OTvT/REXz/z5A8v9IP/P/SD/0/0s/ - 9f9MQfX/Uknz/1tX8/9naPb/cXP3/52d9/+usvP/w87u/9nl7//k6+7/6+3u/+7p6//w6uv/6Ojo/+jo - 6P/n5+f/5eXl/+Pj4//i4uL/4ODg/93d3f/g4OD/4ODg/9fX1/+zs7OzAAAAEgAAAAUAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8/PyD//////// - /////////////////////////7mn//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//5V7//// - ///////////////////////////////////6+vr/q6ur/6Ghof+mpqb/qamp/8DAwP/g4OD//Pz8//// - //////////////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////7Kysv+5ubn/1dXV/+/v7//7+/v//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/9/f3/+/v7//z8/P/9/f3/+fn5//X19f/z8/P/8fHx/+Lo - 7//ByNf/Ixvy/2Bl9v9uZ/j/SUbw/0A/+f9mWf//SkD+/1la2v+1sb3/u7zG/7nDtv/Oy8P/w8PD/8O+ - u/+9vav/tLC1/6enrf+QmqT/VVDT/ywb/v89OPn/TkH//zw8+v89O+v/aGzz/3x59P9HOPT/a2f//8/T - 7//b3u3/7+vw/+3q8//s6PT/6uf2/+no+P/o6Pj/5+r4/+fq+P/f6PL/3+f0/+Hn9P/e5PH/3OLv/+Dl - 7v/k6u//6O/y/+ns6v/u8e//8fLw/+7v7f/q6Oj/7+rs//Hq7f/y6/D/6enp/+np6f/n5+f/5eXl/+Pj - 4//h4eH/39/f/9zc3P/g4OD/39/f/9fX1/+zs7OzAAAAEwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8/Pxr//////////////////////// - /////////8y///8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zUD///Sx/////////////// - ////////////////////////5+fn/6urq//R0dH/9fX1//////////////////////////////////// - /////////////////////////////////////////////////////Pv//8Kz//+Zf///r5v///z7//// - /////////////////////////////8vLy/+/v7//3d3d//Pz8//7+/v//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz/+/v7//39/f/9/f3/+/v7//n5+f/4+Pj/9vb2/+jt6//b1+P/dXvk/zU1 - /f97dPP/VFXt/0E9+v9YS///XVv1/ysi+/+ambv/p6zB/7q4uP+1sbb/uq/D/7m2sf+qqa3/rKun/5iY - qv9SS9T/IyT2/z5A+f9UQ/7/PjH5/0RF+f91df//c2z3/zMw9/91f/H/4uLo/+nn7f/69f7/8fb0//H2 - 9f/x9fb/8PT1//L09f/y9PT/8vXz//L28f/y8/f/8vT0//L28P/x9+z/8ffs//Hy8P/w7vT/7+v2//Py - 7v/w7u7/7+vw/+7s8v/v7vL/7O7u/+rt6//p7ej/6enp/+np6f/o6Oj/5eXl/+Pj4//h4eH/39/f/9zc - 3P/g4OD/39/f/9bW1v+zs7OzAAAAEwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8/Pxi/////////////////////////////////9nP//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//9SJ///+ff///////////////////////// - //////////////////////////////////////////////////////////////////////////////// - /////////////////////////+Xf//+Ve///SRv//zMA//8zAP//MwD//8W3//////////////////// - /////////////9vb2//IyMj/5+fn//f39//8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/7+/v//Pz8//39/f/8/Pz/+/v7//v7+//6+vr/9fX1/+vq7P/i3uP/w87c/ygg9/9mae//Zl/2/0ZC - 7/9HPv//YmD5/zc2/P9iZsz/oaul/6+xq/+oqqT/qaqm/6emov+gpKX/lZyl/1FIzv8yJP7/Q0P//zxA - 9/8+Ov3/YFL4/3Z9/P9lau//LyX7/5KU8//g6Oj/4u7o//P06v/39O///Prw//v48P/79/L/+vXy//j0 - 8//48/T/9vT0//b09P/28vj/9PD2//Lu9P/y7vP/8/Dy//bx8v/28vH/9fHw/+7t9//s7fH/7PDr/+vx - 7P/q7+7/5+vs/+fr7P/p7u3/6enp/+np6f/n5+f/5eXl/+Pj4//h4eH/39/f/93d3f/g4OD/39/f/9bW - 1v+3t7e/AAAAEwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAD7+/tG/////////////////////////////////+Xf//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//j3P///////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////n3//+5 - p///bEf//zMA//8zAP//MwD//zMA//8zAP//Pw///+zn/////////////////////////////////9LS - 0v/R0dH/8PDw//r6+v/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//f39//39 - /f/7+/v/+vr6//v7+//5+fn/8/Pz//Tz9//x8eX/1Nfc/25q6P87OP//eHD5/1NS7v9GPvf/VUz//1RR - +/8iHer/kZGj/5icp/+oo6L/nKKh/5+jqP+HlKL/T0XO/zss//9COv//Qzr//0A/+f9TWPD/fHv//2NY - +v8qGvT/pqnt/+zr9f/y8fX/+fX7//P4+//w8/j/8vX5//H0+P/z9Pj/8vP3//Py9v/18fb/9fH2//fx - 9v/x9fD/8fTy//Dy8//w8fX/8PH1/+/x8f/u8u3/7vPq/+3w7v/t7/D/7e7y/+zr7//u7e//7e3t/+/r - 8P/s5/D/6enp/+jo6P/n5+f/5eXl/+Pj4//i4uL/39/f/93d3f/g4OD/39/f/9bW1v+2trbAAAAAEwAA - AAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAD///8///////////////////////////////////z7//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//NQP//9LH//////////////////////////////////////////////////// - ///////////////////////////////////////////////c0///j3P//0IT//8zAP//MwD//zMA//8z - AP//MwD//zMA//81A///z8P//////////////////////////////////////9DQ0P/c3Nz/9fX1//v7 - +//8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//39/f/9/f3//f39//7+ - /v/+/v7/+/v7//Hx8f/39vL/4drn/7i93P8uIvb/XmXy/2Jl8P9HPOz/SD///2Nc//8yKvP/bW25/46R - oP+ckZn/kZWa/4KNqP9LR9b/MSby/0Q6//9KRfr/PDj1/19f8/97fPb/WVr4/1pX6f/R0e//4+L2/+zt - 9//58vX//Prv//Lv+P/v9/b/9PT6//T0+v/09fn/8fX2//H29f/x9vX/8Pb1//D29f/z8vb/8/L0//Ly - 8v/x8u7/8fLu//Dy7P/x8+3/8fPt//Hv7//y8e3/9PXs/+7v5v/v8Of/7u7o//Dv6//t7Oj/6enp/+np - 6f/n5+f/5eXl/+Pj4//i4uL/39/f/93d3f/g4OD/39/f/9bW1v+2trbAAAAAEwAAAAUAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACfn58Bn5+fAZ+fnwH19fUj//////// - //////////////////////////////81A///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//1In///59/////////////////////////////////////////////////////////////// - ///////////////18///r5v//183//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zUD//+8 - q////////////////////////////////////////f39/9PT0//o6Oj/+Pj4//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz/+/v7//z8/P/9/f3//Pz8//v7+//8/Pz//Pz8//f2 - +P/n5+3/7Ojn/9TZ4v9kXuv/O0j+/3F07v9WR/b/RTv//1pM//9bS/f/NTfR/42Njf+RjIv/jo6O/1NK - wv8sI///REL5/0Q//v8+Nvn/ZWD3/3Jv//9VUPP/Wlby/9fb4P/a4fL/9PT6//v39v/6+fX/9fL0//v6 - 8P/9+Pf/+fj0//n58//7+PP/+vfy//r38v/79vP/+vXy//r19P/08vH/9PLx//Ty8f/08vL/9PHz//Tw - 9f/x7/X/8O70//Tz7//x7vD/8O70/+3q8//v7fP/6evs/+rs7P/p6+v/6enp/+np6f/n5+f/5eXl/+Pj - 4//h4eH/39/f/9zc3P/g4OD/39/f/9bW1v+2trbAAAAAEwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAn5+fAp+fnwefn58Mn5+fEp+fnxfPz882//////////////////////// - //////////////9MH///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//+P - c///////////////////////////////////////////////////////////////////0sf//4Vn//88 - C///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//6yX//////////////////// - ////////////////////////5OTk/+Tk5P/09PT/+/v7//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7/+r2+P/78u//7unm/+fp - 6f+vruD/LCb7/29u8/9bXPL/STbx/01I9/9TXPr/KCXs/2Z3nv+Dh5r/QEHP/ycf//9GQv//RkP3/z02 - /f9XXun/eX30/1dG//9iYeb/6eLl/+vr6//z8/P/+Pj4//b29v/09PT/9vb2//j4+P/39/f/9vb2//b2 - 9v/29vb/9vb2//X19f/19fX/9fX1//X19f/09PT/9PT0//T09P/z8/P/8/Pz//Ly8v/x8fH/8fHx//Dw - 8P/w8PD/7+/v/+/v7//u7u7/7e3t/+zs7P/r6+v/6enp/+jo6P/n5+f/5eXl/+Pj4//g4OD/3t7e/9zc - 3P/f39//3t7e/9XV1f+3t7fAAAAAEwAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwKfn58Gn5+fB5+f - nwufn58Rn5+fHZ+fny2fn58/n5+fUZ+fn2Kfn590//////////////////////////////////////9Z - L///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//81A///z8P///////// - ////////////////////////////////////7+v//6WP//9VK///MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//oov///////////////////////////////////////// - ///6+vr/39/f//Ly8v/6+vr//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//X6+//9+vX/7ubx/93h3P/T0e7/UE7j/09Q - /v9paPT/TUXw/0pB//9WU///PDL//0dLwf9NT7X/MR34/zs8+P9FO///Pjf+/1ZQ9f9ydf//WVP//1hW - 7//g2e7/4+v4//Hx8f/29vb/+Pj4//f39//29vb/+Pj4//j4+P/39/f/9vb2//b29v/29vb/9vb2//X1 - 9f/19fX/9fX1//X19f/09PT/9PT0//Pz8//z8/P/8/Pz//Ly8v/x8fH/8fHx//Dw8P/w8PD/7+/v/+/v - 7//u7u7/7e3t/+zs7P/r6+v/6enp/+jo6P/n5+f/5eXl/+Pj4//g4OD/3t7e/9zc3P/f39//3t7e/9XV - 1f+3t7fAAAAAEwAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAACfn58Bn5+fA5+fnwefn58Mn5+fFJ+fnx6fn58qn5+fNJ+fnz+fn59Ln5+fXZ+f - n3Kfn5+Hn5+fnZ+fn7Ofn5/H+/v7/f////////////////////////////////9lP///MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//TB////Xz//////////////////// - /////////8m7//95V///OQf//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//+Mb/////////////////////////////////////////////39/f/k5OT/8fHx//r6 - +v/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8///9/f/y8/f/9PLy/+fq4f/h3u3/l57X/yYm//9wbvb/VlP8/z84 - 9f9PR///VVL1/yUV9v8aEvP/Ni35/0M///8/M///TUb1/3B0+P9gV/v/IhXz/8XK4//q79r/6PD9//b2 - 9v/39/f/+Pj4//j4+P/4+Pj/+fn5//j4+P/29vb/9vb2//b29v/29vb/9vb2//X19f/19fX/9fX1//X1 - 9f/09PT/9PT0//Pz8//z8/P/8vLy//Ly8v/x8fH/8fHx//Dw8P/w8PD/7+/v/+/v7//u7u7/7Ozs/+zs - 7P/r6+v/6enp/+np6f/n5+f/5eXl/+Pj4//h4eH/3t7e/9zc3P/f39//3t7e/9XV1f+3t7fAAAAAEwAA - AAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACfn58Cn5+fCZ+f - nw+fn58Un5+fG5+fnyWfn580n5+fR5+fn12fn592n5+fjp+fn6Wfn5+4n5+fxp+fn9Gfn5/Yn5+f4aen - p+u+vr71+Pj4/v////////////////////////////////95V///MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//4lr/////////////+nj//+cg///TB///zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//3xb//// - /////////////////////////////////////////v7+/+fn5//v7+//+fn5//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//32+f/19///9v3u/+zt4//f3uj/z9Hb/ycj5v9WVfn/ZWjz/0M97v9IQP//ZFr//ygf - //8QFf7/RD7//z0z//9JP/D/bG/v/21x9f8kE/7/sbTr/+Ha5//p8PP/9/j0//b29v/29vb/9vb2//j4 - +P/5+fn/+Pj4//f39//39/f/9vb2//b29v/29vb/9fX1//X19f/19fX/9fX1//X19f/09PT/8/Pz//Pz - 8//z8/P/8vLy//Ly8v/x8fH/8fHx//Dw8P/v7+//7+/v/+7u7v/t7e3/7Ozs/+vr6//r6+v/6urq/+np - 6f/n5+f/5eXl/+Pj4//h4eH/3t7e/9zc3P/f39//3t7e/9XV1f+3t7fAAAAAEwAAAAYAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAn5+fA5+fnw2fn58dn5+fNJ+fn0qfn59en5+fcJ+f - n4Gfn5+Sn5+foJ+fn7Cfn5/Cn5+f0p+fn+Gjo6Ptt7e398vLy/zg4OD99fX1//////////////////// - //////////////////////////////+CY///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//+ii///b0v//zUD//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//dVP///z7//////////////////// - ////////////////////////5+fn/+3t7f/4+Pj//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//f39//39 - /f/9/f3//f39//39/f/9/f3//f39//39/f/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//75 - +v/2+ff/+f34//n27v/e5ej/4tzn/4F+5f80Lv//bG/p/1RO+/9BOvX/XU7//0RK+/8ZHvz/PjH//z08 - 6v9xZvj/cHnh/zEp//+Aiuj/6d/r/+3t7f/x8Pr/9/j0//X19f/29vb/9/f3//n5+f/5+fn/9/f3//f3 - 9//39/f/9vb2//b29v/29vb/9fX1//X19f/19fX/9fX1//T09P/09PT/8/Pz//Pz8//y8vL/8vLy//Hx - 8f/x8fH/8fHx//Dw8P/v7+//7+/v/+7u7v/t7e3/7Ozs/+vr6//r6+v/6enp/+jo6P/n5+f/5eXl/+Pj - 4//h4eH/3t7e/9zc3P/f39//3t7e/9XV1f+4uLjFAAAAEwAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAJ+fnwGfn58Hn5+fGZ+fnzSfn59Wn5+feJ+fn5Wfn5+vn5+fxZ+fn9efn5/joKCg6bKy - svHHx8f42tra/e3t7f////////////////////////////////////////////////////////////// - //////////////+Zf///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//9iO///9fP///////////////////////////////////////// - ///o6Oj/7e3t//j4+P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//f39//39/f/9/f3//f39//39 - /f/9/f3//f39//39/f/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//r99P//////9ff4//bu - 9f/m7u7/4t/h/7m31f8qI/D/ZGHz/11Y+f9COe3/UUb6/1JV/v8pHP//OC/x/1Vb8P+HfPr/Pzz2/1xp - 6//W0uX/4ebl//n19P/49fH/9vr1//f39//4+Pj/+vr6//r6+v/5+fn/9/f3//f39//4+Pj/9vb2//b2 - 9v/19fX/9fX1//X19f/19fX/9PT0//T09P/09PT/8/Pz//Pz8//y8vL/8vLy//Hx8f/x8fH/8fHx/+/v - 7//v7+//7+/v/+7u7v/t7e3/7Ozs/+vr6//r6+v/6enp/+jo6P/n5+f/5eXl/+Pj4//g4OD/3t7e/9zc - 3P/f39//3t7e/9XV1f+7u7vMAAAAEwAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAn5+fAp+f - nwufn58hn5+fTp+fn4Gfn5+yn5+fzp+fn96tra3rv7+/9tbW1vvp6en+/Pz8//////////////////// - //////////////////////////////////////////////////////////////////////////////+l - j///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//1Ur///18////////////////////////////////////////////+zs7P/r6+v/+Pj4//v7 - +//8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//f39//39/f/9/f3//f39//39/f/9/f3//f39//39 - /f/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//3/+f/5+f//+Pn1//fz/v/q6e3/5+nj/9HP - 2/9XWd3/SUT9/2Jj8/9RRfH/SD3//1FR//8+OPX/Myf7/29z//9eXu7/KR3z/8TH3P/b4dz/6+3u//L0 - 9f/79fb/+fzz//f39//5+fn/+vr6//n5+f/4+Pj/9/f3//f39//39/f/9vb2//b29v/19fX/9fX1//X1 - 9f/19fX/9PT0//T09P/09PT/8/Pz//Pz8//y8vL/8fHx//Hx8f/x8fH/8fHx/+/v7//v7+//7+/v/+7u - 7v/t7e3/7Ozs/+vr6//q6ur/6enp/+jo6P/m5ub/5eXl/+Li4v/g4OD/3d3d/9zc3P/f39//3t7e/9XV - 1f+7u7vMAAAAEwAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACfn58Dn5+fEZ+fnzOfn59ln5+fmbq6 - utLR0dHy4+Pj/Pj4+P////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////+yn///MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//Uif//+zn//// - ////////////////////////////////////////7e3t/+rq6v/39/f//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//33///4//n/+Pn3/+vw8f/y6ez/4eLm/8zP3f+OmdP/Ih/+/2dv - 8v9hVPD/Ozvz/09N//9OTPn/HhH5/25z9P8YHf//mpnZ/87J3v/f4eL/6uzs//H17//39f//+/T3//b2 - 9v/4+Pj/+Pj4//f39//39/f/9/f3//f39//39/f/9vb2//X19f/19fX/9fX1//X19f/19fX/9PT0//T0 - 9P/09PT/8/Pz//Pz8//y8vL/8fHx//Hx8f/x8fH/8fHx/+/v7//v7+//7+/v/+7u7v/t7e3/7Ozs/+vr - 6//q6ur/6Ojo/+jo6P/m5ub/5OTk/+Li4v/g4OD/3d3d/9vb2//f39//3t7e/9XV1f+6urrNAAAAEwAA - AAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACfn58Kn5+fLKKiomjJycnJ7+/v+P////////////////// - //////////////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////Ft///MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//9FF///4tv///////////////////////// - ///////////////////w8PD/6Ojo//b29v/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z9+//8/Pz/+fn5//T09P/x8fH/5ubm/9fX1//CwcP/HxT3/1td8f9YXfX/PDnz/1JE - /v9gWv//Jx3//zE9+/9rWdz/vsLD/+Db2v/d4eL/5vHn//f17f/89fj/9vr1//j4+P/4+Pj/+Pj4//j4 - +P/4+Pj/9/f3//f39//39/f/9vb2//b29v/29vb/9vb2//X19f/09PT/9PT0//Pz8//z8/P/8/Pz//Ly - 8v/x8fH/8fHx//Hx8f/w8PD/8PDw/+/v7//v7+//7u7u/+3t7f/t7e3/7Ozs/+vr6//q6ur/5+fn/+fn - 5//m5ub/5OTk/+Hh4f/f39//3d3d/93d3f/e3t7/3d3d/9bW1v+6urrNAAAAFAAAAAYAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAJ+fnwKfn58Uo6OjUOrq6tz///////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////n3///Pw///pY///3VT//9JG///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zwL///f1/////////////////////////////////////////////Pz - 8//n5+f/9fX1//v7+//8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z9 - +//7+/v/+fn5//X19f/y8vL/5ubm/9jY2P/FxMb/XGTf/0M5/f9hZfP/Uk3u/0U7//9YUv//Qjj//xYY - +f+dmdv/xcrT/9XZ1P/f3+X/7e7s//z3+f/9+Pn/8vf1//j4+P/4+Pj/+Pj4//j4+P/4+Pj/9/f3//f3 - 9//39/f/9vb2//b29v/29vb/9vb2//X19f/09PT/9PT0//Pz8//z8/P/8vLy//Ly8v/x8fH/8fHx//Hx - 8f/w8PD/8PDw/+/v7//u7u7/7u7u/+3t7f/t7e3/7Ozs/+rq6v/q6ur/5+fn/+fn5//m5ub/5OTk/+Hh - 4f/f39//3d3d/9zc3P/e3t7/3d3d/9bW1v+6urrNAAAAFAAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+f - nwSfn58c6enpv/////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////4tv//7Wj//+Ja///XDP//zUD//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//PAv//8/D////////////////////////////////////////////8/Pz/+fn5//09PT/+/v7//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z9+//6+vr/+Pj4//T0 - 9P/x8fH/5OTk/9nZ2f/Ix8n/jprE/y4e+P9iZfD/ZFrt/zs1+P9NSvr/X1j9/xYT+f+mrcD/vsfU/9Pe - 1P/t6PH/8+nv//vx/f/4+ff/9vv6//j4+P/4+Pj/+Pj4//j4+P/4+Pj/9/f3//f39//29vb/9vb2//b2 - 9v/29vb/9vb2//X19f/09PT/9PT0//Pz8//z8/P/8vLy//Ly8v/x8fH/8fHx//Hx8f/w8PD/8PDw/+/v - 7//u7u7/7u7u/+3t7f/s7Oz/6+vr/+rq6v/p6en/5+fn/+fn5//l5eX/5OTk/+Hh4f/f39//3d3d/9zc - 3P/e3t7/3d3d/9bW1v+6urrNAAAAFAAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwXw8PB///////// - //////////////////////////////////////////////////////////////////////////////// - //////////Lv///Ft///nIP//29L//8/D///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//81A///wrP///////// - ///////////////////////////////////39/f/5ubm//T09P/7+/v//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//3+/P/6+vr/9/f3//Pz8//u7u7/4ODg/9bW - 1v/JyMr/qKu6/zgy4/9XVvL/aF7x/z868/9JRfz/Ylj+/yso+f+Kj8b/vMfP/9Pay//o4uf/7ebt//nx - /P/29vb/9Pn4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/9/f3//f39//29vb/9vb2//b29v/29vb/9fX1//X1 - 9f/09PT/9PT0//Pz8//y8vL/8vLy//Ly8v/x8fH/8fHx//Dw8P/w8PD/7+/v/+/v7//u7u7/7e3t/+3t - 7f/s7Oz/6+vr/+rq6v/p6en/6Ojo/+fn5//l5eX/4+Pj/+Hh4f/f39//3d3d/9zc3P/e3t7/3d3d/9bW - 1v+6urrNAAAAFAAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwb9/f3k//////////////////////// - ///////////////////////////////////////////////8+///2c///6mT//9/X///Uif//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//+5p/////////////////////////////// - //////////////n5+f/h4eH/8vLy//n5+f/7+/v/+/v7//v7+//7+/v/+/v7//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//3+/P/6+vr/+Pj4//T09P/t7e3/3t7e/9PT0//FxMb/sLO3/0hN - 0v88Nfr/aWbx/09G9P9JQf//Ukn//0g///9XT+L/usPM/9zZy//f3d3/5urr//X19f/39Pb/9Pf1//j4 - +P/4+Pj/+Pj4//j4+P/39/f/9/f3//b29v/29vb/9vb2//b29v/29vb/9fX1//X19f/09PT/8/Pz//Pz - 8//y8vL/8vLy//Hx8f/x8fH/8PDw//Dw8P/v7+//7+/v/+7u7v/u7u7/7e3t/+zs7P/s7Oz/6+vr/+rq - 6v/p6en/6Ojo/+bm5v/l5eX/4+Pj/+Hh4f/f39//3d3d/9zc3P/e3t7/3d3d/9bW1v+6urrNAAAAFAAA - AAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAPn5+VD///////////////////////////////////////////// - /////////+nj//+/r///j3P//2I7//88C///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//6WP////////////////////////////////////////////+Pj4/9XV - 1f/n5+f/+Pj4//v7+//7+/v/+/v7//v7+//7+/v/+/v7//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z9+//6+vr/+fn5//b29v/v7+//3t7e/9DQ0P/Av8H/qa2y/zo53f8cEv//Zmvv/1tR - 8f9EPvv/SEj//15S//8qG/P/pq7M/+HY1P/h39//5Ozr/+/z7f/48/X/9/f3//f39//4+Pj/+Pj4//j4 - +P/39/f/9/f3//b29v/29vb/9vb2//b29v/19fX/9fX1//X19f/09PT/8/Pz//Pz8//y8vL/8vLy//Hx - 8f/x8fH/8PDw/+/v7//v7+//7+/v/+7u7v/t7e3/7e3t/+zs7P/s7Oz/6+vr/+np6f/p6en/6Ojo/+bm - 5v/k5OT/4+Pj/+Hh4f/f39//3d3d/9vb2//e3t7/3d3d/9bW1v+9vb3ZAAAAFAAAAAYAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAP39/Z7//////////////////////////////////////7mn//91U///SRv//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//j3P////////////////////////////////////////////7+/v/wMDA/8rKyv/j4+P/9PT0//r6 - +v/7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//r7 - +f/5+fn/+Pj4//Pz8//s7Oz/3Nzc/87Ozv+9vL7/mJu3/yEW9v8KBv//WVj0/2Na8P89Puz/Q0f5/2JY - //8yJP7/h4vS/8vK0//d2d7/5Ono/+zw6//z9PL/9fT2//f39//39/f/9/f3//f39//39/f/9/f3//b2 - 9v/29vb/9vb2//X19f/19fX/9fX1//X19f/09PT/8/Pz//Pz8//x8fH/8fHx//Hx8f/x8fH/8PDw/+/v - 7//v7+//7+/v/+7u7v/t7e3/7e3t/+zs7P/r6+v/6+vr/+np6f/o6Oj/6Ojo/+bm5v/k5OT/4+Pj/+Hh - 4f/f39//3d3d/9vb2//e3t7/3d3d/9bW1v+9vb3ZAAAAFAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7+ - /qH/////////////////////////////////r5v//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//98W/////////////// - //////////////////////////////z8/P+1tbX/p6en/7a2tv/Q0ND/5+fn//X19f/7+/v/+/v7//v7 - +//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//r7+f/4+Pj/9PT0/+7u - 7v/o6Oj/2tra/83Nzf+8u73/jY66/xEL/v8DDfX/STv3/25n+P8/RO3/REH//1xT/f9DPvj/a27W/7jA - 0f/d1+L/6Obm/+rs7P/z+O//9vT6//f39//39/f/9/f3//f39//39/f/9/f3//b29v/29vb/9fX1//X1 - 9f/19fX/9fX1//T09P/09PT/8/Pz//Pz8//x8fH/8fHx//Hx8f/x8fH/8PDw/+/v7//v7+//7+/v/+7u - 7v/t7e3/7Ozs/+zs7P/r6+v/6urq/+np6f/o6Oj/6Ojo/+bm5v/k5OT/4+Pj/+Hh4f/f39//3d3d/9vb - 2//e3t7/3d3d/9bW1v+9vb3ZAAAAFAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP7+/oX///////////// - ////////////////////zL///zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//9iO////Pv///////////////////////// - ///////////////////Gxsb/oaGh/6ioqP+6urr/0dHR/+fn5//09PT/+vr6//v7+//7+/v/+/v7//v7 - +//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7 - +//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//X6/f/69vX/9PDv/+nr6//a4dr/29fd/9TK - 2/+3uLT/aXPR/yAZ9v8UEv7/IR79/3Fo9P9LUvX/NTXz/1ZN//9WT/j/JBL//7a71P/U29T/5uHe/+rp - 6//z8fD/8/L2//n5+f/4+Pj/9/f3//b29v/39/f/9/f3//f39//29vb/9fX1//T09P/09PT/8/Pz//T0 - 9P/z8/P/8/Pz//Pz8//y8vL/8vLy//Hx8f/w8PD/8PDw/+/v7//v7+//7u7u/+7u7v/t7e3/7e3t/+zs - 7P/r6+v/6urq/+rq6v/p6en/5+fn/+bm5v/l5eX/4+Pj/+Hh4f/f39//3Nzc/9vb2//e3t7/3t7e/9TU - 1P++vr7aAAAAFQAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///4D///////////////////////////// - /////////9zT//+Ve///aUP//zwL//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//dVP///z7//////////////////////////////////// - ///9/f3/vr6+/6Ghof+oqKj/ubm5/9TU1P/p6en/9fX1//r6+v/7+/v/+/v7//v7+//7+/v/+/v7//v7 - +//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7 - +//7+/v/+/v7//v7+//7+/v/+/v7//X5+v/9+fj/9vHy/+jq6v/a4dr/19TW/8vE0f+wtbT/SUnd/ykk - +/8hIf3/HBP9/2Zb8f9TVvj/OTnx/05H/P9aVvz/Jxb//6Wq0f/P1tP/5eLe/+np6f/w7/H/9fX1//f3 - 9//29vb/9vb2//b29v/39/f/9/f3//b29v/29vb/9PT0//T09P/z8/P/8/Pz//Pz8//z8/P/8/Pz//Ly - 8v/y8vL/8fHx//Hx8f/w8PD/8PDw/+/v7//u7u7/7u7u/+3t7f/t7e3/7e3t/+zs7P/r6+v/6urq/+rq - 6v/p6en/5+fn/+bm5v/k5OT/4uLi/+Dg4P/e3t7/3Nzc/9ra2v/e3t7/3t7e/9TU1P++vr7aAAAAFQAA - AAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///y////////////////////////////////////////////// - ///////////////Zz///r5v//4Jj//9VK///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//4Jj/////////////////////////////////////////////f39/7W1 - tf+hoaH/qqqq/7u7u//U1NT/6urq//b29v/6+vr/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7 - +//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7 - +//7+/v/+/v7//H29f/6+Pf/9/L0/+jq6v/f497/2dfW/8jHy/+usr3/Ihns/zUx//8zM/v/IBX//1dN - 9P9eXvj/QT3w/0VB+P9bV/3/NCT//4qL1f/Fz8//4d7a/+fo5v/v7fP/9/nz//X19f/19fX/9vb2//b2 - 9v/29vb/9vb2//b29v/19fX/9PT0//T09P/z8/P/8/Pz//Pz8//z8/P/8/Pz//Ly8v/x8fH/8fHx//Hx - 8f/w8PD/7+/v/+/v7//u7u7/7u7u/+3t7f/t7e3/7Ozs/+zs7P/r6+v/6urq/+np6f/p6en/5ubm/+Xl - 5f/k5OT/4uLi/+Dg4P/e3t7/3Nzc/9ra2v/d3d3/3t7e/9TU1P++vr7aAAAAFQAAAAcAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAD///+v//////////////////////////////////////////////////////// - ////////////////////9fP//8m7//+cg///b0v//0IT//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//+Mb/////////////////////////////////////////////r6+v+ysrL/oqKi/6qq - qv++vr7/1dXV/+vr6//29vb/+vr6//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7 - +//7+/v/+/v7//v7+//7+/v/+/v7//v7+//6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//T5 - +P/6+Pf/9fL0/+Xn5//a3dv/09PN/7vAv/+Ynb7/Ewr7/zw5//89OPf/Myz//0Q6+P9mZvb/S0Xy/0I9 - /P9UUP3/Rjv//2li4f++y83/2dfX/+bn5f/v7PX/9fjv//X19f/19fX/9fX1//b29v/29vb/9vb2//X1 - 9f/19fX/9PT0//Pz8//z8/P/8/Pz//Pz8//z8/P/8vLy//Ly8v/x8fH/8fHx//Dw8P/w8PD/7+/v/+7u - 7v/u7u7/7e3t/+3t7f/s7Oz/7Ozs/+vr6//q6ur/6urq/+np6f/p6en/5ubm/+Xl5f/k5OT/4uLi/+Dg - 4P/e3t7/3Nzc/9vb2//d3d3/3d3d/9TU1P++vr7aAAAAFQAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAD///8v//////////////////////////////////////////////////////////////////////// - ///////////////////////////////i2///taP//4xv//9cM///NQP//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//pY/////////////////////////////////////////////29vb/rq6u/6Ghof+rq6v/vr6+/9ra - 2v/s7Oz/9/f3//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7 - +//7+/v/+/v7//v7+//6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//T29v/z8fD/8Ozx/+Ll - 4//a2tr/09TL/7vDw/+IiMj/GBj//0E9//89NfT/SUj2/ywj9f9laPP/VE30/0M7/v9NSv7/U079/0c4 - 7f+2xs3/09PZ/+Xm5P/p6u7/9PTu//b29v/29vb/9vb2//b29v/19fX/9fX1//X19f/09PT/8/Pz//Pz - 8//y8vL/8vLy//Ly8v/y8vL/8vLy//Hx8f/x8fH/8PDw//Dw8P/v7+//7u7u/+7u7v/t7e3/7e3t/+zs - 7P/s7Oz/6+vr/+vr6//q6ur/6enp/+np6f/o6Oj/5+fn/+Xl5f/k5OT/4uLi/+Dg4P/e3t7/3Nzc/9vb - 2//c3Nz/3d3d/9TU1P++vr7aAAAAFQAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////r/// - //////////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////+ff//8/D//+lj///dVP//0kb//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//6+b//// - ////////////////////////////////////////9PT0/6ioqP+jo6P/ra2t/8DAwP/Z2dn/7u7u//j4 - +P/7+/v/+/v7//v7+//7+/v/+/v7//v7+//7+/v/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//r6 - +v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//f5+f/08vH/7ezw/+Pn4v/c2dv/1dLN/7nB - yP9xbdL/Iif4/z87//8/NPT/V1vw/xoV9P9cYPX/WlX4/z429f9JRf//WFX4/y8f9v+os9P/1Nbe/+Tl - 4//m6Oj/8/Hx//X19f/29vb/9vb2//X19f/19fX/9PT0//T09P/09PT/8/Pz//Ly8v/y8vL/8vLy//Ly - 8v/y8vL/8fHx//Hx8f/w8PD/8PDw/+/v7//v7+//7u7u/+3t7f/t7e3/7e3t/+zs7P/s7Oz/6+vr/+rq - 6v/p6en/6enp/+jo6P/o6Oj/5+fn/+Xl5f/j4+P/4eHh/+Dg4P/e3t7/3d3d/9zc3P/c3Nz/3Nzc/9PT - 0//AwMDhAAAAFQAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////D////3/////v//////// - //////////////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////s5///v6///49z//9cM///MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zUD//+8q/////////////// - //////////////////////////////Dw8P+mpqb/o6Oj/66urv/Dw8P/2tra/+7u7v/4+Pj/+vr6//r6 - +v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/5+fn/+fn5//n5 - +f/5+fn/+fn5//n5+f/5+fn/+fn5//b4+f/z9PL/6+rs/+Lm4P/c2N3/0c7K/7C4yf9cUdf/LC/2/0A5 - //9FPPf/Xl7y/xIQ9v9NUPn/XFv3/0Q47v9FQ///WVL5/ywi/v+Sldn/1NjZ/+Ti4f/k6ej/9PD1//T0 - 9P/09PT/9fX1//X19f/09PT/9PT0//Pz8//z8/P/8/Pz//Ly8v/y8vL/8vLy//Ly8v/y8vL/8fHx//Hx - 8f/w8PD/8PDw/+/v7//u7u7/7u7u/+3t7f/t7e3/7Ozs/+zs7P/r6+v/6+vr/+rq6v/p6en/6Ojo/+jo - 6P/o6Oj/5ubm/+Xl5f/j4+P/4eHh/9/f3//e3t7/3Nzc/9vb2//c3Nz/3Nzc/9PT0//AwMDmAAAAFQAA - AAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8X////j/////f///////////// - //////////////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////Cs///MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//81A///z8P///////////////////////// - ///////////////////o6Oj/pKSk/6Ojo/+vr6//w8PD/97e3v/v7+//+Pj4//r6+v/6+vr/+vr6//r6 - +v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/5+fn/+fn5//n5+f/5+fn/+fn5//n5 - +f/5+fn/+fn5//b4+f/4+ff/7ezu/+Pn4f/g2eD/z8rL/62zyv9PQdz/ODf9/0I6//9JQvf/XFf2/w4Q - +P89P/v/XWD4/0xD7f9BQPz/W1D//zQv//+AfNv/0NfU/+Lg3//n7Ov/9vL4//Ly8v/z8/P/9PT0//X1 - 9f/09PT/9PT0//Pz8//z8/P/8vLy//Ly8v/y8vL/8fHx//Ly8v/x8fH/8fHx//Dw8P/w8PD/7+/v/+/v - 7//u7u7/7u7u/+3t7f/s7Oz/7Ozs/+zs7P/r6+v/6+vr/+rq6v/p6en/6Ojo/+jo6P/n5+f/5ubm/+Xl - 5f/i4uL/4ODg/9/f3//d3d3/3Nzc/9vb2//b29v/3Nzc/9PT0//AwMDmAAAAFQAAAAcAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///w////9H////gP///7T////v//////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////+yn///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//PAv//9LH//////////////////////////////////// - ////////5OTk/6Ghof+kpKT/r6+v/8TExP/c3Nz/7+/v//f39//5+fn/+fn5//n5+f/5+fn/+vr6//r6 - +v/6+vr/+vr6//r6+v/6+vr/+vr6//r6+v/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//Xz - 8//w8vP/8+3y/+Lk5f/T1tT/zM3E/769x/8hJPv/Qzn//zs99v9US/n/TU35/xoW8f8tNvH/YWTv/1BF - 9f9BO/7/VUv//0M//P9ZWvL/zc7S/+Lc3f/g5uH/7uvt//Pz8//z8/P/9PT0//T09P/09PT/8/Pz//Pz - 8//x8fH/8PDw//Dw8P/u7u7/7e3t/+vr6//s7Oz/7Ozs/+7u7v/v7+//7+/v/+7u7v/u7u7/7e3t/+3t - 7f/s7Oz/7Ozs/+rq6v/q6ur/6urq/+np6f/p6en/6Ojo/+fn5//m5ub/5eXl/+Tk5P/i4uL/4eHh/9/f - 3//d3d3/29vb/9nZ2f/b29v/29vb/9PT0//BwcHmAAAAFgAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////I////1v///+T////zP// - //v///////////////////////////////////////////////////////////////////////////// - //////////////+ii///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//0UX///f1////////////////////////////////////////////9/f - 3/+goKD/pKSk/7CwsP/Hx8f/39/f//Dw8P/4+Pj/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5 - +f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n39//w8vL/8Ovt/+Di - 4//V2Nb/zs7I/7y6xv8aHPb/Qzv+/zs7+f9XT/b/SEj4/ygm6v8nK/b/Y2Ty/1NL9v8/Ovv/UUn//0M/ - /P9PUO7/y8vR/+Db3P/i6OP/7+zu//T09P/09PT/9PT0//T09P/z8/P/8fHx/+3t7f/p6en/5ubm/+Tk - 5P/h4eH/3t7e/9zc3P/e3t7/4uLi/+np6f/s7Oz/7u7u/+7u7v/t7e3/7e3t/+zs7P/s7Oz/6+vr/+rq - 6v/q6ur/6enp/+np6f/o6Oj/5+fn/+bm5v/m5ub/5eXl/+Tk5P/i4uL/4ODg/9/f3//d3d3/2tra/9nZ - 2f/b29v/29vb/9PT0//BwcHmAAAAFgAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wf///87////b/// - /6v////f//////////////////////////////////////////////////////////////////////+Z - f///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//9FF///7Of////////////////////////////////////////////V1dX/oKCg/6Sk - pP+ysrL/yMjI/+Pj4//y8vL/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5 - +f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//r49//x8/P/8Ovs/+Di4v/V2Nb/zs3J/7q3 - x/8UFPT/RD77/zs6//9fVfX/PUH4/zs+3P8aGfj/ZGD1/1dS9f88N/b/Tkb//0VC/P9BQev/zMrQ/9zZ - 2//m6uX/7+vw//T09P/09PT/8/Pz//Pz8//w8PD/6urq/9/f3//R0dH/yMjI/8PDw/+/v7//urq6/7m5 - uf+9vb3/ycnJ/9ra2v/m5ub/6+vr/+3t7f/s7Oz/7Ozs/+vr6//r6+v/6+vr/+rq6v/p6en/6enp/+jo - 6P/n5+f/5ubm/+bm5v/m5ub/5OTk/+Pj4//i4uL/4ODg/97e3v/c3Nz/2tra/9nZ2f/b29v/29vb/9PT - 0//AwMDmAAAAFgAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////F/// - /0////+H////vP////P///////////////////////////////////////////9/X///MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zUD//+5p///iWv//z8P//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//Uif//+zn////////////////////////////////////////////z8/P/6CgoP+mpqb/tra2/9DQ - 0P/m5ub/9vb2//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/4+Pj/+Pj4//j4 - +P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j38//x9PL/8+/u/+Lk5P/V2Nb/zcvK/7m0yf8SEfX/RkH7/zs4 - //9jWvH/MzX3/05Vyv8UD/T/Xljz/1dW8v88NvP/SUL9/0pI//81Muz/zcrT/9rZ2//n6+b/7enu//Pz - 8//z8/P/8/Pz//Hx8f/p6en/2tra/8jIyP+6urr/sbGx/6ysrP+oqKj/paWl/6Wlpf+np6f/s7Oz/8TE - xP/V1dX/4uLi/+rq6v/s7Oz/7Ozs/+vr6//r6+v/6urq/+rq6v/p6en/6Ojo/+fn5//m5ub/5ubm/+bm - 5v/m5ub/5OTk/+Pj4//h4eH/4ODg/97e3v/c3Nz/2tra/9jY2P/b29v/2tra/9PT0//AwMDmAAAAFgAA - AAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAD///8v/v7+6v////////////////////////////////95V///MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//5l///////////////n3//+5p///ZT///zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//183///1 - 8////////////////////////////////////////////8nJyf+goKD/qamp/729vf/Y2Nj/7+/v//f3 - 9//4+Pj/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4 - +P/4+Pj/+Pj4//f28v/w8/H/9PDv/+Tm5v/W2df/z83N/7u1zP8SD/j/Q0D6/zs4//9kW/H/LSz4/1tk - vv8bFOv/WE71/1hZ7/89OPL/R0L8/05J//8nJPD/zcnU/9fa3v/m6uX/6+fs//Ly8v/y8vL/8fHx/+rq - 6v/b29v/xMTE/7i4uP/Nzc3/3Nzc/9zc3P/Pz8//ycnJ/6ampv+fn5//pKSk/66urv+/v7//0dHR/+Hh - 4f/p6en/6+vr/+vr6//q6ur/6urq/+rq6v/p6en/6Ojo/+fn5//m5ub/5ubm/+bm5v/m5ub/4+Pj/+Li - 4v/h4eH/39/f/93d3f/b29v/2dnZ/9jY2P/a2tr/2dnZ/9LS0v/AwMDmAAAAFgAAAAcAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACfn58E////+P// - //////////////////////////////9lP///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//WS////z7/////////////////////////////+Xf//+Sd///SRv//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//9iO////Pv///////// - //////////////////////////////39/f+9vb3/o6Oj/6+vr//Ly8v/6Ojo//T09P/4+Pj/+Pj4//j4 - +P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f1 - 9P/w8/H/8+/u/+Pl5f/X2tj/0tDQ/7640f8SD/n/Qz79/zw4+/9fWvH/LSb5/2FruP8sKd3/UUX3/1pb - 8f8/OvP/RED9/05K//8bFvP/zcnU/9Xc3//m5+P/7Ojt//Hx8f/x8fH/6+vr/93d3f/S0tL/7e3t//// - //////////////////////////////z8/P/V1dX/ra2t/6Ojo/+srKz/vLy8/8/Pz//h4eH/6enp/+vr - 6//q6ur/6urq/+np6f/p6en/6Ojo/+fn5//m5ub/5ubm/+Xl5f/l5eX/4+Pj/+Li4v/g4OD/3t7e/93d - 3f/b29v/2NjY/9fX1//Z2dn/2NjY/9HR0f/AwMDmAAAAFgAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACfn58F//////////////////////// - //////////////9VK///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//81 - A///2c///////////////////////////////////////////////Pv//8Kz//91U///NQP//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//dVP///z7//////////////////// - ///////////////////29vb/pKSk/6ioqP+/v7//29vb/+/v7//39/f/9/f3//f39//39/f/9/f3//f3 - 9//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f19f/v8fH/8u3u/+Pl - 5f/Y29n/1NLS/7+50v8SD/n/QDz//z869P9aV/P/MCL8/2Bqt/89Qc//SD34/1pb8f9BPPP/Qz/8/01K - /v8XEfr/z8vX/9bf4//l5uL/7urv//Ly8v/w8PD/4+Pj/9bW1v/7+/v///////////////////////// - ////////////////////////+fn5/66urv+hoaH/rKys/729vf/V1dX/4+Pj/+np6f/p6en/6enp/+jo - 6P/o6Oj/6Ojo/+fn5//m5ub/5eXl/+Xl5f/k5OT/4uLi/+Hh4f/g4OD/3t7e/9zc3P/a2tr/2NjY/9fX - 1//Z2dn/19fX/9DQ0P/Dw8PzAAAAFgAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADx8fEk//////////////////////////////////////9M - H///MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//+cg/////////////// - ////////////////////////////////////////////////////7Of//6KL//9SJ///MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//4Jj//////////////////////////////////// - ////////ycnJ/6Wlpf+5ubn/1NTU/+zs7P/39/f/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4 - +P/39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f09v/w8vP/8+7v/+Pl5f/X2tj/09HQ/7+5 - 0P8SD/n/Pzz//0E88/9VVfX/MiD9/15otv9JUMP/QTb4/1la8v9BPPH/QD/7/01K/v8WEP//08/b/9rj - 5//l5uL/7urv//Ly8v/t7e3/4eHh//n5+f////////////////////////////////////////////// - //////////////Dw8P+lpaX/o6Oj/66urv/Gxsb/2dnZ/+Xl5f/p6en/6enp/+jo6P/o6Oj/5+fn/+fn - 5//m5ub/5eXl/+Tk5P/j4+P/4uLi/+Hh4f/g4OD/3t7e/9zc3P/a2tr/2NjY/9bW1v/Y2Nj/19fX/9DQ - 0P/Dw8PzAAAAFgAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAADv7+8q//////////////////////////////////////81A///MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//183///8+/////////////////////////////// - ////////////////////////////////////////////////////z8P//39f//85B///MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//zMA//+Mb///////////////////////////////////////9vb2/6am - pv+4uLj/0tLS/+vr6//29vb/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f3 - 9//39/f/9/f3//f39//39/f/9/f3//X3+P/0+PP/6fHx/+Xo3//j4Nz/2tDc/7C7yf8TEvH/PkD9/zo+ - 9P9XSvr/MSb4/15ps/9PU8T/PjL8/1lU8/9APO//Pzn//0lH//8eGfH/yc7X/97g4f/z6PL/7+/v//Dw - 8P/t7e3/+fn5//////////////////////////////////////////////////////////////////// - ///i4uL/oKCg/6ampv+1tbX/y8vL/97e3v/m5ub/6Ojo/+jo6P/n5+f/5ubm/+bm5v/l5eX/5OTk/+Tk - 5P/j4+P/4uLi/+Dg4P/e3t7/3Nzc/9vb2//Z2dn/19fX/9bW1v/W1tb/09PT/87Ozv/Dw8PzAAAAFgAA - AAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAD19fVH//////////////////////////////////z7//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//OQf//9/X//////////////////////////////////////////////////// - ///////////////////////////////////////////////18///rJf//1wz//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//qZP//////////////////////////////////////8zMzP+6urr/1tbW/+zs - 7P/29vb/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f3 - 9//39/f/9/f3//Tz9f/19vL/6/Dx/+bn4//i39v/2tPa/7bBz/8VE/X/RT7//zk4+f9TT/T/Miz1/19n - uv9TV8D/Nizw/1FR8f9BOvX/P0H6/0I8//8sJ/T/zM7g/+Dl5P/y7ez/7/Lw/+7u7v/z8/P///////// - ////////////////////////////////////////////////////////////////////////w8PD/6Gh - of+pqan/vLy8/9LS0v/h4eH/6Ojo/+fn5//n5+f/5ubm/+Xl5f/l5eX/5OTk/+Tk5P/j4+P/4eHh/+Dg - 4P/e3t7/3Nzc/9ra2v/Y2Nj/1tbW/9XV1f/V1dX/0tLS/83Nzf/CwsLzAAAAFgAAAAcAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwH19fVT//////// - /////////////////////////+Xf//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//oov///////////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////c0///jG///0IT//8zAP//MwD//zMA//8z - AP//OQf//+zn/////////////////////////////////9XV1f++vr7/2tra/+7u7v/19fX/9vb2//b2 - 9v/29vb/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//f0 - 9v/4+PL/7fHy/+jn6f/h397/29nZ/7/H2P8cFPv/ST3//z46/f9LTfH/MSzz/15kw/9ZXcb/Nyvv/01S - 9P9AOfb/PED3/z42//88NPP/ztDi/+Dl4//s6+H/6Ovp/+3t7f/39/f///////////////////////// - ////////////////////////////////////////////////////////+fn5/6qqqv+jo6P/r6+v/8HB - wf/X19f/5OTk/+fn5//m5ub/5eXl/+Xl5f/l5eX/5OTk/+Tk5P/j4+P/4ODg/9/f3//d3d3/3Nzc/9ra - 2v/X19f/1dXV/9PT0//U1NT/0dHR/8zMzP/CwsLzAAAAFgAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwH39/do//////////////////////// - /////////9nP//8zAP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zMA//9fN////Pv///////// - //////////////////////////////z8/P////////////////////////////////////////////// - //////////////////////////////////////////n3//+5p///bEf//zMA//8zAP//MwD//9/X//// - /////////////////////////////8fHx//ExMT/4eHh//Dw8P/29vb/9vb2//b29v/29vb/9vb2//b2 - 9v/29vb/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//n2+P/6+PD/7vDx/+zn - 8P/i4+H/4eDc/8fO3f8lHPn/QTb+/0I9/P9EQ/H/PDT3/1Nb1P9OUdf/PjH3/01R8P8/PPD/Nzj+/zwx - //9USfP/2tvp/+bt6v/s7eT/6uzs/+3t7f/7+/v//////////////////////////////////9f///+D - ////5////////////////////////////////////////+Li4v+goKD/pqam/7Kysv/Kysr/29vb/+Tk - 5P/l5eX/5eXl/+Tk5P/k5OT/5OTk/+Pj4//j4+P/39/f/9/f3//d3d3/29vb/9nZ2f/X19f/1NTU/9LS - 0v/T09P/0NDQ/8vLy//BwcHzAAAAFgAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwEAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD4+Ph3/////////////////////////////////8y///8z - AP//MwD//zMA//8zAP//MwD//zMA//8zAP//MwD//zkH///f1/////////////////////////////// - ////////6enp/9nZ2f/y8vL//Pz8//////////////////////////////////////////////////// - /////////////////////////////////////////+Xf//+pk///taP///////////////////////// - /////////////8PDw//Pz8//6enp//Pz8//29vb/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//b2 - 9v/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9fX1//Xy9P/08ez/7Ozs/+rm8f/l6Ob/4+Tg/8zS - 3/8zKfH/PTn9/0Y//v9EPvH/T0b6/zk85f80Mur/TUX+/1ZX7f9CQO7/NTb//zMf//97der/4ePt/+nu - 7f/r7Oj/6+zw/+3t7f///////////////////////////////////////zP///8A////P/////v///// - ///////////////////////////////////Dw8P/oaGh/6ioqP+7u7v/z8/P/97e3v/k5OT/5OTk/+Tk - 5P/k5OT/4+Pj/+Pj4//i4uL/39/f/97e3v/d3d3/29vb/9nZ2f/W1tb/09PT/9HR0f/S0tL/z8/P/8rK - yv/AwMDzAAAAFwAAAAefn58Cn5+fBZ+fnwifn58On5+fFJ+fnxifn58Sn5+fC5+fnwMAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAJ+fnwH5+fmI/////////////////////////////////7mn//8zAP//MwD//zMA//8z - AP//MwD//zMA//8zAP//MwD//6KL///////////////////////////////////////5+fn/0NDQ/+bm - 5v/x8fH/9PT0//b29v/6+vr//v7+//////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////////8jI - yP/c3Nz/7+/v//T09P/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9fX1//X1 - 9f/19fX/9fX1//X19f/19fX/9fX1//X09v/28+//8PHv//Dt9v/s8e//6+no/9fZ4f9NR+z/NTX9/0I2 - //9APuz/W1X2/yEc9P8jHPP/Wlb1/1xZ6/9EQvD/MjT+/zIg9/+rr9//4uDs/+Pm6v/n6Ob/6unt/+/v - 7////////////////////////////////////////wf///8A////AP///4v///////////////////// - ///////////////////5+fn/qamp/6Kiov+tra3/wMDA/9bW1v/f39//5OTk/+Pj4//j4+P/4+Pj/+Li - 4v/h4eH/39/f/97e3v/c3Nz/2tra/9jY2P/V1dX/0tLS/9DQ0P/R0dH/zs7O/8nJyf/AwMDzIiIiHGxs - bBWfn58Zn5+fJJ+fny+fn588n5+fR5+fn02fn59Cn5+fL5+fnxufn58Nn5+fBAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+f - nwH6+vqb/////////////////////////////////6+b//8zAP//MwD//zMA//8zAP//MwD//zMA//8z - AP//Xzf///z7///////////////////////////////////////Z2dn/3t7e/+7u7v/z8/P/9PT0//T0 - 9P/09PT/9PT0//f39//8/Pz///////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////9fX1/93d3f/s7Oz/9PT0//X1 - 9f/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9fX1//X19f/09PT/9PT0//T09P/09PT/9PT0//T0 - 9P/09PT/9PT0//Hz8//y8O//7vLt/+7t8f/r8O7/6+jq/9/e4P9ubO7/MCv8/0E1//85PvH/W1L8/ygi - //9BP/3/Z2by/1tY8f9GQu//KSf9/1pZ7//V3uL/5uLt/+jp7f/q6ur/8O/r/+3t7f////////////// - /////////////////////////xP///8A////AP///wf////X//////////////////////////////// - ////////4uLi/6CgoP+lpaX/s7Oz/8fHx//Z2dn/4uLi/+Pj4//j4+P/4uLi/+Hh4f/h4eH/39/f/97e - 3v/b29v/2dnZ/9bW1v/U1NT/0dHR/9DQ0P/Pz8//zc3N/8fHx/++vr76Z2dnOJOTk0Wfn59in5+fgJ+f - n5ifn5+kn5+fq5+fn66fn5+in5+fiZ+fn2Gfn585n5+fGJ+fnwYAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwH7+/un//////// - /////////////////////////5l///8zAP//MwD//zMA//8zAP//MwD//zMA//85B///39f///////// - /////////////////////////////+jo6P/X19f/6urq//Ly8v/09PT/9PT0//T09P/09PT/9PT0//T0 - 9P/09PT/9fX1//n5+f/9/f3///////////////////////////////////////////////////////// - ///////////////////////////////////+/v7/5eXl/+zs7P/z8/P/9fX1//X19f/19fX/9fX1//X1 - 9f/19fX/9fX1//X19f/19fX/9fX1//X19f/09PT/9PT0//T09P/09PT/9PT0//T09P/09PT/9PT0//D1 - 9P/z8fH/8PTu/+/u8P/u8/H/7+vw/+3r6v+Njvz/KCD2/z42//8mL/D/QTH0/ykp9/9eaPb/bmrx/1xX - +P9JRO3/Ixf//4qg7v/r8ez/6+fs/+7t7//t6uz/8vLm/+7u7v////////////////////////////// - /////////x////8A////AP///wD///83////+////////////////////////////////////////8PD - w/+hoaH/qamp/7m5uf/Ozs7/3d3d/+Li4v/i4uL/4uLi/+Hh4f/g4OD/39/f/93d3f/b29v/2NjY/9XV - 1f/T09P/0dHR/87Ozv/Ly8v/x8fH/7+/v/+2trb/jY2Nd5ubm42fn5+un5+fzJ+fn+Kfn5/qn5+f7Z+f - n+2fn5/mn5+f0Z+fn6ufn59+n5+fTJ+fnx2fn58HAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwL8/PzB//////////////////////// - /////////49z//8zAP//MwD//zMA//8zAP//MwD//zMA//+ii/////////////////////////////// - ////////9/f3/8/Pz//k5OT/8PDw//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Ly8v/y8vL/8/Pz//Pz - 8//z8/P/9vb2//r6+v/+/v7///////////////////////////////////////////////////////// - ///////////////////v7+//7e3t//Pz8//09PT/9PT0//T09P/09PT/9PT0//T09P/09PT/9PT0//T0 - 9P/09PT/9PT0//T09P/z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//P08v/z9PL/8fHx/+/v - 7//v7vD/7+7w/+rp7f/k4+f/GBf2/yAi//8NDfP/Kifz/2dm/P92dPz/ZWL+/05T9f8xJOr/gH/m/9DW - 6f/u7u7/7Ovv/+rx6v/w8+r/8uvy/+zs7P/8/Pz//////////////////////////////////zv///8A - ////AP///wD///8A////f/////////////////////////////////////////n5+f+rq6v/o6Oj/6ys - rP/AwMD/09PT/97e3v/h4eH/4ODg/9/f3//f39//3t7e/93d3f/a2tr/1tbW/9PT0//Q0ND/y8vL/8fH - x//Dw8P/u7u7/7Gxsf+qqqr/m5ubzqOjo966urrwx8fH+NXV1f7j4+P+4eHh/7q6uv6fn5/8n5+f9p+f - n+mfn5/On5+fmZ+fn0Wfn58Xn5+fAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwL8/PzF/////////////////////////////////39f//8z - AP//MwD//zMA//8zAP//MwD//183///8+///////////////////////////////////////1tbW/+Dg - 4P/t7e3/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Ly8v/y8vL/8/Pz//Pz8//z8/P/8/Pz//Pz - 8//09PT/9/f3//z8/P////////////////////////////////////////////////////////////j4 - +P/u7u7/8/Pz//T09P/09PT/9PT0//T09P/09PT/9PT0//T09P/09PT/9PT0//T09P/09PT/9PT0//T0 - 9P/z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Lz8f/x8vD/8PDw/+7u7v/v7vD/8fDy/+/u - 8v/r6u7/jJb//y8c9f8kE/7/R0ry/1FW5/9aVvX/RED3/yUc9f+Ghez/0tT//+jq6//o4+T/8e3y/+bs - 5//m6uT/8Ozx/+3t7f/7+/v//////////////////////////////////0f///8A////AP///wD///8A - ////A////8/////////////////////////////////////////n5+f/oKCg/6SkpP+ysrL/xcXF/9fX - 1//f39//4ODg/9/f3//e3t7/3d3d/9zc3P/Y2Nj/09PT/83Nzf/Gxsb/vr6+/7a2tv+xsbH/rKys/6am - pv+4uLj/2tra+vv7+//////////////////////////////////t7e3/vr6+/6CgoP2fn5/wn5+fx5+f - n3Wfn58zn5+fCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAJ+fnwP+/v7i/////////////////////////////////2xH//8zAP//MwD//zMA//8z - AP//PAv//+Xf///////////////////////////////////////n5+f/1tbW/+rq6v/x8fH/8/Pz//Pz - 8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Ly8v/y8vL/8/Pz//Pz8//z8/P/8vLy//Ly8v/y8vL/8/Pz//Pz - 8//19fX/+fn5//7+/v/////////////////////////////////9/f3/9fX1//Ly8v/z8/P/9PT0//T0 - 9P/09PT/9PT0//T09P/09PT/9PT0//T09P/09PT/9PT0//Pz8//z8/P/8/Pz//Pz8//y8vL/8vLy//Ly - 8v/y8vL/8vLy//Ly8v/y8vL/8vLy//P08v/y8/H/8fHx/+/v7//v7vD/8fDy//Dv8f/t7O7/7ufq/7u5 - 9f9YUPf/KBv//zEo+v9NQPD/hXv3/7fA8v/W3O//6uzt//fx7P/x6er/6ufp/+ft6P/t8ez/8Ozx/+zs - 7P/5+fn//////////////////////////////////1////8A////AP///wD///8A////AP///y/////7 - ////////////////////////////////////////x8fH/6CgoP+np6f/t7e3/8zMzP/Z2dn/39/f/9/f - 3//c3Nz/2dnZ/9XV1f/Ozs7/xsbG/8DAwP+4uLj/sLCw/6mpqf+vr6//zc3N//Dw8P////////////// - /////////////////////////////////////////////+vr6/+ioqL9n5+f45+fn6Wfn59Wn5+fFp+f - nwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+f - nwP+/v7q/////////////////////////////////2U///8zAP//MwD//zMA//8zAP//qZP///////// - //////////////////////////////f39//T09P/5OTk//Dw8P/z8/P/8/Pz//Pz8//z8/P/8/Pz//Ly - 8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8/Pz//Pz - 8//19fX/+Pj4//r6+v/6+vr/+Pj4//b29v/09PT/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz - 8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//y8vL/8vLy//Ly8v/y8vL/8vLy//Ly - 8v/y8vL/8vLy//Lz8f/z8/P/8vLy//Hx8f/w8PD/8O/x/+7t7//s6+3/5e7k/+jx9f/e5/T/2eDv/97g - 8v/i5e3/4+zv/+Dq9P/t7e3/6OPk//Lq6//y7ez/6uvp/+rv7f/q7O3/7urw/+vr6//4+Pj///////// - /////////////////////////2////8A////AP///wD///8A////AP///wD///9///////////////// - ////////////////////////+vr6/6urq/+ioqL/rKys/7y8vP/Q0ND/2tra/9nZ2f/W1tb/z8/P/8fH - x/+9vb3/s7Oz/6urq/+pqan/wsLC/+Pj4//+/v7///////////////////////////////////////// - ///////////////////////////////////Y2Nj/n5+f8p+fn82fn598n5+fLJ+fnwsAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ+fnwP///////////// - /////////////////////////0wf//8zAP//MwD//zMA//9lP/////////////////////////////// - /////////////9XV1f/e3t7/7e3t//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly - 8v/y8vL/8vLy//Ly8v/y8vL/8fHx//Hx8f/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly - 8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8/Pz//Pz - 8//z8/P/8/Pz//Ly8v/y8vL/8vLy//Ly8v/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Dw - 8P/x8fH/8vLy//Hx8f/x8fH/8PDw/+/v7//t7e3/8/Dy/+fk7f/v8/T/8PXs/+/u6v/27vX/8+rt//bw - 6//q6e3/8+/0/+zp6//r7Or/7fDu/+rr7//s6+//7ejp/+rq6v/29vb///////////////////////// - /////////3////8A////AP///wD///8A////AP///wD///8D////z/////////////////////////// - /////////////+fn5/+fn5//pKSk/6+vr//BwcH/ysrK/8nJyf/BwcH/ubm5/7Kysv+srKz/tbW1/9bW - 1v/4+Pj///////////////////////////////////////////////////////////////////////// - ////////////////////////wMDA+5+fn+Wfn5+fn5+fUJ+fnxmfn58CAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPHx8Q3///////////////////////////// - /////////0UX//8zAP//MwD//zwL///l3///////////////////////////////////////5ubm/9fX - 1//p6en/8fHx//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly - 8v/y8vL/8fHx//Hx8f/x8fH/8fHx//Hx8f/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly - 8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly - 8v/y8vL/8vLy//Ly8v/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Dw - 8P/w8PD/8PDw//Dw8P/v7+//9PLq//Xz8v/u7e//7e3t/+rs7P/q7ev/7/Du/+zs7P/q8er/6O7p/+nv - 6v/q7+3/6uvv/+vp7//t6uz/7e3n/+rq6v/09PT//////////////////////////////////5v///8A - ////AP///wD///8A////AP///wD///8A////L/////v///////////////////////////////////// - ///Hx8f/oaGh/6Wlpf+ysrL/t7e3/7a2tv+vr6//ra2t/8rKyv/s7Oz///////////////////////// - //////////////////////////////////////////////////////////////////////////////// - ////////8/Pz/5+fn/Cfn5+1n5+faZ+fnyKfn58EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAPz8/CD//////////////////////////////////////zMA//8z - AP//MwD//6mT///////////////////////////////////////39/f/0NDQ/+Tk5P/v7+//8vLy//Ly - 8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Hx8f/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/x8fH/8fHx//Hx - 8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Ly - 8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly8v/x8fH/8fHx//Hx - 8f/w8PD/8PDw//Dw8P/w8PD/8PDw//Dw8P/w8PD/8PDw//Ly8v/x8fH/8PDw/+/v7//v7+//7u/t/+7v - 7f/u7+3/7+3t/+/u6v/x7+7/7u/r/+nx5//o7u3/5uvu/+nw6f/u8ej/5+vl/+zw6//o6uv/7Ovv/+3q - 7P/h4uD/6+/q/+np6f/z8/P//////////////////////////////////6f///8A////AP///wD///8A - ////AP///wD///8A////AP///3v////////////////////////////////////////6+vr/q6ur/6Gh - of+kpKT/pqam/76+vv/f39///Pz8//////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////////66u - rvSfn5+4n5+fbJ+fnyOfn58EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAP///wv//////////////////////////////////////08j//8zAP//dVP///////// - ///////////////////////////////////W1tb/3Nzc/+zs7P/y8vL/8vLy//Ly8v/y8vL/8vLy//Ly - 8v/y8vL/8vLy//Hx8f/x8fH/8vLy//Ly8v/y8vL/8vLy//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx - 8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx - 8f/x8fH/8fHx//Hx8f/x8fH/8vLy//Ly8v/y8vL/8fHx//Hx8f/x8fH/8fHx//Hx8f/w8PD/8PDw//Dw - 8P/w8PD/8PDw//Dw8P/w8PD/8PDw/+/v7//v7+//7u7u/+/v7//v8O7/7u/t/+7v7f/t7uz/7u/z/+7s - 6//y7+v/8evw//Dq9f/w7e//7Ovn//Hr8P/v6O//7+vw/+7q7//s6O7/7ejp/+7u6P/q7un/4uXp/+np - 6f/w8PD//////////////////////////////////7////8A////AP///wD///8A////AP///wD///8A - ////AP///wP////H////////////////////////////////////////5+fn/6urq//R0dH/9fX1//// - //////////////////////////////////////////////////////////////////////////////// - ////+////7P///9/////m/////v//////////////////////////////////8nJyfSfn5+nn5+fVp+f - nxqfn58CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAgAA - AAL////7/////////////////////////////////9/X//+5p////Pv///////////////////////// - /////////////+Pj4//W1tb/6Ojo//Dw8P/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx - 8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8PDw//Dw8P/w8PD/8PDw//Dw8P/w8PD/8fHx//Hx - 8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx - 8f/x8fH/8fHx//Hx8f/x8fH/8fHx//Hx8f/x8fH/8PDw//Dw8P/w8PD/8PDw//Dw8P/w8PD/8PDw/+/v - 7//v7+//7+/v//Dw8P/w8PD/7+/v/+7u7v/t7e3/7e3t/+7u7v/v7+//7e3t/+7u7v/u7u7/7e3t/+3t - 7f/t7e3/7Ozs/+rq6v/r6+v/6+vr/+rq6v/q6ur/6enp/+np6f/p6en/6enp/+jo6P/w8PD///////// - /////////////////////////8////8A////AP///wD///8A////AP///wD///8A////AP///wD///8n - ////9/////////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////9////97////G////wD///8A - ////AP///7f//////////////////////////////////9nZ2fKfn5+Pn5+fOp+fnw8AAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAADAAAABQAAAAcAAAAKAAAACwAAAA38/PzR//////// - ////////////////////////////////////////////////////////////////////////9vb2/87O - zv/g4OD/6+vr/+3t7f/t7e3/7e3t/+3t7f/t7e3/7e3t/+3t7f/t7e3/7e3t/+3t7f/t7e3/7e3t/+3t - 7f/t7e3/7e3t/+3t7f/s7Oz/7e3t/+3t7f/t7e3/7e3t/+7u7v/u7u7/7u7u/+7u7v/t7e3/7e3t/+3t - 7f/t7e3/7e3t/+3t7f/t7e3/7e3t/+7u7v/u7u7/7u7u/+3t7f/t7e3/7e3t/+3t7f/t7e3/7e3t/+3t - 7f/t7e3/7e3t/+3t7f/t7e3/7e3t/+zs7P/s7Oz/7Ozs/+zs7P/s7Oz/7Ozs/+zs7P/r6+v/6+vr/+vr - 6//r6+v/6+vr/+rq6v/q6ur/6+vr/+zs7P/s7Oz/7Ozs/+3t7f/t7e3/7Ozs/+zs7P/s7Oz/6+vr/+np - 6f/q6ur/6urq/+np6f/p6en/6enp/+np6f/o6Oj/6Ojo/+fn5//t7e3///////////////////////// - /////////9////8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////c/////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////f///+n////R////wD///8A////AP///wD///8A////D////+f///// - /////////////////////////////83NzeGfn591n5+fIp+fnwYAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAEAAAACAAAABAAAAAcAAAAMAAAAEAAAABUAAAAZAAAAHAAAAB7U1NRy//////////////////////// - ////////////////////////////////////////////////////////1NTU/9fX1//g4OD/5OTk/+Tk - 5P/k5OT/5OTk/+Tk5P/k5OT/5OTk/+Tk5P/k5OT/5OTk/+Tk5P/k5OT/5OTk/+Tk5P/k5OT/5OTk/+Tk - 5P/k5OT/4+Pj/+Pj4//j4+P/4+Pj/+Tk5P/k5OT/5OTk/+Tk5P/l5eX/5eXl/+Xl5f/l5eX/5eXl/+Xl - 5f/l5eX/5eXl/+Xl5f/l5eX/5eXl/+Xl5f/l5eX/5OTk/+Tk5P/k5OT/5OTk/+Tk5P/k5OT/5OTk/+Tk - 5P/k5OT/5OTk/+Tk5P/j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Hh4f/i4uL/4uLi/+Li - 4v/i4uL/4+Pj/+Xl5f/m5ub/6enp/+rq6v/r6+v/6urq/+rq6v/r6+v/6+vr/+rq6v/q6ur/6enp/+np - 6f/o6Oj/6Ojo/+jo6P/o6Oj/5+fn/+fn5//t7e3///////////////////////////////////v///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////A////8f///////////////////// - ///////////////////////////////////////////////////////////////////////////////T - ////c////xP///8A////AP///wD///8A////AP///wD///8D////w/////////////////////////// - /////////////8LCwsGfn59Yn5+fFJ+fnwIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAQAAAAHAAAADQAA - ABMAAAAbAAAAIwAAACoAAAAwAAAANAAAADcNDQ079vb24/////////////////////////////////// - ///////////////////////////////////k5OT/y8vL/9LS0v/V1dX/1tbW/9bW1v/W1tb/1tbW/9bW - 1v/W1tb/1tbW/9bW1v/W1tb/1tbW/9bW1v/W1tb/1tbW/9bW1v/W1tb/1tbW/9bW1v/W1tb/1tbW/9bW - 1v/X19f/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9fX1//X19f/19fX/9bW - 1v/W1tb/1tbW/9bW1v/W1tb/1tbW/9bW1v/W1tb/1tbW/9bW1v/W1tb/1tbW/9XV1f/V1dX/1dXV/9XV - 1f/V1dX/1dXV/9XV1f/V1dX/1dXV/9XV1f/U1NT/1NTU/9PT0//T09P/1NTU/9TU1P/V1dX/19fX/9nZ - 2f/b29v/3t7e/+Hh4f/l5eX/5+fn/+jo6P/q6ur/6urq/+rq6v/q6ur/6enp/+jo6P/o6Oj/6Ojo/+jo - 6P/n5+f/5+fn/+bm5v/o6Oj///////////////////////////////////////8D////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///yf////3//////////////////////////////// - ///////////////////////////////////////////////z////m////zf///8A////AP///wD///8A - ////AP///wD///8A////AP///wP///+r/////////////////////////////////////////f39/aqq - qoKfn584n5+fCp+fnwEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAABAAAAAkAAAAQAAAAGgAAACUAAAAxAAAAPQAA - AEcAAABPAAAAVQAAAFgAAABbiYmJi/v7+/f///////////////////////////////////////////// - /////////////+bm5v+8vLz/v7+//8HBwf/CwsL/wsLC/8LCwv/Dw8P/w8PD/8PDw//Dw8P/w8PD/8PD - w//Dw8P/w8PD/8PDw//Dw8P/wsLC/8LCwv/CwsL/wsLC/8LCwv/CwsL/w8PD/8PDw//Dw8P/w8PD/8PD - w//Dw8P/w8PD/8PDw//CwsL/wsLC/8LCwv/CwsL/wsLC/8LCwv/CwsL/wsLC/8PDw//Dw8P/wsLC/8LC - wv/CwsL/wsLC/8LCwv/CwsL/wsLC/8HBwf/BwcH/wcHB/8HBwf/BwcH/wcHB/8HBwf/BwcH/wcHB/8HB - wf/BwcH/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wcHB/8HBwf/CwsL/xMTE/8jIyP/Ly8v/z8/P/9TU - 1P/b29v/4ODg/+Tk5P/n5+f/6Ojo/+np6f/p6en/6enp/+jo6P/o6Oj/5+fn/+bm5v/k5OT/4uLi/+Dg - 4P/h4eH///////////////////////////////////////8f////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///9z//////////////////////////////////////////////// - ////////////////////x////2f///8L////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///5f/////////////////////////////////////////////3d3dyp+fn0Kfn58Xn5+fAgAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAEAAAAEAAAACgAAABMAAAAfAAAALgAAAD8AAABPAAAAXgAAAGoAAAByAAAAeAAA - AHwAAAB+AAAAf1tbW5vy8vLz////////////////////////////////////////////////4eHh/6en - p/+oqKj/qKio/6ioqP+pqan/qamp/6mpqf+qqqr/qqqq/6qqqv+qqqr/qqqq/6qqqv+qqqr/qqqq/6mp - qf+pqan/qamp/6mpqf+pqan/qamp/6mpqf+pqan/qKio/6ioqP+oqKj/qKio/6ioqP+pqan/qamp/6mp - qf+pqan/qamp/6mpqf+pqan/qamp/6mpqf+pqan/qamp/6qqqv+qqqr/qqqq/6qqqv+pqan/qamp/6mp - qf+pqan/qKio/6ioqP+oqKj/qKio/6ioqP+oqKj/qKio/6ioqP+oqKj/qKio/6ioqP+np6f/p6en/6en - p/+np6f/p6en/6ioqP+oqKj/qKio/6ioqP+pqan/rKys/7Gxsf+0tLT/vb29/8TExP/Ozs7/1tbW/93d - 3f/j4+P/5ubm/+fn5//n5+f/5ubm/+Xl5f/j4+P/39/f/9ra2v/V1dX/0NDQ/8vLy//Gxsb///////// - //////////////////////////////8v////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8D////w///////////////////////////////////////////////6////4////8r - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////i/////////// - ///////////////////////////////////6+vr1q6urWZ+fnxyfn58GAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA - AAQAAAAKAAAAFAAAACIAAAA0AAAASQAAAFwAAABvAAAAfQAAAIgAAACRAAAAlQAAAJgAAACaAAAAmgAA - AJovLy+nw8PD3/f39/v///////////////////////////r6+v/X19f/jo6O/42Njf+Ojo7/j4+P/4+P - j/+Pj4//j4+P/5CQkP+QkJD/kJCQ/5CQkP+QkJD/kJCQ/5CQkP+QkJD/kJCQ/4+Pj/+Pj4//j4+P/4+P - j/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//kJCQ/5CQkP+QkJD/kJCQ/5CQkP+Pj4//j4+P/4+P - j/+Pj4//j4+P/4+Pj/+Pj4//j4+P/5CQkP+QkJD/kJCQ/5CQkP+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+P - j/+Ojo7/jo6O/46Ojv+Ojo7/jo6O/46Ojv+Ojo7/jo6O/46Ojv+Ojo7/jo6O/46Ojv+Ojo7/jY2N/46O - jv+Ojo7/j4+P/4+Pj/+Pj4//kpKS/5eXl/+ampr/paWl/66urv+6urr/xsbG/9DQ0P/X19f/3Nzc/93d - 3f/b29v/2dnZ/9bW1v/S0tL/zMzM/8bGxv/AwMD/urq6/7S0tP+vr6//+/v7//////////////////// - //////////////8/////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////H/////P//////////////////////////////7v///9X////B////wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///9v//////////////////////////////// - //////////////39/fzMzMx/n5+fHp+fnwYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAgAAAASAAAAIgAA - ADYAAABMAAAAZAAAAHkAAACLAAAAmAAAAKEAAACnAAAAqwAAAKwAAACuAAAArgAAAK8AAACvAAAAsAoK - CrRWVlbIlJSU239/f9eAgIDugoKC/4KCgv+AgID/fHx8/3x8fP99fX3/fn5+/35+fv9+fn7/fn5+/39/ - f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//35+fv9+fn7/fn5+/35+fv9+fn7/fn5+/319 - ff99fX3/fX19/319ff99fX3/fX19/319ff99fX3/fX19/319ff9+fn7/fn5+/35+fv9+fn7/fn5+/35+ - fv9+fn7/fn5+/35+fv9+fn7/fn5+/35+fv9+fn7/fn5+/319ff99fX3/fn5+/35+fv9+fn7/fn5+/319 - ff99fX3/fX19/319ff99fX3/fX19/319ff99fX3/fX19/319ff99fX3/fX19/3x8fP98fHz/fX19/319 - ff9+fn7/gICA/4SEhP+IiIj/kZGR/5qamv+np6f/tLS0/76+vv/Gxsb/ysrK/8jIyP/Gxsb/v7+//7m5 - uf+zs7P/r6+v/6ysrP+qqqr/p6en/6ysrP/AwMD/+Pj4//////////////////////////////////9X - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///2v///// - /////////+P///+D////H////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///1v//////////////////////////////////////////////v7+/tfX - 14+fn58ln5+fBwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAABgAAAA8AAAAdAAAAMgAAAEwAAABmAAAAfgAA - AJIAAACiAAAArAAAALIAAAC2AAAAuAAAALoAAAC6AAAAuwAAALsAAAC7AAAAuwAAALsAAAC8AAAAvQAA - AL5BRUPoZmtp/3B1c/9vdHL/b3Bu/3Bxb/9wcW//cHFv/3Bxb/9xcnD/cXJw/3FycP9xcnD/cXJw/3Fy - cP9xcnD/cXJw/3FycP9xcnD/cXJw/29ycP9vcnD/b3Jw/29ycP9vcnD/b3Jw/29ycP9vcnD/b3Jw/29y - cP9vcnD/b3Jw/29ycP9vcnD/b3Jw/29ycP9vcnD/b3Jw/29ycP9vcnD/b3Jw/29ycP9vcnD/b3Jw/29y - cP9vcnD/b3Jw/29ycP9vcnD/b3Jw/29ycP9vcnD/cHFv/3Bxb/9wcW//cHFv/3Bxb/9wcW//cHFv/3Bx - b/9ucW//bnFv/25xb/9ucW//bnFv/25xb/9ucW//bnFv/29wdP9ucHH/bnBw/3Bxb/9xcm7/cnNx/3d1 - df98enz/i4KG/4+Mj/+VmZb/naOc/6iqpf+wrq7/s7Gz/7Gxsv+vr6//rKys/6enp/+oqKj/ubm5/8vL - y//g4OD/9fX1//////////////////////////////////////////////////9j////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///+L////S////wP///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////U/////v/////////////////////////////////////////////2tranJ+fnyifn58KAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAEAAAADAAAACgAAABcAAAArAAAARQAAAGEAAAB8AAAAlAAAAKYAAACyAAAAuAAA - ALwAAAC+AAAAvhcXGMozNDbZMjQ22TI0NtkyNTXZMjU12TIyNdkwMDPZLy8x2SsrLtlKSk/xYWFn/2lp - b/9oaG7/ZWVr/2Vla/9mZmz/ZmZs/2ZmbP9mZmz/Z2dt/2dnbf9nZ23/Z2dt/2dnbf9nZ23/Z2dt/2dn - bf9nZ23/Z2dt/2dnbf9nZ23/Z2dt/2dnbf9nZ23/Z2dt/2dnbf9nZ23/ZmZs/2ZmbP9mZmz/ZmZs/2Zm - bP9mZmz/ZmZs/2ZmbP9mZmz/ZmZs/2ZmbP9mZmz/ZmZs/2ZmbP9mZmz/ZmZs/2ZmbP9mZmz/ZmZs/2Zm - bP9mZmz/ZmZs/2ZmbP9mZmz/ZmZs/2ZmbP9mZmz/ZmZs/2ZmbP9mZmz/ZmZs/2ZmbP9lZWv/ZWVr/2Vl - a/9lZWv/ZWVr/2Vla/9lZWv/ZWVr/2FqZ/9gaGf/Ymdq/2Jma/9kaGz/aWxw/3J1dv97f37/iIuB/46O - jv+Vk5f/nJyc/5+goP+hoqL/o6Ok/7S0s//IyMj/2tra/+3t7f////////////////////////////// - //////////////////////////////////////////////9/////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///87////8/////////// - ///////////////////////////////////e3t6pn5+fKZ+fnwoAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAEAAAAFAAAAEAAAACAAAAA5AAAAVwAAAHUAAACQAAAApAAAALIAAAC6AAAAvRocHctBR2DqSlB5+kZH - gf9BPob/PTeJ/zsyjP86MYv/OjGL/zc0if81Mof/MzCF/zAtgv8tKn//MS6D/zYziP81Mof/NDGG/zQx - hv80MYb/NDGG/zQxhv81Mof/NTKH/zUyh/81Mof/NTKH/zUyh/81Mof/NTKH/zUyh/81Mof/NTKH/zUy - h/81Mof/NTKH/zUyh/81Mof/NTKH/zUyh/81Mof/NDGG/zQxhv80MYb/NDGG/zQxhv80MYb/NDGG/zQx - hv80MYb/NDGG/zQxhv80MYb/NDGG/zQxhv80MYb/NDGG/zQxhv80MYb/NDGG/zQxhv80MYb/NDGG/zQx - hv80MYb/NDGG/zQxhv80MYb/NDGG/zQxhv80MYb/NDGG/zQxhv80MYb/NDGG/zQxhv80MYb/NDGG/zQx - hv80MYb/NDGG/zkyh/84MIf/OTCJ/zw2h/9GQ4X/W1uH/3J0jf+Fh5T/kZOW/5iYmf+qqar/vr2+/9XV - 1f/o6Oj//Pz8//////////////////////////////////////////////////////////////////// - //////////////////////////////+P////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///yv////z//////////////////////////////// - /////////////+fn57qfn58un5+fDJ+fnwIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAIAAAAFgAA - ACoAAABGAAAAZwAAAIUAAACdAAAArwAAALkHCAjBPEBa5zw3k/8aFpT/GBKV/xcQl/8ZEJ3/GQ+f/xgP - n/8ZEZ7/GhOe/xYSof8UEJ//FBCf/xQQn/8SDp3/Ew+e/xURoP8UEJ//EhCf/xIQn/8SEJ//EhCf/xIQ - n/8SEJ//EhCf/xMRoP8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQ - n/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQ - n/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQ - n/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xIQn/8SEJ//EhCf/xgR - mv8aE5z/IRmf/zMsn/9NR57/aWWd/52ctP/IyM7/4eHi//f39/////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////+f////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////J////+f/////////////////////////////////////////////6Ojoxp+f - nzKfn58PAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAALAAAAHAAAADMAAABSAAAAdAAA - AJEAAACnAAAAtRQVFsZAQXf3IxqZ/xEKk/8VDaD/IBqn/y0qr/84OLT/P0K1/0VJuf9ITbr/Sk+8/1FO - u/9PTLn/UE26/1FOu/9QTbr/UE26/1BNuv9QTbr/Tk66/05Ouv9OTrr/Tk66/05Ouv9OTrr/Tk66/05O - uv9OTrr/Tk66/05Ouv9OTrr/Tk66/05Ouv9OTrr/Tk66/1BNuv9QTbr/UE26/1BNuv9QTbr/UE26/1BN - uv9QTbr/UE26/1BNuv9QTbr/UE26/1BNuv9QTbr/UE26/1BNuv9QTbr/UE26/1BNuv9QTbr/UE26/1BN - uv9QTbr/UE26/1BNuv9QTbr/UE26/1BNuv9QTbr/UE26/1BNuv9QTbr/Tk66/05Ouv9OTrr/Tk66/05O - uv9OTrr/Tk66/05Ouv9QTbr/UE26/1BNuv9QTbr/UE26/1BNuv9QTbr/UE26/0tNvf9OULz/V1q3/2tt - sP+rq8X/6urt//////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////+3 - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8X - ////2//////////////////////////////////////////////t7e3SpKSkOZ+fnxCfn58BAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAOAAAAIAAAADoAAABcAAAAfgAAAJkAAACtFRYYw0E+ - hvcZDZv/Fg2k/yMhqf9PTbf/W1rB/2RmxP9pa8P/am3C/2prxf9qacn/amjM/25rwf9tasD/bWrA/29s - wv9vbML/bmvB/21qwP9ua8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9tbML/bWzC/21swv9sa8H/bGvB/2xr - wf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xr - wf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xr - wf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xr - wf9sa8H/bGvB/2xrwf9sa8H/bGvB/2xrwf9sa8H/bGvB/2dky/9sa8b/fHy6/9jZ5P////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////f////D////j////1P///8b////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wv////X//////////////// - //////////////////////////////Ly8t2kpKQ8n5+fEp+fnwQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAQAAAAQAAAAJQAAAEAAAABjAAAAhAAAAJ4CAgOyQ0J58R4Zmv8UCqr/MC24/01O - vv9dWcL/Yl/G/2Nhxf9iYMD/YV+//2BdwP9hWsL/Y1zF/11cxP9cW8P/XFvD/11cxP9eXcX/XVzE/1xb - w/9dXMT/XVzE/11cxP9dXMT/XVzE/11cxP9dXMT/XVzE/11cxP9dXMT/XVzE/11cxP9dXMT/XVzE/11c - xP9dXMT/XVzE/19bxP9fW8T/X1vE/19bxP9fW8T/X1vE/19bxP9fW8T/X1vE/19bxP9fW8T/X1vE/19b - xP9fW8T/X1vE/19bxP9fW8T/X1vE/19bxP9fW8T/X1vE/19bxP9fW8T/X1vE/19bxP9fW8T/X1vE/19b - xP9fW8T/X1vE/19bxP9fW8T/XVzE/11cxP9dXMT/XVzE/11cxP9dXMT/XVzE/11cxP9fW8T/X1vE/19b - xP9fW8T/X1vE/19bxP9fW8T/X1vE/2RdxP9qY8D/x8Xe//////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - ////2////6P///9r////M////wP///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////C////8P///////////////////////////////////// - ////////8vLy4q6urkWfn58Wn5+fAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAUAAAATAAAAJwAAAEMAAABnAAAAiAAAAKFERF3WKiGa/w8In/8lKqv/Sk26/1RQuf9MTrr/TE66/01M - uv9MSrv/T068/1BNuv9PTbf/UVC4/1FOu/9RTrv/UE26/1BNuv9ST7z/UU67/1FOu/9RTrv/UU67/1FO - u/9RTrv/UU67/1FOu/9QTbr/UE26/1BNuv9QTbr/UE26/1BNuv9QTbr/UE26/1BNuv9QTbr/UE26/1FO - u/9RTrv/UU67/1FOu/9RTrv/UU67/1FOu/9RTrv/UE26/1BNuv9QTbr/UE26/1BNuv9QTbr/UE26/1BN - uv9RTrv/UU67/1FOu/9RTrv/UU67/1FOu/9RTrv/UU67/1BNuv9QTbr/UE26/1BNuv9QTbr/UE26/1BN - uv9QTbr/UU67/1FOu/9RTrv/UU67/1FOu/9RTrv/UU67/1FOu/9RTrv/UU67/1FOu/9RTrv/UU67/1FO - u/9RTrv/UU67/1JOtf+hn9T///////////////////////////////////////////////////////// - /////////////////////////////////////////+////+3////g////0v///8P////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8D////s//////////////////////////////////////////////29vbsubm5VZ+f - nxWfn58DAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAATAAAAKAAA - AEYAAABqAAAAiwMEBKQ4OJ34EQyj/yAbpv88OrH/QT27/zk7uP9BPbr/QT26/0E9uv9BPbr/QT26/0E9 - uv9BPbr/QT26/0E+vP9APrn/Qj6//z88uv9ARLT/P0G3/zo6vP87Prj/QT65/z87uP9BP7r/QkK2/0BA - tv9BPbr/QDu8/0E5u/9APrr/QD66/0A+uv9APrr/QD66/0A+uv9APrr/QD66/0VCtv9CQbX/QkG5/z4+ - uv8+Prr/QD+3/0BAtv9CP7r/Qjy5/0M+uf9EP7j/Qz63/0A+tv9BP7f/Qj+6/0E+uf8+QLb/PT62/z48 - t/9CPrv/Qjy5/0E6uf9EPbz/Qjq8/0Q/uv9CPbb/Q0O1/0A8uf9BP7v/QD65/z8+tv8+P7f/Qj+9/0E/ - uv8+QLb/P0G3/z9AuP8/QLr/QD65/z89uP9BPrn/QT65/0E+uf9BPrn/QT65/0E+uf9BPrn/QT65/0JA - uf/p6fb////////////////////////////////////////////////////////////////////////7 - ////z////5P///9f////J////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///+n - //////////////////////////////////////////////j4+PS1tbVgn5+fGp+fnwYAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAUAAAAKQAAAEYAAABrAAAAi0FD - TsErKaD/Dguk/yIerf83NLL/ODK5/y8xs/8zMbP/MzGz/zMxs/8zMbP/MzGz/zMxs/8zMbP/MzGz/zY1 - tf8zMrD/NDC3/zMvtv8zNK7/NTKw/zMttP83NLL/NjGy/zQvsv8zMbP/MTKy/zAxsf8xMbP/NDK0/zg0 - tf8zMbP/MzGz/zMxs/8zMbP/MzGz/zMxs/8zMbP/MzGz/zMysv80M7P/NTO1/zMxs/8yMbH/NTOv/zYy - r/81MLH/NTGy/zQxr/8zMK7/MzGt/zQyrv81MrD/NDOz/zQzs/82Mbb/NTC1/zo4uv8zMbP/MTCw/zk1 - tv80L7L/NTCz/zcxuP83Mrf/NzSy/zMvsP8zL7D/NDCx/zQwsf81MbL/NjKz/zYys/80M7H/MzS0/zMy - t/81Mrf/NDG2/zYxtP80MrT/NDK0/zQytP80MrT/NDK0/zQytP80MrT/NDK0/3Jwyf////////////// - /////////////////////////////////////////+P///+v////c////zv///8L////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///4////////////////////// - ////////////////////////9/f3+7S0tJSdnZ04n5+fCQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAUAAAAKgAAAEcAAABsAAAAjFpdedodF57/Dwyo/yAe - s/8tJ7T/KSO2/yUnsf8pJrL/KSay/ykmsv8pJrL/KSay/ykmsv8pJrL/KSay/yknr/8nJqz/Kye2/y0m - t/8rJqv/JyOg/yYem/8oH5f/Jh6a/ygjnv8mJKb/JiWx/yYns/8lJrL/Jiaw/yYnrf8oJ7P/KCez/ygn - s/8oJ7P/KCez/ygns/8oJ7P/KCez/yQktP8oJbb/JiOu/yQjo/8iIJf/JCGU/ychlv8lH5b/ISCU/yEg - lP8iIZX/IiGV/yEflv8gH5f/IiCb/yQinv8rIan/LSat/yYiqv8oKLL/Kiq0/yQkrv8rKLP/Kiiw/yQg - tf8pJbT/JyOr/ycjoP8mIZr/JSCZ/yUgm/8nIZ7/JSSk/yglqv8pJrH/JyS1/yYjtf8pI7b/KSS1/ygk - s/8qJ7P/Kiez/yons/8qJ7P/Kiez/yons/8qJ7P/Kiez/6ur4P////////////////////////////// - /////////6f///9T////G////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////c/////////////////////////////////////////// - ///6+vr/tLS05Jubm4ydnZ1En5+fE5+fnwQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAcAAAAUAAAAKgAAAEcAAABtAAAAjGFikecVD6T/Dg2w/xwatP8fGbT/HBe2/xse - r/8cGbL/HBmy/xwZsv8cGbL/HBmy/xwZsv8cGbL/HBmy/xsZrv8bGqz/Hhu0/x4ZsP8ZFJn/GhiC/xoV - cP8ZEmf/FxFo/xgZcf8XFIf/GBSj/x0bsP8dHLL/HRqz/x0bsP8cGbL/HBmy/xwZsv8cGbL/HBmy/xwZ - sv8cGbL/HBmy/x0btP8dGK//FxOa/xcXg/8UFWv/ExJi/xURY/8VEWP/FRNl/xQSZP8TEWP/EBFi/xER - Zf8UE2n/FhRu/xUSbv8UD3j/GRWG/x0amP8YGKL/GRmt/x4ctf8bGrD/HBqw/x0Ztf8dGqv/Fg+W/xsa - fP8WFG3/ExBm/xYRbP8cF3P/FxaW/xsZof8eGq//HRm1/xwXtv8dGbX/IBu0/x4ZsP8cGbL/HBmy/xwZ - sv8cGbL/HBmy/xwZsv8cGbL/HBmy/6qp4v//////////////////////////////////m////wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///9b//////////////////////////////////////////////z8/P+1tbX/n5+f756e - nsGenp55n5+fOJ+fnxCfn58BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAcAAAAVAAAAKwAAAEgAAABtAAAAjV9fnO4VDa7/Cwux/xERsf8UDbH/FA20/xIUr/8UErL/FBKy/xQS - sv8UErL/FBKy/xQSsv8UErL/FBKy/xcStf8UErL/FRCx/w8Mpf8PDYn/JSl3/zQ6Zf84OVv/Ojlh/zY5 - Zf8fIHj/EguW/xIPqP8UEK//Fg61/xgQsf8TEbH/ExGx/xMRsf8TEbH/ExGx/xMRsf8TEbH/ExGx/xMT - rf8SDaT/Ew2K/ysref82OWX/ODpc/zo7Xf88O13/ODZa/zk4Wv85OFr/ODhc/zo5YP82NV3/KSdR/xoX - RP8REkr/Dw5W/xAPb/8QDon/Eg+g/xQRrf8TDrH/FBC1/xURsP8VEp3/EwuI/zAzcP84OWX/Njdd/zg4 - YP88O2f/CgyJ/xAQmv8UEKv/FA6z/xQOs/8UD7D/FRGw/xMQrP8TEbH/ExGx/xMRsf8TEbH/ExGx/xMR - sf8TEbH/ExGx/46N2v//////////////////////////////////v////wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///87 - ////+//////////////////////////////////////////////Gxsb/n5+f+p+fn+afn5+zn5+fdJ+f - nzSfn58Rn5+fAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAVAAAAKwAA - AEgAAABtAAAAjV1bnu8TDLH/CAiy/wwKsP8QCq//EQqz/woKsP8LCa//Cwmv/wsJr/8LCa//Cwmv/wsJ - r/8LCa//Cwmv/wsIsv8LCLH/Cgmt/wsIpP8VE47/R06H/2t0ff90eXj/dHR6/2dteP84OoD/Fg+a/w8K - qf8OCq//EAa2/xIJs/8LCa//Cwmv/wsJr/8LCa//Cwmv/wsJr/8LCa//Cwmv/wwNq/8OCKP/GROK/0xN - hf9qcHv/c3d4/3V3eP90dnb/dXR4/3d2eP92dXf/dHN1/3Z1ef96eH7/dnV+/3Fwev9lann/Rkpn/xob - U/8JCF7/CQV8/wsGl/8SDa7/DAax/wwIrf8PDJf/GxCK/1hegf9vdH3/cHN3/29yd/9tb3f/BgmJ/woL - mf8PCqv/Dwqz/wwKsP8MC67/Dguu/w4Kr/8LCa//Cwmv/wsJr/8LCa//Cwmv/wsJr/8LCa//Cwmv/4aF - 1////////////////////////////////////////9P///97////Q////wv///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////U/////v///// - ///////////////////////////////////9/f3/vr6+/5+fn/qfn5/ln5+ftZ+fn2qfn58xn5+fDZ+f - nwEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAVAAAAKwAAAEkAAABtAAAAjVpa - ne8UDLP/CQi2/w4Ltf8SDLH/EQ2z/wsJtv8NDbX/DQ21/w0Ntf8NDbX/DQ21/w0Ntf8NDbX/DQ21/w4N - t/8MDLb/Cwuz/wwJrP8YE5b/VFaQ/3uAgf+EgXz/goCA/3R7fv8/QYj/Fg2j/wsJr/8MDLT/DQq6/w4M - sv8PDLX/Dwy1/w8Mtf8PDLX/Dwy1/w8Mtf8PDLX/Dwy1/wkMtP8PCa7/HRWS/1lZj/97gIP/goR+/4OB - gP+DgHz/goB//4SDf/+Eg3//gYF7/31+ev99fnr/f4B+/4GBgf9/gYH/fX6C/3Fxg/9AP2n/FRNf/wwJ - fP8NCZ7/EQy1/wsJuf8ODZ//HRGT/2ZtiP98gYD/foB6/4F/fv97enz/Cw6U/w8No/8PC7H/Dwq5/w4L - tf8MDbH/DAyy/w4Ltf8NDbX/DQ21/w0Ntf8NDbX/DQ21/w0Ntf8NDbX/DQ21/zo4wv////////////// - ///////////////////////////////////////////////P////m////2P///8r////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///2P///////////////////// - /////////////////////////f39/7W1tf6fn5/5n5+f4J+fn7Cfn59rn5+fLZ+fnwsAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAVAAAAKwAAAEkAAABuAAAAjlpanO8XELX/DQy6/xEN - uv8UD7L/FBC1/xAOvP8PDrj/Dw64/w8OuP8PDrj/Dw64/w8OuP8PDrj/Dw64/w4Qtf8ODrj/Dg64/xIN - tv8fFqP/W1mb/4KCiP+JgIP/hH+I/3h/iP9DRJT/Fw+v/w0Nuf8LELn/DQ68/w0Ps/8RDrj/EQ64/xEO - uP8RDrj/EQ64/xEOuP8RDrj/EQ64/wgMvv8QC7r/Hhed/1tclv98f4f/gYGB/4eAh/+HgYb/g4KG/3+A - hP+AgoP/g4WF/4SGhv+ChIT/gYOE/4GDhP+FgIH/hIF9/4WGhP94eoX/R0h0/xcXcf8LCZH/Dgqv/wkL - xP8QEKr/IRSg/2pyj/99gYL/gH97/4SAhf9+e4T/EhOf/xIQqv8TDbr/Egy9/w8Nuv8ODrb/Dg23/w8M - vP8PD7f/Dw+3/w8Pt/8PD7f/Dw+3/w8Pt/8PD7f/Dw+3/xEOuP+1tOn///////////////////////// - ////////////////////////////////////////////////////8////7v///+D////S////xP///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///9v//////////////////////////////// - //////////////r6+v+ysrL/n5+f9p+fn9+fn5+pn5+fZ5+fnymfn58LAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAcAAAAVAAAAKwAAAEkAAABuAAAAjlhao+8QCb7/Dwy//xUUvv8TE7n/EhG7/xUS - vP8TErz/ExK8/xMSvP8TErz/ExK8/xMSvP8TErz/ExK8/xERu/8UEL3/FBO9/xAStv8bFbD/YGCg/4SI - if+KiIf/kYmK/36Eif9ERJ7/GxK2/xUSvP8UEr//FhO9/xQRu/8QEr7/ExO9/xYWvP8VEbb/GBK3/xsU - u/8VELn/GRO+/xUTuf8RD7z/Ghep/19env+HiIz/i4mJ/4eJif+Ghoz/hoiT/4aCq/+Ij6j/hpKc/4uT - oP+NkJ7/ioyW/4OMif+Fio3/lImF/5CMh/+AhYj/foOG/z47ef8ODYX/Eg+h/xQSsv8VFLf/GxOm/290 - k/+JhYr/ioWG/4aFh/+BgIn/FBeo/xUUsP8WErj/FhK//xQSv/8VFL7/FBO9/xISvP8VD7z/FxS+/xIR - u/8REL7/FBLC/xMSwP8UE73/ERG3/xMSvP8+Psj///////////////////////////////////////// - ///////////////////////////////////////////////////////////////b////o////2////8z - ////A////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////j/////////////////////////////////////////// - ///29vb/rq6u/p+fn/mfn5/en5+fqZ+fn1ufn58nn5+fCZ+fnwEAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAcAAAAVAAAAKwAAAEkAAABuAAAAjllapfARCr//EA3B/xcWwP8WFr7/FRS+/xgVv/8WFb//FhW//xYV - v/8WFb//FhW//xYVv/8WFb//FhW//xUVv/8ZFcL/FxbA/xMVuf8eGLP/ZGSk/4qOj/+Rj47/lZKO/4KO - kP9GSKD/Gxa1/xUVvf8UFL7/FRW//xYWwP8TEsD/ExLA/xYUwf8aFsP/GRbA/xgVv/8aF8H/FxS+/xkX - vf8VE8D/Hhut/2Rjo/+NjpL/kY+P/42Pj/+MjJL/eHS1/3pvz/+Cgtb/honT/42K2f+PitX/kYrT/46P - yf+Dh6r/k42S/5OOj/+Gi4n/jI6P/29wlv8WFoD/FhOf/xYUtP8YF7r/Hxeq/3R5mP+Pi5D/kYyN/4yL - jf+Hho//FRas/xcWtP8YE7z/FxLB/xcTwP8VFL7/FRS+/xUTwP8VFL7/FxbA/xYVv/8VFL7/FRPA/xQS - v/8WFb//Fha+/xYVv/8WFb//trbr//////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////9////8P///+P - ////U////xv///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///5v/////////////////////////////////////////////9PT0/6io - qP6fn5/1n5+f2Z+fn6Ofn59dn5+fI5+fnwgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAVAAAAKwAA - AEkAAABvAAAAjlxdrPUSC8D/EA/D/xoYxf8aGsL/GhnD/xwZw/8aGcP/GhnD/xoZw/8aGcP/GhnD/xoZ - w/8aGcP/GhnD/xkZw/8cGMX/GhnD/xYYvP8hG7b/aGio/5GVlv+YlpX/lpaW/4iTm/9GSqL/HBqw/xoZ - vP8WFrz/GRq+/xsbwf8dGsP/HxzG/xkXxP8aGcf/GRfH/xgXxf8cHMj/GBbD/xwawP8YFsP/IR6w/2hn - p/+TlJj/mJaW/5SWlv+Tk5n/U1G1/0lByv9RTdT/VlXT/1pV2v9fV9n/ZmDd/2lq2v9uccb/jIut/5KR - mv+UmZD/mZeW/4qPmP85Oor/GBSb/xgWtv8aGbz/Ihqt/3p/nv+Wkpf/mJOU/5OTk/+OjZb/Ghq0/xwa - uv8eGcL/HRnG/x0Zxv8aGcP/GxrE/xwax/8YG8T/FxrD/xoaxP8cHMT/GxrE/xoZw/8ZF8T/GRnF/xoZ - w/8aGcP/JyfH/4yM4f/x8fv///////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////////////////n - ////r////3P///8z////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wP///+r//////////////////////////////////////////////Dw8P+mpqb/n5+f9J+f - n9afn5+bn5+fWZ+fnyGfn58HAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAWAAAAKwAAAEkAAABvAAAAjlxd - rfUTC8P/EhHF/x4cyf8eHsb/Hh3H/yAdx/8eHcf/Hh3H/x4dx/8eHcf/Hh3H/x4dx/8eHcf/Hh3H/x0d - x/8gHMn/HRzG/xocwP8kHrn/bGys/5ebnP+enJv/m5mf/46Vpv9LS5//Hxqf/xsapv8XFKX/Fxik/xYX - pf8aFqX/Hhut/xsZs/8cG77/Hh/H/xsbx/8bGsj/HRvL/x8dw/8cGsf/JCGz/2xrq/+am5//n52d/5qc - nP+ZmZ//RUm5/ysowf8qKcX/Ky3H/y8qy/8zL8v/PDnS/0FEz/9HS8//bmq8/5SUpP+fopn/oZ2c/5SY - k/9tcp//HRad/xkYtv8cHLz/Jh6x/4CFpP+dmZ7/n5qb/5qamv+UlJr/Gxy0/xwbuf8eGr//IBzB/x4d - wf8dHL//HRzA/x4cwv8cHsP/GxzE/xwbxf8hHsj/IB3G/yAgyP8eHcf/HR3J/x4dx/8eHcf/Hh3H/x4d - x/8yMcz/nJzm//j4/f////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////+z - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8D - ////w//////////////////////////////////////////////o6Oj/o6Oj/J+fn/Ofn5/Tn5+fm5+f - n06fn58fn5+fBQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAWAAAALAAAAEoAAABwAAAAjlxdrfUSDcT/FBLJ/yEf - zP8iIsr/IiHL/yQgzf8iIcv/IiHL/yIhy/8iIcv/IiHL/yIhy/8iIcv/IiHL/yIizP8lIc7/IiHL/yAi - xv8pI77/cXGx/5+jpP+npaT/rKar/5qbqf9RTY7/HBl1/xUUcv8TEXH/Fxdx/xYXcv8XFnj/FxZ+/xka - jP8YGZn/Ghyq/yMiwP8kIcr/Ih/P/yQiyP8hH8z/Kie5/3Jxsf+io6f/qKam/6KkpP+hoaf/Rky9/yYh - wv8gH8n/IiLM/yIfz/8nIc7/KifR/yotzP8wM9X/Rj3D/5OWsv+opqX/qKSj/6impv+MlKX/Jhuh/x0c - uP8fH7//KiK1/4aLrP+loaf/qKOk/6Kjof+cnaH/HiCk/xwcpP8bGqb/HBun/x0dp/8dHaX/Ghym/xsc - qv8dHa3/IR+5/yEdw/8lIc7/Ih/J/yIiyv8iIsr/ISHL/yIhy/8iIcv/IiHL/yIhy/8iIcv/IiHL/y8u - zv9gX9n/kJDl/7298P/x8fz///////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////+f////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////C////8f///// - ////////////////////////////////////////5OTk/6CgoP2fn5/xn5+f0p+fn5afn59Sn5+fG5+f - nwUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAcAAAAWAAAALAAAAEoAAABwAAAAj1xdr/UTDcb/FxXM/yUj0f8mJ8//JibS/ygk - 0f8mJc//JiXP/yYlz/8mJc//JiXP/yYlz/8mJc//JiXP/yYm0P8qJtP/JiXP/yQmyv8sJsH/dXW1/6er - rP+vraz/s6+q/6alp/9wb5H/Sklz/0VGbP9FRGz/Rkhq/0RFa/82N2r/GRpS/xcXV/8aHGr/Gxt//yEg - nv8lI7n/KSXK/ycly/8lI9D/LSq8/3d2tv+pqq7/sK6u/6qsrP+pqa//S1G8/yomwv8oJc7/KSnR/yYk - 0v8oJc//KSXS/ykqzv8mKtb/NyvR/4yOt/+trK7/rKqp/7Ovtf+boqX/Ny6n/yAguv8iI8H/Lia5/4yR - sv+sqK7/r6qr/6qrqf+lp6j/ICF8/xoZef8WFXX/FRVz/xYXcf8WF3H/FhZ0/xcWeP8ZF3v/IR+X/yAa - r/8pJcv/JyXS/yQkzv8mJs7/JibO/ycm0P8nJtD/JybQ/ycm0P8nJtD/JybQ/ycm0P8nJtD/JiXP/yUl - 0f8pJs//Q0PW/3Nz4f+Xluj/0M/z//7+/v////////////////////////////////////////////// - //////////////////////////////////////////////+L////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///xf////X//////////////// - /////////////////////////////9/f3/+goKD+n5+f8J+fn86fn5+Pn5+fS5+fnxmfn58EAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAcAAAAWAAAALAAAAEoAAABwAAAAj1xdsPUUDcj/GhjQ/ygn1f8rLNT/KirW/ysp1v8rKtT/KyrU/ysq - 1P8rKtT/KyrU/ysq1P8rKtT/KyrU/yoq1P8uKtf/KinT/ygqzv8wKsX/enq6/6+ztP+4trX/urev/7m6 - tv+rrLr/p6qy/62xsv+ysLb/sbCy/62stf+sq7v/qqq4/5qarP9qaoj/MzJq/xkZc/8gHpr/LCm7/yoo - zv8oJtP/MS7A/3x7u/+xsrb/ube3/7O1tf+xsbf/UFi9/zAuxP8tLM//LC7Q/ysr0f8uLdH/LCzU/ywu - 0v8kKdL/NCzT/4GAuP+ztLj/sraw/7eyu/+tsLj/UU6x/yUlv/8nKMb/Myu+/5KXuP+0sLb/uLO0/7O0 - sv+vsbL/UVB6/0xLd/9IR3P/R0dv/0lJbf9ISWv/SEdv/0pHdP9KTHX/QkCM/yEemf8oJcH/KyvV/ygq - 1v8sK9X/LSrU/ysq1P8rKtT/KyrU/ysq1P8rKtT/KyrU/ysq1P8rKtT/KinT/yoq1v8uK9T/KSnT/yop - 1/8KCcr/GBHG/6OjtP/Nzc3/4uLi//Ly8v/6+vr///////////////////////////////////////// - //////////////////////////////9/////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8X////5/////////////////////////// - ///////////////////V1dX/n5+f/J+fn/Gfn5/Jn5+fip+fnz6fn58Un5+fAQAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAWAAAALAAA - AEsAAABwAAAAkF1esfUVDsn/HBrS/ysq2P8uL9f/Li7a/y4s2f8vLtj/Ly7Y/y8u2P8vLtj/Ly7Y/y8u - 2P8vLtj/Ly7Y/y4u2P8yLtv/Li3X/ywu0v81L8r/gIDA/7a6u/+/vbz/wr+7/7+/v/+7u8f/u8C+/8HC - uf/Cvbz/wb24/8K8wf/Av7v/w8G5/8HAtv/BwcH/mZiy/0dGiP8eHoj/KSmr/y0r0f8rKdb/NTLE/4GA - wP+3uLz/wL6+/7q8vP+5ub//VVjE/zMuzf8vLNb/Li3X/y8t2v8zL9z/MCzf/y8u3P8qMdT/My7N/4N+ - w/+6vL3/vMS6/7u6vv+2tsj/XmKx/ysrxf8tLsz/OTHE/5mev/+8uL7/wLu8/7y9u/+4urv/uLa8/7Wy - u/+0srj/tbS2/7W2tP+1tLD/tbK0/7ayuP+tsbL/hIWx/zk2nf8rKb7/LS7W/yst2f8xL9z/MizZ/y8u - 2P8vLtj/Ly7Y/y8u2P8vLtj/Ly7Y/y8u2P8vLtj/Li7W/y0t2f8xLtf/LCzW/ywr2f8LCsz/GRLH/6Gg - tP+/v7//zMzM/9fX1//a2tr/3d3d/+Xl5f/s7Oz/9PT0//39/f////////////////////////////// - //////////////9f////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wP///+n////a////w////8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////J////+f///////////////////////////////////// - ////////z8/P/5+fn/yfn5/qn5+fv5+fn3Wfn581n5+fCQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAWAAAALQAAAEsAAABxAAAAkFtb - t/UNCtH/GhzY/zYy3/86M9z/ODPc/zY32/82NNr/NjTa/zY02v82NNr/NjTa/zY02v82NNr/NjTa/zM0 - 3P84Mt3/NzXb/zM02P85OcP/hILI/8LCzv/Hx8f/yMPF/8bHw//Cws7/xsrF/8vGx//Mx8T/y8bD/8vG - x//JyMr/v8m9/8nCyf/RyMT/xMTK/6+yx/9BQIL/IyuW/zEvvv8zMs7/OzbH/4SDx//CxMz/xcXF/8TH - xf/CwcX/W17H/zkwzf80Mtj/MzXZ/zMz2f83Ntr/NDTc/zM02P81MtX/Nz3G/4N+yf/Dwsv/vMfF/8jJ - x//EwMz/XF/B/zI0z/8yNM//PDPD/5+hyv/FxsL/xsbG/8bGxv/KxsX/x8bK/8LBw//CwcP/xMTE/8PD - w//DwsT/wsHF/8C/w/+7wL//lZ6//z85wP8wLNn/MTPf/zMw5P83Ntn/NzPZ/zY02v82NNr/NjTa/zY0 - 2v82NNr/NjTa/zY02v82NNr/NDHa/zo03/83NdX/NTba/zcz2P8FBdv/CwzS/6Khq/+9vb3/y8vL/9bW - 1v/Z2dn/2dnZ/9fX1//V1dX/1dXV/9PT0//Z2dn/+vr6//////////////////////////////////9X - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///3////// - //////////f///+n////P////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///zf////z/////////////////////////////////////////////8nJ - yf+fn5/7n5+f4p+fn6ifn59bn5+fGZ+fnwQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAWAAAALQAAAEsAAABxAAAAkF9fv/kOC9L/HB7a/zk2 - 4P8+N97/PDfg/zo73/87Od//Oznf/zs53/87Od//Oznf/zs53/87Od//Oznf/zg43v87Nt//Ojje/zY3 - 2/89Pcf/iIbM/8fI0v/Mzcv/zs7I/8nQyf+5utb/ur7W/8DC2v/Gxtj/xcXX/8TG2P/Bv9X/xtLS/83O - zP/WzMz/0c/P/8TFz/+QkLj/MzCd/zIwv/81NND/PjnK/4iHyf/HydH/y8vL/8vOzP/JyMz/YmLM/0A4 - 0/89Od7/OTvd/zY23P88O9//Ojfg/zg32/84Ndj/NTfF/4qIyv/Ny9H/xs7N/9LRzf/Cwcr/Z2fT/zk7 - 1v84OtX/QjnJ/6ao0f/Mzcn/zczO/83Nzf/OzMz/zs7O/83OzP/Nzsr/zc7K/8vMyP/Ky8f/ysvH/8rL - yf/KydL/pKrP/1RP0P8/PN//OTvf/zk35f87O9v/PTjh/zo43v86ON7/Ojje/zo43v86ON7/Ojje/zo4 - 3v86ON7/OTbf/z454v87Otj/ODnd/zo22/8GBtz/DA3T/6OirP++vr7/y8vL/9bW1v/Z2dn/2NjY/9bW - 1v/U1NT/09PT/9LS0v/Nzc3//f39//////////////////////////////////8/////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////L/////v///////////////////// - /////////9////93////G////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///87////+/////////////////////////////////////////39/f+9vb3/n5+f85+f - n9Gfn5+An5+fL5+fnwwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAcAAAAWAAAALQAAAEwAAABxAAAAkV5gwvoOC9b/HyHd/z885f9EP+L/QT3i/0FA - 4/9AP+P/QD/j/0A/4/9AP+P/QD/j/0A/4/9AP+P/QD/j/z0+4v9BPeP/QD/j/zw+4P9EQsr/jozS/87P - 2f/V1tT/1tTT/8nO1/+cmOD/kZDm/5ic6/+cn+n/oaHv/6Gj6f+qqef/srvh/87S1//Z0tf/19fR/9TV - 0f/HydT/Ukis/zY0w/84N9P/Qj7N/46Nz//P0tf/1NTU/9TX1f/S0dX/Y2fN/0I80f9BQN7/P0Lg/z49 - 4f9CP+L/QT3j/z8/3/9APt7/NzXE/5ORxf/Y1df/0dPU/9fW0v/R1Nn/aGbh/0JB3f8+QNv/Rz7O/6ut - 1v/S1dP/1dTW/9TT1f/V0tT/wL3W/8bD3P/Kyd3/ycnb/8nJ2//Jydv/ycnb/8nJ2//Dv+P/o6Tg/2Vg - 4f9OTOX/P0Pe/0A+5P8/QN7/QD3m/0A/4/9AP+P/QD/j/0A/4/9AP+P/QD/j/0A/4/9AP+P/Pz7i/0RA - 5v9BQNz/Pj/j/z084P8HBt7/DQ3V/6Ohrf++vr7/y8vL/9XV1f/Y2Nj/19fX/9XV1f/S0tL/0tLS/9DQ - 0P/Kysr///////////////////////////////////////8r////AP///wD///8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8D////z/////////////////////////////////////////// - ////+////7P///9T////A////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////U/////v////////////////////////////////////////29vb/oqKi+p+fn+afn5+in5+fU5+f - nxmfn58CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAcAAAAWAAAALQAAAEsAAABxAAAAkF5fw/oPDNj/IiTh/0RC6P9LRuX/RkPm/0ZG5v9GQ+b/RkPm/0ZD - 5v9GQ+b/RkPm/0ZD5v9GQ+b/RkPm/0VF5f9IQ+b/R0Tn/0BD4v9JR8//lJPX/9XW4P/d3tz/4uDf/83T - 5v+Be+b/aGPu/21v8/9wcfH/d3P6/3l69P+Bfuz/gYXk/7W24v/b2d//3N3Z/97f1v/Z29v/gHfI/zw7 - x/8+Ptj/R0PS/5ST1f/W2d7/3Nzc/9zf3f/Z2Nz/am/V/0RB0/9CRN7/Q0ni/0JE5v9GROT/REHk/0RE - 3v84OMz/Qz7B/66u0v/g29z/3tvd/93c2P/M0t3/VVHY/0hI4v9ERN7/S0LS/7Cy2//Y29n/3Nvf/9na - 3v/a1tv/jYbh/5mS7f+hm/L/op3y/6Sg8v+kofH/op/v/6Of8f+bluv/h4Xp/2Fg7P9OUen/RUfi/0dE - 5/9FROD/R0Pp/0dE5/9HROf/R0Tn/0dE5/9HROf/R0Tn/0dE5/9HROf/R0Tn/0lG6f9GRuD/Q0Xn/0JB - 5f8IB9//Dg7W/6Ghr/++vr7/y8vL/9XV1f/X19f/1tbW/9TU1P/R0dH/0NDQ/87Ozv/Q0ND///////// - //////////////////////////////8f////AP///wD///8A////AP///wD///8A////AP///wD///8A - ////AP///wD///+D//////////////////////////////////////////////////////////////// - ////5////4v///8n////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///2P///// - ////////////////////////////////////////ycnJ/p+fn++fn5+0n5+faJ+fnyKfn58EAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAWAAAALAAA - AEoAAABwAAAAj19fxfoPC9n/JCbj/0lI7P9QTOf/TEjn/0xL6f9MS+n/TEvp/0xL6f9MS+n/TEvp/0xL - 6f9MS+n/TEvp/0pM5/9NSOn/TEvp/0VI5v9NTNL/mZja/9vd5f/j5OL/5ejZ/9Lb5f91cN3/UE3f/1JV - 5v9VVub/WFbv/1pc5v9iXOn/Xlvn/42H3v/d4uX/3+Pk/+Hi3v/e3uT/l5bU/0ZF0f9FRd//TEnV/5mY - 2v/c3+T/4uLi/+Hk4v/f3uL/b3Lf/0tG3f9ISuT/SE3m/0pK6v9QS+z/Skbl/0RE1v9BQb3/RECn/8XF - 3f/n4uP/5OHj/+Tl4//Dxef/V1Tg/09Q6P9KS+P/UEjV/7a44f/f4uD/4+Lm/9/g5P/e3eH/YGHh/2xu - 6/90dvL/dXjy/3d78v92evD/dHju/3N37v9wbO3/ZGTu/1ZY8v9NUez/Skrq/09K6/9PS+b/T0rt/0xL - 6f9MS+n/TEvp/0xL6f9MS+n/TEvp/0xL6f9MS+n/S0ro/09K6/9NS+T/SUzr/0ZF6P8IB9//DA7Y/6Kh - sf++vr7/ysrK/9TU1P/W1tb/1tbW/9PT0//Q0ND/z8/P/8zMzP/Pz8////////////////////////// - //////////////8D////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///zf////7 - //////////////////////////////////////////////////////////////////////////////// - ////w////1////8H////AP///wD///8A////AP///wD///8A////AP///wD///9v//////////////// - ////////////////////////9vb2/6KiovGfn5+3n5+fbJ+fnyOfn58EAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAVAAAAKwAAAEgAAABtAAAAjV5g - yPoQCt3/Jifn/01M7/9VU+j/UU/p/1FQ7P9RUev/UVHr/1FR6/9RUev/UVHr/1FR6/9RUev/UVHr/1FR - 6/9UUOz/U1Ds/0xO6f9SUdb/nZze/+Hj6//p6ub/6erg/9rh8P96ddj/T0zR/1BP2/9PT9n/UEzb/05N - 0v9PSs//Qj7F/310zv/f5OX/4+fs/+Tm5v/c3ev/nZ3d/1JS3P9OT+f/Uk/b/52d3f/h5On/6Ojo/+fp - 6f/j4ub/b2/Z/09I2f9NTd3/TE7c/05K3/9RTN3/SEPO/zw8uP84OJL/bGyo/93d6//s6ur/6Ojo/+Lk - 5f+zsvL/Yl/r/1dW7P9PUOb/VE3Y/7u95f/l6eT/5+nq/+Xm6v/j4ub/TUrj/1FP5f9UUuf/VVTm/1ZW - 5v9WVub/VVXl/1VU5v9ZV9//UlLi/1FT5/9OT+X/Uk7t/1VQ7/9UUer/U1Ds/1FR6/9RUev/UVHr/1FR - 6/9RUev/UVHr/1FR6/9RUev/UFDq/1RR7f9SUef/TlHw/0xL7v8JCOL/Dg/b/6Kgs/++vr7/ysrK/9TU - 1P/W1tb/1dXV/9PT0//Pz8//zc3N/8vLy//T09P///////////////////////////////////v///8A - ////AP///wD///8A////AP///wD///8A////AP///wD///8A////B////9f///////////////////// - ///////////////////////////////////////////////////////////////////////////////z - ////l////zP///8A////AP///wD///8A////AP///wD///8A////k/////////////////////////// - /////////////8rKyvWfn5+wn5+fYZ+fnx+fn58DAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAATAAAAKAAAAEQAAABoAAAAiGBhy/oSDOH/Jyrq/1JS - 8v9aWev/VlTt/1dX8f9YVu//WFbv/1hW7/9YVu//WFbv/1hW7/9YVu//WFbv/1dY7v9aVvH/WVfx/1FT - 7f9XV9n/oqLi/+bo8P/v8Oz/7+zu/+Pk+P97dcb/R0Wp/0Q/sv9DP7D/Pzyp/zw7ov81NJL/PkKT/6Ch - zf/o5+v/6+zw/+7y7f/k5vH/oJvw/15e6P9WV+//V1Tg/6Ki4v/m6e7/7e3t/+zu7v/p6Oz/dHPD/0lC - tf9BQrL/QESt/z8+rP8+OqP/NzaU/zM3hf85OnT/ur7Q//Hw+f/s7Oz/7/Lw/+To7f+ck/T/Z2ju/1xc - 7v9WVuj/WVHa/8DD6f/r7+n/7O7v/+nr7P/o5+n/Ske7/0RBtP9BP7D/Q0Gy/0NCsP9DQbL/Q0Gy/0RB - tP9FQ63/QEC2/0VJv/9KS8v/V1Hm/1lU7f9YWOz/U1bu/1hW7/9YVu//WFbv/1hW7/9YVu//WFbv/1hW - 7/9YVu//WFft/1lX8f9XV+v/VVb0/1FQ8/8ICeP/Dw/d/6Oitv+/v7//y8vL/9TU1P/W1tb/1dXV/9LS - 0v/Ozs7/zMzM/8fHx//T09P//////////////////////////////////9////8A////AP///wD///8A - ////AP///wD///8A////AP///wD///8A////i/////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////////////////T - ////b////xP///8A////AP///wD///8A////B////+f//////////////////////////////////9TU - 1PWfn5+jn5+fUZ+fnxifn58CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAQAAAAQAAAAIwAAAD4AAABhAAAAgmVm0/4UDuP/Ki3t/1ZX9f9eXu7/Wlnv/1tb - 9f9cW/H/XFvx/1xb8f9cW/H/XFvx/1xb8f9cW/H/XFvx/1tc8v9eW/T/XVv0/1VY8P9aWtz/pqbm/+nr - 8//y8+//+PTz/+bo8v90dKr/Nzp3/y0sfP8vLnj/Kixt/yYrav8sLGj/ZG+N/+Hp6P/58fj/8/Dy//H0 - 6//r7/T/lInx/2Vl7f9cXfX/W1jk/6Wl5f/q7fL/8fHx//Dy8v/t6/H/dXWl/zs1h/8nLHf/KjF2/yos - c/8pKWn/LS9l/ztEZf+pqtD/7vbs/+3s8P/09vb/6/Du/9zk6/+IfPL/bG7w/2Fi8v9aW+v/Xlfe/8XJ - 7P/v8+3/8PLy/+zw8f/s6+3/Q0KG/zc2ev8wL3H/MTBy/zEwcv8vLnD/MC9z/y8tc/8vLnb/LiyF/zc7 - lP9ERLD/WlHe/11X6v9bXu//VVzz/1xb8f9cW/H/XFvx/1xb8f9cW/H/XFvx/1xb8f9cW/H/XFvx/11b - 9P9bW+3/WVr4/1RT9v8JCuT/ERHf/6Sjt//AwMD/zMzM/9TU1P/W1tb/1dXV/9HR0f/Nzc3/y8vL/8bG - xv/X19f//////////////////////////////////8////8A////AP///wD///8A////AP///wD///8A - ////AP///wD///83////+/////////////////////////////////////////z8/P////////////// - //////////////////////////////////////////////////////////////////////////f///+n - ////R////wD///8A////AP///9f//////////////////////////////////8PDw+ufn5+Sn5+fPp+f - nxEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAMAAAANAAAAHgAAADcAAABXAAAAeGtp2v8YCe3/LjDz/1pi6/9iY+n/Z2H8/15k6/9jZPL/Y2Ty/2Nk - 8v9jZPL/Y2Ty/2Nk8v9jZPL/Y2Ty/2Rj7/9iYPb/X2Px/19h7/9lYOX/pajl/+zx8v/58/j/8vT8/+Tl - 7/+8vMr/mJen/5GPov+Ni57/jo2d/5ycqv/LytT/8fDs//jz8P/78/r/+Pnw/+767v/T1v//jHv0/29x - 9f9hYPL/YmHf/6ap5v/s7vb/+/bz//f09v/t8vX/sq/I/5yZsv+Ni6H/j42h/5KRof+em6r/wb/L/+jm - 8v/17vX/9/Py//X17//2+Pn/4OP//62u8v+CgPH/cm/6/2Rn8f9jYOz/Z1/c/8LG7//w8/f/+fT2//Xx - 9v/x8u7/mJas/5ORp/+PjaP/joyi/46Mov+Ni6H/jYuh/46Mov+QjaP/kZGh/5OWtf9XV6P/UlDL/15f - 7f9gYvD/YmTu/2Jj8f9iY/H/YmPx/2Jj8f9iY/H/YmPx/2Jj8f9iY/H/XGTz/2xj8/9lZ+v/X2Xs/1lb - 9f8GAvX/GA/s/6ius//ExMT/zMzM/9PT0//T09P/0dHR/9DQ0P/MzMz/yMjI/8TExP/b29v///////// - /////////////////////////7////8A////AP///wD///8A////AP///wD///8A////AP///wf////X - ////////////////////////////////////////5ubm/7+/v//c3Nz/8/Pz//////////////////// - /////////////////////////////////////////////////////////////////////////9////+T - ////o////////////////////////////////////////7e3t86fn59zn5+fJ5+fnwkAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAKAAAAFwAA - AC0AAABKAAAAa25w3P8TCe//LzHz/2Ro9v9rZ+//a2r2/2Zn9/9oafX/aGn1/2hp9f9oafX/aGn1/2hp - 9f9oafX/aGn1/2pq9P9oZ/n/Zmn0/2Rl8f9sZ+j/ra7q/+/09f/69ff/9ff3//f5+v/x8vb/7ez1//Lx - +v/y8fr/7+/1//Hx9//y8vL/+/n4//z3+P/48/T/+Pz3/+fw+f+3uPT/jYP1/3V3+f9pZ/b/a2nk/62x - 7P/w8vr//vr1//r49//y9/b/8/T+/+3u+P/u7fb/8PD2//Dx9f/w7/P/9PP1//z7/f/49fH/+/r2//n7 - +//t8P7/yMz1/5qb6/9+ffH/dHH8/2ps9v9oZfD/cmni/8jO8//0+Pn//Pf4//v29//3+fP/9Pb3//Hz - 9P/v8fL/7/Hy/+/x8v/v8fL/7/Hy//Dy8//w8Pb/7fD0/9nd9f+AgMb/YF7V/2Zl8f9oafX/Zmjy/2hp - 9f9oafX/aGn1/2hp9f9oafX/aGn1/2hp9f9oafX/Ymn2/25m+f9mZ+3/a2z6/19j8v8HCPL/Egvo/6mv - uv/Gxsb/zc3N/9PT0//T09P/0dHR/9DQ0P/MzMz/yMjI/8TExP/e3t7///////////////////////// - /////////6f///8A////AP///wD///8A////AP///wD///8A////AP///4v///////////////////// - ///////////////////4+Pj/vb29/8nJyf/Hx8f/wsLC/8vLy//l5eX/+Pj4//////////////////// - //////////////////////////////////////////////////////////////////////////////// - /////////////////////////////6amppKfn59Jn5+fE5+fnwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAGAAAAEQAAACMAAAA9AAAAW3N2 - 4f0KCen/Mjf4/2po/f95c/r/b27z/21u/P9vb/f/b2/3/29v9/9vb/f/b2/3/29v9/9vb/f/b2/3/3Fw - 9f9wb/v/bXD3/25v9f97du//uLn1//L5/P/9+vz/+Pr0//n69v/6+/n/+/v7//v7+//8/Pz/+/v7//j5 - 9//7/ff/+Pf7//z6///2+Pj/8Pb9/9HU//+cnPD/i4j2/3h69/9wbvb/d3bq/7e49P/z9f////35//38 - +P/3/fj/+Pz3//n9+P/7/Pj/+/z4//z9+f/9/vr/+fv1//X38f/+//v/9/n6/+vt///S1Pz/qq3x/4yN - 7/+Afvn/dXL9/29v9/9xbvP/fnfq/87U9//2+f3/+/n5//v5+f/5/ff/+vr6//n5+f/5+fn/+vr6//v7 - +//6+vr/+vr6//r6+v/4+/L//f/7/+3x//+Yl9n/cW7h/25u9v9ucPr/bm72/29v9/9vb/f/b2/3/29v - 9/9vb/f/b2/3/29v9/9vb/f/a2/2/3Nt//9vcPb/dnD9/2Ro7/8ECu3/EArr/6+zxf/Kysr/z8/P/9TU - 1P/T09P/0dHR/9DQ0P/MzMz/yMjI/8TExP/j4+P//////////////////////////////////5v///8A - ////AP///wD///8A////AP///wD///8A////N/////v///////////////////////////////////// - ///Pz8//wcHB/8jIyP/Kysr/xsbG/8TExP+4uLj/uLi4rP///1H///+z////+/////////////////// - //////////////////////////////////////////////////////////////////////////////// - ////////9fX165+fn0afn58bn5+fBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAEAAAACwAAABkAAAAuAAAASXR43O8JC+z/Ky/6/29t - //9/evv/dXP1/3V4+P92dvj/dnb4/3Z2+P92dvj/dnb4/3Z2+P92dvj/dnb4/3V38/90dvr/dHb4/3t6 - +v+Lhvn/vr/8/+3y///49///+vz9//f4/P/3+Pz/9vf7//X1+//29vz/+fn///j4/v/4+///9fP///Tz - ///o7P7/z9P2/66u+v+Tkfv/hIT4/3x8+P99efr/iof0/76+/v/t7///+fn///j5/f/1+v3/+vz9//j6 - +//3+fr/9vf7//f4/P/5+v7/+fn///j4/v/z8///4eL8/8nM+f+vsfj/lJb1/4eH+f+Af/3/d3T5/3d2 - +/9/ffn/j4n4/8/W/f/y9f//9vX+//f2///2+f3/+Pr6//j6+v/4+vr/+fv7//n7+//4+vr/+Pr6//j6 - +v/39/f/+Pr7/+zt//+sqfH/hYP0/3h4+v9zdfn/d3b7/3Z2+P92dvj/dnb4/3Z2+P92dvj/dnb4/3Z2 - +P92dvj/dnj1/3Zz/v93dvz/eHXz/2Bj9P8CBu7/GxL1/7W5y//Nzc3/0dHR/9TU1P/T09P/0dHR/8/P - z//MzMz/yMjI/8TExP/m5ub//////////////////////////////////3////8A////AP///wD///8A - ////AP///wD///8H////1////////////////////////////////////////+Tk5P+8vLz/ysrK/8rK - yv/Gxsb/w8PD/8LCwv+1tbW36urqBgAAAAAAAAAA////F////3f////X//////////////////////// - ///////////////////////////////////////////////////////////////////+/v790dHRcZ+f - nxqfn58GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAABAAAABwAAABEAAAAhAAAAN32EzMYPBvf/GBf2/3F2//98fPL/gYD4/3x/ - +f99ffn/fX35/319+f99ffn/fX35/319+f99ffn/fX35/36A9v97ffr/enz4/4WE/P+Sj/3/trX9/9TX - /f/e3vz/4d/8/+Lg/f/j4f7/5OL//+Ti///j4f7/4+H+/+Ph///d3P7/1tX8/87N9//Cw/X/qqzy/5iX - +f+Pjf//gIH7/4GA+P+GhPz/k5H7/7e2///V1v//39/9/9/g+v/e4Pj/4+L8/+Ph/v/j4f7/4+H//+Lf - ///f3v7/3Nv9/9nY+v/OzPr/wb/6/62t+/+YmPz/ior8/4KD/f9+fvr/fH33/4B8/f+Ghvz/lJH+/8DG - +//a3P7/4d/9/+Hh///e4vv/4uH7/+Lh+//j4vz/4uH7/+Lh+//h4Pr/4eD6/+Hg+v/k4f//3t78/9XS - //+qp/z/jov+/36A/P95e/f/f4D6/319+f99ffn/fX35/319+f99ffn/fX35/319+f99ffn/fYHy/3t6 - +P96ePr/fIDw/09O/P8FBfP/LiTz/7zAy//Q0ND/09PT/9TU1P/S0tL/0dHR/8/Pz//MzMz/yMjI/8TE - xP/t7e3//////////////////////////////////3P///8A////AP///wD///8A////AP///wD///+L - ////////////////////////////////////////9vb2/76+vv/FxcX/y8vL/83Nzf/Hx8f/wsLC/7S0 - tMDm5uYJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////N////5v////z//////////////////////// - ///////////////////////////////////////////////////t7e2nn5+fFp+fnwMAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAABAAAABAAAAAoAAAAWAAAAJo6WuowZBvX/DQn1/1pn+f+Eh/r/ior0/4B///+EhPr/hIT6/4SE - +v+EhPr/hIT6/4SE+v+EhPr/hIT6/4WG+P+Eg/v/g4L6/4qJ/f+TkP3/o6T8/7O0+P+8vPj/vLv5/7y7 - +f+8vPj/u7v3/7y8+P+7u/f/urn3/7y7+f++vP7/t7b4/7Gw+P+lpvf/nJv7/5OS//+Hhv7/goP9/4OD - +f+Jifv/k5H7/6Si+/+zsvr/urv4/72++P+9vvj/vbz6/7++/P++vfv/vLv7/727/f++vP7/urn9/7Sz - 9/+qqPr/pKL8/5mW/f+Li/3/h4b+/4WE/P+Cgvj/hYX5/4WD+/+Ki/v/kY///6is8/+4t/f/vbr4/76+ - +v+6vvj/vbr//767//++u///vbr//726//+9uv//vbr//726//+7t/7/t7b2/7Ow+P+dm/v/jo3//4aI - /v+Dg/f/hoP3/4SE+v+EhPr/hIT6/4SE+v+EhPr/hIT6/4SE+v+EhPr/goXx/4eF/f+Dgf3/e4X7/zEs - /f8JBPP/S0fi/8bJzv/S0tL/09PT/9PT0//S0tL/0NDQ/87Ozv/Ly8v/x8fH/8TExP/u7u7///////// - /////////////////////////1////8A////AP///wD///8A////AP///zf////7//////////////// - ////////////////////////y8vL/8bGxv/Ly8v/ysrK/8rKyv/FxcX/tbW1yerq6g8AAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8L////X////8P///////////////////////////// - //////////////////////////////n5+baurq4Un5+fAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA - AAUAAAAMAAAAGD9DSDVJPfH2DQf6/y849P+AhP//joz2/4WE//+Kivz/ior8/4qK/P+Kivz/ior8/4qK - /P+Kivz/ior8/4qL+/+Kif3/iYj8/4yN/f+Rkf3/mJf+/5ya+v+jofv/o6P//6Gi/f+hovz/oqP9/6Kk - /P+hovz/oaL9/6Gh//+hovr/np37/5mZ/f+Qkfn/jpD8/42N//+Hh/n/jI39/4qK/v+OjP3/lJL8/5iU - /f+cm/3/oKH8/6Oj/f+lov7/oqL8/6Oj/f+jov7/oKH8/6Gh//+iov//nqD+/5qc+v+XmP//k5P9/42O - /P+Jifv/ion9/4uL/f+Jivr/jI39/4yN/f+OkPz/kI7//5ea9f+gnPv/o576/6Ki/P+eovv/oqP5/6Kj - +f+io/n/oaL4/6Kj+f+jpPr/oqP5/6Gi+P+iof//oaH7/5yd9/+Ulf3/jI3//4mN/f+Mi/n/kIr7/4qK - /P+Kivz/ior8/4qK/P+Kivz/ior8/4qK/P+Kivz/iIv4/5GK//+Lif//YWn8/xIO+v8UD/T/f4jY/9DN - 1v/T09P/09PT/9LS0v/R0dH/0NDQ/87Ozv/Kysr/x8fH/8PDw//39/f///////////////////////// - /////////0f///8A////AP///wD///8A////C////9////////////////////////////////////// - ///i4uL/vr6+/8jIyP/Nzc3/yMjI/8LCwv+7u7vS2traFgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8n////h////+f///////////////////////////// - ///////k+fn5VJ+fnwWfn58CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAAGAAAADQAA - ABd+gOWjCQb2/xAO+v9tcPb/kYv//4yP//+PkP//j5D//4+Q//+PkP//j5D//4+Q//+PkP//j5D//5CO - //+Rkf//jo7//4+Q/v+Pkf3/lJL//5GP//+Wk///kZP//42P//+Okf3/kJT9/46S+/+Okf3/kJP//46R - /v+Slff/k5H//4+N//+Pkf//jpH+/4+P//+Tkv//kZP3/46P//+Qj/3/lJH+/5OP//+Rjv//kJH//5KR - //+UkP//kpX+/5CT/P+Qk/z/kZP//4+S/v+NkPz/jpH9/46U//+MkP//i4///5CS//+PkP7/kZD+/5OS - //+Qj/3/jo/9/5CQ/P+Okfr/kI7//5GR+/+Xkf//lpD//5KR//+Pkv//kJL+/5GT//+Rk///kJL+/5CS - /v+Rk///kJL+/4+R/f+Qkf//kJT6/5CT9f+QlP3/i4///4yP/P+Sj/z/mJH//4+Q//+PkP//j5D//4+Q - //+PkP//j5D//4+Q//+PkP//j5D//5GH//+Kivz/O0Hu/wMC/P8nIvr/rsTd/9XO2//T09P/09PT/9LS - 0v/R0dH/0NDQ/87Ozv/Kysr/xsbG/8PDw//5+fn//////////////////////////////////z////8A - ////AP///wD///8A////k/////////////////////////////////////////b29v+/v7//xcXF/8vL - y//Nzc3/xsbG/8DAwNvV1dUZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wP///8v////a////5////+T////b////0f///8PAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAACAAAABgAAAAxrbHkmRUD35woG - //8gGPn/dn///4mY//+Zmvz/mJb//5aS//+Vlf//lpz7/5Wd9/+SmPv/k5b//5aW//+Vlf//lZX//5WV - //+Vlf//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lpb//5aW - //+Wlv//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lpb//5aW - //+Wlv//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lpb//5aW - //+Wlv//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lZX//5WV//+Wlv//lpb//5aW//+Wlv//lpb//5aW - //+Wlv//lpb//5aW//+Wlv//lpb//5aW//+Wlv//lpb//5mW//+YmPz/mJr4/5qZ+/+alf//m5P//5uW - //+cm/n/kZf//4GO+P9GSP//BAD9/xgW8v99heL/zNHU/+HT2f/U1NT/09PT/9LS0v/R0dH/0NDQ/83N - zf/Jycn/xsbG/8LCwv///////////////////////////////////////x////8A////AP///wD///8/ - /////////////////////////////////////////////8vLy//ExMT/ycnJ/87Ozv/BwcH/xMTE5NjY - 2B8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAUAAAAKsbTeVjMs8fwDCfz/Ewv//2Fa - //+RkP7/mZv//5ug+/+anfj/nZz+/6Gd//+hnf//oJ3//5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f - /f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f - /f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f - /f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/6Cg/v+goP7/oKD+/6Cg - /v+goP7/oKD+/6Cg/v+goP7/n5/9/5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f/f+fn/3/n5/9/5+f - /f+fn/3/n5/9/5+f/f+fn/3/n5/9/5yh9v+eoP7/np3//5uc//+anf//mJ79/5ed/v+Umf//c3T//yYg - //8DAP7/Fwz2/2pj6f/Dydz/1dnU/9PX0v/U1NT/09PT/9LS0v/Q0ND/z8/P/8zMzP/IyMj/xcXF/8TE - xP///////////////////////////////////////xf///8A////AP///wv////f//////////////// - ////////////////////////4uLi/7+/v//Jycn/y8vL/8PDw//Ly8vq1tbWJQAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAADAAAABrO48GwzMPf8Dgv1/xgE//8wJff/UU3//3R5 - //+Jkf//lJb//5yX//+imP//pZr//56b/v+em/7/npv+/56b/v+em/7/n5z//5+c//+em/7/npv+/56b - /v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b - /v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b - /v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b - /v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b/v+em/7/npv+/56b - /v+em/7/npv+/56d+/+dm///mpn//5ia//+Ul///hoT//2pe/v9QPfj/EAX//woH9v8hF/f/enbn/8XJ - 2//R1Nj/09fR/9PR0f/T09P/0tLS/9HR0f/Pz8//zc3N/8rKyv/Hx8f/xcXF/8jIyP////////////// - /////////////////////////wD///8A////AP///5P///////////////////////////////////// - ///29vb/vr6+/8fHx//Jycn/x8fH/8bGxu3X19cuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAAALQ0/RFcGr+5RoX7/8PDPz/Cwf6/woF+/8KB/3/CQn9/wgK - +P8GC/T/Bw30/wQI+/8FCfz/BQn8/wQI+/8DB/r/BQn8/wYK/f8FCfz/BQn8/wUJ/P8FCfz/BQn8/wUJ - /P8FCfz/BQn8/wUJ/P8FCfz/BQn8/wUJ/P8FCfz/BQn8/wUJ/P8FCfz/BQn8/wUJ/P8FCfz/BQn8/wUJ - /P8FCfz/BQn8/wUJ/P8FCfz/Bgr9/wYK/f8GCv3/Bgr9/wUJ/P8FCfz/BQn8/wUJ/P8FCfz/BQn8/wUJ - /P8FCfz/BQn8/wUJ/P8FCfz/BQn8/wQI+/8ECPv/BAj7/wQI+/8ECPv/BAj7/wQI+/8ECPv/BQn8/wUJ - /P8FCfz/BQn8/wUJ/P8FCfz/BQn8/wUJ/P8FCfz/BQn8/wUJ/P8FCfz/BQn8/wUJ/P8FCfz/BQn8/woF - //8JB///CQj+/wcJ+/8HCfv/Bgr9/wQK/f8CCPv/Dw3z/z496/+dpt//z9PY/9PS1v/Q19L/zs3W/93V - 3P/T09P/0tLS/9DQ0P/Ozs7/zMzM/8nJyf/Gxsb/xMTE/8LCwv////////////////////////////// - /////////yP///8A////U//////////////////////////////////////////////Kysr/xMTE/8rK - yv/IyMj/x8fH89ra2jcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAA8vP/D7/K/WpsdP/PTEz8/ywj9v8dD/v/FQz9/xEM+/8ODff/DQ74/w8K - //8QC///Eg3//w4J/v8LBvv/Dwr//xEM//8LBvv/Dgn+/w4J/v8OCf7/Dgn+/w4J/v8OCf7/Dgn+/w4J - /v8OCf7/Dgn+/w4J/v8OCf7/Dgn+/w4J/v8OCf7/Dgn+/w4J/v8OCf7/Dgn+/w4J/v8OCf7/Dgn+/w4J - /v8OCf7/Dgn+/w4J/v8OCf7/Dgn+/w4J/v8OCf7/DQj9/w0I/f8PCv//Dwr//w8K//8PCv//Dwr//w8K - //8PCv//Dwr//w8K//8PCv//Dwr//w8K//8PCv//Dwr//w8K//8PCv//Dwr//w8K//8PCv//Dwr//w8K - //8OCf7/Dgn+/w4J/v8PCv//Dwr//w8K//8OCf7/Dgn+/w4J/v8OCf7/Dgn+/w8I/f8RC/z/Ew38/xAJ - +v8RCPj/Gxb1/y0x9P8/S/f/h4vq/7XB3f/Q19r/09TY/9jT1P/Y0tP/1NLR/8rR1P/S0tL/0dHR/8/P - z//Nzc3/y8vL/8jIyP/FxcX/wsLC/729vf/+/v7//////////////////////////////////9f///+n - ////+////////////////////////////////////////97e3v/AwMD/yMjI/8jIyP/MzMz21NTUQAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAOrz/yHr8v8z6/L/M+7z/zPl6fU1xsbSPpqcpk12d39hV1hefUJD - SJl7fYfPztHg/+Dj8v/f4vH/1Nfm/9TX5v/U1+b/1Nfm/9TX5v/U1+b/1Nfm/9TX5v/U1+b/1Nfm/9TX - 5v/U1+b/1Nfm/9TX5v/U1+b/1Nfm/9PW5f/T1uX/09bl/9PW5f/T1uX/09bl/9PW5f/T1uX/0tXk/9LV - 5P/S1eT/0tXk/9LV5P/R1OP/0dTj/9HU4//P0uH/z9Lh/8/S4f/P0uH/z9Lh/8/S4f/P0uH/z9Lh/87R - 4P/O0eD/ztHg/87R4P/O0eD/ztHg/87R4P/O0eD/zdDf/83Q3//Mz97/zM/e/8zP3v/Mz97/zM/e/8vO - 3f/Lzt3/y87d/8vO3f/Lzt3/y87d/8rN3P/Kzdz/ys3c/8TP1//Dztb/xc7X/8rQ2//Nzd3/y8nc/87K - 3f/Qzd3/1NnY/9nT2P/a1tX/09fR/9PT0//c19T/2drR/8bP0v/R0dH/0NDQ/87Ozv/MzMz/ysrK/8bG - xv/Dw8P/wMDA/7u7u//x8fH///////////////////////////////////////////////////////// - ////////////////////////9fX1/76+vv/FxcX/xsbG/8nJyfnX19dMAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADgAAACAAAAA6AAAAXAAAAH9sbWvE3d7c//Hy - 8P/r7Or/4uPh/+Lj4f/i4+H/4uPh/+Lj4f/i4+H/4uPh/+Lj4f/h4uD/4eLg/+Hi4P/h4uD/4eLg/+Hi - 4P/h4uD/4eLg/+Dh3//g4d//4OHf/+Dh3//g4d//4OHf/+Dh3//g4d//4OHf/+Dh3//g4d//4OHf/9/g - 3v/f4N7/3+De/9/g3v/f4N7/3+De/9/g3v/f4N7/3+De/9/g3v/f4N7/3+De/93e3P/d3tz/3d7c/93e - 3P/d3tz/3d7c/93e3P/d3tz/29za/9vc2v/b3Nr/29za/9rb2f/a29n/2tvZ/9rb2f/Z2tj/2drY/9na - 2P/Y2df/2NnX/9jZ1//Y2df/2NnX/9Xa2f/T19j/0tXZ/9TW1//U19X/1tfT/9fY1v/b2Nr/1dLU/9zT - 1v/e1dL/1tfO/9Hbzv/N09L/zcnU/9nW0v/Pz8//zs7O/83Nzf/Ly8v/ycnJ/8XFxf/BwcH/vr6+/7i4 - uP/R0dH///////////////////////////////////////////////////////////////////////// - ////////y8vL/8XFxf/Hx8f/ysrK/NbW1lUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAADAAAADgAAACAAAAA6AAAAXAAAAH9qamrE3d3d//Pz8//q6ur/4uLi/+Li - 4v/i4uL/4uLi/+Li4v/i4uL/4uLi/+Li4v/h4eH/4eHh/+Hh4f/h4eH/4eHh/+Hh4f/h4eH/4eHh/+Dg - 4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg4P/g4OD/4eHh/+Dg4P/g4OD/4ODg/+Dg4P/f39//39/f/9/f - 3//d3d3/3d3d/93d3f/d3d3/3d3d/93d3f/d3d3/3d3d/9zc3P/c3Nz/3Nzc/9zc3P/c3Nz/3Nzc/9zc - 3P/c3Nz/29vb/9vb2//a2tr/2tra/9ra2v/Z2dn/2dnZ/9nZ2f/Z2dn/2dnZ/9jY2P/Y2Nj/2NjY/9jY - 2P/X19f/19fX/9vW1//b1tj/29Xa/9nW2P/Y1tb/1dbU/9TV0f/T1c//1tnQ/9XZ1P/T0df/1s7Z/9DR - 2//K1NT/0dbN/9vOzP/Ozs7/zc3N/8zMzP/Kysr/yMjI/8TExP/AwMD/vb29/7a2tv+0tLT/9PT0//// - ///////////////////////////////////////////////////////////////////j4+P/xMTE/8fH - x//Hx8f80dHRXgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAADAAAADgAAACAAAAA6AAAAXAAAAH9ra2vE3d3d//Dw8P/q6ur/4uLi/+Li4v/h4eH/4eHh/+Hh - 4f/h4eH/4eHh/+Hh4f/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg - 4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg4P/f39//39/f/9/f3//f39//3t7e/97e3v/e3t7/3t7e/93d - 3f/d3d3/3d3d/93d3f/d3d3/3d3d/9zc3P/c3Nz/3Nzc/9zc3P/b29v/29vb/9vb2//b29v/2tra/9ra - 2v/a2tr/2tra/9ra2v/a2tr/2dnZ/9nZ2f/Z2dn/2dnZ/9nZ2f/Z2dn/2dnZ/9nZ2f/Y2Nj/2NjY/9fX - 1//X19f/19fX/9bW1v/W1tb/1tbW/9XV1f/V1dX/1dXV/9TU1P/T09P/09PT/9PT0//S0tL/0dHR/9DQ - 0P/Pz8//zc3N/8rKyv/IyMj/xcXF/8HBwf+9vb3/urq6/7S0tP+xsbH/xMTE//z8/P////////////// - /////////////////////////////////////////////+rq6v/Hx8f/ycnJ/8rKyv/Ozs5kAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADgAA - ACAAAAA6AAAAXAAAAH9ra2vE3d3d//Dw8P/q6ur/4eHh/+Hh4f/h4eH/4eHh/+Hh4f/h4eH/4eHh/+Hh - 4f/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg - 4P/g4OD/39/f/9/f3//f39//3t7e/97e3v/e3t7/3t7e/97e3v/d3d3/3d3d/93d3f/d3d3/3d3d/93d - 3f/d3d3/3d3d/9zc3P/c3Nz/3Nzc/9vb2//b29v/29vb/9vb2//b29v/2tra/9ra2v/a2tr/2tra/9ra - 2v/a2tr/2dnZ/9nZ2f/Z2dn/2dnZ/9nZ2f/Z2dn/2dnZ/9jY2P/Y2Nj/19fX/9fX1//W1tb/1tbW/9bW - 1v/V1dX/1dXV/9XV1f/V1dX/1NTU/9PT0//T09P/0tLS/9LS0v/R0dH/0NDQ/8/Pz//Ozs7/zMzM/8nJ - yf/Gxsb/w8PD/7+/v/+7u7v/uLi4/7Kysv+urq7/qamp/8rKyv/8/Pz///////////////////////// - ////////////////////////7e3t/8bGxv/Gxsb/ysrK/8nJyWoAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADgAAACAAAAA6AAAAXAAA - AH9ra2vE3d3d//Dw8P/q6ur/4eHh/+Hh4f/h4eH/4eHh/+Hh4f/h4eH/4eHh/+Dg4P/g4OD/4ODg/+Dg - 4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//3t7e/97e - 3v/e3t7/3t7e/97e3v/d3d3/3d3d/93d3f/d3d3/3d3d/93d3f/d3d3/3d3d/93d3f/c3Nz/3Nzc/9zc - 3P/b29v/29vb/9vb2//b29v/2tra/9ra2v/a2tr/2tra/9ra2v/a2tr/2tra/9ra2v/Z2dn/2dnZ/9nZ - 2f/Z2dn/2dnZ/9nZ2f/Z2dn/2NjY/9fX1//X19f/1tbW/9bW1v/W1tb/1tbW/9XV1f/V1dX/1NTU/9TU - 1P/U1NT/09PT/9LS0v/S0tL/0dHR/9DQ0P/Pz8//zs7O/83Nzf/MzMz/ysrK/8fHx//ExMT/wcHB/729 - vf+4uLj/tbW1/6+vr/+rq6v/p6en/76+vv/i4uL/8/Pz//39/f////////////////////////////z8 - /P/t7e3/ycnJ/8jIyP/Gxsb/xsbGcwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADgAAACAAAAA6AAAAXAAAAH9qamrE3d3d//Dw - 8P/p6en/4eHh/+Hh4f/h4eH/4eHh/+Dg4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg - 4P/g4OD/4ODg/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//3t7e/97e3v/e3t7/3d3d/93d - 3f/d3d3/3d3d/93d3f/c3Nz/3Nzc/93d3f/d3d3/3Nzc/9zc3P/c3Nz/3Nzc/9vb2//b29v/29vb/9vb - 2//b29v/2tra/9ra2v/a2tr/2tra/9ra2v/a2tr/2tra/9ra2v/Z2dn/2dnZ/9jY2P/Y2Nj/2NjY/9jY - 2P/Y2Nj/19fX/9fX1//W1tb/1tbW/9bW1v/V1dX/1dXV/9XV1f/U1NT/1NTU/9PT0//T09P/0tLS/9HR - 0f/Q0ND/0NDQ/8/Pz//Ozs7/zMzM/8vLy//Kysr/yMjI/8XFxf/CwsL/vr6+/7q6uv+1tbX/srKy/62t - rf+np6f/pqam/8HBwf/b29v/19fX/9fX1//e3t7/5+fn/+Xl5f/b29v/0NDQ/8rKyv/Kysr/yMjI/8LC - wv/Kysp5AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAADAAAADgAAACAAAAA6AAAAXAAAAH9qamrE3Nzc/+/v7//p6en/4ODg/+Dg - 4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg4P/f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f - 3//f39//39/f/9/f3//f39//3t7e/97e3v/e3t7/3t7e/97e3v/e3t7/3d3d/93d3f/d3d3/3d3d/9zc - 3P/c3Nz/3Nzc/9zc3P/c3Nz/29vb/9vb2//c3Nz/3Nzc/9vb2//b29v/29vb/9vb2//a2tr/2tra/9ra - 2v/a2tr/2dnZ/9nZ2f/Z2dn/2dnZ/9nZ2f/Z2dn/2NjY/9jY2P/X19f/19fX/9fX1//X19f/19fX/9fX - 1//W1tb/1tbW/9XV1f/V1dX/1dXV/9TU1P/T09P/09PT/9PT0//S0tL/0dHR/9DQ0P/Pz8//zs7O/83N - zf/MzMz/y8vL/8rKyv/IyMj/xsbG/8LCwv+/v7//vLy8/7i4uP+zs7P/sLCw/6urq/+lpaX/paWl/8TE - xP/W1tb/09PT/9HR0f/Pz8//zc3N/83Nzf/Gxsb/yMjI/8rKyv/ExMT/xMTE/8rKyoEAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAADAAAADgAAACAAAAA6AAAAXAAAAH9qamrE3Nzc/+/v7//p6en/4ODg/+Dg4P/g4OD/4ODg/+Dg - 4P/f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f - 3//e3t7/3t7e/97e3v/e3t7/3t7e/93d3f/d3d3/3d3d/93d3f/c3Nz/3Nzc/9zc3P/c3Nz/3Nzc/9vb - 2//b29v/29vb/9vb2//b29v/29vb/9vb2//b29v/2tra/9ra2v/a2tr/2tra/9nZ2f/Z2dn/2NjY/9nZ - 2f/Z2dn/2dnZ/9jY2P/Y2Nj/19fX/9fX1//W1tb/1tbW/9bW1v/W1tb/1tbW/9bW1v/W1tb/1dXV/9XV - 1f/U1NT/1NTU/9PT0//T09P/0tLS/9HR0f/R0dH/0NDQ/8/Pz//Ozs7/zc3N/8zMzP/Kysr/ycnJ/8jI - yP/FxcX/w8PD/8DAwP+9vb3/ubm5/7W1tf+wsLD/ra2t/6mpqf+jo6P/pqam/8fHx//R0dH/zs7O/83N - zf/Ly8v/y8vL/8fHx//Jycn/xcXF/8LCwv/BwcH/ysrKhwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADgAA - ACAAAAA6AAAAXAAAAH9qamrE3Nzc/+/v7//o6Oj/4ODg/+Dg4P/g4OD/39/f/9/f3//f39//39/f/9/f - 3//f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//f39//3t7e/97e3v/e3t7/3t7e/93d - 3f/d3d3/3d3d/93d3f/d3d3/3Nzc/9zc3P/c3Nz/3Nzc/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb - 2//b29v/29vb/9ra2v/a2tr/2dnZ/9nZ2f/Z2dn/2dnZ/9jY2P/Y2Nj/2NjY/9jY2P/Y2Nj/2NjY/9jY - 2P/X19f/19fX/9bW1v/W1tb/1tbW/9bW1v/W1tb/1tbW/9XV1f/V1dX/1dXV/9PT0//T09P/09PT/9LS - 0v/R0dH/0dHR/9DQ0P/Q0ND/zs7O/83Nzf/MzMz/y8vL/8rKyv/IyMj/x8fH/8bGxv/CwsL/wMDA/729 - vf+6urr/tra2/7Kysv+urq7/qqqq/6ampv+ioqL/p6en/8nJyf/Nzc3/y8vL/8rKyv/Hx8f/xMTE/8nJ - yf/ExMT/xMTE/8LCwv/JycmQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADgAAACAAAAA6AAAAXAAA - AH9qamrE3Nzc/+/v7//o6Oj/4ODg/+Dg4P/f39//39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f - 3//f39//39/f/9/f3//f39//39/f/97e3v/e3t7/3t7e/97e3v/d3d3/3d3d/93d3f/d3d3/3Nzc/9zc - 3P/c3Nz/3Nzc/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2//a2tr/2tra/9nZ - 2f/Z2dn/2dnZ/9jY2P/Y2Nj/2NjY/9jY2P/Y2Nj/19fX/9fX1//Y2Nj/2NjY/9fX1//X19f/1tbW/9bW - 1v/W1tb/1tbW/9bW1v/W1tb/1dXV/9XV1f/U1NT/1NTU/9PT0//S0tL/0tLS/9HR0f/Q0ND/0NDQ/8/P - z//Pz8//zc3N/8zMzP/Ly8v/ysrK/8nJyf/Hx8f/xcXF/8TExP/AwMD/vb29/7q6uv+3t7f/tLS0/7Cw - sP+srKz/qKio/6SkpP+hoaH/p6en/8vLy//Ly8v/ycnJ/8jIyP/ExMT/wsLC/8DAwP/CwsL/vb29/8bG - xpYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADgAAACAAAAA6AAAAXAAAAH9qamrE29vb/+/v - 7//o6Oj/39/f/9/f3//f39//39/f/9/f3//f39//39/f/9/f3//e3t7/3t7e/97e3v/e3t7/3d3d/93d - 3f/d3d3/3d3d/93d3f/d3d3/3Nzc/9zc3P/c3Nz/3Nzc/9zc3P/c3Nz/3Nzc/9zc3P/c3Nz/29vb/9vb - 2//a2tr/2tra/9ra2v/a2tr/2tra/9ra2v/a2tr/2dnZ/9nZ2f/Z2dn/2dnZ/9fX1//X19f/19fX/9fX - 1//Y2Nj/2NjY/9jY2P/Y2Nj/19fX/9fX1//X19f/1tbW/9bW1v/W1tb/1tbW/9XV1f/W1tb/1dXV/9XV - 1f/U1NT/09PT/9LS0v/S0tL/0dHR/9HR0f/R0dH/0NDQ/9DQ0P/Pz8//zs7O/83Nzf/MzMz/zMzM/8vL - y//Jycn/x8fH/8bGxv/ExMT/wcHB/7+/v/+9vb3/urq6/7e3t/+0tLT/r6+v/6ysrP+pqan/pqam/56e - nv+ioqL/uLi4/8LCwv/FxcX/xMTE/8TExP/AwMD/v7+//7+/v/+9vb3/yMjInwAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAADAAAADgAAACAAAAA6AAAAXAAAAH9qamrE2tra/+/v7//n5+f/39/f/9/f - 3//f39//3t7e/97e3v/e3t7/3t7e/97e3v/e3t7/3t7e/97e3v/d3d3/3d3d/93d3f/d3d3/3d3d/93d - 3f/c3Nz/3Nzc/9zc3P/c3Nz/3Nzc/9vb2//b29v/29vb/9vb2//b29v/2tra/9ra2v/a2tr/2dnZ/9nZ - 2f/Z2dn/2dnZ/9jY2P/Y2Nj/2NjY/9jY2P/Y2Nj/2NjY/9fX1//X19f/19fX/9fX1//X19f/19fX/9fX - 1//X19f/1tbW/9bW1v/W1tb/1dXV/9XV1f/V1dX/1dXV/9XV1f/V1dX/1NTU/9TU1P/T09P/0tLS/9LS - 0v/R0dH/0dHR/9DQ0P/Q0ND/z8/P/87Ozv/Ozs7/zc3N/8zMzP/Ly8v/ysrK/8nJyf/Hx8f/xcXF/8TE - xP/CwsL/v7+//76+vv+6urr/t7e3/7S0tP+ysrL/rq6u/6urq/+np6f/oqKi/5+fn/+fn5//t7e3/8XF - xf/ExMT/v7+//8DAwP+8vLz/v7+//7q6uv/BwcGl5eXlAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAADAAAADgAAACAAAAA6AAAAXAAAAH9ra2vE29vb/+7u7v/n5+f/3t7e/97e3v/e3t7/3t7e/97e - 3v/d3d3/3d3d/93d3f/e3t7/3d3d/93d3f/d3d3/3d3d/9zc3P/c3Nz/3Nzc/9zc3P/c3Nz/3Nzc/9zc - 3P/b29v/29vb/9vb2//b29v/2tra/9ra2v/Z2dn/2dnZ/9nZ2f/Y2Nj/2NjY/9jY2P/X19f/19fX/9fX - 1//X19f/19fX/9fX1//W1tb/1tbW/9bW1v/W1tb/1tbW/9bW1v/W1tb/1tbW/9bW1v/W1tb/1NTU/9TU - 1P/U1NT/1NTU/9TU1P/T09P/09PT/9PT0//T09P/09PT/9LS0v/S0tL/0dHR/9DQ0P/Q0ND/0NDQ/8/P - z//Ozs7/zc3N/83Nzf/MzMz/y8vL/8rKyv/Jycn/yMjI/8bGxv/ExMT/w8PD/8HBwf+/v7//vb29/7u7 - u/+4uLj/tbW1/7Kysv+urq7/qqqq/6ioqP+kpKT/n5+f/5ycnP+kpKT/u7u7/8LCwv+9vb3/urq6/729 - vf+5ubn/uLi4/8DAwKvi4uIDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADgAA - ACAAAAA6AAAAXAAAAH9tbW3E3Nzc/+7u7v/o6Oj/3d3d/93d3f/d3d3/3d3d/93d3f/d3d3/3d3d/93d - 3f/d3d3/3d3d/93d3f/d3d3/3Nzc/9zc3P/c3Nz/29vb/9vb2//b29v/29vb/9vb2//a2tr/2tra/9ra - 2v/Z2dn/2dnZ/9jY2P/Y2Nj/2NjY/9fX1//X19f/19fX/9bW1v/W1tb/1tbW/9bW1v/W1tb/1tbW/9XV - 1f/V1dX/1dXV/9TU1P/U1NT/1NTU/9TU1P/U1NT/1NTU/9TU1P/U1NT/09PT/9LS0v/S0tL/0tLS/9LS - 0v/S0tL/0dHR/9HR0f/R0dH/0NDQ/9DQ0P/Q0ND/z8/P/8/Pz//Ozs7/zs7O/83Nzf/Nzc3/zMzM/8vL - y//Kysr/ycnJ/8jIyP/Hx8f/xcXF/8TExP/CwsL/wMDA/76+vv+8vLz/ubm5/7i4uP+0tLT/s7Oz/7Cw - sP+rq6v/p6en/6SkpP+ioqL/n5+f/5qamv+wsLD/vr6+/7q6uv+4uLj/urq6/7i4uP+1tbX/vLy8seLi - 4gYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADgAAACAAAAA6AAAAXAAA - AH9ubm7E3d3d/+7u7v/n5+f/3d3d/93d3f/d3d3/3d3d/93d3f/d3d3/3d3d/93d3f/d3d3/3d3d/93d - 3f/c3Nz/3Nzc/9vb2//b29v/29vb/9ra2v/a2tr/2tra/9nZ2f/Z2dn/2NjY/9jY2P/Y2Nj/19fX/9fX - 1//X19f/1tbW/9bW1v/W1tb/1dXV/9XV1f/V1dX/1dXV/9XV1f/V1dX/1dXV/9TU1P/U1NT/1NTU/9PT - 0//T09P/09PT/9PT0//T09P/0tLS/9LS0v/S0tL/0dHR/9HR0f/R0dH/0dHR/9HR0f/Q0ND/0NDQ/9DQ - 0P/Pz8//z8/P/8/Pz//Ozs7/zs7O/83Nzf/Nzc3/zc3N/8vLy//Ly8v/ysrK/8nJyf/IyMj/x8fH/8XF - xf/ExMT/wsLC/8HBwf+/v7//vb29/7u7u/+5ubn/tra2/7S0tP+wsLD/r6+v/6ysrP+oqKj/paWl/6Ki - ov+fn5//nZ2d/56env+2trb/ubm5/7S0tP+4uLj/tra2/7Kysv+8vLy33d3dBgAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADQAAAB8AAAA4AAAAWAAAAHpxcXHA39/f/+3t - 7f/m5ub/3d3d/93d3f/d3d3/3Nzc/9zc3P/c3Nz/3Nzc/9zc3P/c3Nz/3Nzc/9vb2//b29v/2tra/9ra - 2v/a2tr/2dnZ/9jY2P/Y2Nj/2NjY/9fX1//X19f/1tbW/9bW1v/W1tb/1dXV/9XV1f/V1dX/1dXV/9TU - 1P/U1NT/1NTU/9PT0//T09P/09PT/9PT0//T09P/09PT/9PT0//T09P/09PT/9LS0v/S0tL/0tLS/9LS - 0v/R0dH/0dHR/9HR0f/R0dH/0NDQ/9DQ0P/Q0ND/0NDQ/8/Pz//Pz8//z8/P/8/Pz//Ozs7/zs7O/83N - zf/Nzc3/zMzM/8vLy//Ly8v/y8vL/8nJyf/IyMj/x8fH/8bGxv/FxcX/xMTE/8LCwv/BwcH/v7+//729 - vf+7u7v/ubm5/7e3t/+1tbX/srKy/7Gxsf+vr6//rKys/6enp/+lpaX/pKSk/5+fn/+ampr/mJiY/6io - qP+3t7f/tLS0/7S0tP+zs7P/rq6u/7m5ub3Z2dkJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAADAAAADAAAABwAAAA0AAAAUQAAAHB5eXm54eHh/+3t7f/k5OT/3Nzc/9zc - 3P/c3Nz/3Nzc/9zc3P/b29v/29vb/9vb2//b29v/2tra/9ra2v/a2tr/2dnZ/9jY2P/Y2Nj/2NjY/9fX - 1//X19f/1tbW/9bW1v/V1dX/1dXV/9TU1P/U1NT/1NTU/9PT0//T09P/09PT/9LS0v/S0tL/0tLS/9LS - 0v/R0dH/0dHR/9HR0f/R0dH/0dHR/9HR0f/R0dH/0dHR/9DQ0P/Q0ND/0NDQ/9DQ0P/Pz8//z8/P/8/P - z//Pz8//zs7O/87Ozv/Ozs7/zs7O/83Nzf/Nzc3/zc3N/83Nzf/MzMz/y8vL/8vLy//Kysr/ycnJ/8nJ - yf/IyMj/yMjI/8bGxv/FxcX/xMTE/8PDw//CwsL/wMDA/76+vv+9vb3/u7u7/7q6uv+3t7f/tbW1/7S0 - tP+xsbH/r6+v/62trf+srKz/qKio/6SkpP+ioqL/oKCg/5qamv+ZmZn/nZ2d/6+vr/+0tLT/sbGx/7Ky - sv+vr6//urq6w9fX1wkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAACAAAACgAAABkAAAAsAAAARgAAAGGDg4Ou5OTk/+3t7f/k5OT/29vb/9vb2//b29v/29vb/9vb - 2//b29v/29vb/9vb2//a2tr/2dnZ/9nZ2f/Y2Nj/2NjY/9fX1//X19f/19fX/9bW1v/W1tb/1dXV/9XV - 1f/U1NT/1NTU/9PT0//T09P/0tLS/9LS0v/S0tL/0tLS/9HR0f/R0dH/0NDQ/9DQ0P/Q0ND/0NDQ/9DQ - 0P/Pz8//z8/P/8/Pz//Pz8//z8/P/8/Pz//Pz8//zs7O/87Ozv/Ozs7/zc3N/83Nzf/Nzc3/zMzM/8zM - zP/MzMz/y8vL/8vLy//Ly8v/y8vL/8vLy//Jycn/ycnJ/8jIyP/IyMj/x8fH/8bGxv/FxcX/xcXF/8PD - w//Dw8P/wsLC/8DAwP+/v7//vr6+/7y8vP+7u7v/ubm5/7e3t/+1tbX/s7Oz/7Gxsf+vr6//rKys/6qq - qv+lpaX/o6Oj/6Ghof+fn5//m5ub/5eXl/+dnZ3/qqqq/7Kysv+xsbH/rq6u/66urv+xsbHJ1NTUDAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAACAAA - ABMAAAAjAAAANwAAAEyVlZWg5ubm/+7u7v/i4uL/2tra/9ra2v/a2tr/2dnZ/9nZ2f/Z2dn/2dnZ/9nZ - 2f/X19f/19fX/9fX1//W1tb/1tbW/9bW1v/V1dX/1dXV/9TU1P/U1NT/1NTU/9PT0//S0tL/0dHR/9HR - 0f/R0dH/0NDQ/9DQ0P/Q0ND/z8/P/87Ozv/Ozs7/zc3N/83Nzf/Ozs7/zc3N/83Nzf/Nzc3/zc3N/83N - zf/Nzc3/zc3N/8vLy//Ly8v/y8vL/8vLy//Ly8v/ysrK/8rKyv/Kysr/ysrK/8nJyf/Jycn/yMjI/8jI - yP/Hx8f/x8fH/8bGxv/Gxsb/xsbG/8XFxf/ExMT/w8PD/8PDw//CwsL/wsLC/8DAwP+/v7//vr6+/729 - vf+7u7v/urq6/7m5uf+4uLj/tLS0/7Kysv+ysrL/sbGx/66urv+qqqr/p6en/6enp/+lpaX/oqKi/52d - nf+cnJz/mJiY/5qamv+np6f/rq6u/7Kysv+urq7/qqqq/7a2tszV1dUPAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAABQAAAA0AAAAXAAAAJQAA - ADOurq6N6enp/+3t7f/k5OT/2NjY/9jY2P/Y2Nj/2NjY/9jY2P/Y2Nj/2NjY/9jY2P/X19f/19fX/9bW - 1v/W1tb/1dXV/9XV1f/U1NT/1NTU/9PT0//T09P/09PT/9LS0v/R0dH/0NDQ/9DQ0P/Pz8//z8/P/8/P - z//Ozs7/zs7O/83Nzf/MzMz/zMzM/8zMzP/Ly8v/y8vL/8vLy//Ly8v/y8vL/8vLy//Kysr/ysrK/8nJ - yf/Jycn/ycnJ/8nJyf/Jycn/ycnJ/8nJyf/Jycn/ycnJ/8nJyf/IyMj/yMjI/8fHx//Gxsb/xsbG/8XF - xf/Dw8P/w8PD/8LCwv/CwsL/wcHB/8DAwP/AwMD/wMDA/7y8vP+7u7v/urq6/7m5uf+3t7f/tra2/7S0 - tP+zs7P/sbGx/7CwsP+urq7/q6ur/6mpqf+np6f/paWl/6Kiov+fn5//n5+f/5mZmf+ampr/mZmZ/52d - nf+srKz/sLCw/6mpqf+pqan/vb29z+Hh4RIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAOAAAAFgAAAB/Hx8d/6urq/+rq - 6v/l5eX/19fX/9fX1//X19f/19fX/9fX1//X19f/1tbW/9bW1v/V1dX/1dXV/9XV1f/U1NT/09PT/9PT - 0//T09P/0tLS/9LS0v/R0dH/0dHR/9DQ0P/Pz8//zs7O/87Ozv/Nzc3/zc3N/83Nzf/MzMz/y8vL/8vL - y//Kysr/ysrK/8nJyf/Ly8v/y8vL/8vLy//Kysr/ysrK/8rKyv/Jycn/ycnJ/8nJyf/Jycn/ycnJ/8nJ - yf/IyMj/yMjI/8jIyP/Hx8f/x8fH/8bGxv/Gxsb/xcXF/8TExP/Dw8P/wsLC/8LCwv/CwsL/wcHB/8DA - wP+/v7//vr6+/729vf+9vb3/vLy8/7u7u/+6urr/uLi4/7e3t/+1tbX/s7Oz/7Kysv+xsbH/ra2t/62t - rf+rq6v/qKio/6enp/+np6f/paWl/6Ghof+goKD/l5eX/5mZmf+YmJj/oqKi/7Gxsf+urq7/r6+v/7Oz - s/zR0dGH8fHxCQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAQAAAAHAAAACwAAAA/g4OB07u7u/+vr6//r6+v/6Ojo/+jo - 6P/n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//o6Oj/5+fn/+fn5//m5ub/5ubm/+Xl5f/l5eX/5OTk/+Tk - 5P/k5OT/4+Pj/+Li4v/h4eH/4eHh/+Dg4P/g4OD/4ODg/+Dg4P/f39//3t7e/97e3v/d3d3/3d3d/9zc - 3P/a2tr/2tra/9ra2v/a2tr/2dnZ/9nZ2f/Y2Nj/2NjY/9fX1//X19f/1tbW/9XV1f/U1NT/09PT/9PT - 0//S0tL/0NDQ/8/Pz//Ozs7/zc3N/8zMzP/Kysr/ysrK/8nJyf/Hx8f/xsbG/8XFxf/ExMT/wsLC/8HB - wf+/v7//v7+//76+vv+9vb3/u7u7/7m5uf+4uLj/tra2/7W1tf+0tLT/sLCw/6+vr/+tra3/q6ur/6io - qP+mpqb/o6Oj/6CgoP+goKD/nZ2d/5+fn/+srKz/srKy/7Gxsf+4uLj8v7+/qPDw8DMAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAQAAAAEAAAACAAAABAAAAAXw8PBt7u7u/+np6f/q6ur/7e3t/+3t7f/s7Oz/7Ozs/+zs - 7P/s7Oz/7Ozs/+zs7P/r6+v/6+vr/+vr6//q6ur/6urq/+np6f/p6en/6enp/+jo6P/o6Oj/6Ojo/+fn - 5//m5ub/5ubm/+Xl5f/l5eX/5eXl/+Xl5f/l5eX/5OTk/+Tk5P/j4+P/4+Pj/+Pj4//h4eH/4eHh/+Hh - 4f/g4OD/4ODg/9/f3//f39//39/f/9ra2v/a2tr/2dnZ/9jY2P/X19f/1tbW/9XV1f/V1dX/0tLS/9LS - 0v/R0dH/z8/P/87Ozv/Nzc3/zMzM/8vLy//IyMj/yMjI/8fHx//FxcX/xMTE/8LCwv/BwcH/wcHB/76+ - vv+9vb3/u7u7/7q6uv+5ubn/t7e3/7a2tv+1tbX/sbGx/6+vr/+tra3/ra2t/6qqqv+mpqb/pqam/6io - qP+ioqL/qKio/7a2tv+2trb/zc3N2PPz84H5+fkYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAD8/Pxp8/Pz/+zs7P/t7e3/7Ozs/+zs7P/s7Oz/7Ozs/+vr6//r6+v/6+vr/+vr - 6//q6ur/6urq/+rq6v/p6en/6enp/+np6f/o6Oj/6Ojo/+jo6P/o6Oj/6Ojo/+fn5//n5+f/5+fn/+bm - 5v/m5ub/5+fn/+bm5v/m5ub/5ubm/+bm5v/m5ub/5eXl/+Xl5f/k5OT/5OTk/+Tk5P/j4+P/4+Pj/+Pj - 4//i4uL/4uLi/+Pj4//j4+P/4uLi/+Li4v/i4uL/4eHh/+Hh4f/h4eH/4ODg/9/f3//f39//3t7e/9zc - 3P/b29v/29vb/9ra2v/b29v/29vb/9ra2v/a2tr/2dnZ/9nZ2f/Y2Nj/2NjY/9fX1//W1tb/1dXV/9TU - 1P/U1NT/09PT/9LS0v/R0dH/z8/P/8zMzP/Ly8v/zc3N/8zMzP/Kysr/zs7O89TU1Mzm5ua98vLylvf3 - 91f8/PwYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAD///////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////+AAAAAAAAAAAAAAAAAAAAAH/////////8AAAAAAA - AAAAAAAAAAAAAAD/////////4AAAAAAAAAAAAAAAAAAAAAD/////////4AAAAAAAAAAAAAAAAAAAAAD/ - ////////4AAAAAAAAAAAAAAAAAAAAAAf////////4AAAAAAAAAAAAAAAAAAAAAAf////////4AAAAAAA - AAAAAAAAAAAAAAAf////////4AAAAAAAAAAAAAAAAAAAAAAf////////4AAAAAAAAAAAAAAAAAAAAAAf - ////////4AAAAAAAAAAAAAAAAAAAAAAf////////4AAAAAAAAAAAAAAAAAAAAAAf////////4AAAAAAA - AAAAAAAAAAAAAAAf////////4AAAAAAAAAAAAAAAAAAAAAAf////////4AAAAAAAAAAAAAAAAAAAAAAf - ////////4AAAAAAAAAAAAAAAAAAAAAAf////////4AAAAAAAAAAAAAAAAAAAAAAf////////4AAAAAAA - AAAAAAAAAAAAAAAf////////4AAAAAAAAAAAAAAAAAAAAAAf////////4AAAAAAAAAAAAAAAAAAAAAAP - ////////4AAAAAAAAAAAAAAAAAAAAAAP////////4AAAAAAAAAAAAAAAAAAAAAAP////////4AAAAAAA - AAAAAAAAAAAAAAAP////////4AAAAAAAAAAAAAAAAAAAAAAP////////4AAAAAAAAAAAAAAAAAAAAAAP - ////////4AAAAAAAAAAAAAAAAAAAAAAP////////4AAAAAAAAAAAAAAAAAAAAAAP////////4AAAAAAA - AAAAAAAAAAAAAAAP////////4AAAAAAAAAAAAAAAAAAAAAAP////////4AAAAAAAAAAAAAAAAAAAAAAP - ////////4AAAAAAAAAAAAAAAAAAAAAAP////////gAAAAAAAAAAAAAAAAAAAAAAP////////AAAAAAAA - AAAAAAAAAAAAAAAP///////+AAAAAAAAAAAAAAAAAAAAAAAP///////8AAAAAAAAAAAAAAAAAAAAAAAP - ///////4AAAAAAAAAAAAAAAAAAAAAAAP///////4AAAAAAAAAAAAAAAAAAAAAAAP///////wAAAAAAAA - AAAAAAAAAAAAAAAP///////gAAAAAAAAAAAAAAAAAAAAAAAP///////gAAAAAAAAAAAAAAAAAAAAAAAP - ///////gAAAAAAAAAAAAAAAAAAAAAAAP///////gAAAAAAAAAAAAAAAAAAAAAAAP///////gAAAAAAAA - AAAAAAAAAAAAAAAP///////gAAAAAAAAAAAAAAAAAAAAAAAP///////gAAAAAAAAAAAAAAAAAAAAAAAP - ///////gAAAAAAAAAAAAAAAAAAAAAAAP///////gAAAAAAAAAAAAAAAAAAAAAAAP///////gAAAAAAAA - AAAAAAAAAAAAAAAP///////gAAAAAAAAAAAAAAAAAAAAAAAP///////gAAAAAAAAAAAAAAAAAAAAAAAP - ///////gAAAAAAAAAAAAAAAAAAAAAAAP///////gAAAAAAAAAAAAAAAAAAAAAAAP///////wAAAAAAAA - AAAAAAAAAAAAAAAP///////wAAAAAAAAAAAAAAAAAAAAAAAP///////wAAAAAAAAAAAAAAAAAAAAAAAP - ///////wAAAAAAAAAAAAAAAAAAAAAAAP///////wAAAAAAAAAAAAAAAAAAAAAAAP///////wAAAAAAAA - AAAAAAAAAAAAAAAP///////wAAAAAAAAAAAAAAAAAAAAAAAP//////8AAAAAAAAAAAAAAAAAAAAAAAAP - /////+AAAAAAAAAAAAAAAAAAAAAAAAAP/////AAAAAAAAAAAAAAAAAAAAAAAAAAP////4AAAAAAAAAAA - AAAAAAAAAAAAAAAP////AAAAAAAAAAAAAAAAAAAAAAAAAAAP///+AAAAAAAAAAAAAAAAAAAAAAAAAAAP - ///8AAAAAAAAAAAAAAAAAAAAAAAAAAAP///4AAAAAAAAAAAAAAAAAAAAAAAAAAAP///wAAAAAAAAAAAA - AAAAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAP///gAAAAAAAAAAAAAAAAAAAAAAAAAAAP - ///gAAAAAAAAAAAAAAAAAAAAAAAAAAAP///AAAAAAAAAAAAAAAAAAAAAAAAAAAAP///AAAAAAAAAAAAA - AAAAAAAAAAAAAAAP///AAAAAAAAAAAAAAAAAAAAAAAAAAAAP///AAAAAAAAAAAAAAAAAAAAAAAAAAAAP - ///gAAAAAAAAAAAAAAAAAAAAAAAAAAAP///gAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wAAAAAAAAAAAA - AAAAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAP///8AAAAAAAAAAAAAAAAAAAAAAAAAAAP - ///+AAAAAAAAAAAAAAAAAAAAAAAAAAAP////wAAAAAAAAAAAAAAAAAAAAAAAAAAP/////gAAAAAAAAAA - AAAAAAAAAAAAAAAP//////AAAAAAAAAAAAAAAAAAAAAAAAAP//////8AAAAAAAAAAAAAAAAAAAAAAAAP - ///////wAAAAAAAAAAAAAAAAAAAAAAAP///////wAAAAAAAAAAAAAAAAAAAAAAAP///////wAAAAAAAA - AAAAAAAAAAAAAAAP///////wAAAAAAAAAAAAAAAAAAAAAAAP///////wAAAAAAAAAAAAAAAAAAAAAAAP - ///////wAAAAAAAAAAAAAAAAAAAAAAAP///////wAAAAAAAAAAAAAAAAAAAAAAAP///////wAAAAAAAA - AAAAAAAAAAAAAAAP///////wAAAAAAAAAAAAAAAAAAAAAAAP///////gAAAAAAAAAAAAAAAAAAAAAAAP - ///////gAAAAAAAAAAAAAAAAAAAAAAAOA//////gAAAAAAAAAAAAAAAAAAAAAAAIAf/////gAAAAAAAA - AAAAAAAAAAAAAAAAAH/////gAAAAAAAAAAAAAAAAAAAAAAAAAH/////gAAAAAAAAAAAAAAAAAAAAAAAA - AD/////gAAAAAAAAAAAAAAAAAAAAAAAAAD/////gAAAAAAAAAAAAAAAAAAAAAAAAAB/////gAAAAAAAA - AAAAAAAAAAAAAAAAAB/////gAAAAAAAAAAAAAAAAAAAAAAAAAB/////gAAAAAAAAAAAAAAAAAAAAAAAA - AB/////gAAAAAAAAAAAAAAAAAAAAAAAAAB/////gAAAAAAAAAAAAAAAAAAAAAAAAAD/////wAAAAAAAA - AAAAAAAAAAAAAAAAAD/////wAAAAAAAAAAAAAAAAAAAAAAAAAD/////wAAAAAAAAAAAAAAAAAAAAAAAA - AH/////4AAAAAAAAAAAAAAAAAAAAAAAAAP////4AAAAAAAAAAAAAAAAAAAAAAAAAAf////gAAAAAAAAA - AAAAAAAAAAAAAAAAAf////AAAAAAAAAAAAAAAAAAAAAAAAAAA////+AAAAAAAAAAAAAAAAAAAAAAAAAA - B////8AAAAAAAAAAAAAAAAAAAAAAAAAAD////4AAAAAAAAAAAAAAAAAAAAAAAAAAH////4AAAAAAAAAA - AAAAAAAAAAAAAAAAP////4AAAAAAAAAAAAAAAAAAAAAAAAAAf////wAAAAAAAAAAAAAAAAAAAAAAAAAA - /////wAAAAAAAAAAAAAAAAAAAAAAAAAB/////wAAAAAAAAAAAAAAAAAAAAAAAAAD/////wAAAAAAAAAA - AAAAAAAAAAAAAAAD/////wAAAAAAAAAAAAAAAAAAAAAAAAAD/////wAAAAAAAAAAAAAAAAAAAAAAAAAD - /////wAAAAAAAAAAAAAAAAAAAAAAAAAB/////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////wAAAAAAAAAA - AAAAAAAAAAAAAAAAf////wAAAAAAAAAAAAAAAAAAAAAAAAAAP////wAAAAAAAAAAAAAAAAAAAAAAAAAA - H////wAAAAAAAAAAAAAAAAAAAAAAAAAAD////wAAAAAAAAAAAAAAAAAAAAAAAAAAB////wAAAAAAAAAA - AAAAAAAAAAAAAAAAA////wAAAAAAAAAAAAAAAAAAAAAAAAAAAf///wAAAAAAAAAAAAAAAAAAAAAAAAAA - AP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAH///wAAAAAAAAAAAAAAAAAAAAAAAAAAAH///wAAAAAAAAAA - AAAAAAAAAAAAAAAAAD///wAAAAAAAAAAAAAAAAAAAAAAAAAAAB///wAAAAAAAAAAAAAAAAAAAAAAAAAA - AB///wAAAAAAAAAAAAAAAAAAAAAAAAAAAB///wAAAAAAAAAAAAAAAAAAAAAAAAAAAB///wAAAAAAAAAA - AAAAAAAAAAAAAAAAAB///wAAAAAAAAAAAAAAAAAAAAAAAAAAAB///wAAAAAAAAAAAAAAAAAAAAAAAAAA - AB///4AAAAAAAAAAAAAAAAAAAAAAAAAAAD///4AAAAAAAAAAAAAAAAAAAAAAAAAAAD///4AAAAAAAAAA - AAAAAAAAAAAAAEAAAH///4AAAAAAAAAAAAAAAAAAAAAAAPgAAP///4AAAAAAAAAAAAAAAAAAAAAAAf4A - AP///4AAAAAAAAAAAAAAAAAAAAAAA//AAf///8AAAAAAAAAAAAAAAAAAAAAAB//wB////8AAAAAAAAAA - AAAAAAAAAAAAD///P////+AAAAAAAAAAAAAAAAAAAAAAH/////////AAAAAAAAAAAAAAAAAAAAAAP/// - //////gAAAAAAAAAAAAAAAAAAAAAf/////////wAAAAAAAAAAAAAAAAAAAAA//////////8AAAAAAAAA - AAAAAAAAAAAB////////////4AAAAAAAAAAAAAAAAAAD////////////8AAAAAAAAAAAAAAAAAAH//// - ////////8AAAAAAAAAAAAAAAAAAP////////////8AAAAAAAAAAAAAAAAAAf////////////8AAAAAAA - AAAAAAAAAAA/////////////8AAAAAAAAAAAAAAAAAB/////////////8AAAAAAAAAAAAAAAAAD///// - ////////8AAAAAAAAAAAAAAAAAD/////////////8AAAAAAAAAAAAAAAAAH/////////////8AAAAAAA - AAAAAAAAAAP/////////////8AAAAAAAAAAAAAAAAAf/////////////8AAAAAAAAAAAAAAAAA////// - ////////8AAAAAAAAAAAAAAAAB//////////////8AAAAAAAAAAAAAAAAD//////////////8AAAAAAA - AAAAAAAAAH//////////////8AAAAAAAAAAAAAAAAP//////////////8AAAAAAAAAAAAAAAAf////// - ////////8AAAAAAAAAAAAAAAA///////////////8AAAAAAAAAAAAAAAB///////////////8AAAAAAA - AAAAAAAAD///////////////8AAAAAAAAAAAAAAAH///////////////+AAAAAAAAAAAAAAAP/////// - ////////+AAAAAAAAAAAAAAA////////////////+AAAAAAAAAAAAAAD////////////////+AAAAAAA - AAAAAAA///////////////////////////////////////////////////////////////////////// - //8oAAAAEAAAACAAAAABACAAAAAAAAAEAAAjLgAAIy4AAAAAAAAAAAAAAAAAAAAAAAAsLAxlKioLhyoq - C4ctMhSJOE0zkjxXP5Y8Vz+WPFY+ljdMMZI7VTyVPFY+lkFjS3h///8bf///BwAAAAAAAAAAODgXgv// - ////////+f///8r7/v+66/7/vOb+/7rq/f/b8Pv/t+38/7zn/P97ssbPhvH/cH///xAAAAAAAAAAAElJ - Jnv///////////j+/v/J9/3/54j9//lN/f/NtP3/r+H8/8m4+//4Tv3/v0TS0Yzl/3R///8RAAAAAAAA - AABUVC93/////8zMu//Hzb3/suzi/7qx6//7K/7/+i7+/+tg/P/6Lv3/+yv+/56S2dN///93f///EAAA - AAAAAAAAWFgzdv///v/t7dz/6u3d/8zy5v+q3fX/5y////kH///4Df///gH//+cv//+LxuLbf///S3// - /wYAAKiNAACk/wAAov8AAKD/AACe/x06s/9YseD/fZbp/95C///JNv//7RL//+0S///eQv//mLXp4X// - /7F///86AACu/wAArv8AALH/AACx/wAAsP9XruX/aHHg/8AP7f+6TP//oV7//61S//+nWP//x0D//+Ub - 6eGls/+hf///rgAAtf8AALn/4eH//5KS5/9MTNH/Ybzs/7UD6f+7Eez/2Uv//9lM//+Ucf//2Uz//9lM - ///jIOje/QP/tX///7QAAL7/AADH/1FR3v/d3f3/oqLw/5bs/P+h+P//fNPz/1u25//Wg/L/8zn2/9SC - 8f+g/Pj/e+bf0X///6x///+rAADG/wAA0v8AANX/Z2fo/2Fh5f/Fyff/QkbX/wYNv/85c9X/tK7h/+1G - 7P+2sOP/v/jv/299WnR///8If///CAAAzf8AANr/AADe/y0t5f/T0/r/ZGTn/wAAz/8BA8T/Hj3J/6vw - 8//3TPL/qe7w/9b16P9xdU1uAAAAAAAAAAAAANH/AADg/wAA5v8FBej//v7//yAg4f8AANT/AADJ/wgR - wf+k9/H/offx/6P28P/q8+P/dHRMawAAAAAAAAAAAADV/wAA4/8AAOr/AADs/wAA5/8AAN//AADW/wAA - y/8AAMH/5ubV/6Skk/+kpJP/pKST/0lJJXwAAAAAAAAAAAAAzo0AANj/AADb/wAA3P8AANn/AADV/wAA - 0P8AAMr/fn7N/+Xl1P+2tqX//////3p6UWh6elElAAAAAAAAAAAAAAAAAAAAAH19U2f8/PX/+fnv//b2 - 6v/09OX/8/Pi//Ly4f/y8uH/wsKx/319U2d9fVMlAAAAAAAAAAAAAAAAAAAAAAAAAAB/f1VNf39VZn9/ - VWZ/f1Vmf39VZn9/VWZ/f1Vmf39VZn9/VWZ/f1UkAAAAAAAAAAAAAAAAAAAAAOAH///AA+AH4APAA+AD - 4APgA+ADAAHgAwAAAAEAAAAAAAAAAAAHAAAABwAHAAcABwAHAAcADwAH4B8AD///4B8oAAAAIAAAAEAA - AAABACAAAAAAAAAQAAAjLgAAIy4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAADAAA - AAwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAMAAAADAAA - AAwAAAAMAAAADAAAAAwAAAAMAAAACwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AC0AAACMAAAAkgAAAJIAAACSAAAAkgAAAJIAAACSAAAAkgAAAJIAAACSAAAAkgAAAJIAAACSAAAAkgAA - AJIAAACSAAAAkgAAAJIAAACSAAAAkgAAAJIAAACKAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAPMzMzPna2tr/29vb/93d3f/e3t7/39/f/9/f3//U1NT/zMzM/9vb2//j4+P/4+Pj/+Li - 4v/h4eH/4ODg/97e3v/d3d3/3Nzc/9zc3P/b29v/2dnZ/9TU1P/CwsKUAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAA81NTU+efn5//q6ur/6+vr/+zs7P/t7e3/5+fn/6ysxP96d8n/urnE/+Tk - 5P/s7Oz/7Ozs/+vr6//q6ur/6Ojo/+fn5//m5ub/5OTk/+Li4v/f39//2dnZ/8bGxpcAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADzX19f56+vr/+3t7f/u7u7/7+/v//Hx8f/r7Ov/enrm/0hF - 6f9dWen/w8TP/+zs7P/w8PD/7+/v/+7u7v/t7e3/6+vr/+rq6v/o6Oj/5ubm/+Pj4//c3Nz/ysrKmAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPNnZ2fnt7e3/8PDw//Hx8f/z8/P/9PT0//Pz - 8v+IhvP/VlTc/1xZ2/9tat3/2tra/+/v7//y8vL/8vLy//Dw8P/v7+//7e3t/+rq6v/n5+f/5OTk/97e - 3v/MzMyaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJmZmQOfn5+KxMTE/Ofn5//z8/P/9PT0//X1 - 9f/29vb/9vb2/+zs9f94dvX/QD3t/0xH9/+JiLn/xcXF/93d3f/o6Oj/7e3t/+zs7P/h4eH/0dDQ/8HB - wf/BwMD/0tLS/83NzZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9PT0Vv77+v78+/v/yMjI//Pz - 8//29vb/9/f3//j4+P/5+fn/+fn5//j4+P+8vPf/YmD0/1BL6f9ubb7/oKG1/7W1tf+2trb/tLS0/5iX - ov9vb7X/XFrM/15cyv+6usf/zc3NnQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD9/f1+/7+w//+q - lf/t7e3/09PT//j4+P/19fX/4+Pj/9nZ2f/V1dX/+fn5//r6+v/l5fD/XFf0/1RO8v9PSfX/V1Pn/1ZU - zf9UUcj/SUXv/0ZE8/9RUen/U073/7u73v/Ozs6fAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP39 - /W7/zcD//zwL///j3f/W1tb/3d3d/+fn5//7+/v///j2/+fn5//s7Oz/+/v7//n5+P+dnO7/X1vs/8XF - zf+Egsv/RUD5/3t49f9/fff/iIX1/5uW9f/Lyuz/4eHh/8/Pz6EAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AACXl5cD8vLyaP/c1P//MwD//2U////9/f//9/X//7Sh//9kPv//ppD/9/f3//X19f/8/Pz/+/v7/+Tk - 7/9YU/X/bm6+/1BM7/+qqPP/9PT0//X09P/y8fL/7+/v/+rq6v/h4eH/zs7OowAAAAAAAAAAAAAAAJSU - lAKysrJKycnJmNjY2M3s7Ozy/+vn//8zAP//MwD//2pE//8/D///MwD//5B0//39/f/39/f//Pz8//z8 - /P/8/Pz/+Pj3/4mJ6/9CPPj/kpDt//X29f/29vb/9PT0//Ly8v/v7+//6urq/+Dg4P/Ozs6kAAAAAAAA - AAAAAAAA8fHxWP39/f3/7+v//8O1//+Xff//aUT//zMA//8zAP//MwD//zMA//+AYP/9/Pz/9vb2//v7 - +//8/Pz//Pz8//z8/P/5+fn/srHa/0pF+P/MzN//9/f3//b29v/09PT/8PDw/+3t7f/p6en/39/f/87O - zqYAAAAAAAAAAAAAAAD+/v6O/9rR//9tSf//QRL//zMA//8zAP//MwD//zMA//8zAP//NgT//9/Y/+fn - 5//b29v/+vr6//v7+//7+/v/+/v7//b29v+dnNf/Qj73/6Oh5P/19PX/9fX1//Ly8v/v7+//7Ozs/+jo - 6P/f39//zc3NqAAAAAAAAAAAAAAAAP7+/h////+q////6P/+/v//4Nj//6yY//8zAP//MwD//zMA//8z - AP//TiL//+vm/9nZ2f/f39//+fn5//r6+v/5+fn/8fLx/4WD4P9FQvT/gX/r//Hx8f/x8fH/7e3t/+7u - 7v/q6ur/5ubm/97e3v/MzMypAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////IP7+/on/5uD//zMA//81 - A///sJ3//4Bh//88C///Vy3///Hu/9HR0f/u7u7/+Pj4//f39//x8fH/fXvl/0lH6P9vbO3/7Ozs/+Tk - 5P/R0dH/1tbW/+jo6P/k5OT/29vb/8rKyqoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/Pz8ZP/X - zf//MwD//5R5//v7+//9/f3///Tx//+umf//qpX/9PT0/+jo6P/29vb/9vb2//Hx8f+Hher/R0Xo/3Vz - 8P/09PP//9/////u///Nzc3/3t7e/+Hh4f/X19f/xcXFrJqamgqYmJgFAAAAAAAAAAAAAAAAAAAAAAAA - AAD8/Px1/8i6//9WLP/++ff/7Ozs//Ly8v/19fX/+vr6//39/f/29vb/8/Pz//T09P/z8/P/8fHw/7y7 - 8f9kYvT/wsLs//X09P//tP///1z///n5+f/CwsL/3Nzc/8nJyf/Ozs7q3Nzc5rm5ubmZmZkKAAAAAAAA - AAAAAAAAAAAAAPz8/ID/0MT//9fN//Dw8P/v7+//8PDw//Dw8P/w8PD/8PDw//Dw8P/w8PD/8PDw/+/v - 7//u7u7/7e3t/+3s7P/q6uv/8fHx///H////AP///6///+jo6P/e3t7/+Pj4///k////vP//8fHx+5yc - nCsAAAAAAAAAAAAAAAYAAAA9TExMht/f3/He3t7+srKy/7Ozs/+zs7P/srKy/7Kysv+zs7P/s7Oz/7Ky - sv+ysrL/sbGx/7Gxsf+6urr/2tra/9vb2//f39///9r///8A////F////+f///+w////TP///xD////K - ///09PS/mJiYBQAAAAAAAAAAAAAANw8OMb0uLHnqNTOA7UtKkf1OTZT/Tk6V/05Nlf9OTZT/Tk2U/05N - lP9OTZT/Tk2U/05NlP9OTZT/U1KU/6qqtP/a2tr/7+/v//39/f//3////wD///8A////Bv///wD///8G - ////u///+fn51NfX1xQAAAAAAAAAAAAAAAAPEBZcJyWm+js5t/87OLf/Ojeq/zo4tf87Obj/Ozi1/zk2 - pf85NqX/Oziz/zw4tP86N6v/Ozm4/zw5uP+dnNr//+b///+X////YP///yj///8B////AP///wD///8A - ////Av///6r///Ly8vXNzc0mAAAAAAAAAAAAAAAAAAAAASEhO2gQDbb/EA+2/xAOtf9eX4b/GBas/xEP - tv8dGqr/dHSB/3R1iv9RUX7/Hx2g/1JSiP8RDrX/EA+2/39/2P//6v///53///9m////Lv///wP///8A - ////AP///wD///8B////pP//8fHx/aysrJaXl5cFAAAAAAAAAAAAAAABIiNBah4cy/8kI83/IyLM/4mI - rv9ZWZ3/QUCh/zEvvv+EhLH/NDLR/4KBtf9IR7L/g4Kk/zw6oP8qKbv/JybO/29v4P+op+n/9fX1//7+ - /v//4v///wD///8A////CP///wD///8E////tf//7Ozs/Kenp4eYmJgCAAAAAAAAAAEjI0lrNDLg/0NB - 4/9CQOP/sLHV/4uK3f+4t9f/ZmTL/6qq1v9AQN3/nJvO/29u2P/Cwdf/oKDc/19f4P9DQeP/Q0Hj/z4+ - 1v/Pz8//39/f///a////AP///xn////q////tv///1P///8P////w///4eHh95ycnCoAAAAAAAAAADIz - ZldNTPH/ZmXz/2Vl8//Pz/H/qqnK/9fY5/+KiPD/3d7q/6ipx//T1e//f33w/9ra5/+lpcb/hoXU/2Rl - 8/9lZfP/UVHm/8/Pz//d3d3//8f///8A////sv//7u7u/+fn5+f////q/+n////A///19fXpmpqaFQAA - AAAAAAAAREhlElBP9+mMjPv/jY38/6Sk/P+rq/z/oKD7/5KS/P+qqvz/qqr9/5eX/P+Skvv/q6r8/6ur - /P+dnvz/jY37/4eH+/9oaOv/0NDQ/+Hh4f//tP///17///r6+v/MzMzpvr6+J/7+/gX+/v5S////kfj4 - +DcAAAAAAAAAAAAAAAAAAAAAR0L0K0A9+4M6OdOhhITq+oyM8P+Li+//i4vv/4uL7/+Kiu7/ioru/4mJ - 7f+IiOz/h4fr/4eH6/+Ghur/h4bm/8nJ1f/MzMz/29vb///f////7///29vb7sjIyC8AAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADbT09P14ODg/9/f3//f39//3t7e/93d - 3f/c3Nz/29vb/9nZ2f/Y2Nj/19fX/9XV1f/S0tL/zs7O/8PDw/+0tLT/5+fn/97e3vHHx8c2AAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANtLS0vXe3t7/3d3d/9zc - 3P/b29v/2dnZ/9jY2P/X19f/1tbW/9TU1P/S0tL/z8/P/8vLy//CwsL/s7Oz/6urq//AwMDzwcHBOwAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAp1dXV8dra - 2v/Y2Nj/1tbW/9PT0//R0dH/z8/P/87Ozv/Nzc3/y8vL/8jIyP/Dw8P/u7u7/7CwsP+hoaH/q6ur9bOz - s0EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAPn5+ea5eXlquPj46rg4OCq3t7eqtvb26rZ2dmq19fXqtPT06rNzc2qyMjIqsLCwqq5ubmqr6+vqK+v - r4e4uLgmAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/////8AAAP/AAAB/wA - AAf8AAAH/AAAB/gAAAf4AAAH+AAAB/gAAAf4AAAHwAAAB4AAAAcAAAAHgAAAB/AAAAf4AAAH+AAAAfAA - AAHwAAAB4AAAA+AAAAfgAAAD4AAAAeAAAAHgAAAB4AAAO/AAAH/8AAD//AAB//wAA//8AAf/KAAAADAA - AABgAAAAAQAgAAAAAAAAJAAAIy4AACMuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAADAwMDIQQEBDQEBAQ2BAQENgQEBDYEBAQ2BAQENgQEBDYEBAQ2BAQENgQE - BDYEBAQ2BAQENgQEBDYEBAQ2BAQENgQEBDYEBAQ2BAQENgQEBDYEBAQ2BAQENgQEBDYEBAQ2BAQENgQE - BDYEBAQ2BAQENgQEBDYEBAQ2BAQENgQEBDYEBAQ2BQUFLgAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAgICbQAAAKsAAACxAAAAsQAAALEAAACxAAAAsQAA - ALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAA - ALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAsQAAALEAAACxAAAAmAAAAEAAAAACAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMFRUVgKGhofSpqan1qqqq9aqq - qvWrq6v1rKys9aysrPWtra31rq6u9a2trfWurq71qqqq9aqqqvWxsbH1tbW19bW1tfW0tLT1tLS09bS0 - tPWzs7P1s7Oz9bGxsfWxsbH1sbGx9bCwsPWurq71sLCw9bGxsfWwsLD1sLCw9a+vr/WsrKz1ra2t8JeX - l8w4ODgJ////AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALGBgYgdXV - 1f/o6Oj/6+vr/+rq6v/r6+v/7e3t/+7u7v/u7u7/7u7u/+7u7v/i4eH/yMjE/76+vf/P0M3/5eTm/+7t - 7f/u7u7/7+/v/+7u7v/s7Oz/7Ozs/+zs7P/q6ur/6enp/+jo6P/n5+f/5ubm/+Xl5f/k5OT/5OTk/+Li - 4v/e3t7+3d3d/8HBwexBQUEL////AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAALFxcXgdTU1P/p6en/6+vr/+3t7f/t7e3/7e3t/+7u7v/v7+//7+/v/+7u7v/Q0c7/a2nE/1BL - 3f+Jh8H/zs/I/+Hh4//t7u7/7+/v/+/v7//u7u7/7e3t/+3t7f/r6+v/6+vr/+rq6v/o6Oj/5+fn/+bm - 5v/m5ub/5OTk/+Pj4//d3d3+3Nzc/8LCwutHR0cM////AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAALFxcXgdbW1v/r6+v/7e3t/+7u7v/u7u7/7+/v//Dw8P/x8fH/8fHy//Dw - 8v++vtj/ODT3/0M9//9QSvP/rKy8/9jZ0v/r6+z/8fHx//Dw8P/v7+//8PDw/+/v7//u7u7/7e3t/+zs - 7P/r6+v/6enp/+np6f/n5+f/5eXl/+Xl5f/f39/+3t7e/8PDw+xHR0cM////AQAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALGBgYgdfX1//s7Oz/7+/v//Dw8P/w8PD/8vLy//Ly - 8v/z8/P/9PT0//Hx8//AwOj/PTr9/1JR2/9ZV9v/Tkjz/4mJyv/d3dr/8vHx//Pz8//y8vL/8fHx//Hx - 8f/w8PD/7+/v/+7u7v/t7e3/7Ozs/+vr6//p6en/6Ojo/+fn5//h4eH+4ODg/8bGxu5ISEgO////AQAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMFBQUft3d3f/v7+//8fHx//Ly - 8v/z8/P/9fX1//T09P/19fX/9/f3//X09v/k4/P/My/4/zQu/v9xcL7/Uk73/0dA/v+trcb/5+bp//Dw - 8P/09PT/8/Pz//T09P/z8/P/8vLy//Hx8f/v7+//7u7u/+3t7f/r6+v/6Ojo/+fn5//i4uL+4eHh/8jI - yO9GRkYO////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wEJCQkNMjIyksnJ - yf/u7u7/8vLy//T09P/09PT/9vb2//b29v/29vb/9/f3//b29v/6+vb/pKTz/zUx9P9FQuz/T07h/1FO - /f92dM3/zMzJ/9zd3v/r6+v/8vLz//Pz8//19fX/8/Pz//Ly8v/v7+//6+vr/+fn5//c3N3/09PU/9XV - 1v/X19f+4eHh/8rKyvFKSkoP////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AQAA - AADS0tKI3t7e+Nzc3P/Gxsb/8fHx//b29v/19fX/9/f3//f39//39/f/+Pj4//j4+P/4+Pj//Pv4/9/e - +P96ePf/Ojb4/0NA9v9UT+v/hYSa/6Wmo/++vrr/y8zM/9PT1f/c3N3/4uLj/+Pj4//W1tf/xcTC/7q6 - tf+rq6v/oaGn/5+gpv+5urj+2trb/8vKyvFISEgP////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAANTU1Bj9/f35/fn4/v/////i4uL/wMDA//n5+f/4+Pj/+fn5//j4+P/5+fn/+/v7//7+ - /v/9/v3/+vr6//n3/P////r/1tf4/3V09P9QTPn/OjT7/0ZD2/+Bgb7/ra6s/7S1qP+wsKb/qqqm/6mp - qP+enpT/c3SV/1pYsv8/O+T/Ozjx/zk28P97es7+2drW/8vMzPRLS0sR////AgAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAD///8BAAAAAPDw8DP+/f3//25K///Iuv/8/Pv/sLCw/9nZ2f/6+vr/+fn5//n5 - +f/9/f3/9/f3/+np6f/p6en//f79//z7+//5+fr////7////8P9vbfD/UEj9/z85/v8+N/r/UE/l/2pn - 1P93ea//goGN/4mLif9dWrX/OjT1/0hD//9ZV/f/VVPw/0VB+v9lZOv+5ufa/8rKzfNLS0sR////AgAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8BAAAAAOTk5Cf8+/v9/2ZA//8xEP//4dr/8fHx/7q6 - uv/n5+f/8PDw/+bm5v/f3t7/4+Li/+Xl5f/V1dX/ycnJ//j4+P/8/Pz/+/v8//n7+f+1tO7/UEr5/1BK - 9f+QjuL/enbz/2Bb8f9MR/T/NTD0/zo28v9DP/r/S0b5/0E+9/9KR+//Ukzz/2pj+f+xsOn/5ubi/83N - zvZISEgS////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPT09Bj+/Pz2/4Fh/v8n - Af//f2L///////r5+f++vb3/3t3d//Lv7//////////////18//+/Pv/09PT/9vb2//9/f3//f39//z7 - /f/s7fL/XVzx/0xF//+cm9P/0tDH/729qP9KRub/Tk32/4iG8v+lo/b/oaD4/6Si9/+wrvX/zM3w/+3u - 7P/p6ef/5OTk/83NzfZJSUkT////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf///wH///8C////Af// - /wn//v3w/49y/v8mAP//PxP///b0///////6+Pf/////////////5uD//4Jl//9DGv//7en/6Obm/+rq - 6v/+/v7//f39//39/f/8/Pf/lJPp/05J9/9ua9T/qaud/11Y0v9LR/v/m5vz//f58v////X////1//z9 - 8//6+/D/9ffv/+3t7v/m5uf/4+Pj/83NzflMTEwU////AgAAAAAAAAAAAAAAAAAAAAAAAAAAv7+/AqOj - ow6ampoqnp6eS6mpqWn59/b0/6OM/v8lAP//MgP//1w3///h2f//0MX//5N6//9lSP//OA3//1g+///O - wf/9/Pz/8fHx//z8/P/9/f3//f39//z8/P/7/Pz/5uXq/25t7v9NSOv/SETf/0dC/P+sqvH/+/v4//j4 - 9//19fb/9PT1//Py8//x8PL/7+/w/+3t7f/n5+b/4uLi/83NzfpKSkoU////AgAAAAAAAAAAAAAAAP// - /wGcnJwnpqamrLm5udra2Nj49vPy/////////////8a3//8pAP//NAH//zEA//83BP//KgD//zEA//86 - CP//VjT////////+/v/29vb//v7+//39/f/+/v7//v7+//39/f/8/Pz//v73/7y84/9MRvf/Qj76/31+ - 6v/19fL/+fn5//n4+P/29vb/9fX1//Tz8//x8fH/7+/v/+zs7P/m5ub/4uLi/87OzvxNTU0V////AgAA - AAAAAAAAAAAAAAAAAADZ2dm1//79/////////////////f////7/4Nn//4tu//8uAP//MwH//zQA//8y - AP//NQL//zcE//8kAP//u6r////+//n4+P/5+fn//f39//z8/P/9/f3//f39//z8/P/8/Pz/+fn5/97f - 3f9WVPH/Q0D2/8HD1v/39/b/+fn4//j4+P/29vb/9fX1//Pz8//x8fH/7+/v/+zs7P/m5ub/4eHh/83N - zfxLS0sW////AgAAAAAAAAAAAAAAAPb29j/9+/v7/76t/f+chf7+eF/+/1k5//9IHv//Ngb//zAB//8z - AP//MwD//zMA//8zAP//MgH//z4W//+yn//9/Pv/39/f//Hx8f/9/f3//Pz8//z8/P/8/Pz//Pz8//z8 - /P/8/Pz/9fT3/+Hh0/9XVOf/SkX4/6qq2P/19fL/+Pj4//f39//19fX/9PT0//Ly8v/v7+//7e3t/+vr - 6//k5OT/4ODg/87Ozv5MTEwW////AgAAAAAAAAAAAAAAAP///0T//f39/72t/P+LcP7/WTH//zQB//8p - AP//KQD//zEA//8zAP//MwD//zMA//8zAP//MgH//z4U///Mvv/+/f3/xcXF/7e3t//6+vr/+/v7//z8 - /P/7+/v//Pz8//v7+//7+/z/7+/v/9DQy/8+OvP/SUT6/3Ft6f/w8Ov/9/f3//f39//09PT/8/Pz//Ly - 8v/v7+//7e3t/+vr6//k5OT/4ODg/87Ozv5LS0sX////AgAAAAAAAAAAAAAAAP///wb////f//////// - ////+fj+/9bM+/+rl/3/bkv//z0N//8yAP//MwD//zMA//81Av//NQH//y0A//84Df//6uT//////8DA - wP/a2tr//f39//v7+//7+/v/+/v7//r6+v/5+vr/7+7q/7q9y/9APPX/TEf7/1lU8P/n6On/9vb3//X1 - 9f/z8/P/8/Pz//Dw8P/u7u7/7Ozs/+rq6v/k5OT/4ODg/87Ozv9KSkoY////AgAAAAAAAAAAAAAAAAAA - AAD+/v4d//z8Wf/7+nL//v2h//79x//8/OL+/f39/7im//8qAP//NAH//zAA//9FGv//OAz//y8D//8x - AP//ZkT///Tx///+/v/Kysr/4eHh//v7+//6+vr/+vr6//n5+f/4+Pn/8PDm/6em0v89Ovb/SUb1/0ZB - +v/b2+b/8/P0/+fn5//X19f/29vb/+3t7f/s7Oz/6urq/+jo6P/i4uL/3t7e/83Nzf9MTEwZ////AgAA - AAAAAAAAAAAAAAAAAAD///8C////AQAAAAAAAAAAAAAAAAAAAAD59/fo/6WN/f8mAP//MwP//0IW///w - 7P//3tb//3hY//88D///JAD//1Uu///z7//7+vr/srKy/+Xl5f/6+vr/+Pj4//j4+P/39/j/8vPn/6el - 2P9APe3/TUrr/zs2/P/W1ej/5ubo/+3t7f/y7/L/v7+//7u7u//q6ur/6Ojo/+bm5v/g4OD/3Nzc/8zM - zP9QUFAZqqqqAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wH///8D////BNra2gf9+vru/5h9/v8k - AP//MAP//72s///////////////////p5P//gWP//yEA//9UKv//9/b/2NfX/9jY2P/5+fn/9/f3//f3 - 9//39/j/9PXo/6qq2v9BP+v/TErm/zcz/v/Z2er/+fn7/////////////v7+/7S0tP/a2tr/5ubm/+Xl - 5f/e3t7/2tra/8nJyf9LS0sbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAN3d - 3Rf8+/r2/4Rl//8lAP//dlj///////n49//z8vL/+/r6//38/P///v7//+fh///Asf//9/X/6ejo/+vr - 6//39/f/9fX1//X19f/19PX/9fbv/8nJ6P88OPb/R0Ty/1NQ9f/o6ez////////////+df7///////b1 - 9v/BwcH/5eXl/+Pj4//d3d3/09PT/8PDw/+MjIxUoaGhapCQkEulpaUJAAAAAAAAAAAAAAAAAAAAAAAA - AAB/f38BAAAAANbW1ib7+/v+/3FO//8fAP//4Nj//fv6/+Tl5f/09PT/8/Pz//Pz8//29fX//Pr6///8 - +//7+/v/8/Pz//X19f/19fX/9PT0//Pz8//z8/P/8PDx//j38f90cvb/g4L1/9rZ7v/v8O3///3///// - ////Jv///6z////////Z2dn/w8PD/+Xl5f/Ly8v/vLy8/8vKy//x7vH/+Pj4/9HR0f+VlZVaAAAAAAAA - AAAAAAAAAAAAAAAAAAD///8B////Af/6+jP9/f3//0oc//91Uf///v7/6eno/+3t7f/z8/P/8vLy//Ly - 8v/x8fH/8vLy//Pz8//y8vL/8/Pz//Ly8v/z8/P/8vLy//Hx8f/x8fH/8vLy/+/v8P/z9O7/9PXu//Hy - 7P/s7O3//vz+////////L////xn////p///29fb/qKio/7+/v//T0tP/9vP2///////////+/////f// - //63t7eaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAADVFRUTD4+Pj2/tHG//718v/y8fL/4eHi/+rq - 6v/o6On/6Ojp/+jo6f/o6Oj/6Ojp/+jo6f/o6Oj/6ejp/+jo6P/o6On/5+fo/+fn5//m5uf/5ubm/+fo - 5//r6uv/7Ozs/+zr7P/q6ur//Pj9////////Ov///wP///8q////6P//8fHx//Tz9P/+9f7//8D///+S - ///+Uv7//eD9/v7+/v7Pzs99AAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAsBAQEdQAAAIGDhH/B5+Tg9urp - 5f+qqqb/oqKe/6Ghnf+hop3/oKGc/6CgnP+goJz/oaGc/6ChnP+goZz/oaGd/6ChnP+foJv/n5+b/5+f - m/+fn5v/oKCc/6Skov/CwsL/3d3d/9bW1v/Gxsb/9O/0////////SP///wX///8C////ff///vb+//+p - ////LP///wD///8A////mP/+//////X19fS0tLQd////AgAAAAAAAAAAAAAAAAAAAAwBAQJuAgQAthAQ - GswODR7NKSk921ZWav1bW27/XV1w/11dcP9dXXD/XF1w/1xdcP9bXG//W1xv/1xcb/9cXG//XFxv/1xc - b/9cXG//XFxv/1tbb/9bXG//Wltu/2Zncf+ampn/wsHC/87Nzv/j3+P//ff9////////VP///wP///8B - ////F////yj///8A////AP///wD///8t////9P/++vn6+ry8vFH///8BAAAAAAAAAAAAAAAAAAAAAAAA - ACwQDjOxLyyd+EZFtP9PTbr/TUq2/01LuP9MS7f/TEq3/0xKtv9MSrb/TUu3/05LuP9OS7j/TUu4/01L - t/9NSrb/TUu3/01LuP9MS7b/TEq3/01Kt/9MSrb/m5rO/9va5f/29fb///7////0///+0/7//6z///+T - ////Kv///wH///8A////AP///wH///8C////Bv///3n////v//729fbauLi4MP///wEAAAAAAAAAAAAA - AAAAAAAAVVVVAwAAADQhH4XZLi2y/i0qs/8sKbL/LSqz/ycioP8nJKb/LCqz/ywqs/8sKrP/KCao/yMg - l/8iH5j/Ih+d/ycjrP8tKrX/KSWn/yMfmv8rKbD/LSm1/zAttP9IRr3///////z4/v/+gv7//zj///8V - ////AP///wD///8A////AP///wD///8A////AP///wH///8B////cP///////vz7/P++vr5g////An9/ - fwIAAAAAAAAAAAAAAAAAAAAAPz9/BAAAADQbGpDfDgqt/RAOsv8QDrL/DQqq/z4+eP8wLob/EAy0/xAO - sP8OC7H/KiiI/1NUaP9QT2X/SUhl/yoqa/8NCqT/LSuE/1NUaP8UEaP/EQ6v/xMRsv8zMb3///////v2 - ////P////wD///8A////AP///wD///8C////Af///wD///8A////AP///wL///8A////jv////////r5 - +v+lpaWyAAAAAP///wEAAAAAAAAAAAAAAAAAAAAAPz9/BAAAADUdG5vfFRO7/RYVwP8WFcD/Eg+9/3Jx - nP9QUJ7/Dg6z/xIQtv8UEcD/SEao/5qaj/9tbLP/c3K2/4uKl/88O5j/T02l/5uai/8bGbT/ExO8/xUV - wP8YF8D/np7n/+Hg+P/7+v7//u/+///Z////sP///4j///9o////Hf///wH///8A////AP///wD///8C - ////D////57////9///k5OT8oaGhq5SUlC0AAAAAAAAAAAAAAAAAAAAAPz9/BAAAADYjIqbhKCfQ/Sgn - 0v8pKNP/IyHP/4iHtv+WlaD/dXSM/2Rkiv8lJKr/XVzB/7y9r/80M8j/Hh7V/2Jhxf98fLP/Xly7/728 - r/9JSYr/RkWF/zEvpP8oJ9L/Hx7Q/yIh0P9LStv/p6Te//Xz7//8+f3/////////////W////wL///8B - ////BP///wD///8A////A////wD///9Z///+//7+7e3t/6KiouuYmJgm////AgAAAAAAAAAAPz9/BAAA - ADcoJrDhOTfb/Tc23f84Nt7/MTDZ/5qZyv/Ly9H/zs3Y/9vc1P9xcLT/aWfP/9TWyP9JSNb/MzLf/2ho - zf+Vls3/b23M/9XUyv/Pzsf/19fG/3t7yP80Mt7/Ojje/zg33v8nJdv/T06+/9vbyv/Y2Nr/+PT4///9 - ////Sv///wT///8D////Xv///8j///9h////Cv///wD///8A///+tv7//////uno6f+bm5t1AAAAAAAA - AAAAAAAASEhtAwAAADIwL7rgU1Ln/VBP7P9SUez/SEfn/7e44v+Zmdf/TU3B/5GQ0f+1teb/eXnf//T1 - 6f9YWMj/REO2/6ys0v+hoer/ionh//Hz6f9ubMz/amnJ/1hYzv9QT+n/UVDs/1FP7P9HR+3/XFvK/9vb - zP/Pz9D/9/P3////////Pf///wT///8V////2f///Pr8///9//7/4f/+/5///v9o//3/Qf///uf+//7+ - /v3FxMWaAAAAAAAAAAAAAAAAAAAAAgAAABQ9PcbXbm7y/Wpr9/9sbfb/Zmb0/83N9f/08/D/7Ozn//// - +P+vr/j/nZ3y////+//p6+f/+/vy//v9/v+Ih/b/qqrz/////P/q6+T/7e7j/9TW3/9rbO//bW32/2tr - 9/9fXvf/X1/Z/9/fzv/Nzc//+/f7////////Mf///wP////F///8+/z/zMzM/crKyv/29PbI//7///// - ////+//+//j/+//////Dw8NW////AQAAAAAAAAAAf39/AgAAAAA+Ps68i4z2/H5++/9+fvr/gH/8/7S0 - /v/Pz/7/0dD//8PD/P+MjPv/oJ7+/83N/P/R0f//ycn//6in/P9/f/z/o6T9/87O/P/Q0P//09L//8bF - //+Cgvz/f3/7/319+v9sbPv/cXDf/+Pj0v/Nzc7//vv+////////Kv///3r////////s6+z9wcHB/8zM - zJj///8F/v7+Uv/8/63//f/5/////+vr68fHx8cL////AQAAAAAAAAAAAAAAAKpUqgEzMsNMYF7+6W9v - +/56ev3+e3v+/3h4//93d/7/d3f+/3d3/v93d/7/eHf+/3h3/v93d/7/dnf+/3Z3//94eP7/eHf+/3h3 - /v93d/7/d3f+/3d3/f94eP7/eHj+/3Rz//9gX/L/ysvX/9bV1P/NzM3///7/////////Vv////z///z7 - /P3Qz9Dp0NDQUf///wH///8B////Af///wH+/P4d////JtTU1AMAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAD///8B39/fCMvL/zZkZKBGGRlUl6Ch3Pyur+v/rK3p/6us6P+rrOj/qqvn/6ur5/+qq+f/qarm/6ip - 5f+oqeX/p6jk/6eo5P+mpuL/pabi/6Sl4f+jpOD/oqPf/6io3v/X2NX/0NHT/9DQz//FxcX//Pz8//// - /////v///////NXV1f/MzMxeAAAAAP///wIAAAAAAAAAAAAAAAD///8C////AwAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAD///8BAAAAAAAAAAAAAAAEEBAEbt/f0vrx8eT/7u7g/+3t3//t7d//7Ozf/+zs - 3//r7N7/6+vd/+rq3P/p6dz/6Ojb/+fo2v/m5tn/5ubY/+Xl2P/k5Nb/4+LW/+Dg1P/T09T/0dHQ/8zM - zP+6urv/0dHR///////////94+Pj/8vLy73l5eUF////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMvL/wIKCgoLEBARdtHR0vri4uP/39/g/97e - 3//e3t//3t7f/93d3//c3N7/29vd/9vb3P/a2tz/2tnb/9nZ2v/Y2Nn/19fY/9bW1//V1db/09PU/9HR - 0//Ozs7/ycnJ/8LCwv+vr6//t7e3/9XV1f3MzMzwzs7Oaevr6wb///8BAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wEAAAAKDw8PddLS - 0vvi4uL/39/f/97e3v/d3d3/3d3d/9zc3P/a2tr/2dnZ/9nZ2f/X19f/1tbW/9fX1//V1dX/1dXV/9TU - 1P/R0dH/z8/P/8zMzP/Gxsb/vr6+/7W1tf+lpaX/u7u7/L6+vv/CwsJxAAAAAP///wMAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP// - /wEAAAAKERERdNPT0/rg4OD/3t7e/93d3f/b29v/2tra/9nZ2f/X19f/1tbW/9XV1f/U1NT/09PT/9PT - 0//R0dH/0NDQ/8/Pz//MzMz/ycnJ/8XFxf++vr7/tLS0/62trf+ioqL9tbW1/7a2ttPo6OgL////AwAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAADGRkZPOLi4vfd3d3929vb/dra2v3X19f91tbW/dTU1P3S0tL9z8/P/c/P - z/3Ozs79zMzM/cvLy/3IyMj9xcXF/cPDw/2+vr79ubm5/bW1tf2tra39o6Oj/Z2dnf6rq6vjubm5d+vr - 6w3///8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtra2B/f392r29vZ19vb2dfb29nX19fV19PT0dfT0 - 9HX09PR18fHxdfHx8XXx8fF18fHxde/v73Xt7e116+vrdevr63Xo6Oh15+fndeTk5HXg4OB14eHhb+vr - 60729vYPAAAAAP///wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAP//////////////////////gAAAAD////8AAAAAH/+A/wAAAAAf/wD/AAAAAB//AP8A - AAAAH/8A/wAAAAAf/wD/gAAAAB//AP8AAAAAH/+A/gAAAAAf/wD+AAAAAB/+AP4AAAAAH/4A/gAAAAAf - /gD+AAAAAB/+AP4AAAAAH/4A/gAAAAAf/gDAAAAAAB/+AIAAAAAAH8AAgAAAAAAfgACAAAAAAB+AAIAA - AAAAH4AA8AAAAAAfgAD+AAAAAB/wAP4AAAAAH/4A/gAAAAAf/gD+AAAAAAP+AP4AAAAAAf4A/gAAAAAD - /gD8AAAAAAP+APgAAAAAB/wA8AAAAAAP+ADwAAAAAB/wAPAAAAAAD/AA8AAAAAAH8ADwAAAAAAPwAPAA - AAAAA/AA8AAAAAAB8ADwAAAAAAPwAPAAAAAAw/AA+AAAAAP/8AD/AAAAB//4AP+AAAAH//8A/4AAAB// - /4D/gAAAP///gP+AAAA///+A/4AAAP///4D/////////gA== - - - \ No newline at end of file diff --git a/pdfpatcher/App/Model/AutoBookmarkCondition.cs b/pdfpatcher/App/Model/AutoBookmarkCondition.cs deleted file mode 100644 index 6da98428b248c3eddcb3c04845ad011bc70b1a14..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/AutoBookmarkCondition.cs +++ /dev/null @@ -1,353 +0,0 @@ -using System; -using System.Collections.ObjectModel; -using System.ComponentModel; -using System.Xml.Serialization; -using PDFPatcher.Common; -using PDFPatcher.Processor; -using PowerJson; - -namespace PDFPatcher.Model -{ - public abstract class AutoBookmarkCondition : ICloneable - { - [XmlAttribute(Constants.AutoBookmark.IsInclusive)] - public bool IsInclusive { get; set; } - - public abstract string Description { get; } - public abstract string Name { get; } - - public abstract object Clone(); - internal abstract AutoBookmarkFilter CreateFilter(); - internal abstract bool IsTextLineFilter { get; } - - [JsonTypeAlias(ThisName)] - public class MultiCondition : AutoBookmarkCondition - { - internal const string ThisName = "条件组"; - readonly Collection _Conditions = new Collection(); - - [XmlElement(FontNameCondition.ThisName, typeof(FontNameCondition))] - [XmlElement(TextSizeCondition.ThisName, typeof(TextSizeCondition))] - [XmlElement(PageRangeCondition.ThisName, typeof(PageRangeCondition))] - [XmlElement(TextCondition.ThisName, typeof(TextCondition))] - [JsonField("条件")] - public Collection Conditions => _Conditions; - - public MultiCondition() { } - - public MultiCondition(AutoBookmarkCondition condition) { - var m = condition as MultiCondition; - if (m != null) { - foreach (var item in m.Conditions) { - Conditions.Add(item.Clone() as AutoBookmarkCondition); - } - } - else { - Conditions.Add(condition); - } - } - - public override string Description { - get { - var s = new string[Conditions.Count]; - for (int i = 0; i < s.Length; i++) { - s[i] = _Conditions[i].Description; - } - return String.Join(";", s); - } - } - - public override string Name => "多条件组合"; - - internal override bool IsTextLineFilter { - get { - foreach (var item in Conditions) { - if (item.IsTextLineFilter) { - return true; - } - } - return false; - } - } - - public override object Clone() { - var m = new MultiCondition(); - foreach (var item in Conditions) { - m.Conditions.Add(item.Clone() as AutoBookmarkCondition); - } - return m; - } - - internal override AutoBookmarkFilter CreateFilter() { - return new MultiConditionFilter(this); - } - } - [JsonTypeAlias(ThisName)] - public class FontNameCondition : AutoBookmarkCondition - { - internal const string ThisName = "字体名称"; - /// - /// 需要调整级别的字体名称。 - /// - [XmlAttribute(ThisName)] - public string FontName { get; set; } - - /// - /// 是否匹配字体全名。 - /// - [XmlAttribute("匹配字体全名")] - public bool MatchFullName { get; set; } - - public override string Description => String.Concat(ThisName, (MatchFullName ? "为" : "包含"), "“", FontName, "”"); - - public override string Name => ThisName; - - internal override bool IsTextLineFilter => false; - - public FontNameCondition() { } - - internal FontNameCondition(string fontName, bool matchFullName) { - FontName = fontName; - MatchFullName = matchFullName; - } - - internal override AutoBookmarkFilter CreateFilter() { - return new FontNameFilter(FontName, MatchFullName); - } - public override object Clone() { - return new FontNameCondition(FontName, MatchFullName); - } - - } - [JsonTypeAlias(ThisName)] - public class TextSizeCondition : AutoBookmarkCondition - { - internal const string ThisName = "字体尺寸"; - float _minSize, _maxSize; - string _description; - - [XmlAttribute("最小尺寸")] - [DefaultValue(0)] - public float MinSize { - get => _minSize; - set { - _minSize = value; - _description = null; - } - } - [XmlAttribute("最大尺寸")] - [DefaultValue(0)] - public float MaxSize { - get => _maxSize; - set { - _maxSize = value; - _description = null; - } - } - - public override string Description { - get { - if (_description == null) { - UpdateRangeDescription(); - } - return _description; - } - } - public override string Name => ThisName; - - internal override bool IsTextLineFilter => false; - - public TextSizeCondition() { } - - internal TextSizeCondition(float size) { - SetRange(size, size); - } - - internal TextSizeCondition(float minSize, float maxSize) { - SetRange(minSize, maxSize); - } - - private void UpdateRangeDescription() { - _description = ThisName + (_minSize == _maxSize ? "等于" + _minSize.ToText() : "介于" + _minSize.ToText() + "和" + _maxSize.ToText()); - } - - public override object Clone() { - var f = new TextSizeCondition() { _minSize = _minSize, _maxSize = _maxSize }; - f.UpdateRangeDescription(); - return f; - } - - internal void SetRange(float a, float b) { - if (a > b) { - _minSize = b; - _maxSize = a; - } - else { - _minSize = a; - _maxSize = b; - } - _description = null; - } - - - internal override AutoBookmarkFilter CreateFilter() { - return new TextSizeFilter(_minSize, _maxSize); - } - } - [JsonTypeAlias(ThisName)] - public class TextPositionCondition : AutoBookmarkCondition - { - internal const string ThisName = "文本坐标"; - byte _position; - float _minValue, _maxValue; - string _description; - - [XmlAttribute("坐标值")] - [DefaultValue(0)] - public byte Position { - get => _position; - set { - _position = value; - _description = null; - } - } - - [XmlAttribute("坐标最小值")] - [DefaultValue(0)] - public float MinValue { - get => _minValue; - set { - _minValue = value; - _description = null; - } - } - [XmlAttribute("坐标最大值")] - [DefaultValue(0)] - public float MaxValue { - get => _maxValue; - set { - _maxValue = value; - _description = null; - } - } - - public override string Description { - get { - if (_description == null) { - UpdateRangeDescription(); - } - return _description; - } - } - public override string Name => ThisName; - - internal override bool IsTextLineFilter => false; - - public TextPositionCondition() { } - - internal TextPositionCondition(byte position, float value) { - SetRange(position, value, value); - } - - internal TextPositionCondition(byte position, float value1, float value2) { - SetRange(position, value1, value2); - } - - private void UpdateRangeDescription() { - _description = String.Concat(ThisName, - _position == 1 ? "上" : _position == 2 ? "下" : _position == 3 ? "左" : _position == 4 ? "右" : String.Empty, - "坐标", - _minValue == _maxValue - ? "等于" + ValueHelper.ToText(_minValue) - : "介于" + ValueHelper.ToText(_minValue) + "和" + _maxValue - ); - } - - public override object Clone() { - var f = new TextPositionCondition() { - _position = _position, - _minValue = _minValue, - _maxValue = _maxValue - }; - f.UpdateRangeDescription(); - return f; - } - - internal void SetRange(byte position, float value1, float value2) { - _position = position; - if (value1 > value2) { - _minValue = value2; - _maxValue = value1; - } - else { - _minValue = value1; - _maxValue = value2; - } - _description = null; - } - - - internal override AutoBookmarkFilter CreateFilter() { - return new TextPositionFilter(_position, _minValue, _maxValue); - } - } - [JsonTypeAlias(ThisName)] - public class PageRangeCondition : AutoBookmarkCondition - { - internal const string ThisName = "页码范围"; - - [XmlAttribute(ThisName)] - public string PageRange { get; set; } - - public override string Description => "页码范围为“" + PageRange + "”"; - - public override string Name => ThisName; - - internal override bool IsTextLineFilter => false; - - public override object Clone() { - return new PageRangeCondition() { PageRange = PageRange }; - } - - internal override AutoBookmarkFilter CreateFilter() { - return new PageRangeFilter(PageRange); - } - } - [JsonTypeAlias(ThisName)] - public class TextCondition : AutoBookmarkCondition - { - internal const string ThisName = "文本内容"; - - [XmlElement("文本模式")] - public MatchPattern Pattern { get; set; } - - public override string Description => String.Concat(ThisName, - Pattern.MatchCase ? "区分大小写" : String.Empty, - Pattern.FullMatch ? "完全匹配" : "符合", - Pattern.UseRegularExpression ? "正则表达式" : String.Empty, - Pattern.Text); - - public override string Name => ThisName; - - internal override bool IsTextLineFilter => true; - - public override object Clone() { - return new TextCondition(Pattern); - } - - internal override AutoBookmarkFilter CreateFilter() { - return new TextFilter(Pattern); - } - - public TextCondition() { - Pattern = new MatchPattern(); - } - private TextCondition(MatchPattern pattern) { - Pattern = pattern.Clone() as MatchPattern; - } - } - - } - - -} diff --git a/pdfpatcher/App/Model/AutoBookmarkContext.cs b/pdfpatcher/App/Model/AutoBookmarkContext.cs deleted file mode 100644 index 482b7e99db438dcfd60e8fc47b7cd6519117b7bd..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/AutoBookmarkContext.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Model -{ - sealed class AutoBookmarkContext - { - internal int CurrentPageNumber { get; set; } - internal int TotalPageNumber { get; set; } - internal bool IsTextMerged { get; set; } - internal TextInfo TextInfo { get; set; } - internal TextLine TextLine { get; set; } - internal iTextSharp.text.Rectangle PageBox { get; set; } - } -} diff --git a/pdfpatcher/App/Model/BookmarkSettings.cs b/pdfpatcher/App/Model/BookmarkSettings.cs deleted file mode 100644 index 3f451039b9afe84a74df84ae41025abf776ead9b..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/BookmarkSettings.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Drawing; -using System.Text; -using System.Xml; -using System.Xml.Serialization; -using PDFPatcher.Common; - -namespace PDFPatcher.Model -{ - /// - /// 在合并文件功能中使用的书签设置。 - /// - public class BookmarkSettings : ICloneable, IXmlSerializable - { - public string Title { get; set; } - public bool IsBold { get; set; } - public bool IsItalic { get; set; } - public bool IsOpened { get; set; } - public bool GoToTop { get; set; } - public Color ForeColor { get; set; } - - public BookmarkSettings() { - ForeColor = Color.Transparent; - } - - public BookmarkSettings(string title) { - Title = title; - } - - public BookmarkSettings Clone() { - return (BookmarkSettings)MemberwiseClone(); - } - - public BookmarkSettings(BookmarkElement element) { - Title = element.Title; - IsBold = (element.TextStyle & FontStyle.Bold) == FontStyle.Bold; - IsItalic = (element.TextStyle & FontStyle.Italic) == FontStyle.Italic; - IsOpened = element.IsOpen; - ForeColor = element.ForeColor; - } - - #region ICloneable 成员 - - object ICloneable.Clone() { - return Clone(); - } - - #endregion - - #region IXmlSerializable 成员 - - public System.Xml.Schema.XmlSchema GetSchema() { - return null; - } - - public void ReadXml(XmlReader reader) { - if (reader.Read() == false) { - return; - } - Title = reader.GetAttribute("title"); - IsBold = reader.GetValue("bold", false); - IsItalic = reader.GetValue("italic", false); - IsOpened = reader.GetValue("opened", false); - GoToTop = reader.GetValue("goToTop", false); - string c = reader.GetAttribute("color"); - ForeColor = c is null ? Color.Transparent : Color.FromArgb(c.ToInt32()); - } - - public void WriteXml(XmlWriter writer) { - writer.WriteStartElement("bookmark"); - writer.WriteValue("title", Title, null); - writer.WriteValue("bold", IsBold, false); - writer.WriteValue("italic", IsItalic, false); - writer.WriteValue("opened", IsOpened, false); - writer.WriteValue("goToTop", GoToTop, false); - writer.WriteValue("color", ForeColor.ToArgb(), Color.Transparent.ToArgb()); - writer.WriteEndElement(); - } - - #endregion - } -} diff --git a/pdfpatcher/App/Model/BookmarkStatus.cs b/pdfpatcher/App/Model/BookmarkStatus.cs deleted file mode 100644 index d4ea181904c46531044de49547c5de122d067b90..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/BookmarkStatus.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Xml.Serialization; - -namespace PDFPatcher.Model -{ - public enum BookmarkStatus - { - [XmlEnum("保持不变")] - AsIs, - [XmlEnum("全部关闭")] - CollapseAll, - [XmlEnum("全部打开")] - ExpandAll, - [XmlEnum("打开首层")] - ExpandTop - } -} diff --git a/pdfpatcher/App/Model/Bound.cs b/pdfpatcher/App/Model/Bound.cs deleted file mode 100644 index c2d375f557adea6f0b55de050269f6d16dbc4614..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/Bound.cs +++ /dev/null @@ -1,243 +0,0 @@ -using System; -using System.Diagnostics; - -namespace PDFPatcher.Model -{ - [DebuggerDisplay("T={Top},L={Left},B={Bottom},R={Right}; H={Height},W={Width}")] - public class Bound - { - internal float Top { get; private set; } - internal float Left { get; private set; } - internal float Bottom { get; private set; } - internal float Right { get; private set; } - - /// - /// 获取此区域坐标是否属于笛卡尔坐标系。 - /// - internal bool IsTopUp { get; private set; } - /// - /// 获取此坐标区域是否属于绘图坐标系。 - /// - internal bool IsTopDown { get; private set; } - - internal float Height { get; private set; } - internal float Width { get; private set; } - - internal float Middle { get; private set; } - internal float Center { get; private set; } - - private Bound() { - IsTopDown = true; - IsTopUp = true; - } - - public Bound(float left, float bottom, float right, float top) { - if (right < left) { - Debug.WriteLine("右端坐标不能小于左端坐标。"); - var t = right; - right = left; - left = t; - } - Left = left; - Bottom = bottom; - Right = right; - Top = top; - RecalculateSize(); - } - /// - /// 创建宽度和高度均为 0 的区域(点)实例。 - /// - /// 横坐标。 - /// 纵坐标。 - public Bound(float x, float y) : this(x, y, x, y) { - } - - /// - /// 从指定区域复制副本。 - /// - /// 需要复制副本的区域。 - public Bound(Bound source) : this(source.Left, source.Bottom, source.Right, source.Top) { - } - - private void RecalculateSize() { - IsTopUp = Top >= Bottom; - IsTopDown = Top <= Bottom; - Height = IsTopUp ? Top - Bottom : Bottom - Top; - Middle = (Top + Bottom) / 2; - Width = Right - Left; - Center = (Left + Right) / 2; - } - - internal Bound Merge(Bound source) { - // 笛卡尔坐标 - if (IsTopUp) { - if (Top < source.Top) { - Top = source.Top; - } - if (Bottom > source.Bottom) { - Bottom = source.Bottom; - } - } - else { - if (Top > source.Top) { - Top = source.Top; - } - if (Bottom < source.Bottom) { - Bottom = source.Bottom; - } - } - if (Left > source.Left) { - Left = source.Left; - } - if (Right < source.Right) { - Right = source.Right; - } - RecalculateSize(); - return this; - } - - /// - /// 获取区域 到当前区域之间的距离。 - /// - /// 另一个区域。 - /// 假设书写方向。 - /// 相对于此区域的距离关系。 - internal DistanceInfo GetDistance(Bound other, WritingDirection writingDirection) { - if (IsTopDown != other.IsTopDown && IsTopUp != other.IsTopUp) { - throw new ArgumentException("区域坐标系不同。"); - } - - float hd = float.MaxValue, vd = float.MaxValue; - var hp = DistanceInfo.Placement.Unknown; - var vp = DistanceInfo.Placement.Unknown; - float au, ad, bu, bd; - if (IsTopDown) { - au = Top; - ad = Bottom; - bu = other.Top; - bd = other.Bottom; - } - else { - au = -Top; - ad = -Bottom; - bu = -other.Top; - bd = -other.Bottom; - } - - bool ov = false; - if (IntersectWith(other)) { - ov = true; - hd = other.Center - Center; - if (hd > 0) { - hp = DistanceInfo.Placement.Right; - } - else if (hd < 0) { - hp = DistanceInfo.Placement.Left; - hd = -hd; - } - vd = other.Middle - Middle; - if (vd > 0) { - vp = IsTopUp ? DistanceInfo.Placement.Up : DistanceInfo.Placement.Down; - } - else if (vd < 0) { - vp = IsTopUp ? DistanceInfo.Placement.Down : DistanceInfo.Placement.Up; - } - if (vd == 0 && hd == 0) { - return new DistanceInfo(DistanceInfo.Placement.Overlapping, 0, 0); - } - else if (vd == 0) { - return new DistanceInfo(DistanceInfo.Placement.Overlapping | hp, hd, vd); - } - else if (hp == 0) { - return new DistanceInfo(DistanceInfo.Placement.Overlapping | vp, hd, vd); - } - else { - return new DistanceInfo(DistanceInfo.Placement.Overlapping, hd, vd); - } - } - - if (other.Left >= Right) { - hp = DistanceInfo.Placement.Right; - hd = other.Left - Right; - } - else if (other.Right <= Left) { - hp = DistanceInfo.Placement.Left; - hd = Left - other.Right; - } - if (bd <= au) { - vp = DistanceInfo.Placement.Up; - vd = au - bd; - } - else if (bu >= ad) { - vp = DistanceInfo.Placement.Down; - vd = bu - ad; - } - if (hp == DistanceInfo.Placement.Unknown && vp == DistanceInfo.Placement.Unknown) { - throw new ArgumentOutOfRangeException("位置错误。"); - } - var v = new DistanceInfo(ov ? DistanceInfo.Placement.Overlapping | vp : vp, hd, vd); - var h = new DistanceInfo(ov ? DistanceInfo.Placement.Overlapping | hp : hp, hd, vd); - return writingDirection switch { - WritingDirection.Vertical => hp != DistanceInfo.Placement.Unknown ? h : v, - WritingDirection.Horizontal => vp != DistanceInfo.Placement.Unknown ? v : h, - _ => (hd < vd) ? h : v - }; - } - - /// - /// 返回当前区域是否和指定区域在同一行上(中心点是否落在 的两个边缘之间)。 - /// - /// 需要比较的区域。 - /// 比较方向。 - /// 在同一行上时返回 true。 - internal bool IsAlignedWith(Bound other, WritingDirection direction) { - switch (direction) { - case WritingDirection.Horizontal: - return IsTopDown ? (other.Top < Middle && Middle < other.Bottom || Top < other.Middle && other.Middle < Bottom) : (other.Bottom < Middle && Middle < other.Top || Bottom < other.Middle && other.Middle < Top); - case WritingDirection.Vertical: - return other.Left < Center && Center < other.Right - || Left < other.Center && other.Center < Right; - default: - return IntersectWith(other); - } - } - - internal bool IntersectWith(Bound other) { - return other.Left < Right && Left < other.Right && - (IsTopDown - ? (other.Top < Bottom && Top < other.Bottom) - : (other.Bottom < Top && Bottom < other.Top)); - } - - internal bool Contains(float x, float y) { - float x1, x2, y1, y2; - x1 = Left; - x2 = Right; - if (IsTopUp) { - y1 = Bottom; - y2 = Top; - } - else { - y1 = Top; - y2 = Bottom; - } - return x1 <= x && x <= x2 && y1 <= y && y <= y2; - } - - public static bool operator ==(Bound a, Bound b) { - return a.Top == b.Top && a.Bottom == b.Bottom && a.Left == b.Left && a.Right == b.Right; - } - public static bool operator !=(Bound a, Bound b) { - return a.Top != b.Top || a.Bottom != b.Bottom || a.Left != b.Left || a.Right != b.Right; - } - public override bool Equals(object obj) { - return this == (Bound)obj; - } - public override int GetHashCode() { - return Top.GetHashCode() ^ Bottom.GetHashCode() ^ Left.GetHashCode() ^ Right.GetHashCode(); - } - public static implicit operator System.Drawing.RectangleF(Bound bound) { - return new System.Drawing.RectangleF(Math.Min(bound.Left, bound.Right), Math.Min(bound.Top, bound.Bottom), Math.Abs(bound.Left - bound.Right), Math.Abs(bound.Top - bound.Bottom)); - } - } -} diff --git a/pdfpatcher/App/Model/ColorSpaces/CIELab.cs b/pdfpatcher/App/Model/ColorSpaces/CIELab.cs deleted file mode 100644 index a87267e9c6ffc6a7e4096a3827427e144a803b9d..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/ColorSpaces/CIELab.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System; -using System.ComponentModel; - -namespace Devcorp.Controls.Design -{ - /// - /// Structure to define CIE L*a*b*. - /// - public struct CIELab - { - /// - /// Gets an empty CIELab structure. - /// - public static readonly CIELab Empty = new CIELab(); - - #region Fields - private double l; - private double a; - private double b; - - #endregion - - #region Operators - public static bool operator ==(CIELab item1, CIELab item2) { - return ( - item1.L == item2.L - && item1.A == item2.A - && item1.B == item2.B - ); - } - - public static bool operator !=(CIELab item1, CIELab item2) { - return ( - item1.L != item2.L - || item1.A != item2.A - || item1.B != item2.B - ); - } - - #endregion - - #region Accessors - /// - /// Gets or sets L component. - /// - public double L { - get => l; - set => l = value; - } - - /// - /// Gets or sets a component. - /// - public double A { - get => a; - set => a = value; - } - - /// - /// Gets or sets a component. - /// - public double B { - get => b; - set => b = value; - } - - #endregion - - public CIELab(double l, double a, double b) { - this.l = l; - this.a = a; - this.b = b; - } - - #region Methods - public override bool Equals(Object obj) { - if (obj == null || GetType() != obj.GetType()) return false; - - return (this == (CIELab)obj); - } - - public override int GetHashCode() { - return L.GetHashCode() ^ a.GetHashCode() ^ b.GetHashCode(); - } - - #endregion - } -} diff --git a/pdfpatcher/App/Model/ColorSpaces/CIEXYZ.cs b/pdfpatcher/App/Model/ColorSpaces/CIEXYZ.cs deleted file mode 100644 index 68d351705cf1e5c26d0dee3bb95d0370d2d745fe..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/ColorSpaces/CIEXYZ.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.ComponentModel; - -namespace Devcorp.Controls.Design -{ - /// - /// Structure to define CIE XYZ. - /// - public struct CIEXYZ - { - /// - /// Gets an empty CIEXYZ structure. - /// - public static readonly CIEXYZ Empty = new CIEXYZ(); - /// - /// Gets the CIE D65 (white) structure. - /// - public static readonly CIEXYZ D65 = new CIEXYZ(0.9505, 1.0, 1.0890); - - #region Fields - private double x; - private double y; - private double z; - - #endregion - - #region Operators - public static bool operator ==(CIEXYZ item1, CIEXYZ item2) { - return ( - item1.X == item2.X - && item1.Y == item2.Y - && item1.Z == item2.Z - ); - } - - public static bool operator !=(CIEXYZ item1, CIEXYZ item2) { - return ( - item1.X != item2.X - || item1.Y != item2.Y - || item1.Z != item2.Z - ); - } - - #endregion - - #region Accessors - /// - /// Gets or sets X component. - /// - public double X { - get => x; - set => x = (value > 0.9505) ? 0.9505 : ((value < 0) ? 0 : value); - } - - /// - /// Gets or sets Y component. - /// - public double Y { - get => y; - set => y = (value > 1.0) ? 1.0 : ((value < 0) ? 0 : value); - } - - /// - /// Gets or sets Z component. - /// - public double Z { - get => z; - set => z = (value > 1.089) ? 1.089 : ((value < 0) ? 0 : value); - } - - #endregion - - public CIEXYZ(double x, double y, double z) { - this.x = (x > 0.9505) ? 0.9505 : ((x < 0) ? 0 : x); - this.y = (y > 1.0) ? 1.0 : ((y < 0) ? 0 : y); - this.z = (z > 1.089) ? 1.089 : ((z < 0) ? 0 : z); - } - - #region Methods - public override bool Equals(Object obj) { - if (obj == null || GetType() != obj.GetType()) return false; - - return (this == (CIEXYZ)obj); - } - - public override int GetHashCode() { - return X.GetHashCode() ^ Y.GetHashCode() ^ Z.GetHashCode(); - } - - #endregion - } -} diff --git a/pdfpatcher/App/Model/ColorSpaces/CMYK.cs b/pdfpatcher/App/Model/ColorSpaces/CMYK.cs deleted file mode 100644 index 1ac56e9056ab74cf03572a7586c945dd3a3e7116..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/ColorSpaces/CMYK.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; - -namespace Devcorp.Controls.Design -{ - /// - /// Structure to define CMYK. - /// - public struct CMYK - { - /// - /// Gets an empty CMYK structure; - /// - public readonly static CMYK Empty = new CMYK(); - - #region Fields - private double c; - private double m; - private double y; - private double k; - #endregion - - #region Operators - public static bool operator ==(CMYK item1, CMYK item2) { - return ( - item1.Cyan == item2.Cyan - && item1.Magenta == item2.Magenta - && item1.Yellow == item2.Yellow - && item1.Black == item2.Black - ); - } - - public static bool operator !=(CMYK item1, CMYK item2) { - return ( - item1.Cyan != item2.Cyan - || item1.Magenta != item2.Magenta - || item1.Yellow != item2.Yellow - || item1.Black != item2.Black - ); - } - - - #endregion - - #region Accessors - public double Cyan { - get => c; - set { - c = value; - c = (c > 1) ? 1 : ((c < 0) ? 0 : c); - } - } - - public double Magenta { - get => m; - set { - m = value; - m = (m > 1) ? 1 : ((m < 0) ? 0 : m); - } - } - - public double Yellow { - get => y; - set { - y = value; - y = (y > 1) ? 1 : ((y < 0) ? 0 : y); - } - } - - public double Black { - get => k; - set { - k = value; - k = (k > 1) ? 1 : ((k < 0) ? 0 : k); - } - } - #endregion - - /// - /// Creates an instance of a CMYK structure. - /// - public CMYK(double c, double m, double y, double k) { - this.c = c; - this.m = m; - this.y = y; - this.k = k; - } - - #region Methods - public override bool Equals(Object obj) { - if (obj == null || GetType() != obj.GetType()) return false; - - return (this == (CMYK)obj); - } - - public override int GetHashCode() { - return Cyan.GetHashCode() ^ Magenta.GetHashCode() ^ Yellow.GetHashCode() ^ Black.GetHashCode(); - } - - #endregion - } -} diff --git a/pdfpatcher/App/Model/ColorSpaces/ColorSpaceHelper.cs b/pdfpatcher/App/Model/ColorSpaces/ColorSpaceHelper.cs deleted file mode 100644 index caa901bbac0387a217ca1da2c7516fe852d6cf03..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/ColorSpaces/ColorSpaceHelper.cs +++ /dev/null @@ -1,976 +0,0 @@ -using System; -using System.Drawing; - -namespace Devcorp.Controls.Design -{ - /// - /// Provides methods to convert from a color space to an other. - /// - public static class ColorSpaceHelper - { - #region Color processing - /// - /// Gets the "distance" between two colors. - /// RGB colors must be normalized (eg. values in [0.0, 1.0]). - /// - /// First color red component. - /// First color green component. - /// First color blue component. - /// Second color red component. - /// Second color green component. - /// Second color blue component. - public static double GetColorDistance(double r1, double g1, double b1, double r2, double g2, double b2) { - double a = r2 - r1; - double b = g2 - g1; - double c = b2 - b1; - - return Math.Sqrt(a * a + b * b + c * c); - } - - - /// - /// Gets the "distance" between two colors. - /// RGB colors must be normalized (eg. values in [0.0, 1.0]). - /// - /// First color [r,g,b] - /// Second color [r,g,b] - public static double GetColorDistance(double[] color1, double[] color2) { - return GetColorDistance(color1[0], color1[1], color1[2], color2[0], color2[1], color2[2]); - } - - - /// - /// Gets the "distance" between two colors. - /// - /// First color. - /// Second color. - public static double GetColorDistance(Color c1, Color c2) { - var rgb1 = new double[]{ - (double)c1.R/255.0, - (double)c1.G/255.0, - (double)c1.B/255.0 - }; - - var rgb2 = new double[]{ - (double)c2.R/255.0, - (double)c2.G/255.0, - (double)c2.B/255.0 - }; - - return GetColorDistance(rgb1[0], rgb1[1], rgb1[2], rgb2[0], rgb2[1], rgb2[2]); - } - - - #endregion - - #region Light Spectrum processing - /// - /// Gets visible colors (color wheel). - /// - /// - /// The alpha value used for each colors. - /// - public static Color[] GetWheelColors(int alpha) { - Color temp; - int colorCount = 6 * 256; - var colors = new Color[colorCount]; - - for (int i = 0; i < colorCount; i++) { - temp = HSBtoColor((int)((double)(i * 255.0) / colorCount), 255, 255); - colors[i] = Color.FromArgb(alpha, temp.R, temp.G, temp.B); - } - - return colors; - } - - - /// - /// Gets visible spectrum colors. - /// - /// The alpha value used for each colors. - public static Color[] GetSpectrumColors(int alpha) { - var colors = new Color[256 * 6]; - //for(int i=127; i<256; i++) colors[i-127] = Color.FromArgb(alpha, i, 0, 0); - for (int i = 0; i < 256; i++) colors[i] = Color.FromArgb(alpha, 255, i, 0); - for (int i = 0; i < 256; i++) colors[i + (256)] = Color.FromArgb(alpha, 255 - i, 255, 0); - for (int i = 0; i < 256; i++) colors[i + (256 * 2)] = Color.FromArgb(alpha, 0, 255, i); - for (int i = 0; i < 256; i++) colors[i + (256 * 3)] = Color.FromArgb(alpha, 0, 255 - i, 255); - for (int i = 0; i < 256; i++) colors[i + (256 * 4)] = Color.FromArgb(alpha, i, 0, 255); - for (int i = 0; i < 256; i++) colors[i + (256 * 5)] = Color.FromArgb(alpha, 255, 0, 255 - i); - //for(int i=0; i<128; i++) colors[i+(128+256*6)] = Color.FromArgb(alpha, 255-i, 0, 0); - - return colors; - } - - - /// - /// Gets visible spectrum colors. - /// - public static Color[] GetSpectrumColors() { - return GetSpectrumColors(255); - } - - - #endregion - - #region Hexa convert - /// - /// Gets the int equivalent for a hexadecimal value. - /// - private static int GetIntFromHex(string strHex) { - switch (strHex) { - case ("A"): { - return 10; - } - case ("B"): { - return 11; - } - case ("C"): { - return 12; - } - case ("D"): { - return 13; - } - case ("E"): { - return 14; - } - case ("F"): { - return 15; - } - default: { - return int.Parse(strHex); - } - } - } - - - /// - /// Converts a Hex color to a .net Color. - /// - /// The desired hexadecimal color to convert. - public static Color HexToColor(string hexColor) { - string r, g, b; - - if (hexColor == String.Empty) { - return Color.Empty; - } - - hexColor = hexColor.Trim(); - if (hexColor[0] == '#') hexColor = hexColor.Substring(1, hexColor.Length - 1); - - r = hexColor.Substring(0, 2); - g = hexColor.Substring(2, 2); - b = hexColor.Substring(4, 2); - - r = Convert.ToString(16 * GetIntFromHex(r.Substring(0, 1)) + GetIntFromHex(r.Substring(1, 1))); - g = Convert.ToString(16 * GetIntFromHex(g.Substring(0, 1)) + GetIntFromHex(g.Substring(1, 1))); - b = Convert.ToString(16 * GetIntFromHex(b.Substring(0, 1)) + GetIntFromHex(b.Substring(1, 1))); - - return Color.FromArgb(Convert.ToInt32(r), Convert.ToInt32(g), Convert.ToInt32(b)); - } - - /// - /// Converts a RGB color format to an hexadecimal color. - /// - /// The Red value. - /// The Green value. - /// The Blue value. - public static string RGBToHex(int r, int g, int b) { - return String.Format("#{0:x2}{1:x2}{2:x2}", (int)r, (int)g, (int)b); - } - - - /// - /// Converts a RGB color format to an hexadecimal color. - /// - /// The color to convert. - public static string RGBToHex(Color c) { - return RGBToHex(c.R, c.G, c.B); - } - - #endregion - - #region HSB convert - /// - /// Converts HSB to RGB. - /// - /// The HSB structure to convert. - public static RGB HSBtoRGB(HSB hsb) { - double r = 0; - double g = 0; - double b = 0; - - if (hsb.Saturation == 0) { - r = g = b = hsb.Brightness; - } - else { - // the color wheel consists of 6 sectors. Figure out which sector you're in. - double sectorPos = hsb.Hue / 60.0; - int sectorNumber = (int)(Math.Floor(sectorPos)); - // get the fractional part of the sector - double fractionalSector = sectorPos - sectorNumber; - - // calculate values for the three axes of the color. - double p = hsb.Brightness * (1.0 - hsb.Saturation); - double q = hsb.Brightness * (1.0 - (hsb.Saturation * fractionalSector)); - double t = hsb.Brightness * (1.0 - (hsb.Saturation * (1 - fractionalSector))); - - // assign the fractional colors to r, g, and b based on the sector the angle is in. - switch (sectorNumber) { - case 0: - r = hsb.Brightness; - g = t; - b = p; - break; - case 1: - r = q; - g = hsb.Brightness; - b = p; - break; - case 2: - r = p; - g = hsb.Brightness; - b = t; - break; - case 3: - r = p; - g = q; - b = hsb.Brightness; - break; - case 4: - r = t; - g = p; - b = hsb.Brightness; - break; - case 5: - r = hsb.Brightness; - g = p; - b = q; - break; - } - } - - return new RGB( - Convert.ToInt32(Double.Parse(String.Format("{0:0.00}", r * 255.0))), - Convert.ToInt32(Double.Parse(String.Format("{0:0.00}", g * 255.0))), - Convert.ToInt32(Double.Parse(String.Format("{0:0.00}", b * 255.0))) - ); - } - - /// - /// Converts HSB to RGB. - /// - /// Hue value. - /// Saturation value. - /// Brigthness value. - public static RGB HSBtoRGB(double h, double s, double b) { - return HSBtoRGB(new HSB(h, s, b)); - } - - - /// - /// Converts HSB to Color. - /// - /// the HSB structure to convert. - public static Color HSBtoColor(HSB hsb) { - var rgb = HSBtoRGB(hsb); - - return Color.FromArgb(rgb.Red, rgb.Green, rgb.Blue); - } - - /// - /// Converts HSB to a .net Color. - /// - /// Hue value (must be between 0 and 360). - /// Saturation value (must be between 0 and 1). - /// Brightness value (must be between 0 and 1). - public static Color HSBtoColor(double h, double s, double b) { - return HSBtoColor(new HSB(h, s, b)); - } - - /// - /// Converts HSB to Color. - /// - /// Hue value. - /// Saturation value. - /// Brightness value. - public static Color HSBtoColor(int h, int s, int b) { - double hue = 0, sat = 0, val = 0; - - // Scale Hue to be between 0 and 360. Saturation and value scale to be between 0 and 1. - if (h > 360 || s > 1 || b > 1) { - hue = ((double)h / 255.0 * 360.0) % 360.0; - sat = (double)s / 255.0; - val = (double)b / 255.0; - } - - return HSBtoColor(new HSB(hue, sat, val)); - } - - - /// - /// Converts HSB to HSL. - /// - public static HSL HSBtoHSL(double h, double s, double b) { - var rgb = HSBtoRGB(new HSB(h, s, b)); - - return RGBtoHSL(rgb.Red, rgb.Green, rgb.Blue); - } - - /// - /// Converts HSB to CMYK. - /// - public static CMYK HSBtoCMYK(double h, double s, double b) { - var rgb = HSBtoRGB(new HSB(h, s, b)); - - return RGBtoCMYK(rgb.Red, rgb.Green, rgb.Blue); - } - - /// - /// Converts HSB to CMYK. - /// - public static YUV HSBtoYUV(double h, double s, double b) { - var rgb = HSBtoRGB(new HSB(h, s, b)); - - return RGBtoYUV(rgb.Red, rgb.Green, rgb.Blue); - } - - #endregion - - #region HSL convert - /// - /// Converts HSL to RGB. - /// - /// Hue, must be in [0, 360]. - /// Saturation, must be in [0, 1]. - /// Luminance, must be in [0, 1]. - public static RGB HSLtoRGB(double h, double s, double l) { - if (s == 0) { - // achromatic color (gray scale) - return new RGB( - Convert.ToInt32(Double.Parse(String.Format("{0:0.00}", l * 255.0))), - Convert.ToInt32(Double.Parse(String.Format("{0:0.00}", l * 255.0))), - Convert.ToInt32(Double.Parse(String.Format("{0:0.00}", l * 255.0))) - ); - } - else { - double q = (l < 0.5) ? (l * (1.0 + s)) : (l + s - (l * s)); - double p = (2.0 * l) - q; - - double Hk = h / 360.0; - var T = new double[3]; - T[0] = Hk + (1.0 / 3.0); // Tr - T[1] = Hk; // Tb - T[2] = Hk - (1.0 / 3.0); // Tg - - for (int i = 0; i < 3; i++) { - if (T[i] < 0) T[i] += 1.0; - if (T[i] > 1) T[i] -= 1.0; - - if ((T[i] * 6) < 1) { - T[i] = p + ((q - p) * 6.0 * T[i]); - } - else if ((T[i] * 2.0) < 1) //(1.0/6.0)<=T[i] && T[i]<0.5 - { - T[i] = q; - } - else if ((T[i] * 3.0) < 2) // 0.5<=T[i] && T[i]<(2.0/3.0) - { - T[i] = p + (q - p) * ((2.0 / 3.0) - T[i]) * 6.0; - } - else T[i] = p; - } - - return new RGB( - Convert.ToInt32(Double.Parse(String.Format("{0:0.00}", T[0] * 255.0))), - Convert.ToInt32(Double.Parse(String.Format("{0:0.00}", T[1] * 255.0))), - Convert.ToInt32(Double.Parse(String.Format("{0:0.00}", T[2] * 255.0))) - ); - } - } - - /// - /// Converts HSL to RGB. - /// - /// The HSL structure to convert. - public static RGB HSLtoRGB(HSL hsl) { - return HSLtoRGB(hsl.Hue, hsl.Saturation, hsl.Luminance); - } - - - /// - /// Converts HSL to .net Color. - /// - /// The HSL structure to convert. - public static Color HSLtoColor(double h, double s, double l) { - var rgb = HSLtoRGB(h, s, l); - - return Color.FromArgb(rgb.Red, rgb.Green, rgb.Blue); - } - - /// - /// Converts HSL to .net Color. - /// - /// The HSL structure to convert. - public static Color HSLtoColor(HSL hsl) { - return HSLtoColor(hsl.Hue, hsl.Saturation, hsl.Luminance); - } - - - /// - /// Converts HSL to HSB. - /// - public static HSB HSLtoHSB(double h, double s, double l) { - var rgb = HSLtoRGB(h, s, l); - - return RGBtoHSB(rgb.Red, rgb.Green, rgb.Blue); - } - - /// - /// Converts HSL to CMYK. - /// - public static CMYK HSLtoCMYK(double h, double s, double l) { - var rgb = HSLtoRGB(h, s, l); - - return RGBtoCMYK(rgb.Red, rgb.Green, rgb.Blue); - } - - /// - /// Converts HSL to YUV. - /// - public static YUV HSLtoYUV(double h, double s, double l) { - var rgb = HSLtoRGB(h, s, l); - - return RGBtoYUV(rgb.Red, rgb.Green, rgb.Blue); - } - - #endregion - - #region RGB convert - /// - /// Converts RGB to HSL. - /// - /// Red value, must be in [0,255]. - /// Green value, must be in [0,255]. - /// Blue value, must be in [0,255]. - public static HSL RGBtoHSL(int red, int green, int blue) { - double h = 0, s = 0, l = 0; - - // normalizes red-green-blue values - double nRed = (double)red / 255.0; - double nGreen = (double)green / 255.0; - double nBlue = (double)blue / 255.0; - - double max = Math.Max(nRed, Math.Max(nGreen, nBlue)); - double min = Math.Min(nRed, Math.Min(nGreen, nBlue)); - - // hue - if (max == min) { - h = 0; // undefined - } - else if (max == nRed && nGreen >= nBlue) { - h = 60.0 * (nGreen - nBlue) / (max - min); - } - else if (max == nRed && nGreen < nBlue) { - h = 60.0 * (nGreen - nBlue) / (max - min) + 360.0; - } - else if (max == nGreen) { - h = 60.0 * (nBlue - nRed) / (max - min) + 120.0; - } - else if (max == nBlue) { - h = 60.0 * (nRed - nGreen) / (max - min) + 240.0; - } - - // luminance - l = (max + min) / 2.0; - - // saturation - if (l == 0 || max == min) { - s = 0; - } - else if (0 < l && l <= 0.5) { - s = (max - min) / (max + min); - } - else if (l > 0.5) { - s = (max - min) / (2 - (max + min)); //(max-min > 0)? - } - - return new HSL( - Double.Parse(String.Format("{0:0.##}", h)), - Double.Parse(String.Format("{0:0.##}", s)), - Double.Parse(String.Format("{0:0.##}", l)) - ); - } - - /// - /// Converts RGB to HSL. - /// - public static HSL RGBtoHSL(RGB rgb) { - return RGBtoHSL(rgb.Red, rgb.Green, rgb.Blue); - } - - /// - /// Converts Color to HSL. - /// - public static HSL RGBtoHSL(Color c) { - return RGBtoHSL(c.R, c.G, c.B); - } - - - /// - /// Converts RGB to HSB. - /// - public static HSB RGBtoHSB(int red, int green, int blue) { - double r = ((double)red / 255.0); - double g = ((double)green / 255.0); - double b = ((double)blue / 255.0); - - double max = Math.Max(r, Math.Max(g, b)); - double min = Math.Min(r, Math.Min(g, b)); - - double h = 0.0; - if (max == r && g >= b) { - if (max - min == 0) h = 0.0; - else h = 60 * (g - b) / (max - min); - } - else if (max == r && g < b) { - h = 60 * (g - b) / (max - min) + 360; - } - else if (max == g) { - h = 60 * (b - r) / (max - min) + 120; - } - else if (max == b) { - h = 60 * (r - g) / (max - min) + 240; - } - - double s = (max == 0) ? 0.0 : (1.0 - ((double)min / (double)max)); - - return new HSB(h, s, (double)max); - } - - /// - /// Converts RGB to HSB. - /// - public static HSB RGBtoHSB(RGB rgb) { - return RGBtoHSB(rgb.Red, rgb.Green, rgb.Blue); - } - - /// - /// Converts RGB to HSB. - /// - public static HSB RGBtoHSB(Color c) { - return RGBtoHSB(c.R, c.G, c.B); - } - - - /// - /// Converts RGB to CMYK - /// - /// Red vaue must be in [0, 255]. - /// Green vaue must be in [0, 255]. - /// Blue vaue must be in [0, 255]. - public static CMYK RGBtoCMYK(int red, int green, int blue) { - double c = (double)(255 - red) / 255; - double m = (double)(255 - green) / 255; - double y = (double)(255 - blue) / 255; - - double min = (double)Math.Min(c, Math.Min(m, y)); - if (min == 1.0) { - return new CMYK(0, 0, 0, 1); - } - else { - return new CMYK((c - min) / (1 - min), (m - min) / (1 - min), (y - min) / (1 - min), min); - } - } - - /// - /// Converts RGB to CMYK - /// - public static CMYK RGBtoCMYK(Color c) { - return RGBtoCMYK(c.R, c.G, c.B); - } - - /// - /// Converts RGB to CMYK - /// - public static CMYK RGBtoCMYK(RGB rgb) { - return RGBtoCMYK(rgb.Red, rgb.Green, rgb.Blue); - } - - - /// - /// Converts RGB to YUV. - /// - /// red must be in [0, 255]. - /// green must be in [0, 255]. - /// blue must be in [0, 255]. - public static YUV RGBtoYUV(int red, int green, int blue) { - var yuv = new YUV(); - - // normalizes red/green/blue values - double nRed = (double)red / 255.0; - double nGreen = (double)green / 255.0; - double nBlue = (double)blue / 255.0; - - // converts - yuv.Y = 0.299 * nRed + 0.587 * nGreen + 0.114 * nBlue; - yuv.U = -0.1471376975169300226 * nRed - 0.2888623024830699774 * nGreen + 0.436 * nBlue; - yuv.V = 0.615 * nRed - 0.5149857346647646220 * nGreen - 0.1000142653352353780 * nBlue; - - return yuv; - } - - /// - /// Converts RGB to YUV. - /// - public static YUV RGBtoYUV(Color c) { - return RGBtoYUV(c.R, c.G, c.B); - } - /// - /// Converts RGB to YUV. - /// - public static YUV RGBtoYUV(RGB rgb) { - return RGBtoYUV(rgb.Red, rgb.Green, rgb.Blue); - } - - - /// - /// Converts RGB to CIE XYZ (CIE 1931 color space) - /// - /// Red must be in [0, 255]. - /// Green must be in [0, 255]. - /// Blue must be in [0, 255]. - public static CIEXYZ RGBtoXYZ(int red, int green, int blue) { - // normalize red, green, blue values - double rLinear = (double)red / 255.0; - double gLinear = (double)green / 255.0; - double bLinear = (double)blue / 255.0; - - // convert to a sRGB form - double r = (rLinear > 0.04045) ? Math.Pow((rLinear + 0.055) / (1 + 0.055), 2.2) : (rLinear / 12.92); - double g = (gLinear > 0.04045) ? Math.Pow((gLinear + 0.055) / (1 + 0.055), 2.2) : (gLinear / 12.92); - double b = (bLinear > 0.04045) ? Math.Pow((bLinear + 0.055) / (1 + 0.055), 2.2) : (bLinear / 12.92); - - // converts - return new CIEXYZ( - (r * 0.4124 + g * 0.3576 + b * 0.1805), - (r * 0.2126 + g * 0.7152 + b * 0.0722), - (r * 0.0193 + g * 0.1192 + b * 0.9505) - ); - } - /// - /// Converts RGB to CIEXYZ. - /// - public static CIEXYZ RGBtoXYZ(RGB rgb) { - return RGBtoXYZ(rgb.Red, rgb.Green, rgb.Blue); - } - /// - /// Converts RGB to CIEXYZ. - /// - public static CIEXYZ RGBtoXYZ(Color c) { - return RGBtoXYZ(c.R, c.G, c.B); - } - - - /// - /// Converts RGB to CIELab. - /// - public static CIELab RGBtoLab(int red, int green, int blue) { - return XYZtoLab(RGBtoXYZ(red, green, blue)); - } - - /// - /// Converts RGB to CIELab. - /// - public static CIELab RGBtoLab(RGB rgb) { - return XYZtoLab(RGBtoXYZ(rgb.Red, rgb.Green, rgb.Blue)); - } - /// - /// Converts RGB to CIELab. - /// - public static CIELab RGBtoLab(System.Drawing.Color color) { - return XYZtoLab(RGBtoXYZ(color.R, color.G, color.B)); - } - - - #endregion - - #region CMYK convert - /// - /// 将四色分量(必须为 0~1)转换为 RGB 颜色。 - /// - /// 青 - /// 紫 - /// 黄 - /// 黑 - /// 颜色。 - public static Color CMYKtoColor(float c, float m, float y, float k) { - return CMYKtoColor((double)c, (double)m, (double)y, (double)k); - } - - /// - /// 将四色分量(必须为 0~1)转换为 RGB 颜色。 - /// - /// 青 - /// 紫 - /// 黄 - /// 黑 - /// 颜色。 - public static Color CMYKtoColor(double c, double m, double y, double k) { - return CMYKtoColor(new CMYK(c, m, y, k)); - } - - /// - /// Converts CMYK to RGB. - /// - /// - public static Color CMYKtoColor(CMYK cmyk) { - int red = Convert.ToInt32((1 - cmyk.Cyan) * (1 - cmyk.Black) * 255); - int green = Convert.ToInt32((1 - cmyk.Magenta) * (1 - cmyk.Black) * 255); - int blue = Convert.ToInt32((1 - cmyk.Yellow) * (1 - cmyk.Black) * 255); - - return Color.FromArgb(red, green, blue); - } - - - /// - /// Converts CMYK to RGB. - /// - /// Cyan value (must be between 0 and 1). - /// Magenta value (must be between 0 and 1). - /// Yellow value (must be between 0 and 1). - /// Black value (must be between 0 and 1). - public static RGB CMYKtoRGB(double c, double m, double y, double k) { - int red = Convert.ToInt32((1.0 - c) * (1.0 - k) * 255.0); - int green = Convert.ToInt32((1.0 - m) * (1.0 - k) * 255.0); - int blue = Convert.ToInt32((1.0 - y) * (1.0 - k) * 255.0); - - return new RGB(red, green, blue); - } - - /// - /// Converts CMYK to RGB. - /// - /// - public static RGB CMYKtoRGB(CMYK cmyk) { - return CMYKtoRGB(cmyk.Cyan, cmyk.Magenta, cmyk.Yellow, cmyk.Black); - } - - - /// - /// Converts CMYK to HSL. - /// - public static HSL CMYKtoHSL(double c, double m, double y, double k) { - var rgb = CMYKtoRGB(c, m, y, k); - - return RGBtoHSL(rgb.Red, rgb.Green, rgb.Blue); - } - - /// - /// Converts CMYK to HSB. - /// - public static HSB CMYKtoHSB(double c, double m, double y, double k) { - var rgb = CMYKtoRGB(c, m, y, k); - - return RGBtoHSB(rgb.Red, rgb.Green, rgb.Blue); - } - - /// - /// Converts CMYK to YUV. - /// - public static YUV CMYKtoYUV(double c, double m, double y, double k) { - var rgb = CMYKtoRGB(c, m, y, k); - - return RGBtoYUV(rgb.Red, rgb.Green, rgb.Blue); - } - - #endregion - - #region YUV convert - /// - /// Converts YUV to RGB. - /// - /// Y must be in [0, 1]. - /// U must be in [-0.436, +0.436]. - /// V must be in [-0.615, +0.615]. - public static RGB YUVtoRGB(double y, double u, double v) { - return new RGB { - Red = Convert.ToInt32((y + 1.139837398373983740 * v) * 255), - Green = Convert.ToInt32((y - 0.3946517043589703515 * u - 0.5805986066674976801 * v) * 255), - Blue = Convert.ToInt32((y + 2.032110091743119266 * u) * 255) - }; - } - - /// - /// Converts YUV to RGB. - /// - public static RGB YUVtoRGB(YUV yuv) { - return YUVtoRGB(yuv.Y, yuv.U, yuv.V); - } - - - /// - /// Converts YUV to a .net Color. - /// - /// Y must be in [0, 1]. - /// U must be in [-0.436, +0.436]. - /// V must be in [-0.615, +0.615]. - public static Color YUVtoColor(double y, double u, double v) { - var rgb = YUVtoRGB(y, u, v); - - return Color.FromArgb(rgb.Red, rgb.Green, rgb.Blue); - } - - /// - /// Converts YUV to a .net Color. - /// - public static Color YUVtoColor(YUV yuv) { - var rgb = YUVtoRGB(yuv); - - return Color.FromArgb(rgb.Red, rgb.Green, rgb.Blue); - } - - - /// - /// Converts YUV to HSL. - /// - /// Y must be in [0, 1]. - /// U must be in [-0.436, +0.436]. - /// V must be in [-0.615, +0.615]. - public static HSL YUVtoHSL(double y, double u, double v) { - var rgb = YUVtoRGB(y, u, v); - - return RGBtoHSL(rgb.Red, rgb.Green, rgb.Blue); - } - - /// - /// Converts YUV to HSB. - /// - /// Y must be in [0, 1]. - /// U must be in [-0.436, +0.436]. - /// V must be in [-0.615, +0.615]. - public static HSB YUVtoHSB(double y, double u, double v) { - var rgb = YUVtoRGB(y, u, v); - - return RGBtoHSB(rgb.Red, rgb.Green, rgb.Blue); - } - - /// - /// Converts YUV to CMYK. - /// - /// Y must be in [0, 1]. - /// U must be in [-0.436, +0.436]. - /// V must be in [-0.615, +0.615]. - public static CMYK YUVtoCMYK(double y, double u, double v) { - var rgb = YUVtoRGB(y, u, v); - - return RGBtoCMYK(rgb.Red, rgb.Green, rgb.Blue); - } - - #endregion - - #region CIE XYZ convert - /// - /// Converts CIEXYZ to RGB structure. - /// - public static RGB XYZtoRGB(double x, double y, double z) { - var Clinear = new double[3]; - Clinear[0] = x * 3.2410 - y * 1.5374 - z * 0.4986; // red - Clinear[1] = -x * 0.9692 + y * 1.8760 - z * 0.0416; // green - Clinear[2] = x * 0.0556 - y * 0.2040 + z * 1.0570; // blue - - for (int i = 0; i < 3; i++) { - Clinear[i] = (Clinear[i] <= 0.0031308) ? 12.92 * Clinear[i] : (1 + 0.055) * Math.Pow(Clinear[i], (1.0 / 2.4)) - 0.055; - } - - return new RGB( - Convert.ToInt32(Double.Parse(String.Format("{0:0.00}", Clinear[0] * 255.0))), - Convert.ToInt32(Double.Parse(String.Format("{0:0.00}", Clinear[1] * 255.0))), - Convert.ToInt32(Double.Parse(String.Format("{0:0.00}", Clinear[2] * 255.0))) - ); - } - - /// - /// Converts CIEXYZ to RGB structure. - /// - public static RGB XYZtoRGB(CIEXYZ xyz) { - return XYZtoRGB(xyz.X, xyz.Y, xyz.Z); - } - - - /// - /// XYZ to L*a*b* transformation function. - /// - /// - /// - private static double Fxyz(double t) { - return ((t > 0.008856) ? Math.Pow(t, (1.0 / 3.0)) : (7.787 * t + 16.0 / 116.0)); - } - - /// - /// Converts CIEXYZ to CIELab structure. - /// - public static CIELab XYZtoLab(double x, double y, double z) { - var lab = CIELab.Empty; - - lab.L = 116.0 * Fxyz(y / CIEXYZ.D65.Y) - 16; - lab.A = 500.0 * (Fxyz(x / CIEXYZ.D65.X) - Fxyz(y / CIEXYZ.D65.Y)); - lab.B = 200.0 * (Fxyz(y / CIEXYZ.D65.Y) - Fxyz(z / CIEXYZ.D65.Z)); - - return lab; - } - - /// - /// Converts CIEXYZ to CIELab structure. - /// - public static CIELab XYZtoLab(CIEXYZ xyz) { - return XYZtoLab(xyz.X, xyz.Y, xyz.Z); - } - - - #endregion - - #region CIE L*a*b* convert - /// - /// Converts CIELab to CIEXYZ. - /// - public static CIEXYZ LabtoXYZ(double l, double a, double b) { - double theta = 6.0 / 29.0; - - double fy = (l + 16) / 116.0; - double fx = fy + (a / 500.0); - double fz = fy - (b / 200.0); - - return new CIEXYZ( - (fx > theta) ? CIEXYZ.D65.X * (fx * fx * fx) : (fx - 16.0 / 116.0) * 3 * (theta * theta) * CIEXYZ.D65.X, - (fy > theta) ? CIEXYZ.D65.Y * (fy * fy * fy) : (fy - 16.0 / 116.0) * 3 * (theta * theta) * CIEXYZ.D65.Y, - (fz > theta) ? CIEXYZ.D65.Z * (fz * fz * fz) : (fz - 16.0 / 116.0) * 3 * (theta * theta) * CIEXYZ.D65.Z - ); - } - - /// - /// Converts CIELab to CIEXYZ. - /// - public static CIEXYZ LabtoXYZ(CIELab lab) { - return LabtoXYZ(lab.L, lab.A, lab.B); - } - - - /// - /// Converts CIELab to RGB. - /// - public static RGB LabtoRGB(double l, double a, double b) { - return XYZtoRGB(LabtoXYZ(l, a, b)); - } - /// - /// Converts CIELab to RGB. - /// - public static RGB LabtoRGB(CIELab lab) { - return XYZtoRGB(LabtoXYZ(lab)); - } - - - #endregion - - } -} diff --git a/pdfpatcher/App/Model/ColorSpaces/HSB.cs b/pdfpatcher/App/Model/ColorSpaces/HSB.cs deleted file mode 100644 index 954d9c39702848662d53d8d49abe64eb53dc6696..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/ColorSpaces/HSB.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using System.ComponentModel; - -namespace Devcorp.Controls.Design -{ - /// - /// Structure to define HSB. - /// - public struct HSB - { - /// - /// Gets an empty HSB structure; - /// - public static readonly HSB Empty = new HSB(); - - #region Fields - private double hue; - private double saturation; - private double brightness; - #endregion - - #region Operators - public static bool operator ==(HSB item1, HSB item2) { - return ( - item1.Hue == item2.Hue - && item1.Saturation == item2.Saturation - && item1.Brightness == item2.Brightness - ); - } - - public static bool operator !=(HSB item1, HSB item2) { - return ( - item1.Hue != item2.Hue - || item1.Saturation != item2.Saturation - || item1.Brightness != item2.Brightness - ); - } - - #endregion - - #region Accessors - /// - /// Gets or sets the hue component. - /// - [Description("Hue component"),] - public double Hue { - get => hue; - set => hue = (value > 360) ? 360 : ((value < 0) ? 0 : value); - } - - /// - /// Gets or sets saturation component. - /// - [Description("Saturation component"),] - public double Saturation { - get => saturation; - set => saturation = (value > 1) ? 1 : ((value < 0) ? 0 : value); - } - - /// - /// Gets or sets the brightness component. - /// - [Description("Brightness component"),] - public double Brightness { - get => brightness; - set => brightness = (value > 1) ? 1 : ((value < 0) ? 0 : value); - } - #endregion - - /// - /// Creates an instance of a HSB structure. - /// - /// Hue value. - /// Saturation value. - /// Brightness value. - public HSB(double h, double s, double b) { - hue = (h > 360) ? 360 : ((h < 0) ? 0 : h); - saturation = (s > 1) ? 1 : ((s < 0) ? 0 : s); - brightness = (b > 1) ? 1 : ((b < 0) ? 0 : b); - } - - #region Methods - public override bool Equals(Object obj) { - if (obj == null || GetType() != obj.GetType()) return false; - - return (this == (HSB)obj); - } - - public override int GetHashCode() { - return Hue.GetHashCode() ^ Saturation.GetHashCode() ^ Brightness.GetHashCode(); - } - - #endregion - } -} diff --git a/pdfpatcher/App/Model/ColorSpaces/HSL.cs b/pdfpatcher/App/Model/ColorSpaces/HSL.cs deleted file mode 100644 index 73f3a0a8a382579816e3aed83b97ffba6695803f..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/ColorSpaces/HSL.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System; -using System.ComponentModel; - -namespace Devcorp.Controls.Design -{ - /// - /// Structure to define HSL. - /// - public struct HSL - { - /// - /// Gets an empty HSL structure; - /// - public static readonly HSL Empty = new HSL(); - - #region Fields - private double hue; - private double saturation; - private double luminance; - #endregion - - #region Operators - public static bool operator ==(HSL item1, HSL item2) { - return ( - item1.Hue == item2.Hue - && item1.Saturation == item2.Saturation - && item1.Luminance == item2.Luminance - ); - } - - public static bool operator !=(HSL item1, HSL item2) { - return ( - item1.Hue != item2.Hue - || item1.Saturation != item2.Saturation - || item1.Luminance != item2.Luminance - ); - } - - #endregion - - #region Accessors - /// - /// Gets or sets the hue component. - /// - [Description("Hue component"),] - public double Hue { - get => hue; - set => hue = (value > 360) ? 360 : ((value < 0) ? 0 : value); - } - - /// - /// Gets or sets saturation component. - /// - [Description("Saturation component"),] - public double Saturation { - get => saturation; - set => saturation = (value > 1) ? 1 : ((value < 0) ? 0 : value); - } - - /// - /// Gets or sets the luminance component. - /// - [Description("Luminance component"),] - public double Luminance { - get => luminance; - set => luminance = (value > 1) ? 1 : ((value < 0) ? 0 : value); - } - - #endregion - - /// - /// Creates an instance of a HSL structure. - /// - /// Hue value. - /// Saturation value. - /// Lightness value. - public HSL(double h, double s, double l) { - hue = (h > 360) ? 360 : ((h < 0) ? 0 : h); - saturation = (s > 1) ? 1 : ((s < 0) ? 0 : s); - luminance = (l > 1) ? 1 : ((l < 0) ? 0 : l); - } - - #region Methods - public override bool Equals(Object obj) { - if (obj == null || GetType() != obj.GetType()) return false; - - return (this == (HSL)obj); - } - - public override int GetHashCode() { - return Hue.GetHashCode() ^ Saturation.GetHashCode() ^ Luminance.GetHashCode(); - } - - #endregion - } -} diff --git a/pdfpatcher/App/Model/ColorSpaces/RGB.cs b/pdfpatcher/App/Model/ColorSpaces/RGB.cs deleted file mode 100644 index c82976a2d925316233897f4887f011f563a6b6ef..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/ColorSpaces/RGB.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.ComponentModel; - -namespace Devcorp.Controls.Design -{ - /// - /// Structure to define RGB. - /// - public struct RGB - { - /// - /// Gets an empty RGB structure; - /// - public static readonly RGB Empty = new RGB(); - - #region Fields - private int red; - private int green; - private int blue; - - #endregion - - #region Operators - public static bool operator ==(RGB item1, RGB item2) { - return ( - item1.Red == item2.Red - && item1.Green == item2.Green - && item1.Blue == item2.Blue - ); - } - - public static bool operator !=(RGB item1, RGB item2) { - return ( - item1.Red != item2.Red - || item1.Green != item2.Green - || item1.Blue != item2.Blue - ); - } - - #endregion - - #region Accessors - [Description("Red component."),] - public int Red { - get => red; - set => red = (value > 255) ? 255 : ((value < 0) ? 0 : value); - } - - [Description("Green component."),] - public int Green { - get => green; - set => green = (value > 255) ? 255 : ((value < 0) ? 0 : value); - } - - [Description("Blue component."),] - public int Blue { - get => blue; - set => blue = (value > 255) ? 255 : ((value < 0) ? 0 : value); - } - #endregion - - public RGB(int R, int G, int B) { - red = (R > 255) ? 255 : ((R < 0) ? 0 : R); - green = (G > 255) ? 255 : ((G < 0) ? 0 : G); - blue = (B > 255) ? 255 : ((B < 0) ? 0 : B); - } - - #region Methods - public override bool Equals(Object obj) { - if (obj == null || GetType() != obj.GetType()) return false; - - return (this == (RGB)obj); - } - - public override int GetHashCode() { - return Red.GetHashCode() ^ Green.GetHashCode() ^ Blue.GetHashCode(); - } - - #endregion - } -} diff --git a/pdfpatcher/App/Model/ColorSpaces/YUV.cs b/pdfpatcher/App/Model/ColorSpaces/YUV.cs deleted file mode 100644 index 78cbeb234ace8121f9e216a581bcec7370069744..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/ColorSpaces/YUV.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; - -namespace Devcorp.Controls.Design -{ - /// - /// Structure to define YUV. - /// - public struct YUV - { - /// - /// Gets an empty YUV structure. - /// - public static readonly YUV Empty = new YUV(); - - #region Fields - private double y; - private double u; - private double v; - #endregion - - #region Operators - public static bool operator ==(YUV item1, YUV item2) { - return ( - item1.Y == item2.Y - && item1.U == item2.U - && item1.V == item2.V - ); - } - - public static bool operator !=(YUV item1, YUV item2) { - return ( - item1.Y != item2.Y - || item1.U != item2.U - || item1.V != item2.V - ); - } - - #endregion - - #region Accessors - public double Y { - get => y; - set { - y = value; - y = (y > 1) ? 1 : ((y < 0) ? 0 : y); - } - } - - public double U { - get => u; - set { - u = value; - u = (u > 0.436) ? 0.436 : ((u < -0.436) ? -0.436 : u); - } - } - - public double V { - get => v; - set { - v = value; - v = (v > 0.615) ? 0.615 : ((v < -0.615) ? -0.615 : v); - } - } - - #endregion - - /// - /// Creates an instance of a YUV structure. - /// - public YUV(double y, double u, double v) { - this.y = y; - this.u = u; - this.v = v; - } - - #region Methods - public override bool Equals(Object obj) { - if (obj == null || GetType() != obj.GetType()) return false; - - return (this == (YUV)obj); - } - - public override int GetHashCode() { - return Y.GetHashCode() ^ U.GetHashCode() ^ V.GetHashCode(); - } - - #endregion - } -} diff --git a/pdfpatcher/App/Model/CoordinateTranslationSettings.cs b/pdfpatcher/App/Model/CoordinateTranslationSettings.cs deleted file mode 100644 index 0279a93fa09aa484411a894a9faf883e62482f8c..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/CoordinateTranslationSettings.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Model -{ - internal sealed class CoordinateTranslationSettings - { - internal float XScale { get; set; } - internal float YScale { get; set; } - internal float XTranslation { get; set; } - internal float YTranslation { get; set; } - - public CoordinateTranslationSettings() { - XScale = YScale = 1; - } - - public CoordinateTranslationSettings(float xScale, float yScale, float xTranslation, float yTranslation) { - XScale = xScale; - YScale = yScale; - XTranslation = xTranslation; - YTranslation = yTranslation; - } - - internal iTextSharp.text.pdf.parser.Matrix GetMatrix() { - return new iTextSharp.text.pdf.parser.Matrix(XScale, 0, 0, YScale, XTranslation, YTranslation); - } - } -} diff --git a/pdfpatcher/App/Model/DistanceInfo.cs b/pdfpatcher/App/Model/DistanceInfo.cs deleted file mode 100644 index b12bbd81d342de2f3d82c3baa20564896b0bfe73..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/DistanceInfo.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Model -{ - [System.Diagnostics.DebuggerDisplay("{Location}={Distance}")] - sealed class DistanceInfo - { - [Flags] - internal enum Placement - { - Unknown = 0, - Overlapping = 1, - Left = 2, - Right = 4, - Up = 8, - Down = 16 - } - - internal Placement Location { get; private set; } - internal float DistanceX { get; private set; } - internal float DistanceY { get; private set; } - internal bool IsOverlapping => (Location & Placement.Overlapping) != Placement.Unknown; - internal bool IsLeft => (Location & Placement.Left) != Placement.Unknown; - internal bool IsRight => (Location & Placement.Right) != Placement.Unknown; - internal bool IsAbove => (Location & Placement.Up) != Placement.Unknown; - internal bool IsBelow => (Location & Placement.Down) != Placement.Unknown; - internal bool IsVerticallyAligned => (Location & (Placement.Up | Placement.Down)) != Placement.Unknown; - internal bool IsHorizontallyAligned => (Location & (Placement.Left | Placement.Right)) != Placement.Unknown; - - internal float MinDistance => (Location & Placement.Left) != Placement.Unknown || (Location & Placement.Right) != Placement.Unknown - ? DistanceX - : (Location & Placement.Down) != Placement.Unknown || (Location & Placement.Up) != Placement.Unknown - ? DistanceY : DistanceRadial; - internal float DistanceRadial => DistanceX == Single.MaxValue || DistanceY == Single.MaxValue - ? Single.MaxValue - : (float)Math.Sqrt(DistanceX * DistanceX + DistanceY * DistanceY); - - internal DistanceInfo(Placement location, float distanceX, float distanceY) { - Location = location; - DistanceX = distanceX; - DistanceY = distanceY; - } - - } -} diff --git a/pdfpatcher/App/Model/DocumentObject.cs b/pdfpatcher/App/Model/DocumentObject.cs deleted file mode 100644 index 9a990973ea8351eff8354216389dc6b5ffc9861d..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/DocumentObject.cs +++ /dev/null @@ -1,443 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using iTextSharp.text.pdf; -using PDFPatcher.Common; -using PDFPatcher.Processor; - -namespace PDFPatcher.Model -{ - [System.Diagnostics.DebuggerDisplay("Name = {Name}({FriendlyName}); Value = {Value}; {HasChildren}")] - public sealed class DocumentObject : IHierarchicalObject - { - static readonly string[] __ReversalRefNames = new string[] { "Parent", "Prev", "First", "Last", "P" }; - static readonly int[] __CompoundTypes = new int[] { PdfObject.DICTIONARY, PdfObject.ARRAY, PdfObject.STREAM }; - static readonly DocumentObject[] __Leaf = new DocumentObject[0]; - - internal PdfPathDocument OwnerDocument { get; private set; } - internal DocumentObject Parent { get; private set; } - internal string Name { get; set; } - internal PdfObject Value { get; set; } - internal string Description { get; set; } - internal object ExtensiveObject { get; set; } - internal PdfObjectType Type { get; private set; } - internal bool IsKeyObject { get; set; } - internal object ImageKey { get; set; } - /// - /// 获取友好形式的名称。 - /// - internal string FriendlyName { get; set; } - /// - /// 获取友好形式的值。 - /// - internal string FriendlyValue { get; set; } - - public string LiteralValue => GetItemValueText(Value, ExtensiveObject as PdfObject); - public bool HasChildren { - get { - if (Type != PdfObjectType.Normal - && (Type == PdfObjectType.Trailer || Type == PdfObjectType.Pages || Type == PdfObjectType.Page || Type == PdfObjectType.PageCommands || Type == PdfObjectType.Hidden || Type == PdfObjectType.PageCommand && Children.Count > 0)) { - return true; - } - var po = Value ?? ExtensiveObject as PdfObject; - if (po == null) { - return false; - } - if (PdfHelper.CompoundTypes.Contains(po.Type)) { - return true; - } - else if (po.Type == PdfObject.INDIRECT) { - if (Type == PdfObjectType.GoToPage) { - return false; - } - var r = ExtensiveObject as PdfObject; - if (r == null) { - return false; - } - if (r.Type == PdfObject.DICTIONARY && Parent.Type == PdfObjectType.Outline && Name == "Next") { - return false; - } - return (r.Type == PdfObject.DICTIONARY && __ReversalRefNames.Contains(Name) == false - || r.Type == PdfObject.ARRAY - || r.Type == PdfObject.STREAM - ); - } - return false; - } - } - IList _Children; - public ICollection Children { - get { - if (_Children == null) { - PopulateChildren(false); - if (_Children == null) { - _Children = __Leaf; - } - } - return _Children; - } - } - - internal DocumentObject(PdfPathDocument ownerDocument, DocumentObject parent, string name, PdfObject value) : - this(ownerDocument, parent, name, value, PdfObjectType.Normal) { - } - internal DocumentObject(PdfPathDocument ownerDocument, DocumentObject parent, string name, PdfObject value, PdfObjectType type) { - OwnerDocument = ownerDocument; - Parent = parent; - if (value != null && value.Type == PdfObject.INDIRECT) { - var r = PdfReader.GetPdfObjectRelease(value); - if (r != null) { - ExtensiveObject = r; - if (r.Type == PdfObject.DICTIONARY) { - int page = ownerDocument.GetPageNumber(value as PdfIndirectReference); - if (page > 0) { - Description = String.Concat("指向第 ", page, " 页"); - type = PdfObjectType.GoToPage; - } - } - else if (r.Type == PdfObject.STREAM && PdfName.IMAGE.Equals(((PdfDictionary)r).GetAsName(PdfName.SUBTYPE))) { - type = PdfObjectType.Image; - } - } - } - Name = name; Value = value; Type = type; - } - - internal bool RemoveChildByName(string name) { - if (HasChildren == false) { - return false; - } - for (int i = _Children.Count - 1; i >= 0; i--) { - if (_Children[i].Name == name) { - if (_Children is Array) { - _Children = new List(_Children); - } - _Children.RemoveAt(i); - var po = Value; - if (po != null) { - while (po.Type == PdfObject.INDIRECT) { - po = PdfReader.GetPdfObject(po); - } - if (po.Type == PdfObject.ARRAY) { - ((PdfArray)po).Remove(i); - } - else if (po.Type == PdfObject.DICTIONARY || po.Type == PdfObject.STREAM) { - ((PdfDictionary)po).Remove(new PdfName(name)); - } - } - return true; - } - } - return false; - } - - internal DocumentObject FindReferenceAncestor() { - var d = this; - do { - if (d.Value != null && d.Value.Type == PdfObject.INDIRECT) { - return d; - } - } while ((d = d.Parent) != null); - return null; - } - - internal bool UpdateDocumentObject(object value) { - var po = Value as PdfObject; - if (po == null) { - return false; - } - switch (po.Type) { - case PdfObject.STRING: - var s = value as string; - if (s == (po as PdfString).ToUnicodeString()) { - break; - } - Value = s.ToPdfString(); - break; - case PdfObject.NUMBER: - double n; - if (((string)value).TryParse(out n)) { - Value = new PdfNumber(n); - break; - } - return false; - case PdfObject.NAME: - Value = new PdfName((string)value); break; - case PdfObject.BOOLEAN: - Value = new PdfBoolean((bool)value); break; - } - if (Parent != null) { - var pd = ((Parent.ExtensiveObject ?? Parent.Value) as PdfDictionary); - if (pd != null) { - pd.Put(new PdfName(Name), Value); - _Children = null; - return true; - } - var pa = ((Parent.ExtensiveObject ?? Parent.Value) as PdfArray); - if (pa != null) { - pa.ArrayList[Int32.Parse(Name) - 1] = Value; - _Children = null; - return true; - } - } - return false; - } - - private static string GetItemValueText(PdfObject po, PdfObject eo) { - if (po == null && eo == null) { - goto Exit; - } - if (po == null) { - po = eo; - eo = null; - } - switch (po.Type) { - case PdfObject.DICTIONARY: return String.Concat("<<", (po as PdfDictionary).Size, " 子项>>"); - case PdfObject.INDIRECT: - if (eo == null || __CompoundTypes.Contains(eo.Type)) { - return (po as PdfIndirectReference).ToString(); - } - else { - return String.Concat((po as PdfIndirectReference).ToString(), "→", GetItemValueText(null, eo)); - } - case PdfObject.NAME: return PdfHelper.DecodeKeyName(po); - case PdfObject.NUMBER: return (po as PdfNumber).DoubleValue.ToText(); - case PdfObject.STRING: return (po as PdfString).Decode(null); - case PdfObject.STREAM: goto case PdfObject.DICTIONARY; - case PdfObject.ARRAY: return PdfHelper.GetArrayString(po as PdfArray); - case PdfObject.BOOLEAN: return (po as PdfBoolean).ToString(); - case PdfObject.NULL: return "Null"; - } - Exit: - return null; - } - - internal string GetContextName() { - var d = this; - string contextName = null; - if (d.Type != PdfObjectType.Normal) { - if (d.Type == PdfObjectType.Page) { - return "Page"; - } - else if (d.Type == PdfObjectType.Image) { - return "Image"; - } - } - while ((d.IsKeyObject == false || String.IsNullOrEmpty(contextName = d.Name)) && (d = d.Parent) != null) { - } - return contextName; - } - - internal IList PopulateChildren(bool refresh) { - if (refresh) { - _Children = null; - } - if (_Children == null) { - if (Type == PdfObjectType.Page && Value == null) { - Value = OwnerDocument.Document.GetPageN((int)ExtensiveObject); - } - else if (Type != PdfObjectType.Normal) { - PopulateChildrenForSpecialObject(); - } - if (_Children == null) { - PopulateChildrenForNormalObject(); - } - } - return _Children; - } - - private void PopulateChildrenForNormalObject() { - var po = (ExtensiveObject as PdfObject) ?? Value; - _Children = __Leaf; - if (po == null) { - return; - } - if (po.Type == PdfObject.DICTIONARY || po.Type == PdfObject.STREAM) { - var pd = po as PdfDictionary; - var r = new DocumentObject[pd.Size + (Type == PdfObjectType.Page ? 1 : 0)]; - var n = 0; - foreach (var item in pd) { - var d = new DocumentObject(OwnerDocument, this, PdfHelper.DecodeKeyName(item.Key), item.Value); - r[n++] = d; - var i = Model.PdfStructInfo.GetInfo(GetContextName(), d.Name); - if (i.Name != null && i.IsKeyObject) { - d.IsKeyObject = true; - } - if (String.IsNullOrEmpty(i.ImageKey) == false) { - d.ImageKey = i.ImageKey; - } - } - if (Type != PdfObjectType.Normal) { - if (Type == PdfObjectType.Page) { - r[n++] = new DocumentObject(OwnerDocument, this, Constants.Content.Operators, null, PdfObjectType.PageCommands) { IsKeyObject = true }; - } - else if (Type == PdfObjectType.Trailer) { - var d = Array.Find(r, (o) => { return o.Name == "Root"; }); - if (d != null) { - d.Type = PdfObjectType.Root; - } - } - else if (Type == PdfObjectType.Root) { - var d = Array.Find(r, (o) => { return o.Name == "Outlines"; }); - if (d != null) { - d.Type = PdfObjectType.Outline; - } - } - else if (Type == PdfObjectType.Outline) { - var o = new List(r); - var or = pd.Get(PdfName.FIRST); - pd = PdfReader.GetPdfObject(or) as PdfDictionary; - if (pd != null) { - o.Add(new DocumentObject(OwnerDocument, this, Constants.Bookmark, or, PdfObjectType.Outline) { - Description = pd.Contains(PdfName.TITLE) ? pd.GetAsString(PdfName.TITLE).ToUnicodeString() : null - }); - while ((or = pd.Get(PdfName.NEXT)) != null && (pd = PdfReader.GetPdfObject(or) as PdfDictionary) != null) { - o.Add(new DocumentObject(OwnerDocument, this, Constants.Bookmark, or, PdfObjectType.Outline) { - Description = pd.Contains(PdfName.TITLE) ? pd.GetAsString(PdfName.TITLE).ToUnicodeString() : null - }); - } - } - _Children = o; - return; - } - } - _Children = r; - } - else if (po.Type == PdfObject.ARRAY) { - var pd = po as PdfArray; - var r = new DocumentObject[pd.Size]; - var n = 0; - foreach (var item in pd.ArrayList) { - var d = new DocumentObject(OwnerDocument, this, (++n).ToText(), item); - r[n - 1] = d; - var i = Model.PdfStructInfo.GetInfo(GetContextName(), d.Name); - if (i.Name != null && i.IsKeyObject) { - d.IsKeyObject = true; - } - if (String.IsNullOrEmpty(i.ImageKey) == false) { - d.ImageKey = i.ImageKey; - } - } - _Children = r; - } - } - - private void PopulateChildrenForSpecialObject() { - var pdf = OwnerDocument.Document; - if (Type == PdfObjectType.Pages) { - if (pdf.NumberOfPages == 0) { - return; - } - var r = PageRangeCollection.Parse(ExtensiveObject as string, 1, pdf.NumberOfPages, true); - var pn = new DocumentObject[r.TotalPages]; - var i = 0; - foreach (var item in r) { - foreach (var p in item) { - pn[i++] = new DocumentObject(OwnerDocument, this, "第" + p + "页", null, PdfObjectType.Page) { ExtensiveObject = p }; - } - } - _Children = pn; - } - else if (Type == PdfObjectType.PageCommands) { - // 解释页面指令 - var pn = (int)Parent.ExtensiveObject; - var cp = new PdfPageCommandProcessor(); - cp.ProcessContent(pdf.GetPageContent(pn), pdf.GetPageN(pn).GetAsDict(PdfName.RESOURCES)); - foreach (var item in cp.Commands) { - PopulatePageCommand(item); - } - } - else if (Type == PdfObjectType.PageCommand) { - _Children = __Leaf; - } - else if (Type == PdfObjectType.Hidden) { - var ul = PdfHelper.ListUnusedObjects(pdf, AppContext.LoadPartialPdfFile); - ExtensiveObject = ul; - var uo = new List(); - foreach (var item in ul) { - var u = pdf.GetPdfObjectRelease(item); - if (u != null) { - uo.Add(new DocumentObject(OwnerDocument, this, item.ToText(), u)); - } - } - _Children = uo; - } - } - - private void PopulatePageCommand(PdfPageCommand item) { - string fn; - var op = item.Name.ToString(); - if (PdfPageCommand.GetFriendlyCommandName(op, out fn) == false) { - fn = "未知操作符"; - } - var o = new DocumentObject(OwnerDocument, this, fn, null, PdfObjectType.PageCommand) { - FriendlyName = String.Concat(fn, "(", op, ")"), - ExtensiveObject = op - }; - if (item.Type == PdfPageCommandType.Text) { - var t = item as TextCommand; - o.FriendlyValue = t.TextInfo.PdfString.GetOriginalBytes().ToHexBinString(); - o.Description = t.TextInfo.Text; - if (item.Name.ToString() == "TJ") { - var a = item.Operands[0] as PdfArray; - if (a.Size > 0) { - var pt = item as PaceAndTextCommand; - var i = 0; - CreateChildrenList(ref o._Children); - foreach (var ti in a.ArrayList) { - var d = new DocumentObject(OwnerDocument, o, (++i).ToText(), ti); - if (ti.Type == PdfObject.STRING) { - d.FriendlyValue = (ti as PdfString).GetOriginalBytes().ToHexBinString(); - d.Description = pt.DecodedTexts[i - 1]; - } - o._Children.Add(d); - } - } - } - } - else if (item.Type == PdfPageCommandType.Font) { - var f = item as FontCommand; - o.FriendlyValue = String.Concat( - f.FontName, - " (", Constants.Content.OperandNames.ResourceName, ":", f.ResourceName.ToString(), "); ", - Constants.Content.OperandNames.Size, ":", f.FontSize.DoubleValue.ToText() - ); - } - else if (item.Type == PdfPageCommandType.Enclosure) { - if (item.Operands.HasContent()) { - var i = 0; - CreateChildrenList(ref o._Children); - foreach (var t in item.Operands) { - o._Children.Add(new DocumentObject(OwnerDocument, o, (++i).ToText(), t)); - } - } - var e = item as EnclosingCommand; - if (e.HasCommand == false) { - return; - } - foreach (var cmd in e.Commands) { - o.PopulatePageCommand(cmd); - } - } - else if (item.Type == PdfPageCommandType.InlineImage) { - var s = item.Operands[0] as PdfImageData; - CreateChildrenList(ref o._Children); - foreach (var ii in s) { - o._Children.Add(new DocumentObject(OwnerDocument, o, PdfHelper.DecodeKeyName(ii.Key), ii.Value)); - } - } - else { - o.FriendlyValue = item.GetOperandsText(); - } - CreateChildrenList(ref _Children); - _Children.Add(o); - } - - static void CreateChildrenList(ref IList list) { - if (list == null || list == __Leaf) { - list = new List(); - } - } - - } -} diff --git a/pdfpatcher/App/Model/FontInfo.cs b/pdfpatcher/App/Model/FontInfo.cs deleted file mode 100644 index 98dce7fb58d5d9ab4f4293cbba3110fca82d2cce..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/FontInfo.cs +++ /dev/null @@ -1,164 +0,0 @@ -using System; -using System.Linq; -using System.Text; -using iTextSharp.text.pdf; - -namespace PDFPatcher.Model -{ - sealed class FontInfo : CMapAwareDocumentFont - { - [Flags] - internal enum CjkFontType - { - Unknown, - CJK = 0x01, - Chinese = 0x02 + CJK, - Gb18030Chinese = 0x0100 + Chinese, - Big5Chinese = 0x0200 + Chinese, - Japanese = 0x04 + CJK, - Korean = 0x08 + CJK, - Unicode = 0x4000, - None = 0x8000 - } - - private readonly static Encoding __GbkEncoding = System.Text.Encoding.GetEncoding("gbk"); - //private readonly static Encoding __Big5Encoding = System.Text.Encoding.GetEncoding ("big5"); - private readonly static PdfName[] __GbkEncodingNames = { new PdfName("GBK-EUC-H"), new PdfName("GBK-EUC-V"), new PdfName("GB-EUC-H"), new PdfName("GB-EUC-V") }; - private readonly static string[] __gbkFontNames = { "宋体", "黑体", "楷体_GB2312", "仿宋体", "仿宋_GB2312", "隶书", "幼圆" }; - readonly static PdfName[] __IdentityEncodingNames = { new PdfName("Identity-H"), new PdfName("Identity-V") }; - public const int DefaultDefaultWidth = 1000; - - //private readonly static string[] __big5FontNames = new string[] { "MINGLIU" }; - - readonly PdfDictionary _Font; - PdfDictionary _FontDescriptor; - internal PdfDictionary FontDescriptor { - get { - if (_FontDescriptor == null) { - _FontDescriptor = _Font.Locate(PdfName.DESCENDANTFONTS).Locate(0).Locate(PdfName.FONTDESCRIPTOR); - if (_FontDescriptor == null) { - _FontDescriptor = new PdfDictionary(); - } - } - return _FontDescriptor; - } - } - string _FontName; - internal string FontName { - get { - if (_FontName == null) { - var f = FontDescriptor.GetAsName(PdfName.FONTNAME); - if (f != null) { - _FontName = PdfName.DecodeName(f.ToString()); - } - else { - var fn = PostscriptFontName; - var i = fn.LastIndexOf(','); - if (i != -1) { - fn = fn.Substring(0, i); - } - _FontName = fn; - } - // 删除子集的名称 - _FontName = PdfDocumentFont.RemoveSubsetPrefix(_FontName); - } - return _FontName; - } - } - - CjkFontType _CjkFontType = CjkFontType.Unknown; - internal CjkFontType CjkType { - get { - if (_CjkFontType == CjkFontType.Unknown) { - InitCjkFontType(); - } - return _CjkFontType; - } - } - - int _DefaultWidth = -1; - public int DefaultWidth { - get { - if (_DefaultWidth == -1) { - var w = _Font.Locate(PdfName.DESCENDANTFONTS, 0, PdfName.DW); - if (w == null) { - _DefaultWidth = DefaultDefaultWidth; - } - else { - _DefaultWidth = w.IntValue; - } - } - return _DefaultWidth; - } - } - - private void InitCjkFontType() { - if (_Font.Contains(PdfName.TOUNICODE)) { - _CjkFontType = CjkFontType.None; - return; - } - var encoding = _Font.GetAsName(PdfName.ENCODING); - var fn = FontName.ToUpperInvariant(); - var c = __gbkFontNames.Contains(fn) || __GbkEncodingNames.Contains(encoding); - //&& PdfName.WIN_ANSI_ENCODING.Equals (this.fontDict.GetAsName (PdfName.ENCODING)); - _CjkFontType = c ? CjkFontType.Chinese : CjkFontType.None; - if (_CjkFontType != CjkFontType.None) { - return; - } - c = __IdentityEncodingNames.Contains(encoding); - if (c) { - _CjkFontType = CjkFontType.Unicode; - } - //c = Common.Range.InCollection (fn, __big5FontNames); - //_CjkFontType = c ? CjkFontType.Big5Chinese : CjkFontType.None; - } - - readonly int _FontID = -1; - internal int FontID => _FontID; - - public FontInfo(PdfDictionary font, int refNumber) - : base(font) { - _Font = font; - _FontID = refNumber; - //this.DefaultWidth = _Font.Locate (PdfName.DESCENDANTFONTS).Locate (0).Locate (PdfName.FONTDESCRIPTOR).TryGetInt32 (PdfName.W, 1000); - } - public FontInfo(PRIndirectReference refFont) : base(refFont) { - _Font = (PdfDictionary)PdfReader.GetPdfObjectRelease(refFont); - _FontID = refFont.Number; - //this.DefaultWidth = _Font.Locate (PdfName.DESCENDANTFONTS).Locate (0).Locate (PdfName.FONTDESCRIPTOR).TryGetInt32 (PdfName.W, 1000); - } - - internal int DecodeCidToUnicode(int cid) { - string s; - if (AppContext.Encodings.TextEncoding != null) { - s = AppContext.Encodings.TextEncoding.GetString(new byte[] { (byte)(cid >> 8), (byte)cid }); - } - //if (CjkType == CjkFontType.Chinese) { - // s = __GbkEncoding.GetString (cid < 256 ? new byte[] { (byte)cid } : new byte[] { (byte)cid, (byte)(cid >> 8) }); - //} - //else { - s = Decode(new byte[] { (byte)(cid >> 8), (byte)cid }, 0, 2); - //} - if (s.Length == 0) { - return 0; - } - return s[0]; - } - - internal string DecodeTextBytes(byte[] bytes) { - if (AppContext.Encodings.TextEncoding != null) { - return AppContext.Encodings.TextEncoding.GetString(bytes); - } - if (CjkType == CjkFontType.Chinese) { - return __GbkEncoding.GetString(bytes); - } - //else if (CjkType == CjkFontType.Big5Chinese) { - // return __Big5Encoding.GetString (bytes); - //} - return Decode(bytes, 0, bytes.Length); - } - internal string DecodeText(PdfString text) { - return DecodeTextBytes(text.GetBytes()); - } - } -} diff --git a/pdfpatcher/App/Model/GeneralInfo.cs b/pdfpatcher/App/Model/GeneralInfo.cs deleted file mode 100644 index 80b0a3d5e309d897de0f7de6e1490237edb11fab..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/GeneralInfo.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Xml.Serialization; - -namespace PDFPatcher.Model -{ - [XmlRoot(Constants.Info.ThisName)] - public class GeneralInfo - { - [XmlAttribute("指定文档元数据属性")] - public bool SpecifyMetaData { get; set; } - [XmlAttribute("重写XML元数据属性")] - public bool RewriteXmp { get; set; } - - [XmlAttribute(Constants.Info.Title)] - public string Title { get; set; } - [XmlAttribute(Constants.Info.Author)] - public string Author { get; set; } - [XmlAttribute(Constants.Info.Subject)] - public string Subject { get; set; } - [XmlAttribute(Constants.Info.Keywords)] - public string Keywords { get; set; } - - [XmlIgnore] - public string Creator { get; set; } - [XmlIgnore] - public string Producer { get; set; } - [XmlIgnore] - public string CreationDate { get; set; } - [XmlIgnore] - public string ModDate { get; set; } - } -} diff --git a/pdfpatcher/App/Model/GraphicsState.cs b/pdfpatcher/App/Model/GraphicsState.cs deleted file mode 100644 index 4856a5aff4468193eb370ea12bc5f4a278d6b7e5..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/GraphicsState.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using iTextSharp.text.pdf; -using iTextSharp.text.pdf.parser; - -namespace PDFPatcher.Model -{ - internal sealed class GraphicsState - { - internal Matrix TransMatrix { get; set; } - internal float CharacterSpacing { get; set; } - internal float WordSpacing { get; set; } - internal float HorizontalScaling { get; set; } - internal float Leading { get; set; } - internal int FontID { get; set; } - internal FontInfo Font { get; set; } - internal float FontSize { get; set; } - internal int RenderMode { get; set; } - internal float Rise { get; set; } - internal bool KnockOut { get; set; } - - /** - * Constructs a new Graphics State object with the default values. - */ - public GraphicsState() { - TransMatrix = new Matrix(); - CharacterSpacing = 0; - WordSpacing = 0; - HorizontalScaling = 1.0f; - Leading = 0; - Font = null; - FontSize = 0; - RenderMode = 0; - Rise = 0; - KnockOut = true; - } - - public GraphicsState Copy() { - return MemberwiseClone() as GraphicsState; - } - } -} diff --git a/pdfpatcher/App/Model/IHierarchicalObject.cs b/pdfpatcher/App/Model/IHierarchicalObject.cs deleted file mode 100644 index f815926de11ed2dab6c17058965e3083f97eff3c..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/IHierarchicalObject.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Model -{ - interface IHierarchicalObject - { - bool HasChildren { get; } - ICollection Children { get; } - } -} diff --git a/pdfpatcher/App/Model/ITextRegion.cs b/pdfpatcher/App/Model/ITextRegion.cs deleted file mode 100644 index 3d5a09ae500c84f9be9285c0c2f0d46f77e498f3..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/ITextRegion.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Model -{ - interface ITextRegion - { - string Text { get; } - Bound Region { get; } - } - - interface IDirectionalBoundObject : ITextRegion - { - WritingDirection Direction { get; } - } -} diff --git a/pdfpatcher/App/Model/InsertBookmarkPositionType.cs b/pdfpatcher/App/Model/InsertBookmarkPositionType.cs deleted file mode 100644 index 6c61728942680125351e05c405b925c25f06865a..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/InsertBookmarkPositionType.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Model -{ - public enum InsertBookmarkPositionType - { - NoDefined, - AfterCurrent, - AsChild, - AfterParent, - BeforeCurrent - } -} diff --git a/pdfpatcher/App/Model/Margins.cs b/pdfpatcher/App/Model/Margins.cs deleted file mode 100644 index df2363e3751b1f3e4439652b31fad7b66bb7a140..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/Margins.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Serialization; - -namespace PDFPatcher.Model -{ - public class Margins - { - [XmlAttribute(Constants.Coordinates.Top)] - public float Top { get; set; } - [XmlAttribute(Constants.Coordinates.Right)] - public float Right { get; set; } - [XmlAttribute(Constants.Coordinates.Left)] - public float Left { get; set; } - [XmlAttribute(Constants.Coordinates.Bottom)] - public float Bottom { get; set; } - [XmlAttribute(Constants.Coordinates.ScaleFactor)] - public bool IsRelative { get; set; } - - public bool IsEmpty => Top == 0 && Bottom == 0 && Left == 0 && Right == 0; - - public Margins() { - } - - public Margins(float left, float top, float right, float bottom) { - Top = top; - Left = left; - Bottom = bottom; - Right = right; - } - } -} diff --git a/pdfpatcher/App/Model/MatchPattern.cs b/pdfpatcher/App/Model/MatchPattern.cs deleted file mode 100644 index 6dbd706c83a28bd5dfdd0eb81de63e7f5fae04c2..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/MatchPattern.cs +++ /dev/null @@ -1,167 +0,0 @@ -using System; -using System.Text.RegularExpressions; -using System.Xml; -using System.Xml.Serialization; -using PDFPatcher.Common; - -namespace PDFPatcher.Model -{ - public sealed class MatchPattern : ICloneable, IXmlSerializable - { - [XmlAttribute("名称")] - public string Name { get; set; } - - [XmlAttribute("匹配模板")] - public string Text { get; set; } - - [XmlAttribute("匹配大小写")] - public bool MatchCase { get; set; } - - [XmlAttribute("匹配全标题")] - public bool FullMatch { get; set; } - - [XmlAttribute("使用正则表达式")] - public bool UseRegularExpression { get; set; } - - public MatchPattern() { - } - - public MatchPattern(string text, bool matchCase, bool fullMatch, bool useRegExp) { - Text = text; - MatchCase = matchCase; - FullMatch = fullMatch; - UseRegularExpression = useRegExp; - } - - public IMatcher CreateMatcher() { - if (UseRegularExpression) { - return new RegexMatcher(this); - } - return new SimpleMatcher(this); - } - - public override string ToString() { - return String.IsNullOrEmpty(Name) - ? $"{(UseRegularExpression ? "正则表达式" : "文本")}{(MatchCase ? "区分大小写" : String.Empty)}匹配 {Text}" - : $"匹配{Name}"; - } - - #region ICloneable 成员 - - public object Clone() { - return new MatchPattern(Text, MatchCase, FullMatch, UseRegularExpression); - } - - #endregion - - #region IXmlSerializable 成员 - - public System.Xml.Schema.XmlSchema GetSchema() { - return null; - } - - public void ReadXml(XmlReader reader) { - if (reader.Read() == false || reader.Name != "pattern") { - return; - } - Name = reader.GetAttribute("name"); - Text = reader.GetAttribute("text"); - MatchCase = reader.GetValue("matchCase", false); - FullMatch = reader.GetValue("fullMatch", false); - UseRegularExpression = reader.GetValue("useRegex", false); - } - - public void WriteXml(XmlWriter writer) { - writer.WriteStartElement("pattern"); - writer.WriteValue("name", Name, null); - writer.WriteValue("text", Text, null); - writer.WriteValue("matchCase", MatchCase, false); - writer.WriteValue("fullMatch", FullMatch, false); - writer.WriteValue("useRegex", UseRegularExpression, false); - writer.WriteEndElement(); - } - - #endregion - - public interface IMatcher - { - bool Matches(string text); - string Replace(string text, string replacement); - } - sealed class RegexMatcher : IMatcher - { - readonly Regex _regex; - readonly bool _fullMatch; - public RegexMatcher(MatchPattern pattern) { - _regex = new Regex(pattern.Text, - RegexOptions.Compiled | RegexOptions.CultureInvariant | (pattern.MatchCase ? RegexOptions.None : RegexOptions.IgnoreCase)); - _fullMatch = pattern.FullMatch; - } - - public bool Matches(string text) { - var m = _regex.Match(text); - return m.Success && (_fullMatch == false || text.Length == m.Length); - } - public string Replace(string text, string replacement) { - return _regex.Replace(text, replacement); - } - } - sealed class SimpleMatcher : IMatcher - { - readonly bool _fullMatch; - readonly string _text; - readonly StringComparison _comparison; - - public SimpleMatcher(MatchPattern pattern) { - _text = pattern.Text; - _fullMatch = pattern.FullMatch; - _comparison = pattern.MatchCase ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase; - } - - public bool Matches(string text) { - if (String.IsNullOrEmpty(text)) { - return true; - } - if (_fullMatch && text.Length != _text.Length) { - return false; - } - var i = text.IndexOf(_text, _comparison); - return i != -1 && (_fullMatch == false || i == 0); - } - public string Replace(string text, string replacement) { - return Replace(text, _text, replacement, _comparison); - } - static string Replace(string original, string pattern, string replacement, StringComparison comparisonType) { - return Replace(original, pattern, replacement, comparisonType, -1); - } - - static string Replace(string original, string pattern, string replacement, StringComparison comparisonType, int stringBuilderInitialSize) { - if (original == null) { - return null; - } - - if (String.IsNullOrEmpty(pattern)) { - return original; - } - - var posCurrent = 0; - var lenPattern = pattern.Length; - var idxNext = original.IndexOf(pattern, comparisonType); - var result = StringBuilderCache.Acquire(stringBuilderInitialSize < 0 ? Math.Min(4096, original.Length) : stringBuilderInitialSize); - - while (idxNext >= 0) { - result.Append(original, posCurrent, idxNext - posCurrent) - .Append(replacement); - - posCurrent = idxNext + lenPattern; - - idxNext = original.IndexOf(pattern, posCurrent, comparisonType); - } - - result.Append(original, posCurrent, original.Length - posCurrent); - - return StringBuilderCache.GetStringAndRelease(result); - } - } - } -} diff --git a/pdfpatcher/App/Model/PDFStructInfo.xml b/pdfpatcher/App/Model/PDFStructInfo.xml deleted file mode 100644 index ce859a1920790848fa7a6426ff0f900eeb4624f7..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PDFStructInfo.xml +++ /dev/null @@ -1,217 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pdfpatcher/App/Model/PDFStructInfo.xsd b/pdfpatcher/App/Model/PDFStructInfo.xsd deleted file mode 100644 index cc15fe4caefb76746c9d99933729d3ebeb1c2ab2..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PDFStructInfo.xsd +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pdfpatcher/App/Model/PageBoxSettings.cs b/pdfpatcher/App/Model/PageBoxSettings.cs deleted file mode 100644 index 8b339ffbe4e0b6213e547f160c373d5eafad8996..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PageBoxSettings.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Serialization; - -namespace PDFPatcher.Model -{ - public class PageBoxSettings - { - [XmlElement("边框调整值")] - public Margins Margins { get; set; } - [XmlElement("指定尺寸")] - public PaperSize PaperSize { get; set; } - - [XmlAttribute("页码范围")] - public string PageRanges { get; set; } - [XmlAttribute("页面筛选")] - public PageFilterFlag Filter { get; set; } - ///获取或指定是否自动旋转页面适合图片纵横比。 - [XmlAttribute("自动旋转")] - [System.ComponentModel.DefaultValue(true)] - public bool AutoRotation { get; set; } - [XmlAttribute("旋转角度")] - public int Rotation { get; set; } - [XmlAttribute("拉伸内容")] - public bool ScaleContent { get; set; } - [XmlAttribute("水平对齐")] - public HorizontalAlignment HorizontalAlign { get; set; } - [XmlAttribute("垂直对齐")] - public VerticalAlignment VerticalAlign { get; set; } - [XmlAttribute("基准页面")] - public int BasePage { get; set; } - - public bool NeedResize => PaperSize.SpecialSize != SpecialPaperSize.AsPageSize; - public bool NeedAdjustMargins => Margins.IsEmpty == false; - public PageBoxSettings() { - PaperSize = new PaperSize(PaperSize.AsPageSize, 0, 0); - Margins = new Margins(); - AutoRotation = true; - } - - } - - public enum VerticalAlignment - { - Middle, Top, Bottom - } - public enum HorizontalAlignment - { - Center, Left, Right - } -} diff --git a/pdfpatcher/App/Model/PageFilterFlag.cs b/pdfpatcher/App/Model/PageFilterFlag.cs deleted file mode 100644 index 12245835650bd4d88f31840ddf5af4d6bc6eb056..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PageFilterFlag.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Model -{ - [Flags] - public enum PageFilterFlag - { - NotSpecified, - Odd = 1, - Even = 2, - Portrait = 4, - Landscape = 8, - All = Odd | Even | Portrait | Landscape - } -} diff --git a/pdfpatcher/App/Model/PageLabel.cs b/pdfpatcher/App/Model/PageLabel.cs deleted file mode 100644 index 93bfcd977ae743b1e87fd4f8321c19cdcd1ea60d..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PageLabel.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Xml.Serialization; - -namespace PDFPatcher.Model -{ - public class PageLabel - { - [XmlAttribute(Constants.PageLabelsAttributes.PageNumber)] - public int PageNumber { get; set; } - - [XmlAttribute(Constants.PageLabelsAttributes.Prefix)] - public string Prefix { get; set; } - - [XmlAttribute(Constants.PageLabelsAttributes.StartPage)] - public int StartPage { get; set; } - - [XmlAttribute(Constants.PageLabelsAttributes.Style)] - public string Style { get; set; } - - } -} diff --git a/pdfpatcher/App/Model/PageRange.cs b/pdfpatcher/App/Model/PageRange.cs deleted file mode 100644 index 88bb2dcc08b7c9b3a64e943ed061a6f03e9187df..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PageRange.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.Collections.Generic; -using PDFPatcher.Common; - -namespace PDFPatcher.Model -{ - internal struct PageRange : IEnumerable - { - public int StartValue, EndValue; - public PageRange(int startValue, int endValue) { - StartValue = startValue; - EndValue = endValue; - } - public bool Contains(int value) { - return value >= StartValue && value <= EndValue - || value >= EndValue && value <= StartValue; - } - - public override string ToString() { - return StartValue != EndValue ? String.Concat(StartValue.ToText(), '-', EndValue.ToText()) : StartValue.ToText(); - } - - /// - /// 返回范围中包含的数量。 - /// - public int Count => (EndValue > StartValue ? - EndValue - StartValue : - StartValue - EndValue) + 1; - - #region IEnumerable 成员 - - IEnumerator IEnumerable.GetEnumerator() { - return new PageRangeEnumerator(StartValue, EndValue); - } - - #endregion - - #region IEnumerable 成员 - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { - return new PageRangeEnumerator(StartValue, EndValue); - } - - #endregion - - sealed class PageRangeEnumerator : IEnumerator - { - readonly int _start, _end; - readonly bool _isIncremental; - int _Current; - - public PageRangeEnumerator(int start, int end) { - _start = start; - _isIncremental = start < end; - _end = end; - _Current = _isIncremental ? start - 1 : start + 1; - } - #region IEnumerator 成员 - - public int Current => _Current; - - #endregion - - #region IDisposable 成员 - - public void Dispose() { } - - #endregion - - #region IEnumerator 成员 - - object System.Collections.IEnumerator.Current => _Current; - - public bool MoveNext() { - if (_isIncremental && _Current < _end) { - _Current++; - return true; - } - else if (_isIncremental == false && _Current > _end) { - _Current--; - return true; - } - return false; - } - - public void Reset() { - _Current = _start < _end ? _start : _end; - } - - #endregion - } - } -} diff --git a/pdfpatcher/App/Model/PageRangeCollection.cs b/pdfpatcher/App/Model/PageRangeCollection.cs deleted file mode 100644 index 30f91c99f234502cfe687a929ed1117b469a26fc..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PageRangeCollection.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using System.Collections.Generic; -using PDFPatcher.Common; - -namespace PDFPatcher.Model -{ - internal sealed class PageRangeCollection : List - { - private PageRangeCollection() { } - - public int TotalPages { - get { - int c = 0; - foreach (var item in this) { - c += item.Count; - } - return c; - } - } - - public bool IsInRange(int value) { - foreach (var item in this) { - if (item.StartValue < item.EndValue && value >= item.StartValue && value <= item.EndValue - || value >= item.EndValue && value <= item.StartValue) { - return true; - } - } - return false; - } - - internal void Collapse(int minValue, int maxValue) { - if (maxValue < minValue) { - throw new ArgumentException("maxValue must greater than minValue"); - } - for (int i = Count - 1; i >= 0; i--) { - var r = this[i]; - SetReverseNumber(ref r.StartValue, maxValue); - SetReverseNumber(ref r.EndValue, maxValue); - if (r.StartValue < r.EndValue) { - if (r.EndValue < minValue || maxValue < r.StartValue) { - RemoveAt(i); - continue; - } - if (minValue <= r.StartValue && r.EndValue <= maxValue) { - continue; - } - if (r.StartValue < minValue) { - r.StartValue = minValue; - } - if (r.EndValue > maxValue) { - r.EndValue = maxValue; - } - } - else /*if (r.StartValue >= r.EndValue)*/ { - if (r.StartValue < minValue || maxValue < r.EndValue) { - RemoveAt(i); - continue; - } - if (maxValue >= r.StartValue && r.EndValue >= minValue) { - continue; - } - if (r.EndValue < minValue) { - r.EndValue = minValue; - } - if (r.StartValue > maxValue) { - r.StartValue = maxValue; - } - } - this[i] = r; - } - } - - internal static PageRangeCollection CreateSingle(int minValue, int maxValue) { - var r = new PageRangeCollection { - new PageRange(minValue, maxValue) - }; - return r; - } - - internal static PageRangeCollection Parse(string rangeText, int minValue, int maxValue, bool addDefaultRange) { - var r = new PageRangeCollection(); - if (String.IsNullOrEmpty(rangeText) == false) { - var ranges = rangeText.Split(',', ';', ' ', '\t'); - string startRange, endRange; - int startNum, endNum; - - foreach (string range in ranges) { - if (range.Length == 0) { - continue; - } - startNum = endNum = 0; - int rangeIndicator = range.Length > 1 ? range.IndexOf('-', 1) /*排除首位可能是负数页码的可能*/ : -1; - if (rangeIndicator > 0) { - startRange = range.Substring(0, rangeIndicator); - endRange = range.Substring(rangeIndicator + 1, range.Length - rangeIndicator - 1); - if (startRange.TryParse(out startNum) && endRange.TryParse(out endNum) && startNum != 0 && endNum != 0) { - SetReverseNumber(ref startNum, maxValue); - SetReverseNumber(ref endNum, maxValue); - if (startNum < 0 || endNum < 0) { - continue; - } - r.Add(new PageRange(startNum, endNum)); - } - } - else if (range.TryParse(out startNum)) { - SetReverseNumber(ref startNum, maxValue); - if (startNum < 0) { - continue; - } - r.Add(new PageRange(startNum, startNum)); - } - } - } - if (r.Count == 0 && addDefaultRange) { - r.Add(new PageRange(minValue, maxValue)); - } - else { - r.Collapse(minValue, maxValue); - } - return r; - } - - static void SetReverseNumber(ref int refNum, int maxNum) { - if (refNum < 0) { - refNum = refNum + maxNum + 1; - } - } - - public override string ToString() { - return String.Join(";", ConvertAll((r) => { return r.ToString(); }).ToArray()); - } - } -} diff --git a/pdfpatcher/App/Model/PageResizing.cs b/pdfpatcher/App/Model/PageResizing.cs deleted file mode 100644 index bdee9e2341db4658d2e58af9c0e931008fd0f60e..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PageResizing.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Xml.Serialization; - -namespace PDFPatcher.Model -{ - public enum PageResizing - { - [XmlEnum("保持不变")] - None = 0, - [XmlEnum("更改页面尺寸")] - Resize = 1, - [XmlEnum("拉伸页面内容")] - Scale = 2 - } - - public enum ResizingMode - { - [XmlEnum("相对调整")] - Relative = 0, - [XmlEnum("绝对调整")] - Absolute = 1, - [XmlEnum("同指定页")] - AsPage = 2 - } -} diff --git a/pdfpatcher/App/Model/PageSettings.cs b/pdfpatcher/App/Model/PageSettings.cs deleted file mode 100644 index abc53b84877f757238e1532aa9a4ba0db8306636..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PageSettings.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using System.ComponentModel; -using System.Xml.Serialization; -using iTextSharp.text.pdf; -using PDFPatcher.Common; - -namespace PDFPatcher.Model -{ - [XmlRoot(Constants.Content.Page)] - public class PageSettings - { - ///获取或指定页面范围的值。 - [XmlAttribute(Constants.PageRange)] - public string PageRange { get; set; } - ///获取或指定页面筛选的值。 - [XmlAttribute(Constants.PageFilterTypes.ThisName)] - public string Filter { get; set; } - ///获取或指定页面尺寸的值。 - [XmlAttribute(Constants.Content.PageSettings.MediaBox)] - public string PageSize { get; set; } - ///获取或指定裁剪框的值。 - [XmlAttribute(Constants.Content.PageSettings.CropBox)] - public string CropBox { get; set; } - ///获取或指定修剪框的值。 - [XmlAttribute(Constants.Content.PageSettings.TrimBox)] - public string TrimBox { get; set; } - ///获取或指定艺术框的值。 - [XmlAttribute(Constants.Content.PageSettings.ArtBox)] - public string ArtBox { get; set; } - ///获取或指定出血框的值。 - [XmlAttribute(Constants.Content.PageSettings.BleedBox)] - public string BleedBox { get; set; } - ///获取或指定旋转角度的值。 - [XmlAttribute(Constants.Content.PageSettings.Rotation)] - [DefaultValue(0)] - public int Rotation { get; set; } - - static internal PageSettings FromReader(PdfReader reader, int pageIndex, UnitConverter converter) { - iTextSharp.text.Rectangle b; - var s = new PageSettings(); - b = reader.GetPageSize(pageIndex); - s.PageSize = ConvertPageSize(b, converter); - b = reader.GetCropBox(pageIndex); - s.CropBox = (b != null) ? ConvertPageSize(b, converter) : null; - b = reader.GetBoxSize(pageIndex, "trim"); - s.TrimBox = (b != null) ? ConvertPageSize(b, converter) : null; - b = reader.GetBoxSize(pageIndex, "art"); - s.ArtBox = (b != null) ? ConvertPageSize(b, converter) : null; - b = reader.GetBoxSize(pageIndex, "bleed"); - s.BleedBox = (b != null) ? ConvertPageSize(b, converter) : null; - s.Rotation = reader.GetPageRotation(pageIndex); - return s; - } - - private static string ConvertPageSize(iTextSharp.text.Rectangle b, UnitConverter converter) { - var p = new string[4]; - p[0] = converter.FromPoint(b.Left).ToText("0.###"); - p[1] = converter.FromPoint(b.Bottom).ToText("0.###"); - p[2] = converter.FromPoint(b.Right).ToText("0.###"); - p[3] = converter.FromPoint(b.Top).ToText("0.###"); - return String.Join(" ", p); - } - - static internal bool HavingSameDimension(PageSettings s1, PageSettings s2) { - if (s1 == null && s2 == null) { - return true; - } - else if (s1 == null || s2 == null) { - return false; - } - if (s1.Rotation != s2.Rotation || s1.PageSize != s2.PageSize - || s1.CropBox != s2.CropBox || s1.TrimBox != s2.TrimBox - || s1.BleedBox != s2.BleedBox || s1.ArtBox != s2.ArtBox) { - return false; - } - return true; - } - - internal void WriteXml(System.Xml.XmlWriter writer) { - if (String.IsNullOrEmpty(PageRange)) { - System.Diagnostics.Debug.WriteLine("Empty page range."); - return; - } - writer.WriteAttributeString(Constants.PageRange, PageRange); - writer.WriteAttributeString(Constants.Content.PageSettings.MediaBox, PageSize); - if (CropBox != null) { - writer.WriteAttributeString(Constants.Content.PageSettings.CropBox, CropBox); - } - if (TrimBox != null) { - writer.WriteAttributeString(Constants.Content.PageSettings.TrimBox, TrimBox); - } - if (ArtBox != null) { - writer.WriteAttributeString(Constants.Content.PageSettings.ArtBox, ArtBox); - } - if (BleedBox != null) { - writer.WriteAttributeString(Constants.Content.PageSettings.BleedBox, BleedBox); - } - if (Rotation != 0) { - writer.WriteAttributeString(Constants.Content.PageSettings.Rotation, Rotation.ToText()); - } - } - } -} diff --git a/pdfpatcher/App/Model/PaperSize.cs b/pdfpatcher/App/Model/PaperSize.cs deleted file mode 100644 index 755c26e8ff00e9826892ccc4b3b10dd06d21c317..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PaperSize.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using System.Xml.Serialization; - -namespace PDFPatcher.Model -{ - public class PaperSize - { - public const string AsPageSize = "等同原始内容尺寸"; - public const string FixedWidthAutoHeight = "固定页宽自动高度"; - public const string AsSpecificPage = "等同指定页面尺寸"; - public const string AsWidestPage = "宽度同最宽页面,自动高度"; - public const string AsNarrowestPage = "宽度同最窄页面,自动高度"; - public const string AsLargestPage = "等同最大页面尺寸"; - public const string AsSmallestPage = "等同最小页面尺寸"; - - string _PaperName; - [XmlAttribute("名称")] - public string PaperName { - get => _PaperName; - set { - _PaperName = value; - SpecialSize = _PaperName switch { - AsPageSize => SpecialPaperSize.AsPageSize, - FixedWidthAutoHeight => SpecialPaperSize.FixedWidthAutoHeight, - AsSpecificPage => SpecialPaperSize.AsSpecificPage, - AsWidestPage => SpecialPaperSize.AsWidestPage, - AsNarrowestPage => SpecialPaperSize.AsNarrowestPage, - AsLargestPage => SpecialPaperSize.AsLargestPage, - AsSmallestPage => SpecialPaperSize.AsSmallestPage, - _ => SpecialPaperSize.None, - }; - } - } - - [XmlIgnore] - public SpecialPaperSize SpecialSize { get; private set; } - - private float _Height; - ///获取或指定页面高度的值。 - [XmlAttribute("高度")] - public float Height { - get => _Height; - set { - if (value < 0) { - throw new ArgumentException("页面高度不可小于 0。"); - } - _Height = value; - } - } - - private float _Width; - ///获取或指定页面宽度的值。 - [XmlAttribute("宽度")] - public float Width { - get => _Width; - set { - if (value < 0) { - throw new ArgumentException("页面宽度不可小于 0。"); - } - _Width = value; - } - } - - public PaperSize() { } - - public PaperSize(float width, float height) : this(null, width, height) { - } - - public PaperSize(string paperName, float width, float height) { - PaperName = paperName; - Width = width; - Height = height; - } - - internal PaperSize Scale(float xFactor, float yFactor) { - return new PaperSize(PaperName, Width * xFactor, Height * yFactor); - } - internal PaperSize Scale(float factor) { - return new PaperSize(PaperName, Width * factor, Height * factor); - } - - internal PaperSize Clone() { - return (PaperSize)MemberwiseClone(); - } - - public override string ToString() { - return PaperName; - } - - } - - public enum SpecialPaperSize - { - None, - AsPageSize, - FixedWidthAutoHeight, - AsSpecificPage, - AsWidestPage, - AsNarrowestPage, - AsLargestPage, - AsSmallestPage - } - -} diff --git a/pdfpatcher/App/Model/PdfDocumentFont.cs b/pdfpatcher/App/Model/PdfDocumentFont.cs deleted file mode 100644 index 8642a5277eb28a0989b1396b90d82fd0a06f0a0f..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PdfDocumentFont.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using iTextSharp.text.pdf; -using PDFPatcher.Processor; - -namespace PDFPatcher.Model -{ - static class PdfDocumentFont - { - /// - /// 删除字体名称的子集前缀。 - /// - /// 字体名称。 - internal static string RemoveSubsetPrefix(string name) { - return name.Length > 7 && name[6] == '+' ? name.Substring(7) : name; - } - - /// - /// 列举指定页面所用的字体。 - /// - /// 页面对应的 。 - /// 用于放置字体名称的集合。 - internal static void EnumerateFonts(PdfDictionary page, ICollection fonts) { - var fl = page.Locate(true, PdfName.RESOURCES, PdfName.FONT); - if (fl == null) { - return; - } - foreach (var item in fl) { - var fr = item.Value as PdfIndirectReference; - if (fr == null) { - continue; - } - var f = PdfReader.GetPdfObject(fr) as PdfDictionary; - var fn = f.GetAsName(PdfName.BASEFONT); - if (fn == null) { - continue; - } - fonts.Add(RemoveSubsetPrefix(PdfHelper.GetPdfNameString(fn))); - } - } - - internal static bool HasEmbeddedFont(PdfDictionary font) { - var df = font.Locate(true, PdfName.DESCENDANTFONTS); - if (df == null) { - return IsEmbeddedFont(font); - } - if (df.Type == PdfObject.ARRAY) { - foreach (var item in (df as PdfArray).ArrayList) { - if (IsEmbeddedFont(PdfReader.GetPdfObjectRelease(item) as PdfDictionary) == false) { - return false; - } - } - return true; - } - df = PdfReader.GetPdfObjectRelease(df); - return df.Type == PdfObject.DICTIONARY && IsEmbeddedFont(df as PdfDictionary); - } - - private static bool IsEmbeddedFont(PdfDictionary font) { - var fd = font.Locate(true, PdfName.FONTDESCRIPTOR); - if (fd == null) { - return false; - } - return fd.Contains(PdfName.FONTFILE) || fd.Contains(PdfName.FONTFILE2) || fd.Contains(PdfName.FONTFILE3); - } - - - } -} diff --git a/pdfpatcher/App/Model/PdfImageData.cs b/pdfpatcher/App/Model/PdfImageData.cs deleted file mode 100644 index 7d145ce15d5201a689737ac30e03dfd77a8c7947..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PdfImageData.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using iTextSharp.text.pdf; - -namespace PDFPatcher.Model -{ - internal sealed class PdfImageData : PdfDictionary - { - readonly PdfIndirectReference _pdfRef; - readonly byte[] _bytes; - public int DataType { get; private set; } - public PdfIndirectReference PdfRef => _pdfRef; - public byte[] RawBytes => _bytes; - - public PdfImageData(PRStream stream) { - foreach (var item in stream) { - Put(item.Key, item.Value); - } - _bytes = PdfReader.GetStreamBytesRaw(stream); - DataType = PdfObject.STREAM; - } - - public PdfImageData(PdfIndirectReference pdfRef) { - var s = PdfReader.GetPdfObjectRelease(pdfRef) as PRStream; - foreach (var item in s) { - Put(item.Key, item.Value); - } - _pdfRef = pdfRef; - _bytes = PdfReader.GetStreamBytesRaw(s); - DataType = PdfObject.INDIRECT; - } - - public PdfImageData(PdfDictionary source, byte[] bytes) { - foreach (var item in source) { - Put(item.Key, item.Value); - } - _bytes = bytes; - DataType = PdfObject.NULL; - } - - public override string ToString() { - return (_pdfRef != null ? String.Concat(_pdfRef.Generation, " ", _pdfRef.Number) : "<内嵌图像>") + " " + _bytes.Length; - } - } - -} diff --git a/pdfpatcher/App/Model/PdfInfoXmlDocument.cs b/pdfpatcher/App/Model/PdfInfoXmlDocument.cs deleted file mode 100644 index 0757d95bf2c55ed190e596eb38f64cf19319f064..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PdfInfoXmlDocument.cs +++ /dev/null @@ -1,388 +0,0 @@ -using System; -using System.Diagnostics; -using System.Drawing; -using System.Xml; -using PDFPatcher.Common; - -namespace PDFPatcher.Model -{ - public sealed class PdfInfoXmlDocument : XmlDocument - { - /// 返回已经初始化的 实例。 - public PdfInfoXmlDocument() { - Init(); - } - - /// 获取或设置配置文件关联的 PDF 文件路径。 - public string PdfDocumentPath { - get => DocumentElement.GetAttribute(Constants.Info.DocumentPath); - set => DocumentElement.SetAttribute(Constants.Info.DocumentPath, value); - } - - /// 返回文档信息节点。 - public DocumentInfoElement InfoNode => DocumentElement.GetOrCreateElement(Constants.Info.ThisName) as DocumentInfoElement; - - /// 返回页码标签节点。 - public XmlElement PageLabelRoot => DocumentElement.GetOrCreateElement(Constants.PageLabels); - - public XmlNodeList PageLabels => DocumentElement.SelectNodes(Constants.PageLabels + "[1]/" + Constants.PageLabelsAttributes.Style); - - /// 返回书签根节点。 - public BookmarkRootElement BookmarkRoot => DocumentElement.GetOrCreateElement(Constants.DocumentBookmark) as BookmarkRootElement; - - /// 获取根书签。 - public XmlNodeList Bookmarks => DocumentElement.SelectNodes(Constants.DocumentBookmark + "[1]/" + Constants.Bookmark); - - private void Init() { - var root = DocumentElement ?? AppendChild(CreateElement(Constants.PdfInfo)) as XmlElement; - root.SetAttribute(Constants.Info.ProductName, System.Windows.Forms.Application.ProductName); - root.SetAttribute(Constants.Info.ProductVersion, Constants.InfoDocVersion); - root.SetAttribute(Constants.Info.ExportDate, DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss")); - } - - public BookmarkElement CreateBookmark() { - return new BookmarkElement(this); - } - - public BookmarkElement CreateBookmark(BookmarkSettings settings) { - var b = new BookmarkElement(this) { - Title = settings.Title, - IsOpen = settings.IsOpened, - Action = Constants.ActionType.Goto - }; - if (settings.ForeColor.IsEmptyOrTransparent() == false) { - b.ForeColor = settings.ForeColor; - } - if (settings.IsBold || settings.IsItalic) { - b.TextStyle = (settings.IsBold ? FontStyle.Bold : FontStyle.Regular) | (settings.IsItalic ? FontStyle.Italic : FontStyle.Regular); - } - return b; - } - public PageLabelElement CreatePageLabel(MuPdfSharp.PageLabel label) { - var l = new PageLabelElement(this); - l.SetAttributes(label); - return l; - } - - public override XmlElement CreateElement(string prefix, string localName, string namespaceURI) { - if (String.IsNullOrEmpty(prefix) && String.IsNullOrEmpty(namespaceURI)) { - switch (localName) { - case Constants.Bookmark: - return new BookmarkElement(this); - case Constants.DocumentBookmark: - return new BookmarkRootElement(this); - case Constants.PageLabelsAttributes.Style: - return new PageLabelElement(this); - case Constants.Info.ThisName: - return new DocumentInfoElement(this); - } - } - return base.CreateElement(prefix, localName, namespaceURI); - } - - } - - /// 文档元数据属性元素。 - public sealed class DocumentInfoElement : XmlElement - { - internal DocumentInfoElement(XmlDocument doc) - : base(String.Empty, Constants.Info.ThisName, String.Empty, doc) { - } - public string Title { - get => this.GetValue(Constants.Info.Title); - set => this.SetValue(Constants.Info.Title, value, null); - } - public string Author { - get => this.GetValue(Constants.Info.Author); - set => this.SetValue(Constants.Info.Author, value, null); - } - public string Creator { - get => this.GetValue(Constants.Info.Creator); - set => this.SetValue(Constants.Info.Creator, value, null); - } - public string Keywords { - get => this.GetValue(Constants.Info.Keywords); - set => this.SetValue(Constants.Info.Keywords, value, null); - } - public string Producer { - get => this.GetValue(Constants.Info.Producer); - set => this.SetValue(Constants.Info.Producer, value, null); - } - public string Subject { - get => this.GetValue(Constants.Info.Subject); - set => this.SetValue(Constants.Info.Subject, value, null); - } - } - public abstract class BookmarkContainer : XmlElement - { - protected BookmarkContainer(string name, XmlDocument doc) - : base(String.Empty, name, String.Empty, doc) { - } - - /// 获取当前书签容器是否有子书签。 - public bool HasSubBookmarks => HasChildNodes && SelectSingleNode(Constants.Bookmark) != null; - - /// 获取当前书签容器的子书签。 - public XmlNodeList SubBookmarks => SelectNodes(Constants.Bookmark); - - public BookmarkElement ParentBookmark => ParentNode as BookmarkElement; - public BookmarkContainer Parent => ParentNode as BookmarkContainer; - - /// 创建新的下级书签并返回该书签。 - public BookmarkElement AppendBookmark() { - return AppendChild((OwnerDocument as PdfInfoXmlDocument).CreateBookmark()) as BookmarkElement; - } - /// 使用指定的配置创建新的书签。返回新创建的书签。 - /// 书签设置。 - public BookmarkElement AppendBookmark(BookmarkSettings settings) { - return AppendChild((OwnerDocument as PdfInfoXmlDocument).CreateBookmark(settings)) as BookmarkElement; - } - } - - /// 书签的根元素。 - public sealed class BookmarkRootElement : BookmarkContainer - { - internal BookmarkRootElement(XmlDocument doc) - : base(Constants.DocumentBookmark, doc) { - } - } - - /// 书签元素。 - [DebuggerDisplay(Constants.Bookmark + ":{Title}")] - public sealed class BookmarkElement : BookmarkContainer - { - /// 在自动生成书签时标记级别的属性。 - internal int AutoLevel = 0; - - /// 获取或设置书签的文本。 - public string Title { - get => GetAttribute(Constants.BookmarkAttributes.Title); - set => SetAttribute(Constants.BookmarkAttributes.Title, value); - } - - /// 获取或设置书签的颜色。 - public Color ForeColor { - get { - if (HasAttribute(Constants.Colors.Red) || HasAttribute(Constants.Colors.Green) || HasAttribute(Constants.Colors.Blue)) { - float r = this.GetValue(Constants.Colors.Red, 0f), - g = this.GetValue(Constants.Colors.Green, 0f), - b = this.GetValue(Constants.Colors.Blue, 0f); - return Color.FromArgb((int)(r * 255f), (int)(g * 255f), (int)(b * 255f)); - } - else if (HasAttribute(Constants.Color)) { - var a = GetAttribute(Constants.Color); - int c = a.ToInt32(Int32.MaxValue); - return c != Int32.MaxValue ? Color.FromArgb(c) : Color.FromName(a); - } - return Color.Transparent; - } - set { - RemoveAttribute(Constants.Color); - if (value == Color.Transparent) { - return; - } - SetAttribute(Constants.Color, value.ToArgb().ToText()); - } - } - - /// 获取或设置书签的文本样式。 - public FontStyle TextStyle { - get { - var s = GetAttribute(Constants.BookmarkAttributes.Style); - if (String.IsNullOrEmpty(s) == false) { - switch (s) { - case Constants.BookmarkAttributes.StyleType.Bold: return FontStyle.Bold; - case Constants.BookmarkAttributes.StyleType.Italic: return FontStyle.Italic; - case Constants.BookmarkAttributes.StyleType.BoldItalic: return FontStyle.Italic | FontStyle.Bold; - } - } - return FontStyle.Regular; - } - set { - string s; - switch (value) { - case FontStyle.Bold: - s = Constants.BookmarkAttributes.StyleType.Bold; - break; - case FontStyle.Italic: - s = Constants.BookmarkAttributes.StyleType.Italic; - break; - case FontStyle.Bold | FontStyle.Italic: - s = Constants.BookmarkAttributes.StyleType.BoldItalic; - break; - case FontStyle.Regular: - case FontStyle.Underline: - case FontStyle.Strikeout: - default: - RemoveAttribute(Constants.BookmarkAttributes.Style); - return; - } - SetAttribute(Constants.BookmarkAttributes.Style, s); - } - } - - /// 获取或设置书签的默认打开状态。 - public bool IsOpen { - get { - if (HasChildNodes == false) { - return false; - } - return GetAttribute(Constants.BookmarkAttributes.Open) == Constants.Boolean.True; - } - set { - //if (HasSubBookmarks == false) { - // return; - //} - if (value) { - SetAttribute(Constants.BookmarkAttributes.Open, Constants.Boolean.True); - } - else { - RemoveAttribute(Constants.BookmarkAttributes.Open); - } - } - } - - /// 获取或设置目标动作。 - public string Action { - get => this.GetValue(Constants.DestinationAttributes.Action, Constants.ActionType.Goto); - set => this.SetValue(Constants.DestinationAttributes.Action, value); - } - - /// 获取或设置书签的目标页面。 - public int Page { - get => this.GetValue(Constants.DestinationAttributes.Page, 0); - set { - this.SetValue(Constants.DestinationAttributes.Page, value, 0); - if (HasAttribute(Constants.DestinationAttributes.Action) == false) { - SetAttribute(Constants.DestinationAttributes.Action, Constants.ActionType.Goto); - } - } - } - - /// 返回或设置目标视图。 - public string DestinationView { - get => GetAttribute(Constants.DestinationAttributes.View); - set => this.SetValue(Constants.DestinationAttributes.View, value); - } - - /// 获取或设置 XYZ 目标视图下的缩放比例。 - public float ScaleFactor { - get => this.GetValue(Constants.Coordinates.ScaleFactor, 1f); - set { - SetAttribute(Constants.Coordinates.ScaleFactor, value.ToText()); - SetAttribute(Constants.DestinationAttributes.View, Constants.DestinationAttributes.ViewType.XYZ); - } - } - - /// 获取或设置跳转目标的上坐标。 - public float Top { - get => this.GetValue(Constants.Coordinates.Top, 0f); - set => this.SetValue(Constants.Coordinates.Top, value, 0); - } - - /// 获取或设置跳转目标的左坐标。 - public float Left { - get => this.GetValue(Constants.Coordinates.Left, 0f); - set => this.SetValue(Constants.Coordinates.Left, value, 0); - } - - /// 获取或设置跳转目标的下坐标。 - public float Bottom { - get => this.GetValue(Constants.Coordinates.Bottom, 0f); - set => this.SetValue(Constants.Coordinates.Bottom, value, 0); - } - - /// 获取或设置跳转目标的右坐标。 - public float Right { - get => this.GetValue(Constants.Coordinates.Right, 0f); - set => this.SetValue(Constants.Coordinates.Right, value, 0); - } - - public int MarkerColor { - get => this.GetValue("标记颜色", 0); - set => this.SetValue("标记颜色", value, 0); - } - internal BookmarkElement(XmlDocument doc) - : base(Constants.Bookmark, doc) { - - } - - /// 设置跳转到页面的书签动作。 - /// 书签的标题。 - /// 跳转页面。 - /// 跳转位置。 - public void SetTitleAndGotoPagePosition(string title, int pageNumber, float position) { - SetAttribute(Constants.BookmarkAttributes.Title, title); - this.SetValue(Constants.DestinationAttributes.Page, pageNumber, 0); - SetAttribute(Constants.DestinationAttributes.Action, Constants.ActionType.Goto); - if (position != 0) { - SetAttribute(Constants.DestinationAttributes.View, Constants.DestinationAttributes.ViewType.XYZ); - this.SetValue(Constants.Coordinates.Top, position, 0); - } - } - } - - /// 页码标签设置集合的根元素。 - public sealed class PageLabelRootElement : XmlElement - { - internal PageLabelRootElement(XmlDocument doc) - : base(String.Empty, Constants.DocumentBookmark, String.Empty, doc) { - } - - public XmlNodeList Labels => SelectNodes(Constants.PageLabelsAttributes.Style); - - public void Add(MuPdfSharp.PageLabel label) { - foreach (PageLabelElement item in Labels) { - if (item.PageNumber == label.FromPageNumber) { - item.SetAttributes(label); - return; - } - } - (this.AppendElement(Constants.PageLabelsAttributes.Style) as PageLabelElement).SetAttributes(label); - } - } - - /// 页码标签设置元素。 - public sealed class PageLabelElement : XmlElement - { - /// 获取或指定开始使用页码标签的绝对页码。 - public int PageNumber { - get => GetAttribute(Constants.PageLabelsAttributes.PageNumber).ToInt32(); - set => this.SetValue(Constants.PageLabelsAttributes.PageNumber, value < 1 ? 0 : value, 0); - } - public string PrefixLabel { - get => GetAttribute(Constants.PageLabelsAttributes.Prefix); - set => this.SetValue(Constants.PageLabelsAttributes.Prefix, value); - } - /// 获取或指定页码标签样式。 - public string Style { - get => GetAttribute(Constants.PageLabelsAttributes.Style); - set => this.SetValue(Constants.PageLabelsAttributes.Style, value, Constants.PageLabelStyles.Names[0]); - } - /// 获取或指定页码标签的起始编号。 - public int StartNumber { - get => GetAttribute(Constants.PageLabelsAttributes.StartPage).ToInt32(); - set => this.SetValue(Constants.PageLabelsAttributes.StartPage, value < 1 ? 0 : value, 0); - } - - internal PageLabelElement(XmlDocument doc) - : base(String.Empty, Constants.PageLabelsAttributes.Style, String.Empty, doc) { - } - - public void SetAttributes(MuPdfSharp.PageLabel label) { - this.SetValue(Constants.PageLabelsAttributes.PageNumber, label.FromPageNumber + 1, 0); - SetAttribute(Constants.PageLabelsAttributes.Style, ValueHelper.MapValue((char)label.NumericStyle, Constants.PageLabelStyles.PdfValues, Constants.PageLabelStyles.Names)); - this.SetValue(Constants.PageLabelsAttributes.StartPage, label.StartAt, 0); - this.SetValue(Constants.PageLabelsAttributes.Prefix, label.Prefix); - } - - public MuPdfSharp.PageLabel ToPageLabel() { - return new MuPdfSharp.PageLabel( - PageNumber - 1, - StartNumber, - PrefixLabel, - (MuPdfSharp.PageLabelStyle)ValueHelper.MapValue(Style, Constants.PageLabelStyles.Names, Constants.PageLabelStyles.PdfValues)); - } - } - -} diff --git a/pdfpatcher/App/Model/PdfModelHelper.cs b/pdfpatcher/App/Model/PdfModelHelper.cs deleted file mode 100644 index 3c4320047089f751c5a455e771bba4cfd885bee3..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PdfModelHelper.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using System.IO; -using System.Text; -using iTextSharp.text.pdf; - -namespace PDFPatcher.Model -{ - static class PdfModelHelper - { - internal static T Locate(this PdfDictionary source, params object[] path) where T : PdfObject { - PdfObject s = source; - if (s == null) { - return null; - } - PdfName n; - foreach (var item in path) { - n = item as PdfName; - if (s == null) { - return null; - } - if (n != null) { - if (s.Type != PdfObject.DICTIONARY && s.Type != PdfObject.STREAM) { - return null; - } - s = (s as PdfDictionary).GetDirectObject(n); - continue; - } - if (item is Int32 == false) { - throw new ArgumentException("参数类型必须为 Int32 或 PdfName"); - } - int i = (int)item; - if (s.Type != PdfObject.ARRAY) { - return null; - } - s = (s as PdfArray).GetDirectObject(i); - } - return s as T; - } - internal static T Locate(this PdfDictionary source, params PdfName[] path) where T : PdfObject { - return source.Locate(true, path); - } - internal static T Locate(this PdfDictionary source, bool resolveRef, params PdfName[] path) where T : PdfObject { - PdfObject o = null; - foreach (var item in path) { - if (source == null) { - return null; - } - o = resolveRef ? source.GetDirectObject(item) : source.Get(item); - source = o as PdfDictionary; - } - return o as T; - } - internal static T Locate(this PdfArray source, int index) where T : PdfObject { - return source.Locate(true, index); - } - internal static T Locate(this PdfArray source, bool resolveRef, int index) where T : PdfObject { - if (source == null) { - return null; - } - return (resolveRef ? source.GetDirectObject(index) : source[index]) as T; - } - internal static T CastAs(this PdfIndirectReference pdfRef) where T : PdfObject { - return PdfReader.GetPdfObject(pdfRef) as T; - } - - internal static bool ValueIs(this PdfNumber obj, double value) { - return obj != null && obj.DoubleValue == value; - } - internal static bool ValueIs(this PdfBoolean obj, bool value) { - return obj != null && obj.BooleanValue == value; - } - internal static bool ValueIs(this PdfObject obj, PdfName value) { - return value.Equals(obj); - } - - internal static int TryGetInt32(this PdfDictionary source, PdfName key, int defaultValue) { - var w = source.GetAsNumber(key); - return w?.IntValue ?? defaultValue; - } - internal static bool TryGetBoolean(this PdfDictionary source, PdfName key, bool defaultValue) { - var b = source.GetAsBoolean(key); - return b?.BooleanValue ?? defaultValue; - } - - internal static string Decode(this PdfString text, Encoding encoding) { - if (text == null) { - return String.Empty; - } - var bytes = text.GetBytes(); - using (MemoryStream ms = new MemoryStream(bytes)) { - if (encoding == null) { - if (bytes.Length >= 2 && (bytes[0] == 0xFF && bytes[1] == 0xFE || bytes[0] == 0xFE && bytes[1] == 0xFF)) { - using (TextReader r = new StreamReader(ms, true)) { - return r.ReadToEnd(); - } - } - else { - return PdfEncodings.ConvertToString(bytes, PdfObject.TEXT_PDFDOCENCODING); - } - } - else { - // 忽略字节顺序标记 - if (bytes.Length >= 2 && (bytes[0] == 0xFF && bytes[1] == 0xFE || bytes[0] == 0xFE && bytes[1] == 0xFF)) { - ms.Position += 2; - } - else if (bytes.Length >= 3 && bytes[0] == 0xef && bytes[1] == 0xbb && bytes[2] == 0xbf) { - ms.Position += 3; - } - else if (bytes.Length >= 4 && bytes[0] == 0 && bytes[1] == 0 && bytes[2] == 0xfe && bytes[3] == 0xff) { - ms.Position += 4; - } - using (TextReader r = new StreamReader(ms, encoding)) { - return r.ReadToEnd(); - } - } - } - } - - internal static PdfString ToPdfString(this string text) { - if (String.IsNullOrEmpty(text)) { - return new PdfString(); - } - bool u = false; - foreach (var c in text) { - if (c > 127) { - u = true; - break; - } - } - return u ? new PdfString(text, PdfObject.TEXT_UNICODE) : new PdfString(text); - } - } -} diff --git a/pdfpatcher/App/Model/PdfNavigator.cs b/pdfpatcher/App/Model/PdfNavigator.cs deleted file mode 100644 index d0750ad47b3f8baeaf166924f754a5d0ee16ffc5..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PdfNavigator.cs +++ /dev/null @@ -1,210 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Xml; -using System.Xml.XPath; -using iTextSharp.text.pdf; -using PDFPatcher.Common; - -namespace PDFPatcher.Model -{ - sealed class PdfNavigator : XPathNavigator - { - sealed class HtmlNameTable : XmlNameTable - { - readonly NameTable _nameTable = new NameTable(); - public override string Add(string array) { - return _nameTable.Add(array); - } - - public override string Add(char[] array, int offset, int length) { - return _nameTable.Add(array, offset, length); - } - - public override string Get(string array) { - return _nameTable.Get(array); - } - - public override string Get(char[] array, int offset, int length) { - return _nameTable.Get(array, offset, length); - } - - internal string GetOrAdd(string array) { - return Get(array) ?? Add(array); - } - } - - readonly PdfPathDocument _doc; - readonly HtmlNameTable _nameTable = new HtmlNameTable(); - DocumentObject _currentObject; - int _childIndex = -1; - - public PdfNavigator(PdfPathDocument document) { - _doc = document; - } - - public PdfNavigator(PdfNavigator source) { - _doc = source._doc; - _currentObject = source._currentObject; - } - - public PdfObject PdfObject => _currentObject.ExtensiveObject as PdfObject; - - #region XPathNavigator implementation - public override string BaseURI => String.Empty; - - public override XPathNavigator Clone() { - return new PdfNavigator(this); - } - - public override bool IsEmptyElement => !_currentObject.HasChildren; - - public override bool IsSamePosition(XPathNavigator other) { - var o = other as PdfNavigator; - if (o == null) { - return false; - } - return _currentObject == o._currentObject; - } - - public override string LocalName => _nameTable.GetOrAdd(_currentObject.FriendlyName ?? _currentObject.Name); - - public override bool MoveTo(XPathNavigator other) { - var o = other as PdfNavigator; - if (o == null) { - return false; - } - if (_doc != o._doc) { - return false; - } - _currentObject = o._currentObject; - return true; - } - - public override bool MoveToFirstAttribute() { - return false; - } - - public override bool MoveToFirstChild() { - _currentObject.PopulateChildren(false); - if (_currentObject.HasChildren == false) { - return false; - } - _childIndex = 0; - _currentObject = (_currentObject.Children as IList)[0]; - return true; - } - - public override bool MoveToFirstNamespace(XPathNamespaceScope namespaceScope) { - return false; - } - - public override bool MoveToId(string id) { - if (id.StartsWith("PAGE", StringComparison.OrdinalIgnoreCase)) { - if (id.Substring(4).TryParse(out int p) && p < _doc.PageCount) { - // 将当前对象设置为该页 - return true; - } - } - return false; - } - - public override bool MoveToNext() { - if (_currentObject.Parent == null) { - return false; - } - if (_childIndex < _currentObject.Parent.Children.Count - 1) { - _childIndex++; - _currentObject = (_currentObject.Children as IList)[_childIndex]; - return true; - } - return false; - } - - public override bool MoveToNextAttribute() { - return false; - } - - public override bool MoveToNextNamespace(XPathNamespaceScope namespaceScope) { - return false; - } - - public override bool MoveToParent() { - if (_currentObject.Parent == null) { - return false; - } - _currentObject = _currentObject.Parent; - _childIndex = -1; - return true; - } - - public override bool MoveToPrevious() { - if (_currentObject.Parent == null) { - return false; - } - if (_childIndex > 0) { - _childIndex--; - _currentObject = (_currentObject.Children as IList)[_childIndex]; - return true; - } - return false; - } - - public override string Name => _nameTable.GetOrAdd(_currentObject.Name); - - public override XmlNameTable NameTable => _nameTable; - - public override string NamespaceURI => String.Empty; - - public override XPathNodeType NodeType { - get { - switch (_currentObject.Type) { - case PdfObjectType.Normal: - var po = _currentObject.ExtensiveObject as PdfObject; - switch (po.Type) { - case PdfObject.ARRAY: - case PdfObject.DICTIONARY: - case PdfObject.STREAM: - return XPathNodeType.Element; - default: - return XPathNodeType.Attribute; - } - case PdfObjectType.Trailer: - return XPathNodeType.Root; - case PdfObjectType.Root: - case PdfObjectType.Pages: - case PdfObjectType.Page: - case PdfObjectType.Image: - case PdfObjectType.Outline: - case PdfObjectType.PageCommand: - case PdfObjectType.PageCommands: - case PdfObjectType.GoToPage: - return XPathNodeType.Element; - case PdfObjectType.Hidden: - default: - return XPathNodeType.Comment; - } - } - } - - public override string Prefix => String.Empty; - - public override string Value => _currentObject.FriendlyValue; - #endregion - - #region XPathNavigator overrides - public override void DeleteSelf() { - var p = _currentObject.Parent; - p.Children.Remove(_currentObject); - _currentObject = p; - _childIndex = (p.Parent.Children as IList).IndexOf(p); - } - - public override object UnderlyingObject => _currentObject; - - public override bool ValueAsBoolean => (PdfObject as PdfBoolean)?.BooleanValue == true; - - - #endregion - - } -} diff --git a/pdfpatcher/App/Model/PdfObjectType.cs b/pdfpatcher/App/Model/PdfObjectType.cs deleted file mode 100644 index b96a3a50e871f99961ec8f5263ed8877b7881e7b..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PdfObjectType.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace PDFPatcher -{ - internal enum PdfObjectType - { - Normal, - Trailer, - Root, - Pages, - Page, - Image, - Outline, - PageCommand, - PageCommands, - GoToPage, - Hidden - } -} \ No newline at end of file diff --git a/pdfpatcher/App/Model/PdfPageCommand.cs b/pdfpatcher/App/Model/PdfPageCommand.cs deleted file mode 100644 index 1575b58310fe2b7398dc77e9ff9131aed16bbfc5..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PdfPageCommand.cs +++ /dev/null @@ -1,309 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using iTextSharp.text.pdf; -using PDFPatcher.Common; - -namespace PDFPatcher.Model -{ - enum PdfPageCommandType - { - Normal, - Text, - Enclosure, - Matrix, - Font, - InlineImage - } - interface IPdfPageCommandContainer - { - bool HasCommand { get; } - IList Commands { get; } - } - class PdfPageCommand - { - #region 操作符中文名称 - static readonly Dictionary __OperatorNames = Init(); - static Dictionary Init() { - var d = new Dictionary { - { "'", "换行字符串" }, - { "\"", "换行字符串" }, - { "b", "闭合非零画线填充" }, - { "B", "非零画线填充" }, - { "b*", "闭合奇偶画线填充" }, - { "B*", "奇偶画线填充" }, - { "BDC", "标记内容区及属性" }, - { "BI", "内嵌图像" }, - { "BMC", "标记内容区" }, - { "BT", "文本区" }, - { "BX", "兼容区" }, - { "c", "曲线" }, - { "cm", "矩阵" }, - { "CS", "画线色域" }, - { "cs", "非线色域" }, - { "d", "虚线图案" }, - { "d0", "Type3字宽" }, - { "d1", "Type3字宽及容器" }, - { "Do", "绘制对象" }, - { "DP", "标记内容点及属性" }, - { "EI", "内嵌图像结束" }, - { "EMC", "标记内容结束" }, - { "ET", "文本区尾" }, - { "EX", "兼容区尾" }, - { "f", "非零填充" }, - { "F", "非零填充" }, - { "f*", "奇偶填充" }, - { "G", "画线灰色" }, - { "g", "非线灰色" }, - { "gs", "绘图参数" }, - { "h", "终点" }, - { "i", "平滑度容限" }, - { "ID", "内嵌图像数据" }, - { "J", "线端样式" }, - { "j", "连接线样式" }, - { "K", "画线四色" }, - { "k", "非线四色" }, - { "l", "直线" }, - { "m", "始点" }, - { "M", "斜接面上限" }, - { "MP", "标记内容点" }, - { "n", "闭合路径不填充" }, - { "q", "绘图状态" }, - { "Q", "绘图状态出栈" }, - { "re", "矩形" }, - { "RG", "画线三色" }, - { "rg", "非线三色" }, - { "ri", "颜色渲染意向" }, - { "s", "画封闭线" }, - { "S", "画线" }, - { "SC", "画线颜色" }, - { "sc", "非线颜色" }, - { "SCN", "画线颜色" }, - { "scn", "非线颜色" }, - { "sh", "阴影" }, - { "T*", "换行" }, - { "Tc", "字距" }, - { "Td", "换行" }, - { "TD", "换行" }, - { "Tf", "字体" }, - { "Tj", "字符串" }, - { "TJ", "字符串" }, - { "Tk", "单独字符渲染" }, - { "TL", "行距" }, - { "Tm", "文本矩阵" }, - { "Tr", "文本渲染" }, - { "Ts", "文本垂直偏移" }, - { "Tw", "词距" }, - { "Tz", "文本水平拉伸" }, - { "v", "控尾曲线" }, - { "w", "线宽" }, - { "W", "非零裁剪" }, - { "W*", "奇偶裁剪" }, - { "y", "控首曲线" } - }; - return d; - } - #endregion - - public virtual PdfLiteral Name { get; } - public PdfObject[] Operands { get; } - public virtual PdfPageCommandType Type => PdfPageCommandType.Normal; - internal bool HasOperand => Operands?.Length > 0; - - public PdfPageCommand(PdfLiteral oper, List operands) { - Name = oper; - if (operands?.Count > 0) { - Operands = new PdfObject[operands[operands.Count - 1] is PdfLiteral ? operands.Count - 1 : operands.Count]; - operands.CopyTo(0, Operands, 0, Operands.Length); - } - } - - internal static PdfPageCommand Create(string name, params PdfObject[] operands) { - return new PdfPageCommand(new PdfLiteral(name), new List(operands)); - } - - internal virtual void WriteToPdf(System.IO.Stream target) { - if (Operands != null) { - foreach (var oi in Operands) { - WriteOperand(oi, target); - } - } - WriteOperator(Name, target); - } - - protected static void WriteOperand(PdfObject operand, Stream target) { - operand.ToPdf(null, target); - target.WriteByte((byte)' '); - } - - protected static void WriteOperator(PdfLiteral opName, Stream target) { - opName.ToPdf(null, target); - target.WriteByte((byte)'\n'); - } - - internal static bool GetFriendlyCommandName(string oper, out string friendlyName) { - return __OperatorNames.TryGetValue(oper, out friendlyName); - } - - internal string GetOperandsText() { - return Operands != null ? Processor.PdfHelper.GetArrayString(Operands) : null; - } - } - - sealed class EnclosingCommand : PdfPageCommand, IPdfPageCommandContainer - { - const string BQ = "q"; - const string BT = "BT"; - const string BDC = "BDC"; - const string BMC = "BMC"; - const string BX = "BX"; - const string EQ = "Q"; - const string ET = "ET"; - const string EMC = "EMC"; - const string EX = "EX"; - - static readonly string[] __StartEnclosingCommands = new string[] { BQ, BT, BDC, BMC, BX }; - static readonly string[] __EndEnclosingCommands = new string[] { EQ, ET, EMC, EX }; - static readonly PdfLiteral[] __EnclosingCommands = new PdfLiteral[] { - new PdfLiteral(EQ), - new PdfLiteral(ET), - new PdfLiteral(EMC), - new PdfLiteral(EMC), - new PdfLiteral(EX) - }; - - public bool HasCommand => Commands.Count > 0; - public IList Commands { get; } - public override PdfPageCommandType Type => PdfPageCommandType.Enclosure; - public EnclosingCommand(PdfLiteral oper, List operands) - : base(oper, operands) { - Commands = new List(); - } - - internal static EnclosingCommand Create(string name, IEnumerable operands, params PdfPageCommand[] subCommands) { - var c = new EnclosingCommand(new PdfLiteral(name), operands != null ? new List(operands) : null); - ((List)c.Commands).AddRange(subCommands); - return c; - } - - internal override void WriteToPdf(Stream target) { - base.WriteToPdf(target); - if (HasCommand) { - foreach (var cmd in Commands) { - cmd.WriteToPdf(target); - } - } - WriteOperator(ValueHelper.MapValue(Name.ToString(), __StartEnclosingCommands, __EnclosingCommands), target); - } - - internal static bool IsStartingCommand(string oper) { - return __StartEnclosingCommands.Contains(oper); - } - internal static bool IsEndingCommand(string oper) { - return __EndEnclosingCommands.Contains(oper); - } - } - - class TextCommand : PdfPageCommand - { - public TextInfo TextInfo { get; private set; } - public override PdfPageCommandType Type => PdfPageCommandType.Text; - public TextCommand(PdfLiteral oper, List operands, TextInfo text) - : base(oper, operands) { - TextInfo = text; - } - } - - sealed class PaceAndTextCommand : TextCommand - { - public string[] DecodedTexts { get; private set; } - public PaceAndTextCommand(PdfLiteral oper, List operands, TextInfo text, FontInfo font) - : base(oper, operands, text) { - var a = base.Operands[0] as PdfArray; - DecodedTexts = new string[a.Size]; - int i = 0; - foreach (var item in a.ArrayList) { - if (item.Type == PdfObject.STRING) { - DecodedTexts[i] = font.DecodeText(item as PdfString); - } - ++i; - } - text.Text = String.Concat(DecodedTexts); - } - } - - sealed class MatrixCommand : PdfPageCommand - { - public static PdfLiteral CM = new PdfLiteral("cm"); - public static PdfLiteral TM = new PdfLiteral("Tm"); - public override PdfPageCommandType Type => PdfPageCommandType.Matrix; - public MatrixCommand(PdfLiteral oper, List operands) - : base(oper, operands) { - } - public MatrixCommand(PdfLiteral oper, float a, float b, float c, float d, float e, float f) - : base(oper, new List(6) { - new PdfNumber (a), new PdfNumber(b), - new PdfNumber (c), new PdfNumber (d), - new PdfNumber (e), new PdfNumber(f) - }) { - } - public void Multiply(double[] matrix) { - var m1 = Array.ConvertAll(Operands, (i) => { return (i as PdfNumber).DoubleValue; }); - Operands[0] = new PdfNumber(m1[0] * matrix[0] + m1[1] * matrix[2]); - Operands[1] = new PdfNumber(m1[0] * matrix[1] + m1[1] * matrix[3]); - Operands[2] = new PdfNumber(m1[2] * matrix[0] + m1[3] * matrix[2]); - Operands[3] = new PdfNumber(m1[2] * matrix[1] + m1[3] * matrix[3]); - Operands[4] = new PdfNumber(m1[4] * matrix[0] + m1[5] * matrix[2] + matrix[4]); - Operands[5] = new PdfNumber(m1[4] * matrix[1] + m1[5] * matrix[3] + matrix[5]); - } - } - - sealed class FontCommand : PdfPageCommand - { - public FontCommand(PdfLiteral oper, List operands, string fontName) - : base(oper, operands) { - FontName = fontName; - } - - public string FontName { get; } - public PdfName ResourceName { - get => Operands[0] as PdfName; - set => Operands[0] = value; - } - public PdfNumber FontSize { - get => Operands[1] as PdfNumber; - set => Operands[1] = value; - } - public override PdfPageCommandType Type => PdfPageCommandType.Font; - } - - sealed class InlineImageCommand : PdfPageCommand - { - //static readonly PdfName __DCT = new PdfName ("DCT"); - //static readonly PdfName __CCF = new PdfName ("CCF"); - static readonly PdfLiteral __ID = new PdfLiteral("ID"); - static readonly PdfLiteral __EI = new PdfLiteral("EI"); - - public InlineImageCommand(PdfLiteral oper, List operands) : base(oper, operands) { - } - - public PdfImageData Image => Operands[0] as PdfImageData; - public override PdfPageCommandType Type => PdfPageCommandType.InlineImage; - - internal override void WriteToPdf(Stream target) { - var img = Image; - WriteOperator(Name, target); - foreach (var item in img) { - item.Key.ToPdf(null, target); - target.WriteByte((byte)' '); - item.Value.ToPdf(null, target); - target.WriteByte((byte)'\n'); - } - WriteOperator(__ID, target); - target.Write(img.RawBytes, 0, img.RawBytes.Length); - target.WriteByte((byte)'\n'); - WriteOperator(__EI, target); - } - } -} diff --git a/pdfpatcher/App/Model/PdfPath/Context.cs b/pdfpatcher/App/Model/PdfPath/Context.cs deleted file mode 100644 index 50bc90467ca6af7d105b2835c8cd957db9a2b389..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PdfPath/Context.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Model.PdfPath -{ - sealed class Context - { - public DocumentObject Current { get; private set; } - public int Position { get; private set; } - - public Context(DocumentObject currentObject, int position) { - Current = currentObject; - Position = position; - } - } -} diff --git a/pdfpatcher/App/Model/PdfPath/IPathAxis.cs b/pdfpatcher/App/Model/PdfPath/IPathAxis.cs deleted file mode 100644 index dc136e6f35c7e508c499d60b347e9e7b2b91b13d..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PdfPath/IPathAxis.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Model.PdfPath -{ - public interface IPathAxis - { - PathAxisType Type { get; } - DocumentObject SelectObject(DocumentObject source, string name, IEnumerable predicates); - IList SelectObjects(DocumentObject source, string name, IEnumerable predicates); - } - -} diff --git a/pdfpatcher/App/Model/PdfPath/IPathExpression.cs b/pdfpatcher/App/Model/PdfPath/IPathExpression.cs deleted file mode 100644 index be8b8c6bbeb166268f4cd3ec1c7ce5884c3e2db3..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PdfPath/IPathExpression.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using PDFPatcher.Model; - -namespace PDFPatcher.Model.PdfPath -{ - public interface IPathExpression : IPathValue - { - IList Predicates { get; } - IPathAxis Axis { get; } - string Name { get; } - DocumentObject SelectObject(DocumentObject source); - IList SelectObjects(DocumentObject source); - } - - public class PathExpression : IPathExpression - { - internal static readonly IList EmptyMatchResult = new DocumentObject[0]; - - #region IPathExpression 成员 - public PathValueType ValueType => PathValueType.Expression; - - public IPathAxis Axis { get; private set; } - - public string Name { get; private set; } - - private IList _Predicates; - ///获取匹配条件列表。 - public IList Predicates { - get { - if (_Predicates == null) - _Predicates = new List(); - return _Predicates; - } - } - - public DocumentObject SelectObject(DocumentObject source) { - return Axis.SelectObject(source, Name, Predicates); - } - - public IList SelectObjects(DocumentObject source) { - return Axis.SelectObjects(source, Name, _Predicates); - } - - #endregion - - public PathExpression(PathAxisType axis) { - Axis = PathAxes.Create(axis); - } - public PathExpression(PathAxisType axis, string name) { - Axis = PathAxes.Create(axis); - Name = name; - } - - - } - -} diff --git a/pdfpatcher/App/Model/PdfPath/IPathFunction.cs b/pdfpatcher/App/Model/PdfPath/IPathFunction.cs deleted file mode 100644 index 09eee8e3781b00c07be1f7bc329d1ac1ea51e7a4..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PdfPath/IPathFunction.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Model.PdfPath -{ - interface IPathFunction - { - object Evaluate(DocumentObject source); - } - - sealed class CurrentPosition : IPathFunction - { - #region IPathFunction 成员 - - public object Evaluate(DocumentObject source) { - if (source == null || source.Parent == null) { - return 0; - } - int i = 0; - foreach (var item in source.Parent.Children) { - ++i; - if (item == source) { - return i; - } - } - return i; - } - - #endregion - } -} diff --git a/pdfpatcher/App/Model/PdfPath/IPathPredicate.cs b/pdfpatcher/App/Model/PdfPath/IPathPredicate.cs deleted file mode 100644 index 108160d4e75c73074968395cd9fa46fe28f1477d..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PdfPath/IPathPredicate.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Model.PdfPath -{ - public interface IPathPredicate - { - PredicateOperatorType Operator { get; } - IPathExpression Operand1 { get; } - IPathExpression Operand2 { get; } - bool Match(DocumentObject source, IPathValue value1, IPathValue value2); - } - - abstract class PathPredicate : IPathPredicate - { - #region IPathPredicate 成员 - - public abstract PredicateOperatorType Operator { get; } - - public IPathExpression Operand1 { get; internal set; } - - public IPathExpression Operand2 { get; internal set; } - - public abstract bool Match(DocumentObject source, IPathValue value1, IPathValue value2); - - #endregion - - protected PathPredicate(IPathExpression operand1, IPathExpression operand2) { - Operand1 = operand1; - Operand2 = operand2; - } - - sealed class ContainmentPredicate : PathPredicate - { - public ContainmentPredicate(IPathExpression operand1, IPathExpression operand2) - : base(operand1, operand2) { - } - - public override PredicateOperatorType Operator => PredicateOperatorType.Contains; - - public override bool Match(DocumentObject source, IPathValue value1, IPathValue value2) { - if (value1.ValueType == PathValueType.Expression) { - var exp = value1 as IPathExpression; - return exp.SelectObjects(source).Count > 0; - } - return false; - } - } - - class EqualityPredicate : PathPredicate - { - public override PredicateOperatorType Operator => PredicateOperatorType.Equal; - - public EqualityPredicate(IPathExpression operand1, IPathExpression operand2) - : base(operand1, operand2) { - } - - public override bool Match(DocumentObject source, IPathValue value1, IPathValue value2) { - if (value1.ValueType == PathValueType.Expression) { - var exp = value1 as IPathExpression; - var cv = value2 as IConstantPathValue; - string v; - if (cv != null) { - v = cv.LiteralValue; - } - else { - var o = (value2 as IPathExpression).SelectObject(source); - v = o != null ? (o.FriendlyValue ?? o.LiteralValue) : String.Empty; - } - foreach (var item in exp.SelectObjects(source)) { - if ((item.FriendlyValue ?? item.LiteralValue) == v) { - return true; - } - } - return false; - } - else if (value1.ValueType == PathValueType.Number || value2.ValueType == PathValueType.Number) { - return PathValue.ToNumber(source, value1) == PathValue.ToNumber(source, value2); - } - else if (value1.ValueType == PathValueType.String || value2.ValueType == PathValueType.String) { - return PathValue.ToString(source, value1) == PathValue.ToString(source, value2); - } - else { - return PathValue.ToBoolean(source, value1) == PathValue.ToBoolean(source, value2); - } - } - } - - sealed class InequalityPredicate : EqualityPredicate - { - public InequalityPredicate(IPathExpression operand1, IPathExpression operand2) - : base(operand1, operand2) { - } - public override PredicateOperatorType Operator => PredicateOperatorType.NotEqual; - public override bool Match(DocumentObject source, IPathValue value1, IPathValue value2) { - return !base.Match(source, value1, value2); - } - } - } - -} diff --git a/pdfpatcher/App/Model/PdfPath/IPathValue.cs b/pdfpatcher/App/Model/PdfPath/IPathValue.cs deleted file mode 100644 index 10868dc28a0a8831265a05df80ecf9bee8d01b6d..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PdfPath/IPathValue.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Model.PdfPath -{ - public interface IPathValue - { - PathValueType ValueType { get; } - } - - public interface IConstantPathValue : IPathValue - { - string LiteralValue { get; } - } - -} diff --git a/pdfpatcher/App/Model/PdfPath/PathAxes.cs b/pdfpatcher/App/Model/PdfPath/PathAxes.cs deleted file mode 100644 index 3ebf03e73453ab619efa9dac1998c0bb619fdcc7..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PdfPath/PathAxes.cs +++ /dev/null @@ -1,250 +0,0 @@ -using System; -using System.Collections.Generic; -using PDFPatcher.Common; - -namespace PDFPatcher.Model.PdfPath -{ - static class PathAxes - { - static bool MatchesPredicate(DocumentObject source, string name, IEnumerable predicates) { - if (source == null) { - return false; - } - if (name != null && (source.FriendlyName ?? source.Name) != name) { - return false; - } - if (predicates == null) { - return true; - } - foreach (var p in predicates) { - if (p.Match(source, p.Operand1, p.Operand2) == false) { - return false; - } - } - return true; - } - static IList CompriseSingleObjectCollection(DocumentObject source) { - return source == null ? PathExpression.EmptyMatchResult : new DocumentObject[] { source }; - } - - private static string GetLiteralValue(object operand) { - return operand switch { - null => String.Empty, - string t => t, - DocumentObject o => o.FriendlyValue ?? o.LiteralValue, - IList l when l.Count > 0 => l[0].FriendlyValue ?? l[0].LiteralValue, - IList l => String.Empty, - _ => ((double)operand).ToText() - }; - } - - static readonly SelfAxis __Self = new SelfAxis(); - static readonly ParentAxis __Parent = new ParentAxis(); - static readonly ChildrenAxis __Children = new ChildrenAxis(); - static readonly RootAxis __Root = new RootAxis(); - static readonly AncestorsAxis __Ancestors = new AncestorsAxis(); - static readonly DescendantsAxis __Descendants = new DescendantsAxis(); - - sealed class SelfAxis : IPathAxis - { - #region IPathAxis 成员 - - public PathAxisType Type => PathAxisType.None; - - public DocumentObject SelectObject(DocumentObject source, string name, IEnumerable predicates) { - return source != null && MatchesPredicate(source, name, predicates) ? source : null; - } - - public IList SelectObjects(DocumentObject source, string name, IEnumerable predicates) { - return CompriseSingleObjectCollection(SelectObject(source, name, predicates)); - } - - #endregion - } - - sealed class ParentAxis : IPathAxis - { - #region IPathAxis 成员 - - public PathAxisType Type => PathAxisType.Parent; - - public DocumentObject SelectObject(DocumentObject source, string name, IEnumerable predicates) { - return source != null && MatchesPredicate(source, name, predicates) ? source.Parent : null; - } - - public IList SelectObjects(DocumentObject source, string name, IEnumerable predicates) { - return CompriseSingleObjectCollection(SelectObject(source, name, predicates)); - } - - #endregion - } - - sealed class ChildrenAxis : IPathAxis - { - #region IPathAxis 成员 - - public PathAxisType Type => PathAxisType.Children; - - public DocumentObject SelectObject(DocumentObject source, string name, IEnumerable predicates) { - if (source == null || !source.HasChildren) { - return null; - } - - var r = new List(); - foreach (var item in source.Children) { - if (MatchesPredicate(item, name, predicates)) { - return item; - } - } - return null; - } - - public IList SelectObjects(DocumentObject source, string name, IEnumerable predicates) { - if (source != null && source.HasChildren) { - var r = new List(); - foreach (var item in source.Children) { - if (MatchesPredicate(item, name, predicates)) { - r.Add(item); - } - } - return r.ToArray(); - } - else { - return PathExpression.EmptyMatchResult; - } - } - - #endregion - } - - sealed class RootAxis : IPathAxis - { - #region IPathAxis 成员 - - public PathAxisType Type => PathAxisType.Root; - - public DocumentObject SelectObject(DocumentObject source, string name, IEnumerable predicates) { - if (source == null) { - return null; - } - while (source.Parent != null) { - source = source.Parent; - } - if (MatchesPredicate(source, name, predicates)) { - return source; - } - return null; - } - - public IList SelectObjects(DocumentObject source, string name, IEnumerable predicates) { - return CompriseSingleObjectCollection(SelectObject(source, name, predicates)); - } - - #endregion - } - - sealed class AncestorsAxis : IPathAxis - { - #region IPathAxis 成员 - - public PathAxisType Type => PathAxisType.Ancestors; - - public DocumentObject SelectObject(DocumentObject source, string name, IEnumerable predicates) { - if (source == null) { - return null; - } - var r = new List(); - while (source.Parent != null) { - source = source.Parent; - if (MatchesPredicate(source, name, predicates)) { - return source; - } - } - return null; - } - - public IList SelectObjects(DocumentObject source, string name, IEnumerable predicates) { - if (source == null) { - return PathExpression.EmptyMatchResult; - } - var r = new List(); - while (source.Parent != null) { - source = source.Parent; - if (MatchesPredicate(source, name, predicates)) { - r.Add(source); - } - } - return r.ToArray(); - } - - #endregion - } - - sealed class DescendantsAxis : IPathAxis - { - void SelectObjects(DocumentObject source, string name, IEnumerable predicates, List list) { - if (source == null || source.HasChildren == false) { - return; - } - foreach (var item in source.Children) { - if (MatchesPredicate(item, name, predicates)) { - list.Add(item); - } - SelectObjects(item, name, predicates, list); - } - } - - #region IPathAxis 成员 - - public PathAxisType Type => PathAxisType.Descendants; - - public DocumentObject SelectObject(DocumentObject source, string name, IEnumerable predicates) { - if (source == null || source.HasChildren == false) { - return null; - } - foreach (var item in source.Children) { - if (MatchesPredicate(item, name, predicates)) { - return item; - } - DocumentObject o; - if ((o = SelectObject(item, name, predicates)) != null) { - return o; - } - } - return null; - } - - public IList SelectObjects(DocumentObject source, string name, IEnumerable predicates) { - if (source == null || source.HasChildren == false) { - return PathExpression.EmptyMatchResult; - } - var r = new List(); - foreach (var item in source.Children) { - if (MatchesPredicate(item, name, predicates)) { - r.Add(item); - SelectObjects(item, name, predicates, r); - } - } - return r.ToArray(); - } - - #endregion - } - - public static IPathAxis Create(PathAxisType axisType) { - switch (axisType) { - case PathAxisType.None: return __Self; - case PathAxisType.Children: return __Children; - case PathAxisType.Parent: return __Parent; - case PathAxisType.Ancestors: return __Ancestors; - case PathAxisType.Descendants: return __Descendants; - case PathAxisType.Root: return __Root; - case PathAxisType.Previous: - case PathAxisType.Next: - default: break; - } - return __Children; - } - } - -} diff --git a/pdfpatcher/App/Model/PdfPath/PathAxisType.cs b/pdfpatcher/App/Model/PdfPath/PathAxisType.cs deleted file mode 100644 index f9d44e06eeb901a9fa9b532872965294dfc2170f..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PdfPath/PathAxisType.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace PDFPatcher.Model.PdfPath -{ - public enum PathAxisType - { - None, - Children, - Parent, - Ancestors, - Descendants, - Root, - Previous, - Next - } -} diff --git a/pdfpatcher/App/Model/PdfPath/PathCompiler.cs b/pdfpatcher/App/Model/PdfPath/PathCompiler.cs deleted file mode 100644 index 238f76bad6c29dd9c7bce61a247424cf17b06a98..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PdfPath/PathCompiler.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace PDFPatcher.Model.PdfPath -{ - class PathCompiler - { - const char PathSeparator = '/'; - const char SelfChar = '.'; - const char UniversalName = '*'; - const char StartPredicate = '['; - const char EndPredicate = ']'; - - static readonly char[] __PredicateChars = new char[] { StartPredicate, EndPredicate }; - - sealed class Context - { - internal bool CanBeRoot { get; set; } - internal PathAxisType Axis { get; set; } - } - - public static IEnumerable Compile(string path) { - var r = new Queue(); - if (String.IsNullOrEmpty(path)) { - return r.ToArray(); - } - var l = path.Length; - var i = 0; - string n; - var ctx = new Context(); - while (i < l) { - ctx.Axis = ExtractAxis(path, l, ctx.CanBeRoot, ref i); - if (ctx.Axis == PathAxisType.Root) { - ctx.CanBeRoot = false; - r.Enqueue(new PathExpression(ctx.Axis)); - continue; - } - n = ExtractName(path, l, ref i); - r.Enqueue(new PathExpression(ctx.Axis, n)); - } - return r.ToArray(); - } - - private static PathAxisType ExtractAxis(string path, int length, bool canBeRoot, ref int index) { - char c = path[index]; - if (__PredicateChars.Contains(c)) { - throw new FormatException("“[]”筛选表达式前缺少节点轴及节点名称标识。"); - } - - if (c == PathSeparator) { - if (MatchNextChar(path, length, index, PathSeparator)) { - ++index; - return PathAxisType.Descendants; - } - else if (canBeRoot) { - return PathAxisType.Root; - } - else { - return PathAxisType.Children; - } - } - else if (c == SelfChar) { - if (MatchNextChar(path, length, index, SelfChar)) { - ++index; - return PathAxisType.Parent; - } - else { - return PathAxisType.None; - } - } - else { - return PathAxisType.Children; - } - } - - private static string ExtractName(string path, int length, ref int index) { - char c = path[index]; - if (__PredicateChars.Contains(c)) { - throw new FormatException("“[]”筛选表达式前缺少节点名称。"); - } - if (c == UniversalName) { - return null; - } - var n = new List(); - while (Char.IsLetter(c) || n.Count > 0 && Char.IsLetterOrDigit(c)) { - n.Add(c); - ++index; - if (index < length) { - c = path[index]; - } - else { - break; - } - } - return n.Count > 0 ? new String(n.ToArray()) : null; - } - - private static bool MatchNextChar(string path, int length, int index, char ch) { - return index + 1 < length && path[index + 1] == ch; - } - } -} diff --git a/pdfpatcher/App/Model/PdfPath/PathValue.cs b/pdfpatcher/App/Model/PdfPath/PathValue.cs deleted file mode 100644 index 816527a667e27dd0b7f3d5f1b14dd200601dafa6..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PdfPath/PathValue.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using PDFPatcher.Common; - -namespace PDFPatcher.Model.PdfPath -{ - public static class PathValue - { - public static double ToNumber(DocumentObject source, IPathValue value) { - double d; - switch (value.ValueType) { - case PathValueType.Expression: - var p = (value as IPathExpression).SelectObject(source); - if (p == null) { - return Double.NaN; - } - return Double.TryParse(p.FriendlyValue ?? p.LiteralValue, out d) ? d : Double.NaN; - case PathValueType.String: - return Double.TryParse((value as PathStringValue).Value, out d) ? d : Double.NaN; - case PathValueType.Number: - return (value as PathNumberValue).Value; - case PathValueType.Boolean: - return (value as PathBooleanValue).Value ? 1 : 0; - default: - return Double.NaN; - } - } - - public static string ToString(DocumentObject source, IPathValue value) { - switch (value.ValueType) { - case PathValueType.Expression: - var p = (value as IPathExpression).SelectObject(source); - if (p == null) { - return String.Empty; - } - return p.FriendlyValue ?? p.LiteralValue ?? String.Empty; - case PathValueType.String: - return (value as PathStringValue).Value; - case PathValueType.Number: - return (value as PathNumberValue).Value.ToText(); - case PathValueType.Boolean: - return (value as PathBooleanValue).ToString(); - default: - return String.Empty; - } - } - - public static bool ToBoolean(DocumentObject source, IPathValue value) { - switch (value.ValueType) { - case PathValueType.Expression: - return (value as IPathExpression).SelectObject(source) != null; - case PathValueType.String: - return (value as PathStringValue).Value.Length > 0; - case PathValueType.Number: - return (value as PathNumberValue).Value != 0; - case PathValueType.Boolean: - return (value as PathBooleanValue).Value; - default: - return false; - } - } - - - sealed class PathStringValue : IConstantPathValue - { - public PathValueType ValueType => PathValueType.String; - - public string Value { get; private set; } - - public string LiteralValue => Value; - - public PathStringValue(string value) { - Value = value; - } - } - - sealed class PathNumberValue : IConstantPathValue - { - public PathValueType ValueType => PathValueType.Number; - - public double Value { get; private set; } - - public string LiteralValue => Value.ToText(); - - public PathNumberValue(double value) { - Value = value; - } - } - - sealed class PathBooleanValue : IConstantPathValue - { - public PathValueType ValueType => PathValueType.Boolean; - - public bool Value { get; private set; } - - public string LiteralValue => Value.ToString(); - - public PathBooleanValue(bool value) { - Value = value; - } - } - - } -} diff --git a/pdfpatcher/App/Model/PdfPath/PathValueType.cs b/pdfpatcher/App/Model/PdfPath/PathValueType.cs deleted file mode 100644 index 9500b5b9b1c75071b73dfcde4e1c5572d29b1aae..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PdfPath/PathValueType.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Model.PdfPath -{ - public enum PathValueType - { - Expression, - String, - Number, - Boolean - } -} diff --git a/pdfpatcher/App/Model/PdfPath/PredicateOperatorType.cs b/pdfpatcher/App/Model/PdfPath/PredicateOperatorType.cs deleted file mode 100644 index 9bb9d684b6830109c78246460f53a22ef081bf09..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PdfPath/PredicateOperatorType.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Model.PdfPath -{ - public enum PredicateOperatorType - { - Contains, - Equal, - NotEqual, - LessThan, - LargerThan - } -} diff --git a/pdfpatcher/App/Model/PdfPathDocument.cs b/pdfpatcher/App/Model/PdfPathDocument.cs deleted file mode 100644 index 69a73121697cee07f3c2aec7de625eca011b1de3..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PdfPathDocument.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using iTextSharp.text.pdf; -using PDFPatcher.Common; -using PDFPatcher.Processor; - -namespace PDFPatcher.Model -{ - sealed class PdfPathDocument : IHierarchicalObject - { - const int pageGroupNumber = 100; - static readonly DocumentObject[] __Leaf = new DocumentObject[0]; - readonly PdfReader _pdf; - readonly DocumentObject[] _rootObjects; - readonly DocumentObject _trailer; - readonly DocumentObject _hiddenObjects; - readonly Dictionary _pageMapper; - - public PdfPathDocument(string pdfPath) { - _pdf = PdfHelper.OpenPdfFile(pdfPath, AppContext.LoadPartialPdfFile, false); - _pageMapper = Processor.PdfHelper.GetPageRefMapper(_pdf); - _trailer = new DocumentObject(this, null, "Trailer", _pdf.Trailer, PdfObjectType.Trailer) { - IsKeyObject = true, - Description = "文档根节点", - FriendlyValue = System.IO.Path.GetFileNameWithoutExtension(pdfPath) - }; - _hiddenObjects = new DocumentObject(this, null, "隐藏对象", null, PdfObjectType.Hidden); - var l = _pdf.NumberOfPages; - if (l > 301) { - var c = new DocumentObject[1 + (l + pageGroupNumber - 1) / pageGroupNumber + 1]; - c[0] = _trailer; - for (int i = 1; i < c.Length - 1; i++) { - var a = (i - 1) * pageGroupNumber + 1; - var b = Math.Min(l, (i * pageGroupNumber)); - c[i] = new DocumentObject(this, null, "Pages", null, PdfObjectType.Pages) { IsKeyObject = true, ExtensiveObject = a + "-" + b, FriendlyValue = String.Concat("第 ", a, " 至 ", b, " 页,共 ", l, " 页") }; - } - c[c.Length - 1] = _hiddenObjects; - _rootObjects = c; - } - else { - _rootObjects = new DocumentObject[] { - _trailer, - new DocumentObject (this, null, "Pages", null, PdfObjectType.Pages) { IsKeyObject = true, FriendlyValue = "共 " + l + " 页" }, - _hiddenObjects - }; - } - } - - public PdfReader Document => _pdf; - - public DocumentObject Trailer => _trailer; - - public int PageCount => _pdf.NumberOfPages; - - public void Close() { - _pdf.Close(); - } - - public int GetPageNumber(PdfIndirectReference pdfRef) { - int page; - _pageMapper.TryGetValue(pdfRef.Number, out page); - return page; - } - - #region IHierarchicalObject 成员 - - bool IHierarchicalObject.HasChildren => true; - - ICollection IHierarchicalObject.Children { - get { - var c = new DocumentObject[_rootObjects.Length]; - Array.Copy(_rootObjects, c, _rootObjects.Length); - return c; - } - } - - #endregion - } -} diff --git a/pdfpatcher/App/Model/PdfStructInfo.cs b/pdfpatcher/App/Model/PdfStructInfo.cs deleted file mode 100644 index 6b3aab6f411b7a24ce25a6348fdab2865645d7cc..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/PdfStructInfo.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -namespace PDFPatcher.Model -{ - struct PdfStructInfo - { - static readonly Dictionary _Info = InitStructInfo(); - readonly string _Name; - readonly bool _IsKeyObject; - readonly bool _IsRequired; - readonly string _Description; - readonly string _ImageKey; - - public string Name => _Name; - public bool IsKeyObject => _IsKeyObject; - public bool IsRequired => _IsRequired; - public string Description => _Description; - public string ImageKey => _ImageKey; - - public PdfStructInfo(string name, bool isKeyObject) : this(name, isKeyObject, false, null, null) { - } - public PdfStructInfo(string name, bool isKeyObject, bool isRequired, string description, string imageKey) { - _Name = name; - _IsKeyObject = isKeyObject; - _IsRequired = isRequired; - _Description = description; - _ImageKey = imageKey; - } - internal static PdfStructInfo GetInfo(string context, string name) { - PdfStructInfo i; - if (_Info.TryGetValue(String.Concat(context, "/", name), out i)) { - return i; - } - else { - _Info.TryGetValue(name, out i); - return i; - } - } - - static Dictionary InitStructInfo() { - var d = new Dictionary(); - using (System.IO.Stream s = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("PDFPatcher.Model.PDFStructInfo.xml")) { - var doc = new XmlDocument(); - doc.Load(s); - AddSubItems(d, doc.SelectSingleNode("PDF/Global") as XmlElement); - AddSubItems(d, doc.SelectSingleNode("PDF") as XmlElement); - } - return d; - } - - private static void AddSubItems(Dictionary d, XmlElement element) { - if (element.HasChildNodes == false) { - return; - } - var currentToken = element.GetAttribute("Token"); - foreach (XmlNode item in element.ChildNodes) { - var e = item as XmlElement; - if (e == null) { - continue; - } - var t = e.GetAttribute("Token"); - if (String.IsNullOrEmpty(t)) { - continue; - } - if (e.Name == "Info") { - AddItem(d, String.IsNullOrEmpty(currentToken) ? t : String.Concat(currentToken, "/", t), new PdfStructInfo(e.GetAttribute("Name"), e.HasChildNodes, e.GetAttribute("Required") == "true", e.GetAttribute("Description"), e.GetAttribute("ImageKey"))); - AddSubItems(d, e); - } - else if (e.Name == "RefInfo" && d.ContainsKey(t)) { - AddItem(d, String.IsNullOrEmpty(currentToken) ? t : String.Concat(currentToken, "/", t), d[t]); - } - } - } - - private static void AddItem(Dictionary d, string key, PdfStructInfo item) { - if (d.ContainsKey(key)) { - System.Diagnostics.Debug.WriteLine("已添加 " + key); - return; - } - d.Add(key, item); - } - - } -} diff --git a/pdfpatcher/App/Model/SourceItem.cs b/pdfpatcher/App/Model/SourceItem.cs deleted file mode 100644 index 82dedebe5ff8e8db29acbf08bc80b0d1f8f96298..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/SourceItem.cs +++ /dev/null @@ -1,638 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using PDFPatcher.Common; - -namespace PDFPatcher.Model -{ - public abstract class SourceItem - { - List _Items; - - public FilePath FilePath { get; } - public string FileName { get; } - public string FolderName { get; } - public BookmarkSettings Bookmark { get; set; } - public int PageCount { get; private set; } - public abstract int FileSize { get; } - public abstract DateTime FileTime { get; } - public List Items { - get { - if (_Items == null) { - _Items = new List(); - } - return _Items; - } - } - - public bool HasSubItems => _Items.HasContent(); - - public abstract ItemType Type { get; } - public static void SortFileList(string[] fileList) { - if (AppContext.Merger.CajSort && CajSort(fileList)) { - return; - } - - if (AppContext.Merger.NumericAwareSort) { - Array.Sort(fileList, FileHelper.NumericAwareComparePath); - } - else { - Array.Sort(fileList, StringComparer.OrdinalIgnoreCase); - } - } - - public void SortItems(SortType options, bool recursive) { - if (_Items.HasContent() == false) { - return; - } - switch (options) { - case SortType.Literal: - _Items.Sort((x, y) => String.Compare(x.FilePath, y.FilePath, StringComparison.OrdinalIgnoreCase)); - break; - case SortType.NumericAwareSort: - _Items.Sort((x, y) => FileHelper.NumericAwareComparePath(x.FilePath, y.FilePath)); - break; - case SortType.CajSort: - if (CajSort(_Items) == false) { - goto case SortType.NumericAwareSort; - } - break; - case SortType.FileTime: - _Items.Sort((x, y) => x.FileTime.CompareTo(y.FileTime)); - break; - case SortType.Reverse: - _Items.Reverse(); - break; - } - if (recursive == false) { - return; - } - foreach (var item in _Items) { - if (item._Items.HasContent()) { - item.SortItems(options, recursive); - } - } - } - - public abstract SourceItem Clone(); - - public override string ToString() { - return FilePath.ToString(); - } - - public enum ItemType - { - Empty, Pdf, Image, Folder - } - public enum SortType { - Undefined, - Literal, - NumericAwareSort, - CajSort, - FileTime, - Reverse - } - - /// - /// 创建新的空白页。 - /// - /// 空白页实例。 - internal static Empty Create() { - return new Empty(); - } - - internal static SourceItem Create(string path) { - return Create(path, true); - } - - /// - /// 根据传入的文件路径创建 实例。 - /// - /// 文件或文件夹路径。 - /// 是否强制更新。 - /// 实例。 - internal static SourceItem Create(FilePath path, bool refresh) { - if (((string)path).IsNullOrWhiteSpace()) { - return Create(); - } - if (path.ExistsDirectory) { - return new Folder(path.ToString(), refresh); - } - if (path.HasExtension(Constants.FileExtensions.Pdf)) { - try { - var reader = Processor.PdfHelper.OpenPdfFile(path.ToString(), true, false); - var c = reader.NumberOfPages; - string r = refresh ? new PageRange(1, c).ToString() : null; - var info = Processor.DocInfoExporter.RewriteDocInfoWithEncoding(reader, AppContext.Encodings.DocInfoEncoding); - reader.Close(); - return new Pdf(path, r, c, info); - } - catch (FileNotFoundException) { - FormHelper.ErrorBox(String.Concat("找不到文件:“", path, "”。")); - } - catch (Exception) { - FormHelper.ErrorBox(String.Concat("打开 PDF 文件“", path, "”时出错。")); - // ignore corrupted - } - return Create(); - } - if (path.HasExtension(Constants.FileExtensions.AllSupportedImageExtension)) { - return new Image(path); - //try { - // using (var i = new FreeImageAPI.FreeImageBitmap (path, (FreeImageAPI.FREE_IMAGE_LOAD_FLAGS)0x0800/*仅加载图像尺寸信息*/)) { - // var fc = i.FrameCount; - // return new Image (path); - // } - //} - //catch (Exception) { - // Common.FormHelper.ErrorBox (String.Concat ("不支持图片文件“", path, "”。")); - // // ignore unsupported images - //} - } - FormHelper.ErrorBox(String.Concat("不支持文件“", path, "”。")); - return Create(); - } - - internal string GetInfoFileName() { - // 优先采用与输入文件同名的 XML 信息文件 - var f = new FilePath(FileHelper.CombinePath(FolderName, Path.ChangeExtension(FileName, Constants.FileExtensions.Xml))); - if (f.ExistsFile == false) { - // 次之采用与输入文件同名的 TXT 信息文件 - f = f.ChangeExtension(Constants.FileExtensions.Txt); - if (f.ExistsFile == false) { - // 次之采用同一个信息文件 - f = FilePath.ChangeExtension(Constants.FileExtensions.Xml); - if (f.ExistsFile == false) { - f = FilePath.Empty; - } - } - } - return f.ToString(); - } - - internal string GetTargetPdfFileName(string targetPath) { - return FileHelper.HasFileNameMacro(targetPath) - ? targetPath - : FileHelper.CombinePath(Path.GetDirectoryName(targetPath), FilePath.FileName); - } - - internal sealed class Empty : SourceItem - { - readonly DateTime _Time = DateTime.Now; - - public override ItemType Type => ItemType.Empty; - - public override int FileSize => 0; - public override DateTime FileTime => _Time; - - public void SetPageCount(int pageCount) { - PageCount = pageCount; - } - - public override string ToString() { - return "<空白页>"; - } - - public override SourceItem Clone() { - var n = new Empty(); - CopyProperties(n); - return n; - } - - internal Empty() : base(null, 1) { } - internal Empty(int pageCount) : base(null, pageCount) { } - } - - internal sealed class CropOptions - { - public int Left { get; set; } - public int Right { get; set; } - public int Top { get; set; } - public int Bottom { get; set; } - public int MinHeight { get; set; } - public int MinWidth { get; set; } - - public bool NeedCropping => Left > 0 || Right > 0 || Top > 0 || Bottom > 0; - - public bool Equals(CropOptions i) { - return Top == i.Top && Bottom == i.Bottom && Left == i.Left && Right == i.Right && - MinHeight == i.MinHeight && MinWidth == i.MinWidth; - } - public CropOptions Clone() { - return (CropOptions)MemberwiseClone(); - } - } - - internal sealed class Image : SourceItem - { - readonly int _FileSize = -1; - readonly DateTime _FileTime; - - public Image(FilePath path) - : base(path, 0) { - Cropping = new CropOptions(); - GetFileInfo(path, out _FileSize, out _FileTime); - } - - public CropOptions Cropping { get; set; } - public override ItemType Type => ItemType.Image; - public override int FileSize => _FileSize; - public override DateTime FileTime => _FileTime; - - public override SourceItem Clone() { - return new Image(FilePath) { - Cropping = Cropping.Clone() - }; - } - } - - internal sealed class Pdf : SourceItem - { - int _FileSize = -1; - DateTime _FileTime; - - public Pdf(FilePath path, string pageRanges, int pageCount, Model.GeneralInfo docInfo) - : base(path, pageCount) { - PageRanges = pageRanges; - DocInfo = docInfo; - ExtractImageOptions = new ImageExtracterOptions() { - OutputPath = Path.GetDirectoryName(path.ToString()), - ExtractAnnotationImages = false, - MergeJpgToPng = true, - MergeImages = true, - MinWidth = 50, - MinHeight = 50 - }; - GetFileInfo(path, out _FileSize, out _FileTime); - } - - public Pdf(FilePath path) : base(path, 0) { - Refresh(path.ToString(), AppContext.Encodings.DocInfoEncoding); - } - - public string PageRanges { get; set; } - public bool ImportImagesOnly { get; set; } - public ImageExtracterOptions ExtractImageOptions { get; private set; } - public Model.GeneralInfo DocInfo { get; private set; } - public override ItemType Type => ItemType.Pdf; - public override int FileSize => _FileSize; - public override DateTime FileTime => _FileTime; - - public void Refresh(Encoding encoding) { - Refresh(FilePath.ToString(), encoding); - } - - public override string ToString() { - return FilePath.IsEmpty ? String.Empty : - String.IsNullOrEmpty(PageRanges) ? (string)FilePath : - String.Concat(FilePath, "::", PageRanges); - } - - public override SourceItem Clone() { - var n = new Pdf(FilePath, PageRanges, PageCount, DocInfo) { - ImportImagesOnly = ImportImagesOnly - }; - CopyProperties(n); - return n; - } - - private void Refresh(string path, Encoding encoding) { - try { - GetFileInfo(path, out _FileSize, out _FileTime); - if (_FileSize > 0) { - using (var reader = Processor.PdfHelper.OpenPdfFile(path, true, false)) { - DocInfo = Processor.DocInfoExporter.RewriteDocInfoWithEncoding(reader, encoding); - PageCount = reader.NumberOfPages; - PageRanges = new PageRange(1, PageCount).ToString(); - } - } - } - catch (Exception) { - FormHelper.ErrorBox(String.Concat("打开 PDF 文件时“", path, "”出错。")); - // ignore corrupted - } - } - } - - internal sealed class Folder : SourceItem - { - DateTime _FolderTime; - - public Folder(string path) : base(path, 0) { - var p = new FilePath(path); - if (p.ExistsDirectory) { - _FolderTime = p.ToDirectoryInfo().LastWriteTime; - } - } - public Folder(string path, bool loadSubItems) - : this(path) { - if (loadSubItems) { - Reload(); - } - } - - public override ItemType Type => ItemType.Folder; - - public override int FileSize => 0; - public override DateTime FileTime => _FolderTime; - - public void Reload() { - Items.Clear(); - if (!FilePath.ExistsDirectory) { - return; - } - - var p = FilePath.ToString(); - var l = Items; - switch (AppContext.Merger.SubFolder) { - case MergerOptions.SubFolderPosition.BeforeFiles: - AddSubDirectories(p, l); - AddFiles(p, l); - break; - case MergerOptions.SubFolderPosition.WithFiles: - AddSubDirectoriesAndFiles(p, l); - break; - case MergerOptions.SubFolderPosition.Exclude: - AddFiles(p, l); - break; - } - } - - public override SourceItem Clone() { - var n = new Folder(FilePath.ToString()); - CopyProperties(n); - return n; - } - - private static void AddSubDirectoriesAndFiles(string folderPath, List list) { - var fl = Array.FindAll(Directory.GetFiles(folderPath), (i) => { - var ext = Path.GetExtension(i).ToLowerInvariant(); - return Constants.FileExtensions.Pdf == ext - || Constants.FileExtensions.AllSupportedImageExtension.Contains(ext); - }); - var d = Array.ConvertAll(Directory.GetDirectories(folderPath), (i) => i + "\\"); - var s = new string[fl.Length + d.Length]; - Array.Copy(fl, s, fl.Length); - Array.Copy(d, 0, s, fl.Length, d.Length); - SortFileList(s); - foreach (var item in s) { - if (item[item.Length - 1] == '\\') { - list.Add(new Folder(item.Substring(0, item.Length - 1), true)); - } - else { - list.Add(Create(item)); - } - } - } - - static void AddFiles(string folderPath, List list) { - try { - var fl = Directory.GetFiles(folderPath); - SortFileList(fl); - foreach (var item in fl) { - var ext = Path.GetExtension(item).ToLowerInvariant(); - if (Constants.FileExtensions.Pdf == ext - || Constants.FileExtensions.AllSupportedImageExtension.Contains(ext)) { - list.Add(Create(item)); - } - } - } - catch (UnauthorizedAccessException) { } - catch (IOException) { } - } - - static void AddSubDirectories(string folderPath, List list) { - try { - foreach (var item in Directory.EnumerateDirectories(folderPath)) { - var f = new Folder(item, true); - list.Add(f); - } - } - catch (UnauthorizedAccessException) { } - catch (IOException) { } - } - } - - protected SourceItem(FilePath path, int pageCount) { - PageCount = pageCount; - if (!path.IsValidPath) { - return; - } - - FilePath = path; - FileName = path.FileName; - FolderName = path.Directory; - if (AppContext.Merger.AutoBookmarkTitle == false) { - return; - } - var t = path.ExistsDirectory ? FileName : path.FileNameWithoutExtension; - if (t.Length > 0) { - Bookmark = CreateBookmarkSettings(t); - } - } - - protected static void GetFileInfo(FilePath fileName, out int kilobytes, out DateTime fileTime) { - if (fileName.ExistsFile == false) { - kilobytes = 0; - fileTime = DateTime.MinValue; - } - else { - var f = fileName.ToFileInfo(); - kilobytes = (int)(f.Length >> 10); - fileTime = f.LastWriteTime; - } - } - - protected virtual void CopyProperties(SourceItem target) { - target._Items = new List(HasSubItems ? Items.Count : 0); - if (HasSubItems) { - foreach (var item in _Items) { - target._Items.Add(item.Clone()); - } - } - if (Bookmark != null) { - target.Bookmark = Bookmark.Clone(); - } - target.PageCount = PageCount; - } - static BookmarkSettings CreateBookmarkSettings(string t) { - if (AppContext.Merger.CajSort && t.Length == 6) { - if (MatchCajPattern(t, Constants.CajNaming.Cover)) { - return t.EndsWith("001", StringComparison.Ordinal) ? new BookmarkSettings("封面") - : t.EndsWith("002", StringComparison.Ordinal) ? new BookmarkSettings("封底") - : null; // 超过2页的,只为第一页和第二页生成书签 - } - else if (MatchCajPattern(t, Constants.CajNaming.TitlePage)) { - return t.EndsWith("001", StringComparison.Ordinal) ? new BookmarkSettings("书名") : null; - } - else if (MatchCajPattern(t, Constants.CajNaming.CopyrightPage)) { - return t.EndsWith("001", StringComparison.Ordinal) ? new BookmarkSettings("版权") : null; - } - else if (MatchCajPattern(t, Constants.CajNaming.Foreword)) { - return t.EndsWith("001", StringComparison.Ordinal) ? new BookmarkSettings("前言") : null; - } - else if (MatchCajPattern(t, Constants.CajNaming.Contents)) { - return t.EndsWith("00001", StringComparison.Ordinal) ? new BookmarkSettings("目录") : null; - } - else if (MatchCajPattern(t, String.Empty) && t == "000001") { - return new BookmarkSettings("正文"); - } - } - if (AppContext.Merger.IgnoreLeadingNumbers) { - int i; - for (i = 0; i < t.Length; i++) { - if (t[i] > '9' || t[i] < '0') { - break; - } - } - t = t.Substring(i); - } - return new BookmarkSettings(t); - } - static bool CajSort(string[] fileList) { - var m = false; // match Caj naming - var cov = new List(1); - var bok = new List(2); - var leg = new List(1); - var fow = new List(3); - var cnt = new List(5); - var body = new List(fileList.Length); - foreach (var path in fileList) { - var f = Path.GetFileNameWithoutExtension(path); - if (f.Length == 6) { - if (MatchCajPatternAddPath(path, f, Constants.CajNaming.Cover, cov) - || MatchCajPatternAddPath(path, f, Constants.CajNaming.TitlePage, bok) - || MatchCajPatternAddPath(path, f, Constants.CajNaming.CopyrightPage, leg) - || MatchCajPatternAddPath(path, f, Constants.CajNaming.Foreword, fow) - || MatchCajPatternAddPath(path, f, Constants.CajNaming.Contents, cnt) - ) { - m = true; - continue; - } - } - body.Add(path); - } - if (m == false) { - return false; - } - cov.Sort(StringComparer.OrdinalIgnoreCase); - bok.Sort(StringComparer.OrdinalIgnoreCase); - leg.Sort(StringComparer.OrdinalIgnoreCase); - fow.Sort(StringComparer.OrdinalIgnoreCase); - cnt.Sort(StringComparer.OrdinalIgnoreCase); - body.Sort(StringComparer.OrdinalIgnoreCase); - int p = 0; - if (cov.Count == 2) { - fileList[0] = cov[0]; - ++p; - } - else { - p = CopyItem(fileList, cov, p); - } - p = CopyItem(fileList, bok, p); - p = CopyItem(fileList, leg, p); - p = CopyItem(fileList, fow, p); - p = CopyItem(fileList, cnt, p); - p = CopyItem(fileList, body, p); - if (cov.Count == 2) { - fileList[p] = cov[1]; - } - return true; - } - - static int CopyItem(string[] fileList, List list, int position) { - list.CopyTo(fileList, position); - position += list.Count; - return position; - } - - static bool MatchCajPatternAddPath(string path, string text, string pattern, List container) { - if (MatchCajPattern(text, pattern)) { - container.Add(path); - return true; - } - return false; - } - - static bool CajSort(List fileList) { - var m = false; // match Caj naming - var cov = new List(1); - var bok = new List(2); - var leg = new List(1); - var fow = new List(3); - var cnt = new List(5); - var body = new List(fileList.Count); - foreach (var file in fileList) { - var path = file.FilePath; - var f = Path.GetFileNameWithoutExtension(path); - if (f.Length == 6) { - if (MatchCajPatternAddPath(file, f, Constants.CajNaming.Cover, cov) - || MatchCajPatternAddPath(file, f, Constants.CajNaming.TitlePage, bok) - || MatchCajPatternAddPath(file, f, Constants.CajNaming.CopyrightPage, leg) - || MatchCajPatternAddPath(file, f, Constants.CajNaming.Foreword, fow) - || MatchCajPatternAddPath(file, f, Constants.CajNaming.Contents, cnt) - ) { - m = true; - continue; - } - } - body.Add(file); - } - if (m == false) { - return false; - } - cov.Sort(CompareFilePath); - bok.Sort(CompareFilePath); - leg.Sort(CompareFilePath); - fow.Sort(CompareFilePath); - cnt.Sort(CompareFilePath); - body.Sort(CompareFilePath); - fileList.Clear(); - if (cov.Count == 2) { - fileList.Add(cov[0]); - } - else { - fileList.AddRange(cov); - } - fileList.AddRange(bok); - fileList.AddRange(leg); - fileList.AddRange(fow); - fileList.AddRange(cnt); - fileList.AddRange(body); - if (cov.Count == 2) { - fileList.Add(cov[1]); - } - return true; - } - - static bool MatchCajPatternAddPath(SourceItem item, string text, string pattern, List container) { - if (MatchCajPattern(text, pattern)) { - container.Add(item); - return true; - } - return false; - } - - static int CompareFilePath(SourceItem x, SourceItem y) { - return String.Compare(x.FilePath, y.FilePath, StringComparison.OrdinalIgnoreCase); - } - - static bool MatchCajPattern(string text, string pattern) { - if (text.StartsWith(pattern, StringComparison.OrdinalIgnoreCase) == false) { - return false; - } - int l = pattern.Length; - if (text.Length == l) { - return false; - } - foreach (var ch in text.Substring(l)) { - if (ch < '0' || ch > '9') { - return false; - } - } - return true; - } - } -} diff --git a/pdfpatcher/App/Model/TextInfo.cs b/pdfpatcher/App/Model/TextInfo.cs deleted file mode 100644 index c5b3b2abbbd5e560af1f567526228166a28d256b..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/TextInfo.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System.Diagnostics; -using iTextSharp.text.pdf; - -namespace PDFPatcher.Model -{ - [DebuggerDisplay("Region={Region.Bottom},{Region.Left}; Size={Size}; Text={Text}")] - sealed class TextInfo : ITextRegion - { - public Bound Region { get; set; } - public string Text { get; set; } - public PdfString PdfString { get; set; } - internal float Size { get; set; } - internal FontInfo Font { get; set; } - internal System.Drawing.Color Color { get; set; } - internal float LetterWidth { get; set; } - - internal static int CompareRegionX(ITextRegion a, ITextRegion b) { - if (a == b) { - return 0; - } - return CompareRegionX(a, b, true); - } - static int CompareRegionX(ITextRegion a, ITextRegion b, bool checkAlignment) { - if (checkAlignment && a.Region.IsAlignedWith(b.Region, WritingDirection.Horizontal) == false) { - return CompareRegionY(a, b, false); - } - var x1 = a.Region.Center; - var x2 = b.Region.Center; - return x1 < x2 ? -1 - : x1 == x2 ? 0 - : 1; - } - - internal static int CompareRegionY(ITextRegion a, ITextRegion b) { - if (a == b) { - return 0; - } - return CompareRegionY(a, b, true); - } - static int CompareRegionY(ITextRegion a, ITextRegion b, bool checkAlignment) { - if (checkAlignment && a.Region.IsAlignedWith(b.Region, WritingDirection.Vertical) == false) { - return CompareRegionX(a, b, false); - } - var y1 = a.Region.Middle; - var y2 = b.Region.Middle; - return y1 > y2 ^ a.Region.IsTopDown ? -1 - : y1 == y2 ? 0 - : 1; - } - - } - -} diff --git a/pdfpatcher/App/Model/TextLine.cs b/pdfpatcher/App/Model/TextLine.cs deleted file mode 100644 index 757b472e5e14832c21c6874978f6611d7cbee0a0..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/TextLine.cs +++ /dev/null @@ -1,163 +0,0 @@ -using System; -using System.Collections.Generic; -using PDFPatcher.Common; - -namespace PDFPatcher.Model -{ - [System.Diagnostics.DebuggerDisplay("{Direction}({Region.Middle},{Region.Center}):Text = {Text}")] - sealed class TextLine : IDirectionalBoundObject - { - readonly List _Texts; - /// 获取此行内包含的文本。 - internal IEnumerable Texts => _Texts; - /// 获取 内的第一个 - internal TextInfo FirstText => _Texts[0]; - - public WritingDirection Direction { get; private set; } - public Bound Region { get; private set; } - internal bool SuppressTextInfoArrangement { get; set; } - /// - /// 默认的书写方向。 - /// - internal static WritingDirection DefaultDirection { get; set; } - - string _Text; - /// - /// 获取将 内所有文本串联起来的字符串。 - /// - public string Text { - get { - if (_Text == null) { - _Text = GetConcatenatedText(); - } - return _Text; - } - } - - private TextLine() { - _Texts = new List(); - Direction = DefaultDirection; - } - - internal TextLine(TextInfo text) : this() { - _Texts.Add(text); - Region = new Bound(text.Region); - if (text.Text.Length > 2 && text.Region.Height > 0 && text.Region.Width > text.Region.Height * 2) { - Direction = WritingDirection.Horizontal; - } - } - - internal void AddText(TextInfo text) { - if (Direction == WritingDirection.Unknown) { - var d = GetDistance(text.Region); - Direction = InferWritingDirection(d); - if (Direction == WritingDirection.Unknown) { - d = GetDistance(new Bound(text.Region.Center, text.Region.Middle)); - Direction = InferWritingDirection(d); - } - } - _Text = null; - _Texts.Add(text); - Region.Merge(text.Region); - } - - private static WritingDirection InferWritingDirection(DistanceInfo d) { - return d.IsVerticallyAligned ? WritingDirection.Vertical - : d.IsHorizontallyAligned ? WritingDirection.Horizontal - : WritingDirection.Unknown; - } - - internal void Merge(TextLine source) { - _Text = null; - Region.Merge(source.Region); - _Texts.AddRange(source.Texts); - } - - /// - /// 获取区域 到当前文本行之间的距离。 - /// - /// 另一个区域。 - /// 相对于此区域的距离关系。 - internal DistanceInfo GetDistance(Bound other) { - return Region.GetDistance(other, Direction); - } - - /// - /// 获取将 内所有文本串联起来的字符串。 - /// - private string GetConcatenatedText() { - var l = _Texts.Count; - if (l == 0) { - return String.Empty; - } - else if (l == 1) { - return _Texts[0].Text; - } - - var tl = _Texts; - if (SuppressTextInfoArrangement == false) { - if (Direction == WritingDirection.Vertical) { - tl.Sort(TextInfo.CompareRegionY); - } - else { - tl.Sort(TextInfo.CompareRegionX); - } - } - var cs = GetAverageCharSize(); - var sb = StringBuilderCache.Acquire(); - sb.Append(tl[0].Text); - char c; - for (int i = 1; i < l; i++) { - if (cs > 0) { - var dx = Direction == WritingDirection.Vertical - ? tl[i].Region.Top - tl[i - 1].Region.Bottom - : tl[i].Region.Left - tl[i - 1].Region.Right; - if (dx > cs) { - var t = tl[i - 1].Text; - // 调整标点留下的空白 - if (t.Length > 0) { - c = t[t.Length - 1]; - if (Char.IsPunctuation(c) && c > 128) { - dx -= cs; - } - } - t = tl[i].Text; - if (t.Length > 0) { - c = tl[i].Text[0]; - if (Char.IsPunctuation(c) && c > 128) { - dx -= cs; - } - } - } - while ((dx -= cs) > 0) { - sb.Append(' '); - } - } - sb.Append(tl[i].Text); - } - return StringBuilderCache.GetStringAndRelease(sb); - } - - /// 获取 内文字或数字的平均尺寸。 - /// 返回平均字符尺寸。 - internal float GetAverageCharSize() { - var tl = _Texts; - float ts = 0, cc = 0; - if (Direction == WritingDirection.Vertical) { - tl.ForEach((t) => { ts += t.LetterWidth; cc += t.Text.Length; }); - } - else { - foreach (var t in tl) { - ts += t.LetterWidth; - foreach (var c in t.Text) { - if (Char.IsLetterOrDigit(c) == false) { - continue; - } - cc += (c > 0x36F ? 2 : 1); - } - } - } - return ts / cc; // 平均字符宽度 - } - } -} diff --git a/pdfpatcher/App/Model/TextRegion.cs b/pdfpatcher/App/Model/TextRegion.cs deleted file mode 100644 index c4308e667de64320955771a62dd0bee12fad7a24..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/TextRegion.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Model -{ - [System.Diagnostics.DebuggerDisplay("{Direction}({Region.Top},{Region.Left})Lines={Lines.Count}")] - sealed class TextRegion - { - internal WritingDirection Direction { get; set; } - internal Bound Region { get; private set; } - - /// - /// 获取文本区域中的行。 - /// 不应该调用此属性的 Add 方法添加行,而应使用 方法。 - /// - internal List Lines { get; private set; } - - internal TextRegion() { - Lines = new List(); - } - - internal TextRegion(TextLine text) : this() { - Region = new Bound(text.Region); - AddLine(text); - } - - internal void AddLine(TextLine line) { - if (Direction == WritingDirection.Unknown) { - var d = Region.GetDistance(line.Region, WritingDirection.Unknown); - Direction = (d.Location == DistanceInfo.Placement.Up || d.Location == DistanceInfo.Placement.Down) - ? WritingDirection.Vertical - : (d.Location == DistanceInfo.Placement.Left || d.Location == DistanceInfo.Placement.Right) - ? WritingDirection.Horizontal - : WritingDirection.Unknown; - } - Lines.Add(line); - Region.Merge(line.Region); - } - - - } -} diff --git a/pdfpatcher/App/Model/UnitConverter.cs b/pdfpatcher/App/Model/UnitConverter.cs deleted file mode 100644 index f3c0898e5bb5e430a9a63d21a35244c110599295..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/UnitConverter.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System; -using System.Globalization; -using System.Xml.Serialization; - -namespace PDFPatcher.Common -{ - public class UnitConverter - { - const string Null = "null"; - internal const string ToStringFormat = "0.###"; - - /// - /// 获取单位转换因数。 - /// - [XmlIgnore] - public float UnitFactor { get; private set; } - - private int _Precision; - private float _PreservedValue; - ///获取或指定转换精度的值。 - [XmlIgnore] - public int Precision { - get => _Precision; - set { - if (value < 0 || value > 6) { - throw new ArgumentException("转换精度不能小于 0 或大于 6。"); - } - _Precision = value; - _PreservedValue = (float)Math.Pow(0.1, _Precision); - } - } - - private string _Unit; - ///获取或指定转换使用的单位。 - [XmlAttribute("单位")] - public string Unit { - get => _Unit; - set { - var f = ValueHelper.MapValue(value, Constants.Units.Names, Constants.Units.Factors, 0); - if (f == 0) { - throw new ArgumentException("尺寸单位无效。"); - } - UnitFactor = f; - _Unit = value; - } - } - - public UnitConverter() { - Unit = Constants.Units.CM; - Precision = 3; - } - - internal float FromPoint(float point) { - return (point < _PreservedValue && point >= 0) // preserve small fragment - ? point - : (float)Math.Round(point / UnitFactor, _Precision); - } - - internal float ToPoint(float value) { - return (value < _PreservedValue && value >= 0 || value >= 10000) // preserve small fragment or extra large values - ? value - : (float)Math.Round(value * UnitFactor, _Precision); - } - - internal static string FromPoint(string point, float unitFactor) { - if (String.IsNullOrEmpty(point) || point == Null) { - return Null; - } - if (unitFactor == 1) { - return point; - } - if (point.TryParse(out float v)) { - return (v < 0.01 && v >= 0) // preserve small fragment - ? point - : (v / unitFactor).ToString(ToStringFormat, NumberFormatInfo.InvariantInfo); - } - return point; - } - - internal static string FromPoint(float point, float unitFactor) { - return ((point < 0.01 && point >= 0) || unitFactor == 1 // preserve small fragment - ? point.ToString(NumberFormatInfo.InvariantInfo) - : (point / unitFactor).ToString(ToStringFormat, NumberFormatInfo.InvariantInfo)); - } - - internal static string ToPoint(string value, float unitFactor) { - if (String.IsNullOrEmpty(value) || value == Null) { - return Null; - } - if (value.TryParse(out float v)) { - return (v < 0.01 && v >= 0) // preserve small fragment - ? value - : (v * unitFactor).ToString(ToStringFormat, NumberFormatInfo.InvariantInfo); - } - return value; - } - - internal static float ToPoint(float value, float unitFactor) { - return (value < 0.01 && value >= 0 || value >= 10000) // preserve small fragment or extra large values - ? value - : (value * unitFactor); - } - - internal static float[] ConvertUnit(float[] source, float factor) { - return Array.ConvertAll(source, i => ToPoint(i, factor)); - } - - - } -} diff --git a/pdfpatcher/App/Model/WritingDirection.cs b/pdfpatcher/App/Model/WritingDirection.cs deleted file mode 100644 index 2852b700f3c46c2dbf5408fec45658a3b8110f94..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Model/WritingDirection.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Xml.Serialization; - -namespace PDFPatcher.Model -{ - public enum WritingDirection - { - [XmlEnum("混合")] - Unknown, - [XmlEnum("横排")] - Horizontal, - [XmlEnum("竖排")] - Vertical - } -} diff --git a/pdfpatcher/App/Options/AutoBookmarkOptions.cs b/pdfpatcher/App/Options/AutoBookmarkOptions.cs deleted file mode 100644 index d5ffae40828d2df478f458a589ae63586ed9897d..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Options/AutoBookmarkOptions.cs +++ /dev/null @@ -1,173 +0,0 @@ -using System; -using System.Collections.ObjectModel; -using System.Text.RegularExpressions; -using System.Xml.Serialization; -using PDFPatcher.Model; - -namespace PDFPatcher -{ - public class AutoBookmarkOptions - { - public readonly static Regex NumericPattern = new Regex("^[0-9]+$", RegexOptions.Compiled); - - #region 识别选项 - /// - /// 页码范围。 - /// - //[XmlAttribute ("页码范围")] - [XmlIgnore] - [PowerJson.JsonInclude(false)] - public string PageRanges { get; set; } - - /// - /// 最小标题字体尺寸。 - /// - [XmlAttribute("最小标题尺寸")] - public float TitleThreshold { get; set; } - - /// - /// 每页第一行作为标题。 - /// - [XmlAttribute("第一行为标题")] - public bool FirstLineAsTitle { get; set; } - - /// - /// 忽略只有一个字符的标题。 - /// - [XmlAttribute("忽略单字符标题")] - public bool IgnoreSingleCharacterTitle { get; set; } - - /// - /// 忽略只有数字的标题。 - /// - [XmlAttribute("忽略数字标题")] - public bool IgnoreNumericTitle { get; set; } - - /// - /// 合并近邻的同级别标题。 - /// - [XmlAttribute("合并相邻标题")] - public bool MergeAdjacentTitles { get; set; } - - /// - /// 是否允许合并不同字体尺寸的标题。 - /// - [XmlAttribute("合并不同尺寸标题")] - public bool MergeDifferentSizeTitles { get; set; } - - [XmlAttribute("合并不同字体标题")] - public bool MergeDifferentFontTitles { get; set; } - - [XmlAttribute("忽略重叠文本")] - public bool IgnoreOverlappedText { get; set; } - - private readonly Collection _IgnorePatterns = new Collection(); - /// - /// 忽略指定的表达式。 - /// - [XmlArray("忽略表达式")] - [XmlArrayItem("表达式")] - public Collection IgnorePatterns => _IgnorePatterns; - - private readonly Collection _LevelAdjustment = new Collection(); - [XmlElement("级别调整")] - [PowerJson.JsonField("级别调整")] - public Collection LevelAdjustment => _LevelAdjustment; - - [XmlAttribute("自动组织标题层次")] - public bool AutoHierarchicalArrangement { get; set; } - - [XmlAttribute("列出字体统计信息")] - public bool DisplayFontStatistics { get; set; } - - [XmlAttribute("列出所有字体")] - public bool DisplayAllFonts { get; set; } - - [XmlAttribute("排版")] - public WritingDirection WritingDirection { get; set; } - - [XmlAttribute("最大合并行距")] - public float MaxDistanceBetweenLines { get; set; } - - [XmlAttribute("识别分栏")] - public bool DetectColumns { get; set; } - - [XmlAttribute("为首页生成书签")] - public bool CreateBookmarkForFirstPage { get; set; } - - /// - /// 首页书签名称。指定此属性,则为首页生成书签。 - /// - internal string FirstPageTitle { get; set; } - #endregion - - #region 定位选项 - /// - /// 连接目标的页面 Y 轴偏移量。 - /// - [XmlAttribute("Y轴偏移")] - public float YOffset { get; set; } - - /// - /// 定位到页面顶端的标题级别。 - /// - [XmlAttribute("定位到页面顶端")] - public int PageTopForLevel { get; set; } - #endregion - - /// - /// 是否导出文本的位置信息。 - /// - [XmlAttribute("导出文本位置信息")] - public bool ExportTextCoordinates { get; set; } - - public AutoBookmarkOptions() { - AutoHierarchicalArrangement = true; - CreateBookmarkForFirstPage = true; - ExportTextCoordinates = false; - IgnoreNumericTitle = false; - IgnoreSingleCharacterTitle = false; - MergeAdjacentTitles = true; - MergeDifferentFontTitles = true; - MergeDifferentSizeTitles = false; - TitleThreshold = 13; - YOffset = 1.0f; - DisplayFontStatistics = true; - MaxDistanceBetweenLines = 1.5f; - DetectColumns = true; - } - - public class LevelAdjustmentOption - { - [XmlElement(AutoBookmarkCondition.MultiCondition.ThisName, typeof(AutoBookmarkCondition.MultiCondition))] - [XmlElement(AutoBookmarkCondition.FontNameCondition.ThisName, typeof(AutoBookmarkCondition.FontNameCondition))] - [XmlElement(AutoBookmarkCondition.TextSizeCondition.ThisName, typeof(AutoBookmarkCondition.TextSizeCondition))] - [XmlElement(AutoBookmarkCondition.TextPositionCondition.ThisName, typeof(AutoBookmarkCondition.TextPositionCondition))] - [XmlElement(AutoBookmarkCondition.PageRangeCondition.ThisName, typeof(AutoBookmarkCondition.PageRangeCondition))] - [XmlElement(AutoBookmarkCondition.TextCondition.ThisName, typeof(AutoBookmarkCondition.TextCondition))] - public AutoBookmarkCondition Condition { get; set; } - - [XmlAttribute("合并前筛选")] - public bool FilterBeforeMergeTitle { get; set; } - - [XmlAttribute("相对级别调整")] - public bool RelativeAdjustment { get; set; } - - /// - /// 标题的调整级别。 - /// - [XmlAttribute("调整级别")] - public float AdjustmentLevel { get; set; } - - internal LevelAdjustmentOption Clone() { - return new LevelAdjustmentOption() { - Condition = Condition.Clone() as AutoBookmarkCondition, - RelativeAdjustment = RelativeAdjustment, - AdjustmentLevel = AdjustmentLevel - }; - } - } - - } - -} diff --git a/pdfpatcher/App/Options/DocumentOptions.cs b/pdfpatcher/App/Options/DocumentOptions.cs deleted file mode 100644 index c2f22798946dda1c8b06287aaf977b7516655aaa..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Options/DocumentOptions.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Collections.Generic; -using System.Xml.Serialization; -using PDFPatcher.Model; - -namespace PDFPatcher -{ - public abstract class DocumentOptions - { - [XmlElement("指定元数据")] - public GeneralInfo MetaData { get; set; } - - [XmlElement("阅读器设置")] - public ViewerOptions ViewerPreferences { get; set; } - - [XmlIgnore] - internal List PageLabels { get; private set; } - - [XmlAttribute("压缩索引表和书签")] - public bool FullCompression { get; set; } - - [XmlAttribute("统一页面方向")] - public bool UnifyPageOrientation { get; set; } - - /// - /// 设置统一页面方向要旋转的页面。默认旋转横向的页面。 - /// - [XmlAttribute("旋转源页面方向")] - public bool RotateVerticalPages { get; set; } - - /// - /// 设置统一页面旋转页面的方向。默认为顺时针旋转。 - /// - [XmlAttribute("旋转方向")] - public bool RotateAntiClockwise { get; set; } - - protected DocumentOptions() { - FullCompression = true; - PageLabels = new List(); - ViewerPreferences = new ViewerOptions(); - MetaData = new GeneralInfo(); - } - } -} \ No newline at end of file diff --git a/pdfpatcher/App/Options/EncodingOptions.cs b/pdfpatcher/App/Options/EncodingOptions.cs deleted file mode 100644 index d7f52d050d28d35ba0992b66e9033f8c6b5c0698..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Options/EncodingOptions.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Text; -using System.Xml.Serialization; -using PDFPatcher.Common; - -namespace PDFPatcher -{ - public class EncodingOptions - { - - Encoding _bookmarkEncoding; - public Encoding BookmarkEncoding { - get { - GetEncoding(_bookmarkEncodingName, ref _bookmarkEncoding); - return _bookmarkEncoding; - } - } - - string _bookmarkEncodingName; - ///获取或指定读取书签时所用的编码。 - [XmlAttribute("书签文本编码")] - public string BookmarkEncodingName { - get => _bookmarkEncodingName; - set => SetEncoding(ref _bookmarkEncodingName, ref _bookmarkEncoding, value); - } - - Encoding _docInfoEncoding; - public Encoding DocInfoEncoding { - get { - GetEncoding(_docInfoEncodingName, ref _docInfoEncoding); - return _docInfoEncoding; - } - } - string _docInfoEncodingName; - ///获取或指定读取文档元数据时所用的编码。 - [XmlAttribute("文档元数据编码")] - public string DocInfoEncodingName { - get => _docInfoEncodingName; - set => SetEncoding(ref _docInfoEncodingName, ref _docInfoEncoding, value); - } - - Encoding _textEncoding; - public Encoding TextEncoding { - get { - GetEncoding(_textEncodingName, ref _textEncoding); - return _textEncoding; - } - } - string _textEncodingName; - ///获取或指定读取文本时所用的编码。 - [XmlAttribute("内容文本编码")] - public string TextEncodingName { - get => _textEncodingName; - set => SetEncoding(ref _textEncodingName, ref _textEncoding, value); - } - - Encoding _fontNameEncoding; - public Encoding FontNameEncoding { - get { - GetEncoding(_fontNameEncodingName, ref _fontNameEncoding); - return _fontNameEncoding; - } - } - string _fontNameEncodingName; - ///获取或指定读取文本时所用的编码。 - [XmlAttribute("字体名称编码")] - public string FontNameEncodingName { - get => _fontNameEncodingName; - set => SetEncoding(ref _fontNameEncodingName, ref _fontNameEncoding, value); - } - public static void SetEncoding(ref string encodingName, ref Encoding encoding, string value) { - encoding = null; - encodingName = (value == Constants.Encoding.Automatic ? null : value); - } - static void GetEncoding(string encodingName, ref Encoding encoding) { - if (encoding == null && String.IsNullOrEmpty(encodingName) == false) { - encoding = ValueHelper.MapValue(encodingName, Constants.Encoding.EncodingNames, Constants.Encoding.Encodings); - } - } - - } -} diff --git a/pdfpatcher/App/Options/ExporterOptions.cs b/pdfpatcher/App/Options/ExporterOptions.cs deleted file mode 100644 index 20fa37ed988bbff215fc5e3eebe814b616e5d6b9..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Options/ExporterOptions.cs +++ /dev/null @@ -1,135 +0,0 @@ -using System; -using System.Text; -using System.Xml.Serialization; -using PDFPatcher.Common; -using E = System.Text.Encoding; - -namespace PDFPatcher -{ - public class ExporterOptions - { - private bool _ExportDocProperties = true; - ///获取或指定是否导出文档属性。 - [XmlAttribute("导出文档属性")] - public bool ExportDocProperties { - get => _ExportDocProperties; - set => _ExportDocProperties = value; - } - - private bool _ExportBookmarks = true; - ///获取或指定是否导出书签。 - [XmlAttribute("导出文档书签")] - public bool ExportBookmarks { - get => _ExportBookmarks; - set => _ExportBookmarks = value; - } - - private bool _ExtractPageLinks = true; - ///获取或指定是否导出页面内的连接。 - [XmlAttribute("导出页面链接")] - public bool ExtractPageLinks { - get => _ExtractPageLinks; - set => _ExtractPageLinks = value; - } - - private bool _ExportViewerPreferences = true; - ///获取或指定是否导出阅读器设置。 - [XmlAttribute("导出阅读器设置")] - public bool ExportViewerPreferences { - get => _ExportViewerPreferences; - set => _ExportViewerPreferences = value; - } - - private bool _ExtractPageSettings = true; - ///获取或指定是否导出页面的阅读设置。 - [XmlAttribute("导出页面设置")] - public bool ExtractPageSettings { - get => _ExtractPageSettings; - set => _ExtractPageSettings = value; - } - - ///获取或指定是否导出文档编录信息。 - [XmlAttribute("导出编录信息")] - public bool ExportCatalog { get; set; } - - ///获取或指定是否导出页面内容信息。 - [XmlAttribute("导出页面内容")] - public bool ExtractPageContent { get; set; } - - ///获取或指定需要导出的页码范围。页码范围可用“-”表示起止页码,如有多个页码,可用“;”、“,”或“ ”(空格)隔开,如“1;4-15;2 56”,表示依次导出第1页、第4至15页、第2页和第56页的内容。 - [XmlAttribute("导出页码范围")] - public string ExtractPageRange { get; set; } - - ///获取或指定页面字典的值。 - [XmlAttribute("导出页面字典")] - public bool ExtractPageDictionary { get; set; } - - ///获取或指定是否导出页面中的图片为独立的文件。 - [XmlAttribute("导出图片")] - public bool ExtractImages { get; set; } - - ///获取或指定是否解码导出页面中的文本。 - [XmlAttribute("导出解码文本")] - public bool ExportDecodedText { get; set; } - - ///获取或指定是否解码导出页面指令。 - [XmlAttribute("导出命令操作符")] - public bool ExportContentOperators { get; set; } - - private int _ExportBinaryStream = 200; - ///获取或指定导出二进制流的字节数。 - [XmlAttribute("导出二进制流")] - public int ExportBinaryStream { - get => _ExportBinaryStream; - set => _ExportBinaryStream = value; - } - - ///获取或指定导出前是否解析命名位置。 - [XmlAttribute("解析命名位置")] - public bool ConsolidateNamedDestinations { get; set; } - - private readonly ImageExtracterOptions _Images = new ImageExtracterOptions(); - ///获取导出图像的选项。 - [XmlIgnore] - public ImageExtracterOptions Images => _Images; - - private UnitConverter _UnitConverter = new UnitConverter(); - [XmlElement("导出尺寸单位")] - public UnitConverter UnitConverter { - get => _UnitConverter; - set => _UnitConverter = value; - } - - private Encoding _Encoding = E.Default; - private string _EncodingName; - ///获取或指定导出文件时所用的编码。 - [XmlAttribute("文本编码")] - public string Encoding { - get { - if (_Encoding.EncodingName == E.Default.EncodingName) { - return Constants.Encoding.SystemDefault; - } - return _EncodingName; - } - set { - if (String.IsNullOrEmpty(value) || value == Constants.Encoding.SystemDefault) { - _Encoding = E.Default; - } - else { - try { - _Encoding = E.GetEncoding(value); - _EncodingName = value; - } - catch (Exception) { - _EncodingName = Constants.Encoding.SystemDefault; - } - } - } - } - - public Encoding GetEncoding() { - return _Encoding; - } - - } -} diff --git a/pdfpatcher/App/Options/ExtractPageOptions.cs b/pdfpatcher/App/Options/ExtractPageOptions.cs deleted file mode 100644 index efa911cc8dc397a13b252b757593395032131827..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Options/ExtractPageOptions.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.Xml.Serialization; - -namespace PDFPatcher -{ - public class ExtractPageOptions - { - [XmlAttribute("压缩文档")] - public bool EnableFullCompression { get; set; } - [XmlAttribute("保留文档属性")] - public bool KeepDocumentProperties { get; set; } - [XmlAttribute("保留文档书签")] - public bool KeepBookmarks { get; set; } - [XmlAttribute("删除无效书签")] - public bool RemoveOrphanBookmarks { get; set; } - [XmlAttribute("解除文档限制")] - public bool RemoveDocumentRestrictions { get; set; } - [XmlAttribute("添加编号")] - public bool NumberFileNames { get; set; } - [XmlAttribute("拆分方式")] - public int SeparatingMode { get; set; } - [XmlAttribute("按页数拆分")] - public int SeparateByPage { get; set; } - - [XmlIgnore] - public string PageRanges { get; set; } - [XmlIgnore] - public string ExcludePageRanges { get; set; } - - public ExtractPageOptions() { - EnableFullCompression = true; - KeepBookmarks = true; - KeepDocumentProperties = true; - RemoveDocumentRestrictions = true; - RemoveOrphanBookmarks = true; - NumberFileNames = true; - SeparateByPage = 1; - } - } -} diff --git a/pdfpatcher/App/Options/ImageExtracterOptions.cs b/pdfpatcher/App/Options/ImageExtracterOptions.cs deleted file mode 100644 index 3ea5cae016e28f2dab14276953410354de7a301f..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Options/ImageExtracterOptions.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Xml.Serialization; - -namespace PDFPatcher -{ - public class ImageExtracterOptions - { - [XmlAttribute("自动指定输出位置")] - public bool AutoOutputFolder { get; set; } - - [XmlAttribute("避免重复导出图片")] - public bool SkipRedundantImages { get; set; } - - ///获取或指定是否合并相同页面、相同宽度的图片。 - [XmlAttribute("合并图片")] - public bool MergeImages { get; set; } - - ///获取或指定是否将合并的 JPEG 图片存为无损的 PNG 图片。 - [XmlAttribute("合并JPG图片为PNG")] - public bool MergeJpgToPng { get; set; } - - ///获取或指定是否垂直翻转导出的 PNG 或 TIFF 图片。 - [XmlAttribute("垂直翻转图片")] - public bool VerticalFlipImages { get; set; } - - /// 获取或指定是否反转黑白图片的颜色。 - [XmlAttribute("反转黑白图片颜色")] - public bool InvertBlackAndWhiteImages { get; set; } - [XmlAttribute("黑白图片导出为PNG")] - public bool MonoPng { get; set; } - - ///获取或指定是否导出批注内的图片。 - [XmlAttribute("导出批注图片")] - public bool ExtractAnnotationImages { get; set; } - - [XmlAttribute("最小高度")] - public int MinHeight { get; set; } - [XmlAttribute("最小宽度")] - public int MinWidth { get; set; } - - ///获取或指定导出页面图像所保存的目录路径。 - [XmlAttribute("导出路径")] - public string OutputPath { get; set; } - - ///获取或指定导出文件的名称掩码。 - [XmlAttribute("文件名称掩码")] - public string FileMask { get; set; } - - [XmlAttribute("导出掩模")] - public bool ExtractSoftMask { get; set; } - [XmlAttribute("取反掩模")] - public bool InvertSoftMask { get; set; } - - [XmlIgnore] - [PowerJson.JsonInclude(false)] - public string PageRange { get; set; } - - public ImageExtracterOptions() { - AutoOutputFolder = true; - FileMask = "0000"; - MergeJpgToPng = true; - } - } -} diff --git a/pdfpatcher/App/Options/ImporterOptions.cs b/pdfpatcher/App/Options/ImporterOptions.cs deleted file mode 100644 index d1e2da9cce9658fb7a360ef880bd1ed0e91643d1..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Options/ImporterOptions.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.Xml.Serialization; - -namespace PDFPatcher -{ - public class ImporterOptions - { - ///获取或指定是否导入文档属性信息。 - [XmlAttribute("导入文档属性")] - public bool ImportDocProperties { get; set; } - - ///获取或指定是否导入书签。 - [XmlAttribute("导入文档书签")] - public bool ImportBookmarks { get; set; } - - ///获取或指定是否导入页面内的连接。 - [XmlAttribute("导入页面链接")] - public bool ImportPageLinks { get; set; } - - ///获取或指定是否保留页面内的连接。 - [XmlAttribute("保留页面链接")] - public bool KeepPageLinks { get; set; } - - ///获取或指定是否导入阅读器设置。 - [XmlAttribute("导入阅读器设置")] - public bool ImportViewerPreferences { get; set; } - - ///获取或指定是否导入页面的阅读设置。 - [XmlAttribute("导入页面设置")] - public bool ImportPageSettings { get; set; } - - public ImporterOptions() { - ImportDocProperties = true; - ImportBookmarks = true; - ImportPageLinks = true; - ImportViewerPreferences = true; - ImportPageSettings = true; - } - } -} diff --git a/pdfpatcher/App/Options/MergerOptions.cs b/pdfpatcher/App/Options/MergerOptions.cs deleted file mode 100644 index af8645f5b346d12f49f657ee0db34b0fb612497a..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Options/MergerOptions.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Xml.Serialization; -using PDFPatcher.Model; - -namespace PDFPatcher -{ - public class MergerOptions : DocumentOptions - { - public MergerOptions() { - AutoBookmarkTitle = true; - AutoMaskBWImages = true; - AutoScaleDown = true; - FullCompression = true; - IgnoreLeadingNumbers = true; - KeepBookmarks = true; - NumericAwareSort = true; - RemoveOrphanBookmarks = true; - PageSettings = new PageBoxSettings(); - } - - [XmlElement("页面布局")] - public PageBoxSettings PageSettings { get; set; } - - ///获取或指定是否自动缩小图片以适合页面。 - [XmlAttribute("自动缩小")] - [DefaultValue(true)] - public bool AutoScaleDown { get; set; } - - ///获取或指定是否自动放大图片以填满页面。 - [XmlAttribute("自动放大")] - [DefaultValue(false)] - public bool AutoScaleUp { get; set; } - - [XmlAttribute("压缩冗余数据")] - [DefaultValue(false)] - public bool Deduplicate { get; set; } - - /// - /// 获取页面除去上下留白的高度。 - /// - [XmlIgnore] - public float ContentHeight { - get { - var ps = PageSettings; - return ps.PaperSize.Height - ps.Margins.Top - ps.Margins.Bottom; - } - } - /// - /// 获取页面除去左右留白的宽度。 - /// - [XmlIgnore] - public float ContentWidth { - get { - var ps = PageSettings; - return ps.PaperSize.Width - ps.Margins.Left - ps.Margins.Right; - } - } - - [XmlAttribute("水平DPI")] - public int DpiX { get; set; } - - [XmlAttribute("垂直DPI")] - public int DpiY { get; set; } - - [XmlAttribute("校正图片旋转角度")] - public bool DeskewImages { get; set; } - - [XmlAttribute("优化黑白图片压缩算法")] - public bool RecompressWithJbig2 { get; set; } - - ///获取或指定是否为黑白图片自动设为透明(在阅读器中不能用图像工具选中)。 - [XmlAttribute("黑白图片自动透明")] - public bool AutoMaskBWImages { get; set; } - - #region 文件列表选项 - ///获取或指定排序文件时是否按数值和文本排序。 - [XmlAttribute("按数值排序文件")] - [DefaultValue(true)] - public bool NumericAwareSort { get; set; } - - ///获取或指定排序文件时是否按超星阅读器的文件命名排序。 - [XmlAttribute("按超星阅读器排序文件")] - [DefaultValue(false)] - public bool CajSort { get; set; } - - ///获取或指定添加目录时是否将子目录排列在文件前面。 - [XmlAttribute("子目录")] - [DefaultValue(SubFolderPosition.BeforeFiles)] - public SubFolderPosition SubFolder { get; set; } - #endregion - - #region 自动生成书签选项 - ///获取或指定忽略文件名的前导数值。 - [XmlAttribute("自动生成书签文本")] - [DefaultValue(true)] - public bool AutoBookmarkTitle { get; set; } - - ///获取或指定忽略文件名的前导数值。 - [XmlAttribute("忽略前导数字")] - [DefaultValue(true)] - public bool IgnoreLeadingNumbers { get; set; } - - ///获取或指定是否保留 PDF 文档的书签。 - [XmlAttribute("保留书签")] - [DefaultValue(true)] - public bool KeepBookmarks { get; set; } - - ///获取或指定是否删除没有目标(页面失效)的书签。 - [XmlAttribute("删除失效书签")] - [DefaultValue(true)] - public bool RemoveOrphanBookmarks { get; set; } - #endregion - - public enum SubFolderPosition - { - BeforeFiles, - WithFiles, - Exclude - } - } -} diff --git a/pdfpatcher/App/Options/OcrOptions.cs b/pdfpatcher/App/Options/OcrOptions.cs deleted file mode 100644 index d101649f269903d5e874f017a30ac2ea75ccda5a..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Options/OcrOptions.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Serialization; -using PDFPatcher.Model; - -namespace PDFPatcher -{ - public class OcrOptions - { - //[XmlAttribute ("页码范围")] - [XmlIgnore] - public string PageRanges { get; set; } - - #region 光学字符识别选项 - [XmlAttribute("识别语言")] - public int OcrLangID { get; set; } - [XmlAttribute("旋转校正")] - public bool OrientPage { get; set; } - [XmlAttribute("拉伸校正")] - public bool StretchPage { get; set; } - [XmlIgnore] - public float QuantitativeFactor { get; set; } - [XmlAttribute("排版")] - public WritingDirection WritingDirection { get; set; } - [XmlAttribute("识别分栏")] - public bool DetectColumns { get; set; } - [XmlAttribute("目录识别模式")] - public bool DetectContentPunctuations { get; set; } - [XmlAttribute("压缩空白")] - public bool CompressWhiteSpaces { get; set; } - [XmlAttribute("删除汉字间空白")] - public bool RemoveWhiteSpacesBetweenChineseCharacters { get; set; } - [XmlAttribute("识别前保留图像颜色")] - public bool PreserveColor { get; set; } - [XmlAttribute("导出原始识别结果")] - public bool OutputOriginalOcrResult { get; set; } - [XmlAttribute("在屏幕输出识别文本")] - public bool PrintOcrResult { get; set; } - [XmlIgnore] - public string SaveOcredImagePath { get; set; } - #endregion - - public OcrOptions() { - OcrLangID = 2052; - DetectColumns = true; - } - } -} diff --git a/pdfpatcher/App/Options/PatcherOptions.cs b/pdfpatcher/App/Options/PatcherOptions.cs deleted file mode 100644 index 4db126e64a6963d2e88ec566be84df9a68e1949e..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Options/PatcherOptions.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Xml.Serialization; -using PDFPatcher.Model; - -namespace PDFPatcher -{ - [XmlRoot("文档设置")] - public class PatcherOptions : DocumentOptions - { - [XmlAttribute("嵌入字库")] - public bool EmbedFonts { get; set; } - [XmlAttribute("删除文本尾随空白")] - public bool TrimTrailingWhiteSpace { get; set; } - [XmlAttribute("允许替换字库")] - public bool EnableFontSubstitutions { get; set; } - [XmlAttribute("修复内容流")] - public bool FixContents { get; set; } - [XmlAttribute("删除批注")] - public bool RemoveAnnotations { get; set; } - [XmlAttribute("删除导航书签")] - public bool RemoveBookmarks { get; set; } - [XmlAttribute("删除页面开头指令")] - [XmlIgnore] - public int RemoveLeadingCommandCount { get; set; } - [XmlAttribute("删除页面结尾指令")] - [XmlIgnore] - public int RemoveTrailingCommandCount { get; set; } - [XmlAttribute("删除使用限制")] - public bool RemoveUsageRights { get; set; } - [XmlAttribute("删除文档自动动作")] - public bool RemoveDocAutoActions { get; set; } - [XmlAttribute("删除页面自动动作")] - public bool RemovePageAutoActions { get; set; } - [XmlAttribute("删除页面表单")] - public bool RemovePageForms { get; set; } - [XmlAttribute("删除链接批注")] - public bool RemovePageLinks { get; set; } - [XmlAttribute("删除页面元数据")] - public bool RemovePageMetaData { get; set; } - [XmlAttribute("删除页面文本")] - public bool RemovePageTextBlocks { get; set; } - [XmlAttribute("删除页面缩略图")] - public bool RemovePageThumbnails { get; set; } - [XmlAttribute("删除XML元数据")] - public bool RemoveXmlMetadata { get; set; } - [XmlAttribute("优化黑白图片压缩算法")] - public bool RecompressWithJbig2 { get; set; } - - [XmlElement("页面布局")] - public PageBoxSettings UnifiedPageSettings { get; set; } - [XmlArray("页面设置")] - [XmlArrayItem("设置项")] - public List PageSettings { get; } - [XmlArray("字体替换")] - [XmlArrayItem("替换项")] - public List FontSubstitutions { get; } - - public PatcherOptions() { - PageSettings = new List(); - FontSubstitutions = new List(); - UnifiedPageSettings = new PageBoxSettings(); - } - } - - public class FontSubstitution - { - [XmlAttribute("原字体")] - public string OriginalFont { get; set; } - [XmlAttribute("新字体")] - [PowerJson.JsonField("SubstitutionFont")] - public string Substitution { get; set; } - [XmlAttribute("原字符")] - public string OriginalCharacters { get; set; } - [XmlAttribute("替换字符")] - public string SubstituteCharacters { get; set; } - [XmlAttribute("简繁替换")] - public int TraditionalChineseConversion { get; set; } - [XmlAttribute("数字替换")] - public int NumericWidthConversion { get; set; } - [XmlAttribute("字母替换")] - public int AlphabeticWidthConversion { get; set; } - [XmlAttribute("符号替换")] - public int PunctuationWidthConversion { get; set; } - } - -} diff --git a/pdfpatcher/App/Options/ToolbarOptions.cs b/pdfpatcher/App/Options/ToolbarOptions.cs deleted file mode 100644 index 0e40c16af51e131c1d2e4c9e5db07c82e67939a3..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Options/ToolbarOptions.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Windows.Forms; -using System.Xml.Serialization; - -namespace PDFPatcher -{ - public class ToolbarOptions - { - [XmlAttribute("显示主工具栏")] - [System.ComponentModel.DefaultValue(true)] - public bool ShowGeneralToolbar { get; set; } - - readonly List _Buttons = new List(); - [XmlElement("按钮")] - public List Buttons => _Buttons; - - public ToolbarOptions() { - ShowGeneralToolbar = true; - } - - public void Reset() { - Buttons.Clear(); - foreach (var item in Toolkit.Toolkits) { - Buttons.Add(new ButtonOption(item.Identifier, item.Name, item.ShowText, item.DefaultVisible)); - } - } - - internal void RemoveInvalidButtons() { - if (_Buttons.Count == 0) { - Reset(); - return; - } - for (int i = Buttons.Count - 1; i >= 0; i--) { - if (Buttons[i].GetToolkit() == null) { - Buttons.RemoveAt(i); - } - } - } - - internal void AddMissedButtons() { - foreach (var item in Toolkit.Toolkits) { - foreach (var b in Buttons) { - if (b.ID == item.Identifier) { - goto Next; - } - } - Buttons.Add(new ButtonOption(item.Identifier, item.Name, item.ShowText, false)); - Next: - ; - } - } - - public class ButtonOption - { - string _Id; - [XmlAttribute("ID")] - public string ID { get => _Id; set => _Id = (value == "BookmarkEditor" ? "Editor" : value); } - [XmlAttribute("按钮名称")] - public string DisplayName { get; set; } - [XmlAttribute("显示按钮文字")] - public bool ShowText { get; set; } - [XmlAttribute("显示按钮")] - public bool Visible { get; set; } - - public ButtonOption() { - } - public ButtonOption(string id, string name, bool showText, bool visible) { - ID = id; - DisplayName = name; - ShowText = showText; - Visible = visible; - } - - internal Toolkit GetToolkit() { - return Toolkit.Get(ID); - } - internal ToolStripButton CreateButton() { - var b = GetToolkit().CreateButton(); - b.Text = DisplayName; - b.DisplayStyle = ShowText ? ToolStripItemDisplayStyle.ImageAndText : ToolStripItemDisplayStyle.Image; - return b; - } - } - } -} diff --git a/pdfpatcher/App/Options/ViewerOptions.cs b/pdfpatcher/App/Options/ViewerOptions.cs deleted file mode 100644 index 462ff7d906551c78ccb7a5880a353a8595277d69..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Options/ViewerOptions.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Serialization; -using PDFPatcher.Model; - -namespace PDFPatcher -{ - public class ViewerOptions - { - ///获取或指定初始查看状态的值。 - [XmlAttribute("初始状态")] - public string InitialView { get; set; } - ///获取或指定双页阅读方向的值。 - [XmlAttribute("阅读方向")] - public string Direction { get; set; } - ///获取或指定阅读器初始模式的值。 - [XmlAttribute("初始模式")] - public string InitialMode { get; set; } - ///获取或指定是否删除 XYZ 目标的缩放比例,或将 Fit、FitH、FitV 转换为 XYZ。 - [XmlAttribute("删除缩放比例")] - public bool RemoveZoomRate { get; set; } - [XmlAttribute("强制内部链接")] - public bool ForceInternalLink { get; set; } - ///获取或指定是否将书签状态设置为关闭。 - [XmlAttribute("书签状态")] - public BookmarkStatus CollapseBookmark { get; set; } - [XmlAttribute("指定阅读器设置")] - public bool SpecifyViewerPreferences { get; set; } - [XmlAttribute("隐藏菜单")] - public bool HideMenu { get; set; } - [XmlAttribute("隐藏工具栏")] - public bool HideToolbar { get; set; } - [XmlAttribute("隐藏程序界面")] - public bool HideUI { get; set; } - [XmlAttribute("适合窗口")] - public bool FitWindow { get; set; } - [XmlAttribute("窗口居中")] - public bool CenterWindow { get; set; } - [XmlAttribute("显示文档标题")] - public bool DisplayDocTitle { get; set; } - } -} diff --git a/pdfpatcher/App/Options/WindowStatus.cs b/pdfpatcher/App/Options/WindowStatus.cs deleted file mode 100644 index d8d80fd3f5357ab95732888f004be9b5b9b36047..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Options/WindowStatus.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Windows.Forms; -using System.Xml.Serialization; - -namespace PDFPatcher -{ - public class WindowStatus - { - //[XmlAttribute("屏幕")] - //public int ScreenId { get; set; } - - [XmlAttribute("状态")] - public FormWindowState State { get; set; } - - [XmlAttribute("左")] - public int Left { get; set; } - - [XmlAttribute("上")] - public int Top { get; set; } - - [XmlAttribute("宽")] - public int Width { get; set; } - - [XmlAttribute("高")] - public int Height { get; set; } - - public int Right => Left + Width; - public int Bottom => Top + Height; - - public WindowStatus() {} - - public WindowStatus(Form form) { - //var s = Screen.FromControl(form); - //ScreenId = Array.IndexOf(Screen.AllScreens, s); - State = form.WindowState; - Left = form.Left; - Top = form.Top; - Width = form.Width; - Height = form.Height; - } - - public void Position(Form form) { - var a = Screen.FromControl(form).WorkingArea; - if (a.IntersectsWith(new System.Drawing.Rectangle(Left, Top, Width, Height)) == false) { - return; - } - form.StartPosition = FormStartPosition.Manual; - form.WindowState = State == FormWindowState.Minimized ? FormWindowState.Normal : State; - form.Left = Left; - form.Top = Top; - form.Width = Width; - form.Height = Height; - } - } -} diff --git a/pdfpatcher/App/PDFPatcher.csproj b/pdfpatcher/App/PDFPatcher.csproj deleted file mode 100644 index 67f855d3ffbaf0a8596eefabae38a6a561d37e92..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/PDFPatcher.csproj +++ /dev/null @@ -1,1063 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {77A9FBD2-FB25-4590-864A-64A01A8724C4} - WinExe - Properties - PDFPatcher - PDFPatcher - v4.0 - 512 - pdf_icon.ico - true - true - wmjordan.snk - PDFPatcher.Program - OnOutputUpdated - - - - - - true - ..\bin\Debug\ - TRACE;DEBUG;NET40;SOURCE_INCLUDE - true - full - x86 - prompt - false - latest - false - - - ..\bin\Release\ - TRACE;NET40;SOURCE_INCLUDE - true - true - pdbonly - x86 - false - prompt - latest - false - - - Common\app.manifest - - - - Lib\ColorPicker.dll - - - ..\packages\CyotekImageBox.1.3.1\lib\net20\Cyotek.Windows.Forms.ImageBox.dll - - - Lib\FreeImageNET.dll - - - Lib\HtmlRenderer.dll - - - Lib\HtmlRenderer.WinForms.dll - - - Lib\itextAsian.dll - - - Lib\itextsharp.dll - - - Lib\JacksonSoft.CustomTabControl.dll - - - ..\packages\ObjectListView.Official.2.9.1\lib\net20\ObjectListView.dll - - - Lib\PowerJson.dll - - - - - - - - - - - True - True - Configuration.resx - - - - - - - - - - - - - - - Form - - - FontCharSubstitutionForm.cs - - - - - - - - - - - - - - - - - - - - - - Form - - - CustomPatternForm.cs - - - - Form - - - PagePropertyForm.cs - - - - - - - Component - - - - - - - - - - Form - - - CustomizeToolbarForm.cs - - - Form - - - Form - - - AutoBookmarkForm.cs - - - Form - - - DocumentInfoForm.cs - - - Form - - - InsertPageLabelForm.cs - - - - - - UserControl - - - - - - - - - - - - - - - Component - - - Form - - - InsertBookmarkForm.cs - - - Component - - - - UserControl - - - FrontPageControl.cs - - - Form - - - DocumentFontListForm.cs - - - Form - - - AddPdfObjectForm.cs - - - Form - - - EditAdjustmentForm.cs - - - Form - - - FontFilterForm.cs - - - UserControl - - - FontNameConditionEditor.cs - - - UserControl - - - PageSettingsEditor.cs - - - UserControl - - - FontSubstitutionsEditor.cs - - - UserControl - - - Form - - - ImageViewerForm.cs - - - Form - - - SavePdfForm.cs - - - Form - - - MergerOptionForm.cs - - - UserControl - - - InfoExchangerControl.cs - - - - UserControl - - - RenameControl.cs - - - Component - - - UserControl - - - TextSizeConditionEditor.cs - - - - - - UserControl - - - OcrControl.cs - - - UserControl - - - PageRangeConditionEditor.cs - - - UserControl - - - TextConditionEditor.cs - - - UserControl - - - DocumentInspectorControl.cs - - - UserControl - - - TextPositionConditionEditor.cs - - - Form - - - TextViewerForm.cs - - - UserControl - - - RenderImageControl.cs - - - UserControl - - - MergerControl.cs - - - Form - - - SourcePdfOptionForm.cs - - - Form - - - UpdateForm.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Form - - - ActionEditorForm.cs - - - Component - - - BookmarkEditorView.cs - - - UserControl - - - EditorControl.cs - - - UserControl - - - DocumentInfoEditor.cs - - - Component - - - Component - - - Form - - - NewCoordinateEntryForm.cs - - - UserControl - - - PageLabelEditor.cs - - - Form - - - RenamePreviewForm.cs - - - Component - - - Form - - - SearchBookmarkForm.cs - - - Form - - - ShiftPageNumberEntryForm.cs - - - UserControl - - - ExtractImageControl.cs - - - Form - - - SourceImageOptionForm.cs - - - Form - - - AppOptionForm.cs - - - UserControl - - - ViewerPreferenceEditor.cs - - - UserControl - - - AutoBookmarkControl.cs - - - Form - - - ZoomRateEntryForm.cs - - - Form - - - MainForm.cs - - - - - - - - - - - - - - - - - - - - Code - - - Code - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Code - - - - - - - - - - - Code - - - - - - - - - - UserControl - - - AboutControl.cs - - - - UserControl - - - BookmarkControl.cs - - - Form - - - PatcherOptionForm.cs - - - - UserControl - - - TargetFileControl.cs - - - UserControl - - - PatcherControl.cs - - - - - - - - - - True - True - Resources.resx - - - - - - - - - Form - - - InfoFileOptionControl.cs - - - - - Form - - - PasswordEntryForm.cs - - - - - - - - - ResXFileCodeGenerator - Configuration.Designer.cs - - - FontCharSubstitutionForm.cs - - - AutoBookmarkForm.cs - - - CustomPatternForm.cs - - - DocumentInfoForm.cs - - - InsertBookmarkForm.cs - - - CustomizeToolbarForm.cs - - - InsertPageLabelForm.cs - - - PagePropertyForm.cs - - - FrontPageControl.cs - Designer - - - AboutControl.cs - Designer - - - ActionEditorForm.cs - - - BookmarkEditorView.cs - - - EditorControl.cs - Designer - - - DocumentInfoEditor.cs - - - EditAdjustmentForm.cs - - - InfoFileOptionControl.cs - Designer - - - InfoExchangerControl.cs - - - RenameControl.cs - - - PatcherControl.cs - - - BookmarkControl.cs - Designer - - - PatcherOptionForm.cs - - - FontFilterForm.cs - - - FontNameConditionEditor.cs - - - ImageViewerForm.cs - - - SavePdfForm.cs - - - TextSizeConditionEditor.cs - - - NewCoordinateEntryForm.cs - - - PageLabelEditor.cs - - - RenamePreviewForm.cs - - - SearchBookmarkForm.cs - - - ShiftPageNumberEntryForm.cs - - - TargetFileControl.cs - Designer - - - ExtractImageControl.cs - Designer - - - SourceImageOptionForm.cs - - - AppOptionForm.cs - Designer - - - ViewerPreferenceEditor.cs - - - AutoBookmarkControl.cs - Designer - - - PasswordEntryForm.cs - Designer - - - ZoomRateEntryForm.cs - - - OcrControl.cs - Designer - - - PageRangeConditionEditor.cs - - - TextConditionEditor.cs - - - DocumentInspectorControl.cs - - - MainForm.cs - Designer - - - ResXFileCodeGenerator - Designer - Resources.Designer.cs - - - SourceFileControl.cs - Designer - - - ExtractPageControl.cs - Designer - - - ReportControl.cs - Designer - - - - UserControl - - - SourceFileControl.cs - - - UserControl - - - ExtractPageControl.cs - - - - UserControl - - - ReportControl.cs - - - - - PreserveNewest - - - PreserveNewest - - - - - - - Designer - - - Designer - - - - - - - - - DocumentFontListForm.cs - - - AddPdfObjectForm.cs - - - PageSettingsEditor.cs - - - FontSubstitutionsEditor.cs - - - MergerOptionForm.cs - - - TextPositionConditionEditor.cs - - - TextViewerForm.cs - - - RenderImageControl.cs - Designer - - - MergerControl.cs - - - SourcePdfOptionForm.cs - Designer - - - UpdateForm.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 此项目引用这台计算机上缺少的 NuGet 程序包。使用 NuGet 程序包还原可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 - - - - - - - - - - - - - - \ No newline at end of file diff --git a/pdfpatcher/App/Processor/AutoBookmarkCreator.cs b/pdfpatcher/App/Processor/AutoBookmarkCreator.cs deleted file mode 100644 index 825b36084fcd59bb2911cf30c371d23022f8cea4..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/AutoBookmarkCreator.cs +++ /dev/null @@ -1,778 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Xml; -using iTextSharp.text; -using iTextSharp.text.pdf; -using iTextSharp.text.pdf.parser; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - sealed class AutoBookmarkCreator - { - sealed class SizeOccurrence - { - public float Size { get; set; } - public int FirstPage { get; set; } - public string FirstInstance { get; set; } - public int Occurrence { get; set; } - public SizeOccurrence(float size, int page, string instance) { - Size = size; - Occurrence = 1; - FirstPage = page; - FirstInstance = instance.Length > 50 ? instance.Substring(0, 50) : instance; - } - } - sealed class FontOccurrence - { - readonly Dictionary> oc = new Dictionary>(); - internal List GetOccurrence(string fontName) { - return oc.TryGetValue(fontName, out List s) ? s : null; - } - - internal void AddOccurrence(string fontName, float size, int page, string instance) { - if (oc.ContainsKey(fontName) == false) { - oc.Add(fontName, new List() { new SizeOccurrence(size, page, instance) }); - } - else { - var o = oc[fontName].Find((s) => { return s.Size == size; }); - if (o != null) { - o.Occurrence++; - } - else { - oc[fontName].Add(new SizeOccurrence(size, page, instance)); - } - } - } - } - const string __AddSpaceAfterCharacters = ":.,\"'?!)]};"; - const string __InsertSpaceBeforeCharacters = "\"'([{"; - - readonly PdfReader _reader; - readonly AutoBookmarkOptions _options; - const int OpenWorkload = 10; - public AutoBookmarkCreator(PdfReader reader, AutoBookmarkOptions options) { - _reader = reader; - _options = options; - TextLine.DefaultDirection = options.WritingDirection; - } - - internal int EstimateWorkload() { - var n = _reader.NumberOfPages; - var load = 0; - load += OpenWorkload; - var t = PageRangeCollection.Parse(_options.PageRanges, 1, n, true).TotalPages; - load += t > 0 ? t : n; - return load; - } - - internal void ExportAutoBookmarks(XmlWriter w, AutoBookmarkOptions options) { - AutoCreateBookmarks(w, _reader, options); - } - - internal void AutoCreateBookmarks(XmlWriter writer, PdfReader reader, AutoBookmarkOptions options) { - Tracker.IncrementProgress(OpenWorkload); - int pn = reader.NumberOfPages + 1; - var c = new AutoBookmarkContext() { TotalPageNumber = reader.NumberOfPages }; - var p = new TextToBookmarkProcessor(options, c); - var lp = new LevelProcessor(options.LevelAdjustment); - var ranges = PageRangeCollection.Parse(options.PageRanges, 1, reader.NumberOfPages, true); - var doc = new XmlDocument(); - var be = doc.AppendChild(doc.CreateElement(Constants.Bookmark)) as XmlElement; - float size = -1; - var sizes = new Stack(); - float yOffset = 1 + options.YOffset; - int level = 0; - const string indentString = "          "; - List ig; - var fontOccurrences = new FontOccurrence(); - if (options.IgnorePatterns.Count == 0) { - ig = null; - } - else { - ig = new List(); - foreach (var item in options.IgnorePatterns) { - if (String.IsNullOrEmpty(item.Text)) { - continue; - } - try { - ig.Add(item.CreateMatcher()); - } - catch (ArgumentException ex) { - Tracker.TraceMessage(Tracker.Category.Alert, (String.Concat("忽略文本(", item, ")无效:", ex.Message))); - } - } - } - - XmlWriter oldWriter = null; - if (options.ExportTextCoordinates == false) { - oldWriter = writer; - writer = new Processor.NullXmlWriter(); - } - foreach (PageRange r in ranges) { - for (int i = r.StartValue; i <= r.EndValue && i < pn; i++) { - if (i == 1 && options.CreateBookmarkForFirstPage) { - continue; - } - //Tracker.TraceMessage (String.Concat ("分析第 ", i, " 页。")); - var box = reader.GetCropBox(i); - p.Reset(); - c.PageBox = box; - c.CurrentPageNumber = i; - var pr = reader.GetPageRotation(i); - pr = PdfHelper.NormalizeRotationNumber(pr); - if (pr != 0) { - p.RotationMatrix = pr switch { - 90 => new Matrix(0, 1, -1, 0, 0, 0), - 180 => new Matrix(0, -1, -1, 0, 0, 0), - 270 => new Matrix(0, -1, 1, 0, 0, 0), - _ => p.RotationMatrix - }; - } - p.ProcessContent(reader.GetPageContent(i), reader.GetPageNRelease(i).GetAsDict(PdfName.RESOURCES)); - //p.SortTextList (); - //p.PostProcessTextList (); - - //var tr = p.TextList; - c.IsTextMerged = false; - c.TextLine = null; - // TODO: 自动根据已知排版方向比例修正排版方向 - // 合并前筛选文本 - var ptl = p.TextList; - for (int li = ptl.Count - 1; li >= 0; li--) { - c.TextInfo = ptl[li]; - if (lp.ChangeSizeLevel(c) < options.TitleThreshold) { - ptl.RemoveAt(li); - } - } - var tl = MergeTextInfoList(box, ptl, _options); - // TODO: 筛选文本 - c.IsTextMerged = true; - for (int li = tl.Count - 1; li >= 0; li--) { - c.TextLine = tl[li]; - c.TextInfo = c.TextLine.FirstText; - if ((c.TextInfo.Size = lp.ChangeSizeLevel(c)) < options.TitleThreshold) { - tl.RemoveAt(li); - } - } - var tr = MergeTextLines(box, tl); - if (tr != null && tr.Count > 0) { - if (options.WritingDirection != WritingDirection.Unknown) { - tr.Sort((a, b) => { - var ra = a.Region; - var rb = b.Region; - if (ra.Middle < rb.Middle) return 1; - else if (ra.Middle > rb.Middle) return -1; - else if (ra.Center > rb.Center) return 1; - else if (ra.Center < rb.Center) return -1; - else return 0; - }); - } - writer.WriteStartElement(Constants.Content.Texts); - writer.WriteValue(Constants.Content.PageNumber, i); - foreach (var item in tr) { - var t = PdfHelper.GetValidXmlString(ConcatRegionText(item)).Trim(); - var f = item.Lines[0].FirstText.Font; - var s = item.Lines[0].FirstText.Size; - writer.WriteStartElement("文本"); - writer.WriteAttributeString(Constants.Font.ThisName, f != null ? f.FontID.ToText() : "OCR"); - writer.WriteValue(Constants.Coordinates.Top, item.Region.Top); - writer.WriteValue(Constants.Coordinates.Bottom, item.Region.Bottom); - writer.WriteValue(Constants.Coordinates.Left, item.Region.Left); - writer.WriteValue(Constants.Coordinates.Width, item.Region.Width); - writer.WriteValue(Constants.Coordinates.Height, item.Region.Height); - writer.WriteValue("尺寸", s); - writer.WriteString(t); - writer.WriteEndElement(); - - if (t.Length == 0 - || (t.Length == 1 && options.IgnoreSingleCharacterTitle) - || (options.IgnoreNumericTitle && AutoBookmarkOptions.NumericPattern.IsMatch(t)) - ) { - continue; - } - if (ig != null) { - bool ignore = false; - foreach (var rg in ig) { - if (rg.Matches(t)) { - ignore = true; - continue; - } - } - if (ignore) { - continue; - } - } - if (options.AutoHierarchicalArrangement) { - do { - //if (ValueHelper.TryParse (be.GetAttribute (Constants.Font.Size), out size) == false || s < size) { - if (sizes.Count == 0 || s < (size = sizes.Peek())) { - be = be.AppendChild(doc.CreateElement(Constants.Bookmark)) as XmlElement; - sizes.Push(s); - level++; - break; - } - else if (s == size) { - be = (be.ParentNode ?? be).AppendChild(doc.CreateElement(Constants.Bookmark)) as XmlElement; - break; - } - be = be.ParentNode as XmlElement; - sizes.Pop(); - level--; - } while (s > size && be.NodeType == XmlNodeType.Element); - } - else { - be = doc.DocumentElement.AppendChild(doc.CreateElement(Constants.Bookmark)) as XmlElement; - } - be.SetAttribute(Constants.BookmarkAttributes.Title, t); - be.SetAttribute(Constants.DestinationAttributes.Page, i.ToText()); - be.SetAttribute(Constants.DestinationAttributes.View, Constants.DestinationAttributes.ViewType.XYZ); - be.SetAttribute(Constants.Coordinates.Top, ValueHelper.ToText(item.Region.Top + s * yOffset)); - be.SetAttribute(Constants.Font.Size, s.ToText()); - if (f != null) { - be.SetAttribute(Constants.Font.ThisName, f.FontID.ToText()); - } - CountFontOccurrenceInRegion(fontOccurrences, i, item); -#if DEBUG - Tracker.TraceMessage(String.Concat(item.Direction.ToString()[0], ':', level < 11 ? indentString.Substring(0, level) : indentString, t, " .... ", i.ToText())); -#else - Tracker.TraceMessage (String.Concat (level < 11 ? indentString.Substring (0, level) : indentString, t, " .... ", ValueHelper.ToText (i))); -#endif - } - writer.WriteEndElement(); - } - Tracker.IncrementProgress(1); - } - } - - if (oldWriter != null) { - writer = oldWriter; - } - - WriteDocumentFontOccurrences(writer, options, p, fontOccurrences); - SetGoToTop(options, doc); - writer.WriteStartElement(Constants.DocumentBookmark); - if (options.CreateBookmarkForFirstPage && String.IsNullOrEmpty(options.FirstPageTitle) == false) { - writer.WriteStartElement(Constants.Bookmark); - writer.WriteAttributeString(Constants.BookmarkAttributes.Title, options.FirstPageTitle); - writer.WriteAttributeString(Constants.DestinationAttributes.Page, "1"); - writer.WriteAttributeString(Constants.DestinationAttributes.Action, Constants.ActionType.Goto); - writer.WriteEndElement(); - } - doc.DocumentElement.WriteContentTo(writer); - writer.WriteEndElement(); - } - - static void SetGoToTop(AutoBookmarkOptions options, XmlDocument doc) { - if (options.PageTopForLevel > 0) { - var topics = doc.DocumentElement.SelectNodes(".//书签[count(ancestor::书签) < " + (options.PageTopForLevel + 1) + "]"); - foreach (XmlElement t in topics) { - t.RemoveAttribute(Constants.Coordinates.Top); - } - } - } - - static void WriteDocumentFontOccurrences(XmlWriter writer, AutoBookmarkOptions options, TextToBookmarkProcessor p, FontOccurrence fontOccurrences) { - writer.WriteStartElement(Constants.Font.DocumentFont); - Tracker.TraceMessage("\n文档所用的字体"); - var dl = new List(); - foreach (var item in p.FontList) { - var fo = "0"; - var sl = fontOccurrences.GetOccurrence(item.Value); - if (sl != null) { - if (dl.Contains(item.Value) == false) { - int o = 0; - foreach (var s in sl) { - o += s.Occurrence; - } - fo = o.ToText(); - dl.Add(item.Value); - } - else { - sl = null; - } - } - if (options.DisplayFontStatistics && (sl != null || options.DisplayAllFonts)) { - Tracker.TraceMessage(String.Concat("编号:", item.Key, "\t出现次数:", fo, "\t名称:", item.Value)); - } - writer.WriteStartElement(Constants.Font.ThisName); - writer.WriteAttributeString(Constants.Font.ID, item.Key.ToText()); - writer.WriteAttributeString(Constants.Font.Name, item.Value); - writer.WriteAttributeString(Constants.FontOccurrence.Count, fo); - if (sl != null) { - foreach (var s in sl) { - writer.WriteStartElement(Constants.Font.Size); - writer.WriteAttributeString(Constants.Font.Size, s.Size.ToText()); - writer.WriteAttributeString(Constants.FontOccurrence.Count, s.Occurrence.ToText()); - writer.WriteAttributeString(Constants.FontOccurrence.FirstText, s.FirstInstance); - writer.WriteAttributeString(Constants.FontOccurrence.FirstPage, s.FirstPage.ToText()); - if (options.DisplayFontStatistics && (s.Occurrence > 0 || options.DisplayAllFonts)) { - Tracker.TraceMessage(String.Concat("\t尺寸:", s.Size.ToText(), "\t出现次数:", s.Occurrence.ToText(), "\t首次出现于第", s.FirstPage.ToText(), "页(", s.FirstInstance, ")")); - } - writer.WriteEndElement(); - } - } - writer.WriteEndElement(); - } - writer.WriteEndElement(); - } - - static void CountFontOccurrenceInRegion(FontOccurrence fontOccurrences, int i, TextRegion item) { - FontInfo f = null; - foreach (var il in item.Lines) { - foreach (var ii in il.Texts) { - if (ii.Font != null && (f == null || ii.Font.FontID != f.FontID)) { - fontOccurrences.AddOccurrence(ii.Font.FontName, ii.Size, i, il.Text); - f = ii.Font; - } - } - } - } - - static string ConcatRegionText(TextRegion region) { - var ls = region.Lines; - if (ls.Count == 0) { - return String.Empty; - } - else if (ls.Count == 1) { - return ls[0].Text; - } - ls = new List(ls); - if (region.Direction == WritingDirection.Vertical) { - ls.Sort((a, b) => { - if (a.Region.Middle < b.Region.Middle) { - return 1; - } - else if (a.Region.Middle > b.Region.Middle) { - return -1; - } - return 0; - }); - } - var sb = StringBuilderCache.Acquire(); - sb.Append(ls[0].Text); - for (int i = 1; i < ls.Count; i++) { - var l = ls[i].Text; - var ll = ls[i - 1].Text; - if (ll.Length > 0 && l.Length > 0) { - var c1 = l[l.Length - 1]; - var c2 = ll[0]; - if ((__AddSpaceAfterCharacters.IndexOf(c1) != -1 - || (Char.IsLetterOrDigit(c1) && c1 < 0x4E00 /*非中文字符*/)) - && (__InsertSpaceBeforeCharacters.IndexOf(c2) != -1 - || (Char.IsLetterOrDigit(c2) && c2 < 0x4E00))) { - sb.Append(' '); - } - } - sb.Append(l); - } - return StringBuilderCache.GetStringAndRelease(sb); - } - - /// - /// 使用最小距离法将 的文本聚类为 列表。 - /// - /// 包含文本位置及尺寸信息的 集合。 - /// 聚类后所得的 列表。 - internal static List MergeTextInfoList(Rectangle pageBox, IList textInfos, AutoBookmarkOptions options) { - var ll = new List(); - // 同行合并宽度最小值 - var cw = pageBox.Width / 6; - var ch = pageBox.Height / 6; - - var dirCount = new int[4]; - // 遍历识别所得的各 TextInfo,使用最小距离聚类方法将其聚类为行 - foreach (var item in textInfos) { - var ir = item.Region; - DistanceInfo cd = null; // TextInfo 到 TextLine 的距离 - var md = new DistanceInfo(DistanceInfo.Placement.Unknown, float.MaxValue, float.MaxValue); // 最小距离 - TextLine ml = null; // 最小距离的 TextLine - - // 求最小距离的 TextLine - float ds = item.Size / 10; - // 循环只包含了 TextLine,未包含文本 TextInfo 的其余文本 - var end = ll.Count > 5 ? ll.Count - 5 : 0; - for (int i = ll.Count - 1; i >= end; i--) { - var li = ll[i]; - // 文本尺寸应在误差范围之内 - if (Math.Abs(item.Size - li.FirstText.Size) > ds && options.MergeDifferentSizeTitles == false) { - continue; - } - if (options.MergeDifferentFontTitles == false && li.FirstText.Font.FontID != item.Font.FontID) { - break; - } - cd = li.GetDistance(ir); - if ((cd.IsOverlapping // 当前项与文本行交叠 - && (md.IsOverlapping == false // 最小距离不是交叠 - || cd.DistanceRadial < md.DistanceRadial) // 当前项与文本行的交叠中心距离小于最小距离 - ) - //&& (options.MergeDifferentFontTitles || li.FirstText.Font.FontID == item.Font.FontID) - || ((md.Location == DistanceInfo.Placement.Unknown // 未知最小距离 - || (cd.IsOverlapping == false - && md.IsOverlapping == false - && cd.MinDistance < md.MinDistance) // 当前项与文本行的距离小于最小距离 - ) - && (((cd.IsHorizontallyAligned) // 相对位置为水平 - && li.Direction != WritingDirection.Vertical // 文本行方向不为纵向 - && item.Region.IsAlignedWith(li.Region, WritingDirection.Horizontal) // 两者处于同一横行 - ) - || ((cd.IsVerticallyAligned) // 相对位置为垂直 - && li.Direction != WritingDirection.Horizontal // 文本行方向不为横向 - && item.Region.IsAlignedWith(li.Region, WritingDirection.Vertical) // 两者处于同一纵行 - // && Math.Abs (item.Region.Middle - li.Region.Middle) < li.Region.Height // 行间距离小于行高 - ) - ) - && (options.DetectColumns == false || cd.MinDistance < cw) - && (options.MergeDifferentFontTitles || li.FirstText.Font.FontID == item.Font.FontID) - ) - ) { - md = cd; - ml = li; - if (cd.IsLeft) { - dirCount[0]++; - } - else if (cd.IsRight) { - dirCount[1]++; - } - else if (cd.IsAbove) { - dirCount[2]++; - } - else if (cd.IsBelow) { - dirCount[3]++; - } - } - } - - // 否则,用 item 创建新的 TextLine - if (item.Text.Length == 0) { - item.Text = " "; - } - if (ml != null) { - // 若存在最小距离的 TextLine 且可合并,则将 item 归入 TextLine - if (md.IsOverlapping && options.IgnoreOverlappedText) { - // 检查是否存在交叠重复的文本 - foreach (var t in ml.Texts) { - if (t.Region.IntersectWith(item.Region) // item 与 TextLine 中某项交叠 - && (t.Text.Contains(item.Text) || item.Text.Contains(t.Text) // 交叠的项文本和 item 的文本相同 - ) - ) { - goto Next; // 忽略此项目 - } - } - } - ml.AddText(item); - } - else { - ll.Add(new TextLine(item)); - } - Next: - continue; - } - return ll; - } - - internal List MergeTextLines(Rectangle pageBox, IList textLines) { - var ll = new List(); - // 同行合并宽度最小值 - var cw = pageBox.Width / 6; - var ch = pageBox.Height / 6; - - // 遍历识别所得的各 TextInfo,使用最小距离聚类方法将其聚类为行 - foreach (var item in textLines) { - var ir = item.Region; - DistanceInfo cd = null; // TextInfo 到 TextLine 的距离 - var md = new DistanceInfo(DistanceInfo.Placement.Unknown, float.MaxValue, float.MaxValue); // 最小距离 - TextRegion mr = null; // 最小距离的 TextRegion - - // 求最小距离的 TextLine - float ds = item.FirstText.Size / 10; - // 循环只包含了 TextLine,未包含文本 TextInfo 的其余文本 - for (int i = ll.Count - 1; i >= 0; i--) { - var li = ll[i]; - // 文本尺寸应在误差范围之内 - if (Math.Abs(item.FirstText.Size - li.Lines[0].FirstText.Size) > ds && _options.MergeAdjacentTitles) { - continue; - } - if (_options.MergeDifferentFontTitles == false && li.Lines[0].FirstText.Font.FontID != item.FirstText.Font.FontID) { - break; - } - cd = li.Region.GetDistance(ir, li.Direction); - if ((cd.IsOverlapping // 当前项与文本行交叠 - && (md.IsOverlapping == false // 最小距离不是交叠 - || cd.DistanceRadial < md.DistanceRadial) // 当前项与文本行的交叠中心距离小于最小距离 - ) - || ((md.Location == DistanceInfo.Placement.Unknown // 未知最小距离 - || (cd.IsOverlapping == false - && md.IsOverlapping == false - && cd.MinDistance < md.MinDistance) // 当前项与文本行的距离小于最小距离 - ) - && (((cd.IsHorizontallyAligned) // 相对位置为水平 - && li.Direction != WritingDirection.Vertical // 文本行方向不为纵向 - && item.Region.IsAlignedWith(li.Region, WritingDirection.Horizontal) // 两者处于同一横行 - && cd.MinDistance < item.Region.Width * _options.MaxDistanceBetweenLines // 行间距离小于指定行宽 - && _options.MergeAdjacentTitles - && (_options.MergeDifferentSizeTitles || li.Lines[0].Region.Width == item.Region.Width) // 合并相同尺寸的标题 - ) - || ((cd.IsVerticallyAligned) // 相对位置为垂直 - && li.Direction != WritingDirection.Horizontal // 文本行方向不为横向 - && item.Region.IsAlignedWith(li.Region, WritingDirection.Vertical) // 两者处于同一纵行 - && cd.MinDistance < item.Region.Height * _options.MaxDistanceBetweenLines // 行间距离小于指定行高 - && _options.MergeAdjacentTitles - && (_options.MergeDifferentSizeTitles || li.Lines[0].Region.Height == item.Region.Height) // 合并相同尺寸的标题 - ) - ) - && cd.MinDistance < cw - ) - ) { - md = cd; - mr = li; - } - } - - // 否则,用 item 创建新的 TextLine - if (mr != null) { - // 若存在最小距离的 TextLine 且可合并,则将 item 归入 TextLine - mr.AddLine(item); - } - else { - ll.Add(new TextRegion(item)); - } - } - return ll; - } - - sealed class TextToBookmarkProcessor : PdfContentStreamProcessor - { - readonly float _fontSizeThreshold; - - //Rectangle _positionRectangle; - readonly bool _mergeAdjacentTitles; - readonly bool _mergeDifferentSizeTitles; - float _textWidth, _charWidth; - readonly List _TextList; - readonly LevelProcessor _levelProcessor; - readonly AutoBookmarkContext _context; - const string __AddSpaceAfterCharacters = ":.,\"'?!)]};"; - const string __InsertSpaceBeforeCharacters = "\"'([{"; - - public TextToBookmarkProcessor(AutoBookmarkOptions options, AutoBookmarkContext context) { - _fontSizeThreshold = options.TitleThreshold; - //_positionRectangle = options.PositionRectangle; - _mergeAdjacentTitles = options.MergeAdjacentTitles; - _mergeDifferentSizeTitles = options.MergeDifferentSizeTitles; - _levelProcessor = new LevelProcessor(options.LevelAdjustment); - _TextList = new List(); - PopulateOperators(); - RegisterContentOperator("TJ", new AccumulatedShowTextArray()); - _context = context; - } - - /// - /// 获取页面内容的文本。 - /// - internal List TextList => _TextList; - /// - /// 获取字体列表。 - /// - internal IDictionary FontList => base.Fonts; - - public Matrix RotationMatrix { get; set; } - - internal override void Reset() { - base.Reset(); - _TextList?.Clear(); - } - - protected override void DisplayPdfString(PdfString str) { - var gs = CurrentGraphicState; - var font = gs.Font; - var chars = font.DecodeText(str).ToCharArray(); - float totalWidth = 0, charWidth = 0; - foreach (var c in chars) { - float w = font.GetWidth(c) / 1000.0f; - if (w == 0 && (font.CjkType & FontInfo.CjkFontType.CJK) > 0) { - w = c < 0xFF ? 0.5f : 1f; - } - float wordSpacing = (c == ' ' ? gs.WordSpacing : 0f); - if (Char.IsLetterOrDigit(c)) { - charWidth += w * gs.FontSize * gs.HorizontalScaling; - } - totalWidth += (w * gs.FontSize + gs.CharacterSpacing + wordSpacing) * gs.HorizontalScaling; - } - - _textWidth = totalWidth; - _charWidth = charWidth; - AdjustTextMatrixX(totalWidth); - } - - protected override void InvokeOperator(PdfLiteral oper, List operands) { - var o = oper.ToString(); - string text; - float size; - Matrix tm; - switch (o) { - case "TJ": - tm = GetTextMatrix(); - size = GetFontSize(tm); - text = DecodeTJText(operands, size); - break; - case "Tj": - case "'": - case "\"": - tm = GetTextMatrix(); - size = GetFontSize(tm); - if (size < 0) { - size = -size; - } - //if (size < _fontSizeThreshold) { - // goto default; - //} - text = CurrentGraphicState.Font.DecodeText(operands[0] as PdfString); - break; - default: - // 执行默认的操作指令 - base.InvokeOperator(oper, operands); - return; - } - - // 处理文本 - base.InvokeOperator(oper, operands); - //if (tm[Matrix.I12] != 0 || tm[Matrix.I21] != 0) { - // // 忽略非横向文本 - // goto Exit; - //} - if (size < 0.0001) { - size = 0.0001f; - } - else { - size = (float)Math.Round(size, 4); - } - var ti = new TextInfo() { - Text = text.Length > 1 ? text.TrimEnd(' ') : text, - Size = size, - Region = CreateBoundFromMatrix(tm, _textWidth, size), - Font = CurrentGraphicState.Font, - LetterWidth = _charWidth * tm[Matrix.I22] - }; - if (ti.LetterWidth < 0) { - ti.LetterWidth = -ti.LetterWidth; - } - if (IsBoundOutOfRectangle(_context.PageBox, ti.Region)) { - // 文本落在页面之外 - goto Exit; - } - //TODO: 筛选文本 - //this._context.TextInfo = ti; - //ti.Size = _levelProcessor.ChangeSizeLevel (this._context); - //if (ti.Size < _fontSizeThreshold) { - // return; - //} - - //if (_positionRectangle != null && ti.Region.Right < this._positionRectangle.Left - // || ti.Region.Top < this._positionRectangle.Top - this._positionRectangle.Height - // || ti.Region.Bottom > this._positionRectangle.Top - // || ti.Region.Left > this._positionRectangle.Right) { - // // 文本落在范围框之外 - // goto Exit; - //} - _TextList.Add(ti); - Exit: - return; - } - - string DecodeTJText(List operands, float size) { - //if (size < _fontSizeThreshold) { - // goto default; - //} - var array = (PdfArray)operands[0]; - float d = size * CurrentGraphicState.HorizontalScaling * 4f / 1000f; - var t = new string[array.Size]; - int i = 0; - foreach (PdfObject item in array.ArrayList) { - if (item.Type == PdfObject.STRING) { - t[i++] = CurrentGraphicState.Font.DecodeText(item as PdfString); - } - else if (item.Type == PdfObject.NUMBER) { - if (-(item as PdfNumber).FloatValue * d > size) { - t[i++] = " "; - } - } - } - return String.Concat(t); - } - - float GetFontSize(Matrix tm) { - float size = CurrentGraphicState.FontSize * tm[Matrix.I22]; - if (size < 0) { - size = -size; - } - return size; - } - - Matrix GetTextMatrix() { - return RotationMatrix != null - ? RotationMatrix.Multiply(TextMatrix).Multiply(CurrentGraphicState.TransMatrix) - : TextMatrix.Multiply(CurrentGraphicState.TransMatrix); - } - - static Bound CreateBoundFromMatrix(Matrix tm, float textWidth, float size) { - var l = tm[Matrix.I31]; - var b = tm[Matrix.I32]; - var r = tm[Matrix.I31] + textWidth * tm[Matrix.I11]; - var t = tm[Matrix.I32] + size; - float x; - if (l > r) { - x = r; r = l; l = x; - } - if (b > t) { - x = t; t = b; b = x; - } - return new Bound(l, b, r, t); - } - - /// - /// 检查 是否处于 之内。 - /// - /// 大边框。 - /// 小边框。 - /// 小边框完全处于大边框内,则返回 true。 - internal static bool IsBoundOutOfRectangle(Rectangle a, Bound b) { - return b.Right < a.Left - || b.Top < a.Bottom - || b.Bottom > a.Top - || b.Left > a.Right; - } - - } - - sealed class LevelProcessor - { - readonly AutoBookmarkFilter[] _filters; - readonly AutoBookmarkOptions.LevelAdjustmentOption[] _options; - - internal LevelProcessor(IList options) { - var l = options.Count; - _filters = new AutoBookmarkFilter[l]; - _options = new AutoBookmarkOptions.LevelAdjustmentOption[l]; - for (int i = 0; i < l; i++) { - _filters[i] = options[i].Condition.CreateFilter(); - _options[i] = options[i]; - } - } - - internal float ChangeSizeLevel(AutoBookmarkContext context) { - for (int i = 0; i < _options.Length; i++) { - var o = _options[i]; - if (o.FilterBeforeMergeTitle && context.IsTextMerged) { - continue; - } - if (_filters[i].Matches(context)) { - return o.RelativeAdjustment ? o.AdjustmentLevel + context.TextInfo.Size : o.AdjustmentLevel; - } - } - return context.TextInfo.Size; - } - } - } -} diff --git a/pdfpatcher/App/Processor/AutoBookmarkFilters/AutoBookmarkFilter.cs b/pdfpatcher/App/Processor/AutoBookmarkFilters/AutoBookmarkFilter.cs deleted file mode 100644 index 84d691eb0e02ceee1df00b2664e723973dc46824..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/AutoBookmarkFilters/AutoBookmarkFilter.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; - -namespace PDFPatcher.Processor -{ - public abstract class AutoBookmarkFilter - { - /// - /// 检查传入的 是否符合指定的过滤条件。 - /// - /// 包含需要过滤的文本信息及其它上下文的 。 - /// 过滤结果。 - internal abstract bool Matches(Model.AutoBookmarkContext context); - - /// - /// 重置过滤器的内部状态。 - /// - internal abstract void Reset(); - } -} diff --git a/pdfpatcher/App/Processor/AutoBookmarkFilters/FontNameFilter.cs b/pdfpatcher/App/Processor/AutoBookmarkFilters/FontNameFilter.cs deleted file mode 100644 index a88df4dab226b5c954593812444cc901908555e3..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/AutoBookmarkFilters/FontNameFilter.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace PDFPatcher.Processor -{ - [System.Diagnostics.DebuggerDisplay("FontName = {FontName}; MatchFullName = {MatchFullName}")] - public class FontNameFilter : AutoBookmarkFilter - { - public string FontName { get; set; } - public bool MatchFullName { get; set; } - - readonly Dictionary _matchResultCache; - - public FontNameFilter() { - _matchResultCache = new Dictionary(); - } - - public FontNameFilter(string fontName, bool matchFullName) : this() { - FontName = fontName; - MatchFullName = matchFullName; - } - - internal override bool Matches(PDFPatcher.Model.AutoBookmarkContext context) { - if (context.TextLine == null) { - var font = context.TextInfo.Font; - return MatchFont(font); - } - else { - foreach (var item in context.TextLine.Texts) { - if (MatchFont(item.Font)) { - return true; - } - } - return false; - } - } - - private bool MatchFont(PDFPatcher.Model.FontInfo font) { - if (font == null) { - return true; - } - bool result; - if (_matchResultCache.TryGetValue(font.FontID, out result)) { - return result; - } - - if (MatchFullName) { - //_matchResultCache[font.FontID] = String.Compare (this.FontName, font.PostscriptFontName, StringComparison.OrdinalIgnoreCase) == 0; - _matchResultCache[font.FontID] = String.Compare(FontName, font.FontName, StringComparison.OrdinalIgnoreCase) == 0; - } - else { - _matchResultCache[font.FontID] = font.PostscriptFontName.IndexOf(FontName, StringComparison.OrdinalIgnoreCase) > -1; - } - return _matchResultCache[font.FontID]; - } - - internal override void Reset() { - _matchResultCache.Clear(); - } - - } -} diff --git a/pdfpatcher/App/Processor/AutoBookmarkFilters/MultiConditionFilter.cs b/pdfpatcher/App/Processor/AutoBookmarkFilters/MultiConditionFilter.cs deleted file mode 100644 index fe3deb3735f78cd12ecfa825640e2390efa4b28b..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/AutoBookmarkFilters/MultiConditionFilter.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - internal sealed class MultiConditionFilter : AutoBookmarkFilter - { - readonly List _filters = new List(); - - public MultiConditionFilter(AutoBookmarkCondition.MultiCondition condition) { - foreach (var item in condition.Conditions) { - _filters.Add(item.CreateFilter()); - } - } - - internal override bool Matches(AutoBookmarkContext context) { - foreach (var item in _filters) { - if (item.Matches(context) == false) { - return false; - } - } - return true; - } - - internal override void Reset() { - foreach (var item in _filters) { - item.Reset(); - } - } - } -} diff --git a/pdfpatcher/App/Processor/AutoBookmarkFilters/PageRangeFilter.cs b/pdfpatcher/App/Processor/AutoBookmarkFilters/PageRangeFilter.cs deleted file mode 100644 index ec602f4f14436f54ea79b849ac33366b5328cdfb..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/AutoBookmarkFilters/PageRangeFilter.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; - -namespace PDFPatcher.Processor -{ - [System.Diagnostics.DebuggerDisplay("{_rangeText}")] - public class PageRangeFilter : AutoBookmarkFilter - { - private Model.PageRangeCollection _range; - private readonly string _rangeText; - - public PageRangeFilter(string range) { - _rangeText = range; - _range = null; - } - - internal override bool Matches(PDFPatcher.Model.AutoBookmarkContext context) { - var p = context.CurrentPageNumber; - if (_range == null) { - _range = Model.PageRangeCollection.Parse(_rangeText, 1, context.TotalPageNumber, false); - } - foreach (var item in _range) { - if (p <= item.EndValue && p >= item.StartValue) { - return true; - } - } - return false; - } - - internal override void Reset() { - _range = null; - } - - } -} diff --git a/pdfpatcher/App/Processor/AutoBookmarkFilters/TextFilter.cs b/pdfpatcher/App/Processor/AutoBookmarkFilters/TextFilter.cs deleted file mode 100644 index 0ae7f1c2ae76904ee807b4e9a37841e21200927a..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/AutoBookmarkFilters/TextFilter.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - sealed class TextFilter : AutoBookmarkFilter - { - readonly MatchPattern.IMatcher _matcher; - public TextFilter(MatchPattern pattern) { - _matcher = pattern.CreateMatcher(); - } - internal override bool Matches(PDFPatcher.Model.AutoBookmarkContext context) { - if (context.TextLine == null) { - return _matcher.Matches(context.TextInfo.Text); - } - else { - return _matcher.Matches(context.TextLine.Text); - } - } - - internal override void Reset() { - } - } -} diff --git a/pdfpatcher/App/Processor/AutoBookmarkFilters/TextPositionFilter.cs b/pdfpatcher/App/Processor/AutoBookmarkFilters/TextPositionFilter.cs deleted file mode 100644 index 910eb478b9feedbcf917090b6626f4f369e4a97c..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/AutoBookmarkFilters/TextPositionFilter.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Processor -{ - [System.Diagnostics.DebuggerDisplay("P {Position}: {MinValue}->{MaxValue}")] - sealed class TextPositionFilter : AutoBookmarkFilter - { - public byte Position { get; private set; } - public float MaxValue { get; private set; } - public float MinValue { get; private set; } - - public TextPositionFilter(byte position, float min, float max) { - Position = position; - MaxValue = max; - MinValue = min; - } - - internal override bool Matches(PDFPatcher.Model.AutoBookmarkContext context) { - if (context.TextLine == null) { - return MatchPosition(context.TextInfo.Region); - } - else { - foreach (var item in context.TextLine.Texts) { - if (MatchPosition(item.Region)) { - return true; - } - } - return false; - } - } - - private bool MatchPosition(PDFPatcher.Model.Bound bound) { - switch (Position) { - case 1: return bound.Top > MinValue && bound.Top < MaxValue; - case 2: return bound.Bottom > MinValue && bound.Bottom < MaxValue; - case 3: return bound.Left > MinValue && bound.Left < MaxValue; - case 4: return bound.Right > MinValue && bound.Right < MaxValue; - default: - return false; - } - } - - internal override void Reset() { - } - } -} diff --git a/pdfpatcher/App/Processor/AutoBookmarkFilters/TextSizeFilter.cs b/pdfpatcher/App/Processor/AutoBookmarkFilters/TextSizeFilter.cs deleted file mode 100644 index ec522250abcd1ae97b3f8e2a337566c4f5b46d1e..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/AutoBookmarkFilters/TextSizeFilter.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; - -namespace PDFPatcher.Processor -{ - [System.Diagnostics.DebuggerDisplay("{MinSize}->{MaxSize}")] - public class TextSizeFilter : AutoBookmarkFilter - { - readonly float _minSize, _maxSize; - public float MinSize => _minSize; - public float MaxSize => _maxSize; - - public TextSizeFilter(float a, float b) { - if (a > b) { - _minSize = b; - _maxSize = a; - } - else { - _minSize = a; - _maxSize = b; - } - } - - internal override bool Matches(PDFPatcher.Model.AutoBookmarkContext context) { - if (context.TextLine == null) { - var size = context.TextInfo.Size; - return MatchSize(size); - } - else { - foreach (var item in context.TextLine.Texts) { - if (MatchSize(item.Size)) { - return true; - } - } - return false; - } - } - - private bool MatchSize(float size) { - return _minSize <= size && size <= _maxSize; - } - - internal override void Reset() { - } - - } -} diff --git a/pdfpatcher/App/Processor/ContentProcessors/ColorizeBinaryImageProcessor.cs b/pdfpatcher/App/Processor/ContentProcessors/ColorizeBinaryImageProcessor.cs deleted file mode 100644 index edb8de6770c0fa151497a7deb67c0d59ed21f858..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/ContentProcessors/ColorizeBinaryImageProcessor.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using iTextSharp.text.pdf; -using PDFPatcher.Model; -using PDFPatcher.Processor.Imaging; - -namespace PDFPatcher.Processor -{ - /// - /// 设置黑白图片的颜色。 - /// - sealed class ColorizeBinaryImageProcessor : IPageProcessor - { - int _processedPageCount; - - #region IPageProcessor 成员 - public string Name => "设置黑白图片颜色"; - - public void BeginProcess(DocProcessorContext context) { - _processedPageCount = 0; - } - public bool EndProcess(PdfReader pdf) { - Tracker.TraceMessage(Tracker.Category.Notice, Name + "功能:"); - Tracker.TraceMessage("  修改了 " + _processedPageCount + " 个黑白图片的颜色。"); - return false; - } - - public int EstimateWorkload(PdfReader pdf) { - return pdf.NumberOfPages; - } - - public bool Process(PageProcessorContext context) { - Tracker.IncrementProgress(1); - var images = context.Page.Locate(PdfName.RESOURCES, PdfName.XOBJECT); - if (images == null) { - return false; - } - var bw = new List(); - foreach (var item in images) { - var im = PdfReader.GetPdfObject(item.Value) as PRStream; - if (im == null - || PdfName.IMAGE.Equals(im.GetAsName(PdfName.SUBTYPE)) == false - || im.TryGetInt32(PdfName.BITSPERCOMPONENT, 0) != 1 - ) { - continue; - } - bw.Add(item.Key); - } - if (ProcessCommands(context.PageCommands.Commands, bw)) { - context.IsPageContentModified = true; - _processedPageCount++; - return true; - } - return false; - } - - #endregion - - private bool ProcessCommands(IList parent, IList bwImages) { - var r = false; - Model.PdfPageCommand cmd; - Model.EnclosingCommand ec; - for (int i = 0; i < parent.Count; i++) { - cmd = parent[i]; - ec = cmd as Model.EnclosingCommand; - if (ec != null) { - r |= ProcessCommands(ec.Commands, bwImages); - continue; - } - if (cmd.Name.ToString() == "Do") { - foreach (var item in bwImages) { - if (item.Equals(cmd.Operands[0])) { - parent.Insert(i, Model.PdfPageCommand.Create("RG", new PdfNumber(1), new PdfNumber(0), new PdfNumber(0))); - parent.Insert(i, Model.PdfPageCommand.Create("rg", new PdfNumber(0), new PdfNumber(1), new PdfNumber(0))); - return true; - } - } - } - } - return r; - } - - } -} diff --git a/pdfpatcher/App/Processor/ContentProcessors/CommonProcessor.cs b/pdfpatcher/App/Processor/ContentProcessors/CommonProcessor.cs deleted file mode 100644 index 069f9bec977f1d9036e7c3ddf7764061dac6c314..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/ContentProcessors/CommonProcessor.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using iTextSharp.text.pdf; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - sealed class CommonProcessor : IPageProcessor - { - readonly PatcherOptions _options; - public CommonProcessor(PatcherOptions options) { - _options = options; - } - - #region IPageProcessor 成员 - public string Name => "PDF 常规处理"; - - int IPageProcessor.EstimateWorkload(PdfReader pdf) { - return pdf.NumberOfPages; - } - - void IPageProcessor.BeginProcess(DocProcessorContext context) { - if (context.OutputDocument == null) { - var pdf = context.Pdf; - var c = pdf.Catalog; - if (_options.RemoveUsageRights) { - Tracker.TraceMessage("删除权限控制。"); - pdf.RemoveUsageRights(); - } - if (_options.RemoveXmlMetadata) { - Tracker.TraceMessage("删除 XML 元数据。"); - PdfReader.KillIndirect(c.Get(PdfName.METADATA)); - c.Remove(PdfName.METADATA); - } - - if (_options.RemoveDocAutoActions) { - Tracker.TraceMessage("删除打开文档时的自动动作。"); - c.Remove(PdfName.OPENACTION); - c.Remove(PdfName.AA); - } - if (_options.RemoveAnnotations) { - Tracker.TraceMessage("删除文档批注。"); - pdf.Catalog.Remove(PdfName.ACROFORM); - } - } - if (_options.RemovePageAutoActions) { - Tracker.TraceMessage("删除页面自动动作。"); - } - if (_options.RemovePageMetaData) { - Tracker.TraceMessage("删除页面扩展标记元数据属性。"); - } - } - - bool IPageProcessor.Process(PageProcessorContext context) { - bool isTouched = false; - var page = context.Page; - if (_options.RemoveAnnotations && page.Contains(PdfName.ANNOTS)) { - page.Remove(PdfName.ANNOTS); - isTouched = true; - } - if (_options.RemovePageAutoActions && page.Contains(PdfName.AA)) { - page.Remove(PdfName.AA); - isTouched = true; - } - if (_options.RemovePageMetaData && page.Contains(PdfName.METADATA)) { - page.Remove(PdfName.METADATA); - isTouched = true; - } - Tracker.IncrementProgress(1); - return isTouched; - } - - bool IPageProcessor.EndProcess(PdfReader pdf) { - return false; - } - - #endregion - - } -} diff --git a/pdfpatcher/App/Processor/ContentProcessors/FixContentProcessor.cs b/pdfpatcher/App/Processor/ContentProcessors/FixContentProcessor.cs deleted file mode 100644 index 5850133535c9935d4f292c379b006eb49a74b9ce..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/ContentProcessors/FixContentProcessor.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Collections.Generic; -using iTextSharp.text.pdf; - -namespace PDFPatcher.Processor -{ - sealed class FixContentProcessor : IPageProcessor - { - int _processedPageCount; - - #region IPageProcessor 成员 - public string Name => "修复并删除冗余内容"; - - public void BeginProcess(DocProcessorContext context) { - _processedPageCount = 0; - } - public bool EndProcess(PdfReader pdf) { - Tracker.TraceMessage(Tracker.Category.Notice, Name + "功能:"); - Tracker.TraceMessage("  删除了 " + _processedPageCount + " 页的冗余内容。"); - return false; - } - - public int EstimateWorkload(PdfReader pdf) { - return pdf.NumberOfPages * 3; - } - - public bool Process(PageProcessorContext context) { - Tracker.IncrementProgress(3); - if (ProcessCommands(context.PageCommands)) { - context.IsPageContentModified = true; - _processedPageCount++; - return true; - } - return false; - } - - #endregion - - static bool ProcessCommands(Model.IPdfPageCommandContainer container) { - var r = false; - var cl = container.Commands; - var l = cl.Count; - for (int i = 0; i < l; i++) { - if (cl[i] is Model.EnclosingCommand ec) { - r |= ProcessCommands(ec); - } - } - return r; - } - } -} diff --git a/pdfpatcher/App/Processor/ContentProcessors/IDocProcessor.cs b/pdfpatcher/App/Processor/ContentProcessors/IDocProcessor.cs deleted file mode 100644 index 8ad637290480538b1b472ac601245ba1f8455400..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/ContentProcessors/IDocProcessor.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - interface IDocProcessor : IProcessor - { - /// - /// 估算工作量。 - /// - /// 需要处理的文档。 - /// 整数工作量(用于显示进度条)。 - int EstimateWorkload(iTextSharp.text.pdf.PdfReader pdf); - - /// - /// 在处理页面前调用,初始化处理器。 - /// - /// 包含传入文档的 - void BeginProcess(DocProcessorContext context); - - /// - /// 处理传入的文档。 - /// - /// 包含传入文档的 - /// 更改文档内容后返回 true。 - bool Process(DocProcessorContext context); - - /// - /// 在处理页面后调用。 - /// - /// 包含传入文档的 - void EndProcess(DocProcessorContext context); - - } -} diff --git a/pdfpatcher/App/Processor/ContentProcessors/IPageProcessor.cs b/pdfpatcher/App/Processor/ContentProcessors/IPageProcessor.cs deleted file mode 100644 index bdc1064fd7b59650f456720b89d810c58060e75b..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/ContentProcessors/IPageProcessor.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using iTextSharp.text.pdf; - -namespace PDFPatcher.Processor -{ - interface IPageProcessor : IProcessor - { - /// - /// 估算工作量。 - /// - /// 需要处理的文档。 - /// 整数工作量(用于显示进度条)。 - int EstimateWorkload(PdfReader pdf); - - /// - /// 在处理页面前调用,初始化处理器。 - /// - /// 包含传入文档的 - /// 更改文档内容后返回 true。 - void BeginProcess(DocProcessorContext context); - - /// - /// 处理传入的页面。 - /// - /// 包含传入页面的 - /// 更改页面内容后返回 true。 - bool Process(PageProcessorContext context); - - /// - /// 完成处理文档的操作,在完成处理所有页面后被调用。 - /// - /// 需要处理的文档。 - /// 更改文档内容后返回 true。 - bool EndProcess(PdfReader pdf); - } -} diff --git a/pdfpatcher/App/Processor/ContentProcessors/ImageDeskewProcessor.cs b/pdfpatcher/App/Processor/ContentProcessors/ImageDeskewProcessor.cs deleted file mode 100644 index cab59a54a3d0b1c6987c3713359b042dd90d46c9..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/ContentProcessors/ImageDeskewProcessor.cs +++ /dev/null @@ -1,126 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using iTextSharp.text.pdf; -using PDFPatcher.Processor.Imaging; - -namespace PDFPatcher.Processor -{ - class ImageDeskewProcessor : IPageProcessor - { - static readonly ExportImageOptions _imgExpOption = new ExportImageOptions () { - ExportImagePath = System.IO.Path.GetTempPath (), - MergeImages = false - }; - int _processedImageCount; - int _deskewedImageCount; - - #region IPageProcessor 成员 - public string Name { get { return "校正倾斜图片"; } } - - public void BeginProcess (PdfReader pdf) { - _processedImageCount = 0; - _deskewedImageCount = 0; - } - public bool EndProcess (PdfReader pdf) { - Tracker.TraceMessage (Tracker.Category.Notice, this.Name + "功能:"); - Tracker.TraceMessage ("  处理了 " + _processedImageCount + " 幅图片。"); - Tracker.TraceMessage ("  校正了 " + _deskewedImageCount + " 幅图片的角度。"); - return false; - } - - public int EstimateWorkload (PdfReader pdf) { - return pdf.NumberOfPages * 10; - } - - public bool Process (Model.PageProcessorContext context) { - Tracker.IncrementProgress (10); - Processor.PdfImageExporter ie = new PdfImageExporter (_imgExpOption, context.Pdf); - var images = PdfHelper.Locate (context.Page, true, PdfName.RESOURCES, PdfName.XOBJECT); - if (images == null) { - return false; - } - Dictionary angles = new Dictionary (); - foreach (var item in images) { - var im = PdfReader.GetPdfObject (item.Value) as PRStream; - if (im == null - || PdfName.IMAGE.Equals (im.GetAsName (PdfName.SUBTYPE)) == false) { - continue; - } - _processedImageCount++; - var l = im.GetAsNumber (PdfName.LENGTH); - if (l == null || l.IntValue < 400 /*忽略小图片*/) { - continue; - } - var inf = new ImageInfo (item.Value as PdfIndirectReference); - var b = inf.DecodeImage (_imgExpOption); - using (var fi = PdfImageExporter.CreateFreeImageBitmap (inf, ref b, false, false)) { - //if (fi.Height > 500 && fi.Width > 500) { - // var zy = (float)fi.Height / 500f; - // var zx = (float)fi.Width / 500f; - // if (zy > zx) { - // fi.Rescale (500, (int)((float)fi.Height / zx), FreeImageAPI.FREE_IMAGE_FILTER.FILTER_BILINEAR); - // } - // else { - // fi.Rescale ((int)((float)fi.Width / zy), 500, FreeImageAPI.FREE_IMAGE_FILTER.FILTER_BILINEAR); - // } - //} - angles.Add (item.Key, new ImageDeskew ().GetSkewAngle (fi)); // 获取图片倾斜角度 - } - } - if (angles.Count == 0) { - return false; - } - var p = new PdfPageCommandProcessor (context); - var r = false; - foreach (var item in p.Commands) { - r |= ProcessSubCommand (item, angles); - } - if (r == true) { - p.WritePdfCommands (context); - _deskewedImageCount++; - } - return r; - } - - #endregion - - private bool ProcessSubCommand (Model.PdfPageCommand item, Dictionary angles) { - if (item.Type != Model.PdfPageCommandType.Enclosure) { - return false; - } - var ec = (item as Model.EnclosingCommand); - if (ec.Name.ToString () == "q") { - if (ec.SubCommands.Count != 2 - || ec.SubCommands[0].Name.ToString () != "cm" - || ec.SubCommands[1].Name.ToString () != "Do") { - return false; - } - var m = ec.SubCommands[0] as Model.MatrixCommand; - var d = ec.SubCommands[1]; - if (d.HasOperand == false) { - return false; - } - double a; - if (angles.TryGetValue (d.Operands[0] as PdfName, out a) == false || a < 0.0001 && a > -0.0001) { - return false; - } - Tracker.TraceMessage (d.Operands[0].ToString () + " rotate " + a.ToString ()); - a *= Math.PI / 180f; - ec.SubCommands.Insert (0, new Model.MatrixCommand (new PdfLiteral ("cm"), new List () { - new PdfNumber(Math.Cos (a)), - new PdfNumber(Math.Sin (a)), - new PdfNumber(-Math.Sin (a)), - new PdfNumber(Math.Cos (a)), - new PdfNumber (0), new PdfNumber(0) - })); - return true; - } - var r = false; - foreach (var sub in ec.SubCommands) { - r |= ProcessSubCommand (sub, angles); - } - return r; - } - } -} diff --git a/pdfpatcher/App/Processor/ContentProcessors/ImageRecompressor.cs b/pdfpatcher/App/Processor/ContentProcessors/ImageRecompressor.cs deleted file mode 100644 index 4eeee45ec707cbec1ecf7d82fbdcc826a2c579a0..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/ContentProcessors/ImageRecompressor.cs +++ /dev/null @@ -1,140 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using iTextSharp.text.pdf; -using PDFPatcher.Model; -using PDFPatcher.Processor.Imaging; - -namespace PDFPatcher.Processor -{ - sealed class ImageRecompressor : IPageProcessor - { - static readonly PdfName[] __IgnoreFilters = new PdfName[] { PdfName.DCTDECODE, PdfName.JBIG2DECODE }; - static readonly ImageExtracterOptions _imgExpOption = new ImageExtracterOptions() { - OutputPath = System.IO.Path.GetTempPath(), - MergeImages = false - }; - - int _processedImageCount; - int _optimizedImageCount; - - #region IPageProcessor 成员 - public string Name => "优化压缩黑白图片"; - - public void BeginProcess(DocProcessorContext context) { - _processedImageCount = 0; - _optimizedImageCount = 0; - } - public bool EndProcess(PdfReader pdf) { - Tracker.TraceMessage(Tracker.Category.Notice, Name + "功能:"); - Tracker.TraceMessage("  处理了 " + _processedImageCount + " 幅图片。"); - Tracker.TraceMessage("  优化了 " + _optimizedImageCount + " 幅图片的压缩率。"); - return false; - } - - public int EstimateWorkload(PdfReader pdf) { - return pdf.NumberOfPages * 10; - } - - public bool Process(PageProcessorContext context) { - Tracker.IncrementProgress(10); - var _imgExp = new ImageExtractor(_imgExpOption, context.Pdf); - var images = context.Page.Locate(PdfName.RESOURCES, PdfName.XOBJECT); - if (images == null) { - return false; - } - foreach (var item in images) { - var im = PdfReader.GetPdfObject(item.Value) as PRStream; - if (im == null - || PdfName.IMAGE.Equals(im.GetAsName(PdfName.SUBTYPE)) == false) { - continue; - } - _processedImageCount++; - var l = im.GetAsNumber(PdfName.LENGTH); - if (l == null || l.IntValue < 400 /*忽略小图片*/) { - continue; - } - var f = im.Get(PdfName.FILTER); - PdfName fn = null; - if (f.Type == PdfObject.ARRAY) { - var fl = f as PdfArray; - fn = fl.GetAsName(fl.Size - 1); - } - else if (f.Type == PdfObject.NAME) { - fn = f as PdfName; - } - if (fn != null && __IgnoreFilters.Contains(fn)) { - continue; - } - - if (OptimizeBinaryImage(item.Value as PdfIndirectReference, im, l.IntValue) - /*|| ReplaceJ2kImage(item.Value as PdfIndirectReference, im, fn)*/) { - } - } - return true; - } - - private bool OptimizeBinaryImage(PdfIndirectReference imgRef, PRStream imgStream, int length) { - var bpc = imgStream.GetAsNumber(PdfName.BITSPERCOMPONENT); - var mask = imgStream.GetAsBoolean(PdfName.IMAGEMASK); - if (bpc == null && (mask == null || mask.BooleanValue == false) - || bpc != null && bpc.IntValue != 1) { - return false; - } - - var info = new ImageInfo(imgRef); - var bytes = info.DecodeImage(_imgExpOption); - using (var fi = ImageExtractor.CreateFreeImageBitmap(info, ref bytes, false, false)) { - var sb = JBig2Encoder.Encode(fi); - if (sb.Length > length) { - return false; - } - imgStream.SetData(sb, false); - imgStream.Put(PdfName.FILTER, PdfName.JBIG2DECODE); - if (imgStream.GetAsArray(PdfName.COLORSPACE) == null) { - imgStream.Put(PdfName.COLORSPACE, PdfName.DEVICEGRAY); - } - imgStream.Put(PdfName.BITSPERCOMPONENT, new PdfNumber(1)); - imgStream.Put(PdfName.LENGTH, new PdfNumber(sb.Length)); - imgStream.Remove(PdfName.K); - imgStream.Remove(PdfName.ENDOFLINE); - imgStream.Remove(PdfName.ENCODEDBYTEALIGN); - imgStream.Remove(PdfName.COLUMNS); - imgStream.Remove(PdfName.ROWS); - imgStream.Remove(PdfName.ENDOFBLOCK); - imgStream.Remove(PdfName.BLACKIS1); - imgStream.Remove(PdfName.PREDICTOR); - imgStream.Remove(PdfName.COLORS); - imgStream.Remove(PdfName.COLUMNS); - imgStream.Remove(PdfName.EARLYCHANGE); - imgStream.Remove(PdfName.DECODEPARMS); - imgStream.Remove(PdfName.DECODE); - _optimizedImageCount++; - } - return true; - } - - private bool ReplaceJ2kImage(PdfIndirectReference imgRef, PRStream imgStream, PdfName filter) { - if (PdfName.JPXDECODE.Equals(filter) == false) { - return false; - } - - var info = new ImageInfo(imgRef); - byte[] jpg; - using (var ms = new System.IO.MemoryStream(info.DecodeImage(_imgExpOption))) - using (var js = new System.IO.MemoryStream()) - using (var fi = new FreeImageAPI.FreeImageBitmap(ms)) { - fi.Save(js, FreeImageAPI.FREE_IMAGE_FORMAT.FIF_JPEG, FreeImageAPI.FREE_IMAGE_SAVE_FLAGS.JPEG_BASELINE | FreeImageAPI.FREE_IMAGE_SAVE_FLAGS.JPEG_QUALITYNORMAL | FreeImageAPI.FREE_IMAGE_SAVE_FLAGS.JPEG_PROGRESSIVE); - jpg = js.ToArray(); - } - imgStream.SetData(jpg, false); - imgStream.Put(PdfName.FILTER, PdfName.DCTDECODE); - imgStream.Put(PdfName.LENGTH, new PdfNumber(jpg.Length)); - _optimizedImageCount++; - return true; - } - - #endregion - } -} diff --git a/pdfpatcher/App/Processor/ContentProcessors/ImportOcrResultProcessor.cs b/pdfpatcher/App/Processor/ContentProcessors/ImportOcrResultProcessor.cs deleted file mode 100644 index 46d285ae2ba62ef2c16adf69ead99b7ce71fc38c..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/ContentProcessors/ImportOcrResultProcessor.cs +++ /dev/null @@ -1,330 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using iTextSharp.text.pdf; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - sealed class ImportOcrResultProcessor : IDocProcessor - { - static readonly PdfName PieceInfo = new PdfName("PieceInfo"); - static readonly PdfName ApplicationName = new PdfName(Constants.AppEngName); - static readonly PdfName LastModified = new PdfName("LastModified"); - static readonly PdfName OcrFont = new PdfName("OcrFont"); - static readonly PdfName OcrFontV = new PdfName("OcrFontV"); - static readonly PdfName GbkEucH = new PdfName("GBK-EUC-H"); - static readonly PdfName GbkEucV = new PdfName("GBK-EUC-V"); - static readonly PdfName DescendantFonts = new PdfName("DescendantFonts"); - static readonly PdfName FontName = new PdfName("STSong-Light"); - static readonly PdfName OcrResultBmcName = new PdfName("XXOcrResult"); - static readonly Encoding GbkEncoding = Encoding.GetEncoding("GBK"); - - PdfIndirectReference font; - PdfIndirectReference fontV; - - public ImportOcrResultProcessor() { - } - #region IDocProcessor 成员 - public string Name => "导入光学字符识别结果"; - - public int EstimateWorkload(PdfReader pdf) { - return pdf.NumberOfPages; - } - - public void BeginProcess(DocProcessorContext context) { - var x = context.ExtraData[DocProcessorContext.OcrData] as XmlReader; - if (x == null) { - return; - } - if (x.Name == Constants.PdfInfo) { - x.Read(); - x.MoveToContent(); - } - CreateGlobalOcrFontReference(context); - } - - public bool Process(DocProcessorContext context) { - var x = context.ExtraData[DocProcessorContext.OcrData] as XmlReader; - if (x == null || x.Name != Constants.Ocr.Result) { - return false; - } - ImportOcrResult(context, x); - return true; - } - - public void EndProcess(DocProcessorContext context) { - } - #endregion - - private void ImportOcrResult(DocProcessorContext context, XmlReader x) { - int l = 0; - int p; - var pdf = context.Pdf; - int pn = pdf.NumberOfPages; - var xd = new XmlDocument(); - PdfDictionary page; - while (x.EOF == false) { - // 读取一页识别结果 - if (x.MoveToContent() != XmlNodeType.Element - || x.Name != Constants.Ocr.Result - || x.GetAttribute(Constants.Content.PageNumber).TryParse(out p) == false - || p < 1 || p > pn) { - x.Skip(); - continue; - } - using (var r = x.ReadSubtree()) { - xd.Load(r); - } - page = pdf.GetPageN(p); - var cp = new PdfPageCommandProcessor(); - cp.ProcessContent(pdf.GetPageContent(p), page.GetAsDict(PdfName.RESOURCES)); - var commands = cp.Commands; - ClearPreviousOcrResult(commands); - // 用“q”操作符括起旧的命令 - if (commands.Count > 1) { - var q = EnclosingCommand.Create("q", null); - foreach (var item in commands) { - q.Commands.Add(item); - } - commands.Clear(); - commands.Add(q); - } - // 写入各图像的识别结果 - var ir = xd.SelectNodes(Constants.Ocr.Result + "/" + Constants.Ocr.Image); - var fontUse = 0; - foreach (XmlElement image in ir) { -#if DEBUG - var bt = EnclosingCommand.Create("BT", null); -#else - var bt = EnclosingCommand.Create ("BT", null, - PdfPageCommand.Create ("Tr", new PdfNumber (3)) - ); -#endif - var bmc = EnclosingCommand.Create("BMC", new PdfObject[] { OcrResultBmcName }, bt); - fontUse |= ImportImageOcrResult(bt, image); - commands.Add(bmc); - } - cp.WritePdfCommands(pdf, p); - if ((fontUse & 1) > 0) { - CreatePageOcrFontReference(context, page, font); - } - if ((fontUse & 2) > 0) { - CreatePageOcrFontReference(context, page, fontV); - } - if (l < pn) { - l++; - Tracker.IncrementProgress(1); - } - } - } - - private static void ClearPreviousOcrResult(IList commands) { - for (int i = commands.Count - 1; i >= 0; i--) { - var c = commands[i] as EnclosingCommand; - if (c == null - || c.HasOperand == false - || c.Name.ToString() != "BMC" - || OcrResultBmcName.Equals(c.Operands[0]) == false) { - continue; - } - commands.RemoveAt(i); - } - } - - private void CreateGlobalOcrFontReference(DocProcessorContext context) { - var c = context.Pdf.Catalog; - PdfDictionary d; - if ((d = c.Locate(false, PieceInfo, ApplicationName)) == null) { - d = c.CreateDictionaryPath(PieceInfo, ApplicationName); - d.Put(LastModified, new PdfString("D:" + DateTime.Now.ToString("yyMMddHHmmss"))); - } - font = CreateOcrFont(context, d, false); - fontV = CreateOcrFont(context, d, true); - } - - private static PdfIndirectReference CreateOcrFont(DocProcessorContext context, PdfDictionary d, bool isVertical) { - PdfIndirectReference fontRef; - var fontName = isVertical ? OcrFontV : OcrFont; - fontRef = d.GetAsIndirectObject(fontName); - if (fontRef == null || (d.GetDirectObject(fontName) as PdfDictionary) == null) { - fontRef = CreateOcrFont(context, isVertical); - d.Put(fontName, fontRef); - } - return fontRef; - } - - private static PdfIndirectReference CreateOcrFont(DocProcessorContext context, bool isVertical) { - var f = new PdfDictionary(PdfName.FONT); - - f.Put(PdfName.SUBTYPE, PdfName.TYPE0); - f.Put(PdfName.BASEFONT, isVertical ? OcrFontV : OcrFont); - f.Put(PdfName.ENCODING, isVertical ? GbkEucV : GbkEucH); - - var a = new PdfArray(); - f.Put(DescendantFonts, a); - // DescendantFont - var df = new PdfDictionary(PdfName.FONT); - a.Add(context.Pdf.AddPdfObject(df)); - - df.Put(PdfName.SUBTYPE, PdfName.CIDFONTTYPE0); - df.Put(PdfName.BASEFONT, FontName); - var csi = new PdfDictionary(); - csi.Put(PdfName.REGISTRY, new PdfString("Adobe")); - csi.Put(PdfName.ORDERING, new PdfString("GB1")); - csi.Put(PdfName.SUPPLEMENT, new PdfNumber(3)); - df.Put(PdfName.CIDSYSTEMINFO, csi); - csi = null; - - // FontDescriptor - var fd = new PdfDictionary(PdfName.FONTDESCRIPTOR); - df.Put(PdfName.FONTDESCRIPTOR, context.Pdf.AddPdfObject(fd)); - fd.Put(PdfName.ASCENT, new PdfNumber(857)); - fd.Put(PdfName.CAPHEIGHT, new PdfNumber(857)); - fd.Put(PdfName.DESCENT, new PdfNumber(-143)); - fd.Put(PdfName.FLAGS, new PdfNumber(4)); - fd.Put(PdfName.FONTBBOX, new PdfArray(new int[] { -250, -143, 600, 857 })); - fd.Put(PdfName.FONTNAME, FontName); - //fd.Put (PdfName.ITALICANGLE, new PdfNumber (0)); - fd.Put(PdfName.STEMV, new PdfNumber(91)); - fd.Put(new PdfName("StemH"), new PdfNumber(91)); - return context.Pdf.AddPdfObject(f); - } - - private PdfName CreatePageOcrFontReference(DocProcessorContext context, PdfDictionary page, PdfIndirectReference fontRef) { - var f = page.CreateDictionaryPath(PdfName.RESOURCES, PdfName.FONT); - foreach (var item in f) { - if (PdfHelper.PdfReferencesAreEqual(fontRef, item.Value as PdfIndirectReference)) { - return item.Key; - } - } - context.IsModified = true; - var n = PdfHelper.PdfReferencesAreEqual(fontRef, font) ? OcrFont : OcrFontV; - f.Put(n, fontRef); - return n; - } - - static int ImportImageOcrResult(EnclosingCommand container, XmlElement result) { - int w = 0, h = 0; - var sc = container.Commands; - var chars = result.SelectNodes(Constants.Ocr.Content); - if (chars.Count == 0) { - return 0; - } - if (result.GetAttribute(Constants.Coordinates.Width).TryParse(out w) == false - || result.GetAttribute(Constants.Coordinates.Height).TryParse(out h) == false - || w <= 0 - || h <= 0 - ) { - Tracker.TraceMessage(String.Concat("识别结果的“", Constants.Ocr.Image, "”元素", (w <= 0 ? "宽属性无效" : String.Empty), - (h <= 0 ? "高属性无效" : String.Empty), "。")); - return 0; - } - var m = result.GetAttribute(Constants.Content.OperandNames.Matrix); - if (String.IsNullOrEmpty(m)) { - Tracker.TraceMessage(String.Concat("识别结果的“", Constants.Ocr.Image, "”元素缺少", Constants.Content.OperandNames.Matrix, "属性。")); - return 0; - } - var matrix = DocInfoImporter.ToSingleArray(m, true); - if (matrix == null || matrix.Length < 6) { - Tracker.TraceMessage(String.Concat("识别结果的“", Constants.Ocr.Image, "”元素中,", Constants.Content.OperandNames.Matrix, "属性值无效。")); - return 0; - } - var info = new OcrContentInfo(w, h, matrix); - sc.Add(PdfPageCommand.Create("Tm", - new PdfNumber(matrix[OcrContentInfo.A1] / w), new PdfNumber(matrix[OcrContentInfo.A2] / w), - new PdfNumber(matrix[OcrContentInfo.B1] / h), new PdfNumber(matrix[OcrContentInfo.B2] / h), - new PdfNumber(matrix[OcrContentInfo.DX]), new PdfNumber(matrix[OcrContentInfo.DY]) - )); // 设置初始偏移 - var fSize = -1f; - bool isV = false, hasHFont = false, hasVFont = false; - PdfName fn; - foreach (var item in chars) { - if (info.GetInfo(item as XmlElement) && String.IsNullOrEmpty(info.Text) == false) { - if (info.IsVertical) { - hasVFont = true; - fn = OcrFontV; - } - else { - hasHFont = true; - fn = OcrFont; - } - if (info.FontSize != fSize) { - sc.Add(PdfPageCommand.Create("Tf", fn, new PdfNumber(info.FontSize))); - fSize = info.FontSize; - isV = info.IsVertical; - } - else if (isV != info.IsVertical) { - sc.Add(PdfPageCommand.Create("Tf", fn, new PdfNumber(fSize))); - } - sc.Add(PdfPageCommand.Create("Td", new PdfNumber(info.DeltaX), new PdfNumber(info.DeltaY))); - sc.Add(PdfPageCommand.Create("Tj", new PdfString(GbkEncoding.GetBytes(info.Text)))); - } - } - return (hasHFont ? 1 : 0) + (hasVFont ? 2 : 0); - } - - sealed class OcrContentInfo - { - internal const int A1 = 0, A2 = 1, B1 = 2, B2 = 3, DX = 4, DY = 5; // 矩阵数组索引 - internal int ImageWidth { get; private set; } - internal int ImageHeight { get; private set; } - internal string Text { get; private set; } - internal int DeltaX => _dx; - internal int DeltaY => _dy; - internal bool IsVertical => _isVertical; - internal float FontSize => _size; - - bool _isVertical; - //float _ix, _iy, _dx, _dy; - string _text; - int _top, _bottom, _left, _right, _size; - int _cx, _cy, _dx, _dy; - //float _m11, _m12, _m21, _m22, _mx, _my; - internal OcrContentInfo(int imageWidth, int imageHeight, float[] matrix) { - ImageHeight = imageHeight; - ImageWidth = imageWidth; - //_m11 = matrix[A1]; - //_m12 = matrix[A2]; - //_m21 = matrix[B1]; - //_m22 = matrix[B2]; - //_mx = matrix[DX]; - //_my = matrix[DY]; - //_ix = 1 / (float)imageWidth; - //_iy = 1 / (float)imageHeight; - } - internal bool GetInfo(XmlElement ocrInfoItem) { - if (ocrInfoItem.GetAttribute(Constants.Coordinates.Top).TryParse(out _top) == false - || ocrInfoItem.GetAttribute(Constants.Coordinates.Bottom).TryParse(out _bottom) == false - || ocrInfoItem.GetAttribute(Constants.Coordinates.Left).TryParse(out _left) == false - || ocrInfoItem.GetAttribute(Constants.Coordinates.Right).TryParse(out _right) == false - || _top < 0 || _bottom < 0 || _left < 0 || _right < 0 - || _top > ImageHeight || _bottom > ImageHeight || _left > ImageWidth || _right > ImageWidth - || String.IsNullOrEmpty(_text = ocrInfoItem.GetAttribute(Constants.Ocr.Text)) - ) { - return false; - } - _isVertical = ocrInfoItem.GetAttribute(Constants.Coordinates.Direction) == Constants.Coordinates.Vertical; - _size = Math.Abs(_isVertical ? _right - _left : _bottom - _top); - if (_isVertical == false) { - _bottom = ImageHeight - _bottom; - _dx = _left - _cx; - _dy = _bottom - _cy; - _cx = _left; - _cy = _bottom; - } - else { - _top = ImageHeight - _top; - _dx = _left - _cx; - _dy = _top - _cy; - _cx = _left; - _cy = _top; - } - Text = _text; - return true; - } - } - } -} diff --git a/pdfpatcher/App/Processor/ContentProcessors/PageDimensionProcessor.cs b/pdfpatcher/App/Processor/ContentProcessors/PageDimensionProcessor.cs deleted file mode 100644 index 4be9e90ea61c8778eef8a22422c09e2b3def2b92..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/ContentProcessors/PageDimensionProcessor.cs +++ /dev/null @@ -1,338 +0,0 @@ -using System; -using System.Text; -using iTextSharp.text; -using iTextSharp.text.pdf; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - sealed class PageDimensionProcessor : IPageProcessor - { - CoordinateTranslationSettings[] _cts; - bool _resizePages, _adjustMargins; - PageRangeCollection _pageRanges; - PaperSize _refPaperSize; - public PageBoxSettings Settings { get; set; } - - internal static CoordinateTranslationSettings ResizePage(PdfDictionary page, PageBoxSettings settings, PaperSize refPaperSize) { - var size = refPaperSize ?? settings.PaperSize.Clone(); - var hAlign = settings.HorizontalAlign; - var vAlign = settings.VerticalAlign; - var pb = page.GetAsArray(PdfName.CROPBOX); - var b = pb != null ? PdfReader.GetNormalizedRectangle(pb) : null; - pb = page.GetAsArray(PdfName.MEDIABOX); - if (pb == null) { - throw new PdfException("页面缺少 MediaBox。"); - } - var mb = PdfReader.GetNormalizedRectangle(pb); - var n = PdfHelper.GetPageRotation(page); - if (n == 90 || n == 270) { - size = new PaperSize(size.PaperName, size.Height, size.Width); - } - // 自动旋转页面适应原页面的方向 - if (settings.AutoRotation && size.SpecialSize == SpecialPaperSize.None && (size.Width > size.Height) ^ (mb.Width > mb.Height)) { - size = new PaperSize(size.PaperName, size.Height, size.Width); - } - if (b == null) { - b = new Rectangle(mb); - } - float d, z = 1, zx = 1, zy = 1; - float dx = 0, dy = 0; - float sw = b.Width, sh = b.Height; // resized width and height - if (size.SpecialSize == SpecialPaperSize.FixedWidthAutoHeight || size.SpecialSize == SpecialPaperSize.AsWidestPage || size.SpecialSize == SpecialPaperSize.AsNarrowestPage) { - size.Height = b.Height * size.Width / b.Width; - } - - if (settings.ScaleContent) { - zx = size.Width / b.Width; - zy = size.Height / b.Height; - z = zx < zy ? zx : zy; - sw *= z; - sh *= z; - b.Left *= z; - b.Bottom *= z; - b.Top *= z; - b.Right *= z; - } - if (b.Width != size.Width) { - d = size.Width - sw; - dx = hAlign == HorizontalAlignment.Left ? 0 : hAlign == HorizontalAlignment.Right ? d : d / 2; - b.Left -= dx; - b.Right = b.Left + size.Width; - } - if (b.Height != size.Height) { - d = size.Height - sh; - dy = vAlign == VerticalAlignment.Bottom ? d : vAlign == VerticalAlignment.Top ? 0 : d / 2; - b.Top += dy; - b.Bottom = b.Top - size.Height; - } - - var a = new float[] { b.Left, b.Bottom, b.Right, b.Top }; - page.Put(PdfName.CROPBOX, new PdfArray(a)); - ResizeBox(page, mb, b); - if (page.GetAsArray(PdfName.BLEEDBOX) != null) { - ResizeBox(page, PdfReader.GetNormalizedRectangle(page.GetAsArray(PdfName.BLEEDBOX)), b); - } - if (page.GetAsArray(PdfName.TRIMBOX) != null) { - ResizeBox(page, PdfReader.GetNormalizedRectangle(page.GetAsArray(PdfName.TRIMBOX)), b); - } - if (page.GetAsArray(PdfName.ARTBOX) != null) { - ResizeBox(page, PdfReader.GetNormalizedRectangle(page.GetAsArray(PdfName.ARTBOX)), b); - } - //if (p.Contains (PdfName.BLEEDBOX)) { - // p.Put (PdfName.BLEEDBOX, pr); - //} - //if (p.Contains(PdfName.TRIMBOX)) { - // p.Put (PdfName.TRIMBOX, pr); - //} - //if (p.Contains(PdfName.ARTBOX)) { - // p.Put (PdfName.ARTBOX, pr); - //} - - var ct = new CoordinateTranslationSettings(); - if (settings.ScaleContent) { - ct.XScale = ct.YScale = z; - } - else { - ct.XTranslation = -dx; - ct.YTranslation = -dy; - } - return ct; - } - - static void ResizeBox(PdfDictionary page, Rectangle box, Rectangle refBox) { - page.Put(PdfName.MEDIABOX, new PdfArray(new float[]{ - box.Left < refBox.Left ? box.Left : refBox.Left, - box.Bottom < refBox.Bottom ? box.Bottom : refBox.Bottom, - box.Right > refBox.Right ? box.Right : refBox.Right, - box.Top > refBox.Top ? box.Top : refBox.Top - })); - } - - static bool RotatePage(PdfDictionary page, PageBoxSettings settings) { - if (settings.Rotation == 0) { - return false; - } - var mb = page.GetPageVisibleRectangle(); - if (mb == null) { - throw new PdfException("页面缺少 MediaBox。"); - } - var ls = mb.Width > mb.Height; // Landscape - if (ls && (settings.Filter & PageFilterFlag.Portrait) == PageFilterFlag.Portrait - || ls == false && (settings.Filter & PageFilterFlag.Landscape) == PageFilterFlag.Landscape) { - return false; - } - var n = (PdfHelper.GetPageRotation(page) + settings.Rotation) % 360; - if (n != 0) { - page.Put(PdfName.ROTATE, n); - } - else { - page.Remove(PdfName.ROTATE); - } - return true; - } - - static bool FilterPageNumber(int pageNumber, PageFilterFlag filter) { - var odd = (pageNumber & 1) > 0; - if (odd && (filter & PageFilterFlag.Even) == PageFilterFlag.Even - || (odd == false && (filter & PageFilterFlag.Odd) == PageFilterFlag.Odd) - ) { - return false; - } - return true; - } - - /// - /// 无损拉伸平移页面。 - /// - /// PDF 文档。 - /// 页码。 - /// 拉伸及平移参数。 - internal static byte[] ScaleContent(PdfReader pdf, int pageNumber, CoordinateTranslationSettings ct) { - var newContent = Encoding.ASCII.GetBytes(String.Join(" ", new string[] { - ct.XScale.ToText (), "0", - "0", ct.YScale.ToText (), - ct.XTranslation.ToText (), ct.YTranslation.ToText (), "cm " - })); - var cb = pdf.GetPageContent(pageNumber); - Array.Resize(ref newContent, cb.Length + newContent.Length); - cb.CopyTo(newContent, newContent.Length - cb.Length); - pdf.SafeSetPageContent(pageNumber, newContent); - - var page = pdf.GetPageN(pageNumber); - RewriteAnnotationCoordinates(ct, page); - return newContent; - } - - static void ScaleContent(PageProcessorContext context, CoordinateTranslationSettings ct) { - var cmds = context.PageCommands.Commands; - if (cmds.Count > 0 && cmds[0].Type == PdfPageCommandType.Matrix) { - var c = cmds[0] as MatrixCommand; - if (c.Name.ToString() == "cm") { - c.Multiply(new double[] { ct.XScale, 0, 0, ct.YScale, ct.XTranslation, ct.YTranslation }); - } - } - else { - cmds.Insert(0, new MatrixCommand(MatrixCommand.CM, ct.XScale, 0, 0, ct.YScale, ct.XTranslation, ct.YTranslation)); - } - RewriteAnnotationCoordinates(ct, context.Page); - } - - static void RewriteAnnotationCoordinates(CoordinateTranslationSettings ct, PdfDictionary page) { - var ann = page.GetAsArray(PdfName.ANNOTS); - if (ann == null) { - return; - } - foreach (var item in ann.ArrayList) { - var an = PdfReader.GetPdfObject(item) as PdfDictionary; - if (an != null) { - var rect = an.GetAsArray(PdfName.RECT); - if (rect != null && rect.Size == 4) { - rect[0] = new PdfNumber((rect[0] as PdfNumber).FloatValue * ct.XScale + ct.XTranslation); - rect[1] = new PdfNumber((rect[1] as PdfNumber).FloatValue * ct.YScale + ct.YTranslation); - rect[2] = new PdfNumber((rect[2] as PdfNumber).FloatValue * ct.XScale + ct.XTranslation); - rect[3] = new PdfNumber((rect[3] as PdfNumber).FloatValue * ct.YScale + ct.YTranslation); - } - } - } - } - - internal static void AdjustMargins(PdfDictionary page, Margins margins) { - if (margins.IsRelative) { - var box = page.GetAsArray(PdfName.CROPBOX) ?? page.GetAsArray(PdfName.MEDIABOX); - var r = PdfReader.GetNormalizedRectangle(box); - margins = new Margins(margins.Left * r.Width, margins.Top * r.Height, margins.Right * r.Width, margins.Bottom * r.Height); - } - AdjustBoxDimension(page, margins, PdfName.CROPBOX); - AdjustBoxDimension(page, margins, PdfName.MEDIABOX); - AdjustBoxDimension(page, margins, PdfName.BLEEDBOX); - AdjustBoxDimension(page, margins, PdfName.TRIMBOX); - AdjustBoxDimension(page, margins, PdfName.ARTBOX); - } - - static void AdjustBoxDimension(PdfDictionary page, Margins margins, PdfName boxName) { - var b = page.GetAsArray(boxName); - if (b == null) { - return; - } - var r = PdfReader.GetNormalizedRectangle(b); - page.Put(boxName, new PdfArray(new float[] { - r.Left - margins.Left, - r.Bottom - margins.Bottom, - r.Right + margins.Right, - r.Top + margins.Top - })); - } - - #region IPageProcessor 成员 - - public int EstimateWorkload(PdfReader pdf) { - return pdf.NumberOfPages; - } - - public void BeginProcess(DocProcessorContext context) { - _resizePages = Settings.NeedResize; - if (_resizePages) { - context.ExtraData[DocProcessorContext.CoordinateTransition] - = _cts - = new CoordinateTranslationSettings[context.Pdf.NumberOfPages + 1]; - } - _adjustMargins = Settings.NeedAdjustMargins; - _pageRanges = String.IsNullOrEmpty(Settings.PageRanges) ? null : PageRangeCollection.Parse(Settings.PageRanges, 1, context.Pdf.NumberOfPages, true); - //todo 为新增加的适应拉伸模式设置参考尺寸 - switch (Settings.PaperSize.SpecialSize) { - case SpecialPaperSize.AsSpecificPage: - break; - case SpecialPaperSize.AsWidestPage: - case SpecialPaperSize.AsNarrowestPage: - case SpecialPaperSize.AsLargestPage: - case SpecialPaperSize.AsSmallestPage: - _refPaperSize = GetRefPaperSize(context); - if (_refPaperSize == null) { - throw new InvalidOperationException("无法匹配与指定尺寸及页码范围相符的页面。"); - } - break; - } - } - - private PaperSize GetRefPaperSize(DocProcessorContext context) { - Rectangle refRectangle = null; - var specialSize = Settings.PaperSize.SpecialSize; - foreach (var range in _pageRanges ?? PageRangeCollection.CreateSingle(1, context.Pdf.NumberOfPages)) { - foreach (var page in range) { - var r = context.Pdf.GetPageSizeWithRotation(page); - if (refRectangle == null) { - refRectangle = r; - continue; - } - switch (specialSize) { - case SpecialPaperSize.AsWidestPage: - if (r.Width > refRectangle.Width) { - refRectangle = r; - } - break; - case SpecialPaperSize.AsNarrowestPage: - if (r.Width < refRectangle.Width) { - refRectangle = r; - } - break; - case SpecialPaperSize.AsLargestPage: - if (r.Width * r.Height > refRectangle.Width * refRectangle.Height) { - refRectangle = r; - } - break; - case SpecialPaperSize.AsSmallestPage: - if (r.Width * r.Height < refRectangle.Width * refRectangle.Height) { - refRectangle = r; - } - break; - } - } - } - return refRectangle != null - ? new PaperSize(Settings.PaperSize.PaperName, refRectangle.Width, specialSize != SpecialPaperSize.AsNarrowestPage && specialSize != SpecialPaperSize.AsWidestPage ? refRectangle.Height : 0) - : null; - } - - public bool Process(PageProcessorContext context) { - var f = Settings.Filter; - if (FilterPageNumber(context.PageNumber, f) == false) { - return false; - } - if (_pageRanges != null && _pageRanges.IsInRange(context.PageNumber) == false) { - return false; - } - context.Pdf.ResetReleasePage(); - if (_resizePages) { - var ct = ResizePage(context.Page, Settings, _refPaperSize); - if (Settings.ScaleContent) { - ScaleContent(context, ct); - context.IsPageContentModified = true; - } - _cts[context.PageNumber] = ct; - ct = null; - } - if (_adjustMargins) { - AdjustMargins(context.Page, Settings.Margins); - } - if (Settings.Rotation != 0) { - RotatePage(context.Page, Settings); - } - context.Pdf.ResetReleasePage(); - return true; - } - - public bool EndProcess(PdfReader pdf) { - return false; - } - - #endregion - - #region IProcessor 成员 - - public string Name => "修改页面尺寸"; - - #endregion - } -} diff --git a/pdfpatcher/App/Processor/ContentProcessors/RemoveAnnotationProcessor.cs b/pdfpatcher/App/Processor/ContentProcessors/RemoveAnnotationProcessor.cs deleted file mode 100644 index 034b3309c806131ba058d7d3bd67b0c52d419965..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/ContentProcessors/RemoveAnnotationProcessor.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using iTextSharp.text.pdf; - -namespace PDFPatcher.Processor -{ - sealed class RemoveAnnotationProcessor : IPageProcessor - { - readonly PdfName _AnnotationType; - int _processedPageCount; - - public RemoveAnnotationProcessor(PdfName annotationType) { - _AnnotationType = annotationType; - } - #region IPageProcessor 成员 - public string Name => "删除批注"; - public void BeginProcess(DocProcessorContext context) { - _processedPageCount = 0; - } - public bool EndProcess(PdfReader pdf) { - Tracker.TraceMessage(Tracker.Category.Notice, Name + "功能:"); - Tracker.TraceMessage("  删除了 " + _processedPageCount + " 页的批注。"); - return false; - } - public int EstimateWorkload(PdfReader pdf) { - return pdf.NumberOfPages; - } - - public bool Process(PageProcessorContext context) { - Tracker.IncrementProgress(1); - var anns = context.Page.GetAsArray(PdfName.ANNOTS); - if (anns == null) { - return false; - } - if (_AnnotationType == null) { - context.Page.Remove(PdfName.ANNOTS); - return true; - } - bool removed = false; - var l = anns.Size; - for (int i = l - 1; i >= 0; i--) { - var ann = PdfReader.GetPdfObject(anns[i]) as PdfDictionary; - if (ann == null) { - continue; - } - if (_AnnotationType.Equals(ann.GetAsName(PdfName.SUBTYPE)) == false) { - continue; - } - anns.Remove(i); - removed = true; - } - if (anns.Size == 0) { - context.Page.Remove(PdfName.ANNOTS); - } - if (removed) { - _processedPageCount++; - } - return removed; - } - - #endregion - } -} diff --git a/pdfpatcher/App/Processor/ContentProcessors/RemoveBookmarkProcessor.cs b/pdfpatcher/App/Processor/ContentProcessors/RemoveBookmarkProcessor.cs deleted file mode 100644 index f066ee31f5cc7d2ca71338844c915d85f1c0fa20..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/ContentProcessors/RemoveBookmarkProcessor.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using iTextSharp.text.pdf; - -namespace PDFPatcher.Processor -{ - sealed class RemoveBookmarkProcessor : IDocProcessor - { - #region IDocProcessor 成员 - public string Name => "删除导航书签"; - public void BeginProcess(DocProcessorContext context) { - } - public void EndProcess(DocProcessorContext context) { - } - public int EstimateWorkload(PdfReader pdf) { - return 1; - } - - public bool Process(DocProcessorContext context) { - Tracker.IncrementProgress(1); - OutlineManager.KillOutline(context.Pdf); - return true; - } - - #endregion - } -} diff --git a/pdfpatcher/App/Processor/ContentProcessors/RemoveDictionaryItemProcessor.cs b/pdfpatcher/App/Processor/ContentProcessors/RemoveDictionaryItemProcessor.cs deleted file mode 100644 index e5f11ceb5952b216cc5b3dac20df19b2a746c458..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/ContentProcessors/RemoveDictionaryItemProcessor.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using iTextSharp.text.pdf; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - /// - /// 删除指定字典名称项目的处理器。 - /// - sealed class RemoveDictionaryItemProcessor : IPageProcessor - { - readonly PdfName _ItemName; - public RemoveDictionaryItemProcessor(PdfName itemName) { - _ItemName = itemName; - } - - #region IPageProcessor 成员 - public string Name => "删除字典项目"; - public void BeginProcess(DocProcessorContext context) { - } - public bool EndProcess(PdfReader pdf) { - return false; - } - public int EstimateWorkload(PdfReader pdf) { - return 0; - } - - public bool Process(PageProcessorContext context) { - if (context.Page.Contains(_ItemName)) { - context.Page.Remove(_ItemName); - return true; - } - return false; - } - - #endregion - - #region IDocProcessor 成员 - - public bool Process(DocProcessorContext context) { - if (context.Pdf.Catalog.Contains(_ItemName)) { - context.Pdf.Catalog.Remove(_ItemName); - return true; - } - return false; - } - - #endregion - } -} diff --git a/pdfpatcher/App/Processor/ContentProcessors/RemoveEmptyCommandProcessor.cs b/pdfpatcher/App/Processor/ContentProcessors/RemoveEmptyCommandProcessor.cs deleted file mode 100644 index 6d53194033388246b7c9e46162f06064a48f0681..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/ContentProcessors/RemoveEmptyCommandProcessor.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.Collections.Generic; -using iTextSharp.text.pdf; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - //todo: 删除无直接输出效果的指令 - //todo: 删除空白页 - sealed class RemoveEmptyCommandProcessor : IPageProcessor - { - int _processedPageCount; - - #region IPageProcessor 成员 - public string Name => "删除冗余指令"; - - public void BeginProcess(DocProcessorContext context) { - _processedPageCount = 0; - } - public bool EndProcess(PdfReader pdf) { - Tracker.TraceMessage(Tracker.Category.Notice, Name + "功能:"); - Tracker.TraceMessage("  删除了 " + _processedPageCount + " 页的冗余指令。"); - return false; - } - - public int EstimateWorkload(PdfReader pdf) { - return pdf.NumberOfPages * 3; - } - - public bool Process(PageProcessorContext context) { - Tracker.IncrementProgress(3); - var p = context.PageCommands; - var r = false; - r = ProcessCommands(p.Commands); - if (r == true) { - context.IsPageContentModified = true; - _processedPageCount++; - } - ProcessFormContent(context); - return r; - } - - static void ProcessFormContent(PageProcessorContext context) { - var fl = context.Page.Locate(PdfName.RESOURCES, PdfName.XOBJECT); - if (fl == null) { - return; - } - foreach (var item in fl) { - var f = PdfReader.GetPdfObject(item.Value) as PRStream; - if (f == null - || PdfName.FORM.Equals(f.GetAsName(PdfName.SUBTYPE)) == false) { - continue; - } - var p = new PdfPageCommandProcessor(f); - if (ProcessCommands(p.Commands)) { - using (var ms = new System.IO.MemoryStream()) { - p.WritePdfCommands(ms); - ms.Flush(); - f.SetData(ms.ToArray(), ms.Length > 32); - } - } - } - } - - #endregion - - static bool ProcessCommands(IList parent) { - var r = false; - EnclosingCommand ec; - for (int i = parent.Count - 1; i >= 0; i--) { - ec = parent[i] as EnclosingCommand; - if (ec == null) { - continue; - } - if (ec.Name.ToString() == "BT") { - parent.RemoveAt(i); - r = true; - } - else { - r |= ProcessCommands(ec.Commands); - } - } - return r; - } - - } -} diff --git a/pdfpatcher/App/Processor/ContentProcessors/RemoveFormProcessor.cs b/pdfpatcher/App/Processor/ContentProcessors/RemoveFormProcessor.cs deleted file mode 100644 index 074e5c9b9f6dfb9e4f9ebd525ac61d45bb9c34ee..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/ContentProcessors/RemoveFormProcessor.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.Collections.Generic; -using iTextSharp.text.pdf; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - sealed class RemoveFormProcessor : IPageProcessor - { - int _processedPageCount; - - #region IPageProcessor 成员 - public string Name => "删除表单区域"; - - public void BeginProcess(DocProcessorContext context) { - _processedPageCount = 0; - } - public bool EndProcess(PdfReader pdf) { - Tracker.TraceMessage(Tracker.Category.Notice, Name + "功能:"); - Tracker.TraceMessage("  删除了 " + _processedPageCount + " 页的表单区域。"); - return false; - } - - public int EstimateWorkload(PdfReader pdf) { - return pdf.NumberOfPages * 3; - } - - public bool Process(PageProcessorContext context) { - Tracker.IncrementProgress(3); - var p = context.PageCommands; - var r = false; - var fl = ProcessFormContent(context); - if (fl.HasContent()) { - r = true; - ProcessCommands(p.Commands, fl); - } - if (r) { - context.IsPageContentModified = true; - _processedPageCount++; - } - return r; - } - - private static HashSet ProcessFormContent(PageProcessorContext context) { - var fl = context.Page.Locate(PdfName.RESOURCES, PdfName.XOBJECT); - if (fl == null) { - return null; - } - var r = new HashSet(); - foreach (var item in fl) { - var f = PdfReader.GetPdfObject(item.Value) as PRStream; - if (f == null - || PdfName.FORM.Equals(f.GetAsName(PdfName.SUBTYPE)) == false) { - continue; - } - r.Add(item.Key); - } - foreach (var item in r) { - fl.Remove(item); - } - if (fl.Size == 0) { - context.Page.Locate(PdfName.RESOURCES).Remove(PdfName.XOBJECT); - } - return r; - } - - #endregion - - private bool ProcessCommands(IList parent, HashSet formNames) { - var r = false; - for (int i = parent.Count - 1; i >= 0; i--) { - var cmd = parent[i]; - var ec = cmd as Model.EnclosingCommand; - if (ec != null) { - r |= ProcessCommands(ec.Commands, formNames); - } - if (cmd.Name.ToString() == "Do" && cmd.HasOperand && formNames.Contains(cmd.Operands[0] as PdfName)) { - parent.RemoveAt(i); - r = true; - } - } - return r; - } - - } -} diff --git a/pdfpatcher/App/Processor/ContentProcessors/RemoveTextBlockProcessor.cs b/pdfpatcher/App/Processor/ContentProcessors/RemoveTextBlockProcessor.cs deleted file mode 100644 index 44ae02170de6325308ce6f7248796445ddb27c85..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/ContentProcessors/RemoveTextBlockProcessor.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using System.Collections.Generic; -using iTextSharp.text.pdf; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - sealed class RemoveTextBlockProcessor : IPageProcessor - { - int _processedPageCount; - - #region IPageProcessor 成员 - public string Name => "删除文本区"; - - public void BeginProcess(DocProcessorContext context) { - _processedPageCount = 0; - } - public bool EndProcess(PdfReader pdf) { - Tracker.TraceMessage(Tracker.Category.Notice, Name + "功能:"); - Tracker.TraceMessage("  删除了 " + _processedPageCount + " 页的文本。"); - return false; - } - - public int EstimateWorkload(PdfReader pdf) { - return pdf.NumberOfPages * 3; - } - - public bool Process(PageProcessorContext context) { - Tracker.IncrementProgress(3); - var p = context.PageCommands; - var r = false; - r = ProcessCommands(p.Commands); - if (r == true) { - context.IsPageContentModified = true; - _processedPageCount++; - } - ProcessFormContent(context); - return r; - } - - static void ProcessFormContent(PageProcessorContext context) { - var fl = context.Page.Locate(PdfName.RESOURCES, PdfName.XOBJECT); - if (fl == null) { - return; - } - foreach (var item in fl) { - var f = PdfReader.GetPdfObject(item.Value) as PRStream; - if (f == null - || PdfName.FORM.Equals(f.GetAsName(PdfName.SUBTYPE)) == false) { - continue; - } - var p = new PdfPageCommandProcessor(f); - if (ProcessCommands(p.Commands)) { - using (var ms = new System.IO.MemoryStream()) { - p.WritePdfCommands(ms); - ms.Flush(); - f.SetData(ms.ToArray(), ms.Length > 32); - } - } - } - } - - #endregion - - private static bool ProcessCommands(IList parent) { - var r = false; - EnclosingCommand ec; - for (int i = parent.Count - 1; i >= 0; i--) { - ec = parent[i] as EnclosingCommand; - if (ec == null) { - continue; - } - if (ec.Name.ToString() == "BT") { - parent.RemoveAt(i); - r = true; - } - else { - r |= ProcessCommands(ec.Commands); - } - } - return r; - } - - } -} diff --git a/pdfpatcher/App/Processor/ContentProcessors/RemoveThumbnailProcessor.cs b/pdfpatcher/App/Processor/ContentProcessors/RemoveThumbnailProcessor.cs deleted file mode 100644 index 2217699ae626d6b2089911f3a8c86145fd015e4a..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/ContentProcessors/RemoveThumbnailProcessor.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using iTextSharp.text.pdf; - -namespace PDFPatcher.Processor -{ - sealed class RemoveThumbnailProcessor : IPageProcessor - { - int _processedItemCount; - - #region IPageProcessor 成员 - public string Name => "删除缩略图"; - public void BeginProcess(DocProcessorContext context) { - _processedItemCount = 0; - } - public bool EndProcess(PdfReader pdf) { - Tracker.TraceMessage(Tracker.Category.Notice, Name + "功能:"); - Tracker.TraceMessage("  删除了 " + _processedItemCount + " 幅缩略图。"); - return false; - } - public int EstimateWorkload(PdfReader pdf) { - return pdf.NumberOfPages; - } - - public bool Process(PageProcessorContext context) { - Tracker.IncrementProgress(1); - if (context.Page.Contains(PdfName.THUMB) == false) { - return false; - } - context.Page.Remove(PdfName.THUMB); - _processedItemCount++; - return true; - } - - #endregion - } -} diff --git a/pdfpatcher/App/Processor/ContentProcessors/RemoveWrappedCommandProcessor.cs b/pdfpatcher/App/Processor/ContentProcessors/RemoveWrappedCommandProcessor.cs deleted file mode 100644 index 74cd635f7bbf4ad6d9685fe913416665c391dff5..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/ContentProcessors/RemoveWrappedCommandProcessor.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using iTextSharp.text.pdf; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - sealed class RemoveWrappedCommandProcessor : IPageProcessor - { - int _processedPageCount; - private readonly int _RemoveLeading, _RemoveTrailing; - - public RemoveWrappedCommandProcessor(int removeLeadingCommandCount, int removeTrailingCommandCount) { - _RemoveLeading = removeLeadingCommandCount; - _RemoveTrailing = removeTrailingCommandCount; - } - - #region IPageProcessor 成员 - public string Name => "删除页面起始或结束指令"; - - public void BeginProcess(DocProcessorContext context) { - _processedPageCount = 0; - } - public bool EndProcess(PdfReader pdf) { - Tracker.TraceMessage(Tracker.Category.Notice, Name + "功能:"); - Tracker.TraceMessage("  删除了 " + _processedPageCount + " 页的指令。"); - return false; - } - - public int EstimateWorkload(PdfReader pdf) { - return pdf.NumberOfPages * 3; - } - - public bool Process(PageProcessorContext context) { - Tracker.IncrementProgress(3); - var p = context.PageCommands; - var r = ProcessCommands(p.Commands); - if (r) { - context.IsPageContentModified = true; - _processedPageCount++; - } - return r; - } - - #endregion - - bool ProcessCommands(IList parent) { - var r = false; - if (_RemoveLeading > 0) { - for (int i = _RemoveLeading - 1; i >= 0 && parent.Count > 0; i--) { - parent.RemoveAt(i); - } - r = true; - } - if (_RemoveTrailing > 0) { - for (int i = _RemoveTrailing - 1; i >= 0 && parent.Count > 0; i--) { - parent.RemoveAt(parent.Count - 1); - } - r = true; - } - return r; - } - - } -} diff --git a/pdfpatcher/App/Processor/ContentProcessors/ReplaceFontProcessor.cs b/pdfpatcher/App/Processor/ContentProcessors/ReplaceFontProcessor.cs deleted file mode 100644 index 31cdc00235c5496b192de4f8605456c33bbb6369..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/ContentProcessors/ReplaceFontProcessor.cs +++ /dev/null @@ -1,665 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using iTextSharp.text; -using iTextSharp.text.pdf; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - sealed class ReplaceFontProcessor : IPageProcessor - { - static readonly string[] __LegacyFonts = { "宋体", "楷体_GB2312", "仿宋_GB2312", "黑体", "STSONG-LIGHT-GB-EUC-H", "STSONG-LIGHT-GBK-EUC-H" }; - static readonly string[] __AlternativeFonts = { "宋体", "楷体", "仿宋", "微软雅黑", "宋体", "宋体" }; - static readonly PdfName __GbkEncoding = new PdfName("GBK-EUC-H"); - static readonly PdfName __GbEncoding = new PdfName("GB-EUC-H"); - const string HalfWidthLetters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; - const string FullWidthLetters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; - const string HalfWidthNumbers = "0123456789"; - const string FullWidthNumbers = "0123456789"; - - readonly bool _embedLegacyFonts; - readonly bool _trimTrailingWhiteSpace; - NewFont _currentNewFont; - FontInfo _currentFont; - FontFactoryImp _fontFactory; - Dictionary _newFonts; - Dictionary _fontMap; - Dictionary _fontNameIDMap; - Dictionary _fontInfoMap; - Dictionary _fontSubstitutions; - Dictionary _fontRefIDMap; - Dictionary> _fontDictMap; - HashSet _bypassFonts; - //bool _usedStyle; - - public ReplaceFontProcessor(bool embedLegacyFonts, bool trimTrailingWhiteSpace, Dictionary fontSubstitutions) { - _embedLegacyFonts = embedLegacyFonts; - _trimTrailingWhiteSpace = trimTrailingWhiteSpace; - _fontSubstitutions = fontSubstitutions; - } - #region IPageProcessor 成员 - public string Name => "嵌入汉字库"; - public void BeginProcess(DocProcessorContext context) { - if (_fontSubstitutions == null) { - _fontSubstitutions = new Dictionary(0); - } - var l = __LegacyFonts.Length + _fontSubstitutions.Count; - _newFonts = new Dictionary(l, StringComparer.CurrentCultureIgnoreCase); - _fontMap = new Dictionary(l); - _fontNameIDMap = new Dictionary(); - _fontInfoMap = new Dictionary(); - _fontFactory = new FontFactoryImp(); - _fontRefIDMap = new Dictionary(); - _fontDictMap = new Dictionary>(); - _bypassFonts = new HashSet(); - foreach (var item in Common.FontHelper.GetInstalledFonts(true)) { - try { - _fontFactory.Register(item.Value, item.Key); - } - catch (Exception) { - // ignore - } - } - //_fontFactory.RegisterDirectory (Common.FontHelper.FontDirectory); - } - public bool EndProcess(PdfReader pdf) { - // 用新的字体引用替代字体资源表的字体 - foreach (var map in _fontDictMap) { - var d = map.Key; - foreach (var item in map.Value) { - d.Put(item.Key, item.Value); - } - } - SubSetFontData(pdf); - return false; - } - - public int EstimateWorkload(PdfReader pdf) { - return pdf.NumberOfPages; - } - - public bool Process(PageProcessorContext context) { - Tracker.IncrementProgress(1); - var fonts = context.Page.Locate(PdfName.RESOURCES, PdfName.FONT); - if (fonts == null) { - return false; - } - //bool hasAnsiCjkFont = DetectLegacyCjkFont (context, fonts); - //if (hasAnsiCjkFont == false) { - // return false; - //} - _currentFont = null; - _currentNewFont = null; - _fontNameIDMap.Clear(); - _fontMap.Clear(); - LoadFonts(context, fonts); - if (_fontMap.Count == 0) { - return false; - } - if (ProcessCommands(context.PageCommands.Commands)) { - context.IsPageContentModified = true; - return true; - } - return false; - } - - #endregion - - bool ProcessCommands(IList parent) { - var r = false; - EnclosingCommand ec; - var l = parent.Count; - for (int i = 0; i < l; i++) { - ec = parent[i] as EnclosingCommand; - if (ec == null) { - continue; - } - var n = ec.Name.ToString(); - if (n == "BT") { - foreach (var item in ec.Commands) { - if (item.Type == PdfPageCommandType.Enclosure) { - foreach (var sc in ((item as EnclosingCommand).Commands)) { - ProcessTextCommand(sc); - } - } - else { - if (ProcessTextCommand(item) == false) { - continue; - } - } - } - //if (_usedStyle) { - // _usedStyle = false; - //} - r = true; - } - else if (n == "BDC") { - r |= ProcessCommands(ec.Commands); - //if ((ec.Operands[0] as PdfName)?.ToString() == "/StyleSpan" && (ec.Commands[0] as EnclosingCommand).Commands[1] is MatrixCommand m && (m.Operands[0] as PdfNumber).FloatValue == 6.041f) { - // _usedStyle = true; - //} - } - else { - var cnf = _currentNewFont; - var cf = _currentFont; - r |= ProcessCommands(ec.Commands); - _currentNewFont = cnf; - _currentFont = cf; - } - } - return r; - } - - bool ProcessTextCommand(PdfPageCommand item) { - var cn = item.Name.ToString(); - if (cn == "Tf") { - var cf = item.Operands[0] as PdfName; - if (_fontMap.TryGetValue(cf, out _currentNewFont) == false) { - //Tracker.TraceMessage ("找不到字体:" + cf.ToString ()); - _currentNewFont = null; - } - if (_fontNameIDMap.TryGetValue(cf, out int ni) == false - || _fontInfoMap.TryGetValue(ni, out _currentFont) == false) { - _currentFont = null; - } - } - else if (item.Type == PdfPageCommandType.Text) { - if (_currentNewFont == null || _currentFont == null) { - return false; - } - RewriteTextOut(_currentNewFont, _currentFont, item); - } - //else if (_usedStyle && item.Type == PdfPageCommandType.Matrix) { - // var m = item as MatrixCommand; - // if (m.Operands[0] is PdfNumber mn && mn.FloatValue == 10.522f) { - // m.Operands[5] = new PdfNumber((m.Operands[5] as PdfNumber).FloatValue + 1.05f); - // } - //} - //else if (_usedStyle && cn == "Td") { - // if (item.Operands[1] is PdfNumber dy && dy.FloatValue != 0) { - // item.Operands[1] = new PdfNumber(-1.5f); - // } - //} - return true; - } - - void RewriteTextOut(NewFont ef, FontInfo fontInfo, PdfPageCommand cmd) { - var ops = cmd.Operands; - var f = ef.Font.BaseFont as TrueTypeFontUnicode; - if (ops.Length == 0) { - return; - } - var op = ops[0]; - string t; - if (op.Type == PdfObject.STRING) { - t = fontInfo.DecodeText(op as PdfString);//.TrimEnd (); - if (_trimTrailingWhiteSpace) { - t = t.TrimEnd(); - } - ops[0] = RewriteText(ef, f, t); - //AddCustomDefaultWidth (ef, fontInfo, t); - } - else if (op.Type == PdfObject.ARRAY) { - var a = op as PdfArray; - var l = a.Size; - for (int i = 0; i < l; i++) { - op = a[i]; - if (op.Type == PdfObject.STRING) { - t = fontInfo.DecodeText(op as PdfString); - if (_trimTrailingWhiteSpace/* && i == l - 1*/) { - t = t.TrimEnd(); - } - a[i] = RewriteText(ef, f, t); - //AddCustomDefaultWidth (ef, fontInfo, t); - } - } - } - } - - static void AddCustomDefaultWidth(NewFont newFont, FontInfo fontInfo, string text) { - if (fontInfo.DefaultWidth == FontInfo.DefaultDefaultWidth) { - return; - } - var dw = fontInfo.DefaultWidth; - var w = newFont.GlyphWidths; - //newFont.DefaultWidth = dw; - foreach (var ch in text) { - if (w.ContainsKey(ch) == false) { - w.Add(ch, dw); - } - } - } - - static PdfString RewriteText(NewFont newFont, TrueTypeFontUnicode ttf, string text) { - var cs = newFont.CharSubstitutions.Count > 0; - using (var bb = new ByteBuffer()) { - foreach (var ch in text) { - if (cs == false || newFont.CharSubstitutions.TryGetValue(ch, out char c) == false) { - c = ch; - } - if (newFont.UsedCidMap.TryGetValue(c, out int cid) == false) { - var tt = ttf.GetMetricsTT(c); - if (tt == null) { - newFont.AbsentChars.Add(c); - continue; - } - cid = tt[0]; - newFont.UsedCidMap[c] = cid; - newFont.GlyphWidths[cid] = tt[1]; - } - bb.Append((byte)(cid >> 8)); - bb.Append((byte)cid); - } - return new PdfString(bb.ToByteArray()); - } - } - - static bool DetectLegacyCjkFont(PdfDictionary font) { - var en = font.GetAsName(PdfName.ENCODING); - if (en == null - || (PdfName.WIN_ANSI_ENCODING.Equals(en) || __GbkEncoding.Equals(en) || __GbEncoding.Equals(en)) == false - ) { - return false; - } - return PdfDocumentFont.HasEmbeddedFont(font) == false; - } - - void LoadFonts(PageProcessorContext context, PdfDictionary fonts) { - var r = new Dictionary(fonts.Length); // 替代的字体 - foreach (var item in fonts) { - string sn; // 替换字体名称 - string n; // 字体名称 - var fr = item.Value as PdfIndirectReference; - if (fr == null - || _bypassFonts.Contains(fr.Number)) { - continue; - } - if (_fontRefIDMap.TryGetValue(fr.Number, out NewFont nf) == false) { - var f = fr.CastAs(); - if (f == null) { - goto BYPASSFONT; - } - var fn = f.GetAsName(PdfName.BASEFONT); - if (fn == null) { - goto BYPASSFONT; - } - n = PdfDocumentFont.RemoveSubsetPrefix(PdfHelper.GetPdfNameString(fn)); // 字体名称 - var p = -1; - FontSubstitution fs; - if (_fontSubstitutions.TryGetValue(n, out fs)) { - sn = fs.Substitution; - } - else { - if (_embedLegacyFonts == false || DetectLegacyCjkFont(f) == false) { - goto BYPASSFONT; - } - p = Array.IndexOf(__LegacyFonts, n.ToUpperInvariant()); - if (p == -1) { - goto BYPASSFONT; - } - sn = null; - } - if (_newFonts.TryGetValue(sn ?? n, out nf) == false) { - try { - Tracker.TraceMessage("加载字体:" + (sn != null ? String.Concat(sn, "(替换 ", n, ")") : n)); - if (sn != null) { - n = sn; - } - string sf = null; - foreach (var font in Common.FontUtility.InstalledFonts) { - if (font.DisplayName == n) { - sf = font.OriginalName; - break; - } - } - nf = new NewFont { - Font = _fontFactory.GetFont(sf ?? n, BaseFont.IDENTITY_H), - FontRef = context.Pdf.AddPdfObject(new PdfDictionary()), - DescendantFontRef = context.Pdf.AddPdfObject(new PdfArray()) - }; - if (fs.TraditionalChineseConversion != 0) { - if (fs.TraditionalChineseConversion > 0) { - Map(nf.CharSubstitutions, Constants.Chinese.Simplified, Constants.Chinese.Traditional); - } - else { - Map(nf.CharSubstitutions, Constants.Chinese.Traditional, Constants.Chinese.Simplified); - } - } - if (fs.NumericWidthConversion != 0) { - if (fs.NumericWidthConversion > 0) { - Map(nf.CharSubstitutions, HalfWidthNumbers, FullWidthNumbers); - } - else { - Map(nf.CharSubstitutions, FullWidthNumbers, HalfWidthNumbers); - } - } - if (fs.AlphabeticWidthConversion != 0) { - if (fs.AlphabeticWidthConversion > 0) { - Map(nf.CharSubstitutions, HalfWidthLetters, FullWidthLetters); - } - else { - Map(nf.CharSubstitutions, FullWidthLetters, HalfWidthLetters); - } - } - if (fs.PunctuationWidthConversion != 0) { - if (fs.PunctuationWidthConversion > 0) { - Map(nf.CharSubstitutions, SetCaseProcessor.HalfWidthPunctuations, SetCaseProcessor.FullWidthPunctuations); - } - else { - Map(nf.CharSubstitutions, SetCaseProcessor.FullWidthPunctuations, SetCaseProcessor.HalfWidthPunctuations); - } - } - if (fs?.OriginalCharacters != null && fs.SubstituteCharacters != null) { - var sl = fs.SubstituteCharacters.Length; - for (int i = 0; i < fs.OriginalCharacters.Length; i++) { - if (i >= sl) { - break; - } - nf.CharSubstitutions[fs.OriginalCharacters[i]] = fs.SubstituteCharacters[i]; - } - } - if (sn == null && p != -1 && nf.Font.BaseFont == null) { - nf.Font = _fontFactory.GetFont(__AlternativeFonts[p], BaseFont.IDENTITY_H); - } - if (nf.Font.BaseFont == null) { - throw new System.IO.FileNotFoundException("无法加载字体:" + n); - } - _newFonts.Add(n, nf); - } - catch (Exception) { - Tracker.TraceMessage(Tracker.Category.Error, "无法加载字体"); - throw; - } - } - r[item.Key] = nf.FontRef; - if (_fontInfoMap.ContainsKey(fr.Number) == false) { - var fi = new FontInfo(f, fr.Number); - _fontInfoMap.Add(fr.Number, fi); - //try { - // ReadSingleByteFontWidths (f, fi, nf); - // ReadCidFontWidths (f, fi, nf); - //} - //catch (NullReferenceException) { - // Tracker.TraceMessage (Tracker.Category.ImportantMessage, "字体“" + n + "”的 CID 宽度表错误。"); - //} - } - _fontRefIDMap[nf.FontRef.Number] = nf; - } - //ef.FontDictionaries[(item.Value as PdfIndirectReference).Number] = f; - _fontMap[item.Key] = nf; - _fontNameIDMap[item.Key] = fr.Number; - continue; - BYPASSFONT: - _bypassFonts.Add(fr.Number); - } - if (r.Count > 0) { - _fontDictMap[fonts] = r; - } - } - - static void Map(Dictionary map, string from, string to) { - var i = 0; - foreach (var item in from) { - map[item] = to[i++]; - } - } - - static void ReadSingleByteFontWidths(PdfDictionary font, FontInfo fontInfo, NewFont newFont) { - var wl = font.GetAsArray(PdfName.WIDTHS); - if (wl == null) { - return; - } - var fc = font.TryGetInt32(PdfName.FIRSTCHAR, 0); - var widths = newFont.GlyphWidths; - foreach (PdfNumber item in wl) { - if (item == null) { - continue; - } - var s = fontInfo.Decode(new byte[] { (byte)fc }, 0, 1); - if (s.Length == 0) { - continue; - } - int w; - if (widths.TryGetValue(s[0], out w) == false || w == 0) { - widths[s[0]] = item.IntValue; - } - ++fc; - } - } - static void ReadCidFontWidths(PdfDictionary font, FontInfo fontInfo, NewFont newfont) { - var w = font.GetAsArray(PdfName.W); - if (w == null) { - w = font.Locate(PdfName.DESCENDANTFONTS, 0, PdfName.W); - if (w == null) { - return; - } - } - var l = w.Size; - PdfObject cw; - int cid; - var widths = newfont.GlyphWidths; - for (int i = 0; i < l; i++) { - cid = (w[i] as PdfNumber).IntValue; - if (++i >= l) { - break; - } - cw = w[i]; - if (cw.Type == PdfObject.ARRAY) { - foreach (var width in cw as PdfArray) { - var u = fontInfo.DecodeCidToUnicode(cid); - if (u == 0 && cid != 0) { - Console.WriteLine(cid.ToString() + "-无法解码CID"); - continue; - } - ++cid; - widths[u] = (width as PdfNumber).IntValue; - Console.WriteLine(String.Join(" ", new string[] { cid.ToString(), ((char)u).ToString(), widths[u].ToString() })); - } - } - else if (cw.Type == PdfObject.NUMBER) { - var cid2 = (cw as PdfNumber).IntValue + 1; - var width = (w[++i] as PdfNumber).IntValue; - do { - var u = fontInfo.DecodeCidToUnicode(cid); - if (u == 0 && cid != 0) { - Console.WriteLine(cid.ToString() + "-无法解码CID"); - continue; - } - widths[u] = width; - Console.WriteLine(String.Join(" ", new string[] { cid.ToString(), ((char)u).ToString(), width.ToString() })); - } while (++cid < cid2); - } - } - } - - static void ChangeLegacyFontDictionary(PdfReader pdf, NewFont font) { - var f = PdfReader.GetPdfObject(font.FontRef) as PdfDictionary; - f.Put(PdfName.TYPE, PdfName.FONT); - f.Put(PdfName.SUBTYPE, PdfName.TYPE0); - f.Put(PdfName.BASEFONT, new PdfName(font.FontName)); - f.Put(PdfName.ENCODING, new PdfName(BaseFont.IDENTITY_H)); - f.Put(PdfName.DESCENDANTFONTS, font.DescendantFontRef); - var metrics = new int[font.UsedCidMap.Count][]; - var i = -1; - foreach (var m in font.UsedCidMap) { - metrics[++i] = new int[] { m.Value, 0, m.Key }; - } - var ttf = (font.Font.BaseFont as TrueTypeFontUnicode); - Array.Sort(metrics, ttf); - var u = pdf.AddPdfObject(ttf.GetToUnicode(metrics)); - f.Put(PdfName.TOUNICODE, u); - } - - static void WriteCidWidths(NewFont font, PdfDictionary fontDictionary) { - var l = font.GlyphWidths.Count; - if (l == 0) { - return; - } - var widths = new CharacterWidth[l]; - var i = -1; - int width; - foreach (var item in font.GlyphWidths) { - if (item.Value == FontInfo.DefaultDefaultWidth) { - continue; - } - widths[++i] = new CharacterWidth(item.Key, item.Value); - } - l = ++i; - Array.Resize(ref widths, l); - Array.Sort(widths, CharacterWidth.Compare); - var w = new PdfArray(); - int id, id2; - CharacterWidth cw; - for (i = 0; i < l; i++) { - id = widths[i].ID; - w.Add(new PdfNumber(id)); - width = widths[i].Width; - var i2 = i; - id2 = id; - var wl = new PdfArray { - new PdfNumber(width) - }; - while (++i2 < l && (cw = widths[i2]).ID == ++id2 && cw.Width != width) { - wl.Add(new PdfNumber(cw.Width)); - } - if (wl.Size > 1) { - w.Add(wl); - i = i2 - 1; - continue; - } - id2 = id; - for (i2 = i + 1; i2 < l; i2++) { - cw = widths[i2]; - if (++id2 != cw.ID || cw.Width != width) { - i2--; - id2--; - break; - } - } - if (i2 > i) { - w.Add(new PdfNumber(id2)); - w.Add(new PdfNumber(width)); - i = i2; - } - else { - w.Add(wl); - } - } - if (w.Size > 0) { - fontDictionary.Put(PdfName.W, w); - } - } - - void SubSetFontData(PdfReader pdf) { - foreach (var font in _newFonts) { - var newFont = font.Value; - Tracker.TraceMessage("嵌入字体:" + newFont.Font.Familyname + "(" + newFont.UsedCidMap.Count + "字)"); - if (newFont.AbsentChars.Count > 0) { - Tracker.TraceMessage(Tracker.Category.ImportantMessage, String.Concat("丢失", newFont.AbsentChars.Count, "字:", new String(newFont.AbsentChars.ToArray()))); - } - ChangeLegacyFontDictionary(pdf, newFont); - - var ttf = newFont.Font.BaseFont as TrueTypeFontUnicode; - var fa = PdfReader.GetPdfObject(newFont.DescendantFontRef) as PdfArray; - var df = new PdfDictionary(); - fa.Add(df); - df.Put(PdfName.TYPE, PdfName.FONT); - df.Put(PdfName.SUBTYPE, ttf.Cff ? PdfName.CIDFONTTYPE0 : PdfName.CIDFONTTYPE2); - df.Put(PdfName.BASEFONT, new PdfName(newFont.FontName)); - df.Put(PdfName.CIDTOGIDMAP, PdfName.IDENTITY); - df.Put(PdfName.DW, FontInfo.DefaultDefaultWidth); - var fs = pdf.AddPdfObject(SubsetFont(newFont, ttf)); - var fd = ttf.GetFontDescriptor(fs, newFont.SubsetPrefix, null); - df.Put(PdfName.FONTDESCRIPTOR, pdf.AddPdfObject(fd)); - WriteCidWidths(newFont, df); - - var csi = new PdfDictionary(); - csi.Put(PdfName.REGISTRY, new PdfString("Adobe")); - csi.Put(PdfName.ORDERING, new PdfString("Identity")); - csi.Put(PdfName.SUPPLEMENT, new PdfNumber(0)); - df.Put(PdfName.CIDSYSTEMINFO, csi); - - } - } - - static PdfStream SubsetFont(NewFont ef, TrueTypeFontUnicode ttf) { - //ttf.AddSubsetRange (r); - byte[] b; - if (ttf.Cff) { - int[] metricsTT; - var d = new Dictionary(ef.UsedCidMap.Count); - foreach (var item in ef.UsedCidMap) { - metricsTT = ttf.GetMetricsTT(item.Key); - d.Add(item.Value, new int[] { metricsTT[0], metricsTT[1], item.Key }); - } - //ttf.AddRangeUni (d, false, true); - var f = new CFFFontSubset(new RandomAccessFileOrArray(ttf.ReadCffFont()), d); - b = f.Process(f.GetNames()[0]); - } - else { - var r = new int[ef.UsedCidMap.Count]; - ef.UsedCidMap.Values.CopyTo(r, 0); - var ts = new TrueTypeFontSubSet(ttf.FileName, new RandomAccessFileOrArray(ttf.FileName), new System.util.collections.HashSet2(r), ttf.DirectoryOffset, true, true); - b = ts.Process(); - } - var s = new PdfStream(b); - if (ttf.Cff) { - s.Put(PdfName.SUBTYPE, new PdfName("CIDFontType0C")); - } - s.FlateCompress(); - s.Put(PdfName.LENGTH1, new PdfNumber(b.Length)); - return s; - } - - [System.Diagnostics.DebuggerDisplay("{ID},{Width}")] - struct CharacterWidth - { - public int ID, Width; - - public CharacterWidth(int id, int width) { - ID = id; - Width = width; - } - public static int Compare(CharacterWidth x, CharacterWidth y) { - return x.ID.CompareTo(y.ID); - } - } - - [System.Diagnostics.DebuggerDisplay("{FontName}")] - sealed class NewFont - { - public Dictionary FontDictionaries { get; set; } - public PRIndirectReference FontRef { get; set; } - public PdfIndirectReference DescendantFontRef { get; set; } - /// - /// 字体 Unicode 到宽度的映射表。 - /// - public Dictionary GlyphWidths { get; } - /// - /// 字体 Unicode 和 CID 的映射表。 - /// - public Dictionary UsedCidMap { get; } - public string SubsetPrefix { get; private set; } - public string FontName => SubsetPrefix + _Font.Familyname; - public HashSet AbsentChars { get; } - public Dictionary CharSubstitutions { get; } - Font _Font; - public Font Font { - get => _Font; - set { - _Font = value; - SubsetPrefix = BaseFont.CreateSubsetPrefix(); - } - } - - public NewFont() { - GlyphWidths = new Dictionary(); - FontDictionaries = new Dictionary(); - UsedCidMap = new Dictionary(); - AbsentChars = new HashSet(); - CharSubstitutions = new Dictionary(); - } - } - } -} diff --git a/pdfpatcher/App/Processor/DocInfoExporter.cs b/pdfpatcher/App/Processor/DocInfoExporter.cs deleted file mode 100644 index e55b6262c5870c30ab5d2335458b8df1015a805c..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/DocInfoExporter.cs +++ /dev/null @@ -1,621 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using System.Xml; -using iTextSharp.text.pdf; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - internal sealed class DocInfoExporter - { - const string SimpleBookmarkPageNumLeader = " ………… "; - const int OpenDocWorkload = 10; - const int BookmarkWorkload = 30; - - static internal XmlWriterSettings GetWriterSettings() { - return new XmlWriterSettings() { - Encoding = AppContext.Exporter.GetEncoding(), - Indent = true, - IndentChars = "\t", - CheckCharacters = false - }; - } - - readonly PdfReader _reader; - readonly ExporterOptions _options; - readonly PdfContentExport _contentExport; - readonly PdfActionExporter _actionExport; - Dictionary _pageReferenceMapper; - private Dictionary PageReferenceMapper { - get { - if (_pageReferenceMapper == null) { - _pageReferenceMapper = _reader.GetPageRefMapper(); - } - return _pageReferenceMapper; - } - } - - public DocInfoExporter(PdfReader reader, ExporterOptions options) { - _reader = reader; - _options = options; - _contentExport = new PdfContentExport(options); - _actionExport = new PdfActionExporter(options.UnitConverter); - } - - internal int EstimateWorkload() { - var n = _reader.NumberOfPages; - var load = OpenDocWorkload; - if (_options.ExportCatalog) { - load += n / 100; - } - if (_options.ExportBookmarks) { - load += BookmarkWorkload; - } - if (_options.ExtractPageLinks) { - load += n; - } - if (_options.ExtractPageContent) { - load += PageRangeCollection.Parse(_options.ExtractPageRange, 1, n, true).TotalPages; - } - if (_options.ExtractPageSettings) { - load += n; - } - return load; - } - - internal static GeneralInfo RewriteDocInfoWithEncoding(PdfReader pdf, Encoding encoding) { - try { - return RewriteDocInfoWithEncoding(pdf.Trailer.GetAsDict(PdfName.INFO), encoding); - } - catch (IOException) { - // 忽略错误的元数据 - return new GeneralInfo(); - } - } - - internal static GeneralInfo RewriteDocInfoWithEncoding(PdfDictionary info, Encoding encoding) { - var r = new GeneralInfo(); - if (info == null || info.Length == 0) { - return r; - } - var dump = new PdfDictionary(); - string t; - PdfName n; - PdfString s; - foreach (var item in info) { - s = item.Value as PdfString; - if (s == null) { - continue; - } - n = item.Key; - t = s.Decode(encoding); - if (PdfName.TITLE.Equals(n)) { - r.Title = t; - } - else if (PdfName.AUTHOR.Equals(n)) { - r.Author = t; - } - else if (PdfName.SUBJECT.Equals(n)) { - r.Subject = t; - } - else if (PdfName.KEYWORDS.Equals(n)) { - r.Keywords = t; - } - else if (PdfName.CREATOR.Equals(n)) { - r.Creator = t; - } - else if (PdfName.PRODUCER.Equals(n)) { - r.Producer = t; - } - dump.Put(n, t); - } - if (encoding != null) { - info.Merge(dump); - } - dump = null; - return r; - } - - internal static void WriteDocumentInfoAttributes(XmlWriter w, string sourcePath, int numberOfPages) { - w.WriteAttributeString(Constants.Info.ProductName, System.Windows.Forms.Application.ProductName); - w.WriteAttributeString(Constants.Info.ProductVersion, Constants.InfoDocVersion); - w.WriteAttributeString(Constants.Info.ExportDate, DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss")); - //w.WriteAttributeString (Constants.Info.DocumentName, Path.GetFileNameWithoutExtension (sourceFile)); - w.WriteAttributeString(Constants.Info.DocumentPath, sourcePath); - w.WriteAttributeString(Constants.Info.PageNumber, numberOfPages.ToText()); - } - - internal void ExportDocument(XmlWriter w) { - Tracker.IncrementProgress(OpenDocWorkload); - if (_options.UnitConverter.UnitFactor != 1) { - w.WriteStartElement(Constants.Units.ThisName); - w.WriteAttributeString(Constants.Units.Unit, _options.UnitConverter.Unit); - w.WriteEndElement(); - } - if (_options.ExportDocProperties) { - Tracker.TraceMessage("导出文档信息。"); - RewriteDocInfoWithEncoding(_reader, AppContext.Encodings.DocInfoEncoding); - ExportDocumentInfo(w); - } - if (_options.ExportViewerPreferences) { - Tracker.TraceMessage("导出阅读器设置。"); - ExportViewerPreferences(w); - } - if (_options.ExportBookmarks || _options.ExtractPageLinks) { - if (_options.ConsolidateNamedDestinations) { - _reader.ConsolidateNamedDestinations(); - } - if (_options.ExportBookmarks) { - Tracker.TraceMessage("导出书签。"); - w.WriteStartElement(Constants.DocumentBookmark); - ExportBookmarks(OutlineManager.GetBookmark(_reader, _options.UnitConverter), w); - w.WriteEndElement(); - Tracker.IncrementProgress(BookmarkWorkload); - } - if (_options.ExtractPageLinks) { - Tracker.TraceMessage("导出页面连接。"); - ExtractPageLinks(w); - } - if (_options.ConsolidateNamedDestinations == false) { - Tracker.TraceMessage("导出命名目标。"); - ExportNamedDestinations(w); - } - } - if (_options.ExtractPageSettings) { - Tracker.TraceMessage("导出页面设置。"); - w.WriteStartElement(Constants.Content.PageSettings.ThisName); - ExtractPageSettings(w); - w.WriteEndElement(); - } - if (_options.ExportCatalog) { - _contentExport.ExportTrailer(w, _reader); - } - if (_options.ExtractPageContent) { - _contentExport.ExportContents(w, _reader); - } - Tracker.TraceMessage("完成导出任务。"); - } - - internal void ExportDocumentInfo(XmlWriter w) { - var info = _reader.Catalog; - w.WriteStartElement(Constants.Info.ThisName); - if (info.Contains(PdfName.VERSION)) - w.WriteAttributeString(Constants.Version, PdfHelper.GetPdfNameString(info.GetAsName(PdfName.VERSION))); - info = _reader.Trailer.GetAsDict(PdfName.INFO); - if (info?.Length > 0) { - string key, val; - foreach (var item in info) { - key = PdfName.DecodeName(item.Key.ToString()); - val = item.Value.IsString() ? ((PdfString)item.Value).Decode(null) : item.Value.ToString(); - switch (key) { - case "Title": key = Constants.Info.Title; break; - case "Author": key = Constants.Info.Author; break; - case "Subject": key = Constants.Info.Subject; break; - case "Keywords": key = Constants.Info.Keywords; break; - case "Creator": key = Constants.Info.Creator; break; - case "Producer": key = Constants.Info.Producer; break; - case "CreationDate": - key = Constants.Info.CreationDate; - goto case "//DecodeDate"; - case "ModDate": - key = Constants.Info.ModDate; - goto case "//DecodeDate"; - case "//DecodeDate": - try { - val = PdfDate.Decode(val).ToString("yyyy年MM月dd日 HH:mm:ss"); - } - catch (Exception) { - continue; - } - break; - } - w.WriteAttributeString(XmlConvert.EncodeLocalName(key), PdfHelper.GetValidXmlString(val)); - } - if (_reader.Metadata?.Length > 0) { - w.WriteStartElement(Constants.Info.MetaData); - using (MemoryStream ms = new MemoryStream(_reader.Metadata)) { - var d = new XmlDocument(); - d.Load(ms); - d.DocumentElement?.WriteContentTo(w); - } - w.WriteEndElement(); - } - } - w.WriteEndElement(); - - } - - internal static void WriteDocumentInfoAttributes(TextWriter w, string sourcePath, int numberOfPages) { - w.WriteLine("#版本=" + Constants.InfoDocVersion); - w.WriteLine("#" + Constants.Info.DocumentPath + "=" + sourcePath); - w.WriteLine("#页数=" + numberOfPages); - w.WriteLine(); - } - - internal void ExportDocument(TextWriter w) { - var i = RewriteDocInfoWithEncoding(_reader, AppContext.Encodings.DocInfoEncoding); - OutlineManager.WriteSimpleBookmarkInstruction(w, Constants.Info.Title, PdfHelper.GetValidXmlString(i.Title)); - OutlineManager.WriteSimpleBookmarkInstruction(w, Constants.Info.Author, PdfHelper.GetValidXmlString(i.Author)); - OutlineManager.WriteSimpleBookmarkInstruction(w, Constants.Info.Subject, PdfHelper.GetValidXmlString(i.Subject)); - OutlineManager.WriteSimpleBookmarkInstruction(w, Constants.Info.Keywords, PdfHelper.GetValidXmlString(i.Keywords)); - OutlineManager.WriteSimpleBookmarkInstruction(w, Constants.Info.Creator, PdfHelper.GetValidXmlString(i.Creator)); - OutlineManager.WriteSimpleBookmarkInstruction(w, Constants.Info.Producer, PdfHelper.GetValidXmlString(i.Producer)); - } - - internal void ExportViewerPreferences(XmlWriter w) { - var catalog = _reader.Catalog; - if (catalog.Contains(PdfName.VIEWERPREFERENCES) || catalog.Contains(PdfName.PAGELAYOUT) || catalog.Contains(PdfName.PAGEMODE)) { - w.WriteStartElement(Constants.ViewerPreferences); - if (catalog.Contains(PdfName.PAGELAYOUT)) { - w.WriteAttributeString(Constants.PageLayout, - ValueHelper.MapValue(catalog.GetAsName(PdfName.PAGELAYOUT), Constants.PageLayoutType.PdfNames, - Constants.PageLayoutType.Names)); - } - if (catalog.Contains(PdfName.PAGEMODE)) { - w.WriteAttributeString(Constants.PageMode, - ValueHelper.MapValue(catalog.GetAsName(PdfName.PAGEMODE), Constants.PageModes.PdfNames, - Constants.PageModes.Names)); - } - if (catalog.Contains(PdfName.VIEWERPREFERENCES)) { - ExportViewerPreferences(catalog.GetAsDict(PdfName.VIEWERPREFERENCES), w); - } - w.WriteEndElement(); - } - - if (!catalog.Contains(PdfName.PAGELABELS)) { - return; - } - - var labels = ExtractPageLabels(catalog.GetAsDict(PdfName.PAGELABELS)); - if (labels.Count > 0) { - w.WriteStartElement(Constants.PageLabels); - foreach (var item in labels) { - w.WriteStartElement(Constants.PageLabelsAttributes.Style); - w.WriteAttributeString(Constants.PageLabelsAttributes.PageNumber, item.PageNumber.ToText()); - if (item.StartPage != 0) { - w.WriteAttributeString(Constants.PageLabelsAttributes.StartPage, item.StartPage.ToText()); - } - if (String.IsNullOrEmpty(item.Prefix) == false) { - w.WriteAttributeString(Constants.PageLabelsAttributes.Prefix, item.Prefix); - } - if (String.IsNullOrEmpty(item.Style) == false) { - w.WriteAttributeString(Constants.PageLabelsAttributes.Style, - ValueHelper.MapValue(item.Style[0], - Constants.PageLabelStyles.PdfValues, - Constants.PageLabelStyles.Names, - item.Style) - ); - } - w.WriteEndElement(); - } - w.WriteEndElement(); - } - } - - private static List ExtractPageLabels(PdfDictionary labels) { - var a = new List(); - var ls = labels.GetAsArray(PdfName.NUMS); - if (ls == null) { - return new List(); - } - for (int i = 0; i < ls.Size; i++) { - var l = new PageLabel { - PageNumber = ls.GetAsNumber(i++).IntValue + 1 - }; - var label = ls.GetAsDict(i); - if (label.Contains(PdfName.ST)) { - l.StartPage = label.GetAsNumber(PdfName.ST).IntValue; - } - if (label.Contains(PdfName.P)) { - l.Prefix = label.GetAsString(PdfName.P).ToUnicodeString(); - } - if (label.Contains(PdfName.S)) { - l.Style = PdfHelper.GetPdfNameString(label.GetAsName(PdfName.S)); - } - a.Add(l); - l = null; - } - return a; - } - - internal void ExtractPageSettings(XmlWriter w) { - int n = _reader.NumberOfPages; - PageSettings active = null, current; - int fromP = 1, toP; - for (int i = 1; i <= n; i++) { - Tracker.IncrementProgress(1); - current = PageSettings.FromReader(_reader, i, _options.UnitConverter); - if (PageSettings.HavingSameDimension(active, current) && i != n) { - continue; - } - if (i == 1) { - active = current; - if (n > i) { - continue; - } - } - toP = i == n ? n : i - 1; - active.PageRange = (fromP != toP) ? String.Concat(fromP.ToText(), '-', toP.ToText()) : toP.ToText(); - w.WriteStartElement(Constants.Content.Page); - active.WriteXml(w); - w.WriteEndElement(); - fromP = i; - active = current; - } - } - - private static void ExportViewerPreferences(PdfDictionary preferences, XmlWriter w) { - foreach (var item in preferences) { - var nv = item.Value as PdfName; - if (item.Key.Equals(PdfName.TYPE)) { - continue; - } - var itemName = ValueHelper.MapValue(item.Key, Constants.ViewerPreferencesType.PdfNames, Constants.ViewerPreferencesType.Names, PdfName.DecodeName(item.Key.ToString())); - if (nv != null) { - if (PdfName.DIRECTION.Equals(item.Key)) { - w.WriteAttributeString(Constants.ViewerPreferencesType.Direction, - ValueHelper.MapValue(nv, Constants.ViewerPreferencesType.DirectionType.PdfNames, - Constants.ViewerPreferencesType.DirectionType.Names)); - } - else { - w.WriteAttributeString(itemName, PdfHelper.GetPdfFriendlyName(nv)); - } - } - else if (item.Value.IsBoolean()) { - w.WriteAttributeString( - itemName, - ((PdfBoolean)item.Value).BooleanValue ? Constants.Boolean.True : Constants.Boolean.False - ); - } - else { - w.WriteAttributeString(itemName, item.Value.ToString()); - } - } - } - - internal void ExportNamedDestinations(XmlWriter w) { - var nds = _reader.GetNamedDestination(); - if (nds != null && nds.Count > 0) { - w.WriteStartElement(Constants.NamedDestination); - foreach (var item in nds) { - w.WriteStartElement("位置"); - w.WriteAttributeString(Constants.DestinationAttributes.Name, StringHelper.ReplaceControlAndBomCharacters(item.Key.ToString())); - _actionExport.ExportGotoAction(item.Value as PdfObject, w, PageReferenceMapper); - w.WriteEndElement(); - } - w.WriteEndElement(); - } - } - - internal void ExportBookmarks(XmlElement bookmarks, TextWriter w, int level, bool isOpen) { - if (bookmarks == null || bookmarks.HasChildNodes == false) { - return; - } - var childBookmarks = bookmarks.SelectNodes(Constants.Bookmark); - if (childBookmarks == null || childBookmarks.Count == 0) { - return; - } - string title, page; - bool open; - foreach (XmlElement item in childBookmarks) { - title = item.GetAttribute(Constants.BookmarkAttributes.Title); - page = item.GetAttribute(Constants.DestinationAttributes.Page); - open = item.GetAttribute(Constants.BookmarkAttributes.Open) == Constants.Boolean.True; - - if (open != isOpen && item.HasChildNodes) { - OutlineManager.WriteSimpleBookmarkInstruction(w, "打开书签", open ? "是" : "否"); - isOpen = open; - } - if (String.IsNullOrEmpty(title) == false) { - for (int i = 0; i < level; i++) { - w.Write('\t'); - } - w.Write(title.Replace('\n', ' ').Replace('\r', ' ')); - w.Write(SimpleBookmarkPageNumLeader); - w.WriteLine(page); - } - - if (childBookmarks != null) { - level++; - ExportBookmarks(item, w, level, isOpen); - level--; - } - } - } - - /// - /// 导出 PDF 书签。 - /// - /// - /// - internal void ExportBookmarks(XmlElement bookmarks, XmlWriter w) { - if (bookmarks == null) { - return; - } - foreach (XmlElement child in bookmarks.ChildNodes) { - if (child == null) { - continue; - } - w.WriteStartElement(Constants.Bookmark); - foreach (XmlAttribute entry in child.Attributes) { - var key = entry.Name as string; - var value = entry.Value ?? String.Empty; - switch (key) { - case Constants.Coordinates.Bottom: - case Constants.Coordinates.Left: - case Constants.Coordinates.Top: - case Constants.Coordinates.Right: - if (String.IsNullOrEmpty(value) || value == "null") { - continue; - } - goto default; - case Constants.Coordinates.ScaleFactor: - if (String.IsNullOrEmpty(value)) { - continue; - } - goto default; - case Constants.BookmarkAttributes.Title: - w.WriteAttributeString(key, PdfHelper.GetValidXmlString(value)); - break; - default: - w.WriteAttributeString(key, value); - break; - } - } - if (child.ChildNodes.Count > 0) { - ExportBookmarks(child, w); - } - w.WriteEndElement(); - } - } - - /// - /// 导出 PDF 文档页内连接。 - /// - /// - /// - internal void ExtractPageLinks(XmlWriter w) { - w.WriteStartElement(Constants.PageLink); - int numPages = _reader.NumberOfPages; - - for (int i = 1; i <= numPages; i++) { - var pageDic = _reader.GetPageNRelease(i); - Tracker.IncrementProgress(1); - var annots = (PdfArray)PdfReader.GetPdfObject(pageDic.Get(PdfName.ANNOTS)); - if (annots == null) { - continue; - } - var arr = annots.ArrayList; - foreach (PdfObject item in arr) { - if (item.IsNull()) { - continue; - } - var annot = (PdfDictionary)PdfReader.GetPdfObjectRelease(item); - if (PdfName.LINK.Equals(annot.Get(PdfName.SUBTYPE))) { - w.WriteStartElement(Constants.PageLinkAttributes.Link); - w.WriteAttributeString(Constants.PageLinkAttributes.PageNumber, i.ToText()); - var rect = annot.GetAsArray(PdfName.RECT); - if (rect != null && rect.Size == 4) { - var u = _options.UnitConverter; - var p = new float[4]; - var k = 0; - foreach (PdfNumber ri in rect.ArrayList) { - if (ri == null) { - break; - } - p[k] = u.FromPoint(ri.FloatValue); - k++; - } - if (k == 4) { - w.WriteAttributeString(Constants.Coordinates.Left, p[0].ToText()); - w.WriteAttributeString(Constants.Coordinates.Bottom, p[1].ToText()); - w.WriteAttributeString(Constants.Coordinates.Right, p[2].ToText()); - w.WriteAttributeString(Constants.Coordinates.Top, p[3].ToText()); - } - } - if (annot.Contains(PdfName.BORDER)) { - w.WriteAttributeString(Constants.PageLinkAttributes.Border, PdfHelper.GetNumericArrayString(annot.GetAsArray(PdfName.BORDER), 1)); - } - if (annot.Contains(PdfName.C)) { - ExportColor(annot.GetAsArray(PdfName.C), w); - } - if (annot.Contains(PdfName.H)) { - var style = PdfHelper.GetPdfNameString(annot.GetAsName(PdfName.H)); - style = ValueHelper.MapValue(style, - new string[] { "N", "I", "O", "P" }, - new string[] { "无", "取反内容", "取反边框", "按下" }, - style - ); - w.WriteAttributeString(Constants.PageLinkAttributes.Style, style); - } - //if (annot.Contains (PdfName.M)) { - // try { - // w.WriteAttributeString ("日期", PdfDate.Decode (annot.GetAsString (PdfName.M).ToString ()).ToString ()); - // } - // catch (Exception) { - // w.WriteAttributeString ("日期", annot.GetAsString (PdfName.M).ToString ()); - // } - //} - if (annot.Contains(PdfName.QUADPOINTS)) { - w.WriteAttributeString(Constants.PageLinkAttributes.QuadPoints, PdfHelper.GetNumericArrayString(annot.GetAsArray(PdfName.QUADPOINTS), _options.UnitConverter.UnitFactor)); - } - if (annot.Contains(PdfName.CONTENTS)) { - w.WriteAttributeString(Constants.PageLinkAttributes.Contents, annot.GetAsString(PdfName.CONTENTS).ToUnicodeString()); - } - ExportLinkAction(annot, w); - if (annot.Contains(PdfName.BS)) { - w.WriteStartElement("边框样式"); - var bs = annot.GetAsDict(PdfName.BS); - if (bs.Contains(PdfName.W)) { - w.WriteAttributeString("宽度", bs.GetAsNumber(PdfName.W).FloatValue.ToText()); - } - if (bs.Contains(PdfName.S)) { - var style = PdfHelper.GetPdfNameString(bs.GetAsName(PdfName.S)); - style = ValueHelper.MapValue(style, - new string[] { "S", "U", "D", "B", "I" }, - new string[] { "方框", "下划线", "虚线", "凸起", "凹陷" }, - style - ); - w.WriteAttributeString("样式", style); - if (PdfName.D.Equals(bs.GetAsName(PdfName.S)) && bs.Contains(PdfName.D)) { - w.WriteAttributeString("线型", PdfHelper.GetArrayString(bs.GetAsArray(PdfName.D))); - } - } - w.WriteEndElement(); - } - w.WriteEndElement(); - } - } - } - w.WriteEndElement(); - } - - internal static void ExportColor(PdfArray color, XmlWriter target) { - if (color == null) { - return; - } - switch (color.Size) { - case 0: - target.WriteAttributeString(Constants.Color, Constants.Colors.Transparent); - break; - case 1: - target.WriteAttributeString(Constants.Colors.Gray, color.GetAsNumber(0).FloatValue.ToText()); - break; - case 3: - target.WriteAttributeString(Constants.Colors.Red, color.GetAsNumber(0).FloatValue.ToText()); - target.WriteAttributeString(Constants.Colors.Green, color.GetAsNumber(1).FloatValue.ToText()); - target.WriteAttributeString(Constants.Colors.Blue, color.GetAsNumber(2).FloatValue.ToText()); - break; - case 4: - target.WriteAttributeString(Constants.Colors.Cyan, color.GetAsNumber(0).FloatValue.ToText()); - target.WriteAttributeString(Constants.Colors.Magenta, color.GetAsNumber(1).FloatValue.ToText()); - target.WriteAttributeString(Constants.Colors.Yellow, color.GetAsNumber(2).FloatValue.ToText()); - target.WriteAttributeString(Constants.Colors.Black, color.GetAsNumber(3).FloatValue.ToText()); - break; - } - } - - /// - /// 导出 PDF 文档的单个连接信息。 - /// - /// - /// - void ExportLinkAction(PdfDictionary link, XmlWriter w) { - var dest = PdfReader.GetPdfObjectRelease(link.Get(PdfName.DEST)); - - w.WriteStartElement(Constants.PageLinkAttributes.LinkAction); - - if (dest != null) { - _actionExport.ExportGotoAction(dest, w, PageReferenceMapper); - } - else { - _actionExport.ExportAction((PdfDictionary)PdfReader.GetPdfObjectRelease(link.Get(PdfName.A)), PageReferenceMapper, w); - } - w.WriteEndElement(); - } - - } -} diff --git a/pdfpatcher/App/Processor/DocInfoImporter.cs b/pdfpatcher/App/Processor/DocInfoImporter.cs deleted file mode 100644 index 4d27c401596d3135f5ef8bf1ea90c330acc36f92..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/DocInfoImporter.cs +++ /dev/null @@ -1,933 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Text; -using System.Xml; -using iTextSharp.text.pdf; -using iTextSharp.text.xml.xmp; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - internal sealed class DocInfoImporter - { - readonly float _unitFactor; - readonly PdfInfoXmlDocument _infoDoc; - internal PdfInfoXmlDocument InfoDoc => _infoDoc; - - readonly ImporterOptions _options; - /// - /// 从 实例创建导入器(支持无信息文件的补丁操作)。 - /// - /// 导入器的选项。 - /// 包含信息文件的 。 - internal DocInfoImporter(ImporterOptions options, PdfInfoXmlDocument infoDoc) { - _options = options; - _unitFactor = 1; - _infoDoc = infoDoc; - } - - internal DocInfoImporter(ImporterOptions options, string infoDocFile) { - if (string.IsNullOrEmpty(infoDocFile)) { - throw new FileNotFoundException("找不到信息文件。"); - } - - var infoDoc = new PdfInfoXmlDocument(); - if (FileHelper.HasExtension(infoDocFile, Constants.FileExtensions.Txt)) { - OutlineManager.ImportSimpleBookmarks(infoDocFile, infoDoc); - } - else { - infoDoc.Load(infoDocFile); - } - - // 设置单位转换因数 - _unitFactor = GetUnitFactor(infoDoc.DocumentElement); - _infoDoc = infoDoc; - _options = options; - } - - internal DocInfoImporter(ImporterOptions importerOptions, PdfReader pdf, PatcherOptions patcherOptions, PdfInfoXmlDocument infoDoc) { - var v = patcherOptions.ViewerPreferences; - var o = new ExporterOptions() { - ExportBookmarks = infoDoc?.BookmarkRoot == null - && (v.RemoveZoomRate - || v.CollapseBookmark != BookmarkStatus.AsIs - || v.ForceInternalLink - || AppContext.Encodings.BookmarkEncoding != null - || (patcherOptions.UnifiedPageSettings.ScaleContent - && patcherOptions.UnifiedPageSettings.PaperSize.SpecialSize != SpecialPaperSize.AsPageSize)), - ExportDocProperties = false, - ExtractPageLinks = (v.RemoveZoomRate - || v.ForceInternalLink - || (patcherOptions.UnifiedPageSettings.ScaleContent - && patcherOptions.UnifiedPageSettings.PaperSize.SpecialSize != SpecialPaperSize.AsPageSize)) - && patcherOptions.RemoveAnnotations == false, - ExtractPageSettings = false, - ExportViewerPreferences = true - }; - o.UnitConverter.Unit = Constants.Units.Point; - var exp = new DocInfoExporter(pdf, o); - Tracker.SetProgressGoal(exp.EstimateWorkload()); - - _options = importerOptions; - _unitFactor = 1; - _infoDoc = infoDoc; - } - - internal static float GetUnitFactor(XmlElement root) { - var unit = root.SelectSingleNode(Constants.Units.ThisName + "/@" + Constants.Units.Unit)?.Value; - return string.IsNullOrEmpty(unit) - ? 1 - : ValueHelper.MapValue(unit, Constants.Units.Names, Constants.Units.Factors, 1); - } - - internal BookmarkRootElement GetBookmarks() { - if (_infoDoc == null) { - return null; - } - - var be = _infoDoc.BookmarkRoot; - if (be?.HasSubBookmarks == true) { - if (be.GetAttribute(Constants.DestinationAttributes.FirstPageNumber).TryParse(out int bookmarkPageShift)) { - bookmarkPageShift--; - } - PreprocessBookmark(be, bookmarkPageShift); - } - return be; - } - - /// - /// 偏移页码位置并转换书签目标的尺寸单位。 - /// - /// - /// - private void PreprocessBookmark(BookmarkContainer source, int bookmarkPageShift) { - foreach (BookmarkElement b in source.ChildNodes) { - if (b == null) { - continue; - } - - int pageShift = GetPageShift(b, bookmarkPageShift); - ShiftPageAndConvertUnits(b, pageShift); - PreprocessBookmark(b, pageShift); - } - } - - private static int GetPageShift(XmlElement element, int baseShift) { - int shift = baseShift; - var s = element.GetAttribute(Constants.DestinationAttributes.FirstPageNumber); - if (string.IsNullOrEmpty(s) == false) { - if (s.TryParse(out shift)) { - shift--; - } - else { - shift = baseShift; - } - } - return shift; - } - - private void ShiftPageAndConvertUnits(XmlElement destination, int pageShift) { - foreach (XmlAttribute a in destination.Attributes) { - switch (a.Name) { - case Constants.Coordinates.Top: - case Constants.Coordinates.Left: - case Constants.Coordinates.Bottom: - case Constants.Coordinates.Right: - if (_unitFactor != 1 && a.Value.TryParse(out float c)) { - a.Value = (c * _unitFactor).ToText(); - } - break; - case Constants.DestinationAttributes.Page: - if (pageShift != 0 && a.Value.TryParse(out int pageNum)/* && pageNum > 0*/) { - pageNum += pageShift; - destination.SetAttribute(a.Name, pageNum.ToText()); - } - break; - } - } - } - - internal GeneralInfo ImportDocumentInformation() { - if (_options.ImportDocProperties == false || _infoDoc == null) { - return null; - } - Tracker.TraceMessage("导入文档元数据信息。"); - var info = _infoDoc.InfoNode; - return info == null ? null : new GeneralInfo { - Title = info.Title, - Author = info.Author, - Keywords = info.Keywords, - Subject = info.Subject, - Creator = info.Creator, - Producer = info.Producer - }; - } - - internal static void ImportDocumentInformation(GeneralInfo info, PdfReader pdf, string pdfFileName) { - if (info == null) { - return; - } - var d = pdf.Trailer.GetAsDict(PdfName.INFO); - if (d == null) { - d = new PdfDictionary(); - pdf.Trailer.Put(PdfName.INFO, d); - } - UpdateInfoValue(d, PdfName.TITLE, info.Title, pdfFileName); - UpdateInfoValue(d, PdfName.SUBJECT, info.Subject, pdfFileName); - UpdateInfoValue(d, PdfName.AUTHOR, info.Author, pdfFileName); - UpdateInfoValue(d, PdfName.KEYWORDS, info.Keywords, pdfFileName); - UpdateInfoValue(d, PdfName.CREATOR, info.Creator, pdfFileName); - UpdateInfoValue(d, PdfName.PRODUCER, info.Producer, pdfFileName); - - if (info.RewriteXmp == false) { - return; - } - var m = pdf.Catalog.Locate(PdfName.METADATA); - if (m == null) { - pdf.Catalog.Put(PdfName.METADATA, new PRStream(pdf, new byte[0])); - } - try { - var xw = new XmpWriter(new MemoryStream(), d); - var s = new MemoryStream(); - xw.Serialize(s); - m.SetData(s.ToArray(), false); - } - catch (Exception) { - Trace.WriteLine("读写 XMP 属性时出现错误。"); - } - - } - - internal static void UpdateInfoValue(PdfDictionary info, PdfName name, string value, FilePath pdfFileName) { - if (value != null) { - if (value.Contains(Constants.FileNameMacros.FileName)) { - value = value.Replace(Constants.FileNameMacros.FileName, pdfFileName.FileNameWithoutExtension); - } - if (value.Contains(Constants.FileNameMacros.FolderName)) { - value = value.Replace(Constants.FileNameMacros.FolderName, pdfFileName.Directory.FileName); - } - } - if (info.Contains(name) && value == null) { - var s = info.GetAsString(name); - if (s != null) { - value = s.ToUnicodeString(); - } - } - if (value != null) { - value = value.Trim(); - } - info.Put(name, string.IsNullOrEmpty(value) ? null : value.ToPdfString()); - } - - internal static void ImportDocumentInformation(GeneralInfo info, iTextSharp.text.Document doc) { - if (info == null) { - return; - } - doc.AddTitle(info.Title); - if (string.IsNullOrEmpty(info.Subject) == false) { - doc.AddSubject(info.Subject); - } - if (string.IsNullOrEmpty(info.Author) == false) { - doc.AddAuthor(info.Author); - } - if (string.IsNullOrEmpty(info.Keywords) == false) { - doc.AddKeywords(info.Keywords); - } - } - - internal PdfPageLabels ImportPageLabels() { - if (_options.ImportViewerPreferences == false || _infoDoc == null) { - return null; - } - Tracker.TraceMessage("导入页码设置。"); - var pn = _infoDoc.DocumentElement.SelectNodes( - Constants.PageLabels + "/" + Constants.PageLabelsAttributes.Style + "[@" + Constants.PageLabelsAttributes.PageNumber + "]"); - var pls = new PdfPageLabels(); - bool hasPageLabels = false; - foreach (XmlElement item in pn) { - if (item.GetAttribute(Constants.PageLabelsAttributes.PageNumber).TryParse(out int physicalPage) == false || physicalPage < 1) { - Trace.WriteLine(string.Concat("在“", Constants.PageLabels, "”的“", Constants.PageLabelsAttributes.Style, "”元素中,必须指定大于或等于 1 的“", Constants.PageLabelsAttributes.PageNumber, "”属性。")); - continue; - } - if (item.GetAttribute(Constants.PageLabelsAttributes.StartPage).TryParse(out int firstPage) == false || firstPage < 1) { - firstPage = 1; - } - var prefix = item.GetAttribute(Constants.PageLabelsAttributes.Prefix); - int numberStyle = ValueHelper.MapValue( - item.GetAttribute(Constants.PageLabelsAttributes.Style), - Constants.PageLabelStyles.Names, - Constants.PageLabelStyles.Values, - PdfPageLabels.DECIMAL_ARABIC_NUMERALS); - pls.AddPageLabel(physicalPage, numberStyle, prefix, firstPage); - hasPageLabels = true; - } - return hasPageLabels ? pls : null; - } - - internal static PdfPageLabels ImportPageLabels(List labels) { - if (labels == null || labels.Count == 0) { - return null; - } - var pls = new PdfPageLabels(); - int i = 0; - foreach (var item in labels) { - if (item.PageNumber > 0 && item.StartPage > 0) { - pls.AddPageLabel(item.PageNumber, - ValueHelper.MapValue(item.Style, Constants.PageLabelStyles.Names, Constants.PageLabelStyles.Values, PdfPageLabels.DECIMAL_ARABIC_NUMERALS), - item.Prefix, - item.StartPage - ); - i++; - } - } - return i > 0 ? pls : null; - } - - internal void ImportPageLinks(PdfReader r, PdfStamper w) { - if (_infoDoc == null) { - return; - } - - var ls = _infoDoc.DocumentElement.SelectNodes(Constants.PageLink + "/" + Constants.PageLinkAttributes.Link + "[@" + Constants.PageLinkAttributes.PageNumber + "]"); - if (ls == null || ls.Count == 0) { - return; - } - Tracker.TraceMessage("导入页面内连接。"); - if (_options.KeepPageLinks == false) { - PdfHelper.ClearPageLinks(r); - } - int pageCount = r.NumberOfPages; - foreach (XmlElement item in ls) { - if (item.GetAttribute(Constants.PageLinkAttributes.PageNumber).TryParse(out int pageNum) == false) { - Trace.WriteLine("页码属性格式不正确"); - continue; - } - if (item.GetAttribute(Constants.DestinationAttributes.FirstPageNumber).TryParse(out int pageOffset)) { - pageNum += --pageOffset; - } - if (pageNum > pageCount) { - Trace.WriteLine("页码 " + pageNum + " 超出文档最大页数。"); - continue; - } - var acc = ImportRectangle(item); - if (acc == null) { - Trace.WriteLine("区域坐标不为 4 个。"); - continue; - } - acc = Array.ConvertAll(acc, a => UnitConverter.ToPoint(a, _unitFactor)); - var region = new iTextSharp.text.Rectangle(acc[0], acc[1], acc[2], acc[3]); - var border = item.GetAttribute(Constants.PageLinkAttributes.Border); - var ann = new PdfAnnotation(w.Writer, region); - ann.Put(PdfName.TYPE, PdfName.ANNOT); - ann.Put(PdfName.SUBTYPE, PdfName.LINK); - ann.Put(PdfName.P, w.Writer.GetPageReference(pageNum)); - var hl = item.GetAttribute(Constants.PageLinkAttributes.Style); - if (string.IsNullOrEmpty(hl) == false) { - PdfName h; - switch (hl) { - case "无": h = PdfName.N; break; - case "取反内容": h = PdfName.I; break; - case "取反边框": h = PdfName.O; break; - case "按下": h = PdfName.P; break; - default: h = PdfName.I; break; - } - ann.Put(PdfName.H, h); - } - if (item.SelectSingleNode(Constants.PageLinkAttributes.LinkAction) is XmlElement action) { - ShiftPageAndConvertUnits(action, 0); - ImportAction(w.Writer, ann, action, pageCount, false); - } - - if (ann != null) { - ImportColor(item, ann); - if (string.IsNullOrEmpty(border) == false) { - ImportBorder(border, ann); - } - else { - if (item.SelectSingleNode("边框样式") is XmlElement bse) { - var bs = ImportPdfBorderStyle(bse); - if (bs != null) { - ann.Put(PdfName.BS, bs); - } - } - } - w.AddAnnotation(ann, pageNum); - } - } - } - - internal static void ImportColor(XmlElement item, PdfDictionary dict) { - if (item.HasAttribute(Constants.Color)) { - var s = item.GetAttribute(Constants.Color); - if (s == Constants.Colors.Transparent) { - dict.Put(PdfName.C, new PdfArray()); - } - var c = System.Drawing.Color.FromName(s); - dict.Put(PdfName.C, new PdfArray(new float[] { - c.R / 255f, - c.G / 255f, - c.B / 255f - })); - } - else if (item.HasAttribute(Constants.Colors.Red) || item.HasAttribute(Constants.Colors.Green) || item.HasAttribute(Constants.Colors.Blue)) { - dict.Put(PdfName.C, new PdfArray(new float[] { - item.GetValue(Constants.Colors.Red, 0f), - item.GetValue(Constants.Colors.Green, 0f), - item.GetValue(Constants.Colors.Blue, 0f) - })); - } - else if (item.HasAttribute(Constants.Colors.Gray)) { - dict.Put(PdfName.C, new PdfArray(new float[] { item.GetValue(Constants.Colors.Gray, 0f) })); - } - else if (item.HasAttribute(Constants.Colors.Black) || item.HasAttribute(Constants.Colors.Cyan) || item.HasAttribute(Constants.Colors.Magenta) || item.HasAttribute(Constants.Colors.Yellow)) { - dict.Put(PdfName.C, new PdfArray(new float[] { - item.GetValue(Constants.Colors.Cyan, 0f), - item.GetValue(Constants.Colors.Magenta, 0f), - item.GetValue(Constants.Colors.Yellow, 0f), - item.GetValue(Constants.Colors.Black, 0f) - })); - } - } - - private static void ImportBorder(string border, PdfAnnotation ann) { - var bs = ToInt32Array(border); - PdfBorderArray a; - if (bs == null) { - return; - } - - switch (bs.Length) { - case 3: a = new PdfBorderArray(bs[0], bs[1], bs[2]); break; - case 4: - var dp = new int[bs.Length - 3]; - bs.CopyTo(dp, 3); - a = new PdfBorderArray(bs[0], bs[1], bs[2], GetPdfDashPattern(dp)); - break; - default: - a = null; - break; - } - if (a != null) { - ann.Put(PdfName.BORDER, a); - } - } - - internal static void ImportAction(PdfWriter writer, PdfDictionary dict, XmlElement map, int maxPageNumber, bool namedAsNames) { - var action = map.GetAttribute(Constants.DestinationAttributes.Action); - if (string.IsNullOrEmpty(action)) { - action = Constants.ActionType.Goto; - } - string p; - PdfDictionary fs; - switch (action) { - case Constants.ActionType.Goto: - if (string.IsNullOrEmpty(p = map.GetAttribute(Constants.DestinationAttributes.Named)) == false) { - if (namedAsNames) - dict.Put(PdfName.DEST, new PdfName(p)); - else - dict.Put(PdfName.DEST, p.ToPdfString()); - } - else if (string.IsNullOrEmpty(p = map.GetAttribute(Constants.DestinationAttributes.Page)) == false) { - var ar = new PdfArray(); - if (p.TryParse(out int pn) == false || pn > maxPageNumber) { - return; - } - CreateDestination(writer, map, p, ar, false); - dict.Put(PdfName.DEST, ar); - } - break; - case Constants.ActionType.GotoR: - var dic = new PdfDictionary(); - if (string.IsNullOrEmpty(p = map.GetAttribute(Constants.DestinationAttributes.Named)) == false) { - dic.Put(PdfName.D, p.ToPdfString()); - } - else if (string.IsNullOrEmpty(p = map.GetAttribute(Constants.DestinationAttributes.NamedN)) == false) { - dic.Put(PdfName.D, new PdfName(p)); - } - else if (string.IsNullOrEmpty(p = map.GetAttribute(Constants.DestinationAttributes.Page)) == false) { - p.TryParse(out int pn); - if (pn > 0) { - pn--; - } - var ar = new PdfArray(); - CreateDestination(writer, map, pn.ToText(), ar, true); - dic.Put(PdfName.D, ar); - } - p = map.GetAttribute(Constants.DestinationAttributes.Path); - if (dic.Size > 0 && p != null) { - dic.Put(PdfName.S, PdfName.GOTOR); - fs = new PdfDictionary(PdfName.FILESPEC); - fs.Put(PdfName.F, new PdfString(p, Encoding.Default.WebName)); - fs.Put(PdfName.UF, new PdfString(p, PdfObject.TEXT_UNICODE)); - dic.Put(PdfName.F, fs); - var nw = map.GetAttribute(Constants.DestinationAttributes.NewWindow); - if (nw != null) { - dic.Put(PdfName.NEWWINDOW, nw == Constants.Boolean.True); - } - dict.Put(PdfName.A, dic); - } - break; - case Constants.ActionType.Uri: - p = map.GetAttribute(Constants.DestinationAttributes.Path); - if (string.IsNullOrEmpty(p) == false) { - var u = new PdfDictionary(); - u.Put(PdfName.S, PdfName.URI); - u.Put(PdfName.URI, p); - dict.Put(PdfName.A, u); - } - break; - case Constants.ActionType.Launch: - p = map.GetAttribute(Constants.DestinationAttributes.Path); - if (string.IsNullOrEmpty(p) == false) { - var l = new PdfDictionary(); - l.Put(PdfName.S, PdfName.LAUNCH); - fs = new PdfDictionary(PdfName.FILESPEC); - fs.Put(PdfName.F, new PdfString(p, Encoding.Default.WebName)); - fs.Put(PdfName.UF, new PdfString(p, PdfObject.TEXT_UNICODE)); - l.Put(PdfName.F, fs); - dict.Put(PdfName.A, l); - } - break; - case Constants.ActionType.Javascript: - p = map.GetAttribute(Constants.DestinationAttributes.ScriptContent); - dict.Put(PdfName.A, string.IsNullOrEmpty(p) ? null : PdfAction.JavaScript(p, writer)); - break; - default: - Tracker.TraceMessage(Tracker.Category.Alert, string.Concat("不支持动作:", action)); - break; - } - } - - private static void CreateDestination(PdfWriter writer, XmlElement map, string p, PdfArray ar, bool isRemote) { - int pn; - bool useDefaultPos = false; - var pos = new float[4]; - int posItemCount = 0; - if (p.TryParse(out pn) == false || pn < (isRemote ? 0 : 1)) { - return; - } - PdfIndirectReference pr = null; - if (isRemote == false) { - pr = writer.GetPageReference(pn); - ar.Add(pr); - } - else { - ar.Add(new PdfNumber(pn)); - } - iTextSharp.text.Rectangle box; - switch (p = map.GetAttribute(Constants.DestinationAttributes.View)) { - case Constants.DestinationAttributes.ViewType.XYZ: - goto default; - case Constants.DestinationAttributes.ViewType.Fit: - case Constants.DestinationAttributes.ViewType.FitB: - posItemCount = 0; - break; - case Constants.DestinationAttributes.ViewType.FitH: - case Constants.DestinationAttributes.ViewType.FitBH: - posItemCount = 1; - var top = map.GetAttribute(Constants.Coordinates.Top); - if (top == Constants.Coordinates.Unchanged) { - pos[0] = float.NaN; - } - else if (top.TryParse(out pos[0]) == false) { - if (pr != null && (box = PdfHelper.GetPageVisibleRectangle(PdfReader.GetPdfObject(pr) as PdfDictionary)) != null) { - pos[0] = box.Top; - } - else { - useDefaultPos = true; - } - } - break; - case Constants.DestinationAttributes.ViewType.FitV: - case Constants.DestinationAttributes.ViewType.FitBV: - posItemCount = 1; - var left = map.GetAttribute(Constants.Coordinates.Left); - if (left == Constants.Coordinates.Unchanged) { - pos[0] = float.NaN; - } - else if (left.TryParse(out pos[0]) == false) { - if (pr != null && (box = PdfHelper.GetPageVisibleRectangle(PdfReader.GetPdfObject(pr) as PdfDictionary)) != null) { - pos[0] = box.Left; - } - else { - useDefaultPos = true; - } - } - break; - case Constants.DestinationAttributes.ViewType.FitR: - pos = ImportRectangle(map); - if (pos == null) { - useDefaultPos = true; - } - break; - default: - posItemCount = 3; - left = map.GetAttribute(Constants.Coordinates.Left); - top = map.GetAttribute(Constants.Coordinates.Top); - if (left.TryParse(out pos[0]) == false) { - pos[0] = float.NaN; - } - if (top.TryParse(out pos[1]) == false) { - pos[1] = float.NaN; - } - if (map.GetAttribute(Constants.Coordinates.ScaleFactor).TryParse(out pos[2]) == false || pos[2] < 0) { - pos[2] = float.NaN; - } - if (float.IsNaN(pos[0]) && float.IsNaN(pos[1]) - && left != Constants.Coordinates.Unchanged && top != Constants.Coordinates.Unchanged) { - useDefaultPos = true; - } - break; - } - if (useDefaultPos) { - ar.Add(PdfName.XYZ); - if (isRemote) { - ar.Add(new float[] { 0, 10000, 0 }); - return; - } - if (PdfReader.GetPdfObject(pr) is PdfDictionary page) { - box = page.GetPageVisibleRectangle(); - if (box != null) { - if (true) { - // TODO: 检测页面旋转方向并设置正确的目标 - } - ar.Add(PdfNull.PDFNULL); - ar.Add(new PdfNumber(box.Top)); - ar.Add(PdfNull.PDFNULL); - } - } - else { - ar.Add(new float[] { 0, 10000, 0 }); - } - } - else { - ar.Add(ValueHelper.MapValue(p, - Constants.DestinationAttributes.ViewType.Names, - Constants.DestinationAttributes.ViewType.PdfNames, - PdfName.XYZ)); - for (int i = 0; i < posItemCount; i++) { - ref var v = ref pos[i]; - if (float.IsNaN(v)) { - ar.Add(PdfNull.PDFNULL); - } - else { - if (v > 10000) { - v = 10000; - } - ar.Add(new PdfNumber(v)); - } - } - } - } - - private static float[] ImportRectangle(XmlElement map) { - var pos = new float[4]; - if (map.GetAttribute(Constants.Coordinates.Left).TryParse(out pos[0]) == false || pos[0] < 0 - || map.GetAttribute(Constants.Coordinates.Bottom).TryParse(out pos[1]) == false || pos[1] < 0 - || map.GetAttribute(Constants.Coordinates.Right).TryParse(out pos[2]) == false || pos[2] < 0 - || map.GetAttribute(Constants.Coordinates.Top).TryParse(out pos[3]) == false || pos[3] < 0) { - return null; - } - return pos; - } - - - private static PdfDictionary ImportPdfBorderStyle(XmlElement item) { - var borderWidth = item.GetAttribute("宽度"); - var borderStyle = item.GetAttribute("样式"); - var borderPattern = item.GetAttribute("线形"); - var bs = new PdfDictionary(PdfName.BS); - if (borderWidth.TryParse(out float bw)) { - bs.Put(PdfName.W, new PdfNumber(bw)); - } - - if (string.IsNullOrEmpty(borderStyle)) { - return bs; - } - - PdfName s; - switch (borderStyle) { - case "方框": s = PdfName.S; break; - case "下划线": s = PdfName.U; break; - case "凸起": s = PdfName.B; break; - case "凹陷": s = PdfName.I; break; - case "虚线": - s = PdfName.D; - if (string.IsNullOrEmpty(borderPattern) == false) { - var p = ToInt32Array(borderPattern); - if (p != null) { - var dp = GetPdfDashPattern(p); - if (dp != null) { - bs.Put(PdfName.D, dp); - } - } - } - break; - default: - s = new PdfName(borderStyle); - break; - } - bs.Put(PdfName.S, s); - return bs; - } - - private static PdfDashPattern GetPdfDashPattern(int[] p) { - switch (p.Length) { - case 1: return new PdfDashPattern(p[0]); - case 2: return new PdfDashPattern(p[0], p[1]); - case 3: return new PdfDashPattern(p[0], p[1], p[2]); - default: return null; - } - } - - internal void ImportViewerPreferences(PdfReader r) { - if (_options.ImportViewerPreferences == false || _infoDoc == null) - return; - - Tracker.TraceMessage("导入阅读器设置。"); - if (_infoDoc.DocumentElement.SelectSingleNode(Constants.ViewerPreferences) is not XmlElement ps) { - return; - } - PdfName n; - PdfObject v; - - foreach (XmlAttribute item in ps.Attributes) { - switch (item.Name) { - case Constants.PageLayout: - v = ValueHelper.MapValue(item.Value, Constants.PageLayoutType.Names, Constants.PageLayoutType.PdfNames, PdfName.NONE); - if (PdfName.NONE.Equals(v) == false) { - r.Catalog.Put(PdfName.PAGELAYOUT, v); - } - continue; - case Constants.PageMode: - v = ValueHelper.MapValue(item.Value, Constants.PageModes.Names, Constants.PageModes.PdfNames, PdfName.NONE); - if (PdfName.NONE.Equals(v) == false) { - r.Catalog.Put(PdfName.PAGEMODE, v); - } - continue; - case Constants.ViewerPreferencesType.Direction: - n = PdfName.DIRECTION; - v = ValueHelper.MapValue(item.Value, Constants.ViewerPreferencesType.DirectionType.Names, Constants.ViewerPreferencesType.DirectionType.PdfNames, PdfName.NONE); - if (PdfName.NONE.Equals(v) == true) { - continue; - } - break; - default: - n = ValueHelper.MapValue(item.Name, Constants.ViewerPreferencesType.Names, Constants.ViewerPreferencesType.PdfNames, new PdfName(item.Name)); - v = item.Value switch { - Constants.Boolean.True => PdfBoolean.PDFTRUE, - Constants.Boolean.False => PdfBoolean.PDFFALSE, - _ => PdfHelper.ResolvePdfName(item.Value) - }; - break; - } - if (r.Catalog.Contains(PdfName.VIEWERPREFERENCES) == false) { - r.Catalog.Put(PdfName.VIEWERPREFERENCES, new PdfDictionary()); - } - r.Catalog.GetAsDict(PdfName.VIEWERPREFERENCES).Put(n, v); - } - } - - internal static void OverrideViewerPreferences(ViewerOptions options, PdfReader reader, PdfWriter writer) { - var v = ValueHelper.MapValue(options.InitialView, Constants.PageLayoutType.Names, Constants.PageLayoutType.PdfNames, PdfName.NONE); - if (PdfName.NONE.Equals(v) == false) { - (reader != null ? reader.Catalog : writer.ExtraCatalog).Put(PdfName.PAGELAYOUT, v); - } - - v = ValueHelper.MapValue(options.Direction, Constants.ViewerPreferencesType.DirectionType.Names, Constants.ViewerPreferencesType.DirectionType.PdfNames, PdfName.NONE); - if (PdfName.NONE.Equals(v) == false) { - if (reader != null) { - var d = reader.Catalog.GetAsDict(PdfName.VIEWERPREFERENCES); - if (d == null) { - d = new PdfDictionary(); - reader.Catalog.Put(PdfName.VIEWERPREFERENCES, d); - } - d.Put(PdfName.DIRECTION, v); - } - else { - writer.AddViewerPreference(PdfName.DIRECTION, v); - } - } - - v = ValueHelper.MapValue(options.InitialMode, Constants.PageModes.Names, Constants.PageModes.PdfNames, PdfName.NONE); - if (PdfName.NONE.Equals(v) == false) { - (reader != null ? reader.Catalog : writer.ExtraCatalog).Put(PdfName.PAGEMODE, v); - } - - if (options.SpecifyViewerPreferences) { - var d = reader != null ? reader.Catalog : writer.ExtraCatalog; - var p = d.GetAsDict(PdfName.VIEWERPREFERENCES); - if (p == null) { - p = new PdfDictionary(); - d.Put(PdfName.VIEWERPREFERENCES, p); - } - p.Put(PdfName.CENTERWINDOW, options.CenterWindow ? PdfBoolean.PDFTRUE : null); - p.Put(PdfName.DISPLAYDOCTITLE, options.DisplayDocTitle ? PdfBoolean.PDFTRUE : null); - p.Put(PdfName.FITWINDOW, options.FitWindow ? PdfBoolean.PDFTRUE : null); - p.Put(PdfName.HIDEMENUBAR, options.HideMenu ? PdfBoolean.PDFTRUE : null); - p.Put(PdfName.HIDETOOLBAR, options.HideToolbar ? PdfBoolean.PDFTRUE : null); - p.Put(PdfName.HIDEWINDOWUI, options.HideUI ? PdfBoolean.PDFTRUE : null); - } - } - - internal void ImportNamedDestinations(PdfReader pdf, PdfWriter w) { - if (_infoDoc == null) { - return; - } - - var ds = _infoDoc.DocumentElement.SelectNodes("命名位置/位置[@名称]"); - if (ds.Count == 0) { - return; - } - var infoDs = new Dictionary(ds.Count); - foreach (XmlElement item in ds) { - infoDs[item.GetAttribute(Constants.DestinationAttributes.Name)] = item; - } - var pdfDs = pdf.GetNamedDestination(); - foreach (KeyValuePair item in infoDs) { - if (item.Value.GetAttribute(Constants.DestinationAttributes.Page).TryParse(out int targetPn) == false) { - Trace.WriteLine("“目标页面”属性的数值格式不正确。"); - continue; - } - var prop = new PdfArray(); - CreateDestination(w, item.Value, targetPn.ToText(), prop, false); - //PdfName d = PdfHelper.ResolvePdfName (item.Value.GetAttribute (Constants.DestinationDisplayMode)); - //prop.ArrayList.Clear (); - //prop.Add (w.GetPageReference (targetPn)); - //prop.Add (d); - //string disp = item.Value.GetAttribute (Constants.DestinationAttributes.Position); - //if (String.IsNullOrEmpty (disp)) { - // prop.Add (new float[] { 0, 10000, 0 }); - //} - //else { - // float[] ps = PdfHelper.ToSingleArray (disp.ToLower ().Replace ("null", "0"), true); - // ps = UnitConverter.ConvertUnit (ps, this._unitFactor); - // prop.Add (ps); - //} - PdfObject a; - if (pdfDs.TryGetValue(item.Key, out a)) { - var sourceD = a as PdfArray; - sourceD.ArrayList.Clear(); - sourceD.ArrayList.AddRange(prop.ArrayList); - } - else { - // ignore those names not in the original document - } - } - } - - internal void ImportPageSettings(PdfReader pdf) { - if (_options.ImportPageSettings == false || _infoDoc == null) { - return; - } - - var ps = _infoDoc.DocumentElement.SelectNodes(string.Concat(Constants.Content.PageSettings.ThisName, "/", Constants.Content.Page)); - if (ps.Count == 0) { - return; - } - - Tracker.TraceMessage("导入页面设置。"); - PdfDictionary p; - int pn = pdf.NumberOfPages; - float[] mb, cb, tb, ab, bb; - int pageFilter; - foreach (XmlElement item in ps) { - List ranges = PageRangeCollection.Parse(item.GetAttribute(Constants.PageRange), 1, pn, true); - mb = ToSingleArray(item.GetAttribute(Constants.Content.PageSettings.MediaBox), true); - cb = ToSingleArray(item.GetAttribute(Constants.Content.PageSettings.CropBox), true); - tb = ToSingleArray(item.GetAttribute(Constants.Content.PageSettings.TrimBox), true); - ab = ToSingleArray(item.GetAttribute(Constants.Content.PageSettings.ArtBox), true); - bb = ToSingleArray(item.GetAttribute(Constants.Content.PageSettings.BleedBox), true); - pageFilter = ValueHelper.MapValue(item.GetAttribute(Constants.PageFilterTypes.ThisName), - Constants.PageFilterTypes.Names, - Constants.PageFilterTypes.Values, -1); - if (item.GetAttribute(Constants.Content.PageSettings.Rotation).TryParse(out int rotate)) { - rotate = rotate / 90 * 90; - } - else { - rotate = -1; - } - foreach (PageRange r in ranges) { - foreach (var i in r) { - if (pageFilter != -1 && i % 2 != pageFilter) { - continue; - } - p = pdf.GetPageN(i); - ImportPageBox(mb, p, PdfName.MEDIABOX); - ImportPageBox(cb, p, PdfName.CROPBOX); - ImportPageBox(tb, p, PdfName.TRIMBOX); - ImportPageBox(ab, p, PdfName.ARTBOX); - ImportPageBox(bb, p, PdfName.BLEEDBOX); - if (rotate != -1) { - p.Put(PdfName.ROTATE, new PdfNumber(rotate)); - } - } - } - } - } - - private bool ImportPageBox(float[] array, PdfDictionary pdfDict, PdfName pdfName) { - if (array == null) { - return false; - } - if (array.Length == 0) { - pdfDict.Remove(pdfName); - return true; - } - if (array.Length == 4) { - array = Array.ConvertAll(array, a => { return UnitConverter.ToPoint(a, _unitFactor); }); - pdfDict.Put(pdfName, new PdfArray(array)); - return true; - } - return false; - } - static readonly char[] __ValueArraySplitChars = { ' ', '\t', ',', ';' }; - public static float[] ToSingleArray(string value) { return ToSingleArray(value, false); } - - public static float[] ToSingleArray(string value, bool allowNegativeNumber) { - if (value == null) { - return null; - } - else if (value.Length == 0) { - return new float[0]; - } - var parts = value.Split(__ValueArraySplitChars, StringSplitOptions.RemoveEmptyEntries); - var vals = new float[parts.Length]; - var ok = true; - for (int i = 0; i < vals.Length; i++) { - if (parts[i].TryParse(out vals[i]) == false || (allowNegativeNumber == false && vals[i] < 0)) { - ok = false; - break; - } - } - if (ok == false) { - return null; - } - return vals; - } - public static int[] ToInt32Array(string value) { - return ToInt32Array(value, __ValueArraySplitChars, false); - } - - public static int[] ToInt32Array(string value, bool allowNegativeNumber) { - return ToInt32Array(value, __ValueArraySplitChars, allowNegativeNumber); - } - - public static int[] ToInt32Array(string value, char[] separators, bool allowNegativeNumber) { - if (value == null) { - return null; - } - var parts = value.Split(separators, StringSplitOptions.RemoveEmptyEntries); - var vals = new int[parts.Length]; - for (int i = 0; i < vals.Length; i++) { - if (!parts[i].TryParse(out vals[i]) || (!allowNegativeNumber && vals[i] < 0)) { - return null; - } - } - return vals; - } - } -} diff --git a/pdfpatcher/App/Processor/DocProcessorContext.cs b/pdfpatcher/App/Processor/DocProcessorContext.cs deleted file mode 100644 index b9868bdb39eac5092d502ae1ed7ff473d6c1033d..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/DocProcessorContext.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using iTextSharp.text; -using iTextSharp.text.pdf; - -namespace PDFPatcher.Processor -{ - sealed class DocProcessorContext - { - internal const int OcrData = 9010; - internal const int CoordinateTransition = 9020; - - public PdfReader Pdf { get; } - public PdfWriter Writer { get; } - public Document OutputDocument { get; } - public bool IsModified { get; set; } - public Dictionary ExtraData { get; } - - public DocProcessorContext(PdfProcessingEngine engine, PdfWriter writer, Document outputDocument) { - Pdf = engine.Pdf; - Writer = writer; - OutputDocument = outputDocument; - ExtraData = engine.ExtraData; - } - - public DocProcessorContext(PdfProcessingEngine engine, PdfWriter writer) - : this(engine, writer, null) { - } - } -} diff --git a/pdfpatcher/App/Processor/DocumentSink.cs b/pdfpatcher/App/Processor/DocumentSink.cs deleted file mode 100644 index 58447c9d648baf84d2b72560b41adfae047d4f62..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/DocumentSink.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using System.Collections.Generic; -using iTextSharp.text.pdf; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - /// - /// 用于合并 PDF 文档的文档池。 - /// - sealed class DocumentSink - { - readonly Dictionary _sink = new Dictionary(StringComparer.OrdinalIgnoreCase); - public int Workload { get; private set; } - public bool HasDuplicateFiles { get; private set; } - public DocumentSink(IEnumerable items, bool useSink) { - EvaluateWorkload(items, useSink); - } - - public PdfReader GetPdfReader(string path) { - if (_sink.TryGetValue(path, out PdfReaderReference rr)) { - if (rr.Reader == null) { - rr.Reader = PdfHelper.OpenPdfFile(path, AppContext.LoadPartialPdfFile, false); - } - return rr.Reader; - } - return null; - } - - public int DecrementReference(string path) { - if (_sink.TryGetValue(path, out PdfReaderReference r)) { - var c = --r.Reference; - if (c == 0) { - _sink.Remove(path); - } - return c; - } - return 0; - } - - private void EvaluateWorkload(IEnumerable items, bool useSink) { - foreach (var item in items) { - switch (item.Type) { - case SourceItem.ItemType.Empty: - break; - case SourceItem.ItemType.Pdf: - var p = item as SourceItem.Pdf; - Workload += PageRangeCollection.Parse(p.PageRanges, 1, p.PageCount, true).TotalPages; - if (useSink) { - if (_sink.TryGetValue(item.FilePath.ToString(), out PdfReaderReference r)) { - r.Reference++; - HasDuplicateFiles = true; - break; - } - _sink.Add(item.FilePath.ToString(), new PdfReaderReference()); - } - Workload += item.FileSize; - break; - case SourceItem.ItemType.Image: - Workload += item.FileSize; - break; - case SourceItem.ItemType.Folder: - break; - } - if (item.HasSubItems) { - EvaluateWorkload(item.Items, useSink); - } - } - } - - sealed class PdfReaderReference - { - internal PdfReader Reader; - internal int Reference = 1; - } - } -} diff --git a/pdfpatcher/App/Processor/IInfoDocProcessor.cs b/pdfpatcher/App/Processor/IInfoDocProcessor.cs deleted file mode 100644 index 96339fa7876dd85dd054680fa1665526a85da2c8..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/IInfoDocProcessor.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace PDFPatcher.Processor -{ - interface IInfoDocProcessor - { - bool Process(System.Xml.XmlElement item); - } -} diff --git a/pdfpatcher/App/Processor/IProcessor.cs b/pdfpatcher/App/Processor/IProcessor.cs deleted file mode 100644 index 6f9ef29d4d23fd221ec61aa4e1244875c317862f..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/IProcessor.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Processor -{ - interface IProcessor - { - /// - /// 返回处理器的名称。 - /// - string Name { get; } - } -} diff --git a/pdfpatcher/App/Processor/ImageExtractor.cs b/pdfpatcher/App/Processor/ImageExtractor.cs deleted file mode 100644 index b6f88e0c9488804c67c0e3edcabc87719ab1f1ee..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/ImageExtractor.cs +++ /dev/null @@ -1,634 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using FreeImageAPI; -using iTextSharp.text.pdf; -using PDFPatcher.Common; -using PDFPatcher.Model; -using PDFPatcher.Processor.Imaging; - -namespace PDFPatcher.Processor -{ - sealed class ImageExtractor - { - readonly PdfPageImageProcessor _parser; - int _totalImageCount; - int _imageCount; - int _activePage; // 在导出文件图片时,使用此属性命名文件 - readonly string _fileMask; - int _pageRotation; - readonly ImageExtracterOptions _options; - readonly List _imageInfoList = new List(); - readonly HashSet _Refs = new HashSet(); - - internal List InfoList => _imageInfoList; - - readonly List _imagePosList = new List(); - internal List PosList => _imagePosList; - internal bool PrintImageLocation { get; set; } - - public ImageExtractor(ImageExtracterOptions options, PdfReader reader) { - _fileMask = String.IsNullOrEmpty(options.FileMask) ? "0" : options.FileMask; - _options = options; - _parser = new PdfPageImageProcessor(_imagePosList, _imageInfoList); - } - - internal void ExtractPageImages(PdfReader reader, int pageNum) { - if (pageNum < 1 || pageNum > reader.NumberOfPages) { - return; - } - _activePage = pageNum; - _parser.Reset(); - _imageCount = 0; - _imageInfoList.Clear(); - _imagePosList.Clear(); - var o = reader.GetPageNRelease(pageNum); - if (o == null) { - return; - } - - // 收集页面上的图片 - var pp = o.Locate(PdfName.RESOURCES, PdfName.XOBJECT); - if (pp != null) { - ExtractImageInstances(pp, false); - } - // 收集批注中的图片 - if (_options.ExtractAnnotationImages) { - var an = o.Locate(PdfName.ANNOTS); - if (an != null) { - foreach (var item in an.ArrayList) { - ExtractImageInstances(PdfReader.GetPdfObjectRelease(item) as PdfDictionary, true); - } - } - } - _pageRotation = PdfHelper.GetPageRotation(o); - if (_imageInfoList.Count == 0) { - return; - } - _parser.ProcessContent(reader.GetPageContent(pageNum), o.Locate(PdfName.RESOURCES)); - _imagePosList.Sort(); - _imageInfoList.Sort((x, y) => { - var xi = _imagePosList.Find((info) => info.Image == x); - var yi = _imagePosList.Find((info) => info.Image == y); - if (xi == null) { - return yi == null ? 0 : -1; - } - else if (yi == null) { - return -1; - } - return xi.CompareTo(yi); - }); - foreach (var item in _imageInfoList) { - try { - ExtractImage(item); - } - catch (FreeImageException ex) { - if (item.ReferenceCount > 0) { - Tracker.TraceMessage(Tracker.Category.Error, "在导出第 " + pageNum + " 页图片时遇到错误:" + ex.Message); - } - } - } - if (_options.MergeImages && _imagePosList.Count > 1) { - // 合并相同宽度、相同类型的图片 - MergeImages(); - } - } - - void ExtractImageInstances(PdfDictionary source, bool includeDescendants) { - if (source == null) { - return; - } - foreach (var item in source) { - if (_options.SkipRedundantImages && _Refs.Add(item.Value) == false - || PdfName.SMASK.Equals(item.Key) - || PdfName.MASK.Equals(item.Key)) { - continue; - } - var obj = PdfReader.GetPdfObject(item.Value); - var stream = obj as PRStream; - if (stream == null) { - goto NEXT; - } - PdfName subType = stream.GetAsName(PdfName.SUBTYPE); - if (PdfName.IMAGE.Equals(subType)) { - try { - _imageInfoList.Add(new ImageInfo(item.Value as PRIndirectReference)); - } - catch (NullReferenceException) { - Debug.WriteLine(item.Value); - } - } - else if (PdfName.FORM.Equals(subType)) { - var fr = stream.Locate(PdfName.RESOURCES, PdfName.XOBJECT); - if (fr == null) { - continue; - } - foreach (var fri in fr) { - if (_Refs.Add(fri.Value) == false) { - continue; - } - stream = PdfReader.GetPdfObject(fri.Value) as PRStream; - if (stream != null) { - subType = stream.GetAsName(PdfName.SUBTYPE); - if (PdfName.IMAGE.Equals(subType)) { - _imageInfoList.Add(new ImageInfo(fri.Value as PRIndirectReference)); - } - else if (includeDescendants || PdfName.FORM.Equals(subType)) { - ExtractImageInstances(stream, true); - } - } - else if (includeDescendants) { - ExtractImageInstances(stream, true); - } - } - } - NEXT: - if ((obj.Type == PdfObject.DICTIONARY || obj.Type == PdfObject.STREAM) && includeDescendants) { - ExtractImageInstances(obj as PdfDictionary, true); - } - } - } - - internal void ExtractImage(ImageInfo info) { - if (_totalImageCount == 0 && Directory.Exists(_options.OutputPath) == false) { - Directory.CreateDirectory(_options.OutputPath); - } - var bytes = info.DecodeImage(_options); - if (bytes == null) { - return; - } - if (info.LastDecodeError != null) { - Tracker.TraceMessage(Tracker.Category.Error, info.LastDecodeError); - return; - } - var fileName = GetNewImageFileName(); - if (info.ExtName == Constants.FileExtensions.Png - || info.ExtName == Constants.FileExtensions.Tif - ) { - SaveBitmap(info, bytes, fileName); - } - else { - SaveImageBytes(info, bytes, fileName); - } - if (info.Mask != null) { - using (var m = info.Mask) { - m.Palette.CreateGrayscalePalette(); - m.Save($"{fileName}[mask]{(info.Mask.PixelFormat == PixelFormat.Format1bppIndexed ? Constants.FileExtensions.Tif : Constants.FileExtensions.Png)}"); - } - } - _totalImageCount++; - } - - void SaveImageBytes(ImageInfo info, byte[] bytes, string fileName) { - var vFlip = _options.VerticalFlipImages ^ info.VerticalFlip; - var n = fileName + info.ExtName; - if (PrintImageLocation) { - Tracker.TraceMessage(Tracker.Category.OutputFile, n); - Tracker.TraceMessage("导出图片:" + n); - } - if ((vFlip || _pageRotation != 0) && info.ExtName == Constants.FileExtensions.Jp2) { - try { - using (var ms = new MemoryStream(bytes)) - using (var bmp = new FreeImageBitmap(ms)) { - RotateBitmap(bmp, _pageRotation, vFlip); - info.CreatePaletteAndIccProfile(bmp); - try { - bmp.Save(n); - } - catch (FreeImageException) { - File.Delete(n); - bmp.Save(new FilePath(n).ChangeExtension(Constants.FileExtensions.Png)); - } - } - } - catch (FreeImageException ex) { - Tracker.TraceMessage(ex); - bytes.DumpBytes(n); - } - } - else if (PdfName.DEVICECMYK.Equals(info.ColorSpace)) { - using (var ms = new MemoryStream(bytes)) - using (var bmp = new FreeImageBitmap(ms, FREE_IMAGE_LOAD_FLAGS.JPEG_CMYK | FREE_IMAGE_LOAD_FLAGS.TIFF_CMYK)) { - RotateBitmap(bmp, _pageRotation, vFlip); - if (bmp.ConvertColorDepth(FREE_IMAGE_COLOR_DEPTH.FICD_24_BPP)) { - SwapRedBlue(bmp); - n = fileName + Constants.FileExtensions.Png; - bmp.Save(n, FREE_IMAGE_FORMAT.FIF_PNG); - } - else { - n = fileName + Constants.FileExtensions.Tif; - bmp.Save(n, FREE_IMAGE_FORMAT.FIF_TIFF, FREE_IMAGE_SAVE_FLAGS.TIFF_CMYK | FREE_IMAGE_SAVE_FLAGS.TIFF_DEFLATE); - } - if (PrintImageLocation) { - Tracker.TraceMessage("导出图片:" + n); - } - } - } - else { - using (FileStream f = new FileStream(n, FileMode.Create)) { - f.Write(bytes, 0, bytes.Length); - } - if (info.ExtName == Constants.FileExtensions.Jpg) { - if (vFlip) { - TransformJpeg(n, FREE_IMAGE_JPEG_OPERATION.FIJPEG_OP_FLIP_V); - } - if (_pageRotation != 0) { - TransformJpeg(n, - _pageRotation == 90 ? FREE_IMAGE_JPEG_OPERATION.FIJPEG_OP_ROTATE_90 - : _pageRotation == 180 ? FREE_IMAGE_JPEG_OPERATION.FIJPEG_OP_ROTATE_180 - : _pageRotation == 270 ? FREE_IMAGE_JPEG_OPERATION.FIJPEG_OP_ROTATE_270 - : FREE_IMAGE_JPEG_OPERATION.FIJPEG_OP_NONE); - } - } - } - info.FileName = n; - } - - static void SwapRedBlue(FreeImageBitmap bmp) { - var r = bmp.GetChannel(FREE_IMAGE_COLOR_CHANNEL.FICC_RED); - var b = bmp.GetChannel(FREE_IMAGE_COLOR_CHANNEL.FICC_BLUE); - bmp.SetChannel(b, FREE_IMAGE_COLOR_CHANNEL.FICC_RED); - bmp.SetChannel(r, FREE_IMAGE_COLOR_CHANNEL.FICC_BLUE); - } - - static void TransformJpeg(string fileName, FREE_IMAGE_JPEG_OPERATION operation) { - var tmpName = fileName + Constants.FileExtensions.Tmp; - if (FreeImageBitmap.JPEGTransform(fileName, tmpName, operation, true)) { - File.Delete(fileName); - File.Move(tmpName, fileName); - return; - } - File.Delete(tmpName); - RotateFlipType type; - switch (operation) { - case FREE_IMAGE_JPEG_OPERATION.FIJPEG_OP_FLIP_H: - type = RotateFlipType.RotateNoneFlipX; - break; - case FREE_IMAGE_JPEG_OPERATION.FIJPEG_OP_FLIP_V: - type = RotateFlipType.RotateNoneFlipY; - break; - case FREE_IMAGE_JPEG_OPERATION.FIJPEG_OP_ROTATE_90: - type = RotateFlipType.Rotate270FlipNone; - break; - case FREE_IMAGE_JPEG_OPERATION.FIJPEG_OP_ROTATE_180: - type = RotateFlipType.Rotate180FlipNone; - break; - case FREE_IMAGE_JPEG_OPERATION.FIJPEG_OP_ROTATE_270: - type = RotateFlipType.Rotate90FlipNone; - break; - default: - Tracker.TraceMessage(Tracker.Category.Error, "无损翻转 JPG 图片失败:" + fileName); - return; - } - using (var bmp = new FreeImageBitmap(fileName)) { - bmp.RotateFlip(type); - if (bmp.UniqueColors < 256) { - bmp.ConvertColorDepth(FREE_IMAGE_COLOR_DEPTH.FICD_08_BPP); - } - bmp.Save(new FilePath(fileName).ChangeExtension(Constants.FileExtensions.Png)); - } - File.Delete(fileName); - } - - void SaveBitmap(ImageInfo info, byte[] bytes, string fileName) { - var vFlip = _options.VerticalFlipImages ^ info.VerticalFlip; - var ext = info.ExtName; - if (info.PixelFormat == PixelFormat.Format1bppIndexed) { - ext = _options.MonoPng == false ? Constants.FileExtensions.Tif : Constants.FileExtensions.Png; - } - var n = fileName + ext; - if (PrintImageLocation) { - Tracker.TraceMessage(Tracker.Category.OutputFile, n); - Tracker.TraceMessage("导出图片:" + n); - } - if (PdfName.DEVICECMYK.Equals(info.ColorSpace)) { - // TODO: 转换字节数组的 CMYK 为 RGB 后加载到 FreeImageBitmap - //info.PixelFormat = PixelFormat.Undefined; - using (var bmp = new FreeImageBitmap( - //info.Width, - //info.Height, - //GetStride (info, bytes, vFlip), - //PixelFormat.Format32bppArgb, bytes - new MemoryStream(bytes), FREE_IMAGE_LOAD_FLAGS.JPEG_CMYK - )) { - if (info.ICCProfile != null) { - bmp.CreateICCProfile(info.ICCProfile); - } - RotateBitmap(bmp, _pageRotation, false); - if (bmp.ConvertColorDepth(FREE_IMAGE_COLOR_DEPTH.FICD_24_BPP)) { - SwapRedBlue(bmp); - n = fileName + Constants.FileExtensions.Png; - bmp.Save(n, FREE_IMAGE_FORMAT.FIF_PNG); - } - else { - bmp.Save(n, - FREE_IMAGE_FORMAT.FIF_TIFF, - FREE_IMAGE_SAVE_FLAGS.TIFF_CMYK | FREE_IMAGE_SAVE_FLAGS.TIFF_DEFLATE); - } - } - } - else { - using (var bmp = CreateFreeImageBitmap(info, ref bytes, vFlip, true)) { - if (ext == Constants.FileExtensions.Png - && _options.InvertBlackAndWhiteImages - && info.PixelFormat == PixelFormat.Format1bppIndexed - && bmp.Palette.Length == 2) { - bmp.SwapPaletteIndices(0, 1); - } - RotateBitmap(bmp, _pageRotation, false); - if (ext == Constants.FileExtensions.Tif) { - TiffHelper.Save(bmp, n); - } - else { - try { - bmp.Save(n, FREE_IMAGE_FORMAT.FIF_PNG); - } - catch (FreeImageException ex) when (ex.Message == "Unable to save bitmap") { - using (var b = bmp.ToBitmap()) { - b.Save(n, ImageFormat.Png); - } - } - catch (System.Runtime.InteropServices.SEHException) { - Tracker.TraceMessage(Tracker.Category.Error, "保存图片时出现错误,请联系程序开发者:" + n); - } - } - } - } - info.FileName = n; - } - - static void RotateBitmap(FreeImageBitmap bitmap, int rotation, bool vflip) { - if (rotation == 0 && vflip == false) { - return; - } - RotateFlipType r; - switch (rotation) { - case 0: r = RotateFlipType.RotateNoneFlipY; break; - case 90: r = vflip ? RotateFlipType.Rotate270FlipY : RotateFlipType.Rotate270FlipNone; break; - case 180: r = vflip ? RotateFlipType.Rotate180FlipY : RotateFlipType.Rotate180FlipNone; break; - case 270: r = vflip ? RotateFlipType.Rotate90FlipY : RotateFlipType.Rotate90FlipNone; break; - default: return; - } - bitmap.RotateFlip(r); - } - - internal static FreeImageBitmap CreateFreeImageBitmap(ImageInfo info, ref byte[] bytes, bool vFlip, bool loadPaletteAndIccp) { - if (info.ExtName != Constants.FileExtensions.Jpg && info.ExtName != Constants.FileExtensions.Jp2) { - info.ConvertDecodedBytes(ref bytes); - } - FreeImageBitmap bmp; - if (PdfName.DEVICECMYK.Equals(info.ColorSpace)) { - bmp = new FreeImageBitmap(new MemoryStream(bytes), FREE_IMAGE_LOAD_FLAGS.TIFF_CMYK); - } - else if (info.ExtName == Constants.FileExtensions.Jp2 || info.ExtName == Constants.FileExtensions.Jpg) { - bmp = new FreeImageBitmap(new MemoryStream(bytes)); - } - else { - bmp = new FreeImageBitmap(info.Width, info.Height, GetStride(info, bytes, vFlip), info.PixelFormat, bytes); - } - if (loadPaletteAndIccp) { - info.CreatePaletteAndIccProfile(bmp); - } - return bmp; - } - - static int GetStride(ImageInfo info, byte[] bytes, bool vFlip) { - if (PdfName.COLORSPACE.Equals(info.ColorSpace)) { - return vFlip ? -(info.Width << 2) : (info.Width << 2); - } - var components = bytes.Length / info.Width / info.Height; - var stride = components > 0 - ? info.Width * components - : (info.Width + 8 / info.BitsPerComponent - 1) / (8 / info.BitsPerComponent); - return vFlip ? -stride : stride; - } - - string GetNewImageFileName() { - _imageCount++; - return String.Concat( - FileHelper.CombinePath(_options.OutputPath, _activePage.ToString(_fileMask)), - _imageCount > 1 ? "[" + _imageCount + "]" : null); - } - - void MergeImages() { - var l = _imagePosList.Count; - for (int i = 0; i < l; i++) { - var imageI = _imagePosList[i]; - // 由于在导出图像时仅为 PNG 和 TIF 指定 ImageInfo 的 PixelFormat,因此合并过程中仅处理这两类文件 - if (imageI.Image.ReferenceCount < 1 // 图像已处理 - || imageI.Image.PixelFormat == PixelFormat.Undefined // 不属于可合并的类型 - || l - i < 2 // 是最后一张图片 - ) { - continue; - } - var imageParts = new ImageInfo[l - i]; - var w = imageI.Image.Width; - var h = 0; - var i2 = 0; - for (int j = i; j < l; j++) { - var imageJ = _imagePosList[j]; - if (imageJ.Image.ReferenceCount < 1 // 图像已处理 - || imageJ.Image.Width != w // 宽度不相符 - || Math.Abs(Math.Round(imageJ.X - imageI.X)) > 1 // 位置相差超过 1 点 - ) { - continue; - } - imageParts[i2] = imageJ.Image; - h += imageJ.Image.Height; - _imagePosList[j].Image.ReferenceCount--; // 避免重复处理 - i2++; - } - if (i2 == 0) { // 没有符合合并条件的图片 - continue; - } - if (i2 == 1) { - _imagePosList[i].Image.ReferenceCount++; - continue; - } - if (i2 < imageParts.Length) { - Array.Resize(ref imageParts, i2); - } - if (PrintImageLocation) { - Tracker.TraceMessage("合并图片:" + String.Join("、", Array.ConvertAll(imageParts, p => Path.GetFileName(p.FileName)))); - } - var ext = Path.GetExtension(imageI.Image.FileName).ToLowerInvariant(); - if (imageI.Image.PixelFormat == PixelFormat.Format1bppIndexed) { - ext = Constants.FileExtensions.Tif; - } - var f = GetNewImageFileName(); - using (FreeImageBitmap bmp = new FreeImageBitmap(w, h, imageI.Image.PixelFormat)) { - h = 0; - byte palEntryCount = 0; - var bmpPal = bmp.HasPalette ? bmp.Palette.AsArray : null; - foreach (var part in imageParts) { - using (var bmp2 = FreeImageBitmap.FromFile(part.FileName)) { - var pl = part.PaletteEntryCount; - if (pl > 0 && bmp.HasPalette && bmp2.HasPalette) { - for (int pi = 0; pi < pl; pi++) { - var p = Array.IndexOf(bmpPal, part.PaletteArray[pi], 0, palEntryCount); - if (p == -1) { - if (palEntryCount == 255) { - if (bmpPal != null) { - bmp.Palette.AsArray = bmpPal; - } - // 调色板不足以存放合并后的图片颜色 - if (bmp.ConvertColorDepth(FREE_IMAGE_COLOR_DEPTH.FICD_24_BPP) - && bmp2.ConvertColorDepth(FREE_IMAGE_COLOR_DEPTH.FICD_24_BPP)) { - ext = Constants.FileExtensions.Png; - bmpPal = null; - goto Paste; - } - else { - throw new OverflowException("调色板溢出,无法合并图片。"); - } - } - if (palEntryCount >= bmpPal.Length && palEntryCount < 129) { - bmp.ConvertColorDepth(FREE_IMAGE_COLOR_DEPTH.FICD_08_BPP); - Array.Resize(ref bmpPal, 256); - } - bmpPal[palEntryCount] = part.PaletteArray[pi]; - p = palEntryCount; - ++palEntryCount; - } - } - } - else if (pl > 0 && bmp2.HasPalette) { - bmp2.ConvertColorDepth(FREE_IMAGE_COLOR_DEPTH.FICD_24_BPP); - } - Paste: - if (bmpPal != null) { - bmp.Palette.AsArray = bmpPal; - } - if (bmp.HasPalette && bmp2.HasPalette) { - var a1 = bmp.Palette.AsArray; - var a2 = bmp2.Palette.AsArray; - var sp = new byte[palEntryCount]; - var dp = new byte[palEntryCount]; - var di = 0; - for (int ai = 0; ai < a2.Length; ai++) { - var p = Array.IndexOf(a1, a2[ai], 0, palEntryCount); - if (p != ai && p > -1) { - sp[di] = (byte)ai; - dp[di] = (byte)p; - ++di; - } - } - //todo: 两幅图像调色板不一致时需调换颜色再复制数据 - //if (di > 0) { - // bmp2.ApplyPaletteIndexMapping(sp, dp, (uint)di, true); - //} - } - if (bmp.Paste(bmp2, 0, h, Int32.MaxValue) == false) { - if (bmp.HasPalette && bmp2.HasPalette == false) { - bmp.ConvertColorDepth(FREE_IMAGE_COLOR_DEPTH.FICD_24_BPP); - if (bmp.Paste(bmp2, 0, h, Int32.MaxValue) == false) { - Tracker.TraceMessage("合并图片失败"); - } - bmpPal = null; - } - } - h += bmp2.Height; - } - } - if (bmpPal != null) { - bmp.Palette.AsArray = bmpPal; - } - if (ext == Constants.FileExtensions.Jpg && _options.MergeJpgToPng) { - ext = Constants.FileExtensions.Png; - } - else if (bmp.PixelFormat == PixelFormat.Format1bppIndexed) { - if (_options.MonoPng == false) { - ext = Constants.FileExtensions.Tif; - } - else { - ext = Constants.FileExtensions.Png; - } - } - f += ext; - if (PrintImageLocation) { - Tracker.TraceMessage(Tracker.Category.OutputFile, f); - Tracker.TraceMessage("保存合并后的图片:" + f); - } - if (ext == Constants.FileExtensions.Tif) { - TiffHelper.Save(bmp, f); - } - else { - bmp.Save(f); - } - var mii = new ImageInfo { FileName = f, ReferenceCount = 1, Height = h, Width = w }; - _imageInfoList.Add(mii); - _imagePosList.Add(new ImageDisposition(_imagePosList[i].Ctm, mii)); - } - } - foreach (var item in _imageInfoList) { - if (item.ReferenceCount < 1) { - File.Delete(item.FileName); - item.FileName = null; - } - } - _imageInfoList.Sort((ImageInfo x, ImageInfo y) => string.Compare(x.FileName, y.FileName, StringComparison.OrdinalIgnoreCase)); - _totalImageCount -= _imageCount; - _imageCount = 0; - var newFileNames = new List(); - foreach (var item in _imageInfoList) { - if (item.FileName != null && item.InlineImage == null) { - string n; - do { - n = GetNewImageFileName() + Path.GetExtension(item.FileName); - } while (_imagePosList.Exists((i) => i.Image.FileName == n) || newFileNames.Contains(n)); - if (PrintImageLocation) { - Tracker.TraceMessage(String.Concat("重命名合并后的文件 ", item.FileName, " 为 ", n)); - Tracker.TraceMessage(Tracker.Category.OutputFile, n); - } - newFileNames.Add(n); - File.Delete(n); - File.Move(item.FileName, n); - item.FileName = n; - } - } - _totalImageCount += _imageCount; - } - - sealed class PdfPageImageProcessor : PdfContentStreamProcessor - { - readonly List _posList; - readonly List _infoList; - - public PdfPageImageProcessor(List posList, List infoList) { - PopulateOperators(); - _posList = posList; - _infoList = infoList; - } - protected override void InvokeOperator(PdfLiteral oper, List operands) { - base.InvokeOperator(oper, operands); - switch (oper.ToString()) { - case "Do": - var xobjects = Resource.GetAsDict(PdfName.XOBJECT); - var r = xobjects.GetAsIndirectObject(operands[0] as PdfName); - var info = _infoList.Find( - i => i.InlineImage.PdfRef != null - && i.InlineImage.PdfRef.Number == r.Number - && i.InlineImage.PdfRef.Generation == r.Generation); - if (info != null) { - info.ReferenceCount++; - _posList.Add(new ImageDisposition(CurrentGraphicState.TransMatrix, info)); - } - else { - Trace.WriteLine(String.Concat("Image ", r, " not found.")); - } - break; - case "BI": - info = new ImageInfo(new PdfImageData(operands[0] as PdfDictionary, ((PdfImageData)operands[0]).RawBytes)); - info.ReferenceCount++; - _infoList.Add(info); - _posList.Add(new ImageDisposition(CurrentGraphicState.TransMatrix, info)); - break; - } - } - } - - } -} diff --git a/pdfpatcher/App/Processor/Imaging/BitmapHelper.cs b/pdfpatcher/App/Processor/Imaging/BitmapHelper.cs deleted file mode 100644 index 1134fd18aa497399de842b59eb0ab9ebfe2f4a15..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Imaging/BitmapHelper.cs +++ /dev/null @@ -1,324 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Drawing.Imaging; -using System.Linq; -using System.Runtime.InteropServices; - -namespace PDFPatcher.Processor.Imaging -{ - static class BitmapHelper - { - public static ImageCodecInfo GetCodec(string codecName) { - var ie = ImageCodecInfo.GetImageEncoders(); - for (int i = 0; i < ie.Length; i++) { - var ic = ie[i]; - if (ic.MimeType == codecName) { - return ic; - } - } - return null; - } - - /// - /// 获取指定图片的不重复颜色集合。 - /// - /// 需要获取颜色集合的 。 - /// 包含不重复颜色集合的列表。 - unsafe public static Color[] GetPalette(this Bitmap bmp) { - var hs = new HashSet(); - if (bmp == null) { - return null; - } - if (bmp.IsIndexed()) { - return Array.ConvertAll(bmp.Palette.Entries, c => c); //duplicates the array - } - if (bmp.PixelFormat != PixelFormat.Format24bppRgb && bmp.PixelFormat != PixelFormat.Format32bppArgb) { - throw new InvalidOperationException("仅支持 Format24bppRgb 和 Format32bppArgb。"); - } - BitmapData bmpData; - int bw = bmp.PixelFormat == PixelFormat.Format24bppRgb ? 3 : 4; - byte* ps, pl; - bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, bmp.PixelFormat); - pl = (byte*)bmpData.Scan0; - int w = bmp.Width, h = bmp.Height; - for (int y = 0; y < h; y++) { - ps = pl; - if (bw == 3) { - for (int x = 0; x < w; x++) { - hs.Add((*ps) + (*(++ps) << 8) + (*(++ps) << 16) + (0xFF << 24)); - ++ps; - } - } - else if (bw == 4) { - for (int x = 0; x < w; x++) { - hs.Add((*ps) + ((*++ps) << 8) + (*(++ps) << 16) + (*(++ps) << 24)); - ++ps; - } - } - pl += bmpData.Stride; - } - bmp.UnlockBits(bmpData); - var r = new Color[hs.Count]; - var i = 0; - foreach (var item in hs.Select(Color.FromArgb)) { - r[i++] = item; - } - return r; - } - - /// - /// 检查 是否为索引调色板图像。 - /// - /// 需要检查的图像。 - /// 如为索引调色板图像,则返回 true,否则返回 false。 - public static bool IsIndexed(this Image image) { - return (image.PixelFormat & PixelFormat.Indexed) == PixelFormat.Indexed; - } - - /// - /// 锁定 的内容,用于读写。 - /// - /// 需要锁定的内容。 - /// 是否可写入。 - /// 锁定后的 - public static BitmapData LockBits(this Bitmap bmp, bool writable) { - return bmp.LockBits(new Rectangle(Point.Empty, bmp.Size), writable ? ImageLockMode.ReadWrite : ImageLockMode.ReadOnly, bmp.PixelFormat); - } - - /// - /// 调整 的尺寸。 - /// - /// 需要调整尺寸的 。 - /// 新尺寸。 - /// 是否采用插值方式调整尺寸。 - /// 调整后的新 - public static Bitmap ResizeImage(this Image source, Size size, bool highQuality) { - var b = new Bitmap(size.Width, size.Height); - using (var g = Graphics.FromImage(b)) { - if (highQuality) { - g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; - } - g.DrawImage(source, 0, 0, size.Width, size.Height); - } - return b; - } - /// - /// 按文件名的扩展名保存图像文件为对应的格式。 - /// - /// 需要保存的 。 - /// 保存的文件路径。 - public static void SaveAs(this Image image, string fileName) { - var ext = System.IO.Path.GetExtension(fileName); - switch (ext.ToUpperInvariant()) { - case ".PNG": - image.Save(fileName, ImageFormat.Png); return; - case ".BMP": - image.Save(fileName, ImageFormat.Bmp); return; - case ".JPG": - case ".JPEG": - image.Save(fileName, 75); return; - case ".TIF": - case ".TIFF": - TiffHelper.SaveBinaryImage(image, fileName); return; - case ".GIF": - image.Save(fileName, ImageFormat.Gif); return; - default: - goto case ".PNG"; - } - } - public static void SaveAs(this Image image, string extension, System.IO.Stream stream) { - switch (extension) { - case ".PNG": - image.Save(stream, ImageFormat.Png); return; - case ".BMP": - image.Save(stream, ImageFormat.Bmp); return; - case ".JPG": - case ".JPEG": - image.Save(stream, 75); return; - case ".TIF": - case ".TIFF": - TiffHelper.SaveBinaryImage(image, stream); return; - case ".GIF": - image.Save(stream, ImageFormat.Gif); return; - default: - goto case ".PNG"; - } - } - /// - /// 将 颜色染色到 上。 - /// - /// 基色。 - /// 染色颜色。 - /// 染色后的新颜色。 - public static Color Tint(this Color color, Color tint) { - return Color.FromArgb(color.A, mul255(color.R, tint.R), mul255(color.G, tint.G), mul255(color.B, tint.B)); - - // MuPDF: pixmap.c - static int mul255(int a, int b) { - /* see Jim Blinn's book "Dirty Pixels" for how this works */ - int x = a * b + 128; - x += x >> 8; - return x >> 8; - } - } - - unsafe public static Bitmap ToIndexImage(this Bitmap source, Color[] pallette) { - if (source == null) { - return null; - } - if (source.PixelFormat != PixelFormat.Format24bppRgb && source.PixelFormat != PixelFormat.Format32bppArgb) { - throw new InvalidOperationException("仅支持 Format24bppRgb 和 Format32bppArgb。"); - } - var pi = new Dictionary(pallette.Length); - for (int i = pallette.Length - 1; i >= 0; i--) { - pi[pallette[i].ToArgb()] = (byte)i; - } - var result = new Bitmap(source.Width, source.Height, PixelFormat.Format8bppIndexed); - var sourceData = source.LockBits(false); - var targetData = result.LockBits(true); - int bw = source.PixelFormat == PixelFormat.Format24bppRgb ? 3 : 4; - byte* ps, pr, src, res; - src = (byte*)sourceData.Scan0; - res = (byte*)targetData.Scan0; - var rp = result.Palette; - for (int i = 0; i < pallette.Length; i++) { - rp.Entries[i] = pallette[i]; - } - result.Palette = rp; - int w = source.Width, h = source.Height; - for (int y = 0; y < h; y++) { - ps = src; - pr = res; - if (bw == 3) { - for (int x = 0; x < w; x++) { - *pr = pi[(*ps) + (*(++ps) << 8) + (*(++ps) << 16) + (0xFF << 24)]; - ++pr; - ++ps; - } - } - else if (bw == 4) { - for (int x = 0; x < w; x++) { - *pr = pi[(*ps) + ((*++ps) << 8) + (*(++ps) << 16) + (*(++ps) << 24)]; - ++pr; - ++ps; - } - } - src += sourceData.Stride; - res += targetData.Stride; - } - source.UnlockBits(sourceData); - result.UnlockBits(targetData); - return result; - } - - /// 将图像转换为黑白图像。 - /// 需要转换的图像。 - /// 转换后的图像。 - /// http://www.wischik.com/lu/programmer/1bpp.html - public static Bitmap ToBitonal(this Bitmap original) { - Bitmap source; - - if (original.PixelFormat == PixelFormat.Format1bppIndexed) { - return (Bitmap)original.Clone(); - } - else if (original.PixelFormat != PixelFormat.Format24bppRgb) { - // If original bitmap is not already in 24 BPP, ARGB format, then convert - // unfortunately Clone doesn't do this for us but returns a bitmap with the same pixel format - // source = original.Clone( new Rectangle( Point.Empty, original.Size ), PixelFormat.Format24bppRgb ); - source = new Bitmap(original.Width, original.Height, PixelFormat.Format24bppRgb); - source.SetResolution(original.HorizontalResolution, original.VerticalResolution); - using (Graphics g = Graphics.FromImage(source)) { - //g.CompositingQuality = Drawing2D.CompositingQuality.GammaCorrected; - //g.InterpolationMode = Drawing2D.InterpolationMode.Low; - //g.SmoothingMode = Drawing2D.SmoothingMode.None; - g.DrawImageUnscaled(original, 0, 0); - } - } - else { - source = original; - } - - // Lock source bitmap in memory - BitmapData sourceData = source.LockBits(new Rectangle(0, 0, source.Width, source.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); - - // Copy image data to binary array - int imageSize = sourceData.Stride * sourceData.Height; - byte[] sourceBuffer = new byte[imageSize]; - Marshal.Copy(sourceData.Scan0, sourceBuffer, 0, imageSize); - - // Unlock source bitmap - source.UnlockBits(sourceData); - - // Dispose of source if not originally supplied bitmap - if (source != original) { - source.Dispose(); - } - - // Create destination bitmap - Bitmap destination = new Bitmap(sourceData.Width, sourceData.Height, PixelFormat.Format1bppIndexed); - destination.SetResolution(original.HorizontalResolution, original.VerticalResolution); - - // Lock destination bitmap in memory - BitmapData destinationData = destination.LockBits(new Rectangle(0, 0, destination.Width, destination.Height), ImageLockMode.WriteOnly, PixelFormat.Format1bppIndexed); - - // Create destination buffer - byte[] destinationBuffer = SimpleThresholdBW( - sourceBuffer, - sourceData.Width, - sourceData.Height, - sourceData.Stride, - destinationData.Stride); - - // Copy binary image data to destination bitmap - Marshal.Copy(destinationBuffer, 0, destinationData.Scan0, destinationData.Stride * sourceData.Height); - - // Unlock destination bitmap - destination.UnlockBits(destinationData); - - // Return - return destination; - } - - public static byte[] SimpleThresholdBW(byte[] sourceBuffer, int width, int height, int srcStride, int dstStride) { - const int THRESHOLD = 255 * 3 / 2; - - byte[] destinationBuffer = new byte[dstStride * height]; - int srcIx = 0; - int dstIx = 0; - byte bit; - byte pix8; - - int newPixel, i, j; - - // Iterate lines - for (int y = 0; y < height; y++, srcIx += srcStride, dstIx += dstStride) { - bit = 128; - i = srcIx; - j = dstIx; - pix8 = 0; - // Iterate pixels - for (int x = 0; x < width; x++, i += 3) { - // Compute pixel brightness (i.e. total of Red, Green, and Blue values) - newPixel = sourceBuffer[i] + sourceBuffer[i + 1] + sourceBuffer[i + 2]; - - if (newPixel > THRESHOLD) { - pix8 |= bit; - } - if (bit == 1) { - destinationBuffer[j++] = pix8; - bit = 128; - pix8 = 0; // init next value with 0 - } - else { - bit >>= 1; - } - } // line finished - if (bit != 128) { - destinationBuffer[j] = pix8; - } - } // all lines finished - return destinationBuffer; - } - } -} diff --git a/pdfpatcher/App/Processor/Imaging/ImageDeskew.cs b/pdfpatcher/App/Processor/Imaging/ImageDeskew.cs deleted file mode 100644 index cc74f389e283fd1c63fb43e94acc094df2b2ca3f..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Imaging/ImageDeskew.cs +++ /dev/null @@ -1,943 +0,0 @@ -using System; -using System.Drawing; -using FreeImageAPI; -public class ImageDeskew -{ - // Representation of a line in the image. - private class HougLine - { - // Count of points in the line. - public int Count; - // Index in Matrix. - public int Index; - // The line is represented as all x,y that solve y*cos(alpha)-x*sin(alpha)=d - public double Alpha; - } - - - // The range of angles to search for lines - const double ALPHA_START = -20; - const double ALPHA_STEP = 0.2; - const int STEPS = 40 * 5; - const double STEP = 1; - - // Precalculation of sin and cos. - double[] _sinA; - double[] _cosA; - - // Range of d - double _min; - - - int _count; - // Count of points that fit in a line. - int[] _hMatrix; - - // Calculate the skew angle of the image cBmp. - public double GetSkewAngle (FreeImageBitmap image) { - if (image.PixelFormat != System.Drawing.Imaging.PixelFormat.Format1bppIndexed) { - image = image.GetColorConvertedInstance (FREE_IMAGE_COLOR_DEPTH.FICD_FORCE_GREYSCALE | FREE_IMAGE_COLOR_DEPTH.FICD_01_BPP_DITHER); - } - image.Save ("m:\\1.png"); - // Hough Transformation - Calc (image); - - // Top 20 of the detected lines in the image. - HougLine[] hl = GetTop (20); - - // Average angle of the lines - double sum = 0; - int count = 0; - for (int i = 0; i <= 19; i++) { - sum += hl[i].Alpha; - count += 1; - } - return sum / count; - } - - // Calculate the Count lines in the image with most points. - private HougLine[] GetTop (int count) { - HougLine[] hl = new HougLine[count]; - - for (int i = 0; i <= count - 1; i++) { - hl[i] = new HougLine (); - } - for (int i = 0; i <= _hMatrix.Length - 1; i++) { - if (_hMatrix[i] > hl[count - 1].Count) { - hl[count - 1].Count = _hMatrix[i]; - hl[count - 1].Index = i; - int j = count - 1; - while (j > 0 && hl[j].Count > hl[j - 1].Count) { - HougLine tmp = hl[j]; - hl[j] = hl[j - 1]; - hl[j - 1] = tmp; - j -= 1; - } - } - } - - for (int i = 0; i <= count - 1; i++) { - int dIndex = hl[i].Index / STEPS; - int alphaIndex = hl[i].Index - dIndex * STEPS; - hl[i].Alpha = GetAlpha (alphaIndex); - //hl[i].D = dIndex + _min; - } - - return hl; - } - - - // Hough Transforamtion: - private void Calc (FreeImageBitmap image) { - int hMin = image.Height / 4; - int hMax = image.Height * 3 / 4; - - Init (image); - Scanline l1, l2; - - for (int y = hMin; y <= hMax; y++) { - l1 = image.GetScanline (y - 1); - l2 = image.GetScanline (y); - for (int x = 1; x <= image.Width - 2; x++) { - // Only lower edges are considered. - if (l1[x] == FI1BIT.MinValue) { - if (l2[x] == FI1BIT.MaxValue) { - Calc (x, y); - } - } - } - } - } - - // Calculate all lines through the point (x,y). - private void Calc (int x, int y) { - int alpha; - - for (alpha = 0; alpha <= STEPS - 1; alpha++) { - double d = y * _cosA[alpha] - x * _sinA[alpha]; - int calculatedIndex = (int)CalcDIndex (d); - int index = calculatedIndex * STEPS + alpha; - try { - _hMatrix[index] += 1; - } - catch (Exception ex) { - System.Diagnostics.Debug.WriteLine (ex.ToString ()); - } - } - } - private double CalcDIndex (double d) { - return Convert.ToInt32 (d - _min); - } - - private void Init (FreeImageBitmap image) { - // Precalculation of sin and cos. - _cosA = new double[STEPS]; - _sinA = new double[STEPS]; - - for (int i = 0; i < STEPS; i++) { - double angle = GetAlpha (i) * Math.PI / 180.0; - _sinA[i] = Math.Sin (angle); - _cosA[i] = Math.Cos (angle); - } - - // Range of d: - _min = -image.Width; - _count = (int)(2 * (image.Width + image.Height) / STEP); - _hMatrix = new int[_count * STEPS]; - - - } - - private static double GetAlpha (int index) { - return ALPHA_START + index * ALPHA_STEP; - } -} - - -//// AForge Image Processing Library -//// AForge.NET framework -//// http://www.aforgenet.com/framework/ -//// -//// Copyright © Andrew Kirillov, 2005-2010 -//// andrew.kirillov@aforgenet.com -//// -//// Alejandro Pirola, 2008 -//// alejamp@gmail.com -//// - -//namespace PDFPatcher.Processor -//{ -// using System; -// using System.Collections; -// using System.Drawing; -// using System.Drawing.Imaging; -// using FreeImageAPI; - -// /// -// /// Hough line. -// /// -// /// -// /// Represents line of Hough Line transformation using -// /// polar coordinates. -// /// See Wikipedia -// /// for information on how to convert polar coordinates to Cartesian coordinates. -// /// -// /// -// /// Hough Line transformation does not provide -// /// information about lines start and end points, only slope and distance from image's center. Using -// /// only provided information it is not possible to draw the detected line as it exactly appears on -// /// the source image. But it is possible to draw a line through the entire image, which contains the -// /// source line (see sample code below). -// /// -// /// -// /// Sample code to draw detected Hough lines: -// /// -// /// HoughLineTransformation lineTransform = new HoughLineTransformation( ); -// /// // apply Hough line transofrm -// /// lineTransform.ProcessImage( sourceImage ); -// /// Bitmap houghLineImage = lineTransform.ToBitmap( ); -// /// // get lines using relative intensity -// /// HoughLine[] lines = lineTransform.GetLinesByRelativeIntensity( 0.5 ); -// /// -// /// foreach ( HoughLine line in lines ) -// /// { -// /// // get line's radius and theta values -// /// int r = line.Radius; -// /// double t = line.Theta; -// /// -// /// // check if line is in lower part of the image -// /// if ( r < 0 ) -// /// { -// /// t += 180; -// /// r = -r; -// /// } -// /// -// /// // convert degrees to radians -// /// t = ( t / 180 ) * Math.PI; -// /// -// /// // get image centers (all coordinate are measured relative -// /// // to center) -// /// int w2 = image.Width /2; -// /// int h2 = image.Height / 2; -// /// -// /// double x0 = 0, x1 = 0, y0 = 0, y1 = 0; -// /// -// /// if ( line.Theta != 0 ) -// /// { -// /// // none-vertical line -// /// x0 = -w2; // most left point -// /// x1 = w2; // most right point -// /// -// /// // calculate corresponding y values -// /// y0 = ( -Math.Cos( t ) * x0 + r ) / Math.Sin( t ); -// /// y1 = ( -Math.Cos( t ) * x1 + r ) / Math.Sin( t ); -// /// } -// /// else -// /// { -// /// // vertical line -// /// x0 = line.Radius; -// /// x1 = line.Radius; -// /// -// /// y0 = h2; -// /// y1 = -h2; -// /// } -// /// -// /// // draw line on the image -// /// Drawing.Line( sourceData, -// /// new IntPoint( (int) x0 + w2, h2 - (int) y0 ), -// /// new IntPoint( (int) x1 + w2, h2 - (int) y1 ), -// /// Color.Red ); -// /// } -// /// -// /// -// /// To clarify meaning of and values -// /// of detected Hough lines, let's take a look at the below sample image and -// /// corresponding values of radius and theta for the lines on the image: -// /// -// /// -// /// -// /// -// /// Detected radius and theta values (color in corresponding colors): -// /// -// /// Theta = 90, R = 125, I = 249; -// /// Theta = 0, R = -170, I = 187 (converts to Theta = 180, R = 170); -// /// Theta = 90, R = -58, I = 163 (converts to Theta = 270, R = 58); -// /// Theta = 101, R = -101, I = 130 (converts to Theta = 281, R = 101); -// /// Theta = 0, R = 43, I = 112; -// /// Theta = 45, R = 127, I = 82. -// /// -// /// -// /// -// /// -// /// -// /// -// /// -// public class HoughLine : IComparable -// { -// /// -// /// Line's slope - angle between polar axis and line's radius (normal going -// /// from pole to the line). Measured in degrees, [0, 180). -// /// -// public readonly double Theta; - -// /// -// /// Line's distance from image center, (−∞, +∞). -// /// -// /// -// /// Negative line's radius means, that the line resides in lower -// /// part of the polar coordinates system. This means that value -// /// should be increased by 180 degrees and radius should be made positive. -// /// -// /// -// public readonly short Radius; - -// /// -// /// Line's absolute intensity, (0, +∞). -// /// -// /// -// /// Line's absolute intensity is a measure, which equals -// /// to number of pixels detected on the line. This value is bigger for longer -// /// lines. -// /// -// /// The value may not be 100% reliable to measure exact number of pixels -// /// on the line. Although these value correlate a lot (which means they are very close -// /// in most cases), the intensity value may slightly vary. -// /// -// /// -// public readonly short Intensity; - -// /// -// /// Line's relative intensity, (0, 1]. -// /// -// /// -// /// Line's relative intensity is relation of line's -// /// value to maximum found intensity. For the longest line (line with highest intesity) the -// /// relative intensity is set to 1. If line's relative is set 0.5, for example, this means -// /// its intensity is half of maximum found intensity. -// /// -// /// -// public readonly double RelativeIntensity; - -// /// -// /// Initializes a new instance of the class. -// /// -// /// -// /// Line's slope. -// /// Line's distance from image center. -// /// Line's absolute intensity. -// /// Line's relative intensity. -// /// -// public HoughLine (double theta, short radius, short intensity, double relativeIntensity) { -// Theta = theta; -// Radius = radius; -// Intensity = intensity; -// RelativeIntensity = relativeIntensity; -// } - -// /// -// /// Compare the object with another instance of this class. -// /// -// /// -// /// Object to compare with. -// /// -// /// A signed number indicating the relative values of this instance and value: 1) greater than zero - -// /// this instance is greater than value; 2) zero - this instance is equal to value; -// /// 3) greater than zero - this instance is less than value. -// /// -// /// The sort order is descending. -// /// -// /// -// /// Object are compared using their intensity value. -// /// -// /// -// public int CompareTo (object value) { -// return (-Intensity.CompareTo (((HoughLine)value).Intensity)); -// } -// } - -// /// -// /// Skew angle checker for scanned documents. -// /// -// /// -// /// The class implements document's skew checking algorithm, which is based -// /// on Hough line transformation. The algorithm -// /// is based on searching for text base lines - black line of text bottoms' followed -// /// by white line below. -// /// -// /// The routine supposes that a white-background document is provided -// /// with black letters. The algorithm is not supposed for any type of objects, but for -// /// document images with text. -// /// -// /// The range of angles to detect is controlled by property. -// /// -// /// The filter accepts 8 bpp grayscale images for processing. -// /// -// /// Sample usage: -// /// -// /// // create instance of skew checker -// /// DocumentSkewChecker skewChecker = new DocumentSkewChecker( ); -// /// // get documents skew angle -// /// double angle = skewChecker.GetSkewAngle( documentImage ); -// /// // create rotation filter -// /// RotateBilinear rotationFilter = new RotateBilinear( -angle ); -// /// rotationFilter.FillColor = Color.White; -// /// // rotate image applying the filter -// /// Bitmap rotatedImage = rotationFilter.Apply( documentImage ); -// /// -// /// -// /// Initial image: -// /// -// /// Deskewed image: -// /// -// /// -// /// -// /// -// /// -// public class ImageDeskew -// { -// // Hough transformation: quality settings -// private int stepsPerDegree; -// private int houghHeight; -// private double thetaStep; -// private double maxSkewToDetect; - -// // Hough transformation: precalculated Sine and Cosine values -// private double[] sinMap; -// private double[] cosMap; -// private bool needToInitialize = true; - -// // Hough transformation: Hough map -// private short[,] houghMap; -// private short maxMapIntensity = 0; - -// private int localPeakRadius = 4; -// private ArrayList lines = new ArrayList (); - -// /// -// /// Steps per degree, [1, 10]. -// /// -// /// -// /// The value defines quality of Hough transform and its ability to detect -// /// line slope precisely. -// /// -// /// Default value is set to 1. -// /// -// /// -// public int StepsPerDegree { -// get { return stepsPerDegree; } -// set { -// stepsPerDegree = Math.Max (1, Math.Min (10, value)); -// needToInitialize = true; -// } -// } - -// /// -// /// Maximum skew angle to detect, [0, 45] degrees. -// /// -// /// -// /// The value sets maximum document's skew angle to detect. -// /// Document's skew angle can be as positive (rotated counter clockwise), as negative -// /// (rotated clockwise). So setting this value to 25, for example, will lead to -// /// [-25, 25] degrees detection range. -// /// -// /// Scanned documents usually have skew in the [-20, 20] degrees range. -// /// -// /// Default value is set to 30. -// /// -// /// -// public double MaxSkewToDetect { -// get { return maxSkewToDetect; } -// set { -// maxSkewToDetect = Math.Max (0, Math.Min (45, value)); -// needToInitialize = true; -// } -// } - -// /// -// /// Minimum angle to detect skew in degrees. -// /// -// /// -// /// The property is deprecated and setting it has not any effect. -// /// Use property instead. -// /// -// [Obsolete ("The property is deprecated and setting it has not any effect. Use MaxSkewToDetect property instead.")] -// public double MinBeta { -// get { return (-maxSkewToDetect); } -// set { } -// } - -// /// -// /// Maximum angle to detect skew in degrees. -// /// -// /// -// /// The property is deprecated and setting it has not any effect. -// /// Use property instead. -// /// -// [Obsolete ("The property is deprecated and setting it has not any effect. Use MaxSkewToDetect property instead.")] -// public double MaxBeta { -// get { return (maxSkewToDetect); } -// set { } -// } - -// /// -// /// Radius for searching local peak value, [1, 10]. -// /// -// /// -// /// The value determines radius around a map's value, which is analyzed to determine -// /// if the map's value is a local maximum in specified area. -// /// -// /// Default value is set to 4. -// /// -// public int LocalPeakRadius { -// get { return localPeakRadius; } -// set { localPeakRadius = Math.Max (1, Math.Min (10, value)); } -// } - -// /// -// /// Initializes a new instance of the class. -// /// -// public ImageDeskew () { -// StepsPerDegree = 10; -// MaxSkewToDetect = 30; -// } - -// /// -// /// Get skew angle of the provided document image. -// /// -// /// -// /// Document's image to get skew angle of. -// /// -// /// Returns document's skew angle. If the returned angle equals to -90, -// /// then document skew detection has failed. -// /// -// /// Unsupported pixel format of the source image. -// /// -// public double GetSkewAngle (FreeImageBitmap image) { -// return GetSkewAngle (image, new Rectangle (0, 0, image.Width, image.Height)); -// } - -// /// -// /// Get skew angle of the provided document image. -// /// -// /// -// /// Document's image to get skew angle of. -// /// Image's rectangle to process (used to exclude processing of -// /// regions, which are not relevant to skew detection). -// /// -// /// Returns document's skew angle. If the returned angle equals to -90, -// /// then document skew detection has failed. -// /// -// /// Unsupported pixel format of the source image. -// /// -// public double GetSkewAngle (FreeImageBitmap image, Rectangle rect) { -// //image = image.GetColorConvertedInstance (FREE_IMAGE_COLOR_DEPTH.FICD_FORCE_GREYSCALE | FREE_IMAGE_COLOR_DEPTH.FICD_08_BPP); - -// // init hough transformation settings -// InitHoughMap (); - -// // get source image size -// int width = image.Width; -// int height = image.Height; -// int halfWidth = width / 2; -// int halfHeight = height / 2; - -// // make sure the specified rectangle recides with the source image -// rect.Intersect (new Rectangle (0, 0, width, height)); - -// int startX = -halfWidth + rect.Left; -// int startY = -halfHeight + rect.Top; -// int stopX = width - halfWidth - (width - rect.Right); -// int stopY = height - halfHeight - (height - rect.Bottom) - 1; - -// int offset = image.Stride - rect.Width; - -// // calculate Hough map's width -// int halfHoughWidth = (int)Math.Sqrt (halfWidth * halfWidth + halfHeight * halfHeight); -// int houghWidth = halfHoughWidth * 2; - -// houghMap = new short[houghHeight, houghWidth]; - -// #region do the job -// //using (Bitmap bmp = image.ToBitmap ()) { -// // BitmapData d = bmp.LockBits (new Rectangle (0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format8bppIndexed); -// // unsafe { -// // byte* src = (byte*)d.Scan0.ToPointer () + -// // rect.Top * d.Stride + rect.Left; -// // byte* srcBelow = src + d.Stride; - -// // // for each row -// // for (int y = startY; y < stopY; y++) { -// // // for each pixel -// // for (int x = startX; x < stopX; x++, src++, srcBelow++) { -// // // if current pixel is more black -// // // and pixel below is more white -// // if ((*src < 128) && (*srcBelow >= 128)) { -// // // for each Theta value -// // for (int theta = 0; theta < houghHeight; theta++) { -// // int radius = (int)(cosMap[theta] * x - sinMap[theta] * y) + halfHoughWidth; - -// // if ((radius < 0) || (radius >= houghWidth)) -// // continue; - -// // houghMap[theta, radius]++; -// // } -// // } -// // } -// // src += offset; -// // srcBelow += offset; -// // } -// // } -// //} -// #endregion -// Scanline src, srcBelow; - -// // for each row -// for (int y = startY, l = height - 1; y < stopY; y++, l--) { -// src = image.GetScanline (l - 1); -// srcBelow = image.GetScanline (l); -// // for each pixel -// for (int x = startX, i = 0; x < stopX; x++, i++) { -// // if current pixel is more black -// // and pixel below is more white -// if ((src[i] < 128) && (srcBelow[i] >= 128)) { -// // for each Theta value -// for (int theta = 0; theta < houghHeight; theta++) { -// int radius = (int)(cosMap[theta] * x - sinMap[theta] * y) + halfHoughWidth; - -// if ((radius < 0) || (radius >= houghWidth)) -// continue; - -// houghMap[theta, radius]++; -// } -// } -// } -// } - -// // find max value in Hough map -// maxMapIntensity = 0; -// for (int i = 0; i < houghHeight; i++) { -// for (int j = 0; j < houghWidth; j++) { -// if (houghMap[i, j] > maxMapIntensity) { -// maxMapIntensity = houghMap[i, j]; -// } -// } -// } - -// CollectLines ((short)(width / 10)); - -// // get skew angle -// HoughLine[] hls = this.GetMostIntensiveLines (5); - -// double skewAngle = 0; -// double sumIntensity = 0; - -// foreach (HoughLine hl in hls) { -// if (hl.RelativeIntensity > 0.5) { -// skewAngle += (hl.Theta * hl.RelativeIntensity); -// sumIntensity += hl.RelativeIntensity; -// } -// } -// if (hls.Length > 0) skewAngle = skewAngle / sumIntensity; - -// return skewAngle - 90.0; -// } - -// // Get specified amount of lines with highest intensity -// private HoughLine[] GetMostIntensiveLines (int count) { -// // lines count -// int n = Math.Min (count, lines.Count); - -// // result array -// HoughLine[] dst = new HoughLine[n]; -// lines.CopyTo (0, dst, 0, n); - -// return dst; -// } - -// // Collect lines with intesities greater or equal then specified -// private void CollectLines (short minLineIntensity) { -// int maxTheta = houghMap.GetLength (0); -// int maxRadius = houghMap.GetLength (1); - -// short intensity; -// bool foundGreater; - -// int halfHoughWidth = maxRadius >> 1; - -// // clean lines collection -// lines.Clear (); - -// // for each Theta value -// for (int theta = 0; theta < maxTheta; theta++) { -// // for each Radius value -// for (int radius = 0; radius < maxRadius; radius++) { -// // get current value -// intensity = houghMap[theta, radius]; - -// if (intensity < minLineIntensity) -// continue; - -// foundGreater = false; - -// // check neighboors -// for (int tt = theta - localPeakRadius, ttMax = theta + localPeakRadius; tt < ttMax; tt++) { -// // skip out of map values -// if (tt < 0) -// continue; -// if (tt >= maxTheta) -// break; - -// // break if it is not local maximum -// if (foundGreater == true) -// break; - -// for (int tr = radius - localPeakRadius, trMax = radius + localPeakRadius; tr < trMax; tr++) { -// // skip out of map values -// if (tr < 0) -// continue; -// if (tr >= maxRadius) -// break; - -// // compare the neighboor with current value -// if (houghMap[tt, tr] > intensity) { -// foundGreater = true; -// break; -// } -// } -// } - -// // was it local maximum ? -// if (!foundGreater) { -// // we have local maximum -// lines.Add (new HoughLine (90.0 - maxSkewToDetect + (double)theta / stepsPerDegree, (short)(radius - halfHoughWidth), intensity, (double)intensity / maxMapIntensity)); -// } -// } -// } - -// lines.Sort (); -// } - -// // Init Hough settings and map -// private void InitHoughMap () { -// if (needToInitialize) { -// needToInitialize = false; - -// houghHeight = (int)(2 * maxSkewToDetect * stepsPerDegree); -// thetaStep = (2 * maxSkewToDetect * Math.PI / 180) / houghHeight; - -// // precalculate Sine and Cosine values -// sinMap = new double[houghHeight]; -// cosMap = new double[houghHeight]; - -// double minTheta = 90.0 - maxSkewToDetect; - -// for (int i = 0; i < houghHeight; i++) { -// sinMap[i] = Math.Sin ((minTheta * Math.PI / 180) + (i * thetaStep)); -// cosMap[i] = Math.Cos ((minTheta * Math.PI / 180) + (i * thetaStep)); -// } -// } -// } -// } -//} - -/*namespace PDFPatcher.Processor -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.Data; - using System.Diagnostics; - using System.Drawing; - using System.Drawing.Imaging; - using FreeImageAPI; - - //public class main - //{ - // public static void Main () { - // string fnIn = "d:\\skewsample_in.tif"; - // string fnOut = "d:\\skewsample_out.tif"; - // Bitmap bmpIn = new Bitmap (fnIn); - // ImageDeskew sk = new ImageDeskew (bmpIn); - // double skewangle = sk.GetSkewAngle (); - // Bitmap bmpOut = RotateImage (bmpIn, -skewangle); - // bmpOut.Save (fnOut, ImageFormat.Tiff); - // Interaction.MsgBox ("Skewangle: " + skewangle); - // } - - // private static Bitmap RotateImage (Bitmap bmp, double angle) { - // Graphics g = null; - // Bitmap tmp = new Bitmap (bmp.Width, bmp.Height, PixelFormat.Format32bppRgb); - - // tmp.SetResolution (bmp.HorizontalResolution, bmp.VerticalResolution); - // g = Graphics.FromImage (tmp); - // try { - // g.FillRectangle (Brushes.White, 0, 0, bmp.Width, bmp.Height); - // g.RotateTransform ((float)angle); - // g.DrawImage (bmp, 0, 0); - // } - // finally { - // g.Dispose (); - // } - // return tmp; - // } - //} - - public class ImageDeskew - { - // Representation of a line in the image. - public class HougLine - { - // Count of points in the line. - public int Count; - // Index in Matrix. - public int Index; - // The line is represented as all x,y that solve y*cos(alpha)-x*sin(alpha)=d - public double Alpha; - public double d; - } - // The Bitmap - FreeImageBitmap cBmp; - // The range of angles to search for lines - double cAlphaStart = -20; - double cAlphaStep = 0.2; - int cSteps = 40 * 5; - // Precalculation of sin and cos. - double[] cSinA; - double[] cCosA; - // Range of d - double cDMin; - double cDStep = 1; - int cDCount; - // Count of points that fit in a line. - - int[] cHMatrix; - public static double GetSkewAngle (FreeImageBitmap bmp) { - return new ImageDeskew (bmp).GetSkewAngle (); - } - - // Calculate the skew angle of the image cBmp. - private double GetSkewAngle () { - ImageDeskew.HougLine[] hl = null; - int i = 0; - double sum = 0; - int count = 0; - - // Hough Transformation - Calc (); - // Top 20 of the detected lines in the image. - hl = GetTop (20); - // Average angle of the lines - for (i = 0; i <= 19; i++) { - sum += hl[i].Alpha; - count += 1; - } - return sum / count; - } - - // Calculate the Count lines in the image with most points. - private HougLine[] GetTop (int Count) { - HougLine[] hl = null; - int i = 0; - int j = 0; - HougLine tmp = null; - int AlphaIndex = 0; - int dIndex = 0; - - hl = new HougLine[Count + 1]; - for (i = 0; i <= Count - 1; i++) { - hl[i] = new HougLine (); - } - for (i = 0; i <= cHMatrix.Length - 1; i++) { - if (cHMatrix[i] > hl[Count - 1].Count) { - hl[Count - 1].Count = cHMatrix[i]; - hl[Count - 1].Index = i; - j = Count - 1; - while (j > 0 && hl[j].Count > hl[j - 1].Count) { - tmp = hl[j]; - hl[j] = hl[j - 1]; - hl[j - 1] = tmp; - j -= 1; - } - } - } - for (i = 0; i <= Count - 1; i++) { - dIndex = hl[i].Index / cSteps; - AlphaIndex = hl[i].Index - dIndex * cSteps; - hl[i].Alpha = GetAlpha (AlphaIndex); - hl[i].d = dIndex + cDMin; - } - return hl; - } - private ImageDeskew (FreeImageBitmap bmp) { - cBmp = bmp; - } - // Hough Transforamtion: - private void Calc () { - int x = 0; - int y = 0; - int hMin = cBmp.Height / 4; - int hMax = cBmp.Height * 3 / 4; - - Init (); - for (y = hMin; y <= hMax; y++) { - for (x = 1; x <= cBmp.Width - 2; x++) { - // Only lower edges are considered. - if (IsBlack (x, y)) { - if (!IsBlack (x, y + 1)) { - Calc (x, y); - } - } - } - } - } - // Calculate all lines through the point (x,y). - private void Calc (int x, int y) { - int alpha = 0; - double d = 0; - int dIndex = 0; - int Index = 0; - - for (alpha = 0; alpha <= cSteps - 1; alpha++) { - d = y * cCosA[alpha] - x * cSinA[alpha]; - dIndex = (int)CalcDIndex (d); - Index = dIndex * cSteps + alpha; - try { - cHMatrix[Index] += 1; - } - catch (Exception ex) { - Debug.WriteLine (ex.ToString ()); - } - } - } - private double CalcDIndex (double d) { - return Convert.ToInt32 (d - cDMin); - } - private bool IsBlack (int x, int y) { - Color c = cBmp.GetPixel (x, y); - double luminance = (c.R * 0.299) + (c.G * 0.587) + (c.B * 0.114); - return luminance < 140; - } - private void Init () { - int i = 0; - double angle = 0; - - // Precalculation of sin and cos. - cSinA = new double[cSteps]; - cCosA = new double[cSteps]; - for (i = 0; i <= cSteps - 1; i++) { - angle = GetAlpha (i) * Math.PI / 180.0; - cSinA[i] = Math.Sin (angle); - cCosA[i] = Math.Cos (angle); - } - // Range of d: - cDMin = -cBmp.Width; - cDCount = (int)(2 * (cBmp.Width + cBmp.Height) / cDStep); - cHMatrix = new int[cDCount * cSteps + 1]; - } - - private double GetAlpha (int Index) { - return cAlphaStart + Index * cAlphaStep; - } - } -} -*/ \ No newline at end of file diff --git a/pdfpatcher/App/Processor/Imaging/ImageDisposition.cs b/pdfpatcher/App/Processor/Imaging/ImageDisposition.cs deleted file mode 100644 index b7c31db180736e18ecd364f3d669c4fbdc725c58..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Imaging/ImageDisposition.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Diagnostics; -using iTextSharp.text.pdf.parser; -using PDFPatcher.Common; - -namespace PDFPatcher.Processor.Imaging -{ - [DebuggerDisplay("{Image.InlineImage}: {X}*{XScale},{Y}*{YScale};Flip={Image.VerticalFlip}")] - internal sealed class ImageDisposition : IComparable - { - public ImageInfo Image { get; set; } - public float X { get; } - public float Y { get; } - public float Z { get; } - public Matrix Ctm { get; } - public float XScale => Ctm[Matrix.I11] / Image.Width; - public float YScale => Ctm[Matrix.I22] / Image.Height; - public ImageDisposition(Matrix ctm, ImageInfo image) { - Image = image; - Ctm = ctm; - var v = new Vector(0, 0, 1).Cross(ctm); ; - X = v[0]; Y = v[1]; Z = v[2]; - image.VerticalFlip = Ctm[Matrix.I22] < 0; - } - public override string ToString() { - return String.Concat(Image.InlineImage.PdfRef != null ? Image.InlineImage.PdfRef.Number.ToText() : "内嵌图像", - ":", X, ",", Y, ",", Z); - } - - #region IComparable 成员 - - public int CompareTo(ImageDisposition other) { - return Y < other.Y ? 1 : - Y > other.Y ? -1 : - X > other.X ? 1 : - X < other.X ? -1 : 0; - } - - #endregion - } - -} diff --git a/pdfpatcher/App/Processor/Imaging/ImageInfo.cs b/pdfpatcher/App/Processor/Imaging/ImageInfo.cs deleted file mode 100644 index dc99c406055ad8e8776e73f8a48aba35ce442cc1..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Imaging/ImageInfo.cs +++ /dev/null @@ -1,486 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using FreeImageAPI; -using iTextSharp.text.pdf; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor.Imaging -{ - [DebuggerDisplay("REF = {PdfRef}({ReferenceCount}); Size = {Width} * {Height}")] - internal sealed class ImageInfo - { - public string FileName { get; set; } - public int Width { get; set; } - public int Height { get; set; } - public int BitsPerComponent { get; private set; } - public PixelFormat PixelFormat { get; private set; } - public int ReferenceCount { get; set; } - public bool VerticalFlip { get; set; } - public string ExtName { get; private set; } - public string LastDecodeError { get; private set; } - public PdfName ColorSpace { get; private set; } - public PdfName PaletteColorSpace { get; private set; } - public byte[] PaletteBytes { get; private set; } - public byte[] ICCProfile { get; private set; } - public FreeImageBitmap Mask { get; private set; } - public int PaletteEntryCount { get; private set; } - public RGBQUAD[] PaletteArray { get; private set; } - public PdfImageData InlineImage { get; private set; } - - internal ImageInfo() { } - internal ImageInfo(PdfImageData image) { - InlineImage = image; - } - internal ImageInfo(PdfIndirectReference pdfIndirect) { - InlineImage = new PdfImageData(pdfIndirect); - } - internal ImageInfo(PRStream stream) { - InlineImage = new PdfImageData(stream); - } - internal byte[] DecodeImage(ImageExtracterOptions options) { - return DecodeImage(this, options); - } - - private static byte[] DecodeImage(ImageInfo info, ImageExtracterOptions options) { - byte[] decodedBytes; - var data = info.InlineImage; - info.ExtName = Constants.FileExtensions.Dat; - - info.Width = data.TryGetInt32(PdfName.WIDTH, 0); - info.Height = data.TryGetInt32(PdfName.HEIGHT, 0); - if (info.Width < options.MinWidth || info.Height < options.MinHeight) { - if (info.InlineImage.PdfRef != null) { - Tracker.TraceMessage(String.Concat("忽略了一幅编号为 ", info.InlineImage.ToString(), ",尺寸为 ", info.Width, "*", info.Height, "的图像。")); - } - else { - Tracker.TraceMessage(String.Concat("忽略了一幅尺寸为 ", info.Width, "*", info.Height, "的内嵌图像。")); - } - return null; - } - info.BitsPerComponent = data.TryGetInt32(PdfName.BITSPERCOMPONENT, 1); - info.PixelFormat = PixelFormat.Format8bppIndexed; - var decParams = PdfHelper.GetObjectDirectOrFromContainerArray(data, PdfName.DECODEPARMS, PdfObject.DICTIONARY); - var filters = PdfHelper.GetObjectDirectOrFromContainerArray(data, PdfName.FILTER, PdfObject.NAME); - decodedBytes = DecodeStreamContent(data, filters); - var filter = filters.Count > 0 ? (filters[filters.Count - 1] as PdfName ?? PdfName.DEFAULT).ToString() : "BMP"; - var decParam = decParams.Count > 0 ? decParams[decParams.Count - 1] as PdfDictionary : null; - ExportColorspace(data.GetDirectObject(PdfName.COLORSPACE), info); - switch (filter) { - case "/DCTDecode": - case "/DCT": - info.ExtName = Constants.FileExtensions.Jpg; - goto case "JPG"; - case "/JPXDecode": - case "/JPX": - info.ExtName = Constants.FileExtensions.Jp2; - //goto case "JPG"; - goto EXIT; - case "/CCITTFaxDecode": - case "/CCF": - case "/JBIG2Decode": - info.ExtName = Constants.FileExtensions.Tif; - var k = 0; - var blackIs1 = false; - var byteAlign = false; - var endOfLine = false; - var endOfBlock = true; - if (decParam != null) { - k = decParam.TryGetInt32(PdfName.K, 0); - blackIs1 = decParam.TryGetBoolean(PdfName.BLACKIS1, false); - byteAlign = decParam.TryGetBoolean(PdfName.ENCODEDBYTEALIGN, false); - endOfBlock = decParam.TryGetBoolean(PdfName.ENDOFBLOCK, true); - endOfLine = decParam.TryGetBoolean(PdfName.ENDOFLINE, false); - } - blackIs1 = IsDecodeParamInverted(data, blackIs1); - if (options.InvertBlackAndWhiteImages) { - blackIs1 = !blackIs1; - } - byte[] outBuf; - if (filter == "/JBIG2Decode") { - var globals = new byte[0]; - if (decParam != null) { - var gRef = decParam.GetAsIndirectObject(PdfName.JBIG2GLOBALS); - if (gRef != null) { - var gs = PdfReader.GetPdfObjectRelease(gRef) as PRStream; - if (gs != null) { - globals = PdfReader.GetStreamBytes(gs); - } - } - } - outBuf = Processor.Imaging.JBig2Decoder.Decode(decodedBytes, globals); - if (outBuf == null) { - info.LastDecodeError = "导出 JBig2 编码图片失败。"; - return null; - } - if (blackIs1 == false) { - InvertBits(outBuf); - } - } - else { - outBuf = TiffHelper.Decode(info, decodedBytes, k, endOfLine, byteAlign, endOfBlock, blackIs1); - } - info.PixelFormat = PixelFormat.Format1bppIndexed; - info.BitsPerComponent = 1; - decodedBytes = outBuf; - break; - case "/FlateDecode": - case "/Fl": - case "/LZWDecode": - info.ExtName = Constants.FileExtensions.Png; - info.PixelFormat = GetPixelFormat(decodedBytes.Length, info); - if (info.PixelFormat == PixelFormat.Undefined) { - info.LastDecodeError = "无法判定图像的颜色格式。"; - info.ExtName = Constants.FileExtensions.Dat; - return null; - } - else if (info.PixelFormat == PixelFormat.Format1bppIndexed) { - blackIs1 = IsDecodeParamInverted(data, false); - if (options.InvertBlackAndWhiteImages) { - blackIs1 = !blackIs1; - } - if (blackIs1) { - InvertBits(decodedBytes); - } - } - break; - case "BMP": - info.ExtName = Constants.FileExtensions.Png; - break; - case "JPG": - if (options.MergeImages == false) { - goto EXIT; - } - using (var ms = new MemoryStream(decodedBytes)) - using (var bm = PdfName.DEVICECMYK.Equals(info.ColorSpace) - ? new FreeImageBitmap(ms, FREE_IMAGE_LOAD_FLAGS.JPEG_CMYK) - : new FreeImageBitmap(ms)) { - info.PixelFormat = bm.PixelFormat; - switch (bm.ColorType) { - case FREE_IMAGE_COLOR_TYPE.FIC_CMYK: - info.ColorSpace = PdfName.DEVICECMYK; - break; - case FREE_IMAGE_COLOR_TYPE.FIC_MINISBLACK: - case FREE_IMAGE_COLOR_TYPE.FIC_MINISWHITE: - info.ColorSpace = PdfName.DEVICEGRAY; - break; - case FREE_IMAGE_COLOR_TYPE.FIC_PALETTE: - info.ColorSpace = PdfName.INDEXED; - break; - case FREE_IMAGE_COLOR_TYPE.FIC_RGB: - case FREE_IMAGE_COLOR_TYPE.FIC_RGBALPHA: - info.ColorSpace = PdfName.DEVICERGB; - break; - default: - break; - } - info.BitsPerComponent = - info.PixelFormat == PixelFormat.Format1bppIndexed ? 1 - : info.PixelFormat == PixelFormat.Format4bppIndexed ? 4 - : 8; - } - goto EXIT; - default: - info.PixelFormat = PixelFormat.Undefined; - info.LastDecodeError = "未支持的图像数据格式:" + filter; - return null; - } - if (PdfName.DEVICECMYK.Equals(info.ColorSpace)) { - info.ExtName = Constants.FileExtensions.Tif; - } - EXIT: - PRStream sm; - if (options.ExtractSoftMask && ( - (sm = data.GetAsStream(PdfName.SMASK) as PRStream) != null - || (sm = data.GetAsStream(PdfName.MASK) as PRStream) != null) - ) { - var mi = new ImageInfo(sm); - var mask = DecodeImage(mi, new ImageExtracterOptions() { InvertBlackAndWhiteImages = !options.InvertSoftMask }); - if (mask != null) { - info.Mask = ImageExtractor.CreateFreeImageBitmap(mi, ref mask, options.VerticalFlipImages, false); - } - } - return decodedBytes; - } - - static void InvertBits(byte[] outBuf) { - int len = outBuf.Length; - for (int t = 0; t < len; ++t) { - outBuf[t] ^= 0xff; - } - } - - internal void CreatePaletteAndIccProfile(FreeImageBitmap bmp) { - if (PixelFormat == PixelFormat.Format1bppIndexed) { - ColorSpace = PdfName.DEVICEGRAY; - } - CreatePalette(bmp); - if (PaletteEntryCount > 0) { - if (PaletteEntryCount < 3) { - PixelFormat = PixelFormat.Format1bppIndexed; - bmp.ConvertColorDepth(FREE_IMAGE_COLOR_DEPTH.FICD_01_BPP); - } - else if (PaletteEntryCount < 17) { - PixelFormat = PixelFormat.Format4bppIndexed; - bmp.ConvertColorDepth(FREE_IMAGE_COLOR_DEPTH.FICD_04_BPP); - } - } - if (ICCProfile != null) { - bmp.CreateICCProfile(ICCProfile); - } - } - - void CreatePalette(FreeImageBitmap bmp) { - //if (PaletteColorSpace == null) { - // //todo++ 缺少色域信息的图片不一定是灰度图像 - // if (bmp.HasPalette) { - // PaletteColorSpace = PdfName.DEVICEGRAY; - // } - // else { - // return; - // } - //} - if (bmp.HasPalette == false) { - Trace.WriteLine("Bitmap does not have palette."); - return; - } - var pal = bmp.Palette; - if (PdfName.DEVICEGRAY.Equals(PaletteColorSpace)) { - if (PaletteBytes == null) { - pal.CreateGrayscalePalette(); - PaletteEntryCount = pal.Count; - } - else { - var pattern = PaletteBytes; - var l = pattern.Length; - var l2 = pal.Count; - int i; - byte p; - for (i = 0; i < l && i < l2; i++) { - p = pattern[i]; - pal.SetValue(new RGBQUAD(Color.FromArgb(p, p, p)), i); - } - PaletteEntryCount = i; - } - } - else { - var pattern = PaletteBytes; - if (pattern == null) { - bmp.Palette.CreateGrayscalePalette(); - return; - } - var i = 0; - var l = pattern.Length; - var l2 = pal.Count; - for (int pi = 0; pi < l && i < l2; pi++) { - pal.SetValue(new RGBQUAD(Color.FromArgb(pattern[pi++], pi < l ? pattern[pi++] : 0, pi < l ? pattern[pi] : 0)), i); - i++; - } - PaletteEntryCount = i; - } - PaletteArray = pal.AsArray; - } - - static bool IsDecodeParamInverted(PdfDictionary data, bool blackIs1) { - var a = data.GetAsArray(PdfName.DECODE); - if (a?.Size == 2 && a[0].Type == PdfObject.NUMBER) { - blackIs1 = ((PdfNumber)a[0]).IntValue == (blackIs1 ? 0 : 1); - } - return blackIs1; - } - - static byte[] DecodeStreamContent(PdfImageData data, IList filters) { - var buffer = data.RawBytes; - if (filters.Count == 0) { - return buffer; - } - var dp = new List(); - var dpo = PdfReader.GetPdfObjectRelease(data.Get(PdfName.DECODEPARMS)); - if (dpo == null || (!dpo.IsDictionary() && !dpo.IsArray())) - dpo = PdfReader.GetPdfObjectRelease(data.Get(PdfName.DP)); - if (dpo != null) { - if (dpo.IsDictionary()) - dp.Add(dpo); - else if (dpo.IsArray()) - dp = ((PdfArray)dpo).ArrayList; - } - - for (int i = 0; i < filters.Count; i++) { - var name = (filters[i] as PdfName).ToString(); - switch (name) { - case "/FlateDecode": - case "/Fl": - buffer = PdfReader.FlateDecode(buffer); - goto case "DecodePredictor"; - case "/ASCIIHexDecode": - case "/AHx": - buffer = PdfReader.ASCIIHexDecode(buffer); - break; - case "/ASCII85Decode": - case "/A85": - buffer = PdfReader.ASCII85Decode(buffer); - break; - case "/LZWDecode": - buffer = PdfReader.LZWDecode(buffer); - goto case "DecodePredictor"; - case "/Crypt": - break; - case "/DCTDecode": - case "/JPXDecode": - case "/CCITTFaxDecode": - case "/JBIG2Decode": - if (i != filters.Count - 1) { - Tracker.TraceMessage(Tracker.Category.Error, "文件格式错误:" + name + " 解码器不是最后一个解码器。"); - } - break; - case "DecodePredictor": - if (i < dp.Count) { - buffer = PdfReader.DecodePredictor(buffer, (PdfObject)dp[i]); - } - break; - default: - Trace.WriteLine(Tracker.Category.Error, "不支持的流编码格式:" + name); - break; - } - } - return buffer; - } - - static PixelFormat GetPixelFormat(int byteLength, ImageInfo info) { - var pf = PixelFormat.Undefined; - var components = byteLength / info.Width / info.Height; - switch (info.BitsPerComponent) { - case 1: pf = PixelFormat.Format1bppIndexed; break; - case 2: - pf = PixelFormat.Format1bppIndexed; - Trace.WriteLine("Warning: unsupported bpc = 2"); - break; - case 4: pf = PixelFormat.Format4bppIndexed; break; - case 8: - switch (components) { - case 0: // 兼容异常图片(github:#119) - Trace.WriteLine("Warning: Not enough bytes."); - goto case 1; - case 1: - pf = PixelFormat.Format8bppIndexed; - break; - case 2: - pf = PixelFormat.Format16bppRgb555; - break; - case 3: - pf = PixelFormat.Format24bppRgb; - break; - case 4: - pf = PixelFormat.Format32bppRgb; - break; - default: - Trace.WriteLine("Warning: Unknown colors."); - break; - } - break; - case 16: - pf = PixelFormat.Format48bppRgb; - break; - default: - Debug.WriteLine("Warning: bitsPerComponent missing or incorrect (" + info.BitsPerComponent + ")."); - if (components > 0) { - goto case 8; - } - else { - var areaPixels = (info.Width + 7) / 8 * info.Height; - switch (areaPixels / byteLength) { - case 1: pf = PixelFormat.Format1bppIndexed; info.BitsPerComponent = 1; break; - case 2: pf = PixelFormat.Format1bppIndexed; info.BitsPerComponent = 2; break; - case 4: pf = PixelFormat.Format4bppIndexed; info.BitsPerComponent = 4; break; - default: pf = PixelFormat.Format8bppIndexed; info.BitsPerComponent = 8; break; - } - } - break; - } - return pf; - } - - static void ExportColorspace(PdfObject cs, ImageInfo info) { - if (cs == null) { - return; - } - info.ColorSpace = cs as PdfName; - if (info.ColorSpace != null) { - return; - } - - if (cs.Type != PdfObject.ARRAY) { - return; - } - - var colorspace = cs as PdfArray; - // todo: 是否需要将所有 ColorSpace 换成 PaletteColorSpace - if (PdfName.ICCBASED.Equals(colorspace.GetAsName(0))) { - var iccs = colorspace.GetDirectObject(1) as PRStream; - info.ColorSpace = iccs.GetAsName(PdfName.ALTERNATE); - return; - } - if (PdfName.INDEXED.Equals(colorspace.GetAsName(0))) { - var o = colorspace.GetDirectObject(1); - info.PaletteColorSpace = o as PdfName; - if (info.PaletteColorSpace == null && o is PdfArray arr && arr.Size == 2) { - if (PdfName.ICCBASED.Equals(arr.GetAsName(0)) && arr.Size == 2) { - var iccs = arr.GetDirectObject(1) as PRStream; - info.ColorSpace = iccs.GetAsName(PdfName.ALTERNATE) ?? PdfName.DEVICERGB; - info.ICCProfile = PdfReader.GetStreamBytes(iccs); - } - else { - info.ColorSpace = arr.GetAsName(0); - //Tracker.TraceMessage (String.Concat ("不支持此图片的色域:", info.ColorSpace)); - } - } - var csp = colorspace.GetDirectObject(3); - if (csp.IsString()) { - info.PaletteBytes = ((PdfString)csp).GetOriginalBytes(); - } - else if (csp is PRStream s) { - info.PaletteBytes = PdfReader.GetStreamBytes(s); - } - //} - } - } - - internal void ConvertDecodedBytes(ref byte[] bytes) { - if (PixelFormat == PixelFormat.Format24bppRgb) { - // from RGB array to BGR GDI+ data - byte b; - for (int i = 0; i < bytes.Length; i += 3) { - b = bytes[i]; - bytes[i] = bytes[i + 2]; - bytes[i + 2] = b; - } - } - else if (PixelFormat == PixelFormat.Format1bppIndexed && BitsPerComponent == 2) { - // 支持四级灰度的图像 - var l = bytes.Length; - var newBytes = new byte[l << 1]; - var i = 0; - foreach (var b in bytes) { - newBytes[i++] = (byte)(((b & 0xC0) >> 0x02) + ((b & 0x30) >> 0x04)); - newBytes[i++] = (byte)(((b & 0x0C) << 0x02) + (b & 0x03)); - } - if (PaletteBytes != null) { - var pattern = PaletteBytes; - Array.Resize(ref pattern, 16 * 3); - PaletteBytes = pattern; - } - PixelFormat = PixelFormat.Format4bppIndexed; - BitsPerComponent = 4; - ColorSpace = PdfName.DEVICEGRAY; - bytes = newBytes; - } - } - - - } - - -} diff --git a/pdfpatcher/App/Processor/Imaging/JBig2Decoder.cs b/pdfpatcher/App/Processor/Imaging/JBig2Decoder.cs deleted file mode 100644 index 0c2e149ed2b94b81dfbc533543e9eab535d8b283..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Imaging/JBig2Decoder.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace PDFPatcher.Processor.Imaging -{ - internal static class JBig2Decoder - { - internal const string DLL = "jbig2.dll"; - const int JBIG2_OPTIONS_EMBEDDED = 1; - - internal static byte[] Decode(byte[] data, byte[] globals) { - IntPtr ctxptr = IntPtr.Zero, globalptr = IntPtr.Zero; - IntPtr imageptr; - byte[] decodedData = null; - int c; - - try { - ctxptr = NativeMethods.New(IntPtr.Zero); - if (globals != null && globals.Length > 0) { - c = NativeMethods.ReadData(ctxptr, globals, (uint)globals.Length); - globalptr = NativeMethods.MakeGlobal(ctxptr); - ctxptr = NativeMethods.New(globalptr); - } - c = NativeMethods.ReadData(ctxptr, data, (uint)data.Length); - c = NativeMethods.CompletePage(ctxptr); - if ((imageptr = NativeMethods.Decode(ctxptr)) != IntPtr.Zero) { - var image = Common.PInvokeHelper.Unwrap(imageptr); - decodedData = image.GetData(); - NativeMethods.ReleasePage(ctxptr, imageptr); - } - return decodedData; - } - finally { - if (globalptr != IntPtr.Zero) { - NativeMethods.Free(globalptr); - } - if (ctxptr != IntPtr.Zero) { - NativeMethods.Free(ctxptr); - } - } - } - - static class NativeMethods - { - internal static IntPtr New(IntPtr globalCtx) { - return New(IntPtr.Zero, JBIG2_OPTIONS_EMBEDDED, globalCtx, null, IntPtr.Zero, 0, 19); - } - [DllImport(DLL, EntryPoint = "jbig2_ctx_new_imp", CallingConvention = CallingConvention.Cdecl)] - extern static IntPtr New(IntPtr allocator, int options, IntPtr globalCtx, Jbig2ErrorCallback error_callback, IntPtr error_callback_data, int major, int minor); - - [DllImport(DLL, EntryPoint = "jbig2_ctx_free", CallingConvention = CallingConvention.Cdecl)] - internal extern static IntPtr Free(IntPtr ctx); - - [DllImport(DLL, EntryPoint = "jbig2_complete_page", CallingConvention = CallingConvention.Cdecl)] - internal extern static int CompletePage(IntPtr ctx); - - [DllImport(DLL, EntryPoint = "jbig2_data_in", CallingConvention = CallingConvention.Cdecl)] - internal extern static int ReadData(IntPtr ctx, [InAttribute()] byte[] bytes, uint length); - - [DllImport(DLL, EntryPoint = "jbig2_make_global_ctx", CallingConvention = CallingConvention.Cdecl)] - internal extern static IntPtr MakeGlobal(IntPtr ctx); - - [DllImport(DLL, EntryPoint = "jbig2_page_out", CallingConvention = CallingConvention.Cdecl)] - internal extern static IntPtr Decode(IntPtr ctx); - - [DllImport(DLL, EntryPoint = "jbig2_release_page", CallingConvention = CallingConvention.Cdecl)] - internal extern static void ReleasePage(IntPtr ctx, IntPtr image); - - static int ErrorCallback(IntPtr data, [InAttribute()] string msg, Jbig2Severity severity, int seg_idx) { - System.Diagnostics.Debug.WriteLine(msg); - return 0; - } - } - - } -} diff --git a/pdfpatcher/App/Processor/Imaging/JBig2Encoder.cs b/pdfpatcher/App/Processor/Imaging/JBig2Encoder.cs deleted file mode 100644 index e5ff4c9f4a8a8cecac0e137efa42ef2a9135b64d..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Imaging/JBig2Encoder.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using FreeImageAPI; - -namespace PDFPatcher.Processor.Imaging -{ - static class JBig2Encoder - { - const uint White = 0x00FFFFFF; - - internal static byte[] Encode(FreeImageBitmap fi) { - bool zeroIsWhite = fi.HasPalette && fi.Palette.Data[0].uintValue == White; - using (var bmp = fi.ToBitmap()) { - var bits = bmp.LockBits(new System.Drawing.Rectangle(0, 0, bmp.Width, bmp.Height), System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format1bppIndexed); - var bytes = Encode(bmp.Width, bmp.Height, bits.Stride, zeroIsWhite, bits.Scan0); - bmp.UnlockBits(bits); - return bytes; - } - } - - static byte[] Encode(int width, int height, int stride, bool zeroIsWhite, IntPtr b) { - int l = 0; - var r = NativeMethods.Encode(width, height, stride, zeroIsWhite, b, ref l); - var result = new byte[l]; - Marshal.Copy(r, result, 0, l); - NativeMethods.Release(r); - return result; - } - - static class NativeMethods - { - [DllImport(JBig2Decoder.DLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "jbig2_encode")] - internal static extern IntPtr Encode(int width, int height, int stride, bool zeroIsWhite, IntPtr data, ref int length); - - [DllImport(JBig2Decoder.DLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "jbig2_freemem")] - internal static extern IntPtr Release(IntPtr data); - } - } -} diff --git a/pdfpatcher/App/Processor/Imaging/JBig2Structs.cs b/pdfpatcher/App/Processor/Imaging/JBig2Structs.cs deleted file mode 100644 index fd965dfdefd3ba5dc51973f51f0f2be6b73b2fa7..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Imaging/JBig2Structs.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace PDFPatcher.Processor.Imaging -{ - [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi, ThrowOnUnmappableChar = false)] - public delegate int Jbig2ErrorCallback(System.IntPtr data, [InAttribute()][MarshalAsAttribute(UnmanagedType.LPStr)] string msg, Jbig2Severity severity, int seg_idx); - - public enum Jbig2Severity - { - JBIG2_SEVERITY_DEBUG, - JBIG2_SEVERITY_INFO, - JBIG2_SEVERITY_WARNING, - JBIG2_SEVERITY_FATAL, - } - - [StructLayout(LayoutKind.Sequential)] - internal sealed class JBig2Ctx - { - readonly IntPtr /*Jbig2Allocator **/allocator; - readonly int options; - readonly IntPtr /*const Jbig2Ctx **/global_ctx; - readonly Jbig2ErrorCallback error_callback; - readonly IntPtr /*void **/error_callback_data; - readonly IntPtr /*byte **/buf; - readonly int buf_size; - readonly int buf_rd_ix; - readonly int buf_wr_ix; - readonly int/*Jbig2FileState*/ state; - readonly byte file_header_flags; - readonly int n_pages; - readonly int n_segments_max; - readonly IntPtr /*Jbig2Segment ***/segments; - readonly int n_segments; /* index of last segment header parsed */ - readonly int segment_index; /* index of last segment body parsed */ - - /* list of decoded pages, including the one in progress, - currently stored as a contiguous, 0-indexed array. */ - readonly int current_page; - readonly int max_page_index; - readonly IntPtr /*Jbig2Page **/pages; - } - - [StructLayout(LayoutKind.Sequential)] - internal sealed class JBig2Image - { - readonly int Width; - readonly int Height; - readonly int Stride; - readonly IntPtr Data; - readonly int RefCount; - public byte[] GetData() { - var result = new byte[Height * Stride]; - Marshal.Copy(Data, result, 0, result.Length); - return result; - } - } -} diff --git a/pdfpatcher/App/Processor/Imaging/JpgHelper.cs b/pdfpatcher/App/Processor/Imaging/JpgHelper.cs deleted file mode 100644 index ae8e1177b616e37c27d8d1292ad68a7d350a12cc..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Imaging/JpgHelper.cs +++ /dev/null @@ -1,943 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing.Imaging; -using System.Globalization; -using System.IO; -using System.Text.RegularExpressions; - -namespace PDFPatcher.Processor.Imaging -{ - static class JpgHelper - { - static readonly ImageCodecInfo _jpgCodec = BitmapHelper.GetCodec("image/jpeg"); - static EncoderParameters GetEncoderParameters(int quality) { - return new EncoderParameters(2) { - Param = new EncoderParameter[] { - new EncoderParameter (Encoder.Compression, (long)EncoderValue.RenderProgressive), - new EncoderParameter (Encoder.Quality, quality) - } - }; - } - // JPEG 编码器不支持 8 位图像输出 - static EncoderParameters GetEncoderParameters(int quality, int colorDepth) { - return new EncoderParameters(3) { - Param = new EncoderParameter[] { - new EncoderParameter (Encoder.Compression, (long)EncoderValue.RenderProgressive), - new EncoderParameter (Encoder.Quality, quality), - new EncoderParameter (Encoder.ColorDepth, colorDepth) - } - }; - } - - internal static void Save(this System.Drawing.Image bmp, string fileName, int quality) { - //if (bmp.IsIndexed ()) { - // bmp.Save (fileName, _jpgCodec, GetEncoderParameters (quality, 8)); - //} - //else { - using (var p = GetEncoderParameters(quality)) { - bmp.Save(fileName, _jpgCodec, p); - foreach (var item in p.Param) { - item.Dispose(); - } - } - //} - } - - internal static void Save(this System.Drawing.Image bmp, Stream stream, int quality) { - using (var p = GetEncoderParameters(quality)) { - bmp.Save(stream, _jpgCodec, p); - foreach (var item in p.Param) { - item.Dispose(); - } - } - } - - internal static bool TryGetExifOrientation(string fileName, out ushort b) { - try { - using (var r = new ExifReader(fileName)) { - return r.GetTagValue(ExifTags.Orientation, out b); - } - } - catch (Exception) { - b = 0; - return false; - } - } - - /// - /// A class for reading Exif data from a JPEG file. The file will be open for reading for as long as the class exists. - /// - /// - sealed class ExifReader : IDisposable - { - private static readonly Regex _nullDateTimeMatcher = new Regex(@"^[\s0]{4}[:\s][\s0]{2}[:\s][\s0]{5}[:\s][\s0]{2}[:\s][\s0]{2}$"); - - private readonly bool _leaveOpen; - private Stream _stream; - private BinaryReader _reader; - - /// - /// The main tag id/absolute file offset catalogue - /// - private Dictionary _ifd0Catalogue; - - /// - /// The thumbnail tag id/absolute file offset catalogue - /// - /// JPEG images contain 2 main sections - one for the main image (which contains most of the useful EXIF data), and one for the thumbnail - /// image (which contains little more than the thumbnail itself). This catalogue is only used by . - private Dictionary _ifd1Catalogue; - - /// - /// Indicates whether to read data using big or little endian byte aligns - /// - private bool _isLittleEndian; - - /// - /// The position in the filestream at which the TIFF header starts - /// - private long _tiffHeaderStart; - - /// - /// The location of the thumbnail IFD - /// - private uint _ifd1Offset; - - private bool _isInitialized; - - public ExifReader(string fileName) - : this(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { } - - public ExifReader(Stream stream) - : this(stream, false) { } - - public ExifReader(Stream stream, bool leaveOpen) { - if (stream == null) - throw new ArgumentNullException("stream"); - - if (!stream.CanSeek) - throw new ExifLibException("ExifLib requires a seekable stream"); - - // Leave the stream open if the user wants it so - _leaveOpen = leaveOpen; - _stream = stream; - } - - private void Initialize() { - if (_isInitialized) - return; - - _isInitialized = true; - - // JPEG encoding uses big endian (i.e. Motorola) byte aligns. The TIFF encoding - // found later in the document will specify the byte aligns used for the - // rest of the document. - _isLittleEndian = false; - - // Open the file in a stream - _reader = new BinaryReader(_stream, System.Text.Encoding.UTF8); - - // Make sure the file's a JPEG. - if (ReadUShort() != 0xFFD8) - throw new ExifLibException("File is not a valid JPEG"); - - // Scan to the start of the Exif content - ReadToExifStart(); - - // Create an index of all Exif tags found within the document - CreateTagIndex(); - } - - #region TIFF methods - - /// - /// Returns the length (in bytes) per component of the specified TIFF data type - /// - /// - private static byte GetTIFFFieldLength(ushort tiffDataType) { - return tiffDataType switch { - 1 or 2 or 7 or 6 => 1, - 3 or 8 => 2, - 4 or 9 or 11 => 4, - 5 or 10 or 12 => 8, - _ => throw new ExifLibException(string.Format("Unknown TIFF datatype: {0}", tiffDataType)), - }; - } - - #endregion - - #region Methods for reading data directly from the filestream - - /// - /// Gets a 2 byte unsigned integer from the file - /// - /// - private ushort ReadUShort() { - return ToUShort(ReadBytes(2)); - } - - /// - /// Gets a 4 byte unsigned integer from the file - /// - /// - private uint ReadUint() { - return ToUint(ReadBytes(4)); - } - - private string ReadString(int chars) { - var bytes = ReadBytes(chars); - return System.Text.Encoding.UTF8.GetString(bytes, 0, bytes.Length); - } - - private byte[] ReadBytes(int byteCount) { - return _reader.ReadBytes(byteCount); - } - - /// - /// Reads some bytes from the specified TIFF offset - /// - /// - /// - /// - private byte[] ReadBytes(ushort tiffOffset, int byteCount) { - // Keep the current file offset - var originalOffset = _stream.Position; - - // Move to the TIFF offset and retrieve the data - _stream.Seek(tiffOffset + _tiffHeaderStart, SeekOrigin.Begin); - - var data = _reader.ReadBytes(byteCount); - - // Restore the file offset - _stream.Position = originalOffset; - - return data; - } - - #endregion - - #region Data conversion methods for interpreting datatypes from a byte array - - /// - /// Converts 2 bytes to a ushort using the current byte aligns - /// - /// - private ushort ToUShort(byte[] data) { - if (_isLittleEndian != BitConverter.IsLittleEndian) - Array.Reverse(data); - - return BitConverter.ToUInt16(data, 0); - } - - /// - /// Converts 8 bytes to the numerator and denominator - /// components of an unsigned rational using the current byte aligns - /// - private uint[] ToURationalFraction(byte[] data) { - var numeratorData = new byte[4]; - var denominatorData = new byte[4]; - - Array.Copy(data, numeratorData, 4); - Array.Copy(data, 4, denominatorData, 0, 4); - - var numerator = ToUint(numeratorData); - var denominator = ToUint(denominatorData); - - return new[] { numerator, denominator }; - } - - - /// - /// Converts 8 bytes to an unsigned rational using the current byte aligns - /// - /// - private double ToURational(byte[] data) { - var fraction = ToURationalFraction(data); - - return fraction[0] / (double)fraction[1]; - } - - /// - /// Converts 8 bytes to the numerator and denominator - /// components of an unsigned rational using the current byte aligns - /// - /// - /// A TIFF rational contains 2 4-byte integers, the first of which is - /// the numerator, and the second of which is the denominator. - /// - private int[] ToRationalFraction(byte[] data) { - var numeratorData = new byte[4]; - var denominatorData = new byte[4]; - - Array.Copy(data, numeratorData, 4); - Array.Copy(data, 4, denominatorData, 0, 4); - - int numerator = ToInt(numeratorData); - int denominator = ToInt(denominatorData); - - return new[] { numerator, denominator }; - } - - /// - /// Converts 8 bytes to a signed rational using the current byte aligns. - /// - /// - private double ToRational(byte[] data) { - var fraction = ToRationalFraction(data); - - return fraction[0] / (double)fraction[1]; - } - - /// - /// Converts 4 bytes to a uint using the current byte aligns - /// - private uint ToUint(byte[] data) { - if (_isLittleEndian != BitConverter.IsLittleEndian) - Array.Reverse(data); - - return BitConverter.ToUInt32(data, 0); - } - - /// - /// Converts 4 bytes to an int using the current byte aligns - /// - private int ToInt(byte[] data) { - if (_isLittleEndian != BitConverter.IsLittleEndian) - Array.Reverse(data); - - return BitConverter.ToInt32(data, 0); - } - - private double ToDouble(byte[] data) { - if (_isLittleEndian != BitConverter.IsLittleEndian) - Array.Reverse(data); - - return BitConverter.ToDouble(data, 0); - } - - private float ToSingle(byte[] data) { - if (_isLittleEndian != BitConverter.IsLittleEndian) - Array.Reverse(data); - - return BitConverter.ToSingle(data, 0); - } - - private short ToShort(byte[] data) { - if (_isLittleEndian != BitConverter.IsLittleEndian) - Array.Reverse(data); - - return BitConverter.ToInt16(data, 0); - } - - private sbyte ToSByte(byte[] data) { - // An sbyte should just be a byte with an offset range. - return (sbyte)(data[0] - byte.MaxValue); - } - - /// - /// Retrieves an array from a byte array using the supplied converter - /// to read each individual element from the supplied byte array - /// - /// - /// - /// - /// - private static Array GetArray(byte[] data, int elementLengthBytes, ConverterMethod converter) { - Array convertedData = new T[data.Length / elementLengthBytes]; - - var buffer = new byte[elementLengthBytes]; - - // Read each element from the array - for (int elementCount = 0; elementCount < data.Length / elementLengthBytes; elementCount++) { - // Place the data for the current element into the buffer - Array.Copy(data, elementCount * elementLengthBytes, buffer, 0, elementLengthBytes); - - // Process the data and place it into the output array - convertedData.SetValue(converter(buffer), elementCount); - } - - return convertedData; - } - - /// - /// A delegate used to invoke any of the data conversion methods - /// - /// - /// - /// Although this could be defined as covariant, it wouldn't work on Windows Phone - private delegate T ConverterMethod(byte[] data); - - #endregion - - #region Stream seek methods - used to get to locations within the JPEG - - /// - /// Scans to the Exif block - /// - private void ReadToExifStart() { - // The file has a number of blocks (Exif/JFIF), each of which - // has a tag number followed by a length. We scan the document until the required tag (0xFFE1) - // is found. All tags start with FF, so a non FF tag indicates an error. - - // Get the next tag. - byte markerStart; - byte markerNumber = 0; - while (((markerStart = _reader.ReadByte()) == 0xFF) && (markerNumber = _reader.ReadByte()) != 0xE1) { - // Get the length of the data. - ushort dataLength = ReadUShort(); - - // Jump to the end of the data (note that the size field includes its own size)! - _stream.Seek(dataLength - 2, SeekOrigin.Current); - } - - // It's only success if we found the 0xFFE1 marker - if (markerStart != 0xFF || markerNumber != 0xE1) - throw new ExifLibException("Could not find Exif data block"); - } - - /// - /// Reads through the Exif data and builds an index of all Exif tags in the document - /// - /// - private void CreateTagIndex() { - // The next 4 bytes are the size of the Exif data. - ReadUShort(); - - // Next is the Exif data itself. It starts with the ASCII "Exif" followed by 2 zero bytes. - if (ReadString(4) != "Exif") - throw new ExifLibException("Exif data not found"); - - // 2 zero bytes - if (ReadUShort() != 0) - throw new ExifLibException("Malformed Exif data"); - - // We're now into the TIFF format - _tiffHeaderStart = _stream.Position; - - // What byte align will be used for the TIFF part of the document? II for Intel, MM for Motorola - _isLittleEndian = ReadString(2) == "II"; - - // Next 2 bytes are always the same. - if (ReadUShort() != 0x002A) - throw new ExifLibException("Error in TIFF data"); - - // Get the offset to the IFD (image file directory) - var ifdOffset = ReadUint(); - - // Note that this offset is from the first byte of the TIFF header. Jump to the IFD. - _stream.Position = ifdOffset + _tiffHeaderStart; - - // Catalogue this first IFD (there will be another IFD) - _ifd0Catalogue = new Dictionary(); - CatalogueIFD(ref _ifd0Catalogue); - - // The address to the IFD1 (the thumbnail IFD) is located immediately after the main IFD - _ifd1Offset = ReadUint(); - - // There's more data stored in the subifd, the offset to which is found in tag 0x8769. - // As with all TIFF offsets, it will be relative to the first byte of the TIFF header. - uint offset; - if (!GetTagValue(_ifd0Catalogue, 0x8769, out offset)) - throw new ExifLibException("Unable to locate Exif data"); - - // Jump to the exif SubIFD - _stream.Position = offset + _tiffHeaderStart; - - // Add the subIFD to the catalogue too - CatalogueIFD(ref _ifd0Catalogue); - - // Go to the GPS IFD and catalogue that too. It's an optional - // section. - if (GetTagValue(_ifd0Catalogue, 0x8825, out offset)) { - // Jump to the GPS SubIFD - _stream.Position = offset + _tiffHeaderStart; - - // Add the subIFD to the catalogue too - CatalogueIFD(ref _ifd0Catalogue); - } - - // Finally, catalogue the thumbnail IFD if it's present - if (_ifd1Offset != 0) { - _stream.Position = _ifd1Offset + _tiffHeaderStart; - _ifd1Catalogue = new Dictionary(); - CatalogueIFD(ref _ifd1Catalogue); - } - } - #endregion - - #region Exif data catalog and retrieval methods - - public bool GetTagValue(ExifTags tag, out T result) { - return GetTagValue((ushort)tag, out result); - } - - public bool GetTagValue(ushort tagId, out T result) { - // All useful EXIF tags are stored in the ifd0 catalogue. The ifd1 catalogue is only for thumbnail retrieval. - Initialize(); - return GetTagValue(_ifd0Catalogue, tagId, out result); - } - - /// - /// Retrieves an Exif value with the requested tag ID - /// - private bool GetTagValue(IDictionary tagDictionary, ushort tagId, out T result) { - ushort tiffDataType; - uint numberOfComponents; - var tagData = GetTagBytes(tagDictionary, tagId, out tiffDataType, out numberOfComponents); - - if (tagData == null) { - result = default(T); - return false; - } - - var fieldLength = GetTIFFFieldLength(tiffDataType); - - // Convert the data to the appropriate datatype. Note the weird boxing via object. - // The compiler doesn't like it otherwise. - switch (tiffDataType) { - case 1: - // unsigned byte - if (numberOfComponents == 1) - result = (T)(object)tagData[0]; - else - result = (T)(object)tagData; - return true; - case 2: - // ascii string - var str = System.Text.Encoding.UTF8.GetString(tagData, 0, tagData.Length); - - // There may be a null character within the string - var nullCharIndex = str.IndexOf('\0'); - if (nullCharIndex != -1) - str = str.Substring(0, nullCharIndex); - - // Special processing for dates. - if (typeof(T) == typeof(DateTime)) { - DateTime dateResult; - var success = ToDateTime(str, out dateResult); - - result = (T)(object)dateResult; - return success; - - } - - result = (T)(object)str; - return true; - case 3: - // unsigned short - if (numberOfComponents == 1) - result = (T)(object)ToUShort(tagData); - else - result = (T)(object)GetArray(tagData, fieldLength, ToUShort); - return true; - case 4: - // unsigned long - if (numberOfComponents == 1) - result = (T)(object)ToUint(tagData); - else - result = (T)(object)GetArray(tagData, fieldLength, ToUint); - return true; - case 5: - // unsigned rational - if (numberOfComponents == 1) { - // Special case - sometimes it's useful to retrieve the numerator and - // denominator in their raw format - if (typeof(T).IsArray) - result = (T)(object)ToURationalFraction(tagData); - else - result = (T)(object)ToURational(tagData); - } - else - result = (T)(object)GetArray(tagData, fieldLength, ToURational); - return true; - case 6: - // signed byte - if (numberOfComponents == 1) - result = (T)(object)ToSByte(tagData); - else - result = (T)(object)GetArray(tagData, fieldLength, ToSByte); - return true; - case 7: - // undefined. Treat it as a byte. - if (numberOfComponents == 1) - result = (T)(object)tagData[0]; - else - result = (T)(object)tagData; - return true; - case 8: - // Signed short - if (numberOfComponents == 1) - result = (T)(object)ToShort(tagData); - else - result = (T)(object)GetArray(tagData, fieldLength, ToShort); - return true; - case 9: - // Signed long - if (numberOfComponents == 1) - result = (T)(object)ToInt(tagData); - else - result = (T)(object)GetArray(tagData, fieldLength, ToInt); - return true; - case 10: - // signed rational - if (numberOfComponents == 1) { - // Special case - sometimes it's useful to retrieve the numerator and - // denominator in their raw format - if (typeof(T).IsArray) - result = (T)(object)ToRationalFraction(tagData); - else - result = (T)(object)ToRational(tagData); - } - else - result = (T)(object)GetArray(tagData, fieldLength, ToRational); - return true; - case 11: - // single float - if (numberOfComponents == 1) - result = (T)(object)ToSingle(tagData); - else - result = (T)(object)GetArray(tagData, fieldLength, ToSingle); - return true; - case 12: - // double float - if (numberOfComponents == 1) - result = (T)(object)ToDouble(tagData); - else - result = (T)(object)GetArray(tagData, fieldLength, ToDouble); - return true; - default: - throw new ExifLibException(string.Format("Unknown TIFF datatype: {0}", tiffDataType)); - } - } - - private static bool ToDateTime(string str, out DateTime result) { - // From page 28 of the Exif 2.2 spec (http://www.exif.org/Exif2-2.PDF): - - // "When the field is left blank, it is treated as unknown ... When the date and time are unknown, - // all the character spaces except colons (":") may be filled with blank characters" - if (string.IsNullOrEmpty(str) || _nullDateTimeMatcher.IsMatch(str)) { - result = DateTime.MinValue; - return false; - } - - // There are 2 types of date - full date/time stamps, and plain dates. Dates are 10 characters long. - if (str.Length == 10) { - result = DateTime.ParseExact(str, "yyyy:MM:dd", CultureInfo.InvariantCulture); - return true; - } - - // "The format is "YYYY:MM:DD HH:MM:SS" with time shown in 24-hour format, and the date and time separated by one blank character [20.H]. - result = DateTime.ParseExact(str, "yyyy:MM:dd HH:mm:ss", CultureInfo.InvariantCulture); - return true; - } - - /// - /// Gets the data in the specified tag ID, starting from before the IFD block. - /// - /// - /// The number of items which make up the data item - i.e. for a string, this will be the - /// number of characters in the string - /// - /// - private byte[] GetTagBytes(IDictionary tagDictionary, ushort tagId, out ushort tiffDataType, out uint numberOfComponents) { - // Get the tag's offset from the catalogue and do some basic error checks - if (_stream == null || _reader == null || tagDictionary == null || !tagDictionary.ContainsKey(tagId)) { - tiffDataType = 0; - numberOfComponents = 0; - return null; - } - - var tagOffset = tagDictionary[tagId]; - - // Jump to the TIFF offset - _stream.Position = tagOffset; - - // Read the tag number from the file - var currentTagId = ReadUShort(); - - if (currentTagId != tagId) - throw new ExifLibException("Tag number not at expected offset"); - - // Read the offset to the Exif IFD - tiffDataType = ReadUShort(); - numberOfComponents = ReadUint(); - var tagData = ReadBytes(4); - - // If the total space taken up by the field is longer than the - // 2 bytes afforded by the tagData, tagData will contain an offset - // to the actual data. - var dataSize = (int)(numberOfComponents * GetTIFFFieldLength(tiffDataType)); - - if (dataSize > 4) { - var offsetAddress = ToUShort(tagData); - return ReadBytes(offsetAddress, dataSize); - } - - // The value is stored in the tagData starting from the left - Array.Resize(ref tagData, dataSize); - - return tagData; - } - - /// - /// Records all Exif tags and their offsets within - /// the file from the current IFD - /// - private void CatalogueIFD(ref Dictionary tagOffsets) { - // Assume we're just before the IFD. - - // First 2 bytes is the number of entries in this IFD - var entryCount = ReadUShort(); - - for (ushort currentEntry = 0; currentEntry < entryCount; currentEntry++) { - var currentTagNumber = ReadUShort(); - - // Record this in the catalogue - tagOffsets[currentTagNumber] = _stream.Position - 2; - - // Go to the end of this item (10 bytes, as each entry is 12 bytes long) - _stream.Seek(10, SeekOrigin.Current); - } - } - - #endregion - - #region Thumbnail retrieval - /// - /// Retrieves a JPEG thumbnail from the image if one is present. Note that this method cannot retrieve thumbnails encoded in other formats, - /// but since the DCF specification specifies that thumbnails must be JPEG, this method will be sufficient for most purposes - /// See http://gvsoft.homedns.org/exif/exif-explanation.html#TIFFThumbs or http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf for - /// details on the encoding of TIFF thumbnails - /// - /// - public byte[] GetJpegThumbnailBytes() { - Initialize(); - - if (_ifd1Catalogue == null) - return null; - - // Get the thumbnail encoding - ushort compression; - if (!GetTagValue(_ifd1Catalogue, (ushort)ExifTags.Compression, out compression)) - return null; - - // This method only handles JPEG thumbnails (compression type 6) - if (compression != 6) - return null; - - // Get the location of the thumbnail - uint offset; - if (!GetTagValue(_ifd1Catalogue, (ushort)ExifTags.JPEGInterchangeFormat, out offset)) - return null; - - // Get the length of the thumbnail data - uint length; - if (!GetTagValue(_ifd1Catalogue, (ushort)ExifTags.JPEGInterchangeFormatLength, out length)) - return null; - - _stream.Position = offset; - - // The thumbnail may be padded, so we scan forward until we reach the JPEG header (0xFFD8) or the end of the file - int currentByte; - var previousByte = -1; - while ((currentByte = _stream.ReadByte()) != -1) { - if (previousByte == 0xFF && currentByte == 0xD8) - break; - - previousByte = currentByte; - - } - - if (currentByte != 0xD8) - return null; - - // Step back to the start of the JPEG header - _stream.Position -= 2; - - var imageBytes = new byte[length]; - _stream.Read(imageBytes, 0, (int)length); - - // A valid JPEG stream ends with 0xFFD9. The stream may be padded at the end with multiple 0xFF bytes. - var jpegStreamEnd = (int)length - 1; - while (jpegStreamEnd > 0 && imageBytes[jpegStreamEnd] == 0xFF) - jpegStreamEnd--; - - if (jpegStreamEnd <= 0 || imageBytes[jpegStreamEnd] != 0xD9 || imageBytes[jpegStreamEnd - 1] != 0xFF) - return null; - - return imageBytes; - } - #endregion - - #region IDisposable Members - - ~ExifReader() { - Dispose(false); - } - - private void Dispose(bool disposing) { - if (disposing) { - if (_reader != null) - _reader.Dispose(); - - if (!_leaveOpen) { - // Make sure the file handle is released - _stream?.Dispose(); - } - } - _reader = null; - _stream = null; - } - - public void Dispose() { - Dispose(true); - GC.SuppressFinalize(this); - } - - #endregion - } - - sealed class ExifLibException : Exception - { - public ExifLibException() { - } - - public ExifLibException(string message) - : base(message) { - } - - public ExifLibException(string message, Exception innerException) - : base(message, innerException) { - } - } - - /// - /// All exif tags as per the Exif standard 2.2, JEITA CP-2451 - /// - public enum ExifTags : ushort - { - // IFD0 items - ImageWidth = 0x100, - ImageLength = 0x101, - BitsPerSample = 0x102, - Compression = 0x103, - PhotometricInterpretation = 0x106, - ImageDescription = 0x10E, - Make = 0x10F, - Model = 0x110, - StripOffsets = 0x111, - Orientation = 0x112, - SamplesPerPixel = 0x115, - RowsPerStrip = 0x116, - StripByteCounts = 0x117, - XResolution = 0x11A, - YResolution = 0x11B, - PlanarConfiguration = 0x11C, - ResolutionUnit = 0x128, - TransferFunction = 0x12D, - Software = 0x131, - DateTime = 0x132, - Artist = 0x13B, - WhitePoint = 0x13E, - PrimaryChromaticities = 0x13F, - JPEGInterchangeFormat = 0x201, - JPEGInterchangeFormatLength = 0x202, - YCbCrCoefficients = 0x211, - YCbCrSubSampling = 0x212, - YCbCrPositioning = 0x213, - ReferenceBlackWhite = 0x214, - Copyright = 0x8298, - - // SubIFD items - ExposureTime = 0x829A, - FNumber = 0x829D, - ExposureProgram = 0x8822, - SpectralSensitivity = 0x8824, - ISOSpeedRatings = 0x8827, - OECF = 0x8828, - ExifVersion = 0x9000, - DateTimeOriginal = 0x9003, - DateTimeDigitized = 0x9004, - ComponentsConfiguration = 0x9101, - CompressedBitsPerPixel = 0x9102, - ShutterSpeedValue = 0x9201, - ApertureValue = 0x9202, - BrightnessValue = 0x9203, - ExposureBiasValue = 0x9204, - MaxApertureValue = 0x9205, - SubjectDistance = 0x9206, - MeteringMode = 0x9207, - LightSource = 0x9208, - Flash = 0x9209, - FocalLength = 0x920A, - SubjectArea = 0x9214, - MakerNote = 0x927C, - UserComment = 0x9286, - SubsecTime = 0x9290, - SubsecTimeOriginal = 0x9291, - SubsecTimeDigitized = 0x9292, - FlashpixVersion = 0xA000, - ColorSpace = 0xA001, - PixelXDimension = 0xA002, - PixelYDimension = 0xA003, - RelatedSoundFile = 0xA004, - FlashEnergy = 0xA20B, - SpatialFrequencyResponse = 0xA20C, - FocalPlaneXResolution = 0xA20E, - FocalPlaneYResolution = 0xA20F, - FocalPlaneResolutionUnit = 0xA210, - SubjectLocation = 0xA214, - ExposureIndex = 0xA215, - SensingMethod = 0xA217, - FileSource = 0xA300, - SceneType = 0xA301, - CFAPattern = 0xA302, - CustomRendered = 0xA401, - ExposureMode = 0xA402, - WhiteBalance = 0xA403, - DigitalZoomRatio = 0xA404, - FocalLengthIn35mmFilm = 0xA405, - SceneCaptureType = 0xA406, - GainControl = 0xA407, - Contrast = 0xA408, - Saturation = 0xA409, - Sharpness = 0xA40A, - DeviceSettingDescription = 0xA40B, - SubjectDistanceRange = 0xA40C, - ImageUniqueID = 0xA420, - - // GPS subifd items - GPSVersionID = 0x0, - GPSLatitudeRef = 0x1, - GPSLatitude = 0x2, - GPSLongitudeRef = 0x3, - GPSLongitude = 0x4, - GPSAltitudeRef = 0x5, - GPSAltitude = 0x6, - GPSTimestamp = 0x7, - GPSSatellites = 0x8, - GPSStatus = 0x9, - GPSMeasureMode = 0xA, - GPSDOP = 0xB, - GPSSpeedRef = 0xC, - GPSSpeed = 0xD, - GPSTrackRef = 0xE, - GPSTrack = 0xF, - GPSImgDirectionRef = 0x10, - GPSImgDirection = 0x11, - GPSMapDatum = 0x12, - GPSDestLatitudeRef = 0x13, - GPSDestLatitude = 0x14, - GPSDestLongitudeRef = 0x15, - GPSDestLongitude = 0x16, - GPSDestBearingRef = 0x17, - GPSDestBearing = 0x18, - GPSDestDistanceRef = 0x19, - GPSDestDistance = 0x1A, - GPSProcessingMethod = 0x1B, - GPSAreaInformation = 0x1C, - GPSDateStamp = 0x1D, - GPSDifferential = 0x1E - } - } -} diff --git a/pdfpatcher/App/Processor/Imaging/TiffHelper.cs b/pdfpatcher/App/Processor/Imaging/TiffHelper.cs deleted file mode 100644 index 767a377711af45d83b99bc87c004aa8219cbab6f..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Imaging/TiffHelper.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System.Drawing.Imaging; -using FreeImageAPI; - -namespace PDFPatcher.Processor.Imaging -{ - static class TiffHelper - { - static readonly ImageCodecInfo _tiffCodec = BitmapHelper.GetCodec("image/tiff"); - static readonly EncoderParameters _encoderParameters = new EncoderParameters(1) { - Param = new EncoderParameter[] { new EncoderParameter(Encoder.Compression, (long)EncoderValue.CompressionCCITT4) } - }; - - internal static void Save(FreeImageBitmap bmp, string fileName) { - // 使用 .NET 的 TIFF 保存方式,文件尺寸较小 - if (_tiffCodec != null) { - if (bmp.ColorType == FREE_IMAGE_COLOR_TYPE.FIC_MINISWHITE) { - // HACK: TIFF编码黑色为1,解决 .NET TIFF 编码器无法正常保存双色图片的问题 - bmp.Invert(); - } - using (var b = bmp.ToBitmap()) { - b.Save(fileName, _tiffCodec, _encoderParameters); - } - } - else { - bmp.Save(fileName, FREE_IMAGE_FORMAT.FIF_TIFF, FREE_IMAGE_SAVE_FLAGS.TIFF_CCITTFAX4); - } - } - - /// - /// 将图片保存为黑白双色图片。如图片的 不为 ,则按默认格式保存。 - /// - /// 要保存的图片。 - /// 保存路径。 - internal static void SaveBinaryImage(this System.Drawing.Image bmp, string fileName) { - if (bmp.PixelFormat == PixelFormat.Format1bppIndexed) { - bmp.Save(fileName, _tiffCodec, _encoderParameters); - } - else { - bmp.Save(fileName, ImageFormat.Tiff); - } - } - internal static void SaveBinaryImage(this System.Drawing.Image bmp, System.IO.Stream stream) { - if (bmp.PixelFormat == PixelFormat.Format1bppIndexed) { - bmp.Save(stream, _tiffCodec, _encoderParameters); - } - else { - bmp.Save(stream, ImageFormat.Tiff); - } - } - - internal static byte[] Decode(ImageInfo info, byte[] bytes, int k, bool endOfLine, bool encodedByteAlign, bool endOfBlock, bool blackIs1) { - using (var s = new MuPdfSharp.MuStream(bytes)) - using (var img = s.DecodeTiffFax(info.Width, info.Height, k, endOfLine, encodedByteAlign, endOfBlock, blackIs1)) { - return img.ReadAll(bytes.Length); - } - //var outBuf = new byte[(info.Width + 7) / 8 * info.Height]; - //var decoder = new TIFFFaxDecoder (1, info.Width, info.Height); - //if (k < 0) { - // // CCITT Fax Group 4 - // decoder.DecodeT6 (outBuf, bytes, 0, info.Height, 0L); - //} - //else if (k == 0) { - // // CCITT Fax Group 3 (1-D) - // decoder.Decode1D (outBuf, bytes, 0, info.Height); - //} - //else { - // // CCITT Fax Group 3 (2-D) - // decoder.Decode2D (outBuf, bytes, 0, info.Height, 0L); - //} - //return outBuf; - } - } -} diff --git a/pdfpatcher/App/Processor/Imaging/WuColorQuantizer.cs b/pdfpatcher/App/Processor/Imaging/WuColorQuantizer.cs deleted file mode 100644 index e85e54f39a4e3d9392d2b43651be88926567dae2..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Imaging/WuColorQuantizer.cs +++ /dev/null @@ -1,640 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Drawing.Imaging; - -namespace PDFPatcher.Processor.Imaging -{ - public static class WuQuantizer - { - const int __MaxColor = 256; - const int __Red = 2; - const int __Green = 1; - const int __Blue = 0; - const int __SideSize = 33; - const int __MaxSideIndex = 32; - - public static Bitmap QuantizeImage(Bitmap image) { - var colorCount = __MaxColor; - var data = BuildHistogram(image); - CalculateMoments(data); - var cubes = SplitData(ref colorCount, data); - var palette = GetQuantizedPalette(colorCount, data, cubes); - return ProcessImagePixels(image, palette); - } - - static Bitmap ProcessImagePixels(Image sourceImage, QuantizedPalette palette) { - var result = new Bitmap(sourceImage.Width, sourceImage.Height, PixelFormat.Format8bppIndexed); - var newPalette = result.Palette; - palette.Colors.CopyTo(newPalette.Entries, 0); - result.Palette = newPalette; - - BitmapData targetData = null; - try { - targetData = result.LockBits(Rectangle.FromLTRB(0, 0, result.Width, result.Height), ImageLockMode.WriteOnly, result.PixelFormat); - var targetByteLength = targetData.Stride < 0 ? -targetData.Stride : targetData.Stride; - var targetSize = targetByteLength * result.Height; - var targetOffset = 0; - var targetBuffer = new byte[targetSize]; - var pixelIndex = 0; - var pil = palette.PixelIndex; - int rw = result.Width, rh = result.Height; - var empty = palette.Colors.Count - 1; - for (var y = 0; y < rh; y++) { - for (var x = 0; x < rw; x++) { - var pv = pil[pixelIndex]; - targetBuffer[targetOffset + x] = (byte)(pv == -1 ? empty : pv); - pixelIndex++; - } - - targetOffset += targetByteLength; - } - - System.Runtime.InteropServices.Marshal.Copy(targetBuffer, 0, targetData.Scan0, targetSize); - } - finally { - if (targetData != null) - result.UnlockBits(targetData); - } - - return result; - } - - static ColorData BuildHistogram(Bitmap sourceImage) { - int bitmapWidth = sourceImage.Width; - int bitmapHeight = sourceImage.Height; - - var data = sourceImage.LockBits(false); - var colorData = new ColorData(__MaxSideIndex, bitmapWidth, bitmapHeight); - - try { - var bitDepth = Image.GetPixelFormatSize(sourceImage.PixelFormat); - if (bitDepth != 32 && bitDepth != 24) - throw new QuantizationException(string.Format("The image you are attempting to quantize does not contain a 32 bit ARGB palette. This image has a bit depth of {0} with {1} colors.", bitDepth, sourceImage.Palette.Entries.Length)); - var byteLength = data.Stride < 0 ? -data.Stride : data.Stride; - var offset = 0; - var buffer = new Byte[byteLength * sourceImage.Height]; - - System.Runtime.InteropServices.Marshal.Copy(data.Scan0, buffer, 0, buffer.Length); - var t = new int[__MaxColor]; - for (var i = 0; i < __MaxColor; ++i) { - t[i] = i * i; - } - int pos; - byte vr, vg, vb, r, g, b; - var w = colorData.Weights; - var mr = colorData.MomentsRed; - var mg = colorData.MomentsGreen; - var mb = colorData.MomentsBlue; - var m = colorData.Moments; - for (int y = 0; y < bitmapHeight; y++) { - var index = 0; - for (int x = 0; x < bitmapWidth; x++) { - var indexOffset = offset + (index >> 3); - - vr = buffer[indexOffset + __Red]; - vg = buffer[indexOffset + __Green]; - vb = buffer[indexOffset + __Blue]; - r = (byte)((vr >> 3) + 1); - g = (byte)((vg >> 3) + 1); - b = (byte)((vb >> 3) + 1); - pos = (r << 10) + (r << 6) + r + (g << 5) + g + b; // [r,g,b] - w[pos]++; - mr[pos] += vr; - mg[pos] += vg; - mb[pos] += vb; - m[pos] += t[vr] + t[vg] + t[vb]; - - colorData.AddPixel( - new Pixel(vr, vg, vb), - (r << 16) + (g << 8) + b - ); - index += bitDepth; - - } - - offset += byteLength; - } - } - finally { - sourceImage.UnlockBits(data); - } - return colorData; - } - - static void CalculateMoments(ColorData data) { - var w = data.Weights; - var mr = data.MomentsRed; - var mg = data.MomentsGreen; - var mb = data.MomentsBlue; - var m = data.Moments; - for (var r = 1; r <= __MaxSideIndex; ++r) { - var area = new long[__SideSize]; - var areaRed = new long[__SideSize]; - var areaGreen = new long[__SideSize]; - var areaBlue = new long[__SideSize]; - var area2 = new float[__SideSize]; - for (var g = 1; g <= __MaxSideIndex; ++g) { - long line = 0; - long lineRed = 0; - long lineGreen = 0; - long lineBlue = 0; - var line2 = 0.0f; - for (var b = 1; b <= __MaxSideIndex; ++b) { - var pos = (r << 10) + (r << 6) + r + (g << 5) + g + b; // [r,g,b] - ref var wp = ref w[pos]; - ref var mrp = ref mr[pos]; - ref var mgp = ref mg[pos]; - ref var mbp = ref mb[pos]; - ref var mp = ref m[pos]; - line += wp; - lineRed += mrp; - lineGreen += mgp; - lineBlue += mbp; - line2 += mp; - - pos -= __MaxSideIndex * __MaxSideIndex; // [r-1,g,b] - wp = w[pos] + (area[b] += line); - mrp = mr[pos] + (areaRed[b] += lineRed); - mgp = mg[pos] + (areaGreen[b] += lineGreen); - mbp = mb[pos] + (areaBlue[b] += lineBlue); - mp = m[pos] + (area2[b] += line2); - } - } - } - } - - static long Top(Box cube, int direction, int position, long[] moment) { - int r0 = cube.RedMinimum, - r1 = cube.RedMaximum, - g0 = cube.GreenMinimum, - g1 = cube.GreenMaximum, - b0 = cube.BlueMinimum, - b1 = cube.BlueMaximum; - switch (direction) { - case __Red: - position = (position << 10) + (position << 6) + position; - g0 = (g0 << 5) + g0; - g1 = (g1 << 5) + g1; - return - -moment[position + g1 + b1] - + moment[position + g1 + b0] - + moment[position + g0 + b1] - - moment[position + g0 + b0]; - case __Green: - r0 = (r0 << 10) + (r0 << 6) + r0; - r1 = (r1 << 10) + (r1 << 6) + r1; - position = (position << 5) + position; - return - -moment[position + r1 + b1] - + moment[position + r1 + b0] - + moment[position + r0 + b1] - - moment[position + r0 + b0]; - case __Blue: - r0 = (r0 << 10) + (r0 << 6) + r0; - r1 = (r1 << 10) + (r1 << 6) + r1; - g0 = (g0 << 5) + g0; - g1 = (g1 << 5) + g1; - return - -moment[position + r1 + g1] - + moment[position + r1 + g0] - + moment[position + r0 + g1] - - moment[position + r0 + g0]; - default: - return 0; - } - } - - static long Bottom(Box cube, int direction, long[] moment) { - int r0 = cube.RedMinimum, r1 = cube.RedMaximum, - g0 = cube.GreenMinimum, g1 = cube.GreenMaximum, - b0 = cube.BlueMinimum, b1 = cube.BlueMaximum; - r0 = (r0 << 10) + (r0 << 6) + r0; - r1 = (r1 << 10) + (r1 << 6) + r1; - g0 = (g0 << 5) + g0; - g1 = (g1 << 5) + g1; - switch (direction) { - case __Red: - return - -moment[r0 + g1 + b1] - + moment[r0 + g1 + b0] - + moment[r0 + g0 + b1] - - moment[r0 + g0 + b0]; - case __Green: - return - -moment[r1 + g0 + b1] - + moment[r1 + g0 + b0] - + moment[r0 + g0 + b1] - - moment[r0 + g0 + b0]; - case __Blue: - return - -moment[r1 + g1 + b0] - + moment[r1 + g0 + b0] - + moment[r0 + g1 + b0] - - moment[r0 + g0 + b0]; - default: - return 0; - } - } - - static CubeCut Maximize(ColorData data, Box cube, int direction, byte first, byte last, long wholeRed, long wholeGreen, long wholeBlue, long wholeWeight) { - var bottomRed = Bottom(cube, direction, data.MomentsRed); - var bottomGreen = Bottom(cube, direction, data.MomentsGreen); - var bottomBlue = Bottom(cube, direction, data.MomentsBlue); - var bottomWeight = Bottom(cube, direction, data.Weights); - - var result = 0.0f; - bool canSplit = false; - byte cutPoint = 0; - - for (var position = first; position < last; ++position) { - var halfRed = bottomRed + Top(cube, direction, position, data.MomentsRed); - var halfGreen = bottomGreen + Top(cube, direction, position, data.MomentsGreen); - var halfBlue = bottomBlue + Top(cube, direction, position, data.MomentsBlue); - var halfWeight = bottomWeight + Top(cube, direction, position, data.Weights); - - if (halfWeight == 0) continue; - - var halfDistance = halfRed * halfRed + halfGreen * halfGreen + halfBlue * halfBlue; - var temp = halfDistance / halfWeight; - - halfRed = wholeRed - halfRed; - halfGreen = wholeGreen - halfGreen; - halfBlue = wholeBlue - halfBlue; - halfWeight = wholeWeight - halfWeight; - - if (halfWeight != 0) { - halfDistance = halfRed * halfRed + halfGreen * halfGreen + halfBlue * halfBlue; - temp += halfDistance / halfWeight; - - if (temp > result) { - result = temp; - canSplit = true; - cutPoint = position; - } - } - } - - return new CubeCut(canSplit, cutPoint, result); - } - - static bool Cut(ColorData data, ref Box first, ref Box second) { - int direction; - var wholeRed = Volume(first, data.MomentsRed); - var wholeGreen = Volume(first, data.MomentsGreen); - var wholeBlue = Volume(first, data.MomentsBlue); - var wholeWeight = Volume(first, data.Weights); - - var maxRed = Maximize(data, first, __Red, (byte)(first.RedMinimum + 1), first.RedMaximum, wholeRed, wholeGreen, wholeBlue, wholeWeight); - var maxGreen = Maximize(data, first, __Green, (byte)(first.GreenMinimum + 1), first.GreenMaximum, wholeRed, wholeGreen, wholeBlue, wholeWeight); - var maxBlue = Maximize(data, first, __Blue, (byte)(first.BlueMinimum + 1), first.BlueMaximum, wholeRed, wholeGreen, wholeBlue, wholeWeight); - - if ((maxRed.Value >= maxGreen.Value) && (maxRed.Value >= maxBlue.Value)) { - direction = __Red; - if (maxRed.CanSplit == false) { - return false; - } - } - else { - if ((maxGreen.Value >= maxRed.Value) && (maxGreen.Value >= maxBlue.Value)) - direction = __Green; - else - direction = __Blue; - } - - second.RedMaximum = first.RedMaximum; - second.GreenMaximum = first.GreenMaximum; - second.BlueMaximum = first.BlueMaximum; - - switch (direction) { - case __Red: - second.RedMinimum = first.RedMaximum = maxRed.Position; - second.GreenMinimum = first.GreenMinimum; - second.BlueMinimum = first.BlueMinimum; - break; - - case __Green: - second.GreenMinimum = first.GreenMaximum = maxGreen.Position; - second.RedMinimum = first.RedMinimum; - second.BlueMinimum = first.BlueMinimum; - break; - - case __Blue: - second.BlueMinimum = first.BlueMaximum = maxBlue.Position; - second.RedMinimum = first.RedMinimum; - second.GreenMinimum = first.GreenMinimum; - break; - } - - first.Volume = (first.RedMaximum - first.RedMinimum) * (first.GreenMaximum - first.GreenMinimum) * (first.BlueMaximum - first.BlueMinimum); - second.Volume = (second.RedMaximum - second.RedMinimum) * (second.GreenMaximum - second.GreenMinimum) * (second.BlueMaximum - second.BlueMinimum); - - return true; - } - - static float CalculateVariance(ColorData data, Box cube) { - float volumeRed = Volume(cube, data.MomentsRed); - float volumeGreen = Volume(cube, data.MomentsGreen); - float volumeBlue = Volume(cube, data.MomentsBlue); - float volumeMoment = VolumeFloat(cube, data.Moments); - float volumeWeight = Volume(cube, data.Weights); - - float distance = volumeRed * volumeRed + volumeGreen * volumeGreen + volumeBlue * volumeBlue; - - var result = volumeMoment - distance / volumeWeight; - return double.IsNaN(result) ? 0.0f : result; - } - - static long Volume(Box cube, long[] moment) { - int r0 = cube.RedMinimum, r1 = cube.RedMaximum, - g0 = cube.GreenMinimum, g1 = cube.GreenMaximum, - b0 = cube.BlueMinimum, b1 = cube.BlueMaximum; - r0 = (r0 << 10) + (r0 << 6) + r0; - r1 = (r1 << 10) + (r1 << 6) + r1; - g0 = (g0 << 5) + g0; - g1 = (g1 << 5) + g1; - return moment[r1 + g1 + b1] - - moment[r1 + g1 + b0] - - moment[r1 + g0 + b1] - + moment[r1 + g0 + b0] - - moment[r0 + g1 + b1] - + moment[r0 + g1 + b0] - + moment[r0 + g0 + b1] - - moment[r0 + g0 + b0]; - } - - static float VolumeFloat(Box cube, float[] moment) { - int r0 = cube.RedMinimum, r1 = cube.RedMaximum, - g0 = cube.GreenMinimum, g1 = cube.GreenMaximum, - b0 = cube.BlueMinimum, b1 = cube.BlueMaximum; - r0 = (r0 << 10) + (r0 << 6) + r0; - r1 = (r1 << 10) + (r1 << 6) + r1; - g0 = (g0 << 5) + g0; - g1 = (g1 << 5) + g1; - return moment[r1 + g1 + b1] - - moment[r1 + g1 + b0] - - moment[r1 + g0 + b1] - + moment[r1 + g0 + b0] - - moment[r0 + g1 + b1] - + moment[r0 + g1 + b0] - + moment[r0 + g0 + b1] - - moment[r0 + g0 + b0]; - } - - static Box[] SplitData(ref int colorCount, ColorData data) { - --colorCount; - var next = 0; - var volumeVariance = new float[__MaxColor]; - var cubes = new Box[__MaxColor]; - cubes[0].RedMaximum = __MaxSideIndex; - cubes[0].GreenMaximum = __MaxSideIndex; - cubes[0].BlueMaximum = __MaxSideIndex; - for (var cubeIndex = 1; cubeIndex < colorCount; ++cubeIndex) { - if (Cut(data, ref cubes[next], ref cubes[cubeIndex])) { - volumeVariance[next] = cubes[next].Volume > 1 ? CalculateVariance(data, cubes[next]) : 0.0f; - volumeVariance[cubeIndex] = cubes[cubeIndex].Volume > 1 ? CalculateVariance(data, cubes[cubeIndex]) : 0.0f; - } - else { - volumeVariance[next] = 0.0f; - cubeIndex--; - } - - next = 0; - var temp = volumeVariance[0]; - - for (var index = 1; index <= cubeIndex; ++index) { - var v = volumeVariance[index]; - if (v <= temp) - continue; - temp = v; - next = index; - } - - if (temp > 0.0) - continue; - colorCount = cubeIndex + 1; - break; - } - Array.Resize(ref cubes, colorCount); - return cubes; - } - - static LookupData BuildLookups(IEnumerable cubes, ColorData data) { - var lookupData = new LookupData(__SideSize); - var lookups = lookupData.Lookups; - int lookupsCount = lookupData.Lookups.Count; - var tags = lookupData.Tags; - int ri, rgi; - foreach (var cube in cubes) { - byte r1 = cube.RedMaximum, - g1 = cube.GreenMaximum, - b1 = cube.BlueMaximum, - r0 = (byte)(cube.RedMinimum + 1), - g0 = (byte)(cube.GreenMinimum + 1), - b0 = (byte)(cube.BlueMinimum + 1); - for (var redIndex = r0; redIndex <= r1; ++redIndex) { - ri = (redIndex << 10) + (redIndex << 6) + redIndex; // redIndex * 33 * 33 - for (var greenIndex = g0; greenIndex <= g1; ++greenIndex) { - rgi = ri + (greenIndex << 5) + greenIndex; - for (var blueIndex = b0; blueIndex <= b1; ++blueIndex) { - tags[rgi + blueIndex] = lookupsCount; // [redIndex,greenIndex,blueIndex] - } - } - } - - var weight = Volume(cube, data.Weights); - - if (weight <= 0) continue; - - var lookup = new Pixel( - (byte)(Volume(cube, data.MomentsRed) / weight), - (byte)(Volume(cube, data.MomentsGreen) / weight), - (byte)(Volume(cube, data.MomentsBlue) / weight) - ); - lookups.Add(lookup); - } - return lookupData; - } - - static QuantizedPalette GetQuantizedPalette(int colorCount, ColorData data, IEnumerable cubes) { - int imageSize = data.PixelsCount; - var lookups = BuildLookups(cubes, data); - - var quantizedPixels = data.QuantizedPixels; - for (int index = 0, pixel, red, green; index < imageSize; ++index) { - ref var p = ref quantizedPixels[index]; - pixel = p; - red = pixel >> 16; - green = 0xFF & (pixel >> 8); - p = lookups.Tags[(red << 10) + (red << 6) + red + (green << 5) + green + (0xFF & pixel)];// red*33*33 + green*33 + blue - } - - var reds = new int[colorCount + 1]; - var greens = new int[colorCount + 1]; - var blues = new int[colorCount + 1]; - var sums = new int[colorCount + 1]; - var palette = new QuantizedPalette(imageSize); - - IList pixels = data.Pixels; - var pixelIndexes = palette.PixelIndex; - int pixelsCount = data.PixelsCount; - var lookupsList = lookups.Lookups; - int lookupsCount = lookupsList.Count; - - var cachedMatches = new Dictionary(); - - for (int pixelIndex = 0; pixelIndex < pixelsCount; pixelIndex++) { - var pixel = pixels[pixelIndex]; - ref var p = ref pixelIndexes[pixelIndex]; - p = -1; - int bestMatch; - int pr = pixel.Red, pg = pixel.Green, pb = pixel.Blue; - int argb = pr << 16 | pg << 8 | pb; - - if (!cachedMatches.TryGetValue(argb, out bestMatch)) { - bestMatch = quantizedPixels[pixelIndex]; - int bestDistance = Int32.MaxValue; - - for (int lookupIndex = 0; lookupIndex < lookupsCount; lookupIndex++) { - var lookup = lookupsList[lookupIndex]; - var deltaRed = pr - lookup.Red; - var deltaGreen = pg - lookup.Green; - var deltaBlue = pb - lookup.Blue; - - int distance = deltaRed * deltaRed + deltaGreen * deltaGreen + deltaBlue * deltaBlue; - - if (distance >= bestDistance) - continue; - - bestDistance = distance; - bestMatch = lookupIndex; - } - - cachedMatches[argb] = bestMatch; - } - - reds[bestMatch] += pr; - greens[bestMatch] += pg; - blues[bestMatch] += pb; - sums[bestMatch]++; - - p = bestMatch; - } - - for (var paletteIndex = 0; paletteIndex < colorCount; paletteIndex++) { - var s = sums[paletteIndex]; - if (s > 0) { - reds[paletteIndex] /= s; - greens[paletteIndex] /= s; - blues[paletteIndex] /= s; - } - - palette.Colors.Add(Color.FromArgb(reds[paletteIndex] & 0xFF, greens[paletteIndex] & 0xFF, blues[paletteIndex] & 0xFF)); - } - - palette.Colors.Add(Color.FromArgb(0, 0, 0, 0)); - - return palette; - } - - struct Box - { - public byte RedMinimum; // exclusive - public byte RedMaximum; // inclusive - public byte GreenMinimum; - public byte GreenMaximum; - public byte BlueMinimum; - public byte BlueMaximum; - public int Volume; - } - sealed class ColorData - { - public ColorData(int dataGranularity, int bitmapWidth, int bitmapHeight) { - dataGranularity++; - var s = dataGranularity * dataGranularity * dataGranularity; - Weights = new long[s]; - MomentsRed = new long[s]; - MomentsGreen = new long[s]; - MomentsBlue = new long[s]; - Moments = new float[s]; - - pixelsCount = bitmapWidth * bitmapHeight; - pixels = new Pixel[pixelsCount]; - quantizedPixels = new int[pixelsCount]; - } - - internal long[] Weights { get; } - internal long[] MomentsRed { get; } - internal long[] MomentsGreen { get; } - internal long[] MomentsBlue { get; } - internal float[] Moments { get; } - - internal int[] QuantizedPixels => quantizedPixels; - internal Pixel[] Pixels => pixels; - - public int PixelsCount => pixels.Length; - internal void AddPixel(Pixel pixel, int quantizedPixel) { - pixels[pixelFillingCounter] = pixel; - quantizedPixels[pixelFillingCounter++] = quantizedPixel; - } - - readonly Pixel[] pixels; - readonly int[] quantizedPixels; - readonly int pixelsCount; - int pixelFillingCounter; - } - readonly struct CubeCut - { - public readonly bool CanSplit; - public readonly byte Position; - public readonly float Value; - - public CubeCut(bool canSplit, byte cutPoint, float result) { - CanSplit = canSplit; - Position = cutPoint; - Value = result; - } - } - sealed class LookupData - { - public LookupData(int granularity) { - Lookups = new List(); - Tags = new int[granularity * granularity * granularity]; - } - - public IList Lookups { get; } - public int[] Tags { get; } - } - - readonly struct Pixel - { - public Pixel(byte red, byte green, byte blue) { - Red = red; - Green = green; - Blue = blue; - } - - public readonly byte Red; - public readonly byte Green; - public readonly byte Blue; - } - - sealed class QuantizedPalette - { - public QuantizedPalette(int size) { - Colors = new List(); - PixelIndex = new int[size]; - } - public IList Colors { get; } - public int[] PixelIndex { get; } - } - - sealed class QuantizationException : ApplicationException - { - public QuantizationException(string message) - : base(message) { - } - } - } - -} diff --git a/pdfpatcher/App/Processor/Imaging/WuQuantize.c b/pdfpatcher/App/Processor/Imaging/WuQuantize.c deleted file mode 100644 index af7e61daad3f87b1644264f1d9106cb3a3ddc8d3..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Imaging/WuQuantize.c +++ /dev/null @@ -1,437 +0,0 @@ -Having received many constructive comments and bug reports about my previous -C implementation of my color quantizer (Graphics Gems vol. II, p. 126-133), -I am posting the following second version of my program (hopefully 100% -healthy) as a reply to all those who are interested in the problem. - - - - -/********************************************************************** - C Implementation of Wu's Color Quantizer (v. 2) - (see Graphics Gems vol. II, pp. 126-133) - -Author: Xiaolin Wu - Dept. of Computer Science - Univ. of Western Ontario - London, Ontario N6A 5B7 - wu@csd.uwo.ca - -Algorithm: Greedy orthogonal bipartition of RGB space for variance - minimization aided by inclusion-exclusion tricks. - For speed no nearest neighbor search is done. Slightly - better performance can be expected by more sophisticated - but more expensive versions. - -The author thanks Tom Lane at Tom_Lane@G.GP.CS.CMU.EDU for much of -additional documentation and a cure to a previous bug. - -Free to distribute, comments and suggestions are appreciated. -**********************************************************************/ - -#include - -#define MAXCOLOR 256 -#define RED 2 -#define GREEN 1 -#define BLUE 0 - -struct box { - int r0; /* min value, exclusive */ - int r1; /* max value, inclusive */ - int g0; - int g1; - int b0; - int b1; - int vol; -}; - -/* Histogram is in elements 1..HISTSIZE along each axis, - * element 0 is for base or marginal value - * NB: these must start out 0! - */ - -float m2[33][33][33]; -long int wt[33][33][33], mr[33][33][33], mg[33][33][33], mb[33][33][33]; -unsigned char *Ir, *Ig, *Ib; -int size; /*image size*/ -int K; /*color look-up table size*/ -unsigned short int *Qadd; - -void -Hist3d(vwt, vmr, vmg, vmb, m2) -/* build 3-D color histogram of counts, r/g/b, c^2 */ -long int *vwt, *vmr, *vmg, *vmb; -float *m2; -{ -register int ind, r, g, b; -int inr, ing, inb, table[256]; -register long int i; - - for(i=0; i<256; ++i) table[i]=i*i; - Qadd = (unsigned short int *)malloc(sizeof(short int)*size); - if (Qadd==NULL) {printf("Not enough space\n"); exit(1);} - for(i=0; i>3)+1; - ing=(g>>3)+1; - inb=(b>>3)+1; - Qadd[i]=ind=(inr<<10)+(inr<<6)+inr+(ing<<5)+ing+inb; - /*[inr][ing][inb]*/ - ++vwt[ind]; - vmr[ind] += r; - vmg[ind] += g; - vmb[ind] += b; - m2[ind] += (float)(table[r]+table[g]+table[b]); - } -} - -/* At conclusion of the histogram step, we can interpret - * wt[r][g][b] = sum over voxel of P(c) - * mr[r][g][b] = sum over voxel of r*P(c) , similarly for mg, mb - * m2[r][g][b] = sum over voxel of c^2*P(c) - * Actually each of these should be divided by 'size' to give the usual - * interpretation of P() as ranging from 0 to 1, but we needn't do that here. - */ - -/* We now convert histogram into moments so that we can rapidly calculate - * the sums of the above quantities over any desired box. - */ - - -void -M3d(vwt, vmr, vmg, vmb, m2) /* compute cumulative moments. */ -long int *vwt, *vmr, *vmg, *vmb; -float *m2; -{ -register unsigned short int ind1, ind2; -register unsigned char i, r, g, b; -long int line, line_r, line_g, line_b, - area[33], area_r[33], area_g[33], area_b[33]; -float line2, area2[33]; - - for(r=1; r<=32; ++r){ - for(i=0; i<=32; ++i) - area2[i]=area[i]=area_r[i]=area_g[i]=area_b[i]=0; - for(g=1; g<=32; ++g){ - line2 = line = line_r = line_g = line_b = 0; - for(b=1; b<=32; ++b){ - ind1 = (r<<10) + (r<<6) + r + (g<<5) + g + b; /* [r][g][b] */ - line += vwt[ind1]; - line_r += vmr[ind1]; - line_g += vmg[ind1]; - line_b += vmb[ind1]; - line2 += m2[ind1]; - area[b] += line; - area_r[b] += line_r; - area_g[b] += line_g; - area_b[b] += line_b; - area2[b] += line2; - ind2 = ind1 - 1089; /* [r-1][g][b] */ - vwt[ind1] = vwt[ind2] + area[b]; - vmr[ind1] = vmr[ind2] + area_r[b]; - vmg[ind1] = vmg[ind2] + area_g[b]; - vmb[ind1] = vmb[ind2] + area_b[b]; - m2[ind1] = m2[ind2] + area2[b]; - } - } - } -} - - -long int Vol(cube, mmt) -/* Compute sum over a box of any given statistic */ -struct box *cube; -long int mmt[33][33][33]; -{ - return( mmt[cube->r1][cube->g1][cube->b1] - -mmt[cube->r1][cube->g1][cube->b0] - -mmt[cube->r1][cube->g0][cube->b1] - +mmt[cube->r1][cube->g0][cube->b0] - -mmt[cube->r0][cube->g1][cube->b1] - +mmt[cube->r0][cube->g1][cube->b0] - +mmt[cube->r0][cube->g0][cube->b1] - -mmt[cube->r0][cube->g0][cube->b0] ); -} - -/* The next two routines allow a slightly more efficient calculation - * of Vol() for a proposed subbox of a given box. The sum of Top() - * and Bottom() is the Vol() of a subbox split in the given direction - * and with the specified new upper bound. - */ - -long int Bottom(cube, dir, mmt) -/* Compute part of Vol(cube, mmt) that doesn't depend on r1, g1, or b1 */ -/* (depending on dir) */ -struct box *cube; -unsigned char dir; -long int mmt[33][33][33]; -{ - switch(dir){ - case RED: - return( -mmt[cube->r0][cube->g1][cube->b1] - +mmt[cube->r0][cube->g1][cube->b0] - +mmt[cube->r0][cube->g0][cube->b1] - -mmt[cube->r0][cube->g0][cube->b0] ); - break; - case GREEN: - return( -mmt[cube->r1][cube->g0][cube->b1] - +mmt[cube->r1][cube->g0][cube->b0] - +mmt[cube->r0][cube->g0][cube->b1] - -mmt[cube->r0][cube->g0][cube->b0] ); - break; - case BLUE: - return( -mmt[cube->r1][cube->g1][cube->b0] - +mmt[cube->r1][cube->g0][cube->b0] - +mmt[cube->r0][cube->g1][cube->b0] - -mmt[cube->r0][cube->g0][cube->b0] ); - break; - } -} - - -long int Top(cube, dir, pos, mmt) -/* Compute remainder of Vol(cube, mmt), substituting pos for */ -/* r1, g1, or b1 (depending on dir) */ -struct box *cube; -unsigned char dir; -int pos; -long int mmt[33][33][33]; -{ - switch(dir){ - case RED: - return( mmt[pos][cube->g1][cube->b1] - -mmt[pos][cube->g1][cube->b0] - -mmt[pos][cube->g0][cube->b1] - +mmt[pos][cube->g0][cube->b0] ); - break; - case GREEN: - return( mmt[cube->r1][pos][cube->b1] - -mmt[cube->r1][pos][cube->b0] - -mmt[cube->r0][pos][cube->b1] - +mmt[cube->r0][pos][cube->b0] ); - break; - case BLUE: - return( mmt[cube->r1][cube->g1][pos] - -mmt[cube->r1][cube->g0][pos] - -mmt[cube->r0][cube->g1][pos] - +mmt[cube->r0][cube->g0][pos] ); - break; - } -} - - -float Var(cube) -/* Compute the weighted variance of a box */ -/* NB: as with the raw statistics, this is really the variance * size */ -struct box *cube; -{ -float dr, dg, db, xx; - - dr = Vol(cube, mr); - dg = Vol(cube, mg); - db = Vol(cube, mb); - xx = m2[cube->r1][cube->g1][cube->b1] - -m2[cube->r1][cube->g1][cube->b0] - -m2[cube->r1][cube->g0][cube->b1] - +m2[cube->r1][cube->g0][cube->b0] - -m2[cube->r0][cube->g1][cube->b1] - +m2[cube->r0][cube->g1][cube->b0] - +m2[cube->r0][cube->g0][cube->b1] - -m2[cube->r0][cube->g0][cube->b0]; - - return( xx - (dr*dr+dg*dg+db*db)/(float)Vol(cube,wt) ); -} - -/* We want to minimize the sum of the variances of two subboxes. - * The sum(c^2) terms can be ignored since their sum over both subboxes - * is the same (the sum for the whole box) no matter where we split. - * The remaining terms have a minus sign in the variance formula, - * so we drop the minus sign and MAXIMIZE the sum of the two terms. - */ - - -float Maximize(cube, dir, first, last, cut, - whole_r, whole_g, whole_b, whole_w) -struct box *cube; -unsigned char dir; -int first, last, *cut; -long int whole_r, whole_g, whole_b, whole_w; -{ -register long int half_r, half_g, half_b, half_w; -long int base_r, base_g, base_b, base_w; -register int i; -register float temp, max; - - base_r = Bottom(cube, dir, mr); - base_g = Bottom(cube, dir, mg); - base_b = Bottom(cube, dir, mb); - base_w = Bottom(cube, dir, wt); - max = 0.0; - *cut = -1; - for(i=first; i max) {max=temp; *cut=i;} - } - return(max); -} - -int -Cut(set1, set2) -struct box *set1, *set2; -{ -unsigned char dir; -int cutr, cutg, cutb; -float maxr, maxg, maxb; -long int whole_r, whole_g, whole_b, whole_w; - - whole_r = Vol(set1, mr); - whole_g = Vol(set1, mg); - whole_b = Vol(set1, mb); - whole_w = Vol(set1, wt); - - maxr = Maximize(set1, RED, set1->r0+1, set1->r1, &cutr, - whole_r, whole_g, whole_b, whole_w); - maxg = Maximize(set1, GREEN, set1->g0+1, set1->g1, &cutg, - whole_r, whole_g, whole_b, whole_w); - maxb = Maximize(set1, BLUE, set1->b0+1, set1->b1, &cutb, - whole_r, whole_g, whole_b, whole_w); - - if( (maxr>=maxg)&&(maxr>=maxb) ) { - dir = RED; - if (cutr < 0) return 0; /* can't split the box */ - } - else - if( (maxg>=maxr)&&(maxg>=maxb) ) - dir = GREEN; - else - dir = BLUE; - - set2->r1 = set1->r1; - set2->g1 = set1->g1; - set2->b1 = set1->b1; - - switch (dir){ - case RED: - set2->r0 = set1->r1 = cutr; - set2->g0 = set1->g0; - set2->b0 = set1->b0; - break; - case GREEN: - set2->g0 = set1->g1 = cutg; - set2->r0 = set1->r0; - set2->b0 = set1->b0; - break; - case BLUE: - set2->b0 = set1->b1 = cutb; - set2->r0 = set1->r0; - set2->g0 = set1->g0; - break; - } - set1->vol=(set1->r1-set1->r0)*(set1->g1-set1->g0)*(set1->b1-set1->b0); - set2->vol=(set2->r1-set2->r0)*(set2->g1-set2->g0)*(set2->b1-set2->b0); - return 1; -} - - -Mark(cube, label, tag) -struct box *cube; -int label; -unsigned char *tag; -{ -register int r, g, b; - - for(r=cube->r0+1; r<=cube->r1; ++r) - for(g=cube->g0+1; g<=cube->g1; ++g) - for(b=cube->b0+1; b<=cube->b1; ++b) - tag[(r<<10) + (r<<6) + r + (g<<5) + g + b] = label; -} - -main() -{ -struct box cube[MAXCOLOR]; -unsigned char *tag; -unsigned char lut_r[MAXCOLOR], lut_g[MAXCOLOR], lut_b[MAXCOLOR]; -int next; -register long int i, weight; -register int k; -float vv[MAXCOLOR], temp; - - /* input R,G,B components into Ir, Ig, Ib; - set size to width*height */ - - printf("no. of colors:\n"); - scanf("%d", &K); - - Hist3d(wt, mr, mg, mb, m2); printf("Histogram done\n"); - free(Ig); free(Ib); free(Ir); - - M3d(wt, mr, mg, mb, m2); printf("Moments done\n"); - - cube[0].r0 = cube[0].g0 = cube[0].b0 = 0; - cube[0].r1 = cube[0].g1 = cube[0].b1 = 32; - next = 0; - for(i=1; i1) ? Var(&cube[next]) : 0.0; - vv[i] = (cube[i].vol>1) ? Var(&cube[i]) : 0.0; - } else { - vv[next] = 0.0; /* don't try to split this box again */ - i--; /* didn't create box i */ - } - next = 0; temp = vv[0]; - for(k=1; k<=i; ++k) - if (vv[k] > temp) { - temp = vv[k]; next = k; - } - if (temp <= 0.0) { - K = i+1; - fprintf(stderr, "Only got %d boxes\n", K); - break; - } - } - printf("Partition done\n"); - - /* the space for array m2 can be freed now */ - - tag = (unsigned char *)malloc(33*33*33); - if (tag==NULL) {printf("Not enough space\n"); exit(1);} - for(k=0; k 0) { - if (TransitionMapper != null) { - if (PageRemapper != null && page >= PageRemapper.Length) { - System.Diagnostics.Trace.WriteLine("跳转页码位置无效:" + page); - } - else if (TransitionMapper[page] != null) { - var ct = TransitionMapper[page]; - TranslateDestinationCoordinates(item, ct); - } - } - if (PageRemapper != null) { - if (page < PageRemapper.Length && (page = PageRemapper[page]) > 0) { - item.SetAttribute(Constants.DestinationAttributes.Page, page.ToText()); - } - else if (RemoveOrphanDestination) { - RemoveOrphan(item); - return true; - } - } - } - else if (RemoveOrphanDestination) { - RemoveOrphan(item); - } - else { - RemoveGotoAction(item); - } - return true; - } - - private static void RemoveGotoAction(XmlElement item) { - if (item.Name == Constants.ActionType.Goto) { - item.ParentNode.RemoveChild(item); - } - else { - item.RemoveAttribute(Constants.DestinationAttributes.Action); - item.RemoveAttribute(Constants.DestinationAttributes.Page); - } - } - - private void RemoveOrphan(XmlElement item) { - if (item.HasChildNodes && item.LocalName == Constants.Bookmark) { - while (item.HasChildNodes) { - var c = item.LastChild as XmlElement; - if (c == null || - (c.HasAttribute(Constants.DestinationAttributes.Action) == false - && c.HasChildNodes == false)) { - item.RemoveChild(item.LastChild); - continue; - } - item.ParentNode.InsertAfter(item.LastChild, item); - } - } - item.ParentNode.RemoveChild(item); - } - - #endregion - - private static void TranslateDestinationCoordinates(XmlElement item, CoordinateTranslationSettings ct) { - float p; - if (item.GetAttribute(Constants.Coordinates.Top).TryParse(out p) && p != 0) { - item.SetAttribute(Constants.Coordinates.Top, (p * ct.YScale + ct.YTranslation).ToText()); - } - if (item.GetAttribute(Constants.Coordinates.Bottom).TryParse(out p) && p != 0) { - item.SetAttribute(Constants.Coordinates.Bottom, (p * ct.YScale + ct.YTranslation).ToText()); - } - if (item.GetAttribute(Constants.Coordinates.Left).TryParse(out p) && p != 0) { - item.SetAttribute(Constants.Coordinates.Left, (p * ct.XScale + ct.XTranslation).ToText()); - } - if (item.GetAttribute(Constants.Coordinates.Right).TryParse(out p) && p != 0) { - item.SetAttribute(Constants.Coordinates.Right, (p * ct.XScale + ct.XTranslation).ToText()); - } - } - - } -} diff --git a/pdfpatcher/App/Processor/InfoDocProcessor/RemoveZoomRateProcessor.cs b/pdfpatcher/App/Processor/InfoDocProcessor/RemoveZoomRateProcessor.cs deleted file mode 100644 index 9514b550020fc83dcc78de6a60c86c0fdea2c5f2..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/InfoDocProcessor/RemoveZoomRateProcessor.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Processor -{ - sealed class RemoveZoomRateProcessor : IInfoDocProcessor - { - #region IInfoDocProcessor 成员 - - public bool Process(System.Xml.XmlElement item) { - var d = item.GetAttributeNode(Constants.DestinationAttributes.View); - if (d != null && d.Value != Constants.DestinationAttributes.ViewType.XYZ) { - d.Value = Constants.DestinationAttributes.ViewType.XYZ; - } - item.RemoveAttribute(Constants.Coordinates.ScaleFactor); - return true; - } - - #endregion - } -} diff --git a/pdfpatcher/App/Processor/InfoDocProcessor/ShiftPageProcessor.cs b/pdfpatcher/App/Processor/InfoDocProcessor/ShiftPageProcessor.cs deleted file mode 100644 index 6ec04adf5a7f017dab1218c36010f980e1ca64fc..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/InfoDocProcessor/ShiftPageProcessor.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using PDFPatcher.Common; - -namespace PDFPatcher.Processor -{ - sealed class ShiftPageProcessor : IInfoDocProcessor - { - public int Offset { get; set; } - - #region IInfoDocProcessor 成员 - - public bool Process(System.Xml.XmlElement item) { - var a = item.GetAttributeNode(Constants.DestinationAttributes.Page); - if (a != null && a.Value.TryParse(out int pageNum)/* && pageNum > 0*/) { - pageNum += Offset; - a.Value = pageNum.ToText(); - return true; - } - return false; - } - - #endregion - } -} diff --git a/pdfpatcher/App/Processor/InfoXmlProcessors/BookmarkMatcher.cs b/pdfpatcher/App/Processor/InfoXmlProcessors/BookmarkMatcher.cs deleted file mode 100644 index f61693fb7dc7ac97c5c223675af5ce2d4c9ec5b3..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/InfoXmlProcessors/BookmarkMatcher.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System.Xml; - -namespace PDFPatcher.Processor -{ - internal abstract class BookmarkMatcher - { - internal enum MatcherType - { - Normal, Regex, XPath - } - - internal abstract bool Match(XmlElement item); - internal abstract IUndoAction Replace(XmlElement item, string replacement); - internal static BookmarkMatcher Create(string pattern, MatcherType type, bool matchCase, bool fullMatch) { - return type == MatcherType.XPath - ? new XPathMatcher(pattern) - : new RegexMatcher(pattern, matchCase, type == MatcherType.Regex, fullMatch); - } - sealed class RegexMatcher : BookmarkMatcher - { - readonly Model.MatchPattern.IMatcher _matcher; - internal RegexMatcher(string pattern, bool matchCase, bool regexSearch, bool fullMatch) { - _matcher = new Model.MatchPattern(pattern, matchCase, fullMatch, regexSearch).CreateMatcher(); - } - internal override bool Match(XmlElement item) { - return _matcher.Matches(item.GetAttribute(Constants.BookmarkAttributes.Title)); - } - internal override IUndoAction Replace(XmlElement item, string replacement) { - var a = item.GetAttributeNode(Constants.BookmarkAttributes.Title); - if (a == null) { - return null; - } - var t = a.Value; - if (_matcher.Matches(t)) { - var r = _matcher.Replace(t, replacement); - return r == t ? null : (IUndoAction)UndoAttributeAction.GetUndoAction(item, Constants.BookmarkAttributes.Title, r); - } - return null; - } - } - sealed class XPathMatcher : BookmarkMatcher - { - readonly System.Xml.XPath.XPathExpression _xpath; - internal XPathMatcher(string pattern) { - _xpath = System.Xml.XPath.XPathExpression.Compile("*[" + pattern + "]"); - } - internal override bool Match(XmlElement item) { - return item.CreateNavigator().Matches(_xpath); - } - internal override IUndoAction Replace(XmlElement item, string replacement) { - var a = item.GetAttributeNode(Constants.BookmarkAttributes.Title); - if (a == null) { - return null; - } - var n = item.CreateNavigator().SelectSingleNode(_xpath); - return n == null || a.Value == replacement - ? null - : (IUndoAction)UndoAttributeAction.GetUndoAction(item, Constants.BookmarkAttributes.Title, replacement); - } - } - internal sealed class SimpleReplacer : BookmarkMatcher - { - internal override bool Match(XmlElement item) { - return true; - } - internal override IUndoAction Replace(XmlElement item, string replacement) { - var a = item.GetAttributeNode(Constants.BookmarkAttributes.Title); - if (a == null) { - return null; - } - return a.Value != replacement - ? UndoAttributeAction.GetUndoAction(item, Constants.BookmarkAttributes.Title, replacement) - : (IUndoAction)null; - } - } - } -} diff --git a/pdfpatcher/App/Processor/InfoXmlProcessors/BookmarkOpenStatusProcessor.cs b/pdfpatcher/App/Processor/InfoXmlProcessors/BookmarkOpenStatusProcessor.cs deleted file mode 100644 index 689311a207840d9966fa6e150e029a06b00e6d05..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/InfoXmlProcessors/BookmarkOpenStatusProcessor.cs +++ /dev/null @@ -1,33 +0,0 @@ - -namespace PDFPatcher.Processor -{ - sealed class BookmarkOpenStatusProcessor : IPdfInfoXmlProcessor, IPdfInfoXmlProcessor - { - /// - /// 表示处理器是否应打开书签。 - /// - public bool Parameter { get; set; } - public BookmarkOpenStatusProcessor() { - } - public BookmarkOpenStatusProcessor(bool open) { - Parameter = open; - } - - #region IInfoDocProcessor 成员 - - public string Name => "设置书签状态为" + (Parameter ? "打开" : "关闭"); - - public IUndoAction Process(System.Xml.XmlElement item) { - if (item.SelectSingleNode(Constants.Bookmark) == null) { - return null; - } - var v = item.HasChildNodes && item.SelectSingleNode(Constants.Bookmark) != null && Parameter - ? Constants.Boolean.True - : null; - return UndoAttributeAction.GetUndoAction(item, Constants.BookmarkAttributes.Open, v); - } - - #endregion - - } -} diff --git a/pdfpatcher/App/Processor/InfoXmlProcessors/ChangeCoordinateProcessor.cs b/pdfpatcher/App/Processor/InfoXmlProcessors/ChangeCoordinateProcessor.cs deleted file mode 100644 index 21a835cdfb93c0f4cbb8163845e9f4b2ad8cfd86..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/InfoXmlProcessors/ChangeCoordinateProcessor.cs +++ /dev/null @@ -1,46 +0,0 @@ -using PDFPatcher.Common; - -namespace PDFPatcher.Processor -{ - sealed class ChangeCoordinateProcessor : IPdfInfoXmlProcessor - { - public string CoordinateName { get; } - public float Value { get; } - public bool IsAbsolute { get; } - public bool IsProportional { get; } - - public ChangeCoordinateProcessor(string coordinateName, float value, bool absolute, bool proportional) { - CoordinateName = coordinateName; - Value = value; - IsAbsolute = absolute; - IsProportional = proportional; - } - - #region IInfoDocProcessor 成员 - - public string Name => string.Concat((IsAbsolute ? "更改" : IsProportional ? "缩放" : "调整"), CoordinateName, "坐标定位"); - - public IUndoAction Process(System.Xml.XmlElement item) { - float c; - string v; - item.GetAttribute(CoordinateName).TryParse(out c); - if (IsAbsolute) { - if (c != Value) { - v = Value.ToText(); - } - else { - return null; - } - } - else if (Value != 0) { - v = (IsProportional ? Value * c : Value + c).ToText(); - } - else { - return null; - } - return UndoAttributeAction.GetUndoAction(item, CoordinateName, v); - } - - #endregion - } -} diff --git a/pdfpatcher/App/Processor/InfoXmlProcessors/ChangePageCoordinateProcessor.cs b/pdfpatcher/App/Processor/InfoXmlProcessors/ChangePageCoordinateProcessor.cs deleted file mode 100644 index ea6c347daebe661cf825a57618584f37d148bc01..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/InfoXmlProcessors/ChangePageCoordinateProcessor.cs +++ /dev/null @@ -1,32 +0,0 @@ -using PDFPatcher.Common; - -namespace PDFPatcher.Processor -{ - sealed class ChangePageCoordinateProcessor : IPdfInfoXmlProcessor - { - public string CoordinateName { get; } - public int PageNumber { get; } - public float X { get; } - public float Y { get; } - - public ChangePageCoordinateProcessor(string coordinateName, int pageNumber, float x, float y) { - CoordinateName = coordinateName; - PageNumber = pageNumber; - X = x; - Y = y; - } - - #region IInfoDocProcessor 成员 - - public string Name => "调整页码坐标定位"; - - public IUndoAction Process(System.Xml.XmlElement item) { - var undo = new UndoActionGroup(); - undo.Add(new ChangePageNumberProcessor(PageNumber, true, true).Process(item)); - undo.Add(new ChangeCoordinateProcessor(CoordinateName, Y, true, false).Process(item)); - return undo; - } - - #endregion - } -} diff --git a/pdfpatcher/App/Processor/InfoXmlProcessors/ChangePageNumberProcessor.cs b/pdfpatcher/App/Processor/InfoXmlProcessors/ChangePageNumberProcessor.cs deleted file mode 100644 index d08f22b017c1ee53b1953995692db6feabc25ce6..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/InfoXmlProcessors/ChangePageNumberProcessor.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using PDFPatcher.Common; - -namespace PDFPatcher.Processor -{ - sealed class ChangePageNumberProcessor : IPdfInfoXmlProcessor - { - public bool IsAbsolute { get; } - public int Amount { get; } - public bool SkipZero { get; } - - public ChangePageNumberProcessor(int amount) : this(amount, false, false) { } - public ChangePageNumberProcessor(int amount, bool isAbsolute, bool skipZero) { - IsAbsolute = isAbsolute; - Amount = amount; - SkipZero = skipZero; - } - - #region IInfoDocProcessor 成员 - - public string Name => "更改目标页码"; - - public IUndoAction Process(System.Xml.XmlElement item) { - int p; - var a = item.GetAttribute(Constants.DestinationAttributes.Action); - if ((String.IsNullOrEmpty(a) && SkipZero == false || a == Constants.ActionType.Goto || a == Constants.ActionType.GotoR) == false && item.HasAttribute(Constants.DestinationAttributes.Page) == false) { - return null; - } - if (item.GetAttribute(Constants.DestinationAttributes.Page).TryParse(out p)) { - if (IsAbsolute) { - if (p == Amount) { - return null; - } - p = Amount; - } - else { - p += Amount; - } - if (p < 1) { - return null; - } - return UndoAttributeAction.GetUndoAction(item, Constants.DestinationAttributes.Page, p.ToText()); - } - else { - var undo = new UndoActionGroup(); - undo.SetAttribute(item, Constants.DestinationAttributes.Page, Amount.ToText()); - if (String.IsNullOrEmpty(a)) { - undo.SetAttribute(item, Constants.DestinationAttributes.Action, Constants.ActionType.Goto); - } - return undo; - } - } - - #endregion - } -} diff --git a/pdfpatcher/App/Processor/InfoXmlProcessors/ChangeZoomRateProcessor.cs b/pdfpatcher/App/Processor/InfoXmlProcessors/ChangeZoomRateProcessor.cs deleted file mode 100644 index a7f40b81661255c1bc3045dc4e4175d5f5ec7bf2..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/InfoXmlProcessors/ChangeZoomRateProcessor.cs +++ /dev/null @@ -1,44 +0,0 @@ -using PDFPatcher.Common; - -namespace PDFPatcher.Processor -{ - sealed class ChangeZoomRateProcessor : IPdfInfoXmlProcessor - { - public string ZoomMethod { get; } - public float ZoomRate { get; } - - public ChangeZoomRateProcessor(object zoomRate) { - if (zoomRate is string || zoomRate == null) { - ZoomMethod = zoomRate as string; - ZoomRate = -1; - } - else if (zoomRate is float f) { - ZoomRate = f; - } - } - - #region IInfoDocProcessor 成员 - - public string Name => "更改缩放比例"; - - public IUndoAction Process(System.Xml.XmlElement item) { - UndoActionGroup undo; - if (ZoomRate >= 0) { - undo = new UndoActionGroup(); - undo.SetAttribute(item, Constants.DestinationAttributes.View, Constants.DestinationAttributes.ViewType.XYZ); - undo.SetAttribute(item, Constants.Coordinates.ScaleFactor, ZoomRate.ToText()); - } - else if (string.IsNullOrEmpty(ZoomMethod)) { - undo = new UndoActionGroup(); - undo.SetAttribute(item, Constants.DestinationAttributes.View, Constants.DestinationAttributes.ViewType.XYZ); - undo.RemoveAttribute(item, Constants.Coordinates.ScaleFactor); - } - else { - return UndoAttributeAction.GetUndoAction(item, Constants.DestinationAttributes.View, ZoomMethod); - } - return undo; - } - - #endregion - } -} diff --git a/pdfpatcher/App/Processor/InfoXmlProcessors/ClearDestinationOffsetProcessor.cs b/pdfpatcher/App/Processor/InfoXmlProcessors/ClearDestinationOffsetProcessor.cs deleted file mode 100644 index c1d657045ad99ea74a10cd257b1e265eca2e2463..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/InfoXmlProcessors/ClearDestinationOffsetProcessor.cs +++ /dev/null @@ -1,95 +0,0 @@ - -namespace PDFPatcher.Processor -{ - sealed class ClearDestinationOffsetProcessor : IPdfInfoXmlProcessor, IPdfInfoXmlProcessor - { - public enum PositionType { X, Y, XY } - - PositionType _type; - public PositionType Parameter { - get => _type; - set { - _type = value; - switch (_type) { - case PositionType.X: - _name = "横"; - break; - case PositionType.Y: - _name = "纵"; - break; - default: - _name = string.Empty; - break; - } - } - } - - string _name; - - public ClearDestinationOffsetProcessor() { - } - public ClearDestinationOffsetProcessor(PositionType type) { - Parameter = type; - switch (type) { - case PositionType.X: - _name = "横"; - break; - case PositionType.Y: - _name = "纵"; - break; - default: - _name = string.Empty; - break; - } - } - #region IInfoDocProcessor 成员 - - public string Name => "清除" + _name + "坐标定位偏移值"; - - public IUndoAction Process(System.Xml.XmlElement item) { - if (item.GetAttribute(Constants.DestinationAttributes.View) == Constants.DestinationAttributes.ViewType.FitR) { - return null; - } - switch (_type) { - case PositionType.X: - return ClearPositionOffset(item, Constants.Coordinates.Left); - case PositionType.Y: - return ClearPositionOffset(item, Constants.Coordinates.Top); - case PositionType.XY: - var x = ClearPositionOffset(item, Constants.Coordinates.Left); - var y = ClearPositionOffset(item, Constants.Coordinates.Top); - if (x != null && y != null) { - var g = new UndoActionGroup(); - g.Add(x); - g.Add(y); - return g; - } - else if (x != null) { - return x; - } - else if (y != null) { - return y; - } - break; - default: - break; - } - return null; - } - - private static IUndoAction ClearPositionOffset(System.Xml.XmlElement item, string coordinate) { - if (!item.HasAttribute(coordinate)) { - return null; - } - - var l = item.GetAttribute(coordinate); - if (l.Trim() == "0") { - return null; - } - item.RemoveAttribute(coordinate); - return new SetAttributeAction(item, coordinate, l); - } - - #endregion - } -} diff --git a/pdfpatcher/App/Processor/InfoXmlProcessors/DestinationGotoTopProcessor.cs b/pdfpatcher/App/Processor/InfoXmlProcessors/DestinationGotoTopProcessor.cs deleted file mode 100644 index 0207fc38a0a5a6eecc0b612b643602ea3eda0c24..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/InfoXmlProcessors/DestinationGotoTopProcessor.cs +++ /dev/null @@ -1,23 +0,0 @@ - -namespace PDFPatcher.Processor -{ - sealed class DestinationGotoTopProcessor : IPdfInfoXmlProcessor - { - #region IInfoDocProcessor 成员 - - public string Name => "设置点击目标到页首"; - - public IUndoAction Process(System.Xml.XmlElement item) { - if (item.HasAttribute(Constants.DestinationAttributes.Page)) { - var undo = new UndoActionGroup(); - undo.SetAttribute(item, Constants.DestinationAttributes.View, Constants.DestinationAttributes.ViewType.XYZ); - undo.SetAttribute(item, Constants.Coordinates.Top, "10000"); - undo.RemoveAttribute(item, Constants.Coordinates.ScaleFactor); - return undo; - } - return null; - } - - #endregion - } -} diff --git a/pdfpatcher/App/Processor/InfoXmlProcessors/ForceInternalLinkProcessor.cs b/pdfpatcher/App/Processor/InfoXmlProcessors/ForceInternalLinkProcessor.cs deleted file mode 100644 index 9a95826bdf16cbefc89f092475d96733b3d1d939..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/InfoXmlProcessors/ForceInternalLinkProcessor.cs +++ /dev/null @@ -1,34 +0,0 @@ - -using System; -using PDFPatcher.Common; -using A = PDFPatcher.Constants.ActionType; -using D = PDFPatcher.Constants.DestinationAttributes; - -namespace PDFPatcher.Processor -{ - sealed class ForceInternalLinkProcessor : IPdfInfoXmlProcessor - { - #region IInfoDocProcessor 成员 - - public string Name => "设置点击目标到页首"; - - public IUndoAction Process(System.Xml.XmlElement item) { - if (item.HasAttribute(D.Action) - && item.GetAttribute(D.Path).EndsWith(".pdf", StringComparison.InvariantCultureIgnoreCase) - && ValueHelper.IsInCollection(item.GetAttribute(D.Action), A.GotoR, A.Launch, A.Uri)) { - var undo = new UndoActionGroup(); - undo.Add(UndoAttributeAction.GetUndoAction(item, D.Action, A.Goto)); - if (item.HasAttribute(D.Page) == false - && item.HasAttribute(D.Named) == false - && item.HasAttribute(D.NamedN) == false - ) { - undo.Add(UndoAttributeAction.GetUndoAction(item, D.Page, "1")); - } - return undo; - } - return null; - } - - #endregion - } -} diff --git a/pdfpatcher/App/Processor/InfoXmlProcessors/IPdfInfoXmlProcessor.cs b/pdfpatcher/App/Processor/InfoXmlProcessors/IPdfInfoXmlProcessor.cs deleted file mode 100644 index 03514ad1c25cd80815c9414f2c8cbc6a7495bf95..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/InfoXmlProcessors/IPdfInfoXmlProcessor.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace PDFPatcher.Processor -{ - interface IPdfInfoXmlProcessor - { - string Name { get; } - IUndoAction Process(System.Xml.XmlElement item); - } - - interface IPdfInfoXmlProcessor : IPdfInfoXmlProcessor - { - T Parameter { get; set; } - } -} diff --git a/pdfpatcher/App/Processor/InfoXmlProcessors/LevelDownProcessor.cs b/pdfpatcher/App/Processor/InfoXmlProcessors/LevelDownProcessor.cs deleted file mode 100644 index ad61cec55d3b81e0a7e4c66c077b2a52888d0201..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/InfoXmlProcessors/LevelDownProcessor.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace PDFPatcher.Processor -{ - sealed class LevelDownProcessor : IPdfInfoXmlProcessor - { - #region IInfoDocProcessor 成员 - - public string Name => "设置书签为子书签"; - - public IUndoAction Process(System.Xml.XmlElement item) { - if (item == item.ParentNode.FirstChild) { - return null; - } - var undo = new UndoActionGroup(); - var n = item.SelectSingleNode("preceding-sibling::" + Constants.Bookmark + "[1]"); - if (n == null) { - return null; - } - - undo.Add(new AddElementAction(item)); - n.AppendChild(item); - undo.Add(new RemoveElementAction(item)); - return undo; - } - - #endregion - } -} diff --git a/pdfpatcher/App/Processor/InfoXmlProcessors/LevelUpProcessor.cs b/pdfpatcher/App/Processor/InfoXmlProcessors/LevelUpProcessor.cs deleted file mode 100644 index 30d936ace4137b98c35aa37f405167bc8120c46a..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/InfoXmlProcessors/LevelUpProcessor.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; - -namespace PDFPatcher.Processor -{ - sealed class LevelUpProcessor : IPdfInfoXmlProcessor - { - #region IInfoDocProcessor 成员 - - public string Name => "设置书签为父书签"; - - public IUndoAction Process(System.Xml.XmlElement item) { - if (item.ParentNode.Name != Constants.Bookmark) { - return null; - } - var undo = new UndoActionGroup(); - var fs = item.SelectNodes("following-sibling::" + Constants.Bookmark); - foreach (System.Xml.XmlElement f in fs) { - undo.Add(new AddElementAction(f)); - item.AppendChild(f); - undo.Add(new RemoveElementAction(f)); - } - undo.Add(new AddElementAction(item)); - item.ParentNode.ParentNode.InsertAfter(item, item.ParentNode); - undo.Add(new RemoveElementAction(item)); - return undo; - } - - #endregion - } -} diff --git a/pdfpatcher/App/Processor/InfoXmlProcessors/ReplaceTitleTextProcessor.cs b/pdfpatcher/App/Processor/InfoXmlProcessors/ReplaceTitleTextProcessor.cs deleted file mode 100644 index 34badced31dd64215287aae6b360ae32de68e601..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/InfoXmlProcessors/ReplaceTitleTextProcessor.cs +++ /dev/null @@ -1,36 +0,0 @@ -namespace PDFPatcher.Processor -{ - sealed class ReplaceTitleTextProcessor : IPdfInfoXmlProcessor - { - static readonly BookmarkMatcher.SimpleReplacer __replacer = new BookmarkMatcher.SimpleReplacer(); - - readonly BookmarkMatcher _matcher; - readonly string _replacement; - - public ReplaceTitleTextProcessor(string replacement) { - _matcher = __replacer; - _replacement = replacement; - } - public ReplaceTitleTextProcessor(BookmarkMatcher matcher, string replacement) { - if (matcher == null) { - throw new System.ArgumentNullException("matcher"); - } - _matcher = matcher; - _replacement = replacement; - } - - #region IInfoDocProcessor 成员 - - public string Name => string.Concat("替换文本为“", _replacement, "”"); - - public IUndoAction Process(System.Xml.XmlElement item) { - var a = item.GetAttributeNode(Constants.BookmarkAttributes.Title); - if (a == null) { - return null; - } - return _matcher.Replace(item, _replacement); - } - - #endregion - } -} diff --git a/pdfpatcher/App/Processor/InfoXmlProcessors/SetCaseProcessor.cs b/pdfpatcher/App/Processor/InfoXmlProcessors/SetCaseProcessor.cs deleted file mode 100644 index 51eb0fdad241a5e88799f5b8f2247c3ac26836dc..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/InfoXmlProcessors/SetCaseProcessor.cs +++ /dev/null @@ -1,227 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace PDFPatcher.Processor -{ - sealed class SetCaseProcessor : IPdfInfoXmlProcessor - { - static readonly System.Globalization.TextInfo __currentTextInfo = System.Globalization.CultureInfo.CurrentCulture.TextInfo; - static readonly char[] FullWidthNumbers = "01234567890".ToCharArray(); - static readonly char[] HalfWidthNumbers = "01234567890".ToCharArray(); - static readonly char[] ChineseNumbers = "○一二三四五六七八九〇".ToCharArray(); - static readonly char[] TraditionalChineseNumbers = "零壹贰叁肆伍陆柒捌玖零".ToCharArray(); - - internal const string FullWidthPunctuations = "!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"; - internal const string HalfWidthPunctuations = "!\"#$%&'()*+,-./;:<=>?@[\\]^_`{|}~"; - - internal static string[] CaseNames = new string[]{ - "首字母大写", "英文大写", "英文小写", - "全角数字", "全角字母", "全角标点", - "半角数字", "半角字母", "半角标点", - "中文数字", "大写中文数字", - "繁体汉字转简体", "简体汉字转繁体" - }; - - public enum LetterCase - { - Title, Upper, Lower, - FullWidthNumber, FullWidthAlphabetic, FullWidthPunctuation, - HalfWidthNumber, HalfWidthAlphabetic, HalfWidthPunctuation, - ChineseNumber, TraditionalChineseNumbers, - TraditionalToSimplifiedCjk, SimplifiedToTraditionalCjk - } - - public LetterCase Case { get; } - - public SetCaseProcessor(LetterCase letterCase) { - Case = letterCase; - } - - #region IInfoDocProcessor 成员 - - public string Name => "设置书签文本为" + CaseNames[(int)Case]; - - public IUndoAction Process(System.Xml.XmlElement item) { - var a = item.GetAttributeNode(Constants.BookmarkAttributes.Title); - if (a == null) { - return null; - } - var source = a.Value; - var value = ConvertCase(source, Case); - if (source == value) { - return null; - } - return UndoAttributeAction.GetUndoAction(item, Constants.BookmarkAttributes.Title, value); - } - - #endregion - - static string ConvertCase(string source, LetterCase targetCase) { - string value; - switch (targetCase) { - case LetterCase.Lower: - return source.ToLowerInvariant(); - case LetterCase.Upper: - return source.ToUpperInvariant(); - case LetterCase.Title: - return __currentTextInfo.ToTitleCase(source.ToLowerInvariant()); - case LetterCase.FullWidthAlphabetic: - return HWL2FWL.Convert(source); - case LetterCase.FullWidthNumber: - return HWN2FWN.Convert(source); - case LetterCase.FullWidthPunctuation: - return HWP2FWP.Convert(source); - case LetterCase.HalfWidthAlphabetic: - return FWL2HWL.Convert(source); - case LetterCase.HalfWidthNumber: - return FWN2HWN.Convert(source); - case LetterCase.HalfWidthPunctuation: - return FWP2HWP.Convert(source); - case LetterCase.ChineseNumber: - value = Translate(source, FullWidthNumbers, ChineseNumbers); - return Translate(value, HalfWidthNumbers, ChineseNumbers); - case LetterCase.TraditionalChineseNumbers: - value = Translate(source, FullWidthNumbers, TraditionalChineseNumbers); - value = Translate(value, HalfWidthNumbers, TraditionalChineseNumbers); - return Translate(value, ChineseNumbers, TraditionalChineseNumbers); - case LetterCase.SimplifiedToTraditionalCjk: - return SC2TC.Convert(source); - case LetterCase.TraditionalToSimplifiedCjk: - return TC2SC.Convert(source); - default: throw new ArgumentOutOfRangeException("LetterCase"); - } - } - - // todo 优化转换效率:避免 ToCharArray 和无条件创建新字符串 - static string Translate(string s, char[] source, char[] target) { - var cs = s.ToCharArray(); - for (int i = 0; i < cs.Length; i++) { - ref char c = ref cs[i]; - var p = Array.IndexOf(source, c); - if (p != -1) { - c = target[p]; - } - } - return new string(cs); - } - - static char FullWidthLetterToHalfWidth(char ch) { - return ch >= 'a' && ch <= 'z' ? (char)(ch - 'a' + 'a') - : ch >= 'A' && ch <= 'Z' ? (char)(ch - 'A' + 'A') - : ch; - } - - static char HalfWidthLetterToFullWidth(char ch) { - return ch >= 'a' && ch <= 'z' ? (char)(ch + 'a' - 'a') - : ch >= 'A' && ch <= 'Z' ? (char)(ch + 'A' - 'A') - : ch; - } - static char FullWidthNumberToHalfWidth(char ch) { - return ch >= '0' && ch <= '9' ? (char)(ch - '0' + '0') : ch; - } - - static char HalfWidthNumberToFullWidth(char ch) { - return ch >= '0' && ch <= '9' ? (char)(ch + '0' - '0') : ch; - } - - static class SC2TC - { - public static readonly Converter Convert = new StringMapper(new CharacterMapper(Constants.Chinese.Simplified, Constants.Chinese.Traditional).Map).Convert; - } - static class TC2SC - { - public static readonly Converter Convert = new StringMapper(new CharacterMapper(Constants.Chinese.Traditional, Constants.Chinese.Simplified).Map).Convert; - } - static class FWP2HWP - { - public static readonly Converter Convert = new StringMapper(new CharacterMapper(FullWidthPunctuations, HalfWidthPunctuations).Map).Convert; - } - static class HWP2FWP - { - public static readonly Converter Convert = new StringMapper(new CharacterMapper(HalfWidthPunctuations, FullWidthPunctuations).Map).Convert; - } - static class FWL2HWL - { - public static readonly Converter Convert = new StringMapper(FullWidthLetterToHalfWidth).Convert; - } - static class HWL2FWL - { - public static readonly Converter Convert = new StringMapper(HalfWidthLetterToFullWidth).Convert; - } - static class FWN2HWN - { - public static readonly Converter Convert = new StringMapper(FullWidthNumberToHalfWidth).Convert; - } - static class HWN2FWN - { - public static readonly Converter Convert = new StringMapper(HalfWidthNumberToFullWidth).Convert; - } - - sealed class StringMapper - { - readonly Converter Converter; - public StringMapper(Converter converter) { - Converter = converter; - } - - public unsafe string Convert(string value) { - if (String.IsNullOrEmpty(value)) { - return value; - } - int i = 0; - foreach (var ch in value) { - if (ch != Converter(ch)) { - break; - } - ++i; - } - if (i == value.Length) { - return value; - } - var r = String.Copy(value); - fixed (char* s = r) { - char* c = s + i; - char* end = c + value.Length; - do { - *c = Converter(*c); - } while (++c < end); - } - return r; - } - } - - sealed class CharacterMapper - { - readonly Dictionary _Mapper; - - public CharacterMapper(string from, string to) { - var i = 0; - _Mapper = new Dictionary(from.Length); - foreach (var item in from) { - _Mapper[item] = to[i++]; - } - } - - public char Map(char value) { - return _Mapper.TryGetValue(value, out var r) ? r : value; - } - } - - sealed class SequentialCharacterMapper - { - readonly char _From, _To; - readonly int _Count; - - public SequentialCharacterMapper(char from, char to, int count) { - _From = from; - _To = to; - _Count = count; - } - - public char Map(char value) { - var d = value - _From; - return d >= 0 && d < _Count ? (char)(_To + d) : value; - } - } - } -} diff --git a/pdfpatcher/App/Processor/InfoXmlProcessors/SetTextColorProcessor.cs b/pdfpatcher/App/Processor/InfoXmlProcessors/SetTextColorProcessor.cs deleted file mode 100644 index ecf78b8cd1c10d155d258c99f851a9c54ae854cf..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/InfoXmlProcessors/SetTextColorProcessor.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Drawing; -using PDFPatcher.Common; - -namespace PDFPatcher.Processor -{ - sealed class SetTextColorProcessor : IPdfInfoXmlProcessor - { - readonly string r, g, b; - - public SetTextColorProcessor(Color color) { - if (color != Color.Transparent && color != Color.White) { - r = ValueHelper.ToText(color.R / 255f); - g = ValueHelper.ToText(color.G / 255f); - b = ValueHelper.ToText(color.B / 255f); - } - } - - #region IInfoDocProcessor 成员 - - public string Name => "设置书签文本颜色"; - - public IUndoAction Process(System.Xml.XmlElement item) { - var undo = new UndoActionGroup(); - if (String.IsNullOrEmpty(r)) { - undo.RemoveAttribute(item, Constants.Colors.Red); - undo.RemoveAttribute(item, Constants.Colors.Green); - undo.RemoveAttribute(item, Constants.Colors.Blue); - } - else { - undo.SetAttribute(item, Constants.Colors.Red, r); - undo.SetAttribute(item, Constants.Colors.Green, g); - undo.SetAttribute(item, Constants.Colors.Blue, b); - } - undo.RemoveAttribute(item, Constants.Color); - return undo; - } - - #endregion - } -} diff --git a/pdfpatcher/App/Processor/InfoXmlProcessors/SetTextStyleProcessor.cs b/pdfpatcher/App/Processor/InfoXmlProcessors/SetTextStyleProcessor.cs deleted file mode 100644 index 865f2c63581125cbffc59d02fe6f6e756d73cc73..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/InfoXmlProcessors/SetTextStyleProcessor.cs +++ /dev/null @@ -1,88 +0,0 @@ - -namespace PDFPatcher.Processor -{ - sealed class SetTextStyleProcessor : IPdfInfoXmlProcessor - { - public enum Style - { - SetBold = 0, SetItalic = 1, RemoveBold = 10, RemoveItalic = 11 - } - - readonly Style _style; - public SetTextStyleProcessor(System.Xml.XmlElement element, Style style) { - var s = element.GetAttribute(Constants.BookmarkAttributes.Style); - if (style == Style.SetBold) { - _style = s != Constants.BookmarkAttributes.StyleType.Bold && s != Constants.BookmarkAttributes.StyleType.BoldItalic - ? Style.SetBold - : Style.RemoveBold; - } - else if (style == Style.SetItalic) { - _style = s != Constants.BookmarkAttributes.StyleType.Italic && s != Constants.BookmarkAttributes.StyleType.BoldItalic - ? Style.SetItalic - : Style.RemoveItalic; - } - } - - #region IInfoDocProcessor 成员 - - public string Name { - get { - return _style switch { - Style.SetBold => "设置书签文本为粗体", - Style.SetItalic => "设置书签文本为斜体", - Style.RemoveBold => "清除书签文本粗体样式", - Style.RemoveItalic => "清除书签文本斜体样式", - _ => "", - }; - } - } - - public IUndoAction Process(System.Xml.XmlElement item) { - var value = item.GetAttribute(Constants.BookmarkAttributes.Style); - var style = 0; - switch (value) { - case Constants.BookmarkAttributes.StyleType.Bold: style = 1; break; - case Constants.BookmarkAttributes.StyleType.Italic: style = 2; break; - case Constants.BookmarkAttributes.StyleType.BoldItalic: style = 3; break; - default: - break; - } - switch (_style) { - case Style.SetBold: - if ((style & 0x01) > 0) { - return null; - } - style |= 0x01; - break; - case Style.SetItalic: - if ((style & 0x02) > 0) { - return null; - } - style |= 0x02; - break; - case Style.RemoveBold: - if ((style & 0x01) == 0) { - return null; - } - style ^= 0x01; - break; - case Style.RemoveItalic: - if ((style & 0x02) == 0) { - return null; - } - style ^= 0x02; - break; - default: throw new System.ArgumentOutOfRangeException("Style"); - } - value = style switch { - 1 => Constants.BookmarkAttributes.StyleType.Bold, - 2 => Constants.BookmarkAttributes.StyleType.Italic, - 3 => Constants.BookmarkAttributes.StyleType.BoldItalic, - _ => null, - }; - return UndoAttributeAction.GetUndoAction(item, Constants.BookmarkAttributes.Style, value); - } - - #endregion - } -} diff --git a/pdfpatcher/App/Processor/InfoXmlProcessors/UndoAction.cs b/pdfpatcher/App/Processor/InfoXmlProcessors/UndoAction.cs deleted file mode 100644 index b572b528583d39ab2d6f7f85ff0fefc430380425..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/InfoXmlProcessors/UndoAction.cs +++ /dev/null @@ -1,269 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Xml; - -namespace PDFPatcher.Processor -{ - interface IUndoAction - { - IEnumerable AffectedElements { get; } - bool Undo(); - } - - sealed class UndoManager - { - readonly Stack _undoActions = new Stack(); - readonly List _names = new List(); - - public delegate void OnUndoDelegate(UndoManager undoManager, IUndoAction action); - - public bool CanUndo => _names.Count > 0; - - public OnUndoDelegate OnAddUndo = null; - public OnUndoDelegate OnUndo = null; - - public void Clear() { - _names.Clear(); - _undoActions.Clear(); - } - - public void AddUndo(string name, IUndoAction action) { - if (action == null) { - return; - } - _names.Add(name); - _undoActions.Push(action); - OnAddUndo?.Invoke(this, action); - } - - public string[] GetActionNames(int limit) { - var n = new string[_names.Count > limit ? limit : _names.Count]; - var j = 0; - for (int i = n.Length - 1; i >= 0; i--) { - n[j++] = _names[i]; - } - return n; - } - - public IEnumerable Undo() { - if (!CanUndo) { - return null; - } - - _names.RemoveAt(_names.Count - 1); - if (_names.Count > 100 && _names.Capacity > 200) { - _names.TrimExcess(); - } - var a = _undoActions.Pop(); - a.Undo(); - OnUndo?.Invoke(this, a); - return a.AffectedElements; - } - } - - sealed class UndoActionGroup : IUndoAction - { - readonly List _actions = new List(); - - public int Count => _actions.Count; - - public UndoActionGroup() { - } - - public UndoActionGroup(IEnumerable actions) { - _actions.AddRange(actions); - } - - public void Add(IUndoAction action) { - if (action == null) { - return; - } - if (action is UndoActionGroup g) { - _actions.AddRange(g._actions); - } - else { - _actions.Add(action); - } - } - - public void RemoveElement(XmlElement target) { - Add(new RemoveElementAction(target)); - } - public void AddElement(XmlElement target) { - Add(new AddElementAction(target)); - } - public void SetAttribute(XmlElement targetNode, string name, string newValue) { - Add(UndoAttributeAction.GetUndoAction(targetNode, name, newValue)); - } - public void RemoveAttribute(XmlElement target, string name) { - Add(UndoAttributeAction.GetUndoAction(target, name, null)); - } - #region IUndoAction 成员 - - public IEnumerable AffectedElements { - get { - var d = new Dictionary(); - foreach (var item in _actions) { - foreach (var e in item.AffectedElements) { - d[e] = 0; - } - } - return d.Keys; - } - } - public bool Undo() { - for (int i = _actions.Count - 1; i >= 0; i--) { - _actions[i].Undo(); - } - return true; - } - - #endregion - } - - abstract class UndoElementAction : IUndoAction - { - public XmlNode Parent { get; } - public XmlElement TargetElement { get; } - - protected UndoElementAction(XmlElement target) { - TargetElement = target ?? throw new ArgumentNullException("undo/element/target"); - Parent = target.ParentNode; - } - - #region IUndoAction 成员 - - public IEnumerable AffectedElements => new XmlNode[] { Parent }; - public abstract bool Undo(); - - #endregion - } - - sealed class RemoveElementAction : UndoElementAction - { - public RemoveElementAction(XmlElement target) : base(target) { - } - - public override bool Undo() { - TargetElement.ParentNode.RemoveChild(TargetElement); - return true; - } - } - - sealed class AddElementAction : UndoElementAction - { - public XmlNode RefNode { get; } - - public AddElementAction(XmlElement target) : base(target) { - RefNode = target.NextSibling; - } - - public override bool Undo() { - if (RefNode == null) { - Parent.AppendChild(TargetElement); - } - else { - Parent.InsertBefore(TargetElement, RefNode); - } - return true; - } - } - - abstract class UndoAttributeAction : IUndoAction - { - public XmlElement TargetElement { get; } - public string Name { get; } - - protected UndoAttributeAction(XmlElement targetNode, string name) { - if (String.IsNullOrEmpty(name)) { - throw new ArgumentNullException("undo/attr/name"); - } - TargetElement = targetNode ?? throw new ArgumentNullException("undo/attr/target"); - Name = name; - } - - //internal static UndoActionGroup GetUndoAttributeGroup (XmlElement targetNode, params string[] names) { - // var undoList = new UndoActionGroup (); - // foreach (var item in names) { - // if (targetNode.HasAttribute (item)) { - // undoList.Add (new SetAttributeAction (targetNode, item, targetNode.GetAttribute (item))); - // } - // else { - // undoList.Add (new RemoveAttributeAction (targetNode, item)); - // } - // } - // return undoList; - //} - - //internal static IUndoAction[] GetUndoListForAttributes (XmlElement targetNode, params string[] names) { - // var undoList = new IUndoAction[names.Length]; - // var i = 0; - // foreach (var item in names) { - // if (targetNode.HasAttribute (item)) { - // undoList[i++] = new SetAttributeAction (targetNode, item, targetNode.GetAttribute (item)); - // } - // else { - // undoList[i++] = new RemoveAttributeAction (targetNode, item); - // } - // } - // return undoList; - //} - - /// - /// 设置目标元素的属性值,并返回撤销动作。 - /// - /// 需要修改的元素节点。 - /// 属性名称。 - /// 新属性值。 - /// 撤销设置属性的动作。 - internal static UndoAttributeAction GetUndoAction(XmlElement targetNode, string name, string newValue) { - if (targetNode.HasAttribute(name)) { - var v = targetNode.GetAttribute(name); - if (v == newValue) { - return null; - } - if (newValue != null) { - targetNode.SetAttribute(name, newValue); - } - else { - targetNode.RemoveAttribute(name); - } - return new SetAttributeAction(targetNode, name, v); - } - else if (newValue != null) { - targetNode.SetAttribute(name, newValue); - } - return new RemoveAttributeAction(targetNode, name); - } - - #region IUndoAction 成员 - public IEnumerable AffectedElements => new XmlNode[] { TargetElement }; - public abstract bool Undo(); - #endregion - } - - sealed class RemoveAttributeAction : UndoAttributeAction - { - public RemoveAttributeAction(XmlElement targeNode, string name) : base(targeNode, name) { - } - - public override bool Undo() { - TargetElement.RemoveAttribute(Name); - return true; - } - } - - sealed class SetAttributeAction : UndoAttributeAction - { - public string Value { get; } - - public SetAttributeAction(XmlElement targeNode, string name, string value) : base(targeNode, name) { - Value = value; - } - - public override bool Undo() { - TargetElement.SetAttribute(Name, Value); - return true; - } - } -} diff --git a/pdfpatcher/App/Processor/ModiOcr.cs b/pdfpatcher/App/Processor/ModiOcr.cs deleted file mode 100644 index c0db04160b75215b4ffb97b807cddad71c053fd7..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/ModiOcr.cs +++ /dev/null @@ -1,295 +0,0 @@ -#define DEBUGOCR -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Runtime.InteropServices; -using Microsoft.Win32; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - public class ModiOcr - { - //static string _modiPath; - const string __MachineRegistryPath = @"Installer\Components\61BA386016BD0C340BBEAC273D84FD5F"; - const string __UserRegistryPath = @"Software\Microsoft\Installer\Components\61BA386016BD0C340BBEAC273D84FD5F"; - - static readonly List __InstalledLanguage = DetectInstalledLanguages(); - static readonly bool __ModiInstalled = DetectModi(); - public int LangID { get; set; } - public bool StretchPage { get; set; } - public bool OrientPage { get; set; } - public WritingDirection WritingDirection { get; set; } - - public ModiOcr() { - //if (_modiPath == null) { - // _modiPath = FindModi (); - //} - } - - internal static bool ModiInstalled => __ModiInstalled; - - #region COMInterop - static readonly object[] EmptyArray = new object[0]; - static object Create(string type) { - var t = Type.GetTypeFromProgID(type); - if (t == null) { - return null; - } - return Activator.CreateInstance(t); - } - static object Call(object instance, string method, params object[] parameters) { - try { - return instance.GetType().InvokeMember(method, BindingFlags.InvokeMethod, null, instance, parameters); - } - catch (Exception ex) { - if (ex.InnerException != null) { - throw ex.InnerException; - } - throw; - } - } - static object Get(object instance, string propertyName) { - return instance.GetType().InvokeMember(propertyName, BindingFlags.GetProperty, null, instance, EmptyArray); - } - static T Get(object instance, string propertyName) { - return (T)Get(instance, propertyName); - } - static object Get(object instance, string propertyName, int index) { - return instance.GetType().InvokeMember(propertyName, BindingFlags.GetProperty, null, instance, new object[1] { index }); - } - static void FinalReleaseComObjects(params object[] objs) { - for (int i = 0; i < objs.Length; i++) { - if (objs[i] == null) { - continue; - } - try { - var r = Marshal.ReleaseComObject(objs[i]); - System.Diagnostics.Debug.Assert(r == 0); - } - catch (Exception ex) { - System.Diagnostics.Debug.WriteLine("释放对象时出现错误:" + ex.Message); - } - } - } - #endregion - - static bool DetectModi() { - if (__InstalledLanguage.Count == 0) { - return false; - } - var ocr = Create("MODI.Document"); - if (ocr == null) { - return false; - } - FinalReleaseComObjects(ocr); - return true; - } - - internal static bool IsLanguageInstalled(int langID) { - return __InstalledLanguage.Contains(langID); - } - - static List DetectInstalledLanguages() { - var l = new List(); - try { - using (var k = Registry.CurrentUser.OpenSubKey(__UserRegistryPath)) { - DetectInstalledLanguages(k, l); - } - using (var k = Registry.ClassesRoot.OpenSubKey(__MachineRegistryPath)) { - DetectInstalledLanguages(k, l); - } - } - catch (Exception ex) { - Tracker.DebugMessage("OCR registry error: " + ex.Message); - } - return l; - } - - private static void DetectInstalledLanguages(RegistryKey k, List list) { - if (k == null) { - return; - } - foreach (var n in k.GetValueNames()) { - var i = n.ToInt32(); - if (i == 0) { - continue; - } - if (Constants.Ocr.LangIDs.Contains(i) && list.Contains(i) == false) { - list.Add(i); - } - } - } - - internal void Ocr(string path, string saveImagePath, List results) { - object ocr = null, images = null, image = null, layout = null; - object merge = null, mergeImages = null; - IEnumerable words = null, rects = null; - TextLine line = null; - int lineID = -1, regionID = -1; - int cl, cr; - TextInfo cti = null; - try { -#if DEBUGOCR - Tracker.TraceMessage("创建识别引擎对象。"); -#endif - ocr = Create("MODI.Document"); - var p = Environment.CurrentDirectory; - //Environment.CurrentDirectory = _modiPath; -#if DEBUGOCR - Tracker.TraceMessage("读取识别图像:" + path); -#endif - Call(ocr, "Create", path); -#if DEBUGOCR - Tracker.TraceMessage("执行识别:" + LangID); -#endif - Call(ocr, "OCR", ValueHelper.MapValue(LangID, Constants.Ocr.LangIDs, Constants.Ocr.OcrLangIDs), OrientPage, StretchPage); - - Environment.CurrentDirectory = p; -#if DEBUGOCR - Tracker.TraceMessage("读取识别结果。"); -#endif - images = Get(ocr, "Images"); - image = Get(images, "Item", 0); - layout = Get(image, "Layout"); -#if DEBUGOCR && DEBUG - var l = new StreamWriter(@"m:\ocr.txt", true, System.Text.Encoding.Default); - l.WriteLine("path: " + path); -#endif - words = Get(layout, "Words"); - foreach (var word in words) { - var ti = new TextInfo(); - var w = Get(word, "Text"); - ti.Text = w; - var pos = new float[4]; - rects = Get(word, "Rects"); - foreach (var rect in rects) { - int r = Get(rect, "Left"); - if (r < pos[0] || pos[0] == 0) { - pos[0] = r; - } - r = Get(rect, "Top"); - if (r > pos[1]) { - pos[1] = r; - } - r = Get(rect, "Right"); - if (r > pos[2]) { - pos[2] = r; - } - r = Get(rect, "Bottom"); - if (r < pos[3] || pos[3] == 0) { - pos[3] = r; - } - FinalReleaseComObjects(rect); - } - Marshal.ReleaseComObject(rects); - ti.Region = new Bound(pos[0], pos[3], pos[2], pos[1]); - ti.Font = null; - ti.Size = pos[3] - pos[1]; - if (ti.Text.Length == 1) { - switch (ti.Text[0]) { - case '一': - var r = ti.Region; - ti.Size = r.Width > r.Height ? r.Width : r.Height; - var s = (int)Math.Ceiling(ti.Size / 2 - (r.Width > r.Height ? r.Height : r.Width) / 2); - ti.Region = new Bound(r.Left, r.Bottom + s, r.Right, r.Top - s); - break; - case '\u2022': - ti.Text = "·"; - break; - } - } - if (Char.IsLetterOrDigit(ti.Text[0]) && ti.Size > 0) { - ti.LetterWidth = ti.Size; - } - cl = Get(word, "LineID"); - cr = Get(word, "RegionID"); - var sl = (cl == lineID && cr == regionID); // 处于同一行 - if (sl && WritingDirection != WritingDirection.Unknown) { - sl = cti != null - && cti.Region.IsAlignedWith(ti.Region, WritingDirection); - } - if (sl) { - if (cti != null && cti.Region == ti.Region) { - cti.Text += ti.Text; - } - else { - line.AddText(ti); - } - } - else { - if (line != null) { - results.Add(line); - } - line = new TextLine(ti) { - SuppressTextInfoArrangement = true - }; - lineID = cl; - regionID = cr; - } - cti = ti; -#if DEBUGOCR && DEBUG - l.WriteLine(String.Concat(ti.Size, "\t", ti.Text, "\t", ti.Region.Top, " ", ti.Region.Left, " ", ti.Region.Bottom, " ", ti.Region.Right)); -#endif - FinalReleaseComObjects(word); - } - Marshal.ReleaseComObject(words); - if (line != null) { - results.Add(line); - } -#if DEBUGOCR && DEBUG - l.Close(); -#endif - if (FileHelper.IsPathValid(saveImagePath)) { -#if DEBUGOCR - Tracker.TraceMessage("保存识别后图像路径:" + saveImagePath); -#endif - if (File.Exists(saveImagePath) == false) { - Call(ocr, "SaveAs", saveImagePath, -1); - } - else { - merge = Create("MODI.Document"); - Call(merge, "Create", saveImagePath); - mergeImages = Get(merge, "Images"); - Call(mergeImages, "Add", image, Get(mergeImages, "Item", 0)); - Call(merge, "Save"); - } - } -#if DEBUGOCR - Tracker.TraceMessage("完成识别操作。"); -#endif - Call(ocr, "Close", false); - } - finally { -#if DEBUGOCR - Tracker.TraceMessage("释放识别引擎对象。"); -#endif - FinalReleaseComObjects(rects, words, layout, image, images, ocr); - FinalReleaseComObjects(merge, mergeImages); - words = rects = null; - ocr = images = image = layout = null; - merge = mergeImages = null; - } - - } - - //private static string FindModi () { - // var p = Registry.GetValue (@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools", "SharedFilesDir", null) as string; - // if (p != null && Directory.Exists (p)) { - // var m = String.Concat (p, @"\MODI\12.0\"); - // if (Directory.Exists (m)) { - // return m; - // } - // m = String.Concat (p, @"\MODI\11.0\"); - // if (Directory.Exists (m)) { - // return m; - // } - // } - // throw new FileNotFoundException ("无法找到微软 Office 文档图像处理引擎。"); - //} - } -} diff --git a/pdfpatcher/App/Processor/Mupdf/DataModels.cs b/pdfpatcher/App/Processor/Mupdf/DataModels.cs deleted file mode 100644 index 4ddc1f94dba690e5dc8a7e1e7b798e85927e850c..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Mupdf/DataModels.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace PDFPatcher.Processor.Mupdf -{ - [StructLayout (LayoutKind.Sequential)] - internal class GlyphCache - { - /*fz_hashtable**/ IntPtr hash; - int total; - } - - internal class PdfXref - { - IntPtr ptr = IntPtr.Zero; - PdfXrefStruct data; - - internal int Length { get { return data.Length; } } - - public static PdfXref Open (string fileName, string password) { - IntPtr p = IntPtr.Zero; - Open (ref p, fileName, password); - var r = LoadPageTree (p); - var xref = new PdfXref () - { - data = Common.PInvokeHelper.UnwrapPointer (p), - ptr = p - }; - return xref; - } - - public void Close () { - Close (ptr); - } - - #region Native Methods - [DllImport (Constants.LibMupdf, EntryPoint = "pdf_open_xref", CharSet=CharSet.Ansi)] - extern static int Open (ref IntPtr /*pdf_xref ***/xrefp, string /*char **/filename, string /*char **/password); - - [DllImport (Constants.LibMupdf, EntryPoint = "pdf_free_xref")] - extern static void Close (IntPtr /*pdf_xref **/ xref); - - [DllImport (Constants.LibMupdf, EntryPoint = "pdf_load_page_tree")] - extern static int LoadPageTree (IntPtr /*pdf_xref **/ xref); - #endregion - - [StructLayout (LayoutKind.Sequential)] - class PdfXrefStruct - { - #region Fields - IntPtr /*fz_stream **/file; - int version; - int startxref; - int filesize; - IntPtr /*pdf_crypt **/crypt; - IntPtr /*fz_obj **/trailer; - - int len; - IntPtr /*pdf_xrefentry **/table; - - int pagelen; - int pagecap; - IntPtr /*fz_obj ***/pageobjs; - IntPtr /*fz_obj ***/pagerefs; - - IntPtr /*struct pdf_store_s **/store; - [MarshalAsAttribute (UnmanagedType.ByValArray, SizeConst = 65536, ArraySubType = UnmanagedType.U1)] - byte[] /*char*/ scratch/*[65536]*/; - #endregion - - #region Properties - internal int Version { get { return version; } } - internal int Length { get { return len; } } - internal int PageCount { get { return pagelen; } } - #endregion - - } - } - -} diff --git a/pdfpatcher/App/Processor/Mupdf/ImageRendererOptions.cs b/pdfpatcher/App/Processor/Mupdf/ImageRendererOptions.cs deleted file mode 100644 index 8421e8633a2e735f4d7de02e36100e55da24dfbc..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Mupdf/ImageRendererOptions.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Xml.Serialization; - -namespace MuPdfSharp -{ - public class ImageRendererOptions - { - [XmlAttribute("自动指定输出位置")] - public bool AutoOutputFolder { get; set; } - - ///获取或指定导出图片的格式。 - [XmlAttribute("图片格式")] - public ImageFormat FileFormat { get; set; } - public string FileFormatExtension => FileFormat == ImageFormat.Jpeg ? ".jpg" : FileFormat == ImageFormat.Tiff ? ".tif" : ".png"; - ///获取或指定是否垂直翻转导出的图片。 - [XmlAttribute("垂直翻转图片")] - public bool VerticalFlipImages { get; set; } - - ///获取或指定是否水平翻转导出的图片。 - [XmlAttribute("水平翻转图片")] - public bool HorizontalFlipImages { get; set; } - - /// 获取或指定导出图片的颜色。 - [XmlAttribute("图片颜色")] - public ColorSpace ColorSpace { get; set; } - - /// 获取或指定是否反转图片的颜色。 - [XmlAttribute("反转图片颜色")] - public bool InvertColor { get; set; } - - [XmlAttribute("JPEG质量")] - public int JpegQuality { get; set; } - - /// 获取或指定旋转图片的角度。 - [XmlAttribute("旋转角度")] - public int Rotation { get; set; } - - [XmlAttribute("图片宽度")] - public int ImageWidth { get; set; } - - [XmlAttribute("图片比例")] - public float ScaleRatio { get; set; } - - float _Dpi = 72f; - [XmlAttribute("分辨率")] - public float Dpi { get => _Dpi; set => _Dpi = value > 0 ? value : 72f; } - - [XmlAttribute("尺寸模式")] - public bool UseSpecificWidth { get; set; } - - ///获取或指定导出页面图像所保存的目录路径。 - [XmlAttribute("导出路径")] - public string ExtractImagePath { get; set; } - - ///获取或指定导出文件的名称掩码。 - [XmlAttribute("文件名称掩码")] - public string FileMask { get; set; } - - [XmlIgnore] - public string ExtractPageRange { get; set; } - - [XmlAttribute("适合区域")] - public bool FitArea { get; set; } - - [XmlAttribute("隐藏批注")] - public bool HideAnnotations { get; set; } - - [XmlAttribute("减少颜色")] - public bool Quantize { get; set; } - - [XmlAttribute("伽马校正")] - public float Gamma { get; set; } - - [XmlAttribute("染色")] - public int Tint { - get => TintColor.ToArgb(); - set => TintColor = Color.FromArgb(value); - } - [XmlIgnore] - public Color TintColor { get; set; } - - internal bool LowQuality { get; set; } - - public ImageRendererOptions() { - AutoOutputFolder = true; - FileMask = "0000"; - ScaleRatio = 1f; - Gamma = 1.0f; - TintColor = Color.Transparent; - } - } -} diff --git a/pdfpatcher/App/Processor/Mupdf/Interop.cs b/pdfpatcher/App/Processor/Mupdf/Interop.cs deleted file mode 100644 index f87c95a3ecb740659b74518b6684b90744e40fca..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Mupdf/Interop.cs +++ /dev/null @@ -1,129 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.ConstrainedExecution; -using System.Runtime.InteropServices; - -namespace MuPdfSharp -{ - internal struct NativeObject where T : struct - { - internal IntPtr Ptr; - internal T Data; - public NativeObject(IntPtr ptr) { - Ptr = ptr; - Data = ptr.MarshalAs(); - } - } - - static class Interop - { - internal interface ILinkedList - { - IntPtr Next { get; } - } - - internal static T MarshalAs(this IntPtr ptr) where T : struct { - return (T)Marshal.PtrToStructure(ptr, typeof(T)); - } - - internal static bool IsValid(this SafeHandle handle) { - return handle != null && (handle.IsInvalid == true || handle.IsClosed == false); - } - - internal static void DisposeHandle(this SafeHandle handle) { - if (handle != null && handle.IsValid()) { - handle.Dispose(); - //handle.SetHandleAsInvalid (); - } - } - - /// - /// 将链表指针转换为 - /// - /// 链表的类型。 - /// 需要转换的指针。 - /// 实例。 - internal static IEnumerable> EnumerateLinkedList(this IntPtr ptr) where T : struct, ILinkedList { - return NativeLinkedList.EnumerateLinkedList(ptr); - } - - /// - /// 将链表指针转换为 - /// - /// 链表的类型。 - /// 需要转换的指针。 - /// 实例。 - internal static IEnumerable> EnumerateLinkedList(this SafeHandle ptr) where T : struct, ILinkedList { - return NativeLinkedList.EnumerateLinkedList(ptr.DangerousGetHandle()); - } - - internal unsafe static string DecodeUtf8String(IntPtr chars) { - var b = (byte*)chars.ToPointer(); - using (var buffer = new System.IO.MemoryStream()) { - while (*b != 0) { - buffer.WriteByte(*b); - ++b; - } - buffer.Position = 0; - return System.Text.Encoding.UTF8.GetString(buffer.GetBuffer(), (int)buffer.Position, (int)buffer.Length); - } - } - - static class NativeLinkedList where T : struct, Interop.ILinkedList - { - internal static IEnumerable> EnumerateLinkedList(IntPtr pointer) { - return new LinkedListEnumerable(pointer); - } - - sealed class LinkedListEnumerable : IEnumerable> where Node : struct, Interop.ILinkedList - { - readonly IntPtr _pointer; - public LinkedListEnumerable(IntPtr pointer) { - _pointer = pointer; - } - IEnumerator> IEnumerable>.GetEnumerator() { - return new LinkedListEnumerator(_pointer); - } - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { - return new LinkedListEnumerator(_pointer); - } - } - - sealed class LinkedListEnumerator : IEnumerator> where Node : struct, Interop.ILinkedList - { - private readonly IntPtr _start; - private IntPtr _current; - NativeObject _Node; - public LinkedListEnumerator(IntPtr pointer) { - _current = _start = pointer; - } - - #region IEnumerator> - NativeObject IEnumerator>.Current => _Node; - - void IDisposable.Dispose() { - } - - object System.Collections.IEnumerator.Current => _Node; - - bool System.Collections.IEnumerator.MoveNext() { - if (_current == IntPtr.Zero) { - return false; - } - _Node = new NativeObject(_current); - _current = _Node.Data.Next; - return true; - } - - void System.Collections.IEnumerator.Reset() { - _current = _start; - } - #endregion - } - - } - - } - -} diff --git a/pdfpatcher/App/Processor/Mupdf/MuDocument.cs b/pdfpatcher/App/Processor/Mupdf/MuDocument.cs deleted file mode 100644 index 6b5097325019c67aad2203301a04ded5a7682a6b..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Mupdf/MuDocument.cs +++ /dev/null @@ -1,282 +0,0 @@ -using System; -using System.IO; -using System.Runtime.InteropServices; - -namespace MuPdfSharp -{ - public sealed class MuDocument : IDisposable - { - #region 非托管资源成员 - StreamHandle _sourceStream; - DocumentHandle _document; - readonly ContextHandle _context; - #endregion - - #region 托管资源成员 - /// 获取所加载文档的路径。 - public string FilePath { get; private set; } - /// 获取文档的页数。 - public int PageCount { get; private set; } - /// 获取或设置抗锯齿显示级别。 - public int AntiAlias { - get => NativeMethods.GetAntiAliasLevel(_context); - set => NativeMethods.SetAntiAliasLevel(_context, value); - } - /// 获取文件句柄是否打开。 - public bool IsDocumentOpened => _document.IsValid() && _sourceStream.IsValid(); - /// 获取文档是否设置了打开密码。 - public bool NeedsPassword => NativeMethods.NeedsPdfPassword(_context, _document); - public bool IsAuthenticated { get; private set; } - public bool IsCancellationPending => _cookie.IsCancellationPending; - object _SyncObj = new object(); - public object SyncObj => _SyncObj; - - internal ContextHandle Context => _context; - MuPdfDictionary _trailer; - internal MuPdfDictionary Trailer { - get { - if (_trailer == null) { - _trailer = new MuPdfDictionary(_context, NativeMethods.GetTrailer(_context, _document)); - } - return _trailer; - } - } - internal MuPdfDictionary Root => Trailer["Root"].AsDictionary(); - internal MuDocumentInfo Info => new MuDocumentInfo(Trailer["Info"].AsDictionary()); - PageLabelCollection _PageLabels; - /// - /// 返回文档的页码标签。 - /// - public PageLabelCollection PageLabels { - get { - if (_PageLabels == null) { - _PageLabels = new PageLabelCollection(this); - } - return _PageLabels; - } - } - MuCookie _cookie; - #endregion - - public MuDocument(string fileName) : this() { - LoadPdf(fileName, null); - } - public MuDocument(string fileName, string password) : this() { - LoadPdf(fileName, password); - } - private MuDocument() { - _context = ContextHandle.Create(); - _cookie = new MuCookie(); - - NativeMethods.LoadSystemFontFuncs(_context, NativeMethods.LoadSystemFont, NativeMethods.LoadSystemCjkFont, NativeMethods.LoadSystemFallbackFont); - PageCount = -1; - } - - private int LoadPdf(string fileName, string password) { - if (File.Exists(fileName) == false) { - throw new FileNotFoundException("找不到 PDF 文件:" + fileName); - } - try { - _sourceStream = new StreamHandle(_context, fileName); - _document = new DocumentHandle(_context, _sourceStream); - FilePath = fileName; - return InitPdf(password); - } - catch (AccessViolationException) { - _sourceStream.DisposeHandle(); - _document.DisposeHandle(); - throw new IOException("PDF 文件无效:" + fileName); - } - } - - /// - /// 释放文档对应的句柄,不再占用 PDF 文件。 - /// - public void ReleaseFile() { - lock (_SyncObj) { - _document.DisposeHandle(); - _sourceStream.DisposeHandle(); - } - } - - /// - /// 重新打开文件。 - /// - public void Reopen() { - lock (_SyncObj) { - ReleaseFile(); - LoadPdf(FilePath, null); - } - } - - public void AbortAsync() { - _cookie.CancelAsync(); - } - /// - /// 使用指定的尺寸渲染页面。 - /// - /// 需要渲染的页码。 - /// 图片尺寸。 - /// 渲染的图片。 - public FreeImageAPI.FreeImageBitmap RenderPage(int pageNumber, System.Drawing.Size size) { - return RenderPage(pageNumber, size.Width, size.Height, null); - } - /// - /// 使用指定的尺寸渲染页面。 - /// - /// 需要渲染的页码。 - /// 页面宽度。 - /// 页面高度。 - /// 渲染的图片。 - public FreeImageAPI.FreeImageBitmap RenderPage(int pageNumber, int width, int height) { - return RenderPage(pageNumber, width, height, null); - } - /// - /// 使用渲染配置渲染指定的页面。 - /// - /// 要渲染的页码。 - /// 页面宽度。 - /// 页面高度。 - /// 渲染选项。 - /// 成功渲染后的 实例。如传入的页码在有效页码范围内,则返回空引用。 - public FreeImageAPI.FreeImageBitmap RenderPage(int pageNumber, int width, int height, ImageRendererOptions options) { - if (pageNumber < 1 || pageNumber > PageCount) { - return null; - } - using (var p = LoadPage(pageNumber)) { - return options != null ? p.RenderPage(width, height, options) : p.RenderPage(width, height); - } - } - - public MuPage LoadPage(int pageNumber) { - return new MuPage(_context, _document, pageNumber, ref _cookie); - } - - public bool AuthenticatePassword(string password) { - return IsAuthenticated = - NativeMethods.NeedsPdfPassword(_context, _document) == false - || String.IsNullOrEmpty(password) == false && NativeMethods.AuthenticatePassword(_context, _document, password); - } - - int InitPdf(string password) { - AuthenticatePassword(password); - PageCount = NativeMethods.CountPages(_context, _document); - return PageCount; - } - - #region 实现 IDisposable 接口的属性和方法 - private bool disposed; - public bool IsDisposed => disposed; - - /// 释放由 MuDocument 占用的资源。 - public void Dispose() { - Dispose(true); - GC.SuppressFinalize(this); - } - - /// 释放由 MuDocument 占用的资源。 - /// 是否手动释放托管资源。 - void Dispose(bool disposing) { - if (!disposed) { - if (disposing) { - #region 释放托管资源 - _trailer = null; - _SyncObj = null; - if (_PageLabels != null) { - _PageLabels.Clear(); - _PageLabels = null; - } - #endregion - } - - #region 释放非托管资源 - // 注意这里不是线程安全的 - _document.DisposeHandle(); - _sourceStream.DisposeHandle(); - _context.DisposeHandle(); - #endregion - } - disposed = true; - } - - // 析构函数只在未调用 Dispose 方法时调用 - // 派生类中不必再提供析构函数 - ~MuDocument() { - Dispose(false); - } - #endregion - - #region 生成对象 - public MuPdfObject Create(bool value) { - return new MuPdfObject(_context, NativeMethods.NewBoolean(_context, _document, value ? 1 : 0)); - } - public MuPdfObject Create(int value) { - return new MuPdfObject(_context, NativeMethods.NewInteger(_context, _document, value)); - } - public MuPdfObject Create(float value) { - return new MuPdfObject(_context, NativeMethods.NewFloat(_context, _document, value)); - } - public MuPdfObject Create(string value) { - return new MuPdfObject(_context, NativeMethods.NewString(_context, _document, value, value.Length)); - } - public MuPdfObject CreateName(string value) { - return new MuPdfObject(_context, NativeMethods.NewName(_context, _document, value)); - } - public MuPdfObject Create(int number, int generation) { - return new MuPdfObject(_context, NativeMethods.NewIndirectReference(_context, _document, number, generation)); - } - public MuPdfArray Create(Rectangle rect) { - return new MuPdfArray(_context, NativeMethods.NewRect(_context, _document, rect)); - } - public MuPdfArray Create(Matrix matrix) { - return new MuPdfArray(_context, NativeMethods.NewMatrix(_context, _document, matrix)); - } - public MuPdfArray CreateArray() { - return new MuPdfArray(_context, NativeMethods.NewArray(_context, _document, 4)); - } - public MuPdfDictionary CreateDictionary() { - return new MuPdfDictionary(_context, NativeMethods.NewDictionary(_context, _document, 4)); - } - #endregion - - unsafe struct FzFont - { -#pragma warning disable 649, 169 - readonly int refs; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] readonly byte[] name; - internal FzBuffer* Buffer; - internal FzFontFlags Flags; -#pragma warning restore 649, 169 - public string Name => System.Text.Encoding.Default.GetString(name, 0, Array.IndexOf(name, 0)); - } - - struct FzFontFlags - { -#pragma warning disable 649 - internal uint flag; -#pragma warning restore 649 - bool IsMono => (flag & 1) > 0; - bool IsSerif => (flag & 2) > 0; - bool IsBold => (flag & 4) > 0; - bool IsItalic => (flag & 8) > 0; - bool IsSubstitute => (flag & 16) > 0; /* use substitute metrics */ - bool IsStretch => (flag & 32) > 0; /* stretch to match PDF metrics */ - bool IsFakeBold => (flag & 64) > 0; /* synthesize bold */ - bool IsFakeItalic => (flag & 128) > 0; /* synthesize italic */ - bool IsForcedHinting => (flag & 256) > 0; /* force hinting for DynaLab fonts */ - bool HasOpenType => (flag & 512) > 0; /* has opentype shaping tables */ - bool InvalidBBox => (flag & 1024) > 0; - } - - struct FzBuffer - { -#pragma warning disable 649, 169 - readonly int refs; - readonly IntPtr data; - internal uint cap, len; - readonly int unused_bits; - readonly int shared; -#pragma warning restore 649, 169 - } - } -} diff --git a/pdfpatcher/App/Processor/Mupdf/MuDocumentInfo.cs b/pdfpatcher/App/Processor/Mupdf/MuDocumentInfo.cs deleted file mode 100644 index 7b742a74266d9cb7b63743022e72f6725424d63a..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Mupdf/MuDocumentInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace MuPdfSharp -{ - public class MuDocumentInfo - { - readonly MuPdfDictionary _info; - public MuDocumentInfo(MuPdfDictionary dictionary) { - _info = dictionary; - } - public string Title => _info["Title"].StringValue; - public string Subject => _info["Subject"].StringValue; - public string Producer => _info["Producer"].StringValue; - public string Creator => _info["Creator"].StringValue; - public string Author => _info["Author"].StringValue; - public string Keywords => _info["Keywords"].StringValue; - public string CreationDate => _info["CreationDate"].StringValue; - public string ModificationDate => _info["ModDate"].StringValue; - } -} diff --git a/pdfpatcher/App/Processor/Mupdf/MuHandle.cs b/pdfpatcher/App/Processor/Mupdf/MuHandle.cs deleted file mode 100644 index 914ba644e333d76e46660abbc069f5aa0c1b1ec1..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Mupdf/MuHandle.cs +++ /dev/null @@ -1,303 +0,0 @@ -using System; -using System.Runtime.ConstrainedExecution; -using System.Security.Permissions; - -namespace MuPdfSharp -{ - [SecurityPermission(SecurityAction.InheritanceDemand, UnmanagedCode = true)] - [SecurityPermission(SecurityAction.Demand, UnmanagedCode = true)] - abstract class MuHandle : System.Runtime.InteropServices.SafeHandle - { - protected MuHandle() : base(IntPtr.Zero, true) { } - - public override bool IsInvalid => handle == IntPtr.Zero; - - public T MarshalAs() where T : struct { - return handle.MarshalAs(); - } - } - - sealed class ContextHandle : MuHandle - { - private ContextHandle() { } - - /// - /// 创建 MuPDF 的 Context 实例。 - /// - /// 指向 Context 的指针。 - internal static ContextHandle Create() { - return NativeMethods.NewContext(); - } - - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - protected override bool ReleaseHandle() { - NativeMethods.DropContext(handle); - SetHandleAsInvalid(); - return true; - } - - internal PixmapHandle CreatePixmap(ColorSpace colorspace, int width, int height) { - return new PixmapHandle(this, FindDeviceColorSpace(colorspace), width, height); - } - - internal PixmapHandle CreatePixmap(ColorSpace colorspace, BBox box) { - return new PixmapHandle(this, FindDeviceColorSpace(colorspace), box); - } - internal DisplayListHandle CreateDisplayList(Rectangle mediaBox) { - return new DisplayListHandle(this, mediaBox); - } - internal PixmapHandle LoadJpeg2000(byte[] data) { - var p = NativeMethods.LoadJpeg2000(this, data, data.Length, IntPtr.Zero); - return new PixmapHandle(this, p); - } - IntPtr FindDeviceColorSpace(ColorSpace colorspace) { - switch (colorspace) { - case ColorSpace.Rgb: return NativeMethods.GetRgbColorSpace(this); - case ColorSpace.Bgr: return NativeMethods.GetBgrColorSpace(this); - case ColorSpace.Cmyk: return NativeMethods.GetCmykColorSpace(this); - case ColorSpace.Gray: return NativeMethods.GetGrayColorSpace(this); - default: throw new NotImplementedException(colorspace + " not supported."); - } - } - } - - sealed class DocumentHandle : MuHandle - { - readonly ContextHandle _context; - readonly bool _releaseContext; - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - internal DocumentHandle(ContextHandle context, StreamHandle stream) { - handle = NativeMethods.OpenPdfDocumentStream(context, stream); - _context = context; - context.DangerousAddRef(ref _releaseContext); - } - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - internal DocumentHandle(ContextHandle context, IntPtr documentHandle) { - handle = documentHandle; - _context = context; - context.DangerousAddRef(ref _releaseContext); - } - - internal ContextHandle Context => _context; - - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - protected override bool ReleaseHandle() { - NativeMethods.DropDocument(_context, handle); - if (_releaseContext) { - _context.DangerousRelease(); - } - return true; - } - } - - sealed class StreamHandle : MuHandle - { - readonly bool _releaseContext; - - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - internal StreamHandle(ContextHandle context, IntPtr handle) { - this.handle = handle; - Context = context; - context.DangerousAddRef(ref _releaseContext); - } - - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - internal StreamHandle(ContextHandle context, string filePath) - : this(context, NativeMethods.OpenFile(context, filePath)) { - } - internal ContextHandle Context { get; } - - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - protected override bool ReleaseHandle() { - NativeMethods.DropStream(Context, handle); - if (_releaseContext) { - Context.DangerousRelease(); - } - return true; - } - - internal void CloseStream() { - NativeMethods.DropStream(Context, handle); - } - } - - sealed class DeviceHandle : MuHandle - { - readonly ContextHandle _context; - readonly bool _releaseContext; - - DeviceHandle(ContextHandle context, IntPtr handle) : base() { - this.handle = handle; - _context = context; - context.DangerousAddRef(ref _releaseContext); - } - - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - internal DeviceHandle(ContextHandle context, ref Rectangle rectangle) - : this(context, NativeMethods.NewBBoxDevice(context, ref rectangle)) { - } - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - internal DeviceHandle(ContextHandle context, PixmapHandle pixmap, Matrix matrix) - : this(context, NativeMethods.NewDrawDevice(context, matrix, pixmap)) { - } - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - internal DeviceHandle(ContextHandle context, PixmapHandle pixmap, Matrix matrix, ref BBox box) - : this(context, NativeMethods.NewDrawDevice(context, matrix, pixmap, ref box)) { - } - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - internal DeviceHandle(ContextHandle context, DisplayListHandle displayList) - : this(context, NativeMethods.NewListDevice(context, displayList)) { - } - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - internal DeviceHandle(ContextHandle context, TextPageHandle page) - : this(context, NativeMethods.NewTextDevice(context, page, null)) { - } - internal void EndOperations() { - NativeMethods.CloseDevice(_context, handle); - } - - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - protected override bool ReleaseHandle() { - NativeMethods.DropDevice(_context, handle); - if (_releaseContext) { - _context.DangerousRelease(); - } - return true; - } - } - - sealed class PageHandle : MuHandle - { - readonly DocumentHandle _document; - readonly bool _releaseDocument; - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - public PageHandle(DocumentHandle document, int pageNumber) { - handle = NativeMethods.LoadPage(document.Context, document, pageNumber); - _document = document; - document.DangerousAddRef(ref _releaseDocument); - } - - internal unsafe IntPtr PageDictionary => ((NativePage*)handle)->PageDictionary; - - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - protected override bool ReleaseHandle() { - NativeMethods.DropPage(_document.Context, handle); - if (_releaseDocument) { - _document.DangerousRelease(); - } - return true; - } - -#pragma warning disable 649, 169 - struct NativePage - { - readonly NativeFzPage FzPage; - readonly IntPtr Document; - internal IntPtr PageDictionary; - readonly int Transparency; - readonly int Overprint; - readonly IntPtr Links; - readonly IntPtr Annots, AnnotTailp; - readonly IntPtr Widgets, WidgetTailp; - } - struct NativeFzPage - { - readonly int Refs; - readonly IntPtr Document; - readonly int Chapter; - readonly int Number; - readonly int Incomplete; - readonly IntPtr /*fz_page_drop_page_fn*/ DropPage; - readonly IntPtr /*fz_page_bound_page_fn*/ BoundPage; - readonly IntPtr /*fz_page_run_page_fn*/ RunPageContents; - readonly IntPtr /*fz_page_run_page_fn*/ RunPageAnnots; - readonly IntPtr /*fz_page_run_page_fn*/ RunPageWidgets; - readonly IntPtr /*fz_page_load_links_fn*/ LoadLinks; - readonly IntPtr /*fz_page_page_presentation_fn*/ PagePresentation; - readonly IntPtr /*fz_page_control_separation_fn*/ ControlSeparation; - readonly IntPtr /*fz_page_separation_disabled_fn*/ SeparationDisabled; - readonly IntPtr /*fz_page_separations_fn*/ GetSeparations; - readonly IntPtr /*fz_page_uses_overprint_fn*/ GetOverprint; - readonly IntPtr /*fz_page_create_link_fn*/ CreateLink; - readonly IntPtr /*fz_page_delete_link_fn*/ DeleteLink; - readonly IntPtr /*fz_page ** prev, *next*/ Prev, Next; - } -#pragma warning restore 649, 169 - } - - sealed class DisplayListHandle : MuHandle - { - readonly ContextHandle _context; - readonly bool _releaseContext; - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - internal DisplayListHandle(ContextHandle context, Rectangle mediaBox) { - handle = NativeMethods.NewDisplayList(context, mediaBox); - _context = context; - context.DangerousAddRef(ref _releaseContext); - } - - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - protected override bool ReleaseHandle() { - NativeMethods.DropDisplayList(_context, handle); - if (_releaseContext) { - _context.DangerousRelease(); - } - return true; - } - } - - sealed class PixmapHandle : MuHandle - { - readonly ContextHandle _context; - readonly bool _releaseContext; - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - internal PixmapHandle(ContextHandle context, IntPtr pixmap) { - handle = pixmap; - _context = context; - context.DangerousAddRef(ref _releaseContext); - } - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - internal PixmapHandle(ContextHandle context, IntPtr colorspace, int width, int height) { - handle = NativeMethods.NewPixmap(context, colorspace, width, height, IntPtr.Zero, 0); - _context = context; - context.DangerousAddRef(ref _releaseContext); - } - - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - internal PixmapHandle(ContextHandle context, IntPtr colorspace, BBox box) { - handle = NativeMethods.NewPixmap(context, colorspace, box, IntPtr.Zero, 0); - _context = context; - context.DangerousAddRef(ref _releaseContext); - } - - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - protected override bool ReleaseHandle() { - NativeMethods.DropPixmap(_context, handle); - if (_releaseContext) { - _context.DangerousRelease(); - } - return true; - } - } - - sealed class TextPageHandle : MuHandle - { - readonly ContextHandle _context; - readonly bool _releaseContext; - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - internal TextPageHandle(ContextHandle context, Rectangle mediaBox) { - handle = NativeMethods.NewTextPage(context, mediaBox); - _context = context; - context.DangerousAddRef(ref _releaseContext); - } - - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.None)] - protected override bool ReleaseHandle() { - NativeMethods.DropTextPage(_context, handle); - if (_releaseContext) { - _context.DangerousRelease(); - } - return true; - } - } -} \ No newline at end of file diff --git a/pdfpatcher/App/Processor/Mupdf/MuPDF.cs b/pdfpatcher/App/Processor/Mupdf/MuPDF.cs deleted file mode 100644 index 2b2e16419d945ddb0e3fa4b000261fdcc4fe15e4..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Mupdf/MuPDF.cs +++ /dev/null @@ -1,325 +0,0 @@ -using System; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using System.Runtime.InteropServices; - -namespace MuPDFLib -{ - public class MuPDF : IDisposable - { - private const string MuDLL = "MuPDFLib.dll"; - private IntPtr _MuPdfObject; - private string _FileName; - private byte[] _Image; - private GCHandle _ImagePin; - private string _PdfPassword; - private int _CurrentPage; - private int _LoadType; - private int _AliasBits; - - public int PageCount { get; set; } - public int Page { - get { return _CurrentPage; } - set { - _CurrentPage = NativeMethods.LoadPage (this._MuPdfObject, value); - } - } - - public double Width { - get { - if (_CurrentPage > 0) - return NativeMethods.GetWidth (this._MuPdfObject); - else - return 0; - } - } - - public double Height { - get { - if (_CurrentPage > 0) - return NativeMethods.GetHeight (this._MuPdfObject); - else - return 0; - } - } - - public int AntiAliasLevel { - get { - return NativeMethods.GetAntiAliasLevel (this._MuPdfObject); - } - set { - if (_AliasBits > 8) { - _AliasBits = 8; - } - else if (_AliasBits < 0) { - _AliasBits = 0; - } - NativeMethods.SetAntiAliasLevel (this._MuPdfObject, _AliasBits); - } - } - - public MuPDF (byte[] image, string pdfPassword) { - _LoadType = 1; - _Image = image; - _PdfPassword = pdfPassword; - - if (image == null) - throw new ArgumentNullException (); - Initialize (); - } - - public MuPDF (string fileName, string pdfPassword) { - _LoadType = 0; - _FileName = fileName; - _PdfPassword = pdfPassword; - - if (!File.Exists (_FileName)) - throw new FileNotFoundException ("Cannot find file to open!", _FileName); - Initialize (); - } - - public void Initialize () { - this._MuPdfObject = NativeMethods.CreateMuPDFClass (); - if (_LoadType == 0) - PageCount = NativeMethods.LoadPdf (this._MuPdfObject, _FileName, _PdfPassword); - else if (_LoadType == 1) { - _ImagePin = GCHandle.Alloc (_Image, GCHandleType.Pinned); - PageCount = NativeMethods.LoadPdfFromStream (this._MuPdfObject, _Image, (int)_Image.Length, _PdfPassword); - } - - if (PageCount == -5) - throw new Exception ("PDF password needed!"); - else if (PageCount == -6) - throw new Exception ("Invalid PDF password supplied!"); - else if (PageCount < 1) - throw new Exception ("Unable to open pdf document!"); - _CurrentPage = 1; - _AliasBits = NativeMethods.GetAntiAliasLevel (_MuPdfObject); - } - - private static bool Is64BitProcess () { - return IntPtr.Size == 8; - } - - public void Dispose () { - Dispose (true); - } - - protected virtual void Dispose (bool bDisposing) { - if (this._MuPdfObject != IntPtr.Zero) { - // Call the DLL Export to dispose this class - NativeMethods.DisposeMuPDFClass (this._MuPdfObject); - this._MuPdfObject = IntPtr.Zero; - if (_ImagePin.IsAllocated) - _ImagePin.Free (); - } - - if (bDisposing) { - // No need to call the finalizer since we've now cleaned - // up the unmanaged memory - GC.SuppressFinalize (this); - } - } - - ~MuPDF () { - Dispose (false); - } - - public unsafe Bitmap GetBitmap (int width, int height, float dpix, float dpiy, int rotation, RenderType type, bool rotateLandscapePages, int maxSize) { - Bitmap bitmap2 = null; - int nLength = 0; - IntPtr data = NativeMethods.GetBitmap (this._MuPdfObject, out width, out height, dpix, dpiy, rotation, (int)type, rotateLandscapePages, out nLength, maxSize); - if (data == null || data == IntPtr.Zero) - throw new Exception ("Unable to render pdf page to bitmap!"); - - if (type == RenderType.RGB) { - bitmap2 = new Bitmap (width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); - BitmapData imageData = bitmap2.LockBits (new Rectangle (0, 0, width, height), ImageLockMode.ReadWrite, bitmap2.PixelFormat); - byte* ptrSrc = (byte*)data; - byte* ptrDest = (byte*)imageData.Scan0; - for (int y = 0; y < height; y++) { - byte* pl = ptrDest; - byte* sl = ptrSrc; - for (int x = 0; x < width; x++) { - //Swap these here instead of in MuPDF because most pdf images will be rgb or cmyk. - //Since we are going through the pixels one by one anyway swap here to save a conversion from rgb to bgr. - pl[2] = sl[0]; //b-r - pl[1] = sl[1]; //g-g - pl[0] = sl[2]; //r-b - //pl[3] = sl[3]; //alpha - pl += 3; - sl += 4; - } - ptrDest += imageData.Stride; - ptrSrc += width * 4; - } - bitmap2.UnlockBits (imageData); - } - else if (type == RenderType.Grayscale) { - bitmap2 = new Bitmap (width, height, System.Drawing.Imaging.PixelFormat.Format8bppIndexed); - ColorPalette palette = bitmap2.Palette; - for (int i = 0; i < 256; ++i) - palette.Entries[i] = System.Drawing.Color.FromArgb (i, i, i); - bitmap2.Palette = palette; - BitmapData imageData = bitmap2.LockBits (new Rectangle (0, 0, width, height), ImageLockMode.ReadWrite, bitmap2.PixelFormat); - - byte* ptrSrc = (byte*)data; - byte* ptrDest = (byte*)imageData.Scan0; - for (int y = 0; y < height; y++) { - byte* pl = ptrDest; - byte* sl = ptrSrc; - for (int x = 0; x < width; x++) { - pl[0] = sl[0]; - //pl[1] = sl[1]; //alpha - pl += 1; - sl += 2; - } - ptrDest += imageData.Stride; - ptrSrc += width * 2; - } - bitmap2.UnlockBits (imageData); - } - else//RenderType.Monochrome - { - //bitmap2 = new Bitmap(width, height, bmpstride, PixelFormat.Format1bppIndexed, data);//Doesn't free memory - bitmap2 = new Bitmap (width, height, System.Drawing.Imaging.PixelFormat.Format1bppIndexed); - ColorPalette palette = bitmap2.Palette; - palette.Entries[0] = System.Drawing.Color.FromArgb (0, 0, 0); - palette.Entries[1] = System.Drawing.Color.FromArgb (255, 255, 255); - bitmap2.Palette = palette; - BitmapData imageData = bitmap2.LockBits (new Rectangle (0, 0, width, height), ImageLockMode.ReadWrite, bitmap2.PixelFormat); - - byte* ptrSrc = (byte*)data; - byte* ptrDest = (byte*)imageData.Scan0; - for (int i = 0; i < nLength; i++) { - ptrDest[i] = ptrSrc[i]; - } - bitmap2.UnlockBits (imageData); - } - bitmap2.SetResolution (dpix, dpiy); - NativeMethods.FreeRenderedPage (this._MuPdfObject);//Free unmanaged array - - return bitmap2; - } - - - public unsafe byte[] GetPixels (ref int width, ref int height, float dpix, float dpiy, int rotation, RenderType type, bool rotateLandscapePages, out uint cbStride, int maxSize) { - byte[] output = null; - int nLength = 0; - IntPtr data = NativeMethods.GetBitmap (this._MuPdfObject, out width, out height, dpix, dpiy, rotation, (int)type, rotateLandscapePages, out nLength, maxSize); - if (data == null || data == IntPtr.Zero) - throw new Exception ("Unable to render pdf page to bitmap!"); - - if (type == RenderType.RGB) { - const int depth = 24; - int bmpstride = ((width * depth + 31) & ~31) >> 3; - int newSize = bmpstride * height; - - output = new byte[newSize]; - cbStride = (uint)bmpstride; - IntPtr DestPointer = Marshal.UnsafeAddrOfPinnedArrayElement (output, 0); - - byte* ptrSrc = (byte*)data; - byte* ptrDest = (byte*)DestPointer; - for (int y = 0; y < height; y++) { - byte* pl = ptrDest; - byte* sl = ptrSrc; - for (int x = 0; x < width; x++) { - //Swap these here instead of in MuPDF because most pdf images will be rgb or cmyk. - //Since we are going through the pixels one by one anyway swap here to save a conversion from rgb to bgr. - pl[2] = sl[0]; //b-r - pl[1] = sl[1]; //g-g - pl[0] = sl[2]; //r-b - //pl[3] = sl[3]; //alpha - pl += 3; - sl += 4; - } - ptrDest += cbStride; - ptrSrc += width * 4; - } - } - else if (type == RenderType.Grayscale) { - const int depth = 8;//(n * 8) - int bmpstride = ((width * depth + 31) & ~31) >> 3; - int newSize = bmpstride * height; - - output = new byte[newSize]; - cbStride = (uint)bmpstride; - IntPtr DestPointer = Marshal.UnsafeAddrOfPinnedArrayElement (output, 0); - - byte* ptrSrc = (byte*)data; - byte* ptrDest = (byte*)DestPointer; - for (int y = 0; y < height; y++) { - byte* pl = ptrDest; - byte* sl = ptrSrc; - for (int x = 0; x < width; x++) { - pl[0] = sl[0]; //g - //pl[1] = sl[1]; //alpha - pl += 1; - sl += 2; - } - ptrDest += cbStride; - ptrSrc += width * 2; - } - } - else//RenderType.Monochrome - { - const int depth = 1; - int bmpstride = ((width * depth + 31) & ~31) >> 3; - - cbStride = (uint)bmpstride; - output = new byte[nLength]; - Marshal.Copy (data, output, 0, nLength); - } - NativeMethods.FreeRenderedPage (this._MuPdfObject);//Free unmanaged array - return output; - } - - class NativeMethods - { - [DllImport (MuDLL, EntryPoint = "CreateMuPDFClass")] - static internal extern IntPtr CreateMuPDFClass (); - - [DllImport (MuDLL, EntryPoint = "DisposeMuPDFClass")] - static internal extern void DisposeMuPDFClass (IntPtr mupdf); - - [DllImport (MuDLL, EntryPoint = "CallGetBitmap")] - internal static extern IntPtr GetBitmap (IntPtr mupdf, out int width, out int height, float dpix, float dpiy, int rotation, int colorspace, bool rotateLandscapePages, out int nLength, int maxSize); - - [DllImport (MuDLL, EntryPoint = "CallLoadPdf", CharSet=CharSet.Unicode)] - internal static extern int LoadPdf (IntPtr mupdf, string filename, string password); - - [DllImport (MuDLL, EntryPoint = "CallLoadPdfFromStream")] - internal static extern int LoadPdfFromStream (IntPtr mupdf, byte[] buffer, int bufferSize, string password); - - [DllImport (MuDLL, EntryPoint = "CallGetWidth")] - internal static extern float GetWidth (IntPtr mupdf); - - [DllImport (MuDLL, EntryPoint = "CallLoadPage")] - internal static extern int LoadPage (IntPtr mupdf, int pageNumber); - - [DllImport (MuDLL, EntryPoint = "CallGetHeight")] - internal static extern float GetHeight (IntPtr mupdf); - - [DllImport (MuDLL, EntryPoint = "CallGetAntiAliasLevel")] - internal static extern int GetAntiAliasLevel (IntPtr mupdf); - - [DllImport (MuDLL, EntryPoint = "CallSetAntiAliasLevel")] - internal static extern void SetAntiAliasLevel (IntPtr mupdf, int antiAliasLevel); - - [DllImport (MuDLL, EntryPoint = "CallFreeRenderedPage")] - internal static extern void FreeRenderedPage (IntPtr mupdf); - } - } - - public enum RenderType - { - /// 24-bit Color RGB - RGB = 0, - /// 8-bit Grayscale - Grayscale = 1, - /// 1-bit Monochrome - Monochrome = 2 - } -} diff --git a/pdfpatcher/App/Processor/Mupdf/MuPDFConverter.cs b/pdfpatcher/App/Processor/Mupdf/MuPDFConverter.cs deleted file mode 100644 index 793ca3bbbb57f424e8d81180eadae60356d71677..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Mupdf/MuPDFConverter.cs +++ /dev/null @@ -1,233 +0,0 @@ -using System; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; - -namespace MuPDFLib -{ - public static class MuPdfConverter - { - public static byte[] ConvertPdfToTiff (byte[] image, float dpi, RenderType type, bool rotateLandscapePages, int maxSizeInPdfPixels, string pdfPassword) { - byte[] output = null; - - if (image == null) - throw new ArgumentNullException ("image"); - - using (MuPDF pdfDoc = new MuPDF (image, pdfPassword)) { - using (MemoryStream outputStream = new MemoryStream ()) { - ImageCodecInfo info = null; - foreach (ImageCodecInfo ice in ImageCodecInfo.GetImageEncoders ()) - if (ice.MimeType == "image/tiff") - info = ice; - - Bitmap saveTif = null; - for (int i = 1; i <= pdfDoc.PageCount; i++) { - int Width = 0;//Zero for no resize. - int Height = 0;//Zero for autofit height to width. - - pdfDoc.Page = i; - - Bitmap FirstImage = pdfDoc.GetBitmap (Width, Height, dpi, dpi, 0, type, rotateLandscapePages, maxSizeInPdfPixels); - if (FirstImage == null) - throw new Exception ("Unable to convert pdf to tiff!"); - using (EncoderParameters ep = new EncoderParameters (2)) { - ep.Param[0] = new EncoderParameter (Encoder.SaveFlag, (long)EncoderValue.MultiFrame); - ep.Param[1] = new EncoderParameter (Encoder.Compression, (long)EncoderValue.CompressionLZW); - if (type == RenderType.Monochrome) { - ep.Param[1] = new EncoderParameter (Encoder.Compression, (long)EncoderValue.CompressionCCITT4); - } - - if (i == 1) { - saveTif = FirstImage; - saveTif.Save (outputStream, info, ep); - } - else { - ep.Param[0] = new EncoderParameter (Encoder.SaveFlag, (long)EncoderValue.FrameDimensionPage); - saveTif.SaveAdd (FirstImage, ep); - FirstImage.Dispose (); - } - if (i == pdfDoc.PageCount) { - ep.Param[0] = new EncoderParameter (Encoder.SaveFlag, (long)EncoderValue.Flush); - saveTif.SaveAdd (ep); - saveTif.Dispose (); - } - } - } - output = outputStream.ToArray (); - } - } - return output; - } - - public static bool ConvertPdfToTiff (string sourceFile, string outputFile, float dpi, RenderType type, bool rotateLandscapePages, int maxSizeInPdfPixels, string pdfPassword) { - bool output = false; - - if (string.IsNullOrEmpty (sourceFile) || string.IsNullOrEmpty (outputFile)) - throw new ArgumentNullException (); - - using (MuPDF pdfDoc = new MuPDF (sourceFile, pdfPassword)) { - using (FileStream outputStream = new FileStream (outputFile, FileMode.Create, FileAccess.ReadWrite, FileShare.None)) { - ImageCodecInfo info = null; - foreach (ImageCodecInfo ice in ImageCodecInfo.GetImageEncoders ()) - if (ice.MimeType == "image/tiff") - info = ice; - - Bitmap saveTif = null; - for (int i = 1; i <= pdfDoc.PageCount; i++) { - pdfDoc.Page = i; - - Bitmap FirstImage = pdfDoc.GetBitmap (0, 0, dpi, dpi, 0, type, rotateLandscapePages, maxSizeInPdfPixels); - if (FirstImage == null) - throw new Exception ("Unable to convert pdf to tiff!"); - - using (EncoderParameters ep = new EncoderParameters (2)) { - ep.Param[0] = new EncoderParameter (Encoder.SaveFlag, (long)EncoderValue.MultiFrame); - ep.Param[1] = new EncoderParameter (Encoder.Compression, (long)EncoderValue.CompressionLZW); - if (type == RenderType.Monochrome) { - ep.Param[1] = new EncoderParameter (Encoder.Compression, (long)EncoderValue.CompressionCCITT4); - } - - if (i == 1) { - saveTif = FirstImage; - saveTif.Save (outputStream, info, ep); - } - else { - ep.Param[0] = new EncoderParameter (Encoder.SaveFlag, (long)EncoderValue.FrameDimensionPage); - saveTif.SaveAdd (FirstImage, ep); - FirstImage.Dispose (); - } - if (i == pdfDoc.PageCount) { - ep.Param[0] = new EncoderParameter (Encoder.SaveFlag, (long)EncoderValue.Flush); - saveTif.SaveAdd (ep); - saveTif.Dispose (); - } - } - } - } - if (File.Exists (outputFile)) - output = true; - } - return output; - } - - public static byte[] ConvertPdfToFaxTiff (byte[] image, float dpi, string pdfPassword) { - byte[] output = null; - const long Compression = (long)EncoderValue.CompressionCCITT4; - - using (MuPDF pdfDoc = new MuPDF (image, pdfPassword)) { - using (MemoryStream outputStream = new MemoryStream ()) { - ImageCodecInfo info = null; - foreach (ImageCodecInfo ice in ImageCodecInfo.GetImageEncoders ()) - if (ice.MimeType == "image/tiff") - info = ice; - - Bitmap saveTif = null; - for (int i = 1; i <= pdfDoc.PageCount; i++) { - int Width = 0;//Zero for no resize. - //int Height = 0;//Zero for autofit height to width. - float DpiX = dpi; - float DpiY = dpi; - - pdfDoc.Page = i; - - if (dpi == 200) { - Width = 1728; - DpiX = 204; - DpiY = 196; - } - else if (dpi == 300) - Width = 2592; - else if (dpi == 400) - Width = 3456; - - Bitmap FirstImage = pdfDoc.GetBitmap (Width, 0, DpiX, DpiY, 0, RenderType.Monochrome, true, 0); - if (FirstImage == null) - throw new Exception ("Unable to convert pdf to tiff!"); - - using (EncoderParameters ep = new EncoderParameters (2)) { - ep.Param[0] = new EncoderParameter (Encoder.SaveFlag, (long)EncoderValue.MultiFrame); - ep.Param[1] = new EncoderParameter (Encoder.Compression, Compression); - - if (i == 1) { - saveTif = FirstImage; - saveTif.Save (outputStream, info, ep); - } - else { - ep.Param[0] = new EncoderParameter (Encoder.SaveFlag, (long)EncoderValue.FrameDimensionPage); - saveTif.SaveAdd (FirstImage, ep); - FirstImage.Dispose (); - } - if (i == pdfDoc.PageCount) { - ep.Param[0] = new EncoderParameter (Encoder.SaveFlag, (long)EncoderValue.Flush); - saveTif.SaveAdd (ep); - saveTif.Dispose (); - } - } - } - output = outputStream.ToArray (); - } - } - return output; - } - - public static bool ConvertPdfToFaxTiff (string sourceFile, string outputFile, float dpi, string pdfPassword) { - bool output = false; - const long Compression = (long)EncoderValue.CompressionCCITT4; - - using (MuPDF pdfDoc = new MuPDF (sourceFile, pdfPassword)) { - using (FileStream outputStream = new FileStream (outputFile, FileMode.Create, FileAccess.ReadWrite, FileShare.None)) { - ImageCodecInfo info = null; - foreach (ImageCodecInfo ice in ImageCodecInfo.GetImageEncoders ()) - if (ice.MimeType == "image/tiff") - info = ice; - - Bitmap saveTif = null; - for (int i = 1; i <= pdfDoc.PageCount; i++) { - int Width = 0;//Zero for no resize. - //int Height = 0;//Zero for autofit height to width. - float DpiX = dpi; - float DpiY = dpi; - - pdfDoc.Page = i; - - if (dpi == 200) { - Width = 1728; - DpiX = 204; - DpiY = 196; - } - else if (dpi == 300) - Width = 2592; - else if (dpi == 400) - Width = 3456; - - Bitmap FirstImage = pdfDoc.GetBitmap (Width, 0, DpiX, DpiY, 0, RenderType.Monochrome, true, 0); - if (FirstImage == null) - throw new Exception ("Unable to convert pdf to tiff!"); - using (EncoderParameters ep = new EncoderParameters (2)) { - ep.Param[0] = new EncoderParameter (Encoder.SaveFlag, (long)EncoderValue.MultiFrame); - ep.Param[1] = new EncoderParameter (Encoder.Compression, Compression); - - if (i == 1) { - saveTif = FirstImage; - saveTif.Save (outputStream, info, ep); - } - else { - ep.Param[0] = new EncoderParameter (Encoder.SaveFlag, (long)EncoderValue.FrameDimensionPage); - saveTif.SaveAdd (FirstImage, ep); - FirstImage.Dispose (); - } - if (i == pdfDoc.PageCount) { - ep.Param[0] = new EncoderParameter (Encoder.SaveFlag, (long)EncoderValue.Flush); - saveTif.SaveAdd (ep); - saveTif.Dispose (); - } - } - } - } - if (File.Exists (outputFile)) - output = true; - } - return output; - } - } -} diff --git a/pdfpatcher/App/Processor/Mupdf/MuPage.cs b/pdfpatcher/App/Processor/Mupdf/MuPage.cs deleted file mode 100644 index a856d0d7bf2d4db8759dd74ada1feeb6206f5837..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Mupdf/MuPage.cs +++ /dev/null @@ -1,341 +0,0 @@ -using System; -using System.Drawing; - -namespace MuPdfSharp -{ - public sealed class MuPage : IDisposable - { - #region 非托管资源成员 - private readonly ContextHandle _context; - private DocumentHandle _document; - private readonly PageHandle _page; - private DisplayListHandle _displayList; - #endregion - - #region 托管资源成员 - static readonly ImageRendererOptions __defaultOptions = new ImageRendererOptions(); - MuCookie _cookie; - MuTextPage _TextPage; - bool _flattened; - - /// 获取当前页面的页码。 - public int PageNumber { get; private set; } - /// 获取当前页面的尺寸(左下角坐标置为“0,0”)。如需获取页面字典中的原始可视区域,请使用 属性。 - public Rectangle Bound => NativeMethods.BoundPage(_context, _page); - /// 获取当前页面可视区域的坐标及尺寸。 - public Rectangle VisualBound => Matrix.Identity.RotateTo(Rotation).Transform(VisualBox); - - public Rectangle ArtBox => LookupPageBox("ArtBox"); - public Rectangle BleedBox => LookupPageBox("BleedBox"); - public Rectangle CropBox => LookupPageBox("CropBox"); - public Rectangle TrimBox => LookupPageBox("TrimBox"); - public Rectangle MediaBox => LookupPageBox("MediaBox"); - public Rectangle VisualBox { get { var b = LookupPageBox("CropBox"); return b.IsEmpty ? LookupPageBox("MediaBox") : b; } } - public int Rotation => LookupPage("Rotate").IntegerValue; - - public MuTextPage TextPage { - get { - PopulateTextPage(); - return _TextPage; - } - } - - private unsafe Rectangle LookupPageBox(string name) { - if (_flattened == false) { - var d = _page.PageDictionary; - NativeMethods.FlattenInheritablePageItems(_context, d); - _flattened = true; - } - var a = new MuPdfDictionary(_context, _page.PageDictionary); - var ra = a[name].AsArray(); - return ra.Count == 4 ? Rectangle.FromArray(a[name]) : Rectangle.Empty; - } - private MuPdfObject LookupPage(string name) { - var a = new MuPdfDictionary(_context, _page.PageDictionary); - return a[name]; - } - #endregion - - internal MuPage(ContextHandle context, DocumentHandle document, int pageNumber, ref MuCookie cookie) { - try { - _page = new PageHandle(document, pageNumber - 1); - _document = document; - _context = context; - _cookie = cookie; - PageNumber = pageNumber; - } - catch (AccessViolationException) { - _page.DisposeHandle(); - throw new MuPdfException("无法加载第 " + pageNumber + " 页。"); - } - } - - ///// - ///// 获取指定区域的文本。 - ///// - ///// 区域。 - ///// 区域内的文本。 - //public string GetSelection (Rectangle selection) { - // return Interop.DecodeUtf8String (NativeMethods.CopySelection (_context, GetTextPage (), selection)); - //} - - ///// - ///// 获取指定区域的文本。 - ///// - ///// 区域。 - ///// 区域内的文本。 - //public List HighlightSelection (Rectangle selection) { - // var l = - // return Interop.DecodeUtf8String (NativeMethods.HighlightSelection (_context, _page, selection)); - //} - - /// - /// 使用默认的配置渲染页面。 - /// - /// 页面的宽度。 - /// 页面的高度。 - /// 渲染后生成的 - public FreeImageAPI.FreeImageBitmap RenderPage(int width, int height) { - return RenderPage(width, height, __defaultOptions); - } - - /// - /// 使用指定的配置渲染页面。 - /// - /// 页面的宽度。 - /// 页面的高度。 - /// 渲染选项。 - /// 渲染后生成的 - public FreeImageAPI.FreeImageBitmap RenderPage(int width, int height, ImageRendererOptions options) { - using (var pix = InternalRenderPage(width, height, options)) { - if (pix != null) { - return pix.ToFreeImageBitmap(options); - } - } - return null; - } - - /// - /// 使用指定的配置渲染页面。 - /// - /// 页面的宽度。 - /// 页面的高度。 - /// 渲染选项。 - /// 渲染后生成的 - public Bitmap RenderBitmapPage(int width, int height, ImageRendererOptions options) { - using (var pix = InternalRenderPage(width, height, options)) { - if (pix != null) { - return pix.ToBitmap(options); - } - } - return null; - } - - public MuFont GetFont(MuTextChar character) { - return new MuFont(_context, character.FontID); - } - public MuFont GetFont(MuTextSpan span) { - return new MuFont(_context, span.FontID); - } - private DisplayListHandle GetDisplayList() { - if (_displayList.IsValid()) { - return _displayList; - } - _displayList = _context.CreateDisplayList(Bound); - using (var d = new DeviceHandle(_context, _displayList)) { - //if (hideAnnotations) { - // NativeMethods.RunPageContents (_document, _page, d, ref m, _cookie); - //} - //else { - NativeMethods.RunPage(_context, _page, d, Matrix.Identity, ref _cookie); - d.EndOperations(); - //} - } - if (_cookie.ErrorCount > 0) { - System.Diagnostics.Debug.WriteLine("在第 " + PageNumber + " 页有 " + _cookie.ErrorCount + " 个错误。"); - } - return _displayList; - } - - void PopulateTextPage() { - if (_TextPage != null) { - return; - } - var b = Bound; - var text = new TextPageHandle(_context, b); - try { - using (var dev = new DeviceHandle(_context, text)) { - NativeMethods.RunDisplayList(_context, GetDisplayList(), dev, Matrix.Identity, b, ref _cookie); - dev.EndOperations(); - } - _TextPage = new MuTextPage(text); - } - catch (AccessViolationException) { - text.DisposeHandle(); - throw; - } - return; - } - - private PixmapData InternalRenderPage(int width, int height, ImageRendererOptions options) { - var b = Bound; - if (b.Width == 0 || b.Height == 0) { - return null; - } - var ctm = CalculateMatrix(width, height, options); - var bbox = width > 0 && height > 0 ? new BBox(0, 0, width, height) : ctm.Transform(b).Round; - - var pix = _context.CreatePixmap(options.ColorSpace, bbox); - try { - NativeMethods.ClearPixmap(_context, pix, 0xFF); - using (var dev = new DeviceHandle(_context, pix, Matrix.Identity)) { - if (options.LowQuality) { - NativeMethods.EnableDeviceHints(_context, dev, DeviceHints.IgnoreShade | DeviceHints.DontInterperateImages | DeviceHints.NoCache); - } - if (_cookie.IsCancellationPending) { - return null; - } - NativeMethods.RunPageContents(_context, _page, dev, ctm, ref _cookie); - if (options.HideAnnotations == false) { - NativeMethods.RunPageAnnotations(_context, _page, dev, ctm, ref _cookie); - NativeMethods.RunPageWidgets(_context, _page, dev, ctm, ref _cookie); - } - //NativeMethods.BeginPage (dev, ref b, ref ctm); - //NativeMethods.RunDisplayList (_context, GetDisplayList(), dev, ctm, ctm.Transform(VisualBound), ref _cookie); - //NativeMethods.EndPage (dev); - - dev.EndOperations(); - - if (_cookie.IsCancellationPending) { - return null; - } - var pd = new PixmapData(_context, pix); - if (options.TintColor != Color.Transparent) { - pd.Tint(options.TintColor); - } - if (options.Gamma != 1.0f) { - pd.Gamma(options.Gamma); - } - return pd; - } - } - catch (AccessViolationException) { - pix.DisposeHandle(); - throw new MuPdfException("无法渲染页面:" + PageNumber); - } - } - - private Matrix CalculateMatrix(int width, int height, ImageRendererOptions options) { - float w = width, h = height; - var b = Bound; - if (options.UseSpecificWidth) { - if (w < 0) { - w = -w; - } - if (h < 0) { - h = -h; - } - if (options.FitArea && w != 0 && h != 0) { - var rw = w / b.Width; - var rh = h / b.Height; - if (rw < rh) { - h = 0; - } - else { - w = 0; - } - } - if (w == 0 && h == 0) { // No resize - w = b.Width; - h = b.Height; - } - else if (h == 0) { - h = (float)width * b.Height / b.Width; - } - else if (w == 0) { - w = (float)height * b.Width / b.Height; - } - } - else if (w == 0 || h == 0) { - w = b.Width * options.ScaleRatio * options.Dpi / 72; - h = b.Height * options.ScaleRatio * options.Dpi / 72; - } - - var ctm = Matrix.Scale(w / b.Width, h / b.Height).RotateTo(options.Rotation); - if (options.VerticalFlipImages) { - ctm = Matrix.Concat(ctm, Matrix.VerticalFlip); - } - if (options.HorizontalFlipImages) { - ctm = Matrix.Concat(ctm, Matrix.HorizontalFlip); - } - return ctm; - } - - /// - /// 获取页面内容的实际覆盖范围。 - /// - /// 包含页面内容的最小 - public Rectangle GetContentBoundary() { - var b = Bound; - var o = b; - using (var dev = new DeviceHandle(_context, ref o)) { - try { - var im = Matrix.Identity; - //NativeMethods.BeginPage (dev, ref b, ref im); - NativeMethods.RunDisplayList(_context, GetDisplayList(), dev, Matrix.Identity, b, ref _cookie); - dev.EndOperations(); - //NativeMethods.EndPage (dev); - return o; - } - catch (AccessViolationException) { - throw new MuPdfException("无法获取页面内容边框:" + PageNumber); - } - } - } - - #region 实现 IDisposable 接口的属性和方法 - private bool disposed; - public void Dispose() { - Dispose(true); - GC.SuppressFinalize(this); // 抑制析构函数 - } - - /// 释放由 MuPdfPage 占用的资源。 - /// 是否手动释放托管资源。 - void Dispose(bool disposing) { - if (!disposed) { - if (disposing) { - #region 释放托管资源 - _TextPage?.Dispose(); - _TextPage = null; - #endregion - } - - #region 释放非托管资源 - // 注意这里不是线程安全的 - //int retry = 0; - //_cookie.CancelAsync (); - //while (_cookie.IsRunning && ++retry < 10) { - // System.Threading.Thread.Sleep (100); - //} - _page.DisposeHandle(); - _displayList.DisposeHandle(); - _document = null; - #endregion - } - disposed = true; - } - - // 析构函数只在未调用 Dispose 方法时调用 - // 派生类中不必再提供析构函数 - ~MuPage() { - Dispose(false); - } - #endregion - - //protected override bool ReleaseHandle () { - // NativeMethods.FreePage (_document, this.handle); - // return true; - //} - } -} diff --git a/pdfpatcher/App/Processor/Mupdf/MuPdfException.cs b/pdfpatcher/App/Processor/Mupdf/MuPdfException.cs deleted file mode 100644 index a54c88285de2df3315883a3e0b86232d32471d77..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Mupdf/MuPdfException.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace MuPdfSharp -{ - [global::System.Serializable] - public sealed class MuPdfException : Exception - { - public MuPdfException() { } - public MuPdfException(string message) : base(message) { } - public MuPdfException(string message, Exception inner) : base(message, inner) { } - //protected MuPdfException ( - // System.Runtime.Serialization.SerializationInfo info, - // System.Runtime.Serialization.StreamingContext context) - // : base (info, context) { } - } -} diff --git a/pdfpatcher/App/Processor/Mupdf/MuPdfObject.cs b/pdfpatcher/App/Processor/Mupdf/MuPdfObject.cs deleted file mode 100644 index fe095e97a199e04c7d14cc52c15955e869d4b831..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Mupdf/MuPdfObject.cs +++ /dev/null @@ -1,213 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; - -namespace MuPdfSharp -{ - [DebuggerDisplay("({Kind})")] - public unsafe class MuPdfObject - { - #region 非托管资源成员 - readonly IntPtr _object; - readonly ContextHandle _context; - NativeObject* NativePointer => (NativeObject*)_object; - internal IntPtr Pointer => _object; - internal ContextHandle Context => _context; - #endregion - - internal DocumentHandle Document { - get { - var d = NativeMethods.GetDocument(_context, _object); - return d == IntPtr.Zero ? null : new DocumentHandle(_context, d); - } - } - - /// 返回对象的类型。 - public MuPdfObjectKind Kind => Pointer == IntPtr.Zero ? MuPdfObjectKind.PDF_NULL : (MuPdfObjectKind)NativePointer->_kind; - - /// 返回对象的引用数量。 - internal int ReferenceCount => Pointer == IntPtr.Zero ? 0 : NativePointer->_referenceCount; - - /// - /// 返回对象的类型(如对象为引用,则返回其解除引用后的类型)。 - /// - public MuPdfObjectKind UnderlyingKind { - get { - var obj = new MuPdfObject(_context, NativeMethods.ResolveIndirect(_context, _object)); - return obj.Kind; - } - } - - public bool BooleanValue => NativeMethods.ToBoolean(_context, _object) != 0; - public int IntegerValue => NativeMethods.ToInteger(_context, _object); - public float FloatValue => NativeMethods.ToSingle(_context, _object); - public string NameValue => NativeMethods.ToName(_context, _object); - public string StringValue => NativeMethods.ToString(_context, _object); - public bool IsNull => NativeMethods.IsNull(_context, _object) != 0; - public bool IsArray => NativeMethods.IsArray(_context, _object) != 0; - public bool IsDictionary => NativeMethods.IsDictionary(_context, _object) != 0; - - internal MuPdfObject(ContextHandle context, IntPtr obj) { - _object = obj; - _context = context; - } - - internal MuPdfDictionary AsDictionary() { - return new MuPdfDictionary(_context, NativeMethods.ResolveIndirect(_context, _object)); - } - internal MuPdfArray AsArray() { - return new MuPdfArray(_context, NativeMethods.ResolveIndirect(_context, _object)); - } - - protected struct NativeObject - { -#pragma warning disable 649, 169 - internal short _referenceCount; - internal byte _kind; - internal byte _flags; -#pragma warning restore 649, 169 - } - } - - public struct MuIndirectReference - { - public readonly int Number, Generation; - public static readonly MuIndirectReference Empty; - - public MuIndirectReference(int number, int generation) { - Number = number; - Generation = generation; - } - } - - public enum MuPdfObjectKind : byte - { - PDF_NULL = 0, - PDF_BOOL = (byte)'b', - PDF_INT = (byte)'i', - PDF_REAL = (byte)'f', - PDF_STRING = (byte)'s', - PDF_NAME = (byte)'n', - PDF_ARRAY = (byte)'a', - PDF_DICT = (byte)'d', - PDF_INDIRECT = (byte)'r' - } - - public sealed unsafe class MuPdfDictionary : MuPdfObject - { - NativeDict* NativePointer => (NativeDict*)Pointer; - - internal MuPdfDictionary(ContextHandle context, IntPtr obj) - : base(context, obj) { - } - - public int Capacity => Pointer == IntPtr.Zero ? 0 : NativePointer->_capacity; - - /// - /// 获取字典中的项目数量。 - /// - public int Count => Pointer == IntPtr.Zero ? 0 : NativePointer->_length; - - public KeyValuePair this[int index] => new KeyValuePair( - new MuPdfObject(Context, NativeMethods.GetKey(Context, Pointer, index)).NameValue, - new MuPdfObject(Context, NativeMethods.GetValue(Context, Pointer, index)) - ); - public MuPdfObject this[string key] { - get => new MuPdfObject(Context, NativeMethods.Get(Context, Pointer, key)); - set => NativeMethods.Put(Context, Pointer, key, value.Pointer); - } - - public MuPdfObject GetKey(int index) { - return new MuPdfObject(Context, NativeMethods.GetKey(Context, Pointer, index)); - } - public MuPdfObject GetValue(int index) { - return new MuPdfObject(Context, NativeMethods.GetValue(Context, Pointer, index)); - } - public MuPdfObject Locate(string path) { - return new MuPdfObject(Context, NativeMethods.Locate(Context, Pointer, path)); - } - public void LocatePut(string path, MuPdfObject value) { - NativeMethods.LocatePut(Context, Pointer, path, value.Pointer); - } - public void Delete(string key) { - NativeMethods.Delete(Context, Pointer, key); - } - public void Delete(int index) { - NativeMethods.Delete(Context, Pointer, NativeMethods.GetKey(Context, Pointer, index)); - } - - struct NativeDict - { -#pragma warning disable 649 - internal NativeObject _nativeObject; - internal IntPtr _document; - internal int _parentNum; - internal int _length; - internal int _capacity; - internal IntPtr _items; -#pragma warning restore 649 - } - } - - public sealed unsafe class MuPdfArray : MuPdfObject - { - NativeArray* NativePointer => (NativeArray*)Pointer; - - public int Capacity => Pointer == IntPtr.Zero ? 0 : NativePointer->_capacity; - - /// - /// 获取数组中的项目数量。 - /// - public int Count => Pointer == IntPtr.Zero ? 0 : NativePointer->_length; - - public MuPdfObject this[int index] { - get => new MuPdfObject(Context, NativeMethods.GetArrayItem(Context, Pointer, index)); - set => NativeMethods.SetArrayItem(Context, Pointer, index, value.Pointer); - } - - internal MuPdfArray(ContextHandle context, IntPtr obj) - : base(context, obj) { - } - - public void Add(MuPdfObject obj) { - NativeMethods.Push(Context, Pointer, obj.Pointer); - } - - public void AddAndDrop(MuPdfObject obj) { - NativeMethods.PushAndDrop(Context, Pointer, obj.Pointer); - } - - struct NativeArray - { -#pragma warning disable 649 - internal NativeObject _nativeObject; - internal IntPtr _document; - internal int _parentNum; - internal int _length; - internal int _capacity; - internal IntPtr _items; -#pragma warning restore 649 - } - } - - public sealed unsafe class MuPdfRef : MuPdfObject - { - NativeRef* NativePointer => (NativeRef*)Pointer; - - public int Number => NativePointer->_Num; - public int Generation => NativePointer->_Generation; - - internal MuPdfRef(ContextHandle context, IntPtr obj) : base(context, obj) { - } - - struct NativeRef - { -#pragma warning disable 649 - internal NativeObject _nativeObject; - internal IntPtr _document; // Only needed for arrays, dicts and indirects - internal int _Num; - internal int _Generation; -#pragma warning restore 649 - } - } -} diff --git a/pdfpatcher/App/Processor/Mupdf/MuStream.cs b/pdfpatcher/App/Processor/Mupdf/MuStream.cs deleted file mode 100644 index 8af1551079441d223f4553d44b22c68bbe75eb47..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Mupdf/MuStream.cs +++ /dev/null @@ -1,151 +0,0 @@ -using System; -using System.IO; -using System.Runtime.InteropServices; -using CC = System.Runtime.InteropServices.CallingConvention; - -namespace MuPdfSharp -{ - sealed class MuStream : IDisposable - { - const int __CompressionBomb = 100 << 20; - - #region 非托管资源成员 - readonly StreamHandle _stream; - readonly ContextHandle _context; - GCHandle _data; - #endregion - - #region 托管资源成员 - readonly int _knownDataLength; - readonly bool _sharedContext; - /// 获取或设置游标位置。 - public int Position { - get => NativeMethods.GetPosition(_context, _stream); - set => Seek(value, SeekOrigin.Begin); - } - #endregion - - internal MuStream(byte[] data) { - var ctx = ContextHandle.Create(); - _knownDataLength = data.Length; - _data = GCHandle.Alloc(data, GCHandleType.Pinned); - _stream = new StreamHandle(ctx, NativeMethods.OpenMemory(ctx, _data.AddrOfPinnedObject(), _knownDataLength)); - _context = ctx; - } - internal MuStream(ContextHandle ctx, string fileName) { - _stream = new StreamHandle(ctx, fileName); - _knownDataLength = -1; - _sharedContext = true; - } - private MuStream(ContextHandle ctx, StreamHandle stream) { - _context = ctx; - _stream = stream; - NativeMethods.Keep(ctx, stream); - _sharedContext = true; - } - - /// - /// 读取 字节到缓冲数组 。(可能抛出异常) - /// - /// 放置读取数据的数组。 - /// 要读取的数据长度。 - /// 实际读取的长度。 - public int Read(byte[] buffer, int length) { - return NativeMethods.Read(_context, _stream, buffer, length); - } - - /// - /// 读取流的所有内容到字节数组。(可能抛出异常) - /// - /// 包含流中所有内容的数组。 - public byte[] ReadAll(int initialSize) { - if (_knownDataLength > 0) { - var b = new byte[_knownDataLength]; - NativeMethods.Read(_context, _stream, b, _knownDataLength); - return b; - } - else { - var b = new byte[initialSize]; - int l; - using (var ms = new MemoryStream(initialSize)) - using (var mw = new BinaryWriter(ms)) { - while ((l = NativeMethods.Read(_context, _stream, b, initialSize)) > 0) { - mw.Write(b, 0, l); - if (ms.Length >= __CompressionBomb && ms.Length / 200 > initialSize) { - throw new IOException("Compression bomb detected."); - } - } - ms.Flush(); - return ms.ToArray(); - } - } - } - - /// - /// 跳转到流的指定位置。 - /// - /// 偏移位置。 - /// 跳转方式。 - public void Seek(int offset, SeekOrigin origin) { - NativeMethods.Seek(_context, _stream, offset, origin == SeekOrigin.Begin ? 0 : origin == SeekOrigin.Current ? 1 : 2); - } - - /// - /// 将当前流视为以 CCITT Fax 压缩的图像来解压缩。 - /// - /// 图像宽度。 - /// 图像高度。 - /// - /// - /// - /// - /// - /// 解压缩后的图像数据。 - public MuStream DecodeTiffFax(int width, int height, int k, bool endOfLine, bool encodedByteAlign, bool endOfBlock, bool blackIs1) { - return new MuStream( - _context, - new StreamHandle(_context, NativeMethods.DecodeCcittFax(_context, _stream, k, endOfLine ? 1 : 0, encodedByteAlign ? 1 : 0, width, height, endOfBlock ? 1 : 0, blackIs1 ? 1 : 0)) - ); - } - - #region 实现 IDisposable 接口的属性和方法 - private bool disposed; - public void Dispose() { - Dispose(true); - GC.SuppressFinalize(this); // 抑制析构函数 - } - - /// 释放由 MuPdfPage 占用的资源。 - /// 是否手动释放托管资源。 - void Dispose(bool disposing) { - if (!disposed) { - if (disposing) { - #region 释放托管资源 - //_components.Dispose (); - #endregion - } - - #region 释放非托管资源 - // 注意这里不是线程安全的 - if (_stream.IsValid()) { - _stream.Dispose(); - } - if (_sharedContext == false && _context.IsValid()) { - _context.Dispose(); - } - if (_data.IsAllocated) { - _data.Free(); - } - #endregion - } - disposed = true; - } - - // 析构函数只在未调用 Dispose 方法时调用 - // 派生类中不必再提供析构函数 - ~MuStream() { - Dispose(false); - } - #endregion - } -} diff --git a/pdfpatcher/App/Processor/Mupdf/MuText.cs b/pdfpatcher/App/Processor/Mupdf/MuText.cs deleted file mode 100644 index 0ac560bb4d4654176758db59dd2c2ded4e5d3445..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Mupdf/MuText.cs +++ /dev/null @@ -1,376 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; - -#pragma warning disable 649, 169 -namespace MuPdfSharp -{ - public interface IMuTextLines - { - IEnumerable Lines { get; } - } - - public interface IMuTextSpans - { - IEnumerable Spans { get; } - } - - [DebuggerDisplay("Name={Name}")] - public sealed class MuFont - { - readonly ContextHandle _context; - readonly IntPtr _Font; - - public unsafe string Name => new string(NativeMethods.GetFontName(_context, _Font)); - public MuFontFlags Attributes => NativeMethods.GetFontFlags(_Font); - public BBox BBox => NativeMethods.GetFontBBox(_context, _Font); - - internal MuFont(ContextHandle handle, IntPtr font) { - _context = handle; - _Font = font; - } - } - - [Flags] - public enum MuFontFlags : uint - { - None = 0, - IsMono = 1, - IsSerif = 1 << 1, - IsBold = 1 << 2, - IsItalic = 1 << 3, - IsSubstitute = 1 << 4, /* use substitute metrics */ - IsStretch = 1 << 5, /* stretch to match PDF metrics */ - IsFakeBold = 1 << 6, /* synthesize bold */ - IsFakeItalic = 1 << 7, /* synthesize italic */ - IsForcedHinting = 1 << 8, /* force hinting for DynaLab fonts */ - HasOpenType = 1 << 9, /* has opentype shaping tables */ - InvalidBBox = 1 << 10 - } - - [DebuggerDisplay("BBox={BBox}")] - public sealed class MuTextPage : IMuBoundedElement, IDisposable - { - readonly TextPageHandle _handle; - NativeTextPage _TextPage; - IEnumerable _Blocks; - - public Rectangle BBox => _TextPage.MediaBox; - public IEnumerable Blocks => _Blocks ?? (_Blocks = MuContentBlock.GetTextBlocks(_TextPage._FirstBlock)); - - internal MuTextPage(TextPageHandle nativePage) { - _handle = nativePage; - _TextPage = _handle.MarshalAs(); - } - - ///// - ///// 获取指针指向的所有文本集合。 - ///// - ///// 第一个 fz_text_page 指针。 - ///// 包含所有文本页的集合。 - //internal static List GetTextPages (TextPageHandle firstPage) { - // var l = new List (); - // foreach (var p in firstPage.EnumerateLinkedList ()) { - // l.Add (new MuTextPage (p.Data)); - // } - // return l; - //} - - struct NativeTextPage - { - readonly IntPtr /*fz_pool*/ _Pool; - readonly Rectangle _MediaBox; - /* fz_text_block */ - internal IntPtr _FirstBlock, _LastBlock; - - internal Rectangle MediaBox => _MediaBox; - } - - #region IDisposable Support - private bool disposedValue = false; // 要检测冗余调用 - - void Dispose(bool disposing) { - if (disposedValue) { - return; - } - - if (disposing) { - _Blocks = null; - } - - _handle.DisposeHandle(); - disposedValue = true; - } - - ~MuTextPage() { - Dispose(false); - } - - // 添加此代码以正确实现可处置模式。 - public void Dispose() { - Dispose(true); - GC.SuppressFinalize(this); - } - #endregion - } - - public enum ContentBlockType { Text = 0, Image = 1 } - - public abstract class MuContentBlock : IMuBoundedElement - { - public abstract Rectangle BBox { get; } - public abstract ContentBlockType Type { get; } - internal static IEnumerable GetBlocks(IntPtr firstBlock) { - foreach (var item in firstBlock.EnumerateLinkedList()) { - switch (item.Data.Type) { - case ContentBlockType.Text: - yield return item.Data.ToMuBlock(); - break; - case ContentBlockType.Image: - yield return item.Ptr.MarshalAs().ToMuBlock(); - break; - } - } - } - internal static IEnumerable GetTextBlocks(IntPtr firstBlock) { - foreach (var item in firstBlock.EnumerateLinkedList()) { - if (item.Data.Type == ContentBlockType.Text) { - yield return item.Data.ToMuBlock() as MuTextBlock; - } - } - } - - struct NativeImageBlock - { - readonly ContentBlockType _Type; - readonly Rectangle _BBox; - - /* union { - struct { fz_stext_line *first_line, *last_line; } t; - struct { fz_matrix transform; fz_image *image; } i; - } u; */ - readonly Matrix _Transform; - readonly IntPtr _Image; - readonly IntPtr _PreviousBlock, _NextBlock; - internal MuContentBlock ToMuBlock() { - return new MuImageBlock(_BBox, _Transform, _Image); - } - } - struct NativeContentBlock : Interop.ILinkedList - { - readonly ContentBlockType _Type; - readonly Rectangle _BBox; - - /* union { - struct { fz_stext_line *first_line, *last_line; } t; - struct { fz_matrix transform; fz_image *image; } i; - } u; */ - readonly IntPtr _Ptr1, _Ptr2, a, b, c, d, e; - readonly IntPtr _PreviousBlock, _NextBlock; - - IntPtr Interop.ILinkedList.Next => _NextBlock; - internal ContentBlockType Type => _Type; - internal MuContentBlock ToMuBlock() { - return new MuTextBlock(_BBox, _Ptr1, _Ptr2); - } - } - } - - public sealed class MuImageBlock : MuContentBlock, IMuBoundedElement - { - readonly Rectangle _BBox; - readonly Matrix _Matrix; - readonly IntPtr _Image; - - internal MuImageBlock(Rectangle bbox, Matrix matrix, IntPtr image) { - _BBox = bbox; - _Matrix = matrix; - _Image = image; - } - - public override Rectangle BBox => _BBox; - public override ContentBlockType Type => ContentBlockType.Image; - } - - public sealed class MuTextBlock : MuContentBlock, IMuBoundedElement, IMuTextLines - { - readonly Rectangle _BBox; - readonly IntPtr _FirstLine, _LastLine; - - IEnumerable _Lines; - public override Rectangle BBox => _BBox; - public override ContentBlockType Type => ContentBlockType.Text; - public IEnumerable Lines => _Lines ?? (_Lines = MuTextLine.GetLines(_FirstLine)); - - internal MuTextBlock(Rectangle BBox, IntPtr FirstLine, IntPtr LastLine) { - _BBox = BBox; - _FirstLine = FirstLine; - _LastLine = LastLine; - } - } - - [DebuggerDisplay("Text={Text},BBox={BBox}")] - public sealed class MuTextLine : IMuBoundedElement, IMuTextSpans - { - NativeTextLine _textLine; - string _Text; - IEnumerable _Characters; - - public Rectangle BBox => _textLine.BBox; - public IEnumerable Characters => _Characters ?? (_Characters = MuTextChar.GetCharacters(_textLine._FirstChar)); - public IList Spans => MuTextChar.GetSpans(this, _textLine._FirstChar, _textLine._LastChar); - public string Text => _Text ?? (_Text = GetText()); - public MuTextChar FirstCharacter => MuTextChar.GetChar(_textLine._FirstChar); - - MuTextLine(IntPtr textLine) { - _textLine = textLine.MarshalAs(); - } - - IEnumerable IMuTextSpans.Spans => Spans; - - string GetText() { - var sb = new System.Text.StringBuilder(50); - foreach (var ch in Characters) { - sb.Append(char.ConvertFromUtf32(ch.Unicode)); - } - return sb.ToString(); - } - - internal static IEnumerable GetLines(IntPtr firstLine) { - foreach (var item in firstLine.EnumerateLinkedList()) { - yield return new MuTextLine(item.Ptr); - } - } - - internal struct NativeTextLine : IMuBoundedElement, Interop.ILinkedList - { - //int wmode; /* 0 for horizontal, 1 for vertical */ - readonly int _WMode; - - //fz_point dir; /* normalized direction of baseline */ - readonly Point _Point; - - //fz_rect bbox; - readonly Rectangle _BBox; - //fz_stext_char *first_char, *last_char; - internal IntPtr _FirstChar, _LastChar; - - //fz_stext_line *prev, *next; - readonly IntPtr _PrevLine, _NextLine; - - IntPtr Interop.ILinkedList.Next => _NextLine; - - public Rectangle BBox => _BBox; - } - } - - [DebuggerDisplay("Point={Point}; Size={Size}, Char={System.Char.ConvertFromUtf32(Unicode)}({Unicode}); Font={FontID}")] - public sealed class MuTextChar : IMuBoundedElement - { - NativeTextChar _textChar; - readonly Rectangle _Box; - - public Point Point => _textChar._Point; - public Rectangle BBox => _Box.IsEmpty ? Quad.ToRectangle() : _Box; - public Quad Quad => _textChar._Quad; - public int Unicode => _textChar._Unicode; - public float Size => _textChar._Size; - public IntPtr FontID => _textChar._Font; - - MuTextChar(NativeTextChar textChar) { - _textChar = textChar; - } - internal static MuTextChar GetChar(IntPtr charPtr) { - return new MuTextChar(charPtr.MarshalAs()); - } - internal static IEnumerable GetCharacters(IntPtr firstChar) { - foreach (var item in firstChar.EnumerateLinkedList()) { - yield return new MuTextChar(item.Data); - } - } - internal unsafe static IList GetSpans(MuTextLine textLine, IntPtr firstChar, IntPtr lastChar) { - if (firstChar == IntPtr.Zero) { - return new MuTextSpan[0]; - } - var r = new List(2); - var ch = (NativeTextChar*)firstChar; - var start = ch; - var end = (NativeTextChar*)lastChar; - var size = ch->_Size; - var font = ch->_Font; - var color = ch->_Color; - var t = new System.Text.StringBuilder(100); - t.Append((char)ch->_Unicode); - do { - ch = ch->_Next; - if ((IntPtr)ch == IntPtr.Zero) { - break; - } - if (ch->_Size == size && ch->_Font == font && ch->_Color == color) { - t.Append((char)ch->_Unicode); - continue; - } - r.Add(new MuTextSpan(textLine, start->_Point, t.ToString(), size, font, start->_Quad.Union(ch->_Quad).ToRectangle(), color)); - t.Length = 0; - size = ch->_Size; - font = ch->_Font; - color = ch->_Color; - start = ch; - t.Append((char)ch->_Unicode); - } while (ch != end); - if (t.Length > 0) { - var s = t.ToString().TrimEnd(); - if (s.Length > 0) { - r.Add(new MuTextSpan(textLine, start->_Point, s, size, font, start->_Quad.Union(end->_Quad).ToRectangle(), color)); - } - } - return r; - } - unsafe struct NativeTextChar : Interop.ILinkedList - { - //int c; - internal int _Unicode; - // color - internal int _Color; // sRGB hex value - //fz_point origin; - internal Point _Point; - //fz_quad quad; - internal Quad _Quad; - //float size; - internal float _Size; - //fz_font* font; - internal IntPtr _Font; - //fz_stext_char* next; - internal NativeTextChar* _Next; - - IntPtr Interop.ILinkedList.Next => (IntPtr)_Next; - } - } - - [DebuggerDisplay("Point={Point}; FontID={FontID}; Size={Size}; Color={Color}; Text={Text}")] - public sealed class MuTextSpan - { - public MuTextSpan(MuTextLine line, Point point, string text, float size, IntPtr fontID, Rectangle box, int color) { - Line = line; - Point = point; - Text = text; - Size = size; - FontID = fontID; - Box = box; - Color = color; - } - - public MuTextLine Line { get; } - public Point Point { get; } - public string Text { get; } - public float Size { get; } - public IntPtr FontID { get; } - public Rectangle Box { get; } - public int Color { get; } - } - - sealed class TextOptions - { - internal int _Flags; - } -} diff --git a/pdfpatcher/App/Processor/Mupdf/Mupdf.api.cs b/pdfpatcher/App/Processor/Mupdf/Mupdf.api.cs deleted file mode 100644 index c2eb886cadfd34e48d000a2d3d57984c41d6bffe..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Mupdf/Mupdf.api.cs +++ /dev/null @@ -1,1092 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace PDFPatcher.Processor.Mupdf -{ - [StructLayoutAttribute (LayoutKind.Sequential)] - public struct fz_matrix_s - { - // float - public float a; - // float - public float b; - // float - public float c; - // float - public float d; - // float - public float e; - // float - public float f; - } - [StructLayoutAttribute (LayoutKind.Sequential)] - public struct fz_point_s - { - // float - public float x; - // float - public float y; - } - [StructLayoutAttribute (LayoutKind.Sequential)] - public struct fz_rect_s - { - // float - public float x0; - // float - public float y0; - // float - public float x1; - // float - public float y1; - } - [StructLayoutAttribute (LayoutKind.Sequential)] - public struct fz_bbox_s - { - // int - public int x0; - // int - public int y0; - // int - public int x1; - // int - public int y1; - } - [StructLayoutAttribute (LayoutKind.Sequential, CharSet = CharSet.Ansi)] - public struct fz_md5_s - { - // unsigned int[4] - [MarshalAsAttribute (UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.U4)] - public uint[] state; - // unsigned int[2] - [MarshalAsAttribute (UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.U4)] - public uint[] count; - // unsigned char[64] - [MarshalAsAttribute (UnmanagedType.ByValTStr, SizeConst = 64)] - public string buffer; - } - [StructLayoutAttribute (LayoutKind.Sequential)] - public struct fz_sha256_s - { - // unsigned int[8] - [MarshalAsAttribute (UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.U4)] - public uint[] state; - // unsigned int[2] - [MarshalAsAttribute (UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.U4)] - public uint[] count; - // Anonymous_070cc860_42fb_4449_9338_672f82fd50b4 - public fz_sha256_s.Buffer buffer; - - [StructLayoutAttribute (LayoutKind.Explicit)] - public struct Buffer - { - // unsigned char[64] - [MarshalAsAttribute (UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] - [FieldOffsetAttribute (0)] - public byte[] u8; - // unsigned int[16] - [MarshalAsAttribute (UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.U4)] - [FieldOffsetAttribute (0)] - public uint[] u32; - } - } - [StructLayoutAttribute (LayoutKind.Sequential, CharSet = CharSet.Ansi)] - public struct fz_arc4_s - { - // unsigned int - public uint x; - // unsigned int - public uint y; - // unsigned char[256] - [MarshalAsAttribute (UnmanagedType.ByValTStr, SizeConst = 256)] - public string state; - } - [StructLayoutAttribute (LayoutKind.Sequential)] - public struct fz_aes_s - { - // int - public int nr; - // unsigned int* - public IntPtr rk; - // unsigned int[68] - [MarshalAsAttribute (UnmanagedType.ByValArray, SizeConst = 68, ArraySubType = UnmanagedType.U4)] - public uint[] buf; - } - public enum fz_objkind_e - { - FZ_NULL, - FZ_BOOL, - FZ_INT, - FZ_REAL, - FZ_STRING, - FZ_NAME, - FZ_ARRAY, - FZ_DICT, - FZ_INDIRECT, - } - [StructLayoutAttribute (LayoutKind.Sequential)] - public struct fz_buffer_s - { - // int - public int refs; - // unsigned char* - [MarshalAsAttribute (UnmanagedType.LPStr)] - public string data; - // int - public int cap; - // int - public int len; - } - public enum fz_blendmode_e - { - FZ_BNORMAL, - FZ_BMULTIPLY, - FZ_BSCREEN, - FZ_BOVERLAY, - FZ_BDARKEN, - FZ_BLIGHTEN, - FZ_BCOLORDODGE, - FZ_BCOLORBURN, - FZ_BHARDLIGHT, - FZ_BSOFTLIGHT, - FZ_BDIFFERENCE, - FZ_BEXCLUSION, - FZ_BHUE, - FZ_BSATURATION, - FZ_BCOLOR, - FZ_BLUMINOSITY, - } - [StructLayoutAttribute (LayoutKind.Sequential)] - public struct fz_pixmap_s - { - // int - public int refs; - // int - public int x; - // int - public int y; - // int - public int w; - // int - public int h; - // int - public int n; - // fz_pixmap* - public IntPtr mask; - // int - public int interpolate; - // fz_colorspace* - public IntPtr colorspace; - // unsigned char* - [MarshalAsAttribute (UnmanagedType.LPStr)] - public string samples; - // int - public int freesamples; - } - [StructLayoutAttribute (LayoutKind.Sequential, CharSet = CharSet.Ansi)] - public struct fz_colorspace_s - { - // Return Type: void - //param0: fz_colorspace* - //src: float* - //xyz: float* - public delegate void ToXyzDelegate (ref fz_colorspace_s param0, ref float src, ref float xyz); - // Return Type: void - //param0: fz_colorspace* - //xyz: float* - //dst: float* - public delegate void FromXyzDelegate (ref fz_colorspace_s param0, ref float xyz, ref float dst); - // Return Type: void - //param0: fz_colorspace* - public delegate void FreeDataDelegate (ref fz_colorspace_s param0); - - // int - public int refs; - // char[16] - [MarshalAsAttribute (UnmanagedType.ByValTStr, SizeConst = 16)] - public string name; - // int - public int n; - // fz_colorspace_s_toxyz - public ToXyzDelegate toxyz; - // fz_colorspace_s_fromxyz - public FromXyzDelegate fromxyz; - // fz_colorspace_s_freedata - public FreeDataDelegate freedata; - // void* - public IntPtr data; - } - - public enum fz_pathelkind_e - { - FZ_MOVETO, - FZ_LINETO, - FZ_CURVETO, - FZ_CLOSEPATH, - } - [StructLayoutAttribute (LayoutKind.Explicit)] - public struct fz_pathel_s - { - // fz_pathelkind->fz_pathelkind_e - [FieldOffsetAttribute (0)] - public fz_pathelkind_e k; - // float - [FieldOffsetAttribute (0)] - public float v; - } - [StructLayoutAttribute (LayoutKind.Sequential)] - public struct fz_path_s - { - // int - public int len; - // int - public int cap; - // fz_pathel* - public IntPtr els; - } - [StructLayoutAttribute (LayoutKind.Sequential)] - public struct fz_strokestate_s - { - // int - public int linecap; - // int - public int linejoin; - // float - public float linewidth; - // float - public float miterlimit; - // float - public float dashphase; - // int - public int dashlen; - // float[32] - [MarshalAsAttribute (UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.R4)] - public float[] dashlist; - } - [StructLayoutAttribute (LayoutKind.Sequential)] - public struct fz_textel_s - { - // float - public float x; - // float - public float y; - // int - public int gid; - // int - public int ucs; - } - [StructLayoutAttribute (LayoutKind.Sequential)] - public struct fz_shade_s - { - // int - public int refs; - // fz_rect->fz_rect_s - public fz_rect_s bbox; - // fz_colorspace* - public IntPtr cs; - // fz_matrix->fz_matrix_s - public fz_matrix_s matrix; - // int - public int usebackground; - // float[] - public float[] background; - // int - public int usefunction; - // float[] - public float[] function; - // int - public int type; - // int[2] - [MarshalAsAttribute (UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I4)] - public int[] extend; - // int - public int meshlen; - // int - public int meshcap; - // float* - public IntPtr mesh; - } - [StructLayoutAttribute (LayoutKind.Sequential)] - public struct fz_edge_s - { - // int - public int x; - // int - public int e; - // int - public int h; - // int - public int y; - // int - public int adjup; - // int - public int adjdown; - // int - public int xmove; - // int - public int xdir; - // int - public int ydir; - } - [StructLayoutAttribute (LayoutKind.Sequential)] - public struct fz_gel_s - { - // fz_bbox->fz_bbox_s - public fz_bbox_s clip; - // fz_bbox->fz_bbox_s - public fz_bbox_s bbox; - // int - public int cap; - // int - public int len; - // fz_edge* - public IntPtr edges; - } - [StructLayoutAttribute (LayoutKind.Sequential)] - public struct fz_ael_s - { - // int - public int cap; - // int - public int len; - // fz_edge** - public IntPtr edges; - } - [StructLayoutAttribute (LayoutKind.Sequential)] - public struct fz_textchar_s - { - // int - public int c; - // fz_bbox->fz_bbox_s - public fz_bbox_s bbox; - } - public enum fz_displaycommand_e - { - FZ_CMDFILLPATH, - FZ_CMDSTROKEPATH, - FZ_CMDCLIPPATH, - FZ_CMDCLIPSTROKEPATH, - FZ_CMDFILLTEXT, - FZ_CMDSTROKETEXT, - FZ_CMDCLIPTEXT, - FZ_CMDCLIPSTROKETEXT, - FZ_CMDIGNORETEXT, - FZ_CMDFILLSHADE, - FZ_CMDFILLIMAGE, - FZ_CMDFILLIMAGEMASK, - FZ_CMDCLIPIMAGEMASK, - FZ_CMDPOPCLIP, - FZ_CMDBEGINMASK, - FZ_CMDENDMASK, - FZ_CMDBEGINGROUP, - FZ_CMDENDGROUP, - } - [StructLayoutAttribute (LayoutKind.Sequential)] - public struct pdf_cryptfilter_s - { - // int - public int method; - // int - public int length; - } - [StructLayoutAttribute (LayoutKind.Sequential)] - public struct pdf_range_s - { - // unsigned short - public ushort low; - // unsigned short - public ushort extentflags; - // unsigned int - public uint offset; - } - [StructLayoutAttribute (LayoutKind.Sequential, CharSet = CharSet.Ansi)] - public struct pdf_cmap_s - { - [StructLayoutAttribute (LayoutKind.Sequential)] - public struct Cspace - { - // unsigned short - public ushort n; - // unsigned short - public ushort low; - // unsigned short - public ushort high; - } - - // int - public int refs; - // char[32] - [MarshalAsAttribute (UnmanagedType.ByValTStr, SizeConst = 32)] - public string cmapname; - // char[32] - [MarshalAsAttribute (UnmanagedType.ByValTStr, SizeConst = 32)] - public string usecmapname; - // pdf_cmap* - public IntPtr usecmap; - // int - public int wmode; - // int - public int ncspace; - // Anonymous_f39df5ad_2fc5_4167_911a_7b31839b08a0[40] - [MarshalAsAttribute (UnmanagedType.ByValArray, SizeConst = 40, ArraySubType = UnmanagedType.Struct)] - public pdf_cmap_s.Cspace[] cspace; - // int - public int rlen; - // int - public int rcap; - // pdf_range* - public IntPtr ranges; - // int - public int tlen; - // int - public int tcap; - // unsigned short* - public IntPtr table; - - } - [StructLayoutAttribute (LayoutKind.Sequential)] - public struct pdf_hmtx_s - { - // unsigned short - public ushort lo; - // unsigned short - public ushort hi; - // int - public int w; - } - [StructLayoutAttribute (LayoutKind.Sequential)] - public struct pdf_vmtx_s - { - // unsigned short - public ushort lo; - // unsigned short - public ushort hi; - // short - public short x; - // short - public short y; - // short - public short w; - } - public enum pdf_linkkind_e - { - // PDF_LGOTO -> 0 - PDF_LGOTO = 0, - PDF_LURI, - PDF_LLAUNCH, - PDF_LNAMED, - PDF_LACTION, - } - - public partial class NativeMethods - { - const string DLL = "libmupdf.dll"; - // Return Type: void* - //size: int - [DllImportAttribute (DLL, EntryPoint = "fz_malloc")] - public static extern IntPtr fz_malloc (int size); - // Return Type: void* - //count: int - //size: int - [DllImportAttribute (DLL, EntryPoint = "fz_calloc")] - public static extern IntPtr fz_calloc (int count, int size); - // Return Type: void* - //p: void* - //count: int - //size: int - [DllImportAttribute (DLL, EntryPoint = "fz_realloc")] - public static extern IntPtr fz_realloc (IntPtr p, int count, int size); - // Return Type: void - //p: void* - [DllImportAttribute (DLL, EntryPoint = "fz_free")] - public static extern void fz_free (IntPtr p); - // Return Type: char* - //s: char* - [DllImportAttribute (DLL, EntryPoint = "fz_strdup")] - public static extern IntPtr fz_strdup (IntPtr s); - // Return Type: int - [DllImportAttribute (DLL, EntryPoint = "fz_isbigendian")] - public static extern int fz_isbigendian (); - // Return Type: char* - //stringp: char** - //delim: char* - [DllImportAttribute (DLL, EntryPoint = "fz_strsep")] - public static extern IntPtr fz_strsep (ref IntPtr stringp, [InAttribute ()] [MarshalAsAttribute (UnmanagedType.LPStr)] string delim); - // Return Type: int - //dst: char* - //src: char* - //n: int - [DllImportAttribute (DLL, EntryPoint = "fz_strlcpy")] - public static extern int fz_strlcpy (IntPtr dst, [InAttribute ()] [MarshalAsAttribute (UnmanagedType.LPStr)] string src, int n); - // Return Type: int - //dst: char* - //src: char* - //n: int - [DllImportAttribute (DLL, EntryPoint = "fz_strlcat")] - public static extern int fz_strlcat (IntPtr dst, [InAttribute ()] [MarshalAsAttribute (UnmanagedType.LPStr)] string src, int n); - // Return Type: fz_matrix->fz_matrix_s - //one: fz_matrix->fz_matrix_s - //two: fz_matrix->fz_matrix_s - [DllImportAttribute (DLL, EntryPoint = "fz_concat")] - public static extern fz_matrix_s fz_concat (fz_matrix_s one, fz_matrix_s two); - // Return Type: fz_matrix->fz_matrix_s - //sx: float - //sy: float - [DllImportAttribute (DLL, EntryPoint = "fz_scale")] - public static extern fz_matrix_s fz_scale (float sx, float sy); - // Return Type: fz_matrix->fz_matrix_s - //theta: float - [DllImportAttribute (DLL, EntryPoint = "fz_rotate")] - public static extern fz_matrix_s fz_rotate (float theta); - // Return Type: fz_matrix->fz_matrix_s - //tx: float - //ty: float - [DllImportAttribute (DLL, EntryPoint = "fz_translate")] - public static extern fz_matrix_s fz_translate (float tx, float ty); - // Return Type: fz_matrix->fz_matrix_s - //m: fz_matrix->fz_matrix_s - [DllImportAttribute (DLL, EntryPoint = "fz_invertmatrix")] - public static extern fz_matrix_s fz_invertmatrix (fz_matrix_s m); - // Return Type: int - //m: fz_matrix->fz_matrix_s - [DllImportAttribute (DLL, EntryPoint = "fz_isrectilinear")] - public static extern int fz_isrectilinear (fz_matrix_s m); - // Return Type: float - //m: fz_matrix->fz_matrix_s - [DllImportAttribute (DLL, EntryPoint = "fz_matrixexpansion")] - public static extern float fz_matrixexpansion (fz_matrix_s m); - // Return Type: fz_bbox->fz_bbox_s - //r: fz_rect->fz_rect_s - [DllImportAttribute (DLL, EntryPoint = "fz_roundrect")] - public static extern fz_bbox_s fz_roundrect (fz_rect_s r); - // Return Type: fz_bbox->fz_bbox_s - //a: fz_bbox->fz_bbox_s - //b: fz_bbox->fz_bbox_s - [DllImportAttribute (DLL, EntryPoint = "fz_intersectbbox")] - public static extern fz_bbox_s fz_intersectbbox (fz_bbox_s a, fz_bbox_s b); - // Return Type: fz_bbox->fz_bbox_s - //a: fz_bbox->fz_bbox_s - //b: fz_bbox->fz_bbox_s - [DllImportAttribute (DLL, EntryPoint = "fz_unionbbox")] - public static extern fz_bbox_s fz_unionbbox (fz_bbox_s a, fz_bbox_s b); - // Return Type: fz_point->fz_point_s - //m: fz_matrix->fz_matrix_s - //p: fz_point->fz_point_s - [DllImportAttribute (DLL, EntryPoint = "fz_transformpoint")] - public static extern fz_point_s fz_transformpoint (fz_matrix_s m, fz_point_s p); - // Return Type: fz_point->fz_point_s - //m: fz_matrix->fz_matrix_s - //p: fz_point->fz_point_s - [DllImportAttribute (DLL, EntryPoint = "fz_transformvector")] - public static extern fz_point_s fz_transformvector (fz_matrix_s m, fz_point_s p); - // Return Type: fz_rect->fz_rect_s - //m: fz_matrix->fz_matrix_s - //r: fz_rect->fz_rect_s - [DllImportAttribute (DLL, EntryPoint = "fz_transformrect")] - public static extern fz_rect_s fz_transformrect (fz_matrix_s m, fz_rect_s r); - // Return Type: fz_bbox->fz_bbox_s - //m: fz_matrix->fz_matrix_s - //b: fz_bbox->fz_bbox_s - [DllImportAttribute (DLL, EntryPoint = "fz_transformbbox")] - public static extern fz_bbox_s fz_transformbbox (fz_matrix_s m, fz_bbox_s b); - // Return Type: void - //state: fz_md5* - [DllImportAttribute (DLL, EntryPoint = "fz_md5init")] - public static extern void fz_md5init (ref fz_md5_s state); - // Return Type: void - //state: fz_md5* - //input: char* - //inlen: int - [DllImportAttribute (DLL, EntryPoint = "fz_md5update")] - public static extern void fz_md5update (ref fz_md5_s state, [InAttribute ()] [MarshalAsAttribute (UnmanagedType.LPStr)] string input, int inlen); - // Return Type: void - //state: fz_sha256* - [DllImportAttribute (DLL, EntryPoint = "fz_sha256init")] - public static extern void fz_sha256init (ref fz_sha256_s state); - // Return Type: void - //state: fz_sha256* - //input: char* - //inlen: unsigned int - [DllImportAttribute (DLL, EntryPoint = "fz_sha256update")] - public static extern void fz_sha256update (ref fz_sha256_s state, [InAttribute ()] [MarshalAsAttribute (UnmanagedType.LPStr)] string input, uint inlen); - // Return Type: void - //state: fz_arc4* - //key: char* - //len: int - [DllImportAttribute (DLL, EntryPoint = "fz_arc4init")] - public static extern void fz_arc4init (ref fz_arc4_s state, [InAttribute ()] [MarshalAsAttribute (UnmanagedType.LPStr)] string key, int len); - // Return Type: void - //state: fz_arc4* - //dest: unsigned char* - //src: char* - //len: int - [DllImportAttribute (DLL, EntryPoint = "fz_arc4encrypt")] - public static extern void fz_arc4encrypt (ref fz_arc4_s state, IntPtr dest, [InAttribute ()] [MarshalAsAttribute (UnmanagedType.LPStr)] string src, int len); - // Return Type: void - //ctx: fz_aes* - //key: char* - //keysize: int - [DllImportAttribute (DLL, EntryPoint = "aes_setkey_enc")] - public static extern void aes_setkey_enc (ref fz_aes_s ctx, [InAttribute ()] [MarshalAsAttribute (UnmanagedType.LPStr)] string key, int keysize); - // Return Type: void - //ctx: fz_aes* - //key: char* - //keysize: int - [DllImportAttribute (DLL, EntryPoint = "aes_setkey_dec")] - public static extern void aes_setkey_dec (ref fz_aes_s ctx, [InAttribute ()] [MarshalAsAttribute (UnmanagedType.LPStr)] string key, int keysize); - // Return Type: fz_buffer* - //size: int - [DllImportAttribute (DLL, EntryPoint = "fz_newbuffer")] - public static extern IntPtr fz_newbuffer (int size); - // Return Type: fz_buffer* - //buf: fz_buffer* - [DllImportAttribute (DLL, EntryPoint = "fz_keepbuffer")] - public static extern IntPtr fz_keepbuffer (ref fz_buffer_s buf); - // Return Type: void - //buf: fz_buffer* - [DllImportAttribute (DLL, EntryPoint = "fz_dropbuffer")] - public static extern void fz_dropbuffer (ref fz_buffer_s buf); - // Return Type: void - //buf: fz_buffer* - //size: int - [DllImportAttribute (DLL, EntryPoint = "fz_resizebuffer")] - public static extern void fz_resizebuffer (ref fz_buffer_s buf, int size); - // Return Type: void - //buf: fz_buffer* - [DllImportAttribute (DLL, EntryPoint = "fz_growbuffer")] - public static extern void fz_growbuffer (ref fz_buffer_s buf); - // Return Type: fz_pixmap* - //colorspace: fz_colorspace* - //x: int - //y: int - //w: int - //h: int - //samples: unsigned char* - [DllImportAttribute (DLL, EntryPoint = "fz_newpixmapwithdata")] - public static extern IntPtr fz_newpixmapwithdata (ref fz_colorspace_s colorspace, int x, int y, int w, int h, IntPtr samples); - // Return Type: fz_pixmap* - //param0: fz_colorspace* - //bbox: fz_bbox->fz_bbox_s - [DllImportAttribute (DLL, EntryPoint = "fz_newpixmapwithrect")] - public static extern IntPtr fz_newpixmapwithrect (ref fz_colorspace_s param0, fz_bbox_s bbox); - // Return Type: fz_pixmap* - //param0: fz_colorspace* - //x: int - //y: int - //w: int - //h: int - [DllImportAttribute (DLL, EntryPoint = "fz_newpixmap")] - public static extern IntPtr fz_newpixmap (ref fz_colorspace_s param0, int x, int y, int w, int h); - // Return Type: fz_pixmap* - //pix: fz_pixmap* - [DllImportAttribute (DLL, EntryPoint = "fz_keeppixmap")] - public static extern IntPtr fz_keeppixmap (ref fz_pixmap_s pix); - // Return Type: void - //pix: fz_pixmap* - [DllImportAttribute (DLL, EntryPoint = "fz_droppixmap")] - public static extern void fz_droppixmap (ref fz_pixmap_s pix); - // Return Type: void - //pix: fz_pixmap* - [DllImportAttribute (DLL, EntryPoint = "fz_clearpixmap")] - public static extern void fz_clearpixmap (ref fz_pixmap_s pix); - // Return Type: void - //pix: fz_pixmap* - //value: int - [DllImportAttribute (DLL, EntryPoint = "fz_clearpixmapwithcolor")] - public static extern void fz_clearpixmapwithcolor (ref fz_pixmap_s pix, int value); - // Return Type: fz_pixmap* - //gray: fz_pixmap* - //luminosity: int - [DllImportAttribute (DLL, EntryPoint = "fz_alphafromgray")] - public static extern IntPtr fz_alphafromgray (ref fz_pixmap_s gray, int luminosity); - // Return Type: fz_bbox->fz_bbox_s - //pix: fz_pixmap* - [DllImportAttribute (DLL, EntryPoint = "fz_boundpixmap")] - public static extern fz_bbox_s fz_boundpixmap (ref fz_pixmap_s pix); - // Return Type: fz_pixmap* - //src: fz_pixmap* - //xdenom: int - //ydenom: int - [DllImportAttribute (DLL, EntryPoint = "fz_scalepixmap")] - public static extern IntPtr fz_scalepixmap (ref fz_pixmap_s src, int xdenom, int ydenom); - // Return Type: fz_pixmap* - //src: fz_pixmap* - //x: float - //y: float - //w: float - //h: float - [DllImportAttribute (DLL, EntryPoint = "fz_smoothscalepixmap")] - public static extern IntPtr fz_smoothscalepixmap (ref fz_pixmap_s src, float x, float y, float w, float h); - // Return Type: fz_error->int - //pixmap: fz_pixmap* - //filename: char* - [DllImportAttribute (DLL, EntryPoint = "fz_writepnm")] - public static extern int fz_writepnm (ref fz_pixmap_s pixmap, IntPtr filename); - // Return Type: fz_error->int - //pixmap: fz_pixmap* - //filename: char* - //savealpha: int - [DllImportAttribute (DLL, EntryPoint = "fz_writepam")] - public static extern int fz_writepam (ref fz_pixmap_s pixmap, IntPtr filename, int savealpha); - // Return Type: fz_error->int - //pixmap: fz_pixmap* - //filename: char* - //savealpha: int - [DllImportAttribute (DLL, EntryPoint = "fz_writepng")] - public static extern int fz_writepng (ref fz_pixmap_s pixmap, IntPtr filename, int savealpha); - // Return Type: fz_error->int - //imgp: fz_pixmap** - //data: unsigned char* - //size: int - [DllImportAttribute (DLL, EntryPoint = "fz_loadjpximage")] - public static extern int fz_loadjpximage (ref IntPtr imgp, IntPtr data, int size); - // Return Type: fz_colorspace* - //name: char* - //n: int - [DllImportAttribute (DLL, EntryPoint = "fz_newcolorspace")] - public static extern IntPtr fz_newcolorspace (IntPtr name, int n); - // Return Type: fz_colorspace* - //cs: fz_colorspace* - [DllImportAttribute (DLL, EntryPoint = "fz_keepcolorspace")] - public static extern IntPtr fz_keepcolorspace (ref fz_colorspace_s cs); - // Return Type: void - //cs: fz_colorspace* - [DllImportAttribute (DLL, EntryPoint = "fz_dropcolorspace")] - public static extern void fz_dropcolorspace (ref fz_colorspace_s cs); - // Return Type: fz_colorspace* - //name: char* - [DllImportAttribute (DLL, EntryPoint = "fz_getstaticcolorspace")] - public static extern IntPtr fz_getstaticcolorspace (IntPtr name); - // Return Type: void - //srcs: fz_colorspace* - //srcv: float* - //dsts: fz_colorspace* - //dstv: float* - [DllImportAttribute (DLL, EntryPoint = "fz_convertcolor")] - public static extern void fz_convertcolor (ref fz_colorspace_s srcs, ref float srcv, ref fz_colorspace_s dsts, ref float dstv); - // Return Type: void - //src: fz_pixmap* - //dst: fz_pixmap* - [DllImportAttribute (DLL, EntryPoint = "fz_convertpixmap")] - public static extern void fz_convertpixmap (ref fz_pixmap_s src, ref fz_pixmap_s dst); - // Return Type: char* - //err: int - [DllImportAttribute (DLL, EntryPoint = "ft_errorstring")] - public static extern IntPtr ft_errorstring (int err); - // Return Type: fz_path* - [DllImportAttribute (DLL, EntryPoint = "fz_newpath")] - public static extern IntPtr fz_newpath (); - // Return Type: void - //param0: fz_path* - //x: float - //y: float - [DllImportAttribute (DLL, EntryPoint = "fz_moveto")] - public static extern void fz_moveto (ref fz_path_s param0, float x, float y); - // Return Type: void - //param0: fz_path* - //x: float - //y: float - [DllImportAttribute (DLL, EntryPoint = "fz_lineto")] - public static extern void fz_lineto (ref fz_path_s param0, float x, float y); - // Return Type: void - //param0: fz_path* - //param1: float - //param2: float - //param3: float - //param4: float - //param5: float - //param6: float - [DllImportAttribute (DLL, EntryPoint = "fz_curveto")] - public static extern void fz_curveto (ref fz_path_s param0, float param1, float param2, float param3, float param4, float param5, float param6); - // Return Type: void - //param0: fz_path* - //param1: float - //param2: float - //param3: float - //param4: float - [DllImportAttribute (DLL, EntryPoint = "fz_curvetov")] - public static extern void fz_curvetov (ref fz_path_s param0, float param1, float param2, float param3, float param4); - // Return Type: void - //param0: fz_path* - //param1: float - //param2: float - //param3: float - //param4: float - [DllImportAttribute (DLL, EntryPoint = "fz_curvetoy")] - public static extern void fz_curvetoy (ref fz_path_s param0, float param1, float param2, float param3, float param4); - // Return Type: void - //param0: fz_path* - [DllImportAttribute (DLL, EntryPoint = "fz_closepath")] - public static extern void fz_closepath (ref fz_path_s param0); - // Return Type: void - //path: fz_path* - [DllImportAttribute (DLL, EntryPoint = "fz_freepath")] - public static extern void fz_freepath (ref fz_path_s path); - // Return Type: fz_path* - //old: fz_path* - [DllImportAttribute (DLL, EntryPoint = "fz_clonepath")] - public static extern IntPtr fz_clonepath (ref fz_path_s old); - // Return Type: fz_rect->fz_rect_s - //path: fz_path* - //stroke: fz_strokestate* - //ctm: fz_matrix->fz_matrix_s - [DllImportAttribute (DLL, EntryPoint = "fz_boundpath")] - public static extern fz_rect_s fz_boundpath (ref fz_path_s path, ref fz_strokestate_s stroke, fz_matrix_s ctm); - // Return Type: void - //param0: fz_path* - //indent: int - [DllImportAttribute (DLL, EntryPoint = "fz_debugpath")] - public static extern void fz_debugpath (ref fz_path_s param0, int indent); - // Return Type: fz_shade* - //shade: fz_shade* - [DllImportAttribute (DLL, EntryPoint = "fz_keepshade")] - public static extern IntPtr fz_keepshade (ref fz_shade_s shade); - // Return Type: void - //shade: fz_shade* - [DllImportAttribute (DLL, EntryPoint = "fz_dropshade")] - public static extern void fz_dropshade (ref fz_shade_s shade); - // Return Type: void - //shade: fz_shade* - [DllImportAttribute (DLL, EntryPoint = "fz_debugshade")] - public static extern void fz_debugshade (ref fz_shade_s shade); - // Return Type: fz_rect->fz_rect_s - //shade: fz_shade* - //ctm: fz_matrix->fz_matrix_s - [DllImportAttribute (DLL, EntryPoint = "fz_boundshade")] - public static extern fz_rect_s fz_boundshade (ref fz_shade_s shade, fz_matrix_s ctm); - // Return Type: void - //shade: fz_shade* - //ctm: fz_matrix->fz_matrix_s - //dest: fz_pixmap* - //bbox: fz_bbox->fz_bbox_s - [DllImportAttribute (DLL, EntryPoint = "fz_paintshade")] - public static extern void fz_paintshade (ref fz_shade_s shade, fz_matrix_s ctm, ref fz_pixmap_s dest, fz_bbox_s bbox); - // Return Type: fz_gel* - [DllImportAttribute (DLL, EntryPoint = "fz_newgel")] - public static extern IntPtr fz_newgel (); - // Return Type: void - //gel: fz_gel* - //x0: float - //y0: float - //x1: float - //y1: float - [DllImportAttribute (DLL, EntryPoint = "fz_insertgel")] - public static extern void fz_insertgel (ref fz_gel_s gel, float x0, float y0, float x1, float y1); - // Return Type: fz_bbox->fz_bbox_s - //gel: fz_gel* - [DllImportAttribute (DLL, EntryPoint = "fz_boundgel")] - public static extern fz_bbox_s fz_boundgel (ref fz_gel_s gel); - // Return Type: void - //gel: fz_gel* - //clip: fz_bbox->fz_bbox_s - [DllImportAttribute (DLL, EntryPoint = "fz_resetgel")] - public static extern void fz_resetgel (ref fz_gel_s gel, fz_bbox_s clip); - // Return Type: void - //gel: fz_gel* - [DllImportAttribute (DLL, EntryPoint = "fz_sortgel")] - public static extern void fz_sortgel (ref fz_gel_s gel); - // Return Type: void - //gel: fz_gel* - [DllImportAttribute (DLL, EntryPoint = "fz_freegel")] - public static extern void fz_freegel (ref fz_gel_s gel); - // Return Type: int - //gel: fz_gel* - [DllImportAttribute (DLL, EntryPoint = "fz_isrectgel")] - public static extern int fz_isrectgel (ref fz_gel_s gel); - // Return Type: fz_ael* - [DllImportAttribute (DLL, EntryPoint = "fz_newael")] - public static extern IntPtr fz_newael (); - // Return Type: void - //ael: fz_ael* - [DllImportAttribute (DLL, EntryPoint = "fz_freeael")] - public static extern void fz_freeael (ref fz_ael_s ael); - // Return Type: fz_error->int - //gel: fz_gel* - //ael: fz_ael* - //eofill: int - //clip: fz_bbox->fz_bbox_s - //pix: fz_pixmap* - //colorbv: unsigned char* - [DllImportAttribute (DLL, EntryPoint = "fz_scanconvert")] - public static extern int fz_scanconvert (ref fz_gel_s gel, ref fz_ael_s ael, int eofill, fz_bbox_s clip, ref fz_pixmap_s pix, IntPtr colorbv); - // Return Type: void - //gel: fz_gel* - //path: fz_path* - //ctm: fz_matrix->fz_matrix_s - //flatness: float - [DllImportAttribute (DLL, EntryPoint = "fz_fillpath")] - public static extern void fz_fillpath (ref fz_gel_s gel, ref fz_path_s path, fz_matrix_s ctm, float flatness); - // Return Type: void - //gel: fz_gel* - //path: fz_path* - //stroke: fz_strokestate* - //ctm: fz_matrix->fz_matrix_s - //flatness: float - //linewidth: float - [DllImportAttribute (DLL, EntryPoint = "fz_strokepath")] - public static extern void fz_strokepath (ref fz_gel_s gel, ref fz_path_s path, ref fz_strokestate_s stroke, fz_matrix_s ctm, float flatness, float linewidth); - // Return Type: void - //gel: fz_gel* - //path: fz_path* - //stroke: fz_strokestate* - //ctm: fz_matrix->fz_matrix_s - //flatness: float - //linewidth: float - [DllImportAttribute (DLL, EntryPoint = "fz_dashpath")] - public static extern void fz_dashpath (ref fz_gel_s gel, ref fz_path_s path, ref fz_strokestate_s stroke, fz_matrix_s ctm, float flatness, float linewidth); - // Return Type: void - [DllImportAttribute (DLL, EntryPoint = "fz_accelerate")] - public static extern void fz_accelerate (); - // Return Type: void - //pix: fz_pixmap* - //decode: float* - [DllImportAttribute (DLL, EntryPoint = "fz_decodetile")] - public static extern void fz_decodetile (ref fz_pixmap_s pix, ref float decode); - // Return Type: void - //pix: fz_pixmap* - //decode: float* - //maxval: int - [DllImportAttribute (DLL, EntryPoint = "fz_decodeindexedtile")] - public static extern void fz_decodeindexedtile (ref fz_pixmap_s pix, ref float decode, int maxval); - // Return Type: void - //dst: fz_pixmap* - //scissor: fz_bbox->fz_bbox_s - //img: fz_pixmap* - //ctm: fz_matrix->fz_matrix_s - //alpha: int - [DllImportAttribute (DLL, EntryPoint = "fz_paintimage")] - public static extern void fz_paintimage (ref fz_pixmap_s dst, fz_bbox_s scissor, ref fz_pixmap_s img, fz_matrix_s ctm, int alpha); - // Return Type: void - //dst: fz_pixmap* - //scissor: fz_bbox->fz_bbox_s - //img: fz_pixmap* - //ctm: fz_matrix->fz_matrix_s - //colorbv: unsigned char* - [DllImportAttribute (DLL, EntryPoint = "fz_paintimagecolor")] - public static extern void fz_paintimagecolor (ref fz_pixmap_s dst, fz_bbox_s scissor, ref fz_pixmap_s img, fz_matrix_s ctm, IntPtr colorbv); - // Return Type: void - //dst: fz_pixmap* - //src: fz_pixmap* - //alpha: int - [DllImportAttribute (DLL, EntryPoint = "fz_paintpixmap")] - public static extern void fz_paintpixmap (ref fz_pixmap_s dst, ref fz_pixmap_s src, int alpha); - // Return Type: void - //dst: fz_pixmap* - //src: fz_pixmap* - //msk: fz_pixmap* - [DllImportAttribute (DLL, EntryPoint = "fz_paintpixmapmask")] - public static extern void fz_paintpixmapmask (ref fz_pixmap_s dst, ref fz_pixmap_s src, ref fz_pixmap_s msk); - // Return Type: void - //dst: fz_pixmap* - //src: fz_pixmap* - //alpha: int - //blendmode: fz_blendmode->fz_blendmode_e - [DllImportAttribute (DLL, EntryPoint = "fz_blendpixmap")] - public static extern void fz_blendpixmap (ref fz_pixmap_s dst, ref fz_pixmap_s src, int alpha, fz_blendmode_e blendmode); - // Return Type: char* - //src: unsigned short* - [DllImportAttribute (DLL, EntryPoint = "pdf_fromucs2")] - public static extern IntPtr pdf_fromucs2 (ref ushort src); - // Return Type: fz_pixmap* - //src: fz_pixmap* - [DllImportAttribute (DLL, EntryPoint = "pdf_expandindexedpixmap")] - public static extern IntPtr pdf_expandindexedpixmap (ref fz_pixmap_s src); - // Return Type: pdf_cmap* - [DllImportAttribute (DLL, EntryPoint = "pdf_newcmap")] - public static extern IntPtr pdf_newcmap (); - // Return Type: pdf_cmap* - //cmap: pdf_cmap* - [DllImportAttribute (DLL, EntryPoint = "pdf_keepcmap")] - public static extern IntPtr pdf_keepcmap (ref pdf_cmap_s cmap); - // Return Type: void - //cmap: pdf_cmap* - [DllImportAttribute (DLL, EntryPoint = "pdf_dropcmap")] - public static extern void pdf_dropcmap (ref pdf_cmap_s cmap); - // Return Type: void - //cmap: pdf_cmap* - [DllImportAttribute (DLL, EntryPoint = "pdf_debugcmap")] - public static extern void pdf_debugcmap (ref pdf_cmap_s cmap); - // Return Type: int - //cmap: pdf_cmap* - [DllImportAttribute (DLL, EntryPoint = "pdf_getwmode")] - public static extern int pdf_getwmode (ref pdf_cmap_s cmap); - // Return Type: void - //cmap: pdf_cmap* - //wmode: int - [DllImportAttribute (DLL, EntryPoint = "pdf_setwmode")] - public static extern void pdf_setwmode (ref pdf_cmap_s cmap, int wmode); - // Return Type: void - //cmap: pdf_cmap* - //usecmap: pdf_cmap* - [DllImportAttribute (DLL, EntryPoint = "pdf_setusecmap")] - public static extern void pdf_setusecmap (ref pdf_cmap_s cmap, ref pdf_cmap_s usecmap); - // Return Type: void - //cmap: pdf_cmap* - //low: int - //high: int - //n: int - [DllImportAttribute (DLL, EntryPoint = "pdf_addcodespace")] - public static extern void pdf_addcodespace (ref pdf_cmap_s cmap, int low, int high, int n); - // Return Type: void - //cmap: pdf_cmap* - //low: int - //map: int* - //len: int - [DllImportAttribute (DLL, EntryPoint = "pdf_maprangetotable")] - public static extern void pdf_maprangetotable (ref pdf_cmap_s cmap, int low, ref int map, int len); - // Return Type: void - //cmap: pdf_cmap* - //srclo: int - //srchi: int - //dstlo: int - [DllImportAttribute (DLL, EntryPoint = "pdf_maprangetorange")] - public static extern void pdf_maprangetorange (ref pdf_cmap_s cmap, int srclo, int srchi, int dstlo); - // Return Type: void - //cmap: pdf_cmap* - //one: int - //many: int* - //len: int - [DllImportAttribute (DLL, EntryPoint = "pdf_maponetomany")] - public static extern void pdf_maponetomany (ref pdf_cmap_s cmap, int one, ref int many, int len); - // Return Type: void - //cmap: pdf_cmap* - [DllImportAttribute (DLL, EntryPoint = "pdf_sortcmap")] - public static extern void pdf_sortcmap (ref pdf_cmap_s cmap); - // Return Type: int - //cmap: pdf_cmap* - //cpt: int - [DllImportAttribute (DLL, EntryPoint = "pdf_lookupcmap")] - public static extern int pdf_lookupcmap (ref pdf_cmap_s cmap, int cpt); - // Return Type: int - //cmap: pdf_cmap* - //cpt: int - //out: int* - [DllImportAttribute (DLL, EntryPoint = "pdf_lookupcmapfull")] - public static extern int pdf_lookupcmapfull (ref pdf_cmap_s cmap, int cpt, ref int @out); - // Return Type: unsigned char* - //cmap: pdf_cmap* - //s: unsigned char* - //cpt: int* - [DllImportAttribute (DLL, EntryPoint = "pdf_decodecmap")] - public static extern IntPtr pdf_decodecmap (ref pdf_cmap_s cmap, IntPtr s, ref int cpt); - // Return Type: pdf_cmap* - //wmode: int - //bytes: int - [DllImportAttribute (DLL, EntryPoint = "pdf_newidentitycmap")] - public static extern IntPtr pdf_newidentitycmap (int wmode, int bytes); - // Return Type: fz_error->int - //cmapp: pdf_cmap** - //name: char* - [DllImportAttribute (DLL, EntryPoint = "pdf_loadsystemcmap")] - public static extern int pdf_loadsystemcmap (ref IntPtr cmapp, IntPtr name); - // Return Type: void - //estrings: char** - //encoding: char* - [DllImportAttribute (DLL, EntryPoint = "pdf_loadencoding")] - public static extern void pdf_loadencoding (ref IntPtr estrings, IntPtr encoding); - // Return Type: int - //name: char* - [DllImportAttribute (DLL, EntryPoint = "pdf_lookupagl")] - public static extern int pdf_lookupagl (IntPtr name); - } - -} diff --git a/pdfpatcher/App/Processor/Mupdf/NativeMethods.Document.cs b/pdfpatcher/App/Processor/Mupdf/NativeMethods.Document.cs deleted file mode 100644 index f66219792879464eedf693773a11083b43a86684..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Mupdf/NativeMethods.Document.cs +++ /dev/null @@ -1,179 +0,0 @@ -using System; -using System.IO; -using System.Runtime.InteropServices; -using CC = System.Runtime.InteropServices.CallingConvention; - -namespace MuPdfSharp -{ - static partial class NativeMethods - { - #region Object creation - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_new_null")] - internal static extern IntPtr NewNull(ContextHandle ctx, DocumentHandle doc); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_new_bool")] - internal static extern IntPtr NewBoolean(ContextHandle ctx, DocumentHandle doc, int boolean); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_new_int")] - internal static extern IntPtr NewInteger(ContextHandle ctx, DocumentHandle doc, int value); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_new_real")] - internal static extern IntPtr NewFloat(ContextHandle ctx, DocumentHandle doc, float value); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_new_string", BestFitMapping = false)] - internal static extern IntPtr NewString(ContextHandle ctx, DocumentHandle doc, [MarshalAs(UnmanagedType.LPStr)] string value, int len); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_new_name", BestFitMapping = false)] - internal static extern IntPtr NewName(ContextHandle ctx, DocumentHandle doc, [MarshalAs(UnmanagedType.LPStr)] string name); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_new_array")] - internal static extern IntPtr NewArray(ContextHandle ctx, DocumentHandle doc, int initCap); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_new_dict")] - internal static extern IntPtr NewDictionary(ContextHandle ctx, DocumentHandle doc, int initCap); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_new_indirect")] - internal static extern IntPtr NewIndirectReference(ContextHandle ctx, DocumentHandle doc, int num, int gen); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_new_rect")] - internal static extern IntPtr NewRect(ContextHandle ctx, DocumentHandle doc, Rectangle rect); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_new_matrix")] - internal static extern IntPtr NewMatrix(ContextHandle ctx, DocumentHandle doc, Matrix matrix); - #endregion - - #region Document level object and operation - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_authenticate_password", BestFitMapping = false)] - internal static extern bool AuthenticatePassword(ContextHandle ctx, DocumentHandle doc, [MarshalAs(UnmanagedType.LPStr)] string password); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_trailer")] - internal static extern IntPtr GetTrailer(ContextHandle ctx, DocumentHandle doc); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_count_pages")] - internal static extern int CountPages(ContextHandle ctx, DocumentHandle doc); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_flush_warnings")] - internal static extern void FlushWarnings(ContextHandle ctx); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_open_document", CharSet = CharSet.Unicode)] - internal static extern DocumentHandle OpenPdfDocument(ContextHandle ctx, string fileName); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_needs_password")] - internal static extern bool NeedsPdfPassword(ContextHandle ctx, DocumentHandle doc); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_aa_level")] - internal static extern int GetAntiAliasLevel(ContextHandle ctx); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_set_aa_level")] - internal static extern void SetAntiAliasLevel(ContextHandle ctx, int level); - #endregion - - #region Fonts - internal static readonly FzLoadSystemFont LoadSystemFont = RequestSystemFont; - internal static readonly FzLoadSystemCjkFont LoadSystemCjkFont = RequestSystemCjkFont; - internal static readonly FzLoadSystemFallbackFont LoadSystemFallbackFont = RequestSystemFallbackFont; - - [UnmanagedFunctionPointer(CC.Cdecl)] - internal delegate IntPtr FzLoadSystemFont(IntPtr ctx, string name, int bold, int italic, int needExactMetrics); - [UnmanagedFunctionPointer(CC.Cdecl)] - internal delegate IntPtr FzLoadSystemCjkFont(IntPtr ctx, string name, int registry, int serifDesired); - [UnmanagedFunctionPointer(CC.Cdecl)] - internal delegate IntPtr FzLoadSystemFallbackFont(IntPtr ctx, int script, int language, int serif, int bold, int italic); - - /// 打开系统内置汉字库功能,支持老的未正确嵌入汉字库的 PDF。 - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_install_load_system_font_funcs")] - internal static extern void LoadSystemFontFuncs(ContextHandle ctx, - FzLoadSystemFont fz_load_system_font_fn, - FzLoadSystemCjkFont fz_load_system_cjk_font_fn, - FzLoadSystemFallbackFont fz_load_system_fallback_font_fn - ); - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_new_font_from_file", CharSet = CharSet.Ansi)] - internal static extern IntPtr LoadFontFromFile(IntPtr ctx, [MarshalAs(UnmanagedType.LPStr)] string name, [MarshalAs(UnmanagedType.LPStr)] string path, int index, int useGlyphBox); - static IntPtr RequestSystemFont(IntPtr ctx, [MarshalAs(UnmanagedType.LPWStr)] string name, int bold, int italic, int needExactMetrics) { - System.Diagnostics.Debug.WriteLine("Requesting system font: " + name); - var f = TryLoadCompatibleFont(name); - if (f != null) { - return LoadFontFromFile(ctx, null, f, 0, 0); - //unsafe { - // MuFontFlags* flags = (MuFontFlags*)GetFontFlags(p); - // var n = GetFontName(ctx, p); - // var f = p.MarshalAs(); - //} - } - //var p = LoadFontFromFile(ctx, name, @"C:\Windows\Fonts\simsun.ttc", 1, 1); - return IntPtr.Zero; - } - static IntPtr RequestSystemCjkFont(IntPtr ctx, string name, int registry, int serifDesired) { - System.Diagnostics.Debug.WriteLine("Requesting system CJK font: " + name); - var ff = TryLoadCompatibleFont(name); - // todo: load fallback font - return ff != null ? LoadFontFromFile(ctx, name, ff, 0, 1) : IntPtr.Zero; - } - - private static string TryLoadCompatibleFont(string name) { - var ff = Path.GetDirectoryName(Environment.GetFolderPath(Environment.SpecialFolder.System)) + "\\Fonts\\"; - ff = name.StartsWith("SimKai", StringComparison.OrdinalIgnoreCase) || name.StartsWith("楷体_GB2312", StringComparison.OrdinalIgnoreCase) || name.StartsWith("Kaiti_GB2312", StringComparison.OrdinalIgnoreCase) ? ff + "simkai.ttf" - : name.StartsWith("SimSun", StringComparison.OrdinalIgnoreCase) || name.StartsWith("宋体", StringComparison.OrdinalIgnoreCase) || name.StartsWith("STSong", StringComparison.OrdinalIgnoreCase) ? ff + "simsun.ttc" - : name.StartsWith("SimHei", StringComparison.OrdinalIgnoreCase) || name.StartsWith("黑体", StringComparison.OrdinalIgnoreCase) ? ff + "simhei.ttf" - : name.StartsWith("SimLi", StringComparison.OrdinalIgnoreCase) || name.StartsWith("隶书", StringComparison.OrdinalIgnoreCase) ? ff + "simli.ttf" - : name.StartsWith("SimFang", StringComparison.OrdinalIgnoreCase) || name.StartsWith("仿宋_GB2312", StringComparison.OrdinalIgnoreCase) || name.StartsWith("Fangsong_GB2312", StringComparison.OrdinalIgnoreCase) ? ff + "simfang.ttf" - : name.StartsWith("SimYou", StringComparison.OrdinalIgnoreCase) || name.StartsWith("幼圆", StringComparison.OrdinalIgnoreCase) ? ff + "simyou.ttf" - : null; - return ff; - } - - static IntPtr RequestSystemFallbackFont(IntPtr ctx, int script, int language, int serif, int bold, int italic) { - System.Diagnostics.Debug.WriteLine("Requesting fallback font: " + script); - return IntPtr.Zero; - } - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_font_ft_face")] - internal static extern IntPtr GetFontFace(ContextHandle ctx, IntPtr font); - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_font_flags")] - internal static extern MuFontFlags GetFontFlags(IntPtr font); - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_font_name")] - internal static unsafe extern sbyte* GetFontName(ContextHandle ctx, IntPtr font); - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_font_bbox")] - internal static extern BBox GetFontBBox(ContextHandle ctx, IntPtr font); - #endregion - - #region Stream and file - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_buffer_storage")] - internal static extern int BufferStorage(ContextHandle ctx, IntPtr buffer, ref IntPtr data); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_open_faxd")] - internal static extern IntPtr DecodeCcittFax(ContextHandle ctx, StreamHandle stmChain, int k, int endOfLine, int encodedByteAlign, int columns, int rows, int endOfBlock, int blackIs1); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_drop_buffer")] - internal static extern void DropBuffer(ContextHandle ctx, IntPtr buffer); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_tell")] - internal static extern int GetPosition(ContextHandle ctx, StreamHandle stm); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_keep_stream")] - internal static extern IntPtr Keep(ContextHandle ctx, StreamHandle stm); - - /// 打开文本流。 - /// MuPDF 上下文指针。 - /// 要打开的文件名。 - /// 指向 fz_stream 的指针 - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_open_file_w", CharSet = CharSet.Unicode)] - internal static extern IntPtr OpenFile(ContextHandle ctx, string fileName); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_open_memory")] - internal static extern IntPtr OpenMemory(ContextHandle ctx, byte[] data, int len); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_open_memory")] - internal static extern IntPtr OpenMemory(ContextHandle ctx, IntPtr data, int len); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_read")] - internal static extern int Read(ContextHandle ctx, StreamHandle stm, byte[] buffer, int len); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_read_all")] - internal static extern IntPtr ReadAll(ContextHandle ctx, StreamHandle stm, int initial); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_seek")] - internal static extern void Seek(ContextHandle ctx, StreamHandle stm, int offset, int whence); - #endregion - } -} diff --git a/pdfpatcher/App/Processor/Mupdf/NativeMethods.PdfObjects.cs b/pdfpatcher/App/Processor/Mupdf/NativeMethods.PdfObjects.cs deleted file mode 100644 index 98ed8f44252504f174a047731f9756f45f280bff..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Mupdf/NativeMethods.PdfObjects.cs +++ /dev/null @@ -1,221 +0,0 @@ -using System; -using System.IO; -using System.Runtime.InteropServices; -using CC = System.Runtime.InteropServices.CallingConvention; - -namespace MuPdfSharp -{ - partial class NativeMethods - { - #region Dictionary - /// Returns [0, len) for key found. Returns (-1-len, -1] for key not found, but with insertion point -1-i. - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_dict_finds")] - public static extern int FindIndex(ContextHandle ctx, IntPtr dict, [MarshalAs(UnmanagedType.LPStr)] string key); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_dict_len")] - public static extern int GetDictLength(ContextHandle context, IntPtr dict); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_dict_get_key")] - public static extern IntPtr GetKey(ContextHandle context, IntPtr dict, int index); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_dict_get_val")] - public static extern IntPtr GetValue(ContextHandle context, IntPtr dict, int index); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_dict_get")] - public static extern IntPtr Get(ContextHandle context, IntPtr dict, IntPtr key); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_dict_gets", BestFitMapping = false)] - public static extern IntPtr Get(ContextHandle context, IntPtr dict, [MarshalAs(UnmanagedType.LPStr)] string key); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_dict_getsa", BestFitMapping = false)] - public static extern IntPtr GetOrAbbrev(ContextHandle context, IntPtr dict, [MarshalAs(UnmanagedType.LPStr)] string key, [MarshalAs(UnmanagedType.LPStr)] string abbrev); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_dict_getp", BestFitMapping = false)] - public static extern IntPtr Locate(ContextHandle context, IntPtr dict, [MarshalAs(UnmanagedType.LPStr)] string path); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_dict_del")] - public static extern void Delete(ContextHandle context, IntPtr dict, IntPtr key); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_dict_dels", BestFitMapping = false)] - public static extern void Delete(ContextHandle context, IntPtr dict, [MarshalAs(UnmanagedType.LPStr)] string key); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_dict_put")] - public static extern void Put(ContextHandle context, IntPtr dict, IntPtr key, IntPtr value); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_dict_puts", BestFitMapping = false)] - public static extern void Put(ContextHandle context, IntPtr dict, [MarshalAs(UnmanagedType.LPStr)] string key, IntPtr value); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_dict_puts_drop", BestFitMapping = false)] - public static extern void PutAndDrop(ContextHandle context, IntPtr dict, [MarshalAs(UnmanagedType.LPStr)] string key, IntPtr value); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_dict_putp", BestFitMapping = false)] - public static extern void LocatePut(ContextHandle context, IntPtr dict, [MarshalAs(UnmanagedType.LPStr)] string path, IntPtr value); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_dict_putp_drop", BestFitMapping = false)] - public static extern void LocatePutAndDrop(ContextHandle context, IntPtr dict, [MarshalAs(UnmanagedType.LPStr)] string path, IntPtr value); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_dict_get_rect")] - public static extern Rectangle DictGetRect(ContextHandle context, IntPtr dict, IntPtr key); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_dict_get_matrix")] - public static extern Matrix DictGetMatrix(ContextHandle context, IntPtr dict, IntPtr key); - #endregion - - #region Array - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_array_len")] - public static extern int GetArrayLength(ContextHandle context, IntPtr pdfArray); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_array_get")] - public static extern IntPtr GetArrayItem(ContextHandle context, IntPtr pdfArray, int index); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_array_contains")] - public static extern int Contains(ContextHandle context, IntPtr pdfArray, IntPtr obj); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_array_put")] - public static extern void SetArrayItem(ContextHandle context, IntPtr pdfArray, int index, IntPtr obj); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_array_push")] - public static extern void Push(ContextHandle context, IntPtr pdfArray, IntPtr obj); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_array_push_drop")] - public static extern void PushAndDrop(ContextHandle context, IntPtr pdfArray, IntPtr obj); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_array_get_rect")] - public static extern Rectangle ArrayGetRect(ContextHandle context, IntPtr pdfArray, int index); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_array_get_matrix")] - public static extern Matrix ArrayGetMatrix(ContextHandle context, IntPtr pdfArray, int index); - #endregion - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_get_bound_document")] - public static extern IntPtr GetDocument(ContextHandle context, IntPtr obj); - - #region Object type - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_is_null")] - public static extern int IsNull(ContextHandle context, IntPtr obj); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_is_bool")] - public static extern int IsBoolean(ContextHandle context, IntPtr obj); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_is_int")] - public static extern int IsInteger(ContextHandle context, IntPtr obj); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_is_real")] - public static extern int IsFloat(ContextHandle context, IntPtr obj); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_is_number")] - public static extern int IsNumber(ContextHandle context, IntPtr obj); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_is_string")] - public static extern int IsString(ContextHandle context, IntPtr obj); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_is_name")] - public static extern int IsName(ContextHandle context, IntPtr obj); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_is_array")] - public static extern int IsArray(ContextHandle context, IntPtr obj); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_is_dict")] - public static extern int IsDictionary(ContextHandle context, IntPtr obj); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_is_indirect")] - public static extern int IsIndirectReference(ContextHandle context, IntPtr obj); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_is_stream")] - public static extern int IsStream(ContextHandle context, IntPtr document, int number, int generation); - #endregion - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_objcmp")] - public static extern int Compare(ContextHandle context, IntPtr obj, IntPtr obj2); - - #region Object conversion - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_to_bool")] - public static extern int ToBoolean(ContextHandle context, IntPtr obj); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_to_real")] - public static extern float ToSingle(ContextHandle context, IntPtr obj); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_to_int")] - public static extern int ToInteger(ContextHandle context, IntPtr obj); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_to_name")] - public static extern string ToName(ContextHandle context, IntPtr obj); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_to_str_buf")] - static extern IntPtr ToStringBytes(ContextHandle context, IntPtr obj); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_to_str_len")] - static extern int ToStringLength(ContextHandle context, IntPtr obj); - - public static string ToString(ContextHandle context, IntPtr obj) { - var b = ToStringBytes(context, obj); - var l = ToStringLength(context, obj); - var bytes = new byte[l]; - Marshal.Copy(b, bytes, 0, l); - if (bytes.Length >= 2 && (bytes[0] == 255 && bytes[1] == 254 || bytes[0] == 254 && bytes[1] == 255)) { - using (var ms = new MemoryStream(bytes)) { - using (var r = new StreamReader(ms, true)) { - return r.ReadToEnd(); - } - } - } - else { - var c = new char[l]; - for (int i = 0; i < l; i++) { - c[i] = (char)pdf_doc_encoding[bytes[i]]; - } - return new string(c); - } - } - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_to_num")] - static extern int ToIndirectNum(ContextHandle context, IntPtr obj); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_to_gen")] - static extern int ToIndirectGen(ContextHandle context, IntPtr obj); - - public static MuIndirectReference ToReference(ContextHandle context, IntPtr obj) { - return new MuIndirectReference(ToIndirectNum(context, obj), ToIndirectGen(context, obj)); - } - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_resolve_indirect")] - public static extern IntPtr ResolveIndirect(ContextHandle context, IntPtr obj); - - static readonly ushort[] pdf_doc_encoding = { - /* 0x0 to 0x17 except \t, \n and \r are really undefined */ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x02d8, 0x02c7, 0x02c6, 0x02d9, 0x02dd, 0x02db, 0x02da, 0x02dc, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x0000, - 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x0192, 0x2044, - 0x2039, 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018, - 0x2019, 0x201a, 0x2122, 0xfb01, 0xfb02, 0x0141, 0x0152, 0x0160, - 0x0178, 0x017d, 0x0131, 0x0142, 0x0153, 0x0161, 0x017e, 0x0000, - 0x20ac, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, - 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x0000, 0x00ae, 0x00af, - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, - 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, - 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, - 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, - 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, - 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, - 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, - 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, - 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, - 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff - }; - #endregion - } -} diff --git a/pdfpatcher/App/Processor/Mupdf/NativeMethods.cs b/pdfpatcher/App/Processor/Mupdf/NativeMethods.cs deleted file mode 100644 index becbc7ecf5d84035d9c53d002f646084c10357fa..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Mupdf/NativeMethods.cs +++ /dev/null @@ -1,216 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Security; -using CC = System.Runtime.InteropServices.CallingConvention; - -namespace MuPdfSharp -{ - [SuppressUnmanagedCodeSecurity] - static partial class NativeMethods - { - const string DLL = "mupdflib.dll"; - const string FZ_VERSION = "1.21.1"; - - const uint FZ_STORE_DEFAULT = 256 << 20; - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_new_context_imp", BestFitMapping = false)] - static extern ContextHandle NewContext(IntPtr alloc, IntPtr locks, uint max_store, [MarshalAs(UnmanagedType.LPStr)] string fz_version); - - internal static ContextHandle NewContext() { - var c = NewContext(IntPtr.Zero, IntPtr.Zero, FZ_STORE_DEFAULT, FZ_VERSION); - if (c.IsInvalid) { - throw new MuPdfException("MuPDF 引擎版本不匹配。"); - } - return c; - } - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_drop_context")] - internal static extern void DropContext(IntPtr ctx); - - #region Colorspace - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_device_gray")] - internal static extern IntPtr GetGrayColorSpace(ContextHandle ctx); - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_device_rgb")] - internal static extern IntPtr GetRgbColorSpace(ContextHandle ctx); - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_device_bgr")] - internal static extern IntPtr GetBgrColorSpace(ContextHandle ctx); - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_device_cmyk")] - internal static extern IntPtr GetCmykColorSpace(ContextHandle ctx); - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_device_lab")] - internal static extern IntPtr GetLabColorSpace(ContextHandle ctx); - #endregion - - #region Document and file stream - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_open_document_with_stream")] - internal static extern IntPtr OpenPdfDocumentStream(ContextHandle ctx, StreamHandle stm); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_drop_document")] - internal static extern void DropDocument(ContextHandle context, IntPtr doc); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_drop_stream")] - internal static extern IntPtr DropStream(ContextHandle context, IntPtr stm); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_load_jpx")] - internal static extern IntPtr LoadJpeg2000(ContextHandle ctx, byte[] data, int size, IntPtr colorspace); - #endregion - - #region Device - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_new_bbox_device")] - internal static extern IntPtr NewBBoxDevice(ContextHandle ctx, ref Rectangle bbox); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_new_draw_device")] - internal static extern IntPtr NewDrawDevice(ContextHandle ctx, Matrix matrix, PixmapHandle pix); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_new_draw_device_with_bbox")] - internal static extern IntPtr NewDrawDevice(ContextHandle ctx, Matrix matrix, PixmapHandle pix, ref BBox bbox); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_new_gdiplus_device")] - internal static extern IntPtr NewGdiPlusDevice(ContextHandle ctx, IntPtr dc, BBox base_clip); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_new_list_device")] - internal static extern IntPtr NewListDevice(ContextHandle ctx, DisplayListHandle list); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_new_stext_device")] - internal static extern IntPtr NewTextDevice(ContextHandle ctx, TextPageHandle page, TextOptions options); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_close_device")] - internal static extern void CloseDevice(ContextHandle context, IntPtr dev); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_drop_device")] - internal static extern void DropDevice(ContextHandle context, IntPtr dev); - #endregion - - #region Page - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_load_page")] - internal static extern IntPtr LoadPage(ContextHandle context, DocumentHandle doc, int pageNumber); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_drop_page")] - internal static extern void DropPage(ContextHandle context, IntPtr page); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_bound_page")] - public static extern Rectangle BoundPage(ContextHandle context, PageHandle page); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_flatten_inheritable_page_items")] - public static extern void FlattenInheritablePageItems(ContextHandle doc, IntPtr pageNode); - #endregion - - #region Pixmap and display list - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_new_pixmap")] - internal static extern IntPtr NewPixmap(ContextHandle ctx, IntPtr colorspace, int width, int height, IntPtr separations, int alpha); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_new_pixmap_with_bbox")] - internal static extern IntPtr NewPixmap(ContextHandle ctx, IntPtr colorspace, BBox bbox, IntPtr separations, int alpha); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_drop_pixmap")] - internal static extern void DropPixmap(ContextHandle ctx, IntPtr pix); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_gamma_pixmap")] - public static extern void GammaPixmap(ContextHandle ctx, PixmapHandle pix, float gamma); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_invert_pixmap")] - public static extern void InvertPixmap(ContextHandle ctx, PixmapHandle pix); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_invert_pixmap_rect")] - public static extern void InvertPixmap(ContextHandle ctx, PixmapHandle pix, BBox rect); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_tint_pixmap")] - public static extern void TintPixmap(ContextHandle ctx, PixmapHandle pix, int black, int white); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_pixmap_bbox")] - public static extern BBox GetBBox(ContextHandle ctx, PixmapHandle pix); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_pixmap_colorspace")] - public static extern IntPtr GetColorSpace(ContextHandle ctx, PixmapHandle pix); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_pixmap_colorants")] - public static extern int GetColorants(ContextHandle ctx, PixmapHandle pix); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_pixmap_spots")] - public static extern int GetSpots(ContextHandle ctx, PixmapHandle pix); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_pixmap_components")] - public static extern int GetComponents(ContextHandle ctx, PixmapHandle pix); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_pixmap_height")] - public static extern int GetHeight(ContextHandle ctx, PixmapHandle pix); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_pixmap_width")] - public static extern int GetWidth(ContextHandle ctx, PixmapHandle pix); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_pixmap_x")] - public static extern int GetPixmapX(ContextHandle ctx, PixmapHandle pix); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_pixmap_y")] - public static extern int GetPixmapY(ContextHandle ctx, PixmapHandle pix); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_pixmap_samples")] - public static extern IntPtr GetSamples(ContextHandle ctx, PixmapHandle pix); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_pixmap_stride")] - public static extern int GetStride(ContextHandle ctx, PixmapHandle pix); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_drop_display_list")] - internal static extern void DropDisplayList(ContextHandle ctx, IntPtr list); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_new_display_list")] - internal static extern IntPtr NewDisplayList(ContextHandle ctx, Rectangle mediaBox); - #endregion - - #region Text page - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_new_stext_page")] - internal static extern IntPtr NewTextPage(ContextHandle ctx, Rectangle mediaBox); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_drop_stext_page")] - internal static extern void DropTextPage(ContextHandle ctx, IntPtr page); - #endregion - - #region 图像渲染函数 - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_clear_pixmap_with_value")] - public static extern void ClearPixmap(ContextHandle ctx, PixmapHandle pix, int byteValue); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_disable_device_hints")] - public static extern void DisableDeviceHints(ContextHandle ctx, DeviceHandle dev, DeviceHints hints); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_enable_device_hints")] - public static extern void EnableDeviceHints(ContextHandle ctx, DeviceHandle dev, DeviceHints hints); - - #endregion - - #region 文本函数 - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_new_stext_page")] - public static extern TextPageHandle GetTextPage(ContextHandle ctx, Rectangle mediaBox); - - //[DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_highlight_selection")] - //public static extern int HighlightSelection (ContextHandle ctx, IntPtr page, Rectangle rect, Rectangle hitBBox, fz_quad* quads, int maxHit); - - //[DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_copy_selection")] - //public static extern IntPtr CopySelection (ContextHandle ctx, IntPtr page, Rectangle rect); - #endregion - - #region Render page content and annotation - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_run_page")] - public static extern void RunPage(ContextHandle context, PageHandle page, DeviceHandle dev, Matrix transform, ref MuCookie cookie); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_run_page_contents")] - public static extern void RunPageContents(ContextHandle context, PageHandle page, DeviceHandle dev, Matrix transform, ref MuCookie cookie); - - /// - /// (Re)-run a display list through a device. - /// - /// - /// A display list, created by fz_new_display_list and populated with objects from a page by running fz_run_page on a device obtained from fz_new_list_device. - /// The target device to render the display list. - /// Transform to apply to display list contents. May include for example scaling and rotation, see fz_scale, fz_rotate and fz_concat.Set to fz_identity if no transformation is desired. - /// Only the part of the contents of the display list visible within this area will be considered when the list is run through the device.This does not imply for tile objects contained in the display list. - /// Communication mechanism between caller and library running the page.Intended for multi-threaded applications, while single-threaded applications set cookie to NULL.The caller may abort an ongoing page run.Cookie also communicates progress information back to the caller.The fields inside cookie are continually updated while the page is being run. - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "fz_run_display_list")] - public static extern void RunDisplayList(ContextHandle context, DisplayListHandle list, DeviceHandle dev, Matrix ctm, Rectangle scissor, ref MuCookie cookie); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_run_page_annots")] - public static extern void RunPageAnnotations(ContextHandle context, PageHandle page, DeviceHandle dev, Matrix transform, ref MuCookie cookie); - - [DllImport(DLL, CallingConvention = CC.Cdecl, EntryPoint = "pdf_run_page_widgets")] - public static extern void RunPageWidgets(ContextHandle context, PageHandle page, DeviceHandle dev, Matrix transform, ref MuCookie cookie); - #endregion - } -} diff --git a/pdfpatcher/App/Processor/Mupdf/PageLabelCollection.cs b/pdfpatcher/App/Processor/Mupdf/PageLabelCollection.cs deleted file mode 100644 index 24b523a5572c8c280eade3fbd275b1c90d480b0f..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Mupdf/PageLabelCollection.cs +++ /dev/null @@ -1,118 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; - -namespace MuPdfSharp -{ - public sealed class PageLabelCollection : ICollection - { - readonly List _labels = new List(); - - public PageLabel this[int index] => _labels[index]; - - internal PageLabelCollection(MuDocument document) { - var pl = new List(); - var l = document.Trailer.Locate("Root/PageLabels/Nums").AsArray(); - if (l.Kind == MuPdfObjectKind.PDF_ARRAY) { - for (int i = 0; i < l.Count; i++) { - var n = l[i].IntegerValue; - var d = l[++i].AsDictionary(); - var sp = d["St"].IntegerValue; - var p = d["P"].StringValue; - var s = d["S"].NameValue; - pl.Add(new PageLabel(n, sp, p, s.Length == 0 ? PageLabelStyle.Default : (PageLabelStyle)(byte)s[0])); - } - pl.Sort(); - } - _labels = pl; - } - - /// - /// 添加页码标签。如集合中存在相同页码的页码标签,则先将旧的标签删除,再添加新的页码标签。 - /// - /// 需要添加的页码标签。 - public void Add(PageLabel label) { - Remove(label); - _labels.Add(label); - _labels.Sort(); - } - - /// - /// 根据传入的页码,返回当前页码标签集合格式化后生成的页码。 - /// - /// 绝对页码。 - /// 格式化后的页码文本。 - public string Format(int pageNumber) { - var l = _labels.Count; - if (l == 0) { - return String.Empty; - } - for (int i = l - 1; i >= 0; i--) { - var p = _labels[i]; - if (pageNumber > p.FromPageNumber) { - return p.Format(pageNumber); - } - } - return String.Empty; - } - - public PageLabel Find(int pageNumber) { - --pageNumber; - for (int i = _labels.Count - 1; i >= 0; i--) { - if (_labels[i].FromPageNumber == pageNumber) { - return _labels[i]; - } - } - return PageLabel.Empty; - } - - public void Clear() { - _labels.Clear(); - } - - /// - /// 返回集合中是否包含具有与 相同起始页码的页码标签。 - /// - /// 需要检查起始页码的页码标签。 - /// 如包含相同页码的页码标签,返回 true,否则返回 false。 - public bool Contains(PageLabel item) { - for (int i = _labels.Count - 1; i >= 0; i--) { - if (_labels[i].FromPageNumber == item.FromPageNumber) { - return true; - } - } - return false; - } - - public void CopyTo(PageLabel[] array, int arrayIndex) { - _labels.CopyTo(array, arrayIndex); - } - - public int Count => _labels.Count; - - public bool IsReadOnly => false; - - /// - /// 删除集合中具有与 相同起始页码的页码标签。 - /// - /// 需要删除的页码标签。 - /// 如包含相同页码的页码标签,返回 true,否则返回 false。 - public bool Remove(PageLabel item) { - for (int i = _labels.Count - 1; i >= 0; i--) { - if (_labels[i].FromPageNumber == item.FromPageNumber) { - _labels.RemoveAt(i); - return true; - } - } - return false; - } - - public IEnumerator GetEnumerator() { - return _labels.GetEnumerator(); - } - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { - return _labels.GetEnumerator(); - } - } -} diff --git a/pdfpatcher/App/Processor/Mupdf/PixmapData.cs b/pdfpatcher/App/Processor/Mupdf/PixmapData.cs deleted file mode 100644 index a1f9e75b0607742e4d099600a421cc45e8e9d6b1..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Mupdf/PixmapData.cs +++ /dev/null @@ -1,225 +0,0 @@ -using System; -using System.Drawing; -using System.Drawing.Imaging; -using FreeImageAPI; -using CC = System.Runtime.InteropServices.CallingConvention; -using DllImport = System.Runtime.InteropServices.DllImportAttribute; - -namespace MuPdfSharp -{ - internal sealed class PixmapData : IDisposable - { - readonly ContextHandle _context; - readonly PixmapHandle _pixmap; - public PixmapData(ContextHandle context, PixmapHandle pixmap) { - Width = NativeMethods.GetWidth(context, pixmap); - Height = NativeMethods.GetHeight(context, pixmap); - Components = NativeMethods.GetComponents(context, pixmap); - Samples = NativeMethods.GetSamples(context, pixmap); - _context = context; - _pixmap = pixmap; - } - public int Width { get; private set; } - public int Height { get; private set; } - public int Components { get; private set; } - /// 获取指向 Pixmap 数据内容的指针。 - public IntPtr Samples { get; private set; } - /// 获取 Pixmap 的边框。 - public BBox BBox => NativeMethods.GetBBox(_context, _pixmap); - /// number of colorants (components, less any spots and alpha)。 - public int Colorants => NativeMethods.GetColorants(_context, _pixmap); - /// number of spots (components, less colorants and alpha). Does not throw exceptions.。 - public int Spots => NativeMethods.GetColorants(_context, _pixmap); - /// 获取 Pixmap 一行像素的字节数。 - public int Stride => NativeMethods.GetStride(_context, _pixmap); - - /// - /// 将 Pixmap 的数据转换为 。 - /// - public unsafe Bitmap ToBitmap(ImageRendererOptions options) { - int width = Width; - int height = Height; - bool grayscale = options.ColorSpace == ColorSpace.Gray; - bool invert = options.InvertColor; - var bmp = new Bitmap(width, height, grayscale ? PixelFormat.Format8bppIndexed : PixelFormat.Format24bppRgb); - var imageData = bmp.LockBits(new System.Drawing.Rectangle(0, 0, width, height), ImageLockMode.ReadWrite, bmp.PixelFormat); - var ptrSrc = (byte*)Samples; - var ptrDest = (byte*)imageData.Scan0; - if (grayscale) { - var palette = bmp.Palette; - for (int i = 0; i < 256; ++i) - palette.Entries[i] = Color.FromArgb(i, i, i); - bmp.Palette = palette; - for (int y = 0; y < height; y++) { - var pl = ptrDest; - var sl = ptrSrc; - for (int x = 0; x < width; x++) { - *pl = invert ? (byte)(*sl ^ 0xFF) : *sl; - pl++; - sl++; - } - ptrDest += imageData.Stride; - ptrSrc = sl; - } - } - else { // DeviceBGR - for (int y = 0; y < height; y++) { - var pl = ptrDest; - var sl = ptrSrc; - if (invert) { - for (int x = 0; x < width; x++) { - // 在这里进行 RGB 到 DIB BGR 的转换(省去 Mupdf 内部的转换工作) - pl[2] = (byte)(*sl ^ 0xFF); sl++; // R - pl[1] = (byte)(*sl ^ 0xFF); sl++; // G - pl[0] = (byte)(*sl ^ 0xFF); sl++; // B - pl += 3; - } - } - else { - for (int x = 0; x < width; x++) { - // 在这里进行 RGB 到 DIB BGR 的转换(省去 Mupdf 内部的转换工作) - pl[2] = *sl; sl++; // R - pl[1] = *sl; sl++; // G - pl[0] = *sl; sl++; // B - pl += 3; - } - } - ptrDest += imageData.Stride; - ptrSrc = sl; - } - } - bmp.UnlockBits(imageData); - if (options.Dpi > 0) { - bmp.SetResolution(options.Dpi, options.Dpi); - } - return bmp; - } - - /// - /// 将 Pixmap 的数据转换为 。 - /// - public unsafe FreeImageBitmap ToFreeImageBitmap(ImageRendererOptions options) { - int width = Width; - int height = Height; - bool grayscale = options.ColorSpace == ColorSpace.Gray; - bool invert = options.InvertColor; - var bmp = new FreeImageBitmap(width, height, grayscale ? PixelFormat.Format8bppIndexed : PixelFormat.Format24bppRgb); - var ptrSrc = (byte*)Samples; - if (grayscale) { - bmp.Palette.CreateGrayscalePalette(); - for (int y = height - 1; y >= 0; y--) { - var pDest = bmp.GetScanlinePointer(y); - var pl = (byte*)pDest.ToPointer(); - var sl = ptrSrc; - for (int x = 0; x < width; x++) { - *pl = invert ? (byte)(*sl ^ 0xFF) : *sl; - pl++; - sl++; - } - ptrSrc = sl; - } - } - else { // DeviceBGR - for (int y = height - 1; y >= 0; y--) { - var pDest = bmp.GetScanlinePointer(y); - var pl = (byte*)pDest.ToPointer(); - var sl = ptrSrc; - if (invert) { - for (int x = 0; x < width; x++) { - // 在这里进行 RGB 到 DIB BGR 的转换(省去 Mupdf 内部的转换工作) - pl[2] = (byte)(*sl ^ 0xFF); sl++; // R - pl[1] = (byte)(*sl ^ 0xFF); sl++; // G - pl[0] = (byte)(*sl ^ 0xFF); sl++; // B - pl += 3; - } - } - else { - for (int x = 0; x < width; x++) { - // 在这里进行 RGB 到 DIB BGR 的转换(省去 Mupdf 内部的转换工作) - pl[2] = *sl; sl++; // R - pl[1] = *sl; sl++; // G - pl[0] = *sl; sl++; // B - pl += 3; - } - } - ptrSrc = sl; - } - } - bmp.SetResolution(options.Dpi, options.Dpi); - return bmp; - } - - /// - /// 反转 Pixmap 的颜色。 - /// - public void Invert() { - NativeMethods.InvertPixmap(_context, _pixmap); - } - - /// - /// 为 Pixmap 蒙上色层。 - /// - /// 需要蒙上的颜色。 - public void Tint(Color color) { - NativeMethods.TintPixmap(_context, _pixmap, 0, color.ToArgb()); - } - - /// - /// 对 Pixmap 执行 Gamma 校正。 - /// - /// 需要应用的 Gamma 值。1.0 表示不更改。 - public void Gamma(float gamma) { - if (gamma == 1) { - return; - } - NativeMethods.GammaPixmap(_context, _pixmap, gamma); - } - - /// - /// 获取 Pixmap 内的数据。 - /// - /// 字节数组。 - public byte[] GetSampleBytes() { - if (Samples == IntPtr.Zero) { - return null; - } - var d = new byte[Width * Height * Components]; - System.Runtime.InteropServices.Marshal.Copy(Samples, d, 0, d.Length); - return d; - } - - #region 实现 IDisposable 接口的属性和方法 - private bool disposed = false; - public void Dispose() { - Dispose(true); - GC.SuppressFinalize(this); // 抑制析构函数 - } - - /// 释放由 MuPdfPage 占用的资源。 - /// 是否手动释放托管资源。 - void Dispose(bool disposing) { - if (!disposed) { - if (disposing) { - #region 释放托管资源 - //_components.Dispose (); - #endregion - } - - #region 释放非托管资源 - // 注意这里不是线程安全的 - _pixmap.DisposeHandle(); - #endregion - } - disposed = true; - } - - // 析构函数只在未调用 Dispose 方法时调用 - // 派生类中不必再提供析构函数 - ~PixmapData() { - Dispose(false); - } - #endregion - } - - -} diff --git a/pdfpatcher/App/Processor/Mupdf/RenderResultCache.cs b/pdfpatcher/App/Processor/Mupdf/RenderResultCache.cs deleted file mode 100644 index 095e5a1bd26a87b72bf0e63f875e6d171bd2d660..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Mupdf/RenderResultCache.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using PDFPatcher.Common; - -namespace MuPdfSharp -{ - public sealed class RenderResultCache : IDisposable - { - const int __bufferSize = 10; - readonly MuDocument _document; - Dictionary _buffer = new Dictionary(__bufferSize); - readonly object _SyncObj = new object(); - public object SyncObj => _SyncObj; - - public RenderResultCache(MuDocument document) { - _document = document; - } - - public MuPage LoadPage(int pageNumber) { - if (_buffer.ContainsKey(pageNumber)) { - return _buffer[pageNumber].Page; - } - var p = _document.LoadPage(pageNumber); - _buffer.Add(pageNumber, new RenderResult(p)); - return p; - } - - public Bitmap GetBitmap(int pageNumber) { - if (_buffer == null || _document.IsDisposed) { - return null; - } - RenderResult result; - _buffer.TryGetValue(pageNumber, out result); - return result?.Image; - } - - public void AddBitmap(int pageNumber, Bitmap bmp) { - if (_buffer.ContainsKey(pageNumber)) { - var i = _buffer[pageNumber]; - i.Image?.Dispose(); - } - _buffer[pageNumber].Image = bmp; - TrimBitmapBuffer(pageNumber); - } - - private void TrimBitmapBuffer(int pageNumber) { - if (__bufferSize >= _buffer.Count) { - return; - } - - int x = 0; - int i = 0; - foreach (var item in _buffer.Keys) { - if (Math.Abs(item - pageNumber) > x) { - x = Math.Abs(item - pageNumber); - i = item; - } - } - _buffer[i].Dispose(); - _buffer.Remove(i); - //Tracker.DebugMessage ("removed buffered result " + i); - } - - public void Clear() { - if (_buffer.HasContent() == false) { - return; - } - foreach (var item in _buffer) { - //Tracker.DebugMessage ("Disposing page " + item.Key + " result."); - item.Value.Dispose(); - } - _buffer.Clear(); - } - - public void Dispose() { - Clear(); - _buffer = null; - } - - sealed class RenderResult : IDisposable - { - public MuPage Page { get; private set; } - public Bitmap Image { get; internal set; } - - public RenderResult(MuPage page) { - Page = page; - } - - public void Dispose() { - Page?.Dispose(); - Image?.Dispose(); - } - } - } - -} diff --git a/pdfpatcher/App/Processor/Mupdf/Structures.cs b/pdfpatcher/App/Processor/Mupdf/Structures.cs deleted file mode 100644 index b71145eb2cc4e96a71e933b6e3cd95fe976fc71d..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Mupdf/Structures.cs +++ /dev/null @@ -1,640 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using PDFPatcher.Common; - -namespace MuPdfSharp -{ - public interface IMuBoundedElement - { - Rectangle BBox { get; } - } - - [DebuggerDisplay("(Abort: {_Abort}, Progress: {_Progress}/{_ProgressMax}, Errors: {_Errors}, Incomplete: {_Incomplete})")] - public struct MuCookie - { - int _Abort; - readonly int _Progress; - readonly int _ProgressMax; - readonly int _Errors; - readonly int _IncompleteOk; - readonly int _Incomplete; - - public bool IsCancellationPending => _Abort != 0; - public bool IsRunning => _ProgressMax == -1 || _Progress > 0 && _Progress < _ProgressMax - 1; - public int ErrorCount => _Errors; - - public void CancelAsync() { _Abort = 1; } - } - - /// - /// MuPDF 引擎的工作方式。 - /// - [Flags] - public enum DeviceHints - { - None = 0, - IgnoreImage = 1, - IgnoreShade = 2, - DontInterperateImages = 4, - MaintainContainerStack = 8, - NoCache = 16 - } - - /// - /// 渲染页面的颜色空间。 - /// - public enum ColorSpace - { - Rgb, - Bgr, - Cmyk, - Gray - } - - /// - /// 保存渲染页面的文件格式。 - /// - public enum ImageFormat - { - Png, - Jpeg, - Tiff - } - - [DebuggerDisplay("From: {FromPageNumber}, Format: {Format (1)}")] - public readonly struct PageLabel : IComparable - { - public readonly string Prefix; - public readonly PageLabelStyle NumericStyle; - public readonly int StartAt; - public readonly int FromPageNumber; - public static PageLabel Empty = new PageLabel(-1, -1, null, PageLabelStyle.Default); - public bool IsEmpty => FromPageNumber < 0; - - public PageLabel(int pageNumber, int startAt, string prefix, PageLabelStyle numericStyle) { - FromPageNumber = pageNumber; - StartAt = startAt; - Prefix = prefix; - NumericStyle = numericStyle; - } - - int IComparable.CompareTo(PageLabel other) { - return FromPageNumber.CompareTo(other.FromPageNumber); - } - - public string Format(int pageNumber) { - var n = pageNumber - FromPageNumber + (StartAt < 1 ? 0 : StartAt - 1); - switch (NumericStyle) { - case PageLabelStyle.Default: - return Prefix; - case PageLabelStyle.Digit: - return String.Concat(Prefix, n.ToText()); - case PageLabelStyle.UpperRoman: - return String.Concat(Prefix, n.ToRoman()); - case PageLabelStyle.LowerRoman: - return String.Concat(Prefix, n.ToRoman()).ToLowerInvariant(); - case PageLabelStyle.UpperAlphabetic: - return String.Concat(Prefix, n.ToAlphabet(true)); - case PageLabelStyle.LowerAlphabetic: - return String.Concat(Prefix, n.ToAlphabet(false)); - default: - goto case PageLabelStyle.Digit; - } - } - } - - public enum PageLabelStyle : byte - { - Default = (byte)'-', - Digit = (byte)'d', - UpperRoman = (byte)'R', - LowerRoman = (byte)'r', - UpperAlphabetic = (byte)'A', - LowerAlphabetic = (byte)'a' - } - - /// - /// 表示点。 - /// - [DebuggerDisplay("({X},{Y})")] - public readonly struct Point : IEquatable - { - public readonly float X, Y; - public override string ToString() { - return String.Concat("(", X, ",", Y, ")"); - } - public Point(float x, float y) { - X = x; Y = y; - } - /// - /// 将 PDF 页面坐标点转换为渲染页面坐标点。 - /// - /// 页面的可视区域。 - /// 转换为页面坐标的点。 - public Point ToPageCoordinate(Rectangle pageVisualBound) { - return new Point((X - pageVisualBound.Left), pageVisualBound.Height - (Y - pageVisualBound.Top)); - } - public static explicit operator System.Drawing.Point(Point point) { - return new System.Drawing.Point(point.X.ToInt32(), point.Y.ToInt32()); - } - public static implicit operator System.Drawing.PointF(Point point) { - return new System.Drawing.PointF(point.X, point.Y); - } - public static implicit operator Point(System.Drawing.Point point) { - return new Point(point.X, point.Y); - } - public static implicit operator Point(System.Drawing.PointF point) { - return new Point(point.X, point.Y); - } - - public override bool Equals(object obj) { - return obj is Point && this == (Point)obj; - } - - public override int GetHashCode() { - return X.GetHashCode() ^ Y.GetHashCode(); - } - - public bool Equals(Point other) { - return this == other; - } - - public static bool operator ==(Point left, Point right) { - return left.X == right.X && left.Y == right.Y; - } - - public static bool operator !=(Point left, Point right) { - return !(left == right); - } - } - - /// - /// 表示边框(坐标值为整数的矩形)。 - /// 在 MuPDF 中,BBox 的 值应大于 值。 - /// - [DebuggerDisplay("({Left},{Top})-({Right},{Bottom})")] - public readonly struct BBox : IEquatable - { - public readonly int Left, Top, Right, Bottom; - public BBox(int left, int top, int right, int bottom) { - Left = left; - Top = top; - Right = right; - Bottom = bottom; - } - public System.Drawing.Size Size => new System.Drawing.Size(Width, Height); - public bool IsEmpty => Left == Right || Top == Bottom; - public bool IsInfinite => Left > Right || Top > Bottom; - public int Width => Right - Left; - public int Height => Bottom - Top; - - public bool Contains(Point point) { - return (Right >= point.X && Left <= point.X && Top <= point.Y && Bottom >= point.Y); - } - - public static implicit operator System.Drawing.Rectangle(BBox rect) { - return new System.Drawing.Rectangle( - rect.Left, - rect.Top < rect.Bottom ? rect.Top : rect.Bottom, - rect.Width, - rect.Height); - } - - public override bool Equals(object obj) { - return obj is BBox && this == (BBox)obj; - } - - public bool Equals(BBox other) { - return Left == other.Left && - Top == other.Top && - Right == other.Right && - Bottom == other.Bottom; - } - - public override int GetHashCode() { - var hashCode = -1819631549; - hashCode = hashCode * -1521134295 + Left; - hashCode = hashCode * -1521134295 + Top; - hashCode = hashCode * -1521134295 + Right; - hashCode = hashCode * -1521134295 + Bottom; - return hashCode; - } - - public static bool operator ==(BBox left, BBox right) { - return left.Equals(right); - } - - public static bool operator !=(BBox left, BBox right) { - return !(left == right); - } - } - - /// - /// 表示使用浮点数为坐标的矩形。 - /// - [DebuggerDisplay("({Left},{Top})-({Right},{Bottom})")] - public readonly struct Rectangle : IEquatable - { - public readonly float Left, Top, Right, Bottom; - public static readonly Rectangle Infinite = new Rectangle(1, 1, -1, -1); - public static readonly Rectangle Empty = new Rectangle(0, 0, 0, 0); - public static readonly Rectangle Unit = new Rectangle(0, 0, 1, 1); - - public Rectangle(float left, float top, float right, float bottom) { - Left = left; - Top = top; - Right = right; - Bottom = bottom; - } - - private static int SafeInt(double f) { - return (f > int.MaxValue) ? int.MaxValue : ((f < int.MinValue) ? int.MinValue : (int)f); - } - public System.Drawing.SizeF Size => new System.Drawing.SizeF(Width, Height); - public bool IsEmpty => Left == Right || Top == Bottom; - public bool IsInfinite => Left > Right || Top > Bottom; - public float Width => Right - Left; - public float Height => Bottom - Top; - public BBox Round => new BBox( - SafeInt(Math.Floor(Left + 0.001)), - SafeInt(Math.Floor(Top + 0.001)), - SafeInt(Math.Ceiling(Right - 0.001)), - SafeInt(Math.Ceiling(Bottom - 0.001)) - ); - public override string ToString() { - return string.Concat("(", Left, ",", Top, ")-(", Right, ",", Bottom, ")"); - } - - /// - /// 返回当前矩形区域是否包含另一个点。 - /// - /// 另一个点。 - /// 包含点时返回 true。 - public bool Contains(Point point) { - return Right >= point.X && Left <= point.X && Top <= point.Y && Bottom >= point.Y; - } - public bool Contains(float pointX, float pointY) { - return Right >= pointX && Left <= pointX && Top <= pointY && Bottom >= pointY; - } - /// 返回当前矩形区域是否与另一个矩形区域存在交集。 - /// 另一个矩形区域。 - /// 包含矩形区域时返回 true。 - public bool Contains(Rectangle other) { - if (IsEmpty || other.IsInfinite) { - return false; - } - else if (IsInfinite || other.IsEmpty) { - return true; - } - return Contains(other.Left, other.Top) && Contains(other.Right, other.Bottom); - } - /// 返回当前矩形区域与另一个矩形区域的交集。 - /// 另一个矩形区域。 - /// 返回两个矩形区域的交集。 - public Rectangle Intersect(Rectangle other) { - if (IsEmpty || other.IsEmpty) { - return Rectangle.Empty; - } - if (other.IsInfinite) { - return this; - } - if (IsInfinite) { - return other; - } - float x0, y0, x1, y1; - x0 = Left < other.Left ? other.Left : Left; - y0 = Top < other.Top ? other.Top : Top; - x1 = Right > other.Right ? other.Right : Right; - y1 = Bottom > other.Bottom ? other.Bottom : Bottom; - if (x1 < x0 || y1 < y0) { - return Rectangle.Empty; - } - return new Rectangle(x0, y0, x1, y1); - } - /// 返回将当前矩形区域乘以指定比例的区域。 - /// 比例乘数。 - /// 拉伸后的矩形区域。 - public Rectangle Multiply(float multiplier) { - return new Rectangle(Left * multiplier, Top * multiplier, Right * multiplier, Bottom * multiplier); - } - - /// 返回包含两个矩形区域的新矩形区域。 - /// 另一个矩形区域。 - /// 包含两个矩形区域的新矩形区域。 - public Rectangle Union(Rectangle other) { - if (IsEmpty || other.IsInfinite) { - return other; - } - if (other.IsEmpty || IsInfinite) { - return this; - } - return new Rectangle( - Left > other.Left ? other.Left : Left, - Top > other.Top ? other.Top : Top, - Right < other.Right ? other.Right : Right, - Bottom < other.Bottom ? other.Bottom : Bottom - ); - } - - public bool IsHorizontalNeighbor(Rectangle other) { - if (IsEmpty || other.IsInfinite || other.IsEmpty || IsInfinite || other.Top > Bottom || other.Bottom < Top) { - return false; - } - - var h = Height / other.Height; - return h > 0.4 && h < 2.5; - } - - internal static Rectangle FromArray(MuPdfObject array) { - var r = array.AsArray(); - var a = r[0].FloatValue; - var b = r[1].FloatValue; - var c = r[2].FloatValue; - var d = r[3].FloatValue; - return new Rectangle(Math.Min(a, c), Math.Min(b, d), Math.Max(a, c), Math.Max(b, d)); - } - - public static implicit operator System.Drawing.RectangleF(Rectangle rect) { - return new System.Drawing.RectangleF( - rect.Left, - rect.Top < rect.Bottom ? rect.Top : rect.Bottom, - rect.Width, - rect.Height); - } - public static implicit operator System.Drawing.Rectangle(Rectangle rect) { - return new System.Drawing.Rectangle( - rect.Left.ToInt32(), - (rect.Top < rect.Bottom ? rect.Top : rect.Bottom).ToInt32(), - rect.Width.ToInt32(), - rect.Height.ToInt32()); - } - public static Rectangle operator &(Rectangle r1, Rectangle r2) { - return r1.Intersect(r2); - } - public static Rectangle operator |(Rectangle r1, Rectangle r2) { - return r1.Union(r2); - } - /// 返回两个矩形重叠区域与两矩形最小包容区域的占比。 - public static float operator /(Rectangle r1, Rectangle r2) { - var i = r1.Intersect(r2); - if (i.IsEmpty) { - return 0f; - } - var u = r1.Union(r1); - return (i.Height * i.Width) / (u.Height * u.Width); - } - - internal Rectangle ToPageCoordinate(Rectangle pageVisualBound) { - return new Rectangle( - Left - pageVisualBound.Left, - pageVisualBound.Height - (Top - pageVisualBound.Top), - Right - pageVisualBound.Left, - pageVisualBound.Height - (Bottom - pageVisualBound.Top) - ); - } - - public override bool Equals(object obj) { - return obj is Rectangle && Equals((Rectangle)obj); - } - - public override int GetHashCode() { - return Left.GetHashCode() - ^ (Right.GetHashCode() << 13 | Right.GetHashCode() >> 19) - ^ (Top.GetHashCode() << 26 | Top.GetHashCode() >> 6) - ^ (Bottom.GetHashCode() << 7 | Bottom.GetHashCode() >> 25); - } - - public bool Equals(Rectangle other) { - return Left == other.Left && Right == other.Right && Top == other.Top && Bottom == other.Bottom; - } - - public static bool operator ==(Rectangle left, Rectangle right) { - return left.Equals(right); - } - - public static bool operator !=(Rectangle left, Rectangle right) { - return !(left == right); - } - } - - /// - /// 表示四个坐标构成的矩形。 - /// - public readonly struct Quad : IEquatable - { - public readonly Point UpperLeft, UpperRight, LowerLeft, LowerRight; - - public Quad(Point upperLeft, Point upperRight, Point lowerLeft, Point lowerRight) { - UpperLeft = upperLeft; - UpperRight = upperRight; - LowerLeft = lowerLeft; - LowerRight = lowerRight; - } - - public Quad Union(Quad other) { - var x1 = Math.Min(Math.Min(UpperLeft.X, other.UpperLeft.X), Math.Min(LowerLeft.X, other.LowerLeft.X)); - var x2 = Math.Max(Math.Max(UpperLeft.X, other.UpperLeft.X), Math.Max(LowerLeft.X, other.LowerLeft.X)); - var y1 = Math.Min(Math.Min(UpperLeft.Y, other.UpperLeft.Y), Math.Min(LowerLeft.Y, other.LowerLeft.Y)); - var y2 = Math.Max(Math.Max(UpperLeft.Y, other.UpperLeft.Y), Math.Max(LowerLeft.Y, other.LowerLeft.Y)); - return new Quad(new Point(x1, y1), new Point(x2, y2), new Point(x1, y2), new Point(x2, y2)); - } - public Rectangle ToRectangle() { - var x1 = Math.Min(Math.Min(UpperLeft.X, UpperRight.X), Math.Min(LowerLeft.X, LowerRight.X)); - var x2 = Math.Max(Math.Max(UpperLeft.X, UpperRight.X), Math.Max(LowerLeft.X, LowerRight.X)); - var y1 = Math.Min(Math.Min(UpperLeft.Y, UpperRight.Y), Math.Min(LowerLeft.Y, LowerRight.Y)); - var y2 = Math.Max(Math.Max(UpperLeft.Y, UpperRight.Y), Math.Max(LowerLeft.Y, LowerRight.Y)); - return new Rectangle(x1, y1, x2, y2); - } - - public override bool Equals(object obj) { - return obj is Quad && Equals((Quad)obj); - } - - public bool Equals(Quad other) { - return UpperLeft.Equals(other.UpperLeft) && - UpperRight.Equals(other.UpperRight) && - LowerLeft.Equals(other.LowerLeft) && - LowerRight.Equals(other.LowerRight); - } - - public override int GetHashCode() { - var hashCode = -1690381272; - hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(UpperLeft); - hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(UpperRight); - hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(LowerLeft); - hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(LowerRight); - return hashCode; - } - - public static bool operator ==(Quad quad1, Quad quad2) { - return quad1.Equals(quad2); - } - - public static bool operator !=(Quad quad1, Quad quad2) { - return !(quad1 == quad2); - } - } - - /// - /// 表示转置矩阵。 - /// - [DebuggerDisplay("({A},{B},{C},{D},{E},{F})")] - public readonly struct Matrix : IEquatable - { - public readonly float A, B, C, D, E, F; - /// - /// 返回矩阵的放大方向是否对齐坐标轴(没有斜向拉伸或90整数倍以外的旋转)。 - /// - public bool IsRectilinear => Math.Abs(B) < Single.Epsilon && Math.Abs(C) < Single.Epsilon - || Math.Abs(A) < Single.Epsilon && Math.Abs(D) < Single.Epsilon; - /// - /// 返回矩阵大致的放大比例。 - /// - public float Expansion => (float)Math.Sqrt(Math.Abs(A * D - B * C)); - private static float Min4(float a, float b, float c, float d) { - return Math.Min(Math.Min(a, b), Math.Min(c, d)); - } - private static float Max4(float a, float b, float c, float d) { - return Math.Max(Math.Max(a, b), Math.Max(c, d)); - } - /// - /// 单元矩阵。 - /// - public static readonly Matrix Identity = new Matrix(1, 0, 0, 1, 0, 0); - /// - /// 垂直翻转矩阵。 - /// - public static readonly Matrix VerticalFlip = new Matrix(1, 0, 0, -1, 0, 0); - /// - /// 水平翻转矩阵。 - /// - public static readonly Matrix HorizontalFlip = new Matrix(-1, 0, 0, 1, 0, 0); - public Matrix(float a, float b, float c, float d, float e, float f) { - A = a; - B = b; - C = c; - D = d; - E = e; - F = f; - } - /// - /// 将两个矩阵相乘。 - /// - /// 被乘的矩阵。 - /// 乘数矩阵。 - /// 相乘后的新矩阵。 - public static Matrix Concat(Matrix one, Matrix two) { - return new Matrix( - one.A * two.A + one.B * two.C, - one.A * two.B + one.B * two.D, - one.C * two.A + one.D * two.C, - one.C * two.B + one.D * two.D, - one.E * two.A + one.F * two.C + two.E, - one.E * two.B + one.F * two.D + two.F); - } - public static Matrix Scale(float x, float y) { - return new Matrix(x, 0, 0, y, 0, 0); - } - public Matrix ScaleTo(float x, float y) { - return Concat(this, Scale(x, y)); - } - public static Matrix Shear(float h, float v) { - return new Matrix(1, v, h, 1, 0, 0); - } - public Matrix ShearTo(float x, float y) { - return Concat(this, Shear(x, y)); - } - public static Matrix Rotate(float theta) { - float s; - float c; - - while (theta < 0) - theta += 360; - while (theta >= 360) - theta -= 360; - - if (Math.Abs(0 - theta) < float.Epsilon) { - s = 0; - c = 1; - } - else if (Math.Abs(90.0f - theta) < float.Epsilon) { - s = 1; - c = 0; - } - else if (Math.Abs(180.0f - theta) < float.Epsilon) { - s = 0; - c = -1; - } - else if (Math.Abs(270.0f - theta) < float.Epsilon) { - s = -1; - c = 0; - } - else { - s = (float)Math.Sin(theta * Math.PI / 180f); - c = (float)Math.Cos(theta * Math.PI / 180f); - } - - return new Matrix(c, s, -s, c, 0, 0); - } - public Matrix RotateTo(float theta) { - return Concat(this, Rotate(theta)); - } - public static Matrix Translate(float tx, float ty) { - return new Matrix(1, 0, 0, 1, tx, ty); - } - public Matrix TranslateTo(float tx, float ty) { - return Concat(this, Translate(tx, ty)); - } - public Point Transform(Point p) { - return new Point(p.X * A + p.Y * C + E, p.X * B + p.Y * D + F); - } - public Point Transform(float x, float y) { - return new Point(x * A + y * C + E, x * B + y * D + F); - } - public Rectangle Transform(Rectangle rect) { - Point s, t, u, v; - - if (rect.IsInfinite) - return rect; - - s = Transform(rect.Left, rect.Top); - t = Transform(rect.Left, rect.Bottom); - u = Transform(rect.Right, rect.Bottom); - v = Transform(rect.Right, rect.Top); - return new Rectangle(Min4(s.X, t.X, u.X, v.X), - Min4(s.Y, t.Y, u.Y, v.Y), - Max4(s.X, t.X, u.X, v.X), - Max4(s.Y, t.Y, u.Y, v.Y) - ); - } - - public override bool Equals(object obj) { - return obj is Matrix && Equals((Matrix)obj); - } - - public bool Equals(Matrix other) { - return A == other.A && B == other.B && C == other.C && D == other.D && E == other.E && F == other.F; - } - - public override int GetHashCode() { - var hashCode = 165473199; - hashCode = hashCode * -1521134295 + A.GetHashCode(); - hashCode = hashCode * -1521134295 + B.GetHashCode(); - hashCode = hashCode * -1521134295 + C.GetHashCode(); - hashCode = hashCode * -1521134295 + D.GetHashCode(); - hashCode = hashCode * -1521134295 + E.GetHashCode(); - hashCode = hashCode * -1521134295 + F.GetHashCode(); - return hashCode; - } - - public static bool operator ==(Matrix matrix1, Matrix matrix2) { - return matrix1.Equals(matrix2); - } - - public static bool operator !=(Matrix matrix1, Matrix matrix2) { - return !(matrix1 == matrix2); - } - } - -} diff --git a/pdfpatcher/App/Processor/NullXmlWriter.cs b/pdfpatcher/App/Processor/NullXmlWriter.cs deleted file mode 100644 index d03de06f85903e0eff05bebec8cac210dc6b4681..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/NullXmlWriter.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PDFPatcher.Processor -{ - sealed class NullXmlWriter : System.Xml.XmlWriter - { - public override void Close() { - - } - - public override void Flush() { - - } - - public override string LookupPrefix(string ns) { - return String.Empty; - } - - public override void WriteBase64(byte[] buffer, int index, int count) { - - } - - public override void WriteCData(string text) { - - } - - public override void WriteCharEntity(char ch) { - - } - - public override void WriteChars(char[] buffer, int index, int count) { - - } - - public override void WriteComment(string text) { - - } - - public override void WriteDocType(string name, string pubid, string sysid, string subset) { - - } - - public override void WriteEndAttribute() { - - } - - public override void WriteEndDocument() { - - } - - public override void WriteEndElement() { - - } - - public override void WriteEntityRef(string name) { - - } - - public override void WriteFullEndElement() { - - } - - public override void WriteProcessingInstruction(string name, string text) { - - } - - public override void WriteRaw(string data) { - - } - - public override void WriteRaw(char[] buffer, int index, int count) { - - } - - public override void WriteStartAttribute(string prefix, string localName, string ns) { - - } - - public override void WriteStartDocument(bool standalone) { - - } - - public override void WriteStartDocument() { - - } - - public override void WriteStartElement(string prefix, string localName, string ns) { - - } - - public override System.Xml.WriteState WriteState => System.Xml.WriteState.Content; - - public override void WriteString(string text) { - - } - - public override void WriteSurrogateCharEntity(char lowChar, char highChar) { - - } - - public override void WriteWhitespace(string ws) { - - } - } -} diff --git a/pdfpatcher/App/Processor/OcrProcessor.cs b/pdfpatcher/App/Processor/OcrProcessor.cs deleted file mode 100644 index a358794c71880d532eb08f390128c8bc0d4dd78f..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/OcrProcessor.cs +++ /dev/null @@ -1,607 +0,0 @@ -#if DEBUG -#define DEBUGOCR -#endif -using System; -using System.Collections.Generic; -using System.IO; -using System.Text.RegularExpressions; -using System.Xml; -using iTextSharp.text.pdf; -using PDFPatcher.Common; -using PDFPatcher.Model; -using PDFPatcher.Processor.Imaging; - -namespace PDFPatcher.Processor -{ - sealed class OcrProcessor - { - internal sealed class Result - { - public ImageDisposition Image { get; } - public List Texts { get; } - public Result(ImageDisposition image) { - Image = image; - Texts = new List(); - } - } - - const int OpenWorkload = 1; - const string __punctuations = @"·.“”,,\.-""~∼。::\p{P}"; - static readonly AutoBookmarkOptions __MergeOptions = new AutoBookmarkOptions { MergeAdjacentTitles = true, MergeDifferentSizeTitles = true }; - static readonly Regex __ContentPunctuationExpression = new Regex(@"[" + __punctuations + @"][" + __punctuations + @"0一\s]+[" + __punctuations + @"]\s*", RegexOptions.Compiled); - static readonly Regex __ContinuousWhiteSpaceExpression = new Regex(@"[  ]{3,}", RegexOptions.Compiled); - static readonly Regex __WhiteSpaceBetweenChineseCharacters = new Regex(@"([\u4E00-\u9FFF\u3400-\u4DBF])[  ]+(?=[\u4E00-\u9FFF\u3400-\u4DBF])", RegexOptions.Compiled); - - private readonly ModiOcr _Ocr; - private readonly float _OcrQuantitativeFactor; - private readonly PdfReader _reader; - private readonly ImageExtractor _ocrImageExp; - private readonly OcrOptions _options; - private IResultWriter _resultWriter; - - public OcrProcessor(PdfReader reader, OcrOptions options) : this(options) { - var expOptions = new ImageExtracterOptions() { - OutputPath = Path.GetTempPath(), - FileMask = "\"ocr-" + DateTime.Now.ToString("yyMMddHHmmss") + "-\"0000", - MergeImages = true, - MergeJpgToPng = true, - MinHeight = 100, - MinWidth = 100 - }; - CleanUpTempFiles(expOptions.OutputPath); - _reader = reader; - _ocrImageExp = new ImageExtractor(expOptions, reader) { - PrintImageLocation = false - }; - } - - private OcrProcessor(OcrOptions options) { - _Ocr = new ModiOcr { - LangID = options.OcrLangID, - StretchPage = options.StretchPage, - OrientPage = options.OrientPage, - WritingDirection = options.WritingDirection - }; - _OcrQuantitativeFactor = options.QuantitativeFactor; - _options = options; - } - - private static void CleanUpTempFiles(string folderPath) { - var tf = Directory.GetFiles(folderPath, "ocr-*.tif"); - foreach (var file in tf) { - try { - File.Delete(file); - } - catch (Exception) { - } - } - } - - internal int EstimateWorkload() { - var n = _reader.NumberOfPages; - var load = 0; - load += OpenWorkload; - var t = PageRangeCollection.Parse(_options.PageRanges, 1, n, true).TotalPages; - load += t > 0 ? t : n; - return load; - } - - internal void SetWriter(XmlWriter writer) { - _resultWriter = new XmlResultWriter(writer); - } - internal void SetWriter(TextWriter writer) { - _resultWriter = new TextResultWriter(writer); - } - - internal void PerformOcr() { - Tracker.IncrementProgress(OpenWorkload); - var ranges = PageRangeCollection.Parse(_options.PageRanges, 1, _reader.NumberOfPages, true); - __MergeOptions.DetectColumns = _options.DetectColumns; - __MergeOptions.WritingDirection = _options.WritingDirection; - TextLine.DefaultDirection = _options.WritingDirection; - if (FileHelper.IsPathValid(_options.SaveOcredImagePath)) { - File.Delete(_options.SaveOcredImagePath); - } - var el = new List(); - foreach (PageRange r in ranges) { - for (int i = r.StartValue; i <= r.EndValue; i++) { - Tracker.TraceMessage("正在识别第 " + i + " 页。"); - var or = OcrPage(i, el); - if (or.Count > 0) { - _resultWriter?.BeginWritePage(i); - - foreach (var result in or) { - _resultWriter?.BeginWriteImage(result.Image); - if (_options.OutputOriginalOcrResult) { - if (_resultWriter != null) { - foreach (var item in result.Texts) { - _resultWriter.WriteText(item, null); - } - } - } - else { - WriteOcrResult(i, result); - } - _resultWriter?.EndWriteImage(); - } - _resultWriter?.EndWritePage(); - } - Tracker.IncrementProgress(1); - } - } - if (el.Count > 0) { - Tracker.TraceMessage(Tracker.Category.Alert, String.Concat("有 ", el.Count, " 页在识别过程中出现错误,页码为:", String.Join(", ", el))); - } - } - - private void WriteOcrResult(int i, Result result) { - SortRecognizedText(result.Texts, _options); - var pr = _reader.GetPageNRelease(i).GetPageVisibleRectangle(); - var tl = _options.WritingDirection != WritingDirection.Unknown - ? AutoBookmarkCreator.MergeTextInfoList(pr, result.Texts.ConvertAll((l) => GetMergedTextInfo(result.Image, l)), __MergeOptions) // 按照书写方向重组识别文本 - : result.Texts; - foreach (var item in tl) { - var t = item.Text; - var ir = item.Region; - - t = CleanUpText(t, _options); - if (_options.PrintOcrResult) { -#if DEBUG - Tracker.TraceMessage(String.Concat(item.Direction.ToString()[0], ir.Top.ToString(" 0000"), ',', ir.Left.ToString("0000"), "(", ir.Width.ToString("0000"), ',', ir.Height.ToString("0000"), ")\t", t)); -#else - Tracker.TraceMessage (t); -#endif - } - - _resultWriter?.WriteText(item, t); - } - } - - /// - /// 根据识别选项优化输出结果。 - /// - /// 文本内容。 - /// 识别选项。 - /// 优化后的文本。 - internal static string CleanUpText(string text, OcrOptions options) { - if (options.DetectContentPunctuations) { - text = __ContentPunctuationExpression.Replace(text, " .... "); - } - if (options.CompressWhiteSpaces) { - text = __ContinuousWhiteSpaceExpression.Replace(text, " "); - } - if (options.RemoveWhiteSpacesBetweenChineseCharacters) { - text = __WhiteSpaceBetweenChineseCharacters.Replace(text, "$1"); - } - return text; - } - - private IList OcrPage(int i, List errorList) { -#if DEBUGOCR - Tracker.TraceMessage("导出第 " + i + " 页的图片。"); -#endif - _ocrImageExp.ExtractPageImages(_reader, i); -#if DEBUGOCR - Tracker.TraceMessage("完成导出第 " + i + " 页的图片。"); -#endif - var or = new List(); - try { - foreach (var item in _ocrImageExp.PosList) { - var r = new Result(item); - OcrPage(r); - or.Add(r); - r = null; - } - } - catch (System.Runtime.InteropServices.COMException ex) { - string err = null; - switch (ex.ErrorCode) { - case -959967087: - err = "页面的图片不包含可识别的文本。"; - goto default; - default: - Tracker.TraceMessage(Tracker.Category.Error, "在执行第 " + i + " 页的光学字符识别时出错:"); - if (err != null) { - Tracker.TraceMessage(err); - } - else { - Tracker.TraceMessage("错误编号:" + ex.ErrorCode); - Tracker.TraceMessage(ex); - errorList.Add(i); - } - break; - } - } - catch (Exception ex) { - Tracker.TraceMessage(Tracker.Category.Error, "在执行第 " + i + " 页的光学字符识别时出错:"); - Tracker.TraceMessage(ex); - errorList.Add(i); - } - finally { - foreach (var item in _ocrImageExp.InfoList) { - if (String.IsNullOrEmpty(item.FileName)) { - continue; - } - try { - File.Delete(item.FileName); - } - catch (Exception ex) { - Tracker.TraceMessage(Tracker.Category.Error, ex.Message); - Tracker.TraceMessage(Tracker.Category.Error, "无法删除识别过程中产生的临时文件:" + item.FileName); - } - } - } - return or; - } - - private void OcrPage(Result result) { - var image = result.Image; - var p = image.Image.FileName; - if (String.IsNullOrEmpty(p)) { - return; - } -#if DEBUGOCR - Tracker.TraceMessage("识别图片:" + p); -#endif -#if DEBUG - Tracker.TraceMessage(p); -#endif - result.Texts.Clear(); - OcrImageFile(result.Texts, p); - #region Legacy code - // var ll = new List (); - // // 同行合并宽度最小值 - // var cw = image.Image.Width / 4; - - // // 遍历识别所得的各 TextInfo,使用最小距离聚类方法将其聚类为行 - // foreach (var item in or) { - // var ir = item.Region; - // DistanceInfo cd = null; // TextInfo 到 TextLine 的距离 - // DistanceInfo md = new DistanceInfo (DistanceInfo.Placement.Unknown, float.MaxValue); // 最小距离 - // TextLine ml = null; // 最小距离的 TextLine - - //if (item.Text == "哉") { - // var lxx = 1; - //} - // // 求最小距离的 TextLine - // foreach (var li in ll) { - // cd = li.GetDistance (ir); - // if ((cd.Location == DistanceInfo.Placement.Overlapping // 当前项与文本行交叠 - // && (md.Location != DistanceInfo.Placement.Overlapping // 最小距离不是交叠 - // || cd.Distance < md.Distance) // 当前项与文本行的交叠中心距离小于最小距离 - // ) - // || ((md.Location == DistanceInfo.Placement.Unknown // 未知最小距离 - // || (cd.Location != DistanceInfo.Placement.Overlapping - // && md.Location != DistanceInfo.Placement.Overlapping - // && cd.Distance < md.Distance) // 当前项与文本行的距离小于最小距离 - // ) - // && (((cd.Location == DistanceInfo.Placement.Left || cd.Location == DistanceInfo.Placement.Right) // 相对位置为水平 - // && li.Direction != TextLine.WritingDirection.Vertical // 文本行方向不为纵向 - // ) - // || ((cd.Location == DistanceInfo.Placement.Up || cd.Location == DistanceInfo.Placement.Down) // 相对位置为垂直 - // && li.Direction != TextLine.WritingDirection.Horizontal // 文本行方向不为横向 - // ) - // ) - // && cd.Distance < cw - // ) - // ) { - // md = cd; - // ml = li; - // } - // } - - // if (ml != null) { - // // 若存在最小距离的 TextLine 且可合并,则将 item 归入 TextLine - // if (md.Location == DistanceInfo.Placement.Overlapping) { - // // 检查是否存在交叠重复的文本 - // foreach (var t in ml.Texts) { - // if (t.Region.IntersectWith (item.Region) // item 与 TextLine 中某项交叠 - // && (t.Text.Contains (item.Text) || item.Text.Contains (t.Text) // 交叠的项文本和 item 的文本相同 - // ) - // ) { - // goto Next; // 忽略此项目 - // } - // } - // } - // ml.AddText (item); - // } - // else { - // // 否则,用 item 创建新的 TextLine - // ll.Add (new TextLine (item)); - // } - // Next: - // continue; - // } - - //if (or.Count > 0) { - // float size = 0, size2 = 0, avgSize, maxSize = 0; - // float top = or[0].Region.Top, bottom = or[0].Region.Bottom, left = or[0].Region.Left, right = 0; - // var sb = new System.Text.StringBuilder (); - // int letterCount = 0; - // var rr = new List (); - // Bound r; - // var end = or.Count - 1; - // for (var i = 0; i <= end; i++) { - // var item = or[i]; - // r = item.Region; - // avgSize = letterCount > 0 ? size / letterCount : maxSize; - // AddLine: - // if (r.Top > bottom + 0.2f * (avgSize) || i > end) { // 新行 - // size = image.YScale * avgSize; - // if (_OcrQuatitiveFactor > 0) { - // var a = Math.IEEERemainder (size, _OcrQuatitiveFactor); - // var b = Math.IEEERemainder (size + _OcrQuatitiveFactor, _OcrQuatitiveFactor); - // if (a < b) { - // size -= (float)a; - // } - // else { - // size += _OcrQuatitiveFactor - (float)b; - // } - // } - // if (size >= _fontSizeThreshold) { - // var ni = new TextInfo () - // { - // Text = sb.ToString (), - // Size = size, - // Region = new Bound ( - // image.X + image.XScale * left, - // image.Y + image.YScale * (image.Image.Height - bottom), - // image.X + image.XScale * right, - // image.Y + image.YScale * (image.Image.Height - top)), - // Font = -1 - // }; - // rr.Add (ni); - // } - // maxSize = size = size2 = 0; - // left = r.Left; - // right = r.Right; - // top = r.Top; - // bottom = r.Bottom; - // sb.Length = 0; - // letterCount = 0; - // if (i > end) { - // break; - // } - // } - // if (Char.IsLetter (item.Text[0])) { - // size += item.Size; - // size2 += item.Size * item.Size; - // letterCount++; - // } - // if (item.Size > maxSize) { - // maxSize = item.Size; - // } - // if (r.Top < top) { - // top = r.Top; - // } - // if (r.Bottom > bottom) { - // bottom = r.Bottom; - // } - // if (r.Right > right) { - // right = r.Right; - // } - // sb.Append (item.Text); - // if (i == end) { - // i++; - // goto AddLine; - // } - // } - // this._TextList.AddRange (rr); - //} - #endregion - } - - private void OcrImageFile(List result, string p) { - var sp = _options.SaveOcredImagePath; - if (FileHelper.HasExtension(p, Constants.FileExtensions.Tif) == false) { - using (var fi = new FreeImageAPI.FreeImageBitmap(p)) { -#if !DEBUG - var t = Path.GetDirectoryName (p) + "\\ocr-" + new Random ().Next ().ToText () +".tif"; -#else - var t = "m:\\ocr.tif"; -#endif - if (_options.PreserveColor) { - fi.Save(t, FreeImageAPI.FREE_IMAGE_FORMAT.FIF_TIFF); - } - else { - using (var ti = fi.GetColorConvertedInstance(FreeImageAPI.FREE_IMAGE_COLOR_DEPTH.FICD_01_BPP_THRESHOLD)) { - ti.Save(t, FreeImageAPI.FREE_IMAGE_FORMAT.FIF_TIFF); - } - } - _Ocr.Ocr(t, sp, result); -#if !DEBUG - try { - File.Delete (t); - } - catch (Exception) { - Tracker.TraceMessage (Tracker.Category.Notice, "无法删除临时文件:" + t); - } -#endif - } - } - else { - _Ocr.Ocr(p, sp, result); - } -#if DEBUGOCR - Tracker.TraceMessage("完成识别图片:" + p); -#endif - return; - } - - /// - /// 调用图像处理引擎识别位图。如图片中的文本量太少,将无法识别,并会抛出异常。 - /// - /// 需要识别的图片。 - /// 识别选项。 - /// 在识别时发生的错误。 - /// 识别后的文本。 - internal static List OcrBitmap(System.Drawing.Bitmap bmp, OcrOptions options) { - const int minSize = 500; - var ocr = new OcrProcessor(options); - var r = new List(); - string p = null; - using (var fi = new FreeImageAPI.FreeImageBitmap(bmp)) { - if (fi.Width < minSize || fi.Height < minSize) { - fi.EnlargeCanvas(0, 0, fi.Width < minSize ? minSize : fi.Width, fi.Height < minSize ? minSize : fi.Height, new FreeImageAPI.RGBQUAD(fi.GetPixel(0, 0))); - } - p = FileHelper.CombinePath(Path.GetTempPath(), new Random().Next(Int32.MaxValue).ToText() + Constants.FileExtensions.Tif); - fi.Save(p, FreeImageAPI.FREE_IMAGE_FORMAT.FIF_TIFF); - } - ocr._Ocr.Ocr(p, null, r); - File.Delete(p); - return r; - } - - private static TextInfo GetMergedTextInfo(ImageDisposition image, TextLine item) { - var ti = new TextInfo { - Font = null, - Region = item.Region, - Text = item.Text, - Size = (float)Math.Round(item.Direction == WritingDirection.Vertical ? item.Region.Width/* * image.XScale*/ : item.Region.Height/* * image.YScale*/), - LetterWidth = item.GetAverageCharSize() - }; - //if (item.Texts.Count > 0) { - // float aw = 0; - // foreach (var t in item.Texts) { - // aw += t.LetterWidth; - // } - // aw /= item.Texts.Count; - // ti.LetterWidth = aw; - //} - return ti; - } - - private static void SortRecognizedText(List list, OcrOptions ocrOptions) { - if (ocrOptions.WritingDirection == WritingDirection.Horizontal) { - list.Sort((a, b) => { - var ra = a.Region; - var rb = b.Region; - if (ra.Bottom > rb.Top) { - return 1; - } - if (ra.Top < rb.Bottom) { - return -1; - } - if (ra.IsAlignedWith(rb, WritingDirection.Horizontal)) { - return ra.Center < rb.Center ? -1 : 1; - } - return ra.Middle < rb.Middle ? -1 : 1; - }); - } - else if (ocrOptions.WritingDirection == WritingDirection.Vertical) { - list.Sort((a, b) => { - var ra = a.Region; - var rb = b.Region; - if (ra.Left > rb.Right) { - return -1; - } - if (ra.Right < rb.Left) { - return 1; - } - if (ra.IsAlignedWith(rb, WritingDirection.Vertical)) { - return ra.Middle > rb.Middle ? -1 : 1; - } - return ra.Center > rb.Center ? -1 : 1; - }); - } - } - - interface IResultWriter - { - void BeginWritePage(int i); - void BeginWriteImage(ImageDisposition image); - void WriteText(TextLine text, string optimizedText); - void EndWriteImage(); - void EndWritePage(); - } - - sealed class XmlResultWriter : IResultWriter - { - readonly XmlWriter _writer; - public XmlResultWriter(XmlWriter writer) { - _writer = writer; - } - - #region IResultWriter 成员 - - public void BeginWritePage(int i) { - _writer.WriteStartElement(Constants.Ocr.Result); - _writer.WriteAttributeString(Constants.Content.PageNumber, ValueHelper.ToText(i)); - } - - public void WriteText(TextLine text, string optimizedText) { - if (optimizedText != null) { - WriteTextItem(optimizedText, text.Region, text.Direction); - return; - } - _writer.WriteComment(text.Text); - foreach (var item in text.Texts) { - WriteTextItem(item.Text, item.Region, WritingDirection.Unknown); - } - } - - private void WriteTextItem(string text, Bound ir, WritingDirection direction) { - _writer.WriteStartElement(Constants.Ocr.Content); - _writer.WriteAttributeString(Constants.Ocr.Text, text); - switch (direction) { - case WritingDirection.Horizontal: - _writer.WriteAttributeString(Constants.Coordinates.Direction, Constants.Coordinates.Horizontal); - break; - case WritingDirection.Vertical: - _writer.WriteAttributeString(Constants.Coordinates.Direction, Constants.Coordinates.Vertical); - break; - } - _writer.WriteAttributeString(Constants.Coordinates.Top, ValueHelper.ToText(Math.Round(ir.Top))); - _writer.WriteAttributeString(Constants.Coordinates.Left, ValueHelper.ToText(Math.Round(ir.Left))); - _writer.WriteAttributeString(Constants.Coordinates.Bottom, ValueHelper.ToText(Math.Round(ir.Bottom))); - _writer.WriteAttributeString(Constants.Coordinates.Right, ValueHelper.ToText(Math.Round(ir.Right))); - _writer.WriteEndElement(); - } - - public void EndWritePage() { - _writer.WriteEndElement(); - } - - public void BeginWriteImage(ImageDisposition image) { - _writer.WriteStartElement(Constants.Ocr.Image); - _writer.WriteAttributeString(Constants.Coordinates.Width, ValueHelper.ToText(image.Image.Width)); - _writer.WriteAttributeString(Constants.Coordinates.Height, ValueHelper.ToText(image.Image.Height)); - _writer.WriteAttributeString(Constants.Content.OperandNames.Matrix, PdfHelper.MatrixToString(image.Ctm)); - } - - public void EndWriteImage() { - _writer.WriteEndElement(); - } - #endregion - } - - sealed class TextResultWriter : IResultWriter - { - readonly TextWriter _writer; - public TextResultWriter(TextWriter writer) { - _writer = writer; - } - - #region IResultWriter 成员 - - public void BeginWritePage(int i) { - _writer.WriteLine("#识别页码=" + i); - } - - public void WriteText(TextLine text, string optimizedText) { - _writer.WriteLine(optimizedText ?? text.Text); - } - - public void EndWritePage() { - _writer.WriteLine(); - } - - public void BeginWriteImage(ImageDisposition image) { - _writer.WriteLine("#识别图片=" + PdfHelper.MatrixToString(image.Ctm)); - } - - public void EndWriteImage() { } - #endregion - } - } -} diff --git a/pdfpatcher/App/Processor/OperatorGroup.cs b/pdfpatcher/App/Processor/OperatorGroup.cs deleted file mode 100644 index 89c2cff4d68f0e4ce0d36e9d5cb3396e1f6dce21..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/OperatorGroup.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using iTextSharp.text.pdf; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - internal sealed class OperatorGroup : PdfContentStreamProcessor.IContentOperator - { - /// - /// 处理内容的 列表。 - /// - public List Operators { get; private set; } - - public OperatorGroup(IEnumerable operators) { - Operators = new List(); - if (operators != null) { - Operators.AddRange(operators); - } - } - - #region IContentOperator 成员 - - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - foreach (var item in Operators) { - item.Invoke(processor, oper, operands); - } - } - - #endregion - - } -} diff --git a/pdfpatcher/App/Processor/OutlineManager.cs b/pdfpatcher/App/Processor/OutlineManager.cs deleted file mode 100644 index 88cd500c2e091767b67d47a4a9540192d7989766..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/OutlineManager.cs +++ /dev/null @@ -1,448 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; -using iTextSharp.text.pdf; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - /// A class which manages outlines (bookmarks) of PDF documents. - static class OutlineManager - { - // modifed: added split array for action parameters - static readonly char[] __ActionSplitters = new char[] { ' ', '\t', '\r', '\n' }; - static readonly char[] __fullWidthNums = "0123456789".ToCharArray(); - static readonly char[] __halfWidthNums = "0123456789".ToCharArray(); - static readonly char[] __cmdIdentifiers = new char[] { '=', '﹦', '=', ':', ':' }; - static readonly char[] __pageLabelSeparators = new char[] { ';', ';', ',', ',', ' ' }; - - private static void BookmarkDepth(PdfReader reader, PdfActionExporter exporter, PdfDictionary outline, Dictionary pageRefMap, XmlWriter target) { - while (outline != null) { - target.WriteStartElement(Constants.Bookmark); - - target.WriteAttributeString(Constants.BookmarkAttributes.Title, - StringHelper.ReplaceControlAndBomCharacters(outline.GetAsString(PdfName.TITLE).Decode(AppContext.Encodings.BookmarkEncoding)) - ); - - var color = outline.Locate(PdfName.C); - DocInfoExporter.ExportColor(color, target); - - var style = outline.Locate(PdfName.F); - if (style != null) { - int f = style.IntValue & 0x03; - if (f > 0) { - target.WriteAttributeString(Constants.BookmarkAttributes.Style, Constants.BookmarkAttributes.StyleType.Names[f]); - } - } - - var count = outline.Get(PdfName.COUNT) as PdfNumber; - if (count != null) { - target.WriteAttributeString(Constants.BookmarkAttributes.Open, count.IntValue < 0 ? Constants.Boolean.False : Constants.Boolean.True); - } - - var dest = outline.Locate(PdfName.DEST); - if (dest != null) { - exporter.ExportGotoAction(dest, target, pageRefMap); - } - else { - exporter.ExportAction(outline.Locate(PdfName.A), pageRefMap, target); - } - var first = outline.Locate(PdfName.FIRST); - if (first != null) { - BookmarkDepth(reader, exporter, first, pageRefMap, target); - } - outline = outline.Locate(PdfName.NEXT); - target.WriteEndElement(); - } - } - - /// - /// 从 PDF 导出书签为 XML 元素。 - /// - public static XmlElement GetBookmark(PdfReader reader, UnitConverter unitConverter) { - var catalog = reader.Catalog; - var outlines = catalog.Locate(PdfName.OUTLINES); - if (outlines == null) - return null; - if (unitConverter == null) { - throw new NullReferenceException("unitConverter"); - } - var pages = reader.GetPageRefMapper(); - var doc = new XmlDocument(); - doc.AppendElement(Constants.DocumentBookmark); - using (var w = doc.DocumentElement.CreateNavigator().AppendChild()) { - var a = new PdfActionExporter(unitConverter); - BookmarkDepth( - reader, - a, - (PdfDictionary)PdfReader.GetPdfObjectRelease(outlines.Get(PdfName.FIRST)), - pages, - w); - } - return doc.DocumentElement; - } - - private static Object[] CreateOutlines(PdfWriter writer, PdfIndirectReference parent, XmlElement kids, int maxPageNumber, bool namedAsNames) { - var bookmarks = kids.SelectNodes(Constants.Bookmark); - var refs = new PdfIndirectReference[bookmarks.Count]; - for (int k = 0; k < refs.Length; ++k) - refs[k] = writer.PdfIndirectReference; - int ptr = 0; - int count = 0; - foreach (XmlElement child in bookmarks) { - Object[] lower = null; - if (child.SelectSingleNode(Constants.Bookmark) != null) - lower = CreateOutlines(writer, refs[ptr], child, maxPageNumber, namedAsNames); - var outline = new PdfDictionary(); - ++count; - if (lower != null) { - outline.Put(PdfName.FIRST, (PdfIndirectReference)lower[0]); - outline.Put(PdfName.LAST, (PdfIndirectReference)lower[1]); - int n = (int)lower[2]; - // 默认关闭书签 - if (child.GetAttribute(Constants.BookmarkAttributes.Open) != Constants.Boolean.True) { - outline.Put(PdfName.COUNT, -n); - } - else { - outline.Put(PdfName.COUNT, n); - count += n; - } - } - outline.Put(PdfName.PARENT, parent); - if (ptr > 0) - outline.Put(PdfName.PREV, refs[ptr - 1]); - if (ptr < refs.Length - 1) - outline.Put(PdfName.NEXT, refs[ptr + 1]); - outline.Put(PdfName.TITLE, child.GetAttribute(Constants.BookmarkAttributes.Title)); - DocInfoImporter.ImportColor(child, outline); - var style = child.GetAttribute(Constants.BookmarkAttributes.Style); - if (String.IsNullOrEmpty(style) == false) { - int bits = Array.IndexOf(Constants.BookmarkAttributes.StyleType.Names, style); - if (bits == -1) { - bits = 0; - } - if (bits != 0) - outline.Put(PdfName.F, bits); - } - DocInfoImporter.ImportAction(writer, outline, child, maxPageNumber, namedAsNames); - writer.AddToBody(outline, refs[ptr]); - ++ptr; - } - return new Object[] { refs[0], refs[refs.Length - 1], count }; - } - - internal static PdfIndirectReference WriteOutline(PdfWriter writer, XmlElement bookmarks, int maxPageNumber) { - if (bookmarks == null || bookmarks.SelectSingleNode(Constants.Bookmark) == null) { - return null; - } - var top = new PdfDictionary(); - var topRef = writer.PdfIndirectReference; - var kids = CreateOutlines(writer, topRef, bookmarks, maxPageNumber, false); - top.Put(PdfName.TYPE, PdfName.OUTLINES); - top.Put(PdfName.FIRST, (PdfIndirectReference)kids[0]); - top.Put(PdfName.LAST, (PdfIndirectReference)kids[1]); - top.Put(PdfName.COUNT, (int)kids[2]); - writer.AddToBody(top, topRef); - writer.ExtraCatalog.Put(PdfName.OUTLINES, topRef); - return topRef; - } - - internal static void KillOutline(PdfReader source) { - var catalog = source.Catalog; - var o = catalog.Get(PdfName.OUTLINES); - if (o == null) { - return; - } - if (o != null) { - var outlines = o as PRIndirectReference; - OutlineTravel(outlines); - PdfReader.KillIndirect(outlines); - } - catalog.Remove(PdfName.OUTLINES); - PdfReader.KillIndirect(catalog.Get(PdfName.OUTLINES)); - if (PdfName.USEOUTLINES.Equals(catalog.GetAsName(PdfName.PAGEMODE))) { - catalog.Remove(PdfName.PAGEMODE); - } - } - - private static void OutlineTravel(PRIndirectReference outline) { - while (outline != null) { - var outlineR = (PdfDictionary)PdfReader.GetPdfObjectRelease(outline); - PdfReader.KillIndirect(outline); - if (outlineR != null) { - var first = (PRIndirectReference)outlineR.Get(PdfName.FIRST); - if (first != null) { - OutlineTravel(first); - } - PdfReader.KillIndirect(outlineR.Get(PdfName.DEST)); - PdfReader.KillIndirect(outlineR.Get(PdfName.A)); - outline = (PRIndirectReference)outlineR.Get(PdfName.NEXT); - } - else { - outline = null; - } - } - } - - public static string EscapeBinaryString(String s) { - var buf = StringBuilderCache.Acquire(); - var cc = s.ToCharArray(); - int len = cc.Length; - for (int k = 0; k < len; ++k) { - char c = cc[k]; - if (c < ' ') { - buf.Append('\\'); - int v = c; - var octal = ""; - do { - int x = v % 8; - octal = x.ToText() + octal; - v /= 8; - } while (v > 0); - buf.Append(octal.PadLeft(3, '0')); - } - else if (c == '\\') { - buf.Append("\\\\"); - } - else { - buf.Append(c); - } - } - return StringBuilderCache.GetStringAndRelease(buf); - } - - public static string UnescapeBinaryString(String s) { - var buf = StringBuilderCache.Acquire(); - var cc = s.ToCharArray(); - int len = cc.Length; - for (int k = 0; k < len; ++k) { - char c = cc[k]; - if (c != '\\') { - buf.Append(c); - continue; - } - if (++k >= len) { - buf.Append('\\'); - break; - } - c = cc[k]; - if (c < '0' || c > '7') { - buf.Append(c); - continue; - } - int n = c - '0'; - ++k; - for (int j = 0; j < 2 && k < len; ++j) { - c = cc[k]; - if (c < '0' || c > '7') { - break; - } - ++k; - n = n * 8 + c - '0'; - } - --k; - buf.Append((char)n); - } - return StringBuilderCache.GetStringAndRelease(buf); - } - - internal static void ImportSimpleBookmarks(TextReader source, PdfInfoXmlDocument target) { - string cmd, cmdData, s, title, indentString = "\t", pnText; - bool isOpen = false; // 书签是否默认打开 - int pageOffset = 0, pageNum; - int currentIndent = -1, indent, p; - int lineNum = 0; - char[] digits; - var pattern = new Regex(@"(.+?)[\s\.… \-_]*(-?[0-90123456789]+)?\s*$", RegexOptions.Compiled); - var docInfo = target.InfoNode; - var root = target.BookmarkRoot; - var pageLabels = target.PageLabelRoot; - BookmarkContainer currentBookmark = root; - BookmarkElement bookmark; - while (source.Peek() != -1) { - s = source.ReadLine(); - lineNum++; - if (s.Trim().Length == 0) { - continue; - } - - if ((s[0] == '#' || s[0] == '#') && (p = s.IndexOfAny(__cmdIdentifiers)) != -1) { - cmd = s.Substring(1, p - 1); - cmdData = s.Substring(p + 1); - switch (cmd) { - case "首页页码": - if (cmdData.TryParse(out pageOffset)) { - Tracker.TraceMessage("首页页码改为 " + pageOffset); - pageOffset--; - } - break; - case "缩进标记": - indentString = cmdData; - Tracker.TraceMessage(String.Concat("缩进标记改为“", indentString, "”")); - break; - case "版本": - if (lineNum == 1) { - var v = cmdData.Trim(); - target.DocumentElement.SetAttribute(Constants.Info.ProductVersion, v); - Tracker.TraceMessage("导入简易书签文件,版本为:" + v); - } - break; - case "打开书签": - cmdData = cmdData.ToLowerInvariant(); - isOpen = (cmdData == "是" || cmdData == "true" || cmdData == "y" || cmdData == "yes" || cmdData == "1"); - break; - case Constants.Info.DocumentPath: - target.PdfDocumentPath = cmdData.Trim(); - break; - case Constants.PageLabels: - var l = cmdData.Split(__pageLabelSeparators, 3); - if (l.Length < 1) { - Tracker.TraceMessage(Constants.PageLabels + "格式不正确,至少应指定起始页码。"); - continue; - } - int pn; - if (l[0].TryParse(out pn) == false || pn < 1) { - Tracker.TraceMessage(Constants.PageLabels + "格式不正确:起始页码应为正整数。"); - continue; - } - var style = l[1].Length > 0 - ? ValueHelper.MapValue(l[1][0], - Constants.PageLabelStyles.SimpleInfoIdentifiers, - Constants.PageLabelStyles.Names, - Constants.PageLabelStyles.Names[1]) - : Constants.PageLabelStyles.Names[1]; - var prefix = l.Length > 2 ? l[2] : null; - var pl = target.CreateElement(Constants.PageLabelsAttributes.Style) as XmlElement; - pl.SetAttribute(Constants.PageLabelsAttributes.PageNumber, pn.ToText()); - pl.SetAttribute(Constants.PageLabelsAttributes.Style, style); - if (String.IsNullOrEmpty(prefix) == false) { - pl.SetAttribute(Constants.PageLabelsAttributes.Prefix, prefix); - } - pageLabels.AppendChild(pl); - continue; - case Constants.Info.Title: - case Constants.Info.Subject: - case Constants.Info.Keywords: - case Constants.Info.Author: - docInfo.SetAttribute(cmd, cmdData); - break; - } - continue; - } - indent = p = 0; - while (s.IndexOf(indentString, p) == p) { - p += indentString.Length; - indent++; - } - var m = pattern.Match(s, p); - if (m.Success == false) { - continue; - } - title = m.Groups[1].Value; - pnText = m.Groups[2].Value; - if (pnText.Length == 0) { - pageNum = 0; - } - else { - if (pnText.IndexOfAny(__fullWidthNums) != -1) { - digits = Array.ConvertAll(m.Groups[2].Value.ToCharArray(), d => ValueHelper.MapValue(d, __fullWidthNums, __halfWidthNums, d)); - pnText = new string(digits, 0, digits.Length); - } - if (pnText.TryParse(out pageNum)) { - pageNum += pageOffset; - } - } - bookmark = target.CreateBookmark(); - if (indent == currentIndent) { - currentBookmark.ParentNode.AppendChild(bookmark); - } - else if (indent > currentIndent) { - currentBookmark.AppendChild(bookmark); - if (indent - currentIndent > 1) { - throw new FormatException(String.Concat("在简易书签第 ", lineNum, " 行的缩进格式不正确。\n\n说明:下级书签最多只能比上级书签多一个缩进标记。")); - } - currentIndent++; - } - else /* indent < currentIndent */ { - while (currentIndent > indent && currentBookmark.ParentNode != root) { - currentBookmark = currentBookmark.ParentNode as BookmarkContainer; - currentIndent--; - } - currentBookmark.ParentNode.AppendChild(bookmark); - } - bookmark.Title = title; - if (isOpen == false) { - bookmark.IsOpen = false; - } - if (pageNum > 0) { - bookmark.Page = pageNum; - } - currentBookmark = bookmark; - } - } - - internal static void ImportSimpleBookmarks(string path, PdfInfoXmlDocument target) { - using (TextReader r = new StreamReader(path, DetectEncoding(path))) { - ImportSimpleBookmarks(r, target); - } - } - - public static void WriteSimpleBookmarkInstruction(TextWriter writer, string item, string value) { - if (String.IsNullOrEmpty(value)) { - return; - } - writer.Write("#"); - writer.Write(item); - writer.Write("="); - writer.WriteLine(value); - } - - /// - /// 将 XML 书签输出为简易书签。 - /// - /// 输出目标。 - /// 书签节点。 - /// 缩进量。 - /// 缩进字符串。 - public static void WriteSimpleBookmark(TextWriter writer, BookmarkContainer container, int indent, string indentChar) { - foreach (BookmarkElement item in container.SubBookmarks) { - for (int i = 0; i < indent; i++) { - writer.Write(indentChar); - } - writer.Write(item.Title); - writer.Write("\t\t"); - writer.Write(item.Page.ToText()); - writer.WriteLine(); - WriteSimpleBookmark(writer, item, indent + 1, indentChar); - } - } - - private static Encoding DetectEncoding(string path) { - const string VersionString = "#版本"; - const string VersionString2 = "#版本"; - - var b = new byte[20]; - using (var r = new FileStream(path, FileMode.Open)) { - if (r.Length < b.Length) { - throw new FormatException("简易书签文件内容不足。"); - } - r.Read(b, 0, b.Length); - } - foreach (var item in Constants.Encoding.Encodings) { - if (item == null) { - continue; - } - var s = item.GetString(b); - if (s.StartsWith(VersionString, StringComparison.Ordinal) || s.StartsWith(VersionString2, StringComparison.Ordinal)) { - return item; - } - } - return Encoding.Default; - } - - } -} diff --git a/pdfpatcher/App/Processor/PageProcessorContext.cs b/pdfpatcher/App/Processor/PageProcessorContext.cs deleted file mode 100644 index adc06c01b87dc0af69db398ce345c8b90b61ae89..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/PageProcessorContext.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using iTextSharp.text.pdf; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - sealed class PageProcessorContext - { - /// 正在处理的 PDF 文档。 - public PdfReader Pdf { get; } - - /// 正在处理的页码。 - public int PageNumber { get; } - - /// 标记页面内容是否已被更改。 - public bool IsPageContentModified { get; set; } - - PdfDictionary _Page; - /// 获取正在处理的页面。 - public PdfDictionary Page { - get { - if (_Page == null) { - _Page = Pdf.GetPageN(PageNumber); - } - return _Page; - } - } - - PdfPageCommandProcessor _processor; - /// 获取正在处理的页面指令集合。 - public Model.IPdfPageCommandContainer PageCommands { - get { - if (_processor == null) { - _processor = new PdfPageCommandProcessor(); - var resources = Page.Locate(PdfName.RESOURCES); - _processor.ProcessContent(PdfReader.GetPageContent(Page), resources); - } - return _processor; - } - } - - public PageProcessorContext(PdfReader pdf, int pageNumber) { - Pdf = pdf; - PageNumber = pageNumber; - } - - /// 写入页面指令到当前处理的页面。 - internal void WritePageCommands() { - _processor.WritePdfCommands(Pdf, PageNumber); - } - - //internal void UpdateContentBytes () { - // if (_ContentBytes == null) { - // return; - // } - // Pdf.SafeSetPageContent (PageNumber, _ContentBytes); - // Pdf.ResetReleasePage (); - //} - } -} diff --git a/pdfpatcher/App/Processor/PdfActionExporter.cs b/pdfpatcher/App/Processor/PdfActionExporter.cs deleted file mode 100644 index c7fe27cab5b7dcaba75b546375172588be412f9f..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/PdfActionExporter.cs +++ /dev/null @@ -1,199 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Xml; -using iTextSharp.text.pdf; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - internal sealed class PdfActionExporter - { - readonly Common.UnitConverter _unitConverter; - - public PdfActionExporter(Common.UnitConverter unitConverter) { - _unitConverter = unitConverter; - } - - internal void ExportFileLocation(XmlWriter w, PdfObject file) { - if (file.Type == PdfObject.DICTIONARY) { - var fs = file as PdfDictionary; - if (fs.Contains(PdfName.UF)) { - w.WriteAttributeString(Constants.DestinationAttributes.Path, PdfHelper.GetValidXmlString(fs.GetAsString(PdfName.UF).ToUnicodeString())); - } - else if (fs.Contains(PdfName.F)) { - file = fs.Get(PdfName.F); - } - } - else if (file.Type == PdfObject.STRING) - w.WriteAttributeString(Constants.DestinationAttributes.Path, PdfHelper.GetValidXmlString(((PdfString)file).Decode(System.Text.Encoding.Default))); - } - - internal void ExportAction(PdfDictionary action, Dictionary pageRefMap, XmlWriter target) { - PdfObject dest; - if (action == null) - return; - var actionType = PdfReader.GetPdfObjectRelease(action.Get(PdfName.S)); - if (PdfName.GOTO.Equals(actionType)) { - dest = PdfReader.GetPdfObjectRelease(action.Get(PdfName.D)); - if (dest != null) { - ExportGotoAction(dest, target, pageRefMap); - } - } - else if (PdfName.URI.Equals(actionType)) { - target.WriteAttributeString(Constants.DestinationAttributes.Action, Constants.ActionType.Uri); - target.WriteAttributeString(Constants.DestinationAttributes.Path, PdfHelper.GetValidXmlString(action.Locate(PdfName.URI).ToUnicodeString())); - } - else if (PdfName.GOTOR.Equals(actionType)) { - target.WriteAttributeString(Constants.DestinationAttributes.Action, Constants.ActionType.GotoR); - dest = PdfReader.GetPdfObjectRelease(action.Get(PdfName.D)); - if (dest != null) { - if (dest.IsString()) - target.WriteAttributeString(Constants.DestinationAttributes.Named, PdfHelper.GetValidXmlString(dest.ToString())); - else if (dest.IsName()) - target.WriteAttributeString(Constants.DestinationAttributes.NamedN, PdfName.DecodeName(dest.ToString())); - else if (dest.IsArray()) { - var arr = (PdfArray)dest; - if (arr.Size > 0 && arr[0].IsNumber()) { - target.WriteAttributeString(Constants.DestinationAttributes.Page, PdfHelper.GetValidXmlString(((arr[0] as PdfNumber).IntValue + 1).ToText())); - ExportDestinationView(target, arr); - } - } - } - var file = action.Locate(PdfName.F) ?? action.Locate(PdfName.WIN); - if (file != null) { - ExportFileLocation(target, file); - } - var newWindow = action.Locate(PdfName.NEWWINDOW); - if (newWindow != null) - target.WriteAttributeString(Constants.DestinationAttributes.NewWindow, newWindow.BooleanValue ? Constants.Boolean.True : Constants.Boolean.False); - } - else if (PdfName.LAUNCH.Equals(actionType)) { - target.WriteAttributeString(Constants.DestinationAttributes.Action, Constants.ActionType.Launch); - var file = PdfReader.GetPdfObjectRelease(action.Get(PdfName.F)) ?? PdfReader.GetPdfObjectRelease(action.Get(PdfName.WIN)); - if (file != null) { - ExportFileLocation(target, file); - } - } - else if (PdfName.JAVASCRIPT.Equals(actionType)) { - target.WriteAttributeString(Constants.DestinationAttributes.Action, Constants.ActionType.Javascript); - target.WriteAttributeString(Constants.DestinationAttributes.ScriptContent, PdfReader.GetPdfObjectRelease(action.Get(PdfName.JS)).ToString()); - } - } - - internal void ExportGotoAction(PdfObject dest, XmlWriter target, Dictionary pages) { - target.WriteAttributeString(Constants.DestinationAttributes.Action, Constants.ActionType.Goto); - if (dest.Type == PdfObject.STRING) - target.WriteAttributeString(Constants.DestinationAttributes.Named, StringHelper.ReplaceControlAndBomCharacters((dest as PdfString).ToUnicodeString())); - else if (dest.Type == PdfObject.NAME) - target.WriteAttributeString(Constants.DestinationAttributes.Named, PdfName.DecodeName(dest.ToString())); - else if (dest.Type == PdfObject.ARRAY) { - var a = dest as PdfArray; - if (a.Size > 0) { - var p = a[0]; - int pn = 0; - if (p.Type == PdfObject.INDIRECT && pages.TryGetValue(GetNumber((PdfIndirectReference)a[0]), out pn)) { - // use pn - } - else if (p.Type == PdfObject.NUMBER) { - pn = (p as PdfNumber).IntValue + 1; - } - if (pn > 0) { - target.WriteAttributeString(Constants.DestinationAttributes.Page, pn.ToText()); - } - } - ExportDestinationView(target, a); - } - } - - private void ExportDestinationView(XmlWriter target, PdfArray dest) { - if (dest.Size < 2) { - return; - } - var pn = dest[1] as PdfName; - if (pn == null) { - return; - } - var m = PdfHelper.GetPdfFriendlyName(pn); - target.WriteAttributeString(Constants.DestinationAttributes.View, m); - var p = new string[dest.Size - 2]; - PdfObject o; - for (int i = 0; i < p.Length; i++) { - o = dest[i + 2]; - if (o == null) { - p[i] = String.Empty; - } - p[i] = (o.Type == PdfObject.NUMBER) ? (m == Constants.DestinationAttributes.ViewType.XYZ && i == 2 - ? ((PdfNumber)o).FloatValue - : _unitConverter.FromPoint(((PdfNumber)o).FloatValue)).ToText( - ) - : (o.Type == PdfObject.NULL) ? Constants.Coordinates.Unchanged - : o.ToString(); - } - switch (m) { - case Constants.DestinationAttributes.ViewType.XYZ: - if (p.Length < 1) { - goto default; - } - target.WriteAttributeString(Constants.Coordinates.Left, p[0]); - if (p.Length > 1) { - target.WriteAttributeString(Constants.Coordinates.Top, p[1]); - } - if (p.Length > 2) { - target.WriteAttributeString(Constants.Coordinates.ScaleFactor, p[2]); - } - break; - case Constants.DestinationAttributes.ViewType.Fit: - case Constants.DestinationAttributes.ViewType.FitB: - break; - case Constants.DestinationAttributes.ViewType.FitBH: - case Constants.DestinationAttributes.ViewType.FitH: - if (p.Length < 1) { - goto default; - } - target.WriteAttributeString(Constants.Coordinates.Top, p[0]); - break; - case Constants.DestinationAttributes.ViewType.FitV: - case Constants.DestinationAttributes.ViewType.FitBV: - if (p.Length < 1) { - goto default; - } - target.WriteAttributeString(Constants.Coordinates.Left, p[0]); - break; - case Constants.DestinationAttributes.ViewType.FitR: - if (p.Length < 1) { - goto default; - } - target.WriteAttributeString(Constants.Coordinates.Left, p[0]); - if (p.Length > 1) { - target.WriteAttributeString(Constants.Coordinates.Bottom, p[1]); - } - if (p.Length > 2) { - target.WriteAttributeString(Constants.Coordinates.Right, p[2]); - } - if (p.Length > 3) { - target.WriteAttributeString(Constants.Coordinates.Top, p[3]); - } - break; - default: - System.Diagnostics.Trace.WriteLine("目标位置无效"); - break; - } - } - - private static int GetNumber(PdfIndirectReference indirect) { - var pdfObj = (PdfDictionary)PdfReader.GetPdfObjectRelease(indirect); - if (pdfObj == null) { - return 0; - } - if (pdfObj.Contains(PdfName.TYPE) - && PdfName.PAGES.Equals(pdfObj.GetAsName(PdfName.TYPE)) - && pdfObj.Contains(PdfName.KIDS)) { - var kids = (PdfArray)pdfObj.Get(PdfName.KIDS); - indirect = (PdfIndirectReference)kids[0]; - } - return indirect.Number; - } - - } -} diff --git a/pdfpatcher/App/Processor/PdfContentExport.cs b/pdfpatcher/App/Processor/PdfContentExport.cs deleted file mode 100644 index 9a12379d01f11b4536e4adc98b0d4e5c9f17c11b..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/PdfContentExport.cs +++ /dev/null @@ -1,694 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using System.Xml; -using iTextSharp.text.pdf; -using PDFPatcher.Common; -using PDFPatcher.Model; -using Matrix = iTextSharp.text.pdf.parser.Matrix; -using NameValuePair = System.Collections.Generic.KeyValuePair; - -namespace PDFPatcher.Processor -{ - sealed class PdfContentExport - { - readonly ExporterOptions _options; - readonly Dictionary _resolvedReferences = new Dictionary(); - readonly List _exportPath = new List(); - ImageExtractor _imageExporter; - - bool AddReferenceRecord(PdfIndirectReference r, string type) { - var k = String.Concat(r.Number, ' ', r.Generation); - if (_resolvedReferences.ContainsKey(k)) { - return false; - } - - _resolvedReferences.Add(k, type); - return true; - } - - - public PdfContentExport(ExporterOptions options) { - _options = options; - } - - internal void ExportTrailer(XmlWriter writer, PdfReader reader) { - Tracker.TraceMessage("导出文档总索引。"); - writer.WriteStartElement("Trailer"); - writer.WriteAttributeString(Constants.ContentPrefix, "http://www.w3.org/2000/xmlns/", Constants.ContentNamespace); - foreach (var item in reader.Trailer) { - if (PdfName.ROOT.Equals(item.Key) == false) { - ExportPdfDictionaryItem(item, writer); - } - } - ExportCatalog(writer, reader); - writer.WriteEndElement(); - } - - void ExportCatalog(XmlWriter writer, PdfReader reader) { - Tracker.TraceMessage("导出文档编录。"); - writer.WriteStartElement(Constants.Catalog); - writer.WriteAttributeString(Constants.ContentPrefix, "http://www.w3.org/2000/xmlns/", Constants.ContentNamespace); - foreach (var item in reader.Catalog) { - if (PdfName.OUTLINES.Equals(item.Key)) { - if (PdfReader.GetPdfObjectRelease(item.Value) is PdfDictionary o) { - ExportPdfOutline(o, writer); - } - } - else { - ExportPdfDictionaryItem(item, writer); - } - } - writer.WriteEndElement(); - } - - internal void ExportContents(XmlWriter writer, PdfReader reader) { - if (_options.ExtractImages) { - _imageExporter = new ImageExtractor(_options.Images, reader); - } - writer.WriteStartElement(Constants.Body); - writer.WriteAttributeString(Constants.ContentPrefix, "http://www.w3.org/2000/xmlns/", Constants.ContentNamespace); - - var ranges = PageRangeCollection.Parse(_options.ExtractPageRange, 1, reader.NumberOfPages, true); - ExtractPages(reader, ranges, writer); - writer.WriteEndElement(); - } - - void ExtractPages(PdfReader reader, PageRangeCollection ranges, XmlWriter writer) { - var p = new ExportProcessor(this, writer, _options); - foreach (PageRange r in ranges) { - foreach (var i in r) { - Tracker.TraceMessage(String.Concat("导出第 ", i, " 页。")); - ExtractPage(i, reader, writer, p); - Tracker.IncrementProgress(1); - } - } - } - - void ExportPdfOutline(PdfDictionary outline, XmlWriter writer) { - while (outline != null) { - writer.WriteStartElement(Constants.ContentPrefix, "Outline", Constants.ContentNamespace); - foreach (var i in outline) { - switch (i.Key.ToString()) { - case "/First": - case "/Last": - case "/Next": - case "/Parent": - case "/Prev": - continue; - default: - ExportPdfDictionaryItem(i, writer); - break; - } - } - if (PdfReader.GetPdfObjectRelease(outline.Get(PdfName.FIRST)) is PdfDictionary f) { - writer.WriteStartElement(Constants.ContentPrefix, "Outlines", Constants.ContentNamespace); - ExportPdfOutline(f, writer); - writer.WriteEndElement(); - } - writer.WriteEndElement(); - outline = PdfReader.GetPdfObjectRelease(outline.Get(PdfName.NEXT)) as PdfDictionary; - } - } - - /// - /// 导出 PDFDictionary。 - /// - /// - /// - void ExportPdfDictionary(XmlWriter writer, PdfDictionary dict) { - foreach (var item in dict) { - ExportPdfDictionaryItem(item, writer); - } - } - - void ExportPdfDictionaryItem(KeyValuePair item, XmlWriter writer) { - var key = PdfHelper.DecodeKeyName(item.Key); - var text = item.Value.ToString(); - var value = item.Value as PdfObject; - try { - writer.WriteStartElement(XmlConvert.VerifyNCName(key)); - } - catch (XmlException) { - writer.WriteStartElement(Constants.Content.Item, Constants.ContentNamespace); - writer.WriteAttributeString(Constants.Content.Name, Constants.ContentNamespace, key); - } - _exportPath.Add(key); - if (value == null) { - writer.WriteAttributeString(PdfHelper.GetTypeName(value.Type), text); - goto EndElement; - } - switch (value.Type) { - case PdfObject.ARRAY: - var a = value as PdfArray; - if (key == "ColorSpace" && PdfName.INDEXED.Equals(a.GetAsName(0)) && a.ArrayList.Count == 4) { - ExportColorSpaceContent(writer, a); - } - else { - ExportArray(a.ArrayList, writer); - } - break; - case PdfObject.STRING: - text = (value as PdfString).ToUnicodeString(); - if (text.StartsWith(" array, XmlWriter writer) { - writer.WriteStartElement(Constants.ContentPrefix, "array", Constants.ContentNamespace); - ExportArrayContent(array, writer, false); - writer.WriteEndElement(); - } - - void ExportArrayContent(List array, XmlWriter writer, bool writeStringBytes) { - int iType = PdfObject.NULL; - foreach (PdfObject i in array) { - if (iType == PdfObject.NULL) { - iType = i.Type; - } - else if (iType != i.Type) { - iType = PdfObject.NULL; - break; - } - } - if (ValueHelper.IsInCollection(iType, PdfObject.NAME, PdfObject.NUMBER, PdfObject.BOOLEAN)) { - writer.WriteAttributeString(Constants.Content.Type, PdfHelper.GetTypeName(iType)); - writer.WriteStartAttribute(Constants.Content.Value); - var l = array; - for (int i = 0; i < l.Count; i++) { - if (i > 0) { - writer.WriteString(" "); - } - writer.WriteString(l[i].ToString()); - } - writer.WriteEndAttribute(); - } - else { - foreach (PdfObject i in array) { - if (i is not PdfArray subArray) { - if (PdfHelper.GetTypeName(i.Type).Length > 0) { - writer.WriteStartElement(Constants.ContentPrefix, PdfHelper.GetTypeName(i.Type), Constants.ContentNamespace); - } -#if DEBUG - else { - writer.WriteElementString("literal", i.ToString()); - continue; - } -#endif - switch (i.Type) { - case PdfObject.INDIRECT: - ExportIndirectReference(i as PdfIndirectReference, writer, String.Empty); - break; - case PdfObject.DICTIONARY: - ExportPdfDictionary(writer, i as PdfDictionary); - break; - case PdfObject.STRING: - if (writeStringBytes) { - var bytes = (i as PdfString).GetBytes(); - var bl = bytes.Length; - if (bl > 0) { - int l = 2 * bl + ((bl + 1) >> 1) - 1; - var chArray = new char[l]; - int num = 0, bi = 0; - foreach (byte b in bytes) { - if ((bi % 2) == 0 && bi > 0) { - chArray[num++] = ' '; - } - chArray[num++] = "0123456789ABCDEF"[b >> 4]; - chArray[num++] = "0123456789ABCDEF"[b & 15]; - bi++; - } - writer.WriteAttributeString(Constants.Content.Type, "字节"); - writer.WriteAttributeString(Constants.Content.Value, new string(chArray)); - } - break; - } - goto default; - default: - writer.WriteAttributeString(Constants.Content.Value, PdfHelper.GetValidXmlString(i.ToString())); - break; - } - writer.WriteEndElement(); - } - else { - writer.WriteStartElement(Constants.ContentPrefix, "array", Constants.ContentNamespace); - ExportArrayContent(subArray.ArrayList, writer, writeStringBytes); - writer.WriteEndElement(); - } - } - } - } - - void ExportIndirectReference(PdfIndirectReference r, XmlWriter writer, string key) { - var i = PdfReader.GetPdfObjectRelease(r); - writer.WriteAttributeString(Constants.Content.ResourceID, Constants.ContentNamespace, r.ToString()); - if (AddReferenceRecord(r, key) == false || i == null) { - return; - } - switch (i.Type) { - case PdfObject.DICTIONARY: - var type = (i as PdfDictionary).GetAsName(PdfName.TYPE); - if (type != null) { - var n = PdfHelper.GetPdfNameString(type); - writer.WriteAttributeString(Constants.Content.RefType, Constants.ContentNamespace, n); - switch (n) { - case "Page": - case "Pages": - return; - default: - if (key == "Parent") { - return; - } - break; - } - } - ExportPdfDictionary(writer, i as PdfDictionary); - break; - case PdfObject.ARRAY: - ExportArray((i as PdfArray).ArrayList, writer); - break; - case PdfObject.STREAM: - var s = i as PdfStream; - ExportPdfDictionary(writer, i as PdfDictionary); - if (_imageExporter != null && PdfName.IMAGE.Equals((i as PdfDictionary).GetAsName(PdfName.SUBTYPE))) { - writer.WriteStartElement(Constants.ContentPrefix, "image", Constants.ContentNamespace); - var info = _imageExporter.InfoList.Find(ii => ii.InlineImage.PdfRef == r); - if (info != null) { - writer.WriteAttributeString(Constants.Content.Path, Path.GetFileName(info.FileName)); - } - writer.WriteEndElement(); - break; - } - ExportStreamContent(writer, s); - break; - default: - writer.WriteAttributeString(PdfHelper.GetTypeName(i.Type), Constants.ContentNamespace, i.ToString()); - break; - } - } - - void ExportStreamContent(XmlWriter writer, PdfStream s) { - if (s is not PRStream prs || writer is NullXmlWriter) { - return; - } - var key = _exportPath[_exportPath.Count - 1]; - writer.WriteStartElement(Constants.ContentPrefix, "stream", Constants.ContentNamespace); - byte[] bs; - bool isRaw = false; - try { - bs = PdfReader.GetStreamBytes(prs); - } - catch (IOException) { - bs = PdfReader.GetStreamBytesRaw(prs); - isRaw = true; - writer.WriteAttributeString(Constants.Content.Raw, Constants.Boolean.True); - } - if (isRaw == false) { - if (key == "Contents" || key == "ToUnicode" || PdfName.XOBJECT.Equals(s.GetAsName(PdfName.TYPE)) && PdfName.FORM.Equals(s.GetAsName(PdfName.SUBTYPE))) { - var sb = StringBuilderCache.Acquire(); - byte b; - int l = bs.Length; - int p1 = 0, p2 = 0; - for (int i = 0; i < l; i++) { - b = bs[i]; - if (b == 0x0A || b == 0x0D || i + 1 == l) { - p2 = i; - if (i > 2 && bs[i - 2] == 'T' && (bs[i - 1] == 'J' || bs[i - 1] == 'j')) { - // is a text operation - ExportStreamTextContent(bs, sb, p1, p2); - sb.AppendLine(); - } - else { - sb.Append(Encoding.ASCII.GetString(bs, p1, p2 - p1)); - sb.AppendLine(); - } - if (b == 0x0D && i + 1 < l && bs[i + 1] == 0x0A) { - i++; - } - p1 = i + 1; - } - } - - if (sb.Length == 0) { - if (l > 2 && bs[l - 2] == 'T' && (bs[l - 1] == 'J' || bs[l - 1] == 'j')) { - ExportStreamTextContent(bs, sb, 0, l); - } - else { - sb.Append(Encoding.Default.GetString(bs, p1, p2)); - } - } - writer.WriteCData(StringBuilderCache.GetStringAndRelease(sb)); - } - else if (key == "Metadata") { - using (var ms = new MemoryStream(bs)) - using (var sr = new StreamReader(ms, true)) { - // strip byte-order-marks - writer.WriteCData(sr.ReadToEnd().Replace("\uFFFE", "￾").Replace("\uFEFF", "")); - } - } - else { - ExportRawStreamContent(writer, bs); - } - } - else { - //_streamID++; - //string fileName = String.Concat (_options.ExtractImagePath, (_options.ExtractImagePath.EndsWith ("\\") ? String.Empty : "\\"), (_activePage != 0 ? _activePage.ToString () + "-" : String.Empty), _streamID, ".bin"); - //using (FileStream f = new FileStream (fileName, FileMode.Create)) { - // f.Write (bs, 0, bs.Length); - //} - //writer.WriteAttributeString ("path", Path.GetFileName (fileName)); - - ExportRawStreamContent(writer, bs); - } - writer.WriteEndElement(); - } - - void ExportRawStreamContent(XmlWriter writer, byte[] bs) { - writer.WriteAttributeString(Constants.Content.Length, bs.Length.ToText()); - if (_options.ExportBinaryStream == 0) { - writer.WriteBinHex(bs, 0, bs.Length); - } - else { - writer.WriteBinHex(bs, 0, bs.Length < _options.ExportBinaryStream ? bs.Length : _options.ExportBinaryStream); - if (bs.Length > _options.ExportBinaryStream) { - writer.WriteString("...."); - } - } - } - - static void ExportStreamTextContent(byte[] bs, StringBuilder sb, int p1, int p2) { - bool inText = false; - bool escape = false; - char ch; - int beginTextPosition = 0; - for (int c = p1; c < p2; c++) { - ch = (char)bs[c]; - switch (ch) { - case '\\': - if (escape) { - escape = false; - sb.Append(ch); - } - else { - escape = true; - } - continue; - case '(': - if (escape) { - sb.Append(ch); - escape = false; - } - else { - inText = true; - beginTextPosition = c; - sb.Append(ch); - } - continue; - case ')': - if (escape) { - escape = false; - } - else { - inText = false; - //sb.Append (Encoding.BigEndianUnicode.GetString (buffer, beginTextPosition + 1, c - 1 - beginTextPosition)); - } - sb.Append(ch); - continue; - default: - if (escape) { - escape = false; - } - if (inText == false) { - sb.Append(ch); - } - else { - sb.Append(((byte)ch).ToString("X2")); - } - break; - } - } - } - - internal void ExtractPage(PdfReader reader, XmlWriter writer, params int[] pageNumbers) { - var p = new ExportProcessor(this, writer, _options); - foreach (var pageNum in pageNumbers) { - ExtractPage(pageNum, reader, writer, p); - } - } - - void ExtractPage(int pageNum, PdfReader reader, XmlWriter writer, ExportProcessor exportProcessor) { - writer.WriteStartElement(Constants.Content.Page); - _exportPath.Add(Constants.Content.Page); - writer.WriteAttributeString(Constants.Content.PageNumber, pageNum.ToText()); - writer.WriteAttributeString(Constants.Content.ResourceID, reader.GetPageOrigRef(pageNum).ToString()); - _imageExporter?.ExtractPageImages(reader, pageNum); - - if (_options.ExtractPageDictionary) { - ExportPdfDictionary(writer, reader.GetPageNRelease(pageNum)); - } - if (_options.ExportContentOperators || _options.ExportDecodedText) { - if (_options.ExportContentOperators) { - writer.WriteStartElement(Constants.Content.Operators); - } - exportProcessor.Reset(); - exportProcessor.ProcessContent(reader.GetPageContent(pageNum), reader.GetPageNRelease(pageNum).GetAsDict(PdfName.RESOURCES)); - if (_options.ExportContentOperators) { - exportProcessor.End(); - writer.WriteEndElement(); - } - } - //if (_imageExporter != null && _imageExporter.InfoList.Count > 0) { - // writer.WriteStartElement ("images", Constants.ContentNamespace); - // foreach (var item in _imageExporter.InfoList) { - // writer.WriteStartElement ("image", Constants.ContentNamespace); - // writer.WriteAttributeString (Constants.Content.ResourceID, Constants.ContentNamespace, item.PdfRef.ToString ()); - // writer.WriteAttributeString ("位置", String.Concat (item.X, ", ", item.Y, ", ", item.Z)); - // writer.WriteEndElement (); - // } - // writer.WriteEndElement (); - //} - writer.WriteEndElement(); - _exportPath.RemoveAt(_exportPath.Count - 1); - } - - sealed class ExportProcessor : PdfContentStreamProcessor - { - readonly PdfContentExport _export; - readonly XmlWriter _writer; - readonly bool _writeOperators; - readonly List _textContainer; - readonly List _operands = new List(); - int _writerLevel; - float _textWidth; - - - public ExportProcessor(PdfContentExport export, XmlWriter writer, ExporterOptions options) { - _export = export; - _writer = writer; - _writeOperators = options.ExportContentOperators; - _textContainer = options.ExportDecodedText ? new List() : null; - PopulateOperators(); - RegisterContentOperator("TJ", new AccumulatedShowTextArray()); - } - - public void End() { - if (_writeOperators == false) { - return; - } - while (_writerLevel > 0) { - _writer.WriteEndElement(); - _writerLevel--; - } - } - - internal List TextInfoList => _textContainer; - protected override void DisplayPdfString(PdfString str) { - var gs = CurrentGraphicState; - var font = gs.Font; - float totalWidth = 0; - foreach (var c in font.DecodeText(str)) { - float w = font.GetWidth(c) / 1000.0f; - float wordSpacing = c == ' ' ? gs.WordSpacing : 0f; - totalWidth += (w * gs.FontSize + gs.CharacterSpacing + wordSpacing) * gs.HorizontalScaling; - } - - _textWidth = totalWidth; - } - - protected override void InvokeOperator(PdfLiteral oper, List operands) { - base.InvokeOperator(oper, operands); - string o, fn, t = null; - bool open = false; - bool hasDescriptiveOperands = false; - o = oper.ToString(); - PdfPageCommand.GetFriendlyCommandName(o, out fn); - _operands.Clear(); - switch (o) { - case "BDC": - case "BMC": - case "BT": - case "BX": - case "q": - open = true; - _writerLevel++; - goto default; - case "EMC": - case "ET": - case "EX": - case "Q": - if (_writerLevel > 0 && _writeOperators) { - _writer.WriteEndElement(); - _writerLevel--; - } - return; - case "TJ": - var array = (PdfArray)operands[0]; - using (var ms = new MemoryStream(array.Length)) { - foreach (PdfObject item in array.ArrayList) { - if (item.Type == PdfObject.STRING) { - ms.Write((item as PdfString).GetBytes(), 0, item.Length); - } - } - t = CurrentGraphicState.Font.DecodeText(new PdfString(ms.ToArray())); - } - AddTextInfo(t); - _operands.Add(new NameValuePair(Constants.Content.OperandNames.Text, t)); - goto default; - case "Tj": - case "'": - case "\"": - t = CurrentGraphicState.Font.DecodeText(operands[0] as PdfString); - AddTextInfo(t); - _operands.Add(new NameValuePair(Constants.Content.OperandNames.Text, t)); - goto default; - case "Tf": - _operands.Add(new NameValuePair(Constants.Font.ThisName, CurrentGraphicState.Font.FontName)); - _operands.Add(new NameValuePair(Constants.Content.OperandNames.ResourceName, operands[0].ToString())); - _operands.Add(new NameValuePair(Constants.Content.OperandNames.Size, operands[1].ToString())); - hasDescriptiveOperands = true; - goto default; - case "cm": - case "Tm": - _operands.Add(new NameValuePair(Constants.Content.Operands, GetOperandsTextValue(operands))); - hasDescriptiveOperands = true; - goto default; - case "BI": - //case "EI": - goto default; - default: - if (_writeOperators == false) { - return; - } - _writer.WriteStartElement(fn ?? "未知操作符"); - _writer.WriteAttributeString("name", o); - foreach (var item in _operands) { - _writer.WriteAttributeString(item.Key, PdfHelper.GetValidXmlString(item.Value)); - } - break; - } - if (hasDescriptiveOperands == false) { - if (operands.Count > 0) { - // 删除操作符 - operands.RemoveAt(operands.Count - 1); - } - if (operands.Count > 0) { - _writer.WriteStartElement(Constants.Content.Operands); - _export.ExportArrayContent(operands, _writer, true); - _writer.WriteEndElement(); - if (o == "BI") { - _writer.WriteStartElement(Constants.Content.Raw); - _export.ExportRawStreamContent(_writer, (operands[0] as PdfImageData).RawBytes); - _writer.WriteEndElement(); - } - } - } - if (open == false && _writerLevel >= 0) { - _writer.WriteEndElement(); - } - } - - static string GetOperandsTextValue(List operands) { - operands.RemoveAt(operands.Count - 1); - return String.Join(" ", operands.ConvertAll((po) => po.Type == PdfObject.NUMBER ? ((PdfNumber)po).DoubleValue.ToText() : null).ToArray()); - } - - void AddTextInfo(string t) { - if (_textContainer != null && t != null) { - _textContainer.Add(new TextInfo() { - Text = t, - Size = CurrentGraphicState.FontSize * TextMatrix[Matrix.I11], - Region = new Bound(TextMatrix[Matrix.I31], TextMatrix[Matrix.I32], TextMatrix[Matrix.I31] + _textWidth, 0), - // note 不要设置该属性,否则可能在文档具有大量字体时占用过高的内存 - //Font = CurrentGraphicState.Font - }); - } - } - } - - } -} diff --git a/pdfpatcher/App/Processor/PdfContentStreamParser.cs b/pdfpatcher/App/Processor/PdfContentStreamParser.cs deleted file mode 100644 index d01b46769301eabe9fb0cdaf2c51147232b63197..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/PdfContentStreamParser.cs +++ /dev/null @@ -1,962 +0,0 @@ -using System; -using System.Collections.Generic; -using iTextSharp.text.error_messages; -using iTextSharp.text.pdf; -using iTextSharp.text.pdf.parser; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - internal class PdfContentStreamProcessor - { - // Fields - readonly Stack gsStack = new Stack(); - readonly Stack markedContentStack = new Stack(); - readonly IDictionary operators = new Dictionary(); - readonly Dictionary _XObjectDoHandlers = new Dictionary(); - readonly Dictionary _FontCache = new Dictionary(); - readonly Dictionary _FontNameCache = new Dictionary(); - //IRenderListener renderListener; - ResourceDictionary _Resources; - Matrix _TextLineMatrix; - Matrix _TextMatrix; - public readonly static IContentOperator NopOperator = new IgnoreOperatorContentOperator(); - - internal PdfContentStreamProcessor() { - Reset(); - } - - // Methods - internal Model.GraphicsState CurrentGraphicState => gsStack.Peek(); - internal Matrix TextMatrix => _TextMatrix; - internal IContentOperator DefaultOperator { get; set; } - protected IDictionary Fonts => _FontNameCache; - protected ResourceDictionary Resource => _Resources; - - protected void ApplyTextAdjust(float tj) { - float adjustBy = -tj / 1000f * CurrentGraphicState.FontSize * CurrentGraphicState.HorizontalScaling; - _TextMatrix = new Matrix(adjustBy, 0f).Multiply(_TextMatrix); - } - - protected void AdjustTextMatrixX(float x) { - _TextMatrix = new Matrix(x, 0f).Multiply(_TextMatrix); - } - - protected void BeginMarkedContent(PdfName tag, PdfDictionary dict) { - markedContentStack.Push(new MarkedContentInfo(tag, dict)); - } - - private void BeginText() { - //this.renderListener.BeginTextBlock (); - } - private FontInfo GetFont(PRIndirectReference fontRef) { - if (_FontCache.TryGetValue(fontRef.Number, out var r)) { - r.Access++; - return r.Info; - } - var f = new FontInfo(fontRef); - _FontCache.Add(fontRef.Number, new FontInfoCache(f)); - _FontNameCache.Add(fontRef.Number, f.FontName); - if (_FontCache.Count > 53) { - var l = new List>(_FontCache); - l.Sort((x, y) => x.Value.Access - y.Value.Access); - for (int i = 0; i < 10; i++) { - int k = l[i].Key; - _FontCache.Remove(k); - _FontNameCache.Remove(k); - } - } - return f; - } - - protected virtual void DisplayPdfString(PdfString str) { - //TextRenderInfo renderInfo = new TextRenderInfo (this.Decode (str), this.CurrentGraphicState, this.textMatrix, this.markedContentStack); - //this.renderListener.RenderText (renderInfo); - //this.textMatrix = new Matrix (renderInfo.GetUnscaledWidth (), 0f).Multiply (this.textMatrix); - } - - protected virtual void DisplayXObject(PdfName xobjectName) { - //IXObjectDoHandler handler; - //PdfDictionary xobjects = this.resources.GetAsDict (PdfName.XOBJECT); - //PdfObject xobject = xobjects.GetDirectObject (xobjectName); - //PdfStream xobjectStream = (PdfStream)xobject; - //PdfName subType = xobjectStream.GetAsName (PdfName.SUBTYPE); - //if (!xobject.IsStream ()) { - // throw new InvalidOperationException (MessageLocalization.GetComposedMessage ("XObject.1.is.not.a.stream", xobjectName)); - //} - //this.xobjectDoHandlers.TryGetValue (subType, out handler); - //if (handler == null) { - // handler = this.xobjectDoHandlers[PdfName.DEFAULT]; - //} - //handler.HandleXObject (this, xobjectStream, xobjects.GetAsIndirectObject (xobjectName)); - } - - private void EndMarkedContent() { - markedContentStack.Pop(); - } - - private void EndText() { - //this.renderListener.EndTextBlock (); - } - - protected virtual void InvokeOperator(PdfLiteral oper, List operands) { - IContentOperator op; - if (operators.TryGetValue(oper.ToString(), out op)) { - op.Invoke(this, oper, operands); - } - else { - DefaultOperator?.Invoke(this, oper, operands); - } - } - - protected void PopulateOperators() { - RegisterContentOperator("q", new PushGraphicsState()); - RegisterContentOperator("Q", new PopGraphicsState()); - RegisterContentOperator("cm", new ModifyCurrentTransformationMatrix()); - RegisterContentOperator("gs", new ProcessGraphicsStateResource()); - var tcOperator = new SetTextCharacterSpacing(); - RegisterContentOperator("Tc", tcOperator); - var twOperator = new SetTextWordSpacing(); - RegisterContentOperator("Tw", twOperator); - RegisterContentOperator("Tz", new SetTextHorizontalScaling()); - var tlOperator = new SetTextLeading(); - RegisterContentOperator("TL", tlOperator); - RegisterContentOperator("Tf", new SetTextFont()); - RegisterContentOperator("Tr", new SetTextRenderMode()); - RegisterContentOperator("Ts", new SetTextRise()); - RegisterContentOperator("BT", new BeginTextC()); - RegisterContentOperator("ET", new EndTextC()); - RegisterContentOperator("BMC", new BeginMarkedContentC()); - RegisterContentOperator("BDC", new BeginMarkedContentDictionary()); - RegisterContentOperator("EMC", new EndMarkedContentC()); - var tdOperator = new TextMoveStartNextLine(); - RegisterContentOperator("Td", tdOperator); - RegisterContentOperator("TD", new TextMoveStartNextLineWithLeading(tdOperator, tlOperator)); - RegisterContentOperator("Tm", new TextSetTextMatrix()); - var tstarOperator = new TextMoveNextLine(tdOperator); - RegisterContentOperator("T*", tstarOperator); - var tjOperator = new ShowText(); - RegisterContentOperator("Tj", new ShowText()); - RegisterContentOperator("TJ", new ShowTextArray()); - var tickOperator = new MoveNextLineAndShowText(tstarOperator, tjOperator); - RegisterContentOperator("'", tickOperator); - RegisterContentOperator("\"", new MoveNextLineAndShowTextWithSpacing(twOperator, tcOperator, tickOperator)); - RegisterContentOperator("Do", new Do()); - } - - protected void PopulateXObjectDoHandlers() { - RegisterXObjectDoHandler(PdfName.DEFAULT, new IgnoreXObjectDoHandler()); - RegisterXObjectDoHandler(PdfName.FORM, new FormXObjectDoHandler()); - RegisterXObjectDoHandler(PdfName.IMAGE, new ImageXObjectDoHandler()); - } - - public void ProcessContent(byte[] contentBytes, PdfDictionary resources) { - _Resources.Push(resources); - var tokenizer = new PRTokeniser(new RandomAccessFileOrArray(contentBytes)); - var ps = new PdfContentParser(tokenizer); - var operands = new List(); - while (ps.Parse(operands).Count > 0) { - var oper = (PdfLiteral)operands[operands.Count - 1]; - if ("BI".Equals(oper.ToString())) { - var img = InlineImageUtils.ParseInlineImage(ps, resources.GetAsDict(PdfName.COLORSPACE)); - InvokeOperator(oper, new List { img, oper }); - // this.renderListener.RenderImage (renderInfo); - } - else { - InvokeOperator(oper, operands); - } - } - tokenizer.Close(); - _Resources.Pop(); - } - - internal IContentOperator RegisterContentOperator(string operatorString, IContentOperator oper) { - if (oper == null) { - operators.Remove(operatorString); - return null; - } - return operators[operatorString] = oper; - } - - internal IXObjectDoHandler RegisterXObjectDoHandler(PdfName xobjectSubType, IXObjectDoHandler handler) { - IXObjectDoHandler old; - _XObjectDoHandlers.TryGetValue(xobjectSubType, out old); - _XObjectDoHandlers[xobjectSubType] = handler; - return old; - } - - internal virtual void Reset() { - gsStack.Clear(); - gsStack.Push(new Model.GraphicsState()); - _TextMatrix = null; - _TextLineMatrix = null; - _Resources = new ResourceDictionary(); - } - - #region Nested Types - internal interface IContentOperator - { - void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands); - } - internal interface IXObjectDoHandler - { - void HandleXObject(PdfContentStreamProcessor processor, PdfStream stream, PdfIndirectReference refi); - } - - protected sealed class BeginMarkedContentC : IContentOperator - { - // Methods - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - processor.BeginMarkedContent((PdfName)operands[0], new PdfDictionary()); - } - } - - protected sealed class BeginMarkedContentDictionary : IContentOperator - { - // Methods - private PdfDictionary GetPropertiesDictionary(PdfObject operand1, PdfContentStreamProcessor.ResourceDictionary resources) { - if (operand1.IsDictionary()) { - return (PdfDictionary)operand1; - } - var dictionaryName = (PdfName)operand1; - return resources.GetAsDict(dictionaryName); - } - - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - var properties = operands[1]; - processor.BeginMarkedContent((PdfName)operands[0], GetPropertiesDictionary(properties, processor._Resources)); - } - } - - protected sealed class BeginTextC : IContentOperator - { - // Methods - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - processor._TextMatrix = new Matrix(); - processor._TextLineMatrix = processor._TextMatrix; - processor.BeginText(); - } - } - - protected sealed class Do : IContentOperator - { - // Methods - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - var xobjectName = (PdfName)operands[0]; - processor.DisplayXObject(xobjectName); - } - } - - protected sealed class EndMarkedContentC : IContentOperator - { - // Methods - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - processor.EndMarkedContent(); - } - } - - protected sealed class EndTextC : IContentOperator - { - // Methods - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - processor._TextMatrix = null; - processor._TextLineMatrix = null; - processor.EndText(); - } - } - - protected sealed class FormXObjectDoHandler : IXObjectDoHandler - { - // Methods - public void HandleXObject(PdfContentStreamProcessor processor, PdfStream stream, PdfIndirectReference refi) { - var resources = stream.GetAsDict(PdfName.RESOURCES); - var contentBytes = ContentByteUtils.GetContentBytesFromContentObject(stream); - var matrix = stream.GetAsArray(PdfName.MATRIX); - new PdfContentStreamProcessor.PushGraphicsState().Invoke(processor, null, null); - if (matrix != null) { - float a = matrix.GetAsNumber(0).FloatValue; - float b = matrix.GetAsNumber(1).FloatValue; - float c = matrix.GetAsNumber(2).FloatValue; - float d = matrix.GetAsNumber(3).FloatValue; - float e = matrix.GetAsNumber(4).FloatValue; - float f = matrix.GetAsNumber(5).FloatValue; - processor.CurrentGraphicState.TransMatrix = new Matrix(a, b, c, d, e, f).Multiply(processor.CurrentGraphicState.TransMatrix); - } - processor.ProcessContent(contentBytes, resources); - new PdfContentStreamProcessor.PopGraphicsState().Invoke(processor, null, null); - } - } - - protected sealed class IgnoreOperatorContentOperator : IContentOperator - { - // Methods - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - } - } - - protected sealed class IgnoreXObjectDoHandler : IXObjectDoHandler - { - // Methods - public void HandleXObject(PdfContentStreamProcessor processor, PdfStream xobjectStream, PdfIndirectReference refi) { - } - } - - protected sealed class ImageXObjectDoHandler : IXObjectDoHandler - { - // Methods - public void HandleXObject(PdfContentStreamProcessor processor, PdfStream xobjectStream, PdfIndirectReference refi) { - //ImageRenderInfo renderInfo = ImageRenderInfo.CreateForXObject (processor.CurrentGraphicState.TransMatrix, refi); - //processor.renderListener.RenderImage (renderInfo); - } - } - - protected sealed class ModifyCurrentTransformationMatrix : IContentOperator - { - // Methods - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - float a = ((PdfNumber)operands[0]).FloatValue; - float b = ((PdfNumber)operands[1]).FloatValue; - float c = ((PdfNumber)operands[2]).FloatValue; - float d = ((PdfNumber)operands[3]).FloatValue; - float e = ((PdfNumber)operands[4]).FloatValue; - float f = ((PdfNumber)operands[5]).FloatValue; - var matrix = new Matrix(a, b, c, d, e, f); - var gs = processor.gsStack.Peek(); - gs.TransMatrix = matrix.Multiply(gs.TransMatrix); - } - } - - protected sealed class MoveNextLineAndShowText : IContentOperator - { - // Fields - private readonly IContentOperator showText; - private readonly IContentOperator textMoveNextLine; - - // Methods - public MoveNextLineAndShowText(IContentOperator textMoveNextLine, IContentOperator showText) { - this.textMoveNextLine = textMoveNextLine; - this.showText = showText; - } - - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - textMoveNextLine.Invoke(processor, null, new List(0)); - showText.Invoke(processor, null, operands); - } - } - - protected sealed class MoveNextLineAndShowTextWithSpacing : IContentOperator - { - // Fields - private readonly IContentOperator moveNextLineAndShowText; - private readonly IContentOperator setTextCharacterSpacing; - private readonly IContentOperator setTextWordSpacing; - - // Methods - public MoveNextLineAndShowTextWithSpacing(IContentOperator setTextWordSpacing, IContentOperator setTextCharacterSpacing, IContentOperator moveNextLineAndShowText) { - this.setTextWordSpacing = setTextWordSpacing; - this.setTextCharacterSpacing = setTextCharacterSpacing; - this.moveNextLineAndShowText = moveNextLineAndShowText; - } - - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - var aw = (PdfNumber)operands[0]; - var ac = (PdfNumber)operands[1]; - var str = (PdfString)operands[2]; - var twOperands = new List(1); - twOperands.Insert(0, aw); - setTextWordSpacing.Invoke(processor, null, twOperands); - var tcOperands = new List(1); - tcOperands.Insert(0, ac); - setTextCharacterSpacing.Invoke(processor, null, tcOperands); - var tickOperands = new List(1); - tickOperands.Insert(0, str); - moveNextLineAndShowText.Invoke(processor, null, tickOperands); - } - } - - protected sealed class PopGraphicsState : IContentOperator - { - // Methods - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - try { - processor.gsStack.Pop(); - } - catch (InvalidOperationException) { - Tracker.DebugMessage("绘图状态堆栈为空。"); - } - } - } - - protected sealed class ProcessGraphicsStateResource : IContentOperator - { - // Methods - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - var dictionaryName = (PdfName)operands[0]; - var extGState = processor._Resources.GetAsDict(PdfName.EXTGSTATE); - if (extGState == null) { - throw new ArgumentException(MessageLocalization.GetComposedMessage("resources.do.not.contain.extgstate.entry.unable.to.process.oper.1", oper)); - } - var gsDic = extGState.GetAsDict(dictionaryName); - if (gsDic == null) { - throw new ArgumentException(MessageLocalization.GetComposedMessage("1.is.an.unknown.graphics.state.dictionary", dictionaryName)); - } - var fontParameter = gsDic.GetAsArray(PdfName.FONT); - if (fontParameter != null) { - var font = processor.GetFont((PRIndirectReference)fontParameter[0]); - float size = fontParameter.GetAsNumber(1).FloatValue; - processor.CurrentGraphicState.Font = font; - processor.CurrentGraphicState.FontSize = size; - } - } - } - - protected sealed class PushGraphicsState : IContentOperator - { - // Methods - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - processor.gsStack.Push(processor.gsStack.Peek().Copy()); - } - } - - protected sealed class ResourceDictionary : PdfDictionary - { - // Fields - private readonly IList resourcesStack = new List(); - - // Methods - public override PdfObject GetDirectObject(PdfName key) { - for (int i = resourcesStack.Count - 1; i >= 0; i--) { - var subResource = resourcesStack[i]; - if (subResource != null) { - var obj = subResource.GetDirectObject(key); - if (obj != null) { - return obj; - } - } - } - return base.GetDirectObject(key); - } - - public void Pop() { - resourcesStack.RemoveAt(resourcesStack.Count - 1); - } - - public void Push(PdfDictionary resources) { - resourcesStack.Add(resources); - } - } - - protected sealed class SetTextCharacterSpacing : IContentOperator - { - // Methods - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - var charSpace = (PdfNumber)operands[0]; - processor.CurrentGraphicState.CharacterSpacing = charSpace.FloatValue; - } - } - - protected sealed class SetTextFont : IContentOperator - { - // Methods - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - var fontResourceName = (PdfName)operands[0]; - float size = ((PdfNumber)operands[1]).FloatValue; - var f = processor._Resources.GetAsDict(PdfName.FONT).Get(fontResourceName); - var g = processor.CurrentGraphicState; - if (f is PRIndirectReference fref) { - var font = processor.GetFont(fref); - g.FontID = fref.Number; - g.Font = font; - } - else { - Tracker.DebugMessage("字体(" + fontResourceName + ")不为引用。"); - var fd = f as PdfDictionary; - g.FontID = 0; - g.Font = new FontInfo(fd, 0); - } - g.FontSize = size; - } - } - - protected sealed class SetTextHorizontalScaling : IContentOperator - { - // Methods - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - var scale = (PdfNumber)operands[0]; - processor.CurrentGraphicState.HorizontalScaling = scale.FloatValue / 100f; - } - } - - protected sealed class SetTextLeading : IContentOperator - { - // Methods - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - var leading = (PdfNumber)operands[0]; - processor.CurrentGraphicState.Leading = leading.FloatValue; - } - } - - protected sealed class SetTextRenderMode : IContentOperator - { - // Methods - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - var render = (PdfNumber)operands[0]; - processor.CurrentGraphicState.RenderMode = render.IntValue; - } - } - - protected sealed class SetTextRise : IContentOperator - { - // Methods - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - var rise = (PdfNumber)operands[0]; - processor.CurrentGraphicState.Rise = rise.FloatValue; - } - } - - protected sealed class SetTextWordSpacing : IContentOperator - { - // Methods - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - var wordSpace = (PdfNumber)operands[0]; - processor.CurrentGraphicState.WordSpacing = wordSpace.FloatValue; - } - } - - protected sealed class ShowText : IContentOperator - { - // Methods - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - var str = (PdfString)operands[0]; - processor.DisplayPdfString(str); - } - } - - protected sealed class AccumulatedShowTextArray : IContentOperator - { - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - var array = (PdfArray)operands[0]; - float adj = 0; - using (var ms = new System.IO.MemoryStream(array.Length)) { - foreach (PdfObject item in array.ArrayList) { - if (item.Type == PdfObject.STRING) { - ms.Write((item as PdfString).GetBytes(), 0, item.Length); - } - else { - adj += ((PdfNumber)item).FloatValue; - } - } - processor.DisplayPdfString(new PdfString(ms.ToArray())); - } - processor.ApplyTextAdjust(adj); - } - } - - protected sealed class ShowTextArray : IContentOperator - { - // Methods - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - var array = (PdfArray)operands[0]; - //using (var ms = new System.IO.MemoryStream (array.Length)) { - // foreach (PdfObject item in array.ArrayList) { - // if (item.Type == PdfObject.STRING) { - // ms.Write ((item as PdfString).GetBytes (), 0, item.Length); - // } - // else { - // processor.ApplyTextAdjust (((PdfNumber)item).FloatValue); - // } - // } - // processor.DisplayPdfString (new PdfString (ms.ToArray ())); - //} - - float tj = 0f; - foreach (PdfObject entryObj in array.ArrayList) { - if (entryObj is PdfString) { - processor.DisplayPdfString((PdfString)entryObj); - tj = 0f; - } - else { - tj = ((PdfNumber)entryObj).FloatValue; - processor.ApplyTextAdjust(tj); - } - } - } - } - - protected sealed class TextMoveNextLine : IContentOperator - { - // Fields - private readonly TextMoveStartNextLine moveStartNextLine; - - // Methods - public TextMoveNextLine(TextMoveStartNextLine moveStartNextLine) { - this.moveStartNextLine = moveStartNextLine; - } - - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - var tdoperands = new List(2); - tdoperands.Insert(0, new PdfNumber(0)); - tdoperands.Insert(1, new PdfNumber(-processor.CurrentGraphicState.Leading)); - moveStartNextLine.Invoke(processor, null, tdoperands); - } - } - - protected sealed class TextMoveStartNextLine : IContentOperator - { - // Methods - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - float tx = ((PdfNumber)operands[0]).FloatValue; - float ty = ((PdfNumber)operands[1]).FloatValue; - processor._TextMatrix = new Matrix(tx, ty).Multiply(processor._TextLineMatrix); - processor._TextLineMatrix = processor._TextMatrix; - } - } - - protected sealed class TextMoveStartNextLineWithLeading : IContentOperator - { - // Fields - private readonly TextMoveStartNextLine moveStartNextLine; - private readonly SetTextLeading setTextLeading; - - // Methods - public TextMoveStartNextLineWithLeading(TextMoveStartNextLine moveStartNextLine, SetTextLeading setTextLeading) { - this.moveStartNextLine = moveStartNextLine; - this.setTextLeading = setTextLeading; - } - - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - float ty = ((PdfNumber)operands[1]).FloatValue; - var tlOperands = new List(1); - tlOperands.Insert(0, new PdfNumber(-ty)); - setTextLeading.Invoke(processor, null, tlOperands); - moveStartNextLine.Invoke(processor, null, operands); - } - } - - protected sealed class TextSetTextMatrix : IContentOperator - { - // Methods - public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List operands) { - float a = ((PdfNumber)operands[0]).FloatValue; - float b = ((PdfNumber)operands[1]).FloatValue; - float c = ((PdfNumber)operands[2]).FloatValue; - float d = ((PdfNumber)operands[3]).FloatValue; - float e = ((PdfNumber)operands[4]).FloatValue; - float f = ((PdfNumber)operands[5]).FloatValue; - processor._TextLineMatrix = new Matrix(a, b, c, d, e, f); - processor._TextMatrix = processor._TextLineMatrix; - } - } - - #endregion - - internal static class InlineImageUtils - { - /** - * Simple class in case users need to differentiate an exception from processing - * inline images vs other exceptions - * @since 5.0.4 - */ - public sealed class InlineImageParseException : System.IO.IOException - { - public InlineImageParseException(String message) - : base(message) { - } - } - - /** - * Map between key abbreviations allowed in dictionary of inline images and their - * equivalent image dictionary keys - */ - private static readonly IDictionary inlineImageEntryAbbreviationMap; - /** - * Map between value abbreviations allowed in dictionary of inline images for COLORSPACE - */ - private static readonly IDictionary inlineImageColorSpaceAbbreviationMap; - /** - * Map between value abbreviations allowed in dictionary of inline images for FILTER - */ - private static readonly IDictionary inlineImageFilterAbbreviationMap; - static InlineImageUtils() { // static initializer - inlineImageEntryAbbreviationMap = new Dictionary { - - // allowed entries - just pass these through - [PdfName.BITSPERCOMPONENT] = PdfName.BITSPERCOMPONENT, - [PdfName.COLORSPACE] = PdfName.COLORSPACE, - [PdfName.DECODE] = PdfName.DECODE, - [PdfName.DECODEPARMS] = PdfName.DECODEPARMS, - [PdfName.FILTER] = PdfName.FILTER, - [PdfName.HEIGHT] = PdfName.HEIGHT, - [PdfName.IMAGEMASK] = PdfName.IMAGEMASK, - [PdfName.INTENT] = PdfName.INTENT, - [PdfName.INTERPOLATE] = PdfName.INTERPOLATE, - [PdfName.WIDTH] = PdfName.WIDTH, - - // abbreviations - transform these to corresponding correct values - [new PdfName("BPC")] = PdfName.BITSPERCOMPONENT, - [new PdfName("CS")] = PdfName.COLORSPACE, - [new PdfName("D")] = PdfName.DECODE, - [new PdfName("DP")] = PdfName.DECODEPARMS, - [new PdfName("F")] = PdfName.FILTER, - [new PdfName("H")] = PdfName.HEIGHT, - [new PdfName("IM")] = PdfName.IMAGEMASK, - [new PdfName("I")] = PdfName.INTERPOLATE, - [new PdfName("W")] = PdfName.WIDTH - }; - - inlineImageColorSpaceAbbreviationMap = new Dictionary { - [new PdfName("G")] = PdfName.DEVICEGRAY, - [new PdfName("RGB")] = PdfName.DEVICERGB, - [new PdfName("CMYK")] = PdfName.DEVICECMYK, - [new PdfName("I")] = PdfName.INDEXED - }; - - inlineImageFilterAbbreviationMap = new Dictionary { - [new PdfName("AHx")] = PdfName.ASCIIHEXDECODE, - [new PdfName("A85")] = PdfName.ASCII85DECODE, - [new PdfName("LZW")] = PdfName.LZWDECODE, - [new PdfName("Fl")] = PdfName.FLATEDECODE, - [new PdfName("RL")] = PdfName.RUNLENGTHDECODE, - [new PdfName("CCF")] = PdfName.CCITTFAXDECODE, - [new PdfName("DCT")] = PdfName.DCTDECODE - }; - } - - /** - * Parses an inline image from the provided content parser. The parser must be positioned immediately following the BI operator in the content stream. - * The parser will be left with current position immediately following the EI operator that terminates the inline image - * @param ps the content parser to use for reading the image. - * @return the parsed image - * @throws IOException if anything goes wring with the parsing - * @throws InlineImageParseException if parsing of the inline image failed due to issues specific to inline image processing - */ - public static PdfImageData ParseInlineImage(PdfContentParser ps, PdfDictionary colorSpaceDic) { - var d = ParseInlineImageDictionary(ps); - return new PdfImageData(d, ParseInlineImageSamples(d, colorSpaceDic, ps)); - } - - /** - * Parses the next inline image dictionary from the parser. The parser must be positioned immediately following the EI operator. - * The parser will be left with position immediately following the whitespace character that follows the ID operator that ends the inline image dictionary. - * @param ps the parser to extract the embedded image information from - * @return the dictionary for the inline image, with any abbreviations converted to regular image dictionary keys and values - * @throws IOException if the parse fails - */ - private static PdfDictionary ParseInlineImageDictionary(PdfContentParser ps) { - // by the time we get to here, we have already parsed the BI operator - var dictionary = new PdfDictionary(); - - for (PdfObject key = ps.ReadPRObject(); key != null && !"ID".Equals(key.ToString()); key = ps.ReadPRObject()) { - var value = ps.ReadPRObject(); - - PdfName resolvedKey; - inlineImageEntryAbbreviationMap.TryGetValue((PdfName)key, out resolvedKey); - if (resolvedKey == null) - resolvedKey = (PdfName)key; - - dictionary.Put(resolvedKey, GetAlternateValue(resolvedKey, value)); - } - - int ch = ps.GetTokeniser().Read(); - if (!PRTokeniser.IsWhitespace(ch)) - throw new System.IO.IOException("Unexpected character " + ch + " found after ID in inline image"); - - return dictionary; - } - - /** - * Transforms value abbreviations into their corresponding real value - * @param key the key that the value is for - * @param value the value that might be an abbreviation - * @return if value is an allowed abbreviation for the key, the expanded value for that abbreviation. Otherwise, value is returned without modification - */ - private static PdfObject GetAlternateValue(PdfName key, PdfObject value) { - if (key == PdfName.FILTER) { - if (value is PdfName pdfName - && inlineImageFilterAbbreviationMap.TryGetValue(pdfName, out PdfName altValue) - && altValue != null) { - return altValue; - } - else if (value is PdfArray array) { - var altArray = new PdfArray(); - int count = array.Size; - for (int i = 0; i < count; i++) { - altArray.Add(GetAlternateValue(key, array[i])); - } - return altArray; - } - } - else if (key == PdfName.COLORSPACE) { - if (value is PdfName pdfName - && inlineImageColorSpaceAbbreviationMap.TryGetValue(pdfName, out PdfName altValue) - && altValue != null) { - return altValue; - } - } - - return value; - } - - /** - * @param colorSpaceName the name of the color space. If null, a bi-tonal (black and white) color space is assumed. - * @return the components per pixel for the specified color space - */ - private static int GetComponentsPerPixel(PdfName colorSpaceName, PdfDictionary colorSpaceDic) { - if (colorSpaceName == null) - return 1; - if (colorSpaceName.Equals(PdfName.DEVICEGRAY)) - return 1; - if (colorSpaceName.Equals(PdfName.DEVICERGB)) - return 3; - if (colorSpaceName.Equals(PdfName.DEVICECMYK)) - return 4; - - if (colorSpaceDic != null) { - var colorSpace = colorSpaceDic.GetAsArray(colorSpaceName); - if (colorSpace != null && PdfName.INDEXED.Equals(colorSpace.GetAsName(0))) { - return 1; - } - } - - throw new ArgumentException("Unexpected color space " + colorSpaceName); - } - - /** - * Computes the number of unfiltered bytes that each row of the image will contain. - * If the number of bytes results in a partial terminating byte, this number is rounded up - * per the PDF specification - * @param imageDictionary the dictionary of the inline image - * @return the number of bytes per row of the image - */ - private static int ComputeBytesPerRow(PdfDictionary imageDictionary, PdfDictionary colorSpaceDic) { - var wObj = imageDictionary.GetAsNumber(PdfName.WIDTH); - var bpcObj = imageDictionary.GetAsNumber(PdfName.BITSPERCOMPONENT); - int cpp = GetComponentsPerPixel(imageDictionary.GetAsName(PdfName.COLORSPACE), colorSpaceDic); - int w = wObj.IntValue; - int bpc = bpcObj?.IntValue ?? 1; - return (w * bpc * cpp + 7) / 8; - } - - /** - * Parses the samples of the image from the underlying content parser, ignoring all filters. - * The parser must be positioned immediately after the ID operator that ends the inline image's dictionary. - * The parser will be left positioned immediately following the EI operator. - * This is primarily useful if no filters have been applied. - * @param imageDictionary the dictionary of the inline image - * @param ps the content parser - * @return the samples of the image - * @throws IOException if anything bad happens during parsing - */ - private static byte[] ParseUnfilteredSamples(PdfDictionary imageDictionary, PdfDictionary colorSpaceDic, PdfContentParser ps) { - // special case: when no filter is specified, we just read the number of bits - // per component, multiplied by the width and height. - if (imageDictionary.Contains(PdfName.FILTER)) - throw new ArgumentException("Dictionary contains filters"); - - var h = imageDictionary.GetAsNumber(PdfName.HEIGHT); - - int bytesToRead = ComputeBytesPerRow(imageDictionary, colorSpaceDic) * h.IntValue; - var bytes = new byte[bytesToRead]; - var tokeniser = ps.GetTokeniser(); - - int shouldBeWhiteSpace = tokeniser.Read(); // skip next character (which better be a whitespace character - I suppose we could check for this) - // from the PDF spec: Unless the image uses ASCIIHexDecode or ASCII85Decode as one of its filters, the ID operator shall be followed by a single white-space character, and the next character shall be interpreted as the first byte of image data. - // unfortunately, we've seen some PDFs where there is no space following the ID, so we have to capture this case and handle it - int startIndex = 0; - if (!PRTokeniser.IsWhitespace(shouldBeWhiteSpace) || shouldBeWhiteSpace == 0) { - bytes[0] = (byte)shouldBeWhiteSpace; - startIndex++; - } - for (int i = startIndex; i < bytesToRead; i++) { - int ch = tokeniser.Read(); - if (ch == -1) - throw new InlineImageParseException("End of content stream reached before end of image data"); - - bytes[i] = (byte)ch; - } - var ei = ps.ReadPRObject(); - if (!ei.ToString().Equals("EI")) - throw new InlineImageParseException("EI not found after end of image data"); - - return bytes; - } - - /** - * Parses the samples of the image from the underlying content parser, accounting for filters - * The parser must be positioned immediately after the ID operator that ends the inline image's dictionary. - * The parser will be left positioned immediately following the EI operator. - * Note:This implementation does not actually apply the filters at this time - * @param imageDictionary the dictionary of the inline image - * @param ps the content parser - * @return the samples of the image - * @throws IOException if anything bad happens during parsing - */ - private static byte[] ParseInlineImageSamples(PdfDictionary imageDictionary, PdfDictionary colorSpaceDic, PdfContentParser ps) { - // by the time we get to here, we have already parsed the ID operator - - if (!imageDictionary.Contains(PdfName.FILTER)) { - return ParseUnfilteredSamples(imageDictionary, colorSpaceDic, ps); - } - - - // read all content until we reach an EI operator surrounded by whitespace. - // The following algorithm has two potential issues: what if the image stream - // contains EI ? - // Plus, there are some streams that don't have the before the EI operator - // it sounds like we would have to actually decode the content stream, which - // I'd rather avoid right now. - var baos = new System.IO.MemoryStream(); - var accumulated = new System.IO.MemoryStream(); - int ch; - int found = 0; - var tokeniser = ps.GetTokeniser(); - byte[] ff = null; - - while ((ch = tokeniser.Read()) != -1) { - if (found == 0 && PRTokeniser.IsWhitespace(ch)) { - found++; - accumulated.WriteByte((byte)ch); - } - else if (found == 1 && ch == 'E') { - found++; - accumulated.WriteByte((byte)ch); - } - else if (found == 1 && PRTokeniser.IsWhitespace(ch)) { - // this clause is needed if we have a white space character that is part of the image data - // followed by a whitespace character that precedes the EI operator. In this case, we need - // to flush the first whitespace, then treat the current whitespace as the first potential - // character for the end of stream check. Note that we don't increment 'found' here. - baos.Write(ff = accumulated.ToArray(), 0, ff.Length); - accumulated.SetLength(0); - accumulated.WriteByte((byte)ch); - } - else if (found == 2 && ch == 'I') { - found++; - accumulated.WriteByte((byte)ch); - } - else if (found == 3 && PRTokeniser.IsWhitespace(ch)) { - return baos.ToArray(); - } - else { - baos.Write(ff = accumulated.ToArray(), 0, ff.Length); - accumulated.SetLength(0); - - baos.WriteByte((byte)ch); - found = 0; - } - } - throw new InlineImageParseException("Could not find image data or EI"); - } - } - - sealed class FontInfoCache - { - public readonly FontInfo Info; - public int Access; - - public FontInfoCache(FontInfo info) { - Info = info; - } - } - } -} diff --git a/pdfpatcher/App/Processor/PdfDocumentCreator.cs b/pdfpatcher/App/Processor/PdfDocumentCreator.cs deleted file mode 100644 index 8b78c6d231acbb27943282108a39547bff900968..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/PdfDocumentCreator.cs +++ /dev/null @@ -1,661 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing.Imaging; -using System.IO; -using System.Linq; -using System.Xml; -using FreeImageAPI; -using iTextSharp.text; -using iTextSharp.text.pdf; -using iTextSharp.text.pdf.parser; -using PDFPatcher.Common; -using PDFPatcher.Model; -using iTextImage = iTextSharp.text.Image; - -namespace PDFPatcher.Processor -{ - sealed class PdfDocumentCreator - { - internal static readonly string[] SupportedFileTypes = new string[] { ".pdf", ".tif", ".jpg", ".gif", ".png", ".tiff", ".bmp", ".jpeg", ".jp2", ".j2k" }; - static readonly string[] __BuiltInImageTypes = { ".png", ".jpg", ".jpeg", ".bmp", ".jp2", ".j2k" }; - static readonly string[] __MultiFrameImageTypes = { ".tif", ".tiff", ".gif" }; - static readonly PixelFormat[] __JpgFormats = new PixelFormat[] { - PixelFormat.Format16bppGrayScale, - PixelFormat.Format16bppRgb555, - PixelFormat.Format16bppRgb565, - PixelFormat.Format24bppRgb, - PixelFormat.Format32bppRgb, - PixelFormat.Format48bppRgb}; - - internal static readonly PaperSize[] PaperSizes = new PaperSize[] { - new PaperSize (PaperSize.AsPageSize, 0, 0), - new PaperSize (PaperSize.FixedWidthAutoHeight, 0, 0), - new PaperSize (PaperSize.AsWidestPage, 0, 0), - new PaperSize (PaperSize.AsNarrowestPage, 0, 0), - new PaperSize (PaperSize.AsLargestPage, 0, 0), - new PaperSize (PaperSize.AsSmallestPage, 0, 0), - new PaperSize ("16 开 (18.4*26.0)", 1840, 2600), - new PaperSize ("32 开 (13.0*18.4)", 1300, 1840), - new PaperSize ("大 32 开 (14.0*20.3)", 1400, 2030), - new PaperSize ("A4 (21.0*29.7)", 2100, 2970), - new PaperSize ("A3 (29.7*42.0)", 2970, 4200), - new PaperSize ("自定义", 0, 0), - new PaperSize ("————————————", 0, 0), - new PaperSize ("8 开 (26.0*36.8)", 2600, 3680), - new PaperSize ("16 开 (18.4*26.0)", 1840, 2600), - new PaperSize ("大 16 开 (21.0*28.5)", 2100, 2850), - new PaperSize ("32 开 (13.0*18.4)", 1300, 1840), - new PaperSize ("大 32 开 (14.0*20.3)", 1400, 2030), - new PaperSize ("8 K (27.3*39.3)", 2730, 3930), - new PaperSize ("16 K (19.6*27.3)", 1960, 2730), - new PaperSize ("A0 (84.1*118.9)", 8410, 11890), - new PaperSize ("A1 (59.4*84.1)", 5940, 8410), - new PaperSize ("A2 (42.0*59.4)", 4200, 5940), - new PaperSize ("A3 (29.7*42.0)", 2970, 4200), - new PaperSize ("A4 (21.0*29.7)", 2100, 2970), - new PaperSize ("A5 (14.8*21.0)", 1480, 2100), - new PaperSize ("A6 (10.5*14.8)", 1050, 1480), - new PaperSize ("B0 (100.0*141.3)", 10000, 14130), - new PaperSize ("B1 (70.7*100.0)", 7070, 10000), - new PaperSize ("B2 (50.0*70.7)", 5000, 7070), - new PaperSize ("B3 (35.3*50.0)", 3530, 5000), - new PaperSize ("B4 (25.0*35.3)", 2500, 3530), - new PaperSize ("B5 (17.6*25.0)", 1760, 2500), - new PaperSize ("B6 (12.5*17.6)", 1250, 1760) - }; - readonly MergerOptions _option; - readonly Document _doc; - readonly PdfCopy _writer; - readonly PaperSize _content; - readonly DocumentSink _sink; - readonly PageBoxSettings _pageSettings; - readonly bool _autoRotate; - readonly HorizontalAlignment hAlign; - readonly VerticalAlignment vAlign; - readonly bool scaleUp, scaleDown; - readonly bool areMarginsEqual; - bool _portrait; - int _inputDocumentCount; - - /// - /// 在传入构造函数选项中保留链接时,获取最近处理的 PDF 文档的书签。 - /// - public PdfInfoXmlDocument PdfBookmarks { get; } - /// 获取输入的文档数量。 - public int InputDocumentCount => _inputDocumentCount; - - public PdfDocumentCreator(DocumentSink sink, MergerOptions option, ImporterOptions impOptions, Document document, PdfCopy writer) { - _sink = sink; - _option = option; - _doc = document; - _writer = writer; - var ps = _pageSettings = option.PageSettings; - _content = new PaperSize(ps.PaperSize.PaperName, option.ContentWidth, option.ContentHeight); - _portrait = _content.Height > _content.Width; - _autoRotate = ps.AutoRotation && (_content.Height != _content.Width); - hAlign = ps.HorizontalAlign; - vAlign = ps.VerticalAlign; - scaleUp = option.AutoScaleUp; - scaleDown = option.AutoScaleDown; - areMarginsEqual = (ps.Margins.Top == ps.Margins.Left - && ps.Margins.Top == ps.Margins.Right - && ps.Margins.Top == ps.Margins.Bottom); - if (impOptions.ImportBookmarks) { - PdfBookmarks = new PdfInfoXmlDocument(); - var root = PdfBookmarks.BookmarkRoot; - } - if (_content.SpecialSize == SpecialPaperSize.None) { - _doc.SetPageSize(new Rectangle(ps.PaperSize.Width, ps.PaperSize.Height)); - } - } - - internal void ProcessFile(SourceItem sourceFile, BookmarkContainer bookmarkContainer) { - if (sourceFile.Type != SourceItem.ItemType.Empty) { - Tracker.TraceMessage(Tracker.Category.InputFile, sourceFile.FilePath.ToString()); - } - var b = CreateAutoBookmark(sourceFile, bookmarkContainer); - switch (sourceFile.Type) { - case SourceItem.ItemType.Empty: - Tracker.TraceMessage("添加空白页。"); - AddEmptyPage(); - SetBookmarkAction(b); - ++_inputDocumentCount; - break; - case SourceItem.ItemType.Pdf: - Tracker.TraceMessage("添加文档:" + sourceFile); - AddPdfPages(sourceFile as SourceItem.Pdf, b); - Tracker.IncrementProgress(sourceFile.FileSize); - ++_inputDocumentCount; - break; - case SourceItem.ItemType.Image: - Tracker.TraceMessage("添加图片:" + sourceFile); - AddImagePage(sourceFile, b); - Tracker.IncrementProgress(sourceFile.FileSize); - ++_inputDocumentCount; - break; - case SourceItem.ItemType.Folder: - Tracker.TraceMessage("添加文件夹:" + sourceFile); - break; - } - - if (!sourceFile.HasSubItems) { - return; - } - - var p = false; - var pn = _writer.CurrentPageNumber; - foreach (var item in sourceFile.Items) { - ProcessFile(item, b ?? bookmarkContainer); - if (p) { - continue; - } - p = true; - var t = b; - while (b?.Page == 0) { - b.Page = pn; - b.DestinationView = Constants.DestinationAttributes.ViewType.XYZ; - b.Top = _doc.PageSize.Height; - b = b.ParentBookmark; - } - b = t; - } - } - - void AddImagePage(SourceItem source, BookmarkElement bookmark) { - var ext = source.FilePath.FileExtension.ToLowerInvariant(); - var isIndexed = false; - if (__BuiltInImageTypes.Contains(ext)) { - try { - using (var fi = new FreeImageBitmap(source.FilePath, (FREE_IMAGE_LOAD_FLAGS)0x0800/*仅加载图像尺寸信息*/)) { - if (fi.HasPalette && fi.ImageFormat != FREE_IMAGE_FORMAT.FIF_JPEG && fi.ImageFormat != FREE_IMAGE_FORMAT.FIF_JP2) { - isIndexed = true; - goto ADVANCED_LOAD; - } - } - } - catch (FreeImageException) { - Tracker.TraceMessage("无法添加文件:" + source.FilePath); - return; - } - var image = LoadImage(source, ext); - if (image == null) { - Tracker.TraceMessage("无法添加文件:" + source.FilePath); - return; - } - if (_option.DpiX > 0 || _option.DpiY > 0) { - image.SetDpi(_option.DpiX.SubstituteDefault(image.DpiX), _option.DpiY.SubstituteDefault(image.DpiY)); - } - var cs = image.Additional?.GetAsArray(PdfName.COLORSPACE); - if (cs?.Size == 4 && PdfName.INDEXED.Equals(cs[0])) { - isIndexed = true; - } - else { - if ((ext == Constants.FileExtensions.Jpg || ext == Constants.FileExtensions.Jpeg) - && Imaging.JpgHelper.TryGetExifOrientation(source.FilePath, out var o) - && o != 0) { - switch (o) { - case 6: image.RotationDegrees = -90; break; - case 3: image.RotationDegrees = 180; break; - case 8: image.RotationDegrees = 90; break; - } - } - AddImage(image); - SetBookmarkAction(bookmark); - return; - } - } - ADVANCED_LOAD: - if (isIndexed || __MultiFrameImageTypes.Contains(ext)) { - FreeImageBitmap fi = null; - try { - fi = FreeImageBitmap.FromFile(source.FilePath); - var c = fi.FrameCount; - for (int i = 0; i < c; i++) { - fi.SelectActiveFrame(i); - var img = LoadImageFrame(source as SourceItem.Image, _option.RecompressWithJbig2, ref fi); - if (_option.DpiX > 0 || _option.DpiY > 0) { - img.SetDpi(_option.DpiX.SubstituteDefault(img.DpiX), _option.DpiY.SubstituteDefault(img.DpiY)); - } - AddImage(img); - if (i == 0) { - SetBookmarkAction(bookmark); - } - } - } - finally { - fi?.Dispose(); - } - } - - } - - void SetBookmarkAction(BookmarkElement bookmark) { - if (bookmark == null) { - return; - } - bookmark.Page = _writer.PageEmpty ? _writer.CurrentPageNumber - 1 : _writer.CurrentPageNumber; - bookmark.DestinationView = Constants.DestinationAttributes.ViewType.XYZ; - bookmark.Top = _doc.PageSize.Height; - } - - void AddEmptyPage() { - switch (_content.SpecialSize) { - case SpecialPaperSize.None: - case SpecialPaperSize.AsSpecificPage: - // 插入空白页 - _doc.NewPage(); - _writer.PageEmpty = false; - break; - case SpecialPaperSize.AsPageSize: - if (_doc.PageSize.Width > 0) { - goto case SpecialPaperSize.AsSpecificPage; - } - break; - default: - Tracker.TraceMessage("没有指定页面尺寸,无法插入空白页。"); - break; - } - } - - void AddPdfPages(SourceItem.Pdf sourceFile, BookmarkContainer bookmark) { - var pdf = _sink.GetPdfReader(sourceFile.FilePath); - if (pdf.ConfirmUnethicalMode() == false) { - Tracker.TraceMessage("忽略了没有权限处理的文件:" + sourceFile.FilePath); - if (_sink.DecrementReference(sourceFile.FilePath) < 1) { - pdf.Close(); - } - return; - } - var ranges = PageRangeCollection.Parse(sourceFile.PageRanges, 1, pdf.NumberOfPages, true); - var pageRemapper = new int[pdf.NumberOfPages + 1]; - // 统一页面旋转角度 - if (_option.UnifyPageOrientation) { - var rv = _option.RotateVerticalPages; - var a = _option.RotateAntiClockwise ? -90 : 90; - for (int i = pdf.NumberOfPages; i > 0; i--) { - var p = pdf.GetPageN(i); - var r = PdfHelper.GetPageVisibleRectangle(p); - if (rv && r.Width < r.Height - || rv == false && r.Width > r.Height) { - p.Put(PdfName.ROTATE, (r.Rotation + a) % 360); - } - } - } - if (bookmark != null) { - var n = _writer.CurrentPageNumber + 1; - if (_writer.PageEmpty) { - n--; - } - bookmark.SetAttribute(Constants.DestinationAttributes.Page, n.ToText()); - bookmark.SetAttribute(Constants.DestinationAttributes.View, Constants.DestinationAttributes.ViewType.XYZ); - var r = PdfHelper.GetPageVisibleRectangle(pdf.GetPageN(ranges[0].StartValue)); - float t = 0; - switch ((r.Rotation % 360) / 90) { - case 0: t = r.Top; break; - case 1: t = r.Right; break; - case 2: t = r.Bottom; break; - case 3: t = r.Left; break; - } - bookmark.SetAttribute(Constants.Coordinates.Top, t.ToText()); - } - var pdfItem = (sourceFile as SourceItem.Pdf); - bool importImagesOnly = pdfItem.ImportImagesOnly; - int pn = pdf.NumberOfPages; - ImageExtractor imgExp = null; - if (importImagesOnly) { - imgExp = new ImageExtractor(pdfItem.ExtractImageOptions, pdf); - } - if (_option.KeepBookmarks) { - pdf.ConsolidateNamedDestinations(); - } - var pp = new byte[pdf.NumberOfPages + 1]; // 已处理过的页面 - var cts = _pageSettings.PaperSize.SpecialSize != SpecialPaperSize.AsPageSize ? new CoordinateTranslationSettings[pdf.NumberOfPages + 1] : null; // 页面的位置偏移量 - foreach (var r in ranges) { - foreach (var i in r) { - if (i < 1 || i > pn) { - goto Exit; - } - if (pageRemapper != null) { - pageRemapper[i] = _writer.CurrentPageNumber; - } - _doc.NewPage(); - if (imgExp != null) { - imgExp.ExtractPageImages(pdf, i); - foreach (var item in imgExp.InfoList) { - if (item.FileName != null) { - ProcessFile(new SourceItem.Image(item.FileName), bookmark); - File.Delete(item.FileName); - } - } - } - else { - if (pp[i] == 0) { - var page = pdf.GetPageN(i); - //if (DocInfoImporter.RemovePageAdditionalInfo (_docSettings, page)) { - // pdf.ResetReleasePage (); - //} - //if (_docSettings.AutoMaskBWImages) { - // SetBWImageMask (page); - // pdf.ResetReleasePage (); - //} - //PdfHelper.ClearPageLinks (pdf, i); - if (_pageSettings.PaperSize.SpecialSize != SpecialPaperSize.AsPageSize) { - pdf.ResetReleasePage(); - var ct = PageDimensionProcessor.ResizePage(page, _pageSettings, null); - if (_pageSettings.ScaleContent) { - PageDimensionProcessor.ScaleContent(pdf, i, ct); - } - if (cts != null) { - cts[i] = ct; - } - pdf.ResetReleasePage(); - } - //var og = new OperatorGroup (null); - //if (_docSettings.FixContents) { - // og.Operators.Add (PdfContentStreamProcessor.NopOperator); - //} - //if (og.Operators.Count > 0) { - // var cp = new PdfPageCommandProcessor (); - // cp.ProcessContent (cb ?? pdf.GetPageContent (i), pdf.GetPageN (i).GetAsDict (PdfName.RESOURCES)); - // cp.WritePdfCommands (pdf, i); - //} - - pp[i] = 1; - } - _writer.AddPage(_writer.GetImportedPage(pdf, i)); - } - Exit: - Tracker.IncrementProgress(1); - } - } - _doc.SetPageSize(pdf.GetPageNRelease(ranges[ranges.Count - 1].EndValue).GetPageVisibleRectangle()); - if (_option.KeepBookmarks) { - bookmark = KeepBookmarks(bookmark, pdf, pageRemapper, cts); - } - if (_sink.DecrementReference(sourceFile.FilePath) < 1) { - _writer.FreeReader(pdf); - pdf.Close(); - } - } - - BookmarkContainer KeepBookmarks(BookmarkContainer bookmark, PdfReader pdf, int[] pageRemapper, CoordinateTranslationSettings[] cts) { - var bm = OutlineManager.GetBookmark(pdf, new UnitConverter() { Unit = Constants.Units.Point }); - var processors = new List(); - if (_option.ViewerPreferences.CollapseBookmark != BookmarkStatus.AsIs) { - processors.Add(new CollapseBookmarkProcessor() { BookmarkStatus = _option.ViewerPreferences.CollapseBookmark }); - } - if (_option.ViewerPreferences.RemoveZoomRate) { - processors.Add(new RemoveZoomRateProcessor()); - } - if (_option.ViewerPreferences.ForceInternalLink) { - processors.Add(new ForceInternalDestinationProcessor()); - } - processors.Add(new GotoDestinationProcessor() { - RemoveOrphanDestination = _option.RemoveOrphanBookmarks, - PageRemapper = pageRemapper, - TransitionMapper = cts - }); - ProcessInfoItem(bm, processors); - if (bookmark != null) { - bookmark.SetAttribute(Constants.BookmarkAttributes.Open, - _option.ViewerPreferences.CollapseBookmark == BookmarkStatus.CollapseAll - ? Constants.Boolean.False : Constants.Boolean.True); - } - else if (PdfBookmarks != null) { - bookmark = PdfBookmarks.BookmarkRoot; - } - else { - return bookmark; - } - if (bm != null) { - XmlNode c; - while ((c = bm.FirstChild) != null) { - if (c.NodeType == XmlNodeType.Element) { - bookmark.AppendChild(bookmark.OwnerDocument.ImportNode(c, true)); - } - bm.RemoveChild(c); - } - } - return bookmark; - } - - internal static void ProcessInfoItem(XmlElement item, ICollection processors) { - if (item == null) { - return; - } - foreach (var p in processors) { - p.Process(item); - } - - var c = item.FirstChild; - XmlNode r; - XmlElement ce; - while (c != null) { - ce = c as XmlElement; - r = c.PreviousSibling; - if (ce != null) { - ProcessInfoItem(ce, processors); - } - if (c.ParentNode == null) { - // 节点在处理过程中被删除 - c = r != null ? r.NextSibling : item.FirstChild; - } - else { - c = c.NextSibling; - } - } - } - - //internal static void SetBWImageMask (PdfDictionary page) { - // var xo = PdfHelper.Locate (page, true, PdfName.RESOURCES, PdfName.XOBJECT); - // foreach (var item in xo) { - // var o = PdfReader.GetPdfObject (item.Value) as PdfDictionary; - // if (o == null - // || PdfName.IMAGE.Equals(o.Get(PdfName.SUBTYPE)) == false - // || PdfHelper.ValueIs (o.GetAsBoolean (PdfName.IMAGEMASK), true) - // || PdfHelper.ValueIs (o.GetAsNumber (PdfName.BITSPERCOMPONENT), 1) == false) { - // continue; - // } - // o.Put (PdfName.IMAGEMASK, PdfBoolean.PDFTRUE); - // o.Remove (PdfName.MASK); - // var cs = o.GetAsArray (PdfName.COLORSPACE); - // if (cs != null && cs.Size == 4 - // && PdfHelper.ValueIs (cs.GetAsName (0), PdfName.INDEXED) - // && PdfHelper.ValueIs (cs.GetAsName (1), PdfName.DEVICERGB) - // && PdfHelper.ValueIs (cs.GetAsNumber (2), 1)) { - // PdfObject cl = cs.GetDirectObject (3); - // byte[] l = null; - // if (cs.IsString ()) { - // l = (cl as PdfString).GetOriginalBytes (); - // } - // else if (cs.IsStream ()) { - // l = PdfReader.GetStreamBytes (cl as PRStream); - // } - // Array.Resize (ref l, 6); - // if (l[0] == 0xFF) { - - // } - // } - // o.Remove (PdfName.COLORSPACE); - // } - //} - - static iTextImage LoadImage(SourceItem sourceFile, string ext) { - var imageItem = sourceFile as SourceItem.Image; - var cropOptions = imageItem.Cropping; - if (imageItem == null || cropOptions.NeedCropping == false) { - return Image.GetInstance(sourceFile.FilePath.ToString()); - } - ext = ext.ToLowerInvariant(); - using (var fi = new FreeImageBitmap(sourceFile.FilePath)) { - if (fi.Height < cropOptions.MinHeight // 不满足尺寸限制 - || fi.Width < cropOptions.MinWidth - || fi.Height <= cropOptions.Top + cropOptions.Bottom // 裁剪后尺寸小于 0 - || fi.Width <= cropOptions.Left + cropOptions.Right - ) { - return Image.GetInstance(sourceFile.FilePath.ToString()); - } - if (ext == Constants.FileExtensions.Jpg || ext == Constants.FileExtensions.Jpeg) { - // is JPEG file - var t = sourceFile.FilePath.EnsureExtension(Constants.FileExtensions.Jpg); - if (FreeImageBitmap.JPEGCrop(sourceFile.FilePath, t, cropOptions.Left, cropOptions.Top, fi.Width - cropOptions.Right, fi.Height - cropOptions.Bottom)) { - iTextImage image; - using (var fs = new FileStream(t, FileMode.Open)) { - image = Image.GetInstance(fs); - } - File.Delete(t); - return image; - } - } - - using (var tmp = fi.Copy(cropOptions.Left, cropOptions.Top, fi.Width - cropOptions.Right, fi.Height - cropOptions.Bottom)) - using (MemoryStream ms = new MemoryStream()) { - tmp.Save(ms, fi.ImageFormat); - ms.Flush(); - ms.Position = 0; - return Image.GetInstance(ms); - } - } - } - - BookmarkElement CreateAutoBookmark(SourceItem sourceFile, XmlElement bookmarkContainer) { - if (PdfBookmarks == null - || sourceFile.Bookmark == null - || String.IsNullOrEmpty(sourceFile.Bookmark.Title)) { - return null; - } - var b = PdfBookmarks.CreateBookmark(sourceFile.Bookmark); - bookmarkContainer.AppendChild(b); - return b; - } - - void AddImage(iTextImage image) { - if (_option.AutoMaskBWImages && image.IsMaskCandidate()) { - image.MakeMask(); - } - image.ScalePercent(72f / image.DpiX.SubstituteDefault(72) * 100f, 72f / image.DpiY.SubstituteDefault(72) * 100f); - if (_content.SpecialSize == SpecialPaperSize.AsPageSize) { - _doc.SetPageSize(new Rectangle(image.ScaledWidth + _doc.LeftMargin + _doc.RightMargin, image.ScaledHeight + _doc.TopMargin + _doc.BottomMargin)); - } - else if (_content.SpecialSize == SpecialPaperSize.FixedWidthAutoHeight) { - if ((scaleDown && image.ScaledWidth > _content.Width) || - (scaleUp && image.ScaledWidth < _content.Width)) { - image.ScaleToFit(_content.Width, 999999); - } - _doc.SetPageSize(new Rectangle(_content.Width, image.ScaledHeight + _doc.TopMargin + _doc.BottomMargin)); - } - else { - if (_autoRotate - && (// 页面不足以放下当前尺寸的图片 - (image.ScaledHeight > _content.Height || image.ScaledWidth > _content.Width) - && (image.ScaledWidth > image.ScaledHeight && _portrait == true - || image.ScaledHeight > image.ScaledWidth && _portrait == false) - || - // 图片较小,可以还原为原始的页面方向 - (_portrait != image.Height > image.Width - && image.ScaledHeight <= _content.Height && image.ScaledWidth <= _content.Width - && image.ScaledHeight <= _content.Width && image.ScaledWidth <= _content.Height) - ) - ) { - var t = _content.Height; - _content.Height = _content.Width; - _content.Width = t; - _doc.SetPageSize(new Rectangle(_doc.PageSize.Height, _doc.PageSize.Width)); - if (areMarginsEqual == false) { - if (_portrait) { - _doc.SetMargins(_doc.BottomMargin, _doc.TopMargin, _doc.LeftMargin, _doc.RightMargin); - } - else { - _doc.SetMargins(_doc.TopMargin, _doc.BottomMargin, _doc.RightMargin, _doc.LeftMargin); - } - } - _portrait = !_portrait; - } - if ((scaleDown && (image.ScaledHeight > _content.Height || image.ScaledWidth > _content.Width)) - || (scaleUp && image.ScaledHeight < _content.Height && image.ScaledWidth < _content.Width)) { - image.ScaleToFit(_content.Width, _content.Height); - } - float px = 0, py = 0; - if (hAlign == HorizontalAlignment.Center) { - px = (_content.Width - image.ScaledWidth) / 2f; - } - else if (hAlign == HorizontalAlignment.Right) { - px = _content.Width - image.ScaledWidth; - } - if (vAlign == VerticalAlignment.Middle) { - py = (_content.Height - image.ScaledHeight) / 2f; - } - else if (vAlign == VerticalAlignment.Top) { - py = _content.Height - image.ScaledHeight; - } - image.SetAbsolutePosition(_doc.LeftMargin + px, _doc.BottomMargin + py); - } - _doc.NewPage(); - _doc.Add(image); - _doc.NewPage(); - } - - static Image LoadImageFrame(SourceItem.Image source, bool recompressWithJbig2, ref FreeImageBitmap fi) { - iTextImage image; - var cropOptions = source.Cropping; - FREE_IMAGE_FORMAT format; - if (fi.ImageFormat == FREE_IMAGE_FORMAT.FIF_GIF - || fi.InfoHeader.biCompression == FreeImage.BI_PNG) { - format = FREE_IMAGE_FORMAT.FIF_PNG; - } - else if (fi.ColorDepth > 8 - && fi.ColorType == FREE_IMAGE_COLOR_TYPE.FIC_RGB - && fi.HasPalette == false - && __JpgFormats.Contains(fi.PixelFormat) - && (fi.ImageFormat != FREE_IMAGE_FORMAT.FIF_TIFF || fi.InfoHeader.biCompression != 0)) { - format = FREE_IMAGE_FORMAT.FIF_JPEG; - } - else if (fi.PixelFormat == PixelFormat.Format1bppIndexed && fi.ImageFormat != FREE_IMAGE_FORMAT.FIF_TIFF && recompressWithJbig2 == false) { - format = FREE_IMAGE_FORMAT.FIF_TIFF; - } - else if (fi.ColorDepth > 8) { - format = FREE_IMAGE_FORMAT.FIF_PNG; - } - else if (fi.InfoHeader.biCompression == FreeImage.BI_JPEG) { - format = FREE_IMAGE_FORMAT.FIF_JPEG; - } - else { - format = fi.ImageFormat; - } - using (MemoryStream ms = new MemoryStream()) { - if (cropOptions.NeedCropping - && (fi.Height < cropOptions.MinHeight // 不满足尺寸限制 - || fi.Width < cropOptions.MinWidth - || fi.Height <= cropOptions.Top + cropOptions.Bottom // 裁剪后尺寸小于 0 - || fi.Width <= cropOptions.Left + cropOptions.Right) == false) { - var temp = fi.Copy(cropOptions.Left, cropOptions.Top, fi.Width - cropOptions.Right, fi.Height - cropOptions.Bottom); - temp.Save(ms, format); - fi.Dispose(); - fi = temp; - } - else { - fi.Save(ms, format); - } - ms.Flush(); - ms.Position = 0; - if (recompressWithJbig2 && fi.PixelFormat == PixelFormat.Format1bppIndexed) { - image = iTextImage.GetInstance(fi.Width, fi.Height, Imaging.JBig2Encoder.Encode(fi), null); - } - else { - try { - image = iTextImage.GetInstance(ms.ToArray(), true); - } - catch (IndexOutOfRangeException) { - // 在某些场合下 FreeImage 保存的流无法被读取,尝试读原始文件,让 iTextImage 自行解析 - image = iTextImage.GetInstance(source.FilePath.ReadAllBytes(), true); - } - } - } - if (fi.HorizontalResolution != fi.VerticalResolution) { - image.SetDpi(fi.HorizontalResolution.ToInt32(), fi.VerticalResolution.ToInt32()); - } - return image; - } - - } -} diff --git a/pdfpatcher/App/Processor/PdfHelper.cs b/pdfpatcher/App/Processor/PdfHelper.cs deleted file mode 100644 index 87c4fca0dd8dc226b6d08c1d436ec1d86c4ab00e..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/PdfHelper.cs +++ /dev/null @@ -1,625 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Text; -using iTextSharp.text.pdf; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - internal static class PdfHelper - { - internal static readonly int[] CompoundTypes = new int[] { PdfObject.DICTIONARY, PdfObject.ARRAY, PdfObject.STREAM }; - - static readonly DualKeyDictionary __PdfNameMap; - static readonly Dictionary __PdfPasswordCache = new Dictionary(StringComparer.OrdinalIgnoreCase); - static bool __SuppressUnethicalWarning; - - /// - /// 切换强制读取加密文档模式。 - /// - /// 是否打开强制读取模式。 - internal static void ToggleUnethicalMode(bool unethicalreading) { - PdfReader.unethicalreading = unethicalreading; - } - /// - /// 切换容错模式(忽略 PDF 文档的错误)。 - /// - /// 是否打开容错模式。 - internal static void ToggleReaderDebugMode(bool debugMode) { - PdfReader.debugmode = debugMode; - } - - /// - /// 打开 PDF 文件,在有需要时提示输入密码。 - /// - /// 需要打开的 PDF 文件。 - /// 是否仅打开文件的部分内容。 - /// 实例。 - internal static PdfReader OpenPdfFile(string sourceFile, bool partial, bool removeUnusedObjects) { - byte[] password; - __PdfPasswordCache.TryGetValue(sourceFile, out password); - while (true) { - try { - if (File.Exists(sourceFile) == false) { - throw new FileNotFoundException(String.Concat("找不到文件:", sourceFile)); - } - PdfReader r; - if (partial) { - r = new PdfReader(new RandomAccessFileOrArray(sourceFile), password); - } - else { - r = new PdfReader(sourceFile, password); - } - if (password != null && password.Length > 0) { - __PdfPasswordCache[sourceFile] = password; - } - if (removeUnusedObjects) { - r.RemoveUnusedObjects(); - } - return r; - } - catch (iTextSharp.text.exceptions.BadPasswordException) { - var f = new PasswordEntryForm(sourceFile); - if (f.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) { - throw new iTextSharp.text.exceptions.BadPasswordException("密码错误,没有权限打开 PDF 文件。"); - } - password = Encoding.Default.GetBytes(f.Password); - } - catch (iTextSharp.text.exceptions.InvalidPdfException ex) { - FormHelper.ErrorBox("PDF 文档已经损坏,或使用了不支持的加密方式:" + ex.Message); - throw; - } - } - } - - internal static bool ConfirmUnethicalMode(this PdfReader pdf) { - ToggleUnethicalMode(false); - var r = pdf.IsOpenedWithFullPermissions - || __SuppressUnethicalWarning - || FormHelper.ConfirmOKBox(Messages.UserRightRequired); - ToggleUnethicalMode(true); - if (__SuppressUnethicalWarning == false && FormHelper.IsCtrlKeyDown) { - __SuppressUnethicalWarning = true; - } - return r; - } - - internal static MuPdfSharp.MuDocument OpenMuDocument(string sourceFile) { - var d = new MuPdfSharp.MuDocument(sourceFile); - if (d.NeedsPassword) { - if (__PdfPasswordCache.TryGetValue(sourceFile, out byte[] password)) { - d.AuthenticatePassword(password != null ? Encoding.Default.GetString(password) : String.Empty); - } - while (d.IsAuthenticated == false) { - using (var f = new PasswordEntryForm(sourceFile)) { - if (f.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) { - throw new iTextSharp.text.exceptions.BadPasswordException("密码错误,没有权限打开 PDF 文件。"); - } - __PdfPasswordCache[sourceFile] = password = Encoding.Default.GetBytes(f.Password); - } - d.AuthenticatePassword(password != null ? Encoding.Default.GetString(password) : String.Empty); - } - } - return d; - } - - static PdfHelper() { - __PdfNameMap = InitPdfNameMap(); - } - - static DualKeyDictionary InitPdfNameMap() { - var m = new DualKeyDictionary { - { PdfName.PAGELAYOUT, Constants.PageLayout }, - - { PdfName.PAGEMODE, Constants.PageMode }, - - { PdfName.DIRECTION, Constants.ViewerPreferencesType.Direction }, - - { PdfName.ST, Constants.PageLabelsAttributes.StartPage }, - { PdfName.P, Constants.PageLabelsAttributes.Prefix }, - { PdfName.S, Constants.PageLabelsAttributes.Style }, - - { PdfName.XYZ, Constants.DestinationAttributes.ViewType.XYZ }, - { PdfName.FIT, Constants.DestinationAttributes.ViewType.Fit }, - { PdfName.FITB, Constants.DestinationAttributes.ViewType.FitB }, - { PdfName.FITBH, Constants.DestinationAttributes.ViewType.FitBH }, - { PdfName.FITBV, Constants.DestinationAttributes.ViewType.FitBV }, - { PdfName.FITH, Constants.DestinationAttributes.ViewType.FitH }, - { PdfName.FITR, Constants.DestinationAttributes.ViewType.FitR }, - { PdfName.FITV, Constants.DestinationAttributes.ViewType.FitV }, - - { PdfName.GOTO, Constants.ActionType.Goto }, - { PdfName.GOTOR, Constants.ActionType.GotoR }, - { PdfName.LAUNCH, Constants.ActionType.Launch }, - { PdfName.URI, Constants.ActionType.Uri } - }; - - return m; - } - - internal static string GetTypeName(int t) { - switch (t) { - case PdfObject.ARRAY: return "array"; - case PdfObject.BOOLEAN: return "bool"; - case PdfObject.DICTIONARY: return "dictionary"; - case PdfObject.INDIRECT: return "reference"; - case PdfObject.NAME: return "name"; - case PdfObject.NULL: return "null"; - case PdfObject.NUMBER: return "number"; - case PdfObject.STREAM: return "stream"; - case PdfObject.STRING: return "string"; - default: return String.Empty; - } - } - - /// - /// 获取友好的 PdfName 文本。 - /// - internal static string GetPdfFriendlyName(PdfName name) { - return (__PdfNameMap.ContainsKey(name) ? __PdfNameMap[name] : GetPdfNameString(name)); - } - /// - /// 解析 PdfName。 - /// - /// 转换所得的 PdfName 说明文本。 - /// 与文本说明对应的 PdfName。 - internal static PdfName ResolvePdfName(string friendlyName) { - return (__PdfNameMap.ContainsValue(friendlyName) ? __PdfNameMap.GetKeyByValue(friendlyName) : new PdfName(friendlyName)); - } - - internal static string DecodeKeyName(object name) { - if (name is PdfName) { - return PdfName.DecodeName(name.ToString()); - } - else - return name.ToString(); - } - - /// - /// 获取 PDF 页面引用与页数的映射关系表。 - /// - /// 源 PDF 文档。 - /// 键为 的数值,值为页数的字典。 - internal static Dictionary GetPageRefMapper(this PdfReader reader) { - int numPages = reader.NumberOfPages; - var pages = new Dictionary(numPages); - for (int k = 1; k <= numPages; ++k) { - pages[reader.GetPageOrigRef(k).Number] = k; - reader.ReleasePage(k); - } - return pages; - } - - /// 获取 实际写出的页数。 - public static int GetPageCount(this PdfWriter writer) { - return writer.PageEmpty ? writer.CurrentPageNumber - 1 : writer.CurrentPageNumber; - } - - /// - /// 解析形如“D:20111021090818+08'00'”的日期格式。 - /// - /// 日期格式。 - /// - internal static DateTimeOffset ParseDateTime(string date) { - if (date == null - || date.Length != 23 && date.Length != 16 - || date.StartsWith("D:") == false) { - return DateTimeOffset.MinValue; - } - try { - return new DateTimeOffset( - date.Take(2, 4).ToInt32(), date.Take(6, 2).ToInt32(), date.Take(8, 2).ToInt32(), - date.Take(10, 2).ToInt32(), date.Take(12, 2).ToInt32(), date.Take(14, 2).ToInt32(), - new TimeSpan(date.Take(16, 3).ToInt32(), date.Take(20, 2).ToInt32(), 0) - ); - } - catch (Exception) { - return DateTimeOffset.MinValue; - } - } - - /// - /// 获取解码后的 PDF 名称字符串。 - /// - /// 需要解码的 PDF 名称。 - /// 解码后的 PDF 名称字符串 - internal static string GetPdfNameString(PdfName name) { - return GetPdfNameString(name, PdfName.DefaultEncoding); - } - - /// - /// 获取解码后的 PDF 名称字符串。 - /// - /// 需要解码的 PDF 名称。 - /// 用于解码的文本编码。 - /// 解码后的 PDF 名称字符串 - internal static string GetPdfNameString(PdfName name, Encoding encoding) { - var s = name.ToString(); - int len = s.Length; - var buf = new byte[len]; - int l = 0; - for (int k = 1; k < len; ++k) { - char c = s[k]; - if (c == '#') { - buf[l] = (byte)((PRTokeniser.GetHex(s[++k]) << 4) + PRTokeniser.GetHex(s[++k])); - } - else { - buf[l] = (byte)c; - } - l++; - } - return (encoding ?? System.Text.Encoding.Default).GetString(buf, 0, l); - } - - /// - /// 获取页面可见的边框。 - /// - /// 页面字典。 - /// 页面的可见边框。 - internal static iTextSharp.text.Rectangle GetPageVisibleRectangle(this PdfDictionary page) { - PdfArray box; - if (page == null - || ((box = page.GetAsArray(PdfName.CROPBOX)) == null || box.Size != 4) - && ((box = page.GetAsArray(PdfName.MEDIABOX)) == null || box.Size != 4)) { - return null; - } - var c = new float[4]; - for (int i = 0; i < 4; i++) { - c[i] = box.GetAsNumber(i).FloatValue; - } - var r = page.GetAsNumber(PdfName.ROTATE); - return r != null && r.IntValue != 0 && r.IntValue != 180 - ? new iTextSharp.text.Rectangle(c[0], c[1], c[2], c[3], r.IntValue).Rotate() - : new iTextSharp.text.Rectangle(c[0], c[1], c[2], c[3]); - } - - internal static void ClearPageLinks(this PdfReader r) { - int pageCount = r.NumberOfPages + 1; - for (int i = 1; i < pageCount; i++) { - ClearPageLinks(r, i); - } - } - - internal static void ClearPageLinks(this PdfReader r, int pageNumber) { - r.ResetReleasePage(); - var pageDic = r.GetPageN(pageNumber); - var annots = (PdfArray)PdfReader.GetPdfObjectRelease(pageDic.Get(PdfName.ANNOTS)); - if (annots == null) { - r.ReleasePage(pageNumber); - } - else { - IList arr = annots.ArrayList; - for (int j = arr.Count - 1; j >= 0; j--) { - var item = arr[j]; - var annot = (PdfDictionary)PdfReader.GetPdfObjectRelease(item); - if (PdfName.LINK.Equals(annot.Get(PdfName.SUBTYPE))) { - arr.RemoveAt(j); - } - } - if (annots.ArrayList.Count == 0) { - pageDic.Remove(PdfName.ANNOTS); - } - } - r.ResetReleasePage(); - } - - internal static string GetValidXmlString(string value) { - if (String.IsNullOrEmpty(value)) { - return String.Empty; - } - var marks = new List(3); - int p = 0; - foreach (char c in value) { - switch (c) { - case '\t': - case '\r': - case '\n': - break; - default: - // invalid character - if (Char.IsControl(c)) { - if (marks.Count == 0) { - marks.Add(0); - } - marks.Add(p + 1); - } - break; - } - p++; - } - if (marks.Count > 0) { - marks.Add(value.Length + 1); - } - if (marks.Count > 1) { - var sb = StringBuilderCache.Acquire(); - for (int i = 1; i < marks.Count; i++) { - if (i > 1) { - sb.Append(' '); - } - sb.Append(value, marks[i - 1], marks[i] - 1 - marks[i - 1]); - } - return StringBuilderCache.GetStringAndRelease(sb); - } - else { - return value; - } - } - - internal static string GetArrayString(PdfArray array) { - return GetArrayString(array.ArrayList); - } - - internal static string GetArrayString(ICollection array) { - var sb = StringBuilderCache.Acquire(); - int k = 0; - foreach (var item in array) { - if (++k > 1) { - sb.Append(' '); - } - if (item.Type == PdfObject.ARRAY) { - sb.Append('['); - sb.Append(GetArrayString(item as PdfArray)); - sb.Append(']'); - } - else if (item.Type == PdfObject.DICTIONARY || item.Type == PdfObject.STREAM) { - sb.Append("<<...>>"); - } - else { - sb.Append(item); - } - } - return StringBuilderCache.GetStringAndRelease(sb); - } - - internal static string GetNumericArrayString(PdfArray a, float unitFactor) { - var sb = StringBuilderCache.Acquire(); - for (int k = 0; k < a.ArrayList.Count; k++) { - if (k != 0) { - sb.Append(' '); - } - if (a.GetAsArray(k) != null) { - sb.Append('['); - sb.Append(a.GetAsArray(k)); - sb.Append(']'); - } - else { - var o = a.ArrayList[k]; - sb.Append(o.Type == PdfObject.NUMBER ? UnitConverter.FromPoint(o.ToString(), unitFactor) : o.ToString()); - } - } - return StringBuilderCache.GetStringAndRelease(sb); - } - - internal static void Put(this PdfDictionary dict, PdfName key, string value) { - dict.Put(key, value.ToPdfString()); - } - internal static void Put(this PdfDictionary dict, PdfName key, int value) { - dict.Put(key, new PdfNumber(value)); - } - internal static void Put(this PdfDictionary dict, PdfName key, double value) { - dict.Put(key, new PdfNumber(value)); - } - internal static void Put(this PdfDictionary dict, PdfName key, float value) { - dict.Put(key, new PdfNumber(value)); - } - internal static void Put(this PdfDictionary dict, PdfName key, bool value) { - dict.Put(key, new PdfBoolean(value)); - } - internal static void Put(this PdfDictionary dict, PdfName key, float[] values) { - dict.Put(key, new PdfArray(values)); - } - internal static void Put(this PdfDictionary dict, PdfName key, int[] values) { - dict.Put(key, new PdfArray(values)); - } - - internal static PdfDictionary CreateDictionaryPath(this PdfDictionary source, params PdfName[] path) { - PdfDictionary d; - foreach (var item in path) { - if (source.Contains(item)) { - d = source.GetAsDict(item); - if (d == null) { - throw new InvalidCastException(item.ToString() + "不是 PdfDictionary。"); - } - source = d; - continue; - } - d = new PdfDictionary(); - source.Put(item, d); - source = d; - d = null; - } - return source; - } - - internal static bool PdfReferencesAreEqual(PdfIndirectReference r1, PdfIndirectReference r2) { - if (r1 == null || r2 == null) { - return false; - } - return r1.Number == r2.Number && r1.Generation == r2.Generation; - } - - internal static int GetPageRotation(PdfDictionary page) { - return NormalizeRotationNumber(page.TryGetInt32(PdfName.ROTATE, 0)); - } - - internal static int NormalizeRotationNumber(int rotation) { - switch (rotation) { - case 0: - case 90: - case 180: - case 270: - return rotation; - default: - rotation = rotation % 90; - if (rotation < 0) { - rotation += 360; - } - return (rotation / 90 * 90); - } - } - - internal static IList GetObjectDirectOrFromContainerArray(this PdfDictionary d, PdfName name, int pdfObjectType) { - var results = new List(); - - PdfObject tmp; - tmp = d.Get(name); - if (tmp == null) { - } - else if (tmp.Type == pdfObjectType) { - results.Add(tmp); - } - else if (tmp.Type == PdfObject.ARRAY) { - var a = tmp as PdfArray; - for (int i = 0; i < a.Size; i++) { - tmp = a.GetDirectObject(i); - if (tmp == null) { - continue; - } - if (tmp.Type == pdfObjectType) { - results.Add(tmp); - } - } - } - return results; - } - - internal static string MatrixToString(iTextSharp.text.pdf.parser.Matrix ctm) { - return String.Join(" ", ctm[0].ToText(), ctm[1].ToText(), ctm[3].ToText(), ctm[4].ToText(), ctm[6].ToText(), ctm[7].ToText()); - } - - /// - /// 获取未使用对象的列表。 - /// - /// 需要检查的 PDF 文档。 - /// 待检查 PDF 文档是否为部分加载。 - /// 包含未使用对象索引值的列表。 - internal static List ListUnusedObjects(PdfReader pdf, bool partial) { - var hits = new bool[pdf.XrefSize]; - GetUnusedNode(pdf, partial, pdf.Trailer, hits); - int i = 0; - var result = new List(); - foreach (var item in hits) { - if (item == false && i > 0) { - result.Add(i); - } - ++i; - } - return result; - } - - internal static void SafeSetPageContent(this PdfReader pdf, int pageNumber, byte[] content) { - var p = pdf.GetPageN(pageNumber); - var c = p.GetDirectObject(PdfName.CONTENTS); - if (c != null && c.IsArray()) { - var cs = new PRStream(pdf, content); - if (content.Length > 30) { - cs.FlateCompress(); - } - p.Put(PdfName.CONTENTS, pdf.AddPdfObject(cs)); - } - else { - pdf.SetPageContent(pageNumber, content); - } - } - - static void GetUnusedNode(PdfReader pdf, bool partial, PdfObject obj, bool[] hits) { - var state = new Stack(); - state.Push(obj); - int oc = pdf.XrefSize; - while (state.Count != 0) { - var current = state.Pop(); - if (current == null) - continue; - List ar = null; - PdfDictionary dic = null; - PdfName[] keys = null; - Object[] objs = null; - int idx = 0; - if (current is PdfObject pdfObject) { - obj = pdfObject; - switch (obj.Type) { - case PdfObject.DICTIONARY: - case PdfObject.STREAM: - dic = (PdfDictionary)obj; - keys = new PdfName[dic.Size]; - dic.Keys.CopyTo(keys, 0); - break; - case PdfObject.ARRAY: - ar = ((PdfArray)obj).ArrayList; - break; - case PdfObject.INDIRECT: - var refi = (PRIndirectReference)obj; - int num = refi.Number; - if (!hits[num]) { - hits[num] = true; - state.Push(PdfReader.GetPdfObjectRelease(refi)); - } - continue; - default: - continue; - } - } - else { - objs = (object[])current; - if (objs[0] is List) { - ar = (List)objs[0]; - idx = (int)objs[1]; - } - else { - keys = (PdfName[])objs[0]; - dic = (PdfDictionary)objs[1]; - idx = (int)objs[2]; - } - } - if (ar != null) { - for (int k = idx; k < ar.Count; ++k) { - var v = ar[k]; - if (v.IsIndirect()) { - int num = ((PRIndirectReference)v).Number; - if (num >= oc || (!partial && pdf.GetPdfObjectRelease(num) == null)) { - ar[k] = PdfNull.PDFNULL; - continue; - } - } - if (objs == null) { - state.Push(new object[] { ar, k + 1 }); - } - else { - objs[1] = k + 1; - state.Push(objs); - } - state.Push(v); - break; - } - } - else { - for (int k = idx; k < keys.Length; ++k) { - var key = keys[k]; - var v = dic.Get(key); - if (v.IsIndirect()) { - int num = ((PRIndirectReference)v).Number; - if (num >= oc || (!partial && pdf.GetPdfObjectRelease(num) == null)) { - dic.Put(key, PdfNull.PDFNULL); - continue; - } - } - if (objs == null) { - state.Push(new object[] { keys, dic, k + 1 }); - } - else { - objs[2] = k + 1; - state.Push(objs); - } - state.Push(v); - break; - } - } - } - } - - } -} diff --git a/pdfpatcher/App/Processor/PdfPageCommandProcessor.cs b/pdfpatcher/App/Processor/PdfPageCommandProcessor.cs deleted file mode 100644 index 26074bfed14515e04d716da2e26cf7214495c61b..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/PdfPageCommandProcessor.cs +++ /dev/null @@ -1,147 +0,0 @@ -using System; -using System.Collections.Generic; -using iTextSharp.text.pdf; -using PDFPatcher.Common; -using PDFPatcher.Model; -using Matrix = iTextSharp.text.pdf.parser.Matrix; - -namespace PDFPatcher.Processor -{ - sealed class PdfPageCommandProcessor : PdfContentStreamProcessor, IPdfPageCommandContainer - { - - public bool HasCommand => Commands.Count > 0; - /// - /// 分析内容后得到的 PDF 命令操作符及操作数列表。 - /// - public IList Commands { get; } - readonly Stack _commandStack; - EnclosingCommand _currentCommand; - float _textWidth; - - public PdfPageCommandProcessor() { - PopulateOperators(); - RegisterContentOperator("TJ", new AccumulatedShowTextArray()); - Commands = new List(); - _commandStack = new Stack(); - } - - public PdfPageCommandProcessor(PRStream form) - : this() { - var resources = form.Locate(PdfName.RESOURCES); - ProcessContent(PdfReader.GetStreamBytes(form), resources); - } - - protected override void DisplayPdfString(PdfString str) { - var gs = CurrentGraphicState; - var font = gs.Font; - if (font == null) { - return; - } - float totalWidth = 0; - foreach (var c in font.DecodeText(str)) { - var w = font.GetWidth(c) / 1000.0f; - var wordSpacing = (c == ' ' ? gs.WordSpacing : 0f); - totalWidth += (w * gs.FontSize + gs.CharacterSpacing + wordSpacing) * gs.HorizontalScaling; - } - - _textWidth = totalWidth; - } - - protected override void InvokeOperator(PdfLiteral oper, List operands) { - base.InvokeOperator(oper, operands); - PdfPageCommand cmd; - var o = oper.ToString(); - switch (o) { - case "TJ": - cmd = new PaceAndTextCommand(oper, operands, GetTextInfo(new PdfString()), CurrentGraphicState.Font); - break; - case "Tj": - case "'": - case "\"": - cmd = new TextCommand(oper, operands, GetTextInfo(operands[0] as PdfString)); - break; - case "Tf": - cmd = new FontCommand(oper, operands, CurrentGraphicState.Font.FontName); - break; - case "cm": - case "Tm": - cmd = new MatrixCommand(oper, operands); - break; - case "BI": - cmd = new InlineImageCommand(oper, operands); - break; - default: - cmd = EnclosingCommand.IsStartingCommand(o) ? new EnclosingCommand(oper, operands) : new PdfPageCommand(oper, operands); - break; - } - - if (EnclosingCommand.IsEndingCommand(o)) { - // 兼容结构异常的 PDF 文档(github: #121) - if (_commandStack.Count > 0) { - _commandStack.Pop(); - _currentCommand = _commandStack.Count > 0 ? _commandStack.Peek() : null; - } - else { - _currentCommand = null; - } - return; - } - if (_currentCommand != null) { - _currentCommand.Commands.Add(cmd); - } - else { - Commands.Add(cmd); - } - if (cmd is EnclosingCommand ec) { - _commandStack.Push(ec); - _currentCommand = ec; - } - } - - /// - /// 将 的内容写入到目标 。 - /// - /// 目标流对象。 - internal void WritePdfCommands(System.IO.Stream target) { - foreach (var item in Commands) { - item.WriteToPdf(target); - } - } - - /// - /// 将 的内容写入到目标 的第 页。 - /// - /// 目标 。 - /// 要写入的页码。 - internal void WritePdfCommands(PdfReader pdf, int pageNumber) { - using (var ms = new System.IO.MemoryStream()) { - WritePdfCommands(ms); - ms.Flush(); - pdf.SafeSetPageContent(pageNumber, ms.ToArray()); - } - } - - internal void WritePdfCommands(PageProcessorContext context) { - WritePdfCommands(context.Pdf, context.PageNumber); - } - - private static string GetOperandsTextValue(List operands) { - var n = operands.ConvertAll((po) => po.Type == PdfObject.NUMBER ? ValueHelper.ToText(((PdfNumber)po).DoubleValue) : null); - n.RemoveAt(n.Count - 1); - return String.Join(" ", n.ToArray()); - } - - private TextInfo GetTextInfo(PdfString text) { - var gs = CurrentGraphicState; - var m = TextMatrix; - return new TextInfo { - PdfString = text, - Text = gs.Font != null ? gs.Font.DecodeText(text) : String.Empty, - Size = gs.FontSize * m[Matrix.I11], - Region = new Bound(m[Matrix.I31], m[Matrix.I32], m[Matrix.I31] + _textWidth, 0), - Font = gs.Font - }; - } - } -} diff --git a/pdfpatcher/App/Processor/PdfPageExtractor.cs b/pdfpatcher/App/Processor/PdfPageExtractor.cs deleted file mode 100644 index 9f60b7ba1b8aea39d5e2a808549250d47f5d1524..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/PdfPageExtractor.cs +++ /dev/null @@ -1,258 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Windows.Forms; -using System.Xml; -using iTextSharp.text.pdf; -using PDFPatcher.Common; -using PDFPatcher.Model; -using Ext = PDFPatcher.Constants.FileExtensions; - -namespace PDFPatcher.Processor -{ - static class PdfPageExtractor - { - internal static void ExtractPages(ExtractPageOptions options, string sourceFile, string targetFile, PdfReader pdf) { - var pn = pdf.NumberOfPages; - if (pn == 1) { - Tracker.TraceMessage("文档只有一页,无法拆分。"); - return; - } - switch (options.SeparatingMode) { - case 0: goto default; - case 1: // 按顶层书签拆分 - SeparateByBookmarks(options, sourceFile, targetFile, ref pdf); - break; - case 2: // 按页数拆分 - SeparateByPageNumber(options, sourceFile, targetFile, ref pdf); - break; - default: - SeparateByPageRanges(options, sourceFile, targetFile, ref pdf); - break; - } - } - - static void SeparateByPageNumber(ExtractPageOptions options, string sourceFile, string targetFile, ref PdfReader pdf) { - var c = 1; - var pn = pdf.NumberOfPages; - if (pn <= options.SeparateByPage) { - Tracker.TraceMessage("拆分的页数超过文档页数,无法拆分。"); - return; - } - for (int i = 1; i <= pn; i += options.SeparateByPage) { - if (pdf == null) { - pdf = PdfHelper.OpenPdfFile(sourceFile, AppContext.LoadPartialPdfFile, false); - } - var tf = RewriteTargetFileName(sourceFile, targetFile, pdf); - var e = i + options.SeparateByPage - 1; - if (e > pn) { - e = pn; - } - //var r = String.Concat (i.ToText (), "-", e.ToText ()); - var s = options.NumberFileNames || c > 1 ? String.Concat("[", c.ToText(), "]") : null; - if (s != null) { - tf = string.Concat(tf.Substring(0, tf.LastIndexOf('.')), s, Ext.Pdf); - } - ExtractPages(options, sourceFile, tf, pdf, PageRangeCollection.CreateSingle(i, e)); - pdf.Close(); - pdf = null; - ++c; - Tracker.IncrementProgress(e - i + 1); - } - } - - static void SeparateByPageRanges(ExtractPageOptions options, string sourceFile, string targetFile, ref PdfReader pdf) { - var rl = options.PageRanges.Split(';', ';'); - var pn = pdf.NumberOfPages; - var i = 1; - var c = 0; - foreach (var range in rl) { - c += PageRangeCollection.Parse(range, 1, pn, true).TotalPages; - } - Tracker.SetProgressGoal(c); - foreach (var range in rl) { - if (pdf == null) { - pdf = PdfHelper.OpenPdfFile(sourceFile, AppContext.LoadPartialPdfFile, false); - } - var tf = RewriteTargetFileName(sourceFile, targetFile, pdf); - var s = options.NumberFileNames || i > 1 ? String.Concat("[", i.ToText(), "]") : null; - if (s != null) { - tf = string.Concat(tf.Substring(0, tf.LastIndexOf('.')), s, Ext.Pdf); - } - var ranges = PageRangeCollection.Parse(range, 1, pn, true); - ExtractPages(options, sourceFile, tf, pdf, ranges); - pdf.Close(); - pdf = null; - ++i; - Tracker.IncrementProgress(ranges.TotalPages); - } - } - - static void SeparateByBookmarks(ExtractPageOptions options, string sourceFile, string targetFile, ref PdfReader pdf) { - var n = pdf.NumberOfPages; - Tracker.TraceMessage("导出文档书签。"); - pdf.ConsolidateNamedDestinations(); - var b = OutlineManager.GetBookmark(pdf, new UnitConverter()); - pdf.Close(); - if (b == null) { - Tracker.TraceMessage("文档没有书签,无法拆分。"); - return; - } - Tracker.SetProgressGoal(n); - var l = new List>(); - var pp = 0; - foreach (XmlElement item in b.ChildNodes) { - if (item == null) { - continue; - } - var p = item.GetAttribute(Constants.DestinationAttributes.Page).ToInt32(); - var t = FileHelper.GetValidFileName(item.GetAttribute(Constants.BookmarkAttributes.Title)); - var a = item.GetAttribute(Constants.DestinationAttributes.Action); - if (a.Length > 0 && a != Constants.ActionType.Goto) { - continue; - } - if (p == 0 || p > n || p <= pp || t.Length == 0) { - continue; - } - l.Add(new KeyValuePair(p, t)); - pp = p; - } - if (l.Count == 1 && l[0].Key == 1) { - Tracker.TraceMessage("文档只有一个有效书签,无法拆分。"); - return; - } - if (l[0].Key > 1) { - l.Insert(0, new KeyValuePair(1, Path.GetFileNameWithoutExtension(sourceFile))); - } - targetFile = RewriteTargetFileName(sourceFile, targetFile, pdf); - var dn = Path.GetDirectoryName(targetFile); - var fn = Path.GetFileNameWithoutExtension(targetFile); - for (int i = 0; i < l.Count; i++) { - int s = l[i].Key, e = i < l.Count - 1 ? l[i + 1].Key - 1 : n; - pdf = PdfHelper.OpenPdfFile(sourceFile, AppContext.LoadPartialPdfFile, false); - var tf = FileHelper.CombinePath(dn, String.Concat( - fn, Path.DirectorySeparatorChar, - options.NumberFileNames ? (i + 1).ToText() + " - " : String.Empty, - l[i].Value, - Ext.Pdf)); - ExtractPages(options, sourceFile, tf, pdf, PageRangeCollection.CreateSingle(s, e)); - pdf.Close(); - Tracker.IncrementProgress(e - s + 1); - } - - } - - static void ExtractPages(ExtractPageOptions options, string sourceFile, FilePath targetFile, PdfReader pdf, PageRangeCollection ranges) { - Tracker.TraceMessage(Tracker.Category.OutputFile, targetFile); - if (FileHelper.ComparePath(sourceFile, targetFile)) { - Tracker.TraceMessage(Tracker.Category.Error, "输入文件和输出文件不能相同。"); - return; - } - if (FileHelper.CheckOverwrite(targetFile) == false) { - return; - } - - var excludeRanges = PageRangeCollection.Parse(options.ExcludePageRanges, 1, pdf.NumberOfPages, false); - targetFile.CreateContainingDirectory(); - - using (var s = new FileStream(targetFile, FileMode.Create)) { - var pages = new int[ranges.TotalPages]; - var remapper = new int[pdf.NumberOfPages + 1]; - int i = 0; - foreach (var range in excludeRanges) { - foreach (var item in range) { - remapper[item] = -1; - } - } - foreach (var range in ranges) { - foreach (var item in range) { - if (remapper[item] < 0) { - continue; - } - pages[i++] = item; - if (remapper[item] == 0) { - remapper[item] = i; - } - } - } - var w = new PdfStamper(pdf, s); - XmlElement bm = null; - if (options.KeepBookmarks) { - Tracker.TraceMessage("导出原文档书签。"); - pdf.ConsolidateNamedDestinations(); - bm = OutlineManager.GetBookmark(pdf, new UnitConverter() { Unit = Constants.Units.Point }); - if (bm?.HasChildNodes == true) { - var processors = new IInfoDocProcessor[] - { - new GotoDestinationProcessor () { - RemoveOrphanDestination = options.RemoveOrphanBookmarks, - PageRemapper = remapper, - TransitionMapper = null - } - }; - PdfDocumentCreator.ProcessInfoItem(bm, processors); - } - } - else { - OutlineManager.KillOutline(pdf); - } - pdf.SelectPages(pages); - pdf.Catalog.Remove(PdfName.PAGELABELS); - if (options.KeepDocumentProperties == false) { - pdf.Trailer.Remove(PdfName.INFO); - pdf.Catalog.Remove(PdfName.METADATA); - } - else if (pdf.Catalog == pdf.Trailer.GetAsDict(PdfName.INFO)) { - FixIncorrectTrailerInfo(pdf); - } - if (bm != null) { - pdf.Catalog.Put(PdfName.OUTLINES, OutlineManager.WriteOutline(w.Writer, bm, ranges.TotalPages)); - w.ViewerPreferences = PdfWriter.PageModeUseOutlines; - } - w.Writer.Info.Put(PdfName.PRODUCER, new PdfString(String.Concat(Application.ProductName, " ", Application.ProductVersion))); - Tracker.TraceMessage("保存文件:" + targetFile); - if (options.EnableFullCompression) { - pdf.RemoveUnusedObjects(); - w.SetFullCompression(); - } - w.Close(); - //Document doc = new Document (); - //PdfSmartCopy w = new PdfSmartCopy (doc, s); - //if (impOptions.ImportDocProperties) { - // w.Info.Merge (info ?? new PdfDictionary ()); - //} - //w.Info.Put (PdfName.CREATOR, new PdfString (String.Concat (Application.ProductName, " ", Application.ProductVersion))); - //doc.Open (); - //var creator = new PdfDocumentCreator (options, impOptions, doc, w); - //creator.ProcessFile (options.SourceItems[0]); - //Tracker.TraceMessage ("保存文件:" + targetFile); - //var bm = creator.PdfBookmarks; - //if (bm != null && bm.DocumentElement != null && bm.DocumentElement.HasChildNodes) { - // Tracker.TraceMessage ("自动生成文档书签。"); - // PdfBookmarkUtility.WriteOutline (w, bm.DocumentElement, w.PageEmpty ? w.CurrentPageNumber - 1 : w.CurrentPageNumber); - // w.ViewerPreferences = PdfWriter.PageModeUseOutlines; - //} - //doc.Close (); - //w.Close (); - } - Tracker.TraceMessage(Tracker.Category.Alert, "成功提取文件内容到 <<" + targetFile + ">>。"); - } - - static void FixIncorrectTrailerInfo(PdfReader pdf) { - var d = new PdfDictionary(); - pdf.Trailer.Put(PdfName.INFO, d); - d.Merge(pdf.Catalog); - d.Put(PdfName.TYPE, PdfName.INFO); - d.Remove(PdfName.PAGES); - d.Remove(PdfName.OUTLINES); - } - - static string RewriteTargetFileName(string sourceFile, string targetFile, PdfReader pdf) { - DocInfoExporter.RewriteDocInfoWithEncoding(pdf, AppContext.Encodings.DocInfoEncoding); - targetFile = Worker.ReplaceTargetFileNameMacros(sourceFile, targetFile, pdf); - targetFile = FileHelper.MakePathRootedAndWithExtension(targetFile, sourceFile, Ext.Pdf, true); - return targetFile; - } - - } -} diff --git a/pdfpatcher/App/Processor/PdfProcessingEngine.cs b/pdfpatcher/App/Processor/PdfProcessingEngine.cs deleted file mode 100644 index 62c30e4eb9bf725b61963d6ad0646e38809c1e92..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/PdfProcessingEngine.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using System.Collections.Generic; -using iTextSharp.text; -using iTextSharp.text.pdf; - -namespace PDFPatcher.Processor -{ - sealed class PdfProcessingEngine - { - ///获取文档处理器列表。 - internal List DocumentProcessors { get; private set; } - - ///获取页面处理器列表。 - internal List PageProcessors { get; private set; } - - public PdfReader Pdf { get; private set; } - public Dictionary ExtraData { get; private set; } - - public PdfProcessingEngine(PdfReader pdf) { - DocumentProcessors = new List(); - PageProcessors = new List(); - Pdf = pdf; - ExtraData = new Dictionary(); - } - - public void CreateProcessors(PatcherOptions settings) { - if (settings.RemoveBookmarks) { - DocumentProcessors.Add(new RemoveBookmarkProcessor()); - } - if (settings.FixContents) { - PageProcessors.Add(new FixContentProcessor()); - } - if (settings.EmbedFonts || settings.EnableFontSubstitutions && settings.FontSubstitutions.Count > 0) { - var d = new Dictionary(settings.FontSubstitutions.Count, StringComparer.CurrentCultureIgnoreCase); - if (settings.EnableFontSubstitutions) { - foreach (var item in settings.FontSubstitutions) { - if (String.IsNullOrEmpty(item.OriginalFont) || String.IsNullOrEmpty(item.Substitution)) { - continue; - } - d[item.OriginalFont] = item; - } - } - if (settings.EmbedFonts || d.Count > 0) { - PageProcessors.Add(new ReplaceFontProcessor(settings.EmbedFonts, settings.TrimTrailingWhiteSpace, d)); - } - } - if (settings.RemovePageForms) { - PageProcessors.Add(new RemoveFormProcessor()); - } - if (settings.RemovePageLinks) { - PageProcessors.Add(new RemoveAnnotationProcessor(PdfName.LINK)); - } - if (settings.RecompressWithJbig2) { - PageProcessors.Add(new ImageRecompressor()); - //this.PageProcessors.Add (new ColorizeBinaryImageProcessor ()); - } - if (settings.RemovePageTextBlocks) { - PageProcessors.Add(new RemoveTextBlockProcessor()); - } - if (settings.RemovePageThumbnails) { - PageProcessors.Add(new RemoveThumbnailProcessor()); - } - if (settings.UnifiedPageSettings.NeedAdjustMargins || settings.UnifiedPageSettings.NeedResize) { - PageProcessors.Add(new PageDimensionProcessor { Settings = settings.UnifiedPageSettings }); - } - if (settings.RemoveLeadingCommandCount > 0 || settings.RemoveTrailingCommandCount > 0) { - PageProcessors.Add(new RemoveWrappedCommandProcessor(settings.RemoveLeadingCommandCount, settings.RemoveTrailingCommandCount)); - } - if (settings.PageSettings.Count > 0) { - foreach (var item in settings.PageSettings) { - PageProcessors.Add(new PageDimensionProcessor { Settings = item }); - } - } - //if (settings.DeskewImages) { - // this.PageProcessors.Add (new ImageDeskewProcessor ()); - //} - PageProcessors.Add(new CommonProcessor(settings)); - } - - internal int EstimateWorkload() { - int workload = 0; - foreach (var p in DocumentProcessors) { - workload += p.EstimateWorkload(Pdf); - } - foreach (var p in PageProcessors) { - workload += p.EstimateWorkload(Pdf); - } - return workload; - } - - internal void ProcessDocument(PdfWriter writer) { - ProcessDocument(writer, null); - } - internal void ProcessDocument(PdfWriter writer, Document document) { - var pp = PageProcessors.ToArray(); - var dc = new DocProcessorContext(this, writer, document); - foreach (var p in DocumentProcessors) { - Tracker.TraceMessage(p.Name); - p.BeginProcess(dc); - } - foreach (var p in pp) { - Tracker.TraceMessage(p.Name); - p.BeginProcess(dc); - } - foreach (var p in DocumentProcessors) { - p.Process(dc); - } - var pn = Pdf.NumberOfPages; - var i = 0; - while ((++i <= pn)) { - var pc = new PageProcessorContext(Pdf, i); - try { - foreach (var p in pp) { - p.Process(pc); - } - if (pc.IsPageContentModified) { - pc.WritePageCommands(); - } - } - catch (Exception) { - Tracker.TraceMessage("在处理文档第 " + i + " 页时出错。"); - throw; - } - } - foreach (var p in DocumentProcessors) { - p.EndProcess(dc); - } - foreach (var p in pp) { - p.EndProcess(Pdf); - } - } - } -} diff --git a/pdfpatcher/App/Processor/SourceItemSerializer.cs b/pdfpatcher/App/Processor/SourceItemSerializer.cs deleted file mode 100644 index 7f9d626e4542de3cac77df7aa75554f3ef7582bc..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/SourceItemSerializer.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using System.Collections.Generic; -using PDFPatcher.Common; -using PDFPatcher.Model; - -namespace PDFPatcher.Processor -{ - internal static class SourceItemSerializer - { - static readonly BookmarkSettings __EmptyBookmark = new BookmarkSettings(); - - /// - /// 保存合并文件功能的列表。 - /// - /// 文件列表项目。 - /// 文件列表的保存路径。 - internal static void Serialize(IList list, FilePath path) { - var d = new PdfInfoXmlDocument(); - var b = d.BookmarkRoot; - foreach (var item in list) { - SerializeSourceItem(d, b, item, path); - } - try { - d.Save(path); - } - catch (Exception ex) { - FormHelper.ErrorBox("在保存文件列表时遇到错误:" + ex.Message); - } - } - - static void SerializeSourceItem(PdfInfoXmlDocument doc, BookmarkContainer container, SourceItem item, FilePath basePath) { - var e = doc.CreateBookmark(item.Bookmark ?? __EmptyBookmark); - switch (item.Type) { - case SourceItem.ItemType.Empty: - break; - case SourceItem.ItemType.Pdf: - e.SetValue(Constants.PageRange, ((SourceItem.Pdf)item).PageRanges); - goto default; - default: - e.SetValue(Constants.DestinationAttributes.Path, basePath.GetRelativePath(item.FilePath)); - break; - } - container.AppendChild(e); - if (item.HasSubItems) { - foreach (var sub in item.Items) { - SerializeSourceItem(doc, e, sub, basePath); - } - } - } - - internal static List Deserialize(FilePath path) { - var d = new PdfInfoXmlDocument(); - try { - d.Load(path); - } - catch (Exception ex) { - FormHelper.ErrorBox("在加载文件列表时遇到错误:" + ex.Message); - } - var bl = d.Bookmarks; - var l = new List(bl.Count); - path = path.Directory; - foreach (BookmarkElement item in bl) { - DeserializeSourceItem(l, item, path); - } - return l; - } - - static void DeserializeSourceItem(List list, BookmarkElement bookmark, FilePath basePath) { - var b = new BookmarkSettings(bookmark); - var p = bookmark.GetValue(Constants.DestinationAttributes.Path); - var s = String.IsNullOrEmpty(p) ? SourceItem.Create() : SourceItem.Create(basePath.Combine(p), false); - if (b.Title.IsNullOrWhiteSpace() == false || b.IsOpened || b.IsBold || b.IsItalic || b.ForeColor.IsEmptyOrTransparent() == false) { - s.Bookmark = b; - } - if (s.Type == SourceItem.ItemType.Pdf) { - ((SourceItem.Pdf)s).PageRanges = bookmark.GetValue(Constants.PageRange); - } - list.Add(s); - if (bookmark.HasSubBookmarks) { - foreach (BookmarkElement sub in bookmark.SubBookmarks) { - DeserializeSourceItem(s.Items, sub, basePath); - } - } - } - } -} diff --git a/pdfpatcher/App/Processor/Worker.cs b/pdfpatcher/App/Processor/Worker.cs deleted file mode 100644 index 0765b48872ab8585faddc4b8ee98988a664d4784..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Processor/Worker.cs +++ /dev/null @@ -1,1020 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Windows.Forms; -using System.Xml; -using iTextSharp.text; -using iTextSharp.text.pdf; -using MuPdfSharp; -using PDFPatcher.Common; -using PDFPatcher.Model; -using Ext = PDFPatcher.Constants.FileExtensions; - -namespace PDFPatcher.Processor -{ - internal static class Worker - { - const string OperationCanceled = "已经取消操作。"; - - private static PdfReader OpenPdf(string sourceFile, bool loadPartial, bool removeUnusedObjects) { - try { - Tracker.TraceMessage(Tracker.Category.ImportantMessage, String.Concat("打开 PDF 文件:<<", sourceFile, ">>。")); - return PdfHelper.OpenPdfFile(sourceFile, loadPartial, removeUnusedObjects); - } - catch (FileNotFoundException) { - FormHelper.ErrorBox(String.Concat("找不到文件:“", sourceFile, "”。")); - return null; - } - catch (iTextSharp.text.exceptions.BadPasswordException) { - Tracker.TraceMessage(Tracker.Category.Error, Messages.PasswordInvalid); - FormHelper.ErrorBox(Messages.PasswordInvalid); - return null; - } - catch (Exception ex) { - FormHelper.ErrorBox("在打开 PDF 文件时遇到错误:\n" + ex.Message); -#if DEBUG - Tracker.TraceMessage(ex); -#endif - return null; - } - } - - internal static void ExtractImages(string sourceFile, ImageExtracterOptions options) { - const int loadDocProgressWeight = 10; - Tracker.TraceMessage(Tracker.Category.InputFile, sourceFile); - var pdf = OpenPdf(sourceFile, true, false); // 由于导出图片一般不需要往复访问文档,可用此选项降低内存占用及提高打开速度 - if (pdf == null) { - return; - } - - var targetPath = options.OutputPath; - var ranges = PageRangeCollection.Parse(options.PageRange, 1, pdf.NumberOfPages, true); - var loadCount = loadDocProgressWeight + ranges.TotalPages; - Tracker.SetProgressGoal(loadCount); - var op = targetPath; - var om = options.FileMask; - try { - if (Directory.Exists(targetPath) == false) { - Directory.CreateDirectory(targetPath); - } - Tracker.TraceMessage("正在导出图片。"); - Tracker.TrackProgress(loadDocProgressWeight); - if (FileHelper.HasFileNameMacro(op)) { - options.OutputPath = ReplaceTargetFileNameMacros(sourceFile, op, pdf); - } - if (FileHelper.HasFileNameMacro(om)) { - options.FileMask = ReplaceTargetFileNameMacros(sourceFile, om, pdf); - } - var exp = new ImageExtractor(options, pdf); - foreach (var range in ranges) { - foreach (var i in range) { - exp.ExtractPageImages(pdf, i); - if (exp.InfoList.Count > 0) { - Tracker.TraceMessage(Tracker.Category.OutputFile, exp.InfoList[exp.InfoList.Count - 1].FileName); - } - Tracker.IncrementProgress(1); - } - } - Tracker.TrackProgress(loadCount); - Tracker.TraceMessage(Tracker.Category.Alert, "成功提取图片文件,存放目录为:<<" + targetPath + ">>。"); - } - catch (OperationCanceledException) { - Tracker.TraceMessage(Tracker.Category.ImportantMessage, OperationCanceled); - } - catch (Exception ex) { - Tracker.TraceMessage(ex); - FormHelper.ErrorBox("在导出图片时遇到错误:\n" + ex.Message); - } - finally { - options.OutputPath = op; - options.FileMask = om; - pdf?.Close(); - } - } - - internal static void RenderPages(string sourceFile, ImageRendererOptions options) { - const int loadDocProgressWeight = 10; - Tracker.TraceMessage(Tracker.Category.InputFile, sourceFile); - options.TintColor = System.Drawing.Color.Transparent; - if (Directory.Exists(options.ExtractImagePath) == false) { - Directory.CreateDirectory(options.ExtractImagePath); - } - MuDocument mupdf = null; - try { - mupdf = PdfHelper.OpenMuDocument(sourceFile); - var ranges = PageRangeCollection.Parse(options.ExtractPageRange, 1, mupdf.PageCount, true); - int loadCount = loadDocProgressWeight + ranges.TotalPages; - Tracker.SetProgressGoal(loadCount); - Tracker.TraceMessage("正在转换图片。"); - Tracker.TrackProgress(loadDocProgressWeight); - foreach (var range in ranges) { - foreach (var i in range) { - var fn = FileHelper.CombinePath(options.ExtractImagePath, i.ToString(options.FileMask) + options.FileFormatExtension); - using (var p = mupdf.LoadPage(i)) - using (var bmp = p.RenderBitmapPage(options.ImageWidth, 0, options)) { - if (bmp == null) { - Tracker.TraceMessage(Tracker.Category.Error, "页面" + i + "的尺寸为空。"); - } - else if (options.FileFormat == ImageFormat.Tiff) { - using (var b = Imaging.BitmapHelper.ToBitonal(bmp)) { - Imaging.BitmapHelper.SaveAs(b, fn); - } - } - else { - var uc = Imaging.BitmapHelper.GetPalette(bmp); - if (uc.Length > 256 && options.Quantize) { - using (var b = Imaging.WuQuantizer.QuantizeImage(bmp)) { - Imaging.BitmapHelper.SaveAs(b, fn); - } - } - else if (uc.Length <= 256 && Imaging.BitmapHelper.IsIndexed(bmp) == false) { - using (var b = Imaging.BitmapHelper.ToIndexImage(bmp, uc)) { - Imaging.BitmapHelper.SaveAs(b, fn); - } - } - else if (options.FileFormat == ImageFormat.Jpeg) { - Imaging.JpgHelper.Save(bmp, fn, options.JpegQuality); - } - else { - Imaging.BitmapHelper.SaveAs(bmp, fn); - } - } - } - Tracker.TraceMessage(Tracker.Category.OutputFile, fn); - Tracker.IncrementProgress(1); - } - } - Tracker.TrackProgress(loadCount); - Tracker.TraceMessage(Tracker.Category.Alert, "成功转换图片文件,存放目录为:<<" + options.ExtractImagePath + ">>。"); - } - catch (OperationCanceledException) { - Tracker.TraceMessage(Tracker.Category.ImportantMessage, OperationCanceled); - } - catch (Exception ex) { - Tracker.TraceMessage(ex); - FormHelper.ErrorBox("在转换图片时遇到错误:\n" + ex.Message); - } - finally { - mupdf?.Dispose(); - } - } - - internal static void RenderPagesToPdf(string sourceFile, ImageRendererOptions options, Document doc) { - const int loadDocProgressWeight = 10; - Tracker.TraceMessage(Tracker.Category.InputFile, sourceFile); - Tracker.TraceMessage(Tracker.Category.OutputFile, options.ExtractImagePath); - options.TintColor = System.Drawing.Color.Transparent; - ((FilePath)options.ExtractImagePath).CreateContainingDirectory(); - MuDocument mupdf = null; - try { - mupdf = PdfHelper.OpenMuDocument(sourceFile); - var ranges = PageRangeCollection.Parse(options.ExtractPageRange, 1, mupdf.PageCount, true); - int loadCount = loadDocProgressWeight + ranges.TotalPages; - Tracker.SetProgressGoal(loadCount); - Tracker.TraceMessage("正在转换图片。"); - Tracker.TrackProgress(loadDocProgressWeight); - MemoryStream ms = new MemoryStream(); - var fn = options.FileFormatExtension; - foreach (var range in ranges) { - foreach (var i in range) { - ms.Position = 0; - using (var p = mupdf.LoadPage(i)) - using (var bmp = p.RenderBitmapPage(options.ImageWidth, 0, options)) { - if (bmp == null) { - Tracker.TraceMessage(Tracker.Category.Error, "页面" + i + "的尺寸为空。"); - } - else if (options.FileFormat == ImageFormat.Tiff) { - using (var b = Imaging.BitmapHelper.ToBitonal(bmp)) { - Imaging.BitmapHelper.SaveAs(b, fn, ms); - } - } - else { - var uc = Imaging.BitmapHelper.GetPalette(bmp); - if (uc.Length > 256 && options.Quantize) { - using (var b = Imaging.WuQuantizer.QuantizeImage(bmp)) { - Imaging.BitmapHelper.SaveAs(b, fn, ms); - } - } - else if (uc.Length <= 256 && Imaging.BitmapHelper.IsIndexed(bmp) == false) { - using (var b = Imaging.BitmapHelper.ToIndexImage(bmp, uc)) { - Imaging.BitmapHelper.SaveAs(b, fn, ms); - } - } - else if (options.FileFormat == ImageFormat.Jpeg) { - Imaging.JpgHelper.Save(bmp, ms, options.JpegQuality); - } - else { - Imaging.BitmapHelper.SaveAs(bmp, fn, ms); - } - } - - doc.SetPageSize((options.Rotation % 180) == 0 - ? new iTextSharp.text.Rectangle(p.Bound.Width, p.Bound.Height) - : new iTextSharp.text.Rectangle(p.Bound.Height, p.Bound.Width)); - doc.NewPage(); - } - var image = Image.GetInstance(ms.ToArray(), true); - image.ScalePercent(72f / image.DpiX.SubstituteDefault(72) * 100f, 72f / image.DpiY.SubstituteDefault(72) * 100f); - doc.Add(image); - Tracker.IncrementProgress(1); - } - } - Tracker.TrackProgress(loadCount); - Tracker.TraceMessage(Tracker.Category.Alert, "成功转换图片文件,存放位置为:<<" + options.ExtractImagePath + ">>。"); - } - catch (OperationCanceledException) { - Tracker.TraceMessage(Tracker.Category.ImportantMessage, OperationCanceled); - } - catch (Exception ex) { - Tracker.TraceMessage(ex); - FormHelper.ErrorBox("在转换图片时遇到错误:\n" + ex.Message); - } - finally { - mupdf?.Dispose(); - } - } - - internal static void ExportInfo(FilePath sourceFile, FilePath targetFile) { - Tracker.TraceMessage(Tracker.Category.InputFile, sourceFile); - Tracker.TraceMessage(Tracker.Category.OutputFile, targetFile); - var r = OpenPdf(sourceFile, AppContext.LoadPartialPdfFile, false); - if (r == null) { - return; - } - if (targetFile.IsValidPath == false || targetFile.FileName.Length == 0) { - Tracker.TraceMessage(Tracker.Category.Error, Messages.InfoFileNameInvalid); - FormHelper.ErrorBox(Messages.InfoFileNameInvalid); - return; - } - targetFile = FileHelper.MakePathRootedAndWithExtension(targetFile, sourceFile, Ext.Xml, false); - targetFile.CreateContainingDirectory(); - var export = new DocInfoExporter(r, AppContext.Exporter); - if (AppContext.Exporter.ExtractImages) { - AppContext.Exporter.Images.OutputPath = FileHelper.CombinePath(targetFile.Directory, targetFile.FileNameWithoutExtension + "图片文件\\"); - } - - try { - Tracker.TraceMessage("正在导出信息文件。"); - if (targetFile.HasExtension(Ext.Txt)) { - Tracker.SetProgressGoal(50); - using (TextWriter w = new StreamWriter(targetFile, false, AppContext.Exporter.GetEncoding())) { - DocInfoExporter.WriteDocumentInfoAttributes(w, sourceFile, r.NumberOfPages); - export.ExportDocument(w); - w.WriteLine(); - Tracker.SetProgressGoal(10); - r.ConsolidateNamedDestinations(); - export.ExportBookmarks(OutlineManager.GetBookmark(r, new UnitConverter()), w, 0, false); - } - } - else { - var workload = export.EstimateWorkload(); - Tracker.SetProgressGoal(workload); - using (XmlWriter w = XmlWriter.Create(targetFile, DocInfoExporter.GetWriterSettings())) { - w.WriteStartDocument(); - w.WriteStartElement(Constants.PdfInfo); - DocInfoExporter.WriteDocumentInfoAttributes(w, sourceFile, r.NumberOfPages); - export.ExportDocument(w); - w.WriteEndElement(); - } - } - Tracker.TraceMessage(Tracker.Category.Alert, "成功导出信息文件到 <<" + targetFile + ">>。"); - //if (this._BookmarkBox.Text.Length == 0) { - // this._BookmarkBox.Text = targetFile; - //} - //if (Common.Form.YesNoBox ("已完成导出信息文件到 " + targetFile + ",是否使用内置的编辑器编辑文件?") == DialogResult.Yes) { - // ShowInfoFileEditorForm (targetFile); - //} - } - catch (OperationCanceledException) { - Tracker.TraceMessage(Tracker.Category.ImportantMessage, OperationCanceled); - } - catch (System.Text.EncoderFallbackException ex) { - Tracker.TraceMessage(ex); - FormHelper.ErrorBox("在导出信息文件时遇到错误:\n" + ex.Message + "\n\n请选择在导出信息选项中选择其它编码方式。"); - } - catch (Exception ex) { - Tracker.TraceMessage(ex); - FormHelper.ErrorBox("在导出信息文件时遇到错误:\n" + ex.Message); - } - finally { - r?.Close(); - } - } - - internal static void ConvertBookmark(string sourceFile, string targetFile) { - Tracker.TraceMessage(Tracker.Category.InputFile, sourceFile); - Tracker.TraceMessage(Tracker.Category.OutputFile, targetFile); - try { - var infoDoc = new PdfInfoXmlDocument(); - OutlineManager.ImportSimpleBookmarks(sourceFile, infoDoc); - using (var w = XmlWriter.Create(targetFile, DocInfoExporter.GetWriterSettings())) { - infoDoc.Save(w); - } - Tracker.TraceMessage(Tracker.Category.Alert, "成功转换信息文件到 <<" + targetFile + ">>。"); - } - catch (OperationCanceledException) { - Tracker.TraceMessage(Tracker.Category.ImportantMessage, OperationCanceled); - } - catch (Exception ex) { - Tracker.TraceMessage(ex); - FormHelper.ErrorBox("在转换书签文件时发生错误:\n" + ex.Message); - } - } - - internal static void PatchDocument(SourceItem.Pdf sourceFile, FilePath targetFile, object infoDoc, ImporterOptions options, PatcherOptions pdfSettings) { - var sourcePath = sourceFile.FilePath.ToString(); - if (sourceFile.FilePath.IsEmpty) { - Tracker.TraceMessage(Tracker.Category.Error, "输入文件名为空。"); - return; - } - if (String.IsNullOrEmpty(targetFile) || targetFile.IsEmpty) { - Tracker.TraceMessage(Tracker.Category.Error, "输出文件名为空。"); - return; - } - Tracker.TraceMessage(Tracker.Category.InputFile, sourcePath); - Tracker.TraceMessage(Tracker.Category.OutputFile, targetFile); - bool overwriteSource = false; - var pdf = OpenPdf(sourcePath, AppContext.LoadPartialPdfFile, true); - if (pdf == null) { - return; - } - try { - DocInfoImporter import; - var xInfoDoc = infoDoc as PdfInfoXmlDocument; - var docPath = infoDoc as string; - if (xInfoDoc != null) { - import = new DocInfoImporter(options, pdf, pdfSettings, xInfoDoc); - } - else if (String.IsNullOrEmpty(docPath)) { - Tracker.TraceMessage("没有指定信息文件,将按程序界面的设置执行补丁。"); - import = new DocInfoImporter(options, pdf, pdfSettings, null); - Tracker.TraceMessage("加载源 PDF 文件信息完毕,准备执行补丁操作。"); - } - else { - Tracker.TraceMessage(Tracker.Category.ImportantMessage, String.Concat("加载信息文件:<<", docPath, ">>。")); - import = new DocInfoImporter(options, docPath); - if (import.InfoDoc != null && VerifyInfoDocument(import.InfoDoc) == false) - return; - } - var pdfEngine = new PdfProcessingEngine(pdf); - pdfEngine.CreateProcessors(pdfSettings); - int workload = 110; - workload += pdfEngine.EstimateWorkload(); - Tracker.SetProgressGoal(workload); - Tracker.TrackProgress(10); - - if (pdf.ConfirmUnethicalMode() == false) { - return; - } - - Tracker.TraceMessage("导入文档属性。"); - //var pdfInfo = DocInfoExporter.RewriteDocInfoWithEncoding (pdf.Trailer.GetAsDict (PdfName.INFO), AppContext.Encodings.DocInfoEncoding); - var info = pdfSettings.MetaData.SpecifyMetaData - ? pdfSettings.MetaData - //: sourceFile.DocInfo; - // 不再使用书签文件的文件属性 - : import.ImportDocumentInformation() - ?? sourceFile.DocInfo; - DocInfoImporter.ImportDocumentInformation(info, pdf, sourcePath); - Tracker.TrackProgress(20); - - if (FileHelper.HasFileNameMacro(targetFile)) { - targetFile = ReplaceTargetFileNameMacros(sourcePath, targetFile, pdf); - } - targetFile = FileHelper.MakePathRootedAndWithExtension(targetFile, sourcePath, Ext.Pdf, true); - targetFile = targetFile.Normalize(); - - Tracker.TraceMessage(Tracker.Category.OutputFile, targetFile); - if (FileHelper.ComparePath(sourcePath, targetFile)) { - if (FormHelper.YesNoBox("是否覆盖原始 PDF 文件?\n如处理过程出现错误,覆盖操作将导致原始数据无法恢复!") == DialogResult.No) { - Tracker.TraceMessage(Tracker.Category.Error, Messages.SourceFileEqualsTargetFile); - return; - } - overwriteSource = true; - targetFile = sourceFile.FilePath.ChangeExtension(Ext.Tmp).ToString(); - } - else if (FileHelper.CheckOverwrite(targetFile) == false) { - return; - } - - targetFile.CreateContainingDirectory(); - - using (Stream s = new FileStream(targetFile, FileMode.Create)) { - var st = new PdfStamper(pdf, s); - pdfEngine.ProcessDocument(st.Writer); - #region 处理信息文件 - var processors = new List(); - if (pdfSettings.ViewerPreferences.RemoveZoomRate) { - processors.Add(new RemoveZoomRateProcessor()); - } - if (pdfEngine.ExtraData.ContainsKey(DocProcessorContext.CoordinateTransition) && pdfSettings.UnifiedPageSettings.ScaleContent) { - processors.Add(new GotoDestinationProcessor() { - TransitionMapper = pdfEngine.ExtraData[DocProcessorContext.CoordinateTransition] as CoordinateTranslationSettings[] - }); - } - if (pdfSettings.ViewerPreferences.ForceInternalLink) { - processors.Add(new ForceInternalDestinationProcessor()); - } - //var cts = new CoordinateTranslationSettings[pdf.NumberOfPages + 1]; // 页面的位置偏移量 - //var sc = false; - //if (pdfSettings.PageSettings.Count > 0) { - // Tracker.TraceMessage ("重设页面尺寸。"); - // pdf.ResetReleasePage (); - // foreach (var item in pdfSettings.PageSettings) { - // var ranges = PageRangeCollection.Parse (item.PageRanges, 1, pdf.NumberOfPages, true); - // foreach (var range in ranges) { - // foreach (var i in range) { - // var s = PageDimensionProcessor.ResizePage (pdf.GetPageN (i), item.PaperSize, item.HorizontalAlign, item.VerticalAlign, -1, item.ScaleContent); - // if (item.ScaleContent && s.XScale != 1 && s.YScale != 1) { - // PageDimensionProcessor.ScaleContent (pdf, i, s); - // cts[i] = s; // TODO: 需要解决重复指定相同页面的问题 - // sc = true; - // } - // } - // } - // } - // pdf.ResetReleasePage (); - //} - if (pdfSettings.UnifiedPageSettings.PaperSize.PaperName == PaperSize.AsPageSize) { - import.ImportPageSettings(pdf); - } - //if (sc == false) { - // cts = null; - //} - #endregion - - if (pdfSettings.FullCompression) { - st.SetFullCompression(); - } - //st.Writer.CompressionLevel = ContextData.CreateDocumentOptions.CompressionLevel; - var labels = DocInfoImporter.ImportPageLabels(pdfSettings.PageLabels) ?? import.ImportPageLabels(); - if (labels != null) { - st.Writer.PageLabels = labels; - } - if (options.ImportPageLinks || pdfSettings.UnifiedPageSettings.PaperSize.PaperName != PaperSize.AsPageSize/* sc*/) { - import.ImportPageLinks(pdf, st); - } - if (import.InfoDoc != null) { - PdfDocumentCreator.ProcessInfoItem(import.InfoDoc.DocumentElement.SelectSingleNode(Constants.PageLink) as XmlElement, processors); - PdfDocumentCreator.ProcessInfoItem(import.InfoDoc.DocumentElement.SelectSingleNode(Constants.NamedDestination) as XmlElement, processors); - } - XmlElement bookmarks = null; - if (options.ImportBookmarks && pdfSettings.RemoveBookmarks == false || xInfoDoc != null) { - Tracker.TraceMessage("导入书签。"); - bookmarks = import.GetBookmarks() ?? OutlineManager.GetBookmark(pdf, new UnitConverter() { Unit = Constants.Units.Point }); - } - if (bookmarks != null) { - // 预处理书签 - processors.Add(new CollapseBookmarkProcessor() { BookmarkStatus = pdfSettings.ViewerPreferences.CollapseBookmark }); - PdfDocumentCreator.ProcessInfoItem(bookmarks, processors); - if (bookmarks.ChildNodes.Count > 0 || xInfoDoc != null) { - import.ImportNamedDestinations(pdf, st.Writer); - OutlineManager.KillOutline(pdf); - var bm = OutlineManager.WriteOutline(st.Writer, bookmarks, pdf.NumberOfPages); - if (bm != null) { - pdf.Catalog.Put(PdfName.OUTLINES, bm); - } - if (pdf.Catalog.Contains(PdfName.PAGEMODE) == false) { - pdf.Catalog.Put(PdfName.PAGEMODE, PdfName.USEOUTLINES); - } - } - else if (String.IsNullOrEmpty(docPath) == false) { - OutlineManager.KillOutline(pdf); - } - } - Tracker.IncrementProgress(10); - Tracker.TraceMessage("导入文档设置。"); - import.ImportViewerPreferences(pdf); - DocInfoImporter.OverrideViewerPreferences(pdfSettings.ViewerPreferences, pdf, st.Writer); - //import.OverrideDocumentSettings (pdf); - Tracker.IncrementProgress(5); - Tracker.TraceMessage("清理输出文件。"); - pdf.RemoveUnusedObjects(); - if (pdf.AcroForm == null) { - pdf.Trailer.Locate(PdfName.ROOT).Remove(PdfName.ACROFORM); - } - Tracker.IncrementProgress(10); - Tracker.TraceMessage("保存文件:" + targetFile); - st.Close(); - Tracker.TrackProgress(workload); - } - } - catch (OperationCanceledException) { - Tracker.TraceMessage(Tracker.Category.ImportantMessage, OperationCanceled); - return; - } - catch (Exception ex) { - Tracker.TraceMessage(ex); - FormHelper.ErrorBox("在导入信息时发生错误:\n" + ex.Message); - return; - } - finally { - if (pdf != null) { - try { - pdf.Close(); - } - catch (Exception ex) { - // ignore exception - Tracker.TraceMessage(ex); - } - } - } - if (overwriteSource) { - try { - Tracker.TraceMessage("覆盖输入文件。"); - File.Delete(sourcePath); - File.Move(targetFile, sourcePath); - targetFile = sourcePath; - } - catch (Exception) { - FormHelper.ErrorBox("无法覆盖输入文件。\n请手工将“" + Ext.Tmp + "”后缀的临时文件更名为输入文件。"); - } - } - Tracker.TraceMessage(Tracker.Category.Alert, "成功导入信息到 <<" + targetFile + ">>。"); - } - - internal static string ReplaceTargetFileNameMacros(string sourceFile, string targetFile, PdfReader pdf) { - try { - return ReplaceTargetFileNameMacros(sourceFile, targetFile, pdf.Trailer.GetAsDict(PdfName.INFO), pdf.NumberOfPages); - } - catch (IOException) { - return ReplaceTargetFileNameMacros(sourceFile, targetFile, null as PdfDictionary, 0); - } - } - /// - /// 替换目标文件名的替代符。 - /// - /// 用于替换的源文件名。 - /// 包含替代符的目标文件名。 - /// 源文件的元数据属性。 - /// 源文件的页数。 - /// 替换目标文件名后的文件名。 - internal static string ReplaceTargetFileNameMacros(string sourceFile, string targetFile, PdfDictionary info, int pageCount) { - string p = null; // 文档属性 - if (info != null) { - if (info.Contains(PdfName.TITLE)) { - p = FileHelper.GetValidFileName(info.GetAsString(PdfName.TITLE).ToUnicodeString()); - } - targetFile = targetFile.Replace(Constants.FileNameMacros.TitleProperty, p ?? Path.GetFileNameWithoutExtension(sourceFile)); - p = String.Empty; - if (info.Contains(PdfName.SUBJECT)) { - p = FileHelper.GetValidFileName(info.GetAsString(PdfName.SUBJECT).ToUnicodeString()); - } - targetFile = targetFile.Replace(Constants.FileNameMacros.SubjectProperty, p); - p = String.Empty; - if (info.Contains(PdfName.AUTHOR)) { - p = FileHelper.GetValidFileName(info.GetAsString(PdfName.AUTHOR).ToUnicodeString()); - } - targetFile = targetFile.Replace(Constants.FileNameMacros.AuthorProperty, p); - p = String.Empty; - if (info.Contains(PdfName.KEYWORDS)) { - p = FileHelper.GetValidFileName(info.GetAsString(PdfName.KEYWORDS).ToUnicodeString()); - } - targetFile = targetFile.Replace(Constants.FileNameMacros.KeywordsProperty, p); - } - return targetFile - .Replace(Constants.FileNameMacros.FileName, Path.GetFileNameWithoutExtension(sourceFile)) - .Replace(Constants.FileNameMacros.FolderName, Path.GetFileName(Path.GetDirectoryName(sourceFile))) - .Replace(Constants.FileNameMacros.PathName, FileHelper.CombinePath(sourceFile.Substring(0, sourceFile.LastIndexOf(Path.DirectorySeparatorChar)), String.Empty)) - .Replace(Constants.FileNameMacros.PageCount, pageCount.ToText()); - } - - private static bool VerifyInfoDocument(XmlDocument infoDoc) { - var root = infoDoc.DocumentElement; - switch (root.Name) { - case Constants.PdfInfo: - // 使用中文的书签 - var v = root.GetAttribute(Constants.Info.ProductVersion); - if (v != Constants.InfoDocVersion - && FormHelper.YesNoBox(String.Concat("信息文件不是用这个版本的程序生成的,可能会导入不成功,是否继续?\n当前程序的版本是:", Application.ProductVersion, "\n信息文件的导出程序版本是:", v)) == DialogResult.No) { - return false; - } - break; - default: - FormHelper.ErrorBox("信息文件格式有误,根元素不是“" + Constants.PdfInfo + "”。"); - return false; - } - return true; - } - - internal static void ExtractPages(ExtractPageOptions options, string sourceFile, string targetFile) { - Tracker.TraceMessage(Tracker.Category.InputFile, sourceFile); - Tracker.TraceMessage(Tracker.Category.OutputFile, targetFile); - var r = OpenPdf(sourceFile, AppContext.LoadPartialPdfFile, false); - if (r == null) { - return; - } - try { - if (r.ConfirmUnethicalMode() == false) { - return; - } - PdfPageExtractor.ExtractPages(options, sourceFile, targetFile, r); - } - catch (OperationCanceledException) { - Tracker.TraceMessage(Tracker.Category.ImportantMessage, OperationCanceled); - } - catch (Exception ex) { - Tracker.TraceMessage(ex); - FormHelper.ErrorBox("在导出页面内容时出错:\n" + ex.Message); - } - finally { - if (r != null) { - try { - r.Close(); - } - catch (Exception ex) { - // ignore exception - Tracker.TraceMessage(ex); - } - } - } - } - - internal static void MergeDocuments(ICollection sources, FilePath targetFile, string infoFile) { - targetFile = targetFile.EnsureExtension(Ext.Pdf); - Tracker.TraceMessage(Tracker.Category.OutputFile, targetFile.ToString()); - var option = AppContext.Merger; - var impOptions = AppContext.Importer; - Document doc = null; - var sink = new DocumentSink(sources, true); - if (sink.Workload == 0) { - Tracker.TraceMessage(Tracker.Category.ImportantMessage, "合并文件列表不包含图片或 PDF 文件。"); - return; - } - Tracker.SetProgressGoal(10 + sink.Workload); - Tracker.TrackProgress(1); - try { - GeneralInfo info = null; - PdfPageLabels labels = null; - BookmarkContainer bookmarks = null; - if (String.IsNullOrEmpty(infoFile) == false) { - Tracker.TraceMessage(Tracker.Category.ImportantMessage, String.Concat("加载信息文件:<<", infoFile, ">>。")); - var import = new DocInfoImporter(impOptions, infoFile); - info = import.ImportDocumentInformation(); - labels = import.ImportPageLabels(); - bookmarks = import.GetBookmarks(); - } - if (labels == null && option.PageLabels.Count > 0) { - labels = DocInfoImporter.ImportPageLabels(option.PageLabels); - } - - var f = targetFile.EnsureExtension(Ext.Pdf); - Tracker.TraceMessage(Tracker.Category.OutputFile, f.ToString()); - Tracker.TraceMessage(Tracker.Category.ImportantMessage, String.Concat("输出到文件:", f, "。")); - if (f.IsValidPath == false) { - Tracker.TraceMessage(Tracker.Category.Error, "输出文件路径无效。"); - return; - } - f.CreateContainingDirectory(); - using (Stream s = new FileStream(f, FileMode.Create)) { - var ps = option.PageSettings; - doc = new Document( - new iTextSharp.text.Rectangle(ps.PaperSize.Width, ps.PaperSize.Height), - ps.Margins.Left, ps.Margins.Right, ps.Margins.Top, ps.Margins.Bottom - ); - PdfCopy w = option.Deduplicate ? new PdfSmartCopy(doc, s) : new PdfCopy(doc, s); - if (option.FullCompression) { - w.SetFullCompression(); - } - //w.CompressionLevel = ContextData.CreateDocumentOptions.CompressionLevel; - doc.Open(); - doc.AddCreator(Application.ProductName + " " + Application.ProductVersion); - if (labels != null) { - w.PageLabels = labels; - } - - Tracker.IncrementProgress(10); - var creator = new PdfDocumentCreator(sink, option, impOptions, doc, w); - foreach (var item in sources) { - creator.ProcessFile(item, creator.PdfBookmarks.BookmarkRoot); - } - Tracker.TraceMessage("设置文档选项。"); - DocInfoImporter.ImportDocumentInformation(option.MetaData.SpecifyMetaData - ? option.MetaData - : info, doc); - DocInfoImporter.OverrideViewerPreferences(option.ViewerPreferences, null, w); - if ((bookmarks == null || bookmarks.HasChildNodes == false) && creator.PdfBookmarks.DocumentElement.HasChildNodes) { - bookmarks = creator.PdfBookmarks.BookmarkRoot; - } - if (bookmarks != null && bookmarks.HasChildNodes) { - Tracker.TraceMessage("写入文档书签。"); - OutlineManager.WriteOutline(w, bookmarks, w.GetPageCount()); - w.ViewerPreferences = PdfWriter.PageModeUseOutlines; - } - Tracker.TraceMessage("写入文件索引。"); - Tracker.TraceMessage(Tracker.Category.Alert, $"合并了 {creator.InputDocumentCount.ToText()} 个文件共 {w.GetPageCount()} 页到:<<" + targetFile.ToString() + ">>。"); - w.Close(); - } - } - catch (OperationCanceledException) { - Tracker.TraceMessage(Tracker.Category.ImportantMessage, OperationCanceled); - } - catch (Exception ex) { - Tracker.TraceMessage(ex); - FormHelper.ErrorBox("在生成文档时出错:\n" + ex.Message); - } - finally { - if (doc != null) { - try { - doc.Close(); - } - catch (Exception ex) { - // ignore exception - Tracker.TraceMessage(ex); - } - } - } - } - - internal static void CreateBookmark(string sourceFile, string bookmarkFile, AutoBookmarkOptions options) { - Tracker.TraceMessage(Tracker.Category.InputFile, sourceFile); - Tracker.TraceMessage(Tracker.Category.OutputFile, bookmarkFile); - var r = OpenPdf(sourceFile, AppContext.LoadPartialPdfFile, false); - if (r == null) { - return; - } - if (FileHelper.IsPathValid(bookmarkFile) == false || Path.GetFileName(bookmarkFile).Length == 0) { - Tracker.TraceMessage(Tracker.Category.Error, Messages.InfoFileNameInvalid); - FormHelper.ErrorBox(Messages.InfoFileNameInvalid); - return; - } - bookmarkFile = FileHelper.MakePathRootedAndWithExtension(bookmarkFile, sourceFile, Ext.Xml, false); - Tracker.TraceMessage(Tracker.Category.OutputFile, bookmarkFile); - - if (options.CreateBookmarkForFirstPage) { - options.FirstPageTitle = Path.GetFileNameWithoutExtension(sourceFile); - } - var creator = new AutoBookmarkCreator(r, options); - - try { - Tracker.TraceMessage("正在分析 PDF 文件。"); - var workload = creator.EstimateWorkload(); - Tracker.SetProgressGoal(workload); - using (XmlWriter w = XmlWriter.Create(bookmarkFile, DocInfoExporter.GetWriterSettings())) { - w.WriteStartDocument(); - w.WriteStartElement(Constants.PdfInfo); - w.WriteAttributeString(Constants.Info.ProductName, Application.ProductName); - w.WriteAttributeString(Constants.Info.ProductVersion, Constants.InfoDocVersion); - w.WriteAttributeString(Constants.Info.ExportDate, DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss")); - //w.WriteAttributeString (Constants.Info.DocumentName, Path.GetFileNameWithoutExtension (sourceFile)); - w.WriteAttributeString(Constants.Info.DocumentPath, sourceFile); - w.WriteAttributeString(Constants.Info.PageNumber, r.NumberOfPages.ToText()); - creator.ExportAutoBookmarks(w, options); - w.WriteEndElement(); - } - Tracker.TraceMessage(Tracker.Category.Alert, "成功导出信息文件到 <<" + bookmarkFile + ">>。"); - } - catch (OperationCanceledException) { - Tracker.TraceMessage(Tracker.Category.ImportantMessage, OperationCanceled); - } - catch (System.Text.EncoderFallbackException ex) { - Tracker.TraceMessage(ex); - FormHelper.ErrorBox("在导出信息文件时遇到错误:\n" + ex.Message + "\n\n请选择在导出信息选项中选择其它编码方式。"); - } - catch (Exception ex) { - Tracker.TraceMessage(ex); - FormHelper.ErrorBox("在导出信息文件时遇到错误:\n" + ex.Message); - } - finally { - if (r != null) { - r.Close(); - } - } - } - - internal static void Ocr(string sourceFile, string bookmarkFile, OcrOptions options) { - Tracker.TraceMessage(Tracker.Category.InputFile, sourceFile); - Tracker.TraceMessage(Tracker.Category.OutputFile, bookmarkFile); - var r = OpenPdf(sourceFile, AppContext.LoadPartialPdfFile, false); - if (r == null) { - return; - } - bool noOutputFile = false; - if (String.IsNullOrEmpty(bookmarkFile)) { - noOutputFile = true; - } - else if (FileHelper.IsPathValid(bookmarkFile) == false || Path.GetFileName(bookmarkFile).Length == 0) { - Tracker.TraceMessage(Tracker.Category.Error, Messages.InfoFileNameInvalid); - FormHelper.ErrorBox(Messages.InfoFileNameInvalid); - return; - } - try { - if (FileHelper.CheckOverwrite(bookmarkFile) == false) { - return; - } - } - catch (OperationCanceledException) { - return; - } - bookmarkFile = FileHelper.MakePathRootedAndWithExtension(bookmarkFile, sourceFile, Ext.Xml, false); - Tracker.TraceMessage(Tracker.Category.OutputFile, bookmarkFile); - - OcrProcessor ocr; - try { - ocr = new OcrProcessor(r, options); - } - catch (FileNotFoundException ex) { - Tracker.TraceMessage(ex); - FormHelper.ErrorBox(ex.Message); - return; - } - - try { - Tracker.TraceMessage("正在分析 PDF 文件。"); - var workload = ocr.EstimateWorkload(); - Tracker.SetProgressGoal(workload); - if (noOutputFile) { - ocr.PerformOcr(); - } - else if (new FilePath(bookmarkFile).HasExtension(Ext.Txt)) { - Tracker.TraceMessage(Tracker.Category.OutputFile, bookmarkFile); - Tracker.TraceMessage("输出简易信息文件:" + bookmarkFile); - using (var w = new StreamWriter(bookmarkFile, false, AppContext.Exporter.GetEncoding())) { - DocInfoExporter.WriteDocumentInfoAttributes(w, sourceFile, r.NumberOfPages); - ocr.SetWriter(w); - ocr.PerformOcr(); - } - } - else { - Tracker.TraceMessage(Tracker.Category.OutputFile, bookmarkFile); - Tracker.TraceMessage("输出信息文件:" + bookmarkFile); - using (var w = XmlWriter.Create(bookmarkFile, DocInfoExporter.GetWriterSettings())) { - w.WriteStartDocument(); - w.WriteStartElement(Constants.PdfInfo); - DocInfoExporter.WriteDocumentInfoAttributes(w, sourceFile, r.NumberOfPages); - ocr.SetWriter(w); - ocr.PerformOcr(); - w.WriteEndElement(); - } - } - - if (noOutputFile == false) { - Tracker.TraceMessage(Tracker.Category.Alert, "已完成导出信息文件到 <<" + bookmarkFile + ">>。"); - } - else { - Tracker.TraceMessage(Tracker.Category.Alert, "分析文档完毕。"); - } - } - catch (OperationCanceledException) { - Tracker.TraceMessage(Tracker.Category.ImportantMessage, OperationCanceled); - } - catch (System.Text.EncoderFallbackException ex) { - Tracker.TraceMessage(ex); - FormHelper.ErrorBox("在导出信息文件时遇到错误:\n" + ex.Message + "\n\n请选择在导出信息选项中选择其它编码方式。"); - } - catch (Exception ex) { - Tracker.TraceMessage(ex); - FormHelper.ErrorBox("在导出信息文件时遇到错误:\n" + ex.Message); - } - finally { - if (r != null) { - r.Close(); - } - } - } - - internal static string GetExpandedFileName(SourceItem.Pdf item, string template) { - string t; - var s = item.FilePath; - var d = new PdfDictionary(); - DocInfoImporter.UpdateInfoValue(d, PdfName.TITLE, item.DocInfo.Title, s); - DocInfoImporter.UpdateInfoValue(d, PdfName.AUTHOR, item.DocInfo.Author, s); - DocInfoImporter.UpdateInfoValue(d, PdfName.SUBJECT, item.DocInfo.Subject, s); - DocInfoImporter.UpdateInfoValue(d, PdfName.KEYWORDS, item.DocInfo.Keywords, s); - t = ReplaceTargetFileNameMacros(s.ToString(), template, d, item.PageCount); - if (FileHelper.IsPathValid(t) == false) { - return t; - } - else if (Path.GetFileName(t).Length > 0) { - t = new FilePath(t).EnsureExtension(Ext.Pdf).ToString(); - } - return Path.GetFullPath(t); - } - - internal static void RenameFiles(List items, string template, bool keepSourceFile) { - Tracker.SetTotalProgressGoal(items.Count); - Tracker.TraceMessage(String.Concat("使用“", template, "”模板重命名。")); - foreach (var item in items) { - try { - var s = item.FilePath.ToFullPath(); - if (s.ExistsFile == false) { - Tracker.TraceMessage(Tracker.Category.Error, String.Concat("找不到 PDF 文件:", s)); - continue; - } - var t = GetExpandedFileName(item, template); - Tracker.TraceMessage(Tracker.Category.InputFile, s.ToString()); - Tracker.TraceMessage(Tracker.Category.OutputFile, t); - Tracker.TraceMessage(Tracker.Category.ImportantMessage, String.Concat("重命名 PDF 文件:", s)); - Tracker.TraceMessage(Tracker.Category.ImportantMessage, String.Concat("到目标 PDF 文件:<<", t, ">>。")); - if (FileHelper.IsPathValid(t) == false) { - Tracker.TraceMessage(Tracker.Category.Error, String.Concat("输出文件名 ", t, " 无效。")); - goto Exit; - } - if (s.Equals(t)) { - Tracker.TraceMessage("源文件与目标文件名称相同。不需重命名。"); - goto Exit; - } - else if (Path.GetFileName(t).Trim().Length == 0) { - Tracker.TraceMessage("输出文件名为空,无法重命名。"); - goto Exit; - } - else if (File.Exists(t)) { - switch (FormHelper.YesNoCancelBox("是否覆盖已存在的 PDF 文件:" + t)) { - case DialogResult.No: - goto Exit; - case DialogResult.Cancel: - throw new OperationCanceledException(); - default: - File.Delete(t); - break; - } - } - if (Directory.Exists(Path.GetDirectoryName(t)) == false) { - Directory.CreateDirectory(Path.GetDirectoryName(t)); - } - if (keepSourceFile) { - File.Copy(s.ToString(), t); - } - else { - File.Move(s.ToString(), t); - } - } - catch (OperationCanceledException) { - Tracker.TraceMessage(Tracker.Category.Alert, "已取消重命名操作。"); - return; - } - catch (Exception ex) { - Tracker.TraceMessage(ex); - } - Exit: - Tracker.IncrementTotalProgress(); - } - Tracker.TraceMessage("重命名操作已完成。"); - } - - internal static void ImportOcr(string sourceFile, string infoFile, string targetFile) { - if (FileHelper.IsPathValid(sourceFile) == false) { - Tracker.TraceMessage(Tracker.Category.Error, "输入 PDF 文件路径无效。"); - return; - } - if (FileHelper.IsPathValid(targetFile) == false) { - Tracker.TraceMessage(Tracker.Category.Error, "输出 PDF 文件路径无效。"); - return; - } - if (FileHelper.IsPathValid(infoFile) == false) { - Tracker.TraceMessage(Tracker.Category.Error, "信息文件路径无效。"); - return; - } - if (FileHelper.HasExtension(infoFile, Ext.Xml) == false) { - Tracker.TraceMessage(Tracker.Category.Error, "信息文件不是 XML 文件,只有扩展名为 XML 的识别结果文件才能写入 PDF 文档。"); - return; - } - Tracker.TraceMessage(Tracker.Category.InputFile, sourceFile); - Tracker.TraceMessage(Tracker.Category.OutputFile, targetFile); - if (FileHelper.ComparePath(sourceFile, targetFile)) { - Tracker.TraceMessage(Tracker.Category.Error, "输入文件和输出文件不能相同。"); - return; - } - if (FileHelper.CheckOverwrite(targetFile) == false) { - return; - } - var pdf = OpenPdf(sourceFile, AppContext.LoadPartialPdfFile, false); - if (pdf == null) { - return; - } - try { - using (var infoReader = XmlReader.Create(infoFile, new XmlReaderSettings() { IgnoreComments = true, IgnoreProcessingInstructions = true })) { - infoReader.MoveToContent(); // 移到根元素 - using (var s = new FileStream(targetFile, FileMode.Create)) { - var st = new PdfStamper(pdf, s); - var en = new PdfProcessingEngine(pdf); - en.ExtraData[DocProcessorContext.OcrData] = infoReader; - en.DocumentProcessors.Add(new ImportOcrResultProcessor()); - Tracker.SetProgressGoal(en.EstimateWorkload()); - en.ProcessDocument(st.Writer); - st.Close(); - } - } - Tracker.TraceMessage(Tracker.Category.ImportantMessage, "成功写入识别结果到文件:<<" + targetFile + ">>。"); - } - catch (OperationCanceledException) { - Tracker.TraceMessage(Tracker.Category.ImportantMessage, OperationCanceled); - } - catch (Exception ex) { - Tracker.TraceMessage(ex); - FormHelper.ErrorBox("在导入信息时发生错误:\n" + ex.Message); - } - finally { - if (pdf != null) { - try { - pdf.Close(); - } - catch (Exception ex) { - // ignore exception - Tracker.TraceMessage(ex); - } - } - } - } - } -} diff --git a/pdfpatcher/App/Program.cs b/pdfpatcher/App/Program.cs deleted file mode 100644 index 4473c4dcb02f0d4603d9a53f3e725e7c29373ad1..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Program.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Diagnostics; -using System.Linq; -using System.Windows.Forms; -using System.Threading; -using PDFPatcher.Common; - -namespace PDFPatcher -{ - static class Program - { - [STAThread] - static void Main(string[] args) { - using (var m = new Mutex(true, Constants.AppEngName)) { - if (FormHelper.IsCtrlKeyDown || m.WaitOne(100)) { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(AppContext.MainForm = new MainForm()); - } - else { - Process.GetProcesses() - .FirstOrDefault(p => p.MainWindowTitle.StartsWith(Constants.AppName + " [", StringComparison.Ordinal)) - ?.SendCopyDataMessage(String.Join("\n", args)); - } - } - } - } -} diff --git a/pdfpatcher/App/Properties/AssemblyInfo.cs b/pdfpatcher/App/Properties/AssemblyInfo.cs deleted file mode 100644 index d4ef47723c079c2db77122b7677f018fbd414467..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// 有关程序集的常规信息通过下列属性集 -// 控制。更改这些属性值可修改 -// 与程序集关联的信息。 -[assembly: AssemblyTitle("PDFPatcher")] -[assembly: AssemblyDescription(PDFPatcher.Constants.AppName)] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("wmjordan@163.com")] -[assembly: AssemblyProduct(PDFPatcher.Constants.AppEngName)] -[assembly: AssemblyCopyright("著作权所有 © WMJordan 2009~2022")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 使此程序集中的类型 -// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, -// 则将该类型上的 ComVisible 属性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("e8969c5f-a5fe-4dce-a08b-555686483732")] - -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.3840")] diff --git a/pdfpatcher/App/Properties/Resources.Designer.cs b/pdfpatcher/App/Properties/Resources.Designer.cs deleted file mode 100644 index b08cb5dec0a35629a0ef93438790f8ff58396da4..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Properties/Resources.Designer.cs +++ /dev/null @@ -1,1169 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace PDFPatcher.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PDFPatcher.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap About { - get { - object obj = ResourceManager.GetObject("About", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8" ?> - ///<html> - /// <head> - /// <title>关于 $AppName</title> - /// <style> - ///body { - /// margin: 0; - /// padding: 5pt; - ///} - ///h1 { - /// font-size: 15pt; - /// color: #6666cc; - /// border-bottom: 1px dashed #9900ff; - /// margin: 5pt 0; - ///} - ///p, td { - /// padding: 3pt 0pt; - /// margin: 0pt; - /// font-size: 11pt; - ///} - ///h2 { - /// font-size: 12pt; - /// padding: 3pt 0; - /// margin: 0; - /// color: #6666cc; - ///} - ///span { - /// display: inline-block; - /// width: 50%; - ///} - /// </style> - /// </head> - /// <body> - /// <h1>关于 $AppName</h1> - /// <div style="padding: 0 [rest of string was truncated]";. - /// - internal static string AboutPage { - get { - return ResourceManager.GetString("AboutPage", resourceCulture); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Actions { - get { - object obj = ResourceManager.GetObject("Actions", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Add { - get { - object obj = ResourceManager.GetObject("Add", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap AddChildNode { - get { - object obj = ResourceManager.GetObject("AddChildNode", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap AlphabeticSort { - get { - object obj = ResourceManager.GetObject("AlphabeticSort", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap AppOptions { - get { - object obj = ResourceManager.GetObject("AppOptions", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap AutoBookmark { - get { - object obj = ResourceManager.GetObject("AutoBookmark", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Bold { - get { - object obj = ResourceManager.GetObject("Bold", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap BookmarkFile { - get { - object obj = ResourceManager.GetObject("BookmarkFile", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ChangeCase { - get { - object obj = ResourceManager.GetObject("ChangeCase", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap CheckUpdate { - get { - object obj = ResourceManager.GetObject("CheckUpdate", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Close { - get { - object obj = ResourceManager.GetObject("Close", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Collapse { - get { - object obj = ResourceManager.GetObject("Collapse", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ColorDisplay { - get { - object obj = ResourceManager.GetObject("ColorDisplay", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Convert { - get { - object obj = ResourceManager.GetObject("Convert", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Copy { - get { - object obj = ResourceManager.GetObject("Copy", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap CreateDocument { - get { - object obj = ResourceManager.GetObject("CreateDocument", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap CursorMode { - get { - object obj = ResourceManager.GetObject("CursorMode", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap CustomizeToolbar { - get { - object obj = ResourceManager.GetObject("CustomizeToolbar", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap DarkMode { - get { - object obj = ResourceManager.GetObject("DarkMode", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Delete { - get { - object obj = ResourceManager.GetObject("Delete", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap DocumentInspector { - get { - object obj = ResourceManager.GetObject("DocumentInspector", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap DocumentProcessor { - get { - object obj = ResourceManager.GetObject("DocumentProcessor", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Donation { - get { - object obj = ResourceManager.GetObject("Donation", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap EditItem { - get { - object obj = ResourceManager.GetObject("EditItem", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Editor { - get { - object obj = ResourceManager.GetObject("Editor", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap EmptyPage { - get { - object obj = ResourceManager.GetObject("EmptyPage", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap EvenPage { - get { - object obj = ResourceManager.GetObject("EvenPage", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Expand { - get { - object obj = ResourceManager.GetObject("Expand", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ExportFile { - get { - object obj = ResourceManager.GetObject("ExportFile", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ExportInfoFile { - get { - object obj = ResourceManager.GetObject("ExportInfoFile", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ExtractImage { - get { - object obj = ResourceManager.GetObject("ExtractImage", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ExtractPages { - get { - object obj = ResourceManager.GetObject("ExtractPages", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Fonts { - get { - object obj = ResourceManager.GetObject("Fonts", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8" ?> - ///<html> - /// <head> - /// <title>$appName</title> - /// <style> - ///body { - /// margin: 0; - /// padding: 5pt; - ///} - ///h1 { - /// font-size: 15pt; - /// color: #6666cc; - /// border-bottom: 1px dashed #9900ff; - /// margin: 5pt 0; - ///} - ///p { - /// padding: 3pt 10pt; - /// margin: 0pt; - /// font-size: 11pt; - /// color: #999999; - ///} - ///h2 { - /// font-size: 12pt; - /// padding: 3pt 0; - /// margin: 0; - /// color: #6666cc; - ///} - ///td { - /// vertical-align: top; - ///} - /// </style> - /// </head> - /// <body> - /// <h1><a href="func:About">$appName</a></h1> - /// <table> [rest of string was truncated]";. - /// - internal static string FrontPage { - get { - return ResourceManager.GetString("FrontPage", resourceCulture); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap GrayScaleDisplay { - get { - object obj = ResourceManager.GetObject("GrayScaleDisplay", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap GreenMode { - get { - object obj = ResourceManager.GetObject("GreenMode", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap HomePage { - get { - object obj = ResourceManager.GetObject("HomePage", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Image { - get { - object obj = ResourceManager.GetObject("Image", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ImageFolder { - get { - object obj = ResourceManager.GetObject("ImageFolder", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ImportFile { - get { - object obj = ResourceManager.GetObject("ImportFile", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ImportInfoFile { - get { - object obj = ResourceManager.GetObject("ImportInfoFile", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ImportOcr { - get { - object obj = ResourceManager.GetObject("ImportOcr", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap InfoFileOptions { - get { - object obj = ResourceManager.GetObject("InfoFileOptions", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap InsertMacro { - get { - object obj = ResourceManager.GetObject("InsertMacro", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap InvertColor { - get { - object obj = ResourceManager.GetObject("InvertColor", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Italic { - get { - object obj = ResourceManager.GetObject("Italic", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Lanscape { - get { - object obj = ResourceManager.GetObject("Lanscape", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Log { - get { - object obj = ResourceManager.GetObject("Log", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Logo { - get { - object obj = ResourceManager.GetObject("Logo", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Mark { - get { - object obj = ResourceManager.GetObject("Mark", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Merge { - get { - object obj = ResourceManager.GetObject("Merge", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Merger { - get { - object obj = ResourceManager.GetObject("Merger", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Move { - get { - object obj = ResourceManager.GetObject("Move", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap MoveBottom { - get { - object obj = ResourceManager.GetObject("MoveBottom", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap MoveDown { - get { - object obj = ResourceManager.GetObject("MoveDown", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap MoveLeft { - get { - object obj = ResourceManager.GetObject("MoveLeft", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap MoveRight { - get { - object obj = ResourceManager.GetObject("MoveRight", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap MoveTop { - get { - object obj = ResourceManager.GetObject("MoveTop", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap MoveUp { - get { - object obj = ResourceManager.GetObject("MoveUp", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap NaturalSort { - get { - object obj = ResourceManager.GetObject("NaturalSort", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap NewPdfFile { - get { - object obj = ResourceManager.GetObject("NewPdfFile", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Ocr { - get { - object obj = ResourceManager.GetObject("Ocr", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap OddPage { - get { - object obj = ResourceManager.GetObject("OddPage", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Open { - get { - object obj = ResourceManager.GetObject("Open", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap OpenFile { - get { - object obj = ResourceManager.GetObject("OpenFile", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap OriginalPdfFile { - get { - object obj = ResourceManager.GetObject("OriginalPdfFile", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap PageProcessor { - get { - object obj = ResourceManager.GetObject("PageProcessor", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap PageRange { - get { - object obj = ResourceManager.GetObject("PageRange", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Palette { - get { - object obj = ResourceManager.GetObject("Palette", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Paste { - get { - object obj = ResourceManager.GetObject("Paste", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap PdfOptions { - get { - object obj = ResourceManager.GetObject("PdfOptions", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap PdfPageRange { - get { - object obj = ResourceManager.GetObject("PdfPageRange", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Pin { - get { - object obj = ResourceManager.GetObject("Pin", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Portrait { - get { - object obj = ResourceManager.GetObject("Portrait", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Property { - get { - object obj = ResourceManager.GetObject("Property", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Refresh { - get { - object obj = ResourceManager.GetObject("Refresh", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Rename { - get { - object obj = ResourceManager.GetObject("Rename", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap RenderDocument { - get { - object obj = ResourceManager.GetObject("RenderDocument", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap RenderImage { - get { - object obj = ResourceManager.GetObject("RenderImage", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Replace { - get { - object obj = ResourceManager.GetObject("Replace", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Reset { - get { - object obj = ResourceManager.GetObject("Reset", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Return { - get { - object obj = ResourceManager.GetObject("Return", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap RotateLeft { - get { - object obj = ResourceManager.GetObject("RotateLeft", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap RotateRight { - get { - object obj = ResourceManager.GetObject("RotateRight", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Save { - get { - object obj = ResourceManager.GetObject("Save", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap SaveAs { - get { - object obj = ResourceManager.GetObject("SaveAs", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ScrollHorizontal { - get { - object obj = ResourceManager.GetObject("ScrollHorizontal", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ScrollPosition { - get { - object obj = ResourceManager.GetObject("ScrollPosition", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ScrollVertical { - get { - object obj = ResourceManager.GetObject("ScrollVertical", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap SearchReplace { - get { - object obj = ResourceManager.GetObject("SearchReplace", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap SelectAll { - get { - object obj = ResourceManager.GetObject("SelectAll", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap SelectItem { - get { - object obj = ResourceManager.GetObject("SelectItem", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap SelectMarks { - get { - object obj = ResourceManager.GetObject("SelectMarks", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ShortCut { - get { - object obj = ResourceManager.GetObject("ShortCut", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Sort { - get { - object obj = ResourceManager.GetObject("Sort", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap SortReverse { - get { - object obj = ResourceManager.GetObject("SortReverse", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap TextFile { - get { - object obj = ResourceManager.GetObject("TextFile", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Time { - get { - object obj = ResourceManager.GetObject("Time", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Undo { - get { - object obj = ResourceManager.GetObject("Undo", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Unmark { - get { - object obj = ResourceManager.GetObject("Unmark", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap ViewContent { - get { - object obj = ResourceManager.GetObject("ViewContent", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Zoom { - get { - object obj = ResourceManager.GetObject("Zoom", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - } -} diff --git a/pdfpatcher/App/Properties/Resources.resx b/pdfpatcher/App/Properties/Resources.resx deleted file mode 100644 index 869cb67788e64da0ff48ed2ba29bee62457acbc1..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Properties/Resources.resx +++ /dev/null @@ -1,433 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - ..\Resources\arrow-000-medium.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\document-export.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\bookmarks.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\document-pdf-number.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\layer-rotate-left.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\ui-text-field-select.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\book-open-text-image.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\edit-bold.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\edit-list-order.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\document-copy.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\arrow-stop-180.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\document-import.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\pdf.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\ui-scroll-pane-both.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\document-bookmark.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\101.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\document-convert.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\document-pdf-text.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\096.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\edit-italic.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\blue-folder-open-document.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\document-text.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\arrow-circle-225-left.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\document-bookmark-export.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\arrow-merge-180-left.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\documents.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\108.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\table-select-row.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\107.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\magnifier-zoom.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\folder-open.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\bookmark--pencil.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\arrow-circle-double.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\bookmark--minus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\exclamation-red-frame.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\notebook--pencil.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\clipboard-paste.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\layer-rotate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\document-number.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\document-pdf.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\103.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\edit-uppercase.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\folder-open-image.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\magnifier--pencil.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\document-bookmark-import.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\image--arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\document.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\table-select-all.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\arrow-180-medium.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\resources\palette.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Ocr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\inbox-document-text.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\ImportOcr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\toggle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\toggle-expand.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\document-text-image.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\application-task.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\DocumentInspector.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\InfoFileOptions.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\application-list.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\PdfOptions.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\wand-magic.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\document-processor.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\page-processor.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\document-merge.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\node-insert-next.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\document-image.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\fonts.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\arrow-stop-270.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\arrow-stop-090.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\alphabetic-sort.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\natural-sort.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\document-number-2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\image.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\document-number-1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\image-vertical.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\user-black.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\application-home.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\home.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\arrow-045-small.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Functions\FrontPage.html;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ..\Resources\document-rename.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\ui-scroll-bar-horizontal.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\ui-scroll-bar.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\disk-rename.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\color.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\grayscale.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\ui-color-picker-switch.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\cursor.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\arrow-move.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\ui-check-boxes-series.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\property.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\pin.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\spectacle-sunglass.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\leaf.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Functions\AboutPage.html;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ..\Resources\document-bookmark-wand.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\document-pdf-render.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\cross-button.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\document-pdf-edit.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\edit-replace.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\donation.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\arrow-continue-090.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\clock.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - \ No newline at end of file diff --git a/pdfpatcher/App/Resources/096.png b/pdfpatcher/App/Resources/096.png deleted file mode 100644 index 9713ffa915c48e01288205f49142945020564994..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/096.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/101.png b/pdfpatcher/App/Resources/101.png deleted file mode 100644 index cf640c1058ffa30fe3de0bf9a35a04ce6a52dd45..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/101.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/103.png b/pdfpatcher/App/Resources/103.png deleted file mode 100644 index 7ab335781bf67df5cf70324f15e9c01fb9e3b561..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/103.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/107.png b/pdfpatcher/App/Resources/107.png deleted file mode 100644 index 45fb0d5d48ae401c97bfcfc199b7897f76f3f266..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/107.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/108.png b/pdfpatcher/App/Resources/108.png deleted file mode 100644 index 5bac0de448c4b8ee7eed5c954ec9fcc0fff02e52..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/108.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/DocumentInspector.png b/pdfpatcher/App/Resources/DocumentInspector.png deleted file mode 100644 index 41b66e6d3cc780c77804199c46e85a6749274862..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/DocumentInspector.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/ExportInfoDoc.png b/pdfpatcher/App/Resources/ExportInfoDoc.png deleted file mode 100644 index 53f9cb3cb6dd43c8a4d568594905efe06f95589f..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/ExportInfoDoc.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/ImportInfoDoc.png b/pdfpatcher/App/Resources/ImportInfoDoc.png deleted file mode 100644 index f9a9773290f5ecf0faac8134fe6cb8cc77c6d009..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/ImportInfoDoc.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/ImportOcr.png b/pdfpatcher/App/Resources/ImportOcr.png deleted file mode 100644 index 34ccb798b84f7b7c6bf245476c4bfeaf35083e35..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/ImportOcr.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/InfoFileOptions.png b/pdfpatcher/App/Resources/InfoFileOptions.png deleted file mode 100644 index 27bcf29fa75383c19eaddd01f169a9c09d546572..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/InfoFileOptions.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/Ocr.png b/pdfpatcher/App/Resources/Ocr.png deleted file mode 100644 index 65eca961c42faeb8cc92f2570db9f3925349ce60..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/Ocr.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/PdfOptions.png b/pdfpatcher/App/Resources/PdfOptions.png deleted file mode 100644 index fb0ada940e0f93af9d94c22b6ee4595f81d59724..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/PdfOptions.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/alphabetic-sort.png b/pdfpatcher/App/Resources/alphabetic-sort.png deleted file mode 100644 index f712406325a5b44e3b21578d88b2e48bd33f7ee8..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/alphabetic-sort.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/application-home.png b/pdfpatcher/App/Resources/application-home.png deleted file mode 100644 index 990740735ff7f1b8cbd7e022b47d378b9ad43f26..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/application-home.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/application-list.png b/pdfpatcher/App/Resources/application-list.png deleted file mode 100644 index 52ffff9e07ac5290b61d79defc3ac2cd7b220914..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/application-list.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/application-task.png b/pdfpatcher/App/Resources/application-task.png deleted file mode 100644 index e83d36610a96f0288a2a8d09c33e95b43fd35c24..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/application-task.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/arrow-000-medium.png b/pdfpatcher/App/Resources/arrow-000-medium.png deleted file mode 100644 index ef5a4eaec71789cac2fa7a8dd535e4e0f314cfce..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/arrow-000-medium.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/arrow-045-small.png b/pdfpatcher/App/Resources/arrow-045-small.png deleted file mode 100644 index 61602003ce59bb0fe97fd70fcc60a8ff636e86ca..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/arrow-045-small.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/arrow-180-medium.png b/pdfpatcher/App/Resources/arrow-180-medium.png deleted file mode 100644 index 0ebccfa4102f1ec7a80b60af28bdab34d7a4495f..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/arrow-180-medium.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/arrow-circle-225-left.png b/pdfpatcher/App/Resources/arrow-circle-225-left.png deleted file mode 100644 index e55a304d632a7f4a67f49b35a8eb5c5c5b63d4ef..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/arrow-circle-225-left.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/arrow-circle-double.png b/pdfpatcher/App/Resources/arrow-circle-double.png deleted file mode 100644 index 1c5605506772be9ca53f69e424c4a37a98375c02..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/arrow-circle-double.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/arrow-continue-090.png b/pdfpatcher/App/Resources/arrow-continue-090.png deleted file mode 100644 index 140190773382840ddd882d5d7bcb800cf887db70..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/arrow-continue-090.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/arrow-merge-180-left.png b/pdfpatcher/App/Resources/arrow-merge-180-left.png deleted file mode 100644 index fb5c1bc577860d39695259220b3fa4c0ffcd1aaf..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/arrow-merge-180-left.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/arrow-move.png b/pdfpatcher/App/Resources/arrow-move.png deleted file mode 100644 index 4894c75f0b87da677f32a94466bc67da6486deb8..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/arrow-move.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/arrow-stop-090.png b/pdfpatcher/App/Resources/arrow-stop-090.png deleted file mode 100644 index a91e7945116c51d43d5156be0ee884faf57bbe75..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/arrow-stop-090.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/arrow-stop-180.png b/pdfpatcher/App/Resources/arrow-stop-180.png deleted file mode 100644 index 3b3d639abab58c81afa4fb669e0f7b716de4559c..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/arrow-stop-180.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/arrow-stop-270.png b/pdfpatcher/App/Resources/arrow-stop-270.png deleted file mode 100644 index 3e06cda0974991703e0e8b1ef65ce67d47ebba70..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/arrow-stop-270.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/blue-folder-open-document.png b/pdfpatcher/App/Resources/blue-folder-open-document.png deleted file mode 100644 index bae56b7968256259d93efb31cd709a33af94f51a..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/blue-folder-open-document.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/book-open-text-image.png b/pdfpatcher/App/Resources/book-open-text-image.png deleted file mode 100644 index 8b023a3b5588c55029c4e5bf931e3a08c403384b..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/book-open-text-image.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/bookmark--minus.png b/pdfpatcher/App/Resources/bookmark--minus.png deleted file mode 100644 index 7d3db5ee3b2d08f8c4a11de4101a28d91afdabcf..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/bookmark--minus.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/bookmark--pencil.png b/pdfpatcher/App/Resources/bookmark--pencil.png deleted file mode 100644 index 69f6de32dd681acac7cb6c5c0074f7ebd7d63d3e..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/bookmark--pencil.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/bookmarks.png b/pdfpatcher/App/Resources/bookmarks.png deleted file mode 100644 index b06c71287ba2c570eb405c7ae76404e616a70529..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/bookmarks.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/clipboard-paste.png b/pdfpatcher/App/Resources/clipboard-paste.png deleted file mode 100644 index 51dfa8c7bf484b6f792bc44c788e6c3a9c3d8bce..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/clipboard-paste.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/clock.png b/pdfpatcher/App/Resources/clock.png deleted file mode 100644 index 1aed16233c3e6572a7a48165cee9aa56430594a0..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/clock.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/color.png b/pdfpatcher/App/Resources/color.png deleted file mode 100644 index 59d377b51024f23cdf4c62ae61a7b9673ae91407..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/color.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/cross-button.png b/pdfpatcher/App/Resources/cross-button.png deleted file mode 100644 index 70e8d23afef2ecebdeffc3ceaee9e84b3d1834c4..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/cross-button.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/cursor.png b/pdfpatcher/App/Resources/cursor.png deleted file mode 100644 index 3fdefc964e0da19fcdd7af126e18f57f1b875488..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/cursor.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/disk-rename.png b/pdfpatcher/App/Resources/disk-rename.png deleted file mode 100644 index d97dd1eb12d7368327f43a4eda24664790883b5e..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/disk-rename.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document--arrow.png b/pdfpatcher/App/Resources/document--arrow.png deleted file mode 100644 index c4738eae4325be91dabfeb47548c4f8cd22cdfd5..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document--arrow.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-bookmark-export.png b/pdfpatcher/App/Resources/document-bookmark-export.png deleted file mode 100644 index cac712606b06cccd79b462fdf90d7ca1c658a7e2..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-bookmark-export.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-bookmark-import.png b/pdfpatcher/App/Resources/document-bookmark-import.png deleted file mode 100644 index 75072599bc5280c6cbbe311074398d468f23ad00..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-bookmark-import.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-bookmark-wand.png b/pdfpatcher/App/Resources/document-bookmark-wand.png deleted file mode 100644 index 011d03ac202c2ba13604a78e8238371bfd6fa5d3..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-bookmark-wand.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-bookmark.png b/pdfpatcher/App/Resources/document-bookmark.png deleted file mode 100644 index b372993a31509112102db67288876bb3b8f1ceac..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-bookmark.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-convert.png b/pdfpatcher/App/Resources/document-convert.png deleted file mode 100644 index e5beb6b517aa371e5541ed91066134f03d8532cb..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-convert.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-copy.png b/pdfpatcher/App/Resources/document-copy.png deleted file mode 100644 index 182804a488e82022e90cf3acf2157399dfe1b17d..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-copy.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-export.png b/pdfpatcher/App/Resources/document-export.png deleted file mode 100644 index 01e950766440cc839e1d2c7b90fffc3262298c43..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-export.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-image.png b/pdfpatcher/App/Resources/document-image.png deleted file mode 100644 index 607c25d102af2aff5be5b32d80adbd5eb75e3fc3..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-image.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-import.png b/pdfpatcher/App/Resources/document-import.png deleted file mode 100644 index 2374ba3f533584b018ff84ba1177e935855eb11f..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-import.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-merge.png b/pdfpatcher/App/Resources/document-merge.png deleted file mode 100644 index 2ca1442e4b1cf23717f6d0d591d5cb0db6ab9f46..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-merge.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-number-1.png b/pdfpatcher/App/Resources/document-number-1.png deleted file mode 100644 index a474b2b7ff8ffcee22e735a4f8154d8dc19ec46b..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-number-1.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-number-2.png b/pdfpatcher/App/Resources/document-number-2.png deleted file mode 100644 index e047e553fc13699961fdbfb9ec27f59a0d8c81d7..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-number-2.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-number.png b/pdfpatcher/App/Resources/document-number.png deleted file mode 100644 index 0e7af6e9104d3124fdf4c58afaab80f720f0843a..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-number.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-pdf-edit.png b/pdfpatcher/App/Resources/document-pdf-edit.png deleted file mode 100644 index 5a4490037bc2bd8c8e040425e8c8db9214b11ffc..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-pdf-edit.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-pdf-number.png b/pdfpatcher/App/Resources/document-pdf-number.png deleted file mode 100644 index 5ff573dd866ffdc352e52940e47c16b5c6926dd3..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-pdf-number.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-pdf-render.png b/pdfpatcher/App/Resources/document-pdf-render.png deleted file mode 100644 index bf9405b3dd40bc6821eb1777cc845b6b79662d38..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-pdf-render.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-pdf-text.png b/pdfpatcher/App/Resources/document-pdf-text.png deleted file mode 100644 index ca704c29bae10e76d069f826afa485041e05e19f..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-pdf-text.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-pdf.png b/pdfpatcher/App/Resources/document-pdf.png deleted file mode 100644 index 641a419720687c1a310522d9ceffe585eeb8707b..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-pdf.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-processor.png b/pdfpatcher/App/Resources/document-processor.png deleted file mode 100644 index b71d1bb4ad202bdbfba93fddad8ffd17dccb84a8..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-processor.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-rename.png b/pdfpatcher/App/Resources/document-rename.png deleted file mode 100644 index e4c2042df453dd13e593ced3fe5fb81fb7de7fa2..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-rename.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-text-image.png b/pdfpatcher/App/Resources/document-text-image.png deleted file mode 100644 index 18cca741de29687b55c8e72d84d008c19919c9d7..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-text-image.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document-text.png b/pdfpatcher/App/Resources/document-text.png deleted file mode 100644 index 8c1184dffef0616060b2e38fccdf7de1217e8b39..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document-text.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/document.png b/pdfpatcher/App/Resources/document.png deleted file mode 100644 index 0847f096db0d223ea7dcdf07cfe2a27736cf50dc..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/document.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/documents.png b/pdfpatcher/App/Resources/documents.png deleted file mode 100644 index 3125338fe933bfce5c3531477f4f76b59c3b3de2..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/documents.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/edit-bold.png b/pdfpatcher/App/Resources/edit-bold.png deleted file mode 100644 index 2311669ab7587dd74e9c67bd91c105a2b463e673..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/edit-bold.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/edit-italic.png b/pdfpatcher/App/Resources/edit-italic.png deleted file mode 100644 index 8a7019e1f39bc27fad38e6edfca83e6115401a8c..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/edit-italic.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/edit-list-order.png b/pdfpatcher/App/Resources/edit-list-order.png deleted file mode 100644 index 687b410dd287e2f5e0b929709b44126bd9dac707..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/edit-list-order.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/edit-replace.png b/pdfpatcher/App/Resources/edit-replace.png deleted file mode 100644 index 6ae9fb4fa53aa703ac01b5263de7f58d2ba22398..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/edit-replace.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/edit-uppercase.png b/pdfpatcher/App/Resources/edit-uppercase.png deleted file mode 100644 index 3fde7b2084a22b03bb18387805f216dea0c8f472..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/edit-uppercase.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/exclamation-red-frame.png b/pdfpatcher/App/Resources/exclamation-red-frame.png deleted file mode 100644 index 2663c41070c7b5fcfc80e30f1faa49b89374c021..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/exclamation-red-frame.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/folder-open-image.png b/pdfpatcher/App/Resources/folder-open-image.png deleted file mode 100644 index 6b21e1abbb7ba2fc1e13cea8ab799f3beedc3ac0..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/folder-open-image.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/folder-open.png b/pdfpatcher/App/Resources/folder-open.png deleted file mode 100644 index aea0fda75f6e85954c7ba87b92347859620ea4c4..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/folder-open.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/fonts.png b/pdfpatcher/App/Resources/fonts.png deleted file mode 100644 index ecec113f95bb319724297bfcea2002d4ff5f37af..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/fonts.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/grayscale.png b/pdfpatcher/App/Resources/grayscale.png deleted file mode 100644 index d51db1cedf98497182e8983a61f679aac0373d70..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/grayscale.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/home.png b/pdfpatcher/App/Resources/home.png deleted file mode 100644 index 99ae394fc759f67f291445ead0319c1855677ffe..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/home.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/image--arrow.png b/pdfpatcher/App/Resources/image--arrow.png deleted file mode 100644 index ca2284aa6bacd8f3aa67c248851ea0799415bc1c..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/image--arrow.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/image-vertical.png b/pdfpatcher/App/Resources/image-vertical.png deleted file mode 100644 index f56e648de94a3fdaf4920ad47fc9d1345736f527..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/image-vertical.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/image.png b/pdfpatcher/App/Resources/image.png deleted file mode 100644 index ca65c0226fbd240e7acf3ef4093288f78c9793a6..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/image.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/inbox-document-text.png b/pdfpatcher/App/Resources/inbox-document-text.png deleted file mode 100644 index f56c8e47c370a6c03464b202949778e69254c6ef..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/inbox-document-text.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/layer-rotate-left.png b/pdfpatcher/App/Resources/layer-rotate-left.png deleted file mode 100644 index b903bf133ab77c721868761ed52ffbfa5d1a7a72..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/layer-rotate-left.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/layer-rotate.png b/pdfpatcher/App/Resources/layer-rotate.png deleted file mode 100644 index 914c5af0cfbd21b0d3b93e916c7c379c817aaafd..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/layer-rotate.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/leaf.png b/pdfpatcher/App/Resources/leaf.png deleted file mode 100644 index fce09074e7ebd2df3dd628e56f29041b882916ce..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/leaf.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/magnifier--pencil.png b/pdfpatcher/App/Resources/magnifier--pencil.png deleted file mode 100644 index 75380ae324b51ab8708bcb8a1cdb3a4fdb8c5750..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/magnifier--pencil.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/magnifier-zoom.png b/pdfpatcher/App/Resources/magnifier-zoom.png deleted file mode 100644 index 941b1035673a42d2c0dfe636ef27fd1d7236775f..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/magnifier-zoom.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/natural-sort.png b/pdfpatcher/App/Resources/natural-sort.png deleted file mode 100644 index aa8252c97ab49e7746f8c30b2a522de6d900691d..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/natural-sort.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/node-insert-next.png b/pdfpatcher/App/Resources/node-insert-next.png deleted file mode 100644 index fac40e551b249cf94ed1efbe538e31d8f7ada366..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/node-insert-next.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/notebook--pencil.png b/pdfpatcher/App/Resources/notebook--pencil.png deleted file mode 100644 index 54fa148ce240bddc97d8b04e9b317c32bfc1692e..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/notebook--pencil.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/op_BT.png b/pdfpatcher/App/Resources/op_BT.png deleted file mode 100644 index 9f9cbdb966432968d6196d321c976e9487bf536e..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/op_BT.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/op_TJ.png b/pdfpatcher/App/Resources/op_TJ.png deleted file mode 100644 index 0e787f2c6a07fbc207fc46aa8bfc59201359a0b2..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/op_TJ.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/op_TL.png b/pdfpatcher/App/Resources/op_TL.png deleted file mode 100644 index 9a308df04a3d8cd37bcb517fc173e4476270b428..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/op_TL.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/op_Td.png b/pdfpatcher/App/Resources/op_Td.png deleted file mode 100644 index a9ff4b2aac1678f25c4f78a216b5c01b2c298a91..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/op_Td.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/op_Tr.png b/pdfpatcher/App/Resources/op_Tr.png deleted file mode 100644 index 39c1faab770366a5f4d4f113d8745bebe8d67cdc..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/op_Tr.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/op_Tz.png b/pdfpatcher/App/Resources/op_Tz.png deleted file mode 100644 index 15371968c08bf8c00329b4141f7004ecab398553..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/op_Tz.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/op_cm.png b/pdfpatcher/App/Resources/op_cm.png deleted file mode 100644 index 3ada64b68c771acf8aadc005b7ced6590e91fd10..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/op_cm.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/op_g.png b/pdfpatcher/App/Resources/op_g.png deleted file mode 100644 index c939dd2cf3643ef279e72fd0efbc3317338dd371..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/op_g.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/op_l.png b/pdfpatcher/App/Resources/op_l.png deleted file mode 100644 index aa789b545b241639e4e80b29efb2f83eab0628a4..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/op_l.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/op_q.png b/pdfpatcher/App/Resources/op_q.png deleted file mode 100644 index 077f606a958101d258483cdc4c7e19b3dc6e376c..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/op_q.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/op_tj_.png b/pdfpatcher/App/Resources/op_tj_.png deleted file mode 100644 index 176080802472c5a032cdcc1381aa61760ed8b614..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/op_tj_.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/op_tm.png b/pdfpatcher/App/Resources/op_tm.png deleted file mode 100644 index 212b3ea453f3e91e618ffe093752a5aa8a5ed14a..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/op_tm.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/page-processor.png b/pdfpatcher/App/Resources/page-processor.png deleted file mode 100644 index 76a0140e79f3aa1093345d4e9def4f6010d9b964..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/page-processor.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/palette.png b/pdfpatcher/App/Resources/palette.png deleted file mode 100644 index b7215bd9fd71f433d5ca12a9c42a1d776f514791..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/palette.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/pdf.png b/pdfpatcher/App/Resources/pdf.png deleted file mode 100644 index 84a7ad9cc82a977019f8e381772b17f445132218..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/pdf.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/pin.png b/pdfpatcher/App/Resources/pin.png deleted file mode 100644 index 947c1a752af6f86fed4cd4f1947a668e357c111b..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/pin.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/property.png b/pdfpatcher/App/Resources/property.png deleted file mode 100644 index 17edc7b22f38d41205a4f3dcde7a403b325fd3bd..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/property.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/spectacle-sunglass.png b/pdfpatcher/App/Resources/spectacle-sunglass.png deleted file mode 100644 index e8a75b14cd742d7c14f6097abb671c19d69a128a..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/spectacle-sunglass.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/table-select-all.png b/pdfpatcher/App/Resources/table-select-all.png deleted file mode 100644 index f195b0e1a9ce6cdff2a6816cb7f87ddca7561288..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/table-select-all.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/table-select-row.png b/pdfpatcher/App/Resources/table-select-row.png deleted file mode 100644 index e96313c2089f1902c704172f267f04e5526cbc4f..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/table-select-row.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/toggle-expand.png b/pdfpatcher/App/Resources/toggle-expand.png deleted file mode 100644 index 874c3a2d5e837c47c3287cb158e5bf2981975b39..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/toggle-expand.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/toggle.png b/pdfpatcher/App/Resources/toggle.png deleted file mode 100644 index e99f0c3e27aedd71e64a0c7ba7de33c622635836..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/toggle.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/ui-check-boxes-series.png b/pdfpatcher/App/Resources/ui-check-boxes-series.png deleted file mode 100644 index 5387c8416877fa1f8e6e3cb3fe23992762bbdf77..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/ui-check-boxes-series.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/ui-color-picker-switch.png b/pdfpatcher/App/Resources/ui-color-picker-switch.png deleted file mode 100644 index b77cbf183c384a7e2d155fe28f77aefe860ee046..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/ui-color-picker-switch.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/ui-scroll-bar-horizontal.png b/pdfpatcher/App/Resources/ui-scroll-bar-horizontal.png deleted file mode 100644 index 54beb228cff3594fed82955ebeb775b6d658a722..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/ui-scroll-bar-horizontal.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/ui-scroll-bar.png b/pdfpatcher/App/Resources/ui-scroll-bar.png deleted file mode 100644 index 1ce463dc075b126e0f2d804322fc227232773eaa..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/ui-scroll-bar.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/ui-scroll-pane-both.png b/pdfpatcher/App/Resources/ui-scroll-pane-both.png deleted file mode 100644 index 8b3c5a245b078e1c48ab8e66c7bd9e9e57724afc..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/ui-scroll-pane-both.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/ui-text-field-select.png b/pdfpatcher/App/Resources/ui-text-field-select.png deleted file mode 100644 index 3cfe301ac794617c83ec633c9dfe86d72145cc29..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/ui-text-field-select.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/user-black.png b/pdfpatcher/App/Resources/user-black.png deleted file mode 100644 index 79c4c66deb25a67b982f9ddabeb20a1433b916c0..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/user-black.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/wand-magic.png b/pdfpatcher/App/Resources/wand-magic.png deleted file mode 100644 index 199ba9fe8984b63cf17f6af34a680c85e5c9e9e4..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/wand-magic.png and /dev/null differ diff --git a/pdfpatcher/App/Resources/xfn-colleague-met.png b/pdfpatcher/App/Resources/xfn-colleague-met.png deleted file mode 100644 index a6fe441e1e5834455bdffbc871c17aa5c94d3161..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/Resources/xfn-colleague-met.png and /dev/null differ diff --git a/pdfpatcher/App/Toolkit.cs b/pdfpatcher/App/Toolkit.cs deleted file mode 100644 index 1b074732b522a87cc8af7985c0e1a76bbc64cee4..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Toolkit.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System.Windows.Forms; - -namespace PDFPatcher -{ - sealed class Toolkit - { - internal static readonly Toolkit[] Toolkits = { - new Toolkit ("编辑器","Editor","Editor","创建或修改 PDF 文档的书签,修改 PDF 文档的设置", true), - new Toolkit ("批量修改文档","Patcher","DocumentProcessor","根据配置批量处理 PDF 文档,生成新的文档", true), - new Toolkit ("合并文档","Merger","Merger","将多个图片和 PDF 文档合并为新的 PDF 文档", true), - new Toolkit ("识别文本","Ocr","Ocr","识别扫描 PDF 文档的文字(需微软 Office 2003或2007的光学字符识别(OCR)引擎支持)"), - new Toolkit ("自动书签","BookmarkGenerator","AutoBookmark","根据 PDF 的文本样式生成书签文件"), - new Toolkit ("批量重命名","Rename","Rename","根据 PDF 的文本属性更改文件名", false, false), - new Toolkit ("提取页面或拆分文档","ExtractPages","ExtractPages","提取 PDF 文档的页面或重排页面"), - new Toolkit ("提取图片","ExtractImages","ExtractImage","无损提取 PDF 文档中的图片", true), - new Toolkit ("转换页面为图片","RenderPages","RenderDocument","将 PDF 文档的页面转换为图片"), - new Toolkit ("结构探查器","Inspector","DocumentInspector","探查 PDF 文档的内部结构", false, false), - new Toolkit ("导出导入信息文件","InfoExchanger","ExportInfoFile","导出书签、文档元数据、阅读器设定等信息到信息文件"), - new Toolkit ("程序配置","Options","AppOptions","修改 PDF 补丁丁的程序配置", false, false) - }; - internal static Toolkit Get(string id) { - foreach (var item in Toolkits) { - if (item.Identifier == id) { - return item; - } - } - return null; - } - - public string Identifier { get; } - public string Icon { get; } - public string Name { get; } - public string Description { get; } - public bool ShowText { get; } - public bool DefaultVisible { get; } - - private Toolkit(string name, string id, string icon, string description) - : this(name, id, icon, description, false, true) { - } - private Toolkit(string name, string id, string icon, string description, bool showText) - : this(name, id, icon, description, showText, true) { - } - private Toolkit(string name, string id, string icon, string description, bool showText, bool defaultVisible) { - Name = name; - Identifier = id; - Icon = icon; - Description = description; - ShowText = showText; - DefaultVisible = defaultVisible; - } - - internal ToolStripButton CreateButton() { - return new ToolStripButton(Name, Properties.Resources.ResourceManager.GetObject(Icon) as System.Drawing.Image) { - Name = Identifier, - Tag = Identifier, - ToolTipText = Description, - DisplayStyle = ShowText ? ToolStripItemDisplayStyle.ImageAndText : ToolStripItemDisplayStyle.Image - }; - } - - } - -} diff --git a/pdfpatcher/App/Tracker.cs b/pdfpatcher/App/Tracker.cs deleted file mode 100644 index d3c8ba254fa90b74a0942991056888dac430e19e..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/Tracker.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System; -using System.ComponentModel; -using System.Diagnostics; - -namespace PDFPatcher -{ - static class Tracker - { - internal enum Category - { - Message = -1, - ImportantMessage = -2, - Error = -3, - Alert = -4, - Notice = -5, - InputFile = -10, - OutputFile = -11 - } - - static BackgroundWorker __Worker; - - ///指定后台工作进程。 - internal static void SetWorker(BackgroundWorker value) { - __Worker = value; - } - - internal static void TrackProgress(int progress) { - ReportProgress(progress, null); - } - - internal static void IncrementProgress(int progress) { - ReportProgress(progress, "INC"); - } - - internal static void IncrementTotalProgress() { - ReportProgress(1, "TINC"); - } - internal static void SetProgressGoal(int goalNumber) { - ReportProgress(goalNumber, "GOAL"); - } - internal static void SetTotalProgressGoal(int goalNumber) { - ReportProgress(goalNumber, "TGOAL"); - } - internal static void DebugMessage(string message) { - Debug.Write(DateTime.Now.ToString("HH:mm:ss.fff ")); - Debug.WriteLine(message); - } - internal static void TraceMessage(Category level, string message) { - Trace.Write(DateTime.Now.ToString("HH:mm:ss.fff ")); - Trace.WriteLine(message); - var worker = __Worker; - if (worker?.IsBusy == true) { - worker.ReportProgress((int)level, message); - } - } - internal static void TraceMessage(string message) { - TraceMessage(Category.Message, message); - } - internal static void TraceMessage(Exception exception) { - TraceMessage(Category.Error, exception.Message); -#if DEBUG - TraceMessage(Category.Message, exception.StackTrace); -#endif - } - - static void ReportProgress(int progress, string category) { - var worker = __Worker; - if (worker == null) { - return; - } - if (worker.CancellationPending) { - throw new OperationCanceledException(); - } - worker.ReportProgress(progress, category); - } - } - -} \ No newline at end of file diff --git a/pdfpatcher/App/app.config b/pdfpatcher/App/app.config deleted file mode 100644 index 48d2d1744846bd4ef14e77e856e041fe004fba9e..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/app.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/pdfpatcher/App/donation.png b/pdfpatcher/App/donation.png deleted file mode 100644 index db146cf258503a3bda8d3f176045918d71dfec60..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/donation.png and /dev/null differ diff --git a/pdfpatcher/App/packages.config b/pdfpatcher/App/packages.config deleted file mode 100644 index d73bfcab4329f19fcee4d43600ee71da06b8ec41..0000000000000000000000000000000000000000 --- a/pdfpatcher/App/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/pdfpatcher/App/pdf_icon.ico b/pdfpatcher/App/pdf_icon.ico deleted file mode 100644 index ee1e80256aefa8eeadc8ae0402672a8739aa75b0..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/App/pdf_icon.ico and /dev/null differ diff --git a/pdfpatcher/JBig2/COPYING b/pdfpatcher/JBig2/COPYING deleted file mode 100644 index dba13ed2ddf783ee8118c6a581dbf75305f816a3..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/COPYING +++ /dev/null @@ -1,661 +0,0 @@ - GNU AFFERO GENERAL PUBLIC LICENSE - Version 3, 19 November 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU Affero General Public License is a free, copyleft license for -software and other kinds of works, specifically designed to ensure -cooperation with the community in the case of network server software. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -our General Public Licenses are intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - Developers that use our General Public Licenses protect your rights -with two steps: (1) assert copyright on the software, and (2) offer -you this License which gives you legal permission to copy, distribute -and/or modify the software. - - A secondary benefit of defending all users' freedom is that -improvements made in alternate versions of the program, if they -receive widespread use, become available for other developers to -incorporate. Many developers of free software are heartened and -encouraged by the resulting cooperation. However, in the case of -software used on network servers, this result may fail to come about. -The GNU General Public License permits making a modified version and -letting the public access it on a server without ever releasing its -source code to the public. - - The GNU Affero General Public License is designed specifically to -ensure that, in such cases, the modified source code becomes available -to the community. It requires the operator of a network server to -provide the source code of the modified version running there to the -users of that server. Therefore, public use of a modified version, on -a publicly accessible server, gives the public access to the source -code of the modified version. - - An older license, called the Affero General Public License and -published by Affero, was designed to accomplish similar goals. This is -a different license, not a version of the Affero GPL, but Affero has -released a new version of the Affero GPL which permits relicensing under -this license. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU Affero General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Remote Network Interaction; Use with the GNU General Public License. - - Notwithstanding any other provision of this License, if you modify the -Program, your modified version must prominently offer all users -interacting with it remotely through a computer network (if your version -supports such interaction) an opportunity to receive the Corresponding -Source of your version by providing access to the Corresponding Source -from a network server at no charge, through some standard or customary -means of facilitating copying of software. This Corresponding Source -shall include the Corresponding Source for any work covered by version 3 -of the GNU General Public License that is incorporated pursuant to the -following paragraph. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the work with which it is combined will remain governed by version -3 of the GNU General Public License. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU Affero General Public License from time to time. Such new versions -will be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU Affero General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU Affero General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU Affero General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If your software can interact with users remotely through a computer -network, you should also make sure that it provides a way for users to -get its source. For example, if your program is a web application, its -interface could display a "Source" link that leads users to an archive -of the code. There are many ways you could offer source, and different -solutions will be better for different programs; see section 13 for the -specific requirements. - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU AGPL, see -. diff --git a/pdfpatcher/JBig2/JBig2.sln b/pdfpatcher/JBig2/JBig2.sln deleted file mode 100644 index 9868a5aca6a9a277c9ed0a375eba3b49d65a76f9..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/JBig2.sln +++ /dev/null @@ -1,71 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31829.152 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jbig2enc", "jbig2enc\jbig2enc.vcxproj", "{D66B0FA7-0273-4902-B7D4-B752EBAF2D35}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jbig2dec", "jbig2dec\jbig2dec.vcxproj", "{2E30CFBD-3501-4C46-9C81-2A071D1C1005}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - DLL Release|Any CPU = DLL Release|Any CPU - DLL Release|Win32 = DLL Release|Win32 - DLL Release|x64 = DLL Release|x64 - DLL Release|x86 = DLL Release|x86 - Release|Any CPU = Release|Any CPU - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D66B0FA7-0273-4902-B7D4-B752EBAF2D35}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {D66B0FA7-0273-4902-B7D4-B752EBAF2D35}.Debug|Win32.ActiveCfg = Debug|Win32 - {D66B0FA7-0273-4902-B7D4-B752EBAF2D35}.Debug|Win32.Build.0 = Debug|Win32 - {D66B0FA7-0273-4902-B7D4-B752EBAF2D35}.Debug|x64.ActiveCfg = Debug|Win32 - {D66B0FA7-0273-4902-B7D4-B752EBAF2D35}.Debug|x86.ActiveCfg = Debug|Win32 - {D66B0FA7-0273-4902-B7D4-B752EBAF2D35}.Debug|x86.Build.0 = Debug|Win32 - {D66B0FA7-0273-4902-B7D4-B752EBAF2D35}.DLL Release|Any CPU.ActiveCfg = DLL Release|Win32 - {D66B0FA7-0273-4902-B7D4-B752EBAF2D35}.DLL Release|Win32.ActiveCfg = DLL Release|Win32 - {D66B0FA7-0273-4902-B7D4-B752EBAF2D35}.DLL Release|Win32.Build.0 = DLL Release|Win32 - {D66B0FA7-0273-4902-B7D4-B752EBAF2D35}.DLL Release|x64.ActiveCfg = DLL Release|Win32 - {D66B0FA7-0273-4902-B7D4-B752EBAF2D35}.DLL Release|x86.ActiveCfg = DLL Release|Win32 - {D66B0FA7-0273-4902-B7D4-B752EBAF2D35}.DLL Release|x86.Build.0 = DLL Release|Win32 - {D66B0FA7-0273-4902-B7D4-B752EBAF2D35}.Release|Any CPU.ActiveCfg = Release|Win32 - {D66B0FA7-0273-4902-B7D4-B752EBAF2D35}.Release|Win32.ActiveCfg = Release|Win32 - {D66B0FA7-0273-4902-B7D4-B752EBAF2D35}.Release|Win32.Build.0 = Release|Win32 - {D66B0FA7-0273-4902-B7D4-B752EBAF2D35}.Release|x64.ActiveCfg = Release|Win32 - {D66B0FA7-0273-4902-B7D4-B752EBAF2D35}.Release|x86.ActiveCfg = Release|Win32 - {D66B0FA7-0273-4902-B7D4-B752EBAF2D35}.Release|x86.Build.0 = Release|Win32 - {2E30CFBD-3501-4C46-9C81-2A071D1C1005}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {2E30CFBD-3501-4C46-9C81-2A071D1C1005}.Debug|Win32.ActiveCfg = Debug|Win32 - {2E30CFBD-3501-4C46-9C81-2A071D1C1005}.Debug|Win32.Build.0 = Debug|Win32 - {2E30CFBD-3501-4C46-9C81-2A071D1C1005}.Debug|x64.ActiveCfg = Debug|Win32 - {2E30CFBD-3501-4C46-9C81-2A071D1C1005}.Debug|x86.ActiveCfg = Debug|Win32 - {2E30CFBD-3501-4C46-9C81-2A071D1C1005}.Debug|x86.Build.0 = Debug|Win32 - {2E30CFBD-3501-4C46-9C81-2A071D1C1005}.DLL Release|Any CPU.ActiveCfg = DLL Release|Win32 - {2E30CFBD-3501-4C46-9C81-2A071D1C1005}.DLL Release|Win32.ActiveCfg = DLL Release|Win32 - {2E30CFBD-3501-4C46-9C81-2A071D1C1005}.DLL Release|Win32.Build.0 = DLL Release|Win32 - {2E30CFBD-3501-4C46-9C81-2A071D1C1005}.DLL Release|x64.ActiveCfg = DLL Release|Win32 - {2E30CFBD-3501-4C46-9C81-2A071D1C1005}.DLL Release|x86.ActiveCfg = DLL Release|Win32 - {2E30CFBD-3501-4C46-9C81-2A071D1C1005}.DLL Release|x86.Build.0 = DLL Release|Win32 - {2E30CFBD-3501-4C46-9C81-2A071D1C1005}.Release|Any CPU.ActiveCfg = DLL Release|Win32 - {2E30CFBD-3501-4C46-9C81-2A071D1C1005}.Release|Any CPU.Build.0 = DLL Release|Win32 - {2E30CFBD-3501-4C46-9C81-2A071D1C1005}.Release|Win32.ActiveCfg = DLL Release|Win32 - {2E30CFBD-3501-4C46-9C81-2A071D1C1005}.Release|Win32.Build.0 = DLL Release|Win32 - {2E30CFBD-3501-4C46-9C81-2A071D1C1005}.Release|x64.ActiveCfg = DLL Release|Win32 - {2E30CFBD-3501-4C46-9C81-2A071D1C1005}.Release|x64.Build.0 = DLL Release|Win32 - {2E30CFBD-3501-4C46-9C81-2A071D1C1005}.Release|x86.ActiveCfg = DLL Release|Win32 - {2E30CFBD-3501-4C46-9C81-2A071D1C1005}.Release|x86.Build.0 = DLL Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {5B304BF5-4485-496A-A72B-98B7FDFE2020} - EndGlobalSection -EndGlobal diff --git a/pdfpatcher/JBig2/LICENSE b/pdfpatcher/JBig2/LICENSE deleted file mode 100644 index 7008d5465ce4a54747b92fa17188d725ce26a032..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ - The files in this directory (folder) and any subdirectories - (sub-folders) thereof are part of jbig2dec, with the exception - of certain source files included to support portability which are - marked otherwise in their copyright headers. - - jbig2dec is free software; you can redistribute it and/or modify - it under the terms the GNU Affero General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This software is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Affero General Public - License along with this program in the file named COPYING. If not, - write to the Free Software Foundation, Inc., 59 Temple Place Suite - 330, Boston, MA 02111-1307, USA. - - In addition, specific permission is given to link jbig2dec to or - compile jbig2dec into AFPL Ghostscript and to distribute same - under the Aladdin Free Public License (AFPL) version 9. diff --git a/pdfpatcher/JBig2/README b/pdfpatcher/JBig2/README deleted file mode 100644 index 1a739c690524f02e83115f6e7001da0bfeedbc73..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/README +++ /dev/null @@ -1,32 +0,0 @@ -jbig2dec is a decoder library and example utility implementing the JBIG2 -bi-level image compression spec. Also known as ITU T.88 and ISO IEC -14492, and included by reference in Adobe's PDF version 1.4 and later. - -The basic invocation is: - - jbig2dec [-o ] file.jbig2 - -It also supports separate 'global' and 'page' streams, generally -extracted from some embedded format: - - jbig2dec [-o ] - -The program is only partially functional at this time, but should be -useful in some limited contexts. We welcome files that the decoder can't -handle, or renders incorrectly. - -More information about jbig2dec and updated versions are available from: -https://jbig2dec.com/ - -A set of example files is available from -https://jbig2dec.com/tests/ - -Development source code is kept in a git repository at: -http://git.ghostscript.com/?p=jbig2dec.git - -Report bugs at https://bugs.ghostscript.com -For security issues please use the "Security - Other" product, -and for normal bugs the "jbig2dec" product. - -Contact the developers on Discord or IRC at #ghostscript at libera.chat -or via the mailing list . diff --git a/pdfpatcher/JBig2/include/config_win32.h b/pdfpatcher/JBig2/include/config_win32.h deleted file mode 100644 index 53d4e918b65d2f4ff4f5183021cd98adf03fcffa..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/config_win32.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -/* configuration header file for compiling under Microsoft Windows */ - -#ifdef _MSC_VER - -/* VS 2012 and later have stdint.h */ -# if _MSC_VER >= 1700 -# include -# else -typedef signed char int8_t; -typedef short int int16_t; -typedef int int32_t; -typedef __int64 int64_t; -typedef unsigned char uint8_t; -typedef unsigned short int uint16_t; -typedef unsigned int uint32_t; -typedef unsigned __int64 uint64_t; -#ifndef SIZE_MAX -#define SIZE_MAX (~((size_t) 0)) -#endif -# endif - -/* VS 2008 and later have vsnprintf */ -# if _MSC_VER < 1500 -# define vsnprintf _vsnprintf -/* Previously we defined inline as nothing for 2005 and below */ -# define inline -#else -/* VS 2008 has __inline but not inline, later versions (unknown exactly where) define inline - * so cater for it being defined already. - */ -# if !(defined(inline)) -# define inline __inline -# endif -# endif - -/* VS 2014 and later have (finally) snprintf */ -# if _MSC_VER >= 1900 -# define STDC99 -# else -# define snprintf _snprintf -# endif - -#else /* _MSC_VER */ - -/* Not VS -- it had best behave */ -# include - -#endif /* _MSC_VER */ diff --git a/pdfpatcher/JBig2/include/getopt.h b/pdfpatcher/JBig2/include/getopt.h deleted file mode 100644 index 6111a4a689ba0c01e5616d1d8c109971f7b5606c..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/getopt.h +++ /dev/null @@ -1,173 +0,0 @@ -/* Declarations for getopt. - Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _GETOPT_H - -#ifndef __need_getopt -# define _GETOPT_H 1 -#endif - -/* If __GNU_LIBRARY__ is not already defined, either we are being used - standalone, or this is the first header included in the source file. - If we are being used with glibc, we need to include , but - that does not exist if we are standalone. So: if __GNU_LIBRARY__ is - not defined, include , which will pull in for us - if it's from glibc. (Why ctype.h? It's guaranteed to exist and it - doesn't flood the namespace with stuff the way some other headers do.) */ -#if !defined __GNU_LIBRARY__ -# include -#endif - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -extern char *optarg; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -extern int optind; - -/* Callers store zero here to inhibit the error message `getopt' prints - for unrecognized options. */ - -extern int opterr; - -/* Set to an option character which was unrecognized. */ - -extern int optopt; - -#ifndef __need_getopt -/* Describe the long-named options requested by the application. - The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector - of `struct option' terminated by an element containing a name which is - zero. - - The field `has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - optional_argument (or 2) if the option takes an optional argument. - - If the field `flag' is not NULL, it points to a variable that is set - to the value given in the field `val' when the option is found, but - left unchanged if the option is not found. - - To have a long-named option do something other than set an `int' to - a compiled-in constant, such as set a value from `optarg', set the - option's `flag' field to zero and its `val' field to a nonzero - value (the equivalent single-letter option character, if there is - one). For long options that have a zero `flag' field, `getopt' - returns the contents of the `val' field. */ - -struct option { -# if (defined __STDC__ && __STDC__) || defined __cplusplus - const char *name; -# else - char *name; -# endif - /* has_arg can't be an enum because some compilers complain about - type mismatches in all the code that assumes it is an int. */ - int has_arg; - int *flag; - int val; -}; - -/* Names for the values of the `has_arg' field of `struct option'. */ - -# define no_argument 0 -# define required_argument 1 -# define optional_argument 2 -#endif /* need getopt */ - -/* Get definitions and prototypes for functions to process the - arguments in ARGV (ARGC of them, minus the program name) for - options given in OPTS. - - Return the option character from OPTS just read. Return -1 when - there are no more options. For unrecognized options, or options - missing arguments, `optopt' is set to the option letter, and '?' is - returned. - - The OPTS string is a list of characters which are recognized option - letters, optionally followed by colons, specifying that that letter - takes an argument, to be placed in `optarg'. - - If a letter in OPTS is followed by two colons, its argument is - optional. This behavior is specific to the GNU `getopt'. - - The argument `--' causes premature termination of argument - scanning, explicitly telling `getopt' that there are no more - options. - - If OPTS begins with `--', then non-option arguments are treated as - arguments to the option '\0'. This behavior is specific to the GNU - `getopt'. */ - -#if (defined __STDC__ && __STDC__) || defined __cplusplus -# ifdef __GNU_LIBRARY__ -/* Many other libraries have conflicting prototypes for getopt, with - differences in the consts, in stdlib.h. To avoid compilation - errors, only prototype getopt for the GNU C library. */ -extern int getopt(int __argc, char *const *__argv, const char *__shortopts); -# else /* not __GNU_LIBRARY__ */ -extern int getopt(); -# endif /* __GNU_LIBRARY__ */ - -# ifndef __need_getopt -extern int getopt_long(int __argc, char *const *__argv, const char *__shortopts, const struct option *__longopts, int *__longind); -extern int getopt_long_only(int __argc, char *const *__argv, const char *__shortopts, const struct option *__longopts, int *__longind); - -/* Internal only. Users should not call this directly. */ -extern int _getopt_internal(int __argc, char *const *__argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only); -# endif -#else /* not __STDC__ */ -extern int getopt(); -# ifndef __need_getopt -extern int getopt_long(); -extern int getopt_long_only(); - -extern int _getopt_internal(); -# endif -#endif /* __STDC__ */ - -#ifdef __cplusplus -} -#endif - -/* Make sure we later can get all the definitions and declarations. */ -#undef __need_getopt - -#endif /* getopt.h */ diff --git a/pdfpatcher/JBig2/include/jbig2.h b/pdfpatcher/JBig2/include/jbig2.h deleted file mode 100644 index 49fb1f024178dd895b41d20cc985361c5cfba240..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2.h +++ /dev/null @@ -1,112 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifndef _JBIG2_H -#define _JBIG2_H - -#ifdef __cplusplus -extern "C" -{ -#endif - -#define JBIG2_VERSION_MAJOR (0) -#define JBIG2_VERSION_MINOR (19) - -/* warning levels */ -typedef enum { - JBIG2_SEVERITY_DEBUG, - JBIG2_SEVERITY_INFO, - JBIG2_SEVERITY_WARNING, - JBIG2_SEVERITY_FATAL -} Jbig2Severity; - -typedef enum { - JBIG2_OPTIONS_EMBEDDED = 1 -} Jbig2Options; - -/* forward public structure declarations */ -typedef struct _Jbig2Allocator Jbig2Allocator; -typedef struct _Jbig2Ctx Jbig2Ctx; -typedef struct _Jbig2GlobalCtx Jbig2GlobalCtx; - -/* - this is the general image structure used by the jbig2dec library - images are 1 bpp, packed into rows a byte at a time. stride gives - the byte offset to the next row, while width and height define - the size of the image area in pixels. -*/ -typedef struct _Jbig2Image Jbig2Image; -struct _Jbig2Image { - uint32_t width; - uint32_t height; - uint32_t stride; - uint8_t *data; - int refcount; -}; - -/* errors are returned from the library via a callback. If no callback - is provided (a NULL argument is passed to jbig2_ctx_new) a default - handler is used which prints fatal errors to the stderr stream. */ - -/* error callback */ -#define JBIG2_UNKNOWN_SEGMENT_NUMBER ~0U -typedef void (*Jbig2ErrorCallback)(void *data, const char *msg, Jbig2Severity severity, uint32_t seg_idx); - -/* memory allocation is likewise done via a set of callbacks so that - clients can better control memory usage. If a NULL is passed for - this argument of jbig2_ctx_new, a default allocator based on malloc() - is used. */ - -/* dynamic memory callbacks */ -struct _Jbig2Allocator { - void *(*alloc)(Jbig2Allocator *allocator, size_t size); - void (*free)(Jbig2Allocator *allocator, void *p); - void *(*realloc)(Jbig2Allocator *allocator, void *p, size_t size); -}; - -/* decoder context */ -#define jbig2_ctx_new(allocator, options, global_ctx, error_callback, error_callback_data) jbig2_ctx_new_imp((allocator), (options), (global_ctx), (error_callback), (error_callback_data), JBIG2_VERSION_MAJOR, JBIG2_VERSION_MINOR) -Jbig2Ctx *jbig2_ctx_new_imp(Jbig2Allocator *allocator, - Jbig2Options options, - Jbig2GlobalCtx *global_ctx, - Jbig2ErrorCallback error_callback, - void *error_callback_data, - int jbig2_version_major, - int jbig2_version_minor); -Jbig2Allocator *jbig2_ctx_free(Jbig2Ctx *ctx); - -/* global context for embedded streams */ -Jbig2GlobalCtx *jbig2_make_global_ctx(Jbig2Ctx *ctx); -Jbig2Allocator *jbig2_global_ctx_free(Jbig2GlobalCtx *global_ctx); - -/* submit data to the decoder */ -int jbig2_data_in(Jbig2Ctx *ctx, const unsigned char *data, size_t size); - -/* get the next available decoded page image. NULL means there isn't one. */ -Jbig2Image *jbig2_page_out(Jbig2Ctx *ctx); -/* mark a returned page image as no longer needed. */ -void jbig2_release_page(Jbig2Ctx *ctx, Jbig2Image *image); -/* mark the current page as complete, simulating an end-of-page segment (for broken streams) */ -int jbig2_complete_page(Jbig2Ctx *ctx); - -#ifdef __cplusplus -} -#endif - -#endif /* _JBIG2_H */ diff --git a/pdfpatcher/JBig2/include/jbig2_arith.h b/pdfpatcher/JBig2/include/jbig2_arith.h deleted file mode 100644 index 41876fb2d52514bad677a356c9e8fc0f4ba4bc70..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2_arith.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifndef _JBIG2_ARITH_H -#define _JBIG2_ARITH_H - -typedef struct _Jbig2ArithState Jbig2ArithState; - -/* An arithmetic coding context is stored as a single byte, with the - index in the low order 7 bits (actually only 6 are used), and the - MPS in the top bit. */ -typedef unsigned char Jbig2ArithCx; - -/* allocate and initialize a new arithmetic coding state */ -Jbig2ArithState *jbig2_arith_new(Jbig2Ctx *ctx, Jbig2WordStream *ws); - -/* decode a bit */ -/* Normally returns 0 or 1. May return negative in case of error. */ -int jbig2_arith_decode(Jbig2Ctx *ctx, Jbig2ArithState *as, Jbig2ArithCx *pcx); - -/* returns true if the end of the data stream has been reached (for sanity checks) */ -bool jbig2_arith_has_reached_marker(Jbig2ArithState *as); - -#endif /* _JBIG2_ARITH_H */ diff --git a/pdfpatcher/JBig2/include/jbig2_arith_iaid.h b/pdfpatcher/JBig2/include/jbig2_arith_iaid.h deleted file mode 100644 index 1b0f061bec45009f47674122f47638d14565f88e..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2_arith_iaid.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifndef _JBIG2_ARITH_IAID_H -#define _JBIG2_ARITH_IAID_H - -typedef struct _Jbig2ArithIaidCtx Jbig2ArithIaidCtx; - -Jbig2ArithIaidCtx *jbig2_arith_iaid_ctx_new(Jbig2Ctx *ctx, uint8_t SBSYMCODELEN); - -int jbig2_arith_iaid_decode(Jbig2Ctx *ctx, Jbig2ArithIaidCtx *actx, Jbig2ArithState *as, int32_t *p_result); - -void jbig2_arith_iaid_ctx_free(Jbig2Ctx *ctx, Jbig2ArithIaidCtx *iax); - -#endif /* _JBIG2_ARITH_IAID_H */ diff --git a/pdfpatcher/JBig2/include/jbig2_arith_int.h b/pdfpatcher/JBig2/include/jbig2_arith_int.h deleted file mode 100644 index e7a3b279f3b33771fcfb915d971976bab650ceef..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2_arith_int.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifndef _JBIG2_ARITH_INT_H -#define _JBIG2_ARITH_INT_H - -typedef struct _Jbig2ArithIntCtx Jbig2ArithIntCtx; - -Jbig2ArithIntCtx *jbig2_arith_int_ctx_new(Jbig2Ctx *ctx); - -int jbig2_arith_int_decode(Jbig2Ctx *ctx, Jbig2ArithIntCtx *actx, Jbig2ArithState *as, int32_t *p_result); - -void jbig2_arith_int_ctx_free(Jbig2Ctx *ctx, Jbig2ArithIntCtx *iax); - -#endif /* _JBIG2_ARITH_INT_H */ diff --git a/pdfpatcher/JBig2/include/jbig2_generic.h b/pdfpatcher/JBig2/include/jbig2_generic.h deleted file mode 100644 index 3c9fc9dba95ea336a7daa519818c21847914e558..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2_generic.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifndef _JBIG2_GENERIC_H -#define _JBIG2_GENERIC_H - -/** - * Headers for Generic and Generic Refinement region handling - **/ - -/* 6.4 Table 2 */ -typedef struct { - bool MMR; - /* GBW */ - /* GBH */ - int GBTEMPLATE; - bool TPGDON; - bool USESKIP; - Jbig2Image *SKIP; - int8_t gbat[8]; -} Jbig2GenericRegionParams; - -/* return the appropriate context size for the given template */ -int jbig2_generic_stats_size(Jbig2Ctx *ctx, int template); - -int -jbig2_decode_generic_region(Jbig2Ctx *ctx, - Jbig2Segment *segment, const Jbig2GenericRegionParams *params, Jbig2ArithState *as, Jbig2Image *image, Jbig2ArithCx *GB_stats); - -/* 7.4 */ -int jbig2_immediate_generic_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data); - -#endif /* _JBIG2_GENERIC_H */ diff --git a/pdfpatcher/JBig2/include/jbig2_halftone.h b/pdfpatcher/JBig2/include/jbig2_halftone.h deleted file mode 100644 index 4b0c53837f475beba927c90056467ae52f706d34..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2_halftone.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifndef _JBIG2_HALFTONE_H -#define _JBIG2_HALFTONE_H - -typedef struct { - int n_patterns; - Jbig2Image **patterns; - uint32_t HPW, HPH; -} Jbig2PatternDict; - -/* Table 24 */ -typedef struct { - bool HDMMR; - uint32_t HDPW; - uint32_t HDPH; - uint32_t GRAYMAX; - int HDTEMPLATE; -} Jbig2PatternDictParams; - -/* Table 33 */ -typedef struct { - byte flags; - uint32_t HGW; - uint32_t HGH; - int32_t HGX; - int32_t HGY; - uint16_t HRX; - uint16_t HRY; - bool HMMR; - int HTEMPLATE; - bool HENABLESKIP; - Jbig2ComposeOp HCOMBOP; - bool HDEFPIXEL; -} Jbig2HalftoneRegionParams; - -void jbig2_hd_release(Jbig2Ctx *ctx, Jbig2PatternDict *dict); - -int jbig2_halftone_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data); -int jbig2_pattern_dictionary(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data); - -#endif /* _JBIG2_HALFTONE_H */ diff --git a/pdfpatcher/JBig2/include/jbig2_huffman.h b/pdfpatcher/JBig2/include/jbig2_huffman.h deleted file mode 100644 index 76fdf1b5313b42d0e3b22b3f9d1e74f13280ba04..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2_huffman.h +++ /dev/null @@ -1,110 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifndef _JBIG2_HUFFMAN_H -#define _JBIG2_HUFFMAN_H - -/* Huffman coder interface */ - -typedef struct _Jbig2HuffmanEntry Jbig2HuffmanEntry; -typedef struct _Jbig2HuffmanState Jbig2HuffmanState; -typedef struct _Jbig2HuffmanTable Jbig2HuffmanTable; -typedef struct _Jbig2HuffmanParams Jbig2HuffmanParams; - -struct _Jbig2HuffmanEntry { - union { - int32_t RANGELOW; - Jbig2HuffmanTable *ext_table; - } u; - byte PREFLEN; - byte RANGELEN; - byte flags; -}; - -struct _Jbig2HuffmanTable { - int log_table_size; - Jbig2HuffmanEntry *entries; -}; - -typedef struct _Jbig2HuffmanLine Jbig2HuffmanLine; - -struct _Jbig2HuffmanLine { - int PREFLEN; - int RANGELEN; - int RANGELOW; -}; - -struct _Jbig2HuffmanParams { - bool HTOOB; - int n_lines; - const Jbig2HuffmanLine *lines; -}; - -Jbig2HuffmanState *jbig2_huffman_new(Jbig2Ctx *ctx, Jbig2WordStream *ws); - -void jbig2_huffman_free(Jbig2Ctx *ctx, Jbig2HuffmanState *hs); - -int jbig2_huffman_skip(Jbig2HuffmanState *hs); - -int jbig2_huffman_advance(Jbig2HuffmanState *hs, size_t advance); - -uint32_t jbig2_huffman_offset(Jbig2HuffmanState *hs); - -int32_t jbig2_huffman_get(Jbig2HuffmanState *hs, const Jbig2HuffmanTable *table, bool *oob); - -int32_t jbig2_huffman_get_bits(Jbig2HuffmanState *hs, const int bits, int *err); - -#ifdef JBIG2_DEBUG -void jbig2_dump_huffman_state(Jbig2HuffmanState *hs); -void jbig2_dump_huffman_binary(Jbig2HuffmanState *hs); -#endif - -Jbig2HuffmanTable *jbig2_build_huffman_table(Jbig2Ctx *ctx, const Jbig2HuffmanParams *params); - -void jbig2_release_huffman_table(Jbig2Ctx *ctx, Jbig2HuffmanTable *table); - -/* standard Huffman templates defined by the specification */ -extern const Jbig2HuffmanParams jbig2_huffman_params_A; /* Table B.1 */ -extern const Jbig2HuffmanParams jbig2_huffman_params_B; /* Table B.2 */ -extern const Jbig2HuffmanParams jbig2_huffman_params_C; /* Table B.3 */ -extern const Jbig2HuffmanParams jbig2_huffman_params_D; /* Table B.4 */ -extern const Jbig2HuffmanParams jbig2_huffman_params_E; /* Table B.5 */ -extern const Jbig2HuffmanParams jbig2_huffman_params_F; /* Table B.6 */ -extern const Jbig2HuffmanParams jbig2_huffman_params_G; /* Table B.7 */ -extern const Jbig2HuffmanParams jbig2_huffman_params_H; /* Table B.8 */ -extern const Jbig2HuffmanParams jbig2_huffman_params_I; /* Table B.9 */ -extern const Jbig2HuffmanParams jbig2_huffman_params_J; /* Table B.10 */ -extern const Jbig2HuffmanParams jbig2_huffman_params_K; /* Table B.11 */ -extern const Jbig2HuffmanParams jbig2_huffman_params_L; /* Table B.12 */ -extern const Jbig2HuffmanParams jbig2_huffman_params_M; /* Table B.13 */ -extern const Jbig2HuffmanParams jbig2_huffman_params_N; /* Table B.14 */ -extern const Jbig2HuffmanParams jbig2_huffman_params_O; /* Table B.15 */ - -/* Routines to handle "code table segment (53)" */ - -/* Parse a code table segment, store Jbig2HuffmanParams in segment->result */ -int jbig2_table(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data); - -/* free Jbig2HuffmanParams allocated by jbig2_huffman_table() */ -void jbig2_table_free(Jbig2Ctx *ctx, Jbig2HuffmanParams *params); - -/* find a user supplied table used by 'segment' and by 'index' */ -const Jbig2HuffmanParams *jbig2_find_table(Jbig2Ctx *ctx, Jbig2Segment *segment, int index); - -#endif /* _JBIG2_HUFFMAN_H */ diff --git a/pdfpatcher/JBig2/include/jbig2_hufftab.h b/pdfpatcher/JBig2/include/jbig2_hufftab.h deleted file mode 100644 index 58ed066493ee94db3b4f2b1712c487afc441005a..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2_hufftab.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -/* predefined Huffman table definitions - -- See Annex B.5 of the JBIG2 specification */ - -#ifndef _JBIG2_HUFFTAB_H -#define _JBIG2_HUFFTAB_H - -extern const Jbig2HuffmanParams jbig2_huffman_params_A; -extern const Jbig2HuffmanParams jbig2_huffman_params_B; -extern const Jbig2HuffmanParams jbig2_huffman_params_C; -extern const Jbig2HuffmanParams jbig2_huffman_params_D; -extern const Jbig2HuffmanParams jbig2_huffman_params_E; -extern const Jbig2HuffmanParams jbig2_huffman_params_F; -extern const Jbig2HuffmanParams jbig2_huffman_params_G; -extern const Jbig2HuffmanParams jbig2_huffman_params_H; -extern const Jbig2HuffmanParams jbig2_huffman_params_I; -extern const Jbig2HuffmanParams jbig2_huffman_params_J; -extern const Jbig2HuffmanParams jbig2_huffman_params_K; -extern const Jbig2HuffmanParams jbig2_huffman_params_L; -extern const Jbig2HuffmanParams jbig2_huffman_params_M; -extern const Jbig2HuffmanParams jbig2_huffman_params_N; -extern const Jbig2HuffmanParams jbig2_huffman_params_O; - -#endif /* _JBIG2_HUFFTAB_H */ diff --git a/pdfpatcher/JBig2/include/jbig2_image.h b/pdfpatcher/JBig2/include/jbig2_image.h deleted file mode 100644 index 61991545a1626508ca963014ad19af31d53d19dc..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2_image.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifndef _JBIG2_IMAGE_H -#define _JBIG2_IMAGE_H - -typedef enum { - JBIG2_COMPOSE_OR = 0, - JBIG2_COMPOSE_AND = 1, - JBIG2_COMPOSE_XOR = 2, - JBIG2_COMPOSE_XNOR = 3, - JBIG2_COMPOSE_REPLACE = 4 -} Jbig2ComposeOp; - -Jbig2Image *jbig2_image_new(Jbig2Ctx *ctx, uint32_t width, uint32_t height); -void jbig2_image_release(Jbig2Ctx *ctx, Jbig2Image *image); -Jbig2Image *jbig2_image_reference(Jbig2Ctx *ctx, Jbig2Image *image); -void jbig2_image_free(Jbig2Ctx *ctx, Jbig2Image *image); -void jbig2_image_clear(Jbig2Ctx *ctx, Jbig2Image *image, int value); -Jbig2Image *jbig2_image_resize(Jbig2Ctx *ctx, Jbig2Image *image, uint32_t width, uint32_t height, int value); -int jbig2_image_compose(Jbig2Ctx *ctx, Jbig2Image *dst, Jbig2Image *src, int x, int y, Jbig2ComposeOp op); - -int jbig2_image_get_pixel(Jbig2Image *image, int x, int y); -void jbig2_image_set_pixel(Jbig2Image *image, int x, int y, bool value); - -#endif /* _JBIG2_IMAGE_H */ diff --git a/pdfpatcher/JBig2/include/jbig2_image_rw.h b/pdfpatcher/JBig2/include/jbig2_image_rw.h deleted file mode 100644 index 6441e7d7a066f23f3a9a78c3bc7bac2641023803..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2_image_rw.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifndef _JBIG2_IMAGE_RW_H -#define _JBIG2_IMAGE_RW_H - -/* routines for dumping the image data in various formats */ - -#include - -int jbig2_image_write_pbm_file(Jbig2Image *image, char *filename); -int jbig2_image_write_pbm(Jbig2Image *image, FILE *out); -Jbig2Image *jbig2_image_read_pbm_file(Jbig2Ctx *ctx, char *filename); -Jbig2Image *jbig2_image_read_pbm(Jbig2Ctx *ctx, FILE *in); - -#ifdef HAVE_LIBPNG -int jbig2_image_write_png_file(Jbig2Image *image, char *filename); -int jbig2_image_write_png(Jbig2Image *image, FILE *out); -#endif - -#endif /* _JBIG2_IMAGE_RW_H */ diff --git a/pdfpatcher/JBig2/include/jbig2_mmr.h b/pdfpatcher/JBig2/include/jbig2_mmr.h deleted file mode 100644 index 3da5fcca230caee441d1c9135e04456ee3316d51..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2_mmr.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifndef _JBIG2_MMR_H -#define _JBIG2_MMR_H - -int -jbig2_decode_generic_mmr(Jbig2Ctx *ctx, Jbig2Segment *segment, const Jbig2GenericRegionParams *params, const byte *data, size_t size, Jbig2Image *image); - -int -jbig2_decode_halftone_mmr(Jbig2Ctx *ctx, const Jbig2GenericRegionParams *params, const byte *data, size_t size, Jbig2Image *image, size_t *consumed_bytes); - -#endif /* _JBIG2_MMR_H */ diff --git a/pdfpatcher/JBig2/include/jbig2_page.h b/pdfpatcher/JBig2/include/jbig2_page.h deleted file mode 100644 index 734e3ef0d9c40897dd0232773ba52c255bfbe88c..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2_page.h +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifndef _JBIG2_PAGE_H -#define _JBIG2_PAGE_H - -/* the page structure handles decoded page - results. it's allocated by a 'page info' - segment and marked complete by an 'end of page' - segment. -*/ -typedef enum { - JBIG2_PAGE_FREE, - JBIG2_PAGE_NEW, - JBIG2_PAGE_COMPLETE, - JBIG2_PAGE_RETURNED, - JBIG2_PAGE_RELEASED -} Jbig2PageState; - -struct _Jbig2Page { - Jbig2PageState state; - uint32_t number; - uint32_t height, width; /* in pixels */ - uint32_t x_resolution, y_resolution; /* in pixels per meter */ - uint16_t stripe_size; - bool striped; - uint32_t end_row; - uint8_t flags; - Jbig2Image *image; -}; - -int jbig2_page_info(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data); -int jbig2_end_of_stripe(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data); -int jbig2_end_of_page(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data); -int jbig2_page_add_result(Jbig2Ctx *ctx, Jbig2Page *page, Jbig2Image *src, uint32_t x, uint32_t y, Jbig2ComposeOp op); - -#endif /* _JBIG2_PAGE_H */ diff --git a/pdfpatcher/JBig2/include/jbig2_priv.h b/pdfpatcher/JBig2/include/jbig2_priv.h deleted file mode 100644 index ed366af5c8f9877897f71294201cc8f3e0f278d2..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2_priv.h +++ /dev/null @@ -1,165 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifndef _JBIG2_PRIV_H -#define _JBIG2_PRIV_H - -/* To enable Memento predefine MEMENTO while building by setting - CFLAGS=-DMEMENTO. */ - -/* If we are being compiled as part of a larger project that includes - * Memento, that project should define JBIG_EXTERNAL_MEMENTO_H to point - * to the include file to use. - */ -#ifdef JBIG_EXTERNAL_MEMENTO_H -#include JBIG_EXTERNAL_MEMENTO_H -#else -#include "memento.h" -#endif - -/* library internals */ - -/* If we don't have a definition for inline, make it nothing so the code will compile */ -#ifndef inline -#define inline -#endif - -typedef uint8_t byte; - -#define bool int - -#ifdef __cplusplus -#define template template_C -#define new new_C -#endif - -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef NULL -#define NULL ((void*)0) -#endif - -#if !defined (INT32_MIN) -#define INT32_MIN (-0x7fffffff - 1) -#endif -#if !defined (INT32_MAX) -#define INT32_MAX 0x7fffffff -#endif -#if !defined (UINT32_MAX) -#define UINT32_MAX 0xffffffffu -#endif - -typedef struct _Jbig2Page Jbig2Page; -typedef struct _Jbig2Segment Jbig2Segment; - -typedef enum { - JBIG2_FILE_HEADER, - JBIG2_FILE_SEQUENTIAL_HEADER, - JBIG2_FILE_SEQUENTIAL_BODY, - JBIG2_FILE_RANDOM_HEADERS, - JBIG2_FILE_RANDOM_BODIES, - JBIG2_FILE_EOF -} Jbig2FileState; - -struct _Jbig2Ctx { - Jbig2Allocator *allocator; - Jbig2Options options; - const Jbig2Ctx *global_ctx; - Jbig2ErrorCallback error_callback; - void *error_callback_data; - - byte *buf; - size_t buf_size; - size_t buf_rd_ix; - size_t buf_wr_ix; - - Jbig2FileState state; - - uint8_t file_header_flags; - uint32_t n_pages; - - uint32_t n_segments_max; - Jbig2Segment **segments; - uint32_t n_segments; /* index of last segment header parsed */ - uint32_t segment_index; /* index of last segment body parsed */ - - /* list of decoded pages, including the one in progress, - currently stored as a contiguous, 0-indexed array. */ - uint32_t current_page; - uint32_t max_page_index; - Jbig2Page *pages; -}; - -uint32_t jbig2_get_uint32(const byte *bptr); - -int32_t jbig2_get_int32(const byte *buf); - -uint16_t jbig2_get_uint16(const byte *bptr); - -int16_t jbig2_get_int16(const byte *buf); - -/* dynamic memory management */ -void *jbig2_alloc(Jbig2Allocator *allocator, size_t size, size_t num); - -void jbig2_free(Jbig2Allocator *allocator, void *p); - -void *jbig2_realloc(Jbig2Allocator *allocator, void *p, size_t size, size_t num); - -#define jbig2_new(ctx, t, size) ((t *)jbig2_alloc(ctx->allocator, size, sizeof(t))) - -#define jbig2_renew(ctx, p, t, size) ((t *)jbig2_realloc(ctx->allocator, (p), size, sizeof(t))) - -int jbig2_error(Jbig2Ctx *ctx, Jbig2Severity severity, uint32_t seg_idx, const char *fmt, ...) -#ifdef __GNUC__ - __attribute__ ((format (__printf__, 4, 5))) -#endif - ; - -/* The word stream design is a compromise between simplicity and - trying to amortize the number of method calls. Each ::get_next_word - invocation pulls 4 bytes from the stream, packed big-endian into a - 32 bit word. The offset argument is provided as a convenience. It - begins at 0 and increments by 4 for each successive invocation. */ -typedef struct _Jbig2WordStream Jbig2WordStream; - -struct _Jbig2WordStream { - int (*get_next_word)(Jbig2Ctx *ctx, Jbig2WordStream *self, size_t offset, uint32_t *word); -}; - -Jbig2WordStream *jbig2_word_stream_buf_new(Jbig2Ctx *ctx, const byte *data, size_t size); - -void jbig2_word_stream_buf_free(Jbig2Ctx *ctx, Jbig2WordStream *ws); - -/* restrict is standard in C99, but not in all C++ compilers. */ -#if defined (__STDC_VERSION_) && (__STDC_VERSION__ >= 199901L) /* C99 */ -#define JBIG2_RESTRICT restrict -#elif defined(_MSC_VER) && (_MSC_VER >= 1600) /* MSVC 10 or newer */ -#define JBIG2_RESTRICT __restrict -#elif defined(__GNUC__) && (__GNUC__ >= 3) /* GCC 3 or newer */ -#define JBIG2_RESTRICT __restrict -#else /* Unknown or ancient */ -#define JBIG2_RESTRICT -#endif - -#endif /* _JBIG2_PRIV_H */ diff --git a/pdfpatcher/JBig2/include/jbig2_refinement.h b/pdfpatcher/JBig2/include/jbig2_refinement.h deleted file mode 100644 index 66943335360ea9d07ad5be658306f1b9115733b4..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2_refinement.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifndef _JBIG2_REFINEMENT_H -#define _JBIG2_REFINEMENT_H - -/* 6.3 Table 6 */ -typedef struct { - /* GRW */ - /* GRH */ - bool GRTEMPLATE; - Jbig2Image *GRREFERENCE; - int32_t GRREFERENCEDX, GRREFERENCEDY; - bool TPGRON; - int8_t grat[4]; -} Jbig2RefinementRegionParams; - -int -jbig2_decode_refinement_region(Jbig2Ctx *ctx, - Jbig2Segment *segment, - const Jbig2RefinementRegionParams *params, Jbig2ArithState *as, Jbig2Image *image, Jbig2ArithCx *GB_stats); - -/* 7.4 */ -int jbig2_refinement_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data); - -#endif /* _JBIG2_REFINEMENT_H */ - diff --git a/pdfpatcher/JBig2/include/jbig2_segment.h b/pdfpatcher/JBig2/include/jbig2_segment.h deleted file mode 100644 index 7790bf5357fb58487bb3eb5ce628ca2049af771f..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2_segment.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifndef _JBIG2_SEGMENT_H -#define _JBIG2_SEGMENT_H - -/* segment header routines */ - -struct _Jbig2Segment { - uint32_t number; - uint8_t flags; - uint32_t page_association; - size_t data_length; - int referred_to_segment_count; - uint32_t *referred_to_segments; - uint32_t rows; - void *result; -}; - -Jbig2Segment *jbig2_parse_segment_header(Jbig2Ctx *ctx, uint8_t *buf, size_t buf_size, size_t *p_header_size); -int jbig2_parse_segment(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data); -void jbig2_free_segment(Jbig2Ctx *ctx, Jbig2Segment *segment); -Jbig2Segment *jbig2_find_segment(Jbig2Ctx *ctx, uint32_t number); - -/* region segment info */ - -typedef struct { - uint32_t width; - uint32_t height; - uint32_t x; - uint32_t y; - Jbig2ComposeOp op; - uint8_t flags; -} Jbig2RegionSegmentInfo; - -void jbig2_get_region_segment_info(Jbig2RegionSegmentInfo *info, const uint8_t *segment_data); - -#endif /* _JBIG2_SEGMENT_H */ diff --git a/pdfpatcher/JBig2/include/jbig2_symbol_dict.h b/pdfpatcher/JBig2/include/jbig2_symbol_dict.h deleted file mode 100644 index 2abb0df5bcef0c62f19ca8d5729dbed988ae08a8..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2_symbol_dict.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifndef _JBIG2_SYMBOL_DICT_H -#define _JBIG2_SYMBOL_DICT_H - -/* symbol dictionary header */ - -/* the results of decoding a symbol dictionary */ -typedef struct { - uint32_t n_symbols; - Jbig2Image **glyphs; -} Jbig2SymbolDict; - -/* decode a symbol dictionary segment and store the results */ -int jbig2_symbol_dictionary(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data); - -/* get a particular glyph by index */ -Jbig2Image *jbig2_sd_glyph(Jbig2SymbolDict *dict, unsigned int id); - -/* return a new empty symbol dict */ -Jbig2SymbolDict *jbig2_sd_new(Jbig2Ctx *ctx, uint32_t n_symbols); - -/* release the memory associated with a symbol dict */ -void jbig2_sd_release(Jbig2Ctx *ctx, Jbig2SymbolDict *dict); - -/* generate a new symbol dictionary by concatenating a list of - existing dictionaries */ -Jbig2SymbolDict *jbig2_sd_cat(Jbig2Ctx *ctx, uint32_t n_dicts, Jbig2SymbolDict **dicts); - -/* count the number of dictionary segments referred - to by the given segment */ -uint32_t jbig2_sd_count_referred(Jbig2Ctx *ctx, Jbig2Segment *segment); - -/* return an array of pointers to symbol dictionaries referred - to by a segment */ -Jbig2SymbolDict **jbig2_sd_list_referred(Jbig2Ctx *ctx, Jbig2Segment *segment); - -#endif /* _JBIG2_SYMBOL_DICT_H */ diff --git a/pdfpatcher/JBig2/include/jbig2_text.h b/pdfpatcher/JBig2/include/jbig2_text.h deleted file mode 100644 index 1c5135fddef67b03ba07524c608cd61527a8c710..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2_text.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifndef _JBIG2_TEXT_H -#define _JBIG2_TEXT_H - -/** - * Headers for Text region handling - **/ - -typedef enum { - JBIG2_CORNER_BOTTOMLEFT = 0, - JBIG2_CORNER_TOPLEFT = 1, - JBIG2_CORNER_BOTTOMRIGHT = 2, - JBIG2_CORNER_TOPRIGHT = 3 -} Jbig2RefCorner; - -typedef struct { - bool SBHUFF; - bool SBREFINE; - bool SBDEFPIXEL; - Jbig2ComposeOp SBCOMBOP; - bool TRANSPOSED; - Jbig2RefCorner REFCORNER; - int SBDSOFFSET; - /* int SBW; */ - /* int SBH; */ - uint32_t SBNUMINSTANCES; - int LOGSBSTRIPS; - int SBSTRIPS; - /* int SBNUMSYMS; */ - /* SBSYMCODES */ - /* SBSYMCODELEN */ - /* SBSYMS */ - Jbig2HuffmanTable *SBHUFFFS; - Jbig2HuffmanTable *SBHUFFDS; - Jbig2HuffmanTable *SBHUFFDT; - Jbig2HuffmanTable *SBHUFFRDW; - Jbig2HuffmanTable *SBHUFFRDH; - Jbig2HuffmanTable *SBHUFFRDX; - Jbig2HuffmanTable *SBHUFFRDY; - Jbig2HuffmanTable *SBHUFFRSIZE; - Jbig2ArithIntCtx *IADT; - Jbig2ArithIntCtx *IAFS; - Jbig2ArithIntCtx *IADS; - Jbig2ArithIntCtx *IAIT; - Jbig2ArithIaidCtx *IAID; - Jbig2ArithIntCtx *IARI; - Jbig2ArithIntCtx *IARDW; - Jbig2ArithIntCtx *IARDH; - Jbig2ArithIntCtx *IARDX; - Jbig2ArithIntCtx *IARDY; - bool SBRTEMPLATE; - int8_t sbrat[4]; -} Jbig2TextRegionParams; - -int -jbig2_decode_text_region(Jbig2Ctx *ctx, Jbig2Segment *segment, - const Jbig2TextRegionParams *params, - const Jbig2SymbolDict *const *dicts, const uint32_t n_dicts, - Jbig2Image *image, const byte *data, const size_t size, Jbig2ArithCx *GR_stats, Jbig2ArithState *as, Jbig2WordStream *ws); - -int jbig2_text_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data); - -#endif /* _JBIG2_TEXT_H */ diff --git a/pdfpatcher/JBig2/include/jbig2arith.h b/pdfpatcher/JBig2/include/jbig2arith.h deleted file mode 100644 index bf79e4c49e19a5c9a3ce39654de7682b61382916..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2arith.h +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright 2006 Google Inc. All Rights Reserved. -// Author: agl@imperialviolet.org (Adam Langley) -// -// Copyright (C) 2006 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef JBIG2ENC_JBIG2ENC_H__ -#define JBIG2ENC_JBIG2ENC_H__ - -#if defined(sun) -#include -#else -#include -#endif - -#include - -#define JBIG2_MAX_CTX 65536 -#define JBIG2_OUTPUTBUFFER_SIZE 20 * 1024 - -#ifdef _MSC_VER -#define __restrict__ __restrict -#endif - -//#define JBIG2_DEBUGGING -//#define CODER_DEBUGGING -//#define SYM_DEBUGGING -//#define SYMBOL_COMPRESSION_DEBUGGING - -// ----------------------------------------------------------------------------- -// This is the context for the arithmetic encoder used in JBIG2. The coder is a -// state machine and there are many different states used - one for coding -// images, many more for coding numbers etc. -// -// When outputting data, the bytes are collected into chunks of size -// JBIG2_OUTPUTBUFFER_SIZE. These are chained in a linked list. -// ----------------------------------------------------------------------------- -struct jbig2enc_ctx { - // these are the current state of the arithmetic coder - uint32_t c; - uint16_t a; - uint8_t ct, b; - int bp; - - // This is a list of output chunks, not including the current one - std::vector *output_chunks; - uint8_t *outbuf; // this is the current output chunk - int outbuf_used; // number of bytes used in outbuf - uint8_t context[JBIG2_MAX_CTX]; // state machine context for encoding images - uint8_t intctx[13][512]; // 512 bytes of context indexes for each of 13 different int decodings - // this data is also used for refinement coding - uint8_t *iaidctx; // size of this context not known at construction time -}; - -// these are the proc numbers for encoding different classes of integers -enum { - JBIG2_IAAI = 0, - JBIG2_IADH, - JBIG2_IADS, - JBIG2_IADT, - JBIG2_IADW, - JBIG2_IAEX, - JBIG2_IAFS, - JBIG2_IAIT, - JBIG2_IARDH, - JBIG2_IARDW, - JBIG2_IARDX, - JBIG2_IARDY, - JBIG2_IARI -}; - -// ----------------------------------------------------------------------------- -// Returns the number of bytes of output in the given context -// -// Before doing this you should make sure that the coder is _flush()'ed -// ----------------------------------------------------------------------------- -unsigned jbig2enc_datasize(const struct jbig2enc_ctx *ctx); - -// ----------------------------------------------------------------------------- -// Writes the output of the given context to a buffer. The buffer must be at -// least long enough to contain all the data (see _datasize) -// ----------------------------------------------------------------------------- -void jbig2enc_tobuffer(const struct jbig2enc_ctx *__restrict__ ctx, - uint8_t *__restrict__ buffer); - -// ----------------------------------------------------------------------------- -// Encode an integer of a given class. proc is one of JBIG2_IA* and specifies -// the type of the number. IAID is special and is handled by another function. -// ----------------------------------------------------------------------------- -void jbig2enc_int(struct jbig2enc_ctx *__restrict__ ctx, int proc, int value); - - -// ----------------------------------------------------------------------------- -// Encode an IAID number. This needs to know how many bits to use. -// ----------------------------------------------------------------------------- -void jbig2enc_iaid(struct jbig2enc_ctx *__restrict__ ctx, int symcodelen, - int value); - -// ----------------------------------------------------------------------------- -// Encode the special out-of-bounds (-0) number for a given type. proc is one -// of JBIG2_IA* -// ----------------------------------------------------------------------------- -void jbig2enc_oob(struct jbig2enc_ctx *__restrict__ ctx, int proc); - -// ----------------------------------------------------------------------------- -// Encode a bitmap with the arithmetic encoder. -// data: an array of mx * my bytes -// mx: max x value -// my: max y value -// duplicate_line_removal: if true, TPGD is used -// -// TPGD often takes very slightly more bytes to encode, but cuts the time taken -// by half. -// ----------------------------------------------------------------------------- -void jbig2enc_image(struct jbig2enc_ctx *__restrict__ ctx, - const uint8_t *__restrict__ data, int mx, int my, - bool duplicate_line_removal); - -// ----------------------------------------------------------------------------- -// This function takes almost the same arguments as _image, above. But in this -// case the data pointer points to packed data. -// -// This is designed for Leptonica's 1bpp packed format images. Each row is some -// number of 32-bit words. -// -// *The pad bits at the end of each line must be zero.* -// ----------------------------------------------------------------------------- -void jbig2enc_bitimage(struct jbig2enc_ctx *__restrict__ ctx, - const uint8_t *__restrict__ data, int mx, int my, - bool duplicate_line_removal); - - -// ----------------------------------------------------------------------------- -// Encode the refinement of an exemplar to a bitmap. -// -// This encodes the difference between two images. If the template image is -// close to the final image the amount of data needed should hopefully be -// small. -// templ: the template image -// tx, ty: the size of the template image -// target: the desired image -// mx, my: the size of the desired image -// ox, oy: offset of the desired image from the template image. -// ox is limited to [-1, 0, 1] -// -// This uses Leptonica's 1bpp packed images (see comments above last function). -// -// *The pad bits at the end of each line, for both images, must be zero* -// ----------------------------------------------------------------------------- -void jbig2enc_refine(struct jbig2enc_ctx *__restrict__ ctx, - const uint8_t *__restrict__ templ, int tx, int ty, - const uint8_t *__restrict__ target, int mx, int my, - int ox, int oy); - -// ----------------------------------------------------------------------------- -// Init a new context -// ----------------------------------------------------------------------------- -void jbig2enc_init(struct jbig2enc_ctx *ctx); - -// ----------------------------------------------------------------------------- -// Destroy a context -// ----------------------------------------------------------------------------- -void jbig2enc_dealloc(struct jbig2enc_ctx *ctx); - -// ----------------------------------------------------------------------------- -// Flush all the data stored in a context -// ----------------------------------------------------------------------------- -void jbig2enc_flush(struct jbig2enc_ctx *ctx); - -// ----------------------------------------------------------------------------- -// Reset the arithmetic coder back to a init state -// ----------------------------------------------------------------------------- -void jbig2enc_reset(struct jbig2enc_ctx *ctx); - -// ----------------------------------------------------------------------------- -// Flush any remaining arithmetic encoder context to the output. -// ----------------------------------------------------------------------------- -void jbig2enc_final(struct jbig2enc_ctx *ctx); - -#endif // EXPERIMENTAL_USERS_AGL_JBIG2ENC_JBIG2ENC_H__ diff --git a/pdfpatcher/JBig2/include/jbig2enc.h b/pdfpatcher/JBig2/include/jbig2enc.h deleted file mode 100644 index 1c0bfff90508f96bfa471b92980d14e1c7d977ee..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2enc.h +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright 2006 Google Inc. All Rights Reserved. -// Author: agl@imperialviolet.org (Adam Langley) -// -// Copyright (C) 2006 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef JBIG2ENC_JBIG2_H__ -#define JBIG2ENC_JBIG2_H__ - -// ----------------------------------------------------------------------------- -// Welcome gentle reader, -// -// This is an encoder for JBIG2: -// www.jpeg.org/public/fcd14492.pdf -// -// JBIG2 encodes bi-level (1 bpp) images using a number of clever tricks to get -// better compression than G4. This encoder can: -// * Generate JBIG2 files, or fragments for embedding in PDFs -// * Generic region encoding -// * Symbol extraction, classification and text region coding -// -// It uses the (Apache-ish licensed) Leptonica library: -// http://www.leptonica.com/ -// ----------------------------------------------------------------------------- - -#if defined(sun) -#include -#else -#include -#endif - -struct Pix; -// This is the (opaque) structure which handles multi-page compression. -struct jbig2ctx; - -// ----------------------------------------------------------------------------- -// Multipage compression. -// -// First call jbig2_init to setup the structure. This structure must be free'ed -// by calling jbig2_destroy when you are finished. -// -// First, add all the pages with jbig2_add_page. This will collect all the -// information required. If refinement is on, it will also save all the -// component images, so this may take large amounts of memory. -// -// Then call jbig2_pages_complete. This returns a malloced buffer with the -// symbol table encoded. -// -// Then call jbig2_produce_page for each page. You must call it with pages -// numbered from zero, and for every page. -// ----------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------- -// Create a multi-page compression context structure -// -// thresh: The threshold for the classifier. The larger the number the larger -// the number of different symbols, the more bits used and the closer -// the resulting image is to the original. (0.85 is a good value) -// weight: Use 0.5 -// xres: the ppi in the X direction. If 0, the ppi is taken from bw -// yres: see xres -// full_headers: if true a full JBIG2 file is produced, otherwise the data is -// only good for embedding in PDFs -// refine: If < 0, disable refinement. Otherwise, the number of incorrect -// pixels which will be accepted per symbol. Enabling refinement -// increases memory use. -// ----------------------------------------------------------------------------- -struct jbig2ctx *jbig2_init(float thresh, float weight, int xres, int yres, - bool full_headers, int refine_level); - -// ----------------------------------------------------------------------------- -// Delete a context returned by jbig2_init -// ----------------------------------------------------------------------------- -void jbig2_destroy(struct jbig2ctx *); -// ----------------------------------------------------------------------------- -// Classify and record information about a page. -// -// bw: A 1-bpp image -// ----------------------------------------------------------------------------- -void jbig2_add_page(struct jbig2ctx *ctx, struct Pix *bw); -// ----------------------------------------------------------------------------- -// Finalise information about the document and encode the symbol table. -// -// WARNING: returns a malloced buffer which the caller must free -// ----------------------------------------------------------------------------- -uint8_t *jbig2_pages_complete(struct jbig2ctx *ctx, int *const length); -// ----------------------------------------------------------------------------- -// Encode a page. -// -// page_no: number of this page, indexed from 0. This *must* match the order of -// pages presented to jbig2_add_page. -// xres, yres: if -1, use values given in _init. Otherwise, set the resolution -// for this page only -// -// WARNING: returns a malloced buffer which the caller must free -// ----------------------------------------------------------------------------- -uint8_t *jbig2_produce_page(struct jbig2ctx *ctx, int page_no, int xres, - int yres, int *const length); - -// WARNING: returns a malloced buffer which the caller must free -// ----------------------------------------------------------------------------- - - -// ----------------------------------------------------------------------------- -// Single page compression -// ----------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------- -// Encode an image as a single generic region. This is lossless. It should not -// be used for images as half-tone coding is not implemented. -// -// see argument comments for jbig2_init -// duplicate_line_removal: turning this on -// * Breaks ghostscript -// * Takes ever so slightly more bytes to encode -// * Cuts the encode time by half -// -// WARNING: returns a malloced buffer which the caller must free -// ----------------------------------------------------------------------------- -uint8_t * -jbig2_encode_generic(struct Pix *const bw, const bool full_headers, - const int xres, const int yres, - const bool duplicate_line_removal, - int *const length); - -#endif // JBIG2ENC_JBIG2_H__ diff --git a/pdfpatcher/JBig2/include/jbig2enc.lossless.h b/pdfpatcher/JBig2/include/jbig2enc.lossless.h deleted file mode 100644 index 27f5adbb10c2f0b52252b0bf2d6db020914d96e2..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2enc.lossless.h +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2006 Google Inc. All Rights Reserved. -// Author: agl@imperialviolet.org (Adam Langley) -// -// Copyright (C) 2006 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef JBIG2ENC_JBIG2_H__ -#define JBIG2ENC_JBIG2_H__ - -// ----------------------------------------------------------------------------- -// Welcome gentle reader, -// -// This is an encoder for JBIG2: -// www.jpeg.org/public/fcd14492.pdf -// -// JBIG2 encodes bi-level (1 bpp) images using a number of clever tricks to get -// better compression than G4. This encoder can: -// * Generate JBIG2 files, or fragments for embedding in PDFs -// * Generic region encoding -// * Symbol extraction, classification and text region coding -// -// ----------------------------------------------------------------------------- - -#if defined(sun) -#include -#else -#include -#endif - -struct Pix; - -// ----------------------------------------------------------------------------- -// Single page compression -// ----------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------- -// Encode an image as a single generic region. This is lossless. It should not -// be used for images as half-tone coding is not implemented. -// -// see argument comments for jbig2_init -// xres: the ppi in the X direction. If 0, the ppi is taken from bw -// yres: see xres -// duplicate_line_removal: turning this on -// * Breaks ghostscript -// * Takes ever so slightly more bytes to encode -// * Cuts the encode time by half -// -// WARNING: returns a malloced buffer which the caller must free -// ----------------------------------------------------------------------------- -uint8_t * -jbig2_encode_generic(struct Pix *const bw, const bool full_headers, - const int xres, const int yres, - const bool duplicate_line_removal, - int *const length); - -// ----------------------------------------------------------------------------- -// Encode an image as a single generic region. This is lossless. It should not -// be used for images as half-tone coding is not implemented. -// -// full_headers: if true a full JBIG2 file is produced, otherwise the data is -// only good for embedding in PDFs -// source: pointer to the scan0 of the black and white Bitmap -// length: [out] the length of the output buffer -// WARNING: returns a malloced buffer which the caller must free -// ----------------------------------------------------------------------------- -uint8_t * -jbig2_encode (int width, int height, int stride, bool zeroIsWhite, uint8_t * const source, int *const length); - -// ----------------------------------------------------------------------------- -// Release the memory buffer returned from jbig2_encode_generic or jbig2_encode. -// This function is purely for interoperation outside of C/C++ world. -// ----------------------------------------------------------------------------- -void jbig2_freemem (uint8_t * const memblock); -#endif // JBIG2ENC_JBIG2_H__ diff --git a/pdfpatcher/JBig2/include/jbig2segments.h b/pdfpatcher/JBig2/include/jbig2segments.h deleted file mode 100644 index a58a46802f5fef28d18a85ab619fefc8252586c9..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2segments.h +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2006 Google Inc. All Rights Reserved. -// Author: agl@imperialviolet.org (Adam Langley) -// -// Copyright (C) 2006 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef THIRD_PARTY_JBIG2ENC_JBIG2SEGMENTS_H__ -#define THIRD_PARTY_JBIG2ENC_JBIG2SEGMENTS_H__ - -#include -#ifdef WIN32 -#include -#else -#include -#endif - -// ----------------------------------------------------------------------------- -// See comments in jbig2structs.h about the bit packing in this structure. -// ----------------------------------------------------------------------------- -#if defined(WIN32) -#pragma pack(1) -#endif -struct jbig2_segment { - u32 number; -#ifndef _BIG_ENDIAN - unsigned char type : 6; - unsigned char page_assoc_size : 1; - unsigned char deferred_non_retain : 1; -#else - unsigned char deferred_non_retain : 1; - unsigned char page_assoc_size : 1; - unsigned char type : 6; -#endif - -#ifndef _BIG_ENDIAN - unsigned char retain_bits : 5; - unsigned char segment_count : 3; -#else - unsigned char segment_count : 3; - unsigned char retain_bits : 5; -#endif -} -#if defined(WIN32) -; -#pragma pack() -#else -__attribute__((packed)); -#endif -; - -// ----------------------------------------------------------------------------- -// This structure represents a JBIG2 segment header because they have too many -// variable length fields (number of referred to segments, page length etc). -// You should access and set the members directly. Endian swapping is carried -// out internally. -// ----------------------------------------------------------------------------- -struct Segment { - unsigned number; // segment number - int type; // segment type (see enum in jbig2structs.h) - int deferred_non_retain; // see JBIG2 spec - int retain_bits; - std::vector referred_to; // list of segment numbers referred to - unsigned page; // page number - unsigned len; // length of trailing data - - Segment() - : number(0), - type(0), - deferred_non_retain(0), - retain_bits(0), - page(0), - len(0) {} - - // --------------------------------------------------------------------------- - // Return the size of the segment reference for this segment. Segments can - // only refer to previous segments, so the bits needed is determined by the - // number of this segment. (7.2.5) - // --------------------------------------------------------------------------- - unsigned reference_size() const { - int refsize; - if (number <= 256) { - refsize = 1; - } else if (number <= 65536) { - refsize = 2; - } else { - refsize = 4; - } - - return refsize; - } - - // --------------------------------------------------------------------------- - // Return the size of the segment page association field for this segment. - // (7.2.6) - // --------------------------------------------------------------------------- - unsigned page_size() const { - return page <= 255 ? 1 : 4; - } - - // --------------------------------------------------------------------------- - // Return the number of bytes that this segment header will take up - // --------------------------------------------------------------------------- - unsigned size() const { - const int refsize = reference_size(); - const int pagesize = page_size(); - - return sizeof(struct jbig2_segment) + refsize * referred_to.size() + - pagesize + sizeof(u32); - } - - // --------------------------------------------------------------------------- - // Serialise this segment header into the memory pointed to by buf, which - // must be at least long enough to contain it (e.g. size() bytes) - // --------------------------------------------------------------------------- - void write(u8 *buf) { - struct jbig2_segment s; - memset(&s, 0, sizeof(s)); -#define F(x) s.x = x; - s.number = htonl(number); - s.type = type; - s.deferred_non_retain = deferred_non_retain; - s.retain_bits = retain_bits; -#undef F - s.segment_count = referred_to.size(); - - const int pagesize = page_size(); - const int refsize = reference_size(); - if (pagesize == 4) s.page_assoc_size = 1; - - unsigned j = 0; - - memcpy(buf, &s, sizeof(s)); - j += sizeof(s); -#define APPEND(type, val) type __i; __i = val; \ - memcpy(&buf[j], &__i, sizeof(type)); \ - j += sizeof(type) - - for (std::vector::const_iterator i = referred_to.begin(); - i != referred_to.end(); ++i) { - if (refsize == 4) { - APPEND(u32, htonl(*i)); - } else if (refsize == 2) { - APPEND(u16, htons(*i)); - } else { - APPEND(u8, *i); - } - } - - if (pagesize == 4) { - APPEND(u32, htonl(page)); - } else { - APPEND(u8, page); - } - - APPEND(u32, htonl(len)); - - if (j != size()) abort(); - } -}; - -#endif // THIRD_PARTY_JBIG2ENC_JBIG2SEGMENTS_H__ diff --git a/pdfpatcher/JBig2/include/jbig2structs.h b/pdfpatcher/JBig2/include/jbig2structs.h deleted file mode 100644 index ffedb5307933929774bc0bef78201b3a24bacbbe..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2structs.h +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright 2006 Google Inc. All Rights Reserved. -// Author: agl@imperialviolet.org (Adam Langley) -// -// Copyright (C) 2006 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef JBIG2ENC_JBIG2STRUCTS_H__ -#define JBIG2ENC_JBIG2STRUCTS_H__ - -// GCC packs bit fields in a different order on big endian machines - -enum { - segment_symbol_table = 0, - segment_imm_generic_region = 38, - segment_page_information = 48, - segment_imm_text_region = 6, - segment_end_of_page = 49, - segment_end_of_file = 51 -}; - -// note that the < 1 byte fields are packed from the LSB upwards - unless -// you're bigendian, in which case they are packed MSB downwards. Joy. - -#define JBIG2_FILE_MAGIC "\x97\x4a\x42\x32\x0d\x0a\x1a\x0a" - -#if defined(WIN32) -#pragma pack(1) -#define PACKED -#else -#define PACKED __attribute__((packed)) -#endif - -struct jbig2_file_header { - u8 id[8]; -#ifndef _BIG_ENDIAN - u8 organisation_type : 1; - u8 unknown_n_pages : 1; - u8 reserved : 6; -#else - u8 reserved : 6; - u8 unknown_n_pages : 1; - u8 organisation_type : 1; -#endif - u32 n_pages; -} PACKED; - -struct jbig2_page_info { - u32 width; - u32 height; - u32 xres; - u32 yres; -#ifndef _BIG_ENDIAN - u8 is_lossless : 1; - u8 contains_refinements : 1; - u8 default_pixel : 1; - u8 default_operator : 2; - u8 aux_buffers : 1; - u8 operator_override : 1; - u8 reserved : 1; -#else - u8 reserved : 1; - u8 operator_override : 1; - u8 aux_buffers : 1; - u8 default_operator : 2; - u8 default_pixel : 1; - u8 contains_refinements : 1; - u8 is_lossless : 1; -#endif - u16 segment_flags; -} PACKED; - -struct jbig2_generic_region { - u32 width; - u32 height; - u32 x; - u32 y; - u8 comb_operator; - -#ifndef _BIG_ENDIAN - u8 mmr : 1; - u8 gbtemplate : 2; - u8 tpgdon : 1; - u8 reserved : 4; -#else - u8 reserved : 4; - u8 tpgdon : 1; - u8 gbtemplate : 2; - u8 mmr : 1; -#endif - - // generic region segment here. You may not need to write all 8 bytes here. - // If the template is 1..3 only the first two are needed. - signed char a1x, a1y, a2x, a2y, a3x, a3y, a4x, a4y; -} PACKED ; - -struct jbig2_symbol_dict { -#ifndef _BIG_ENDIAN - u8 sdhuff:1; - u8 sdrefagg:1; - u8 sdhuffdh:2; - u8 sdhuffdw:2; - u8 sdhuffbmsize:1; - u8 sdhuffagginst:1; - u8 bmcontext:1; - u8 bmcontextretained:1; - u8 sdtemplate:2; - u8 sdrtemplate:1; - u8 reserved:3; -#else - u8 reserved:3; - u8 sdrtemplate:1; - u8 sdtemplate:2; - u8 bmcontextretained:1; - u8 bmcontext:1; - u8 sdhuffagginst:1; - u8 sdhuffbmsize:1; - u8 sdhuffdw:2; - u8 sdhuffdh:2; - u8 sdrefagg:1; - u8 sdhuff:1; -#endif - - signed char a1x, a1y, a2x, a2y, a3x, a3y, a4x, a4y; - - // refinement AT flags omitted - - u32 exsyms; - u32 newsyms; -} PACKED; - -struct jbig2_text_region { - u32 width; - u32 height; - u32 x; - u32 y; - u8 comb_operator; - -#ifndef _BIG_ENDIAN - u8 sbcombop2:1; - u8 sbdefpixel:1; - u8 sbdsoffset:5; - u8 sbrtemplate:1; - u8 sbhuff:1; - u8 sbrefine:1; - u8 logsbstrips:2; - u8 refcorner:2; - u8 transposed:1; - u8 sbcombop1:1; -#else - u8 sbcombop1:1; - u8 transposed:1; - u8 refcorner:2; - u8 logsbstrips:2; - u8 sbrefine:1; - u8 sbhuff:1; - u8 sbrtemplate:1; - u8 sbdsoffset:5; - u8 sbdefpixel:1; - u8 sbcombop2:1; -#endif - - // huffman flags omitted -} PACKED; - - -struct jbig2_text_region_atflags { - signed char a1x, a1y, a2x, a2y; -} PACKED; - -struct jbig2_text_region_syminsts { - u32 sbnuminstances; - // huffman decoding table omitted -} PACKED; - -#if defined(WIN32) -#pragma pack() -#endif - -#endif // JBIG2ENC_JBIG2STRUCTS_H__ diff --git a/pdfpatcher/JBig2/include/jbig2sym.h b/pdfpatcher/JBig2/include/jbig2sym.h deleted file mode 100644 index 72ef644998f9982f5364c75cf5745814f2e1bf3a..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/jbig2sym.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2006 Google Inc. All Rights Reserved. -// Author: agl@imperialviolet.org (Adam Langley) -// -// Copyright (C) 2006 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef JBIG2ENC_JBIG2SYM_H__ -#define JBIG2ENC_JBIG2SYM_H__ - -struct jbig2enc_ctx; - -// ----------------------------------------------------------------------------- -// Write a symbol table. -// -// symbols: A 2d array. The first dimention is of different classes of symbols. -// Then, for each class, there are all the examples of that class. The -// first member of the class is taken as the exemplar. -// symbol_list: a list of symbols to encode -// symmap: an empty map which is filled. The symbols are written to the file in -// a different order than they are given in symbols. The maps an index -// into the symbols array to a symbol number in the file -// unborder_symbols: if true, remove a border from every element of symbols -// ----------------------------------------------------------------------------- -void jbig2enc_symboltable(struct jbig2enc_ctx *__restrict__ ctx, - PIXA *__restrict__ const symbols, - std::vector *__restrict__ symbol_list, - std::map *symmap, - bool unborder_symbols); - -// ----------------------------------------------------------------------------- -// Write a text region. -// -// A text region is a list of placements of symbols. The symbols must already -// have been coded. -// -// symmap: This maps class numbers to symbol numbers. Only symbol numbers -// appear in the JBIG2 data stream -// symmap2: If not found in the first symmap, try this one -// comps: a list of connected-component numbers for this page -// ll: This is an array of the lower-left corners of the boxes for each symbol -// assignments: an array, of the same length as boxes, mapping each box to a -// symbol -// stripwidth: 1 is a safe default (one of [1, 2, 4, 8]) -// symbits: number of bits needed to code the symbol number (log2(number of -// symbols) - rounded up) -// source: an array of the original images for all the connected components. -// If NULL, refinement is disabled. (page indexed) -// boxes: if source is non-NULL, this is page based list of boxes of symbols on -// the page -// baseindex: if source is non-NULL, this is the component number of the first -// component on this page -// refine_level: the number of incorrect pixels allowed before refining. -// unborder_symbols: if true, symbols have a 6px border around them -// ----------------------------------------------------------------------------- -void jbig2enc_textregion(struct jbig2enc_ctx *__restrict__ ctx, - /*const*/ std::map &symmap, - /*const*/ std::map &symmap2, - const std::vector &comps, - PTA *const ll, PIXA *const symbols, - NUMA *assignments, - int stripwidth, int symbits, - PIXA *const source, BOXA *boxes, int baseindex, - int refine_level, bool unborder_symbols); - -#endif // JBIG2ENC_JBIG2SYM_H__ diff --git a/pdfpatcher/JBig2/include/memento.h b/pdfpatcher/JBig2/include/memento.h deleted file mode 100644 index ca28b55b7904a1af39cb0f274c7f36f84eb9764a..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/memento.h +++ /dev/null @@ -1,331 +0,0 @@ -/* Copyright (C) 2009-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, modified - or distributed except as expressly authorized under the terms of that - license. Refer to licensing information at http://www.artifex.com - or contact Artifex Software, Inc., 1305 Grant Avenue - Suite 200, - Novato, CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* Memento: A library to aid debugging of memory leaks/heap corruption. - * - * Usage (with C): - * First, build your project with MEMENTO defined, and include this - * header file wherever you use malloc, realloc or free. - * This header file will use macros to point malloc, realloc and free to - * point to Memento_malloc, Memento_realloc, Memento_free. - * - * Run your program, and all mallocs/frees/reallocs should be redirected - * through here. When the program exits, you will get a list of all the - * leaked blocks, together with some helpful statistics. You can get the - * same list of allocated blocks at any point during program execution by - * calling Memento_listBlocks(); - * - * Every call to malloc/free/realloc counts as an 'allocation event'. - * On each event Memento increments a counter. Every block is tagged with - * the current counter on allocation. Every so often during program - * execution, the heap is checked for consistency. By default this happens - * after 1024 events, then after 2048 events, then after 4096 events, etc. - * This can be changed at runtime by using Memento_setParanoia(int level). - * 0 turns off such checking, 1 sets checking to happen on every event, - * any positive number n sets checking to happen once every n events, - * and any negative number n sets checking to happen after -n events, then - * after -2n events etc. - * - * The default paranoia level is therefore -1024. - * - * Memento keeps blocks around for a while after they have been freed, and - * checks them as part of these heap checks to see if they have been - * written to (or are freed twice etc). - * - * A given heap block can be checked for consistency (it's 'pre' and - * 'post' guard blocks are checked to see if they have been written to) - * by calling Memento_checkBlock(void *blockAddress); - * - * A check of all the memory can be triggered by calling Memento_check(); - * (or Memento_checkAllMemory(); if you'd like it to be quieter). - * - * A good place to breakpoint is Memento_breakpoint, as this will then - * trigger your debugger if an error is detected. This is done - * automatically for debug windows builds. - * - * If a block is found to be corrupt, information will be printed to the - * console, including the address of the block, the size of the block, - * the type of corruption, the number of the block and the event on which - * it last passed a check for correctness. - * - * If you rerun, and call Memento_paranoidAt(int event); with this number - * the code will wait until it reaches that event and then start - * checking the heap after every allocation event. Assuming it is a - * deterministic failure, you should then find out where in your program - * the error is occurring (between event x-1 and event x). - * - * Then you can rerun the program again, and call - * Memento_breakAt(int event); and the program will call - * Memento_Breakpoint() when event x is reached, enabling you to step - * through. - * - * Memento_find(address) will tell you what block (if any) the given - * address is in. - * - * An example: - * Suppose we have a gs invocation that crashes with memory corruption. - * * Build with -DMEMENTO. - * * In your debugger put a breakpoint on Memento_breakpoint. - * * Run the program. It will stop in Memento_inited. - * * Execute Memento_setParanoia(1); (In VS use Ctrl-Alt-Q). (Note #1) - * * Continue execution. - * * It will detect the memory corruption on the next allocation event - * after it happens, and stop in Memento_breakpoint. The console should - * show something like: - * - * Freed blocks: - * 0x172e610(size=288,num=1415) index 256 (0x172e710) onwards corrupted - * Block last checked OK at allocation 1457. Now 1458. - * - * * This means that the block became corrupted between allocation 1457 - * and 1458 - so if we rerun and stop the program at 1457, we can then - * step through, possibly with a data breakpoint at 0x172e710 and see - * when it occurs. - * * So restart the program from the beginning. When we stop after - * initialisation execute Memento_breakAt(1457); (and maybe - * Memento_setParanoia(1), or Memento_setParanoidAt(1457)) - * * Continue execution until we hit Memento_breakpoint. - * * Now you can step through and watch the memory corruption happen. - * - * Note #1: Using Memento_setParanoia(1) can cause your program to run - * very slowly. You may instead choose to use Memento_setParanoia(100) - * (or some other figure). This will only exhaustively check memory on - * every 100th allocation event. This trades speed for the size of the - * average allocation event range in which detection of memory corruption - * occurs. You may (for example) choose to run once checking every 100 - * allocations and discover that the corruption happens between events - * X and X+100. You can then rerun using Memento_paranoidAt(X), and - * it'll only start exhaustively checking when it reaches X. - * - * More than one memory allocator? - * - * If you have more than one memory allocator in the system (like for - * instance the ghostscript chunk allocator, that builds on top of the - * standard malloc and returns chunks itself), then there are some things - * to note: - * - * * If the secondary allocator gets its underlying blocks from calling - * malloc, then those will be checked by Memento, but 'subblocks' that - * are returned to the secondary allocator will not. There is currently - * no way to fix this other than trying to bypass the secondary - * allocator. One way I have found to do this with the chunk allocator - * is to tweak its idea of a 'large block' so that it puts every - * allocation in its own chunk. Clearly this negates the point of having - * a secondary allocator, and is therefore not recommended for general - * use. - * - * * Again, if the secondary allocator gets its underlying blocks from - * calling malloc (and hence Memento) leak detection should still work - * (but whole blocks will be detected rather than subblocks). - * - * * If on every allocation attempt the secondary allocator calls into - * Memento_failThisEvent(), and fails the allocation if it returns true - * then more useful features can be used; firstly memory squeezing will - * work, and secondly, Memento will have a "finer grained" paranoia - * available to it. - * - * Usage with C++: - * - * Memento has some experimental code in it to trap new/delete (and - * new[]/delete[] if required) calls. - * - * In order for this to work, either: - * - * 1) Build memento.c with the c++ compiler. - * - * or - * - * 2) Build memento.c as normal with the C compiler, then from any - * one of your .cpp files, do: - * - * #define MEMENTO_CPP_EXTRAS_ONLY - * #include "memento.c" - * - * In the case where MEMENTO is not defined, this will not do anything. - * - * Both Windows and GCC provide separate new[] and delete[] operators - * for arrays. Apparently some systems do not. If this is the case for - * your system, define MEMENTO_CPP_NO_ARRAY_CONSTRUCTORS. - * - * "libbacktrace.so failed to load" - * - * In order to give nice backtraces on unix, Memento will try to use - * a libbacktrace dynamic library. If it can't find it, you'll see - * that warning, and your backtraces won't include file/line information. - * - * To fix this you'll need to build your own libbacktrace. Don't worry - * it's really easy: - * git clone git://github.com/ianlancetaylor/libbacktrace - * cd libbacktrace - * ./configure - * make - * - * This leaves the build .so as .libs/libbacktrace.so - * - * Memento will look for this on LD_LIBRARY_PATH, or in /opt/lib/, - * or in /lib/, or in /usr/lib/, or in /usr/local/lib/. I recommend - * using /opt/lib/ as this won't conflict with anything that you - * get via a package manager like apt. - * - * sudo mkdir /opt - * sudo mkdir /opt/lib - * sudo cp .libs/libbacktrace.so /opt/lib/ - */ - -#ifndef MEMENTO_H - -#include - -#define MEMENTO_H - -#ifndef MEMENTO_UNDERLYING_MALLOC -#define MEMENTO_UNDERLYING_MALLOC malloc -#endif -#ifndef MEMENTO_UNDERLYING_FREE -#define MEMENTO_UNDERLYING_FREE free -#endif -#ifndef MEMENTO_UNDERLYING_REALLOC -#define MEMENTO_UNDERLYING_REALLOC realloc -#endif -#ifndef MEMENTO_UNDERLYING_CALLOC -#define MEMENTO_UNDERLYING_CALLOC calloc -#endif - -#ifndef MEMENTO_MAXALIGN -#define MEMENTO_MAXALIGN (sizeof(int)) -#endif - -#define MEMENTO_PREFILL 0xa6 -#define MEMENTO_POSTFILL 0xa7 -#define MEMENTO_ALLOCFILL 0xa8 -#define MEMENTO_FREEFILL 0xa9 - -#define MEMENTO_FREELIST_MAX 0x2000000 - -int Memento_checkBlock(void *); -int Memento_checkAllMemory(void); -int Memento_check(void); - -int Memento_setParanoia(int); -int Memento_paranoidAt(int); -int Memento_breakAt(int); -void Memento_breakOnFree(void *a); -void Memento_breakOnRealloc(void *a); -int Memento_getBlockNum(void *); -int Memento_find(void *a); -void Memento_breakpoint(void); -int Memento_failAt(int); -int Memento_failThisEvent(void); -void Memento_listBlocks(void); -void Memento_listNewBlocks(void); -size_t Memento_setMax(size_t); -void Memento_stats(void); -void *Memento_label(void *, const char *); -void Memento_tick(void); - -void *Memento_malloc(size_t s); -void *Memento_realloc(void *, size_t s); -void Memento_free(void *); -void *Memento_calloc(size_t, size_t); - -void Memento_info(void *addr); -void Memento_listBlockInfo(void); -void *Memento_takeByteRef(void *blk); -void *Memento_dropByteRef(void *blk); -void *Memento_takeShortRef(void *blk); -void *Memento_dropShortRef(void *blk); -void *Memento_takeIntRef(void *blk); -void *Memento_dropIntRef(void *blk); -void *Memento_takeRef(void *blk); -void *Memento_dropRef(void *blk); -void *Memento_adjustRef(void *blk, int adjust); -void *Memento_reference(void *blk); - -int Memento_checkPointerOrNull(void *blk); -int Memento_checkBytePointerOrNull(void *blk); -int Memento_checkShortPointerOrNull(void *blk); -int Memento_checkIntPointerOrNull(void *blk); - -void Memento_startLeaking(void); -void Memento_stopLeaking(void); - -int Memento_sequence(void); - -int Memento_squeezing(void); - -void Memento_fin(void); - -void Memento_bt(void); - -#ifdef MEMENTO - -#ifndef COMPILING_MEMENTO_C -#define malloc Memento_malloc -#define free Memento_free -#define realloc Memento_realloc -#define calloc Memento_calloc -#endif - -#else - -#define Memento_malloc MEMENTO_UNDERLYING_MALLOC -#define Memento_free MEMENTO_UNDERLYING_FREE -#define Memento_realloc MEMENTO_UNDERLYING_REALLOC -#define Memento_calloc MEMENTO_UNDERLYING_CALLOC - -#define Memento_checkBlock(A) 0 -#define Memento_checkAllMemory() 0 -#define Memento_check() 0 -#define Memento_setParanoia(A) 0 -#define Memento_paranoidAt(A) 0 -#define Memento_breakAt(A) 0 -#define Memento_breakOnFree(A) 0 -#define Memento_breakOnRealloc(A) 0 -#define Memento_getBlockNum(A) 0 -#define Memento_find(A) 0 -#define Memento_breakpoint() do {} while (0) -#define Memento_failAt(A) 0 -#define Memento_failThisEvent() 0 -#define Memento_listBlocks() do {} while (0) -#define Memento_listNewBlocks() do {} while (0) -#define Memento_setMax(A) 0 -#define Memento_stats() do {} while (0) -#define Memento_label(A,B) (A) -#define Memento_info(A) do {} while (0) -#define Memento_listBlockInfo() do {} while (0) -#define Memento_takeByteRef(A) (A) -#define Memento_dropByteRef(A) (A) -#define Memento_takeShortRef(A) (A) -#define Memento_dropShortRef(A) (A) -#define Memento_takeIntRef(A) (A) -#define Memento_dropIntRef(A) (A) -#define Memento_takeRef(A) (A) -#define Memento_dropRef(A) (A) -#define Memento_adjustRef(A,V) (A) -#define Memento_reference(A) (A) -#define Memento_checkPointerOrNull(A) 0 -#define Memento_checkBytePointerOrNull(A) 0 -#define Memento_checkShortPointerOrNull(A) 0 -#define Memento_checkIntPointerOrNull(A) 0 - -#define Memento_tick() do {} while (0) -#define Memento_startLeaking() do {} while (0) -#define Memento_stopLeaking() do {} while (0) -#define Memento_fin() do {} while (0) -#define Memento_bt() do {} while (0) -#define Memento_sequence() (0) -#define Memento_squeezing() (0) - -#endif /* MEMENTO */ - -#endif /* MEMENTO_H */ diff --git a/pdfpatcher/JBig2/include/os_types.h b/pdfpatcher/JBig2/include/os_types.h deleted file mode 100644 index e6270d30c0b66674cbb755de4ec388604cf7906f..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/os_types.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -/* - indirection layer for build and platform-specific definitions - - in general, this header should ensure that the stdint types are - available, and that any optional compile flags are defined if - the build system doesn't pass them directly. -*/ - -#ifndef _JBIG2_OS_TYPES_H -#define _JBIG2_OS_TYPES_H - -#if defined(HAVE_CONFIG_H) -# include "config_types.h" -#elif defined(_WIN32) -# include "config_win32.h" -#elif defined (STD_INT_USE_SYS_TYPES_H) -# include -#elif defined (STD_INT_USE_INTTYPES_H) -# include -#elif defined (STD_INT_USE_SYS_INTTYPES_H) -# include -#elif defined (STD_INT_USE_SYS_INT_TYPES_H) -# include -#else -# include -#endif - -#endif /* _JBIG2_OS_TYPES_H */ diff --git a/pdfpatcher/JBig2/include/pix.h b/pdfpatcher/JBig2/include/pix.h deleted file mode 100644 index 61ba4cc049837468f12a69cd49c6b23b0a450ee9..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/pix.h +++ /dev/null @@ -1,12 +0,0 @@ -#include -struct Pix -{ - uint32_t w; /* width in pixels */ - uint32_t h; /* height in pixels */ - int32_t xres; /* image res (ppi) in x direction */ - /* (use 0 if unknown) */ - int32_t yres; /* image res (ppi) in y direction */ - /* (use 0 if unknown) */ - uint32_t *data; /* the image data */ -}; -typedef struct Pix PIX; \ No newline at end of file diff --git a/pdfpatcher/JBig2/include/sha1.h b/pdfpatcher/JBig2/include/sha1.h deleted file mode 100644 index afeeb42ccd8aa1ada74f8ddabf9cbb213c3a4f99..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/sha1.h +++ /dev/null @@ -1,28 +0,0 @@ -/* public api for steve reid's public domain SHA-1 implementation */ -/* this file is in the public domain */ - -#ifndef __SHA1_H -#define __SHA1_H - -#ifdef __cplusplus -extern "C" -{ -#endif - -typedef struct { - uint32_t state[5]; - uint32_t count[2]; - uint8_t buffer[64]; -} SHA1_CTX; - -#define SHA1_DIGEST_SIZE 20 - -void SHA1_Init(SHA1_CTX *context); -void SHA1_Update(SHA1_CTX *context, const uint8_t *data, const size_t len); -void SHA1_Final(SHA1_CTX *context, uint8_t digest[SHA1_DIGEST_SIZE]); - -#ifdef __cplusplus -} -#endif - -#endif /* __SHA1_H */ diff --git a/pdfpatcher/JBig2/include/stdint.h b/pdfpatcher/JBig2/include/stdint.h deleted file mode 100644 index 7e200dc6fc6938fd3caf2073850056f0a739b882..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/stdint.h +++ /dev/null @@ -1,222 +0,0 @@ -// ISO C9x compliant stdint.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. The name of the author may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MSC_VER // [ -#error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] - -#ifndef _MSC_STDINT_H_ // [ -#define _MSC_STDINT_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#include - -// For Visual Studio 6 in C++ mode wrap include with 'extern "C++" {}' -// or compiler give many errors like this: -// error C2733: second C linkage of overloaded function 'wmemchr' not allowed -#if (_MSC_VER < 1300) && defined(__cplusplus) - extern "C++" { -#endif -# include -#if (_MSC_VER < 1300) && defined(__cplusplus) - } -#endif - -// 7.18.1 Integer types - -// 7.18.1.1 Exact-width integer types -typedef __int8 int8_t; -typedef __int16 int16_t; -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned __int8 uint8_t; -typedef unsigned __int16 uint16_t; -typedef unsigned __int32 uint32_t; -typedef unsigned __int64 uint64_t; - -// 7.18.1.2 Minimum-width integer types -typedef int8_t int_least8_t; -typedef int16_t int_least16_t; -typedef int32_t int_least32_t; -typedef int64_t int_least64_t; -typedef uint8_t uint_least8_t; -typedef uint16_t uint_least16_t; -typedef uint32_t uint_least32_t; -typedef uint64_t uint_least64_t; - -// 7.18.1.3 Fastest minimum-width integer types -typedef int8_t int_fast8_t; -typedef int16_t int_fast16_t; -typedef int32_t int_fast32_t; -typedef int64_t int_fast64_t; -typedef uint8_t uint_fast8_t; -typedef uint16_t uint_fast16_t; -typedef uint32_t uint_fast32_t; -typedef uint64_t uint_fast64_t; - -// 7.18.1.4 Integer types capable of holding object pointers -#ifdef _WIN64 // [ - typedef __int64 intptr_t; - typedef unsigned __int64 uintptr_t; -#else // _WIN64 ][ - typedef int intptr_t; - typedef unsigned int uintptr_t; -#endif // _WIN64 ] - -// 7.18.1.5 Greatest-width integer types -typedef int64_t intmax_t; -typedef uint64_t uintmax_t; - - -// 7.18.2 Limits of specified-width integer types - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 - -// 7.18.2.1 Limits of exact-width integer types -#define INT8_MIN ((int8_t)_I8_MIN) -#define INT8_MAX _I8_MAX -#define INT16_MIN ((int16_t)_I16_MIN) -#define INT16_MAX _I16_MAX -#define INT32_MIN ((int32_t)_I32_MIN) -#define INT32_MAX _I32_MAX -#define INT64_MIN ((int64_t)_I64_MIN) -#define INT64_MAX _I64_MAX -#define UINT8_MAX _UI8_MAX -#define UINT16_MAX _UI16_MAX -#define UINT32_MAX _UI32_MAX -#define UINT64_MAX _UI64_MAX - -// 7.18.2.2 Limits of minimum-width integer types -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MIN INT64_MIN -#define INT_LEAST64_MAX INT64_MAX -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -// 7.18.2.3 Limits of fastest minimum-width integer types -#define INT_FAST8_MIN INT8_MIN -#define INT_FAST8_MAX INT8_MAX -#define INT_FAST16_MIN INT16_MIN -#define INT_FAST16_MAX INT16_MAX -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MIN INT64_MIN -#define INT_FAST64_MAX INT64_MAX -#define UINT_FAST8_MAX UINT8_MAX -#define UINT_FAST16_MAX UINT16_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -// 7.18.2.4 Limits of integer types capable of holding object pointers -#ifdef _WIN64 // [ -# define INTPTR_MIN INT64_MIN -# define INTPTR_MAX INT64_MAX -# define UINTPTR_MAX UINT64_MAX -#else // _WIN64 ][ -# define INTPTR_MIN INT32_MIN -# define INTPTR_MAX INT32_MAX -# define UINTPTR_MAX UINT32_MAX -#endif // _WIN64 ] - -// 7.18.2.5 Limits of greatest-width integer types -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -// 7.18.3 Limits of other integer types - -#ifdef _WIN64 // [ -# define PTRDIFF_MIN _I64_MIN -# define PTRDIFF_MAX _I64_MAX -#else // _WIN64 ][ -# define PTRDIFF_MIN _I32_MIN -# define PTRDIFF_MAX _I32_MAX -#endif // _WIN64 ] - -#define SIG_ATOMIC_MIN INT_MIN -#define SIG_ATOMIC_MAX INT_MAX - -#ifndef SIZE_MAX // [ -# ifdef _WIN64 // [ -# define SIZE_MAX _UI64_MAX -# else // _WIN64 ][ -# define SIZE_MAX _UI32_MAX -# endif // _WIN64 ] -#endif // SIZE_MAX ] - -// WCHAR_MIN and WCHAR_MAX are also defined in -#ifndef WCHAR_MIN // [ -# define WCHAR_MIN 0 -#endif // WCHAR_MIN ] -#ifndef WCHAR_MAX // [ -# define WCHAR_MAX _UI16_MAX -#endif // WCHAR_MAX ] - -#define WINT_MIN 0 -#define WINT_MAX _UI16_MAX - -#endif // __STDC_LIMIT_MACROS ] - - -// 7.18.4 Limits of other integer types - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 - -// 7.18.4.1 Macros for minimum-width integer constants - -#define INT8_C(val) val##i8 -#define INT16_C(val) val##i16 -#define INT32_C(val) val##i32 -#define INT64_C(val) val##i64 - -#define UINT8_C(val) val##ui8 -#define UINT16_C(val) val##ui16 -#define UINT32_C(val) val##ui32 -#define UINT64_C(val) val##ui64 - -// 7.18.4.2 Macros for greatest-width integer constants -#define INTMAX_C INT64_C -#define UINTMAX_C UINT64_C - -#endif // __STDC_CONSTANT_MACROS ] - - -#endif // _MSC_STDINT_H_ ] diff --git a/pdfpatcher/JBig2/include/unistd.h b/pdfpatcher/JBig2/include/unistd.h deleted file mode 100644 index 200991077e1b6c35ee51f7ab4a6984ae7a7cfd4c..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/include/unistd.h +++ /dev/null @@ -1,11 +0,0 @@ -/** This file is part of the Mingw32 package. - * unistd.h maps (roughly) to io.h - */ - -#ifndef _UNISTD_H -#define _UNISTD_H - -#include -#include - -#endif /* _UNISTD_H */ \ No newline at end of file diff --git a/pdfpatcher/JBig2/jbig2.def b/pdfpatcher/JBig2/jbig2.def deleted file mode 100644 index 5a0ec329916edec9403d324d1760daedafbaf0ed..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/jbig2.def +++ /dev/null @@ -1,24 +0,0 @@ -LIBRARY JBig2Dec -EXPORTS - -; jBig2Enc - -; jbig2_init -; jbig2_destroy -; jbig2_add_page -; jbig2_pages_complete -; jbig2_produce_page - jbig2_encode - jbig2_encode_generic - jbig2_freemem - -; jBig2Dec - - jbig2_ctx_new_imp - jbig2_data_in - jbig2_make_global_ctx - jbig2_complete_page - jbig2_global_ctx_free - jbig2_release_page - jbig2_ctx_free - jbig2_page_out diff --git a/pdfpatcher/JBig2/jbig2.vcxproj b/pdfpatcher/JBig2/jbig2.vcxproj deleted file mode 100644 index c61712f2a516b86e5e7381768dfe9182757467b7..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/jbig2.vcxproj +++ /dev/null @@ -1,203 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 16.0 - Win32Proj - {a8c76a16-25e3-45b6-b974-4f4cb88e5ae2} - jbig2 - 10.0 - - - - v142 - v143 - - - DynamicLibrary - true - Unicode - - - DynamicLibrary - false - true - Unicode - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(ProjectDir)include;$(IncludePath) - $(SolutionDir)bin\$(Configuration)\ - obj\$(Configuration)\ - - - false - $(ProjectDir)include;$(IncludePath) - $(SolutionDir)bin\$(Configuration)\ - obj\$(Configuration)\ - - - true - $(SolutionDir)bin\$(Platform)\$(Configuration)\ - - - false - $(SolutionDir)bin\$(Platform)\$(Configuration)\ - - - - Level3 - true - WIN32;__STDC_LIMIT_MACROS;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - -w44146 -w44244 %(AdditionalOptions) - - - Console - true - jbig2.def - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies) - - - - - Level3 - true - true - true - WIN32;__STDC_LIMIT_MACROS;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - -w44146 -w44244 %(AdditionalOptions) - - - Console - true - true - true - jbig2.def - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies) - - - - - Level3 - true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - - \ No newline at end of file diff --git a/pdfpatcher/JBig2/jbig2.vcxproj.filters b/pdfpatcher/JBig2/jbig2.vcxproj.filters deleted file mode 100644 index f9ee3b565b3ad01af4181e599fb3d7f15a2736d3..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/jbig2.vcxproj.filters +++ /dev/null @@ -1,147 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {a673f5df-1884-4ec9-bd85-f0a85eb846e0} - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Decoder Header Files - - - Decoder Header Files - - - Decoder Header Files - - - Decoder Header Files - - - Decoder Header Files - - - Decoder Header Files - - - Decoder Header Files - - - Decoder Header Files - - - Decoder Header Files - - - Decoder Header Files - - - Decoder Header Files - - - Decoder Header Files - - - Decoder Header Files - - - Decoder Header Files - - - Decoder Header Files - - - Decoder Header Files - - - Decoder Header Files - - - Decoder Header Files - - - Decoder Header Files - - - Encoder Header Files - - - Encoder Header Files - - - Encoder Header Files - - - Encoder Header Files - - - Encoder Header Files - - - \ No newline at end of file diff --git a/pdfpatcher/JBig2/src/jbig2.c b/pdfpatcher/JBig2/src/jbig2.c deleted file mode 100644 index 2942f0f19b371e14369ce3d516dd0ff1a997b21d..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2.c +++ /dev/null @@ -1,566 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "os_types.h" - -#include -#include -#include -#include -#include - -#include "jbig2.h" -#include "jbig2_priv.h" -#include "jbig2_image.h" -#include "jbig2_page.h" -#include "jbig2_segment.h" - -static void * -jbig2_default_alloc(Jbig2Allocator *allocator, size_t size) -{ - return malloc(size); -} - -static void -jbig2_default_free(Jbig2Allocator *allocator, void *p) -{ - free(p); -} - -static void * -jbig2_default_realloc(Jbig2Allocator *allocator, void *p, size_t size) -{ - return realloc(p, size); -} - -static Jbig2Allocator jbig2_default_allocator = { - jbig2_default_alloc, - jbig2_default_free, - jbig2_default_realloc -}; - -void * -jbig2_alloc(Jbig2Allocator *allocator, size_t size, size_t num) -{ - /* Check for integer multiplication overflow when computing - the full size of the allocation. */ - if (num > 0 && size > SIZE_MAX / num) - return NULL; - return allocator->alloc(allocator, size * num); -} - -/* jbig2_free and jbig2_realloc moved to the bottom of this file */ - -static void -jbig2_default_error(void *data, const char *msg, Jbig2Severity severity, uint32_t seg_idx) -{ - /* report only fatal errors by default */ - if (severity == JBIG2_SEVERITY_FATAL) { - fprintf(stderr, "jbig2 decoder FATAL ERROR: %s", msg); - if (seg_idx != JBIG2_UNKNOWN_SEGMENT_NUMBER) - fprintf(stderr, " (segment 0x%02x)", seg_idx); - fprintf(stderr, "\n"); - fflush(stderr); - } -} - -int -jbig2_error(Jbig2Ctx *ctx, Jbig2Severity severity, uint32_t segment_number, const char *fmt, ...) -{ - char buf[1024]; - va_list ap; - int n; - - va_start(ap, fmt); - n = vsnprintf(buf, sizeof(buf), fmt, ap); - va_end(ap); - if (n < 0 || n == sizeof(buf)) - strncpy(buf, "failed to generate error string", sizeof(buf)); - ctx->error_callback(ctx->error_callback_data, buf, severity, segment_number); - return -1; -} - -Jbig2Ctx * -jbig2_ctx_new_imp(Jbig2Allocator *allocator, Jbig2Options options, Jbig2GlobalCtx *global_ctx, Jbig2ErrorCallback error_callback, void *error_callback_data, int jbig2_version_major, int jbig2_version_minor) -{ - Jbig2Ctx *result; - - if (jbig2_version_major != JBIG2_VERSION_MAJOR || jbig2_version_minor != JBIG2_VERSION_MINOR) { - Jbig2Ctx fakectx; - fakectx.error_callback = error_callback; - fakectx.error_callback_data = error_callback_data; - jbig2_error(&fakectx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "incompatible jbig2dec header (%d.%d) and library (%d.%d) versions", - jbig2_version_major, jbig2_version_minor, JBIG2_VERSION_MAJOR, JBIG2_VERSION_MINOR); - return NULL; - } - - if (allocator == NULL) - allocator = &jbig2_default_allocator; - if (error_callback == NULL) - error_callback = &jbig2_default_error; - - result = (Jbig2Ctx *) jbig2_alloc(allocator, sizeof(Jbig2Ctx), 1); - if (result == NULL) { - error_callback(error_callback_data, "failed to allocate initial context", JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER); - return NULL; - } - - result->allocator = allocator; - result->options = options; - result->global_ctx = (const Jbig2Ctx *)global_ctx; - result->error_callback = error_callback; - result->error_callback_data = error_callback_data; - - result->state = (options & JBIG2_OPTIONS_EMBEDDED) ? JBIG2_FILE_SEQUENTIAL_HEADER : JBIG2_FILE_HEADER; - - result->buf = NULL; - - result->n_segments = 0; - result->n_segments_max = 16; - result->segments = jbig2_new(result, Jbig2Segment *, result->n_segments_max); - if (result->segments == NULL) { - error_callback(error_callback_data, "failed to allocate initial segments", JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER); - jbig2_free(allocator, result); - return NULL; - } - result->segment_index = 0; - - result->current_page = 0; - result->max_page_index = 4; - result->pages = jbig2_new(result, Jbig2Page, result->max_page_index); - if (result->pages == NULL) { - error_callback(error_callback_data, "failed to allocated initial pages", JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER); - jbig2_free(allocator, result->segments); - jbig2_free(allocator, result); - return NULL; - } - { - uint32_t index; - - for (index = 0; index < result->max_page_index; index++) { - result->pages[index].state = JBIG2_PAGE_FREE; - result->pages[index].number = 0; - result->pages[index].width = 0; - result->pages[index].height = 0xffffffff; - result->pages[index].x_resolution = 0; - result->pages[index].y_resolution = 0; - result->pages[index].stripe_size = 0; - result->pages[index].striped = 0; - result->pages[index].end_row = 0; - result->pages[index].flags = 0; - result->pages[index].image = NULL; - } - } - - return result; -} - -#define get_uint16(bptr)\ - (((bptr)[0] << 8) | (bptr)[1]) -#define get_int16(bptr)\ - (((int)get_uint16(bptr) ^ 0x8000) - 0x8000) - -/* coverity[ -tainted_data_return ] */ -/* coverity[ -tainted_data_argument : arg-0 ] */ -int16_t -jbig2_get_int16(const byte *bptr) -{ - return get_int16(bptr); -} - -/* coverity[ -tainted_data_return ] */ -/* coverity[ -tainted_data_argument : arg-0 ] */ -uint16_t -jbig2_get_uint16(const byte *bptr) -{ - return get_uint16(bptr); -} - -/* coverity[ -tainted_data_return ] */ -/* coverity[ -tainted_data_argument : arg-0 ] */ -int32_t -jbig2_get_int32(const byte *bptr) -{ - return ((int32_t) get_int16(bptr) << 16) | get_uint16(bptr + 2); -} - -/* coverity[ -tainted_data_return ] */ -/* coverity[ -tainted_data_argument : arg-0 ] */ -uint32_t -jbig2_get_uint32(const byte *bptr) -{ - return ((uint32_t) get_uint16(bptr) << 16) | get_uint16(bptr + 2); -} - -static size_t -jbig2_find_buffer_size(size_t desired) -{ - const size_t initial_buf_size = 1024; - size_t size = initial_buf_size; - - if (desired == SIZE_MAX) - return SIZE_MAX; - - while (size < desired) - size <<= 1; - - return size; -} - - -/** - * jbig2_data_in: submit data for decoding - * @ctx: The jbig2dec decoder context - * @data: a pointer to the data buffer - * @size: the size of the data buffer in bytes - * - * Copies the specified data into internal storage and attempts - * to (continue to) parse it as part of a jbig2 data stream. - * - * Return code: 0 on success - * -1 if there is a parsing error - **/ -int -jbig2_data_in(Jbig2Ctx *ctx, const unsigned char *data, size_t size) -{ - if (ctx->buf == NULL) { - size_t buf_size = jbig2_find_buffer_size(size); - ctx->buf = jbig2_new(ctx, byte, buf_size); - if (ctx->buf == NULL) { - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to allocate buffer when reading data"); - } - ctx->buf_size = buf_size; - ctx->buf_rd_ix = 0; - ctx->buf_wr_ix = 0; - } else if (size > ctx->buf_size - ctx->buf_wr_ix) { - size_t already = ctx->buf_wr_ix - ctx->buf_rd_ix; - - if (ctx->buf_rd_ix <= (ctx->buf_size >> 1) && size <= ctx->buf_size - already) { - memmove(ctx->buf, ctx->buf + ctx->buf_rd_ix, already); - } else { - byte *buf; - size_t buf_size; - - if (already > SIZE_MAX - size) { - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "read data causes buffer to grow too large"); - } - - buf_size = jbig2_find_buffer_size(size + already); - - buf = jbig2_new(ctx, byte, buf_size); - if (buf == NULL) { - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to allocate bigger buffer when reading data"); - } - memcpy(buf, ctx->buf + ctx->buf_rd_ix, already); - jbig2_free(ctx->allocator, ctx->buf); - ctx->buf = buf; - ctx->buf_size = buf_size; - } - ctx->buf_wr_ix -= ctx->buf_rd_ix; - ctx->buf_rd_ix = 0; - } - - memcpy(ctx->buf + ctx->buf_wr_ix, data, size); - ctx->buf_wr_ix += size; - - /* data has now been added to buffer */ - - for (;;) { - const byte jbig2_id_string[8] = { 0x97, 0x4a, 0x42, 0x32, 0x0d, 0x0a, 0x1a, 0x0a }; - Jbig2Segment *segment; - size_t header_size; - int code; - - switch (ctx->state) { - case JBIG2_FILE_HEADER: - /* D.4.1 */ - if (ctx->buf_wr_ix - ctx->buf_rd_ix < 9) - return 0; - if (memcmp(ctx->buf + ctx->buf_rd_ix, jbig2_id_string, 8)) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "not a JBIG2 file header"); - /* D.4.2 */ - ctx->file_header_flags = ctx->buf[ctx->buf_rd_ix + 8]; - /* Check for T.88 amendment 2 */ - if (ctx->file_header_flags & 0x04) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "file header indicates use of 12 adaptive template pixels (NYI)"); - /* Check for T.88 amendment 3 */ - if (ctx->file_header_flags & 0x08) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "file header indicates use of colored region segments (NYI)"); - if (ctx->file_header_flags & 0xFC) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "reserved bits (2-7) of file header flags are not zero (0x%02x)", ctx->file_header_flags); - } - /* D.4.3 */ - if (!(ctx->file_header_flags & 2)) { /* number of pages is known */ - if (ctx->buf_wr_ix - ctx->buf_rd_ix < 13) - return 0; - ctx->n_pages = jbig2_get_uint32(ctx->buf + ctx->buf_rd_ix + 9); - ctx->buf_rd_ix += 13; - if (ctx->n_pages == 1) - jbig2_error(ctx, JBIG2_SEVERITY_INFO, JBIG2_UNKNOWN_SEGMENT_NUMBER, "file header indicates a single page document"); - else - jbig2_error(ctx, JBIG2_SEVERITY_INFO, JBIG2_UNKNOWN_SEGMENT_NUMBER, "file header indicates a %d page document", ctx->n_pages); - } else { /* number of pages not known */ - ctx->n_pages = 0; - ctx->buf_rd_ix += 9; - } - /* determine the file organization based on the flags - D.4.2 again */ - if (ctx->file_header_flags & 1) { - ctx->state = JBIG2_FILE_SEQUENTIAL_HEADER; - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, JBIG2_UNKNOWN_SEGMENT_NUMBER, "file header indicates sequential organization"); - } else { - ctx->state = JBIG2_FILE_RANDOM_HEADERS; - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, JBIG2_UNKNOWN_SEGMENT_NUMBER, "file header indicates random-access organization"); - } - break; - case JBIG2_FILE_SEQUENTIAL_HEADER: - case JBIG2_FILE_RANDOM_HEADERS: - segment = jbig2_parse_segment_header(ctx, ctx->buf + ctx->buf_rd_ix, ctx->buf_wr_ix - ctx->buf_rd_ix, &header_size); - if (segment == NULL) - return 0; /* need more data */ - ctx->buf_rd_ix += header_size; - - if (ctx->n_segments >= ctx->n_segments_max) { - Jbig2Segment **segments; - - if (ctx->n_segments_max == UINT32_MAX) { - ctx->state = JBIG2_FILE_EOF; - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "too many segments in jbig2 image"); - } - else if (ctx->n_segments_max > (UINT32_MAX >> 2)) { - ctx->n_segments_max = UINT32_MAX; - } - - segments = jbig2_renew(ctx, ctx->segments, Jbig2Segment *, (ctx->n_segments_max <<= 2)); - if (segments == NULL) { - ctx->state = JBIG2_FILE_EOF; - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to allocate space for more segments"); - } - ctx->segments = segments; - } - - ctx->segments[ctx->n_segments++] = segment; - if (ctx->state == JBIG2_FILE_RANDOM_HEADERS) { - if ((segment->flags & 63) == 51) /* end of file */ - ctx->state = JBIG2_FILE_RANDOM_BODIES; - } else /* JBIG2_FILE_SEQUENTIAL_HEADER */ - ctx->state = JBIG2_FILE_SEQUENTIAL_BODY; - break; - case JBIG2_FILE_SEQUENTIAL_BODY: - case JBIG2_FILE_RANDOM_BODIES: - segment = ctx->segments[ctx->segment_index]; - - /* immediate generic regions may have unknown size */ - if (segment->data_length == 0xffffffff && (segment->flags & 63) == 38) { - byte *s, *e, *p; - int mmr; - byte mmr_marker[2] = { 0x00, 0x00 }; - byte arith_marker[2] = { 0xff, 0xac }; - byte *desired_marker; - - s = p = ctx->buf + ctx->buf_rd_ix; - e = ctx->buf + ctx->buf_wr_ix; - - if (e - p < 18) - return 0; /* need more data */ - - mmr = p[17] & 1; - p += 18; - desired_marker = mmr ? mmr_marker : arith_marker; - - /* look for two byte marker */ - if (e - p < 2) - return 0; /* need more data */ - - while (p[0] != desired_marker[0] || p[1] != desired_marker[1]) { - p++; - if (e - p < 2) - return 0; /* need more data */ - } - p += 2; - - /* the marker is followed by a four byte row count */ - if (e - p < 4) - return 0; /* need more data */ - segment->rows = jbig2_get_uint32(p); - p += 4; - - segment->data_length = (size_t) (p - s); - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "unknown length determined to be %lu", (long) segment->data_length); - } - else if (segment->data_length > ctx->buf_wr_ix - ctx->buf_rd_ix) - return 0; /* need more data */ - - code = jbig2_parse_segment(ctx, segment, ctx->buf + ctx->buf_rd_ix); - ctx->buf_rd_ix += segment->data_length; - ctx->segment_index++; - if (ctx->state == JBIG2_FILE_RANDOM_BODIES) { - if (ctx->segment_index == ctx->n_segments) - ctx->state = JBIG2_FILE_EOF; - } else { /* JBIG2_FILE_SEQUENTIAL_BODY */ - ctx->state = JBIG2_FILE_SEQUENTIAL_HEADER; - } - if (code < 0) { - ctx->state = JBIG2_FILE_EOF; - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode; treating as end of file"); - } - break; - case JBIG2_FILE_EOF: - if (ctx->buf_rd_ix == ctx->buf_wr_ix) - return 0; - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "garbage beyond end of file"); - } - } -} - -Jbig2Allocator * -jbig2_ctx_free(Jbig2Ctx *ctx) -{ - Jbig2Allocator *ca; - uint32_t i; - - if (ctx == NULL) - return NULL; - - ca = ctx->allocator; - jbig2_free(ca, ctx->buf); - if (ctx->segments != NULL) { - for (i = 0; i < ctx->n_segments; i++) - jbig2_free_segment(ctx, ctx->segments[i]); - jbig2_free(ca, ctx->segments); - } - - if (ctx->pages != NULL) { - for (i = 0; i <= ctx->current_page; i++) - if (ctx->pages[i].image != NULL) - jbig2_image_release(ctx, ctx->pages[i].image); - jbig2_free(ca, ctx->pages); - } - - jbig2_free(ca, ctx); - - return ca; -} - -Jbig2GlobalCtx * -jbig2_make_global_ctx(Jbig2Ctx *ctx) -{ - return (Jbig2GlobalCtx *) ctx; -} - -Jbig2Allocator * -jbig2_global_ctx_free(Jbig2GlobalCtx *global_ctx) -{ - return jbig2_ctx_free((Jbig2Ctx *) global_ctx); -} - -/* I'm not committed to keeping the word stream interface. It's handy - when you think you may be streaming your input, but if you're not - (as is currently the case), it just adds complexity. -*/ - -typedef struct { - Jbig2WordStream super; - const byte *data; - size_t size; -} Jbig2WordStreamBuf; - -static int -jbig2_word_stream_buf_get_next_word(Jbig2Ctx *ctx, Jbig2WordStream *self, size_t offset, uint32_t *word) -{ - Jbig2WordStreamBuf *z = (Jbig2WordStreamBuf *) self; - uint32_t val = 0; - int ret = 0; - - if (self == NULL || word == NULL) { - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to read next word of stream because stream or output missing"); - } - if (offset >= z->size) { - *word = 0; - return 0; - } - - if (offset < z->size) { - val = (uint32_t) z->data[offset] << 24; - ret++; - } - if (offset + 1 < z->size) { - val |= (uint32_t) z->data[offset + 1] << 16; - ret++; - } - if (offset + 2 < z->size) { - val |= (uint32_t) z->data[offset + 2] << 8; - ret++; - } - if (offset + 3 < z->size) { - val |= z->data[offset + 3]; - ret++; - } - *word = val; - return ret; -} - -Jbig2WordStream * -jbig2_word_stream_buf_new(Jbig2Ctx *ctx, const byte *data, size_t size) -{ - Jbig2WordStreamBuf *result = jbig2_new(ctx, Jbig2WordStreamBuf, 1); - - if (result == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to allocate word stream"); - return NULL; - } - - result->super.get_next_word = jbig2_word_stream_buf_get_next_word; - result->data = data; - result->size = size; - - return &result->super; -} - -void -jbig2_word_stream_buf_free(Jbig2Ctx *ctx, Jbig2WordStream *ws) -{ - jbig2_free(ctx->allocator, ws); -} - -/* When Memento is in use, the ->free and ->realloc calls get - * turned into ->Memento_free and ->Memento_realloc, which is - * obviously problematic. Undefine free and realloc here to - * avoid this. */ -#ifdef MEMENTO -#undef free -#undef realloc -#endif - -void -jbig2_free(Jbig2Allocator *allocator, void *p) -{ - allocator->free(allocator, p); -} - -void * -jbig2_realloc(Jbig2Allocator *allocator, void *p, size_t size, size_t num) -{ - /* check for integer multiplication overflow */ - if (num > 0 && size >= SIZE_MAX / num) - return NULL; - return allocator->realloc(allocator, p, size * num); -} diff --git a/pdfpatcher/JBig2/src/jbig2.cc b/pdfpatcher/JBig2/src/jbig2.cc deleted file mode 100644 index d3af6898bc7e9a8ec3b37b217fe0f384f17bb924..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2.cc +++ /dev/null @@ -1,476 +0,0 @@ -// Copyright 2006 Google Inc. All Rights Reserved. -// Author: agl@imperialviolet.org (Adam Langley) -// -// Copyright (C) 2006 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "jbig2enc.h" - -#if defined(WIN32) -#define WINBINARY O_BINARY -#else -#define WINBINARY 0 -#endif - -static void -usage(const char *argv0) { - fprintf(stderr, "Usage: %s [options] \n", argv0); - fprintf(stderr, "Options:\n"); - fprintf(stderr, " -b : output file root name when using symbol coding\n"); - fprintf(stderr, " -d --duplicate-line-removal: use TPGD in generic region coder\n"); - fprintf(stderr, " -p --pdf: produce PDF ready data\n"); - fprintf(stderr, " -s --symbol-mode: use text region, not generic coder\n"); - fprintf(stderr, " -t : set classification threshold for symbol coder (def: 0.85)\n"); - fprintf(stderr, " -T : set 1 bpp threshold (def: 188)\n"); - fprintf(stderr, " -r --refine: use refinement (requires -s: lossless)\n"); - fprintf(stderr, " -O : dump thresholded image as PNG\n"); - fprintf(stderr, " -2: upsample 2x before thresholding\n"); - fprintf(stderr, " -4: upsample 4x before thresholding\n"); - fprintf(stderr, " -S: remove images from mixed input and save separately\n"); - fprintf(stderr, " -j --jpeg-output: write images from mixed input as JPEG\n"); - fprintf(stderr, " -v: be verbose\n"); -} - -static bool verbose = false; - - -static void -pixInfo(PIX *pix, const char *msg) { - if (msg != NULL) fprintf(stderr, "%s ", msg); - if (pix == NULL) { - fprintf(stderr, "NULL pointer!\n"); - return; - } - fprintf(stderr, "%u x %u (%d bits) %udpi x %udpi, refcount = %u\n", - pix->w, pix->h, pix->d, pix->xres, pix->yres, pix->refcount); -} - -#ifdef _MSC_VER -// ----------------------------------------------------------------------------- -// Windows, sadly, lacks asprintf -// ----------------------------------------------------------------------------- -#include -int -asprintf(char **strp, const char *fmt, ...) { - va_list va; - va_start(va, fmt); - - const int required = vsnprintf(NULL, 0, fmt, va); - char *const buffer = (char *) malloc(required + 1); - const int ret = vsnprintf(buffer, required + 1, fmt, va); - *strp = buffer; - - va_end(va); - - return ret; -} -#endif - -// ----------------------------------------------------------------------------- -// Morphological operations for segmenting an image into text regions -// ----------------------------------------------------------------------------- -static const char *segment_mask_sequence = "r11"; -static const char *segment_seed_sequence = "r1143 + o4.4 + x4"; /* maybe o6.6 */ -static const char *segment_dilation_sequence = "d3.3"; - -// ----------------------------------------------------------------------------- -// Takes two pix as input, generated from the same original image: -// 1. pixb - a binary thresholded image -// 2. piximg - a full color or grayscale image -// and segments them by finding the areas that contain color or grayscale -// graphics, removing those areas from the binary image, and doing the -// opposite for the full color/grayscale image. The upshot is that after -// this routine has been run, the binary image contains only text and the -// full color image contains only the graphics. -// -// Both input images are modified by this procedure. If no text is found, -// pixb is set to NULL. If no graphics is found, piximg is set to NULL. -// -// Thanks to Dan Bloomberg for this -// ----------------------------------------------------------------------------- - -static PIX* -segment_image(PIX *pixb, PIX *piximg) { - // Make seed and mask, and fill seed into mask - PIX *pixmask4 = pixMorphSequence(pixb, (char *) segment_mask_sequence, 0); - PIX *pixseed4 = pixMorphSequence(pixb, (char *) segment_seed_sequence, 0); - PIX *pixsf4 = pixSeedfillBinary(NULL, pixseed4, pixmask4, 8); - PIX *pixd4 = pixMorphSequence(pixsf4, (char *) segment_dilation_sequence, 0); - - // we want to force the binary mask to be the same size as the - // input color image, so we have to do it this way... - // is there a better way? - // PIX *pixd = pixExpandBinary(pixd4, 4); - PIX *pixd = pixCreate(piximg->w, piximg->h, 1); - pixCopyResolution(pixd, piximg); - if (verbose) pixInfo(pixd, "mask image: "); - expandBinaryPower2Low(pixd->data, pixd->w, pixd->h, pixd->wpl, - pixd4->data, pixd4->w, pixd4->h, pixd4->wpl, 4); - - pixDestroy(&pixd4); - pixDestroy(&pixsf4); - pixDestroy(&pixseed4); - pixDestroy(&pixmask4); - - pixSubtract(pixb, pixb, pixd); - - // now see what we got from the segmentation - static l_int32 *tab = NULL; - if (tab == NULL) tab = makePixelSumTab8(); - - // if no image portion was found, set the image pointer to NULL and return - l_int32 pcount; - pixCountPixels(pixd, &pcount, tab); - if (verbose) fprintf(stderr, "pixel count of graphics image: %u\n", pcount); - if (pcount < 100) { - pixDestroy(&pixd); - return NULL; - } - - // if no text portion found, set the binary pointer to NULL - pixCountPixels(pixb, &pcount, tab); - if (verbose) fprintf(stderr, "pixel count of binary image: %u\n", pcount); - if (pcount < 100) { - pixDestroy(&pixb); - } - - PIX *piximg1; - if (piximg->d == 1 || piximg->d == 8 || piximg->d == 32) { - piximg1 = pixClone(piximg); - } else if (piximg->d > 8) { - piximg1 = pixConvertTo32(piximg); - } else { - piximg1 = pixConvertTo8(piximg, FALSE); - } - - PIX *pixd1; - if (piximg1->d == 32) { - pixd1 = pixConvertTo32(pixd); - } else if (piximg1->d == 8) { - pixd1 = pixConvertTo8(pixd, FALSE); - } else { - pixd1 = pixClone(pixd); - } - pixDestroy(&pixd); - - if (verbose) { - pixInfo(pixd1, "binary mask image:"); - pixInfo(piximg1, "graphics image:"); - } - pixRasteropFullImage(pixd1, piximg1, PIX_SRC | PIX_DST); - - pixDestroy(&piximg1); - if (verbose) { - pixInfo(pixb, "segmented binary text image:"); - pixInfo(pixd1, "segmented graphics image:"); - } - - return pixd1; -} - -int -main(int argc, char **argv) { - bool duplicate_line_removal = false; - bool pdfmode = false; - float threshold = 0.85; - int bw_threshold = 188; - bool symbol_mode = false; - bool refine = false; - bool up2 = false, up4 = false; - const char *output_threshold = NULL; - const char *basename = "output"; - l_int32 img_fmt = IFF_PNG; - const char *img_ext = "png"; - bool segment = false; - int i; - - for (i = 1; i < argc; ++i) { - if (strcmp(argv[i], "-h") == 0 || - strcmp(argv[i], "--help") == 0) { - usage(argv[0]); - return 0; - continue; - } - - if (strcmp(argv[i], "-b") == 0 || - strcmp(argv[i], "--basename") == 0) { - basename = argv[i+1]; - i++; - continue; - } - - if (strcmp(argv[i], "-d") == 0 || - strcmp(argv[i], "--duplicate-line-removal") == 0) { - duplicate_line_removal = true; - continue; - } - - if (strcmp(argv[i], "-p") == 0 || - strcmp(argv[i], "--pdf") == 0) { - pdfmode = true; - continue; - } - - if (strcmp(argv[i], "-s") == 0 || - strcmp(argv[i], "--symbol-mode") == 0) { - symbol_mode = true; - continue; - } - - if (strcmp(argv[i], "-r") == 0 || - strcmp(argv[i], "--refine") == 0) { - fprintf(stderr, "Refinement broke in recent releases since it's " - "rarely used. If you need it you should bug " - "agl@imperialviolet.org to fix it\n"); - return 1; - refine = true; - continue; - } - - if (strcmp(argv[i], "-2") == 0) { - up2 = true; - continue; - } - if (strcmp(argv[i], "-4") == 0) { - up4 = true; - continue; - } - - if (strcmp(argv[i], "-O") == 0) { - output_threshold = argv[i+1]; - i++; - continue; - } - - if (strcmp(argv[i], "-S") == 0) { - segment = true; - continue; - } - - if (strcmp(argv[i], "-j") == 0 || - strcmp(argv[i], "--jpeg-output") == 0) { - img_ext = "jpg"; - img_fmt = IFF_JFIF_JPEG; - continue; - } - - if (strcmp(argv[i], "-t") == 0) { - char *endptr; - threshold = strtod(argv[i+1], &endptr); - if (*endptr) { - fprintf(stderr, "Cannot parse float value: %s\n", argv[i+1]); - usage(argv[0]); - return 1; - } - - if (threshold > 0.9 || threshold < 0.4) { - fprintf(stderr, "Invalid value for threshold\n"); - fprintf(stderr, "(must be between 0.4 and 0.9)\n"); - return 10; - } - i++; - continue; - } - - if (strcmp(argv[i], "-T") == 0) { - char *endptr; - bw_threshold = strtol(argv[i+1], &endptr, 10); - if (*endptr) { - fprintf(stderr, "Cannot parse int value: %s\n", argv[i+1]); - usage(argv[0]); - return 1; - } - if (bw_threshold < 0 || bw_threshold > 255) { - fprintf(stderr, "Invalid bw threshold: (0..255)\n"); - return 11; - } - i++; - continue; - } - - if (strcmp(argv[i], "-v") == 0) { - verbose = true; - continue; - } - - break; - } - - if (i == argc) { - fprintf(stderr, "No filename given\n\n"); - usage(argv[0]); - return 4; - } - - if (refine && !symbol_mode) { - fprintf(stderr, "Refinement makes not sense unless in symbol mode!\n"); - fprintf(stderr, "(if you have -r, you must have -s)\n"); - return 5; - } - - if (up2 && up4) { - fprintf(stderr, "Can't have both -2 and -4!\n"); - return 6; - } - - struct jbig2ctx *ctx = jbig2_init(threshold, 0.5, 0, 0, !pdfmode, refine ? 10 : -1); - int pageno = -1; - - int numsubimages=0, subimage=0, num_pages = 0; - while (i < argc) { - if (subimage==numsubimages) { - subimage = numsubimages = 0; - FILE *fp; - if ((fp=fopen(argv[i], "r"))==NULL) { - fprintf(stderr, "Unable to open \"%s\"", argv[i]); - return 1; - } - l_int32 filetype; - findFileFormatStream(fp, &filetype); - if (filetype==IFF_TIFF && tiffGetCount(fp, &numsubimages)) { - return 1; - } - fclose(fp); - } - - PIX *source; - if (numsubimages<=1) { - source = pixRead(argv[i]); - } else { - source = pixReadTiff(argv[i], subimage++); - } - - if (!source) return 3; - if (verbose) - pixInfo(source, "source image:"); - - PIX *pixl, *gray, *pixt; - if ((pixl = pixRemoveColormap(source, REMOVE_CMAP_BASED_ON_SRC)) == NULL) { - fprintf(stderr, "Failed to remove colormap from %s\n", argv[i]); - return 1; - } - pixDestroy(&source); - pageno++; - - if (pixl->d > 1) { - if (pixl->d > 8) { - gray = pixConvertRGBToGrayFast(pixl); - if (!gray) return 1; - } else { - gray = pixClone(pixl); - } - if (up2) { - pixt = pixScaleGray2xLIThresh(gray, bw_threshold); - } else if (up4) { - pixt = pixScaleGray4xLIThresh(gray, bw_threshold); - } else { - pixt = pixThresholdToBinary(gray, bw_threshold); - } - pixDestroy(&gray); - } else { - pixt = pixClone(pixl); - } - if (verbose) - pixInfo(pixt, "thresholded image:"); - - if (output_threshold) { - pixWrite(output_threshold, pixt, IFF_PNG); - } - - if (segment && pixl->d > 1) { - PIX *graphics = segment_image(pixt, pixl); - if (graphics) { - if (verbose) - pixInfo(graphics, "graphics image:"); - char *filename; - asprintf(&filename, "%s.%04d.%s", basename, pageno, img_ext); - pixWrite(filename, graphics, img_fmt); - free(filename); - } else if (verbose) { - fprintf(stderr, "%s: no graphics found in input image\n", argv[i]); - } - if (! pixt) { - fprintf(stderr, "%s: no text portion found in input image\n", argv[i]); - i++; - continue; - } - } - - pixDestroy(&pixl); - - if (!symbol_mode) { - int length; - uint8_t *ret; - ret = jbig2_encode_generic(pixt, !pdfmode, 0, 0, duplicate_line_removal, - &length); - _setmode (1, O_BINARY); - write(1, ret, length); - return 0; - } - - jbig2_add_page(ctx, pixt); - pixDestroy(&pixt); - num_pages++; - if (subimage==numsubimages) { - i++; - } - } - - uint8_t *ret; - int length; - ret = jbig2_pages_complete(ctx, &length); - if (pdfmode) { - char *filename; - asprintf(&filename, "%s.sym", basename); - const int fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT | WINBINARY, 0600); - free(filename); - if (fd < 0) abort(); - write(fd, ret, length); - close(fd); - } else { - write(1, ret, length); - } - free(ret); - - for (int i = 0; i < num_pages; ++i) { - ret = jbig2_produce_page(ctx, i, -1, -1, &length); - if (pdfmode) { - char *filename; - asprintf(&filename, "%s.%04d", basename, i); - const int fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | WINBINARY, 0600); - free(filename); - if (fd < 0) abort(); - write(fd, ret, length); - close(fd); - } else { - write(1, ret, length); - } - free(ret); - } - - jbig2_destroy(ctx); -} - diff --git a/pdfpatcher/JBig2/src/jbig2_arith.c b/pdfpatcher/JBig2/src/jbig2_arith.c deleted file mode 100644 index 3ad24c51d6de1bc118f3d62a6a8a6208734b4448..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2_arith.c +++ /dev/null @@ -1,453 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "os_types.h" - -#include -#include - -#include "jbig2.h" -#include "jbig2_priv.h" -#include "jbig2_arith.h" - -struct _Jbig2ArithState { - uint32_t C; - uint32_t A; - - int CT; - - uint32_t next_word; - size_t next_word_bytes; - int err; - - Jbig2WordStream *ws; - size_t offset; -}; - -/* - Previous versions of this code had a #define to allow - us to choose between using the revised arithmetic decoding - specified in the 'Software Convention' section of the spec. - Back to back tests showed that the 'Software Convention' - version was indeed slightly faster. We therefore enable it - by default. We also strip the option out, because a) it - makes the code harder to read, and b) such things are an - invitation to bitrot. -*/ - -static int -jbig2_arith_bytein(Jbig2Ctx *ctx, Jbig2ArithState *as) -{ - byte B; - - /* Treat both errors and reading beyond end of stream as an error. */ - if (as->err != 0) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to read from underlying stream during arithmetic decoding"); - return -1; - } - if (as->next_word_bytes == 0) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to read beyond end of underlying stream during arithmetic decoding"); - return -1; - } - - /* At this point there is at least one byte in as->next_word. */ - - /* This code confused me no end when I first read it, so a quick note - * to save others (and future me's) from being similarly confused. - * 'next_word' does indeed contain 'next_word_bytes' of valid data - * (always starting at the most significant byte). The confusing - * thing is that the first byte has always already been read. - * i.e. it serves only as an indication that the last byte we read - * was FF or not. - * - * The jbig2 bytestream uses FF bytes, followed by a byte > 0x8F as - * marker bytes. These never occur in normal streams of arithmetic - * encoding, so meeting one terminates the stream (with an infinite - * series of 1 bits). - * - * If we meet an FF byte, we return it as normal. We just 'remember' - * that fact for the next byte we read. - */ - - /* Figure F.3 */ - B = (byte)((as->next_word >> 24) & 0xFF); - if (B == 0xFF) { - byte B1; - - /* next_word_bytes can only be == 1 here, but let's be defensive. */ - if (as->next_word_bytes <= 1) { - int ret = as->ws->get_next_word(ctx, as->ws, as->offset, &as->next_word); - if (ret < 0) { - as->err = 1; - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to check for marker code due to failure in underlying stream during arithmetic decoding"); - } - as->next_word_bytes = (size_t) ret; - - if (as->next_word_bytes == 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to read end of possible terminating marker code, assuming terminating marker code"); - as->next_word = 0xFF900000; - as->next_word_bytes = 2; - as->C += 0xFF00; - as->CT = 8; - return 0; - } - - as->offset += as->next_word_bytes; - - B1 = (byte)((as->next_word >> 24) & 0xFF); - if (B1 > 0x8F) { -#ifdef JBIG2_DEBUG_ARITH - fprintf(stderr, "read %02x (aa)\n", B); -#endif - as->CT = 8; - as->next_word = 0xFF000000 | (as->next_word >> 8); - as->next_word_bytes = 2; - as->offset--; - } else { -#ifdef JBIG2_DEBUG_ARITH - fprintf(stderr, "read %02x (a)\n", B); -#endif - as->C += 0xFE00 - (B1 << 9); - as->CT = 7; - } - } else { - B1 = (byte)((as->next_word >> 16) & 0xFF); - if (B1 > 0x8F) { -#ifdef JBIG2_DEBUG_ARITH - fprintf(stderr, "read %02x (ba)\n", B); -#endif - as->CT = 8; - } else { - as->next_word_bytes--; - as->next_word <<= 8; -#ifdef JBIG2_DEBUG_ARITH - fprintf(stderr, "read %02x (b)\n", B); -#endif - - as->C += 0xFE00 - (B1 << 9); - as->CT = 7; - } - } - } else { -#ifdef JBIG2_DEBUG_ARITH - fprintf(stderr, "read %02x\n", B); -#endif - as->next_word <<= 8; - as->next_word_bytes--; - - if (as->next_word_bytes == 0) { - int ret = as->ws->get_next_word(ctx, as->ws, as->offset, &as->next_word); - if (ret < 0) { - as->err = 1; - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to read from underlying stream during arithmetic decoding"); - } - as->next_word_bytes = (size_t) ret; - - if (as->next_word_bytes == 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to find terminating marker code before end of underlying stream, assuming terminating marker code"); - as->next_word = 0xFF900000; - as->next_word_bytes = 2; - as->C += 0xFF00; - as->CT = 8; - return 0; - } - - as->offset += as->next_word_bytes; - } - - B = (byte)((as->next_word >> 24) & 0xFF); - as->C += 0xFF00 - (B << 8); - as->CT = 8; - } - - return 0; -} - -/** Allocate and initialize a new arithmetic coding state - * the returned pointer can simply be freed; this does - * not affect the associated Jbig2WordStream. - */ -Jbig2ArithState * -jbig2_arith_new(Jbig2Ctx *ctx, Jbig2WordStream *ws) -{ - Jbig2ArithState *result; - int ret; - - result = jbig2_new(ctx, Jbig2ArithState, 1); - if (result == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to allocate arithmetic coding state"); - return NULL; - } - - result->err = 0; - result->ws = ws; - result->offset = 0; - - ret = result->ws->get_next_word(ctx, result->ws, result->offset, &result->next_word); - if (ret < 0) { - jbig2_free(ctx->allocator, result); - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to initialize underlying stream of arithmetic decoder"); - return NULL; - } - - result->next_word_bytes = (size_t) ret; - if (result->next_word_bytes == 0) { - jbig2_free(ctx->allocator, result); - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to read first byte from underlying stream when initializing arithmetic decoder"); - return NULL; - } - - result->offset += result->next_word_bytes; - - /* Figure F.1 */ - result->C = (~(result->next_word >> 8)) & 0xFF0000; - - /* Figure E.20 (2) */ - if (jbig2_arith_bytein(ctx, result) < 0) { - jbig2_free(ctx->allocator, result); - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to read second byte from underlying stream when initializing arithmetic decoder"); - return NULL; - } - - /* Figure E.20 (3) */ - result->C <<= 7; - result->CT -= 7; - result->A = 0x8000; - - return result; -} - -#define MAX_QE_ARRAY_SIZE 47 - -/* could put bit fields in to minimize memory usage */ -typedef struct { - uint16_t Qe; - byte mps_xor; /* mps_xor = index ^ NMPS */ - byte lps_xor; /* lps_xor = index ^ NLPS ^ (SWITCH << 7) */ -} Jbig2ArithQe; - -static const Jbig2ArithQe jbig2_arith_Qe[MAX_QE_ARRAY_SIZE] = { - {0x5601, 1 ^ 0, 1 ^ 0 ^ 0x80}, - {0x3401, 2 ^ 1, 6 ^ 1}, - {0x1801, 3 ^ 2, 9 ^ 2}, - {0x0AC1, 4 ^ 3, 12 ^ 3}, - {0x0521, 5 ^ 4, 29 ^ 4}, - {0x0221, 38 ^ 5, 33 ^ 5}, - {0x5601, 7 ^ 6, 6 ^ 6 ^ 0x80}, - {0x5401, 8 ^ 7, 14 ^ 7}, - {0x4801, 9 ^ 8, 14 ^ 8}, - {0x3801, 10 ^ 9, 14 ^ 9}, - {0x3001, 11 ^ 10, 17 ^ 10}, - {0x2401, 12 ^ 11, 18 ^ 11}, - {0x1C01, 13 ^ 12, 20 ^ 12}, - {0x1601, 29 ^ 13, 21 ^ 13}, - {0x5601, 15 ^ 14, 14 ^ 14 ^ 0x80}, - {0x5401, 16 ^ 15, 14 ^ 15}, - {0x5101, 17 ^ 16, 15 ^ 16}, - {0x4801, 18 ^ 17, 16 ^ 17}, - {0x3801, 19 ^ 18, 17 ^ 18}, - {0x3401, 20 ^ 19, 18 ^ 19}, - {0x3001, 21 ^ 20, 19 ^ 20}, - {0x2801, 22 ^ 21, 19 ^ 21}, - {0x2401, 23 ^ 22, 20 ^ 22}, - {0x2201, 24 ^ 23, 21 ^ 23}, - {0x1C01, 25 ^ 24, 22 ^ 24}, - {0x1801, 26 ^ 25, 23 ^ 25}, - {0x1601, 27 ^ 26, 24 ^ 26}, - {0x1401, 28 ^ 27, 25 ^ 27}, - {0x1201, 29 ^ 28, 26 ^ 28}, - {0x1101, 30 ^ 29, 27 ^ 29}, - {0x0AC1, 31 ^ 30, 28 ^ 30}, - {0x09C1, 32 ^ 31, 29 ^ 31}, - {0x08A1, 33 ^ 32, 30 ^ 32}, - {0x0521, 34 ^ 33, 31 ^ 33}, - {0x0441, 35 ^ 34, 32 ^ 34}, - {0x02A1, 36 ^ 35, 33 ^ 35}, - {0x0221, 37 ^ 36, 34 ^ 36}, - {0x0141, 38 ^ 37, 35 ^ 37}, - {0x0111, 39 ^ 38, 36 ^ 38}, - {0x0085, 40 ^ 39, 37 ^ 39}, - {0x0049, 41 ^ 40, 38 ^ 40}, - {0x0025, 42 ^ 41, 39 ^ 41}, - {0x0015, 43 ^ 42, 40 ^ 42}, - {0x0009, 44 ^ 43, 41 ^ 43}, - {0x0005, 45 ^ 44, 42 ^ 44}, - {0x0001, 45 ^ 45, 43 ^ 45}, - {0x5601, 46 ^ 46, 46 ^ 46} -}; - -static int -jbig2_arith_renormd(Jbig2Ctx *ctx, Jbig2ArithState *as) -{ - /* Figure E.18 */ - do { - if (as->CT == 0 && jbig2_arith_bytein(ctx, as) < 0) { - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to read byte from compressed data stream"); - } - as->A <<= 1; - as->C <<= 1; - as->CT--; - } while ((as->A & 0x8000) == 0); - - return 0; -} - -int -jbig2_arith_decode(Jbig2Ctx *ctx, Jbig2ArithState *as, Jbig2ArithCx *pcx) -{ - Jbig2ArithCx cx = *pcx; - const Jbig2ArithQe *pqe; - unsigned int index = cx & 0x7f; - bool D; - - if (index >= MAX_QE_ARRAY_SIZE) { - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to determine probability estimate because index out of range"); - } - - pqe = &jbig2_arith_Qe[index]; - - /* Figure F.2 */ - as->A -= pqe->Qe; - if ((as->C >> 16) < as->A) { - if ((as->A & 0x8000) == 0) { - /* MPS_EXCHANGE, Figure E.16 */ - if (as->A < pqe->Qe) { - D = 1 - (cx >> 7); - *pcx ^= pqe->lps_xor; - } else { - D = cx >> 7; - *pcx ^= pqe->mps_xor; - } - if (jbig2_arith_renormd(ctx, as) < 0) { - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to renormalize decoder"); - } - - return D; - } else { - return cx >> 7; - } - } else { - as->C -= (as->A) << 16; - /* LPS_EXCHANGE, Figure E.17 */ - if (as->A < pqe->Qe) { - as->A = pqe->Qe; - D = cx >> 7; - *pcx ^= pqe->mps_xor; - } else { - as->A = pqe->Qe; - D = 1 - (cx >> 7); - *pcx ^= pqe->lps_xor; - } - if (jbig2_arith_renormd(ctx, as) < 0) { - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to renormalize decoder"); - } - - return D; - } -} - -#ifdef TEST - -static const byte test_stream[] = { - 0x84, 0xC7, 0x3B, 0xFC, 0xE1, 0xA1, 0x43, 0x04, 0x02, 0x20, 0x00, 0x00, - 0x41, 0x0D, 0xBB, 0x86, 0xF4, 0x31, 0x7F, 0xFF, 0x88, 0xFF, 0x37, 0x47, - 0x1A, 0xDB, 0x6A, 0xDF, 0xFF, 0xAC, - 0x00, 0x00 -}; - -#if defined(JBIG2_DEBUG) || defined(JBIG2_DEBUG_ARITH) -static void -jbig2_arith_trace(Jbig2ArithState *as, Jbig2ArithCx cx) -{ - fprintf(stderr, "I = %2d, MPS = %d, A = %04x, CT = %2d, C = %08x\n", cx & 0x7f, cx >> 7, as->A, as->CT, as->C); -} -#endif - -static int -test_get_word(Jbig2Ctx *ctx, Jbig2WordStream *self, size_t offset, uint32_t *word) -{ - uint32_t val = 0; - int ret = 0; - - if (self == NULL || word == NULL) - return -1; - if (offset >= sizeof (test_stream)) - return 0; - - if (offset < sizeof(test_stream)) { - val |= test_stream[offset] << 24; - ret++; - } - if (offset + 1 < sizeof(test_stream)) { - val |= test_stream[offset + 1] << 16; - ret++; - } - if (offset + 2 < sizeof(test_stream)) { - val |= test_stream[offset + 2] << 8; - ret++; - } - if (offset + 3 < sizeof(test_stream)) { - val |= test_stream[offset + 3]; - ret++; - } - *word = val; - return ret; -} - -int -main(int argc, char **argv) -{ - Jbig2Ctx *ctx; - Jbig2WordStream ws; - Jbig2ArithState *as; - int i; - Jbig2ArithCx cx = 0; - - ctx = jbig2_ctx_new(NULL, 0, NULL, NULL, NULL); - - ws.get_next_word = test_get_word; - as = jbig2_arith_new(ctx, &ws); -#ifdef JBIG2_DEBUG_ARITH - jbig2_arith_trace(as, cx); -#endif - - for (i = 0; i < 256; i++) { -#ifdef JBIG2_DEBUG_ARITH - int D = -#else - (void) -#endif - jbig2_arith_decode(ctx, as, &cx); - -#ifdef JBIG2_DEBUG_ARITH - fprintf(stderr, "%3d: D = %d, ", i, D); - jbig2_arith_trace(as, cx); -#endif - } - - jbig2_free(ctx->allocator, as); - - jbig2_ctx_free(ctx); - - return 0; -} -#endif diff --git a/pdfpatcher/JBig2/src/jbig2_arith_iaid.c b/pdfpatcher/JBig2/src/jbig2_arith_iaid.c deleted file mode 100644 index e9dad555f0fa46d85cd0d14d91648dc871e17a6a..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2_arith_iaid.c +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -/* Annex A.3 */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "os_types.h" - -#include -#include /* memset() */ - -#ifdef VERBOSE -#include /* for debug printing only */ -#endif - -#include "jbig2.h" -#include "jbig2_priv.h" -#include "jbig2_arith.h" -#include "jbig2_arith_iaid.h" - -struct _Jbig2ArithIaidCtx { - uint8_t SBSYMCODELEN; - Jbig2ArithCx *IAIDx; -}; - -Jbig2ArithIaidCtx * -jbig2_arith_iaid_ctx_new(Jbig2Ctx *ctx, uint8_t SBSYMCODELEN) -{ - Jbig2ArithIaidCtx *result; - size_t ctx_size; - - if (sizeof(ctx_size) * 8 <= SBSYMCODELEN) - { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "requested IAID arithmetic coding state size too large"); - return NULL; - } - - ctx_size = (size_t) 1U << SBSYMCODELEN; - - result = jbig2_new(ctx, Jbig2ArithIaidCtx, 1); - if (result == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to allocate IAID arithmetic coding state"); - return NULL; - } - - result->SBSYMCODELEN = SBSYMCODELEN; - result->IAIDx = jbig2_new(ctx, Jbig2ArithCx, ctx_size); - if (result->IAIDx == NULL) - { - jbig2_free(ctx->allocator, result); - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to allocate symbol ID in IAID arithmetic coding state"); - return NULL; - } - - memset(result->IAIDx, 0, ctx_size); - return result; -} - -/* A.3 */ -/* Return value: -1 on error, 0 on normal value */ -int -jbig2_arith_iaid_decode(Jbig2Ctx *ctx, Jbig2ArithIaidCtx *actx, Jbig2ArithState *as, int32_t *p_result) -{ - Jbig2ArithCx *IAIDx = actx->IAIDx; - uint8_t SBSYMCODELEN = actx->SBSYMCODELEN; - /* A.3 (1) */ - int PREV = 1; - int D; - int i; - - /* A.3 (2) */ - for (i = 0; i < SBSYMCODELEN; i++) { - D = jbig2_arith_decode(ctx, as, &IAIDx[PREV]); - if (D < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to decode IAIDx code"); -#ifdef VERBOSE - fprintf(stderr, "IAID%x: D = %d\n", PREV, D); -#endif - PREV = (PREV << 1) | D; - } - /* A.3 (3) */ - PREV -= 1 << SBSYMCODELEN; -#ifdef VERBOSE - fprintf(stderr, "IAID result: %d\n", PREV); -#endif - *p_result = PREV; - return 0; -} - -void -jbig2_arith_iaid_ctx_free(Jbig2Ctx *ctx, Jbig2ArithIaidCtx *iax) -{ - if (iax != NULL) { - jbig2_free(ctx->allocator, iax->IAIDx); - jbig2_free(ctx->allocator, iax); - } -} diff --git a/pdfpatcher/JBig2/src/jbig2_arith_int.c b/pdfpatcher/JBig2/src/jbig2_arith_int.c deleted file mode 100644 index 6c67784f7212a6660900f958ae172392b280e18c..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2_arith_int.c +++ /dev/null @@ -1,148 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -/* Annex A */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "os_types.h" - -#include -#include /* memset() */ - -#include "jbig2.h" -#include "jbig2_priv.h" -#include "jbig2_arith.h" -#include "jbig2_arith_int.h" - -struct _Jbig2ArithIntCtx { - Jbig2ArithCx IAx[512]; -}; - -Jbig2ArithIntCtx * -jbig2_arith_int_ctx_new(Jbig2Ctx *ctx) -{ - Jbig2ArithIntCtx *result = jbig2_new(ctx, Jbig2ArithIntCtx, 1); - - if (result == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to allocate arithmetic integer coding state"); - return NULL; - } else { - memset(result->IAx, 0, sizeof(result->IAx)); - } - - return result; -} - -/* A.2 */ -/* Return value: -1 on error, 0 on normal value, 1 on OOB return. */ -int -jbig2_arith_int_decode(Jbig2Ctx *ctx, Jbig2ArithIntCtx *actx, Jbig2ArithState *as, int32_t *p_result) -{ - Jbig2ArithCx *IAx = actx->IAx; - int PREV = 1; - int S; - int32_t V; - int bit; - int n_tail, offset; - int i; - - S = jbig2_arith_decode(ctx, as, &IAx[PREV]); - if (S < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to decode IAx S"); - PREV = (PREV << 1) | S; - - bit = jbig2_arith_decode(ctx, as, &IAx[PREV]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to decode IAx decision bit 0"); - PREV = (PREV << 1) | bit; - if (bit) { - bit = jbig2_arith_decode(ctx, as, &IAx[PREV]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to decode IAx decision bit 1"); - PREV = (PREV << 1) | bit; - - if (bit) { - bit = jbig2_arith_decode(ctx, as, &IAx[PREV]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to decode IAx decision bit 2"); - PREV = (PREV << 1) | bit; - - if (bit) { - bit = jbig2_arith_decode(ctx, as, &IAx[PREV]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to decode IAx decision bit 3"); - PREV = (PREV << 1) | bit; - - if (bit) { - bit = jbig2_arith_decode(ctx, as, &IAx[PREV]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to decode IAx decision bit 4"); - PREV = (PREV << 1) | bit; - - if (bit) { - n_tail = 32; - offset = 4436; - } else { - n_tail = 12; - offset = 340; - } - } else { - n_tail = 8; - offset = 84; - } - } else { - n_tail = 6; - offset = 20; - } - } else { - n_tail = 4; - offset = 4; - } - } else { - n_tail = 2; - offset = 0; - } - - V = 0; - for (i = 0; i < n_tail; i++) { - bit = jbig2_arith_decode(ctx, as, &IAx[PREV]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to decode IAx V bit %d", i); - PREV = ((PREV << 1) & 511) | (PREV & 256) | bit; - V = (V << 1) | bit; - } - - /* offset is always >=0, so underflow can't happen. */ - /* avoid overflow by clamping 32 bit value. */ - if (V > INT32_MAX - offset) - V = INT32_MAX; - else - V += offset; - V = S ? -V : V; - *p_result = V; - return S && V == 0 ? 1 : 0; -} - -void -jbig2_arith_int_ctx_free(Jbig2Ctx *ctx, Jbig2ArithIntCtx *iax) -{ - jbig2_free(ctx->allocator, iax); -} diff --git a/pdfpatcher/JBig2/src/jbig2_generic.c b/pdfpatcher/JBig2/src/jbig2_generic.c deleted file mode 100644 index 81a9d0ce402e76e834e720c5504e0f623dab879c..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2_generic.c +++ /dev/null @@ -1,1519 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -/** - * Generic region handlers. - **/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "os_types.h" - -#include -#include /* memcpy(), memset() */ - -#ifdef OUTPUT_PBM -#include -#endif - -#include "jbig2.h" -#include "jbig2_priv.h" -#include "jbig2_arith.h" -#include "jbig2_generic.h" -#include "jbig2_image.h" -#include "jbig2_mmr.h" -#include "jbig2_page.h" -#include "jbig2_segment.h" - -/* -This is an explanation of the unoptimized and optimized generic -region decoder implementations below, wherein we try to explain -all the magic numbers. - -The generic region decoders decode the output pixels one row at a -time, top to bottom. Within each row the pixels are decoded left -to right. The input for the arithmetic integer decoder used to -decode each pixel is a context consisting of up to 16 previously -decoded pixels. These pixels are chosen according to a predefined -template placed relative to the location of the pixel to be -decoded (6.2.5.3 figures 3, 4, 5 and 6). There are four different -template that may be used (6.2.5.3). The template to use is -determined by GBTEMPLATE. GBTEMPLATE is set in the symbol -dictionary (6.5.8.1), generic region (7.4.6.4), or when decoding -a halftone region's gray-scale image (annex C.5). - -Most of the pixels in each template have fixed locations relative -to the pixel to be decoded. However, all templates have at least -one adaptive pixel. The adaptive pixels have nominal locations, -but these locations may be changed by GBAT. GBAT is set in the -symbol dictionary (7.4.2.1.2), generic region (7.4.6.1), or hard -coded as for halftone patterns (6.7.5). - -Adaptive pixels are restricted to fall within a field of -previously decoded pixels relative to the pixel to be decoded -(figure 7). The relative Y-coordinate for these adaptive pixels -may vary between -128 and 0. The relative X-coordinate may vary -between -128 and +127 (however, if the Y-coordinate is 0 the -range of the X-coordinate is further restricted to -128 to -1 -since the pixels at locations 0 to +127 have not yet been -decoded). If a template refers to a pixel location that reside -outside of the image boundaries its value is assumed to be 0. - -UNOPTIMIZED DECODER - -The unoptimized decoders first check the contents of GBAT. If -GBAT specifies that any of the adaptive pixels reside outside the -allowed field the decoding is aborted. Next, each row is -processed top to bottom, left to right, one pixel at a time. For -each pixel a context is created containing the bit values of the -pixels that fall inside the template. - -The order these bits are stored in the context is implementation -dependent (6.2.5.3). We store the bit values in the CONTEXT -variable from LSB to MSB, starting with the value of the pixel to -the left of the current pixel, continuing right to left, bottom -to top following the template. Using the CONTEXT created from -these pixel values, the arithmetic integer decoder retrieves the -pixel value, which is then written into the output image. - -Example when GBTEMPLATE is 2: - -The figure below represents a pixel grid of the output image. -Each pixel is a single bit in the image. The pixel "OO" in the -figure below is about to be decoded. The pixels "??" have not -been decoded yet. The CONTEXT variable is constructed by -combining the bit values from the pixels referred to by the -template, shifted to their corresponding bit position. - - . . . . . . . . - . . . . . . . . - ...+----+----+----+----+----+----+----+... - | | | X9 | X8 | X7 | | | - ...+----+----+----+----+----+----+----+... - | | X6 | X5 | X4 | X3 | A1 | | - ...+----+----+----+----+----+----+----+... - | | X2 | X1 | OO | ?? | ?? | ?? | - ...+----+----+----+----+----+----+----+... - . . . . . . . . - . . . . . . . . - -In the table below pixel OO is assumed to be at coordinate (x, y). - -Bit 9: Pixel at location (x-1, y-2) (This is fixed pixel X9) -Bit 8: Pixel at location (x , y-2) (This is fixed pixel X8) -Bit 7: Pixel at location (x+1, y-2) (This is fixed pixel X7) -Bit 6: Pixel at location (x-2, y-1) (This is fixed pixel X6) -Bit 5: Pixel at location (x-1, y-1) (This is fixed pixel X5) -Bit 4: Pixel at location (x , y-1) (This is fixed pixel X4) -Bit 3: Pixel at location (x+1, y-1) (This is fixed pixel X3) -Bit 2: Pixel at location (x+2, y-1) (This is adaptive pixel A1) -Bit 1: Pixel at location (x-2, y ) (This is fixed pixel X2) -Bit 0: Pixel at location (x-1, y ) (This is fixed pixel X1) - -The location of adaptive pixel A1 may not always be at the -nominal location (x+2, y-1). It could be at any pixel location to -the left or above OO as specified by GBAT, e.g. at the location -(x-128, y+127). - -OPTIMIZED DECODER - -The optimized decoders work differently. They strive to avoid -recreating the arithmetic integer decoder context from scratch -for every pixel decoded. Instead they reuse part of the CONTEXT -used to compute the previous pixel (the pixel to left of the one -now being decoded). They also keep two sliding windows of pixel -bit values from the two rows of pixels immediately above the -pixel to be decoded. These are stored in the 32-bit variables -line_m1 (row above the pixel to be decoded) and line_m2 (row -above that of line_m1). These optimized decoders ONLY work for -the nominal adaptive pixel locations since these locations are -hard-coded into the implementation. - -The bit ordering in the CONTEXT variable is identical to the -unoptimized case described above. - -The optimized decoders decode the output pixels one row at a -time, top to bottom. Within each row the pixels are decoded in -batches of up to eight pixels at a time (except possibly the -right most batch which may be less than eight pixels). The -batches in a row are decoded in sequence from left to right. -Within each such batch the pixels are decoded in sequence from -left to right. - -Before decoding the pixels in a row the two sliding windows of -pixel values are reset. The first eight pixels of the row above -the pixel to be decoded is stored in line_m1, while line_m2 -stores the first eight pixels of the row above that of line_m1. - -The figure below illustrates the situation where the template has -been placed so that the decoded pixel OO is the very first pixel -of a row. It also gives labels to various pixels that we will -refer to below. - - . . . . . . . . . . . - | . . . . . . . . . . - + + +----+----+----+----+----+----+----+----+----+----+... - X9 | X8 | X7 | m1 | m2 | m3 | m4 | m5 | m6 | m7 | | - + + +----+----+----+----+----+----+----+----+----+----+... - X6 X5 | X4 | X3 | A1 | n1 | n2 | n3 | n4 | n5 | n6 | n7 | - + + +----+----+----+----+----+----+----+----+----+----+... - X2 X1 | OO | | | | | | | | | | - + + +----+----+----+----+----+----+----+----+----+----+... - | . . . . . . . . . . - . . . . . . . . . . . - -The pixels X1, X2, X5, X6 and X9 all reside outside the left edge -of the image. These pixels (like all others outside the image) -can according to 6.2.5.2 be assumed to be 0. line_m1 stores n5 -through n1 as well as A1, and X3 through X6. line_m2 stores m6 -through m1 as well as X7 through X9. The bits in line_m2 are also -shifted left four bits as seen below. - -15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 | bit position -------------------------------------------------+------------------ - 0 0 0 0 0 0 X6 X5 X4 X3 A1 n1 n2 n3 n4 n5 | line_m1 - 0 0 0 X9 X8 X7 m1 m2 m3 m4 m5 m6 0 0 0 0 | line_m2 - -The way line_m1 and line_m2 are stored means we can simply shift -them by the same amount to move the sliding window. - -The bit order in line_m1 and line_m2 matches the ordering in the -CONTEXT variable. Each bit for the 'A' and 'X' pixels in line_m1 -and line_m2 correspond to the equivalent bits in CONTEXT, only -shifted right by 3 bits. Thus X3 is bit 3 in CONTEXT and bit 6 in -line_m1, etc. - -The initial arithmetic integer decoder context is created and -stored in the CONTEXT variable by masking, shifting, and bitwise -ORing the contents of line_m1 and line_m2. The "CONTEXT contents" -row is only shown for clarity, it is not present in the code. - -15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 | bit position -------------------------------------------------+--------------------------- - 0 0 0 0 0 0 0 0 0 X6 X5 X4 X3 A1 n1 n2 | line_m1 >> 3 - 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 | mask for line_m1 (0x7c) - 0 0 0 0 0 0 0 0 0 X6 X5 X4 X3 A1 0 0 | line_m1 AND mask -------------------------------------------------+--------------------------- - 0 0 0 0 0 0 X9 X8 X7 m1 m2 m3 m4 m5 m6 0 | line_m2 >> 3 - 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 | mask for line_m2 (0x380) - 0 0 0 0 0 0 X9 X8 X7 0 0 0 0 0 0 0 | line_m2 AND mask -------------------------------------------------+--------------------------- - 0 0 0 0 0 0 X9 X8 X7 X6 X5 X4 X3 A1 0 0 | CONTEXT = line_m1 OR line_m2 -------------------------------------------------+--------------------------- - 0 0 0 0 0 0 X9 X8 X7 X6 X5 X4 X3 A1 X2 X1 | CONTEXT contents - -Each batch is normally 8 bits, but at the right edge of the image -we may have fewer pixels to decode. The minor_width is how many -pixels the current batch should decode, with a counter variable -x_minor to keep track of the current pixel being decoded. - -In order to process a new batch of pixels, unless we're at the -rightmost batch of pixels, we need to refill the sliding window -variables with eight new bits. Looking at the diagram above we -can see that in order to decode eight pixels starting with O0 -we'll need to have bits up to pixel 'n7' for line_m1 and 'm7' for -line_m2 available (A1 and X7 moved right 7 times). To do this -simply and quickly, we shift line_m1 left by 8 bits, and OR in -the next byte from corresponding row. Likewise for line_m2, but -the next byte from the image is also shifted left by 4 bits to -compensate for line_m2 having the four least significant bits -unused. - -These new eight bits contain the bit values of the eight pixels -to the right of those already present in line_m1 and line_m2. We -call these new bits m7 through mE, and n6 through nD, as -illustrated below. - -23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 | bit position -------------------------------------------------------------------------+------------- - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 X6 X5 X4 X3 A1 n1 n2 n3 n4 n5 | original line_m1 - 0 0 0 0 0 0 X6 X5 X4 X3 A1 n1 n2 n3 n4 n5 0 0 0 0 0 0 0 0 | line_m1 shifted left by 8 - 0 0 0 0 0 0 X6 X5 X4 X3 A1 n1 n2 n3 n4 n5 n6 n7 n8 n9 nA nB nC nD | line_m1 with new bits ORed in -------------------------------------------------------------------------+------------- - 0 0 0 0 0 0 0 0 0 0 0 X9 X8 X7 m1 m2 m3 m4 m5 m6 0 0 0 0 | original line_m2 - 0 0 0 X9 X8 X7 m1 m2 m3 m4 m5 m6 0 0 0 0 0 0 0 0 0 0 0 0 | line_m2 shifted left by 8 - 0 0 0 X9 X8 X7 m1 m2 m3 m4 m5 m6 m7 m8 m9 mA mB mC mD mE 0 0 0 0 | line_m2 with new bits ORed in - - . . . . . . . . . . . . . . . . . . . . - | . . . . . . . . . . . . . . . . . . . - + + +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+... - X9 | X8 | X7 | m1 | m2 | m3 | m4 | m5 | m6 | m7 | m8 | m9 | mA | mB | mC | mD | mE | | | | - + + +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+... - X6 X5 | X4 | X3 | A1 | n1 | n2 | n3 | n4 | n5 | n6 | n7 | n8 | n9 | nA | nB | nC | nD | | | | - + + +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+... - X2 X1 | OO | | | | | | | | | | | | | | | | | | | - + + +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+... - | . . . . . . . . . . . . . . . . . . . - . . . . . . . . . . . . . . . . . . . . - -CONTEXT, line_m1 and line_m2 now contain all necessary bits to -decode a full batch of eight pixels. - -The first pixel in the batch is decoded using this CONTEXT. After -that, for each following pixel we need to update the CONTEXT -using both the last decoded pixel value and new bits from line_m1 -and line_m2. - - . . . . . . . . . . . . . . . . . . . . - | . . . . . . . . . . . . . . . . . . . - + + +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+... - (X9)|_X8_|_X7_|>m1<| m2 | m3 | m4 | m5 | m6 | m7 | m8 | m9 | mA | mB | mC | mD | mE | | | | - + + +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+... - (X6) _X5_|_X4_|_X3_|_A1_|>n1<| n2 | n3 | n4 | n5 | n6 | n7 | n8 | n9 | nA | nB | nC | nD | | | | - + + +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+... - (X2) _X1_|>OO<| oo | | | | | | | | | | | | | | | | | | - + + +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+... - | . . . . . . . . . . . . . . . . . . . - . . . . . . . . . . . . . . . . . . . . - -This figure illustrates what happens when the same template is -overlaid on itself shifted one pixel to the right in order to -decode the next pixel. Pixels marked with _ _ are pixels that -are present in both templates' CONTEXTs and can be reused. Pixels -marked with ( ) are pixels from the first template that are no -longer necessary and can be removed from CONTEXT. Pixels marked -with > < are new pixels that were not part of the original -CONTEXT, and so need to be moved into the CONTEXT at the -appropriate locations. In general the leftmost pixels of each -template row can be forgotten, while new pixels are needed at the -right most location of each row. - -The CONTEXT corresponding to the current pixel OO and how it is -masked is shown below. Note how the left most pixel of each row -of the template is NOT propagated to the CONTEXT, these pixels -are X2, X6 and X9. This is done by having the mask being 0 at the -corresponding locations. - - 9 8 7 6 5 4 3 2 1 0 | bit position -------------------------------+------------- -X9 X8 X7 X6 X5 X4 X3 A1 X2 X1 | pixel values from CONTEXT - 0 1 1 0 1 1 1 1 0 1 | reused pixel bit value mask (0x1bd) - 0 X8 X7 0 X5 X4 X3 A1 0 X1 | reused pixel values from CONTEXT - -Next the CONTEXT is shifted left by one bit to make it reference -the next pixel to be decoded. The pixel bit value we just decoded -is then written into the bit corresponding to X1. The sliding -windows in line_m1 and line_m2 are both shifted (10 - x_minor) -bits to the right to make the needed pixels' bit values appear at -the correct positions to be ORed into CONTEXT. Note that this -shift amount depends on which bit in the batch is currently being -computed, as is given by the x_minor counter. In the example -below we assume that x_minor is 0. - - 9 8 7 6 5 4 3 2 1 0 | bit position -------------------------------+-------------- - 0 X8 X7 0 X5 X4 X3 A1 0 0 | reused pixels from CONTEXT -X8 X7 0 X5 X4 X3 A1 0 0 0 | reused pixels shifted left 1 bit -------------------------------+-------------- -X8 X7 0 X5 X4 X3 A1 0 X1 OO | new CONTEXT with current pixel at LSB -------------------------------+-------------- - 0 0 X6 X5 X4 X3 A1 n1 n2 n3 | line_m1 shifted (10 - x_minor) bits to the right - 0 0 0 0 0 0 0 1 0 0 | mask for new adaptive pixel one row above (0x4) -X8 X7 0 X5 X4 X3 A1 n1 X1 OO | new CONTEXT with new adaptive pixel -------------------------------+-------------- -X8 X7 m1 m2 m3 m4 m5 m6 m7 m8 | line_m2 with new bits ORed in - 0 0 1 0 0 0 0 0 0 0 | mask for new pixel two rows above (0x80) -X8 X7 m1 X5 X4 X3 A1 n1 X1 OO | new CONTEXT with new pixel - -This makes the computation of the new CONTEXT be: - -NEWCONTEXT = (CONTEXT & 0x1bd) << 1 -NEWCONTEXT |= newbit; -NEWCONTEXT |= (line_m1 >> (10-x_minor)) & 0x4; -NEWCONTEXT |= (line_m2 >> (10-x_minor)) & 0x80; - -The optimized decoding functions for GBTEMPLATE 0, 1 and 3 all -work similarly. */ - -/* Get a bit. No bounds checking. */ -static inline int -jbig2_image_get_pixel_fast(Jbig2Image *image, int x, int y) -{ - const int byte = (x >> 3) + y * image->stride; - const int bit = 7 - (x & 7); - - return ((image->data[byte] >> bit) & 1); -} - -/* return the appropriate context size for the given template */ -int -jbig2_generic_stats_size(Jbig2Ctx *ctx, int template) -{ - int stats_size = template == 0 ? 1 << 16 : template == 1 ? 1 << 13 : 1 << 10; - - return stats_size; -} - -static int -jbig2_decode_generic_template0(Jbig2Ctx *ctx, - Jbig2Segment *segment, - const Jbig2GenericRegionParams *params, Jbig2ArithState *as, - Jbig2Image *image, Jbig2ArithCx *GB_stats) -{ - const uint32_t GBW = image->width; - const uint32_t GBH = image->height; - const uint32_t rowstride = image->stride; - uint32_t x, y; - byte *line2 = NULL; - byte *line1 = NULL; - byte *gbreg_line = (byte *) image->data; - -#ifdef OUTPUT_PBM - printf("P4\n%d %d\n", GBW, GBH); -#endif - - if (GBW <= 0) - return 0; - - for (y = 0; y < GBH; y++) { - uint32_t CONTEXT; - uint32_t line_m1; - uint32_t line_m2; - uint32_t padded_width = (GBW + 7) & -8; - - line_m1 = line1 ? line1[0] : 0; - line_m2 = line2 ? line2[0] << 6 : 0; - CONTEXT = (line_m1 & 0x7f0) | (line_m2 & 0xf800); - - /* 6.2.5.7 3d */ - for (x = 0; x < padded_width; x += 8) { - byte result = 0; - int x_minor; - int minor_width = GBW - x > 8 ? 8 : GBW - x; - - if (line1) - line_m1 = (line_m1 << 8) | (x + 8 < GBW ? line1[(x >> 3) + 1] : 0); - - if (line2) - line_m2 = (line_m2 << 8) | (x + 8 < GBW ? line2[(x >> 3) + 1] << 6 : 0); - - /* This is the speed-critical inner loop. */ - for (x_minor = 0; x_minor < minor_width; x_minor++) { - int bit; - - bit = jbig2_arith_decode(ctx, as, &GB_stats[CONTEXT]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode arithmetic code when handling generic template0 optimized"); - result |= bit << (7 - x_minor); - CONTEXT = ((CONTEXT & 0x7bf7) << 1) | bit | ((line_m1 >> (7 - x_minor)) & 0x10) | ((line_m2 >> (7 - x_minor)) & 0x800); - } - gbreg_line[x >> 3] = result; - } -#ifdef OUTPUT_PBM - fwrite(gbreg_line, 1, rowstride, stdout); -#endif - line2 = line1; - line1 = gbreg_line; - gbreg_line += rowstride; - } - - return 0; -} - -#define pixel_outside_field(x, y) \ - ((y) < -128 || (y) > 0 || (x) < -128 || ((y) < 0 && (x) > 127) || ((y) == 0 && (x) >= 0)) - -static int -jbig2_decode_generic_template0_unopt(Jbig2Ctx *ctx, - Jbig2Segment *segment, - const Jbig2GenericRegionParams *params, Jbig2ArithState *as, Jbig2Image *image, Jbig2ArithCx *GB_stats) -{ - const uint32_t GBW = image->width; - const uint32_t GBH = image->height; - uint32_t CONTEXT; - uint32_t x, y; - int bit; - - if (pixel_outside_field(params->gbat[0], params->gbat[1]) || - pixel_outside_field(params->gbat[2], params->gbat[3]) || - pixel_outside_field(params->gbat[4], params->gbat[5]) || - pixel_outside_field(params->gbat[6], params->gbat[7])) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, - "adaptive template pixel is out of field"); - - for (y = 0; y < GBH; y++) { - uint32_t out_byte = 0; - int out_bits_to_go_in_byte = 8; - uint8_t *d = &image->data[image->stride * y]; - uint8_t *pline = &image->data[image->stride * (y-1)]; - uint8_t *ppline = &image->data[image->stride * (y-2)]; - uint32_t pd = 0; - uint32_t ppd = 0; - if (y > 0) { - pd = (*pline++ << 8); - if (GBW > 8) - pd |= *pline++; - if (y > 1) { - ppd = (*ppline++ << 8); - if (GBW > 8) - ppd |= *ppline++; - } - } - for (x = 0; x < GBW; x++) { - if (params->USESKIP && jbig2_image_get_pixel(params->SKIP, x, y)) { - bit = 0; - } else { - CONTEXT = out_byte & 0x000F; /* First 4 pixels */ - CONTEXT |= jbig2_image_get_pixel(image, x + params->gbat[0], y + params->gbat[1]) << 4; - CONTEXT |= (pd>>8) & 0x03E0; /* Next 5 pixels */ - CONTEXT |= jbig2_image_get_pixel(image, x + params->gbat[2], y + params->gbat[3]) << 10; - CONTEXT |= jbig2_image_get_pixel(image, x + params->gbat[4], y + params->gbat[5]) << 11; - CONTEXT |= (ppd>>2) & 0x7000; /* Next 3 pixels */ - CONTEXT |= jbig2_image_get_pixel(image, x + params->gbat[6], y + params->gbat[7]) << 15; - bit = jbig2_arith_decode(ctx, as, &GB_stats[CONTEXT]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode arithmetic code when handling generic template0 unoptimized"); - } - pd = pd<<1; - ppd = ppd<<1; - out_byte = (out_byte<<1) | bit; - out_bits_to_go_in_byte--; - *d = out_byte< 0) { - pd |= *pline++; - if (y > 1) - ppd |= *ppline++; - } - } - } - if (out_bits_to_go_in_byte != 8) - *d = (uint8_t)out_byte<width; - const uint32_t GBH = image->height; - uint32_t CONTEXT; - uint32_t x, y; - int bit; - - if (pixel_outside_field(params->gbat[0], params->gbat[1])) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, - "adaptive template pixel is out of field"); - - for (y = 0; y < GBH; y++) { - uint32_t out_byte = 0; - int out_bits_to_go_in_byte = 8; - uint8_t *d = &image->data[image->stride * y]; - uint8_t *pline = &image->data[image->stride * (y-1)]; - uint8_t *ppline = &image->data[image->stride * (y-2)]; - uint32_t pd = 0; - uint32_t ppd = 0; - if (y > 0) { - pd = (*pline++ << 8); - if (GBW > 8) - pd |= *pline++; - if (y > 1) { - ppd = (*ppline++ << 8); - if (GBW > 8) - ppd |= *ppline++; - } - } - for (x = 0; x < GBW; x++) { - if (params->USESKIP && jbig2_image_get_pixel(params->SKIP, x, y)) { - bit = 0; - } else { - CONTEXT = out_byte & 0x0007; /* First 3 pixels */ - CONTEXT |= jbig2_image_get_pixel(image, x + params->gbat[0], y + params->gbat[1]) << 3; - CONTEXT |= (pd>>9) & 0x01F0; /* Next 5 pixels */ - CONTEXT |= (ppd>>4) & 0x1E00; /* Next 4 pixels */ - bit = jbig2_arith_decode(ctx, as, &GB_stats[CONTEXT]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode arithmetic code when handling generic template1 unoptimized"); - } - pd = pd<<1; - ppd = ppd<<1; - out_byte = (out_byte<<1) | bit; - out_bits_to_go_in_byte--; - *d = out_byte< 0) { - pd |= *pline++; - if (y > 1) - ppd |= *ppline++; - } - } - } - if (out_bits_to_go_in_byte != 8) - *d = (uint8_t)out_byte<width; - const uint32_t GBH = image->height; - const uint32_t rowstride = image->stride; - uint32_t x, y; - byte *line2 = NULL; - byte *line1 = NULL; - byte *gbreg_line = (byte *) image->data; - -#ifdef OUTPUT_PBM - printf("P4\n%d %d\n", GBW, GBH); -#endif - - if (GBW <= 0) - return 0; - - for (y = 0; y < GBH; y++) { - uint32_t CONTEXT; - uint32_t line_m1; - uint32_t line_m2; - uint32_t padded_width = (GBW + 7) & -8; - - line_m1 = line1 ? line1[0] : 0; - line_m2 = line2 ? line2[0] << 5 : 0; - CONTEXT = ((line_m1 >> 1) & 0x1f8) | ((line_m2 >> 1) & 0x1e00); - - /* 6.2.5.7 3d */ - for (x = 0; x < padded_width; x += 8) { - byte result = 0; - int x_minor; - int minor_width = GBW - x > 8 ? 8 : GBW - x; - - if (line1) - line_m1 = (line_m1 << 8) | (x + 8 < GBW ? line1[(x >> 3) + 1] : 0); - - if (line2) - line_m2 = (line_m2 << 8) | (x + 8 < GBW ? line2[(x >> 3) + 1] << 5 : 0); - - /* This is the speed-critical inner loop. */ - for (x_minor = 0; x_minor < minor_width; x_minor++) { - int bit; - - bit = jbig2_arith_decode(ctx, as, &GB_stats[CONTEXT]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode arithmetic code when handling generic template1 optimized"); - result |= bit << (7 - x_minor); - CONTEXT = ((CONTEXT & 0xefb) << 1) | bit | ((line_m1 >> (8 - x_minor)) & 0x8) | ((line_m2 >> (8 - x_minor)) & 0x200); - } - gbreg_line[x >> 3] = result; - } -#ifdef OUTPUT_PBM - fwrite(gbreg_line, 1, rowstride, stdout); -#endif - line2 = line1; - line1 = gbreg_line; - gbreg_line += rowstride; - } - - return 0; -} - -static int -jbig2_decode_generic_template2_unopt(Jbig2Ctx *ctx, - Jbig2Segment *segment, - const Jbig2GenericRegionParams *params, Jbig2ArithState *as, Jbig2Image *image, Jbig2ArithCx *GB_stats) -{ - const uint32_t GBW = image->width; - const uint32_t GBH = image->height; - uint32_t CONTEXT; - uint32_t x, y; - int bit; - - if (pixel_outside_field(params->gbat[0], params->gbat[1])) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, - "adaptive template pixel is out of field"); - - for (y = 0; y < GBH; y++) { - uint32_t out_byte = 0; - int out_bits_to_go_in_byte = 8; - uint8_t *d = &image->data[image->stride * y]; - uint8_t *pline = &image->data[image->stride * (y-1)]; - uint8_t *ppline = &image->data[image->stride * (y-2)]; - uint32_t pd = 0; - uint32_t ppd = 0; - if (y > 0) { - pd = (*pline++ << 8); - if (GBW > 8) - pd |= *pline++; - if (y > 1) { - ppd = (*ppline++ << 8); - if (GBW > 8) - ppd |= *ppline++; - } - } - for (x = 0; x < GBW; x++) { - if (params->USESKIP && jbig2_image_get_pixel(params->SKIP, x, y)) { - bit = 0; - } else { - CONTEXT = out_byte & 0x003; /* First 2 pixels */ - CONTEXT |= jbig2_image_get_pixel(image, x + params->gbat[0], y + params->gbat[1]) << 2; - CONTEXT |= (pd>>11) & 0x078; /* Next 4 pixels */ - CONTEXT |= (ppd>>7) & 0x380; /* Next 3 pixels */ - bit = jbig2_arith_decode(ctx, as, &GB_stats[CONTEXT]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode arithmetic code when handling generic template2 unoptimized"); - } - pd = pd<<1; - ppd = ppd<<1; - out_byte = (out_byte<<1) | bit; - out_bits_to_go_in_byte--; - *d = (uint8_t)out_byte< 0) { - pd |= *pline++; - if (y > 1) - ppd |= *ppline++; - } - } - } - if (out_bits_to_go_in_byte != 8) - *d = (uint8_t)out_byte<width; - const uint32_t GBH = image->height; - const uint32_t rowstride = image->stride; - uint32_t x, y; - byte *line2 = NULL; - byte *line1 = NULL; - byte *gbreg_line = (byte *) image->data; - -#ifdef OUTPUT_PBM - printf("P4\n%d %d\n", GBW, GBH); -#endif - - if (GBW <= 0) - return 0; - - for (y = 0; y < GBH; y++) { - uint32_t CONTEXT; - uint32_t line_m1; - uint32_t line_m2; - uint32_t padded_width = (GBW + 7) & -8; - - line_m1 = line1 ? line1[0] : 0; - line_m2 = line2 ? line2[0] << 4 : 0; - CONTEXT = ((line_m1 >> 3) & 0x7c) | ((line_m2 >> 3) & 0x380); - - /* 6.2.5.7 3d */ - for (x = 0; x < padded_width; x += 8) { - byte result = 0; - int x_minor; - int minor_width = GBW - x > 8 ? 8 : GBW - x; - - if (line1) - line_m1 = (line_m1 << 8) | (x + 8 < GBW ? line1[(x >> 3) + 1] : 0); - - if (line2) - line_m2 = (line_m2 << 8) | (x + 8 < GBW ? line2[(x >> 3) + 1] << 4 : 0); - - /* This is the speed-critical inner loop. */ - for (x_minor = 0; x_minor < minor_width; x_minor++) { - int bit; - - bit = jbig2_arith_decode(ctx, as, &GB_stats[CONTEXT]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode arithmetic code when handling generic template2 optimized"); - result |= bit << (7 - x_minor); - CONTEXT = ((CONTEXT & 0x1bd) << 1) | bit | ((line_m1 >> (10 - x_minor)) & 0x4) | ((line_m2 >> (10 - x_minor)) & 0x80); - } - gbreg_line[x >> 3] = result; - } -#ifdef OUTPUT_PBM - fwrite(gbreg_line, 1, rowstride, stdout); -#endif - line2 = line1; - line1 = gbreg_line; - gbreg_line += rowstride; - } - - return 0; -} - -static int -jbig2_decode_generic_template3(Jbig2Ctx *ctx, - Jbig2Segment *segment, - const Jbig2GenericRegionParams *params, Jbig2ArithState *as, Jbig2Image *image, Jbig2ArithCx *GB_stats) -{ - const uint32_t GBW = image->width; - const uint32_t GBH = image->height; - const uint32_t rowstride = image->stride; - byte *line1 = NULL; - byte *gbreg_line = (byte *) image->data; - uint32_t x, y; - -#ifdef OUTPUT_PBM - printf("P4\n%d %d\n", GBW, GBH); -#endif - - if (GBW <= 0) - return 0; - - for (y = 0; y < GBH; y++) { - uint32_t CONTEXT; - uint32_t line_m1; - uint32_t padded_width = (GBW + 7) & -8; - - line_m1 = line1 ? line1[0] : 0; - CONTEXT = (line_m1 >> 1) & 0x3f0; - - /* 6.2.5.7 3d */ - for (x = 0; x < padded_width; x += 8) { - byte result = 0; - int x_minor; - int minor_width = GBW - x > 8 ? 8 : GBW - x; - - if (line1) - line_m1 = (line_m1 << 8) | (x + 8 < GBW ? line1[(x >> 3) + 1] : 0); - - /* This is the speed-critical inner loop. */ - for (x_minor = 0; x_minor < minor_width; x_minor++) { - int bit; - - bit = jbig2_arith_decode(ctx, as, &GB_stats[CONTEXT]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode arithmetic code when handling generic template3 optimized"); - result |= bit << (7 - x_minor); - CONTEXT = ((CONTEXT & 0x1f7) << 1) | bit | ((line_m1 >> (8 - x_minor)) & 0x10); - } - gbreg_line[x >> 3] = result; - } -#ifdef OUTPUT_PBM - fwrite(gbreg_line, 1, rowstride, stdout); -#endif - line1 = gbreg_line; - gbreg_line += rowstride; - } - - return 0; -} - -static int -jbig2_decode_generic_template3_unopt(Jbig2Ctx *ctx, - Jbig2Segment *segment, - const Jbig2GenericRegionParams *params, Jbig2ArithState *as, Jbig2Image *image, Jbig2ArithCx *GB_stats) -{ - const uint32_t GBW = image->width; - const uint32_t GBH = image->height; - uint32_t CONTEXT; - uint32_t x, y; - int bit; - - if (pixel_outside_field(params->gbat[0], params->gbat[1])) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, - "adaptive template pixel is out of field"); - - for (y = 0; y < GBH; y++) { - uint32_t out_byte = 0; - int out_bits_to_go_in_byte = 8; - uint8_t *d = &image->data[image->stride * y]; - uint8_t *pline = &image->data[image->stride * (y-1)]; - uint32_t pd = 0; - if (y > 0) { - pd = (*pline++ << 8); - if (GBW > 8) - pd |= *pline++; - } - for (x = 0; x < GBW; x++) { - if (params->USESKIP && jbig2_image_get_pixel(params->SKIP, x, y)) { - bit = 0; - } else { - CONTEXT = out_byte & 0x00F; /* First 4 pixels */ - CONTEXT |= jbig2_image_get_pixel(image, x + params->gbat[0], y + params->gbat[1]) << 4; - CONTEXT |= (pd>>9) & 0x3E0; /* Next 5 pixels */ - bit = jbig2_arith_decode(ctx, as, &GB_stats[CONTEXT]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode arithmetic code when handling generic template3 unoptimized"); - } - pd = pd<<1; - out_byte = (out_byte<<1) | bit; - out_bits_to_go_in_byte--; - *d = (uint8_t)out_byte< 0) - pd |= *pline++; - } - } - if (out_bits_to_go_in_byte != 8) - *d = (uint8_t)out_byte<data, 0, image->stride); - } else { - /* duplicate data from the previous row */ - uint8_t *src = image->data + (row - 1) * image->stride; - - memcpy(src + image->stride, src, image->stride); - } -} - -static int -jbig2_decode_generic_template0_TPGDON(Jbig2Ctx *ctx, - Jbig2Segment *segment, - const Jbig2GenericRegionParams *params, Jbig2ArithState *as, Jbig2Image *image, Jbig2ArithCx *GB_stats) -{ - const uint32_t GBW = image->width; - const uint32_t GBH = image->height; - uint32_t CONTEXT; - uint32_t x, y; - int LTP = 0; - int gmin, gmax; - uint32_t left, right, top; - - if (pixel_outside_field(params->gbat[0], params->gbat[1]) || - pixel_outside_field(params->gbat[2], params->gbat[3]) || - pixel_outside_field(params->gbat[4], params->gbat[5]) || - pixel_outside_field(params->gbat[6], params->gbat[7])) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, - "adaptive template pixel is out of field"); - - /* JBig2 has 'standard' values for gbat (see 6.2.5.4 of the spec). - * Have an optimised version for those locations. This greatly - * simplifies some of the fetches. It's almost like they thought - * it through. */ - if (params->gbat[0] == 3 && params->gbat[1] == -1 && - params->gbat[2] == -3 && params->gbat[3] == -1 && - params->gbat[4] == 2 && params->gbat[5] == -2 && - params->gbat[6] == -2 && params->gbat[7] == -2) - { - for (y = 0; y < GBH; y++) { - int bit = jbig2_arith_decode(ctx, as, &GB_stats[0x9B25]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode arithmetic code when handling generic template0 TPGDON1"); - LTP ^= bit; - if (!LTP) { - uint32_t out_byte = 0; - int out_bits_to_go_in_byte = 8; - uint8_t *d = &image->data[image->stride * y]; - uint8_t *pline = &image->data[image->stride * (y-1)]; - uint8_t *ppline = &image->data[image->stride * (y-2)]; - uint32_t pd = 0; - uint32_t ppd = 0; - if (y > 0) { - pd = (*pline++ << 8); - if (GBW > 8) - pd |= *pline++; - if (y > 1) { - ppd = (*ppline++ << 8); - if (GBW > 8) - ppd |= *ppline++; - } - } - for (x = 0; x < GBW; x++) { - if (params->USESKIP && jbig2_image_get_pixel(params->SKIP, x, y)) { - bit = 0; - } else { - CONTEXT = out_byte & 0x00F; /* First 4 pixels */ - CONTEXT |= (pd>>8) & 0x7F0; /* Next 7 pixels */ - CONTEXT |= (ppd>>2) & 0xF800; /* Final 5 pixels */ - bit = jbig2_arith_decode(ctx, as, &GB_stats[CONTEXT]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode arithmetic code when handling generic template0 TPGDON2"); - } - pd = pd<<1; - ppd = ppd<<1; - out_byte = (out_byte<<1) | bit; - out_bits_to_go_in_byte--; - if (out_bits_to_go_in_byte == 0) { - out_bits_to_go_in_byte = 8; - *d++ = (uint8_t)out_byte; - if (x+9 < GBW && y > 0) { - pd |= *pline++; - if (y > 1) - ppd |= *ppline++; - } - } - } - if (out_bits_to_go_in_byte != 8) - *d = (uint8_t)out_byte<gbat[0]; - if (params->gbat[2] < gmin) - gmin = params->gbat[2]; - if (gmax < params->gbat[2]) - gmax = params->gbat[2]; - if (params->gbat[4] < gmin) - gmin = params->gbat[4]; - if (gmax < params->gbat[4]) - gmax = params->gbat[4]; - if (params->gbat[6] < gmin) - gmin = params->gbat[6]; - if (gmax < params->gbat[6]) - gmax = params->gbat[6]; - if ((int)left < -gmin) - left = -gmin; - if ((int)right < gmax) - right = gmax; - if (right > GBW) - right = GBW; - right = GBW - right; - /* So 0 <= x < left or right <= x < GBW needs bounds checking. */ - - /* Now we do the same for the height, but here there is no bottom - * region, as we only ever look up for y. */ - top = 2; - gmin = params->gbat[1]; - if (params->gbat[3] < gmin) - gmin = params->gbat[3]; - if (params->gbat[5] < gmin) - gmin = params->gbat[5]; - if (params->gbat[7] < gmin) - gmin = params->gbat[7]; - if ((int)top < -gmin) - top = -gmin; - /* So 0 <= y < top needs bounds checking. */ - - for (y = 0; y < GBH; y++) { - int bit = jbig2_arith_decode(ctx, as, &GB_stats[0x9B25]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode arithmetic code when handling generic template0 TPGDON1"); - LTP ^= bit; - if (!LTP) { - uint32_t out_byte = 0; - int out_bits_to_go_in_byte = 8; - uint8_t *d = &image->data[image->stride * y]; - uint8_t *pline = &image->data[image->stride * (y-1)]; - uint8_t *ppline = &image->data[image->stride * (y-2)]; - uint32_t pd = 0; - uint32_t ppd = 0; - if (y > 0) { - pd = (*pline++ << 8); - if (GBW > 8) - pd |= *pline++; - if (y > 1) { - ppd = (*ppline++ << 8); - if (GBW > 8) - ppd |= *ppline++; - } - } - for (x = 0; x < GBW; x++) { - if (params->USESKIP && jbig2_image_get_pixel(params->SKIP, x, y)) { - bit = 0; - } else { - CONTEXT = out_byte & 0x000F; /* First 4 pixels */ - CONTEXT |= (pd>>8) & 0x03E0; /* Skip one, next 5 pixels */ - CONTEXT |= (ppd>>2) & 0x7000; /* Skip 2, next 3 pixels, skip one */ - if (y >= top && x >= left && x < right) - { - CONTEXT |= jbig2_image_get_pixel_fast(image, x + params->gbat[0], y + params->gbat[1]) << 4; - CONTEXT |= jbig2_image_get_pixel_fast(image, x + params->gbat[2], y + params->gbat[3]) << 10; - CONTEXT |= jbig2_image_get_pixel_fast(image, x + params->gbat[4], y + params->gbat[5]) << 11; - CONTEXT |= jbig2_image_get_pixel_fast(image, x + params->gbat[6], y + params->gbat[7]) << 15; - } - else - { - CONTEXT |= jbig2_image_get_pixel(image, x + params->gbat[0], y + params->gbat[1]) << 4; - CONTEXT |= jbig2_image_get_pixel(image, x + params->gbat[2], y + params->gbat[3]) << 10; - CONTEXT |= jbig2_image_get_pixel(image, x + params->gbat[4], y + params->gbat[5]) << 11; - CONTEXT |= jbig2_image_get_pixel(image, x + params->gbat[6], y + params->gbat[7]) << 15; - } - bit = jbig2_arith_decode(ctx, as, &GB_stats[CONTEXT]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode arithmetic code when handling generic template0 TPGDON2"); - } - pd = pd<<1; - ppd = ppd<<1; - out_byte = (out_byte<<1) | bit; - out_bits_to_go_in_byte--; - *d = (uint8_t)out_byte< 0) { - pd |= *pline++; - if (y > 1) - ppd |= *ppline++; - } - } - } - if (out_bits_to_go_in_byte != 8) - *d = (uint8_t)out_byte<width; - const uint32_t GBH = image->height; - uint32_t CONTEXT; - uint32_t x, y; - int LTP = 0; - - if (pixel_outside_field(params->gbat[0], params->gbat[1])) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, - "adaptive template pixel is out of field"); - - for (y = 0; y < GBH; y++) { - int bit = jbig2_arith_decode(ctx, as, &GB_stats[0x0795]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode arithmetic code when handling generic template1 TPGDON1"); - LTP ^= bit; - if (!LTP) { - uint32_t out_byte = 0; - int out_bits_to_go_in_byte = 8; - uint8_t *d = &image->data[image->stride * y]; - uint8_t *pline = &image->data[image->stride * (y-1)]; - uint8_t *ppline = &image->data[image->stride * (y-2)]; - uint32_t pd = 0; - uint32_t ppd = 0; - if (y > 0) { - pd = (*pline++ << 8); - if (GBW > 8) - pd |= *pline++; - if (y > 1) { - ppd = (*ppline++ << 8); - if (GBW > 8) - ppd |= *ppline++; - } - } - for (x = 0; x < GBW; x++) { - if (params->USESKIP && jbig2_image_get_pixel(params->SKIP, x, y)) { - bit = 0; - } else { - CONTEXT = out_byte & 0x0007; /* First 3 pixels */ - CONTEXT |= jbig2_image_get_pixel(image, x + params->gbat[0], y + params->gbat[1]) << 3; - CONTEXT |= (pd>>9) & 0x01F0; /* next 5 pixels */ - CONTEXT |= (ppd>>4) & 0x1E00; /* next 4 pixels */ - bit = jbig2_arith_decode(ctx, as, &GB_stats[CONTEXT]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode arithmetic code when handling generic template1 TPGDON2"); - } - pd = pd<<1; - ppd = ppd<<1; - out_byte = (out_byte<<1) | bit; - out_bits_to_go_in_byte--; - *d = (uint8_t)out_byte< 0) { - pd |= *pline++; - if (y > 1) - ppd |= *ppline++; - } - } - } - if (out_bits_to_go_in_byte != 8) - *d = (uint8_t)out_byte<width; - const uint32_t GBH = image->height; - uint32_t CONTEXT; - uint32_t x, y; - int LTP = 0; - - if (pixel_outside_field(params->gbat[0], params->gbat[1])) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, - "adaptive template pixel is out of field"); - - for (y = 0; y < GBH; y++) { - int bit = jbig2_arith_decode(ctx, as, &GB_stats[0xE5]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode arithmetic code when handling generic template2 TPGDON1"); - LTP ^= bit; - if (!LTP) { - uint32_t out_byte = 0; - int out_bits_to_go_in_byte = 8; - uint8_t *d = &image->data[image->stride * y]; - uint8_t *pline = &image->data[image->stride * (y-1)]; - uint8_t *ppline = &image->data[image->stride * (y-2)]; - uint32_t pd = 0; - uint32_t ppd = 0; - if (y > 0) { - pd = (*pline++ << 8); - if (GBW > 8) - pd |= *pline++; - if (y > 1) { - ppd = (*ppline++ << 8); - if (GBW > 8) - ppd |= *ppline++; - } - } - for (x = 0; x < GBW; x++) { - if (params->USESKIP && jbig2_image_get_pixel(params->SKIP, x, y)) { - bit = 0; - } else { - CONTEXT = out_byte & 0x003; /* First 2 pixels */ - CONTEXT |= jbig2_image_get_pixel(image, x + params->gbat[0], y + params->gbat[1]) << 2; - CONTEXT |= (pd>>11) & 0x078; /* next 4 pixels */ - CONTEXT |= (ppd>>7) & 0x380; /* next 3 pixels */ - bit = jbig2_arith_decode(ctx, as, &GB_stats[CONTEXT]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode arithmetic code when handling generic template2 TPGDON2"); - } - pd = pd<<1; - ppd = ppd<<1; - out_byte = (out_byte<<1) | bit; - out_bits_to_go_in_byte--; - *d = (uint8_t)out_byte< 0) { - pd |= *pline++; - if (y > 1) - ppd |= *ppline++; - } - } - } - if (out_bits_to_go_in_byte != 8) - *d = (uint8_t)out_byte<width; - const uint32_t GBH = image->height; - uint32_t CONTEXT; - uint32_t x, y; - int LTP = 0; - - if (pixel_outside_field(params->gbat[0], params->gbat[1])) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, - "adaptive template pixel is out of field"); - - for (y = 0; y < GBH; y++) { - int bit = jbig2_arith_decode(ctx, as, &GB_stats[0x0195]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode arithmetic code when handling generic template3 TPGDON1"); - LTP ^= bit; - if (!LTP) { - uint32_t out_byte = 0; - int out_bits_to_go_in_byte = 8; - uint8_t *d = &image->data[image->stride * y]; - uint8_t *pline = &image->data[image->stride * (y-1)]; - uint32_t pd = 0; - if (y > 0) { - pd = (*pline++ << 8); - if (GBW > 8) - pd |= *pline++; - } - for (x = 0; x < GBW; x++) { - if (params->USESKIP && jbig2_image_get_pixel(params->SKIP, x, y)) { - bit = 0; - } else { - CONTEXT = out_byte & 0x0F; /* First 4 pixels */ - CONTEXT |= jbig2_image_get_pixel(image, x + params->gbat[0], y + params->gbat[1]) << 4; - CONTEXT |= (pd>>9) & 0x3E0; /* next 5 pixels */ - bit = jbig2_arith_decode(ctx, as, &GB_stats[CONTEXT]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode arithmetic code when handling generic template3 TPGDON2"); - } - pd = pd<<1; - out_byte = (out_byte<<1) | bit; - out_bits_to_go_in_byte--; - *d = (uint8_t)out_byte< 0) - pd |= *pline++; - } - } - if (out_bits_to_go_in_byte != 8) - *d = (uint8_t)out_byte<GBTEMPLATE) { - case 0: - return jbig2_decode_generic_template0_TPGDON(ctx, segment, params, as, image, GB_stats); - case 1: - return jbig2_decode_generic_template1_TPGDON(ctx, segment, params, as, image, GB_stats); - case 2: - return jbig2_decode_generic_template2_TPGDON(ctx, segment, params, as, image, GB_stats); - case 3: - return jbig2_decode_generic_template3_TPGDON(ctx, segment, params, as, image, GB_stats); - } - - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "unsupported GBTEMPLATE (%d)", params->GBTEMPLATE); -} - -/** - * jbig2_decode_generic_region: Decode a generic region. - * @ctx: The context for allocation and error reporting. - * @segment: A segment reference for error reporting. - * @params: Decoding parameter set. - * @as: Arithmetic decoder state. - * @image: Where to store the decoded data. - * @GB_stats: Arithmetic stats. - * - * Decodes a generic region, according to section 6.2. The caller should - * pass an already allocated Jbig2Image object for @image - * - * Because this API is based on an arithmetic decoding state, it is - * not suitable for MMR decoding. - * - * Return code: 0 on success. - **/ -int -jbig2_decode_generic_region(Jbig2Ctx *ctx, - Jbig2Segment *segment, const Jbig2GenericRegionParams *params, Jbig2ArithState *as, Jbig2Image *image, Jbig2ArithCx *GB_stats) -{ - const int8_t *gbat = params->gbat; - - if (!params->MMR && params->TPGDON) - return jbig2_decode_generic_region_TPGDON(ctx, segment, params, as, image, GB_stats); - - if (!params->MMR && params->GBTEMPLATE == 0) { - if (!params->USESKIP && gbat[0] == +3 && gbat[1] == -1 && gbat[2] == -3 && gbat[3] == -1 && gbat[4] == +2 && gbat[5] == -2 && gbat[6] == -2 && gbat[7] == -2) - return jbig2_decode_generic_template0(ctx, segment, params, as, image, GB_stats); - else - return jbig2_decode_generic_template0_unopt(ctx, segment, params, as, image, GB_stats); - } else if (!params->MMR && params->GBTEMPLATE == 1) { - if (!params->USESKIP && gbat[0] == +3 && gbat[1] == -1) - return jbig2_decode_generic_template1(ctx, segment, params, as, image, GB_stats); - else - return jbig2_decode_generic_template1_unopt(ctx, segment, params, as, image, GB_stats); - } - else if (!params->MMR && params->GBTEMPLATE == 2) { - if (!params->USESKIP && gbat[0] == 2 && gbat[1] == -1) - return jbig2_decode_generic_template2(ctx, segment, params, as, image, GB_stats); - else - return jbig2_decode_generic_template2_unopt(ctx, segment, params, as, image, GB_stats); - } else if (!params->MMR && params->GBTEMPLATE == 3) { - if (!params->USESKIP && gbat[0] == 2 && gbat[1] == -1) - return jbig2_decode_generic_template3(ctx, segment, params, as, image, GB_stats); - else - return jbig2_decode_generic_template3_unopt(ctx, segment, params, as, image, GB_stats); - } - - { - int i; - - for (i = 0; i < 8; i++) - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "gbat[%d] = %d", i, params->gbat[i]); - } - - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "unsupported generic region (MMR=%d, GBTEMPLATE=%d)", params->MMR, params->GBTEMPLATE); -} - -/** - * Handler for immediate generic region segments - */ -int -jbig2_immediate_generic_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data) -{ - Jbig2RegionSegmentInfo rsi; - byte seg_flags; - int8_t gbat[8]; - int offset; - uint32_t gbat_bytes = 0; - Jbig2GenericRegionParams params; - int code = 0; - Jbig2Image *image = NULL; - Jbig2WordStream *ws = NULL; - Jbig2ArithState *as = NULL; - Jbig2ArithCx *GB_stats = NULL; - uint32_t height; - Jbig2Page *page = &ctx->pages[ctx->current_page]; - - /* 7.4.6 */ - if (segment->data_length < 18) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short"); - - jbig2_get_region_segment_info(&rsi, segment_data); - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "generic region: %u x %u @ (%u, %u), flags = %02x", rsi.width, rsi.height, rsi.x, rsi.y, rsi.flags); - - /* 7.4.6.4 */ - height = rsi.height; - if (segment->rows != UINT32_MAX) { - if (segment->rows > rsi.height) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment contains more rows than stated in header"); - height = segment->rows; - } - - /* 7.4.6.2 */ - seg_flags = segment_data[17]; - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "segment flags = %02x", seg_flags); - if ((seg_flags & 1) && (seg_flags & 6)) - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "MMR is 1, but GBTEMPLATE is not 0"); - - /* 7.4.6.3 */ - if (!(seg_flags & 1)) { - gbat_bytes = (seg_flags & 6) ? 2 : 8; - if (18 + gbat_bytes > segment->data_length) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short"); - memcpy(gbat, segment_data + 18, gbat_bytes); - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "gbat: %d, %d", gbat[0], gbat[1]); - } - - offset = 18 + gbat_bytes; - - /* Check for T.88 amendment 2 */ - if ((seg_flags >> 5) & 1) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment uses 12 adaptive template pixels (NYI)"); - - /* Table 34 */ - params.MMR = seg_flags & 1; - params.GBTEMPLATE = (seg_flags & 6) >> 1; - params.TPGDON = (seg_flags & 8) >> 3; - params.USESKIP = 0; - memcpy(params.gbat, gbat, gbat_bytes); - - if (page->height == 0xffffffff && page->striped && page->stripe_size > 0) { - if (rsi.y >= page->end_row + page->stripe_size) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "ignoring %u x %u region at (%u, %u) outside of stripe at row %u covering %u rows, on page of height %u", rsi.width, rsi.height, rsi.x, rsi.y, page->end_row, page->stripe_size, page->image->height); - return 0; - } - if (height > page->end_row + page->stripe_size) { - height = page->end_row + page->stripe_size; - } - } else { - if (rsi.y >= page->height) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "ignoring %u x %u region at (%u, %u) outside of page of height %u", rsi.width, rsi.height, rsi.x, rsi.y, page->height); - return 0; - } - if (height > page->height - rsi .y) { - height = page->height - rsi.y; - } - } - if (height == 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "nothing remains of region, ignoring"); - return 0; - } - - image = jbig2_image_new(ctx, rsi.width, height); - if (image == NULL) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate generic image"); - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "allocated %d x %d image buffer for region decode results", rsi.width, height); - - if (params.MMR) { - code = jbig2_decode_generic_mmr(ctx, segment, ¶ms, segment_data + offset, segment->data_length - offset, image); - if (code < 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode MMR-coded generic region"); - goto cleanup; - } - } else { - int stats_size = jbig2_generic_stats_size(ctx, params.GBTEMPLATE); - - GB_stats = jbig2_new(ctx, Jbig2ArithCx, stats_size); - if (GB_stats == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to allocate arithmetic decoder states when handling immediate generic region"); - goto cleanup; - } - memset(GB_stats, 0, stats_size); - - ws = jbig2_word_stream_buf_new(ctx, segment_data + offset, segment->data_length - offset); - if (ws == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocated word stream when handling immediate generic region"); - goto cleanup; - } - as = jbig2_arith_new(ctx, ws); - if (as == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate arithmetic coding state when handling immediate generic region"); - goto cleanup; - } - code = jbig2_decode_generic_region(ctx, segment, ¶ms, as, image, GB_stats); - if (code < 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode immediate generic region"); - goto cleanup; - } - } - - code = jbig2_page_add_result(ctx, &ctx->pages[ctx->current_page], image, rsi.x, rsi.y, rsi.op); - if (code < 0) - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unable to add result to page"); - -cleanup: - jbig2_free(ctx->allocator, as); - jbig2_word_stream_buf_free(ctx, ws); - jbig2_free(ctx->allocator, GB_stats); - jbig2_image_release(ctx, image); - - return code; -} diff --git a/pdfpatcher/JBig2/src/jbig2_halftone.c b/pdfpatcher/JBig2/src/jbig2_halftone.c deleted file mode 100644 index 79dd2dbd1d69dfbef348150dc84e8ea5383bf00e..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2_halftone.c +++ /dev/null @@ -1,661 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -/* JBIG2 Pattern Dictionary and Halftone Region decoding */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "os_types.h" - -#include /* memset() */ - -#include "jbig2.h" -#include "jbig2_priv.h" -#include "jbig2_arith.h" -#include "jbig2_generic.h" -#include "jbig2_image.h" -#include "jbig2_halftone.h" -#include "jbig2_mmr.h" -#include "jbig2_page.h" -#include "jbig2_segment.h" - -/** - * jbig2_hd_new: create a new dictionary from a collective bitmap - */ -static Jbig2PatternDict * -jbig2_hd_new(Jbig2Ctx *ctx, const Jbig2PatternDictParams *params, Jbig2Image *image) -{ - Jbig2PatternDict *new; - const uint32_t N = params->GRAYMAX + 1; - const uint32_t HPW = params->HDPW; - const uint32_t HPH = params->HDPH; - int code; - uint32_t i, j; - - if (N == 0) { - /* We've wrapped. */ - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "params->GRAYMAX out of range"); - return NULL; - } - - /* allocate a new struct */ - new = jbig2_new(ctx, Jbig2PatternDict, 1); - if (new != NULL) { - new->patterns = jbig2_new(ctx, Jbig2Image *, N); - if (new->patterns == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to allocate pattern in collective bitmap dictionary"); - jbig2_free(ctx->allocator, new); - return NULL; - } - new->n_patterns = N; - new->HPW = HPW; - new->HPH = HPH; - - /* 6.7.5(4) - copy out the individual pattern images */ - for (i = 0; i < N; i++) { - new->patterns[i] = jbig2_image_new(ctx, HPW, HPH); - if (new->patterns[i] == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to allocate pattern element image"); - /* new->patterns[i] above did not succeed, so releasing patterns 0..i-1 is enough */ - for (j = 0; j < i; j++) - jbig2_image_release(ctx, new->patterns[j]); - jbig2_free(ctx->allocator, new->patterns); - jbig2_free(ctx->allocator, new); - return NULL; - } - /* compose with the REPLACE operator; the source - will be clipped to the destination, selecting the - proper sub image */ - code = jbig2_image_compose(ctx, new->patterns[i], image, -i * (int32_t) HPW, 0, JBIG2_COMPOSE_REPLACE); - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to compose image into collective bitmap dictionary"); - /* new->patterns[i] above succeeded, so release all patterns 0..i */ - for (j = 0; j <= i; j++) - jbig2_image_release(ctx, new->patterns[j]); - jbig2_free(ctx->allocator, new->patterns); - jbig2_free(ctx->allocator, new); - return NULL; - } - } - } else { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to allocate collective bitmap dictionary"); - } - - return new; -} - -/** - * jbig2_hd_release: release a pattern dictionary - */ -void -jbig2_hd_release(Jbig2Ctx *ctx, Jbig2PatternDict *dict) -{ - int i; - - if (dict == NULL) - return; - if (dict->patterns != NULL) - for (i = 0; i < dict->n_patterns; i++) - jbig2_image_release(ctx, dict->patterns[i]); - jbig2_free(ctx->allocator, dict->patterns); - jbig2_free(ctx->allocator, dict); -} - -/** - * jbig2_decode_pattern_dict: decode pattern dictionary data - * - * @ctx: jbig2 decoder context - * @segment: jbig2 segment (header) structure - * @params: parameters from the pattern dictionary header - * @data: pointer to text region data to be decoded - * @size: length of text region data - * @GB_stats: arithmetic coding context to use - * - * Implements the pattern dictionary decoding procedure - * described in section 6.7 of the JBIG2 spec. - * - * returns: a pointer to the resulting dictionary on success - * returns: 0 on failure - **/ -static Jbig2PatternDict * -jbig2_decode_pattern_dict(Jbig2Ctx *ctx, Jbig2Segment *segment, - const Jbig2PatternDictParams *params, const byte *data, const size_t size, Jbig2ArithCx *GB_stats) -{ - Jbig2PatternDict *hd = NULL; - Jbig2Image *image = NULL; - Jbig2GenericRegionParams rparams; - int code = 0; - - /* allocate the collective image */ - image = jbig2_image_new(ctx, params->HDPW * (params->GRAYMAX + 1), params->HDPH); - if (image == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate collective bitmap for halftone dictionary"); - return NULL; - } - - /* fill out the generic region decoder parameters */ - rparams.MMR = params->HDMMR; - rparams.GBTEMPLATE = params->HDTEMPLATE; - rparams.TPGDON = 0; /* not used if HDMMR = 1 */ - rparams.USESKIP = 0; - rparams.gbat[0] = -(int8_t) params->HDPW; - rparams.gbat[1] = 0; - rparams.gbat[2] = -3; - rparams.gbat[3] = -1; - rparams.gbat[4] = 2; - rparams.gbat[5] = -2; - rparams.gbat[6] = -2; - rparams.gbat[7] = -2; - - if (params->HDMMR) { - code = jbig2_decode_generic_mmr(ctx, segment, &rparams, data, size, image); - } else { - Jbig2WordStream *ws = jbig2_word_stream_buf_new(ctx, data, size); - - if (ws != NULL) { - Jbig2ArithState *as = jbig2_arith_new(ctx, ws); - - if (as != NULL) { - code = jbig2_decode_generic_region(ctx, segment, &rparams, as, image, GB_stats); - } else { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate arithmetic coding state when handling halftone dictionary"); - } - - jbig2_free(ctx->allocator, as); - jbig2_word_stream_buf_free(ctx, ws); - } else { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate word stream when handling halftone dictionary"); - } - } - - if (code == 0) - hd = jbig2_hd_new(ctx, params, image); - else - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode immediate generic region"); - jbig2_image_release(ctx, image); - - return hd; -} - -/* 7.4.4 */ -int -jbig2_pattern_dictionary(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data) -{ - Jbig2PatternDictParams params; - Jbig2ArithCx *GB_stats = NULL; - byte flags; - int offset = 0; - - /* 7.4.4.1 - Data header */ - if (segment->data_length < 7) { - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short"); - } - flags = segment_data[0]; - params.HDMMR = flags & 1; - params.HDTEMPLATE = (flags & 6) >> 1; - params.HDPW = segment_data[1]; - params.HDPH = segment_data[2]; - params.GRAYMAX = jbig2_get_uint32(segment_data + 3); - offset += 7; - - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, - "pattern dictionary, flags=%02x, %d grays (%dx%d cell)", flags, params.GRAYMAX + 1, params.HDPW, params.HDPH); - - if (params.HDMMR && params.HDTEMPLATE) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "HDTEMPLATE is %d when HDMMR is %d, contrary to spec", params.HDTEMPLATE, params.HDMMR); - } - if (flags & 0xf8) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "reserved flag bits non-zero"); - } - - /* 7.4.4.2 */ - if (!params.HDMMR) { - /* allocate and zero arithmetic coding stats */ - int stats_size = jbig2_generic_stats_size(ctx, params.HDTEMPLATE); - - GB_stats = jbig2_new(ctx, Jbig2ArithCx, stats_size); - if (GB_stats == NULL) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate arithmetic coding state when handling pattern dictionary"); - memset(GB_stats, 0, stats_size); - } - - segment->result = jbig2_decode_pattern_dict(ctx, segment, ¶ms, segment_data + offset, segment->data_length - offset, GB_stats); - - /* todo: retain GB_stats? */ - if (!params.HDMMR) { - jbig2_free(ctx->allocator, GB_stats); - } - - return (segment->result != NULL) ? 0 : -1; -} - -/** - * jbig2_decode_gray_scale_image: decode gray-scale image - * - * @ctx: jbig2 decoder context - * @segment: jbig2 segment (header) structure - * @data: pointer to text region data to be decoded - * @size: length of text region data - * @GSMMR: if MMR is used - * @GSW: width of gray-scale image - * @GSH: height of gray-scale image - * @GSBPP: number of bitplanes/Jbig2Images to use - * @GSKIP: mask indicating which values should be skipped - * @GSTEMPLATE: template used to code the gray-scale bitplanes - * @GB_stats: arithmetic coding context to use - * - * Implements the decoding a gray-scale image described in - * annex C.5. This is part of the halftone region decoding. - * - * returns: array of gray-scale values with GSW x GSH width/height - * 0 on failure - **/ -static uint16_t ** -jbig2_decode_gray_scale_image(Jbig2Ctx *ctx, Jbig2Segment *segment, - const byte *data, const size_t size, - bool GSMMR, uint32_t GSW, uint32_t GSH, - uint32_t GSBPP, bool GSUSESKIP, Jbig2Image *GSKIP, int GSTEMPLATE, Jbig2ArithCx *GB_stats) -{ - uint16_t **GSVALS = NULL; - size_t consumed_bytes = 0; - uint32_t i, j, stride, x, y; - int code; - Jbig2Image **GSPLANES; - Jbig2GenericRegionParams rparams; - Jbig2WordStream *ws = NULL; - Jbig2ArithState *as = NULL; - - /* allocate GSPLANES */ - GSPLANES = jbig2_new(ctx, Jbig2Image *, GSBPP); - if (GSPLANES == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to allocate %d bytes for GSPLANES", GSBPP); - return NULL; - } - - for (i = 0; i < GSBPP; ++i) { - GSPLANES[i] = jbig2_image_new(ctx, GSW, GSH); - if (GSPLANES[i] == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate %dx%d image for GSPLANES", GSW, GSH); - /* free already allocated */ - for (j = i; j > 0;) - jbig2_image_release(ctx, GSPLANES[--j]); - jbig2_free(ctx->allocator, GSPLANES); - return NULL; - } - } - - /* C.5 step 1. Decode GSPLANES[GSBPP-1] */ - /* fill generic region decoder parameters */ - rparams.MMR = GSMMR; - rparams.GBTEMPLATE = GSTEMPLATE; - rparams.TPGDON = 0; - rparams.USESKIP = GSUSESKIP; - rparams.SKIP = GSKIP; - rparams.gbat[0] = (GSTEMPLATE <= 1 ? 3 : 2); - rparams.gbat[1] = -1; - rparams.gbat[2] = -3; - rparams.gbat[3] = -1; - rparams.gbat[4] = 2; - rparams.gbat[5] = -2; - rparams.gbat[6] = -2; - rparams.gbat[7] = -2; - - if (GSMMR) { - code = jbig2_decode_halftone_mmr(ctx, &rparams, data, size, GSPLANES[GSBPP - 1], &consumed_bytes); - } else { - ws = jbig2_word_stream_buf_new(ctx, data, size); - if (ws == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate word stream when decoding gray scale image"); - goto cleanup; - } - - as = jbig2_arith_new(ctx, ws); - if (as == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate arithmetic coding state when decoding gray scale image"); - goto cleanup; - } - - code = jbig2_decode_generic_region(ctx, segment, &rparams, as, GSPLANES[GSBPP - 1], GB_stats); - } - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "error decoding GSPLANES for halftone image"); - goto cleanup; - } - - /* C.5 step 2. Set j = GSBPP-2 */ - j = GSBPP - 1; - /* C.5 step 3. decode loop */ - while (j > 0) { - j--; - /* C.5 step 3. (a) */ - if (GSMMR) { - code = jbig2_decode_halftone_mmr(ctx, &rparams, data + consumed_bytes, size - consumed_bytes, GSPLANES[j], &consumed_bytes); - } else { - code = jbig2_decode_generic_region(ctx, segment, &rparams, as, GSPLANES[j], GB_stats); - } - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode GSPLANES for halftone image"); - goto cleanup; - } - - /* C.5 step 3. (b): - * for each [x,y] - * GSPLANES[j][x][y] = GSPLANES[j+1][x][y] XOR GSPLANES[j][x][y] */ - stride = GSPLANES[j]->stride; - for (i = 0; i < stride * GSH; ++i) - GSPLANES[j]->data[i] ^= GSPLANES[j + 1]->data[i]; - - /* C.5 step 3. (c) */ - } - - /* allocate GSVALS */ - GSVALS = jbig2_new(ctx, uint16_t *, GSW); - if (GSVALS == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to allocate GSVALS: %d bytes", GSW); - goto cleanup; - } - for (i = 0; i < GSW; ++i) { - GSVALS[i] = jbig2_new(ctx, uint16_t, GSH); - if (GSVALS[i] == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to allocate GSVALS: %d bytes", GSH * GSW); - /* free already allocated */ - for (j = i; j > 0;) - jbig2_free(ctx->allocator, GSVALS[--j]); - jbig2_free(ctx->allocator, GSVALS); - GSVALS = NULL; - goto cleanup; - } - } - - /* C.5 step 4. */ - for (x = 0; x < GSW; ++x) { - for (y = 0; y < GSH; ++y) { - GSVALS[x][y] = 0; - - for (j = 0; j < GSBPP; ++j) - GSVALS[x][y] += jbig2_image_get_pixel(GSPLANES[j], x, y) << j; - } - } - -cleanup: - /* free memory */ - if (!GSMMR) { - jbig2_free(ctx->allocator, as); - jbig2_word_stream_buf_free(ctx, ws); - } - for (i = 0; i < GSBPP; ++i) - jbig2_image_release(ctx, GSPLANES[i]); - - jbig2_free(ctx->allocator, GSPLANES); - - return GSVALS; -} - -/** - * jbig2_decode_ht_region_get_hpats: get pattern dictionary - * - * @ctx: jbig2 decoder context - * @segment: jbig2 halftone region segment - * - * Returns the first referred pattern dictionary of segment - * - * returns: pattern dictionary - * 0 if search failed - **/ -static Jbig2PatternDict * -jbig2_decode_ht_region_get_hpats(Jbig2Ctx *ctx, Jbig2Segment *segment) -{ - int index = 0; - Jbig2PatternDict *pattern_dict = NULL; - Jbig2Segment *rsegment = NULL; - - /* loop through all referred segments */ - while (!pattern_dict && segment->referred_to_segment_count > index) { - rsegment = jbig2_find_segment(ctx, segment->referred_to_segments[index]); - if (rsegment) { - /* segment type is pattern dictionary and result is not empty */ - if ((rsegment->flags & 0x3f) == 16 && rsegment->result) { - pattern_dict = (Jbig2PatternDict *) rsegment->result; - return pattern_dict; - } - } - index++; - } - return pattern_dict; -} - -/** - * jbig2_decode_halftone_region: decode a halftone region - * - * @ctx: jbig2 decoder context - * @segment: jbig2 halftone region segment - * @params: parameters - * @data: pointer to halftone region data to be decoded - * @size: length of halftone region data - * @GB_stats: arithmetic coding context to use - * - * Implements the halftone region decoding procedure - * described in section 6.6.5 of the JBIG2 spec. - * - * returns: 0 on success - * <0 on failure - **/ -static int -jbig2_decode_halftone_region(Jbig2Ctx *ctx, Jbig2Segment *segment, - Jbig2HalftoneRegionParams *params, const byte *data, const size_t size, Jbig2Image *image, Jbig2ArithCx *GB_stats) -{ - uint32_t HBPP; - uint32_t HNUMPATS; - uint16_t **GI = NULL; - Jbig2Image *HSKIP = NULL; - Jbig2PatternDict *HPATS; - uint32_t i; - uint32_t mg, ng; - uint16_t gray_val; - int code = 0; - - /* We need the patterns used in this region, get them from the referred pattern dictionary */ - HPATS = jbig2_decode_ht_region_get_hpats(ctx, segment); - if (!HPATS) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "no pattern dictionary found, skipping halftone image"); - goto cleanup; - } - - /* 6.6.5 point 1. Fill bitmap with HDEFPIXEL */ - memset(image->data, params->HDEFPIXEL, image->stride * image->height); - - /* 6.6.5 point 2. compute HSKIP according to 6.6.5.1 */ - if (params->HENABLESKIP == 1) { - HSKIP = jbig2_image_new(ctx, params->HGW, params->HGH); - if (HSKIP == NULL) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate skip image"); - - for (mg = 0; mg < params->HGH; ++mg) { - for (ng = 0; ng < params->HGW; ++ng) { - int64_t x = ((int64_t) params->HGX + mg * params->HRY + ng * params->HRX) >> 8; - int64_t y = ((int64_t) params->HGY + mg * params->HRX - ng * params->HRY) >> 8; - - if (x + HPATS->HPW <= 0 || x >= image->width || y + HPATS->HPH <= 0 || y >= image->height) { - jbig2_image_set_pixel(HSKIP, ng, mg, 1); - } else { - jbig2_image_set_pixel(HSKIP, ng, mg, 0); - } - } - } - } - - /* 6.6.5 point 3. set HBPP to ceil(log2(HNUMPATS)): */ - HNUMPATS = HPATS->n_patterns; - HBPP = 0; - while (HNUMPATS > (1U << ++HBPP)); - if (HBPP > 16) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "HBPP is larger than supported (%u)", HBPP); - goto cleanup; - } - - /* 6.6.5 point 4. decode gray-scale image as mentioned in annex C */ - GI = jbig2_decode_gray_scale_image(ctx, segment, data, size, - params->HMMR, params->HGW, params->HGH, HBPP, params->HENABLESKIP, HSKIP, params->HTEMPLATE, GB_stats); - if (!GI) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unable to acquire gray-scale image, skipping halftone image"); - goto cleanup; - } - - /* 6.6.5 point 5. place patterns with procedure mentioned in 6.6.5.2 */ - for (mg = 0; mg < params->HGH; ++mg) { - for (ng = 0; ng < params->HGW; ++ng) { - int64_t x = ((int64_t) params->HGX + mg * params->HRY + ng * params->HRX) >> 8; - int64_t y = ((int64_t) params->HGY + mg * params->HRX - ng * params->HRY) >> 8; - - /* prevent pattern index >= HNUMPATS */ - gray_val = GI[ng][mg]; - if (gray_val >= HNUMPATS) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "gray-scale index %d out of range, using largest index", gray_val); - /* use highest available pattern */ - gray_val = HNUMPATS - 1; - } - code = jbig2_image_compose(ctx, image, HPATS->patterns[gray_val], x, y, params->HCOMBOP); - if (code < 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to compose pattern with gray-scale image"); - goto cleanup; - } - } - } - -cleanup: - if (GI) { - for (i = 0; i < params->HGW; ++i) { - jbig2_free(ctx->allocator, GI[i]); - } - } - jbig2_free(ctx->allocator, GI); - jbig2_image_release(ctx, HSKIP); - - return code; -} - -/** - * jbig2_halftone_region: read a halftone region segment header - **/ -int -jbig2_halftone_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data) -{ - int offset = 0; - Jbig2RegionSegmentInfo region_info; - Jbig2HalftoneRegionParams params; - Jbig2Image *image = NULL; - Jbig2ArithCx *GB_stats = NULL; - int code = 0; - - /* 7.4.5.1 */ - if (segment->data_length < 17) - goto too_short; - jbig2_get_region_segment_info(®ion_info, segment_data); - offset += 17; - - if (segment->data_length < 18) - goto too_short; - - /* 7.4.5.1.1 Figure 42 */ - params.flags = segment_data[offset]; - params.HMMR = params.flags & 1; - params.HTEMPLATE = (params.flags & 6) >> 1; - params.HENABLESKIP = (params.flags & 8) >> 3; - params.HCOMBOP = (Jbig2ComposeOp)((params.flags & 0x70) >> 4); - params.HDEFPIXEL = (params.flags & 0x80) >> 7; - offset += 1; - - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, - "halftone region: %u x %u @ (%u, %u), flags = %02x", region_info.width, region_info.height, region_info.x, region_info.y, params.flags); - - if (params.HMMR && params.HTEMPLATE) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "HTEMPLATE is %d when HMMR is %d, contrary to spec", params.HTEMPLATE, params.HMMR); - } - if (params.HMMR && params.HENABLESKIP) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "HENABLESKIP is %d when HMMR is %d, contrary to spec", params.HENABLESKIP, params.HMMR); - } - - /* 7.4.5.1.2 Figure 43 */ - if (segment->data_length - offset < 16) - goto too_short; - params.HGW = jbig2_get_uint32(segment_data + offset); - params.HGH = jbig2_get_uint32(segment_data + offset + 4); - params.HGX = jbig2_get_int32(segment_data + offset + 8); - params.HGY = jbig2_get_int32(segment_data + offset + 12); - offset += 16; - - /* 7.4.5.1.3 Figure 44 */ - if (segment->data_length - offset < 4) - goto too_short; - params.HRX = jbig2_get_uint16(segment_data + offset); - params.HRY = jbig2_get_uint16(segment_data + offset + 2); - offset += 4; - - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, - "grid %d x %d @ (%d.%d,%d.%d) vector (%d.%d,%d.%d)", - params.HGW, params.HGH, - params.HGX >> 8, params.HGX & 0xff, - params.HGY >> 8, params.HGY & 0xff, - params.HRX >> 8, params.HRX & 0xff, - params.HRY >> 8, params.HRY & 0xff); - - /* 7.4.5.2 */ - if (!params.HMMR) { - /* allocate and zero arithmetic coding stats */ - int stats_size = jbig2_generic_stats_size(ctx, params.HTEMPLATE); - - GB_stats = jbig2_new(ctx, Jbig2ArithCx, stats_size); - if (GB_stats == NULL) { - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to allocate arithmetic decoder states in halftone region"); - } - memset(GB_stats, 0, stats_size); - } - - image = jbig2_image_new(ctx, region_info.width, region_info.height); - if (image == NULL) { - jbig2_free(ctx->allocator, GB_stats); - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate halftone image"); - } - - code = jbig2_decode_halftone_region(ctx, segment, ¶ms, segment_data + offset, segment->data_length - offset, image, GB_stats); - if (code < 0) { - jbig2_image_release(ctx, image); - jbig2_free(ctx->allocator, GB_stats); - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode halftone region"); - } - - /* todo: retain GB_stats? */ - if (!params.HMMR) { - jbig2_free(ctx->allocator, GB_stats); - } - - code = jbig2_page_add_result(ctx, &ctx->pages[ctx->current_page], image, region_info.x, region_info.y, region_info.op); - if (code < 0) { - jbig2_image_release(ctx, image); - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unable to add halftone region to page"); - } - - jbig2_image_release(ctx, image); - - return code; - -too_short: - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short"); -} diff --git a/pdfpatcher/JBig2/src/jbig2_huffman.c b/pdfpatcher/JBig2/src/jbig2_huffman.c deleted file mode 100644 index a0df0e5e3f105cae4d3d3fabf54829fb9ed119e4..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2_huffman.c +++ /dev/null @@ -1,2148 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -/* Huffman table decoding procedures - -- See Annex B of the JBIG2 specification */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "os_types.h" - -#include -#include - -#ifdef JBIG2_DEBUG -#include -#endif - -#include "jbig2.h" -#include "jbig2_priv.h" -#include "jbig2_huffman.h" -#include "jbig2_hufftab.h" -#include "jbig2_image.h" -#include "jbig2_segment.h" - -#define JBIG2_HUFFMAN_FLAGS_ISOOB 1 -#define JBIG2_HUFFMAN_FLAGS_ISLOW 2 -#define JBIG2_HUFFMAN_FLAGS_ISEXT 4 - -struct _Jbig2HuffmanState { - /* The current bit offset is equal to (offset * 8) + offset_bits. - The MSB of this_word is the current bit offset. The MSB of next_word - is (offset + 4) * 8. */ - uint32_t this_word; - uint32_t next_word; - uint32_t offset_bits; - uint32_t offset; - uint32_t offset_limit; - - Jbig2WordStream *ws; - Jbig2Ctx *ctx; -}; - -#define huff_get_next_word(hs, offset, word) \ - (hs)->ws->get_next_word((hs)->ctx, (hs)->ws, (offset), (word)) - -/** Allocate and initialize a new huffman coding state - * the returned pointer can simply be freed; this does - * not affect the associated Jbig2WordStream. - */ -Jbig2HuffmanState * -jbig2_huffman_new(Jbig2Ctx *ctx, Jbig2WordStream *ws) -{ - Jbig2HuffmanState *result = NULL; - int code; - - result = jbig2_new(ctx, Jbig2HuffmanState, 1); - - if (result != NULL) { - result->offset = 0; - result->offset_bits = 0; - result->offset_limit = 0; - result->ws = ws; - result->ctx = ctx; - code = huff_get_next_word(result, 0, &result->this_word); - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to read first huffman word"); - jbig2_huffman_free(ctx, result); - return NULL; - } - code = huff_get_next_word(result, 4, &result->next_word); - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to read second huffman word"); - jbig2_huffman_free(ctx, result); - return NULL; - } - } else { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to allocate new huffman coding state"); - return NULL; - } - - return result; -} - -/** Free an allocated huffman coding state. - * This just calls jbig2_free() if the pointer is not NULL - */ -void -jbig2_huffman_free(Jbig2Ctx *ctx, Jbig2HuffmanState *hs) -{ - jbig2_free(ctx->allocator, hs); -} - -/** debug routines **/ -#ifdef JBIG2_DEBUG - -/** print current huffman state */ -void -jbig2_dump_huffman_state(Jbig2HuffmanState *hs) -{ - fprintf(stderr, "huffman state %08x %08x offset %d.%d\n", hs->this_word, hs->next_word, hs->offset, hs->offset_bits); -} - -/** print the binary string we're reading from */ -void -jbig2_dump_huffman_binary(Jbig2HuffmanState *hs) -{ - const uint32_t word = hs->this_word; - int i; - - fprintf(stderr, "huffman binary "); - for (i = 31; i >= 0; i--) - fprintf(stderr, ((word >> i) & 1) ? "1" : "0"); - fprintf(stderr, "\n"); -} - -/** print huffman table */ -void -jbig2_dump_huffman_table(const Jbig2HuffmanTable *table) -{ - int i; - int table_size = (1 << table->log_table_size); - - fprintf(stderr, "huffman table %p (log_table_size=%d, %d entries, entries=%p):\n", table, table->log_table_size, table_size, table->entries); - for (i = 0; i < table_size; i++) { - fprintf(stderr, "%6d: PREFLEN=%d, RANGELEN=%d, ", i, table->entries[i].PREFLEN, table->entries[i].RANGELEN); - if (table->entries[i].flags & JBIG2_HUFFMAN_FLAGS_ISEXT) { - fprintf(stderr, "ext=%p", table->entries[i].u.ext_table); - } else { - fprintf(stderr, "RANGELOW=%d", table->entries[i].u.RANGELOW); - } - if (table->entries[i].flags) { - int need_comma = 0; - - fprintf(stderr, ", flags=0x%x(", table->entries[i].flags); - if (table->entries[i].flags & JBIG2_HUFFMAN_FLAGS_ISOOB) { - fprintf(stderr, "OOB"); - need_comma = 1; - } - if (table->entries[i].flags & JBIG2_HUFFMAN_FLAGS_ISLOW) { - if (need_comma) - fprintf(stderr, ","); - fprintf(stderr, "LOW"); - need_comma = 1; - } - if (table->entries[i].flags & JBIG2_HUFFMAN_FLAGS_ISEXT) { - if (need_comma) - fprintf(stderr, ","); - fprintf(stderr, "EXT"); - } - fprintf(stderr, ")"); - } - fprintf(stderr, "\n"); - } - fprintf(stderr, "\n"); -} - -#endif /* JBIG2_DEBUG */ - -/** Skip bits up to the next byte boundary - */ -int -jbig2_huffman_skip(Jbig2HuffmanState *hs) -{ - uint32_t bits = hs->offset_bits & 7; - int code; - - if (bits) { - bits = 8 - bits; - hs->offset_bits += bits; - hs->this_word = (hs->this_word << bits) | (hs->next_word >> (32 - hs->offset_bits)); - } - - if (hs->offset_bits >= 32) { - hs->this_word = hs->next_word; - hs->offset += 4; - code = huff_get_next_word(hs, hs->offset + 4, &hs->next_word); - if (code < 0) { - return jbig2_error(hs->ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to read next huffman word when skipping"); - } - hs->offset_bits -= 32; - if (hs->offset_bits) { - hs->this_word = (hs->this_word << hs->offset_bits) | (hs->next_word >> (32 - hs->offset_bits)); - } - } - return 0; -} - -/* skip ahead a specified number of bytes in the word stream - */ -int -jbig2_huffman_advance(Jbig2HuffmanState *hs, size_t advance) -{ - int code; - hs->offset += advance & ~3; - hs->offset_bits += (advance & 3) << 3; - if (hs->offset_bits >= 32) { - hs->offset += 4; - hs->offset_bits -= 32; - } - code = huff_get_next_word(hs, hs->offset, &hs->this_word); - if (code < 0) { - return jbig2_error(hs->ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to get first huffman word after advancing"); - } - code = huff_get_next_word(hs, hs->offset + 4, &hs->next_word); - if (code < 0) { - return jbig2_error(hs->ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to get second huffman word after advancing"); - } - if (hs->offset_bits > 0) - hs->this_word = (hs->this_word << hs->offset_bits) | (hs->next_word >> (32 - hs->offset_bits)); - return 0; -} - -/* return the offset of the huffman decode pointer (in bytes) - * from the beginning of the WordStream - */ -uint32_t -jbig2_huffman_offset(Jbig2HuffmanState *hs) -{ - return hs->offset + (hs->offset_bits >> 3); -} - -/* read a number of bits directly from the huffman state - * without decoding against a table - */ -int32_t -jbig2_huffman_get_bits(Jbig2HuffmanState *hs, const int bits, int *err) -{ - uint32_t this_word = hs->this_word; - int32_t result; - int code; - - if (hs->offset_limit && hs->offset >= hs->offset_limit) { - *err = -1; - return jbig2_error(hs->ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "end of jbig2 buffer reached at offset %d", hs->offset); - } - - result = this_word >> (32 - bits); - hs->offset_bits += bits; - if (hs->offset_bits >= 32) { - hs->offset += 4; - hs->offset_bits -= 32; - hs->this_word = hs->next_word; - code = huff_get_next_word(hs, hs->offset + 4, &hs->next_word); - if (code < 0) { - return jbig2_error(hs->ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to get next huffman word"); - } - if (hs->offset_bits) { - hs->this_word = (hs->this_word << hs->offset_bits) | (hs->next_word >> (32 - hs->offset_bits)); - } else { - hs->this_word = (hs->this_word << hs->offset_bits); - } - } else { - hs->this_word = (this_word << bits) | (hs->next_word >> (32 - hs->offset_bits)); - } - - return result; -} - -int32_t -jbig2_huffman_get(Jbig2HuffmanState *hs, const Jbig2HuffmanTable *table, bool *oob) -{ - Jbig2HuffmanEntry *entry; - byte flags; - int offset_bits = hs->offset_bits; - uint32_t this_word = hs->this_word; - uint32_t next_word; - int RANGELEN; - int32_t result; - - if (hs->offset_limit && hs->offset >= hs->offset_limit) { - if (oob) - *oob = -1; - return jbig2_error(hs->ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "end of Jbig2WordStream reached at offset %d", hs->offset); - } - - for (;;) { - int log_table_size = table->log_table_size; - int PREFLEN; - int code; - - /* SumatraPDF: shifting by the size of the operand is undefined */ - entry = &table->entries[log_table_size > 0 ? this_word >> (32 - log_table_size) : 0]; - flags = entry->flags; - PREFLEN = entry->PREFLEN; - if (flags == (byte) -1 || PREFLEN == (byte) -1) { - if (oob) - *oob = -1; - return jbig2_error(hs->ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "encountered unpopulated huffman table entry"); - } - - next_word = hs->next_word; - offset_bits += PREFLEN; - if (offset_bits >= 32) { - this_word = next_word; - hs->offset += 4; - code = huff_get_next_word(hs, hs->offset + 4, &next_word); - if (code < 0) { - return jbig2_error(hs->ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to get next huffman word"); - } - offset_bits -= 32; - hs->next_word = next_word; - PREFLEN = offset_bits; - } - if (PREFLEN) - this_word = (this_word << PREFLEN) | (next_word >> (32 - offset_bits)); - if (flags & JBIG2_HUFFMAN_FLAGS_ISEXT) { - table = entry->u.ext_table; - } else - break; - } - result = entry->u.RANGELOW; - RANGELEN = entry->RANGELEN; - if (RANGELEN > 0) { - int32_t HTOFFSET; - int code; - - HTOFFSET = this_word >> (32 - RANGELEN); - if (flags & JBIG2_HUFFMAN_FLAGS_ISLOW) - result -= HTOFFSET; - else - result += HTOFFSET; - - offset_bits += RANGELEN; - if (offset_bits >= 32) { - this_word = next_word; - hs->offset += 4; - code = huff_get_next_word(hs, hs->offset + 4, &next_word); - if (code < 0) { - return jbig2_error(hs->ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to get next huffman word"); - } - offset_bits -= 32; - hs->next_word = next_word; - RANGELEN = offset_bits; - } - if (RANGELEN) - this_word = (this_word << RANGELEN) | (next_word >> (32 - offset_bits)); - } - - hs->this_word = this_word; - hs->offset_bits = offset_bits; - - if (oob != NULL) - *oob = (flags & JBIG2_HUFFMAN_FLAGS_ISOOB); - - return result; -} - -/* TODO: more than 8 bits here is wasteful of memory. We have support - for sub-trees in jbig2_huffman_get() above, but don't use it here. - We should, and then revert to 8 bits */ -#define LOG_TABLE_SIZE_MAX 16 - -/** Build an in-memory representation of a Huffman table from the - * set of template params provided by the spec or a table segment - */ -Jbig2HuffmanTable * -jbig2_build_huffman_table(Jbig2Ctx *ctx, const Jbig2HuffmanParams *params) -{ - int *LENCOUNT; - int LENMAX = -1; - const int lencountcount = 256; - const Jbig2HuffmanLine *lines = params->lines; - int n_lines = params->n_lines; - int i, j; - uint32_t max_j; - int log_table_size = 0; - Jbig2HuffmanTable *result; - Jbig2HuffmanEntry *entries; - int CURLEN; - int firstcode = 0; - int CURCODE; - int CURTEMP; - - LENCOUNT = jbig2_new(ctx, int, lencountcount); - - if (LENCOUNT == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to allocate huffman histogram"); - return NULL; - } - memset(LENCOUNT, 0, sizeof(int) * lencountcount); - - /* B.3, 1. */ - for (i = 0; i < params->n_lines; i++) { - int PREFLEN = lines[i].PREFLEN; - int lts; - - if (PREFLEN > LENMAX) { - for (j = LENMAX + 1; j < PREFLEN + 1; j++) - LENCOUNT[j] = 0; - LENMAX = PREFLEN; - } - LENCOUNT[PREFLEN]++; - - lts = PREFLEN + lines[i].RANGELEN; - if (lts > LOG_TABLE_SIZE_MAX) - lts = PREFLEN; - if (lts <= LOG_TABLE_SIZE_MAX && log_table_size < lts) - log_table_size = lts; - } - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, JBIG2_UNKNOWN_SEGMENT_NUMBER, "constructing huffman table log size %d", log_table_size); - max_j = 1 << log_table_size; - - result = jbig2_new(ctx, Jbig2HuffmanTable, 1); - if (result == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to allocate result"); - jbig2_free(ctx->allocator, LENCOUNT); - return NULL; - } - result->log_table_size = log_table_size; - entries = jbig2_new(ctx, Jbig2HuffmanEntry, max_j); - if (entries == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to allocate result entries"); - jbig2_free(ctx->allocator, result); - jbig2_free(ctx->allocator, LENCOUNT); - return NULL; - } - /* fill now to catch missing JBIG2Globals later */ - memset(entries, 0xFF, sizeof(Jbig2HuffmanEntry) * max_j); - result->entries = entries; - - LENCOUNT[0] = 0; - - for (CURLEN = 1; CURLEN <= LENMAX; CURLEN++) { - int shift = log_table_size - CURLEN; - - /* B.3 3.(a) */ - firstcode = (firstcode + LENCOUNT[CURLEN - 1]) << 1; - CURCODE = firstcode; - /* B.3 3.(b) */ - for (CURTEMP = 0; CURTEMP < n_lines; CURTEMP++) { - int PREFLEN = lines[CURTEMP].PREFLEN; - - if (PREFLEN == CURLEN) { - int RANGELEN = lines[CURTEMP].RANGELEN; - uint32_t start_j = CURCODE << shift; - uint32_t end_j = (CURCODE + 1) << shift; - uint32_t cur_j; - byte eflags = 0; - - if (end_j > max_j) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "ran off the end of the entries table! (%d >= %d)", end_j, max_j); - jbig2_free(ctx->allocator, result->entries); - jbig2_free(ctx->allocator, result); - jbig2_free(ctx->allocator, LENCOUNT); - return NULL; - } - /* todo: build extension tables */ - if (params->HTOOB && CURTEMP == n_lines - 1) - eflags |= JBIG2_HUFFMAN_FLAGS_ISOOB; - if (CURTEMP == n_lines - (params->HTOOB ? 3 : 2)) - eflags |= JBIG2_HUFFMAN_FLAGS_ISLOW; - if (PREFLEN + RANGELEN > LOG_TABLE_SIZE_MAX) { - for (cur_j = start_j; cur_j < end_j; cur_j++) { - entries[cur_j].u.RANGELOW = lines[CURTEMP].RANGELOW; - entries[cur_j].PREFLEN = PREFLEN; - entries[cur_j].RANGELEN = RANGELEN; - entries[cur_j].flags = eflags; - } - } else { - for (cur_j = start_j; cur_j < end_j; cur_j++) { - int32_t HTOFFSET = (cur_j >> (shift - RANGELEN)) & ((1 << RANGELEN) - 1); - - if (eflags & JBIG2_HUFFMAN_FLAGS_ISLOW) - entries[cur_j].u.RANGELOW = lines[CURTEMP].RANGELOW - HTOFFSET; - else - entries[cur_j].u.RANGELOW = lines[CURTEMP].RANGELOW + HTOFFSET; - entries[cur_j].PREFLEN = PREFLEN + RANGELEN; - entries[cur_j].RANGELEN = 0; - entries[cur_j].flags = eflags; - } - } - CURCODE++; - } - } - } - - jbig2_free(ctx->allocator, LENCOUNT); - - return result; -} - -/** Free the memory associated with the representation of table */ -void -jbig2_release_huffman_table(Jbig2Ctx *ctx, Jbig2HuffmanTable *table) -{ - if (table != NULL) { - jbig2_free(ctx->allocator, table->entries); - jbig2_free(ctx->allocator, table); - } -} - -/* Routines to handle "code table segment (53)" */ - -/* return 'bitlen' bits from 'bitoffset' of 'data' */ -static uint32_t -jbig2_table_read_bits(const byte *data, size_t *bitoffset, const int bitlen) -{ - uint32_t result = 0; - uint32_t byte_offset = *bitoffset / 8; - const int endbit = (*bitoffset & 7) + bitlen; - const int n_proc_bytes = (endbit + 7) / 8; - const int rshift = n_proc_bytes * 8 - endbit; - int i; - - for (i = n_proc_bytes - 1; i >= 0; i--) { - uint32_t d = data[byte_offset++]; - const int nshift = i * 8 - rshift; - - if (nshift > 0) - d <<= nshift; - else if (nshift < 0) - d >>= -nshift; - result |= d; - } - result &= ~(-1 << bitlen); - *bitoffset += bitlen; - return result; -} - -/* Parse a code table segment, store Jbig2HuffmanParams in segment->result */ -int -jbig2_table(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data) -{ - Jbig2HuffmanParams *params = NULL; - Jbig2HuffmanLine *line = NULL; - - segment->result = NULL; - if (segment->data_length < 10) - goto too_short; - - { - /* B.2 1) (B.2.1) Code table flags */ - const int code_table_flags = segment_data[0]; - const int HTOOB = code_table_flags & 0x01; /* Bit 0: HTOOB */ - - /* Bits 1-3: Number of bits used in code table line prefix size fields */ - const int HTPS = (code_table_flags >> 1 & 0x07) + 1; - - /* Bits 4-6: Number of bits used in code table line range size fields */ - const int HTRS = (code_table_flags >> 4 & 0x07) + 1; - - /* B.2 2) (B.2.2) The lower bound of the first table line in the encoded table */ - const int32_t HTLOW = jbig2_get_int32(segment_data + 1); - - /* B.2 3) (B.2.3) One larger than the upper bound of - the last normal table line in the encoded table */ - const int32_t HTHIGH = jbig2_get_int32(segment_data + 5); - - /* estimated number of lines in this table, used for allocating memory for lines */ - const size_t lines_max = (segment->data_length * 8 - HTPS * (HTOOB ? 3 : 2)) / (HTPS + HTRS) + (HTOOB ? 3 : 2); - - /* points to a first table line data */ - const byte *lines_data = segment_data + 9; - const size_t lines_data_bitlen = (segment->data_length - 9) * 8; /* length in bit */ - - /* bit offset: controls bit reading */ - size_t boffset = 0; - - /* B.2 4) */ - int32_t CURRANGELOW = HTLOW; - size_t NTEMP = 0; - -#ifdef JBIG2_DEBUG - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, - "DECODING USER TABLE... Flags: %d, HTOOB: %d, HTPS: %d, HTRS: %d, HTLOW: %d, HTHIGH: %d", - code_table_flags, HTOOB, HTPS, HTRS, HTLOW, HTHIGH); -#endif - - if (HTLOW >= HTHIGH) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "invalid Huffman Table range"); - goto error_exit; - } - - /* allocate HuffmanParams & HuffmanLine */ - params = jbig2_new(ctx, Jbig2HuffmanParams, 1); - if (params == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to allocate Huffman Table Parameter"); - goto error_exit; - } - line = jbig2_new(ctx, Jbig2HuffmanLine, lines_max); - if (line == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to allocate huffman table lines"); - goto error_exit; - } - /* B.2 5) */ - while (CURRANGELOW < HTHIGH) { - /* B.2 5) a) */ - if (boffset + HTPS >= lines_data_bitlen) - goto too_short; - line[NTEMP].PREFLEN = jbig2_table_read_bits(lines_data, &boffset, HTPS); - /* B.2 5) b) */ - if (boffset + HTRS >= lines_data_bitlen) - goto too_short; - line[NTEMP].RANGELEN = jbig2_table_read_bits(lines_data, &boffset, HTRS); - /* B.2 5) c) */ - line[NTEMP].RANGELOW = CURRANGELOW; - CURRANGELOW += (1 << line[NTEMP].RANGELEN); - NTEMP++; - } - /* B.2 6), B.2 7) lower range table line */ - if (boffset + HTPS >= lines_data_bitlen) - goto too_short; - line[NTEMP].PREFLEN = jbig2_table_read_bits(lines_data, &boffset, HTPS); - line[NTEMP].RANGELEN = 32; - line[NTEMP].RANGELOW = HTLOW - 1; - NTEMP++; - /* B.2 8), B.2 9) upper range table line */ - if (boffset + HTPS >= lines_data_bitlen) - goto too_short; - line[NTEMP].PREFLEN = jbig2_table_read_bits(lines_data, &boffset, HTPS); - line[NTEMP].RANGELEN = 32; - line[NTEMP].RANGELOW = HTHIGH; - NTEMP++; - /* B.2 10) */ - if (HTOOB) { - /* B.2 10) a), B.2 10) b) out-of-bound table line */ - if (boffset + HTPS >= lines_data_bitlen) - goto too_short; - line[NTEMP].PREFLEN = jbig2_table_read_bits(lines_data, &boffset, HTPS); - line[NTEMP].RANGELEN = 0; - line[NTEMP].RANGELOW = 0; - NTEMP++; - } - if (NTEMP != lines_max) { - Jbig2HuffmanLine *new_line = jbig2_renew(ctx, line, - Jbig2HuffmanLine, NTEMP); - - if (new_line == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to reallocate huffman table lines"); - goto error_exit; - } - line = new_line; - } - params->HTOOB = HTOOB; - params->n_lines = NTEMP; - params->lines = line; - segment->result = params; - -#ifdef JBIG2_DEBUG - { - int i; - - for (i = 0; i < NTEMP; i++) { - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, - "Line: %d, PREFLEN: %d, RANGELEN: %d, RANGELOW: %d", - i, params->lines[i].PREFLEN, params->lines[i].RANGELEN, params->lines[i].RANGELOW); - } - } -#endif - } - return 0; - -too_short: - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short"); -error_exit: - jbig2_free(ctx->allocator, line); - jbig2_free(ctx->allocator, params); - return -1; -} - -/* free Jbig2HuffmanParams allocated by jbig2_huffman_table() */ -void -jbig2_table_free(Jbig2Ctx *ctx, Jbig2HuffmanParams *params) -{ - if (params != NULL) { - jbig2_free(ctx->allocator, (void *)params->lines); - jbig2_free(ctx->allocator, params); - } -} - -/* find a user supplied table used by 'segment' and by 'index' */ -const Jbig2HuffmanParams * -jbig2_find_table(Jbig2Ctx *ctx, Jbig2Segment *segment, int index) -{ - int i, table_index = 0; - - for (i = 0; i < segment->referred_to_segment_count; i++) { - const Jbig2Segment *const rsegment = jbig2_find_segment(ctx, segment->referred_to_segments[i]); - - if (rsegment && (rsegment->flags & 63) == 53) { - if (table_index == index) - return (const Jbig2HuffmanParams *)rsegment->result; - ++table_index; - } - } - - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "huffman table not found (%d)", index); - return NULL; -} - -#ifdef TEST -#include - -/* cc -g -o jbig2_huffman.test1 -DTEST jbig2_huffman.c .libs/libjbig2dec.a */ - -/* a test bitstream, and a list of the table indices - to use in decoding it. 1 = table B.1 (A), 2 = table B.2 (B), and so on */ -/* this test stream should decode to { 8, 5, oob, 8 } */ - -static const byte test_stream[] = { 0xe9, 0xcb, 0xf4, 0x00 }; -static const byte test_tabindex[] = { 4, 2, 2, 1 }; - -static int -test_get_word1(Jbig2Ctx *ctx, Jbig2WordStream *self, size_t offset, uint32_t *word) -{ - uint32_t val = 0; - int ret = 0; - - if (self == NULL || word == NULL) - return -1; - if (offset >= sizeof (test_stream)) - return 0; - - if (offset < sizeof(test_stream)) { - val |= test_stream[offset] << 24; - ret++; - } - if (offset + 1 < sizeof(test_stream)) { - val |= test_stream[offset + 1] << 16; - ret++; - } - if (offset + 2 < sizeof(test_stream)) { - val |= test_stream[offset + 2] << 8; - ret++; - } - if (offset + 3 < sizeof(test_stream)) { - val |= test_stream[offset + 3]; - ret++; - } - *word = val; - return ret; -} - -static int test1() -{ - Jbig2Ctx *ctx; - Jbig2HuffmanTable *tables[5]; - Jbig2HuffmanState *hs = NULL; - Jbig2WordStream ws; - bool oob; - int32_t code; - int i; - int success = 0; - - ctx = jbig2_ctx_new(NULL, 0, NULL, NULL, NULL); - if (ctx == NULL) { - fprintf(stderr, "Failed to allocate jbig2 context\n"); - goto cleanup; - } - - tables[0] = NULL; - tables[1] = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_A); - tables[2] = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_B); - tables[3] = NULL; - tables[4] = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_D); - if (tables[1] == NULL || tables[2] == NULL || tables[4] == NULL) - { - fprintf(stderr, "Failed to build huffman tables"); - goto cleanup; - } - - ws.get_next_word = test_get_word1; - hs = jbig2_huffman_new(ctx, &ws); - if (hs == NULL) { - fprintf(stderr, "Failed to allocate huffman state"); - goto cleanup; - } - - printf("testing jbig2 huffman decoding..."); - printf("\t(should be 8 5 (oob) 8)\n"); - - { - int i; - int sequence_length = sizeof(test_tabindex); - - for (i = 0; i < sequence_length; i++) { - code = jbig2_huffman_get(hs, tables[test_tabindex[i]], &oob); - if (oob) - printf("(oob) "); - else - printf("%d ", code); - } - } - - printf("\n"); - - success = 1; - -cleanup: - jbig2_huffman_free(ctx, hs); - for (i = 0; i < 5; i++) - jbig2_release_huffman_table(ctx, tables[i]); - jbig2_ctx_free(ctx); - - return success; -} - -#include - -/* a decoding test of each line from each standard table */ - -/* test code for Table B.1 - Standard Huffman table A */ -const int32_t test_output_A[] = { - /* line 0, PREFLEN=1, RANGELEN=4, VAL=0..15, 0+VAL */ - 0, /* 0 0000 */ - 1, /* 0 0001 */ - 14, /* 0 1110 */ - 15, /* 0 1111 */ - /* line 1, PREFLEN=2, RANGELEN=8, VAL=16..271, 10+(VAL-16) */ - 16, /* 10 00000000 */ - 17, /* 10 00000001 */ - 270, /* 10 11111110 */ - 271, /* 10 11111111 */ - /* line 2, PREFLEN=3, RANGELEN=16, VAL=272..65807, 110+(VAL-272) */ - 272, /* 110 00000000 00000000 */ - 273, /* 110 00000000 00000001 */ - 65806, /* 110 11111111 11111110 */ - 65807, /* 110 11111111 11111111 */ - /* line 3, PREFLEN=3, RANGELEN=32, VAL=65808..INF, 111+(VAL-65808) */ - 65808, /* 111 00000000 00000000 00000000 00000000 */ - 65809, /* 111 00000000 00000000 00000000 00000001 */ -}; -const byte test_input_A[] = { - /* 0000 0000 0101 1100 1111 1000 0000 0010 */ - 0x00, 0x5c, 0xf8, 0x02, - /* 0000 0001 1011 1111 1010 1111 1111 1100 */ - 0x01, 0xbf, 0xaf, 0xfc, - /* 0000 0000 0000 0001 1000 0000 0000 0000 */ - 0x00, 0x01, 0x80, 0x00, - /* 0111 0111 1111 1111 1111 0110 1111 1111 */ - 0x77, 0xff, 0xf6, 0xff, - /* 1111 1111 1110 0000 0000 0000 0000 0000 */ - 0xff, 0xe0, 0x00, 0x00, - /* 0000 0000 0001 1100 0000 0000 0000 0000 */ - 0x00, 0x1c, 0x00, 0x00, - /* 0000 0000 0000 01 */ - 0x00, 0x04, -}; - -/* test code for Table B.2 - Standard Huffman table B */ -const int32_t test_output_B[] = { - /* line 0, PREFLEN=1, RANGELEN=0, VAL=0, 0 */ - 0, /* 0 */ - /* line 1, PREFLEN=2, RANGELEN=0, VAL=1, 10 */ - 1, /* 10 */ - /* line 2, PREFLEN=3, RANGELEN=0, VAL=2, 110 */ - 2, /* 110 */ - /* line 3, PREFLEN=4, RANGELEN=3, VAL=3..10, 1110+(VAL-3) */ - 3, /* 1110 000 */ - 4, /* 1110 001 */ - 9, /* 1110 110 */ - 10, /* 1110 111 */ - /* line 4, PREFLEN=5, RANGELEN=6, VAL=11..74, 11110+(VAL-11) */ - 11, /* 11110 000000 */ - 12, /* 11110 000001 */ - 73, /* 11110 111110 */ - 74, /* 11110 111111 */ - /* line 5, PREFLEN=6, RANGELEN=32, VAL=75..INF, 111110+(VAL-75) */ - 75, /* 111110 00000000 00000000 00000000 00000000 */ - 76, /* 111110 00000000 00000000 00000000 00000001 */ - /* line 6, PREFLEN=6, VAL=OOB, 111111 */ - /*OOB*/ /* 111111 */ -}; -const byte test_input_B[] = { - /* 0101 1011 1000 0111 0001 1110 1101 1101 */ - 0x5b, 0x87, 0x1e, 0xdd, - /* 1111 1100 0000 0111 1000 0001 1111 0111 */ - 0xfc, 0x07, 0x81, 0xf7, - /* 1101 1110 1111 1111 1110 0000 0000 0000 */ - 0xde, 0xff, 0xe0, 0x00, - /* 0000 0000 0000 0000 0000 1111 1000 0000 */ - 0x00, 0x00, 0x0f, 0x80, - /* 0000 0000 0000 0000 0000 0000 0111 1111 */ - 0x00, 0x00, 0x00, 0x7f, -}; - -/* test code for Table B.3 - Standard Huffman table C */ -const int32_t test_output_C[] = { - /* line 0, PREFLEN=8, RANGELEN=8, VAL=-256..-1, 11111110+(VAL+256) */ - -256, /* 11111110 00000000 */ - -255, /* 11111110 00000001 */ - -2, /* 11111110 11111110 */ - -1, /* 11111110 11111111 */ - /* line 1, PREFLEN=1, RANGELEN=0, VAL=0, 0 */ - 0, /* 0 */ - /* line 2, PREFLEN=2, RANGELEN=0, VAL=1, 10 */ - 1, /* 10 */ - /* line 3, PREFLEN=3, RANGELEN=0, VAL=2, 110 */ - 2, /* 110 */ - /* line 4, PREFLEN=4, RANGELEN=3, VAL=3..10, 1110+(VAL-3) */ - 3, /* 1110 000 */ - 4, /* 1110 001 */ - 9, /* 1110 110 */ - 10, /* 1110 111 */ - /* line 5, PREFLEN=5, RANGELEN=6, VAL=11..74, 11110+(VAL-11) */ - 11, /* 11110 000000 */ - 12, /* 11110 000001 */ - 73, /* 11110 111110 */ - 74, /* 11110 111111 */ - /* line 6, PREFLEN=8, RANGELEN=32, VAL=-INF..-257, 11111111+(-257-VAL) */ - -257, /* 11111111 00000000 00000000 00000000 00000000 */ - -258, /* 11111111 00000000 00000000 00000000 00000001 */ - /* line 7, PREFLEN=7, RANGELEN=32, VAL=75..INF, 1111110+(VAL-75) */ - 75, /* 1111110 00000000 00000000 00000000 00000000 */ - 76, /* 1111110 00000000 00000000 00000000 00000001 */ - /* line 8, PREFLEN=6, VAL=OOB, 111110 */ - /*OOB*/ /* 111110 */ -}; -const byte test_input_C[] = { - /* 1111 1110 0000 0000 1111 1110 0000 0001 */ - 0xfe, 0x00, 0xfe, 0x01, - /* 1111 1110 1111 1110 1111 1110 1111 1111 */ - 0xfe, 0xfe, 0xfe, 0xff, - /* 0101 1011 1000 0111 0001 1110 1101 1101 */ - 0x5b, 0x87, 0x1e, 0xdd, - /* 1111 1100 0000 0111 1000 0001 1111 0111 */ - 0xfc, 0x07, 0x81, 0xf7, - /* 1101 1110 1111 1111 1111 1100 0000 0000 */ - 0xde, 0xff, 0xfc, 0x00, - /* 0000 0000 0000 0000 0000 0011 1111 1100 */ - 0x00, 0x00, 0x03, 0xfc, - /* 0000 0000 0000 0000 0000 0000 0000 0111 */ - 0x00, 0x00, 0x00, 0x07, - /* 1111 0000 0000 0000 0000 0000 0000 0000 */ - 0xf0, 0x00, 0x00, 0x00, - /* 0000 0111 1110 0000 0000 0000 0000 0000 */ - 0x07, 0xe0, 0x00, 0x00, - /* 0000 0000 0001 1111 10 */ - 0x00, 0x1f, 0x80, -}; - -/* test code for Table B.4 - Standard Huffman table D */ -const int32_t test_output_D[] = { - /* line 0, PREFLEN=1, RANGELEN=0, VAL=1, 0 */ - 1, /* 0 */ - /* line 1, PREFLEN=2, RANGELEN=0, VAL=2, 10 */ - 2, /* 10 */ - /* line 2, PREFLEN=3, RANGELEN=0, VAL=3, 110 */ - 3, /* 110 */ - /* line 3, PREFLEN=4, RANGELEN=3, VAL=4..11, 1110+(VAL-4) */ - 4, /* 1110 000 */ - 5, /* 1110 001 */ - 10, /* 1110 110 */ - 11, /* 1110 111 */ - /* line 4, PREFLEN=5, RANGELEN=6, VAL=12..75, 11110+(VAL-12) */ - 12, /* 11110 000000 */ - 13, /* 11110 000001 */ - 74, /* 11110 111110 */ - 75, /* 11110 111111 */ - /* line 5, PREFLEN=5, RANGELEN=32, VAL=76..INF, 11111+(VAL-76) */ - 76, /* 11111 00000000 00000000 00000000 00000000 */ - 77, /* 11111 00000000 00000000 00000000 00000001 */ -}; -const byte test_input_D[] = { - /* 0101 1011 1000 0111 0001 1110 1101 1101 */ - 0x5b, 0x87, 0x1e, 0xdd, - /* 1111 1100 0000 0111 1000 0001 1111 0111 */ - 0xfc, 0x07, 0x81, 0xf7, - /* 1101 1110 1111 1111 1110 0000 0000 0000 */ - 0xde, 0xff, 0xe0, 0x00, - /* 0000 0000 0000 0000 0001 1111 0000 0000 */ - 0x00, 0x00, 0x1f, 0x00, - /* 0000 0000 0000 0000 0000 0001 */ - 0x00, 0x00, 0x01, -}; - -/* test code for Table B.5 - Standard Huffman table E */ -const int32_t test_output_E[] = { - /* line 0, PREFLEN=7, RANGELEN=8, VAL=-255..0, 1111110+(VAL+255) */ - -255, /* 1111110 00000000 */ - -254, /* 1111110 00000001 */ - -1, /* 1111110 11111110 */ - 0, /* 1111110 11111111 */ - /* line 1, PREFLEN=1, RANGELEN=0, VAL=1, 0 */ - 1, /* 0 */ - /* line 2, PREFLEN=2, RANGELEN=0, VAL=2, 10 */ - 2, /* 10 */ - /* line 3, PREFLEN=3, RANGELEN=0, VAL=3, 110 */ - 3, /* 110 */ - /* line 4, PREFLEN=4, RANGELEN=3, VAL=4..11, 1110+(VAL-4) */ - 4, /* 1110 000 */ - 5, /* 1110 001 */ - 10, /* 1110 110 */ - 11, /* 1110 111 */ - /* line 5, PREFLEN=5, RANGELEN=6, VAL=12..75, 11110+(VAL-12) */ - 12, /* 11110 000000 */ - 13, /* 11110 000001 */ - 74, /* 11110 111110 */ - 75, /* 11110 111111 */ - /* line 6, PREFLEN=7, RANGELEN=32, VAL=-INF..-256, 1111111+(-256-VAL) */ - -256, /* 1111111 00000000 00000000 00000000 00000000 */ - -257, /* 1111111 00000000 00000000 00000000 00000001 */ - /* line 6, PREFLEN=6, RANGELEN=32, VAL=76..INF, 111110+(VAL-76) */ - 76, /* 111110 00000000 00000000 00000000 00000000 */ - 77, /* 111110 00000000 00000000 00000000 00000001 */ -}; -const byte test_input_E[] = { - /* 1111 1100 0000 0001 1111 1000 0000 0111 */ - 0xfc, 0x01, 0xf8, 0x07, - /* 1111 0111 1111 0111 1110 1111 1111 0101 */ - 0xf7, 0xf7, 0xef, 0xf5, - /* 1011 1000 0111 0001 1110 1101 1101 1111 */ - 0xb8, 0x71, 0xed, 0xdf, - /* 1100 0000 0111 1000 0001 1111 0111 1101 */ - 0xc0, 0x78, 0x1f, 0x7d, - /* 1110 1111 1111 1111 1000 0000 0000 0000 */ - 0xef, 0xff, 0x80, 0x00, - /* 0000 0000 0000 0000 0111 1111 0000 0000 */ - 0x00, 0x00, 0x7f, 0x00, - /* 0000 0000 0000 0000 0000 0001 1111 1000 */ - 0x00, 0x00, 0x01, 0xf8, - /* 0000 0000 0000 0000 0000 0000 0000 0011 */ - 0x00, 0x00, 0x00, 0x03, - /* 1110 0000 0000 0000 0000 0000 0000 0000 */ - 0xe0, 0x00, 0x00, 0x00, - /* 0001 */ - 0x10, -}; - -/* test code for Table B.6 - Standard Huffman table F */ -const int32_t test_output_F[] = { - /* line 0, PREFLEN=5, RANGELEN=10, VAL=-2048..-1025, 11100+(VAL+2048) */ - -2048, /* 11100 00000000 00 */ - -2047, /* 11100 00000000 01 */ - -1026, /* 11100 11111111 10 */ - -1025, /* 11100 11111111 11 */ - /* line 1, PREFLEN=4, RANGELEN=9, VAL=-1024..-513, 1000+(VAL+1024) */ - -1024, /* 1000 00000000 0 */ - -1023, /* 1000 00000000 1 */ - -514, /* 1000 11111111 0 */ - -513, /* 1000 11111111 1 */ - /* line 2, PREFLEN=4, RANGELEN=8, VAL=-512..-257, 1001+(VAL+512) */ - -512, /* 1001 00000000 */ - -511, /* 1001 00000001 */ - -258, /* 1001 11111110 */ - -257, /* 1001 11111111 */ - /* line 3, PREFLEN=4, RANGELEN=7, VAL=-256..-129, 1010+(VAL+256) */ - -256, /* 1010 0000000 */ - -255, /* 1010 0000001 */ - -130, /* 1010 1111110 */ - -129, /* 1010 1111111 */ - /* line 4, PREFLEN=5, RANGELEN=6, VAL=-128..-65, 11101+(VAL+128) */ - -128, /* 11101 000000 */ - -127, /* 11101 000001 */ - -66, /* 11101 111110 */ - -65, /* 11101 111111 */ - /* line 5, PREFLEN=5, RANGELEN=5, VAL=-64..-33, 11110+(VAL+64) */ - -64, /* 11110 00000 */ - -63, /* 11110 00001 */ - -34, /* 11110 11110 */ - -33, /* 11110 11111 */ - /* line 6, PREFLEN=4, RANGELEN=5, VAL=-32..-1, 1011+(VAL+32) */ - -32, /* 1011 00000 */ - -31, /* 1011 00001 */ - -2, /* 1011 11110 */ - -1, /* 1011 11111 */ - /* line 7, PREFLEN=2, RANGELEN=7, VAL=0..127, 00+VAL */ - 0, /* 00 0000000 */ - 1, /* 00 0000001 */ - 126, /* 00 1111110 */ - 127, /* 00 1111111 */ - /* line 8, PREFLEN=3, RANGELEN=7, VAL=128..255, 010+(VAL-128) */ - 128, /* 010 0000000 */ - 129, /* 010 0000001 */ - 254, /* 010 1111110 */ - 255, /* 010 1111111 */ - /* line 9, PREFLEN=3, RANGELEN=8, VAL=256..511, 011+(VAL-256) */ - 256, /* 011 00000000 */ - 257, /* 011 00000001 */ - 510, /* 011 11111110 */ - 511, /* 011 11111111 */ - /* line 10, PREFLEN=4, RANGELEN=9, VAL=512..1023, 1100+(VAL-512) */ - 512, /* 1100 00000000 0 */ - 513, /* 1100 00000000 1 */ - 1022, /* 1100 11111111 0 */ - 1023, /* 1100 11111111 1 */ - /* line 11, PREFLEN=4, RANGELEN=10, VAL=1024..2047, 1101+(VAL-1024) */ - 1024, /* 1101 00000000 00 */ - 1025, /* 1101 00000000 01 */ - 2046, /* 1101 11111111 10 */ - 2047, /* 1101 11111111 11 */ - /* line 12, PREFLEN=6, RANGELEN=32, VAL=-INF..-2049, 111110+(-2049-VAL) */ - -2049, /* 111110 00000000 00000000 00000000 00000000 */ - -2050, /* 111110 00000000 00000000 00000000 00000001 */ - /* line 13, PREFLEN=6, RANGELEN=32, VAL=2048..INF, 111111+(VAL-2048) */ - 2048, /* 111111 00000000 00000000 00000000 00000000 */ - 2049, /* 111111 00000000 00000000 00000000 00000001 */ -}; -const byte test_input_F[] = { - /* 1110 0000 0000 0001 1100 0000 0000 0111 */ - 0xe0, 0x01, 0xc0, 0x07, - /* 1001 1111 1111 0111 0011 1111 1111 1000 */ - 0x9f, 0xf7, 0x3f, 0xf8, - /* 0000 0000 0100 0000 0000 0110 0011 1111 */ - 0x00, 0x40, 0x06, 0x3f, - /* 1101 0001 1111 1111 1001 0000 0000 1001 */ - 0xd1, 0xff, 0x90, 0x09, - /* 0000 0001 1001 1111 1110 1001 1111 1111 */ - 0x01, 0x9f, 0xe9, 0xff, - /* 1010 0000 0001 0100 0000 0110 1011 1111 */ - 0xa0, 0x14, 0x06, 0xbf, - /* 0101 0111 1111 1110 1000 0001 1101 0000 */ - 0x57, 0xfe, 0x81, 0xd0, - /* 0111 1011 1111 0111 0111 1111 1111 0000 */ - 0x7b, 0xf7, 0x7f, 0xf0, - /* 0011 1100 0001 1111 0111 1011 1101 1111 */ - 0x3c, 0x1f, 0x7b, 0xdf, - /* 1011 0000 0101 1000 0110 1111 1101 0111 */ - 0xb0, 0x58, 0x6f, 0xd7, - /* 1111 0000 0000 0000 0000 0100 1111 1100 */ - 0xf0, 0x00, 0x04, 0xfc, - /* 0111 1111 0100 0000 0001 0000 0001 0101 */ - 0x7f, 0x40, 0x10, 0x15, - /* 1111 1001 0111 1111 0110 0000 0000 1100 */ - 0xf9, 0x7f, 0x60, 0x0c, - /* 0000 0101 1111 1111 0011 1111 1111 1100 */ - 0x05, 0xff, 0x3f, 0xfc, - /* 0000 0000 0110 0000 0000 0111 0011 1111 */ - 0x00, 0x60, 0x07, 0x3f, - /* 1101 1001 1111 1111 1101 0000 0000 0011 */ - 0xd9, 0xff, 0xd0, 0x03, - /* 0100 0000 0001 1101 1111 1111 1011 0111 */ - 0x40, 0x1d, 0xff, 0xb7, - /* 1111 1111 1111 1000 0000 0000 0000 0000 */ - 0xff, 0xf8, 0x00, 0x00, - /* 0000 0000 0000 0011 1110 0000 0000 0000 */ - 0x00, 0x03, 0xe0, 0x00, - /* 0000 0000 0000 0000 0001 1111 1100 0000 */ - 0x00, 0x00, 0x1f, 0xc0, - /* 0000 0000 0000 0000 0000 0000 0011 1111 */ - 0x00, 0x00, 0x00, 0x3f, - /* 0000 0000 0000 0000 0000 0000 0000 0001 */ - 0x00, 0x00, 0x00, 0x01, -}; - -/* test code for Table B.7 - Standard Huffman table G */ -const int32_t test_output_G[] = { - /* line 0, PREFLEN=4, RANGELEN=9, VAL=-1024..-513, 1000+(VAL+1024) */ - -1024, /* 1000 00000000 0 */ - -1023, /* 1000 00000000 1 */ - -514, /* 1000 11111111 0 */ - -513, /* 1000 11111111 1 */ - /* line 1, PREFLEN=3, RANGELEN=8, VAL=-512..-257, 000+(VAL+512) */ - -512, /* 000 00000000 */ - -511, /* 000 00000001 */ - -258, /* 000 11111110 */ - -257, /* 000 11111111 */ - /* line 2, PREFLEN=4, RANGELEN=7, VAL=-256..-129, 1001+(VAL+256) */ - -256, /* 1001 0000000 */ - -255, /* 1001 0000001 */ - -130, /* 1001 1111110 */ - -129, /* 1001 1111111 */ - /* line 3, PREFLEN=5, RANGELEN=6, VAL=-128..-65, 11010+(VAL+128) */ - -128, /* 11010 000000 */ - -127, /* 11010 000001 */ - -66, /* 11010 111110 */ - -65, /* 11010 111111 */ - /* line 4, PREFLEN=5, RANGELEN=5, VAL=-64..-33, 11011+(VAL+64) */ - -64, /* 11011 00000 */ - -63, /* 11011 00001 */ - -34, /* 11011 11110 */ - -33, /* 11011 11111 */ - /* line 5, PREFLEN=4, RANGELEN=5, VAL=-32..-1, 1010+(VAL+32) */ - -32, /* 1010 00000 */ - -31, /* 1010 00001 */ - -2, /* 1010 11110 */ - -1, /* 1010 11111 */ - /* line 6, PREFLEN=4, RANGELEN=5, VAL=0..31, 1011+VAL */ - 0, /* 1011 00000 */ - 1, /* 1011 00001 */ - 30, /* 1011 11110 */ - 31, /* 1011 11111 */ - /* line 7, PREFLEN=5, RANGELEN=5, VAL=32..63, 11100+(VAL-32) */ - 32, /* 11100 00000 */ - 33, /* 11100 00001 */ - 62, /* 11100 11110 */ - 63, /* 11100 11111 */ - /* line 8, PREFLEN=5, RANGELEN=6, VAL=64..127, 11101+(VAL-64) */ - 64, /* 11101 000000 */ - 65, /* 11101 000001 */ - 126, /* 11101 111110 */ - 127, /* 11101 111111 */ - /* line 9, PREFLEN=4, RANGELEN=7, VAL=128..255, 1100+(VAL-128) */ - 128, /* 1100 0000000 */ - 129, /* 1100 0000001 */ - 254, /* 1100 1111110 */ - 255, /* 1100 1111111 */ - /* line 10, PREFLEN=3, RANGELEN=8, VAL=256..511, 001+(VAL-256) */ - 256, /* 001 00000000 */ - 257, /* 001 00000001 */ - 510, /* 001 11111110 */ - 511, /* 001 11111111 */ - /* line 11, PREFLEN=3, RANGELEN=9, VAL=512..1023, 010+(VAL-512) */ - 512, /* 010 00000000 0 */ - 513, /* 010 00000000 1 */ - 1022, /* 010 11111111 0 */ - 1023, /* 010 11111111 1 */ - /* line 12, PREFLEN=3, RANGELEN=10, VAL=1024..2047, 011+(VAL-1024) */ - 1024, /* 011 00000000 00 */ - 1025, /* 011 00000000 01 */ - 2046, /* 011 11111111 10 */ - 2047, /* 011 11111111 11 */ - /* line 13, PREFLEN=5, RANGELEN=32, VAL=-INF..-1025, 11110+(-1025-VAL) */ - -1025, /* 11110 00000000 00000000 00000000 00000000 */ - -1026, /* 11110 00000000 00000000 00000000 00000001 */ - /* line 14, PREFLEN=5, RANGELEN=32, VAL=2048..INF, 11111+(VAL-2048) */ - 2048, /* 11111 00000000 00000000 00000000 00000000 */ - 2049, /* 11111 00000000 00000000 00000000 00000001 */ -}; -const byte test_input_G[] = { - /* 1000 0000 0000 0100 0000 0000 0110 0011 */ - 0x80, 0x04, 0x00, 0x63, - /* 1111 1101 0001 1111 1111 0000 0000 0000 */ - 0xfd, 0x1f, 0xf0, 0x00, - /* 0000 0000 0100 0111 1111 0000 1111 1111 */ - 0x00, 0x47, 0xf0, 0xff, - /* 1001 0000 0001 0010 0000 0110 0111 1111 */ - 0x90, 0x12, 0x06, 0x7f, - /* 0100 1111 1111 1101 0000 0001 1010 0000 */ - 0x4f, 0xfd, 0x01, 0xa0, - /* 0111 0101 1111 0110 1011 1111 1101 1000 */ - 0x75, 0xf6, 0xbf, 0xd8, - /* 0011 0110 0001 1101 1111 1011 0111 1111 */ - 0x36, 0x1d, 0xfb, 0x7f, - /* 1010 0000 0101 0000 0110 1011 1101 0101 */ - 0xa0, 0x50, 0x6b, 0xd5, - /* 1111 1011 0000 0101 1000 0110 1111 1101 */ - 0xfb, 0x05, 0x86, 0xfd, - /* 0111 1111 1110 0000 0011 1000 0001 1110 */ - 0x7f, 0xe0, 0x38, 0x1e, - /* 0111 1011 1001 1111 1110 1000 0001 1101 */ - 0x7b, 0x9f, 0xe8, 0x1d, - /* 0000 0111 1011 1111 0111 0111 1111 1100 */ - 0x07, 0xbf, 0x77, 0xfc, - /* 0000 0001 1000 0000 0111 0011 1111 0110 */ - 0x01, 0x80, 0x73, 0xf6, - /* 0111 1111 0010 0000 0000 0100 0000 0100 */ - 0x7f, 0x20, 0x04, 0x04, - /* 1111 1111 0001 1111 1111 0100 0000 0000 */ - 0xff, 0x1f, 0xf4, 0x00, - /* 0100 0000 0001 0101 1111 1110 0101 1111 */ - 0x40, 0x15, 0xfe, 0x5f, - /* 1111 0110 0000 0000 0011 0000 0000 0101 */ - 0xf6, 0x00, 0x30, 0x05, - /* 1111 1111 1100 1111 1111 1111 1111 0000 */ - 0xff, 0xcf, 0xff, 0xf0, - /* 0000 0000 0000 0000 0000 0000 0000 0111 */ - 0x00, 0x00, 0x00, 0x07, - /* 1000 0000 0000 0000 0000 0000 0000 0000 */ - 0x80, 0x00, 0x00, 0x00, - /* 0111 1110 0000 0000 0000 0000 0000 0000 */ - 0x7e, 0x00, 0x00, 0x00, - /* 0000 0001 1111 0000 0000 0000 0000 0000 */ - 0x01, 0xf0, 0x00, 0x00, - /* 0000 0000 0001 */ - 0x00, 0x10, -}; - -/* test code for Table B.8 - Standard Huffman table H */ -const int32_t test_output_H[] = { - /* line 0, PREFLEN=8, RANGELEN=3, VAL=-15..-8, 11111100+(VAL+15) */ - -15, /* 11111100 000 */ - -14, /* 11111100 001 */ - -9, /* 11111100 110 */ - -8, /* 11111100 111 */ - /* line 1, PREFLEN=9, RANGELEN=1, VAL=-7..-6, 111111100+(VAL+7) */ - -7, /* 111111100 0 */ - -6, /* 111111100 1 */ - /* line 2, PREFLEN=8, RANGELEN=1, VAL=-5..-4, 11111101+(VAL+5) */ - -5, /* 11111101 0 */ - -4, /* 11111101 1 */ - /* line 3, PREFLEN=9, RANGELEN=0, VAL=-3, 111111101 */ - -3, /* 111111101 */ - /* line 4, PREFLEN=7, RANGELEN=0, VAL=-2, 1111100 */ - -2, /* 1111100 */ - /* line 5, PREFLEN=4, RANGELEN=0, VAL=-1, 1010 */ - -1, /* 1010 */ - /* line 6, PREFLEN=2, RANGELEN=1, VAL=0..1, 00+VAL */ - 0, /* 00 0 */ - 1, /* 00 1 */ - /* line 7, PREFLEN=5, RANGELEN=0, VAL=2, 11010 */ - 2, /* 11010 */ - /* line 8, PREFLEN=6, RANGELEN=0, VAL=3, 111010 */ - 3, /* 111010 */ - /* line 9, PREFLEN=3, RANGELEN=4, VAL=4..19, 100+(VAL-4) */ - 4, /* 100 0000 */ - 5, /* 100 0001 */ - 18, /* 100 1110 */ - 19, /* 100 1111 */ - /* line 10, PREFLEN=6, RANGELEN=1, VAL=20..21, 111011+(VAL-20) */ - 20, /* 111011 0 */ - 21, /* 111011 1 */ - /* line 11, PREFLEN=4, RANGELEN=4, VAL=22..37, 1011+(VAL-22) */ - 22, /* 1011 0000 */ - 23, /* 1011 0001 */ - 36, /* 1011 1110 */ - 37, /* 1011 1111 */ - /* line 12, PREFLEN=4, RANGELEN=5, VAL=38..69, 1100+(VAL-38) */ - 38, /* 1100 00000 */ - 39, /* 1100 00001 */ - 68, /* 1100 11110 */ - 69, /* 1100 11111 */ - /* line 13, PREFLEN=5, RANGELEN=6, VAL=70..133, 11011+(VAL-70) */ - 70, /* 11011 000000 */ - 71, /* 11011 000001 */ - 132, /* 11011 111110 */ - 133, /* 11011 111111 */ - /* line 14, PREFLEN=5, RANGELEN=7, VAL=134..261, 11100+(VAL-134) */ - 134, /* 11100 0000000 */ - 135, /* 11100 0000001 */ - 260, /* 11100 1111110 */ - 261, /* 11100 1111111 */ - /* line 15, PREFLEN=6, RANGELEN=7, VAL=262..389, 111100+(VAL-262) */ - 262, /* 111100 0000000 */ - 263, /* 111100 0000001 */ - 388, /* 111100 1111110 */ - 389, /* 111100 1111111 */ - /* line 16, PREFLEN=7, RANGELEN=8, VAL=390..645, 1111101+(VAL-390) */ - 390, /* 1111101 00000000 */ - 391, /* 1111101 00000001 */ - 644, /* 1111101 11111110 */ - 645, /* 1111101 11111111 */ - /* line 17, PREFLEN=6, RANGELEN=10, VAL=646..1669, 111101+(VAL-646) */ - 646, /* 111101 00000000 00 */ - 647, /* 111101 00000000 01 */ - 1668, /* 111101 11111111 10 */ - 1669, /* 111101 11111111 11 */ - /* line 18, PREFLEN=9, RANGELEN=32, VAL=-INF..-16, 111111110+(-16-VAL) */ - -16, /* 111111110 00000000 00000000 00000000 00000000 */ - -17, /* 111111110 00000000 00000000 00000000 00000001 */ - /* line 19, PREFLEN=9, RANGELEN=32, VAL=1670..INF, 111111111+(VAL-1670) */ - 1670, /* 111111111 00000000 00000000 00000000 00000000 */ - 1671, /* 111111111 00000000 00000000 00000000 00000001 */ - /* line 20, PREFLEN=2, VAL=OOB, 01 */ - /*OOB*/ /* 01 */ -}; -const byte test_input_H[] = { - /* 1111 1100 0001 1111 1000 0111 1111 0011 */ - 0xfc, 0x1f, 0x87, 0xf3, - /* 0111 1110 0111 1111 1110 0011 1111 1001 */ - 0x7e, 0x7f, 0xe3, 0xf9, - /* 1111 1101 0111 1110 1111 1111 1011 1111 */ - 0xfd, 0x7e, 0xff, 0xbf, - /* 0010 1000 0001 1101 0111 0101 0000 0010 */ - 0x28, 0x1d, 0x75, 0x02, - /* 0000 1100 1110 1001 1111 1101 1011 1011 */ - 0x0c, 0xe9, 0xfd, 0xbb, - /* 1101 1000 0101 1000 1101 1111 0101 1111 */ - 0xd8, 0x58, 0xdf, 0x5f, - /* 1110 0000 0011 0000 0011 1001 1110 1100 */ - 0xe0, 0x30, 0x39, 0xec, - /* 1111 1110 1100 0000 1101 1000 0011 1011 */ - 0xfe, 0xc0, 0xd8, 0x3b, - /* 1111 1011 0111 1111 1111 0000 0000 0111 */ - 0xfb, 0x7f, 0xf0, 0x07, - /* 0000 0000 1111 0011 1111 0111 0011 1111 */ - 0x00, 0xf3, 0xf7, 0x3f, - /* 1111 1000 0000 0011 1100 0000 0011 1110 */ - 0xf8, 0x03, 0xc0, 0x3e, - /* 0111 1110 1111 0011 1111 1111 1101 0000 */ - 0x7e, 0xf3, 0xff, 0xd0, - /* 0000 1111 1010 0000 0011 1111 0111 1111 */ - 0x0f, 0xa0, 0x3f, 0x7f, - /* 1011 1110 1111 1111 1111 1010 0000 0000 */ - 0xbe, 0xff, 0xfa, 0x00, - /* 0111 1010 0000 0000 1111 1011 1111 1111 */ - 0x7a, 0x00, 0xfb, 0xff, - /* 0111 1011 1111 1111 1111 1111 1000 0000 */ - 0x7b, 0xff, 0xff, 0x80, - /* 0000 0000 0000 0000 0000 0000 0011 1111 */ - 0x00, 0x00, 0x00, 0x3f, - /* 1100 0000 0000 0000 0000 0000 0000 0000 */ - 0xc0, 0x00, 0x00, 0x00, - /* 0011 1111 1111 0000 0000 0000 0000 0000 */ - 0x3f, 0xf0, 0x00, 0x00, - /* 0000 0000 0000 1111 1111 1000 0000 0000 */ - 0x00, 0x0f, 0xf8, 0x00, - /* 0000 0000 0000 0000 0000 101 */ - 0x00, 0x00, 0x0a, -}; - -/* test code for Table B.9 - Standard Huffman table I */ -const int32_t test_output_I[] = { - /* line 0, PREFLEN=8, RANGELEN=4, VAL=-31..-16, 11111100+(VAL+31) */ - -31, /* 11111100 0000 */ - -30, /* 11111100 0001 */ - -17, /* 11111100 1110 */ - -16, /* 11111100 1111 */ - /* line 1, PREFLEN=9, RANGELEN=2, VAL=-15..-12, 111111100+(VAL+15) */ - -15, /* 111111100 00 */ - -14, /* 111111100 01 */ - -13, /* 111111100 10 */ - -12, /* 111111100 11 */ - /* line 2, PREFLEN=8, RANGELEN=2, VAL=-11..-8, 11111101+(VAL+11) */ - -11, /* 11111101 00 */ - -10, /* 11111101 01 */ - -9, /* 11111101 10 */ - -8, /* 11111101 11 */ - /* line 3, PREFLEN=9, RANGELEN=1, VAL=-7..-6, 111111101+(VAL+7) */ - -7, /* 111111101 0 */ - -6, /* 111111101 1 */ - /* line 4, PREFLEN=7, RANGELEN=1, VAL=-5..-4, 1111100+(VAL+5) */ - -5, /* 1111100 0 */ - -4, /* 1111100 1 */ - /* line 5, PREFLEN=4, RANGELEN=1, VAL=-3..-2, 1010+(VAL+3) */ - -3, /* 1010 0 */ - -2, /* 1010 1 */ - /* line 6, PREFLEN=3, RANGELEN=1, VAL=-1..0, 010+(VAL+1) */ - -1, /* 010 0 */ - 0, /* 010 1 */ - /* line 7, PREFLEN=3, RANGELEN=1, VAL=1..2, 011+(VAL-1) */ - 1, /* 011 0 */ - 2, /* 011 1 */ - /* line 8, PREFLEN=5, RANGELEN=1, VAL=3..4, 11010+(VAL-3) */ - 3, /* 11010 0 */ - 4, /* 11010 1 */ - /* line 9, PREFLEN=6, RANGELEN=1, VAL=5..6, 111010+(VAL-5) */ - 5, /* 111010 0 */ - 6, /* 111010 1 */ - /* line 10, PREFLEN=3, RANGELEN=5, VAL=7..38, 100+(VAL-7) */ - 7, /* 100 00000 */ - 8, /* 100 00001 */ - 37, /* 100 11110 */ - 38, /* 100 11111 */ - /* line 11, PREFLEN=6, RANGELEN=2, VAL=39..42, 111011+(VAL-39) */ - 39, /* 111011 00 */ - 40, /* 111011 01 */ - 41, /* 111011 10 */ - 42, /* 111011 11 */ - /* line 12, PREFLEN=4, RANGELEN=5, VAL=43..74, 1011+(VAL-43) */ - 43, /* 1011 00000 */ - 44, /* 1011 00001 */ - 73, /* 1011 11110 */ - 74, /* 1011 11111 */ - /* line 13, PREFLEN=4, RANGELEN=6, VAL=75..138, 1100+(VAL-75) */ - 75, /* 1100 000000 */ - 76, /* 1100 000001 */ - 137, /* 1100 111110 */ - 138, /* 1100 111111 */ - /* line 14, PREFLEN=5, RANGELEN=7, VAL=139..266, 11011+(VAL-139) */ - 139, /* 11011 0000000 */ - 140, /* 11011 0000001 */ - 265, /* 11011 1111110 */ - 266, /* 11011 1111111 */ - /* line 15, PREFLEN=5, RANGELEN=8, VAL=267..522, 11100+(VAL-267) */ - 267, /* 11100 00000000 */ - 268, /* 11100 00000001 */ - 521, /* 11100 11111110 */ - 522, /* 11100 11111111 */ - /* line 16, PREFLEN=6, RANGELEN=8, VAL=523..778, 111100+(VAL-523) */ - 523, /* 111100 00000000 */ - 524, /* 111100 00000001 */ - 777, /* 111100 11111110 */ - 778, /* 111100 11111111 */ - /* line 17, PREFLEN=7, RANGELEN=9, VAL=779..1290, 1111101+(VAL-779) */ - 779, /* 1111101 00000000 0 */ - 780, /* 1111101 00000000 1 */ - 1289, /* 1111101 11111111 0 */ - 1290, /* 1111101 11111111 1 */ - /* line 18, PREFLEN=6, RANGELEN=11, VAL=1291..3338, 111101+(VAL-1291) */ - 1291, /* 111101 00000000 000 */ - 1292, /* 111101 00000000 001 */ - 3337, /* 111101 11111111 110 */ - 3338, /* 111101 11111111 111 */ - /* line 19, PREFLEN=9, RANGELEN=32, VAL=-INF..-32, 111111110+(-32-VAL) */ - -32, /* 111111110 00000000 00000000 00000000 00000000 */ - -33, /* 111111110 00000000 00000000 00000000 00000001 */ - /* line 20, PREFLEN=9, RANGELEN=32, VAL=3339..INF, 111111111+(VAL-3339) */ - 3339, /* 111111111 00000000 00000000 00000000 00000000 */ - 3340, /* 111111111 00000000 00000000 00000000 00000001 */ - /* line 21, PREFLEN=2, VAL=OOB, 00 */ - /*OOB*/ /* 00 */ -}; -const byte test_input_I[] = { - /* 1111 1100 0000 1111 1100 0001 1111 1100 */ - 0xfc, 0x0f, 0xc1, 0xfc, - /* 1110 1111 1100 1111 1111 1110 0001 1111 */ - 0xef, 0xcf, 0xfe, 0x1f, - /* 1100 0111 1111 1001 0111 1111 0011 1111 */ - 0xc7, 0xf9, 0x7f, 0x3f, - /* 1101 0011 1111 0101 1111 1101 1011 1111 */ - 0xd3, 0xf5, 0xfd, 0xbf, - /* 0111 1111 1110 1011 1111 1011 1111 1000 */ - 0x7f, 0xeb, 0xfb, 0xf8, - /* 1111 1001 1010 0101 0101 0001 0101 1001 */ - 0xf9, 0xa5, 0x51, 0x59, - /* 1111 0100 1101 0111 1010 0111 0101 1000 */ - 0xf4, 0xd7, 0xa7, 0x58, - /* 0000 1000 0001 1001 1110 1001 1111 1110 */ - 0x08, 0x19, 0xe9, 0xfe, - /* 1100 1110 1101 1110 1110 1110 1111 1011 */ - 0xce, 0xde, 0xee, 0xfb, - /* 0000 0101 1000 0110 1111 1101 0111 1111 */ - 0x05, 0x86, 0xfd, 0x7f, - /* 1100 0000 0011 0000 0001 1100 1111 1011 */ - 0xc0, 0x30, 0x1c, 0xfb, - /* 0011 1111 1101 1000 0000 1101 1000 0001 */ - 0x3f, 0xd8, 0x0d, 0x81, - /* 1101 1111 1110 1101 1111 1111 1110 0000 */ - 0xdf, 0xed, 0xff, 0xe0, - /* 0000 0111 0000 0000 0111 1001 1111 1101 */ - 0x07, 0x00, 0x79, 0xfd, - /* 1100 1111 1111 1111 0000 0000 0011 1100 */ - 0xcf, 0xff, 0x00, 0x3c, - /* 0000 0001 1111 0011 1111 1011 1100 1111 */ - 0x01, 0xf3, 0xfb, 0xcf, - /* 1111 1111 1010 0000 0000 1111 1010 0000 */ - 0xff, 0xa0, 0x0f, 0xa0, - /* 0001 1111 1011 1111 1110 1111 1011 1111 */ - 0x1f, 0xbf, 0xef, 0xbf, - /* 1111 1111 0100 0000 0000 0111 1010 0000 */ - 0xff, 0x40, 0x07, 0xa0, - /* 0000 0111 1101 1111 1111 1101 1110 1111 */ - 0x07, 0xdf, 0xfd, 0xef, - /* 1111 1111 1111 1111 0000 0000 0000 0000 */ - 0xff, 0xff, 0x00, 0x00, - /* 0000 0000 0000 0000 0111 1111 1000 0000 */ - 0x00, 0x00, 0x7f, 0x80, - /* 0000 0000 0000 0000 0000 0000 0111 1111 */ - 0x00, 0x00, 0x00, 0x7f, - /* 1110 0000 0000 0000 0000 0000 0000 0000 */ - 0xe0, 0x00, 0x00, 0x00, - /* 0001 1111 1111 0000 0000 0000 0000 0000 */ - 0x1f, 0xf0, 0x00, 0x00, - /* 0000 0000 0001 00 */ - 0x00, 0x10, -}; - -/* test code for Table B.10 - Standard Huffman table J */ -const int32_t test_output_J[] = { - /* line 0, PREFLEN=7, RANGELEN=4, VAL=-21..-6, 1111010+(VAL+21) */ - -21, /* 1111010 0000 */ - -20, /* 1111010 0001 */ - -7, /* 1111010 1110 */ - -6, /* 1111010 1111 */ - /* line 1, PREFLEN=8, RANGELEN=0, VAL=-5, 11111100 */ - -5, /* 11111100 */ - /* line 2, PREFLEN=7, RANGELEN=0, VAL=-5, 1111011 */ - -4, /* 1111011 */ - /* line 3, PREFLEN=5, RANGELEN=0, VAL=-3, 11000 */ - -3, /* 11000 */ - /* line 4, PREFLEN=2, RANGELEN=2, VAL=-2..1, 00+(VAL+2) */ - -2, /* 00 00 */ - -1, /* 00 01 */ - 0, /* 00 10 */ - 1, /* 00 11 */ - /* line 5, PREFLEN=5, RANGELEN=0, VAL=2, 11001 */ - 2, /* 11001 */ - /* line 6, PREFLEN=6, RANGELEN=0, VAL=3, 110110 */ - 3, /* 110110 */ - /* line 7, PREFLEN=7, RANGELEN=0, VAL=4, 1111100 */ - 4, /* 1111100 */ - /* line 8, PREFLEN=8, RANGELEN=0, VAL=5, 11111101 */ - 5, /* 11111101 */ - /* line 9, PREFLEN=2, RANGELEN=6, VAL=6..69, 01+(VAL-6) */ - 6, /* 01 000000 */ - 7, /* 01 000001 */ - 68, /* 01 111110 */ - 69, /* 01 111111 */ - /* line 8, PREFLEN=5, RANGELEN=5, VAL=70..101, 11010+(VAL-70) */ - 70, /* 11010 00000 */ - 71, /* 11010 00001 */ - 100, /* 11010 11110 */ - 101, /* 11010 11111 */ - /* line 9, PREFLEN=6, RANGELEN=5, VAL=102..133, 110111+(VAL-102) */ - 102, /* 110111 00000 */ - 103, /* 110111 00001 */ - 132, /* 110111 11110 */ - 133, /* 110111 11111 */ - /* line 10, PREFLEN=6, RANGELEN=6, VAL=134..197, 111000+(VAL-134) */ - 134, /* 111000 000000 */ - 135, /* 111000 000001 */ - 196, /* 111000 111110 */ - 197, /* 111000 111111 */ - /* line 11, PREFLEN=6, RANGELEN=7, VAL=198..325, 111001+(VAL-198) */ - 198, /* 111001 0000000 */ - 199, /* 111001 0000001 */ - 324, /* 111001 1111110 */ - 325, /* 111001 1111111 */ - /* line 12, PREFLEN=6, RANGELEN=8, VAL=326..581, 111010+(VAL-326) */ - 326, /* 111010 00000000 */ - 327, /* 111010 00000001 */ - 580, /* 111010 11111110 */ - 581, /* 111010 11111111 */ - /* line 13, PREFLEN=6, RANGELEN=9, VAL=582..1093, 111011+(VAL-582) */ - 582, /* 111011 00000000 0 */ - 583, /* 111011 00000000 1 */ - 1092, /* 111011 11111111 0 */ - 1093, /* 111011 11111111 1 */ - /* line 14, PREFLEN=6, RANGELEN=10, VAL=1094..2117, 111100+(VAL-1094) */ - 1094, /* 111100 00000000 00 */ - 1095, /* 111100 00000000 01 */ - 2116, /* 111100 11111111 10 */ - 2117, /* 111100 11111111 11 */ - /* line 15, PREFLEN=7, RANGELEN=11, VAL=2118..4165, 1111101+(VAL-2118) */ - 2118, /* 1111101 00000000 000 */ - 2119, /* 1111101 00000000 001 */ - 4164, /* 1111101 11111111 110 */ - 4165, /* 1111101 11111111 111 */ - /* line 16, PREFLEN=8, RANGELEN=32, VAL=-INF..-22, 11111110+(-22-VAL) */ - -22, /* 11111110 00000000 00000000 00000000 00000000 */ - -23, /* 11111110 00000000 00000000 00000000 00000001 */ - /* line 17, PREFLEN=8, RANGELEN=32, VAL=4166..INF, 11111111+(VAL-4166) */ - 4166, /* 11111111 00000000 00000000 00000000 00000000 */ - 4167, /* 11111111 00000000 00000000 00000000 00000001 */ - /* line 8, PREFLEN=2, VAL=OOB, 10 */ - /*OOB*/ /* 10 */ -}; -const byte test_input_J[] = { - /* 1111 0100 0001 1110 1000 0111 1101 0111 */ - 0xf4, 0x1e, 0x87, 0xd7, - /* 0111 1010 1111 1111 1100 1111 0111 1000 */ - 0x7a, 0xff, 0xcf, 0x78, - /* 0000 0001 0010 0011 1100 1110 1101 1111 */ - 0x01, 0x23, 0xce, 0xdf, - /* 0011 1111 0101 0000 0001 0000 0101 1111 */ - 0x3f, 0x50, 0x10, 0x5f, - /* 1001 1111 1111 0100 0000 1101 0000 0111 */ - 0x9f, 0xf4, 0x0d, 0x07, - /* 0101 1110 1101 0111 1111 0111 0000 0110 */ - 0x5e, 0xd7, 0xf7, 0x06, - /* 1110 0001 1101 1111 1101 1011 1111 1111 */ - 0xe1, 0xdf, 0xdb, 0xff, - /* 1000 0000 0011 1000 0000 0111 1000 1111 */ - 0x80, 0x38, 0x07, 0x8f, - /* 1011 1000 1111 1111 1001 0000 0001 1100 */ - 0xb8, 0xff, 0x90, 0x1c, - /* 1000 0001 1110 0111 1111 0111 0011 1111 */ - 0x81, 0xe7, 0xf7, 0x3f, - /* 1111 1010 0000 0000 1110 1000 0000 0111 */ - 0xfa, 0x00, 0xe8, 0x07, - /* 1010 1111 1110 1110 1011 1111 1111 1011 */ - 0xaf, 0xee, 0xbf, 0xfb, - /* 0000 0000 0111 0110 0000 0001 1110 1111 */ - 0x00, 0x76, 0x01, 0xef, - /* 1111 1101 1101 1111 1111 1111 1100 0000 */ - 0xfd, 0xdf, 0xff, 0xc0, - /* 0000 0011 1100 0000 0000 0111 1100 1111 */ - 0x03, 0xc0, 0x07, 0xcf, - /* 1111 1011 1100 1111 1111 1111 1110 1000 */ - 0xfb, 0xcf, 0xff, 0xe8, - /* 0000 0000 1111 1010 0000 0000 0111 1110 */ - 0x00, 0xfa, 0x00, 0x7e, - /* 1111 1111 1110 1111 1011 1111 1111 1111 */ - 0xff, 0xef, 0xbf, 0xff, - /* 1111 1000 0000 0000 0000 0000 0000 0000 */ - 0xf8, 0x00, 0x00, 0x00, - /* 0000 0011 1111 1000 0000 0000 0000 0000 */ - 0x03, 0xf8, 0x00, 0x00, - /* 0000 0000 0000 0111 1111 1100 0000 0000 */ - 0x00, 0x07, 0xfc, 0x00, - /* 0000 0000 0000 0000 0000 0011 1111 1100 */ - 0x00, 0x00, 0x03, 0xfc, - /* 0000 0000 0000 0000 0000 0000 0000 0110 */ - 0x00, 0x00, 0x00, 0x06, -}; - -/* test code for Table B.11 - Standard Huffman table K */ -const int32_t test_output_K[] = { - /* line 0, PREFLEN=1, RANGELEN=0, VAL=1, 0 */ - 1, /* 0 */ - /* line 1, PREFLEN=2, RANGELEN=1, VAL=2..3, 10+(VAL-2) */ - 2, /* 10 0 */ - 3, /* 10 1 */ - /* line 2, PREFLEN=4, RANGELEN=0, VAL=4, 1100 */ - 4, /* 1100 */ - /* line 3, PREFLEN=4, RANGELEN=1, VAL=5..6, 1101+(VAL-5) */ - 5, /* 1101 0 */ - 6, /* 1101 1 */ - /* line 4, PREFLEN=5, RANGELEN=1, VAL=7..8, 11100+(VAL-7) */ - 7, /* 11100 0 */ - 8, /* 11100 1 */ - /* line 5, PREFLEN=5, RANGELEN=2, VAL=9..12, 11101+(VAL-9) */ - 9, /* 11101 00 */ - 10, /* 11101 01 */ - 11, /* 11101 10 */ - 12, /* 11101 11 */ - /* line 6, PREFLEN=6, RANGELEN=2, VAL=13..16, 111100+(VAL-13) */ - 13, /* 111100 00 */ - 14, /* 111100 01 */ - 15, /* 111100 10 */ - 16, /* 111100 11 */ - /* line 7, PREFLEN=7, RANGELEN=2, VAL=17..20, 1111010+(VAL-17) */ - 17, /* 1111010 00 */ - 18, /* 1111010 01 */ - 19, /* 1111010 10 */ - 20, /* 1111010 11 */ - /* line 8, PREFLEN=7, RANGELEN=3, VAL=21..28, 1111011+(VAL-21) */ - 21, /* 1111011 000 */ - 22, /* 1111011 001 */ - 27, /* 1111011 110 */ - 28, /* 1111011 111 */ - /* line 9, PREFLEN=7, RANGELEN=4, VAL=29..44, 1111100+(VAL-29) */ - 29, /* 1111100 0000 */ - 30, /* 1111100 0001 */ - 43, /* 1111100 1110 */ - 44, /* 1111100 1111 */ - /* line 10, PREFLEN=7, RANGELEN=5, VAL=45..76, 1111101+(VAL-45) */ - 45, /* 1111101 00000 */ - 46, /* 1111101 00001 */ - 75, /* 1111101 11110 */ - 76, /* 1111101 11111 */ - /* line 11, PREFLEN=7, RANGELEN=6, VAL=77..140, 1111110+(VAL-77) */ - 77, /* 1111110 000000 */ - 78, /* 1111110 000001 */ - 139, /* 1111110 111110 */ - 140, /* 1111110 111111 */ - /* line 12, PREFLEN=7, RANGELEN=32, VAL=141..INF, 1111111+(VAL-141) */ - 141, /* 1111111 00000000 00000000 00000000 00000000 */ - 142, /* 1111111 00000000 00000000 00000000 00000001 */ -}; -const byte test_input_K[] = { - /* 0100 1011 1001 1010 1101 1111 0001 1100 */ - 0x4b, 0x9a, 0xdf, 0x1c, - /* 1111 0100 1110 1011 1101 1011 1011 1111 */ - 0xf4, 0xeb, 0xdb, 0xbf, - /* 1000 0111 1000 1111 1001 0111 1001 1111 */ - 0x87, 0x8f, 0x97, 0x9f, - /* 1010 0011 1101 0011 1110 1010 1111 0101 */ - 0xa3, 0xd3, 0xea, 0xf5, - /* 1111 1011 0001 1110 1100 1111 1011 1101 */ - 0xfb, 0x1e, 0xcf, 0xbd, - /* 1110 1111 1111 1100 0000 1111 1000 0011 */ - 0xef, 0xfc, 0x0f, 0x83, - /* 1111 0011 1011 1110 0111 1111 1101 0000 */ - 0xf3, 0xbe, 0x7f, 0xd0, - /* 0111 1101 0000 1111 1101 1111 0111 1101 */ - 0x7d, 0x0f, 0xdf, 0x7d, - /* 1111 1111 1110 0000 0011 1111 0000 0011 */ - 0xff, 0xe0, 0x3f, 0x03, - /* 1111 1011 1110 1111 1101 1111 1111 1111 */ - 0xfb, 0xef, 0xdf, 0xff, - /* 0000 0000 0000 0000 0000 0000 0000 0000 */ - 0x00, 0x00, 0x00, 0x00, - /* 1111 1110 0000 0000 0000 0000 0000 0000 */ - 0xfe, 0x00, 0x00, 0x00, - /* 0000 001 */ - 0x02, -}; - -/* test code for Table B.12 - Standard Huffman table L */ -const int32_t test_output_L[] = { - /* line 0, PREFLEN=1, RANGELEN=0, VAL=1, 0 */ - 1, /* 0 */ - /* line 1, PREFLEN=2, RANGELEN=0, VAL=2, 10 */ - 2, /* 10 */ - /* line 2, PREFLEN=3, RANGELEN=1, VAL=3..4, 110+(VAL-3) */ - 3, /* 110 0 */ - 4, /* 110 1 */ - /* line 3, PREFLEN=5, RANGELEN=0, VAL=5, 11100 */ - 5, /* 11100 */ - /* line 4, PREFLEN=5, RANGELEN=1, VAL=6..7, 11101+(VAL-7) */ - 6, /* 11101 0 */ - 7, /* 11101 1 */ - /* line 5, PREFLEN=6, RANGELEN=1, VAL=8..9, 111100+(VAL-8) */ - 8, /* 111100 0 */ - 9, /* 111100 1 */ - /* line 6, PREFLEN=7, RANGELEN=0, VAL=10, 1111010 */ - 10, /* 1111010 */ - /* line 7, PREFLEN=7, RANGELEN=1, VAL=11..12, 1111011+(VAL-11) */ - 11, /* 1111011 0 */ - 12, /* 1111011 1 */ - /* line 8, PREFLEN=7, RANGELEN=2, VAL=13..16, 1111100+(VAL-13) */ - 13, /* 1111100 00 */ - 14, /* 1111100 01 */ - 15, /* 1111100 10 */ - 16, /* 1111100 11 */ - /* line 9, PREFLEN=7, RANGELEN=3, VAL=17..24, 1111101+(VAL-17) */ - 17, /* 1111101 000 */ - 18, /* 1111101 001 */ - 23, /* 1111101 110 */ - 24, /* 1111101 111 */ - /* line 10, PREFLEN=7, RANGELEN=4, VAL=25..40, 1111110+(VAL-25) */ - 25, /* 1111110 0000 */ - 26, /* 1111110 0001 */ - 39, /* 1111110 1110 */ - 40, /* 1111110 1111 */ - /* line 11, PREFLEN=8, RANGELEN=5, VAL=41..72, 11111110+(VAL-41) */ - 41, /* 11111110 00000 */ - 42, /* 11111110 00001 */ - 71, /* 11111110 11110 */ - 72, /* 11111110 11111 */ - /* line 12, PREFLEN=8, RANGELEN=32, VAL=73..INF, 11111111+(VAL-73) */ - 73, /* 11111111 00000000 00000000 00000000 00000000 */ - 74, /* 11111111 00000000 00000000 00000000 00000001 */ -}; -const byte test_input_L[] = { - /* 0101 1001 1011 1100 1110 1011 1011 1111 */ - 0x59, 0xbc, 0xeb, 0xbf, - /* 0001 1110 0111 1101 0111 1011 0111 1011 */ - 0x1e, 0x7d, 0x7b, 0x7b, - /* 1111 1100 0011 1110 0011 1111 0010 1111 */ - 0xfc, 0x3e, 0x3f, 0x2f, - /* 1001 1111 1101 0001 1111 0100 1111 1101 */ - 0x9f, 0xd1, 0xf4, 0xfd, - /* 1101 1111 0111 1111 1110 0000 1111 1100 */ - 0xdf, 0x7f, 0xe0, 0xfc, - /* 0011 1111 1011 1011 1111 0111 1111 1111 */ - 0x3f, 0xbb, 0xf7, 0xff, - /* 0000 0011 1111 1000 0011 1111 1101 1110 */ - 0x03, 0xf8, 0x3f, 0xde, - /* 1111 1110 1111 1111 1111 1000 0000 0000 */ - 0xfe, 0xff, 0xf8, 0x00, - /* 0000 0000 0000 0000 0000 0111 1111 1000 */ - 0x00, 0x00, 0x07, 0xf8, - /* 0000 0000 0000 0000 0000 0000 0000 1 */ - 0x00, 0x00, 0x00, 0x08, -}; - -/* test code for Table B.13 - Standard Huffman table M */ -const int32_t test_output_M[] = { - /* line 0, PREFLEN=1, RANGELEN=0, VAL=1, 0 */ - 1, /* 0 */ - /* line 1, PREFLEN=3, RANGELEN=0, VAL=2, 100 */ - 2, /* 100 */ - /* line 2, PREFLEN=3, RANGELEN=0, VAL=3, 1100 */ - 3, /* 1100 */ - /* line 3, PREFLEN=5, RANGELEN=0, VAL=4, 11100 */ - 4, /* 11100 */ - /* line 4, PREFLEN=4, RANGELEN=1, VAL=5..6, 1101+(VAL-5) */ - 5, /* 1101 0 */ - 6, /* 1101 1 */ - /* line 5, PREFLEN=3, RANGELEN=3, VAL=7..14, 101+(VAL-7) */ - 7, /* 101 000 */ - 8, /* 101 001 */ - 13, /* 101 110 */ - 14, /* 101 111 */ - /* line 6, PREFLEN=6, RANGELEN=1, VAL=15..16, 111010+(VAL-15) */ - 15, /* 111010 0 */ - 16, /* 111010 1 */ - /* line 7, PREFLEN=6, RANGELEN=2, VAL=17..20, 111011+(VAL-17) */ - 17, /* 111011 00 */ - 18, /* 111011 01 */ - 19, /* 111011 10 */ - 20, /* 111011 11 */ - /* line 8, PREFLEN=6, RANGELEN=3, VAL=21..28, 111100+(VAL-21) */ - 21, /* 111100 000 */ - 22, /* 111100 001 */ - 27, /* 111100 110 */ - 28, /* 111100 111 */ - /* line 9, PREFLEN=6, RANGELEN=4, VAL=29..44, 111101+(VAL-29) */ - 29, /* 111101 0000 */ - 30, /* 111101 0001 */ - 43, /* 111101 1110 */ - 44, /* 111101 1111 */ - /* line 10, PREFLEN=6, RANGELEN=5, VAL=45..76, 111110+(VAL-45) */ - 45, /* 111110 00000 */ - 46, /* 111110 00001 */ - 75, /* 111110 11110 */ - 76, /* 111110 11111 */ - /* line 11, PREFLEN=7, RANGELEN=6, VAL=77..140, 1111110+(VAL-77) */ - 77, /* 1111110 000000 */ - 78, /* 1111110 000001 */ - 139, /* 1111110 111110 */ - 140, /* 1111110 111111 */ - /* line 12, PREFLEN=7, RANGELEN=32, VAL=141..INF, 1111111+(VAL-141) */ - 141, /* 1111111 00000000 00000000 00000000 00000000 */ - 142, /* 1111111 00000000 00000000 00000000 00000001 */ -}; -const byte test_input_M[] = { - /* 0100 1100 1110 0110 1011 0111 0100 0101 */ - 0x4c, 0xe6, 0xb7, 0x45, - /* 0011 0111 0101 1111 1101 0011 1010 1111 */ - 0x37, 0x5f, 0xd3, 0xaf, - /* 0110 0111 0110 1111 0111 0111 0111 1111 */ - 0x67, 0x6f, 0x77, 0x7f, - /* 1000 0011 1100 0011 1110 0110 1111 0011 */ - 0x83, 0xc3, 0xe6, 0xf3, - /* 1111 1010 0001 1110 1000 1111 1011 1101 */ - 0xfa, 0x1e, 0x8f, 0xbd, - /* 1110 1111 1111 1100 0000 1111 1000 0011 */ - 0xef, 0xfc, 0x0f, 0x83, - /* 1111 0111 1011 1110 1111 1111 1110 0000 */ - 0xf7, 0xbe, 0xff, 0xe0, - /* 0011 1111 0000 0011 1111 1011 1110 1111 */ - 0x3f, 0x03, 0xfb, 0xef, - /* 1101 1111 1111 1111 0000 0000 0000 0000 */ - 0xdf, 0xff, 0x00, 0x00, - /* 0000 0000 0000 0000 1111 1110 0000 0000 */ - 0x00, 0x00, 0xfe, 0x00, - /* 0000 0000 0000 0000 0000 001 */ - 0x00, 0x00, 0x02, -}; - -/* test code for Table B.14 - Standard Huffman table N */ -const int32_t test_output_N[] = { - /* line 0, PREFLEN=3, RANGELEN=0, VAL=-2, 100 */ - -2, /* 100 */ - /* line 1, PREFLEN=3, RANGELEN=0, VAL=-1, 101 */ - -1, /* 101 */ - /* line 2, PREFLEN=1, RANGELEN=0, VAL=1, 0 */ - 0, /* 0 */ - /* line 3, PREFLEN=3, RANGELEN=0, VAL=1, 110 */ - 1, /* 110 */ - /* line 4, PREFLEN=3, RANGELEN=0, VAL=2, 111 */ - 2, /* 111 */ -}; -const byte test_input_N[] = { - /* 1001 0101 1011 1 */ - 0x95, 0xb8, -}; - -/* test code for Table B.15 - Standard Huffman table O */ -const int32_t test_output_O[] = { - /* line 0, PREFLEN=7, RANGELEN=4, VAL=-24..-9, 1111100+(VAL+24) */ - -24, /* 1111100 0000 */ - -23, /* 1111100 0001 */ - -10, /* 1111100 1110 */ - -9, /* 1111100 1111 */ - /* line 1, PREFLEN=6, RANGELEN=2, VAL=-8..-5, 111100+(VAL+8) */ - -8, /* 111100 00 */ - -7, /* 111100 01 */ - -6, /* 111100 10 */ - -5, /* 111100 11 */ - /* line 2, PREFLEN=5, RANGELEN=1, VAL=-4..-3, 11100+(VAL+4) */ - -4, /* 11100 0 */ - -3, /* 11100 1 */ - /* line 3, PREFLEN=4, RANGELEN=0, VAL=-2, 1100 */ - -2, /* 1100 */ - /* line 4, PREFLEN=3, RANGELEN=0, VAL=-1, 100 */ - -1, /* 100 */ - /* line 5, PREFLEN=1, RANGELEN=0, VAL=1, 0 */ - 0, /* 0 */ - /* line 6, PREFLEN=3, RANGELEN=0, VAL=1, 101 */ - 1, /* 101 */ - /* line 7, PREFLEN=4, RANGELEN=0, VAL=2, 1101 */ - 2, /* 1101 */ - /* line 8, PREFLEN=5, RANGELEN=1, VAL=3..4, 11101+(VAL-3) */ - 3, /* 11101 0 */ - 4, /* 11101 1 */ - /* line 9, PREFLEN=6, RANGELEN=2, VAL=5..8, 111101+(VAL-5) */ - 5, /* 111101 00 */ - 6, /* 111101 01 */ - 7, /* 111101 10 */ - 8, /* 111101 11 */ - /* line 10, PREFLEN=7, RANGELEN=4, VAL=9..24, 1111101+(VAL-9) */ - 9, /* 1111101 0000 */ - 10, /* 1111101 0001 */ - 23, /* 1111101 1110 */ - 24, /* 1111101 1111 */ - /* line 11, PREFLEN=7, RANGELEN=32, VAL=-INF..-25, 1111110+(-25-VAL) */ - -25, /* 1111110 00000000 00000000 00000000 00000000 */ - -26, /* 1111110 00000000 00000000 00000000 00000001 */ - /* line 12, PREFLEN=7, RANGELEN=32, VAL=25..INF, 1111111+(VAL-25) */ - 25, /* 1111111 00000000 00000000 00000000 00000000 */ - 26, /* 1111111 00000000 00000000 00000000 00000001 */ -}; -const byte test_input_O[] = { - /* 1111 1000 0001 1111 0000 0111 1110 0111 */ - 0xf8, 0x1f, 0x07, 0xe7, - /* 0111 1100 1111 1111 0000 1111 0001 1111 */ - 0x7c, 0xff, 0x0f, 0x1f, - /* 0010 1111 0011 1110 0011 1001 1100 1000 */ - 0x2f, 0x3e, 0x39, 0xc8, - /* 1011 1011 1101 0111 0111 1110 1001 1110 */ - 0xbb, 0xd7, 0x7e, 0x9e, - /* 1011 1110 1101 1110 1111 1111 0100 0011 */ - 0xbe, 0xde, 0xff, 0x43, - /* 1110 1000 1111 1101 1110 1111 1011 1111 */ - 0xe8, 0xfd, 0xef, 0xbf, - /* 1111 1000 0000 0000 0000 0000 0000 0000 */ - 0xf8, 0x00, 0x00, 0x00, - /* 0000 0011 1111 0000 0000 0000 0000 0000 */ - 0x03, 0xf0, 0x00, 0x00, - /* 0000 0000 0000 1111 1111 0000 0000 0000 */ - 0x00, 0x0f, 0xf0, 0x00, - /* 0000 0000 0000 0000 0000 1111 1110 0000 */ - 0x00, 0x00, 0x0f, 0xe0, - /* 0000 0000 0000 0000 0000 0000 001 */ - 0x00, 0x00, 0x00, 0x20, -}; - -typedef struct test_huffmancodes { - const char *name; - const Jbig2HuffmanParams *params; - const byte *input; - const size_t input_len; - const int32_t *output; - const size_t output_len; -} test_huffmancodes_t; - -#define countof(x) (sizeof((x)) / sizeof((x)[0])) - -#define DEF_TEST_HUFFMANCODES(x) { \ - #x, \ - &jbig2_huffman_params_##x, \ - test_input_##x, countof(test_input_##x), \ - test_output_##x, countof(test_output_##x), \ -} - -test_huffmancodes_t tests[] = { - DEF_TEST_HUFFMANCODES(A), - DEF_TEST_HUFFMANCODES(B), - DEF_TEST_HUFFMANCODES(C), - DEF_TEST_HUFFMANCODES(D), - DEF_TEST_HUFFMANCODES(E), - DEF_TEST_HUFFMANCODES(F), - DEF_TEST_HUFFMANCODES(G), - DEF_TEST_HUFFMANCODES(H), - DEF_TEST_HUFFMANCODES(I), - DEF_TEST_HUFFMANCODES(J), - DEF_TEST_HUFFMANCODES(K), - DEF_TEST_HUFFMANCODES(L), - DEF_TEST_HUFFMANCODES(M), - DEF_TEST_HUFFMANCODES(N), - DEF_TEST_HUFFMANCODES(O), -}; - -typedef struct test_stream { - Jbig2WordStream ws; - test_huffmancodes_t *h; -} test_stream_t; - -static int -test_get_word2(Jbig2Ctx *ctx, Jbig2WordStream *self, size_t offset, uint32_t *word) -{ - test_stream_t *st = (test_stream_t *) self; - uint32_t val = 0; - int ret = 0; - - if (st == NULL || st->h == NULL || word == NULL) - return -1; - if (offset >= st->h->input_len) - return 0; - - if (offset < st->h->input_len) { - val |= (st->h->input[offset] << 24); - ret++; - } - if (offset + 1 < st->h->input_len) { - val |= (st->h->input[offset + 1] << 16); - ret++; - } - if (offset + 2 < st->h->input_len) { - val |= (st->h->input[offset + 2] << 8); - ret++; - } - if (offset + 3 < st->h->input_len) { - val |= st->h->input[offset + 3]; - ret++; - } - *word = val; - return ret; -} - -static int test2() -{ - Jbig2Ctx *ctx; - int success = 0; - int i; - - ctx = jbig2_ctx_new(NULL, 0, NULL, NULL, NULL); - if (ctx == NULL) { - fprintf(stderr, "Failed to allocate jbig2 context\n"); - return 0; - } - - for (i = 0; i < (int) countof(tests); i++) { - Jbig2HuffmanTable *table; - Jbig2HuffmanState *hs; - test_stream_t st; - int32_t code; - bool oob; - size_t j; - - st.ws.get_next_word = test_get_word2; - st.h = &tests[i]; - printf("testing Standard Huffman table %s: ", st.h->name); - table = jbig2_build_huffman_table(ctx, st.h->params); - if (table == NULL) { - fprintf(stderr, "jbig2_build_huffman_table() returned NULL!\n"); - jbig2_ctx_free(ctx); - return 0; - } - /* jbig2_dump_huffman_table(table); */ - hs = jbig2_huffman_new(ctx, &st.ws); - if (hs == NULL) { - fprintf(stderr, "jbig2_huffman_new() returned NULL!\n"); - jbig2_release_huffman_table(ctx, table); - jbig2_ctx_free(ctx); - return 0; - } - for (j = 0; j < st.h->output_len; j++) { - printf("%d...", st.h->output[j]); - code = jbig2_huffman_get(hs, table, &oob); - if (code == st.h->output[j] && !oob) { - printf("ok, "); - } else { - int need_comma = 0; - - printf("NG("); - if (code != st.h->output[j]) { - printf("%d", code); - need_comma = 1; - } - if (oob) { - if (need_comma) - printf(","); - printf("OOB"); - } - printf("), "); - } - } - if (st.h->params->HTOOB) { - printf("OOB..."); - code = jbig2_huffman_get(hs, table, &oob); - if (oob) { - printf("ok"); - } else { - printf("NG(%d)", code); - } - } - printf("\n"); - jbig2_huffman_free(ctx, hs); - jbig2_release_huffman_table(ctx, table); - } - - jbig2_ctx_free(ctx); - - if (i == countof(tests)) - success = 1; - - return success; -} - -int -main(int argc, char **argv) -{ - return test1() && test2() ? 0 : 1; -} -#endif diff --git a/pdfpatcher/JBig2/src/jbig2_hufftab.c b/pdfpatcher/JBig2/src/jbig2_hufftab.c deleted file mode 100644 index 1587b53ff10ecebf7833ae9fa3755b688d5c5036..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2_hufftab.c +++ /dev/null @@ -1,318 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -/* predefined Huffman table definitions - -- See Annex B of the JBIG2 specification */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "os_types.h" - -#include - -#include "jbig2.h" -#include "jbig2_priv.h" -#include "jbig2_huffman.h" -#include "jbig2_hufftab.h" - -#define JBIG2_COUNTOF(x) (sizeof((x)) / sizeof((x)[0])) - -/* Table B.1 */ -static const Jbig2HuffmanLine jbig2_huffman_lines_A[] = { - {1, 4, 0}, - {2, 8, 16}, - {3, 16, 272}, - {0, 32, -1}, /* low */ - {3, 32, 65808} /* high */ -}; - -const Jbig2HuffmanParams jbig2_huffman_params_A = { FALSE, JBIG2_COUNTOF(jbig2_huffman_lines_A), jbig2_huffman_lines_A }; - -/* Table B.2 */ -static const Jbig2HuffmanLine jbig2_huffman_lines_B[] = { - {1, 0, 0}, - {2, 0, 1}, - {3, 0, 2}, - {4, 3, 3}, - {5, 6, 11}, - {0, 32, -1}, /* low */ - {6, 32, 75}, /* high */ - {6, 0, 0} /* OOB */ -}; - -const Jbig2HuffmanParams jbig2_huffman_params_B = { TRUE, JBIG2_COUNTOF(jbig2_huffman_lines_B), jbig2_huffman_lines_B }; - -/* Table B.3 */ -static const Jbig2HuffmanLine jbig2_huffman_lines_C[] = { - {8, 8, -256}, - {1, 0, 0}, - {2, 0, 1}, - {3, 0, 2}, - {4, 3, 3}, - {5, 6, 11}, - {8, 32, -257}, /* low */ - {7, 32, 75}, /* high */ - {6, 0, 0} /* OOB */ -}; - -const Jbig2HuffmanParams jbig2_huffman_params_C = { TRUE, JBIG2_COUNTOF(jbig2_huffman_lines_C), jbig2_huffman_lines_C }; - -/* Table B.4 */ -static const Jbig2HuffmanLine jbig2_huffman_lines_D[] = { - {1, 0, 1}, - {2, 0, 2}, - {3, 0, 3}, - {4, 3, 4}, - {5, 6, 12}, - {0, 32, -1}, /* low */ - {5, 32, 76}, /* high */ -}; - -const Jbig2HuffmanParams jbig2_huffman_params_D = { FALSE, JBIG2_COUNTOF(jbig2_huffman_lines_D), jbig2_huffman_lines_D }; - -/* Table B.5 */ -static const Jbig2HuffmanLine jbig2_huffman_lines_E[] = { - {7, 8, -255}, - {1, 0, 1}, - {2, 0, 2}, - {3, 0, 3}, - {4, 3, 4}, - {5, 6, 12}, - {7, 32, -256}, /* low */ - {6, 32, 76} /* high */ -}; - -const Jbig2HuffmanParams jbig2_huffman_params_E = { FALSE, JBIG2_COUNTOF(jbig2_huffman_lines_E), jbig2_huffman_lines_E }; - -/* Table B.6 */ -static const Jbig2HuffmanLine jbig2_huffman_lines_F[] = { - {5, 10, -2048}, - {4, 9, -1024}, - {4, 8, -512}, - {4, 7, -256}, - {5, 6, -128}, - {5, 5, -64}, - {4, 5, -32}, - {2, 7, 0}, - {3, 7, 128}, - {3, 8, 256}, - {4, 9, 512}, - {4, 10, 1024}, - {6, 32, -2049}, /* low */ - {6, 32, 2048} /* high */ -}; - -const Jbig2HuffmanParams jbig2_huffman_params_F = { FALSE, JBIG2_COUNTOF(jbig2_huffman_lines_F), jbig2_huffman_lines_F }; - -/* Table B.7 */ -static const Jbig2HuffmanLine jbig2_huffman_lines_G[] = { - {4, 9, -1024}, - {3, 8, -512}, - {4, 7, -256}, - {5, 6, -128}, - {5, 5, -64}, - {4, 5, -32}, - {4, 5, 0}, - {5, 5, 32}, - {5, 6, 64}, - {4, 7, 128}, - {3, 8, 256}, - {3, 9, 512}, - {3, 10, 1024}, - {5, 32, -1025}, /* low */ - {5, 32, 2048} /* high */ -}; - -const Jbig2HuffmanParams jbig2_huffman_params_G = { FALSE, JBIG2_COUNTOF(jbig2_huffman_lines_G), jbig2_huffman_lines_G }; - -/* Table B.8 */ -static const Jbig2HuffmanLine jbig2_huffman_lines_H[] = { - {8, 3, -15}, - {9, 1, -7}, - {8, 1, -5}, - {9, 0, -3}, - {7, 0, -2}, - {4, 0, -1}, - {2, 1, 0}, - {5, 0, 2}, - {6, 0, 3}, - {3, 4, 4}, - {6, 1, 20}, - {4, 4, 22}, - {4, 5, 38}, - {5, 6, 70}, - {5, 7, 134}, - {6, 7, 262}, - {7, 8, 390}, - {6, 10, 646}, - {9, 32, -16}, /* low */ - {9, 32, 1670}, /* high */ - {2, 0, 0} /* OOB */ -}; - -const Jbig2HuffmanParams jbig2_huffman_params_H = { TRUE, JBIG2_COUNTOF(jbig2_huffman_lines_H), jbig2_huffman_lines_H }; - -/* Table B.9 */ -static const Jbig2HuffmanLine jbig2_huffman_lines_I[] = { - {8, 4, -31}, - {9, 2, -15}, - {8, 2, -11}, - {9, 1, -7}, - {7, 1, -5}, - {4, 1, -3}, - {3, 1, -1}, - {3, 1, 1}, - {5, 1, 3}, - {6, 1, 5}, - {3, 5, 7}, - {6, 2, 39}, - {4, 5, 43}, - {4, 6, 75}, - {5, 7, 139}, - {5, 8, 267}, - {6, 8, 523}, - {7, 9, 779}, - {6, 11, 1291}, - {9, 32, -32}, /* low */ - {9, 32, 3339}, /* high */ - {2, 0, 0} /* OOB */ -}; - -const Jbig2HuffmanParams jbig2_huffman_params_I = { TRUE, JBIG2_COUNTOF(jbig2_huffman_lines_I), jbig2_huffman_lines_I }; - -/* Table B.10 */ -static const Jbig2HuffmanLine jbig2_huffman_lines_J[] = { - {7, 4, -21}, - {8, 0, -5}, - {7, 0, -4}, - {5, 0, -3}, - {2, 2, -2}, - {5, 0, 2}, - {6, 0, 3}, - {7, 0, 4}, - {8, 0, 5}, - {2, 6, 6}, - {5, 5, 70}, - {6, 5, 102}, - {6, 6, 134}, - {6, 7, 198}, - {6, 8, 326}, - {6, 9, 582}, - {6, 10, 1094}, - {7, 11, 2118}, - {8, 32, -22}, /* low */ - {8, 32, 4166}, /* high */ - {2, 0, 0} /* OOB */ -}; - -const Jbig2HuffmanParams jbig2_huffman_params_J = { TRUE, JBIG2_COUNTOF(jbig2_huffman_lines_J), jbig2_huffman_lines_J }; - -/* Table B.11 */ -static const Jbig2HuffmanLine jbig2_huffman_lines_K[] = { - {1, 0, 1}, - {2, 1, 2}, - {4, 0, 4}, - {4, 1, 5}, - {5, 1, 7}, - {5, 2, 9}, - {6, 2, 13}, - {7, 2, 17}, - {7, 3, 21}, - {7, 4, 29}, - {7, 5, 45}, - {7, 6, 77}, - {0, 32, -1}, /* low */ - {7, 32, 141} /* high */ -}; - -const Jbig2HuffmanParams jbig2_huffman_params_K = { FALSE, JBIG2_COUNTOF(jbig2_huffman_lines_K), jbig2_huffman_lines_K }; - -/* Table B.12 */ -static const Jbig2HuffmanLine jbig2_huffman_lines_L[] = { - {1, 0, 1}, - {2, 0, 2}, - {3, 1, 3}, - {5, 0, 5}, - {5, 1, 6}, - {6, 1, 8}, - {7, 0, 10}, - {7, 1, 11}, - {7, 2, 13}, - {7, 3, 17}, - {7, 4, 25}, - {8, 5, 41}, - {8, 32, 73}, - {0, 32, -1}, /* low */ - {0, 32, 0} /* high */ -}; - -const Jbig2HuffmanParams jbig2_huffman_params_L = { FALSE, JBIG2_COUNTOF(jbig2_huffman_lines_L), jbig2_huffman_lines_L }; - -/* Table B.13 */ -static const Jbig2HuffmanLine jbig2_huffman_lines_M[] = { - {1, 0, 1}, - {3, 0, 2}, - {4, 0, 3}, - {5, 0, 4}, - {4, 1, 5}, - {3, 3, 7}, - {6, 1, 15}, - {6, 2, 17}, - {6, 3, 21}, - {6, 4, 29}, - {6, 5, 45}, - {7, 6, 77}, - {0, 32, -1}, /* low */ - {7, 32, 141} /* high */ -}; - -const Jbig2HuffmanParams jbig2_huffman_params_M = { FALSE, JBIG2_COUNTOF(jbig2_huffman_lines_M), jbig2_huffman_lines_M }; - -/* Table B.14 */ -static const Jbig2HuffmanLine jbig2_huffman_lines_N[] = { - {3, 0, -2}, - {3, 0, -1}, - {1, 0, 0}, - {3, 0, 1}, - {3, 0, 2}, - {0, 32, -1}, /* low */ - {0, 32, 3}, /* high */ -}; - -const Jbig2HuffmanParams jbig2_huffman_params_N = { FALSE, JBIG2_COUNTOF(jbig2_huffman_lines_N), jbig2_huffman_lines_N }; - -/* Table B.15 */ -static const Jbig2HuffmanLine jbig2_huffman_lines_O[] = { - {7, 4, -24}, - {6, 2, -8}, - {5, 1, -4}, - {4, 0, -2}, - {3, 0, -1}, - {1, 0, 0}, - {3, 0, 1}, - {4, 0, 2}, - {5, 1, 3}, - {6, 2, 5}, - {7, 4, 9}, - {7, 32, -25}, /* low */ - {7, 32, 25} /* high */ -}; - -const Jbig2HuffmanParams jbig2_huffman_params_O = { FALSE, JBIG2_COUNTOF(jbig2_huffman_lines_O), jbig2_huffman_lines_O }; diff --git a/pdfpatcher/JBig2/src/jbig2_image.c b/pdfpatcher/JBig2/src/jbig2_image.c deleted file mode 100644 index 9b9846af057e7bac197b755ac0949bbe41b8ff9e..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2_image.c +++ /dev/null @@ -1,506 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "os_types.h" - -#include -#include -#include /* memcpy() */ - -#include "jbig2.h" -#include "jbig2_priv.h" -#include "jbig2_image.h" - -/* allocate a Jbig2Image structure and its associated bitmap */ -Jbig2Image * -jbig2_image_new(Jbig2Ctx *ctx, uint32_t width, uint32_t height) -{ - Jbig2Image *image; - uint32_t stride; - - if (width == 0 || height == 0) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to create zero sized image"); - return NULL; - } - - image = jbig2_new(ctx, Jbig2Image, 1); - if (image == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to allocate image"); - return NULL; - } - - stride = ((width - 1) >> 3) + 1; /* generate a byte-aligned stride */ - - /* check for integer multiplication overflow */ - if (height > (INT32_MAX / stride)) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "integer multiplication overflow (stride=%u, height=%u)", stride, height); - jbig2_free(ctx->allocator, image); - return NULL; - } - image->data = jbig2_new(ctx, uint8_t, (size_t) height * stride); - if (image->data == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to allocate image data buffer (stride=%u, height=%u)", stride, height); - jbig2_free(ctx->allocator, image); - return NULL; - } - - image->width = width; - image->height = height; - image->stride = stride; - image->refcount = 1; - - return image; -} - -/* bump the reference count for an image pointer */ -Jbig2Image * -jbig2_image_reference(Jbig2Ctx *ctx, Jbig2Image *image) -{ - if (image) - image->refcount++; - return image; -} - -/* release an image pointer, freeing it it appropriate */ -void -jbig2_image_release(Jbig2Ctx *ctx, Jbig2Image *image) -{ - if (image == NULL) - return; - image->refcount--; - if (image->refcount == 0) - jbig2_image_free(ctx, image); -} - -/* free a Jbig2Image structure and its associated memory */ -void -jbig2_image_free(Jbig2Ctx *ctx, Jbig2Image *image) -{ - if (image != NULL) { - jbig2_free(ctx->allocator, image->data); - jbig2_free(ctx->allocator, image); - } -} - -/* resize a Jbig2Image */ -Jbig2Image * -jbig2_image_resize(Jbig2Ctx *ctx, Jbig2Image *image, uint32_t width, uint32_t height, int value) -{ - if (width == image->width) { - uint8_t *data; - - /* check for integer multiplication overflow */ - if (image->height > (INT32_MAX / image->stride)) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "integer multiplication overflow during resize (stride=%u, height=%u)", image->stride, height); - return NULL; - } - /* use the same stride, just change the length */ - data = jbig2_renew(ctx, image->data, uint8_t, (size_t) height * image->stride); - if (data == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to reallocate image"); - return NULL; - } - image->data = data; - if (height > image->height) { - const uint8_t fill = value ? 0xFF : 0x00; - memset(image->data + (size_t) image->height * image->stride, fill, ((size_t) height - image->height) * image->stride); - } - image->height = height; - - } else { - Jbig2Image *newimage; - int code; - - /* Unoptimized implementation, but it works. */ - - newimage = jbig2_image_new(ctx, width, height); - if (newimage == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to allocate resized image"); - return NULL; - } - jbig2_image_clear(ctx, newimage, value); - - code = jbig2_image_compose(ctx, newimage, image, 0, 0, JBIG2_COMPOSE_REPLACE); - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to compose image buffers when resizing"); - jbig2_image_release(ctx, newimage); - return NULL; - } - - /* if refcount > 1 the original image, its pointer must - be kept, so simply replaces its innards, and throw away - the empty new image shell. */ - jbig2_free(ctx->allocator, image->data); - image->width = newimage->width; - image->height = newimage->height; - image->stride = newimage->stride; - image->data = newimage->data; - jbig2_free(ctx->allocator, newimage); - } - - return image; -} - -static inline void -template_image_compose_opt(const uint8_t * JBIG2_RESTRICT ss, uint8_t * JBIG2_RESTRICT dd, int early, int late, uint8_t leftmask, uint8_t rightmask, uint32_t bytewidth_, uint32_t h, uint32_t shift, uint32_t dstride, uint32_t sstride, Jbig2ComposeOp op) -{ - int i; - uint32_t j; - int bytewidth = (int)bytewidth_; - - if (bytewidth == 1) { - for (j = 0; j < h; j++) { - /* Only 1 byte! */ - uint8_t v = (((early ? 0 : ss[0]<<8) | (late ? 0 : ss[1]))>>shift); - if (op == JBIG2_COMPOSE_OR) - *dd |= v & leftmask; - else if (op == JBIG2_COMPOSE_AND) - *dd &= (v & leftmask) | ~leftmask; - else if (op == JBIG2_COMPOSE_XOR) - *dd ^= v & leftmask; - else if (op == JBIG2_COMPOSE_XNOR) - *dd ^= (~v) & leftmask; - else /* Replace */ - *dd = (v & leftmask) | (*dd & ~leftmask); - dd += dstride; - ss += sstride; - } - return; - } - bytewidth -= 2; - if (shift == 0) { - ss++; - for (j = 0; j < h; j++) { - /* Left byte */ - const uint8_t * JBIG2_RESTRICT s = ss; - uint8_t * JBIG2_RESTRICT d = dd; - if (op == JBIG2_COMPOSE_OR) - *d++ |= *s++ & leftmask; - else if (op == JBIG2_COMPOSE_AND) - *d++ &= (*s++ & leftmask) | ~leftmask; - else if (op == JBIG2_COMPOSE_XOR) - *d++ ^= *s++ & leftmask; - else if (op == JBIG2_COMPOSE_XNOR) - *d++ ^= (~*s++) & leftmask; - else /* Replace */ - *d = (*s++ & leftmask) | (*d & ~leftmask), d++; - /* Central run */ - for (i = bytewidth; i != 0; i--) { - if (op == JBIG2_COMPOSE_OR) - *d++ |= *s++; - else if (op == JBIG2_COMPOSE_AND) - *d++ &= *s++; - else if (op == JBIG2_COMPOSE_XOR) - *d++ ^= *s++; - else if (op == JBIG2_COMPOSE_XNOR) - *d++ ^= ~*s++; - else /* Replace */ - *d++ = *s++; - } - /* Right byte */ - if (op == JBIG2_COMPOSE_OR) - *d |= *s & rightmask; - else if (op == JBIG2_COMPOSE_AND) - *d &= (*s & rightmask) | ~rightmask; - else if (op == JBIG2_COMPOSE_XOR) - *d ^= *s & rightmask; - else if (op == JBIG2_COMPOSE_XNOR) - *d ^= (~*s) & rightmask; - else /* Replace */ - *d = (*s & rightmask) | (*d & ~rightmask); - dd += dstride; - ss += sstride; - } - } else { - for (j = 0; j < h; j++) { - /* Left byte */ - const uint8_t * JBIG2_RESTRICT s = ss; - uint8_t * JBIG2_RESTRICT d = dd; - uint8_t s0, s1, v; - s0 = early ? 0 : *s; - s++; - s1 = *s++; - v = ((s0<<8) | s1)>>shift; - if (op == JBIG2_COMPOSE_OR) - *d++ |= v & leftmask; - else if (op == JBIG2_COMPOSE_AND) - *d++ &= (v & leftmask) | ~leftmask; - else if (op == JBIG2_COMPOSE_XOR) - *d++ ^= v & leftmask; - else if (op == JBIG2_COMPOSE_XNOR) - *d++ ^= (~v) & leftmask; - else /* Replace */ - *d = (v & leftmask) | (*d & ~leftmask), d++; - /* Central run */ - for (i = bytewidth; i > 0; i--) { - s0 = s1; s1 = *s++; - v = ((s0<<8) | s1)>>shift; - if (op == JBIG2_COMPOSE_OR) - *d++ |= v; - else if (op == JBIG2_COMPOSE_AND) - *d++ &= v; - else if (op == JBIG2_COMPOSE_XOR) - *d++ ^= v; - else if (op == JBIG2_COMPOSE_XNOR) - *d++ ^= ~v; - else /* Replace */ - *d++ = v; - } - /* Right byte */ - s0 = s1; s1 = (late ? 0 : *s); - v = (((s0<<8) | s1)>>shift); - if (op == JBIG2_COMPOSE_OR) - *d |= v & rightmask; - else if (op == JBIG2_COMPOSE_AND) - *d &= (v & rightmask) | ~rightmask; - else if (op == JBIG2_COMPOSE_XOR) - *d ^= v & rightmask; - else if (op == JBIG2_COMPOSE_XNOR) - *d ^= ~v & rightmask; - else /* Replace */ - *d = (v & rightmask) | (*d & ~rightmask); - dd += dstride; - ss += sstride; - } - } -} - -static void -jbig2_image_compose_opt_OR(const uint8_t *s, uint8_t *d, int early, int late, uint8_t mask, uint8_t rightmask, uint32_t bytewidth, uint32_t h, uint32_t shift, uint32_t dstride, uint32_t sstride) -{ - if (early || late) - template_image_compose_opt(s, d, early, late, mask, rightmask, bytewidth, h, shift, dstride, sstride, JBIG2_COMPOSE_OR); - else - template_image_compose_opt(s, d, 0, 0, mask, rightmask, bytewidth, h, shift, dstride, sstride, JBIG2_COMPOSE_OR); -} - -static void -jbig2_image_compose_opt_AND(const uint8_t *s, uint8_t *d, int early, int late, uint8_t mask, uint8_t rightmask, uint32_t bytewidth, uint32_t h, uint32_t shift, uint32_t dstride, uint32_t sstride) -{ - if (early || late) - template_image_compose_opt(s, d, early, late, mask, rightmask, bytewidth, h, shift, dstride, sstride, JBIG2_COMPOSE_AND); - else - template_image_compose_opt(s, d, 0, 0, mask, rightmask, bytewidth, h, shift, dstride, sstride, JBIG2_COMPOSE_AND); -} - -static void -jbig2_image_compose_opt_XOR(const uint8_t *s, uint8_t *d, int early, int late, uint8_t mask, uint8_t rightmask, uint32_t bytewidth, uint32_t h, uint32_t shift, uint32_t dstride, uint32_t sstride) -{ - if (early || late) - template_image_compose_opt(s, d, early, late, mask, rightmask, bytewidth, h, shift, dstride, sstride, JBIG2_COMPOSE_XOR); - else - template_image_compose_opt(s, d, 0, 0, mask, rightmask, bytewidth, h, shift, dstride, sstride, JBIG2_COMPOSE_XOR); -} - -static void -jbig2_image_compose_opt_XNOR(const uint8_t *s, uint8_t *d, int early, int late, uint8_t mask, uint8_t rightmask, uint32_t bytewidth, uint32_t h, uint32_t shift, uint32_t dstride, uint32_t sstride) -{ - if (early || late) - template_image_compose_opt(s, d, early, late, mask, rightmask, bytewidth, h, shift, dstride, sstride, JBIG2_COMPOSE_XNOR); - else - template_image_compose_opt(s, d, 0, 0, mask, rightmask, bytewidth, h, shift, dstride, sstride, JBIG2_COMPOSE_XNOR); -} - -static void -jbig2_image_compose_opt_REPLACE(const uint8_t *s, uint8_t *d, int early, int late, uint8_t mask, uint8_t rightmask, uint32_t bytewidth, uint32_t h, uint32_t shift, uint32_t dstride, uint32_t sstride) -{ - if (early || late) - template_image_compose_opt(s, d, early, late, mask, rightmask, bytewidth, h, shift, dstride, sstride, JBIG2_COMPOSE_REPLACE); - else - template_image_compose_opt(s, d, 0, 0, mask, rightmask, bytewidth, h, shift, dstride, sstride, JBIG2_COMPOSE_REPLACE); -} - -/* composite one jbig2_image onto another */ -int -jbig2_image_compose(Jbig2Ctx *ctx, Jbig2Image *dst, Jbig2Image *src, int x, int y, Jbig2ComposeOp op) -{ - uint32_t w, h; - uint32_t shift; - uint32_t leftbyte; - uint8_t *ss; - uint8_t *dd; - uint8_t leftmask, rightmask; - int early = x >= 0; - int late; - uint32_t bytewidth; - uint32_t syoffset = 0; - - if (src == NULL) - return 0; - - if ((UINT32_MAX - src->width < (uint32_t) (x > 0 ? x : -x)) || - (UINT32_MAX - src->height < (uint32_t) (y > 0 ? y : -y))) - { -#ifdef JBIG2_DEBUG - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, JBIG2_UNKNOWN_SEGMENT_NUMBER, "overflow in compose_image"); -#endif - return 0; - } - - /* This code takes a src image and combines it onto dst at offset (x,y), with operation op. */ - - /* Data is packed msb first within a byte, so with bits numbered: 01234567. - * Second byte is: 89abcdef. So to combine into a run, we use: - * (s[0]<<8) | s[1] == 0123456789abcdef. - * To read from src into dst at offset 3, we need to read: - * read: 0123456789abcdef... - * write: 0123456798abcdef... - * In general, to read from src and write into dst at offset x, we need to shift - * down by (x&7) bits to allow for bit alignment. So shift = x&7. - * So the 'central' part of our runs will see us doing: - * *d++ op= ((s[0]<<8)|s[1])>>shift; - * with special cases on the left and right edges of the run to mask. - * With the left hand edge, we have to be careful not to 'underread' the start of - * the src image; this is what the early flag is about. Similarly we have to be - * careful not to read off the right hand edge; this is what the late flag is for. - */ - - /* clip */ - w = src->width; - h = src->height; - shift = (x & 7); - ss = src->data - early; - - if (x < 0) { - if (w < (uint32_t) -x) - w = 0; - else - w += x; - ss += (-x-1)>>3; - x = 0; - } - if (y < 0) { - if (h < (uint32_t) -y) - h = 0; - else - h += y; - syoffset = -y * src->stride; - y = 0; - } - if ((uint32_t)x + w > dst->width) - { - if (dst->width < (uint32_t)x) - w = 0; - else - w = dst->width - x; - } - if ((uint32_t)y + h > dst->height) - { - if (dst->height < (uint32_t)y) - h = 0; - else - h = dst->height - y; - } -#ifdef JBIG2_DEBUG - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, JBIG2_UNKNOWN_SEGMENT_NUMBER, "compositing %dx%d at (%d, %d) after clipping", w, h, x, y); -#endif - - /* check for zero clipping region */ - if ((w <= 0) || (h <= 0)) { -#ifdef JBIG2_DEBUG - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, JBIG2_UNKNOWN_SEGMENT_NUMBER, "zero clipping region"); -#endif - return 0; - } - - leftbyte = (uint32_t) x >> 3; - dd = dst->data + y * dst->stride + leftbyte; - bytewidth = (((uint32_t) x + w - 1) >> 3) - leftbyte + 1; - leftmask = 255>>(x&7); - rightmask = (((x+w)&7) == 0) ? 255 : ~(255>>((x+w)&7)); - if (bytewidth == 1) - leftmask &= rightmask; - late = (ss + bytewidth >= src->data + ((src->width+7)>>3)); - ss += syoffset; - - switch(op) - { - case JBIG2_COMPOSE_OR: - jbig2_image_compose_opt_OR(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride); - break; - case JBIG2_COMPOSE_AND: - jbig2_image_compose_opt_AND(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride); - break; - case JBIG2_COMPOSE_XOR: - jbig2_image_compose_opt_XOR(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride); - break; - case JBIG2_COMPOSE_XNOR: - jbig2_image_compose_opt_XNOR(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride); - break; - case JBIG2_COMPOSE_REPLACE: - jbig2_image_compose_opt_REPLACE(ss, dd, early, late, leftmask, rightmask, bytewidth, h, shift, dst->stride, src->stride); - break; - } - - return 0; -} - -/* initialize an image bitmap to a constant value */ -void -jbig2_image_clear(Jbig2Ctx *ctx, Jbig2Image *image, int value) -{ - const uint8_t fill = value ? 0xFF : 0x00; - - memset(image->data, fill, image->stride * image->height); -} - -/* look up a pixel value in an image. - returns 0 outside the image frame for the convenience of - the template code -*/ -int -jbig2_image_get_pixel(Jbig2Image *image, int x, int y) -{ - const int w = image->width; - const int h = image->height; - const int byte = (x >> 3) + y * image->stride; - const int bit = 7 - (x & 7); - - if ((x < 0) || (x >= w)) - return 0; - if ((y < 0) || (y >= h)) - return 0; - - return ((image->data[byte] >> bit) & 1); -} - -/* set an individual pixel value in an image */ -void -jbig2_image_set_pixel(Jbig2Image *image, int x, int y, bool value) -{ - const int w = image->width; - const int h = image->height; - int scratch, mask; - int bit, byte; - - if ((x < 0) || (x >= w)) - return; - if ((y < 0) || (y >= h)) - return; - - byte = (x >> 3) + y * image->stride; - bit = 7 - (x & 7); - mask = (1 << bit) ^ 0xff; - - scratch = image->data[byte] & mask; - image->data[byte] = scratch | (value << bit); -} diff --git a/pdfpatcher/JBig2/src/jbig2_image_pbm.c b/pdfpatcher/JBig2/src/jbig2_image_pbm.c deleted file mode 100644 index d17eb3dd276dc23cf4d51d49e5da0380c5315d0b..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2_image_pbm.c +++ /dev/null @@ -1,162 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "os_types.h" - -#include -#include - -#include "jbig2.h" -#include "jbig2_priv.h" -#include "jbig2_image.h" -#include "jbig2_image_rw.h" - -/* take an image structure and write it to a file in pbm format */ - -int -jbig2_image_write_pbm_file(Jbig2Image *image, char *filename) -{ - FILE *out; - int code; - - if ((out = fopen(filename, "wb")) == NULL) { - fprintf(stderr, "unable to open '%s' for writing", filename); - return 1; - } - - code = jbig2_image_write_pbm(image, out); - - fclose(out); - return (code); -} - -/* write out an image struct as a pbm stream to an open file pointer */ - -int -jbig2_image_write_pbm(Jbig2Image *image, FILE *out) -{ - /* pbm header */ - fprintf(out, "P4\n%d %d\n", image->width, image->height); - - /* pbm format pads to a byte boundary, so we can - just write out the whole data buffer - NB: this assumes minimal stride for the width */ - fwrite(image->data, 1, image->height * image->stride, out); - - /* success */ - return 0; -} - -/* take an image from a file in pbm format */ -Jbig2Image * -jbig2_image_read_pbm_file(Jbig2Ctx *ctx, char *filename) -{ - FILE *in; - Jbig2Image *image; - - if ((in = fopen(filename, "rb")) == NULL) { - fprintf(stderr, "unable to open '%s' for reading\n", filename); - return NULL; - } - - image = jbig2_image_read_pbm(ctx, in); - - fclose(in); - - return (image); -} - -/* FIXME: should handle multi-image files */ -Jbig2Image * -jbig2_image_read_pbm(Jbig2Ctx *ctx, FILE *in) -{ - int i, dim[2]; - int done; - Jbig2Image *image; - int c; - char buf[32]; - - /* look for 'P4' magic */ - while ((c = fgetc(in)) != 'P') { - if (feof(in)) - return NULL; - } - if ((c = fgetc(in)) != '4') { - fprintf(stderr, "not a binary pbm file.\n"); - return NULL; - } - /* read size. we must find two decimal numbers representing - the image dimensions. 'done' will index whether we're - looking for the width or the height and 'i' will be our - array index for copying strings into our buffer */ - done = 0; - i = 0; - while (done < 2) { - c = fgetc(in); - /* skip whitespace */ - if (c == ' ' || c == '\t' || c == '\r' || c == '\n') - continue; - /* skip comments */ - if (c == '#') { - while ((c = fgetc(in)) != '\n'); - continue; - } - /* report unexpected eof */ - if (c == EOF) { - fprintf(stderr, "end-of-file parsing pbm header\n"); - return NULL; - } - if (isdigit(c)) { - buf[i++] = c; - while (isdigit(c = fgetc(in))) { - if (i >= 32) { - fprintf(stderr, "pbm parsing error\n"); - return NULL; - } - buf[i++] = c; - } - buf[i] = '\0'; - if (sscanf(buf, "%d", &dim[done]) != 1) { - fprintf(stderr, "failed to read pbm image dimensions\n"); - return NULL; - } - i = 0; - done++; - } - } - /* allocate image structure */ - image = jbig2_image_new(ctx, dim[0], dim[1]); - if (image == NULL) { - fprintf(stderr, "failed to allocate %dx%d image for pbm file\n", dim[0], dim[1]); - return NULL; - } - /* the pbm data is byte-aligned, so we can - do a simple block read */ - (void)fread(image->data, 1, image->height * image->stride, in); - if (feof(in)) { - fprintf(stderr, "unexpected end of pbm file.\n"); - jbig2_image_release(ctx, image); - return NULL; - } - /* success */ - return image; -} diff --git a/pdfpatcher/JBig2/src/jbig2_image_png.c b/pdfpatcher/JBig2/src/jbig2_image_png.c deleted file mode 100644 index aa56194bab320e44121f0250e684735d87d45ee4..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2_image_png.c +++ /dev/null @@ -1,152 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "os_types.h" - -#include -#include -#include - -#ifndef OLD_LIB_PNG -# if PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR < 2 -# define OLD_LIB_PNG 1 -# else -# define OLD_LIB_PNG 0 -# endif -#endif - -#if OLD_LIB_PNG -#include -#endif - -#define CVT_PTR(ptr) (ptr) - -#include "jbig2.h" -#include "jbig2_priv.h" -#include "jbig2_image.h" - -/* take an image structure and write it out in png format */ - -static void -jbig2_png_write_data(png_structp png_ptr, png_bytep data, png_size_t length) -{ - png_size_t check; - -#if OLD_LIB_PNG - png_FILE_p f = (png_FILE_p) png_ptr->io_ptr; -#else - png_FILE_p f = (png_FILE_p) png_get_io_ptr(png_ptr); -#endif - - check = fwrite(data, 1, length, f); - if (check != length) { - png_error(png_ptr, "write error"); - } -} - -static void -jbig2_png_flush(png_structp png_ptr) -{ -#if OLD_LIB_PNG - png_FILE_p f = (png_FILE_p) png_ptr->io_ptr; -#else - png_FILE_p f = (png_FILE_p) png_get_io_ptr(png_ptr); -#endif - - if (f != NULL) - fflush(f); -} - -/* write out an image struct in png format to an open file pointer */ - -int -jbig2_image_write_png(Jbig2Image *image, FILE *out) -{ - uint32_t i; - png_structp png; - png_infop info; - png_bytep rowpointer; - - png = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - if (png == NULL) { - fprintf(stderr, "unable to create png structure\n"); - return 2; - } - - info = png_create_info_struct(png); - if (info == NULL) { - fprintf(stderr, "unable to create png info structure\n"); - png_destroy_write_struct(&png, (png_infopp) NULL); - return 3; - } - - /* set/check error handling */ - if (setjmp(png_jmpbuf(png))) { - /* we've returned here after an internal error */ - fprintf(stderr, "internal error in libpng saving file\n"); - png_destroy_write_struct(&png, &info); - return 4; - } - - /* png_init_io() doesn't work linking dynamically to libpng on win32 - one has to either link statically or use callbacks because of runtime - variations */ - /* png_init_io(png, out); */ - png_set_write_fn(png, (png_voidp) out, jbig2_png_write_data, jbig2_png_flush); - - /* now we fill out the info structure with our format data */ - png_set_IHDR(png, info, image->width, image->height, 1, PNG_COLOR_TYPE_GRAY, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); - png_write_info(png, info); - - /* png natively treats 0 as black. This will convert for us */ - png_set_invert_mono(png); - - /* write out each row in turn */ - rowpointer = (png_bytep) image->data; - for (i = 0; i < image->height; i++) { - png_write_row(png, rowpointer); - rowpointer += image->stride; - } - - /* finish and clean up */ - png_write_end(png, info); - png_destroy_write_struct(&png, &info); - - return 0; -} - -int -jbig2_image_write_png_file(Jbig2Image *image, char *filename) -{ - FILE *out; - int code; - - if ((out = fopen(filename, "wb")) == NULL) { - fprintf(stderr, "unable to open '%s' for writing\n", filename); - return 1; - } - - code = jbig2_image_write_png(image, out); - - fclose(out); - return (code); -} diff --git a/pdfpatcher/JBig2/src/jbig2_mmr.c b/pdfpatcher/JBig2/src/jbig2_mmr.c deleted file mode 100644 index 4dc48e463ec03aeecdb061cc60ea129d76817b74..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2_mmr.c +++ /dev/null @@ -1,1282 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -/* An implementation of MMR decoding. This is based on the - implementation in Fitz, which in turn is based on the one - in Ghostscript. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "os_types.h" - -#include -#include -#include -#include - -#include "jbig2.h" -#include "jbig2_priv.h" -#include "jbig2_arith.h" -#include "jbig2_generic.h" -#include "jbig2_image.h" -#include "jbig2_mmr.h" -#include "jbig2_segment.h" - -typedef struct { - uint32_t width; - uint32_t height; - const byte *data; - size_t size; - size_t consumed_bits; - uint32_t data_index; - uint32_t bit_index; - uint32_t word; -} Jbig2MmrCtx; - -#define MINUS1 UINT32_MAX -#define ERROR -1 -#define ZEROES -2 -#define UNCOMPRESSED -3 - -static void -jbig2_decode_mmr_init(Jbig2MmrCtx *mmr, int width, int height, const byte *data, size_t size) -{ - mmr->width = width; - mmr->height = height; - mmr->data = data; - mmr->size = size; - mmr->data_index = 0; - mmr->bit_index = 32; - mmr->word = 0; - mmr->consumed_bits = 0; - - while (mmr->bit_index >= 8 && mmr->data_index < mmr->size) { - mmr->bit_index -= 8; - mmr->word |= (mmr->data[mmr->data_index] << mmr->bit_index); - mmr->data_index++; - } -} - -static void -jbig2_decode_mmr_consume(Jbig2MmrCtx *mmr, int n_bits) -{ - mmr->consumed_bits += n_bits; - if (mmr->consumed_bits > mmr->size * 8) - mmr->consumed_bits = mmr->size * 8; - - mmr->word <<= n_bits; - mmr->bit_index += n_bits; - while (mmr->bit_index >= 8 && mmr->data_index < mmr->size) { - mmr->bit_index -= 8; - mmr->word |= (mmr->data[mmr->data_index] << mmr->bit_index); - mmr->data_index++; - } -} - -/* - the first 2^(initialbits) entries map bit patterns to decodes - let's say initial_bits is 8 for the sake of example - and that the code is 1001 - that means that entries 0x90 .. 0x9f have the entry { val, 4 } - because those are all the bytes that start with the code - and the 4 is the length of the code -... if (n_bits > initial_bits) ... - anyway, in that case, it basically points to a mini table - the n_bits is the maximum length of all codes beginning with that byte - so 2^(n_bits - initial_bits) is the size of the mini-table - peter came up with this, and it makes sense -*/ - -typedef struct { - short val; - short n_bits; -} mmr_table_node; - -/* white decode table (runlength huffman codes) */ -const mmr_table_node jbig2_mmr_white_decode[] = { - {256, 12}, - {272, 12}, - {29, 8}, - {30, 8}, - {45, 8}, - {46, 8}, - {22, 7}, - {22, 7}, - {23, 7}, - {23, 7}, - {47, 8}, - {48, 8}, - {13, 6}, - {13, 6}, - {13, 6}, - {13, 6}, - {20, 7}, - {20, 7}, - {33, 8}, - {34, 8}, - {35, 8}, - {36, 8}, - {37, 8}, - {38, 8}, - {19, 7}, - {19, 7}, - {31, 8}, - {32, 8}, - {1, 6}, - {1, 6}, - {1, 6}, - {1, 6}, - {12, 6}, - {12, 6}, - {12, 6}, - {12, 6}, - {53, 8}, - {54, 8}, - {26, 7}, - {26, 7}, - {39, 8}, - {40, 8}, - {41, 8}, - {42, 8}, - {43, 8}, - {44, 8}, - {21, 7}, - {21, 7}, - {28, 7}, - {28, 7}, - {61, 8}, - {62, 8}, - {63, 8}, - {0, 8}, - {320, 8}, - {384, 8}, - {10, 5}, - {10, 5}, - {10, 5}, - {10, 5}, - {10, 5}, - {10, 5}, - {10, 5}, - {10, 5}, - {11, 5}, - {11, 5}, - {11, 5}, - {11, 5}, - {11, 5}, - {11, 5}, - {11, 5}, - {11, 5}, - {27, 7}, - {27, 7}, - {59, 8}, - {60, 8}, - {288, 9}, - {290, 9}, - {18, 7}, - {18, 7}, - {24, 7}, - {24, 7}, - {49, 8}, - {50, 8}, - {51, 8}, - {52, 8}, - {25, 7}, - {25, 7}, - {55, 8}, - {56, 8}, - {57, 8}, - {58, 8}, - {192, 6}, - {192, 6}, - {192, 6}, - {192, 6}, - {1664, 6}, - {1664, 6}, - {1664, 6}, - {1664, 6}, - {448, 8}, - {512, 8}, - {292, 9}, - {640, 8}, - {576, 8}, - {294, 9}, - {296, 9}, - {298, 9}, - {300, 9}, - {302, 9}, - {256, 7}, - {256, 7}, - {2, 4}, - {2, 4}, - {2, 4}, - {2, 4}, - {2, 4}, - {2, 4}, - {2, 4}, - {2, 4}, - {2, 4}, - {2, 4}, - {2, 4}, - {2, 4}, - {2, 4}, - {2, 4}, - {2, 4}, - {2, 4}, - {3, 4}, - {3, 4}, - {3, 4}, - {3, 4}, - {3, 4}, - {3, 4}, - {3, 4}, - {3, 4}, - {3, 4}, - {3, 4}, - {3, 4}, - {3, 4}, - {3, 4}, - {3, 4}, - {3, 4}, - {3, 4}, - {128, 5}, - {128, 5}, - {128, 5}, - {128, 5}, - {128, 5}, - {128, 5}, - {128, 5}, - {128, 5}, - {8, 5}, - {8, 5}, - {8, 5}, - {8, 5}, - {8, 5}, - {8, 5}, - {8, 5}, - {8, 5}, - {9, 5}, - {9, 5}, - {9, 5}, - {9, 5}, - {9, 5}, - {9, 5}, - {9, 5}, - {9, 5}, - {16, 6}, - {16, 6}, - {16, 6}, - {16, 6}, - {17, 6}, - {17, 6}, - {17, 6}, - {17, 6}, - {4, 4}, - {4, 4}, - {4, 4}, - {4, 4}, - {4, 4}, - {4, 4}, - {4, 4}, - {4, 4}, - {4, 4}, - {4, 4}, - {4, 4}, - {4, 4}, - {4, 4}, - {4, 4}, - {4, 4}, - {4, 4}, - {5, 4}, - {5, 4}, - {5, 4}, - {5, 4}, - {5, 4}, - {5, 4}, - {5, 4}, - {5, 4}, - {5, 4}, - {5, 4}, - {5, 4}, - {5, 4}, - {5, 4}, - {5, 4}, - {5, 4}, - {5, 4}, - {14, 6}, - {14, 6}, - {14, 6}, - {14, 6}, - {15, 6}, - {15, 6}, - {15, 6}, - {15, 6}, - {64, 5}, - {64, 5}, - {64, 5}, - {64, 5}, - {64, 5}, - {64, 5}, - {64, 5}, - {64, 5}, - {6, 4}, - {6, 4}, - {6, 4}, - {6, 4}, - {6, 4}, - {6, 4}, - {6, 4}, - {6, 4}, - {6, 4}, - {6, 4}, - {6, 4}, - {6, 4}, - {6, 4}, - {6, 4}, - {6, 4}, - {6, 4}, - {7, 4}, - {7, 4}, - {7, 4}, - {7, 4}, - {7, 4}, - {7, 4}, - {7, 4}, - {7, 4}, - {7, 4}, - {7, 4}, - {7, 4}, - {7, 4}, - {7, 4}, - {7, 4}, - {7, 4}, - {7, 4}, - {-2, 3}, - {-2, 3}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-3, 4}, - {1792, 3}, - {1792, 3}, - {1984, 4}, - {2048, 4}, - {2112, 4}, - {2176, 4}, - {2240, 4}, - {2304, 4}, - {1856, 3}, - {1856, 3}, - {1920, 3}, - {1920, 3}, - {2368, 4}, - {2432, 4}, - {2496, 4}, - {2560, 4}, - {1472, 1}, - {1536, 1}, - {1600, 1}, - {1728, 1}, - {704, 1}, - {768, 1}, - {832, 1}, - {896, 1}, - {960, 1}, - {1024, 1}, - {1088, 1}, - {1152, 1}, - {1216, 1}, - {1280, 1}, - {1344, 1}, - {1408, 1} -}; - -/* black decode table (runlength huffman codes) */ -const mmr_table_node jbig2_mmr_black_decode[] = { - {128, 12}, - {160, 13}, - {224, 12}, - {256, 12}, - {10, 7}, - {11, 7}, - {288, 12}, - {12, 7}, - {9, 6}, - {9, 6}, - {8, 6}, - {8, 6}, - {7, 5}, - {7, 5}, - {7, 5}, - {7, 5}, - {6, 4}, - {6, 4}, - {6, 4}, - {6, 4}, - {6, 4}, - {6, 4}, - {6, 4}, - {6, 4}, - {5, 4}, - {5, 4}, - {5, 4}, - {5, 4}, - {5, 4}, - {5, 4}, - {5, 4}, - {5, 4}, - {1, 3}, - {1, 3}, - {1, 3}, - {1, 3}, - {1, 3}, - {1, 3}, - {1, 3}, - {1, 3}, - {1, 3}, - {1, 3}, - {1, 3}, - {1, 3}, - {1, 3}, - {1, 3}, - {1, 3}, - {1, 3}, - {4, 3}, - {4, 3}, - {4, 3}, - {4, 3}, - {4, 3}, - {4, 3}, - {4, 3}, - {4, 3}, - {4, 3}, - {4, 3}, - {4, 3}, - {4, 3}, - {4, 3}, - {4, 3}, - {4, 3}, - {4, 3}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {3, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {2, 2}, - {-2, 4}, - {-2, 4}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-1, 0}, - {-3, 5}, - {1792, 4}, - {1792, 4}, - {1984, 5}, - {2048, 5}, - {2112, 5}, - {2176, 5}, - {2240, 5}, - {2304, 5}, - {1856, 4}, - {1856, 4}, - {1920, 4}, - {1920, 4}, - {2368, 5}, - {2432, 5}, - {2496, 5}, - {2560, 5}, - {18, 3}, - {18, 3}, - {18, 3}, - {18, 3}, - {18, 3}, - {18, 3}, - {18, 3}, - {18, 3}, - {52, 5}, - {52, 5}, - {640, 6}, - {704, 6}, - {768, 6}, - {832, 6}, - {55, 5}, - {55, 5}, - {56, 5}, - {56, 5}, - {1280, 6}, - {1344, 6}, - {1408, 6}, - {1472, 6}, - {59, 5}, - {59, 5}, - {60, 5}, - {60, 5}, - {1536, 6}, - {1600, 6}, - {24, 4}, - {24, 4}, - {24, 4}, - {24, 4}, - {25, 4}, - {25, 4}, - {25, 4}, - {25, 4}, - {1664, 6}, - {1728, 6}, - {320, 5}, - {320, 5}, - {384, 5}, - {384, 5}, - {448, 5}, - {448, 5}, - {512, 6}, - {576, 6}, - {53, 5}, - {53, 5}, - {54, 5}, - {54, 5}, - {896, 6}, - {960, 6}, - {1024, 6}, - {1088, 6}, - {1152, 6}, - {1216, 6}, - {64, 3}, - {64, 3}, - {64, 3}, - {64, 3}, - {64, 3}, - {64, 3}, - {64, 3}, - {64, 3}, - {13, 1}, - {13, 1}, - {13, 1}, - {13, 1}, - {13, 1}, - {13, 1}, - {13, 1}, - {13, 1}, - {13, 1}, - {13, 1}, - {13, 1}, - {13, 1}, - {13, 1}, - {13, 1}, - {13, 1}, - {13, 1}, - {23, 4}, - {23, 4}, - {50, 5}, - {51, 5}, - {44, 5}, - {45, 5}, - {46, 5}, - {47, 5}, - {57, 5}, - {58, 5}, - {61, 5}, - {256, 5}, - {16, 3}, - {16, 3}, - {16, 3}, - {16, 3}, - {17, 3}, - {17, 3}, - {17, 3}, - {17, 3}, - {48, 5}, - {49, 5}, - {62, 5}, - {63, 5}, - {30, 5}, - {31, 5}, - {32, 5}, - {33, 5}, - {40, 5}, - {41, 5}, - {22, 4}, - {22, 4}, - {14, 1}, - {14, 1}, - {14, 1}, - {14, 1}, - {14, 1}, - {14, 1}, - {14, 1}, - {14, 1}, - {14, 1}, - {14, 1}, - {14, 1}, - {14, 1}, - {14, 1}, - {14, 1}, - {14, 1}, - {14, 1}, - {15, 2}, - {15, 2}, - {15, 2}, - {15, 2}, - {15, 2}, - {15, 2}, - {15, 2}, - {15, 2}, - {128, 5}, - {192, 5}, - {26, 5}, - {27, 5}, - {28, 5}, - {29, 5}, - {19, 4}, - {19, 4}, - {20, 4}, - {20, 4}, - {34, 5}, - {35, 5}, - {36, 5}, - {37, 5}, - {38, 5}, - {39, 5}, - {21, 4}, - {21, 4}, - {42, 5}, - {43, 5}, - {0, 3}, - {0, 3}, - {0, 3}, - {0, 3} -}; - -#define getbit(buf, x) ( ( buf[x >> 3] >> ( 7 - (x & 7) ) ) & 1 ) - -/* On platforms that enforce aligned memory accesses, we can't just - * cast the byte * to the type of object we are accessing, we have - * unpack the requisite number of bytes, and deal with it that way. - * Note that the comments below about being 16/32 bit boundaries - * is referring to offsets into the byte stream, *not* memory - * addresses. - */ -#define getword16(b) ((uint16_t)(b[0] | (b[1] << 8))) -#define getword32(b) ((uint32_t)(getword16(b) | (getword16((b + 2)) << 16))) - -static uint32_t -jbig2_find_changing_element(const byte *line, uint32_t x, uint32_t w) -{ - int a; - uint8_t all8; - uint16_t all16; - uint32_t all32; - - if (line == NULL) - return w; - - if (x == MINUS1) { - a = 0; - x = 0; - } else if (x < w) { - a = getbit(line, x); - x++; - } else { - return x; - } - - /* We will be looking for a uint8 or uint16 or uint32 that has at least one - bit different from , so prepare some useful values for comparison. */ - all8 = (a) ? 0xff : 0; - all16 = (a) ? 0xffff : 0; - all32 = (a) ? 0xffffffff : 0; - - /* Check individual bits up to next 8-bit boundary. - - [Would it be worth looking at top 4 bits, then at 2 bits then at 1 bit, - instead of iterating over all 8 bits? */ - - if ( ((uint8_t*) line)[ x / 8] == all8) { - /* Don't bother checking individual bits if the enclosing uint8 equals - all8 - just move to the next byte. */ - x = x / 8 * 8 + 8; - if (x >= w) { - x = w; - goto end; - } - } else { - for(;;) { - if (x == w) { - goto end; - } - if (x % 8 == 0) { - break; - } - if (getbit(line, x) != a) { - goto end; - } - x += 1; - } - } - - assert(x % 8 == 0); - /* Check next uint8 if we are not on 16-bit boundary. */ - if (x % 16) { - if (w - x < 8) { - goto check1; - } - if ( ((uint8_t*) line)[ x / 8] != all8) { - goto check1; - } - x += 8; /* This will make x a multiple of 16. */ - } - - assert(x % 16 == 0); - /* Check next uint16 if we are not on 32-bit boundary. */ - if (x % 32) { - if (w - x < 16) { - goto check8; - } - if ( getword16((line + (x / 8))) != all16) { - goto check8_no_eof; - } - x += 16; /* This will make x a multiple of 32. */ - } - - /* We are now on a 32-bit boundary. Check uint32's until we reach last - sub-32-bit region. */ - assert(x % 32 == 0); - for(;;) { - if (w - x < 32) { - /* We could still look at the uint32 here - if it equals all32, we - know there is no match before so could do {x = w; goto end;}. - - But for now we simply fall into the epilogue checking, which will - look at the next uint16, then uint8, then last 8 bits. */ - goto check16; - } - if ( getword32((line + (x / 8))) != all32) { - goto check16_no_eof; - } - x += 32; - } - - /* Check next uint16. */ -check16: - assert(x % 16 == 0); - if (w - x < 16) { - goto check8; - } -check16_no_eof: - assert(w - x >= 16); - if ( getword16((line + (x / 8))) != all16) { - goto check8_no_eof; - } - x += 16; - - /* Check next uint8. */ -check8: - assert(x % 8 == 0); - if (w - x < 8) { - goto check1; - } -check8_no_eof: - assert(w - x >= 8); - if ( ((uint8_t*) line)[x/8] != all8) { - goto check1; - } - x += 8; - - /* Check up to the next 8 bits. */ -check1: - assert(x % 8 == 0); - if ( ((uint8_t*) line)[ x / 8] == all8) { - x = w; - goto end; - } - { - for(;;) { - if (x == w) { - goto end; - } - if (getbit(line, x) != a) { - goto end; - } - x += 1; - } - } - -end: - return x; -} - -#undef getword16 -#undef getword32 - -static uint32_t -jbig2_find_changing_element_of_color(const byte *line, uint32_t x, uint32_t w, int color) -{ - if (line == NULL) - return w; - x = jbig2_find_changing_element(line, x, w); - if (x < w && getbit(line, x) != color) - x = jbig2_find_changing_element(line, x, w); - return x; -} - -static const byte lm[8] = { 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x01 }; -static const byte rm[8] = { 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE }; - -static void -jbig2_set_bits(byte *line, uint32_t x0, uint32_t x1) -{ - uint32_t a0, a1, b0, b1, a; - - a0 = x0 >> 3; - a1 = x1 >> 3; - - b0 = x0 & 7; - b1 = x1 & 7; - - if (a0 == a1) { - line[a0] |= lm[b0] & rm[b1]; - } else { - line[a0] |= lm[b0]; - for (a = a0 + 1; a < a1; a++) - line[a] = 0xFF; - if (b1) - line[a1] |= rm[b1]; - } -} - -static int -jbig2_decode_get_code(Jbig2MmrCtx *mmr, const mmr_table_node *table, int initial_bits) -{ - uint32_t word = mmr->word; - int table_ix = word >> (32 - initial_bits); - int val = table[table_ix].val; - int n_bits = table[table_ix].n_bits; - - if (n_bits > initial_bits) { - int mask = (1 << (32 - initial_bits)) - 1; - - table_ix = val + ((word & mask) >> (32 - n_bits)); - val = table[table_ix].val; - n_bits = initial_bits + table[table_ix].n_bits; - } - - jbig2_decode_mmr_consume(mmr, n_bits); - - return val; -} - -static int -jbig2_decode_get_run(Jbig2Ctx *ctx, Jbig2MmrCtx *mmr, const mmr_table_node *table, int initial_bits) -{ - int result = 0; - int val; - - do { - val = jbig2_decode_get_code(mmr, table, initial_bits); - if (val == ERROR) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "invalid code detected in MMR-coded data"); - else if (val == UNCOMPRESSED) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "uncompressed code in MMR-coded data"); - else if (val == ZEROES) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "zeroes code in MMR-coded data"); - result += val; - } while (val >= 64); - - return result; -} - -static int -jbig2_decode_mmr_line(Jbig2Ctx *ctx, Jbig2MmrCtx *mmr, const byte *ref, byte *dst, int *eofb) -{ - uint32_t a0 = MINUS1; - uint32_t a1, a2, b1, b2; - int c = 0; /* 0 is white, black is 1 */ - - while (1) { - uint32_t word = mmr->word; - - /* printf ("%08x\n", word); */ - - if (a0 != MINUS1 && a0 >= mmr->width) - break; - - if ((word >> (32 - 3)) == 1) { - int white_run, black_run; - - jbig2_decode_mmr_consume(mmr, 3); - - if (a0 == MINUS1) - a0 = 0; - - if (c == 0) { - white_run = jbig2_decode_get_run(ctx, mmr, jbig2_mmr_white_decode, 8); - if (white_run < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to decode white H run"); - black_run = jbig2_decode_get_run(ctx, mmr, jbig2_mmr_black_decode, 7); - if (black_run < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to decode black H run"); - /* printf ("H %d %d\n", white_run, black_run); */ - a1 = a0 + white_run; - a2 = a1 + black_run; - if (a1 > mmr->width) - a1 = mmr->width; - if (a2 > mmr->width) - a2 = mmr->width; - if (a2 < a1) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "ignoring negative black H run"); - a2 = a1; - } - if (a1 < mmr->width) - jbig2_set_bits(dst, a1, a2); - a0 = a2; - } else { - black_run = jbig2_decode_get_run(ctx, mmr, jbig2_mmr_black_decode, 7); - if (black_run < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to decode black H run"); - white_run = jbig2_decode_get_run(ctx, mmr, jbig2_mmr_white_decode, 8); - if (white_run < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to decode white H run"); - /* printf ("H %d %d\n", black_run, white_run); */ - a1 = a0 + black_run; - a2 = a1 + white_run; - if (a1 > mmr->width) - a1 = mmr->width; - if (a2 > mmr->width) - a2 = mmr->width; - if (a1 < a0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "ignoring negative white H run"); - a1 = a0; - } - if (a0 < mmr->width) - jbig2_set_bits(dst, a0, a1); - a0 = a2; - } - } - - else if ((word >> (32 - 4)) == 1) { - /* printf ("P\n"); */ - jbig2_decode_mmr_consume(mmr, 4); - b1 = jbig2_find_changing_element_of_color(ref, a0, mmr->width, !c); - b2 = jbig2_find_changing_element(ref, b1, mmr->width); - if (c) { - if (b2 < a0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "ignoring negative P run"); - b2 = a0; - } - if (a0 < mmr->width) - jbig2_set_bits(dst, a0, b2); - } - a0 = b2; - } - - else if ((word >> (32 - 1)) == 1) { - /* printf ("V(0)\n"); */ - jbig2_decode_mmr_consume(mmr, 1); - b1 = jbig2_find_changing_element_of_color(ref, a0, mmr->width, !c); - if (c) { - if (b1 < a0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "ignoring negative V(0) run"); - b1 = a0; - } - if (a0 < mmr->width) - jbig2_set_bits(dst, a0, b1); - } - a0 = b1; - c = !c; - } - - else if ((word >> (32 - 3)) == 3) { - /* printf ("VR(1)\n"); */ - jbig2_decode_mmr_consume(mmr, 3); - b1 = jbig2_find_changing_element_of_color(ref, a0, mmr->width, !c); - if (b1 + 1 <= mmr->width) - b1 += 1; - if (c) { - if (b1 < a0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "ignoring negative VR(1) run"); - b1 = a0; - } - if (a0 < mmr->width) - jbig2_set_bits(dst, a0, b1); - } - a0 = b1; - c = !c; - } - - else if ((word >> (32 - 6)) == 3) { - /* printf ("VR(2)\n"); */ - jbig2_decode_mmr_consume(mmr, 6); - b1 = jbig2_find_changing_element_of_color(ref, a0, mmr->width, !c); - if (b1 + 2 <= mmr->width) - b1 += 2; - if (c) { - if (b1 < a0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "ignoring negative VR(2) run"); - b1 = a0; - } - if (a0 < mmr->width) - jbig2_set_bits(dst, a0, b1); - } - a0 = b1; - c = !c; - } - - else if ((word >> (32 - 7)) == 3) { - /* printf ("VR(3)\n"); */ - jbig2_decode_mmr_consume(mmr, 7); - b1 = jbig2_find_changing_element_of_color(ref, a0, mmr->width, !c); - if (b1 + 3 <= mmr->width) - b1 += 3; - if (c) { - if (b1 < a0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "ignoring negative VR(3) run"); - b1 = a0; - } - if (a0 < mmr->width) - jbig2_set_bits(dst, a0, b1); - } - a0 = b1; - c = !c; - } - - else if ((word >> (32 - 3)) == 2) { - /* printf ("VL(1)\n"); */ - jbig2_decode_mmr_consume(mmr, 3); - b1 = jbig2_find_changing_element_of_color(ref, a0, mmr->width, !c); - if (b1 >= 1) - b1 -= 1; - if (c) { - if (b1 < a0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "ignoring negative VL(1) run"); - b1 = a0; - } - if (a0 < mmr->width) - jbig2_set_bits(dst, a0, b1); - } - a0 = b1; - c = !c; - } - - else if ((word >> (32 - 6)) == 2) { - /* printf ("VL(2)\n"); */ - jbig2_decode_mmr_consume(mmr, 6); - b1 = jbig2_find_changing_element_of_color(ref, a0, mmr->width, !c); - if (b1 >= 2) - b1 -= 2; - if (c) { - if (b1 < a0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "ignoring negative VL(2) run"); - b1 = a0; - } - if (a0 < mmr->width) - jbig2_set_bits(dst, a0, b1); - } - a0 = b1; - c = !c; - } - - else if ((word >> (32 - 7)) == 2) { - /* printf ("VL(3)\n"); */ - jbig2_decode_mmr_consume(mmr, 7); - b1 = jbig2_find_changing_element_of_color(ref, a0, mmr->width, !c); - if (b1 >= 3) - b1 -= 3; - if (c) { - if (b1 < a0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "ignoring negative VL(3) run"); - b1 = a0; - } - if (a0 < mmr->width) - jbig2_set_bits(dst, a0, b1); - } - a0 = b1; - c = !c; - } - - else if ((word >> (32 - 24)) == 0x1001) { - /* printf ("EOFB\n"); */ - jbig2_decode_mmr_consume(mmr, 24); - *eofb = 1; - break; - } - - else - break; - } - - return 0; -} - -int -jbig2_decode_generic_mmr(Jbig2Ctx *ctx, Jbig2Segment *segment, const Jbig2GenericRegionParams *params, const byte *data, size_t size, Jbig2Image *image) -{ - Jbig2MmrCtx mmr; - const uint32_t rowstride = image->stride; - byte *dst = image->data; - byte *ref = NULL; - uint32_t y; - int code = 0; - int eofb = 0; - - jbig2_decode_mmr_init(&mmr, image->width, image->height, data, size); - - for (y = 0; !eofb && y < image->height; y++) { - memset(dst, 0, rowstride); - code = jbig2_decode_mmr_line(ctx, &mmr, ref, dst, &eofb); - if (code < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode mmr line"); - ref = dst; - dst += rowstride; - } - - if (eofb && y < image->height) { - memset(dst, 0, rowstride * (image->height - y)); - } - - return code; -} - -/** - * jbig2_decode_halftone_mmr: decode mmr region inside of halftones - * - * @ctx: jbig2 decoder context - * @params: parameters for decoding - * @data: pointer to text region data to be decoded - * @size: length of text region data - * @image: return of decoded image - * @consumed_bytes: return of consumed bytes from @data - * - * MMR decoding that consumes EOFB and returns consumed bytes (@consumed_bytes) - * - * returns: 0 - **/ -int -jbig2_decode_halftone_mmr(Jbig2Ctx *ctx, const Jbig2GenericRegionParams *params, const byte *data, size_t size, Jbig2Image *image, size_t *consumed_bytes) -{ - Jbig2MmrCtx mmr; - const uint32_t rowstride = image->stride; - byte *dst = image->data; - byte *ref = NULL; - uint32_t y; - int code = 0; - const uint32_t EOFB = 0x001001; - int eofb = 0; - - jbig2_decode_mmr_init(&mmr, image->width, image->height, data, size); - - for (y = 0; !eofb && y < image->height; y++) { - memset(dst, 0, rowstride); - code = jbig2_decode_mmr_line(ctx, &mmr, ref, dst, &eofb); - if (code < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to decode halftone mmr line"); - ref = dst; - dst += rowstride; - } - - if (eofb && y < image->height) { - memset(dst, 0, rowstride * (image->height - y)); - } - - /* test for EOFB (see section 6.2.6) */ - if (mmr.word >> 8 == EOFB) { - jbig2_decode_mmr_consume(&mmr, 24); - } - - *consumed_bytes += (mmr.consumed_bits + 7) / 8; - return code; -} diff --git a/pdfpatcher/JBig2/src/jbig2_page.c b/pdfpatcher/JBig2/src/jbig2_page.c deleted file mode 100644 index e8ce3a7cbb60f01620bb298852ce14f8bce0b696..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2_page.c +++ /dev/null @@ -1,368 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "os_types.h" - -#include - -#ifdef OUTPUT_PBM -#include -#endif - -#include "jbig2.h" -#include "jbig2_priv.h" -#include "jbig2_image.h" -#include "jbig2_page.h" -#include "jbig2_segment.h" - -/* dump the page struct info */ -static void -dump_page_info(Jbig2Ctx *ctx, Jbig2Segment *segment, Jbig2Page *page) -{ - if (page->x_resolution == 0) { - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "page %d image is %dx%d (unknown res)", page->number, page->width, page->height); - } else if (page->x_resolution == page->y_resolution) { - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "page %d image is %dx%d (%d ppm)", page->number, page->width, page->height, page->x_resolution); - } else { - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, - "page %d image is %dx%d (%dx%d ppm)", page->number, page->width, page->height, page->x_resolution, page->y_resolution); - } - if (page->striped) { - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "\tmaximum stripe size: %d", page->stripe_size); - } -} - -/** - * jbig2_page_info: parse page info segment - * - * Parse the page info segment data and fill out a corresponding - * Jbig2Page struct and ready it for subsequent rendered data, - * including allocating an image buffer for the page (or the first stripe) - **/ -int -jbig2_page_info(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data) -{ - Jbig2Page *page, *pages; - - /* a new page info segment implies the previous page is finished */ - page = &(ctx->pages[ctx->current_page]); - if (page->number != 0 && (page->state == JBIG2_PAGE_NEW || page->state == JBIG2_PAGE_FREE)) { - page->state = JBIG2_PAGE_COMPLETE; - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unexpected page info segment, marking previous page finished"); - } - - /* find a free page */ - { - size_t index, j; - - index = ctx->current_page; - while (ctx->pages[index].state != JBIG2_PAGE_FREE) { - index++; - if (index >= ctx->max_page_index) { - /* grow the list */ - - if (ctx->max_page_index == UINT32_MAX) { - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "too many pages in jbig2 image"); - } - else if (ctx->max_page_index > (UINT32_MAX >> 2)) { - ctx->max_page_index = UINT32_MAX; - } - - pages = jbig2_renew(ctx, ctx->pages, Jbig2Page, (ctx->max_page_index <<= 2)); - if (pages == NULL) { - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to reallocate pages"); - } - ctx->pages = pages; - for (j = index; j < ctx->max_page_index; j++) { - ctx->pages[j].state = JBIG2_PAGE_FREE; - ctx->pages[j].number = 0; - ctx->pages[j].image = NULL; - } - } - } - page = &(ctx->pages[index]); - ctx->current_page = index; - page->state = JBIG2_PAGE_NEW; - page->number = segment->page_association; - } - - /* FIXME: would be nice if we tried to work around this */ - if (segment->data_length < 19) { - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short"); - } - - /* 7.4.8.x */ - page->width = jbig2_get_uint32(segment_data); - page->height = jbig2_get_uint32(segment_data + 4); - - page->x_resolution = jbig2_get_uint32(segment_data + 8); - page->y_resolution = jbig2_get_uint32(segment_data + 12); - page->flags = segment_data[16]; - /* Check for T.88 amendment 3 */ - if (page->flags & 0x80) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "page segment indicates use of color segments (NYI)"); - - /* 7.4.8.6 */ - { - int16_t striping = jbig2_get_int16(segment_data + 17); - - if (striping & 0x8000) { - page->striped = TRUE; - page->stripe_size = striping & 0x7FFF; - } else { - page->striped = FALSE; - page->stripe_size = 0; /* would page->height be better? */ - } - } - if (page->height == 0xFFFFFFFF && page->striped == FALSE) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "height is unspecified but page is not marked as striped, assuming striped with maximum strip size"); - page->striped = TRUE; - page->stripe_size = 0x7FFF; - } - page->end_row = 0; - - if (segment->data_length > 19) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "extra data in segment"); - } - - dump_page_info(ctx, segment, page); - - /* allocate an appropriate page image buffer */ - /* 7.4.8.2 */ - if (page->height == 0xFFFFFFFF) { - page->image = jbig2_image_new(ctx, page->width, page->stripe_size); - } else { - page->image = jbig2_image_new(ctx, page->width, page->height); - } - if (page->image == NULL) { - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate buffer for page image"); - } else { - /* 8.2 (3) fill the page with the default pixel value */ - jbig2_image_clear(ctx, page->image, (page->flags & 4)); - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, - "allocated %dx%d page image (%d bytes)", page->image->width, page->image->height, page->image->stride * page->image->height); - } - - return 0; -} - -/** - * jbig2_end_of_stripe: parse and implement an end of stripe segment - **/ -int -jbig2_end_of_stripe(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data) -{ - Jbig2Page *page = &ctx->pages[ctx->current_page]; - uint32_t end_row; - - if (segment->data_length < 4) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short"); - end_row = jbig2_get_uint32(segment_data); - if (end_row < page->end_row) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, - "end of stripe segment with non-positive end row advance (new end row %d vs current end row %d)", end_row, page->end_row); - } else { - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "end of stripe: advancing end row from %u to %u", page->end_row, end_row); - } - - page->end_row = end_row; - - return 0; -} - -/** - * jbig2_complete_page: complete a page image - * - * called upon seeing an 'end of page' segment, this routine - * marks a page as completed so it can be returned. - * compositing will have already happened in the previous - * segment handlers. - **/ -int -jbig2_complete_page(Jbig2Ctx *ctx) -{ - int code; - - /* check for unfinished segments */ - if (ctx->segment_index != ctx->n_segments) { - Jbig2Segment *segment = ctx->segments[ctx->segment_index]; - - /* Some versions of Xerox Workcentre generate PDF files - with the segment data length field of the last segment - set to -1. Try to cope with this here. */ - if ((segment->data_length & 0xffffffff) == 0xffffffff) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "file has an invalid segment data length; trying to decode using the available data"); - segment->data_length = ctx->buf_wr_ix - ctx->buf_rd_ix; - code = jbig2_parse_segment(ctx, segment, ctx->buf + ctx->buf_rd_ix); - ctx->buf_rd_ix += segment->data_length; - ctx->segment_index++; - if (code < 0) { - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to parse segment"); - } - } - } - - /* ensure image exists before marking page as complete */ - if (ctx->pages[ctx->current_page].image == NULL) { - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "page has no image, cannot be completed"); - } - - ctx->pages[ctx->current_page].state = JBIG2_PAGE_COMPLETE; - return 0; -} - -/** - * jbig2_end_of_page: parse and implement an end of page segment - **/ -int -jbig2_end_of_page(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data) -{ - uint32_t page_number = ctx->pages[ctx->current_page].number; - int code; - - if (segment->page_association != page_number) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, - "end of page marker for page %d doesn't match current page number %d", segment->page_association, page_number); - } - - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "end of page %d", page_number); - - code = jbig2_complete_page(ctx); - if (code < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to complete page"); - -#ifdef OUTPUT_PBM - code = jbig2_image_write_pbm(ctx->pages[ctx->current_page].image, stdout); - if (code < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to write page image"); -#endif - - return 0; -} - -/** - * jbig2_add_page_result: composite a decoding result onto a page - * - * this is called to add the results of segment decode (when it - * is an image) to a page image buffer - **/ -int -jbig2_page_add_result(Jbig2Ctx *ctx, Jbig2Page *page, Jbig2Image *image, uint32_t x, uint32_t y, Jbig2ComposeOp op) -{ - int code; - - if (x > INT32_MAX || y > INT32_MAX) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "unsupported image coordinates"); - - /* ensure image exists first */ - if (page->image == NULL) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "page info possibly missing, no image defined"); - - /* grow the page to accommodate a new stripe if necessary */ - if (page->striped && page->height == 0xFFFFFFFF) { - uint32_t new_height; - - if (y > UINT32_MAX - image->height) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "adding image at coordinate would grow page out of bounds"); - new_height = y + image->height; - - if (page->image->height < new_height) { - Jbig2Image *resized_image = NULL; - - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, JBIG2_UNKNOWN_SEGMENT_NUMBER, "growing page buffer to %u rows to accommodate new stripe", new_height); - resized_image = jbig2_image_resize(ctx, page->image, page->image->width, new_height, page->flags & 4); - if (resized_image == NULL) { - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "unable to resize image to accommodate new stripe"); - } - page->image = resized_image; - } - } - - code = jbig2_image_compose(ctx, page->image, image, x, y, op); - if (code < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to compose image with page"); - - return 0; -} - -/** - * jbig2_get_page: return the next available page image buffer - * - * the client can call this at any time to check if any pages - * have been decoded. If so, it returns the first available - * one. The client should then call jbig2_release_page() when - * it no longer needs to refer to the image buffer. - * - * since this is a public routine for the library clients, we - * return an image structure pointer, even though the function - * name refers to a page; the page structure is private. - **/ -Jbig2Image * -jbig2_page_out(Jbig2Ctx *ctx) -{ - uint32_t index; - - /* search for a completed page */ - for (index = 0; index < ctx->max_page_index; index++) { - if (ctx->pages[index].state == JBIG2_PAGE_COMPLETE) { - Jbig2Image *img = ctx->pages[index].image; - uint32_t page_number = ctx->pages[index].number; - - if (img == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "page %d returned with no associated image", page_number); - continue; - } - - ctx->pages[index].state = JBIG2_PAGE_RETURNED; - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, JBIG2_UNKNOWN_SEGMENT_NUMBER, "page %d returned to the client", page_number); - return jbig2_image_reference(ctx, img); - } - } - - /* no pages available */ - return NULL; -} - -/** - * jbig2_release_page: tell the library a page can be freed - **/ -void -jbig2_release_page(Jbig2Ctx *ctx, Jbig2Image *image) -{ - uint32_t index; - - if (image == NULL) - return; - - /* find the matching page struct and mark it released */ - for (index = 0; index < ctx->max_page_index; index++) { - if (ctx->pages[index].image == image) { - jbig2_image_release(ctx, image); - ctx->pages[index].state = JBIG2_PAGE_RELEASED; - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, JBIG2_UNKNOWN_SEGMENT_NUMBER, "page %d released by the client", ctx->pages[index].number); - return; - } - } - - /* no matching pages */ - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to release unknown page"); -} diff --git a/pdfpatcher/JBig2/src/jbig2_refinement.c b/pdfpatcher/JBig2/src/jbig2_refinement.c deleted file mode 100644 index c2d08bafa41eb6ff58da2ea81336126d81e10e32..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2_refinement.c +++ /dev/null @@ -1,549 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -/** - * Generic Refinement region handlers. - **/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "os_types.h" - -#include -#include /* memcpy(), memset() */ - -#include - -#include "jbig2.h" -#include "jbig2_priv.h" -#include "jbig2_arith.h" -#include "jbig2_generic.h" -#include "jbig2_image.h" -#include "jbig2_page.h" -#include "jbig2_refinement.h" -#include "jbig2_segment.h" - -#define pixel_outside_field(x, y) \ - ((y) < -128 || (y) > 0 || (x) < -128 || ((y) < 0 && (x) > 127) || ((y) == 0 && (x) >= 0)) -#define refpixel_outside_field(x, y) \ - ((y) < -128 || (y) > 127 || (x) < -128 || (x) > 127) - -static int -jbig2_decode_refinement_template0_unopt(Jbig2Ctx *ctx, - Jbig2Segment *segment, - const Jbig2RefinementRegionParams *params, Jbig2ArithState *as, Jbig2Image *image, Jbig2ArithCx *GR_stats) -{ - const int GRW = image->width; - const int GRH = image->height; - Jbig2Image *ref = params->GRREFERENCE; - const int dx = params->GRREFERENCEDX; - const int dy = params->GRREFERENCEDY; - uint32_t CONTEXT; - int x, y; - int bit; - - if (pixel_outside_field(params->grat[0], params->grat[1]) || - refpixel_outside_field(params->grat[2], params->grat[3])) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, - "adaptive template pixel is out of field"); - - for (y = 0; y < GRH; y++) { - for (x = 0; x < GRW; x++) { - CONTEXT = 0; - CONTEXT |= jbig2_image_get_pixel(image, x - 1, y + 0) << 0; - CONTEXT |= jbig2_image_get_pixel(image, x + 1, y - 1) << 1; - CONTEXT |= jbig2_image_get_pixel(image, x + 0, y - 1) << 2; - CONTEXT |= jbig2_image_get_pixel(image, x + params->grat[0], y + params->grat[1]) << 3; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 1, y - dy + 1) << 4; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 0, y - dy + 1) << 5; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx - 1, y - dy + 1) << 6; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 1, y - dy + 0) << 7; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 0, y - dy + 0) << 8; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx - 1, y - dy + 0) << 9; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 1, y - dy - 1) << 10; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 0, y - dy - 1) << 11; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + params->grat[2], y - dy + params->grat[3]) << 12; - bit = jbig2_arith_decode(ctx, as, &GR_stats[CONTEXT]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode arithmetic code when handling refinement template0"); - jbig2_image_set_pixel(image, x, y, bit); - } - } -#ifdef JBIG2_DEBUG_DUMP - { - static count = 0; - char name[32]; - int code; - - snprintf(name, 32, "refin-%d.pbm", count); - code = jbig2_image_write_pbm_file(ref, name); - if (code < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed write refinement input"); - snprintf(name, 32, "refout-%d.pbm", count); - code = jbig2_image_write_pbm_file(image, name); - if (code < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed write refinement output"); - count++; - } -#endif - - return 0; -} - -static int -jbig2_decode_refinement_template1_unopt(Jbig2Ctx *ctx, - Jbig2Segment *segment, - const Jbig2RefinementRegionParams *params, Jbig2ArithState *as, Jbig2Image *image, Jbig2ArithCx *GR_stats) -{ - const int GRW = image->width; - const int GRH = image->height; - Jbig2Image *ref = params->GRREFERENCE; - const int dx = params->GRREFERENCEDX; - const int dy = params->GRREFERENCEDY; - uint32_t CONTEXT; - int x, y; - int bit; - - for (y = 0; y < GRH; y++) { - for (x = 0; x < GRW; x++) { - CONTEXT = 0; - CONTEXT |= jbig2_image_get_pixel(image, x - 1, y + 0) << 0; - CONTEXT |= jbig2_image_get_pixel(image, x + 1, y - 1) << 1; - CONTEXT |= jbig2_image_get_pixel(image, x + 0, y - 1) << 2; - CONTEXT |= jbig2_image_get_pixel(image, x - 1, y - 1) << 3; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 1, y - dy + 1) << 4; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 0, y - dy + 1) << 5; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 1, y - dy + 0) << 6; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 0, y - dy + 0) << 7; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx - 1, y - dy + 0) << 8; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 0, y - dy - 1) << 9; - bit = jbig2_arith_decode(ctx, as, &GR_stats[CONTEXT]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode arithmetic code when handling refinement template0"); - jbig2_image_set_pixel(image, x, y, bit); - } - } - -#ifdef JBIG2_DEBUG_DUMP - { - static count = 0; - char name[32]; - - snprintf(name, 32, "refin-%d.pbm", count); - code = jbig2_image_write_pbm_file(ref, name); - if (code < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to write refinement input"); - snprintf(name, 32, "refout-%d.pbm", count); - code = jbig2_image_write_pbm_file(image, name); - if (code < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to write refinement output"); - count++; - } -#endif - - return 0; -} - -#if 0 /* currently not used */ -static int -jbig2_decode_refinement_template1(Jbig2Ctx *ctx, - Jbig2Segment *segment, - const Jbig2RefinementRegionParams *params, Jbig2ArithState *as, Jbig2Image *image, Jbig2ArithCx *GR_stats) -{ - const int GRW = image->width; - const int GRH = image->height; - const int stride = image->stride; - const int refstride = params->reference->stride; - const int dy = params->DY; - byte *grreg_line = (byte *) image->data; - byte *grref_line = (byte *) params->reference->data; - int x, y; - - for (y = 0; y < GRH; y++) { - const int padded_width = (GRW + 7) & -8; - uint32_t CONTEXT; - uint32_t refline_m1; /* previous line of the reference bitmap */ - uint32_t refline_0; /* current line of the reference bitmap */ - uint32_t refline_1; /* next line of the reference bitmap */ - uint32_t line_m1; /* previous line of the decoded bitmap */ - - line_m1 = (y >= 1) ? grreg_line[-stride] : 0; - refline_m1 = ((y - dy) >= 1) ? grref_line[(-1 - dy) * stride] << 2 : 0; - refline_0 = (((y - dy) > 0) && ((y - dy) < GRH)) ? grref_line[(0 - dy) * stride] << 4 : 0; - refline_1 = (y < GRH - 1) ? grref_line[(+1 - dy) * stride] << 7 : 0; - CONTEXT = ((line_m1 >> 5) & 0x00e) | ((refline_1 >> 5) & 0x030) | ((refline_0 >> 5) & 0x1c0) | ((refline_m1 >> 5) & 0x200); - - for (x = 0; x < padded_width; x += 8) { - byte result = 0; - int x_minor; - const int minor_width = GRW - x > 8 ? 8 : GRW - x; - - if (y >= 1) { - line_m1 = (line_m1 << 8) | (x + 8 < GRW ? grreg_line[-stride + (x >> 3) + 1] : 0); - refline_m1 = (refline_m1 << 8) | (x + 8 < GRW ? grref_line[-refstride + (x >> 3) + 1] << 2 : 0); - } - - refline_0 = (refline_0 << 8) | (x + 8 < GRW ? grref_line[(x >> 3) + 1] << 4 : 0); - - if (y < GRH - 1) - refline_1 = (refline_1 << 8) | (x + 8 < GRW ? grref_line[+refstride + (x >> 3) + 1] << 7 : 0); - else - refline_1 = 0; - - /* this is the speed critical inner-loop */ - for (x_minor = 0; x_minor < minor_width; x_minor++) { - int bit; - - bit = jbig2_arith_decode(ctx, as, &GR_stats[CONTEXT]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode arithmetic code when handling refinement template1"); - result |= bit << (7 - x_minor); - CONTEXT = ((CONTEXT & 0x0d6) << 1) | bit | - ((line_m1 >> (9 - x_minor)) & 0x002) | - ((refline_1 >> (9 - x_minor)) & 0x010) | ((refline_0 >> (9 - x_minor)) & 0x040) | ((refline_m1 >> (9 - x_minor)) & 0x200); - } - - grreg_line[x >> 3] = result; - - } - - grreg_line += stride; - grref_line += refstride; - - } - - return 0; - -} -#endif - -typedef uint32_t(*ContextBuilder)(const Jbig2RefinementRegionParams *, Jbig2Image *, int, int); - -static int -implicit_value(const Jbig2RefinementRegionParams *params, Jbig2Image *image, int x, int y) -{ - Jbig2Image *ref = params->GRREFERENCE; - int i = x - params->GRREFERENCEDX; - int j = y - params->GRREFERENCEDY; - int m = jbig2_image_get_pixel(ref, i, j); - - return ((jbig2_image_get_pixel(ref, i - 1, j - 1) == m) && - (jbig2_image_get_pixel(ref, i, j - 1) == m) && - (jbig2_image_get_pixel(ref, i + 1, j - 1) == m) && - (jbig2_image_get_pixel(ref, i - 1, j) == m) && - (jbig2_image_get_pixel(ref, i + 1, j) == m) && - (jbig2_image_get_pixel(ref, i - 1, j + 1) == m) && - (jbig2_image_get_pixel(ref, i, j + 1) == m) && - (jbig2_image_get_pixel(ref, i + 1, j + 1) == m) - )? m : -1; -} - -static uint32_t -mkctx0(const Jbig2RefinementRegionParams *params, Jbig2Image *image, int x, int y) -{ - Jbig2Image *ref = params->GRREFERENCE; - const int dx = params->GRREFERENCEDX; - const int dy = params->GRREFERENCEDY; - uint32_t CONTEXT; - - CONTEXT = jbig2_image_get_pixel(image, x - 1, y + 0); - CONTEXT |= jbig2_image_get_pixel(image, x + 1, y - 1) << 1; - CONTEXT |= jbig2_image_get_pixel(image, x + 0, y - 1) << 2; - CONTEXT |= jbig2_image_get_pixel(image, x + params->grat[0], y + params->grat[1]) << 3; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 1, y - dy + 1) << 4; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 0, y - dy + 1) << 5; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx - 1, y - dy + 1) << 6; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 1, y - dy + 0) << 7; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 0, y - dy + 0) << 8; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx - 1, y - dy + 0) << 9; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 1, y - dy - 1) << 10; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 0, y - dy - 1) << 11; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + params->grat[2], y - dy + params->grat[3]) << 12; - return CONTEXT; -} - -static uint32_t -mkctx1(const Jbig2RefinementRegionParams *params, Jbig2Image *image, int x, int y) -{ - Jbig2Image *ref = params->GRREFERENCE; - const int dx = params->GRREFERENCEDX; - const int dy = params->GRREFERENCEDY; - uint32_t CONTEXT; - - CONTEXT = jbig2_image_get_pixel(image, x - 1, y + 0); - CONTEXT |= jbig2_image_get_pixel(image, x + 1, y - 1) << 1; - CONTEXT |= jbig2_image_get_pixel(image, x + 0, y - 1) << 2; - CONTEXT |= jbig2_image_get_pixel(image, x - 1, y - 1) << 3; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 1, y - dy + 1) << 4; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 0, y - dy + 1) << 5; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 1, y - dy + 0) << 6; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 0, y - dy + 0) << 7; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx - 1, y - dy + 0) << 8; - CONTEXT |= jbig2_image_get_pixel(ref, x - dx + 0, y - dy - 1) << 9; - return CONTEXT; -} - -static int -jbig2_decode_refinement_TPGRON(Jbig2Ctx *ctx, const Jbig2RefinementRegionParams *params, Jbig2ArithState *as, Jbig2Image *image, Jbig2ArithCx *GR_stats) -{ - const int GRW = image->width; - const int GRH = image->height; - int x, y, iv, LTP = 0; - uint32_t start_context = (params->GRTEMPLATE ? 0x40 : 0x100); - ContextBuilder mkctx = (params->GRTEMPLATE ? mkctx1 : mkctx0); - - if (params->GRTEMPLATE == 0 && - (pixel_outside_field(params->grat[0], params->grat[1]) || - refpixel_outside_field(params->grat[2], params->grat[3]))) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, - "adaptive template pixel is out of field"); - - for (y = 0; y < GRH; y++) { - int bit = jbig2_arith_decode(ctx, as, &GR_stats[start_context]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to decode arithmetic code when handling refinement TPGRON1"); - LTP ^= bit; - if (!LTP) { - for (x = 0; x < GRW; x++) { - bit = jbig2_arith_decode(ctx, as, &GR_stats[mkctx(params, image, x, y)]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to decode arithmetic code when handling refinement TPGRON1"); - jbig2_image_set_pixel(image, x, y, bit); - } - } else { - for (x = 0; x < GRW; x++) { - iv = implicit_value(params, image, x, y); - if (iv < 0) { - int bit = jbig2_arith_decode(ctx, as, &GR_stats[mkctx(params, image, x, y)]); - if (bit < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to decode arithmetic code when handling refinement TPGRON1"); - jbig2_image_set_pixel(image, x, y, bit); - } else - jbig2_image_set_pixel(image, x, y, iv); - } - } - } - - return 0; -} - -/** - * jbig2_decode_refinement_region: Decode a generic refinement region. - * @ctx: The context for allocation and error reporting. - * @segment: A segment reference for error reporting. - * @params: Decoding parameter set. - * @as: Arithmetic decoder state. - * @image: Where to store the decoded image. - * @GR_stats: Arithmetic stats. - * - * Decodes a generic refinement region, according to section 6.3. - * an already allocated Jbig2Image object in @image for the result. - * - * Because this API is based on an arithmetic decoding state, it is - * not suitable for MMR decoding. - * - * Return code: 0 on success. - **/ -int -jbig2_decode_refinement_region(Jbig2Ctx *ctx, - Jbig2Segment *segment, - const Jbig2RefinementRegionParams *params, Jbig2ArithState *as, Jbig2Image *image, Jbig2ArithCx *GR_stats) -{ - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, - "decoding generic refinement region with offset %d,%x, GRTEMPLATE=%d, TPGRON=%d", - params->GRREFERENCEDX, params->GRREFERENCEDY, params->GRTEMPLATE, params->TPGRON); - - if (params->TPGRON) - return jbig2_decode_refinement_TPGRON(ctx, params, as, image, GR_stats); - - if (params->GRTEMPLATE) - return jbig2_decode_refinement_template1_unopt(ctx, segment, params, as, image, GR_stats); - else - return jbig2_decode_refinement_template0_unopt(ctx, segment, params, as, image, GR_stats); -} - -/** - * Find the first referred-to intermediate region segment - * with a non-NULL result for use as a reference image - */ -static Jbig2Segment * -jbig2_region_find_referred(Jbig2Ctx *ctx, Jbig2Segment *segment) -{ - const int nsegments = segment->referred_to_segment_count; - Jbig2Segment *rsegment; - int index; - - for (index = 0; index < nsegments; index++) { - rsegment = jbig2_find_segment(ctx, segment->referred_to_segments[index]); - if (rsegment == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to find referred to segment %d", segment->referred_to_segments[index]); - continue; - } - switch (rsegment->flags & 63) { - case 4: /* intermediate text region */ - case 20: /* intermediate halftone region */ - case 36: /* intermediate generic region */ - case 40: /* intermediate generic refinement region */ - if (rsegment->result) - return rsegment; - break; - default: /* keep looking */ - break; - } - } - /* no appropriate reference was found. */ - return NULL; -} - -/** - * Handler for generic refinement region segments - */ -int -jbig2_refinement_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data) -{ - Jbig2RefinementRegionParams params; - Jbig2RegionSegmentInfo rsi; - int offset = 0; - byte seg_flags; - int code = 0; - - /* 7.4.7 */ - if (segment->data_length < 18) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short"); - - jbig2_get_region_segment_info(&rsi, segment_data); - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "generic region: %u x %u @ (%u, %u), flags = %02x", rsi.width, rsi.height, rsi.x, rsi.y, rsi.flags); - - /* 7.4.7.2 */ - seg_flags = segment_data[17]; - params.GRTEMPLATE = seg_flags & 0x01; - params.TPGRON = seg_flags & 0x02 ? 1 : 0; - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, - "segment flags = %02x %s%s", seg_flags, params.GRTEMPLATE ? " GRTEMPLATE" : "", params.TPGRON ? " TPGRON" : ""); - if (seg_flags & 0xFC) - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "reserved segment flag bits are non-zero"); - offset += 18; - - /* 7.4.7.3 */ - if (!params.GRTEMPLATE) { - if (segment->data_length < 22) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short"); - params.grat[0] = segment_data[offset + 0]; - params.grat[1] = segment_data[offset + 1]; - params.grat[2] = segment_data[offset + 2]; - params.grat[3] = segment_data[offset + 3]; - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, - "grat1: (%d, %d) grat2: (%d, %d)", params.grat[0], params.grat[1], params.grat[2], params.grat[3]); - offset += 4; - } - - /* 7.4.7.4 - set up the reference image */ - if (segment->referred_to_segment_count) { - Jbig2Segment *ref; - - ref = jbig2_region_find_referred(ctx, segment); - if (ref == NULL) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to find reference bitmap"); - if (ref->result == NULL) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "reference bitmap has no decoded image"); - /* the reference bitmap is the result of a previous - intermediate region segment; the reference selection - rules say to use the first one available, and not to - reuse any intermediate result, so we simply take another - reference to it and free the original to keep track of this. */ - params.GRREFERENCE = jbig2_image_reference(ctx, (Jbig2Image *) ref->result); - jbig2_image_release(ctx, (Jbig2Image *) ref->result); - ref->result = NULL; - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "found reference bitmap in segment %d", ref->number); - } else { - /* the reference is just (a subset of) the page buffer */ - if (ctx->pages[ctx->current_page].image == NULL) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "reference page bitmap has no decoded image"); - params.GRREFERENCE = jbig2_image_reference(ctx, ctx->pages[ctx->current_page].image); - /* TODO: subset the image if appropriate */ - } - - /* 7.4.7.5 */ - params.GRREFERENCEDX = 0; - params.GRREFERENCEDY = 0; - { - Jbig2WordStream *ws = NULL; - Jbig2ArithState *as = NULL; - Jbig2ArithCx *GR_stats = NULL; - int stats_size; - Jbig2Image *image = NULL; - - image = jbig2_image_new(ctx, rsi.width, rsi.height); - if (image == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate refinement image"); - goto cleanup; - } - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "allocated %d x %d image buffer for region decode results", rsi.width, rsi.height); - - stats_size = params.GRTEMPLATE ? 1 << 10 : 1 << 13; - GR_stats = jbig2_new(ctx, Jbig2ArithCx, stats_size); - if (GR_stats == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to allocate arithmetic decoder state for generic refinement regions"); - goto cleanup; - } - memset(GR_stats, 0, stats_size); - - ws = jbig2_word_stream_buf_new(ctx, segment_data + offset, segment->data_length - offset); - if (ws == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate word stream when handling refinement region"); - goto cleanup; - } - - as = jbig2_arith_new(ctx, ws); - if (as == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate arithmetic coding state when handling refinement region"); - goto cleanup; - } - - code = jbig2_decode_refinement_region(ctx, segment, ¶ms, as, image, GR_stats); - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode refinement region"); - goto cleanup; - } - - if ((segment->flags & 63) == 40) { - /* intermediate region. save the result for later */ - segment->result = jbig2_image_reference(ctx, image); - } else { - /* immediate region. composite onto the page */ - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, - "composing %dx%d decoded refinement region onto page at (%d, %d)", rsi.width, rsi.height, rsi.x, rsi.y); - code = jbig2_page_add_result(ctx, &ctx->pages[ctx->current_page], image, rsi.x, rsi.y, rsi.op); - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unable to add refinement region to page"); - goto cleanup; - } - } - -cleanup: - jbig2_image_release(ctx, image); - jbig2_image_release(ctx, params.GRREFERENCE); - jbig2_free(ctx->allocator, as); - jbig2_word_stream_buf_free(ctx, ws); - jbig2_free(ctx->allocator, GR_stats); - } - - return code; -} diff --git a/pdfpatcher/JBig2/src/jbig2_segment.c b/pdfpatcher/JBig2/src/jbig2_segment.c deleted file mode 100644 index ab54c3729ccff5e340391d7dfd1913c63648884b..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2_segment.c +++ /dev/null @@ -1,384 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "os_types.h" - -#include /* size_t */ - -#include "jbig2.h" -#include "jbig2_priv.h" -#include "jbig2_arith.h" -#include "jbig2_arith_int.h" -#include "jbig2_arith_iaid.h" -#include "jbig2_generic.h" -#include "jbig2_image.h" -#include "jbig2_halftone.h" -#include "jbig2_huffman.h" -#include "jbig2_page.h" -#include "jbig2_refinement.h" -#include "jbig2_segment.h" -#include "jbig2_symbol_dict.h" -#include "jbig2_text.h" - -Jbig2Segment * -jbig2_parse_segment_header(Jbig2Ctx *ctx, uint8_t *buf, size_t buf_size, size_t *p_header_size) -{ - Jbig2Segment *result; - uint8_t rtscarf; - uint32_t rtscarf_long; - uint32_t *referred_to_segments; - uint32_t referred_to_segment_count; - uint32_t referred_to_segment_size; - uint32_t pa_size; - uint32_t offset; - - /* minimum possible size of a jbig2 segment header */ - if (buf_size < 11) - return NULL; - - result = jbig2_new(ctx, Jbig2Segment, 1); - if (result == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to allocate segment"); - return NULL; - } - - /* 7.2.2 */ - result->number = jbig2_get_uint32(buf); - if (result->number == JBIG2_UNKNOWN_SEGMENT_NUMBER) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "segment number too large"); - jbig2_free(ctx->allocator, result); - return NULL; - } - - /* 7.2.3 */ - result->flags = buf[4]; - - /* 7.2.4 referred-to segments */ - rtscarf = buf[5]; - if ((rtscarf & 0xe0) == 0xe0) { - rtscarf_long = jbig2_get_uint32(buf + 5); - referred_to_segment_count = rtscarf_long & 0x1fffffff; - offset = 5 + 4 + (referred_to_segment_count + 1) / 8; - } else { - referred_to_segment_count = (rtscarf >> 5); - offset = 5 + 1; - } - result->referred_to_segment_count = referred_to_segment_count; - - /* we now have enough information to compute the full header length */ - referred_to_segment_size = result->number <= 256 ? 1 : result->number <= 65536 ? 2 : 4; /* 7.2.5 */ - pa_size = result->flags & 0x40 ? 4 : 1; /* 7.2.6 */ - if (offset + referred_to_segment_count * referred_to_segment_size + pa_size + 4 > buf_size) { - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, result->number, "attempted to parse segment header with insufficient data, asking for more data"); - jbig2_free(ctx->allocator, result); - return NULL; - } - - /* 7.2.5 */ - if (referred_to_segment_count) { - uint32_t i; - - referred_to_segments = jbig2_new(ctx, uint32_t, referred_to_segment_count * referred_to_segment_size); - if (referred_to_segments == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, result->number, "failed to allocate referred to segments"); - jbig2_free(ctx->allocator, result); - return NULL; - } - - for (i = 0; i < referred_to_segment_count; i++) { - referred_to_segments[i] = - (referred_to_segment_size == 1) ? buf[offset] : - (referred_to_segment_size == 2) ? jbig2_get_uint16(buf + offset) : jbig2_get_uint32(buf + offset); - offset += referred_to_segment_size; - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, result->number, "segment %d refers to segment %d", result->number, referred_to_segments[i]); - } - result->referred_to_segments = referred_to_segments; - } else { /* no referred-to segments */ - - result->referred_to_segments = NULL; - } - - /* 7.2.6 */ - if (pa_size == 4) { - result->page_association = jbig2_get_uint32(buf + offset); - offset += 4; - } else { - result->page_association = buf[offset++]; - } - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, result->number, "segment %d is associated with page %d", result->number, result->page_association); - - /* 7.2.7 */ - result->rows = UINT32_MAX; - result->data_length = jbig2_get_uint32(buf + offset); - *p_header_size = offset + 4; - - /* no body parsing results yet */ - result->result = NULL; - - return result; -} - -void -jbig2_free_segment(Jbig2Ctx *ctx, Jbig2Segment *segment) -{ - if (segment == NULL) - return; - - jbig2_free(ctx->allocator, segment->referred_to_segments); - /* todo: we need either some separate fields or - a more complex result object rather than this - brittle special casing */ - switch (segment->flags & 63) { - case 0: /* symbol dictionary */ - if (segment->result != NULL) - jbig2_sd_release(ctx, (Jbig2SymbolDict *) segment->result); - break; - case 4: /* intermediate text region */ - case 40: /* intermediate refinement region */ - if (segment->result != NULL) - jbig2_image_release(ctx, (Jbig2Image *) segment->result); - break; - case 16: /* pattern dictionary */ - if (segment->result != NULL) - jbig2_hd_release(ctx, (Jbig2PatternDict *) segment->result); - break; - case 53: /* user-supplied huffman table */ - if (segment->result != NULL) - jbig2_table_free(ctx, (Jbig2HuffmanParams *) segment->result); - break; - default: - /* anything else is probably an undefined pointer */ - break; - } - jbig2_free(ctx->allocator, segment); -} - -/* find a segment by number */ -Jbig2Segment * -jbig2_find_segment(Jbig2Ctx *ctx, uint32_t number) -{ - int index, index_max = ctx->segment_index - 1; - const Jbig2Ctx *global_ctx = ctx->global_ctx; - - /* FIXME: binary search would be better */ - for (index = index_max; index >= 0; index--) - if (ctx->segments[index]->number == number) - return (ctx->segments[index]); - - if (global_ctx) - for (index = global_ctx->segment_index - 1; index >= 0; index--) - if (global_ctx->segments[index]->number == number) - return (global_ctx->segments[index]); - - /* didn't find a match */ - return NULL; -} - -/* parse the generic portion of a region segment data header */ -void -jbig2_get_region_segment_info(Jbig2RegionSegmentInfo *info, const uint8_t *segment_data) -{ - /* 7.4.1 */ - info->width = jbig2_get_uint32(segment_data); - info->height = jbig2_get_uint32(segment_data + 4); - info->x = jbig2_get_uint32(segment_data + 8); - info->y = jbig2_get_uint32(segment_data + 12); - info->flags = segment_data[16]; - info->op = (Jbig2ComposeOp)(info->flags & 0x7); -} - -/* dispatch code for extension segment parsing */ -static int -jbig2_parse_extension_segment(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data) -{ - uint32_t type; - bool reserved; - bool necessary; - - if (segment->data_length < 4) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short"); - - type = jbig2_get_uint32(segment_data); - reserved = type & 0x20000000; - /* Not implemented since this bit - is only needed by encoders. - dependent = type & 0x40000000; - */ - necessary = type & 0x80000000; - - if (necessary && !reserved) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "extension segment is marked 'necessary' but not 'reserved' contrary to spec"); - } - - switch (type) { - case 0x20000000: - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "ignoring ASCII comment"); - break; - case 0x20000002: - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "ignoring UCS-2 comment"); - break; - default: - if (necessary) { - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "unhandled necessary extension segment type 0x%08x", type); - } else { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unhandled non-necessary extension segment, skipping"); - } - } - - return 0; -} - -/* dispatch code for profile segment parsing */ -static int -jbig2_parse_profile_segment(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data) -{ - uint32_t profiles; - uint32_t i; - uint32_t profile; - int index; - const char *requirements; - const char *generic_region; - const char *refinement_region; - const char *halftone_region; - const char *numerical_data; - - if (segment->data_length < 4) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Segment too short"); - index = 0; - - profiles = jbig2_get_uint32(&segment_data[index]); - index += 4; - - for (i = 0; i < profiles; i++) { - if (segment->data_length - index < 4) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short to store profile"); - - profile = jbig2_get_uint32(&segment_data[index]); - index += 4; - - switch (profile) { - case 0x00000001: - requirements = "All JBIG2 capabilities"; - generic_region = "No restriction"; - refinement_region = "No restriction"; - halftone_region = "No restriction"; - numerical_data = "No restriction"; - break; - case 0x00000002: - requirements = "Maximum compression"; - generic_region = "Arithmetic only; any template used"; - refinement_region = "No restriction"; - halftone_region = "No restriction"; - numerical_data = "Arithmetic only"; - break; - case 0x00000003: - requirements = "Medium complexity and medium compression"; - generic_region = "Arithmetic only; only 10-pixel and 13-pixel templates"; - refinement_region = "10-pixel template only"; - halftone_region = "No skip mask used"; - numerical_data = "Arithmetic only"; - break; - case 0x00000004: - requirements = "Low complexity with progressive lossless capability"; - generic_region = "MMR only"; - refinement_region = "10-pixel template only"; - halftone_region = "No skip mask used"; - numerical_data = "Huffman only"; - break; - case 0x00000005: - requirements = "Low complexity"; - generic_region = "MMR only"; - refinement_region = "Not available"; - halftone_region = "No skip mask used"; - numerical_data = "Huffman only"; - break; - default: - requirements = "Unknown"; - generic_region = "Unknown"; - refinement_region = "Unknown"; - halftone_region = "Unknown"; - numerical_data = "Unknown"; - break; - } - - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "Supported profile: 0x%08x", profile); - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, " Requirements: %s", requirements); - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, " Generic region coding: %s", generic_region); - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, " Refinement region coding: %s", refinement_region); - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, " Halftone region coding: %s", halftone_region); - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, " Numerical data: %s", numerical_data); - } - - return 0; -} - -/* general segment parsing dispatch */ -int -jbig2_parse_segment(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data) -{ - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, - "segment %d, flags=%x, type=%d, data_length=%ld", segment->number, segment->flags, segment->flags & 63, (long) segment->data_length); - switch (segment->flags & 63) { - case 0: - return jbig2_symbol_dictionary(ctx, segment, segment_data); - case 4: /* intermediate text region */ - case 6: /* immediate text region */ - case 7: /* immediate lossless text region */ - return jbig2_text_region(ctx, segment, segment_data); - case 16: - return jbig2_pattern_dictionary(ctx, segment, segment_data); - case 20: /* intermediate halftone region */ - case 22: /* immediate halftone region */ - case 23: /* immediate lossless halftone region */ - return jbig2_halftone_region(ctx, segment, segment_data); - case 36: - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "unhandled segment type 'intermediate generic region' (NYI)"); - case 38: /* immediate generic region */ - case 39: /* immediate lossless generic region */ - return jbig2_immediate_generic_region(ctx, segment, segment_data); - case 40: /* intermediate generic refinement region */ - case 42: /* immediate generic refinement region */ - case 43: /* immediate lossless generic refinement region */ - return jbig2_refinement_region(ctx, segment, segment_data); - case 48: - return jbig2_page_info(ctx, segment, segment_data); - case 49: - return jbig2_end_of_page(ctx, segment, segment_data); - case 50: - return jbig2_end_of_stripe(ctx, segment, segment_data); - case 51: - ctx->state = JBIG2_FILE_EOF; - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "end of file"); - break; - case 52: - return jbig2_parse_profile_segment(ctx, segment, segment_data); - case 53: /* user-supplied huffman table */ - return jbig2_table(ctx, segment, segment_data); - case 54: - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unhandled segment type 'color palette' (NYI)"); - case 62: - return jbig2_parse_extension_segment(ctx, segment, segment_data); - default: - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unknown segment type %d", segment->flags & 63); - } - return 0; -} diff --git a/pdfpatcher/JBig2/src/jbig2_symbol_dict.c b/pdfpatcher/JBig2/src/jbig2_symbol_dict.c deleted file mode 100644 index 21a8fcad32733b1ef93062f7747647a2a8300d07..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2_symbol_dict.c +++ /dev/null @@ -1,1099 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -/* symbol dictionary segment decode and support */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "os_types.h" - -#include -#include /* memset() */ - -#if defined(OUTPUT_PBM) || defined(DUMP_SYMDICT) -#include -#endif - -#include "jbig2.h" -#include "jbig2_priv.h" -#include "jbig2_arith.h" -#include "jbig2_arith_int.h" -#include "jbig2_arith_iaid.h" -#include "jbig2_generic.h" -#include "jbig2_huffman.h" -#include "jbig2_image.h" -#include "jbig2_mmr.h" -#include "jbig2_refinement.h" -#include "jbig2_segment.h" -#include "jbig2_symbol_dict.h" -#include "jbig2_text.h" - -/* Table 13 */ -typedef struct { - bool SDHUFF; - bool SDREFAGG; - uint32_t SDNUMINSYMS; - Jbig2SymbolDict *SDINSYMS; - uint32_t SDNUMNEWSYMS; - uint32_t SDNUMEXSYMS; - Jbig2HuffmanTable *SDHUFFDH; - Jbig2HuffmanTable *SDHUFFDW; - Jbig2HuffmanTable *SDHUFFBMSIZE; - Jbig2HuffmanTable *SDHUFFAGGINST; - int SDTEMPLATE; - int8_t sdat[8]; - bool SDRTEMPLATE; - int8_t sdrat[4]; -} Jbig2SymbolDictParams; - -/* Utility routines */ - -#ifdef DUMP_SYMDICT -void -jbig2_dump_symbol_dict(Jbig2Ctx *ctx, Jbig2Segment *segment) -{ - Jbig2SymbolDict *dict = (Jbig2SymbolDict *) segment->result; - uint32_t index; - char filename[24]; - int code; - - if (dict == NULL) - return; - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "dumping symbol dictionary as %d individual png files", dict->n_symbols); - for (index = 0; index < dict->n_symbols; index++) { - snprintf(filename, sizeof(filename), "symbol_%02d-%04d.png", segment->number, index); - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "dumping symbol %d/%d as '%s'", index, dict->n_symbols, filename); -#ifdef HAVE_LIBPNG - code = jbig2_image_write_png_file(dict->glyphs[index], filename); -#else - code = jbig2_image_write_pbm_file(dict->glyphs[index], filename); -#endif - if (code < 0) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to dump symbol %d/%d as '%s'", index, dict->n_symbols, filename); - } -} -#endif /* DUMP_SYMDICT */ - -/* return a new empty symbol dict */ -Jbig2SymbolDict * -jbig2_sd_new(Jbig2Ctx *ctx, uint32_t n_symbols) -{ - Jbig2SymbolDict *new_dict = NULL; - - new_dict = jbig2_new(ctx, Jbig2SymbolDict, 1); - if (new_dict != NULL) { - new_dict->glyphs = jbig2_new(ctx, Jbig2Image *, n_symbols); - new_dict->n_symbols = n_symbols; - } else { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to allocate new empty symbol dictionary"); - return NULL; - } - - if (new_dict->glyphs != NULL) { - memset(new_dict->glyphs, 0, n_symbols * sizeof(Jbig2Image *)); - } else if (new_dict->n_symbols > 0) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to allocate glyphs for new empty symbol dictionary"); - jbig2_free(ctx->allocator, new_dict); - return NULL; - } - - return new_dict; -} - -/* release the memory associated with a symbol dict */ -void -jbig2_sd_release(Jbig2Ctx *ctx, Jbig2SymbolDict *dict) -{ - uint32_t i; - - if (dict == NULL) - return; - if (dict->glyphs != NULL) - for (i = 0; i < dict->n_symbols; i++) - jbig2_image_release(ctx, dict->glyphs[i]); - jbig2_free(ctx->allocator, dict->glyphs); - jbig2_free(ctx->allocator, dict); -} - -/* get a particular glyph by index */ -Jbig2Image * -jbig2_sd_glyph(Jbig2SymbolDict *dict, unsigned int id) -{ - if (dict == NULL) - return NULL; - return dict->glyphs[id]; -} - -/* count the number of dictionary segments referred to by the given segment */ -uint32_t -jbig2_sd_count_referred(Jbig2Ctx *ctx, Jbig2Segment *segment) -{ - int index; - Jbig2Segment *rsegment; - uint32_t n_dicts = 0; - - for (index = 0; index < segment->referred_to_segment_count; index++) { - rsegment = jbig2_find_segment(ctx, segment->referred_to_segments[index]); - if (rsegment && ((rsegment->flags & 63) == 0) && - rsegment->result && (((Jbig2SymbolDict *) rsegment->result)->n_symbols > 0) && ((*((Jbig2SymbolDict *) rsegment->result)->glyphs) != NULL)) - n_dicts++; - } - - return (n_dicts); -} - -/* return an array of pointers to symbol dictionaries referred to by the given segment */ -Jbig2SymbolDict ** -jbig2_sd_list_referred(Jbig2Ctx *ctx, Jbig2Segment *segment) -{ - int index; - Jbig2Segment *rsegment; - Jbig2SymbolDict **dicts; - uint32_t n_dicts = jbig2_sd_count_referred(ctx, segment); - uint32_t dindex = 0; - - dicts = jbig2_new(ctx, Jbig2SymbolDict *, n_dicts); - if (dicts == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to allocate referred list of symbol dictionaries"); - return NULL; - } - - for (index = 0; index < segment->referred_to_segment_count; index++) { - rsegment = jbig2_find_segment(ctx, segment->referred_to_segments[index]); - if (rsegment && ((rsegment->flags & 63) == 0) && rsegment->result && - (((Jbig2SymbolDict *) rsegment->result)->n_symbols > 0) && ((*((Jbig2SymbolDict *) rsegment->result)->glyphs) != NULL)) { - /* add this referred to symbol dictionary */ - dicts[dindex++] = (Jbig2SymbolDict *) rsegment->result; - } - } - - if (dindex != n_dicts) { - /* should never happen */ - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "counted %d symbol dictionaries but built a list with %d.", n_dicts, dindex); - jbig2_free(ctx->allocator, dicts); - return NULL; - } - - return (dicts); -} - -/* generate a new symbol dictionary by concatenating a list of - existing dictionaries */ -Jbig2SymbolDict * -jbig2_sd_cat(Jbig2Ctx *ctx, uint32_t n_dicts, Jbig2SymbolDict **dicts) -{ - uint32_t i, j, k, symbols; - Jbig2SymbolDict *new_dict = NULL; - - /* count the imported symbols and allocate a new array */ - symbols = 0; - for (i = 0; i < n_dicts; i++) - symbols += dicts[i]->n_symbols; - - /* fill a new array with new references to glyph pointers */ - new_dict = jbig2_sd_new(ctx, symbols); - if (new_dict != NULL) { - k = 0; - for (i = 0; i < n_dicts; i++) - for (j = 0; j < dicts[i]->n_symbols; j++) - new_dict->glyphs[k++] = jbig2_image_reference(ctx, dicts[i]->glyphs[j]); - } else { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "failed to allocate new symbol dictionary"); - } - - return new_dict; -} - -/* Decoding routines */ - -/* 6.5 */ -static Jbig2SymbolDict * -jbig2_decode_symbol_dict(Jbig2Ctx *ctx, - Jbig2Segment *segment, - const Jbig2SymbolDictParams *params, const byte *data, size_t size, Jbig2ArithCx *GB_stats, Jbig2ArithCx *GR_stats) -{ - Jbig2SymbolDict *SDNEWSYMS = NULL; - Jbig2SymbolDict *SDEXSYMS = NULL; - uint32_t HCHEIGHT; - uint32_t NSYMSDECODED; - uint32_t SYMWIDTH, TOTWIDTH; - uint32_t HCFIRSTSYM; - uint32_t *SDNEWSYMWIDTHS = NULL; - uint8_t SBSYMCODELEN = 0; - Jbig2WordStream *ws = NULL; - Jbig2HuffmanState *hs = NULL; - Jbig2ArithState *as = NULL; - Jbig2ArithIntCtx *IADH = NULL; - Jbig2ArithIntCtx *IADW = NULL; - Jbig2ArithIntCtx *IAEX = NULL; - Jbig2ArithIntCtx *IAAI = NULL; - int code = 0; - Jbig2SymbolDict **refagg_dicts = NULL; - uint32_t i; - Jbig2TextRegionParams tparams; - Jbig2Image *image = NULL; - Jbig2Image *glyph = NULL; - uint32_t emptyruns = 0; - - memset(&tparams, 0, sizeof(tparams)); - - /* 6.5.5 (3) */ - HCHEIGHT = 0; - NSYMSDECODED = 0; - - ws = jbig2_word_stream_buf_new(ctx, data, size); - if (ws == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate word stream when decoding symbol dictionary"); - return NULL; - } - - as = jbig2_arith_new(ctx, ws); - if (as == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate arithmetic coding state when decoding symbol dictionary"); - jbig2_word_stream_buf_free(ctx, ws); - return NULL; - } - - for (SBSYMCODELEN = 0; ((uint64_t) 1 << SBSYMCODELEN) < ((uint64_t) params->SDNUMINSYMS + params->SDNUMNEWSYMS); SBSYMCODELEN++); - - if (params->SDHUFF) { - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "huffman coded symbol dictionary"); - hs = jbig2_huffman_new(ctx, ws); - tparams.SBHUFFRDX = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_O); /* Table B.15 */ - tparams.SBHUFFRDY = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_O); /* Table B.15 */ - tparams.SBHUFFRSIZE = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_A); /* Table B.1 */ - if (hs == NULL || tparams.SBHUFFRDX == NULL || - tparams.SBHUFFRDY == NULL || tparams.SBHUFFRSIZE == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate for symbol bitmap"); - goto cleanup; - } - /* 6.5.5 (2) */ - if (!params->SDREFAGG) { - SDNEWSYMWIDTHS = jbig2_new(ctx, uint32_t, params->SDNUMNEWSYMS); - if (SDNEWSYMWIDTHS == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to allocate symbol widths (%u)", params->SDNUMNEWSYMS); - goto cleanup; - } - } else { - tparams.SBHUFFFS = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_F); /* Table B.6 */ - tparams.SBHUFFDS = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_H); /* Table B.8 */ - tparams.SBHUFFDT = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_K); /* Table B.11 */ - tparams.SBHUFFRDW = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_O); /* Table B.15 */ - tparams.SBHUFFRDH = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_O); /* Table B.15 */ - if (tparams.SBHUFFFS == NULL || tparams.SBHUFFDS == NULL || - tparams.SBHUFFDT == NULL || tparams.SBHUFFRDW == NULL || - tparams.SBHUFFRDH == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "out of memory creating text region huffman decoder entries"); - goto cleanup; - } - } - } else { - IADH = jbig2_arith_int_ctx_new(ctx); - IADW = jbig2_arith_int_ctx_new(ctx); - IAEX = jbig2_arith_int_ctx_new(ctx); - IAAI = jbig2_arith_int_ctx_new(ctx); - if (IADH == NULL || IADW == NULL || IAEX == NULL || IAAI == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate symbol bitmap"); - goto cleanup; - } - tparams.IAID = jbig2_arith_iaid_ctx_new(ctx, SBSYMCODELEN); - tparams.IARDX = jbig2_arith_int_ctx_new(ctx); - tparams.IARDY = jbig2_arith_int_ctx_new(ctx); - if (tparams.IAID == NULL || tparams.IARDX == NULL || - tparams.IARDY == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate text region arithmetic decoder contexts"); - goto cleanup; - } - if (params->SDREFAGG) { - /* Values from Table 17, section 6.5.8.2 (2) */ - tparams.IADT = jbig2_arith_int_ctx_new(ctx); - tparams.IAFS = jbig2_arith_int_ctx_new(ctx); - tparams.IADS = jbig2_arith_int_ctx_new(ctx); - tparams.IAIT = jbig2_arith_int_ctx_new(ctx); - /* Table 31 */ - tparams.IARI = jbig2_arith_int_ctx_new(ctx); - tparams.IARDW = jbig2_arith_int_ctx_new(ctx); - tparams.IARDH = jbig2_arith_int_ctx_new(ctx); - if (tparams.IADT == NULL || tparams.IAFS == NULL || - tparams.IADS == NULL || tparams.IAIT == NULL || - tparams.IARI == NULL || tparams.IARDW == NULL || - tparams.IARDH == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate text region arith decoder contexts"); - } - } - } - tparams.SBHUFF = params->SDHUFF; - tparams.SBREFINE = 1; - tparams.SBSTRIPS = 1; - tparams.SBDEFPIXEL = 0; - tparams.SBCOMBOP = JBIG2_COMPOSE_OR; - tparams.TRANSPOSED = 0; - tparams.REFCORNER = JBIG2_CORNER_TOPLEFT; - tparams.SBDSOFFSET = 0; - tparams.SBRTEMPLATE = params->SDRTEMPLATE; - - /* 6.5.5 (1) */ - SDNEWSYMS = jbig2_sd_new(ctx, params->SDNUMNEWSYMS); - if (SDNEWSYMS == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate new symbols (%u)", params->SDNUMNEWSYMS); - goto cleanup; - } - - refagg_dicts = jbig2_new(ctx, Jbig2SymbolDict *, 2); - if (refagg_dicts == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "Out of memory allocating dictionary array"); - goto cleanup; - } - refagg_dicts[0] = jbig2_sd_new(ctx, params->SDNUMINSYMS); - if (refagg_dicts[0] == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "out of memory allocating symbol dictionary"); - goto cleanup; - } - for (i = 0; i < params->SDNUMINSYMS; i++) { - refagg_dicts[0]->glyphs[i] = jbig2_image_reference(ctx, params->SDINSYMS->glyphs[i]); - } - refagg_dicts[1] = SDNEWSYMS; - - /* 6.5.5 (4a) */ - while (NSYMSDECODED < params->SDNUMNEWSYMS) { - int32_t HCDH, DW; - - /* 6.5.6 */ - if (params->SDHUFF) { - HCDH = jbig2_huffman_get(hs, params->SDHUFFDH, &code); - } else { - code = jbig2_arith_int_decode(ctx, IADH, as, &HCDH); - } - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode height class delta"); - goto cleanup; - } - if (code > 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "OOB decoding height class delta"); - goto cleanup; - } - - /* 6.5.5 (4b) */ - HCHEIGHT = HCHEIGHT + HCDH; - SYMWIDTH = 0; - TOTWIDTH = 0; - HCFIRSTSYM = NSYMSDECODED; - - if ((int32_t) HCHEIGHT < 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "invalid HCHEIGHT value"); - goto cleanup; - } -#ifdef JBIG2_DEBUG - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "HCHEIGHT = %d", HCHEIGHT); -#endif - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "decoding height class %d with %d syms decoded", HCHEIGHT, NSYMSDECODED); - - for (;;) { - /* 6.5.7 */ - if (params->SDHUFF) { - DW = jbig2_huffman_get(hs, params->SDHUFFDW, &code); - } else { - code = jbig2_arith_int_decode(ctx, IADW, as, &DW); - } - if (code < 0) - { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode DW"); - goto cleanup; - } - /* 6.5.5 (4c.i) */ - if (code > 0) { - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "OOB when decoding DW signals end of height class %d", HCHEIGHT); - break; - } - - /* check for broken symbol table */ - if (NSYMSDECODED >= params->SDNUMNEWSYMS) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "no OOB signaling end of height class %d, continuing", HCHEIGHT); - break; - } - - if (DW < 0 && SYMWIDTH < (uint32_t) -DW) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "DW value (%d) would make SYMWIDTH (%u) negative at symbol %u", DW, SYMWIDTH, NSYMSDECODED + 1); - goto cleanup; - } - if (DW > 0 && (uint32_t) DW > UINT32_MAX - SYMWIDTH) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "DW value (%d) would make SYMWIDTH (%u) too large at symbol %u", DW, SYMWIDTH, NSYMSDECODED + 1); - goto cleanup; - } - - SYMWIDTH = SYMWIDTH + DW; - if (SYMWIDTH > UINT32_MAX - TOTWIDTH) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "SYMWIDTH value (%u) would make TOTWIDTH (%u) too large at symbol %u", SYMWIDTH, TOTWIDTH, NSYMSDECODED + 1); - goto cleanup; - } - - TOTWIDTH = TOTWIDTH + SYMWIDTH; -#ifdef JBIG2_DEBUG - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "SYMWIDTH = %u TOTWIDTH = %u", SYMWIDTH, TOTWIDTH); -#endif - /* 6.5.5 (4c.ii) */ - if (!params->SDHUFF || params->SDREFAGG) { -#ifdef JBIG2_DEBUG - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "SDHUFF = %d; SDREFAGG = %d", params->SDHUFF, params->SDREFAGG); -#endif - /* 6.5.8 */ - if (!params->SDREFAGG) { - Jbig2GenericRegionParams region_params; - int sdat_bytes; - - /* Table 16 */ - region_params.MMR = 0; - region_params.GBTEMPLATE = params->SDTEMPLATE; - region_params.TPGDON = 0; - region_params.USESKIP = 0; - sdat_bytes = params->SDTEMPLATE == 0 ? 8 : 2; - memcpy(region_params.gbat, params->sdat, sdat_bytes); - - image = jbig2_image_new(ctx, SYMWIDTH, HCHEIGHT); - if (image == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate image"); - goto cleanup; - } - - code = jbig2_decode_generic_region(ctx, segment, ®ion_params, as, image, GB_stats); - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode generic region"); - goto cleanup; - } - - SDNEWSYMS->glyphs[NSYMSDECODED] = image; - image = NULL; - } else { - /* 6.5.8.2 refinement/aggregate symbol */ - uint32_t REFAGGNINST; - - if (params->SDHUFF) { - REFAGGNINST = jbig2_huffman_get(hs, params->SDHUFFAGGINST, &code); - } else { - code = jbig2_arith_int_decode(ctx, IAAI, as, (int32_t *) &REFAGGNINST); - } - if (code < 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode number of symbols in aggregate glyph"); - goto cleanup; - } - if (code > 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "OOB in number of symbols in aggregate glyph"); - goto cleanup; - } - if ((int32_t) REFAGGNINST <= 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "invalid number of symbols in aggregate glyph"); - goto cleanup; - } - - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "aggregate symbol coding (%d instances)", REFAGGNINST); - - if (REFAGGNINST > 1) { - tparams.SBNUMINSTANCES = REFAGGNINST; - - image = jbig2_image_new(ctx, SYMWIDTH, HCHEIGHT); - if (image == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate symbol image"); - goto cleanup; - } - - /* multiple symbols are handled as a text region */ - code = jbig2_decode_text_region(ctx, segment, &tparams, (const Jbig2SymbolDict * const *)refagg_dicts, - 2, image, data, size, GR_stats, as, ws); - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode text region"); - goto cleanup; - } - - SDNEWSYMS->glyphs[NSYMSDECODED] = image; - image = NULL; - } else { - /* 6.5.8.2.2 */ - /* bool SBHUFF = params->SDHUFF; */ - Jbig2RefinementRegionParams rparams; - uint32_t ID; - int32_t RDX, RDY; - int BMSIZE = 0; - uint32_t ninsyms = params->SDNUMINSYMS; - int code1 = 0; - int code2 = 0; - int code3 = 0; - int code4 = 0; - int code5 = 0; - - /* 6.5.8.2.2 (2, 3, 4, 5) */ - if (params->SDHUFF) { - ID = jbig2_huffman_get_bits(hs, SBSYMCODELEN, &code1); - RDX = jbig2_huffman_get(hs, tparams.SBHUFFRDX, &code2); - RDY = jbig2_huffman_get(hs, tparams.SBHUFFRDY, &code3); - BMSIZE = jbig2_huffman_get(hs, tparams.SBHUFFRSIZE, &code4); - code5 = jbig2_huffman_skip(hs); - } else { - code1 = jbig2_arith_iaid_decode(ctx, tparams.IAID, as, (int32_t *) &ID); - code2 = jbig2_arith_int_decode(ctx, tparams.IARDX, as, &RDX); - code3 = jbig2_arith_int_decode(ctx, tparams.IARDY, as, &RDY); - } - - if (code1 < 0 || code2 < 0 || code3 < 0 || code4 < 0 || code5 < 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode data"); - goto cleanup; - } - if (code1 > 0 || code2 > 0 || code3 > 0 || code4 > 0 || code5 > 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "OOB in single refinement/aggregate coded symbol data"); - goto cleanup; - } - - if (ID >= ninsyms + NSYMSDECODED) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "refinement references unknown symbol %d", ID); - goto cleanup; - } - - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, - "symbol is a refinement of ID %d with the refinement applied at (%d,%d)", ID, RDX, RDY); - - image = jbig2_image_new(ctx, SYMWIDTH, HCHEIGHT); - if (image == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate symbol image"); - goto cleanup; - } - - /* Table 18 */ - rparams.GRTEMPLATE = params->SDRTEMPLATE; - rparams.GRREFERENCE = (ID < ninsyms) ? params->SDINSYMS->glyphs[ID] : SDNEWSYMS->glyphs[ID - ninsyms]; - /* SumatraPDF: fail on missing glyphs */ - if (rparams.GRREFERENCE == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "missing glyph %d/%d", ID, ninsyms); - goto cleanup; - } - rparams.GRREFERENCEDX = RDX; - rparams.GRREFERENCEDY = RDY; - rparams.TPGRON = 0; - memcpy(rparams.grat, params->sdrat, 4); - code = jbig2_decode_refinement_region(ctx, segment, &rparams, as, image, GR_stats); - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode refinement region"); - goto cleanup; - } - - SDNEWSYMS->glyphs[NSYMSDECODED] = image; - image = NULL; - - /* 6.5.8.2.2 (7) */ - if (params->SDHUFF) { - if (BMSIZE == 0) - BMSIZE = (size_t) SDNEWSYMS->glyphs[NSYMSDECODED]->height * - SDNEWSYMS->glyphs[NSYMSDECODED]->stride; - code = jbig2_huffman_advance(hs, BMSIZE); - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to advance after huffman decoding in refinement region"); - goto cleanup; - } - } - } - } - -#ifdef OUTPUT_PBM - { - char name[64]; - FILE *out; - int code; - - snprintf(name, 64, "sd.%04d.%04d.pbm", segment->number, NSYMSDECODED); - out = fopen(name, "wb"); - code = jbig2_image_write_pbm(SDNEWSYMS->glyphs[NSYMSDECODED], out); - fclose(out); - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to write glyph"); - goto cleanup; - } - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "writing out glyph as '%s' ...", name); - } -#endif - - } - - /* 6.5.5 (4c.iii) */ - if (params->SDHUFF && !params->SDREFAGG) { - SDNEWSYMWIDTHS[NSYMSDECODED] = SYMWIDTH; - } - - /* 6.5.5 (4c.iv) */ - NSYMSDECODED = NSYMSDECODED + 1; - - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "decoded symbol %u of %u (%ux%u)", NSYMSDECODED, params->SDNUMNEWSYMS, SYMWIDTH, HCHEIGHT); - - } /* end height class decode loop */ - - /* 6.5.5 (4d) */ - if (params->SDHUFF && !params->SDREFAGG) { - /* 6.5.9 */ - size_t BMSIZE; - uint32_t j; - int x; - - BMSIZE = jbig2_huffman_get(hs, params->SDHUFFBMSIZE, &code); - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "error decoding size of collective bitmap"); - goto cleanup; - } - if (code > 0) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "OOB obtained when decoding size of collective bitmap"); - goto cleanup; - } - - /* skip any bits before the next byte boundary */ - code = jbig2_huffman_skip(hs); - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to skip to next byte when decoding collective bitmap"); - } - - image = jbig2_image_new(ctx, TOTWIDTH, HCHEIGHT); - if (image == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate collective bitmap image"); - goto cleanup; - } - - if (BMSIZE == 0) { - /* if BMSIZE == 0 bitmap is uncompressed */ - const byte *src = data + jbig2_huffman_offset(hs); - const int stride = (image->width >> 3) + ((image->width & 7) ? 1 : 0); - byte *dst = image->data; - - /* SumatraPDF: prevent read access violation */ - if (size < jbig2_huffman_offset(hs) || (size - jbig2_huffman_offset(hs) < (size_t) image->height * stride) || (size < jbig2_huffman_offset(hs))) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "not enough data for decoding uncompressed (%d/%li)", image->height * stride, - (long) (size - jbig2_huffman_offset(hs))); - goto cleanup; - } - - BMSIZE = (size_t) image->height * stride; - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, - "reading %dx%d uncompressed bitmap for %d symbols (%li bytes)", image->width, image->height, NSYMSDECODED - HCFIRSTSYM, (long) BMSIZE); - - for (j = 0; j < image->height; j++) { - memcpy(dst, src, stride); - dst += image->stride; - src += stride; - } - } else { - Jbig2GenericRegionParams rparams; - - /* SumatraPDF: prevent read access violation */ - if (size < jbig2_huffman_offset(hs) || size < BMSIZE || size - jbig2_huffman_offset(hs) < BMSIZE) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "not enough data for decoding (%li/%li)", (long) BMSIZE, (long) (size - jbig2_huffman_offset(hs))); - goto cleanup; - } - - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, - "reading %dx%d collective bitmap for %d symbols (%li bytes)", image->width, image->height, NSYMSDECODED - HCFIRSTSYM, (long) BMSIZE); - - rparams.MMR = 1; - code = jbig2_decode_generic_mmr(ctx, segment, &rparams, data + jbig2_huffman_offset(hs), BMSIZE, image); - if (code) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode MMR-coded generic region"); - goto cleanup; - } - } - - /* advance past the data we've just read */ - code = jbig2_huffman_advance(hs, BMSIZE); - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to advance after huffman decoding MMR bitmap image"); - goto cleanup; - } - - /* copy the collective bitmap into the symbol dictionary */ - x = 0; - for (j = HCFIRSTSYM; j < NSYMSDECODED; j++) { - glyph = jbig2_image_new(ctx, SDNEWSYMWIDTHS[j], HCHEIGHT); - if (glyph == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to copy the collective bitmap into symbol dictionary"); - goto cleanup; - } - code = jbig2_image_compose(ctx, glyph, image, -x, 0, JBIG2_COMPOSE_REPLACE); - if (code) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to compose image into glyph"); - goto cleanup; - } - x += SDNEWSYMWIDTHS[j]; - SDNEWSYMS->glyphs[j] = glyph; - glyph = NULL; - } - jbig2_image_release(ctx, image); - image = NULL; - } - - } /* end of symbol decode loop */ - - /* 6.5.10 */ - SDEXSYMS = jbig2_sd_new(ctx, params->SDNUMEXSYMS); - if (SDEXSYMS == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate symbols exported from symbols dictionary"); - goto cleanup; - } else { - uint32_t i = 0; - uint32_t j = 0; - uint32_t k; - int exflag = 0; - uint32_t limit = params->SDNUMINSYMS + params->SDNUMNEWSYMS; - uint32_t EXRUNLENGTH; - - while (i < limit) { - if (params->SDHUFF) - EXRUNLENGTH = jbig2_huffman_get(hs, tparams.SBHUFFRSIZE, &code); - else - code = jbig2_arith_int_decode(ctx, IAEX, as, (int32_t *) &EXRUNLENGTH); - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode runlength for exported symbols"); - /* skip to the cleanup code and return SDEXSYMS = NULL */ - jbig2_sd_release(ctx, SDEXSYMS); - SDEXSYMS = NULL; - break; - } - if (code > 0) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "OOB when decoding runlength for exported symbols"); - /* skip to the cleanup code and return SDEXSYMS = NULL */ - jbig2_sd_release(ctx, SDEXSYMS); - SDEXSYMS = NULL; - break; - } - - /* prevent infinite list of empty runs, 1000 is just an arbitrary number */ - if (EXRUNLENGTH <= 0 && ++emptyruns == 1000) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "runlength too small in export symbol table (%u == 0 i = %u limit = %u)", EXRUNLENGTH, i, limit); - /* skip to the cleanup code and return SDEXSYMS = NULL */ - jbig2_sd_release(ctx, SDEXSYMS); - SDEXSYMS = NULL; - break; - } else if (EXRUNLENGTH > 0) { - emptyruns = 0; - } - - if (EXRUNLENGTH > limit - i) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "exporting more symbols than available (%u > %u), capping", i + EXRUNLENGTH, limit); - EXRUNLENGTH = limit - i; - } - if (exflag && j + EXRUNLENGTH > params->SDNUMEXSYMS) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "exporting more symbols than may be exported (%u > %u), capping", j + EXRUNLENGTH, params->SDNUMEXSYMS); - EXRUNLENGTH = params->SDNUMEXSYMS - j; - } - - for (k = 0; k < EXRUNLENGTH; k++) { - if (exflag) { - Jbig2Image *img; - if (i < params->SDNUMINSYMS) { - img = params->SDINSYMS->glyphs[i]; - } else { - img = SDNEWSYMS->glyphs[i - params->SDNUMINSYMS]; - } - SDEXSYMS->glyphs[j++] = jbig2_image_reference(ctx, img); - } - i++; - } - exflag = !exflag; - } - } - -cleanup: - jbig2_image_release(ctx, glyph); - jbig2_image_release(ctx, image); - if (refagg_dicts != NULL) { - if (refagg_dicts[0] != NULL) - jbig2_sd_release(ctx, refagg_dicts[0]); - /* skip releasing refagg_dicts[1] as that is the same as SDNEWSYMS */ - jbig2_free(ctx->allocator, refagg_dicts); - } - jbig2_sd_release(ctx, SDNEWSYMS); - if (params->SDHUFF) { - jbig2_release_huffman_table(ctx, tparams.SBHUFFRSIZE); - jbig2_release_huffman_table(ctx, tparams.SBHUFFRDY); - jbig2_release_huffman_table(ctx, tparams.SBHUFFRDX); - jbig2_release_huffman_table(ctx, tparams.SBHUFFRDH); - jbig2_release_huffman_table(ctx, tparams.SBHUFFRDW); - jbig2_release_huffman_table(ctx, tparams.SBHUFFDT); - jbig2_release_huffman_table(ctx, tparams.SBHUFFDS); - jbig2_release_huffman_table(ctx, tparams.SBHUFFFS); - if (!params->SDREFAGG) { - jbig2_free(ctx->allocator, SDNEWSYMWIDTHS); - } - jbig2_huffman_free(ctx, hs); - } else { - jbig2_arith_int_ctx_free(ctx, tparams.IARDY); - jbig2_arith_int_ctx_free(ctx, tparams.IARDX); - jbig2_arith_int_ctx_free(ctx, tparams.IARDH); - jbig2_arith_int_ctx_free(ctx, tparams.IARDW); - jbig2_arith_int_ctx_free(ctx, tparams.IARI); - jbig2_arith_iaid_ctx_free(ctx, tparams.IAID); - jbig2_arith_int_ctx_free(ctx, tparams.IAIT); - jbig2_arith_int_ctx_free(ctx, tparams.IADS); - jbig2_arith_int_ctx_free(ctx, tparams.IAFS); - jbig2_arith_int_ctx_free(ctx, tparams.IADT); - jbig2_arith_int_ctx_free(ctx, IAAI); - jbig2_arith_int_ctx_free(ctx, IAEX); - jbig2_arith_int_ctx_free(ctx, IADW); - jbig2_arith_int_ctx_free(ctx, IADH); - } - jbig2_free(ctx->allocator, as); - jbig2_word_stream_buf_free(ctx, ws); - - return SDEXSYMS; -} - -/* 7.4.2 */ -int -jbig2_symbol_dictionary(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data) -{ - Jbig2SymbolDictParams params; - uint16_t flags; - uint32_t sdat_bytes; - uint32_t offset; - Jbig2ArithCx *GB_stats = NULL; - Jbig2ArithCx *GR_stats = NULL; - int table_index = 0; - const Jbig2HuffmanParams *huffman_params; - - params.SDHUFF = 0; - - if (segment->data_length < 10) - goto too_short; - - /* 7.4.2.1.1 */ - flags = jbig2_get_uint16(segment_data); - - /* zero params to ease cleanup later */ - memset(¶ms, 0, sizeof(Jbig2SymbolDictParams)); - - params.SDHUFF = flags & 1; - params.SDREFAGG = (flags >> 1) & 1; - params.SDTEMPLATE = (flags >> 10) & 3; - params.SDRTEMPLATE = (flags >> 12) & 1; - - if (params.SDHUFF) { - switch ((flags & 0x000c) >> 2) { - case 0: /* Table B.4 */ - params.SDHUFFDH = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_D); - break; - case 1: /* Table B.5 */ - params.SDHUFFDH = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_E); - break; - case 3: /* Custom table from referred segment */ - huffman_params = jbig2_find_table(ctx, segment, table_index); - if (huffman_params == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "custom DH huffman table not found (%d)", table_index); - goto cleanup; - } - params.SDHUFFDH = jbig2_build_huffman_table(ctx, huffman_params); - ++table_index; - break; - case 2: - default: - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "symbol dictionary specified invalid huffman table"); - } - if (params.SDHUFFDH == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate DH huffman table"); - goto cleanup; - } - - switch ((flags & 0x0030) >> 4) { - case 0: /* Table B.2 */ - params.SDHUFFDW = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_B); - break; - case 1: /* Table B.3 */ - params.SDHUFFDW = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_C); - break; - case 3: /* Custom table from referred segment */ - huffman_params = jbig2_find_table(ctx, segment, table_index); - if (huffman_params == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "custom DW huffman table not found (%d)", table_index); - goto cleanup; - } - params.SDHUFFDW = jbig2_build_huffman_table(ctx, huffman_params); - ++table_index; - break; - case 2: - default: - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "symbol dictionary specified invalid huffman table"); - goto cleanup; /* Jump direct to cleanup to avoid 2 errors being given */ - } - if (params.SDHUFFDW == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate DW huffman table"); - goto cleanup; - } - - if (flags & 0x0040) { - /* Custom table from referred segment */ - huffman_params = jbig2_find_table(ctx, segment, table_index); - if (huffman_params == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "custom BMSIZE huffman table not found (%d)", table_index); - goto cleanup; - } - params.SDHUFFBMSIZE = jbig2_build_huffman_table(ctx, huffman_params); - ++table_index; - } else { - /* Table B.1 */ - params.SDHUFFBMSIZE = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_A); - } - if (params.SDHUFFBMSIZE == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate BMSIZE huffman table"); - goto cleanup; - } - - if (flags & 0x0080) { - /* Custom table from referred segment */ - huffman_params = jbig2_find_table(ctx, segment, table_index); - if (huffman_params == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "custom REFAGG huffman table not found (%d)", table_index); - goto cleanup; - } - params.SDHUFFAGGINST = jbig2_build_huffman_table(ctx, huffman_params); - ++table_index; - } else { - /* Table B.1 */ - params.SDHUFFAGGINST = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_A); - } - if (params.SDHUFFAGGINST == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate REFAGG huffman table"); - goto cleanup; - } - } - - /* FIXME: there are quite a few of these conditions to check */ - /* maybe #ifdef CONFORMANCE and a separate routine */ - if (!params.SDHUFF) { - if (flags & 0x000c) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "SDHUFF is zero, but contrary to spec SDHUFFDH is not."); - goto cleanup; - } - if (flags & 0x0030) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "SDHUFF is zero, but contrary to spec SDHUFFDW is not."); - goto cleanup; - } - } - - /* 7.4.2.1.2 */ - sdat_bytes = params.SDHUFF ? 0 : params.SDTEMPLATE == 0 ? 8 : 2; - memcpy(params.sdat, segment_data + 2, sdat_bytes); - offset = 2 + sdat_bytes; - - /* 7.4.2.1.3 */ - if (params.SDREFAGG && !params.SDRTEMPLATE) { - if (offset + 4 > segment->data_length) - goto too_short; - memcpy(params.sdrat, segment_data + offset, 4); - offset += 4; - } - - if (offset + 8 > segment->data_length) - goto too_short; - - /* 7.4.2.1.4 */ - params.SDNUMEXSYMS = jbig2_get_uint32(segment_data + offset); - /* 7.4.2.1.5 */ - params.SDNUMNEWSYMS = jbig2_get_uint32(segment_data + offset + 4); - offset += 8; - - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, - "symbol dictionary, flags=%04x, %u exported syms, %u new syms", flags, params.SDNUMEXSYMS, params.SDNUMNEWSYMS); - - /* 7.4.2.2 (2) */ - { - uint32_t n_dicts = jbig2_sd_count_referred(ctx, segment); - Jbig2SymbolDict **dicts = NULL; - - if (n_dicts > 0) { - dicts = jbig2_sd_list_referred(ctx, segment); - if (dicts == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate dicts in symbol dictionary"); - goto cleanup; - } - params.SDINSYMS = jbig2_sd_cat(ctx, n_dicts, dicts); - if (params.SDINSYMS == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate symbol array in symbol dictionary"); - jbig2_free(ctx->allocator, dicts); - goto cleanup; - } - jbig2_free(ctx->allocator, dicts); - } - if (params.SDINSYMS != NULL) { - params.SDNUMINSYMS = params.SDINSYMS->n_symbols; - } - } - - /* 7.4.2.2 (3, 4) */ - if (flags & 0x0100) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "segment marks bitmap coding context as used (NYI)"); - goto cleanup; - } else { - int stats_size = params.SDTEMPLATE == 0 ? 65536 : params.SDTEMPLATE == 1 ? 8192 : 1024; - - GB_stats = jbig2_new(ctx, Jbig2ArithCx, stats_size); - if (GB_stats == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to allocate arithmetic decoder states for generic regions"); - goto cleanup; - } - memset(GB_stats, 0, sizeof (Jbig2ArithCx) * stats_size); - - stats_size = params.SDRTEMPLATE ? 1 << 10 : 1 << 13; - GR_stats = jbig2_new(ctx, Jbig2ArithCx, stats_size); - if (GR_stats == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to allocate arithmetic decoder states for generic refinement regions"); - jbig2_free(ctx->allocator, GB_stats); - goto cleanup; - } - memset(GR_stats, 0, sizeof (Jbig2ArithCx) * stats_size); - } - - segment->result = (void *)jbig2_decode_symbol_dict(ctx, segment, ¶ms, segment_data + offset, segment->data_length - offset, GB_stats, GR_stats); -#ifdef DUMP_SYMDICT - if (segment->result) - jbig2_dump_symbol_dict(ctx, segment); -#endif - - /* 7.4.2.2 (7) */ - if (flags & 0x0200) { - /* todo: retain GB_stats, GR_stats */ - jbig2_free(ctx->allocator, GR_stats); - jbig2_free(ctx->allocator, GB_stats); - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "segment marks bitmap coding context as retained (NYI)"); - goto cleanup; - } else { - jbig2_free(ctx->allocator, GR_stats); - jbig2_free(ctx->allocator, GB_stats); - } - -cleanup: - if (params.SDHUFF) { - jbig2_release_huffman_table(ctx, params.SDHUFFDH); - jbig2_release_huffman_table(ctx, params.SDHUFFDW); - jbig2_release_huffman_table(ctx, params.SDHUFFBMSIZE); - jbig2_release_huffman_table(ctx, params.SDHUFFAGGINST); - } - jbig2_sd_release(ctx, params.SDINSYMS); - - return (segment->result != NULL) ? 0 : -1; - -too_short: - if (params.SDHUFF) { - jbig2_release_huffman_table(ctx, params.SDHUFFDH); - jbig2_release_huffman_table(ctx, params.SDHUFFDW); - jbig2_release_huffman_table(ctx, params.SDHUFFBMSIZE); - jbig2_release_huffman_table(ctx, params.SDHUFFAGGINST); - } - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short"); -} diff --git a/pdfpatcher/JBig2/src/jbig2_text.c b/pdfpatcher/JBig2/src/jbig2_text.c deleted file mode 100644 index 955a4ac2b01795b50cc2d13ff6a7a547b2125c47..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2_text.c +++ /dev/null @@ -1,1045 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "os_types.h" - -#include -#include /* memset() */ - -#include "jbig2.h" -#include "jbig2_priv.h" -#include "jbig2_arith.h" -#include "jbig2_arith_int.h" -#include "jbig2_arith_iaid.h" -#include "jbig2_generic.h" -#include "jbig2_huffman.h" -#include "jbig2_image.h" -#include "jbig2_page.h" -#include "jbig2_refinement.h" -#include "jbig2_segment.h" -#include "jbig2_symbol_dict.h" -#include "jbig2_text.h" - -/** - * jbig2_decode_text_region: decode a text region segment - * - * @ctx: jbig2 decoder context - * @segment: jbig2 segment (header) structure - * @params: parameters from the text region header - * @dicts: an array of referenced symbol dictionaries - * @n_dicts: the number of referenced symbol dictionaries - * @image: image structure in which to store the decoded region bitmap - * @data: pointer to text region data to be decoded - * @size: length of text region data - * - * Implements the text region decoding procedure - * described in section 6.4 of the JBIG2 spec. - * - * returns: 0 on success - **/ -int -jbig2_decode_text_region(Jbig2Ctx *ctx, Jbig2Segment *segment, - const Jbig2TextRegionParams *params, - const Jbig2SymbolDict *const *dicts, const uint32_t n_dicts, - Jbig2Image *image, const byte *data, const size_t size, Jbig2ArithCx *GR_stats, Jbig2ArithState *as, Jbig2WordStream *ws) -{ - /* relevant bits of 6.4.4 */ - uint32_t NINSTANCES; - uint32_t ID; - int32_t STRIPT; - int32_t FIRSTS; - int32_t DT; - int32_t DFS; - int32_t IDS; - int32_t CURS; - int32_t CURT; - int S, T; - int x, y; - bool first_symbol; - uint32_t index, SBNUMSYMS; - Jbig2Image *IB = NULL; - Jbig2Image *IBO = NULL; - Jbig2Image *refimage = NULL; - Jbig2HuffmanState *hs = NULL; - Jbig2HuffmanTable *SBSYMCODES = NULL; - int code = 0; - int RI; - - SBNUMSYMS = 0; - for (index = 0; index < n_dicts; index++) { - SBNUMSYMS += dicts[index]->n_symbols; - } - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "symbol list contains %d glyphs in %d dictionaries", SBNUMSYMS, n_dicts); - - if (params->SBHUFF) { - Jbig2HuffmanTable *runcodes = NULL; - Jbig2HuffmanParams runcodeparams; - Jbig2HuffmanLine runcodelengths[35]; - Jbig2HuffmanLine *symcodelengths = NULL; - Jbig2HuffmanParams symcodeparams; - int err, len, range, r; - - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "huffman coded text region"); - hs = jbig2_huffman_new(ctx, ws); - if (hs == NULL) - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate text region"); - - /* 7.4.3.1.7 - decode symbol ID Huffman table */ - /* this is actually part of the segment header, but it is more - convenient to handle it here */ - - /* parse and build the runlength code huffman table */ - for (index = 0; index < 35; index++) { - runcodelengths[index].PREFLEN = jbig2_huffman_get_bits(hs, 4, &code); - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to read huffman runcode lengths"); - goto cleanup1; - } - if (code > 0) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "OOB decoding huffman runcode lengths"); - goto cleanup1; - } - runcodelengths[index].RANGELEN = 0; - runcodelengths[index].RANGELOW = index; - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, " read runcode%d length %d", index, runcodelengths[index].PREFLEN); - } - runcodeparams.HTOOB = 0; - runcodeparams.lines = runcodelengths; - runcodeparams.n_lines = 35; - runcodes = jbig2_build_huffman_table(ctx, &runcodeparams); - if (runcodes == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "error constructing symbol ID runcode table"); - goto cleanup1; - } - - /* decode the symbol ID code lengths using the runlength table */ - symcodelengths = jbig2_new(ctx, Jbig2HuffmanLine, SBNUMSYMS); - if (symcodelengths == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to allocate memory when reading symbol ID huffman table"); - goto cleanup1; - } - index = 0; - while (index < SBNUMSYMS) { - code = jbig2_huffman_get(hs, runcodes, &err); - if (err < 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "error reading symbol ID huffman table"); - goto cleanup1; - } - if (err > 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "OOB decoding symbol ID huffman table"); - goto cleanup1; - } - if (code < 0 || code >= 35) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "symbol ID huffman table out of range"); - goto cleanup1; - } - - if (code < 32) { - len = code; - range = 1; - } else { - if (code == 32) { - if (index < 1) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "error decoding symbol ID table: run length with no antecedent"); - goto cleanup1; - } - len = symcodelengths[index - 1].PREFLEN; - } else { - len = 0; /* code == 33 or 34 */ - } - err = 0; - if (code == 32) - range = jbig2_huffman_get_bits(hs, 2, &err) + 3; - else if (code == 33) - range = jbig2_huffman_get_bits(hs, 3, &err) + 3; - else if (code == 34) - range = jbig2_huffman_get_bits(hs, 7, &err) + 11; - if (err < 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to read huffman code"); - goto cleanup1; - } - if (err > 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "OOB decoding huffman code"); - goto cleanup1; - } - } - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, " read runcode%d at index %d (length %d range %d)", code, index, len, range); - if (index + range > SBNUMSYMS) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, - "runlength extends %d entries beyond the end of symbol ID table", index + range - SBNUMSYMS); - range = SBNUMSYMS - index; - } - for (r = 0; r < range; r++) { - symcodelengths[index + r].PREFLEN = len; - symcodelengths[index + r].RANGELEN = 0; - symcodelengths[index + r].RANGELOW = index + r; - } - index += r; - } - - if (index < SBNUMSYMS) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "runlength codes do not cover the available symbol set"); - goto cleanup1; - } - - symcodeparams.HTOOB = 0; - symcodeparams.lines = symcodelengths; - symcodeparams.n_lines = SBNUMSYMS; - - /* skip to byte boundary */ - err = jbig2_huffman_skip(hs); - if (err < 0) - { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to skip to next byte when building huffman table"); - goto cleanup1; - } - - /* finally, construct the symbol ID huffman table itself */ - SBSYMCODES = jbig2_build_huffman_table(ctx, &symcodeparams); - -cleanup1: - jbig2_free(ctx->allocator, symcodelengths); - jbig2_release_huffman_table(ctx, runcodes); - - if (SBSYMCODES == NULL) { - jbig2_huffman_free(ctx, hs); - return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to construct symbol ID huffman table"); - } - } - - /* 6.4.5 (1) */ - jbig2_image_clear(ctx, image, params->SBDEFPIXEL); - - /* 6.4.6 */ - if (params->SBHUFF) { - STRIPT = jbig2_huffman_get(hs, params->SBHUFFDT, &code); - } else { - code = jbig2_arith_int_decode(ctx, params->IADT, as, &STRIPT); - } - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode strip T"); - goto cleanup2; - } - if (code > 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "OOB obtained when decoding strip T"); - goto cleanup2; - } - - /* 6.4.5 (2) */ - STRIPT *= -(params->SBSTRIPS); - FIRSTS = 0; - NINSTANCES = 0; - - /* 6.4.5 (3) */ - while (NINSTANCES < params->SBNUMINSTANCES) { - /* (3b) */ - if (params->SBHUFF) { - DT = jbig2_huffman_get(hs, params->SBHUFFDT, &code); - } else { - code = jbig2_arith_int_decode(ctx, params->IADT, as, &DT); - } - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode delta T"); - goto cleanup2; - } - if (code > 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "OOB obtained when decoding delta T"); - goto cleanup2; - } - DT *= params->SBSTRIPS; - STRIPT += DT; - - first_symbol = TRUE; - /* 6.4.5 (3c) - decode symbols in strip */ - for (;;) { - /* (3c.i) */ - if (first_symbol) { - /* 6.4.7 */ - if (params->SBHUFF) { - DFS = jbig2_huffman_get(hs, params->SBHUFFFS, &code); - } else { - code = jbig2_arith_int_decode(ctx, params->IAFS, as, &DFS); - } - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode strip symbol S-difference"); - goto cleanup2; - } - if (code > 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "OOB obtained when decoding strip symbol S-difference"); - goto cleanup2; - } - FIRSTS += DFS; - CURS = FIRSTS; - first_symbol = FALSE; - } else { - if (NINSTANCES > params->SBNUMINSTANCES) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "too many NINSTANCES (%d) decoded", NINSTANCES); - break; - } - /* (3c.ii) / 6.4.8 */ - if (params->SBHUFF) { - IDS = jbig2_huffman_get(hs, params->SBHUFFDS, &code); - } else { - code = jbig2_arith_int_decode(ctx, params->IADS, as, &IDS); - } - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode symbol instance S coordinate"); - goto cleanup2; - } - if (code > 0) { - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "OOB obtained when decoding symbol instance S coordinate signals end of strip with T value %d", DT); - break; - } - CURS += IDS + params->SBDSOFFSET; - } - - /* (3c.iii) / 6.4.9 */ - if (params->SBSTRIPS == 1) { - CURT = 0; - } else if (params->SBHUFF) { - CURT = jbig2_huffman_get_bits(hs, params->LOGSBSTRIPS, &code); - } else { - code = jbig2_arith_int_decode(ctx, params->IAIT, as, &CURT); - } - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode symbol instance T coordinate"); - goto cleanup2; - } - if (code > 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "OOB obtained when decoding symbol instance T coordinate"); - goto cleanup2; - } - T = STRIPT + CURT; - - /* (3b.iv) / 6.4.10 - decode the symbol ID */ - if (params->SBHUFF) { - ID = jbig2_huffman_get(hs, SBSYMCODES, &code); - } else { - code = jbig2_arith_iaid_decode(ctx, params->IAID, as, (int *)&ID); - } - if (code < 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to obtain symbol instance symbol ID"); - goto cleanup2; - } - if (code > 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "OOB obtained when decoding symbol instance symbol ID"); - goto cleanup2; - } - if (ID >= SBNUMSYMS) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "ignoring out of range symbol ID (%d/%d)", ID, SBNUMSYMS); - IB = NULL; - } else { - /* (3c.v) / 6.4.11 - look up the symbol bitmap IB */ - uint32_t id = ID; - - index = 0; - while (id >= dicts[index]->n_symbols) - id -= dicts[index++]->n_symbols; - if (dicts[index]->glyphs[id] == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "missing glyph (%d/%d), ignoring", index, id); - } else { - IB = jbig2_image_reference(ctx, dicts[index]->glyphs[id]); - } - } - if (params->SBREFINE) { - if (params->SBHUFF) { - RI = jbig2_huffman_get_bits(hs, 1, &code); - } else { - code = jbig2_arith_int_decode(ctx, params->IARI, as, &RI); - } - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode symbol bitmap refinement indicator"); - goto cleanup2; - } - if (code > 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "OOB obtained when decoding symbol bitmap refinement indicator"); - goto cleanup2; - } - } else { - RI = 0; - } - if (RI) { - Jbig2RefinementRegionParams rparams; - int32_t RDW, RDH, RDX, RDY; - size_t BMSIZE = 0; - int code1 = 0; - int code2 = 0; - int code3 = 0; - int code4 = 0; - int code5 = 0; - int code6 = 0; - - /* 6.4.11 (1, 2, 3, 4) */ - if (!params->SBHUFF) { - code1 = jbig2_arith_int_decode(ctx, params->IARDW, as, &RDW); - code2 = jbig2_arith_int_decode(ctx, params->IARDH, as, &RDH); - code3 = jbig2_arith_int_decode(ctx, params->IARDX, as, &RDX); - code4 = jbig2_arith_int_decode(ctx, params->IARDY, as, &RDY); - } else { - RDW = jbig2_huffman_get(hs, params->SBHUFFRDW, &code1); - RDH = jbig2_huffman_get(hs, params->SBHUFFRDH, &code2); - RDX = jbig2_huffman_get(hs, params->SBHUFFRDX, &code3); - RDY = jbig2_huffman_get(hs, params->SBHUFFRDY, &code4); - BMSIZE = jbig2_huffman_get(hs, params->SBHUFFRSIZE, &code5); - code6 = jbig2_huffman_skip(hs); - } - - if (code1 < 0 || code2 < 0 || code3 < 0 || code4 < 0 || code5 < 0 || code6 < 0) { - jbig2_image_release(ctx, IB); - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode data"); - goto cleanup2; - } - if (code1 > 0 || code2 > 0 || code3 > 0 || code4 > 0 || code5 > 0 || code6 > 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "OOB obtained when decoding symbol instance refinement data"); - goto cleanup2; - } - - /* 6.4.11 (6) */ - if (IB) { - IBO = IB; - IB = NULL; - if (((int32_t) IBO->width) + RDW < 0 || ((int32_t) IBO->height) + RDH < 0) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "reference image dimensions negative"); - goto cleanup2; - } - refimage = jbig2_image_new(ctx, IBO->width + RDW, IBO->height + RDH); - if (refimage == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate reference image"); - goto cleanup2; - } - jbig2_image_clear(ctx, refimage, 0x00); - - /* Table 12 */ - rparams.GRTEMPLATE = params->SBRTEMPLATE; - rparams.GRREFERENCE = IBO; - rparams.GRREFERENCEDX = (RDW >> 1) + RDX; - rparams.GRREFERENCEDY = (RDH >> 1) + RDY; - rparams.TPGRON = 0; - memcpy(rparams.grat, params->sbrat, 4); - code = jbig2_decode_refinement_region(ctx, segment, &rparams, as, refimage, GR_stats); - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode refinement region"); - goto cleanup2; - } - - jbig2_image_release(ctx, IBO); - IBO = NULL; - IB = refimage; - refimage = NULL; - } - - /* 6.4.11 (7) */ - if (params->SBHUFF) { - code = jbig2_huffman_advance(hs, BMSIZE); - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to advance after huffman decoding refinement region"); - goto cleanup2; - } - } - } - - /* (3c.vi) */ - if ((!params->TRANSPOSED) && (params->REFCORNER > 1) && IB) { - CURS += IB->width - 1; - } else if ((params->TRANSPOSED) && !(params->REFCORNER & 1) && IB) { - CURS += IB->height - 1; - } - - /* (3c.vii) */ - S = CURS; - - /* (3c.viii) */ - if (!params->TRANSPOSED) { - switch (params->REFCORNER) { - case JBIG2_CORNER_TOPLEFT: - x = S; - y = T; - break; - case JBIG2_CORNER_TOPRIGHT: - if (IB) - x = S - IB->width + 1; - else - x = S + 1; - y = T; - break; - case JBIG2_CORNER_BOTTOMLEFT: - x = S; - if (IB) - y = T - IB->height + 1; - else - y = T + 1; - break; - default: - case JBIG2_CORNER_BOTTOMRIGHT: - if (IB ) { - x = S - IB->width + 1; - y = T - IB->height + 1; - } else { - x = S + 1; - y = T + 1; - } - break; - } - } else { /* TRANSPOSED */ - switch (params->REFCORNER) { - case JBIG2_CORNER_TOPLEFT: - x = T; - y = S; - break; - case JBIG2_CORNER_TOPRIGHT: - if (IB) - x = T - IB->width + 1; - else - x = T + 1; - y = S; - break; - case JBIG2_CORNER_BOTTOMLEFT: - x = T; - if (IB) - y = S - IB->height + 1; - else - y = S + 1; - break; - default: - case JBIG2_CORNER_BOTTOMRIGHT: - if (IB) { - x = T - IB->width + 1; - y = S - IB->height + 1; - } else { - x = T + 1; - y = S + 1; - } - break; - } - } - - /* (3c.ix) */ -#ifdef JBIG2_DEBUG - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, - "composing glyph ID %d: %dx%d @ (%d,%d) symbol %d/%d", ID, IB->width, IB->height, x, y, NINSTANCES + 1, params->SBNUMINSTANCES); -#endif - code = jbig2_image_compose(ctx, image, IB, x, y, params->SBCOMBOP); - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to compose symbol instance symbol bitmap into picture"); - goto cleanup2; - } - - /* (3c.x) */ - if (IB && (!params->TRANSPOSED) && (params->REFCORNER < 2)) { - CURS += IB->width - 1; - } else if (IB && (params->TRANSPOSED) && (params->REFCORNER & 1)) { - CURS += IB->height - 1; - } - - /* (3c.xi) */ - NINSTANCES++; - - jbig2_image_release(ctx, IB); - IB = NULL; - } - /* end strip */ - } - /* 6.4.5 (4) */ - -cleanup2: - jbig2_image_release(ctx, refimage); - jbig2_image_release(ctx, IBO); - jbig2_image_release(ctx, IB); - if (params->SBHUFF) { - jbig2_release_huffman_table(ctx, SBSYMCODES); - } - jbig2_huffman_free(ctx, hs); - - return code; -} - -/** - * jbig2_text_region: read a text region segment header - **/ -int -jbig2_text_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data) -{ - uint32_t offset = 0; - Jbig2RegionSegmentInfo region_info; - Jbig2TextRegionParams params; - Jbig2Image *image = NULL; - Jbig2SymbolDict **dicts = NULL; - uint32_t n_dicts = 0; - uint16_t flags = 0; - uint16_t huffman_flags = 0; - Jbig2ArithCx *GR_stats = NULL; - int code = 0; - Jbig2WordStream *ws = NULL; - Jbig2ArithState *as = NULL; - uint32_t table_index = 0; - const Jbig2HuffmanParams *huffman_params = NULL; - - /* zero params to ease cleanup later */ - memset(¶ms, 0, sizeof(Jbig2TextRegionParams)); - - /* 7.4.1 */ - if (segment->data_length < 17) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short"); - goto cleanup2; - } - jbig2_get_region_segment_info(®ion_info, segment_data); - offset += 17; - /* Check for T.88 amendment 3 */ - if (region_info.flags & 8) - return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "region segment flags indicate use of colored bitmap (NYI)"); - - /* 7.4.3.1.1 */ - if (segment->data_length - offset < 2) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short"); - goto cleanup2; - } - flags = jbig2_get_uint16(segment_data + offset); - offset += 2; - - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "text region header flags 0x%04x", flags); - - params.SBHUFF = flags & 0x0001; - params.SBREFINE = flags & 0x0002; - params.LOGSBSTRIPS = (flags & 0x000c) >> 2; - params.SBSTRIPS = 1 << params.LOGSBSTRIPS; - params.REFCORNER = (Jbig2RefCorner)((flags & 0x0030) >> 4); - params.TRANSPOSED = flags & 0x0040; - params.SBCOMBOP = (Jbig2ComposeOp)((flags & 0x0180) >> 7); - params.SBDEFPIXEL = flags & 0x0200; - /* SBDSOFFSET is a signed 5 bit integer */ - params.SBDSOFFSET = (flags & 0x7C00) >> 10; - if (params.SBDSOFFSET > 0x0f) - params.SBDSOFFSET -= 0x20; - params.SBRTEMPLATE = flags & 0x8000; - - if (params.SBDSOFFSET) { - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, "text region has SBDSOFFSET %d", params.SBDSOFFSET); - } - - if (params.SBHUFF) { /* Huffman coding */ - /* 7.4.3.1.2 */ - if (segment->data_length - offset < 2) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short"); - goto cleanup2; - } - huffman_flags = jbig2_get_uint16(segment_data + offset); - offset += 2; - - if (huffman_flags & 0x8000) - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "reserved bit 15 of text region huffman flags is not zero"); - } else { /* arithmetic coding */ - - /* 7.4.3.1.3 */ - if (segment->data_length - offset < 4) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short"); - goto cleanup2; - } - if ((params.SBREFINE) && !(params.SBRTEMPLATE)) { - params.sbrat[0] = segment_data[offset]; - params.sbrat[1] = segment_data[offset + 1]; - params.sbrat[2] = segment_data[offset + 2]; - params.sbrat[3] = segment_data[offset + 3]; - offset += 4; - } - } - - /* 7.4.3.1.4 */ - if (segment->data_length - offset < 4) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short"); - goto cleanup2; - } - params.SBNUMINSTANCES = jbig2_get_uint32(segment_data + offset); - offset += 4; - - if (params.SBHUFF) { - /* 7.4.3.1.5 - Symbol ID Huffman table */ - /* ...this is handled in the segment body decoder */ - - /* 7.4.3.1.6 - Other Huffman table selection */ - switch (huffman_flags & 0x0003) { - case 0: /* Table B.6 */ - params.SBHUFFFS = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_F); - break; - case 1: /* Table B.7 */ - params.SBHUFFFS = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_G); - break; - case 3: /* Custom table from referred segment */ - huffman_params = jbig2_find_table(ctx, segment, table_index); - if (huffman_params == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "custom FS huffman table not found (%d)", table_index); - goto cleanup1; - } - params.SBHUFFFS = jbig2_build_huffman_table(ctx, huffman_params); - ++table_index; - break; - case 2: /* invalid */ - default: - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "text region specified invalid FS huffman table"); - goto cleanup1; - break; - } - if (params.SBHUFFFS == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate text region specified FS huffman table"); - goto cleanup1; - } - - switch ((huffman_flags & 0x000c) >> 2) { - case 0: /* Table B.8 */ - params.SBHUFFDS = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_H); - break; - case 1: /* Table B.9 */ - params.SBHUFFDS = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_I); - break; - case 2: /* Table B.10 */ - params.SBHUFFDS = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_J); - break; - case 3: /* Custom table from referred segment */ - huffman_params = jbig2_find_table(ctx, segment, table_index); - if (huffman_params == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "custom DS huffman table not found (%d)", table_index); - goto cleanup1; - } - params.SBHUFFDS = jbig2_build_huffman_table(ctx, huffman_params); - ++table_index; - break; - } - if (params.SBHUFFDS == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate text region specified DS huffman table"); - goto cleanup1; - } - - switch ((huffman_flags & 0x0030) >> 4) { - case 0: /* Table B.11 */ - params.SBHUFFDT = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_K); - break; - case 1: /* Table B.12 */ - params.SBHUFFDT = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_L); - break; - case 2: /* Table B.13 */ - params.SBHUFFDT = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_M); - break; - case 3: /* Custom table from referred segment */ - huffman_params = jbig2_find_table(ctx, segment, table_index); - if (huffman_params == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "custom DT huffman table not found (%d)", table_index); - goto cleanup1; - } - params.SBHUFFDT = jbig2_build_huffman_table(ctx, huffman_params); - ++table_index; - break; - } - if (params.SBHUFFDT == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate text region specified DT huffman table"); - goto cleanup1; - } - - switch ((huffman_flags & 0x00c0) >> 6) { - case 0: /* Table B.14 */ - params.SBHUFFRDW = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_N); - break; - case 1: /* Table B.15 */ - params.SBHUFFRDW = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_O); - break; - case 3: /* Custom table from referred segment */ - huffman_params = jbig2_find_table(ctx, segment, table_index); - if (huffman_params == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "custom RDW huffman table not found (%d)", table_index); - goto cleanup1; - } - params.SBHUFFRDW = jbig2_build_huffman_table(ctx, huffman_params); - ++table_index; - break; - case 2: /* invalid */ - default: - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "text region specified invalid RDW huffman table"); - goto cleanup1; - break; - } - if (params.SBHUFFRDW == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate text region specified RDW huffman table"); - goto cleanup1; - } - - switch ((huffman_flags & 0x0300) >> 8) { - case 0: /* Table B.14 */ - params.SBHUFFRDH = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_N); - break; - case 1: /* Table B.15 */ - params.SBHUFFRDH = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_O); - break; - case 3: /* Custom table from referred segment */ - huffman_params = jbig2_find_table(ctx, segment, table_index); - if (huffman_params == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "custom RDH huffman table not found (%d)", table_index); - goto cleanup1; - } - params.SBHUFFRDH = jbig2_build_huffman_table(ctx, huffman_params); - ++table_index; - break; - case 2: /* invalid */ - default: - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "text region specified invalid RDH huffman table"); - goto cleanup1; - break; - } - if (params.SBHUFFRDH == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate text region specified RDH huffman table"); - goto cleanup1; - } - - switch ((huffman_flags & 0x0c00) >> 10) { - case 0: /* Table B.14 */ - params.SBHUFFRDX = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_N); - break; - case 1: /* Table B.15 */ - params.SBHUFFRDX = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_O); - break; - case 3: /* Custom table from referred segment */ - huffman_params = jbig2_find_table(ctx, segment, table_index); - if (huffman_params == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "custom RDX huffman table not found (%d)", table_index); - goto cleanup1; - } - params.SBHUFFRDX = jbig2_build_huffman_table(ctx, huffman_params); - ++table_index; - break; - case 2: /* invalid */ - default: - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "text region specified invalid RDX huffman table"); - goto cleanup1; - break; - } - if (params.SBHUFFRDX == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate text region specified RDX huffman table"); - goto cleanup1; - } - - switch ((huffman_flags & 0x3000) >> 12) { - case 0: /* Table B.14 */ - params.SBHUFFRDY = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_N); - break; - case 1: /* Table B.15 */ - params.SBHUFFRDY = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_O); - break; - case 3: /* Custom table from referred segment */ - huffman_params = jbig2_find_table(ctx, segment, table_index); - if (huffman_params == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "custom RDY huffman table not found (%d)", table_index); - goto cleanup1; - } - params.SBHUFFRDY = jbig2_build_huffman_table(ctx, huffman_params); - ++table_index; - break; - case 2: /* invalid */ - default: - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "text region specified invalid RDY huffman table"); - goto cleanup1; - break; - } - if (params.SBHUFFRDY == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate text region specified RDY huffman table"); - goto cleanup1; - } - - switch ((huffman_flags & 0x4000) >> 14) { - case 0: /* Table B.1 */ - params.SBHUFFRSIZE = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_A); - break; - case 1: /* Custom table from referred segment */ - huffman_params = jbig2_find_table(ctx, segment, table_index); - if (huffman_params == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "custom RSIZE huffman table not found (%d)", table_index); - goto cleanup1; - } - params.SBHUFFRSIZE = jbig2_build_huffman_table(ctx, huffman_params); - ++table_index; - break; - } - if (params.SBHUFFRSIZE == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate text region specified RSIZE huffman table"); - goto cleanup1; - } - - if (huffman_flags & 0x8000) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "text region huffman flags bit 15 is set, contrary to spec"); - } - - /* 7.4.3.1.7 */ - /* For convenience this is done in the body decoder routine */ - } - - jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, - "text region: %d x %d @ (%d,%d) %d symbols", region_info.width, region_info.height, region_info.x, region_info.y, params.SBNUMINSTANCES); - - /* 7.4.3.2 (2) - compose the list of symbol dictionaries */ - n_dicts = jbig2_sd_count_referred(ctx, segment); - if (n_dicts == 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "text region refers to no symbol dictionaries"); - } else { - dicts = jbig2_sd_list_referred(ctx, segment); - if (dicts == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "unable to retrieve symbol dictionaries! previous parsing error?"); - goto cleanup1; - } else { - uint32_t index; - - if (dicts[0] == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unable to find first referenced symbol dictionary"); - goto cleanup1; - } - for (index = 1; index < n_dicts; index++) - if (dicts[index] == NULL) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unable to find all referenced symbol dictionaries"); - n_dicts = index; - } - } - } - - /* 7.4.3.2 (3) */ - { - int stats_size = params.SBRTEMPLATE ? 1 << 10 : 1 << 13; - - GR_stats = jbig2_new(ctx, Jbig2ArithCx, stats_size); - if (GR_stats == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "could not allocate arithmetic decoder state"); - goto cleanup1; - } - memset(GR_stats, 0, stats_size); - } - - image = jbig2_image_new(ctx, region_info.width, region_info.height); - if (image == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate text region image"); - goto cleanup2; - } - - if (offset >= segment->data_length) { - code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "segment too short"); - goto cleanup2; - } - ws = jbig2_word_stream_buf_new(ctx, segment_data + offset, segment->data_length - offset); - if (ws == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate word stream when handling text region image"); - goto cleanup2; - } - - as = jbig2_arith_new(ctx, ws); - if (as == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate arithmetic coding context when handling text region image"); - goto cleanup3; - } - - if (!params.SBHUFF) { - uint8_t SBSYMCODELEN; - uint32_t index; - uint32_t SBNUMSYMS = 0; - - for (index = 0; index < n_dicts; index++) { - SBNUMSYMS += dicts[index]->n_symbols; - } - - params.IADT = jbig2_arith_int_ctx_new(ctx); - params.IAFS = jbig2_arith_int_ctx_new(ctx); - params.IADS = jbig2_arith_int_ctx_new(ctx); - params.IAIT = jbig2_arith_int_ctx_new(ctx); - if (params.IADT == NULL || params.IAFS == NULL || params.IADS == NULL || params.IAIT == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate text region image data"); - goto cleanup4; - } - - /* Table 31 */ - for (SBSYMCODELEN = 0; ((uint64_t) 1 << SBSYMCODELEN) < (uint64_t) SBNUMSYMS; SBSYMCODELEN++); - - params.IAID = jbig2_arith_iaid_ctx_new(ctx, SBSYMCODELEN); - params.IARI = jbig2_arith_int_ctx_new(ctx); - params.IARDW = jbig2_arith_int_ctx_new(ctx); - params.IARDH = jbig2_arith_int_ctx_new(ctx); - params.IARDX = jbig2_arith_int_ctx_new(ctx); - params.IARDY = jbig2_arith_int_ctx_new(ctx); - if (params.IAID == NULL || params.IARI == NULL || - params.IARDW == NULL || params.IARDH == NULL || params.IARDX == NULL || params.IARDY == NULL) { - code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate text region image data"); - goto cleanup5; - } - } - - code = jbig2_decode_text_region(ctx, segment, ¶ms, - (const Jbig2SymbolDict * const *)dicts, n_dicts, image, - segment_data + offset, segment->data_length - offset, GR_stats, as, ws); - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to decode text region image data"); - goto cleanup5; - } - - if ((segment->flags & 63) == 4) { - /* we have an intermediate region here. save it for later */ - segment->result = jbig2_image_reference(ctx, image); - } else { - /* otherwise composite onto the page */ - jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, - "composing %dx%d decoded text region onto page at (%d, %d)", region_info.width, region_info.height, region_info.x, region_info.y); - code = jbig2_page_add_result(ctx, &ctx->pages[ctx->current_page], image, region_info.x, region_info.y, region_info.op); - if (code < 0) - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unable to add text region to page"); - } - -cleanup5: - if (!params.SBHUFF) { - jbig2_arith_iaid_ctx_free(ctx, params.IAID); - jbig2_arith_int_ctx_free(ctx, params.IARI); - jbig2_arith_int_ctx_free(ctx, params.IARDW); - jbig2_arith_int_ctx_free(ctx, params.IARDH); - jbig2_arith_int_ctx_free(ctx, params.IARDX); - jbig2_arith_int_ctx_free(ctx, params.IARDY); - } - -cleanup4: - if (!params.SBHUFF) { - jbig2_arith_int_ctx_free(ctx, params.IADT); - jbig2_arith_int_ctx_free(ctx, params.IAFS); - jbig2_arith_int_ctx_free(ctx, params.IADS); - jbig2_arith_int_ctx_free(ctx, params.IAIT); - } - -cleanup3: - jbig2_free(ctx->allocator, as); - jbig2_word_stream_buf_free(ctx, ws); - -cleanup2: - jbig2_free(ctx->allocator, GR_stats); - jbig2_image_release(ctx, image); - -cleanup1: - if (params.SBHUFF) { - jbig2_release_huffman_table(ctx, params.SBHUFFFS); - jbig2_release_huffman_table(ctx, params.SBHUFFDS); - jbig2_release_huffman_table(ctx, params.SBHUFFDT); - jbig2_release_huffman_table(ctx, params.SBHUFFRDX); - jbig2_release_huffman_table(ctx, params.SBHUFFRDY); - jbig2_release_huffman_table(ctx, params.SBHUFFRDW); - jbig2_release_huffman_table(ctx, params.SBHUFFRDH); - jbig2_release_huffman_table(ctx, params.SBHUFFRSIZE); - } - jbig2_free(ctx->allocator, dicts); - - return code; -} diff --git a/pdfpatcher/JBig2/src/jbig2arith.cc b/pdfpatcher/JBig2/src/jbig2arith.cc deleted file mode 100644 index 1e7a346a7b7c7c4b42538db724c4bda15f10cb35..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2arith.cc +++ /dev/null @@ -1,780 +0,0 @@ -// Copyright 2006 Google Inc. All Rights Reserved. -// Author: agl@imperialviolet.org (Adam Langley) -// -// Copyright (C) 2006 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "jbig2arith.h" - -#include -#include -#include - -#define u64 uint64_t -#define u32 uint32_t -#define u16 uint16_t -#define u8 uint8_t - -// C++ doesn't have C99 restricted pointers, but GCC does allow __restrict__ -#if !defined(WIN32) -#define restrict __restrict__ -#else -#define restrict -#endif - -// ----------------------------------------------------------------------------- -// This the structure for a single state of the adaptive arithmetic compressor -// ----------------------------------------------------------------------------- -struct context { - u16 qe; - u8 mps, lps; -}; - -// ----------------------------------------------------------------------------- -// And this is the table of states for that adaptive compressor -// ----------------------------------------------------------------------------- -struct context ctbl[] = { - // This is the standard state table from - // Table E.1 of the standard. The switch has been omitted and - // those states are included below -#define STATETABLE \ - {0x5601, F( 1), SWITCH(F( 1))},\ - {0x3401, F( 2), F( 6)},\ - {0x1801, F( 3), F( 9)},\ - {0x0ac1, F( 4), F(12)},\ - {0x0521, F( 5), F(29)},\ - {0x0221, F(38), F(33)},\ - {0x5601, F( 7), SWITCH(F( 6))},\ - {0x5401, F( 8), F(14)},\ - {0x4801, F( 9), F(14)},\ - {0x3801, F(10), F(14)},\ - {0x3001, F(11), F(17)},\ - {0x2401, F(12), F(18)},\ - {0x1c01, F(13), F(20)},\ - {0x1601, F(29), F(21)},\ - {0x5601, F(15), SWITCH(F(14))},\ - {0x5401, F(16), F(14)},\ - {0x5101, F(17), F(15)},\ - {0x4801, F(18), F(16)},\ - {0x3801, F(19), F(17)},\ - {0x3401, F(20), F(18)},\ - {0x3001, F(21), F(19)},\ - {0x2801, F(22), F(19)},\ - {0x2401, F(23), F(20)},\ - {0x2201, F(24), F(21)},\ - {0x1c01, F(25), F(22)},\ - {0x1801, F(26), F(23)},\ - {0x1601, F(27), F(24)},\ - {0x1401, F(28), F(25)},\ - {0x1201, F(29), F(26)},\ - {0x1101, F(30), F(27)},\ - {0x0ac1, F(31), F(28)},\ - {0x09c1, F(32), F(29)},\ - {0x08a1, F(33), F(30)},\ - {0x0521, F(34), F(31)},\ - {0x0441, F(35), F(32)},\ - {0x02a1, F(36), F(33)},\ - {0x0221, F(37), F(34)},\ - {0x0141, F(38), F(35)},\ - {0x0111, F(39), F(36)},\ - {0x0085, F(40), F(37)},\ - {0x0049, F(41), F(38)},\ - {0x0025, F(42), F(39)},\ - {0x0015, F(43), F(40)},\ - {0x0009, F(44), F(41)},\ - {0x0005, F(45), F(42)},\ - {0x0001, F(45), F(43)}, -#undef F -#define F(x) x -#define SWITCH(x) (x + 46) - STATETABLE -#undef SWITCH -#undef F - -#define F(x) (x + 46) -#define SWITCH(x) ((x) - 46) - STATETABLE -#undef SWITCH -#undef F -}; - -#if __GNUC__ >= 4 -#define BRANCH_OPT -#endif - -// GCC peephole optimisations -#ifdef BRANCH_OPT -#define likely(x) __builtin_expect((x),1) -#define unlikely(x) __builtin_expect((x),0) -#else -#define likely(x) x -#define unlikely(x) x -#endif - -// see comments in .h file -void -jbig2enc_init(struct jbig2enc_ctx *ctx) { - memset(ctx->context, 0, JBIG2_MAX_CTX); - memset(ctx->intctx, 0, 13 * 512); - ctx->a = 0x8000; - ctx->c = 0; - ctx->ct = 12; - ctx->bp = -1; - ctx->b = 0; - ctx->outbuf_used = 0; - ctx->outbuf = (u8 *) malloc(JBIG2_OUTPUTBUFFER_SIZE); - ctx->output_chunks = new std::vector; - ctx->iaidctx = NULL; -} - -// see comments in .h file -void -jbig2enc_reset(struct jbig2enc_ctx *ctx) { - ctx->a = 0x8000; - ctx->c = 0; - ctx->ct = 12; - ctx->bp = -1; - ctx->b = 0; - free(ctx->iaidctx); - ctx->iaidctx = NULL; - memset(ctx->context, 0, JBIG2_MAX_CTX); - memset(ctx->intctx, 0, 13 * 512); -} - -// see comments in .h file -void -jbig2enc_flush(struct jbig2enc_ctx *ctx) { - ctx->outbuf_used = 0; - - for (std::vector::iterator i = ctx->output_chunks->begin(); - i != ctx->output_chunks->end(); ++i) { - free(*i); - } - ctx->output_chunks->clear(); - ctx->bp = -1; -} - -// see comments in .h file -void -jbig2enc_dealloc(struct jbig2enc_ctx *ctx) { - for (std::vector::iterator i = ctx->output_chunks->begin(); - i != ctx->output_chunks->end(); ++i) { - free(*i); - } - delete ctx->output_chunks; - free(ctx->outbuf); - free(ctx->iaidctx); -} - -// ----------------------------------------------------------------------------- -// Emit a byte from the compressor by appending to the current output buffer. -// If the buffer is full, allocate a new one -// ----------------------------------------------------------------------------- -static void inline -emit(struct jbig2enc_ctx *restrict ctx) { - if (unlikely(ctx->outbuf_used == JBIG2_OUTPUTBUFFER_SIZE)) { - ctx->output_chunks->push_back(ctx->outbuf); - ctx->outbuf = (u8 *) malloc(JBIG2_OUTPUTBUFFER_SIZE); - ctx->outbuf_used = 0; - } - - ctx->outbuf[ctx->outbuf_used++] = ctx->b; -} - -// ----------------------------------------------------------------------------- -// The BYTEOUT procedure from the standard -// ----------------------------------------------------------------------------- -static void -byteout(struct jbig2enc_ctx *restrict ctx) { - if (ctx->b == 0xff) goto rblock; - - if (ctx->c < 0x8000000) goto lblock; - ctx->b += 1; - if (ctx->b != 0xff) goto lblock; - ctx->c &= 0x7ffffff; - -rblock: - if (ctx->bp >= 0) { -#ifdef TRACE - printf("emit %x\n", ctx->b); -#endif - emit(ctx); - } - ctx->b = ctx->c >> 20; - ctx->bp++; - ctx->c &= 0xfffff; - ctx->ct = 7; - return; - -lblock: - if (ctx->bp >= 0) { -#ifdef TRACE - printf("emit %x\n", ctx->b); -#endif - emit(ctx); - } - ctx->b = ctx->c >> 19; - ctx->bp++; - ctx->c &= 0x7ffff; - ctx->ct = 8; - return; -} - -// ----------------------------------------------------------------------------- -// A merging of the ENCODE, CODELPS and CODEMPS procedures from the standard -// ----------------------------------------------------------------------------- -static void -encode_bit(struct jbig2enc_ctx *restrict ctx, u8 *restrict context, u32 ctxnum, u8 d) { - const u8 i = context[ctxnum]; - const u8 mps = i > 46 ? 1 : 0; - const u16 qe = ctbl[i].qe; - -#ifdef CODER_DEBUGGING - fprintf(stderr, "B: %d %d %d %d\n", ctxnum, qe, ctx->a, d); -#endif - -#ifdef TRACE - static int ec = 0; - printf("%d\t%d %d %x %x %x %d %x %d\n", ec++, i, mps, qe, ctx->a, ctx->c, ctx->ct, ctx->b, ctx->bp); -#endif - - if (unlikely(d != mps)) goto codelps; -#ifdef SURPRISE_MAP - { - u8 b = static_cast - (((static_cast(qe) / 0xac02) * 255)); - write(3, &b, 1); - } -#endif - ctx->a -= qe; - if (unlikely((ctx->a & 0x8000) == 0)) { - if (unlikely(ctx->a < qe)) { - ctx->a = qe; - } else { - ctx->c += qe; - } - context[ctxnum] = ctbl[i].mps; - goto renorme; - } else { - ctx->c += qe; - } - - return; - -codelps: -#ifdef SURPRISE_MAP - { - u8 b = static_cast - ((1.0f - (static_cast(qe) / 0xac02)) * 255); - write(3, &b, 1); - } -#endif - ctx->a -= qe; - if (ctx->a < qe) { - ctx->c += qe; - } else { - ctx->a = qe; - } - context[ctxnum] = ctbl[i].lps; - -renorme: - do { - ctx->a <<= 1; - ctx->c <<= 1; - ctx->ct -= 1; - if (unlikely(!ctx->ct)) { - byteout(ctx); - } - } while ((ctx->a & 0x8000) == 0); -} - -// ----------------------------------------------------------------------------- -// The FINALISE procudure from the standard -// ----------------------------------------------------------------------------- -static void -encode_final(struct jbig2enc_ctx *restrict ctx) { - // SETBITS - const u32 tempc = ctx->c + ctx->a; - ctx->c |= 0xffff; - if (ctx->c >= tempc) { - ctx->c -= 0x8000; - } - - ctx->c <<= ctx->ct; - byteout(ctx); - ctx->c <<= ctx->ct; - byteout(ctx); - emit(ctx); - if (ctx->b != 0xff) { -#ifdef TRACE - printf("emit 0xff\n"); -#endif - ctx->b = 0xff; - emit(ctx); - } -#ifdef TRACE - printf("emit 0xac\n"); -#endif - ctx->b = 0xac; - emit(ctx); -} - -// see comments in .h file -void -jbig2enc_final(struct jbig2enc_ctx *restrict ctx) { - encode_final(ctx); -} - -// ----------------------------------------------------------------------------- -// When encoding integers there are a number of different cases. This structure -// contains all the information for one of those cases -// ----------------------------------------------------------------------------- -struct intencrange_s { - int bot, top; // the range of numbers for which this is valid - u8 data, bits; // the bits of data to write first, and the number which are valid - // These bits are taken from the bottom of the u8, in reverse order - u16 delta; // the amount to subtract from the value before encoding it - u8 intbits; // number of bits to use to encode the integer -}; - -// table for how to encode integers of a given range -static struct intencrange_s intencrange[] = { - {0, 3, 0, 2, 0, 2}, - {-1, -1, 9, 4, 0, 0}, - {-3, -2, 5, 3, 2, 1}, - {4, 19, 2, 3, 4, 4}, - {-19,-4, 3, 3, 4, 4}, - {20, 83, 6, 4, 20, 6}, - {-83,-20, 7, 4, 20, 6}, - {84, 339, 14,5, 84, 8}, - {-339,-84,15,5, 84, 8}, - {340,4435,30,6, 340, 12}, - {-4435,-340,31,6,340, 12}, - {4436,2000000000,62,6,4436, 32}, - {-2000000000,-4436,63,6,4436, 32} -}; - -// see comments in .h file -void -jbig2enc_oob(struct jbig2enc_ctx *restrict ctx, int proc) { - u8 *const context = ctx->intctx[proc]; - - encode_bit(ctx, context, 1, 1); - encode_bit(ctx, context, 3, 0); - encode_bit(ctx, context, 6, 0); - encode_bit(ctx, context, 12, 0); -} - -// see comments in .h file -void -jbig2enc_int(struct jbig2enc_ctx *restrict ctx, int proc, int value) { - u8 *const context = ctx->intctx[proc]; - int i; - - if (value > 2000000000 || value < -2000000000) abort(); - - u32 prev = 1; - - for (i = 0; ; ++i) { - if (intencrange[i].bot <= value && intencrange[i].top >= value) break; - } - if (value < 0) value = -value; - value -= intencrange[i].delta; - - u8 data = intencrange[i].data; - for (int j = 0; j < intencrange[i].bits; ++j) { - const u8 v = data & 1; - encode_bit(ctx, context, prev, v); - data >>= 1; - if (prev & 0x100) { - // prev > 256 - prev = (((prev << 1) | v) & 0x1ff) | 0x100; - } else { - prev = (prev << 1) | v; - } - } - - // move the data in value to the top of the word - value <<= (32 - intencrange[i].intbits); - for (int j = 0; j < intencrange[i].intbits; ++j) { - const u8 v = (value & 0x80000000) >> 31; - encode_bit(ctx, context, prev, v); - // roll the next bit into place - value <<= 1; - if (prev & 0x100) { - // prev > 256 - prev = (((prev << 1) | v) & 0x1ff) | 0x100; - } else { - prev = (prev << 1) | v; - } - } -} - -// see comments in .h file -void -jbig2enc_iaid(struct jbig2enc_ctx *restrict ctx, int symcodelen, int value) { - if (!ctx->iaidctx) { - // we've not yet allocated the context index buffer for this - ctx->iaidctx = (u8 *) malloc(1 << symcodelen); - memset(ctx->iaidctx, 0, 1 << symcodelen); - } - const u32 mask = (1 << (symcodelen + 1)) - 1; - - value <<= (32 - symcodelen); // roll the data to the top of the word - u32 prev = 1; - for (int i = 0; i < symcodelen; ++i) { - const u32 tval = prev & mask; - const u8 v = (value & 0x80000000) >> 31; - encode_bit(ctx, ctx->iaidctx, tval, v); - prev = (prev << 1) | v; - value <<= 1; - } -} - -// This is the test input to the coder as given in the standard (H.2) -static const u8 input[] = { 0, 2, 0, 0x51, 0, 0, 0, 0xc0, 0x03, 0x52, 0x87, - 0x2a, 0xaa, 0xaa, 0xaa, 0xaa, 0x82, 0xc0, 0x20, 0, 0xfc, 0xd7, 0x9e, 0xf6, - 0xbf, 0x7f, 0xed, 0x90, 0x4f, 0x46, 0xa3, 0xbf } ; - -// ----------------------------------------------------------------------------- -// This function is used by jbig2enc_image to fetch values from the image and -// to automatically extend the range of the image on three sides with zero's -// ----------------------------------------------------------------------------- -static u8 image_get(const u8 *restrict image, int x, int y, int mx, int my) { - if (y < 0) return 0; - if (x >= mx) return 0; - if (y >= my) return 0; - return image[mx * y + x]; -} - -// see comments in .h file -unsigned -jbig2enc_datasize(const struct jbig2enc_ctx *ctx) { - return JBIG2_OUTPUTBUFFER_SIZE * ctx->output_chunks->size() + ctx->outbuf_used; -} - -// see comments in .h file -void -jbig2enc_tobuffer(const struct jbig2enc_ctx *restrict ctx, u8 *restrict buffer) { - int j = 0; - for (std::vector::const_iterator i = ctx->output_chunks->begin(); - i != ctx->output_chunks->end(); ++i) { - memcpy(&buffer[j], *i, JBIG2_OUTPUTBUFFER_SIZE); - j += JBIG2_OUTPUTBUFFER_SIZE; - } - - memcpy(&buffer[j], ctx->outbuf, ctx->outbuf_used); -} - -// This is the context used for the TPGD bits -#define TPGDCTX 0x9b25 - -// ----------------------------------------------------------------------------- -// This is designed for Leptonica's 1bpp packed format images. Each row is some -// number of 32-bit words. Pixels are in native-byte-order in each word. -// ----------------------------------------------------------------------------- -void -jbig2enc_bitimage(struct jbig2enc_ctx *restrict ctx, const u8 *restrict idata, - int mx, int my, bool duplicate_line_removal) { - const u32 *restrict data = (u32 *) idata; - u8 *const context = ctx->context; - const unsigned words_per_row = (mx + 31) / 32; - const unsigned bytes_per_row = words_per_row * 4; - - u8 ltp = 0, sltp = 0; - - for (int y = 0; y < my; ++y) { - int x = 0; - - // the c* values store the context bits for each row. The template is fixed - // as template 0 with the floating bits in the default locations. - u16 c1, c2, c3; - // the w* values contain words from each of the rows: w1 is from two rows - // up etc. The next bit to roll onto the context values are kept at the top - // of these words. - u32 w1, w2, w3; - w1 = w2 = w3 = 0; - - if (y >= 2) w1 = data[(y - 2) * words_per_row]; - if (y >= 1) { - w2 = data[(y - 1) * words_per_row]; - - if (duplicate_line_removal) { - // it's possible that the last row was the same as this row - if (memcmp(&data[y * words_per_row], &data[(y - 1) * words_per_row], - bytes_per_row) == 0) { - sltp = ltp ^ 1; - ltp = 1; - } else { - sltp = ltp; - ltp = 0; - } - } - } - if (duplicate_line_removal) { - encode_bit(ctx, context, TPGDCTX, sltp); - if (ltp) continue; - } - w3 = data[y * words_per_row]; - - // the top three bits are the start of the context c1 - c1 = w1 >> 29; - c2 = w2 >> 28; - // and we need to remove the used bits from the w* vars - w1 <<= 3; - w2 <<= 4; - c3 = 0; - for (x = 0; x < mx; ++x) { - const u16 tval = (c1 << 11) | (c2 << 4) | c3; - const u8 v = (w3 & 0x80000000) >> 31; - - //fprintf(stderr, "%d %d %d %d\n", x, y, tval, v); - encode_bit(ctx, context, tval, v); - c1 <<= 1; - c2 <<= 1; - c3 <<= 1; - c1 |= (w1 & 0x80000000) >> 31; - c2 |= (w2 & 0x80000000) >> 31; - c3 |= v; - const int m = x % 32; - if (m == 28 && y >= 2) { - // need to roll in another word from two lines up - const unsigned wordno = (x / 32) + 1; - if (wordno >= words_per_row) { - w1 = 0; - } else { - w1 = data[(y - 2) * words_per_row + wordno]; - } - } else { - w1 <<= 1; - } - - if (m == 27 && y >= 1) { - // need to roll in another word from the last line - const unsigned wordno = (x / 32) + 1; - if (wordno >= words_per_row) { - w2 = 0; - } else { - w2 = data[(y - 1) * words_per_row + wordno]; - } - } else { - w2 <<= 1; - } - - if (m == 31) { - // need to roll in another word from this line - const unsigned wordno = (x / 32) + 1; - if (wordno >= words_per_row) { - w3 = 0; - } else { - w3 = data[y * words_per_row + wordno]; - } - } else { - w3 <<= 1; - } - - c1 &= 31; - c2 &= 127; - c3 &= 15; - } - } -} - -void -jbig2enc_refine(struct jbig2enc_ctx *__restrict__ ctx, - const uint8_t *__restrict__ itempl, int tx, int ty, - const uint8_t *__restrict__ itarget, int mx, int my, - int ox, int oy) { - const u32 *restrict templdata = (u32 *) itempl; - const u32 *restrict data = (u32 *) itarget; - u8 *restrict const context = ctx->context; - - static int image_counter = 0; - - image_counter++; - -#ifdef SYM_DEBUGGING - fprintf(stderr, "refine:%d %d %d %d\n", tx, ty, mx, my); -#endif - - const unsigned templwords_per_row = (tx + 31) / 32; - const unsigned words_per_row = (mx + 31) / 32; - - for (int y = 0; y < my; ++y) { - int x; - const int temply = y + oy; - // the template is fixed to the 13 pixel template with the floating bits in - // the default locations. - // we have 5 words of context. The first three are the last, current and - // next rows of the template. The last two are the last and current rows of - // the target. - // To form the 14 bits of content these are packed from the least - // significant bits rightward. - u16 c1, c2, c3, c4, c5; - // the w* values contain words from each of the corresponding rows. The - // next bit to be part of the context is kept at the top of these words - u32 w1, w2, w3, w4, w5; - w1 = w2 = w3 = w4 = w5 = 0; - - if (temply >= 1 && (temply - 1) < ty) w1 = templdata[(temply - 1) * templwords_per_row]; - if (temply >= 0 && temply < ty) w2 = templdata[temply * templwords_per_row]; - if (temply >= -1 && temply + 1 < ty) w3 = templdata[(temply + 1) * templwords_per_row]; - - // the x offset prevents a hassel because we are dealing with bits. Thus we - // restrict it to being {-1, 0, 1}. - if (y >= 1) w4 = data[(y - 1) * words_per_row]; - w5 = data[y * words_per_row]; - - const int shiftoffset = 30 + ox; - c1 = w1 >> shiftoffset; - c2 = w2 >> shiftoffset; - c3 = w3 >> shiftoffset; - - c4 = w4 >> 30; - c5 = 0; - - // the w* should contain the next bit to be included in the context, in the - // MSB position. Thus we need to roll the used bits out of the way. - const int bits_to_trim = 2 - ox; - w1 <<= bits_to_trim; - w2 <<= bits_to_trim; - w3 <<= bits_to_trim; - - w4 <<= 2; - - for (x = 0; x < mx; ++x) { - const u16 tval = (c1 << 10) | (c2 << 7) | (c3 << 4) | (c4 << 1) | c5; - const u8 v = w5 >> 31; - -#ifdef SYM_DEBUGGING - fprintf(stderr, "%d %d %d %d\n", x, y, tval, v); -#endif - encode_bit(ctx, context, tval, v); - c1 <<= 1; - c2 <<= 1; - c3 <<= 1; - c4 <<= 1; - c1 |= w1 >> 31; - c2 |= w2 >> 31; - c3 |= w3 >> 31; - c4 |= w4 >> 31; - c5 = v; - - const int m = x % 32; - const unsigned wordno = (x / 32) + 1; - if (m == 29 + ox) { - // have run out of bits in the w[123] values. Need to get more. - - if (wordno >= templwords_per_row) { - w1 = w2 = w3 = 0; - } else { - if (temply >= 1 && (temply - 1 < ty)) { - w1 = templdata[(temply - 1) * templwords_per_row + wordno]; - } else { - w1 = 0; - } - if (temply >= 0 && temply < ty) { - w2 = templdata[temply * templwords_per_row + wordno]; - } else { - w2 = 0; - } - if (temply >= -1 && (temply + 1) < ty) { - w3 = templdata[(temply + 1) * templwords_per_row + wordno]; - } else { - w3 = 0; - } - } - } else { - w1 <<= 1; - w2 <<= 1; - w3 <<= 1; - } - - if (m == 29 && y >= 1) { - // run out of data from w4 - if (wordno >= words_per_row) { - w4 = 0; - } else { - w4 = data[(y - 1) * words_per_row + wordno]; - } - } else { - w4 <<= 1; - } - - if (m == 31) { - // run out of data from w5 - if (wordno >= words_per_row) { - w5 = 0; - } else { - w5 = data[y * words_per_row + wordno]; - } - } else { - w5 <<= 1; - } - - c1 &= 7; - c2 &= 7; - c3 &= 7; - c4 &= 7; - } - } -} - -// see comments in .h file -void -jbig2enc_image(struct jbig2enc_ctx *restrict ctx, const u8 *restrict data, - int mx, int my, bool duplicate_line_removal) { - u8 *const context = ctx->context; - u8 ltp = 0; - u8 sltp = 0; - for (int y = 0; y < my; ++y) { - int x = 0; - u16 c1 = (image_get(data, x, y - 2, mx, my) << 2) | - (image_get(data, x + 1, y - 2, mx, my) << 1) | - (image_get(data, x + 2, y - 2, mx, my)); - u16 c2 = (image_get(data, x, y - 1, mx, my) << 3) | - (image_get(data, x + 1, y - 1, mx, my) << 2) | - (image_get(data, x + 2, y - 1, mx, my) << 1) | - (image_get(data, x + 3, y - 1, mx, my)); - u16 c3 = 0; - if (y > 0) { - // it's possible that the last row was the same as this row - if (memcmp(&data[y * mx], &data[(y - 1) * mx], mx) == 0) { - sltp = ltp ^ 1; - ltp = 1; - } else { - sltp = ltp; - ltp = 0; - } - } - if (duplicate_line_removal) { - encode_bit(ctx, context, TPGDCTX, sltp); - if (ltp) continue; - } - for (x = 0; x < mx; ++x) { - const u16 tval = (c1 << 11) | (c2 << 4) | c3; - const u8 v = image_get(data, x, y, mx, my); - encode_bit(ctx, context, tval, v); - c1 <<= 1; - c2 <<= 1; - c3 <<= 1; - c1 |= image_get(data, x + 3, y - 2, mx, my); - c2 |= image_get(data, x + 4, y - 1, mx, my); - c3 |= v; - c1 &= 31; - c2 &= 127; - c3 &= 15; - } - } -} diff --git a/pdfpatcher/JBig2/src/jbig2dec.c b/pdfpatcher/JBig2/src/jbig2dec.c deleted file mode 100644 index dc1fd560d80079a8c5c69686a7e7ad35c758d2c2..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2dec.c +++ /dev/null @@ -1,798 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include - -#ifdef HAVE_GETOPT_H -# include -#else -# include "getopt.h" -#endif - -#include "os_types.h" -#include "sha1.h" - -#ifdef JBIG_EXTERNAL_MEMENTO_H -#include JBIG_EXTERNAL_MEMENTO_H -#else -#include "memento.h" -#endif - -#include "jbig2.h" -#include "jbig2_priv.h" -#include "jbig2_image.h" -#include "jbig2_image_rw.h" - -typedef enum { - usage, dump, render -} jbig2dec_mode; - -typedef enum { - jbig2dec_format_none, - jbig2dec_format_jbig2, - jbig2dec_format_pbm, -#ifdef HAVE_LIBPNG - jbig2dec_format_png, -#endif -} jbig2dec_format; - -typedef struct { - jbig2dec_mode mode; - int verbose, hash, embedded; - SHA1_CTX *hash_ctx; - char *output_filename; - jbig2dec_format output_format; - size_t memory_limit; -} jbig2dec_params_t; - -typedef struct { - int verbose; - char *last_message; - Jbig2Severity severity; - char *type; - long repeats; -} jbig2dec_error_callback_state_t; - -typedef struct { - Jbig2Allocator super; - Jbig2Ctx *ctx; - size_t memory_limit; - size_t memory_used; - size_t memory_peak; -} jbig2dec_allocator_t; - -static int print_version(void); -static int print_usage(void); - -#define ALIGNMENT 16 -#define KBYTE 1024 -#define MBYTE (1024 * KBYTE) - -static void *jbig2dec_reached_limit(jbig2dec_allocator_t *allocator, size_t oldsize, size_t size) -{ - size_t limit_mb = allocator->memory_limit / MBYTE; - size_t used_mb = allocator->memory_used / MBYTE; - size_t oldsize_mb = oldsize / MBYTE; - size_t size_mb = size / MBYTE; - - if (oldsize == 0) - jbig2_error(allocator->ctx, JBIG2_SEVERITY_FATAL, -1, "memory: limit reached: limit: %zu (%zu Mbyte) used: %zu (%zu Mbyte) allocation: %zu (%zu Mbyte)", - allocator->memory_limit, limit_mb, - allocator->memory_used, used_mb, - size, size_mb); - else - jbig2_error(allocator->ctx, JBIG2_SEVERITY_FATAL, -1, "memory: limit reached: limit: %zu (%zu Mbyte) used: %zu (%zu Mbyte) reallocation: %zu (%zu Mbyte) -> %zu (%zu Mbyte)", - allocator->memory_limit, limit_mb, - allocator->memory_used, used_mb, - oldsize, oldsize_mb, - size, size_mb); - - return NULL; -} - -static void jbig2dec_peak(jbig2dec_allocator_t *allocator) -{ - size_t limit_mb = allocator->memory_limit / MBYTE; - size_t peak_mb = allocator->memory_peak / MBYTE; - size_t used_mb = allocator->memory_used / MBYTE; - - if (allocator->ctx == NULL) - return; - if (used_mb <= peak_mb) - return; - - allocator->memory_peak = allocator->memory_used; - - jbig2_error(allocator->ctx, JBIG2_SEVERITY_DEBUG, JBIG2_UNKNOWN_SEGMENT_NUMBER, "memory: limit: %lu %sbyte used: %lu %sbyte, peak: %lu %sbyte", - limit_mb > 0 ? limit_mb : allocator->memory_limit, limit_mb > 0 ? "M" : "", - used_mb > 0 ? used_mb : allocator->memory_used, used_mb > 0 ? "M" : "", - peak_mb > 0 ? peak_mb : allocator->memory_peak, peak_mb > 0 ? "M" : ""); -} - -static void *jbig2dec_alloc(Jbig2Allocator *allocator_, size_t size) -{ - jbig2dec_allocator_t *allocator = (jbig2dec_allocator_t *) allocator_; - void *ptr; - - if (size == 0) - return NULL; - if (size > SIZE_MAX - ALIGNMENT) - return NULL; - - if (size + ALIGNMENT > allocator->memory_limit - allocator->memory_used) - return jbig2dec_reached_limit(allocator, 0, size + ALIGNMENT); - - ptr = malloc(size + ALIGNMENT); - if (ptr == NULL) - return NULL; - memcpy(ptr, &size, sizeof(size)); - allocator->memory_used += size + ALIGNMENT; - - jbig2dec_peak(allocator); - - return (unsigned char *) ptr + ALIGNMENT; -} - -static void jbig2dec_free(Jbig2Allocator *allocator_, void *p) -{ - jbig2dec_allocator_t *allocator = (jbig2dec_allocator_t *) allocator_; - size_t size; - - if (p == NULL) - return; - - memcpy(&size, (unsigned char *) p - ALIGNMENT, sizeof(size)); - allocator->memory_used -= size + ALIGNMENT; - free((unsigned char *) p - ALIGNMENT); -} - -static void *jbig2dec_realloc(Jbig2Allocator *allocator_, void *p, size_t size) -{ - jbig2dec_allocator_t *allocator = (jbig2dec_allocator_t *) allocator_; - unsigned char *oldp; - size_t oldsize; - - if (p == NULL) - return jbig2dec_alloc(allocator_, size); - if (p < (void *) ALIGNMENT) - return NULL; - - if (size == 0) { - jbig2dec_free(allocator_, p); - return NULL; - } - if (size > SIZE_MAX - ALIGNMENT) - return NULL; - - oldp = (unsigned char *) p - ALIGNMENT; - memcpy(&oldsize, oldp, sizeof(oldsize)); - - if (size + ALIGNMENT > allocator->memory_limit - allocator->memory_used + oldsize + ALIGNMENT) - return jbig2dec_reached_limit(allocator, oldsize + ALIGNMENT, size + ALIGNMENT); - - p = realloc(oldp, size + ALIGNMENT); - if (p == NULL) - return NULL; - - allocator->memory_used -= oldsize + ALIGNMENT; - memcpy(p, &size, sizeof(size)); - allocator->memory_used += size + ALIGNMENT; - - jbig2dec_peak(allocator); - - return (unsigned char *) p + ALIGNMENT; -} - -/* page hashing functions */ -static void -hash_init(jbig2dec_params_t *params) -{ - params->hash_ctx = (SHA1_CTX *) malloc(sizeof(SHA1_CTX)); - if (params->hash_ctx == NULL) { - fprintf(stderr, "unable to allocate hash state\n"); - params->hash = 0; - return; - } else { - SHA1_Init(params->hash_ctx); - } -} - -static void -hash_image(jbig2dec_params_t *params, Jbig2Image *image) -{ - unsigned int N = image->stride * image->height; - - SHA1_Update(params->hash_ctx, image->data, N); -} - -static void -hash_print(jbig2dec_params_t *params, FILE *out) -{ - unsigned char md[SHA1_DIGEST_SIZE]; - char digest[2 * SHA1_DIGEST_SIZE + 1]; - int i; - - SHA1_Final(params->hash_ctx, md); - for (i = 0; i < SHA1_DIGEST_SIZE; i++) { - snprintf(&(digest[2 * i]), 3, "%02x", md[i]); - } - fprintf(out, "%s", digest); -} - -static void -hash_free(jbig2dec_params_t *params) -{ - free(params->hash_ctx); - params->hash_ctx = NULL; -} - -static int -set_output_format(jbig2dec_params_t *params, const char *format) -{ -#ifdef HAVE_LIBPNG - /* this should really by strncasecmp() - TODO: we need to provide our own for portability */ - if (!strncmp(format, "png", 3) || !strncmp(format, "PNG", 3)) { - params->output_format = jbig2dec_format_png; - return 0; - } -#endif - /* default to pbm */ - params->output_format = jbig2dec_format_pbm; - - return 0; -} - -static int -parse_options(int argc, char *argv[], jbig2dec_params_t *params) -{ - static struct option long_options[] = { - {"version", 0, NULL, 'V'}, - {"help", 0, NULL, 'h'}, - {"quiet", 0, NULL, 'q'}, - {"verbose", 2, NULL, 'v'}, - {"dump", 0, NULL, 'd'}, - {"hash", 0, NULL, 'm'}, - {"output", 1, NULL, 'o'}, - {"format", 1, NULL, 't'}, - {"embedded", 0, NULL, 'e'}, - {NULL, 0, NULL, 0} - }; - int option_idx = 1; - int option; - int ret; - - while (1) { - option = getopt_long(argc, argv, "Vh?qv:do:t:eM:", long_options, &option_idx); - if (option == -1) - break; - - switch (option) { - case 0: /* unknown long option */ - if (!params->verbose) - fprintf(stdout, "unrecognized option: --%s\n", long_options[option_idx].name); - break; - case 'q': - params->verbose = 0; - break; - case 'v': - if (optarg) - params->verbose = atoi(optarg); - else - params->verbose = 2; - break; - case 'h': - case '?': - params->mode = usage; - break; - case 'V': - /* the GNU Coding Standards suggest --version - should override all other options */ - print_version(); - exit(0); - break; - case 'd': - params->mode = dump; - break; - case 'm': - params->hash = 1; - break; - case 'o': - params->output_filename = strdup(optarg); - break; - case 't': - set_output_format(params, optarg); - break; - case 'e': - params->embedded = 1; - break; - case 'M': - ret = sscanf(optarg, "%zu", ¶ms->memory_limit); - if (ret != 1) - fprintf(stderr, "could not parse memory limit argument\n"); - break; - default: - if (!params->verbose) - fprintf(stderr, "unrecognized option: -%c\n", option); - break; - } - } - return (optind); -} - -static int -print_version(void) -{ - fprintf(stdout, "jbig2dec %d.%d\n", JBIG2_VERSION_MAJOR, JBIG2_VERSION_MINOR); - return 0; -} - -static int -print_usage(void) -{ - fprintf(stderr, - "Usage: jbig2dec [options] \n" - " or jbig2dec [options] \n" - "\n" - " When invoked with a single file, it attempts to parse it as\n" - " a normal jbig2 file. Invoked with two files, it treats the\n" - " first as the global segments, and the second as the segment\n" - " stream for a particular page. This is useful for examining\n" - " embedded streams.\n" - "\n" - " available options:\n" - " -h --help this usage summary\n" - " -q --quiet suppress diagnostic output\n" - " -v --verbose set the verbosity level\n" - " -d --dump print the structure of the jbig2 file\n" - " rather than explicitly decoding\n" - " -V --version program name and version information\n" - " -m --hash print a hash of the decoded document\n" - " -e --embedded expect embedded bit stream without file header\n" - " -M memory limit expressed in bytes\n" - " -o \n" - " --output send decoded output to \n" - " Defaults to the the input with a different\n" - " extension. Pass '-' for stdout.\n" - " -t \n" - " --format force a particular output file format\n" -#ifdef HAVE_LIBPNG - " supported options are 'png' and 'pbm'\n" -#else - " the only supported option is 'pbm'\n" -#endif - "\n"); - - return 1; -} - -static void -error_callback(void *error_callback_data, const char *message, Jbig2Severity severity, uint32_t seg_idx) -{ - jbig2dec_error_callback_state_t *state = (jbig2dec_error_callback_state_t *) error_callback_data; - char *type; - int ret; - - switch (severity) { - case JBIG2_SEVERITY_DEBUG: - if (state->verbose < 3) - return; - type = "DEBUG"; - break; - case JBIG2_SEVERITY_INFO: - if (state->verbose < 2) - return; - type = "info"; - break; - case JBIG2_SEVERITY_WARNING: - if (state->verbose < 1) - return; - type = "WARNING"; - break; - case JBIG2_SEVERITY_FATAL: - type = "FATAL ERROR"; - break; - default: - type = "unknown message"; - break; - } - - if (state->last_message != NULL && !strcmp(message, state->last_message) && state->severity == severity && state->type == type) { - state->repeats++; - if (state->repeats % 1000000 == 0) { - ret = fprintf(stderr, "jbig2dec %s last message repeated %ld times so far\n", state->type, state->repeats); - if (ret < 0) - goto printerror; - } - } else { - if (state->repeats > 1) { - ret = fprintf(stderr, "jbig2dec %s last message repeated %ld times\n", state->type, state->repeats); - if (ret < 0) - goto printerror; - } - - if (seg_idx == JBIG2_UNKNOWN_SEGMENT_NUMBER) - ret = fprintf(stderr, "jbig2dec %s %s\n", type, message); - else - ret = fprintf(stderr, "jbig2dec %s %s (segment 0x%08x)\n", type, message, seg_idx); - if (ret < 0) - goto printerror; - - state->repeats = 0; - state->severity = severity; - state->type = type; - free(state->last_message); - state->last_message = NULL; - - if (message) { - state->last_message = strdup(message); - if (state->last_message == NULL) { - ret = fprintf(stderr, "jbig2dec WARNING could not duplicate message\n"); - if (ret < 0) - goto printerror; - } - } - } - - return; - -printerror: - fprintf(stderr, "jbig2dec WARNING could not print message\n"); - state->repeats = 0; - free(state->last_message); - state->last_message = NULL; -} - -static void -flush_errors(jbig2dec_error_callback_state_t *state) -{ - if (state->repeats > 1) { - fprintf(stderr, "jbig2dec last message repeated %ld times\n", state->repeats); - } -} - -static char * -make_output_filename(const char *input_filename, const char *extension) -{ - char *output_filename; - const char *c, *e; - size_t extlen, len; - - if (extension == NULL) { - fprintf(stderr, "no filename extension; cannot create output filename!\n"); - exit(1); - } - - if (input_filename == NULL) - c = "out"; - else { - /* strip any leading path */ - c = strrchr(input_filename, '/'); /* *nix */ - if (c == NULL) - c = strrchr(input_filename, '\\'); /* win32/dos */ - if (c != NULL) - c++; /* skip the path separator */ - else - c = input_filename; /* no leading path */ - } - - /* make sure we haven't just stripped the last character */ - if (*c == '\0') - c = "out"; - - /* strip the extension */ - len = strlen(c); - e = strrchr(c, '.'); - if (e != NULL) - len -= strlen(e); - - extlen = strlen(extension); - - /* allocate enough space for the base + ext */ - output_filename = (char *)malloc(len + extlen + 1); - if (output_filename == NULL) { - fprintf(stderr, "failed to allocate memory for output filename\n"); - exit(1); - } - - memcpy(output_filename, c, len); - memcpy(output_filename + len, extension, extlen); - *(output_filename + len + extlen) = '\0'; - - /* return the new string */ - return (output_filename); -} - -static int -write_page_image(jbig2dec_params_t *params, FILE *out, Jbig2Image *image) -{ - switch (params->output_format) { -#ifdef HAVE_LIBPNG - case jbig2dec_format_png: - return jbig2_image_write_png(image, out); -#endif - case jbig2dec_format_pbm: - return jbig2_image_write_pbm(image, out); - default: - fprintf(stderr, "unsupported output format.\n"); - return 1; - } - - return 0; -} - -static int -write_document_hash(jbig2dec_params_t *params) -{ - FILE *out; - - if (!strncmp(params->output_filename, "-", 2)) { - out = stderr; - } else { - out = stdout; - } - - fprintf(out, "Hash of decoded document: "); - hash_print(params, out); - fprintf(out, "\n"); - - return 0; -} - -int -main(int argc, char **argv) -{ - jbig2dec_params_t params; - jbig2dec_error_callback_state_t error_callback_state; - jbig2dec_allocator_t allocator_; - jbig2dec_allocator_t *allocator = &allocator_; - Jbig2Ctx *ctx = NULL; - FILE *f = NULL, *f_page = NULL; - uint8_t buf[4096]; - int filearg; - int result = 1; - int code; - - /* set defaults */ - params.mode = render; - params.verbose = 1; - params.hash = 0; - params.output_filename = NULL; - params.output_format = jbig2dec_format_none; - params.embedded = 0; - params.memory_limit = 0; - - filearg = parse_options(argc, argv, ¶ms); - - error_callback_state.verbose = params.verbose; - error_callback_state.severity = JBIG2_SEVERITY_DEBUG; - error_callback_state.type = NULL; - error_callback_state.last_message = NULL; - error_callback_state.repeats = 0; - - if (params.hash) - hash_init(¶ms); - - switch (params.mode) { - case usage: - print_usage(); - exit(0); - break; - case dump: - fprintf(stderr, "Sorry, segment dump not yet implemented\n"); - break; - case render: - - if ((argc - filearg) == 1) { - /* only one argument--open as a jbig2 file */ - char *fn = argv[filearg]; - - f = fopen(fn, "rb"); - if (f == NULL) { - fprintf(stderr, "error opening %s\n", fn); - goto cleanup; - } - } else if ((argc - filearg) == 2) { - /* two arguments open as separate global and page streams */ - char *fn = argv[filearg]; - char *fn_page = argv[filearg + 1]; - - f = fopen(fn, "rb"); - if (f == NULL) { - fprintf(stderr, "error opening %s\n", fn); - goto cleanup; - } - - f_page = fopen(fn_page, "rb"); - if (f_page == NULL) { - fclose(f); - fprintf(stderr, "error opening %s\n", fn_page); - goto cleanup; - } - } else { - /* any other number of arguments */ - result = print_usage(); - goto cleanup; - } - - if (params.memory_limit == 0) - allocator = NULL; - else - { - allocator->super.alloc = jbig2dec_alloc; - allocator->super.free = jbig2dec_free; - allocator->super.realloc = jbig2dec_realloc; - allocator->ctx = NULL; - allocator->memory_limit = params.memory_limit; - allocator->memory_used = 0; - allocator->memory_peak = 0; - } - - ctx = jbig2_ctx_new((Jbig2Allocator *) allocator, (Jbig2Options)(f_page != NULL || params.embedded ? JBIG2_OPTIONS_EMBEDDED : 0), NULL, error_callback, &error_callback_state); - if (ctx == NULL) { - fclose(f); - if (f_page) - fclose(f_page); - goto cleanup; - } - - if (allocator != NULL) - allocator->ctx = ctx; - - /* pull the whole file/global stream into memory */ - for (;;) { - int n_bytes = fread(buf, 1, sizeof(buf), f); - if (n_bytes < 0) { - if (f_page != NULL) - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "unable to read jbig2 global stream"); - else - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "unable to read jbig2 page stream"); - } - if (n_bytes <= 0) - break; - - if (jbig2_data_in(ctx, buf, (size_t) n_bytes) < 0) - { - if (f_page != NULL) - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "unable to process jbig2 global stream"); - else - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "unable to process jbig2 page stream"); - break; - } - } - fclose(f); - - /* if there's a local page stream read that in its entirety */ - if (f_page != NULL) { - Jbig2GlobalCtx *global_ctx = jbig2_make_global_ctx(ctx); - - ctx = jbig2_ctx_new((Jbig2Allocator *) allocator, JBIG2_OPTIONS_EMBEDDED, global_ctx, error_callback, &error_callback_state); - if (ctx != NULL) { - if (allocator != NULL) - allocator->ctx = ctx; - - for (;;) { - int n_bytes = fread(buf, 1, sizeof(buf), f_page); - if (n_bytes < 0) - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "unable to read jbig2 page stream"); - if (n_bytes <= 0) - break; - - if (jbig2_data_in(ctx, buf, (size_t) n_bytes) < 0) - { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "unable to process jbig2 page stream"); - break; - } - } - } - fclose(f_page); - jbig2_global_ctx_free(global_ctx); - } - - /* retrieve and output the returned pages */ - { - Jbig2Image *image; - FILE *out; - - /* always complete a page, working around streams that lack end of - page segments: broken CVision streams, embedded streams or streams - with parse errors. */ - code = jbig2_complete_page(ctx); - if (code < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_WARNING, JBIG2_UNKNOWN_SEGMENT_NUMBER, "unable to complete page"); - goto cleanup; - } - - if (params.output_filename == NULL) { - switch (params.output_format) { -#ifdef HAVE_LIBPNG - case jbig2dec_format_png: - params.output_filename = make_output_filename(argv[filearg], ".png"); - break; -#endif - case jbig2dec_format_pbm: - params.output_filename = make_output_filename(argv[filearg], ".pbm"); - break; - default: - fprintf(stderr, "unsupported output format: %d\n", params.output_format); - goto cleanup; - } - } else { - int len = strlen(params.output_filename); - - if ((len >= 3) && (params.output_format == jbig2dec_format_none)) - /* try to set the output type by the given extension */ - set_output_format(¶ms, params.output_filename + len - 3); - } - - if (!strncmp(params.output_filename, "-", 2)) { - out = stdout; - } else { - if (params.verbose > 1) - fprintf(stderr, "saving decoded page as '%s'\n", params.output_filename); - if ((out = fopen(params.output_filename, "wb")) == NULL) { - fprintf(stderr, "unable to open '%s' for writing\n", params.output_filename); - goto cleanup; - } - } - - /* retrieve and write out all the completed pages */ - while ((image = jbig2_page_out(ctx)) != NULL) { - write_page_image(¶ms, out, image); - if (params.hash) - hash_image(¶ms, image); - jbig2_release_page(ctx, image); - } - - if (out != stdout) - fclose(out); - if (params.hash) - write_document_hash(¶ms); - } - - } /* end params.mode switch */ - - if (allocator != NULL && allocator->ctx != NULL) { - size_t limit_mb = allocator->memory_limit / MBYTE; - size_t peak_mb = allocator->memory_peak / MBYTE; - jbig2_error(allocator->ctx, JBIG2_SEVERITY_DEBUG, JBIG2_UNKNOWN_SEGMENT_NUMBER, "memory: limit: %lu Mbyte peak usage: %lu Mbyte", limit_mb, peak_mb); - } - - /* fin */ - result = 0; - -cleanup: - flush_errors(&error_callback_state); - jbig2_ctx_free(ctx); - if (params.output_filename) - free(params.output_filename); - if (error_callback_state.last_message) - free(error_callback_state.last_message); - if (params.hash) - hash_free(¶ms); - - return result; -} diff --git a/pdfpatcher/JBig2/src/jbig2enc.cc b/pdfpatcher/JBig2/src/jbig2enc.cc deleted file mode 100644 index a42482f6c1c5822ed9f90cf4d470dd3683b335cd..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2enc.cc +++ /dev/null @@ -1,644 +0,0 @@ -// Copyright 2006 Google Inc. All Rights Reserved. -// Author: agl@imperialviolet.org (Adam Langley) -// -// Copyright (C) 2006 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include -#include - -#include -#include - -#include -#if defined(sun) -#include -#else -#include -#endif - -#define u64 uint64_t -#define u32 uint32_t -#define u16 uint16_t -#define u8 uint8_t - -#include "jbig2arith.h" -#include "jbig2sym.h" -#include "jbig2structs.h" -#include "jbig2segments.h" - -// ----------------------------------------------------------------------------- -// Removes spots which are less than size x size pixels -// -// Note, this has a side-effect of removing a few pixels -// that from components you want to keep. -// -// If that's a problem, you do a binary reconstruction -// (from seedfill.c): -// ----------------------------------------------------------------------------- -static PIX * -remove_flyspecks(PIX *const source, const int size) { - Sel *sel_5h = selCreateBrick(1, size, 0, 2, SEL_HIT); - Sel *sel_5v = selCreateBrick(size, 1, 2, 0, SEL_HIT); - - Pix *pixt = pixOpen(NULL, source, sel_5h); - Pix *pixd = pixOpen(NULL, source, sel_5v); - pixOr(pixd, pixd, pixt); - pixDestroy(&pixt); - selDestroy(&sel_5h); - selDestroy(&sel_5v); - - return pixd; -} - -// ----------------------------------------------------------------------------- -// Returns the number of bits needed to encode v symbols -// ----------------------------------------------------------------------------- -static unsigned -log2up(int v) { - unsigned r = 0; - const bool is_pow_of_2 = (v & (v - 1)) == 0; - - while (v >>= 1) r++; - if (is_pow_of_2) return r; - - return r + 1; -} - -// ----------------------------------------------------------------------------- -// This is the context for a multi-page JBIG2 document. -// ----------------------------------------------------------------------------- -struct jbig2ctx { - struct JbClasser *classer; // the leptonica classifier - int xres, yres; // ppi for the X and Y direction - bool full_headers; // true if we are producing a full JBIG2 file - bool pdf_page_numbering; // true if all text pages are page "1" (pdf mode) - int segnum; // current segment number - int symtab_segment; // the segment number of the symbol table - // a map from page number a list of components for that page - std::map > pagecomps; - // for each page, the list of symbols which are only used on that page - std::map > single_use_symbols; - // the number of symbols in the global symbol table - int num_global_symbols; - std::vector page_xres, page_yres; - std::vector page_width, page_height; - // Used to store the mapping from symbol number to the index in the global - // symbol dictionary. - std::map symmap; - bool refinement; - PIXA *avg_templates; // grayed templates - int refine_level; - // only used when using refinement - // the number of the first symbol of each page - std::vector baseindexes; -}; - -// see comments in .h file -struct jbig2ctx * -jbig2_init(float thresh, float weight, int xres, int yres, bool full_headers, - int refine_level) { - struct jbig2ctx *ctx = new jbig2ctx; - ctx->xres = xres; - ctx->yres = yres; - ctx->full_headers = full_headers; - ctx->pdf_page_numbering = !full_headers; - ctx->segnum = 0; - ctx->symtab_segment = -1; - ctx->refinement = refine_level >= 0; - ctx->refine_level = refine_level; - ctx->avg_templates = NULL; - - ctx->classer = jbCorrelationInitWithoutComponents(JB_CONN_COMPS, 9999, 9999, - thresh, weight); - - return ctx; -} - -// see comments in .h file -void -jbig2_destroy(struct jbig2ctx *ctx) { - if (ctx->avg_templates) pixaDestroy(&ctx->avg_templates); - jbClasserDestroy(&ctx->classer); - delete ctx; -} - -// see comments in .h file -void -jbig2_add_page(struct jbig2ctx *ctx, struct Pix *input) { - PIX *bw; - - if (false /*ctx->xres >= 300*/) { - bw = remove_flyspecks(input, (int) (0.0084*ctx->xres)); - } else { - bw = pixClone(input); - } - - if (ctx->refinement) { - ctx->baseindexes.push_back(ctx->classer->baseindex); - } - - jbAddPage(ctx->classer, bw); - ctx->page_width.push_back(bw->w); - ctx->page_height.push_back(bw->h); - ctx->page_xres.push_back(bw->xres); - ctx->page_yres.push_back(bw->yres); - - if (ctx->refinement) { - // This code is broken by (my) recent changes to Leptonica. Needs to be - // fixed at some point, but not too important at the moment since we don't - // use refinement. - - /*BOXA *boxes = boxaCopy(ctx->classer->boxas, L_CLONE); - ctx->boxes.push_back(boxes); - PIXA *comps = pixaCopy(ctx->classer->pixas, L_CLONE); - ctx->comps.push_back(comps);*/ - } - - pixDestroy(&bw); -} - -#define F(x) memcpy(ret + offset, &x, sizeof(x)) ; offset += sizeof(x) -#define G(x, y) memcpy(ret + offset, x, y); offset += y; -#define SEGMENT(x) x.write(ret + offset); offset += x.size(); - -// see comments in .h file -uint8_t * -jbig2_pages_complete(struct jbig2ctx *ctx, int *const length) { - /* - Graying support - disabled. - It's not very clear that graying actaully buys you much extra quality - above pick-the-first. Also, aligning the gray glyphs requires the - original source image. - - Remember that you need the Init without WithoutComponents to use this */ - - - /*NUMA *samples_per_composition; - PTA *grayed_centroids; - PIXA *grayed; - - grayed = jbAccumulateComposites(ctx->classer->pixaa, &samples_per_composition, - &grayed_centroids); - - if (!grayed || grayed->n != ctx->classer->pixaa->n) { - fprintf(stderr, "Graying failed\n"); - return NULL; - } - - ctx->avg_templates = pixaCreate(0); - for (int i = 0; i < grayed->n; ++i) { - int samples; - numaGetIValue(samples_per_composition, i, &samples); - PIX *avg = pixFinalAccumulateThreshold(grayed->pix[i], 0, - (samples + 1) >> 1); - pixaAddPix(ctx->avg_templates, avg, L_INSERT); - //char b[512]; - //sprintf(b, "gray-%d/th.png", i); - //pixWrite(b, avg, IFF_PNG); - } - - pixaDestroy(&grayed); - numaDestroy(&samples_per_composition);*/ - - // We find the symbols which only appear on a single page and encode them in - // a symbol dictionary just for that page. This is because we want to keep - // the size of the global dictionary down as some PDF readers appear to - // decode it for every page (!) - - // (as a short cut, we just pick the symbols which are only used once since, - // in testing, all the symbols which appear on only one page appear only once - // on that page) - - const bool single_page = ctx->classer->npages == 1; - - // maps symbol number to the number of times it has been used - // pixat->n is the number of symbols - // naclass->n is the number of connected components - - std::vector symbol_used(ctx->classer->pixat->n); - for (int i = 0; i < ctx->classer->naclass->n; ++i) { - int n; - numaGetIValue(ctx->classer->naclass, i, &n); - symbol_used[n]++; - } - - // the multiuse symbols are the ones which go into the global dictionary - std::vector multiuse_symbols; - for (int i = 0; i < ctx->classer->pixat->n; ++i) { - if (symbol_used[i] == 0) abort(); - if (symbol_used[i] > 1 || single_page) multiuse_symbols.push_back(i); - } - ctx->num_global_symbols = multiuse_symbols.size(); - - // build the pagecomps map: a map from page number to the list of connected - // components for that page. The classer gives us an array from connected - // component number to page number - we just have to reverse it - for (int i = 0; i < ctx->classer->napage->n; ++i) { - int page_num; - numaGetIValue(ctx->classer->napage, i, &page_num); - ctx->pagecomps[page_num].push_back(i); - int symbol; - numaGetIValue(ctx->classer->naclass, i, &symbol); - if (symbol_used[symbol] == 1 && !single_page) { - ctx->single_use_symbols[page_num].push_back(symbol); - } - } - -#ifdef DUMP_SYMBOL_GRAPH - for (int p = 0; p < ctx->classer->npages; ++p) { - for (std::vector::const_iterator i = ctx->pagecomps[p].begin(); - i != ctx->pagecomps[p].end(); ++i) { - const int sym = (int) ctx->classer->naclass->array[*i]; - fprintf(stderr, "S: %d %d\n", p, sym); - } - } -#endif - -#ifdef SYMBOL_COMPRESSION_DEBUGGING - std::map usecount; - for (int i = 0; i < ctx->classer->naclass->n; ++i) { - usecount[(int)ctx->classer->naclass->array[i]]++; - } - - for (int p = 0; p < ctx->classer->npages; ++p) { - const int numcomps = ctx->pagecomps[p].size(); - int unique_in_doc = 0; - std::map symcount; - for (std::vector::const_iterator i = ctx->pagecomps[p].begin(); - i != ctx->pagecomps[p].end(); ++i) { - const int sym = (int) ctx->classer->naclass->array[*i]; - symcount[sym]++; - if (usecount[sym] == 1) unique_in_doc++; - } - int unique_this_page = 0; - for (std::map::const_iterator i = symcount.begin(); - i != symcount.end(); ++i) { - if (i->second == 1) unique_this_page++; - } - - fprintf(stderr, "Page %d %d/%d/%d\n", p, numcomps, unique_this_page, unique_in_doc); - } -#endif - -#ifdef DUMP_ALL_SYMBOLS - char filenamebuf[128]; - for (int i = 0; i < ctx->classer->pixat->n; ++i) { - sprintf(filenamebuf, "sym-%d.png", i); - pixWrite(filenamebuf, ctx->classer->pixat->pix[i], IFF_PNG); - } -#endif - fprintf(stderr, "JBIG2 compression complete. pages:%d symbols:%d log2:%d\n", - ctx->classer->npages, ctx->classer->pixat->n, - log2up(ctx->classer->pixat->n)); - - jbGetLLCorners(ctx->classer); - - struct jbig2enc_ctx ectx; - jbig2enc_init(&ectx); - - struct jbig2_file_header header; - if (ctx->full_headers) { - memset(&header, 0, sizeof(header)); - header.n_pages = htonl(ctx->classer->npages); - header.organisation_type = 1; - memcpy(&header.id, JBIG2_FILE_MAGIC, 8); - } - - Segment seg; - struct jbig2_symbol_dict symtab; - memset(&symtab, 0, sizeof(symtab)); - - jbig2enc_symboltable - (&ectx, ctx->avg_templates ? ctx->avg_templates : ctx->classer->pixat, - &multiuse_symbols, &ctx->symmap, ctx->avg_templates == NULL); - const int symdatasize = jbig2enc_datasize(&ectx); - - symtab.a1x = 3; - symtab.a1y = -1; - symtab.a2x = -3; - symtab.a2y = -1; - symtab.a3x = 2; - symtab.a3y = -2; - symtab.a4x = -2; - symtab.a4y = -2; - symtab.exsyms = symtab.newsyms = htonl(multiuse_symbols.size()); - - ctx->symtab_segment = ctx->segnum; - seg.number = ctx->segnum; - ctx->segnum++; - seg.type = segment_symbol_table; - seg.len = sizeof(symtab) + symdatasize; - seg.page = 0; - seg.retain_bits = 1; - - u8 *const ret = (u8 *) malloc((ctx->full_headers ? sizeof(header) : 0) + - seg.size() + sizeof(symtab) + symdatasize); - int offset = 0; - if (ctx->full_headers) { - F(header); - } - SEGMENT(seg); - F(symtab); - jbig2enc_tobuffer(&ectx, ret + offset); - jbig2enc_dealloc(&ectx); - offset += symdatasize; - - *length = offset; - - return ret; -} - -// see comments in .h file -uint8_t * -jbig2_produce_page(struct jbig2ctx *ctx, int page_no, - int xres, int yres, int *const length) { - const bool last_page = page_no == ctx->classer->npages; - const bool include_trailer = last_page && ctx->full_headers; - - struct jbig2enc_ctx ectx; - jbig2enc_init(&ectx); - - Segment seg, symseg; - Segment endseg, trailerseg; - struct jbig2_page_info pageinfo; - memset(&pageinfo, 0, sizeof(pageinfo)); - struct jbig2_text_region textreg; - memset(&textreg, 0, sizeof(textreg)); - struct jbig2_text_region_syminsts textreg_syminsts; - memset(&textreg_syminsts, 0, sizeof(textreg_syminsts)); - struct jbig2_text_region_atflags textreg_atflags; - memset(&textreg_atflags, 0, sizeof(textreg_atflags)); - Segment segr; - - // page information segment - seg.number = ctx->segnum; - ctx->segnum++; - seg.type = segment_page_information; - seg.page = ctx->pdf_page_numbering ? 1 : 1 + page_no; - seg.len = sizeof(struct jbig2_page_info); - pageinfo.width = htonl(ctx->page_width[page_no]); - pageinfo.height = htonl(ctx->page_height[page_no]); - pageinfo.xres = htonl(xres == -1 ? ctx->page_xres[page_no] : xres ); - pageinfo.yres = htonl(yres == -1 ? ctx->page_yres[page_no] : yres ); - pageinfo.is_lossless = ctx->refinement; - - std::map second_symbol_map; - // If we have single-use symbols on this page we make a new symbol table - // containing just them. - const bool extrasymtab = ctx->single_use_symbols[page_no].size() > 0; - struct jbig2enc_ctx extrasymtab_ctx; - - struct jbig2_symbol_dict symtab; - memset(&symtab, 0, sizeof(symtab)); - - if (extrasymtab) { - jbig2enc_init(&extrasymtab_ctx); - symseg.number = ctx->segnum++; - symseg.type = segment_symbol_table; - symseg.page = ctx->pdf_page_numbering ? 1 : 1 + page_no; - - jbig2enc_symboltable - (&extrasymtab_ctx, - ctx->avg_templates ? ctx->avg_templates : ctx->classer->pixat, - &ctx->single_use_symbols[page_no], &second_symbol_map, - ctx->avg_templates == NULL); - symtab.a1x = 3; - symtab.a1y = -1; - symtab.a2x = -3; - symtab.a2y = -1; - symtab.a3x = 2; - symtab.a3y = -2; - symtab.a4x = -2; - symtab.a4y = -2; - symtab.exsyms = symtab.newsyms = - htonl(ctx->single_use_symbols[page_no].size()); - - symseg.len = jbig2enc_datasize(&extrasymtab_ctx) + sizeof(symtab); - } - - const int numsyms = ctx->num_global_symbols + - ctx->single_use_symbols[page_no].size(); - //BOXA *const boxes = ctx->refinement ? ctx->boxes[page_no] : NULL; - int baseindex = ctx->refinement ? ctx->baseindexes[page_no] : 0; - jbig2enc_textregion(&ectx, ctx->symmap, second_symbol_map, - ctx->pagecomps[page_no], - ctx->classer->ptall, - ctx->avg_templates ? ctx->avg_templates : ctx->classer->pixat, - ctx->classer->naclass, 1, - log2up(numsyms), - //ctx->refinement ? ctx->comps[page_no] : NULL, - NULL, - /* boxes */ NULL, baseindex, ctx->refine_level, - ctx->avg_templates == NULL); - const int textdatasize = jbig2enc_datasize(&ectx); - textreg.width = htonl(ctx->page_width[page_no]); - textreg.height = htonl(ctx->page_height[page_no]); - textreg.logsbstrips = 0; - textreg.sbrefine = ctx->refinement; - // refcorner = 0 -> bot left - textreg_syminsts.sbnuminstances = htonl(ctx->pagecomps[page_no].size()); - - textreg_atflags.a1x = -1; - textreg_atflags.a1y = -1; - textreg_atflags.a2x = -1; - textreg_atflags.a2y = -1; - - segr.number = ctx->segnum; - ctx->segnum++; - segr.type = segment_imm_text_region; - segr.referred_to.push_back(ctx->symtab_segment); - if (extrasymtab) segr.referred_to.push_back(symseg.number); - if (ctx->refinement) { - segr.len = sizeof(textreg) + sizeof(textreg_syminsts) + - sizeof(textreg_atflags) + textdatasize; - } else { - segr.len = sizeof(textreg) + sizeof(textreg_syminsts) + textdatasize; - } - - segr.retain_bits = 2; - segr.page = ctx->pdf_page_numbering ? 1 : 1 + page_no; - - const int extrasymtab_size = extrasymtab ? - jbig2enc_datasize(&extrasymtab_ctx) : 0; - - if (ctx->full_headers) { - endseg.number = ctx->segnum; - ctx->segnum++; - endseg.type = segment_end_of_page; - endseg.page = ctx->pdf_page_numbering ? 1 : 1 + page_no; - } - - if (include_trailer) { - trailerseg.number = ctx->segnum; - ctx->segnum++; - trailerseg.type = segment_end_of_file; - trailerseg.page = 0; - } - - const int totalsize = seg.size() + sizeof(pageinfo) + - (extrasymtab ? (extrasymtab_size + symseg.size() + - sizeof(symtab)) : 0) + - segr.size() + - sizeof(textreg) + sizeof(textreg_syminsts) + - (ctx->refinement ? sizeof(textreg_atflags) : 0) + - textdatasize + - (ctx->full_headers ? endseg.size() : 0) + - (include_trailer ? trailerseg.size() : 0); - u8 *ret = (u8 *) malloc(totalsize); - int offset = 0; - - SEGMENT(seg); - F(pageinfo); - if (extrasymtab) { - SEGMENT(symseg); - F(symtab); - jbig2enc_tobuffer(&extrasymtab_ctx, ret + offset); - offset += extrasymtab_size; - } - SEGMENT(segr); - F(textreg); - if (ctx->refinement) { - F(textreg_atflags); - } - F(textreg_syminsts); - jbig2enc_tobuffer(&ectx, ret + offset); offset += textdatasize; - if (ctx->full_headers) { - SEGMENT(endseg); - } - if (include_trailer) { - SEGMENT(trailerseg); - } - - if (totalsize != offset) abort(); - - jbig2enc_dealloc(&ectx); - if (extrasymtab) jbig2enc_dealloc(&extrasymtab_ctx); - - *length = offset; - return ret; -} - -#undef F -#undef G - -// see comments in .h file -u8 * -jbig2_encode_generic(struct Pix *const bw, const bool full_headers, const int xres, - const int yres, const bool duplicate_line_removal, - int *const length) { - int segnum = 0; - - if (!bw) return NULL; - pixSetPadBits(bw, 0); - - struct jbig2_file_header header; - if (full_headers) { - memset(&header, 0, sizeof(header)); - header.n_pages = htonl(1); - header.organisation_type = 1; - memcpy(&header.id, JBIG2_FILE_MAGIC, 8); - } - - // setup compression - struct jbig2enc_ctx ctx; - jbig2enc_init(&ctx); - - Segment seg, seg2, endseg; - jbig2_page_info pageinfo; - memset(&pageinfo, 0, sizeof(pageinfo)); - jbig2_generic_region genreg; - memset(&genreg, 0, sizeof(genreg)); - - seg.number = segnum; - segnum++; - seg.type = segment_page_information; - seg.page = 1; - seg.len = sizeof(struct jbig2_page_info); - pageinfo.width = htonl(bw->w); - pageinfo.height = htonl(bw->h); - pageinfo.xres = htonl(xres ? xres : bw->xres); - pageinfo.yres = htonl(yres ? yres : bw->yres); - pageinfo.is_lossless = 1; - -#ifdef SURPRISE_MAP - dprintf(3, "P5\n%d %d 255\n", bw->w, bw->h); -#endif - - jbig2enc_bitimage(&ctx, (u8 *) bw->data, bw->w, bw->h, duplicate_line_removal); - jbig2enc_final(&ctx); - const int datasize = jbig2enc_datasize(&ctx); - - seg2.number = segnum; - segnum++; - seg2.type = segment_imm_generic_region; - seg2.page = 1; - seg2.len = sizeof(genreg) + datasize; - - endseg.number = segnum; - segnum++; - endseg.page = 1; - - genreg.width = htonl(bw->w); - genreg.height = htonl(bw->h); - if (duplicate_line_removal) { - genreg.tpgdon = true; - } - genreg.a1x = 3; - genreg.a1y = -1; - genreg.a2x = -3; - genreg.a2y = -1; - genreg.a3x = 2; - genreg.a3y = -2; - genreg.a4x = -2; - genreg.a4y = -2; - - const int totalsize = seg.size() + sizeof(pageinfo) + seg2.size() + - sizeof(genreg) + datasize + - (full_headers ? (sizeof(header) + 2*endseg.size()) : 0); - u8 *const ret = (u8 *) malloc(totalsize); - int offset = 0; - -#define F(x) memcpy(ret + offset, &x, sizeof(x)) ; offset += sizeof(x) - if (full_headers) { - F(header); - } - SEGMENT(seg); - F(pageinfo); - SEGMENT(seg2); - F(genreg); - jbig2enc_tobuffer(&ctx, ret + offset); - offset += datasize; - - if (full_headers) { - endseg.type = segment_end_of_page; - SEGMENT(endseg); - endseg.number += 1; - endseg.type = segment_end_of_file; - SEGMENT(endseg); - } - - if (totalsize != offset) abort(); - - jbig2enc_dealloc(&ctx); - - *length = offset; - - return ret; -} - diff --git a/pdfpatcher/JBig2/src/jbig2enc.lossless.cc b/pdfpatcher/JBig2/src/jbig2enc.lossless.cc deleted file mode 100644 index cf55373875b826212a137e5107968b0b42bd446b..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2enc.lossless.cc +++ /dev/null @@ -1,236 +0,0 @@ -// Copyright 2006 Google Inc. All Rights Reserved. -// Author: agl@imperialviolet.org (Adam Langley) -// -// Copyright (C) 2006 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include -#include - -#include - -#include -#if defined(sun) -#include -#else -#include -#endif - -#define u64 uint64_t -#define u32 uint32_t -#define u16 uint16_t -#define u8 uint8_t - -#include "jbig2arith.h" -#include "jbig2structs.h" -#include "jbig2segments.h" - -#define SEGMENT(x) x.write(ret + offset); offset += x.size(); - - -static const uint32_t rmask32[] = {0x0, - 0x00000001, 0x00000003, 0x00000007, 0x0000000f, - 0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff, - 0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff, - 0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff, - 0x0001ffff, 0x0003ffff, 0x0007ffff, 0x000fffff, - 0x001fffff, 0x003fffff, 0x007fffff, 0x00ffffff, - 0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff, - 0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff}; - -int32_t -pixSetPadBits(PIX *pix, - int32_t val) -{ -int32_t i, w, h, d, wpl, endbits, fullwords; -uint32_t mask; -uint32_t *data, *pword; - - w = pix->w; - h = pix->h; - d = 1; - - data = pix->data; - wpl = (w + 31) /32; - endbits = 32 - ((w * d) % 32); - if (endbits == 32) /* no partial word */ - return 0; - fullwords = w * d / 32; - - mask = rmask32[endbits]; - if (val == 0) - mask = ~mask; - - for (i = 0; i < h; i++) { - pword = data + i * wpl + fullwords; - if (val == 0) /* clear */ - *pword = *pword & mask; - else /* set */ - *pword = *pword | mask; - } - - return 0; -} - - -// see comments in .h file -u8 * -jbig2_encode_generic(struct Pix *const bw, const bool full_headers, const int xres, - const int yres, const bool duplicate_line_removal, - int *const length) { - int segnum = 0; - - if (!bw) return NULL; - pixSetPadBits(bw, 0); - - struct jbig2_file_header header; - if (full_headers) { - memset(&header, 0, sizeof(header)); - header.n_pages = htonl(1); - header.organisation_type = 1; - memcpy(&header.id, JBIG2_FILE_MAGIC, 8); - } - - // setup compression - struct jbig2enc_ctx ctx; - jbig2enc_init(&ctx); - - Segment seg, seg2, endseg; - jbig2_page_info pageinfo; - memset(&pageinfo, 0, sizeof(pageinfo)); - jbig2_generic_region genreg; - memset(&genreg, 0, sizeof(genreg)); - - seg.number = segnum; - segnum++; - seg.type = segment_page_information; - seg.page = 1; - seg.len = sizeof(struct jbig2_page_info); - pageinfo.width = htonl(bw->w); - pageinfo.height = htonl(bw->h); - pageinfo.xres = htonl(xres ? xres : bw->xres); - pageinfo.yres = htonl(yres ? yres : bw->yres); - pageinfo.is_lossless = 1; - -#ifdef SURPRISE_MAP - dprintf(3, "P5\n%d %d 255\n", bw->w, bw->h); -#endif - - jbig2enc_bitimage(&ctx, (u8 *) bw->data, bw->w, bw->h, duplicate_line_removal); - jbig2enc_final(&ctx); - const int datasize = jbig2enc_datasize(&ctx); - - seg2.number = segnum; - segnum++; - seg2.type = segment_imm_generic_region; - seg2.page = 1; - seg2.len = sizeof(genreg) + datasize; - - endseg.number = segnum; - segnum++; - endseg.page = 1; - - genreg.width = htonl(bw->w); - genreg.height = htonl(bw->h); - if (duplicate_line_removal) { - genreg.tpgdon = true; - } - genreg.a1x = 3; - genreg.a1y = -1; - genreg.a2x = -3; - genreg.a2y = -1; - genreg.a3x = 2; - genreg.a3y = -2; - genreg.a4x = -2; - genreg.a4y = -2; - - const int totalsize = seg.size() + sizeof(pageinfo) + seg2.size() + - sizeof(genreg) + datasize + - (full_headers ? (sizeof(header) + 2*endseg.size()) : 0); - u8 *const ret = (u8 *) malloc(totalsize); - int offset = 0; - -#define F(x) memcpy(ret + offset, &x, sizeof(x)) ; offset += sizeof(x) - if (full_headers) { - F(header); - } - SEGMENT(seg); - F(pageinfo); - SEGMENT(seg2); - F(genreg); - jbig2enc_tobuffer(&ctx, ret + offset); - offset += datasize; - - if (full_headers) { - endseg.type = segment_end_of_page; - SEGMENT(endseg); - endseg.number += 1; - endseg.type = segment_end_of_file; - SEGMENT(endseg); - } - - if (totalsize != offset) abort(); - - jbig2enc_dealloc(&ctx); - - *length = offset; - - return ret; -} - -// see comments in .h file -u8 * -jbig2_encode (int width, int height, int stride, bool zeroIsWhite, uint8_t * const source, int *const length) { - u8 * ret; - u32 mask = zeroIsWhite ? 0x0 : 0xffffffff; - u8* pl = source; - u8* p; - u32* pw; - char a, b; - for (int h = 0; h < height; h++) { - p = pl; - for (int w = 0; w < stride; w += 4) { - pw = (u32*)p; - *pw = *pw ^ mask; - a = *p; - *p = p[3]; - p++; - b = *p; - *p = p[1]; - p++; - *p = b; - p++; - *p = a; - p++; - } - pl += stride; - } - - Pix * pix = (Pix*)malloc(sizeof(Pix)); - pix->w = width; - pix->h = height; - pix->data = (u32*)source; - ret = jbig2_encode_generic (pix, false, 0, 0, false, length); - free(pix); - return ret; -} - -// see comments in .h file -void jbig2_freemem (uint8_t * const memblock) { - free (memblock); -}; diff --git a/pdfpatcher/JBig2/src/jbig2sym.cc b/pdfpatcher/JBig2/src/jbig2sym.cc deleted file mode 100644 index 86c12923eab6bb7f3aa9cb721fa3eedcd938e68d..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/jbig2sym.cc +++ /dev/null @@ -1,458 +0,0 @@ -// Copyright 2006 Google Inc. All Rights Reserved. -// Author: agl@imperialviolet.org (Adam Langley) -// -// Copyright (C) 2006 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include - -#include "jbig2arith.h" - -#ifdef _MSC_VER -#define restrict __restrict -#else -#define restrict __restrict__ -#endif - -#include - -#include -#include - -#include - -#define S(i) symbols->pix[i] - - -// ----------------------------------------------------------------------------- -// iota isn't part of the STL standard, and it can be a pain to include even on -// gcc based systems. Thus we define it here and save the issues -// ----------------------------------------------------------------------------- -template -void -myiota(_ForwardIterator __first, _ForwardIterator __last, _Tp __val) { - while (__first != __last) *__first++ = __val++; -} - -// ----------------------------------------------------------------------------- -// Sorts a vector of indexes into the symbols PIXA by height. This is needed -// because symbols are placed into the JBIG2 table in height order -// ----------------------------------------------------------------------------- -class HeightSorter { // concept: stl/StrictWeakOrdering - public: - HeightSorter(const PIXA *isymbols) - : symbols(isymbols) {} - - bool operator() (int x, int y) { - return S(x)->h < S(y)->h; - } - - private: - const PIXA *const symbols; -}; - -// ----------------------------------------------------------------------------- -// Sorts a vector of indexes into the symbols PIXA by width. This is needed -// because symbols are placed into the JBIG2 table in width order (for a given -// height class) -// ----------------------------------------------------------------------------- -class WidthSorter { // concept: stl/StrictWeakOrdering - public: - WidthSorter(const PIXA *isymbols) - : symbols(isymbols) {} - - bool operator() (int x, int y) { - return S(x)->w < S(y)->w; - } - - private: - const PIXA *const symbols; -}; - -static const int kBorderSize = 6; - -// see comment in .h file -void -jbig2enc_symboltable(struct jbig2enc_ctx *restrict ctx, - PIXA *restrict const symbols, - std::vector *__restrict__ symbol_list, - std::map *symmap, const bool unborder_symbols) { - const unsigned n = symbol_list->size(); - int number = 0; - -#ifdef JBIG2_DEBUGGING - fprintf(stderr, " symbols: %d\n", n); -#endif - - // this is a vector of indexes into symbols - std::vector syms(*symbol_list); - // now sort that vector by height - std::sort(syms.begin(), syms.end(), HeightSorter(symbols)); - - // this is used for each height class to sort into increasing width - WidthSorter sorter(symbols); - - // this stores the indexes of the symbols for a given height class - std::vector hc; - // this keeps the value of the height of the current class - unsigned hcheight = 0; - for (unsigned i = 0; i < n;) { - // height is the height of this class of symbols - const unsigned height = S(syms[i])->h - (unborder_symbols ? 2*kBorderSize : 0); -#ifdef JBIG2_DEBUGGING - fprintf(stderr, "height is %d\n", height); -#endif - unsigned j; - hc.clear(); - hc.push_back(syms[i]); // this is the first member of the new class - // walk the vector until we find a symbol with a different height - for (j = i + 1; j < n; ++j) { - if (S(syms[j])->h - (unborder_symbols ? 2*kBorderSize : 0) != height) break; - hc.push_back(syms[j]); // add each symbol of the same height to the class - } -#ifdef JBIG2_DEBUGGING - fprintf(stderr, " hc (height: %d, members: %d)\n", height, hc.size()); -#endif - // all the symbols from i to j-1 are a height class - // now sort them into increasing width - sort(hc.begin(), hc.end(), sorter); - // encode the delta height - const int deltaheight = height - hcheight; - jbig2enc_int(ctx, JBIG2_IADH, deltaheight); - hcheight = height; - int symwidth = 0; - // encode each symbol - for (std::vector::const_iterator k = hc.begin(); k != hc.end(); ++k) { - const int sym = *k; - const int thissymwidth = S(sym)->w - (unborder_symbols ? 2*kBorderSize : 0); - const int deltawidth = thissymwidth - symwidth; -#ifdef JBIG2_DEBUGGING - fprintf(stderr, " h: %d\n", S(sym)->w); -#endif - symwidth += deltawidth; - //fprintf(stderr, "width is %d\n", S(sym)->w); - jbig2enc_int(ctx, JBIG2_IADW, deltawidth); - - PIX *unbordered; - if (unborder_symbols) { - // the exemplars are stored with a border - unbordered = pixRemoveBorder(S(sym), kBorderSize); - // encoding the bitmap requires that the pad bits be zero - } else { - unbordered = pixClone(S(sym)); - } - pixSetPadBits(unbordered, 0); - jbig2enc_bitimage(ctx, (uint8_t *) unbordered->data, thissymwidth, height, - false); - // add this symbol to the map - (*symmap)[sym] = number++; - pixDestroy(&unbordered); - } - // OOB marks the end of the height class - //fprintf(stderr, "OOB\n"); - jbig2enc_oob(ctx, JBIG2_IADW); - i = j; - } - - // now we have the list of exported symbols (which is all of them) - // it's run length encoded and we have a run length of 0 (for all the symbols - // which aren't set) followed by a run length of the number of symbols - - jbig2enc_int(ctx, JBIG2_IAEX, 0); - jbig2enc_int(ctx, JBIG2_IAEX, n); - - jbig2enc_final(ctx); -} - -// sort by the bottom-left corner of the box -class YSorter { // concept: stl/StrictWeakOrdering - public: - YSorter(const PTA *ill) - : ll(ill) {} - - bool operator() (int x, int y) { - return ll->y[x] < ll->y[y]; - } - - private: - const PTA *const ll; -}; - -// sort by the bottom-left corner of the box -class XSorter { // concept: stl/StrictWeakOrdering - public: - XSorter(const PTA *ill) - : ll(ill) {} - - bool operator() (int x, int y) { - return ll->x[x] < ll->x[y]; - } - - private: - const PTA *const ll; -}; - -#if (__GNUC__ <= 2) || defined(sun) -#define lrint(x) static_cast(x) -#endif - -#define BY(x) (lrint(ll->y[x])) - -// see comment in .h file -void -jbig2enc_textregion(struct jbig2enc_ctx *restrict ctx, - /*const*/ std::map &symmap, - /*const*/ std::map &symmap2, - const std::vector &comps, - PTA *const in_ll, - PIXA *const symbols, - NUMA *assignments, int stripwidth, int symbits, - PIXA *const source, BOXA *boxes, int baseindex, - int refine_level, bool unborder_symbols) { - // these are the only valid values for stripwidth - if (stripwidth != 1 && stripwidth != 2 && stripwidth != 4 && - stripwidth != 8) { - abort(); - } - - PTA *ll; - - // In the case of refinement, we have to put the symbols where the original - // boxes were. So we make up an array of lower-left (ll) points from the - // boxes. Otherwise we take the points from the in_ll array we were given. - // However, the in_ll array is absolutely indexed and the boxes array is - // relative to this page so watch out below. - if (source) { - ll = ptaCreate(0); - for (int i = 0; i < boxes->n; ++i) { - ptaAddPt(ll, boxes->box[i]->x, - boxes->box[i]->y + boxes->box[i]->h - 1); - } - } else { - // if we aren't doing refinement - we just put the symbols where they - // matched best - ll = in_ll; - } - - const int n = comps.size(); - - // sort each box by distance from the top of the page - // syms (a copy of comps) is a list of indexes into symmap and ll - // elements which are indexes into symmap and ll are labeled I - // indexes into the syms array are labeled II - std::vector syms(n); - if (source) { - // refining: fill syms with the numbers 0..n because ll is relative to this - // page in this case - myiota(syms.begin(), syms.end(), 0); - } else { - // fill syms with the component numbers from the comps array because ll is - // absolutly indexed in this case (absolute: over the whole multi-page - // document) - syms = comps; - } - // sort into height order - sort(syms.begin(), syms.end(), YSorter(ll)); - - XSorter sorter(ll); - - int stript = 0; - int firsts = 0; - int wibble = 0; - // this is the initial stript value. I don't see why encoding this as zero, - // then encoding the first stript value as the real start is any worst than - // encoding this value correctly and then having a 0 value for the first - // deltat - jbig2enc_int(ctx, JBIG2_IADT, 0); - - // for each symbol we group it into a strip, which is stripwidth px high - // for each strip we sort into left-right order - std::vector strip; // elements of strip: I - for (int i = 0; i < n;) { // i: II - const int height = (BY(syms[i]) / stripwidth) * stripwidth; - int j; - strip.clear(); - strip.push_back(syms[i]); - - // now walk until we hit the first symbol which isn't in this strip - for (j = i + 1; j < n; ++j) { // j: II - if (BY(syms[j]) < height) abort(); - if (BY(syms[j]) >= height + stripwidth) { - // outside strip - break; - } - strip.push_back(syms[j]); - } - - // now sort the strip into left-right order - sort(strip.begin(), strip.end(), sorter); - const int deltat = height - stript; -#ifdef SYM_DEBUGGING - fprintf(stderr, "deltat is %d\n", deltat); -#endif - jbig2enc_int(ctx, JBIG2_IADT, deltat / stripwidth); - stript = height; -#ifdef SYM_DEBUGGING - fprintf(stderr, "t now: %d\n", stript); -#endif - - bool firstsymbol = true; - int curs = 0; - // k: iterator(I) - for (std::vector::const_iterator k = strip.begin(); k != strip.end(); ++k) { - const int sym = *k; // sym: I - if (firstsymbol) { - firstsymbol = false; - const int deltafs = lrint(ll->x[sym]) - firsts; - jbig2enc_int(ctx, JBIG2_IAFS, deltafs); - firsts += deltafs; - curs = firsts; - } else { - const int deltas = lrint(ll->x[sym]) - curs; - jbig2enc_int(ctx, JBIG2_IADS, deltas); - curs += deltas; - } - - // if stripwidth is 1, all the t values must be the same so they aren't - // even encoded - if (stripwidth > 1) { - const int deltat = BY(sym) - stript; - jbig2enc_int(ctx, JBIG2_IAIT, deltat); - } - - // The assignments array is absolutely indexed, but in the case that we - // are doing refinement (source != NULL) then the symbol number is - // relative to this page, so we have to add the baseindex to get an - // absolute index. - const int assigned = (int)assignments->array - [sym + (source ? baseindex : 0)]; - - // the symmap maps the number of the symbol from the classifier to the - // order in while it was written in the symbol dict - - // We have two symbol dictionaries. A global one and a per-page one. - int symid; - std::map::const_iterator symit = symmap.find(assigned); - if (symit != symmap.end()) { - symid = symit->second; - } else { - symit = symmap2.find(assigned); - if (symit != symmap2.end()) { - symid = symit->second + symmap.size(); - } else { - for (symit = symmap.begin(); symit != symmap.end(); ++symit) { - fprintf(stderr, "%d ", symit->first); - } - for (symit = symmap2.begin(); symit != symmap2.end(); ++symit) { - fprintf(stderr, "%d ", symit->first); - } - fprintf(stderr, "\n%d\n", assigned); - abort(); - } - } -#ifdef SYM_DEBUGGING - fprintf(stderr, "sym: %d\n", symid); -#endif - jbig2enc_iaid(ctx, symbits, symid); - - // refinement is enabled if the original source components are given - if (source) { - // the boxes array is indexed by the number of the symbol on this page. - // So we subtract the number of the first symbol to get this relative - // number. - const int abssym = baseindex + sym; - - PIX *symbol; - if (unborder_symbols) { - // the symbol has a 6 px border around it, which we need to remove - symbol = pixRemoveBorder(S(assigned), kBorderSize); - } else { - symbol = pixClone(S(assigned)); - } - pixSetPadBits(symbol, 0); - - const int targetw = boxes->box[sym]->w; - const int targeth = boxes->box[sym]->h; - const int targetx = boxes->box[sym]->x; - const int targety = boxes->box[sym]->y; - - const int symboly = (int) (in_ll->y[abssym] - symbol->h) + 1; - const int symbolx = (int) in_ll->x[abssym]; - - const int deltaw = targetw - symbol->w; - const int deltah = targeth - symbol->h; - const int deltax = targetx - symbolx; - const int deltay = targety - symboly; - - pixSetPadBits(source->pix[sym], 0); - // now see how well the symbol matches - PIX *targetcopy = pixCopy(NULL, source->pix[sym]); - pixRasterop(targetcopy, deltax, deltay, symbol->w, symbol->h, - PIX_SRC ^ PIX_DST, - symbol, 0, 0); - int deltacount; - pixCountPixels(targetcopy, &deltacount, NULL); -#ifdef SYMBOL_COMPRESSION_DEBUGGING - fprintf(stderr, "delta count: %d\n", deltacount); -#endif - pixDestroy(&targetcopy); - -#ifdef SYMBOL_COMPRESSION_DEBUGGING - fprintf(stderr, "refinement: dw:%d dh:%d dx:%d dy:%d w:%d h:%d\n", - deltaw, deltah, deltax, deltay, targetw, targeth); - fprintf(stderr, " box: %d %d symbol: %d %d h:%d ll:%f %f\n", - targetx, targety, symbolx, symboly, symbol->h, - in_ll->x[abssym], in_ll->y[abssym]); -#endif - - // Note that the refinement encoding function can only cope with x - // offsets in [-1, 0, 1] so refinement is disabled if the offset is - // outside this range. This should be *very* rare. - if (deltacount <= refine_level || deltax < -1 || deltax > 1) { - //if (deltaw > 1 || deltaw < -1 || deltax || deltah || deltay) { - // refinement disabled. - jbig2enc_int(ctx, JBIG2_IARI, 0); - // update curs given the width of the bitmap - curs += (S(assigned)->w - (unborder_symbols ? 2*kBorderSize : 0)) - 1; - } else { - wibble++; - jbig2enc_int(ctx, JBIG2_IARI, 1); - - jbig2enc_int(ctx, JBIG2_IARDW, deltaw); - jbig2enc_int(ctx, JBIG2_IARDH, deltah); - jbig2enc_int(ctx, JBIG2_IARDX, deltax - (deltaw >> 1)); - jbig2enc_int(ctx, JBIG2_IARDY, deltay - (deltah >> 1)); - - jbig2enc_refine - (ctx, (uint8_t *) symbol->data, symbol->w, symbol->h, - (uint8_t *) source->pix[sym]->data, targetw, targeth, - deltax, -deltay); - - pixDestroy(&symbol); - curs += targetw - 1; - } - } else { - // update curs given the width of the bitmap - curs += (S(assigned)->w - (unborder_symbols ? 2*kBorderSize : 0)) - 1; - } - } - // terminate the strip - jbig2enc_oob(ctx, JBIG2_IADS); - i = j; - } - - jbig2enc_final(ctx); - if (ll != in_ll) ptaDestroy(&ll); -} diff --git a/pdfpatcher/JBig2/src/memcmp.c b/pdfpatcher/JBig2/src/memcmp.c deleted file mode 100644 index 9da72dbf45a12173403904224745e94bce770093..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/memcmp.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -/* replacement for broken memcmp() */ - -/* - * compares two byte strings 'a' and 'b', both assumed to be 'len' bytes long - * returns zero if the two strings are identical, otherwise returns -1 or 1 - * depending on the relative magnitude of the first differing elements, - * considered as unsigned chars - */ - -int -memcmp(const void *b1, const void *b2, size_t len) -{ - unsigned char *a, *b; - size_t i; - - a = (unsigned char *)b1; - b = (unsigned char *)b2; - for (i = 0; i < len; i++) { - if (*a != *b) { - /* strings differ */ - return (*a < *b) ? -1 : 1; - } - a++; - b++; - } - - /* strings match */ - return 0; -} diff --git a/pdfpatcher/JBig2/src/memento.c b/pdfpatcher/JBig2/src/memento.c deleted file mode 100644 index 46e6602ab2b5bda24f73c806a0b07c015085e476..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/memento.c +++ /dev/null @@ -1,3129 +0,0 @@ -/* Copyright (C) 2009-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, modified - or distributed except as expressly authorized under the terms of that - license. Refer to licensing information at http://www.artifex.com - or contact Artifex Software, Inc., 1305 Grant Avenue - Suite 200, - Novato, CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* Inspired by Fortify by Simon P Bullen. */ - -/* Set the following if you're only looking for leaks, not memory overwrites - * to speed the operation */ -/* #define MEMENTO_LEAKONLY */ - -/* Set the following to keep extra details about the history of blocks */ -#define MEMENTO_DETAILS - -/* Don't keep blocks around if they'd mean losing more than a quarter of - * the freelist. */ -#define MEMENTO_FREELIST_MAX_SINGLE_BLOCK (MEMENTO_FREELIST_MAX/4) - -#define COMPILING_MEMENTO_C - -/* SHUT UP, MSVC. I KNOW WHAT I AM DOING. */ -#define _CRT_SECURE_NO_WARNINGS - -/* We have some GS specific tweaks; more for the GS build environment than - * anything else. */ -/* #define MEMENTO_GS_HACKS */ - -#ifdef MEMENTO_GS_HACKS -/* For GS we include malloc_.h. Anyone else would just include memento.h */ -#include "malloc_.h" -#include "memory_.h" -int atexit(void (*)(void)); -#else -#include "memento.h" -#include -#endif -#ifndef _MSC_VER -#include -#include -#include -#endif - -#include -#include -#include - -#ifdef __ANDROID__ -#define MEMENTO_ANDROID -#include -#endif - -/* Hacks to portably print large sizes */ -#ifdef _MSC_VER -#define FMTZ "%llu" -#define FMTZ_CAST _int64 -#define FMTP "0x%p" -#else -#define FMTZ "%zu" -#define FMTZ_CAST size_t -#define FMTP "%p" -#endif - -#define UB(x) ((intptr_t)((x) & 0xFF)) -#define B2I(x) (UB(x) | (UB(x)<<8) | (UB(x)<<16) | (UB(x)<<24)) -#define B2P(x) ((void *)(B2I(x) | ((B2I(x)<<16)<<16))) -#define MEMENTO_PREFILL_UBYTE ((unsigned char)(MEMENTO_PREFILL)) -#define MEMENTO_PREFILL_USHORT (((unsigned short)MEMENTO_PREFILL_UBYTE) | (((unsigned short)MEMENTO_PREFILL_UBYTE)<<8)) -#define MEMENTO_PREFILL_UINT (((unsigned int)MEMENTO_PREFILL_USHORT) | (((unsigned int)MEMENTO_PREFILL_USHORT)<<16)) -#define MEMENTO_PREFILL_PTR (void *)(((uintptr_t)MEMENTO_PREFILL_UINT) | ((((uintptr_t)MEMENTO_PREFILL_UINT)<<16)<<16)) -#define MEMENTO_POSTFILL_UBYTE ((unsigned char)(MEMENTO_POSTFILL)) -#define MEMENTO_POSTFILL_USHORT (((unsigned short)MEMENTO_POSTFILL_UBYTE) | (((unsigned short)MEMENTO_POSTFILL_UBYTE)<<8)) -#define MEMENTO_POSTFILL_UINT (((unsigned int)MEMENTO_POSTFILL_USHORT) | (((unsigned int)MEMENTO_POSTFILL_USHORT)<<16)) -#define MEMENTO_POSTFILL_PTR (void *)(((uintptr_t)MEMENTO_POSTFILL_UINT) | ((((uintptr_t)MEMENTO_POSTFILL_UINT)<<16)<<16)) -#define MEMENTO_ALLOCFILL_UBYTE ((unsigned char)(MEMENTO_ALLOCFILL)) -#define MEMENTO_ALLOCFILL_USHORT (((unsigned short)MEMENTO_ALLOCFILL_UBYTE) | (((unsigned short)MEMENTO_ALLOCFILL_UBYTE)<<8)) -#define MEMENTO_ALLOCFILL_UINT (((unsigned int)MEMENTO_ALLOCFILL_USHORT) | (((unsigned int)MEMENTO_ALLOCFILL_USHORT)<<16)) -#define MEMENTO_ALLOCFILL_PTR (void *)(((uintptr_t)MEMENTO_ALLOCFILL_UINT) | ((((uintptr_t)MEMENTO_ALLOCFILL_UINT)<<16)<<16)) -#define MEMENTO_FREEFILL_UBYTE ((unsigned char)(MEMENTO_FREEFILL)) -#define MEMENTO_FREEFILL_USHORT (((unsigned short)MEMENTO_FREEFILL_UBYTE) | (((unsigned short)MEMENTO_FREEFILL_UBYTE)<<8)) -#define MEMENTO_FREEFILL_UINT (((unsigned int)MEMENTO_FREEFILL_USHORT) | (((unsigned int)MEMENTO_FREEFILL_USHORT)<<16)) -#define MEMENTO_FREEFILL_PTR (void *)(((uintptr_t)MEMENTO_FREEFILL_UINT) | ((((uintptr_t)MEMENTO_FREEFILL_UINT)<<16)<<16)) - -#ifdef MEMENTO - -#ifndef MEMENTO_CPP_EXTRAS_ONLY - -#ifdef MEMENTO_ANDROID -#include - -static char log_buffer[4096]; -static int log_fill = 0; - -static char log_buffer2[4096]; - -static int -android_fprintf(FILE *file, const char *fmt, ...) -{ - va_list args; - char *p, *q; - - va_start(args, fmt); - vsnprintf(log_buffer2, sizeof(log_buffer2)-1, fmt, args); - va_end(args); - - /* Ensure we are always null terminated */ - log_buffer2[sizeof(log_buffer2)-1] = 0; - - p = log_buffer2; - q = p; - do - { - /* Find the end of the string, or the next \n */ - while (*p && *p != '\n') - p++; - - /* We need to output from q to p. Limit ourselves to what - * will fit in the existing */ - if (p - q >= sizeof(log_buffer)-1 - log_fill) - p = q + sizeof(log_buffer)-1 - log_fill; - - memcpy(&log_buffer[log_fill], q, p-q); - log_fill += p-q; - if (*p == '\n') - { - log_buffer[log_fill] = 0; - __android_log_print(ANDROID_LOG_ERROR, "memento", "%s", log_buffer); - usleep(1); - log_fill = 0; - p++; /* Skip over the \n */ - } - else if (log_fill >= sizeof(log_buffer)-1) - { - log_buffer[sizeof(log_buffer2)-1] = 0; - __android_log_print(ANDROID_LOG_ERROR, "memento", "%s", log_buffer); - usleep(1); - log_fill = 0; - } - q = p; - } - while (*p); - - return 0; -} - -#define fprintf android_fprintf -#define MEMENTO_STACKTRACE_METHOD 3 -#endif - -/* _WIN64 defined implies _WIN32 will be */ -#ifdef _WIN32 -#include - -static int -windows_fprintf(FILE *file, const char *fmt, ...) -{ - va_list args; - char text[4096]; - int ret; - - va_start(args, fmt); - ret = vfprintf(file, fmt, args); - va_end(args); - - va_start(args, fmt); - vsnprintf(text, 4096, fmt, args); - OutputDebugStringA(text); - va_end(args); - - return ret; -} - -#define fprintf windows_fprintf -#endif - -#ifndef MEMENTO_STACKTRACE_METHOD -#ifdef __GNUC__ -#define MEMENTO_STACKTRACE_METHOD 1 -#endif -#ifdef _WIN32 -#define MEMENTO_STACKTRACE_METHOD 2 -#endif -#endif - -#if defined(__linux__) -#define MEMENTO_HAS_FORK -#elif defined(__APPLE__) && defined(__MACH__) -#define MEMENTO_HAS_FORK -#endif - -/* Define the underlying allocators, just in case */ -void *MEMENTO_UNDERLYING_MALLOC(size_t); -void MEMENTO_UNDERLYING_FREE(void *); -void *MEMENTO_UNDERLYING_REALLOC(void *,size_t); -void *MEMENTO_UNDERLYING_CALLOC(size_t,size_t); - -/* And some other standard functions we use. We don't include the header - * files, just in case they pull in unexpected others. */ -int atoi(const char *); -char *getenv(const char *); - -/* How far to search for pointers in each block when calculating nestings */ -/* mupdf needs at least 34000ish (sizeof(fz_shade))/ */ -#define MEMENTO_PTRSEARCH 65536 - -#ifndef MEMENTO_MAXPATTERN -#define MEMENTO_MAXPATTERN 0 -#endif - -#ifdef MEMENTO_GS_HACKS -#include "valgrind.h" -#else -#ifdef HAVE_VALGRIND -#include "valgrind/memcheck.h" -#else -#define VALGRIND_MAKE_MEM_NOACCESS(p,s) do { } while (0==1) -#define VALGRIND_MAKE_MEM_UNDEFINED(p,s) do { } while (0==1) -#define VALGRIND_MAKE_MEM_DEFINED(p,s) do { } while (0==1) -#endif -#endif - -enum { - Memento_PreSize = 16, - Memento_PostSize = 16 -}; - -/* Some compile time checks */ -typedef struct -{ - char MEMENTO_PRESIZE_MUST_BE_A_MULTIPLE_OF_4[Memento_PreSize & 3 ? -1 : 1]; - char MEMENTO_POSTSIZE_MUST_BE_A_MULTIPLE_OF_4[Memento_PostSize & 3 ? -1 : 1]; - char MEMENTO_POSTSIZE_MUST_BE_AT_LEAST_4[Memento_PostSize >= 4 ? 1 : -1]; - char MEMENTO_PRESIZE_MUST_BE_AT_LEAST_4[Memento_PreSize >= 4 ? 1 : -1]; -} MEMENTO_SANITY_CHECK_STRUCT; - -#define MEMENTO_UINT32 unsigned int -#define MEMENTO_UINT16 unsigned short - -#define MEMENTO_PREFILL_UINT32 ((MEMENTO_UINT32)(MEMENTO_PREFILL | (MEMENTO_PREFILL <<8) | (MEMENTO_PREFILL <<16) |(MEMENTO_PREFILL <<24))) -#define MEMENTO_POSTFILL_UINT16 ((MEMENTO_UINT16)(MEMENTO_POSTFILL | (MEMENTO_POSTFILL<<8))) -#define MEMENTO_POSTFILL_UINT32 ((MEMENTO_UINT32)(MEMENTO_POSTFILL | (MEMENTO_POSTFILL<<8) | (MEMENTO_POSTFILL<<16) |(MEMENTO_POSTFILL<<24))) -#define MEMENTO_FREEFILL_UINT16 ((MEMENTO_UINT16)(MEMENTO_FREEFILL | (MEMENTO_FREEFILL<<8))) -#define MEMENTO_FREEFILL_UINT32 ((MEMENTO_UINT32)(MEMENTO_FREEFILL | (MEMENTO_FREEFILL<<8) | (MEMENTO_FREEFILL<<16) |(MEMENTO_FREEFILL<<24))) - -enum { - Memento_Flag_OldBlock = 1, - Memento_Flag_HasParent = 2, - Memento_Flag_BreakOnFree = 4, - Memento_Flag_BreakOnRealloc = 8, - Memento_Flag_Freed = 16, - Memento_Flag_KnownLeak = 32, - Memento_Flag_Reported = 64 -}; - -enum { - Memento_EventType_malloc = 0, - Memento_EventType_calloc = 1, - Memento_EventType_realloc = 2, - Memento_EventType_free = 3, - Memento_EventType_new = 4, - Memento_EventType_delete = 5, - Memento_EventType_newArray = 6, - Memento_EventType_deleteArray = 7, - Memento_EventType_takeRef = 8, - Memento_EventType_dropRef = 9, - Memento_EventType_reference = 10 -}; - -static const char *eventType[] = -{ - "malloc", - "calloc", - "realloc", - "free", - "new", - "delete", - "new[]", - "delete[]", - "takeRef", - "dropRef", - "reference" -}; - -/* When we list leaked blocks at the end of execution, we search for pointers - * between blocks in order to be able to give a nice nested view. - * Unfortunately, if you have are running your own allocator (such as - * postscript's chunk allocator) you can often find that the header of the - * block always contains pointers to next or previous blocks. This tends to - * mean the nesting displayed is "uninteresting" at best :) - * - * As a hack to get around this, we have a define MEMENTO_SKIP_SEARCH that - * indicates how many bytes to skip over at the start of the chunk. - * This may cause us to miss true nestings, but such is life... - */ -#ifndef MEMENTO_SEARCH_SKIP -#ifdef MEMENTO_GS_HACKS -#define MEMENTO_SEARCH_SKIP (2*sizeof(void *)) -#else -#define MEMENTO_SEARCH_SKIP 0 -#endif -#endif - -#define MEMENTO_CHILD_MAGIC ((Memento_BlkHeader *)('M' | ('3' << 8) | ('m' << 16) | ('3' << 24))) -#define MEMENTO_SIBLING_MAGIC ((Memento_BlkHeader *)('n' | ('t' << 8) | ('0' << 16) | ('!' << 24))) - -#ifdef MEMENTO_DETAILS -typedef struct Memento_BlkDetails Memento_BlkDetails; - -struct Memento_BlkDetails -{ - Memento_BlkDetails *next; - char type; - char count; - int sequence; - void *stack[1]; -}; -#endif /* MEMENTO_DETAILS */ - -typedef struct Memento_BlkHeader Memento_BlkHeader; - -struct Memento_BlkHeader -{ - size_t rawsize; - int sequence; - int lastCheckedOK; - int flags; - Memento_BlkHeader *next; - Memento_BlkHeader *prev; /* Reused as 'parent' when printing nested list */ - - const char *label; - - /* Entries for nesting display calculations. Set to magic - * values at all other time. */ - Memento_BlkHeader *child; - Memento_BlkHeader *sibling; - -#ifdef MEMENTO_DETAILS - Memento_BlkDetails *details; - Memento_BlkDetails **details_tail; -#endif - - char preblk[Memento_PreSize]; -}; - -/* In future this could (should) be a smarter data structure, like, say, - * splay trees. For now, we use a list. - */ -typedef struct Memento_Blocks -{ - Memento_BlkHeader *head; - Memento_BlkHeader *tail; -} Memento_Blocks; - -/* What sort of Mutex should we use? */ -#ifdef MEMENTO_LOCKLESS -typedef int Memento_mutex; - -static void Memento_initMutex(Memento_mutex *m) -{ - (void)m; -} - -#define MEMENTO_DO_LOCK() do { } while (0) -#define MEMENTO_DO_UNLOCK() do { } while (0) - -#else -#if defined(_WIN32) || defined(_WIN64) -/* Windows */ -typedef CRITICAL_SECTION Memento_mutex; - -static void Memento_initMutex(Memento_mutex *m) -{ - InitializeCriticalSection(m); -} - -#define MEMENTO_DO_LOCK() \ - EnterCriticalSection(&memento.mutex) -#define MEMENTO_DO_UNLOCK() \ - LeaveCriticalSection(&memento.mutex) - -#else -#include -typedef pthread_mutex_t Memento_mutex; - -static void Memento_initMutex(Memento_mutex *m) -{ - pthread_mutex_init(m, NULL); -} - -#define MEMENTO_DO_LOCK() \ - pthread_mutex_lock(&memento.mutex) -#define MEMENTO_DO_UNLOCK() \ - pthread_mutex_unlock(&memento.mutex) - -#endif -#endif - -/* And our global structure */ -static struct { - int inited; - Memento_Blocks used; - Memento_Blocks free; - size_t freeListSize; - int sequence; - int paranoia; - int paranoidAt; - int countdown; - int lastChecked; - int breakAt; - int failAt; - int failing; - int nextFailAt; - int squeezeAt; - int squeezing; - int segv; - int pattern; - int nextPattern; - int patternBit; - int leaking; - size_t maxMemory; - size_t alloc; - size_t peakAlloc; - size_t totalAlloc; - size_t numMallocs; - size_t numFrees; - size_t numReallocs; - Memento_mutex mutex; -} memento; - -#define MEMENTO_EXTRASIZE (sizeof(Memento_BlkHeader) + Memento_PostSize) - -/* Round up size S to the next multiple of N (where N is a power of 2) */ -#define MEMENTO_ROUNDUP(S,N) ((S + N-1)&~(N-1)) - -#define MEMBLK_SIZE(s) MEMENTO_ROUNDUP(s + MEMENTO_EXTRASIZE, MEMENTO_MAXALIGN) - -#define MEMBLK_FROMBLK(B) (&((Memento_BlkHeader*)(void *)(B))[-1]) -#define MEMBLK_TOBLK(B) ((void*)(&((Memento_BlkHeader*)(void*)(B))[1])) -#define MEMBLK_POSTPTR(B) \ - (&((unsigned char *)(void *)(B))[(B)->rawsize + sizeof(Memento_BlkHeader)]) - -enum -{ - SkipStackBackTraceLevels = 4 -}; - -#if defined(MEMENTO_STACKTRACE_METHOD) && MEMENTO_STACKTRACE_METHOD == 1 -extern size_t backtrace(void **, int); -extern void backtrace_symbols_fd(void **, size_t, int); -extern char **backtrace_symbols(void **, size_t); - -#define MEMENTO_BACKTRACE_MAX 256 -static void (*print_stack_value)(void *address); - -/* Libbacktrace gubbins - relies on us having libdl to load the .so */ -#ifdef HAVE_LIBDL -#include - -typedef void (*backtrace_error_callback) (void *data, const char *msg, int errnum); - -typedef struct backtrace_state *(*backtrace_create_state_type)( - const char *filename, int threaded, - backtrace_error_callback error_callback, void *data); - -typedef int (*backtrace_full_callback) (void *data, uintptr_t pc, - const char *filename, int lineno, - const char *function); - -typedef int (*backtrace_pcinfo_type)(struct backtrace_state *state, - uintptr_t pc, - backtrace_full_callback callback, - backtrace_error_callback error_callback, - void *data); - -typedef void (*backtrace_syminfo_callback) (void *data, uintptr_t pc, - const char *symname, - uintptr_t symval, - uintptr_t symsize); - -typedef int (*backtrace_syminfo_type)(struct backtrace_state *state, - uintptr_t addr, - backtrace_syminfo_callback callback, - backtrace_error_callback error_callback, - void *data); - -static backtrace_syminfo_type backtrace_syminfo; -static backtrace_create_state_type backtrace_create_state; -static backtrace_pcinfo_type backtrace_pcinfo; -static struct backtrace_state *my_backtrace_state; -static void *libbt; -static char backtrace_exe[4096]; -static void *current_addr; - -static void error2_cb(void *data, const char *msg, int errnum) -{ -} - -static void syminfo_cb(void *data, uintptr_t pc, const char *symname, uintptr_t symval, uintptr_t symsize) -{ - if (sizeof(void *) == 4) - fprintf(stderr, " 0x%08lx %s\n", pc, symname?symname:"?"); - else - fprintf(stderr, " 0x%016lx %s\n", pc, symname?symname:"?"); -} - -static void error_cb(void *data, const char *msg, int errnum) -{ - backtrace_syminfo(my_backtrace_state, - (uintptr_t)current_addr, - syminfo_cb, - error2_cb, - NULL); -} - -static int full_cb(void *data, uintptr_t pc, const char *fname, int line, const char *fn) -{ - if (sizeof(void *) == 4) - fprintf(stderr, " 0x%08lx %s(%s:%d)\n", pc, fn?fn:"?", fname?fname:"?", line); - else - fprintf(stderr, " 0x%016lx %s(%s:%d)\n", pc, fn?fn:"?", fname?fname:"?", line); - return 0; -} - -static void print_stack_libbt(void *addr) -{ - current_addr = addr; - backtrace_pcinfo(my_backtrace_state, - (uintptr_t)addr, - full_cb, - error_cb, - NULL); -} - -static void print_stack_libbt_failed(void *addr) -{ - char **strings; -#if 0 - /* Let's use a hack from Julian Smith to call gdb to extract the information */ - /* Disabled for now, as I can't make this work. */ - static char command[1024]; - int e; - static int gdb_invocation_failed = 0; - - if (gdb_invocation_failed == 0) - { - snprintf(command, sizeof(command), - //"gdb -q --batch -p=%i -ex 'info line *%p' -ex quit 2>/dev/null", - "gdb -q --batch -p=%i -ex 'info line *%p' -ex quit 2>/dev/null| egrep -v '(Thread debugging using)|(Using host libthread_db library)|(A debugging session is active)|(will be detached)|(Quit anyway)|(No such file or directory)|(^0x)|(^$)'", - getpid(), addr); - printf("%s\n", command); - e = system(command); - if (e == 0) - return; /* That'll do! */ - gdb_invocation_failed = 1; /* If it's failed once, it'll probably keep failing. */ - } -#endif - - /* We couldn't even get gdb! Make do. */ - strings = backtrace_symbols(&addr, 1); - - if (strings == NULL || strings[0] == NULL) - { - if (sizeof(void *) == 4) - fprintf(stderr, " [0x%08lx]\n", (uintptr_t)addr); - else - fprintf(stderr, " [0x%016lx]\n", (uintptr_t)addr); - } - else - { - fprintf(stderr, " %s\n", strings[0]); - } - (free)(strings); -} - -static int init_libbt(void) -{ - static int libbt_inited = 0; - - if (libbt_inited) - return 0; - libbt_inited = 1; - - libbt = dlopen("libbacktrace.so", RTLD_LAZY); - if (libbt == NULL) - libbt = dlopen("/opt/lib/libbacktrace.so", RTLD_LAZY); - if (libbt == NULL) - libbt = dlopen("/lib/libbacktrace.so", RTLD_LAZY); - if (libbt == NULL) - libbt = dlopen("/usr/lib/libbacktrace.so", RTLD_LAZY); - if (libbt == NULL) - libbt = dlopen("/usr/local/lib/libbacktrace.so", RTLD_LAZY); - if (libbt == NULL) - goto fail; - - backtrace_create_state = dlsym(libbt, "backtrace_create_state"); - backtrace_syminfo = dlsym(libbt, "backtrace_syminfo"); - backtrace_pcinfo = dlsym(libbt, "backtrace_pcinfo"); - - if (backtrace_create_state == NULL || - backtrace_syminfo == NULL || - backtrace_pcinfo == NULL) - { - goto fail; - } - - my_backtrace_state = backtrace_create_state(backtrace_exe, - 1 /*BACKTRACE_SUPPORTS_THREADS*/, - error_cb, - NULL); - if (my_backtrace_state == NULL) - goto fail; - - print_stack_value = print_stack_libbt; - - return 1; - - fail: - fprintf(stderr, - "MEMENTO: libbacktrace.so failed to load; backtraces will be sparse.\n" - "MEMENTO: See memento.h for how to rectify this.\n"); - libbt = NULL; - backtrace_create_state = NULL; - backtrace_syminfo = NULL; - print_stack_value = print_stack_libbt_failed; - return 0; -} -#endif - -static void print_stack_default(void *addr) -{ - char **strings = backtrace_symbols(&addr, 1); - - if (strings == NULL || strings[0] == NULL) - { - fprintf(stderr, " ["FMTP"]\n", addr); - } -#ifdef HAVE_LIBDL - else if (strchr(strings[0], ':') == NULL) - { - /* Probably a "path [address]" format string */ - char *s = strchr(strings[0], ' '); - - if (s != strings[0]) - { - memcpy(backtrace_exe, strings[0], s - strings[0]); - backtrace_exe[s-strings[0]] = 0; - init_libbt(); - print_stack_value(addr); - } - } -#endif - else - { - fprintf(stderr, " %s\n", strings[0]); - } - free(strings); -} - -static void Memento_initStacktracer(void) -{ - print_stack_value = print_stack_default; -} - -static int Memento_getStacktrace(void **stack, int *skip) -{ - size_t num; - - num = backtrace(&stack[0], MEMENTO_BACKTRACE_MAX); - - *skip = SkipStackBackTraceLevels; - if (num <= SkipStackBackTraceLevels) - return 0; - return (int)(num-SkipStackBackTraceLevels); -} - -static void Memento_showStacktrace(void **stack, int numberOfFrames) -{ - int i; - - for (i = 0; i < numberOfFrames; i++) - { - print_stack_value(stack[i]); - } -} -#elif defined(MEMENTO_STACKTRACE_METHOD) && MEMENTO_STACKTRACE_METHOD == 2 -#include - -/* We use DbgHelp.dll rather than DbgHelp.lib. This avoids us needing - * extra link time complications, and enables us to fall back gracefully - * if the DLL cannot be found. - * - * To achieve this we have our own potted versions of the required types - * inline here. - */ -#ifdef _WIN64 -typedef DWORD64 DWORD_NATIVESIZED; -#else -typedef DWORD DWORD_NATIVESIZED; -#endif - -#define MEMENTO_BACKTRACE_MAX 64 - -typedef USHORT (__stdcall *My_CaptureStackBackTraceType)(__in ULONG, __in ULONG, __out PVOID*, __out_opt PULONG); - -typedef struct MY_IMAGEHLP_LINE { - DWORD SizeOfStruct; - PVOID Key; - DWORD LineNumber; - PCHAR FileName; - DWORD_NATIVESIZED Address; -} MY_IMAGEHLP_LINE, *MY_PIMAGEHLP_LINE; - -typedef BOOL (__stdcall *My_SymGetLineFromAddrType)(HANDLE hProcess, DWORD_NATIVESIZED dwAddr, PDWORD pdwDisplacement, MY_PIMAGEHLP_LINE Line); - -typedef struct MY_SYMBOL_INFO { - ULONG SizeOfStruct; - ULONG TypeIndex; // Type Index of symbol - ULONG64 Reserved[2]; - ULONG info; - ULONG Size; - ULONG64 ModBase; // Base Address of module containing this symbol - ULONG Flags; - ULONG64 Value; // Value of symbol, ValuePresent should be 1 - ULONG64 Address; // Address of symbol including base address of module - ULONG Register; // register holding value or pointer to value - ULONG Scope; // scope of the symbol - ULONG Tag; // pdb classification - ULONG NameLen; // Actual length of name - ULONG MaxNameLen; - CHAR Name[1]; // Name of symbol -} MY_SYMBOL_INFO, *MY_PSYMBOL_INFO; - -typedef BOOL (__stdcall *My_SymFromAddrType)(HANDLE hProcess, DWORD64 Address, PDWORD64 Displacement, MY_PSYMBOL_INFO Symbol); -typedef BOOL (__stdcall *My_SymInitializeType)(HANDLE hProcess, PSTR UserSearchPath, BOOL fInvadeProcess); - -static My_CaptureStackBackTraceType Memento_CaptureStackBackTrace; -static My_SymGetLineFromAddrType Memento_SymGetLineFromAddr; -static My_SymFromAddrType Memento_SymFromAddr; -static My_SymInitializeType Memento_SymInitialize; -static HANDLE Memento_process; - -static void Memento_initStacktracer(void) -{ - HMODULE mod = LoadLibrary("kernel32.dll"); - - if (mod == NULL) - return; - Memento_CaptureStackBackTrace = (My_CaptureStackBackTraceType)(GetProcAddress(mod, "RtlCaptureStackBackTrace")); - if (Memento_CaptureStackBackTrace == NULL) - return; - mod = LoadLibrary("Dbghelp.dll"); - if (mod == NULL) { - Memento_CaptureStackBackTrace = NULL; - return; - } - Memento_SymGetLineFromAddr = - (My_SymGetLineFromAddrType)(GetProcAddress(mod, -#ifdef _WIN64 - "SymGetLineFromAddr64" -#else - "SymGetLineFromAddr" -#endif - )); - if (Memento_SymGetLineFromAddr == NULL) { - Memento_CaptureStackBackTrace = NULL; - return; - } - Memento_SymFromAddr = (My_SymFromAddrType)(GetProcAddress(mod, "SymFromAddr")); - if (Memento_SymFromAddr == NULL) { - Memento_CaptureStackBackTrace = NULL; - return; - } - Memento_SymInitialize = (My_SymInitializeType)(GetProcAddress(mod, "SymInitialize")); - if (Memento_SymInitialize == NULL) { - Memento_CaptureStackBackTrace = NULL; - return; - } - Memento_process = GetCurrentProcess(); - Memento_SymInitialize(Memento_process, NULL, TRUE); -} - -static int Memento_getStacktrace(void **stack, int *skip) -{ - if (Memento_CaptureStackBackTrace == NULL) - return 0; - - *skip = 0; - /* Limit us to 63 levels due to windows bug */ - return Memento_CaptureStackBackTrace(SkipStackBackTraceLevels, 63-SkipStackBackTraceLevels, stack, NULL); -} - -static void Memento_showStacktrace(void **stack, int numberOfFrames) -{ - MY_IMAGEHLP_LINE line; - int i; - char symbol_buffer[sizeof(MY_SYMBOL_INFO) + 1024 + 1]; - MY_SYMBOL_INFO *symbol = (MY_SYMBOL_INFO *)symbol_buffer; - - symbol->MaxNameLen = 1024; - symbol->SizeOfStruct = sizeof(MY_SYMBOL_INFO); - line.SizeOfStruct = sizeof(MY_IMAGEHLP_LINE); - for (i = 0; i < numberOfFrames; i++) - { - DWORD64 dwDisplacement64; - DWORD dwDisplacement; - Memento_SymFromAddr(Memento_process, (DWORD64)(stack[i]), &dwDisplacement64, symbol); - Memento_SymGetLineFromAddr(Memento_process, (DWORD_NATIVESIZED)(stack[i]), &dwDisplacement, &line); - fprintf(stderr, " %s in %s:%d\n", symbol->Name, line.FileName, line.LineNumber); - } -} -#elif defined(MEMENTO_STACKTRACE_METHOD) && MEMENTO_STACKTRACE_METHOD == 3 - -#include -#include - -/* From cxxabi.h */ -extern char* __cxa_demangle(const char* mangled_name, - char* output_buffer, - size_t* length, - int* status); - -static void Memento_initStacktracer(void) -{ -} - -#define MEMENTO_BACKTRACE_MAX 256 - -typedef struct -{ - int count; - void **addr; -} my_unwind_details; - -static _Unwind_Reason_Code unwind_populate_callback(struct _Unwind_Context *context, - void *arg) -{ - my_unwind_details *uw = (my_unwind_details *)arg; - int count = uw->count; - - if (count >= MEMENTO_BACKTRACE_MAX) - return _URC_END_OF_STACK; - - uw->addr[count] = (void *)_Unwind_GetIP(context); - uw->count++; - - return _URC_NO_REASON; -} - -static int Memento_getStacktrace(void **stack, int *skip) -{ - my_unwind_details uw = { 0, stack }; - - *skip = 0; - - /* Collect the backtrace. Deliberately only unwind once, - * and avoid using malloc etc until this completes just - * in case. */ - _Unwind_Backtrace(unwind_populate_callback, &uw); - if (uw.count <= SkipStackBackTraceLevels) - return 0; - - *skip = SkipStackBackTraceLevels; - return uw.count-SkipStackBackTraceLevels; -} - -static void Memento_showStacktrace(void **stack, int numberOfFrames) -{ - int i; - - for (i = 0; i < numberOfFrames; i++) - { - Dl_info info; - if (dladdr(stack[i], &info)) - { - int status = 0; - const char *sym = info.dli_sname ? info.dli_sname : ""; - char *demangled = __cxa_demangle(sym, NULL, 0, &status); - int offset = stack[i] - info.dli_saddr; - fprintf(stderr, " ["FMTP"]%s(+0x%x)\n", stack[i], demangled && status == 0 ? demangled : sym, offset); - free(demangled); - } - else - { - fprintf(stderr, " ["FMTP"]\n", stack[i]); - } - } -} - -#else -static void Memento_initStacktracer(void) -{ -} - -static int Memento_getStacktrace(void **stack, int *skip) -{ - *skip = 0; - return 0; -} - -static void Memento_showStacktrace(void **stack, int numberOfFrames) -{ -} -#endif /* MEMENTO_STACKTRACE_METHOD */ - -#ifdef MEMENTO_DETAILS -static void Memento_storeDetails(Memento_BlkHeader *head, int type) -{ - void *stack[MEMENTO_BACKTRACE_MAX]; - Memento_BlkDetails *details; - int count; - int skip; - - if (head == NULL) - return; - -#ifdef MEMENTO_STACKTRACE_METHOD - count = Memento_getStacktrace(stack, &skip); -#else - skip = 0; - count = 0; -#endif - - details = MEMENTO_UNDERLYING_MALLOC(sizeof(*details) + (count-1) * sizeof(void *)); - if (details == NULL) - return; - - if (count) - memcpy(&details->stack, &stack[skip], count * sizeof(void *)); - - details->type = type; - details->count = count; - details->sequence = memento.sequence; - details->next = NULL; - VALGRIND_MAKE_MEM_DEFINED(&head->details_tail, sizeof(head->details_tail)); - *head->details_tail = details; - head->details_tail = &details->next; - VALGRIND_MAKE_MEM_NOACCESS(&head->details_tail, sizeof(head->details_tail)); -} -#endif - -void (Memento_bt)(void) -{ -#ifdef MEMENTO_STACKTRACE_METHOD - void *stack[MEMENTO_BACKTRACE_MAX]; - int count; - int skip; - - count = Memento_getStacktrace(stack, &skip); - Memento_showStacktrace(&stack[skip-2], count-skip+2); -#endif -} - -static void Memento_bt_internal(int skip2) -{ -#ifdef MEMENTO_STACKTRACE_METHOD - void *stack[MEMENTO_BACKTRACE_MAX]; - int count; - int skip; - - count = Memento_getStacktrace(stack, &skip); - Memento_showStacktrace(&stack[skip+skip2], count-skip-skip2); -#endif -} - -static int Memento_checkAllMemoryLocked(void); - -void Memento_breakpoint(void) -{ - /* A handy externally visible function for breakpointing */ -#if 0 /* Enable this to force automatic breakpointing */ -#ifndef NDEBUG -#ifdef _MSC_VER - __asm int 3; -#endif -#endif -#endif -} - -static void Memento_init(void); - -#define MEMENTO_LOCK() \ -do { if (!memento.inited) Memento_init(); MEMENTO_DO_LOCK(); } while (0) - -#define MEMENTO_UNLOCK() \ -do { MEMENTO_DO_UNLOCK(); } while (0) - -/* Do this as a macro to prevent another level in the callstack, - * which is annoying while stepping. */ -#define Memento_breakpointLocked() \ -do { MEMENTO_UNLOCK(); Memento_breakpoint(); MEMENTO_LOCK(); } while (0) - -static void Memento_addBlockHead(Memento_Blocks *blks, - Memento_BlkHeader *b, - int type) -{ - if (blks->tail == NULL) - blks->tail = b; - b->next = blks->head; - b->prev = NULL; - if (blks->head) - { - VALGRIND_MAKE_MEM_DEFINED(&blks->head->prev, sizeof(blks->head->prev)); - blks->head->prev = b; - VALGRIND_MAKE_MEM_NOACCESS(&blks->head->prev, sizeof(blks->head->prev)); - } - blks->head = b; -#ifndef MEMENTO_LEAKONLY - memset(b->preblk, MEMENTO_PREFILL, Memento_PreSize); - memset(MEMBLK_POSTPTR(b), MEMENTO_POSTFILL, Memento_PostSize); -#endif - VALGRIND_MAKE_MEM_NOACCESS(MEMBLK_POSTPTR(b), Memento_PostSize); - if (type == 0) { /* malloc */ - VALGRIND_MAKE_MEM_UNDEFINED(MEMBLK_TOBLK(b), b->rawsize); - } else if (type == 1) { /* free */ - VALGRIND_MAKE_MEM_NOACCESS(MEMBLK_TOBLK(b), b->rawsize); - } - VALGRIND_MAKE_MEM_NOACCESS(b, sizeof(Memento_BlkHeader)); -} - -static void Memento_addBlockTail(Memento_Blocks *blks, - Memento_BlkHeader *b, - int type) -{ - VALGRIND_MAKE_MEM_DEFINED(&blks->tail, sizeof(Memento_BlkHeader *)); - if (blks->head == NULL) - blks->head = b; - b->prev = blks->tail; - b->next = NULL; - if (blks->tail) { - VALGRIND_MAKE_MEM_DEFINED(&blks->tail->next, sizeof(blks->tail->next)); - blks->tail->next = b; - VALGRIND_MAKE_MEM_NOACCESS(&blks->tail->next, sizeof(blks->tail->next)); - } - blks->tail = b; -#ifndef MEMENTO_LEAKONLY - memset(b->preblk, MEMENTO_PREFILL, Memento_PreSize); - memset(MEMBLK_POSTPTR(b), MEMENTO_POSTFILL, Memento_PostSize); -#endif - VALGRIND_MAKE_MEM_NOACCESS(MEMBLK_POSTPTR(b), Memento_PostSize); - if (type == 0) { /* malloc */ - VALGRIND_MAKE_MEM_UNDEFINED(MEMBLK_TOBLK(b), b->rawsize); - } else if (type == 1) { /* free */ - VALGRIND_MAKE_MEM_NOACCESS(MEMBLK_TOBLK(b), b->rawsize); - } - VALGRIND_MAKE_MEM_NOACCESS(b, sizeof(Memento_BlkHeader)); - VALGRIND_MAKE_MEM_NOACCESS(&blks->tail, sizeof(Memento_BlkHeader *)); -} - -typedef struct BlkCheckData { - int found; - int preCorrupt; - int postCorrupt; - int freeCorrupt; - size_t index; -} BlkCheckData; - -#ifndef MEMENTO_LEAKONLY -static int Memento_Internal_checkAllocedBlock(Memento_BlkHeader *b, void *arg) -{ - int i; - MEMENTO_UINT32 *ip; - unsigned char *p; - BlkCheckData *data = (BlkCheckData *)arg; - - ip = (MEMENTO_UINT32 *)(void *)(b->preblk); - i = Memento_PreSize>>2; - do { - if (*ip++ != MEMENTO_PREFILL_UINT32) - goto pre_corrupt; - } while (--i); - if (0) { -pre_corrupt: - data->preCorrupt = 1; - } - /* Postfill may not be aligned, so have to be slower */ - p = MEMBLK_POSTPTR(b); - i = Memento_PostSize-4; - if ((intptr_t)p & 1) - { - if (*p++ != MEMENTO_POSTFILL) - goto post_corrupt; - i--; - } - if ((intptr_t)p & 2) - { - if (*(MEMENTO_UINT16 *)p != MEMENTO_POSTFILL_UINT16) - goto post_corrupt; - p += 2; - i -= 2; - } - do { - if (*(MEMENTO_UINT32 *)p != MEMENTO_POSTFILL_UINT32) - goto post_corrupt; - p += 4; - i -= 4; - } while (i >= 0); - if (i & 2) - { - if (*(MEMENTO_UINT16 *)p != MEMENTO_POSTFILL_UINT16) - goto post_corrupt; - p += 2; - } - if (i & 1) - { - if (*p != MEMENTO_POSTFILL) - goto post_corrupt; - } - if (0) { -post_corrupt: - data->postCorrupt = 1; - } - if ((data->freeCorrupt | data->preCorrupt | data->postCorrupt) == 0) { - b->lastCheckedOK = memento.sequence; - } - data->found |= 1; - return 0; -} - -static int Memento_Internal_checkFreedBlock(Memento_BlkHeader *b, void *arg) -{ - size_t i; - unsigned char *p; - BlkCheckData *data = (BlkCheckData *)arg; - - p = MEMBLK_TOBLK(b); /* p will always be aligned */ - i = b->rawsize; - /* Attempt to speed this up by checking an (aligned) int at a time */ - if (i >= 4) { - i -= 4; - do { - if (*(MEMENTO_UINT32 *)p != MEMENTO_FREEFILL_UINT32) - goto mismatch4; - p += 4; - i -= 4; - } while (i > 0); - i += 4; - } - if (i & 2) { - if (*(MEMENTO_UINT16 *)p != MEMENTO_FREEFILL_UINT16) - goto mismatch; - p += 2; - i -= 2; - } - if (0) { -mismatch4: - i += 4; - } -mismatch: - while (i) { - if (*p++ != (unsigned char)MEMENTO_FREEFILL) - break; - i--; - } - if (i) { - data->freeCorrupt = 1; - data->index = b->rawsize-i; - } - return Memento_Internal_checkAllocedBlock(b, arg); -} -#endif /* MEMENTO_LEAKONLY */ - -static void Memento_removeBlock(Memento_Blocks *blks, - Memento_BlkHeader *b) -{ - VALGRIND_MAKE_MEM_DEFINED(b, sizeof(*b)); - if (b->next) { - VALGRIND_MAKE_MEM_DEFINED(&b->next->prev, sizeof(b->next->prev)); - b->next->prev = b->prev; - VALGRIND_MAKE_MEM_NOACCESS(&b->next->prev, sizeof(b->next->prev)); - } - if (b->prev) { - VALGRIND_MAKE_MEM_DEFINED(&b->prev->next, sizeof(b->prev->next)); - b->prev->next = b->next; - VALGRIND_MAKE_MEM_NOACCESS(&b->prev->next, sizeof(b->prev->next)); - } - if (blks->tail == b) - blks->tail = b->prev; - if (blks->head == b) - blks->head = b->next; -} - -static void free_block(Memento_BlkHeader *head) -{ -#ifdef MEMENTO_DETAILS - Memento_BlkDetails *details = head->details; - - while (details) - { - Memento_BlkDetails *next = details->next; - MEMENTO_UNDERLYING_FREE(details); - details = next; - } -#endif - MEMENTO_UNDERLYING_FREE(head); -} - -static int Memento_Internal_makeSpace(size_t space) -{ - /* If too big, it can never go on the freelist */ - if (space > MEMENTO_FREELIST_MAX_SINGLE_BLOCK) - return 0; - /* Pretend we added it on. */ - memento.freeListSize += space; - /* Ditch blocks until it fits within our limit */ - while (memento.freeListSize > MEMENTO_FREELIST_MAX) { - Memento_BlkHeader *head = memento.free.head; - VALGRIND_MAKE_MEM_DEFINED(head, sizeof(*head)); - memento.free.head = head->next; - memento.freeListSize -= MEMBLK_SIZE(head->rawsize); - free_block(head); - } - /* Make sure we haven't just completely emptied the free list */ - /* (This should never happen, but belt and braces... */ - if (memento.free.head == NULL) - memento.free.tail = NULL; - return 1; -} - -static int Memento_appBlocks(Memento_Blocks *blks, - int (*app)(Memento_BlkHeader *, - void *), - void *arg) -{ - Memento_BlkHeader *head = blks->head; - Memento_BlkHeader *next; - int result; - while (head) { - VALGRIND_MAKE_MEM_DEFINED(head, sizeof(Memento_BlkHeader)); - VALGRIND_MAKE_MEM_DEFINED(MEMBLK_TOBLK(head), - head->rawsize + Memento_PostSize); - result = app(head, arg); - next = head->next; - VALGRIND_MAKE_MEM_NOACCESS(MEMBLK_POSTPTR(head), Memento_PostSize); - VALGRIND_MAKE_MEM_NOACCESS(head, sizeof(Memento_BlkHeader)); - if (result) - return result; - head = next; - } - return 0; -} - -#ifndef MEMENTO_LEAKONLY -/* Distrustful - check the block is a real one */ -static int Memento_appBlockUser(Memento_Blocks *blks, - int (*app)(Memento_BlkHeader *, - void *), - void *arg, - Memento_BlkHeader *b) -{ - Memento_BlkHeader *head = blks->head; - Memento_BlkHeader *next; - int result; - while (head && head != b) { - VALGRIND_MAKE_MEM_DEFINED(head, sizeof(Memento_BlkHeader)); - next = head->next; - VALGRIND_MAKE_MEM_NOACCESS(MEMBLK_POSTPTR(head), Memento_PostSize); - head = next; - } - if (head == b) { - VALGRIND_MAKE_MEM_DEFINED(head, sizeof(Memento_BlkHeader)); - VALGRIND_MAKE_MEM_DEFINED(MEMBLK_TOBLK(head), - head->rawsize + Memento_PostSize); - result = app(head, arg); - VALGRIND_MAKE_MEM_NOACCESS(MEMBLK_POSTPTR(head), Memento_PostSize); - VALGRIND_MAKE_MEM_NOACCESS(head, sizeof(Memento_BlkHeader)); - return result; - } - return 0; -} - -static int Memento_appBlock(Memento_Blocks *blks, - int (*app)(Memento_BlkHeader *, - void *), - void *arg, - Memento_BlkHeader *b) -{ - int result; - VALGRIND_MAKE_MEM_DEFINED(b, sizeof(Memento_BlkHeader)); - VALGRIND_MAKE_MEM_DEFINED(MEMBLK_TOBLK(b), - b->rawsize + Memento_PostSize); - result = app(b, arg); - VALGRIND_MAKE_MEM_NOACCESS(MEMBLK_POSTPTR(b), Memento_PostSize); - VALGRIND_MAKE_MEM_NOACCESS(b, sizeof(Memento_BlkHeader)); - return result; -} -#endif /* MEMENTO_LEAKONLY */ - -static int showBlock(Memento_BlkHeader *b, int space) -{ - int seq; - VALGRIND_MAKE_MEM_DEFINED(b, sizeof(Memento_BlkHeader)); - fprintf(stderr, FMTP":(size=" FMTZ ",num=%d)", - MEMBLK_TOBLK(b), (FMTZ_CAST)b->rawsize, b->sequence); - if (b->label) - fprintf(stderr, "%c(%s)", space, b->label); - if (b->flags & Memento_Flag_KnownLeak) - fprintf(stderr, "(Known Leak)"); - seq = b->sequence; - VALGRIND_MAKE_MEM_NOACCESS(b, sizeof(Memento_BlkHeader)); - return seq; -} - -static void blockDisplay(Memento_BlkHeader *b, int n) -{ - n++; - while (n > 40) - { - fprintf(stderr, "*"); - n -= 40; - } - while(n > 0) - { - int i = n; - if (i > 32) - i = 32; - n -= i; - fprintf(stderr, "%s", &" "[32-i]); - } - showBlock(b, '\t'); - fprintf(stderr, "\n"); -} - -static int Memento_listBlock(Memento_BlkHeader *b, - void *arg) -{ - size_t *counts = (size_t *)arg; - blockDisplay(b, 0); - counts[0]++; - VALGRIND_MAKE_MEM_DEFINED(b, sizeof(Memento_BlkHeader)); - counts[1]+= b->rawsize; - VALGRIND_MAKE_MEM_NOACCESS(b, sizeof(Memento_BlkHeader)); - return 0; -} - -static void doNestedDisplay(Memento_BlkHeader *b, - int depth) -{ - /* Try and avoid recursion if we can help it */ - do { - Memento_BlkHeader *c = NULL; - blockDisplay(b, depth); - VALGRIND_MAKE_MEM_DEFINED(b, sizeof(Memento_BlkHeader)); - if (b->sibling) { - c = b->child; - b = b->sibling; - } else { - b = b->child; - depth++; - } - VALGRIND_MAKE_MEM_NOACCESS(b, sizeof(Memento_BlkHeader)); - if (c) - doNestedDisplay(c, depth+1); - } while (b); -} - -static int ptrcmp(const void *a_, const void *b_) -{ - const char **a = (const char **)a_; - const char **b = (const char **)b_; - return (int)(*a-*b); -} - -static -int Memento_listBlocksNested(void) -{ - int count, i; - size_t size; - Memento_BlkHeader *b, *prev; - void **blocks, *minptr, *maxptr; - intptr_t mask; - - /* Count the blocks */ - count = 0; - size = 0; - for (b = memento.used.head; b; b = b->next) { - VALGRIND_MAKE_MEM_DEFINED(b, sizeof(*b)); - size += b->rawsize; - count++; - } - - /* Make our block list */ - blocks = MEMENTO_UNDERLYING_MALLOC(sizeof(void *) * count); - if (blocks == NULL) - return 1; - - /* Populate our block list */ - b = memento.used.head; - minptr = maxptr = MEMBLK_TOBLK(b); - mask = (intptr_t)minptr; - for (i = 0; b; b = b->next, i++) { - void *p = MEMBLK_TOBLK(b); - mask &= (intptr_t)p; - if (p < minptr) - minptr = p; - if (p > maxptr) - maxptr = p; - blocks[i] = p; - b->flags &= ~Memento_Flag_HasParent; - b->child = NULL; - b->sibling = NULL; - b->prev = NULL; /* parent */ - } - qsort(blocks, count, sizeof(void *), ptrcmp); - - /* Now, calculate tree */ - for (b = memento.used.head; b; b = b->next) { - char *p = MEMBLK_TOBLK(b); - int end = (b->rawsize < MEMENTO_PTRSEARCH ? b->rawsize : MEMENTO_PTRSEARCH); - for (i = MEMENTO_SEARCH_SKIP; i < end; i += sizeof(void *)) { - void *q = *(void **)(&p[i]); - void **r; - - /* Do trivial checks on pointer */ - if ((mask & (intptr_t)q) != mask || q < minptr || q > maxptr) - continue; - - /* Search for pointer */ - r = bsearch(&q, blocks, count, sizeof(void *), ptrcmp); - if (r) { - /* Found child */ - Memento_BlkHeader *child = MEMBLK_FROMBLK(*r); - Memento_BlkHeader *parent; - - /* We're assuming tree structure, not graph - ignore second - * and subsequent pointers. */ - if (child->prev != NULL) /* parent */ - continue; - if (child->flags & Memento_Flag_HasParent) - continue; - - /* Not interested in pointers to ourself! */ - if (child == b) - continue; - - /* We're also assuming acyclicness here. If this is one of - * our parents, ignore it. */ - parent = b->prev; /* parent */ - while (parent != NULL && parent != child) - parent = parent->prev; /* parent */ - if (parent == child) - continue; - - child->sibling = b->child; - b->child = child; - child->prev = b; /* parent */ - child->flags |= Memento_Flag_HasParent; - } - } - } - - /* Now display with nesting */ - for (b = memento.used.head; b; b = b->next) { - if ((b->flags & Memento_Flag_HasParent) == 0) - doNestedDisplay(b, 0); - } - fprintf(stderr, " Total number of blocks = %d\n", count); - fprintf(stderr, " Total size of blocks = "FMTZ"\n", (FMTZ_CAST)size); - - MEMENTO_UNDERLYING_FREE(blocks); - - /* Now put the blocks back for valgrind, and restore the prev - * and magic values. */ - prev = NULL; - for (b = memento.used.head; b;) { - Memento_BlkHeader *next = b->next; - b->prev = prev; - b->child = MEMENTO_CHILD_MAGIC; - b->sibling = MEMENTO_SIBLING_MAGIC; - prev = b; - VALGRIND_MAKE_MEM_NOACCESS(b, sizeof(*b)); - b = next; - } - - return 0; -} - -void Memento_listBlocks(void) -{ - MEMENTO_LOCK(); - fprintf(stderr, "Allocated blocks:\n"); - if (Memento_listBlocksNested()) - { - size_t counts[2]; - counts[0] = 0; - counts[1] = 0; - Memento_appBlocks(&memento.used, Memento_listBlock, &counts[0]); - fprintf(stderr, " Total number of blocks = "FMTZ"\n", (FMTZ_CAST)counts[0]); - fprintf(stderr, " Total size of blocks = "FMTZ"\n", (FMTZ_CAST)counts[1]); - } - MEMENTO_UNLOCK(); -} - -static int Memento_listNewBlock(Memento_BlkHeader *b, - void *arg) -{ - if (b->flags & Memento_Flag_OldBlock) - return 0; - b->flags |= Memento_Flag_OldBlock; - return Memento_listBlock(b, arg); -} - -void Memento_listNewBlocks(void) -{ - size_t counts[2]; - MEMENTO_LOCK(); - counts[0] = 0; - counts[1] = 0; - fprintf(stderr, "Blocks allocated and still extant since last list:\n"); - Memento_appBlocks(&memento.used, Memento_listNewBlock, &counts[0]); - fprintf(stderr, " Total number of blocks = "FMTZ"\n", (FMTZ_CAST)counts[0]); - fprintf(stderr, " Total size of blocks = "FMTZ"\n", (FMTZ_CAST)counts[1]); - MEMENTO_UNLOCK(); -} - -static void Memento_endStats(void) -{ - fprintf(stderr, "Total memory malloced = "FMTZ" bytes\n", (FMTZ_CAST)memento.totalAlloc); - fprintf(stderr, "Peak memory malloced = "FMTZ" bytes\n", (FMTZ_CAST)memento.peakAlloc); - fprintf(stderr, FMTZ" mallocs, "FMTZ" frees, "FMTZ" reallocs\n", (FMTZ_CAST)memento.numMallocs, - (FMTZ_CAST)memento.numFrees, (FMTZ_CAST)memento.numReallocs); - fprintf(stderr, "Average allocation size "FMTZ" bytes\n", (FMTZ_CAST) - (memento.numMallocs != 0 ? memento.totalAlloc/memento.numMallocs: 0)); -} - -void Memento_stats(void) -{ - MEMENTO_LOCK(); - fprintf(stderr, "Current memory malloced = "FMTZ" bytes\n", (FMTZ_CAST)memento.alloc); - Memento_endStats(); - MEMENTO_UNLOCK(); -} - -#ifdef MEMENTO_DETAILS -static int showInfo(Memento_BlkHeader *b, void *arg) -{ - Memento_BlkDetails *details; - - fprintf(stderr, FMTP":(size="FMTZ",num=%d)", - MEMBLK_TOBLK(b), (FMTZ_CAST)b->rawsize, b->sequence); - if (b->label) - fprintf(stderr, " (%s)", b->label); - fprintf(stderr, "\nEvents:\n"); - - details = b->details; - while (details) - { - fprintf(stderr, " Event %d (%s)\n", details->sequence, eventType[(int)details->type]); - Memento_showStacktrace(details->stack, details->count); - details = details->next; - } - return 0; -} -#endif - -void Memento_listBlockInfo(void) -{ -#ifdef MEMENTO_DETAILS - MEMENTO_LOCK(); - fprintf(stderr, "Details of allocated blocks:\n"); - Memento_appBlocks(&memento.used, showInfo, NULL); - MEMENTO_UNLOCK(); -#endif -} - -static int Memento_nonLeakBlocksLeaked(void) -{ - Memento_BlkHeader *blk = memento.used.head; - while (blk) - { - Memento_BlkHeader *next; - int leaked; - VALGRIND_MAKE_MEM_DEFINED(blk, sizeof(*blk)); - leaked = ((blk->flags & Memento_Flag_KnownLeak) == 0); - next = blk->next; - VALGRIND_MAKE_MEM_DEFINED(blk, sizeof(*blk)); - if (leaked) - return 1; - blk = next; - } - return 0; -} - -void Memento_fin(void) -{ - Memento_checkAllMemory(); - if (!memento.segv) - { - Memento_endStats(); - if (Memento_nonLeakBlocksLeaked()) { - Memento_listBlocks(); -#ifdef MEMENTO_DETAILS - fprintf(stderr, "\n"); - Memento_listBlockInfo(); -#endif - Memento_breakpoint(); - } - } - if (memento.squeezing) { - if (memento.pattern == 0) - fprintf(stderr, "Memory squeezing @ %d complete%s\n", memento.squeezeAt, memento.segv ? " (with SEGV)" : ""); - else - fprintf(stderr, "Memory squeezing @ %d (%d) complete%s\n", memento.squeezeAt, memento.pattern, memento.segv ? " (with SEGV)" : ""); - } else if (memento.segv) { - fprintf(stderr, "Memento completed (with SEGV)\n"); - } - if (memento.failing) - { - fprintf(stderr, "MEMENTO_FAILAT=%d\n", memento.failAt); - fprintf(stderr, "MEMENTO_PATTERN=%d\n", memento.pattern); - } - if (memento.nextFailAt != 0) - { - fprintf(stderr, "MEMENTO_NEXTFAILAT=%d\n", memento.nextFailAt); - fprintf(stderr, "MEMENTO_NEXTPATTERN=%d\n", memento.nextPattern); - } -} - -static void Memento_init(void) -{ - char *env; - memset(&memento, 0, sizeof(memento)); - memento.inited = 1; - memento.used.head = NULL; - memento.used.tail = NULL; - memento.free.head = NULL; - memento.free.tail = NULL; - memento.sequence = 0; - memento.countdown = 1024; - - env = getenv("MEMENTO_FAILAT"); - memento.failAt = (env ? atoi(env) : 0); - - env = getenv("MEMENTO_BREAKAT"); - memento.breakAt = (env ? atoi(env) : 0); - - env = getenv("MEMENTO_PARANOIA"); - memento.paranoia = (env ? atoi(env) : 0); - if (memento.paranoia == 0) - memento.paranoia = -1024; - - env = getenv("MEMENTO_PARANOIDAT"); - memento.paranoidAt = (env ? atoi(env) : 0); - - env = getenv("MEMENTO_SQUEEZEAT"); - memento.squeezeAt = (env ? atoi(env) : 0); - - env = getenv("MEMENTO_PATTERN"); - memento.pattern = (env ? atoi(env) : 0); - - env = getenv("MEMENTO_MAXMEMORY"); - memento.maxMemory = (env ? atoi(env) : 0); - - atexit(Memento_fin); - - Memento_initMutex(&memento.mutex); - - Memento_initStacktracer(); - - Memento_breakpoint(); -} - -typedef struct findBlkData { - void *addr; - Memento_BlkHeader *blk; - int flags; -} findBlkData; - -static int Memento_containsAddr(Memento_BlkHeader *b, - void *arg) -{ - findBlkData *data = (findBlkData *)arg; - char *blkend = &((char *)MEMBLK_TOBLK(b))[b->rawsize]; - if ((MEMBLK_TOBLK(b) <= data->addr) && - ((void *)blkend > data->addr)) { - data->blk = b; - data->flags = 1; - return 1; - } - if (((void *)b <= data->addr) && - (MEMBLK_TOBLK(b) > data->addr)) { - data->blk = b; - data->flags = 2; - return 1; - } - if (((void *)blkend <= data->addr) && - ((void *)(blkend + Memento_PostSize) > data->addr)) { - data->blk = b; - data->flags = 3; - return 1; - } - return 0; -} - -void Memento_info(void *addr) -{ -#ifdef MEMENTO_DETAILS - findBlkData data; - - MEMENTO_LOCK(); - data.addr = addr; - data.blk = NULL; - data.flags = 0; - Memento_appBlocks(&memento.used, Memento_containsAddr, &data); - if (data.blk != NULL) - showInfo(data.blk, NULL); - data.blk = NULL; - data.flags = 0; - Memento_appBlocks(&memento.free, Memento_containsAddr, &data); - if (data.blk != NULL) - showInfo(data.blk, NULL); - MEMENTO_UNLOCK(); -#else - printf("Memento not compiled with details support\n"); -#endif -} - -#ifdef MEMENTO_HAS_FORK -#include -#include -#include -#ifdef MEMENTO_STACKTRACE_METHOD -#if MEMENTO_STACKTRACE_METHOD == 1 -#include -#endif -#endif - -/* FIXME: Find some portable way of getting this */ -/* MacOSX has 10240, Ubuntu seems to have 256 */ -#ifndef OPEN_MAX -#define OPEN_MAX 10240 -#endif - -/* stashed_map[j] = i means that file descriptor i-1 was duplicated to j */ -int stashed_map[OPEN_MAX]; - -static void Memento_signal(int sig) -{ - (void)sig; - fprintf(stderr, "SEGV at:\n"); - memento.segv = 1; - Memento_bt_internal(0); - - exit(1); -} - -static int squeeze(void) -{ - pid_t pid; - int i, status; - - if (memento.patternBit < 0) - return 1; - if (memento.squeezing && memento.patternBit >= MEMENTO_MAXPATTERN) - return 1; - - if (memento.patternBit == 0) - memento.squeezeAt = memento.sequence; - - if (!memento.squeezing) { - fprintf(stderr, "Memory squeezing @ %d\n", memento.squeezeAt); - } else - fprintf(stderr, "Memory squeezing @ %d (%x,%x)\n", memento.squeezeAt, memento.pattern, memento.patternBit); - - /* When we fork below, the child is going to snaffle all our file pointers - * and potentially corrupt them. Let's make copies of all of them before - * we fork, so we can restore them when we restart. */ - for (i = 0; i < OPEN_MAX; i++) { - if (stashed_map[i] == 0) { - int j = dup(i); - stashed_map[j] = i+1; - } - } - - fprintf(stderr, "Failing at:\n"); - Memento_bt_internal(2); - pid = fork(); - if (pid == 0) { - /* Child */ - signal(SIGSEGV, Memento_signal); - /* In the child, we always fail the next allocation. */ - if (memento.patternBit == 0) { - memento.patternBit = 1; - } else - memento.patternBit <<= 1; - memento.squeezing = 1; - return 1; - } - - /* In the parent if we hit another allocation, pass it (and record the - * fact we passed it in the pattern. */ - memento.pattern |= memento.patternBit; - memento.patternBit <<= 1; - - /* Wait for pid to finish, with a timeout. */ - { - struct timespec tm = { 0, 10 * 1000 * 1000 }; /* 10ms = 100th sec */ - int timeout = 30 * 1000 * 1000; /* time out in microseconds! */ - while (waitpid(pid, &status, WNOHANG) == 0) { - nanosleep(&tm, NULL); - timeout -= (tm.tv_nsec/1000); - tm.tv_nsec *= 2; - if (tm.tv_nsec > 999999999) - tm.tv_nsec = 999999999; - if (timeout <= 0) { - char text[32]; - fprintf(stderr, "Child is taking a long time to die. Killing it.\n"); - sprintf(text, "kill %d", pid); - system(text); - break; - } - } - } - - if (status != 0) { - fprintf(stderr, "Child status=%d\n", status); - } - - /* Put the files back */ - for (i = 0; i < OPEN_MAX; i++) { - if (stashed_map[i] != 0) { - dup2(i, stashed_map[i]-1); - close(i); - stashed_map[i] = 0; - } - } - - return 0; -} -#else -#include - -static void Memento_signal(int sig) -{ - (void)sig; - memento.segv = 1; - /* If we just return from this function the SEGV will be unhandled, and - * we'll launch into whatever JIT debugging system the OS provides. At - * least fprintf(stderr, something useful first. If MEMENTO_NOJIT is set, then - * just exit to avoid the JIT (and get the usual atexit handling). */ - if (getenv("MEMENTO_NOJIT")) - exit(1); - else - Memento_fin(); -} - -static int squeeze(void) -{ - fprintf(stderr, "Memento memory squeezing disabled as no fork!\n"); - return 0; -} -#endif - -static void Memento_startFailing(void) -{ - if (!memento.failing) { - fprintf(stderr, "Starting to fail...\n"); - Memento_bt(); - fflush(stderr); - memento.failing = 1; - memento.failAt = memento.sequence; - memento.nextFailAt = memento.sequence+1; - memento.pattern = 0; - memento.patternBit = 0; - signal(SIGSEGV, Memento_signal); - signal(SIGABRT, Memento_signal); - Memento_breakpointLocked(); - } -} - -static int Memento_event(void) -{ - memento.sequence++; - if ((memento.sequence >= memento.paranoidAt) && (memento.paranoidAt != 0)) { - memento.paranoia = 1; - memento.countdown = 1; - } - if (--memento.countdown == 0) { - Memento_checkAllMemoryLocked(); - if (memento.paranoia > 0) - memento.countdown = memento.paranoia; - else - { - memento.countdown = -memento.paranoia; - if (memento.paranoia > INT_MIN/2) - memento.paranoia *= 2; - } - } - - if (memento.sequence == memento.breakAt) { - fprintf(stderr, "Breaking at event %d\n", memento.breakAt); - return 1; - } - return 0; -} - -int Memento_sequence(void) -{ - return memento.sequence; -} - -int Memento_breakAt(int event) -{ - MEMENTO_LOCK(); - memento.breakAt = event; - MEMENTO_UNLOCK(); - return event; -} - -static void *safe_find_block(void *ptr) -{ - Memento_BlkHeader *block; - int valid; - - if (ptr == NULL) - return NULL; - - block = MEMBLK_FROMBLK(ptr); - /* Sometimes wrapping allocators can mean Memento_label - * is called with a value within the block, rather than - * at the start of the block. If we detect this, find it - * the slow way. */ - VALGRIND_MAKE_MEM_DEFINED(&block->child, sizeof(block->child)); - VALGRIND_MAKE_MEM_DEFINED(&block->sibling, sizeof(block->sibling)); - valid = (block->child == MEMENTO_CHILD_MAGIC && - block->sibling == MEMENTO_SIBLING_MAGIC); - VALGRIND_MAKE_MEM_NOACCESS(&block->child, sizeof(block->child)); - VALGRIND_MAKE_MEM_NOACCESS(&block->sibling, sizeof(block->sibling)); - if (!valid) - { - findBlkData data; - - data.addr = ptr; - data.blk = NULL; - data.flags = 0; - Memento_appBlocks(&memento.used, Memento_containsAddr, &data); - if (data.blk == NULL) - return NULL; - block = data.blk; - } - return block; -} - -void *Memento_label(void *ptr, const char *label) -{ - Memento_BlkHeader *block; - - if (ptr == NULL) - return NULL; - MEMENTO_LOCK(); - block = safe_find_block(ptr); - if (block != NULL) - { - VALGRIND_MAKE_MEM_DEFINED(&block->label, sizeof(block->label)); - block->label = label; - VALGRIND_MAKE_MEM_NOACCESS(&block->label, sizeof(block->label)); - } - MEMENTO_UNLOCK(); - return ptr; -} - -void Memento_tick(void) -{ - MEMENTO_LOCK(); - if (Memento_event()) Memento_breakpointLocked(); - MEMENTO_UNLOCK(); -} - -static int Memento_failThisEventLocked(void) -{ - int failThisOne; - - if (Memento_event()) Memento_breakpointLocked(); - - if ((memento.sequence >= memento.failAt) && (memento.failAt != 0)) - Memento_startFailing(); - if ((memento.sequence >= memento.squeezeAt) && (memento.squeezeAt != 0)) { - return squeeze(); - } - - if (!memento.failing) - return 0; - failThisOne = ((memento.patternBit & memento.pattern) == 0); - /* If we are failing, and we've reached the end of the pattern and we've - * still got bits available in the pattern word, and we haven't already - * set a nextPattern, then extend the pattern. */ - if (memento.failing && - ((~(memento.patternBit-1) & memento.pattern) == 0) && - (memento.patternBit != 0) && - memento.nextPattern == 0) - { - /* We'll fail this one, and set the 'next' one to pass it. */ - memento.nextFailAt = memento.failAt; - memento.nextPattern = memento.pattern | memento.patternBit; - } - memento.patternBit = (memento.patternBit ? memento.patternBit << 1 : 1); - - return failThisOne; -} - -int Memento_failThisEvent(void) -{ - int ret; - - if (!memento.inited) - Memento_init(); - - MEMENTO_LOCK(); - ret = Memento_failThisEventLocked(); - MEMENTO_UNLOCK(); - return ret; -} - -static void *do_malloc(size_t s, int eventType) -{ - Memento_BlkHeader *memblk; - size_t smem = MEMBLK_SIZE(s); - - if (Memento_failThisEventLocked()) - return NULL; - - if (s == 0) - return NULL; - - memento.numMallocs++; - - if (memento.maxMemory != 0 && memento.alloc + s > memento.maxMemory) - return NULL; - - memblk = MEMENTO_UNDERLYING_MALLOC(smem); - if (memblk == NULL) - return NULL; - - memento.alloc += s; - memento.totalAlloc += s; - if (memento.peakAlloc < memento.alloc) - memento.peakAlloc = memento.alloc; -#ifndef MEMENTO_LEAKONLY - memset(MEMBLK_TOBLK(memblk), MEMENTO_ALLOCFILL, s); -#endif - memblk->rawsize = s; - memblk->sequence = memento.sequence; - memblk->lastCheckedOK = memblk->sequence; - memblk->flags = 0; - memblk->label = 0; - memblk->child = MEMENTO_CHILD_MAGIC; - memblk->sibling = MEMENTO_SIBLING_MAGIC; -#ifdef MEMENTO_DETAILS - memblk->details = NULL; - memblk->details_tail = &memblk->details; - Memento_storeDetails(memblk, Memento_EventType_malloc); -#endif /* MEMENTO_DETAILS */ - Memento_addBlockHead(&memento.used, memblk, 0); - - if (memento.leaking > 0) - memblk->flags |= Memento_Flag_KnownLeak; - - return MEMBLK_TOBLK(memblk); -} - -void *Memento_malloc(size_t s) -{ - void *ret; - - if (!memento.inited) - Memento_init(); - - MEMENTO_LOCK(); - ret = do_malloc(s, Memento_EventType_malloc); - MEMENTO_UNLOCK(); - return ret; -} - -void *Memento_calloc(size_t n, size_t s) -{ - void *block; - - if (!memento.inited) - Memento_init(); - - MEMENTO_LOCK(); - block = do_malloc(n*s, Memento_EventType_calloc); - if (block) - memset(block, 0, n*s); - MEMENTO_UNLOCK(); - return block; -} - -static void do_reference(Memento_BlkHeader *blk, int event) -{ -#ifdef MEMENTO_DETAILS - Memento_storeDetails(blk, event); -#endif /* MEMENTO_DETAILS */ -} - -int Memento_checkPointerOrNull(void *blk) -{ - if (blk == NULL) - return 0; - if (blk == MEMENTO_PREFILL_PTR) - fprintf(stderr, "Prefill value found as pointer - buffer underrun?\n"); - else if (blk == MEMENTO_POSTFILL_PTR) - fprintf(stderr, "Postfill value found as pointer - buffer overrun?\n"); - else if (blk == MEMENTO_ALLOCFILL_PTR) - fprintf(stderr, "Allocfill value found as pointer - use of uninitialised value?\n"); - else if (blk == MEMENTO_FREEFILL_PTR) - fprintf(stderr, "Allocfill value found as pointer - use after free?\n"); - else - return 0; -#ifdef MEMENTO_DETAILS - fprintf(stderr, "Current backtrace:\n"); - Memento_bt(); - fprintf(stderr, "History:\n"); - Memento_info(blk); -#endif - return 1; -} - -int Memento_checkBytePointerOrNull(void *blk) -{ - unsigned char i; - if (blk == NULL) - return 0; - Memento_checkPointerOrNull(blk); - - i = *(unsigned int *)blk; - - if (i == MEMENTO_PREFILL_UBYTE) - fprintf(stderr, "Prefill value found - buffer underrun?\n"); - else if (i == MEMENTO_POSTFILL_UBYTE) - fprintf(stderr, "Postfill value found - buffer overrun?\n"); - else if (i == MEMENTO_ALLOCFILL_UBYTE) - fprintf(stderr, "Allocfill value found - use of uninitialised value?\n"); - else if (i == MEMENTO_FREEFILL_UBYTE) - fprintf(stderr, "Allocfill value found - use after free?\n"); - else - return 0; -#ifdef MEMENTO_DETAILS - fprintf(stderr, "Current backtrace:\n"); - Memento_bt(); - fprintf(stderr, "History:\n"); - Memento_info(blk); -#endif - Memento_breakpoint(); - return 1; -} - -int Memento_checkShortPointerOrNull(void *blk) -{ - unsigned short i; - if (blk == NULL) - return 0; - Memento_checkPointerOrNull(blk); - - i = *(unsigned short *)blk; - - if (i == MEMENTO_PREFILL_USHORT) - fprintf(stderr, "Prefill value found - buffer underrun?\n"); - else if (i == MEMENTO_POSTFILL_USHORT) - fprintf(stderr, "Postfill value found - buffer overrun?\n"); - else if (i == MEMENTO_ALLOCFILL_USHORT) - fprintf(stderr, "Allocfill value found - use of uninitialised value?\n"); - else if (i == MEMENTO_FREEFILL_USHORT) - fprintf(stderr, "Allocfill value found - use after free?\n"); - else - return 0; -#ifdef MEMENTO_DETAILS - fprintf(stderr, "Current backtrace:\n"); - Memento_bt(); - fprintf(stderr, "History:\n"); - Memento_info(blk); -#endif - Memento_breakpoint(); - return 1; -} - -int Memento_checkIntPointerOrNull(void *blk) -{ - unsigned int i; - if (blk == NULL) - return 0; - Memento_checkPointerOrNull(blk); - - i = *(unsigned int *)blk; - - if (i == MEMENTO_PREFILL_UINT) - fprintf(stderr, "Prefill value found - buffer underrun?\n"); - else if (i == MEMENTO_POSTFILL_UINT) - fprintf(stderr, "Postfill value found - buffer overrun?\n"); - else if (i == MEMENTO_ALLOCFILL_UINT) - fprintf(stderr, "Allocfill value found - use of uninitialised value?\n"); - else if (i == MEMENTO_FREEFILL_UINT) - fprintf(stderr, "Allocfill value found - use after free?\n"); - else - return 0; -#ifdef MEMENTO_DETAILS - fprintf(stderr, "Current backtrace:\n"); - Memento_bt(); - fprintf(stderr, "History:\n"); - Memento_info(blk); -#endif - Memento_breakpoint(); - return 1; -} - -static void *do_takeRef(void *blk) -{ - MEMENTO_LOCK(); - do_reference(safe_find_block(blk), Memento_EventType_takeRef); - MEMENTO_UNLOCK(); - return blk; -} - -void *Memento_takeByteRef(void *blk) -{ - if (!memento.inited) - Memento_init(); - - if (Memento_event()) Memento_breakpoint(); - - if (!blk) - return NULL; - - (void)Memento_checkBytePointerOrNull(blk); - - return do_takeRef(blk); -} - -void *Memento_takeShortRef(void *blk) -{ - if (!memento.inited) - Memento_init(); - - if (Memento_event()) Memento_breakpoint(); - - if (!blk) - return NULL; - - (void)Memento_checkShortPointerOrNull(blk); - - return do_takeRef(blk); -} - -void *Memento_takeIntRef(void *blk) -{ - if (!memento.inited) - Memento_init(); - - if (Memento_event()) Memento_breakpoint(); - - if (!blk) - return NULL; - - (void)Memento_checkIntPointerOrNull(blk); - - return do_takeRef(blk); -} - -void *Memento_takeRef(void *blk) -{ - if (!memento.inited) - Memento_init(); - - if (Memento_event()) Memento_breakpoint(); - - if (!blk) - return NULL; - - return do_takeRef(blk); -} - -static void *do_dropRef(void *blk) -{ - MEMENTO_LOCK(); - do_reference(safe_find_block(blk), Memento_EventType_dropRef); - MEMENTO_UNLOCK(); - return blk; -} - -void *Memento_dropByteRef(void *blk) -{ - if (!memento.inited) - Memento_init(); - - if (Memento_event()) Memento_breakpoint(); - - if (!blk) - return NULL; - - Memento_checkBytePointerOrNull(blk); - - return do_dropRef(blk); -} - -void *Memento_dropShortRef(void *blk) -{ - if (!memento.inited) - Memento_init(); - - if (Memento_event()) Memento_breakpoint(); - - if (!blk) - return NULL; - - Memento_checkShortPointerOrNull(blk); - - return do_dropRef(blk); -} - -void *Memento_dropIntRef(void *blk) -{ - if (!memento.inited) - Memento_init(); - - if (Memento_event()) Memento_breakpoint(); - - if (!blk) - return NULL; - - Memento_checkIntPointerOrNull(blk); - - return do_dropRef(blk); -} - -void *Memento_dropRef(void *blk) -{ - if (!memento.inited) - Memento_init(); - - if (Memento_event()) Memento_breakpoint(); - - if (!blk) - return NULL; - - return do_dropRef(blk); -} - -void *Memento_adjustRef(void *blk, int adjust) -{ - if (Memento_event()) Memento_breakpoint(); - - if (blk == NULL) - return NULL; - - while (adjust > 0) - { - do_takeRef(blk); - adjust--; - } - while (adjust < 0) - { - do_dropRef(blk); - adjust++; - } - - return blk; - } - -void *Memento_reference(void *blk) -{ - if (!blk) - return NULL; - - if (!memento.inited) - Memento_init(); - - MEMENTO_LOCK(); - do_reference(safe_find_block(blk), Memento_EventType_reference); - MEMENTO_UNLOCK(); - return blk; -} - -/* Treat blocks from the user with suspicion, and check them the slow - * but safe way. */ -static int checkBlockUser(Memento_BlkHeader *memblk, const char *action) -{ -#ifndef MEMENTO_LEAKONLY - BlkCheckData data; - - memset(&data, 0, sizeof(data)); - Memento_appBlockUser(&memento.used, Memento_Internal_checkAllocedBlock, - &data, memblk); - if (!data.found) { - /* Failure! */ - fprintf(stderr, "Attempt to %s block ", action); - showBlock(memblk, 32); - fprintf(stderr, "\n"); - Memento_breakpointLocked(); - return 1; - } else if (data.preCorrupt || data.postCorrupt) { - fprintf(stderr, "Block "); - showBlock(memblk, ' '); - fprintf(stderr, " found to be corrupted on %s!\n", action); - if (data.preCorrupt) { - fprintf(stderr, "Preguard corrupted\n"); - } - if (data.postCorrupt) { - fprintf(stderr, "Postguard corrupted\n"); - } - fprintf(stderr, "Block last checked OK at allocation %d. Now %d.\n", - memblk->lastCheckedOK, memento.sequence); - if ((memblk->flags & Memento_Flag_Reported) == 0) - { - memblk->flags |= Memento_Flag_Reported; - Memento_breakpointLocked(); - } - return 1; - } -#endif - return 0; -} - -static int checkBlock(Memento_BlkHeader *memblk, const char *action) -{ -#ifndef MEMENTO_LEAKONLY - BlkCheckData data; -#endif - - if (memblk->child != MEMENTO_CHILD_MAGIC || - memblk->sibling != MEMENTO_SIBLING_MAGIC) - { - /* Failure! */ - fprintf(stderr, "Attempt to %s invalid block ", action); - showBlock(memblk, 32); - fprintf(stderr, "\n"); - Memento_breakpointLocked(); - return 1; - } - -#ifndef MEMENTO_LEAKONLY - memset(&data, 0, sizeof(data)); - Memento_appBlock(&memento.used, Memento_Internal_checkAllocedBlock, - &data, memblk); - if (!data.found) { - /* Failure! */ - fprintf(stderr, "Attempt to %s block ", action); - showBlock(memblk, 32); - fprintf(stderr, "\n"); - Memento_breakpointLocked(); - return 1; - } else if (data.preCorrupt || data.postCorrupt) { - fprintf(stderr, "Block "); - showBlock(memblk, ' '); - fprintf(stderr, " found to be corrupted on %s!\n", action); - if (data.preCorrupt) { - fprintf(stderr, "Preguard corrupted\n"); - } - if (data.postCorrupt) { - fprintf(stderr, "Postguard corrupted\n"); - } - fprintf(stderr, "Block last checked OK at allocation %d. Now %d.\n", - memblk->lastCheckedOK, memento.sequence); - if ((memblk->flags & Memento_Flag_Reported) == 0) - { - memblk->flags |= Memento_Flag_Reported; - Memento_breakpointLocked(); - } - return 1; - } -#endif - return 0; -} - -static void do_free(void *blk, int eventType) -{ - Memento_BlkHeader *memblk; - - if (Memento_event()) Memento_breakpointLocked(); - - if (blk == NULL) - return; - - memblk = MEMBLK_FROMBLK(blk); - VALGRIND_MAKE_MEM_DEFINED(memblk, sizeof(*memblk)); - if (checkBlock(memblk, "free")) - return; - -#ifdef MEMENTO_DETAILS - Memento_storeDetails(memblk, Memento_EventType_free); -#endif - - VALGRIND_MAKE_MEM_DEFINED(memblk, sizeof(*memblk)); - if (memblk->flags & Memento_Flag_BreakOnFree) - Memento_breakpointLocked(); - - memento.alloc -= memblk->rawsize; - memento.numFrees++; - - Memento_removeBlock(&memento.used, memblk); - - VALGRIND_MAKE_MEM_DEFINED(memblk, sizeof(*memblk)); - if (Memento_Internal_makeSpace(MEMBLK_SIZE(memblk->rawsize))) { - VALGRIND_MAKE_MEM_DEFINED(memblk, sizeof(*memblk)); - VALGRIND_MAKE_MEM_DEFINED(MEMBLK_TOBLK(memblk), - memblk->rawsize + Memento_PostSize); -#ifndef MEMENTO_LEAKONLY - memset(MEMBLK_TOBLK(memblk), MEMENTO_FREEFILL, memblk->rawsize); -#endif - memblk->flags |= Memento_Flag_Freed; - Memento_addBlockTail(&memento.free, memblk, 1); - } else { - free_block(memblk); - } -} - -void Memento_free(void *blk) -{ - if (!memento.inited) - Memento_init(); - - MEMENTO_LOCK(); - do_free(blk, Memento_EventType_free); - MEMENTO_UNLOCK(); -} - -static void *do_realloc(void *blk, size_t newsize, int type) -{ - Memento_BlkHeader *memblk, *newmemblk; - size_t newsizemem; - int flags; - - if (Memento_failThisEventLocked()) - return NULL; - - memblk = MEMBLK_FROMBLK(blk); - VALGRIND_MAKE_MEM_DEFINED(memblk, sizeof(*memblk)); - if (checkBlock(memblk, "realloc")) - return NULL; - -#ifdef MEMENTO_DETAILS - Memento_storeDetails(memblk, type); -#endif - - VALGRIND_MAKE_MEM_DEFINED(memblk, sizeof(*memblk)); - if (memblk->flags & Memento_Flag_BreakOnRealloc) - Memento_breakpointLocked(); - - VALGRIND_MAKE_MEM_DEFINED(memblk, sizeof(*memblk)); - if (memento.maxMemory != 0 && memento.alloc - memblk->rawsize + newsize > memento.maxMemory) - return NULL; - - newsizemem = MEMBLK_SIZE(newsize); - Memento_removeBlock(&memento.used, memblk); - VALGRIND_MAKE_MEM_DEFINED(memblk, sizeof(*memblk)); - flags = memblk->flags; - newmemblk = MEMENTO_UNDERLYING_REALLOC(memblk, newsizemem); - if (newmemblk == NULL) - { - Memento_addBlockHead(&memento.used, memblk, 2); - return NULL; - } - memento.numReallocs++; - memento.totalAlloc += newsize; - memento.alloc -= newmemblk->rawsize; - memento.alloc += newsize; - if (memento.peakAlloc < memento.alloc) - memento.peakAlloc = memento.alloc; - newmemblk->flags = flags; -#ifndef MEMENTO_LEAKONLY - if (newmemblk->rawsize < newsize) { - char *newbytes = ((char *)MEMBLK_TOBLK(newmemblk))+newmemblk->rawsize; - VALGRIND_MAKE_MEM_DEFINED(newbytes, newsize - newmemblk->rawsize); - memset(newbytes, MEMENTO_ALLOCFILL, newsize - newmemblk->rawsize); - VALGRIND_MAKE_MEM_UNDEFINED(newbytes, newsize - newmemblk->rawsize); - } -#endif - newmemblk->rawsize = newsize; -#ifndef MEMENTO_LEAKONLY - VALGRIND_MAKE_MEM_DEFINED(newmemblk->preblk, Memento_PreSize); - memset(newmemblk->preblk, MEMENTO_PREFILL, Memento_PreSize); - VALGRIND_MAKE_MEM_UNDEFINED(newmemblk->preblk, Memento_PreSize); - VALGRIND_MAKE_MEM_DEFINED(MEMBLK_POSTPTR(newmemblk), Memento_PostSize); - memset(MEMBLK_POSTPTR(newmemblk), MEMENTO_POSTFILL, Memento_PostSize); - VALGRIND_MAKE_MEM_UNDEFINED(MEMBLK_POSTPTR(newmemblk), Memento_PostSize); -#endif - Memento_addBlockHead(&memento.used, newmemblk, 2); - return MEMBLK_TOBLK(newmemblk); -} - -void *Memento_realloc(void *blk, size_t newsize) -{ - void *ret; - - if (!memento.inited) - Memento_init(); - - if (blk == NULL) - { - MEMENTO_LOCK(); - ret = do_malloc(newsize, Memento_EventType_realloc); - MEMENTO_UNLOCK(); - return ret; - } - if (newsize == 0) { - MEMENTO_LOCK(); - do_free(blk, Memento_EventType_realloc); - MEMENTO_UNLOCK(); - return NULL; - } - - MEMENTO_LOCK(); - ret = do_realloc(blk, newsize, Memento_EventType_realloc); - MEMENTO_UNLOCK(); - return ret; -} - -int Memento_checkBlock(void *blk) -{ - Memento_BlkHeader *memblk; - int ret; - - if (blk == NULL) - return 0; - - MEMENTO_LOCK(); - memblk = MEMBLK_FROMBLK(blk); - ret = checkBlockUser(memblk, "check"); - MEMENTO_UNLOCK(); - return ret; -} - -#ifndef MEMENTO_LEAKONLY -static int Memento_Internal_checkAllAlloced(Memento_BlkHeader *memblk, void *arg) -{ - BlkCheckData *data = (BlkCheckData *)arg; - - Memento_Internal_checkAllocedBlock(memblk, data); - if (data->preCorrupt || data->postCorrupt) { - if ((data->found & 2) == 0) { - fprintf(stderr, "Allocated blocks:\n"); - data->found |= 2; - } - fprintf(stderr, " Block "); - showBlock(memblk, ' '); - if (data->preCorrupt) { - fprintf(stderr, " Preguard "); - } - if (data->postCorrupt) { - fprintf(stderr, "%s Postguard ", - (data->preCorrupt ? "&" : "")); - } - fprintf(stderr, "corrupted.\n " - "Block last checked OK at allocation %d. Now %d.\n", - memblk->lastCheckedOK, memento.sequence); - data->preCorrupt = 0; - data->postCorrupt = 0; - data->freeCorrupt = 0; - if ((memblk->flags & Memento_Flag_Reported) == 0) - { - memblk->flags |= Memento_Flag_Reported; - Memento_breakpointLocked(); - } - } - else - memblk->lastCheckedOK = memento.sequence; - return 0; -} - -static int Memento_Internal_checkAllFreed(Memento_BlkHeader *memblk, void *arg) -{ - BlkCheckData *data = (BlkCheckData *)arg; - - Memento_Internal_checkFreedBlock(memblk, data); - if (data->preCorrupt || data->postCorrupt || data->freeCorrupt) { - if ((data->found & 4) == 0) { - fprintf(stderr, "Freed blocks:\n"); - data->found |= 4; - } - fprintf(stderr, " "); - showBlock(memblk, ' '); - if (data->freeCorrupt) { - fprintf(stderr, " index %d (address "FMTP") onwards", (int)data->index, - &((char *)MEMBLK_TOBLK(memblk))[data->index]); - if (data->preCorrupt) { - fprintf(stderr, "+ preguard"); - } - if (data->postCorrupt) { - fprintf(stderr, "+ postguard"); - } - } else { - if (data->preCorrupt) { - fprintf(stderr, " preguard"); - } - if (data->postCorrupt) { - fprintf(stderr, "%s Postguard", - (data->preCorrupt ? "+" : "")); - } - } - VALGRIND_MAKE_MEM_DEFINED(memblk, sizeof(Memento_BlkHeader)); - fprintf(stderr, " corrupted.\n" - " Block last checked OK at allocation %d. Now %d.\n", - memblk->lastCheckedOK, memento.sequence); - if ((memblk->flags & Memento_Flag_Reported) == 0) - { - memblk->flags |= Memento_Flag_Reported; - Memento_breakpointLocked(); - } - VALGRIND_MAKE_MEM_NOACCESS(memblk, sizeof(Memento_BlkHeader)); - data->preCorrupt = 0; - data->postCorrupt = 0; - data->freeCorrupt = 0; - } - else - memblk->lastCheckedOK = memento.sequence; - return 0; -} -#endif /* MEMENTO_LEAKONLY */ - -static int Memento_checkAllMemoryLocked(void) -{ -#ifndef MEMENTO_LEAKONLY - BlkCheckData data; - - memset(&data, 0, sizeof(data)); - Memento_appBlocks(&memento.used, Memento_Internal_checkAllAlloced, &data); - Memento_appBlocks(&memento.free, Memento_Internal_checkAllFreed, &data); - return data.found; -#else - return 0; -#endif -} - -int Memento_checkAllMemory(void) -{ -#ifndef MEMENTO_LEAKONLY - int ret; - - MEMENTO_LOCK(); - ret = Memento_checkAllMemoryLocked(); - MEMENTO_UNLOCK(); - if (ret & 6) { - Memento_breakpoint(); - return 1; - } - return 0; -#endif -} - -int Memento_setParanoia(int i) -{ - memento.paranoia = i; - if (memento.paranoia > 0) - memento.countdown = memento.paranoia; - else - memento.countdown = -memento.paranoia; - return i; -} - -int Memento_paranoidAt(int i) -{ - memento.paranoidAt = i; - return i; -} - -int Memento_getBlockNum(void *b) -{ - Memento_BlkHeader *memblk; - if (b == NULL) - return 0; - memblk = MEMBLK_FROMBLK(b); - return (memblk->sequence); -} - -int Memento_check(void) -{ - int result; - - fprintf(stderr, "Checking memory\n"); - result = Memento_checkAllMemory(); - fprintf(stderr, "Memory checked!\n"); - return result; -} - -int Memento_find(void *a) -{ - findBlkData data; - int s; - - MEMENTO_LOCK(); - data.addr = a; - data.blk = NULL; - data.flags = 0; - Memento_appBlocks(&memento.used, Memento_containsAddr, &data); - if (data.blk != NULL) { - fprintf(stderr, "Address "FMTP" is in %sallocated block ", - data.addr, - (data.flags == 1 ? "" : (data.flags == 2 ? - "preguard of " : "postguard of "))); - s = showBlock(data.blk, ' '); - fprintf(stderr, "\n"); - MEMENTO_UNLOCK(); - return s; - } - data.blk = NULL; - data.flags = 0; - Memento_appBlocks(&memento.free, Memento_containsAddr, &data); - if (data.blk != NULL) { - fprintf(stderr, "Address "FMTP" is in %sfreed block ", - data.addr, - (data.flags == 1 ? "" : (data.flags == 2 ? - "preguard of " : "postguard of "))); - s = showBlock(data.blk, ' '); - fprintf(stderr, "\n"); - MEMENTO_UNLOCK(); - return s; - } - MEMENTO_UNLOCK(); - return 0; -} - -void Memento_breakOnFree(void *a) -{ - findBlkData data; - - MEMENTO_LOCK(); - data.addr = a; - data.blk = NULL; - data.flags = 0; - Memento_appBlocks(&memento.used, Memento_containsAddr, &data); - if (data.blk != NULL) { - fprintf(stderr, "Will stop when address "FMTP" (in %sallocated block ", - data.addr, - (data.flags == 1 ? "" : (data.flags == 2 ? - "preguard of " : "postguard of "))); - showBlock(data.blk, ' '); - fprintf(stderr, ") is freed\n"); - VALGRIND_MAKE_MEM_DEFINED(data.blk, sizeof(Memento_BlkHeader)); - data.blk->flags |= Memento_Flag_BreakOnFree; - VALGRIND_MAKE_MEM_NOACCESS(data.blk, sizeof(Memento_BlkHeader)); - MEMENTO_UNLOCK(); - return; - } - data.blk = NULL; - data.flags = 0; - Memento_appBlocks(&memento.free, Memento_containsAddr, &data); - if (data.blk != NULL) { - fprintf(stderr, "Can't stop on free; address "FMTP" is in %sfreed block ", - data.addr, - (data.flags == 1 ? "" : (data.flags == 2 ? - "preguard of " : "postguard of "))); - showBlock(data.blk, ' '); - fprintf(stderr, "\n"); - MEMENTO_UNLOCK(); - return; - } - fprintf(stderr, "Can't stop on free; address "FMTP" is not in a known block.\n", a); - MEMENTO_UNLOCK(); -} - -void Memento_breakOnRealloc(void *a) -{ - findBlkData data; - - MEMENTO_LOCK(); - data.addr = a; - data.blk = NULL; - data.flags = 0; - Memento_appBlocks(&memento.used, Memento_containsAddr, &data); - if (data.blk != NULL) { - fprintf(stderr, "Will stop when address "FMTP" (in %sallocated block ", - data.addr, - (data.flags == 1 ? "" : (data.flags == 2 ? - "preguard of " : "postguard of "))); - showBlock(data.blk, ' '); - fprintf(stderr, ") is freed (or realloced)\n"); - VALGRIND_MAKE_MEM_DEFINED(data.blk, sizeof(Memento_BlkHeader)); - data.blk->flags |= Memento_Flag_BreakOnFree | Memento_Flag_BreakOnRealloc; - VALGRIND_MAKE_MEM_NOACCESS(data.blk, sizeof(Memento_BlkHeader)); - MEMENTO_UNLOCK(); - return; - } - data.blk = NULL; - data.flags = 0; - Memento_appBlocks(&memento.free, Memento_containsAddr, &data); - if (data.blk != NULL) { - fprintf(stderr, "Can't stop on free/realloc; address "FMTP" is in %sfreed block ", - data.addr, - (data.flags == 1 ? "" : (data.flags == 2 ? - "preguard of " : "postguard of "))); - showBlock(data.blk, ' '); - fprintf(stderr, "\n"); - MEMENTO_UNLOCK(); - return; - } - fprintf(stderr, "Can't stop on free/realloc; address "FMTP" is not in a known block.\n", a); - MEMENTO_UNLOCK(); -} - -int Memento_failAt(int i) -{ - memento.failAt = i; - if ((memento.sequence > memento.failAt) && - (memento.failing != 0)) - Memento_startFailing(); - return i; -} - -size_t Memento_setMax(size_t max) -{ - memento.maxMemory = max; - return max; -} - -void Memento_startLeaking(void) -{ - memento.leaking++; -} - -void Memento_stopLeaking(void) -{ - memento.leaking--; -} - -int Memento_squeezing(void) -{ - return memento.squeezing; -} - -#endif /* MEMENTO_CPP_EXTRAS_ONLY */ - -#ifdef __cplusplus -/* Dumb overrides for the new and delete operators */ - -void *operator new(size_t size) -{ - void *ret; - - if (!memento.inited) - Memento_init(); - - if (size == 0) - size = 1; - MEMENTO_LOCK(); - ret = do_malloc(size, Memento_EventType_new); - MEMENTO_UNLOCK(); - return ret; -} - -void operator delete(void *pointer) -{ - if (!pointer) - return; - - MEMENTO_LOCK(); - do_free(pointer, Memento_EventType_delete); - MEMENTO_UNLOCK(); -} - -/* Some C++ systems (apparently) don't provide new[] or delete[] - * operators. Provide a way to cope with this */ -#ifndef MEMENTO_CPP_NO_ARRAY_CONSTRUCTORS -void *operator new[](size_t size) -{ - void *ret; - if (!memento.inited) - Memento_init(); - - if (size == 0) - size = 1; - MEMENTO_LOCK(); - ret = do_malloc(size, Memento_EventType_newArray); - MEMENTO_UNLOCK(); - return ret; -} - -void operator delete[](void *pointer) -{ - MEMENTO_LOCK(); - do_free(pointer, Memento_EventType_deleteArray); - MEMENTO_UNLOCK(); -} -#endif /* MEMENTO_CPP_NO_ARRAY_CONSTRUCTORS */ -#endif /* __cplusplus */ - -#else - -/* Just in case anyone has left some debugging code in... */ -void (Memento_breakpoint)(void) -{ -} - -int (Memento_checkBlock)(void *b) -{ - return 0; -} - -int (Memento_checkAllMemory)(void) -{ - return 0; -} - -int (Memento_check)(void) -{ - return 0; -} - -int (Memento_setParanoia)(int i) -{ - return 0; -} - -int (Memento_paranoidAt)(int i) -{ - return 0; -} - -int (Memento_breakAt)(int i) -{ - return 0; -} - -int (Memento_getBlockNum)(void *i) -{ - return 0; -} - -int (Memento_find)(void *a) -{ - return 0; -} - -int (Memento_failAt)(int i) -{ - return 0; -} - -void (Memento_breakOnFree)(void *a) -{ -} - -void (Memento_breakOnRealloc)(void *a) -{ -} - -void *(Memento_takeRef)(void *a) -{ - return a; -} - -void *(Memento_dropRef)(void *a) -{ - return a; -} - -void *(Memento_adjustRef)(void *a, int adjust) -{ - return a; -} - -void *(Memento_reference)(void *a) -{ - return a; -} - -#undef Memento_malloc -#undef Memento_free -#undef Memento_realloc -#undef Memento_calloc - -void *Memento_malloc(size_t size) -{ - return MEMENTO_UNDERLYING_MALLOC(size); -} - -void Memento_free(void *b) -{ - MEMENTO_UNDERLYING_FREE(b); -} - -void *Memento_realloc(void *b, size_t s) -{ - return MEMENTO_UNDERLYING_REALLOC(b, s); -} - -void *Memento_calloc(size_t n, size_t s) -{ - return MEMENTO_UNDERLYING_CALLOC(n, s); -} - -void (Memento_listBlocks)(void) -{ -} - -void (Memento_listNewBlocks)(void) -{ -} - -size_t (Memento_setMax)(size_t max) -{ - return 0; -} - -void (Memento_stats)(void) -{ -} - -void *(Memento_label)(void *ptr, const char *label) -{ - return ptr; -} - -void (Memento_info)(void *addr) -{ -} - -void (Memento_listBlockInfo)(void) -{ -} - -void (Memento_startLeaking)(void) -{ -} - -void (Memento_stopLeaking)(void) -{ -} - -int (Memento_squeezing)(void) -{ - return 0; -} - -#endif diff --git a/pdfpatcher/JBig2/src/pbm2png.c b/pdfpatcher/JBig2/src/pbm2png.c deleted file mode 100644 index c1e6a855e812ff9e7caa65ec820b904b776a0a1d..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/pbm2png.c +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - -/* - jbig2dec -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#include "config_types.h" -#elif _WIN32 -#include "config_win32.h" -#endif -#ifdef HAVE_STDINT_H -#include -#endif - -#include -#include -#include - -#include "jbig2.h" -#include "jbig2_image.h" -#include "jbig2_image_rw.h" - -int -main(int argc, char *argv[]) -{ - Jbig2Ctx *ctx; - Jbig2Image *image; - int code; - - /* we need a context for the allocators */ - ctx = jbig2_ctx_new(NULL, 0, NULL, NULL, NULL); - - if (argc != 3) { - fprintf(stderr, "usage: %s \n\n", argv[0]); - return 1; - } - - image = jbig2_image_read_pbm_file(ctx, argv[1]); - if (image == NULL) { - fprintf(stderr, "error reading pbm file '%s'\n", argv[1]); - return 1; - } else { - fprintf(stderr, "converting %dx%d image to png format\n", image->width, image->height); - } - - code = jbig2_image_write_png_file(image, argv[2]); - if (code) { - fprintf(stderr, "error writing png file '%s' error %d\n", argv[2], code); - } - - return (code); -} diff --git a/pdfpatcher/JBig2/src/sha1.c b/pdfpatcher/JBig2/src/sha1.c deleted file mode 100644 index 1c691cc0f8a4183f4cfa9886aec587fa7caf4630..0000000000000000000000000000000000000000 --- a/pdfpatcher/JBig2/src/sha1.c +++ /dev/null @@ -1,376 +0,0 @@ -/* -SHA-1 in C -By Steve Reid -100% Public Domain - ------------------ -Modified 7/98 -By James H. Brown -Still 100% Public Domain - -Corrected a problem which generated improper hash values on 16 bit machines -Routine SHA1Update changed from - void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int -len) -to - void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned -long len) - -The 'len' parameter was declared an int which works fine on 32 bit machines. -However, on 16 bit machines an int is too small for the shifts being done -against -it. This caused the hash function to generate incorrect values if len was -greater than 8191 (8K - 1) due to the 'len << 3' on line 3 of SHA1Update(). - -Since the file IO in main() reads 16K at a time, any file 8K or larger would -be guaranteed to generate the wrong hash (e.g. Test Vector #3, a million -"a"s). - -I also changed the declaration of variables i & j in SHA1Update to -unsigned long from unsigned int for the same reason. - -These changes should make no difference to any 32 bit implementations since -an -int and a long are the same size in those environments. - --- -I also corrected a few compiler warnings generated by Borland C. -1. Added #include for exit() prototype -2. Removed unused variable 'j' in SHA1Final -3. Changed exit(0) to return(0) at end of main. - -ALL changes I made can be located by searching for comments containing 'JHB' ------------------ -Modified 8/98 -By Steve Reid -Still 100% public domain - -1- Removed #include and used return() instead of exit() -2- Fixed overwriting of finalcount in SHA1Final() (discovered by Chris Hall) -3- Changed email address from steve@edmweb.com to sreid@sea-to-sky.net - ------------------ -Modified 4/01 -By Saul Kravitz -Still 100% PD -Modified to run on Compaq Alpha hardware. - ------------------ -Modified 07/2002 -By Ralph Giles -Still 100% public domain -modified for use with stdint types, autoconf -code cleanup, removed attribution comments -switched SHA1Final() argument order for consistency -use SHA1_ prefix for public api -move public api to sha1.h -*/ - -/* -Test Vectors (from FIPS PUB 180-1) -"abc" - A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D -"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" - 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 -A million repetitions of "a" - 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F -*/ - -/* #define SHA1HANDSOFF */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -#include "os_types.h" -#include "sha1.h" - -void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64]); - -#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) - -/* blk0() and blk() perform the initial expand. */ -/* I got the idea of expanding during the round function from SSLeay */ -/* FIXME: can we do this in an endian-proof way? */ -#ifdef WORDS_BIGENDIAN -#define blk0(i) block->l[i] -#else -#define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \ - |(rol(block->l[i],8)&0x00FF00FF)) -#endif -#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \ - ^block->l[(i+2)&15]^block->l[i&15],1)) - -/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ -#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); -#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); -#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); -#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); -#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); - -#ifdef VERBOSE /* SAK */ -void -SHAPrintContext(SHA1_CTX *context, char *msg) -{ - printf("%s (%d,%d) %x %x %x %x %x\n", - msg, context->count[0], context->count[1], context->state[0], context->state[1], context->state[2], context->state[3], context->state[4]); -} -#endif /* VERBOSE */ - -/* Hash a single 512-bit block. This is the core of the algorithm. */ -void -SHA1_Transform(uint32_t state[5], const uint8_t buffer[64]) -{ - uint32_t a, b, c, d, e; - typedef union { - uint8_t c[64]; - uint32_t l[16]; - } CHAR64LONG16; - CHAR64LONG16 *block; - -#ifdef SHA1HANDSOFF - static uint8_t workspace[64]; - - block = (CHAR64LONG16 *) workspace; - memcpy(block, buffer, 64); -#else - block = (CHAR64LONG16 *) buffer; -#endif - - /* Copy context->state[] to working vars */ - a = state[0]; - b = state[1]; - c = state[2]; - d = state[3]; - e = state[4]; - - /* 4 rounds of 20 operations each. Loop unrolled. */ - R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3); - R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7); - R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11); - R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15); - R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19); - R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23); - R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27); - R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31); - R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35); - R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39); - R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43); - R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47); - R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51); - R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55); - R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59); - R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63); - R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67); - R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71); - R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75); - R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79); - - /* Add the working vars back into context.state[] */ - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; - state[4] += e; - - /* Wipe variables */ - a = b = c = d = e = 0; -} - -/* SHA1Init - Initialize new context */ -void -SHA1_Init(SHA1_CTX *context) -{ - /* SHA1 initialization constants */ - context->state[0] = 0x67452301; - context->state[1] = 0xEFCDAB89; - context->state[2] = 0x98BADCFE; - context->state[3] = 0x10325476; - context->state[4] = 0xC3D2E1F0; - context->count[0] = context->count[1] = 0; -} - -/* Run your data through this. */ -void -SHA1_Update(SHA1_CTX *context, const uint8_t *data, const size_t len) -{ - size_t i, j; - -#ifdef VERBOSE - SHAPrintContext(context, "before"); -#endif - - j = (context->count[0] >> 3) & 63; - if ((context->count[0] += len << 3) < (len << 3)) - context->count[1]++; - context->count[1] += (len >> 29); - if ((j + len) > 63) { - memcpy(&context->buffer[j], data, (i = 64 - j)); - SHA1_Transform(context->state, context->buffer); - for (; i + 63 < len; i += 64) { - SHA1_Transform(context->state, data + i); - } - j = 0; - } else - i = 0; - memcpy(&context->buffer[j], &data[i], len - i); - -#ifdef VERBOSE - SHAPrintContext(context, "after "); -#endif -} - -/* Add padding and return the message digest. */ -void -SHA1_Final(SHA1_CTX *context, uint8_t digest[SHA1_DIGEST_SIZE]) -{ - uint32_t i; - uint8_t finalcount[8]; - - for (i = 0; i < 8; i++) { - finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)] - >> ((3 - (i & 3)) * 8)) & 255); /* Endian independent */ - } - SHA1_Update(context, (uint8_t *) "\200", 1); - while ((context->count[0] & 504) != 448) { - SHA1_Update(context, (uint8_t *) "\0", 1); - } - SHA1_Update(context, finalcount, 8); /* Should cause a SHA1_Transform() */ - for (i = 0; i < SHA1_DIGEST_SIZE; i++) { - digest[i] = (uint8_t) - ((context->state[i >> 2] >> ((3 - (i & 3)) * 8)) & 255); - } - - /* Wipe variables */ - i = 0; - memset(context->buffer, 0, 64); - memset(context->state, 0, 20); - memset(context->count, 0, 8); - memset(finalcount, 0, 8); /* SWR */ - -#ifdef SHA1HANDSOFF /* make SHA1Transform overwrite its own static vars */ - SHA1_Transform(context->state, context->buffer); -#endif -} - -/*************************************************************/ - -#if 0 -int -main(int argc, char **argv) -{ - int i, j; - SHA1_CTX context; - unsigned char digest[SHA1_DIGEST_SIZE], buffer[16384]; - FILE *file; - - if (argc > 2) { - puts("Public domain SHA-1 implementation - by Steve Reid "); - puts("Modified for 16 bit environments 7/98 - by James H. Brown "); /* JHB */ - puts("Produces the SHA-1 hash of a file, or stdin if no file is specified."); - return (0); - } - if (argc < 2) { - file = stdin; - } else { - if (!(file = fopen(argv[1], "rb"))) { - fputs("Unable to open file.", stderr); - return (-1); - } - } - SHA1_Init(&context); - while (!feof(file)) { /* note: what if ferror(file) */ - i = fread(buffer, 1, 16384, file); - SHA1_Update(&context, buffer, i); - } - SHA1_Final(&context, digest); - fclose(file); - for (i = 0; i < SHA1_DIGEST_SIZE / 4; i++) { - for (j = 0; j < 4; j++) { - printf("%02X", digest[i * 4 + j]); - } - putchar(' '); - } - putchar('\n'); - return (0); /* JHB */ -} -#endif - -/* self test */ - -#ifdef TEST - -static char *test_data[] = { - "abc", - "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - "A million repetitions of 'a'" -}; -static char *test_results[] = { - "A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D", - "84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1", - "34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F" -}; - -void -digest_to_hex(const uint8_t digest[SHA1_DIGEST_SIZE], char *output) -{ - int i, j; - char *c = output; - - for (i = 0; i < SHA1_DIGEST_SIZE / 4; i++) { - for (j = 0; j < 4; j++) { - sprintf(c, "%02X", digest[i * 4 + j]); - c += 2; - } - sprintf(c, " "); - c += 1; - } - *(c - 1) = '\0'; -} - -int -main(int argc, char **argv) -{ - int k; - SHA1_CTX context; - uint8_t digest[20]; - char output[80]; - - fprintf(stdout, "verifying SHA-1 implementation... "); - - for (k = 0; k < 2; k++) { - SHA1_Init(&context); - SHA1_Update(&context, (uint8_t *) test_data[k], strlen(test_data[k])); - SHA1_Final(&context, digest); - digest_to_hex(digest, output); - - if (strcmp(output, test_results[k])) { - fprintf(stdout, "FAIL\n"); - fprintf(stderr, "* hash of \"%s\" incorrect:\n", test_data[k]); - fprintf(stderr, "\t%s returned\n", output); - fprintf(stderr, "\t%s is correct\n", test_results[k]); - return (1); - } - } - /* million 'a' vector we feed separately */ - SHA1_Init(&context); - for (k = 0; k < 1000000; k++) - SHA1_Update(&context, (uint8_t *) "a", 1); - SHA1_Final(&context, digest); - digest_to_hex(digest, output); - if (strcmp(output, test_results[2])) { - fprintf(stdout, "FAIL\n"); - fprintf(stderr, "* hash of \"%s\" incorrect:\n", test_data[2]); - fprintf(stderr, "\t%s returned\n", output); - fprintf(stderr, "\t%s is correct\n", test_results[2]); - return (1); - } - - /* success */ - fprintf(stdout, "ok\n"); - return (0); -} -#endif /* TEST */ diff --git a/pdfpatcher/PDFPatcher.sln b/pdfpatcher/PDFPatcher.sln deleted file mode 100644 index 0a516f5687050fed65d7a42632e2116f17b6e58c..0000000000000000000000000000000000000000 --- a/pdfpatcher/PDFPatcher.sln +++ /dev/null @@ -1,66 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.2.32210.308 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDFPatcher", "App\PDFPatcher.csproj", "{77A9FBD2-FB25-4590-864A-64A01A8724C4}" - ProjectSection(ProjectDependencies) = postProject - {A8C76A16-25E3-45B6-B974-4F4CB88E5AE2} = {A8C76A16-25E3-45B6-B974-4F4CB88E5AE2} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jbig2", "JBig2\jbig2.vcxproj", "{A8C76A16-25E3-45B6-B974-4F4CB88E5AE2}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3243E921-0EC3-44D1-96CC-C3E05BF9C89B}" - ProjectSection(SolutionItems) = preProject - .gitattributes = .gitattributes - .gitignore = .gitignore - README.md = README.md - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {77A9FBD2-FB25-4590-864A-64A01A8724C4}.Debug|Any CPU.ActiveCfg = Debug|x86 - {77A9FBD2-FB25-4590-864A-64A01A8724C4}.Debug|Any CPU.Build.0 = Debug|x86 - {77A9FBD2-FB25-4590-864A-64A01A8724C4}.Debug|Win32.ActiveCfg = Debug|x86 - {77A9FBD2-FB25-4590-864A-64A01A8724C4}.Debug|Win32.Build.0 = Debug|x86 - {77A9FBD2-FB25-4590-864A-64A01A8724C4}.Debug|x64.ActiveCfg = Debug|x86 - {77A9FBD2-FB25-4590-864A-64A01A8724C4}.Debug|x86.ActiveCfg = Debug|x86 - {77A9FBD2-FB25-4590-864A-64A01A8724C4}.Debug|x86.Build.0 = Debug|x86 - {77A9FBD2-FB25-4590-864A-64A01A8724C4}.Release|Any CPU.ActiveCfg = Release|x86 - {77A9FBD2-FB25-4590-864A-64A01A8724C4}.Release|Win32.ActiveCfg = Release|x86 - {77A9FBD2-FB25-4590-864A-64A01A8724C4}.Release|Win32.Build.0 = Release|x86 - {77A9FBD2-FB25-4590-864A-64A01A8724C4}.Release|x64.ActiveCfg = Release|x86 - {77A9FBD2-FB25-4590-864A-64A01A8724C4}.Release|x86.ActiveCfg = Release|x86 - {77A9FBD2-FB25-4590-864A-64A01A8724C4}.Release|x86.Build.0 = Release|x86 - {A8C76A16-25E3-45B6-B974-4F4CB88E5AE2}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {A8C76A16-25E3-45B6-B974-4F4CB88E5AE2}.Debug|Win32.ActiveCfg = Debug|Win32 - {A8C76A16-25E3-45B6-B974-4F4CB88E5AE2}.Debug|Win32.Build.0 = Debug|Win32 - {A8C76A16-25E3-45B6-B974-4F4CB88E5AE2}.Debug|x64.ActiveCfg = Debug|x64 - {A8C76A16-25E3-45B6-B974-4F4CB88E5AE2}.Debug|x64.Build.0 = Debug|x64 - {A8C76A16-25E3-45B6-B974-4F4CB88E5AE2}.Debug|x86.ActiveCfg = Debug|Win32 - {A8C76A16-25E3-45B6-B974-4F4CB88E5AE2}.Debug|x86.Build.0 = Debug|Win32 - {A8C76A16-25E3-45B6-B974-4F4CB88E5AE2}.Release|Any CPU.ActiveCfg = Release|Win32 - {A8C76A16-25E3-45B6-B974-4F4CB88E5AE2}.Release|Win32.ActiveCfg = Release|Win32 - {A8C76A16-25E3-45B6-B974-4F4CB88E5AE2}.Release|Win32.Build.0 = Release|Win32 - {A8C76A16-25E3-45B6-B974-4F4CB88E5AE2}.Release|x64.ActiveCfg = Release|x64 - {A8C76A16-25E3-45B6-B974-4F4CB88E5AE2}.Release|x64.Build.0 = Release|x64 - {A8C76A16-25E3-45B6-B974-4F4CB88E5AE2}.Release|x86.ActiveCfg = Release|Win32 - {A8C76A16-25E3-45B6-B974-4F4CB88E5AE2}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {2A79F8C5-2A16-4D1C-9DCD-C6FA86808545} - EndGlobalSection -EndGlobal diff --git a/pdfpatcher/doc/example.xml b/pdfpatcher/doc/example.xml deleted file mode 100644 index 21bfb5c2826e45f317959fe4cb8281af9159414a..0000000000000000000000000000000000000000 --- a/pdfpatcher/doc/example.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - <λ λ="" /> - <ĵǩ> - <ǩ ҳ="1" ı="" ="תҳ" /> - <ǩ ҳ="2" ı="ǩ1" ="תҳ"> - <ǩ ҳ="3" ı="ǩ1" ="תҳ"> - <ǩ ҳ="3" ı="ǩ1" ="תҳ" /> - - <ǩ ҳ="4" ı="ǩ2" ="תҳ" /> - <ǩ ҳ="5" ı="ǩ3" ="תҳ" /> - - <ǩ ҳ="10" ı="ǩ2" ="תҳ" /> - - \ No newline at end of file diff --git a/pdfpatcher/doc/media/image1.png b/pdfpatcher/doc/media/image1.png deleted file mode 100644 index 7ad121fcaa6699241ad7d98aeea7831b52df734e..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image1.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image10.png b/pdfpatcher/doc/media/image10.png deleted file mode 100644 index 5446d9354f03c4848b39505aaab4805d9b3ceb20..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image10.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image11.png b/pdfpatcher/doc/media/image11.png deleted file mode 100644 index 5ca89c595d0c34ca709498e08b0ae2e8eaeca246..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image11.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image12.png b/pdfpatcher/doc/media/image12.png deleted file mode 100644 index d514f58a60683dec8a88a0c9e6a8757461913c32..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image12.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image13.png b/pdfpatcher/doc/media/image13.png deleted file mode 100644 index 63a8c4559de927a274a96a0328aca0fd177816af..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image13.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image14.png b/pdfpatcher/doc/media/image14.png deleted file mode 100644 index fc8764f83e02288103394af2e092644bee50e853..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image14.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image15.png b/pdfpatcher/doc/media/image15.png deleted file mode 100644 index 244058f1f10d2ca03be0153e868630be24472db0..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image15.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image16.png b/pdfpatcher/doc/media/image16.png deleted file mode 100644 index f57070cbb3371fe4dcd93d5bf8703eb2edd7a580..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image16.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image17.png b/pdfpatcher/doc/media/image17.png deleted file mode 100644 index 92742abca2eadf43b7ba940279f1cb2ffaba7400..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image17.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image18.png b/pdfpatcher/doc/media/image18.png deleted file mode 100644 index 179ac3071567e0e0505451b60c6be579fc459c08..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image18.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image19.png b/pdfpatcher/doc/media/image19.png deleted file mode 100644 index 7a0b29773d11c3a6e4be12f68cbe084c176f985b..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image19.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image2.png b/pdfpatcher/doc/media/image2.png deleted file mode 100644 index 181ba96a1b8279585af3a3a8adef14de74d0c142..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image2.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image20.png b/pdfpatcher/doc/media/image20.png deleted file mode 100644 index 28cf148ace09d573559a7041e4acbdfdb0240010..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image20.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image21.png b/pdfpatcher/doc/media/image21.png deleted file mode 100644 index dfae73dbbed08eb19261345ddbbc562915bf7346..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image21.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image22.png b/pdfpatcher/doc/media/image22.png deleted file mode 100644 index d9b731b3b872b792522dab62765af3373338cdb6..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image22.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image23.png b/pdfpatcher/doc/media/image23.png deleted file mode 100644 index 4057a3f2875f1d0a96c906c283aa46c7a0d3b059..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image23.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image24.PNG b/pdfpatcher/doc/media/image24.PNG deleted file mode 100644 index 4a3f6ee6f371686b75fa661978c58d644ea66cb7..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image24.PNG and /dev/null differ diff --git a/pdfpatcher/doc/media/image25.png b/pdfpatcher/doc/media/image25.png deleted file mode 100644 index 1a4fbe56e6e3f4e1510293973cb0530adeca6b18..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image25.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image26.png b/pdfpatcher/doc/media/image26.png deleted file mode 100644 index 1b471be45c607e24acdbf6569a430617308c1da3..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image26.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image27.png b/pdfpatcher/doc/media/image27.png deleted file mode 100644 index afa5b0e14e9fa3b4b2943a432d6a1fbb6684b3c2..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image27.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image28.png b/pdfpatcher/doc/media/image28.png deleted file mode 100644 index 8833a31a7e67f9fddd0f1c4fb844623075ead829..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image28.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image29.PNG b/pdfpatcher/doc/media/image29.PNG deleted file mode 100644 index d4e6bc1426578bfd184529712e01f1c82158603f..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image29.PNG and /dev/null differ diff --git a/pdfpatcher/doc/media/image3.png b/pdfpatcher/doc/media/image3.png deleted file mode 100644 index 616d83c083cf308f1bd1b7c7772801bc4398948d..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image3.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image30.jpeg b/pdfpatcher/doc/media/image30.jpeg deleted file mode 100644 index 61468c3dfa02fcccdaa6fecd14c361920982858d..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image30.jpeg and /dev/null differ diff --git a/pdfpatcher/doc/media/image31.PNG b/pdfpatcher/doc/media/image31.PNG deleted file mode 100644 index 1a94cf3e9f9f36f4c01b0b4568faebf9da813bff..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image31.PNG and /dev/null differ diff --git a/pdfpatcher/doc/media/image32.png b/pdfpatcher/doc/media/image32.png deleted file mode 100644 index daea1b5230e02869b31ccdb33ddf739aa64c9a3c..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image32.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image33.png b/pdfpatcher/doc/media/image33.png deleted file mode 100644 index 14611f8d2b2fc66d32765158431fda0d3adb0edc..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image33.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image34.png b/pdfpatcher/doc/media/image34.png deleted file mode 100644 index 9365bfcbf48aa031cc3bf50bee0c638ccf9d5489..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image34.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image35.png b/pdfpatcher/doc/media/image35.png deleted file mode 100644 index d357ce85a693504f0c64a04b6f5094b6534c8375..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image35.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image36.png b/pdfpatcher/doc/media/image36.png deleted file mode 100644 index ad9e1e06a07c82a00f21fec6251f07a28c227067..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image36.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image37.png b/pdfpatcher/doc/media/image37.png deleted file mode 100644 index 59048b23beced25028a46e23020f1e8fdbeb72c2..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image37.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image38.png b/pdfpatcher/doc/media/image38.png deleted file mode 100644 index a18027d28047efb542c2da14119d353d4ffd22ad..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image38.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image39.png b/pdfpatcher/doc/media/image39.png deleted file mode 100644 index ee38d3d59909662784825f843aeddd6be24e2b10..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image39.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image4.png b/pdfpatcher/doc/media/image4.png deleted file mode 100644 index 53a354d3c1511ce6e3e23447bbe4a5c4f03cfb09..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image4.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image40.png b/pdfpatcher/doc/media/image40.png deleted file mode 100644 index a246397f34fdb0833a1e6d70160f9c1f183d25ce..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image40.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image41.png b/pdfpatcher/doc/media/image41.png deleted file mode 100644 index be0e0f7296e7d09a405cc931ba8cf6037a4ce791..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image41.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image42.png b/pdfpatcher/doc/media/image42.png deleted file mode 100644 index d39c18df53d65e2604dfb3e114392ae84d6577df..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image42.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image43.png b/pdfpatcher/doc/media/image43.png deleted file mode 100644 index 1f793c5636b68061c6bb986125d31daf39639854..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image43.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image44.png b/pdfpatcher/doc/media/image44.png deleted file mode 100644 index 1e85366ab1286f3a1e37b494b53e546c7e9c6dd1..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image44.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image45.png b/pdfpatcher/doc/media/image45.png deleted file mode 100644 index f42f03ae242fc3313c2406dca8bda91a3bab73cb..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image45.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image46.png b/pdfpatcher/doc/media/image46.png deleted file mode 100644 index eb3d58ed52283a49ba8a4391a202056452a48003..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image46.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image47.png b/pdfpatcher/doc/media/image47.png deleted file mode 100644 index c8a7754a62bf6d70c10170e2bae24944d7277741..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image47.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image48.png b/pdfpatcher/doc/media/image48.png deleted file mode 100644 index 4217615dc8b3e62da62e582b76b99ce5ca1dabef..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image48.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image49.png b/pdfpatcher/doc/media/image49.png deleted file mode 100644 index 81e4ba3ab926e7b1625c132e6c4113ff16c3be94..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image49.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image5.png b/pdfpatcher/doc/media/image5.png deleted file mode 100644 index f13bbce143263e73bbd9562170ba1877e6ab5675..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image5.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image50.png b/pdfpatcher/doc/media/image50.png deleted file mode 100644 index 2cf2c3ba783e6a101974b68d9712c6d9da760821..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image50.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image51.png b/pdfpatcher/doc/media/image51.png deleted file mode 100644 index 60cb66b8bd88d9f149cf5c79c156a2b126d9b6b8..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image51.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image52.png b/pdfpatcher/doc/media/image52.png deleted file mode 100644 index 1ec969d45beeba0f7bc9e4995ed55a983a0b9cb9..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image52.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image53.png b/pdfpatcher/doc/media/image53.png deleted file mode 100644 index 86d4b86614dc2bc8cb79ad8f71f53432f8dcc961..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image53.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image54.png b/pdfpatcher/doc/media/image54.png deleted file mode 100644 index 99753bf0b1c87eaa3c8e95485d12ee34c66e2dcb..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image54.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image55.png b/pdfpatcher/doc/media/image55.png deleted file mode 100644 index bab4754542687b87b4a61091bc99d883a180dc2b..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image55.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image56.png b/pdfpatcher/doc/media/image56.png deleted file mode 100644 index 5bc91fdc258156a99be4dfdb5a4eb09fa9356295..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image56.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image57.png b/pdfpatcher/doc/media/image57.png deleted file mode 100644 index 11733b604463eed2a026297bebc262d3648d304b..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image57.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image58.png b/pdfpatcher/doc/media/image58.png deleted file mode 100644 index bfb3031276c71e98548f692475061095b7e3e062..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image58.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image59.png b/pdfpatcher/doc/media/image59.png deleted file mode 100644 index 060977a05f0d3e2dd8fa7cc80dfeee22502378f4..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image59.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image6.png b/pdfpatcher/doc/media/image6.png deleted file mode 100644 index f1203dcc1860ca841d06271cda1dac074a68ffdb..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image6.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image60.png b/pdfpatcher/doc/media/image60.png deleted file mode 100644 index ac0b3e42fba7dc16f062cc201de199a8cc90c7f1..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image60.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image61.png b/pdfpatcher/doc/media/image61.png deleted file mode 100644 index 31b5f4bff36bf1a94748244bee42f5b5474a8f3e..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image61.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image62.png b/pdfpatcher/doc/media/image62.png deleted file mode 100644 index 1b9d3e8e8849900b970138d77ae0e351ce62f1be..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image62.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image63.png b/pdfpatcher/doc/media/image63.png deleted file mode 100644 index 3c29951c13e9ab4ffabfb2d971e218bc993f1490..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image63.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image64.png b/pdfpatcher/doc/media/image64.png deleted file mode 100644 index dc5b13a616f7b9d30fbfa8865500af25237c3bbd..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image64.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image65.png b/pdfpatcher/doc/media/image65.png deleted file mode 100644 index 1e88c1d325d7c664e6bd1dfd2792fb5ed811f2f1..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image65.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image66.png b/pdfpatcher/doc/media/image66.png deleted file mode 100644 index 94a2181fff469ca4fb0c96cbf700d60f6ea1a9dc..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image66.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image67.png b/pdfpatcher/doc/media/image67.png deleted file mode 100644 index 82a3cd6992368f987ec3b77f2d069c9c2ea81823..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image67.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image68.png b/pdfpatcher/doc/media/image68.png deleted file mode 100644 index d959209fdbfa2bac08fc2e7e3a33a16c57c7b583..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image68.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image69.png b/pdfpatcher/doc/media/image69.png deleted file mode 100644 index 5a26d728f559c55d80291e01c39d302dd4631fc0..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image69.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image7.png b/pdfpatcher/doc/media/image7.png deleted file mode 100644 index 836fc26249567506651577d6c918cbd8d6be56ea..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image7.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image70.png b/pdfpatcher/doc/media/image70.png deleted file mode 100644 index 4b042e58f5b66ba0ff1b52ed65ac76c55a193b99..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image70.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image71.png b/pdfpatcher/doc/media/image71.png deleted file mode 100644 index 2761d902968a50ab6af1809439ab310f88cd07ce..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image71.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image72.png b/pdfpatcher/doc/media/image72.png deleted file mode 100644 index 04969bce8f1087e1df94dcb242d208a1e33ba70a..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image72.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image73.png b/pdfpatcher/doc/media/image73.png deleted file mode 100644 index a8ba6f463d1b661b94dfc5c85a7329c2baba639a..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image73.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image74.png b/pdfpatcher/doc/media/image74.png deleted file mode 100644 index 59f9d0c57030b8e2a34178a3a37a8009866b0660..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image74.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image75.png b/pdfpatcher/doc/media/image75.png deleted file mode 100644 index f6825df99c406c5ea1ad0604f96e4921496515fa..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image75.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image76.png b/pdfpatcher/doc/media/image76.png deleted file mode 100644 index 47cbfb94e0e63cbeb792f0691d048fa3032591c7..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image76.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image77.png b/pdfpatcher/doc/media/image77.png deleted file mode 100644 index 153c09bf1ff417c8d50aea25e8d7eb46a97625e8..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image77.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image78.png b/pdfpatcher/doc/media/image78.png deleted file mode 100644 index 39c30f6a6bd6328c03a7e324a0ab62e3ee4728e4..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image78.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image79.png b/pdfpatcher/doc/media/image79.png deleted file mode 100644 index d60c2c1865acbb17cd0b2116dd1277bb2f2987fe..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image79.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image8.png b/pdfpatcher/doc/media/image8.png deleted file mode 100644 index 32bc31219bb0bfae16f704d7898d48d42795cd42..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image8.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image80.png b/pdfpatcher/doc/media/image80.png deleted file mode 100644 index 55291ba3fb220adea464fef1dde7d1ab3f0dc20c..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image80.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image81.png b/pdfpatcher/doc/media/image81.png deleted file mode 100644 index 2f91e5580e2a01977d9a4f8722c3eae4f6c47f3f..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image81.png and /dev/null differ diff --git a/pdfpatcher/doc/media/image9.png b/pdfpatcher/doc/media/image9.png deleted file mode 100644 index dae5b44a5652647cd6dda4ecf8a9dbebd761cc47..0000000000000000000000000000000000000000 Binary files a/pdfpatcher/doc/media/image9.png and /dev/null differ diff --git "a/pdfpatcher/doc/\344\275\277\347\224\250\346\211\213\345\206\214.md" "b/pdfpatcher/doc/\344\275\277\347\224\250\346\211\213\345\206\214.md" deleted file mode 100644 index c913b77f604a986db419627cc0fbc3a98c390bbf..0000000000000000000000000000000000000000 --- "a/pdfpatcher/doc/\344\275\277\347\224\250\346\211\213\345\206\214.md" +++ /dev/null @@ -1,2535 +0,0 @@ -# 软件功能简介 - -PDF 补丁丁是一个用于修改 PDF 文件信息的工具。它具有以下功能: - -- 修改文档(带"\*"号部分功能需通过高级补丁修改功能实现): - - 修改文档属性(如作者、主题、关键词等)。支持通过文件名重写文档属性。 - - 书签编辑器:添加、修改或删除 PDF 书签,设置书签的文字颜色、打开或收拢状态、点击后的跳转位置及页面缩放比例等修改 PDF 书签的功能。 - - 替换文档中使用的字体,或将字体嵌入到原本没有嵌入字体的 PDF 文档。 - - 添加或修改页面内的链接。\* - - 添加或更改 PDF 文档的逻辑页码编号。 - - 更改阅读器的初始设置(如显示比例、界面等)。 - - 统一页面尺寸、裁剪或扩大页面尺寸。 - - 调整页面旋转方向。 - - 删除文档或页面内嵌的 XML 元数据。 - - 删除打开文档或页面时自动执行的动作。 - - 去除 PDF 文件复制、打印限制。 -- 高级补丁修改功能(分两步进行)。 - - 首先导出信息文件(将 PDF 文档属性、阅读器初始状态、页码设置、页面设置、书签等信息导出成可编辑的 XML 文件。 - - 导入信息文件生成新文件:将上述信息文件和已有 PDF 文件合并,生成新的 PDF 文档,该 PDF 文档具有 XML 信息文件的设置(如页面设置、书签等)。 -- 制作 PDF 文件:通过导入一批图片或已有 PDF 文件,生成包含图片及已有 PDF 文件指定页面范围的 PDF 文件(可挂上书签)。此功能还可拆分或合并 PDF 文件,并保留原文件的书签。 -- 自动生成 PDF 书签:分析 PDF 文档的文本,自动生成书签。 -- 文字识别:调用微软 Office - 2003 或 2007 的光学字符识别引擎,将 PDF 文档的图片转换为文字。识别结果可写入 PDF 文档。 -- 无损导出 PDF 文件的图片。 -- 提取 PDF 文件中指定的页面。 -- 根据 PDF 文档元数据重命名 PDF 文件名。 -- 分析文档结构:以树节点形式查看 PDF 文档结构,可将页面或文档内容导出成 XML 文件、二进制文件供 PDF 爱好者分析、调试之用。 -- 支持打开并修改超过 2G 字节的超大 PDF 文档。 - -# 使用许可及授权协议 - -《PDF 补丁丁》软件(以下简称本软件)受著作权法及国际条约条款和其它知识产权法及条约保护。 - -本软件对于最终用户是免费的,你可以在遵循本协议的基础上自由的使用和传播它,你一旦安装、复制或使用本软件,则表示您已经同意本协议条款。 - -如果你不同意本协议,请不要安装使用本软件。 - -1. 软件:软件是指《PDF 补丁丁》软件以及它的更新、产品手册,以及在线文档等相关载体。 - -2. 你可以以任意方式分发数量不限的本软件的完整拷贝,但前提是: - - 1. 你必须提供本软件的完整版本,未经许可不得对软件乃至它的安装程序做任何修改; - - 2. 你不能因此而以任何方式任何理由收取费用; - - 3. 你不能够在商业性宣传活动、产品中附加本软件,除非你已获得著作权人的书面许可。 - -3. 支持:软件会由于用户的需求而不断更新,著作权人将提供包括用户手册、电子邮件等各种相关信息支持,但软件不确保支持内容和功能不发生变更。 - -4. 终止:当你不同意或者违背本协议的时候,协议将自动终止,你必须立即删除本软件产品。 - -5. 版权:你需要清楚你只具备软件使用权,本软件受著作权法及国际条约条款和其它知识产权法及条约的保护。 - -6. 免责:对于本软件安装、复制、使用中导致的任何损害,本软件及著作权人不负责任。 - -# 软件安装及使用环境 - -## 运行环境 - -PDF 补丁丁要求计算机上安装了微软.NET Framework 4.0 或更高版本的运行环境才能运行。 - -## 安装及运行程序方法 - -PDF 补丁丁是便携软件,将压缩包解压出来,运行 PDFPatcher.exe 文件即可。 - -## 卸载方法 - -删除 PDF 补丁丁所在的目录即可完成卸载。 - -# 详细功能介绍 - -## 程序界面 - -启动程序后,将看到下图所示的程序界面。 - -![程序主界面](media/image3.png) -
    图表 4--1:PDF补丁丁的程序界面
    - -界面主要分为上下两部分:上方是菜单和工具栏区,下方是程序功能区和功能切换区。 - -点击菜单项目或工具栏按钮,将打开相应的功能。 - -常用的功能在工具栏中显示为图标和功能文本,不太常用的功能则显示为图标。将鼠标移到工具栏的图标上,停留几秒钟,程序将弹出该按钮对应功能的说明文本。 - -打开了功能之后,在功能切换区将增加一个选项卡,与该功能相对应。 - -如不需要使用该功能了,可点击选项卡上的"X"按钮,将选项卡和对应的功能关闭。 - -下文逐一介绍程序各功能。 - -## 处理文件 - -处理 PDF 文件功能的界面如下图所示。 - -![新的图片](media/image4.png) -
    图表 4--2:处理PDF文件功能
    - -### 文件列表 - -处于界面中央的是"源文件及文件属性列表"(上图③)。该列表列出需要处理的文件及其属性。按住键盘的 Shift 键或 Ctrl 键,再用鼠标点击文件列表的源文件名,可一次选中多个文件。 - -### 添加文件 - -使用工具栏(上图①)上的"添加文件"按钮可向文件列表添加需处理的文件。在"添加文件"按钮右方有一个小小的倒三角形按钮。点击该按钮将弹出一个菜单,列出最近处理过的 PDF 文件。点击菜单上的文件项,也可将文件添加到文件列表。 - -此外,还可在 Windows 资源管理器(或其它程序的文件列表框)中选中一批文件,然后用鼠标将文件项目拖放到列表上。 - -**注意**:如选中了"添加文件前清空列表"复选框,则在添加文件之前会清空文件列表,再添加文件项。如果需要处理的文件要分几次才能添加到文件列表,请取消该复选框的选中状态。 - -**说明**:添加文件时,如 PDF 文件本身被加密,并要求只有输入密码后才能打开,则会弹出一个输入身份验证的对话框以供输入密码。如不能提供正确的密码,将无法处理 PDF 文档。 - -### 调整文件的处理顺序 - -程序处理文件列表文件的顺序是从上到下。 - -选中文件后,用鼠标左键拖动选中的项目,可调整文件的处理顺序。 - -使用工具栏上的排序菜单可排序文件。排序方式有两种:"按数值和字母顺序排序"将文件名中的数字考虑为数值。"按字母顺序排序"则根据文件名的字母顺序排序。 - -例如,导入列表中有"1.tif"、"2.tif"、"10.tif"和"3.tif"等四个文件,按数字和字母顺序排序后,由于文件名中的"10"比"3"大,因此"10.tif"应排在"3.tif"后面,故排序后顺序为"1.tif"、"2.tif"、"3.tif"和"10.tif";如按字母顺序排序,则"10.tif"中"1"出现在"2"和"3"之前,故排序后顺序为"1.tif"、"10.tif"、"2.tif"和"3.tif"。 - -点击文件列表的表头,也可按表头项对应的数据排序。点击第一次时执行顺序排序,再点一次则执行逆序排序。 - -### 删除文件项目 - -选中文件列表上的项目后,点击"×"按钮可删除选中的项目。 - -### 修改输出文件的属性 - -点击文件列表中文件项目的"标题"、"作者"、"主题"和"关键词"列,列表项将进入编辑状态。编辑项目的文本,可修改输出文件的属性(原始文件的属性不会更改)。如下图所示。 - -![新的图片](media/image5.png) -
    图表 4--3:修改输出文件的属性
    - -某些 PDF 文件的文件属性没有使用正确的编码,文件属性将显示为乱码。在这种情况下,可以在文件列表中选中该 PDF 文件,然后点击工具栏上"刷新文档属性"按钮右边的倒三角按钮,在弹出的菜单中选择其它编码。如下图所示。 - -![新的图片](media/image6.png) -
    图表 4--4:使用其它编码方式解码文档属性
    - -常用的编码有多种,逐一尝试,可能会选择到正确的编码方式,将乱码变成可读的文本。 - -### 切换补丁和重命名模式 - -在工具栏下的是"模式切换栏"(上图②),该栏包含两个单选框,对应两种处理方式。通过切换处理方式,可完成如下任务(详见下文): - -[独立补丁](#独立补丁处理模式):修改 PDF 文档的内容(修改书签、页面链接、解除复制限制等)生成新的文件; - -[重命名](#pdf文档选项):查看 PDF 文档属性并根据文档属性重命名 PDF 文件。 - -### 输出文件、信息文件路径及执行按钮 - -"生成 PDF 文件"按钮将执行模式栏选定方式对应的任务,生成新的 PDF 文件,输出到"输出 PDF 文件"(上图⑤)对应的文件路径。某些功能可能涉及用于修改 PDF 文档的信息文件。可在"PDF 信息文件"(上图④)处指定。 - -下文将根据上述两种处理方式分别介绍其使用方法。 - -## "独立补丁"处理模式 - -处理文件功能的"独立补丁"模式用于修改处理列表的每个 PDF 文件。 - -### 补丁修改文档的操作步骤 - -独立补丁模式通常的操作步骤如下: - -1. 选择处理 PDF 文档的"独立补丁"处理方式。 - -2. 使用"添加"按钮或拖文件方式向文件列表添加需要处理的 PDF 文件。 - -3. 点击界面右上角的"[配置处理文件选项](#高级补丁功能导出导入信息文件)"连接(或选择功能目录树中的"PDF 文档选项"),在该界面[指定PDF文件需要更改的设置](#高级补丁功能导出导入信息文件)(如指定阅读器界面,去除复制和打印等限制,将书签状态设置为关闭,禁止书签和页面链接改变显示比例等等)。修改的设置将应用于生成的 PDF 文件。详见 4.5 节介绍。 - -4. 关闭选项对话框,返回"处理/制作 PDF 文件"功能,指定输出 PDF 文件的路径(可在文本框中插入包含替代符的输出文件名,替代符的使用方式详见 4.3.2 节)。 - -5. 点击"生成 PDF 文件"按钮。程序将逐一按"PDF 文档选项"的设置处理文件列表中的 PDF 文件,并生成对应的新 PDF 文件到输出位置。 - -### 批量操作输出文件命名规则 - -为了正确操作多个原始文件的批量补丁操作,有必要了解批量操作后文件输出的位置及命名规则。程序有两种命名规则:默认命名规则和替代符命名规则。 - -#### 默认命名规则 - -在文件列表的文件有多个的情况下,输出文件名为"输出 PDF 文件"指定文件名所在的目录名+原始文件名+".pdf"后缀。 - -例如:设选中的原始 PDF 文件处于"M:\\abc"文件夹下,有"f1.pdf"和"f2.pdf"两个。"输出 PDF 文件"对应的目录为"E:\\efg",文件名为"xyz.pdf"(即路径为"E:\\efg\\xyz.pdf")。 - -在批量操作中,程序将忽略输出路径的文件名部分,输出文件到"E:\\efg"目录,文件名为"f1.pdf"和"f2.pdf"。如下表及示意图所示。 - -表格 4--1:批量操作输出文件名示例 - -| 输入文件名 | "输出PDF文件"位置 | 实际输出文件名 | -| --------------- | ----------------- | --------------- | -| M:\\abc\\f1.pdf | E:\\efg\\xyz.pdf | E:\\efg\\f1.pdf | -| M:\\abc\\f2.pdf | E:\\efg\\xyz.pdf | E:\\efg\\f2.pdf | - -![新的图片](media/image7.png) -
    图表 4--5:默认命名规则输出的文件
    - -#### 替代符命名规则 - -在"输出 PDF 文件"组合编辑框中,点击鼠标右键,将弹出一个上下文菜单。点击菜单的项目可插入替代符。在输出文件时,文件名的替代符将被替换成相应的内容。插入替代符的操作界面如下图所示。 - -![新的图片](media/image8.png) -
    图表 4--6:在输出路径中插入替代符
    - -各替代符的含义如下表所示。 - -表格 4--2:替代符含义 - -| 替代符名称 | 替代内容 | -| ------------------ | ----------------------------------------------------------------------------------------------------- | -| `<标题>` | 原始文档的"标题"属性 | -| `<作者>` | 原始文档的"作者"属性 | -| `<主题>` | 原始文档的"主题"属性 | -| `<关键字>` | 原始文档的"关键字"属性 | -| `<源目录路径>` | 原始PDF文件路径除文件名的部分(设源文件的路径为"M:\\abc\\efg\\hi.pdf",则替代符表示"M:\\abc\\efg\\") | -| `<源文件名>` | 原始PDF文件路径文件名不含扩展名的部分(设源文件的路径为"M:\\abc\\efg\\hi.pdf",则替代符表示"hi") | -| `<源目录名>` | 原始PDF文件路径的文件夹名称(设源文件的路径为"M:\\abc\\efg\\hi.pdf",则替代符表示"efg") | - -提示:源文件的属性已在文件列表中列出。 - -举例说明如下: - -设选中的原始 PDF 文件有"M:\\abc\\efg\\f1.pdf"和"M:\\abc\\efg\\f2.pdf"两个。 - -其中"f1.pdf"文件具有以下文档属性:"标题"为"示例 1","作者"为"W. Jordan","关键词"为"示例文档"。 - -"f2.pdf"文件不具有文档属性。 - -输出路径为`<源目录路径><标题>`,`<源目录路径>`表示原始 PDF 文件除文件名以外的路径部分。"`<标题>`"表示文档的"标题"属性。 - -由于"f2.pdf"文档不包含"标题"属性,因此,替代符替代的结果导致文件名为空。在这种场合下,程序将自动使用原路径的文件名作为输出的文件名部分。 - -输出情况如下表所示。 - -表格 4--3:输出路径包含替代符"`<源目录路径><标题>`"时的输出文件名 - -| 输入文件名 | 文档属性 | 输出文件名 | -|----------------------|---------------------|-------------------------| -| M:\\abc\\efg\\f1.pdf | 标题=\"示例1\"
    作者=\"W. Jordan\"
    关键词=\"示例文档\" | M:\\abc\\efg\\示例1.pdf | -| M:\\abc\\efg\\f2.pdf | 无文档属性 | M:\\abc\\efg\\f2.pdf | - -**注意**:本示例中,"f2.pdf"文件输出路径和原始路径相同,因此无法执行补丁。 - -![新的图片](media/image9.png) -
    图表 4--7:替代符命名规则输出的文件
    - -## 高级补丁功能(导出、导入信息文件) - -高级补丁功能用于将 PDF 文档的信息导出成一个可编辑的文档。该文档包含 PDF 文档属性、书签、页面链接、页面尺寸等信息,称为"信息文件"。 - -补丁操作分两步进行: - -第一步,[导出信息文件](#导出信息文件):将 PDF 文档中的信息导出成[可编辑修改的XML信息文件](#xml信息文件参考)。 - -第二步,[导入信息文件](#导入信息文件):使用文本编辑器修改上一步骤导出 XML 文件,然后在处理 PDF 文件处指定信息文件,点击"生成 PDF 文件"按钮,将源 PDF 文件和信息文件合并,生成一个具有修改后的设置的新 PDF 文件。 - -### 导出信息文件 - -操作步骤如下所示。 - -1. 选择处理 PDF 文档独立补丁处理方式。 - -2. 向文件列表添加需导出信息的 PDF 文件。 - -3. 点击PDF 信息文件右方的浏览按钮,指定保存导出信息文件的位置。 - -4. 点击导出信息文件按钮,程序将会把原始 PDF 文件中的信息导出到PDF 信息文件对应的位置。 - -操作步骤如下图所示: - -![新的图片](media/image10.png) -
    图表 4--8:导出信息文件的过程
    - -### 关于"信息文件" - -信息文件有两种类型:一种是[XML格式的信息文件](#应用示例)(文件名后缀为"xml"),另一种是[简易文本文件](#简易书签文件参考)(文件名后缀为"txt")。 - -在导出信息文件时,信息文件的类型由文件名后缀确定。例如,信息文件名为"文件.xml",则导出 XML 格式的信息文件;信息文件名为"文件.txt",则导出简易文本书签文件。 - -XML 信息文件包含的信息较全,较丰富。其可包含的信息有文档属性、阅读器设定、书签、页面链接、页面布局设置等。请参见第 6 章的介绍。 - -文本书签文件只包含文档属性和指向页面的书签信息(详见第 7 章),信息量远少于 XML 信息文件。如将 PDF 文档的书签导出成简易文本书签文件,编辑后重新导入到文档,由于简易文本书签包含的信息量较少,可能导致原文档的书签丢失一些信息(如无法精确定位到页面的指定位置等)。因此,一般场合下不要导出简易文本书签文件。 - -### 导入信息文件 - -在上一个步骤导出了信息文件后,可用文本编辑器或 XML 编辑器打开,修改里面的信息。修改后,可将信息文件的内容与原始 PDF 文件合并,生成一个新的 PDF 文件。操作步骤如下所示。 - -1. 按上一步骤的操作,指定 PDF 源文件和信息文件。 - -2. 点击输出 PDF 文件右边的浏览按钮,指定保存补丁后 PDF 文件的位置;或者可直接在输出 PDF 文件对应的组合框中输入输出文件路径。 - -3. 点击生成 PDF 文件按钮。程序将切换到输出信息界面。如导入成功,则输出的 PDF 文件将包含原始 PDF 文件的内容,以及 PDF 信息文件所附带的信息。 - -![新的图片](media/image11.png) -
    图表 4--9:导入信息文件的过程
    - -信息文件的内容不一定需要全部导入 PDF 文件,可在信息文件选项功能的导入选项处指定应导入信息文件的哪些内容。 - -关于信息文件的详细使用方法,请参阅[应用示例](#应用示例)和[信息文件参考](#xml信息文件参考)。 - -### 批量处理方式 - -如选定的原始 PDF 文件有多个,则导出信息文件时将导出到PDF 信息文件组合框指定的目录,而信息文件名则按 PDF 文件名来命名。 - -例如:选中的原始 PDF 文件处于"M:\\abc"文件夹下,有"f1.pdf"和"f2.pdf"两个。点击PDF 信息文件右边的浏览按钮后,指定信息文件放在"M:\\efg"目录,文件名为"xyz.xml"(即路径为"M:\\efg\\xyz.xml")。程序在批量操作中将忽略输出路径的文件名部分,故实际输出的信息文件将放在"M:\\efg"目录,文件名为"f1.xml"和"f2.xml"。 - -表格 4--4:批量导出信息文件的输出文件名示例 - -| 输入文件名 | "PDF信息文件"位置 |实际输出信息文件名| -| --------------- | ------------------ | ---------------- | -| M:\\abc\\f1.pdf | M:\\efg\\xyz.xml |M:\\efg\\f1.xml | -| M:\\abc\\f2.pdf | M:\\efg\\xyz.xml |M:\\efg\\f2.xml | - -![新的图片](media/image12.png) -
    图表 4--10:批量导出书签的命名规则
    - -导入文件时,信息文件的命名规则同上,即程序读取PDF 信息文件所在目录中与 PDF 文件相同文件名的信息文件作为批量处理时的信息文件。 - -输出文件的命名,则按 4.3.2 节所述的方式确定。 - -### 信息文件选项 - -信息文件选项用于指定高级补丁两个步骤中导出、导入的内容。选择程序选项菜单中的信息文件选项命令,将弹出信息文件选项对话框。 - -#### 常规导出选项 - -常规导出选项指定[导出信息文件](#导出信息文件)功能导出的内容。界面如下所示。 - -![新的图片](media/image13.png) -
    图表 4--11:信息文件选项(常规导出选项)
    - -各选项说明如下。 - -1. 字符编码:指定使用何种编码导出信息文件。系统默认编码为 GBK。某些 PDF 文件包含一些无法用 GBK 编码来表示的字符。这时可尝试选择该下拉框的GB18030UTF-8UTF-16等编码方式(使用系统默认、UTF-8 或 UTF-16 编码方式导出的信息文件可用 Windows 记事本直接打开编辑)。 -2. 文档属性:指定是否导出 PDF 文档的标题、作者、关键字、主题等元数据信息。 -3. 文档书签:指定是否导出 PDF 文档内的书签信息。当需要修改 PDF 书签时,可选中此选项。 -4. 页面内的链接:指定是否导出 PDF 文档页面内的链接。对于某些 PDF 文档,点击其中某些区域可跳转到文档的其它位置,打开新的文档或打开网站等,当需要修改这些链接时可选择此选项。 -5. 解析书签和页面链接的命名位置:PDF 文档中的命名位置是一个用特定名称表示的跳转目标,与书签信息是独立存储的。如发现导出的 PDF 书签或页面链接无法补丁到 PDF 文档,可尝试选中此选项,将书签和页面链接的命名位置转换为实际位置。 -6. 阅读器设置:指定是否导出初始排版方式(如单页、单页连续、双页等)、页码样式(在 PDF 阅读器中看到的逻辑页码编号方式,如"I"、"II"、"III"形式的罗马数字页码,"A"、"B"、"C"形式的英文字母顺序页码)等设置。 -7. 尺寸度量单位:指定使用何种单位表达 PDF 文档坐标值。程序中默认为厘米。 - -提示:PDF 文档中使用的标准度量单位是。如需精确导出定位信息,请选择为度量单位。 - -#### 高级导出选项 - -高级导出选项是 PDF 补丁丁为 PDF 开发人员提供的高级功能。该功能可以 XML 表示形式导出 PDF 页面的内容、处理指令等信息,供开发参考。界面如下所示。 - -![新的图片](media/image14.png) -
    图表 4--12:信息文件选项(高级导出选项)
    - -1. 导出编录信息:选中该复选框后,导出的信息文件将包含 PDF 编录(Catalog)字典中的内容。 -2. 导出页面内容:选中该复选框后,导出的信息文件将包含 PDF 页面的字典、绘制指令等内容,供调试、研究文档之用。 -3. 页码范围:指定仅导出部分页面的内容。如不指定页码范围,则导出所有页面的内容。 -4. 选中导出页面字典信息复选框,可导出页面的字典信息。 -5. 选中导出绘制页面命令复选框,可导出向页面输出文本、图片和图像等内容的指令。 -6. 选中将图片导出为独立文件复选框,可把图片保存为独立的文件,而不写入到 XML 信息文件。 -7. 选中解码导出页面内的文本复选框,可把文档页面内容流的文本解码提取出来。 - -如仅需要分析二进制流前面若干字节的内容,可在限制导出二进制流字节数的数字调整框中输入数值,如"100",表示仅导出二进制流前面 100 个字节的内容。 - -**说明**:高级导出选项导出的 XML 内容仅供参考,不会在导入时写入 PDF 文档。PDF 文档中的二进制内容将使用 HexBin 编码方式编码成 XML 文档中的 CDATA 字符串。 - -#### 导入选项 - -导入选项用于指定高级补丁功能中导入的内容,其界面及各选项含义如下。 - -![新的图片](media/image15.png) -
    图表 4--13:PDF文档选项(信息文件内容)
    - -1. 文档属性信息:是否使用信息文件中指定的元数据(如作者、主题、关键字等)。 -2. 文档书签:是否使用信息文件中指定的书签。如不选中此选项,则输出文件的书签与原始 PDF 文件的相同。书签格式可参考[信息文件参考](#xml信息文件参考)中[书签](#文档书签)一节的说明。 -3. 页面内的链接:是否导入信息文件中包含的页面链接。如选择此选项,则可用信息文件中的页面链接替换(选择原页面链接右方的替换单选框)或叠加(选择保留单选框)原始 PDF 文件的页面链接。 -4. 阅读器设置:是否导入阅读器的初始状态(如是否在打开文档时显示书签、全屏显示、初始页面状态)和页码编号方式。 -5. 页面设置:是否导入各页面的尺寸、裁剪边框、旋转角度等数据。 - -## PDF文档选项 - -PDF 文档选项用于指定如何修改 PDF 文档。点击工具栏上的PDF 文档选项项目,将打开 PDF 文档选项对话框。 - -选项对话框以选项卡形式划分选项。界面分页面尺寸阅读方式压缩清理文档属性页码标签替换字体等选项卡,分别介绍如下。 - -### 页面尺寸 - -该选项可统一 PDF 文档的尺寸,或调整页面边框的留白,其界面及各选项含义如下。 - -**说明**:选项卡的默认状态如下图所示。如更改了界面的设置,导入信息时以界面上的设置为准;如保留默认设置,则以信息文件指定的信息为准。 - -![新的图片](media/image16.png) -
    图表 4--14:PDF文档选项(页面尺寸)
    - -1. 页面尺寸、宽、高:在此列表可指定输出 PDF 文件的页面尺寸。更改页面尺寸列表的选中项目后,具体尺寸将在对应的文本框中显示。最终的页面尺寸以指定的尺寸为准。即使源 PDF 文件页面尺寸不同,输出后的页面均将统一尺寸。 -2. 特殊页面尺寸: - 1. 等同原始内容尺寸:不改变输出的 PDF 文档的页面尺寸。 - 2. 固定页宽自动高度:自由指定输出 PDF 文档页面宽度,将源 PDF 页面等比例缩放到指定的宽度。 -3. 位置:指定源 PDF 页面在新尺寸页面上的对齐方式。 -4. 页面留白:在页面四边留下的空白。选中同步调整四边留白选项时,更改任一个留白数值会改变其余三个的值。取消选中该选项框,可单独调整各边留白数值。数值可以为负数,用于减少页面留白。 - -### 阅读方式 - -阅读方式选项卡用于指定阅读器的界面设置,其界面及各选项含义如下。 - -**说明**:选项卡的默认状态如下图所示。如更改了界面的设置,导入信息时以界面上的设置为准;如保留默认设置,则以信息文件指定的信息为准。 - -![新的图片](media/image17.png) -
    图表 4--15:PDF文档选项(阅读方式)
    - -阅读器设定:指定阅读器的初始视图、阅读方向和初始模式。下拉列表中选择保持不变时,以信息文件或原始 PDF 文件中指定的设定为准。 - -在一屏显示两页竖排文本(如某些古籍)的场合下,可设置文档的阅读方向为从右到左,以适应竖排阅读方式。 - -书签状态选项用于指定是否打开(展开)或关闭所有书签。不指定状态时,以信息文件或原始 PDF 文件中指定的状态为准。 - -书签及链接动作:指定书签及页面内链接的缩放比例。有些书签或页面链接在点击后会改变阅读器当前的显示比例,选中禁止书签及页面链接更改显示比例复选框,可去除此类行为,使点击书签及页面链接后仍保持阅读器的显示比例。有些 PDF 文档,更改文件名后书签失效,选中强制将外部 PDF 文件链接改成内部链接选项,可修复此类书签。 - -阅读器操作界面设定:指定在 PDF 阅读器中打开 PDF 文件时的界面。默认状态下,不强制更改 PDF 阅读器的界面设置。如需重写 PDF 文档的操作界面设定,可选中指定操作界面设置复选框。选中该复选框后,下面灰色被禁用的复选框将变成可操作的状态。通过设置这些复选框的选中状态,可指定打开文档后 PDF 阅读器的界面。 - -### 压缩清理 - -此功能用于提高 PDF 文档的压缩率,并可清理一些不需要的内容。其界面及选项内容如下。 - -![新的图片](media/image18.png) -
    图表 4--16:PDF文档选项(压缩清理)
    - -1. 源文档处理、源文档页面处理:用于清除限制(如复制、打印等限制)、自动执行的动作、文档批注及元数据信息。 - - **说明**:关于扩展标记(XML)元数据属性:XML 元数据属性是一种附加在文档上的标注信息,一般不影响阅读,如无需要可将其删除。 - -2. 尝试修复文档错误:一般场合下没有必要选择此复选框。若打开某些 PDF 文档时出现操作符无效错误,可选中此复选框尝试修复文档内容。 - -3. 清楚页面所有文本:一般场合下不要选择此复选框。该选项将清除页面上所有的文本内容。 - -4. 压缩索引表和书签:选中此选项时,程序将压缩 PDF 的索引表和书签等数据,尽最大限度减少 PDF 文件占用的空间。 - - **注意**:低版本或不兼容的 PDF 阅读器可能无法打开压缩索引表的 PDF 文档。 - -5. 优化压缩黑白图片:选中此选项时,程序将尝试使用 JBIG2 算法压缩 PDF 文档内的黑白图片,以求减少图片所占用的文件空间。如果压缩后无法减少文件大小,将保持原图片不变。选择此选项不会降低图像质量,但可能会使用更多的处理时间。 - -### 文档属性 - -文档属性选项卡用于指定文档属性。一般场合下不需要使用此选项卡设置文档属性,在文档列表中直接输入需要设置的文档属性即可。此选项卡是用于批量设置文档属性的。其界面及各选项含义如下。 - -**说明**:选项卡的默认状态如下图所示。如更改了界面的设置,导入信息时以界面上的设置为准;如保留默认设置,则以信息文件指定的信息为准。 - -![新的图片](media/image19.png) -
    图表 4--17:PDF文档选项(文档属性)
    - -文档信息:选中使用此处设定的文档属性信息复选框后,可指定文档标题、作者、主题、关键词等属性。 - -在独立补丁处理模式下,可用鼠标右键点击各文档属性文本框,弹出插入`<源文件名>`和`<源目录名>`替代符的菜单命令。`<源文件名>`表示使用源 PDF 文件的文件名作为指定的文档属性,`<源目录名>`表示使用目录名称作为指定的属性。使用此功能可使用 PDF 文件名或目录名轻松修改 PDF 文件的属性。 - -重写文档属性时,如设定的文档属性为空,则保留 PDF 文档相应的原始属性。如属性为一个或多个半角空格(` `),则删除 PDF 文档对应的原始属性。 - -### 页码标签 - -PDF 文档的页码标签通常在 PDF 阅读器的翻页控件上显示,表示文档中的逻辑页码。 - -页码标签选项卡可用于指定逻辑页码标签,其界面及各选项含义如下。 - -**说明**:选项卡的默认状态如下图所示。如更改了界面的设置,导入信息时以界面上的设置为准;如保留默认设置,则以信息文件指定的信息为准。 - -![新的图片](media/image20.png) -
    图表 4--18:PDF文档选项(页码标签)
    - -点击添加按钮可新增一个页码标签。如需修改页码标签,可直接点击列表框相应的页码标签项修改其内容。点击删除按钮可删除选中的页码标签。 - -1. 文档页码:表示文档中使用此页码标签的实际页码。在 PDF 阅读器界面上,从该页开始,后面的页面将使用设置的标签显示页码。 - -2. 页码样式:页码编号的样式。默认为数字,此外可使用罗马数字及英文字母。 - -3. 前缀文本:在逻辑页码标签前的文本。 - -4. 起始号码:逻辑页码标签开始编号的号码,一般保持为 1。 - -现以下图为例,说明页码标签的用法。 - -![新的图片](media/image21.png) -
    图表 4--19:页码标签设置示例
    - -在上图中,第一项的文档页码为 1,页码样式为"大写英文字母",前缀文本为"封面",起始页码为"1",则在阅读器中第 1 页的页码显示为"封面 A"。 - -第二项的文档页码为 2,页码样式为"大写罗马数字",前缀文本为"目录-",起始页码为"1",则在阅读器中从第 2 页开始,到第 8 页为止(共 7 页),页码显示为"目录-I"、"目录-II"、"目录-III"......"目录-VII"。 - -第三项的文档页码为 9,页码样式为"数字",前缀文本为空,起始页码为 1,则在阅读器中从第 9 页开始到文档最后一页,页码显示为"1"、"2"、"3"...... - -### 替换字体 - -替换字体选项卡的设置内容用于将 PDF 文档的字体更换为系统中安装的其它字体。对于某些没有嵌入字体的 PDF 文档,此功能还可实现嵌入字体的功能。其界面及各选项含义如下。 - -![新的图片](media/image22.png) -
    图表 4--20:PDF文档选项(替换字体)
    - -嵌入汉字库:选中此选项后,为没有嵌入字库的 PDF 文档自动嵌入如下常见字库:宋体、黑体、楷体、仿宋体、幼圆体。 - -允许替换字体:选中此选项后,可替换 PDF 文档中的字体。 - -列出文档字体:要替换 PDF 文档中的字体,首先需要知道文档中采用了哪些字体。点击此按钮,将出现一个对话框。如下图所示。 - -![新的图片](media/image23.png) -
    图表 4--21:列出文档字体
    - -点击浏览按钮,选择需列出字体的 PDF 文档,再点击列出字体按钮,该文档中使用到的字体将列出到对话框下方的列表。 - -选中字体名称对应的复选框,再点击添加选中项至替换列表按钮,选中的字体就会被添加到 PDF 文档选项的替换字体列表。点击列表项目右方替换字体列,指定系统中安装的字体。 - -执行补丁操作后,原字体列的字体就会被替换为替换字体列的字体了。 - -## 重命名处理模式 - -此功能用于查看 PDF 文档的属性,并可根据文档属性更改 PDF 文件名。 - -操作方式与独立补丁处理模式类似。 - -输出 PDF 文件用于更改 PDF 文件的命名模板。命名模板支持替换符,因此可用文档属性(如标题重命名 PDF 文件)。关于替换符的用法请参见[替代符命名规则](#替代符命名规则)一节的介绍。 - -点击测试按钮可预览重命名结果。 - -点击生成 PDF 文件按钮,将按重命名模板更改源 PDF 文件名称为模板指定的名称。如选中保留原始文件复选框,则保留重命名之前的 PDF 文件,否则文件会被改为新的名称。 - -## 合并文件 - -此功能可实现多种方式制作 PDF 文件的功能,例如制作扫描书籍的电子书、将整个目录的图片和 PDF 文件合并为一个 PDF 文件等。 - -合并功能还可在已有的 PDF 文件中抽取指定范围的页面,导出到生成的 PDF 文件,即具有合并或拆分 PDF 文件。 - -在界面正中有一个列表框,称为文件列表。在文件列表,可混合指定图片和 PDF 文件,将图片插入到 PDF 文件的页面中。 - -双击列表中的源 PDF 文件,可以指定该文档中参与合并操作的页码范围。页码范围默认为第一页到最后一页,通过修改页码范围,可实现拆分、重排 PDF 文件页面的功能。 - -此外,可通过修改[合并文档选项](#合并文档选项)的设置,在合并 PDF 文件时指定输出 PDF 文件的属性。 - -本功能的界面如下图所示。 - -![](media/image24.PNG) -
    图表 4--22:合并文档功能
    - -### 操作方法 - -使用合并文件功能生成 PDF 文档的操作步骤如下。 - -1. 点击工具栏上的合并文件按钮。 - -2. 向文件列表添加图片(JPEG、PNG、GIF、BMP 和 TIFF 文件)或源 PDF 文件。每个图片将成为 PDF 文档的一页,如有 3 个图片,则 PDF 文档有 3 页;10 个图片则文档有 10 页。如果图片文件有多帧,则每帧将作为单独的一页。 - -3. 如需添加空白页,可点击工具栏的插入空白页按钮。 - -4. 点击添加文件夹按钮,将弹出一个打开文件的对话框。使用该对话框定位到需要添加的文件夹,点击打开按钮,可以将该文件夹中所有的图片或 PDF 文件添加到列表(含子文件夹的文件)。 - -5. 如果添加了不需要合并的文件或文件夹,可以选中该项目,然后点击工具栏上的删除文件按钮将该文件或文件夹从文件列表中删除。 - -6. 如需为生成的 PDF 文件挂上书签,可点击PDF 信息文件右边的浏览按钮,指定书签文件的位置。信息文件不是必需的,可不指定。不指定书签时,程序根据文件列表中书签文本列为生成的 PDF 文件生成书签。 - -7. 点击输出 PDF 文件右边的浏览按钮,指定制作 PDF 文件的保存位置。 - -8. 点击生成 PDF 文件按钮。 - -9. 程序将创建 PDF 文件,然后按文件列表的顺序逐一将图片或源 PDF 文件添加到输出 PDF 文件的页面。 - -提示:除了使用添加文件或文件夹的按钮之外,还可以直接从资源管理器将文件拖放到文件列表。 - -#### 排序文件 - -选中文件项目后,用鼠标点住需要移动文件的文本区域,然后拖动鼠标,就可以移动文件。将鼠标移到其它文件项上面,释放鼠标按键,就可使选中的文件移到对应的位置。 - -例如,在下图中选中程序主界面.PNG子文件夹 2两个文件项后,用鼠标将其拖动到文件夹 1书签上。在文件夹 1上将显示一个蓝色的矩形。 - -![新的图片](media/image25.png) -
    图表 4--23:排序文件项目
    - -蓝色的矩形有四个区域,在不同区域释放鼠标按键有不同移动方式。以上图为例。 - -在①区域上释放鼠标按键,选中的文件项目将移动到"文件夹 1"的前面。 - -在②区域上释放鼠标按键,选中的文件项目将移动到"文件夹 1"的后面。 - -在③区域上释放鼠标按键,选中的文件项目将移动到"文件夹 1"的所有子项的前面。 - -在④区域上释放鼠标按键,选中的文件项目将移动到"文件夹 1"的所有子项的后面。 - -移动文件项目后的效果分别如下图各标记所示(被移动的两个文件项目为选中状态)。 - -![新的图片](media/image26.png) -
    图表 4--24:移动文件项的效果
    - -**说明**:在拖动书签时,按键盘的 Esc 键可取消拖动操作。 - -#### 设置书签文本和书签样式 - -合并生成 PDF 文件时可指定导航书签,在阅读器中点击书签将跳转到与文件对应的页面。 - -书签文本在合并文件列表的书签文本列设置。将文件添加到合并文件列表后,点击书签文本列的单元格。该单元格将进入编辑状态,在其中输入文本,即可为文件设置对应的书签项。 - -在书签文本不为空的情况下,选中文件项,再点击工具栏上的BI按钮,可分别为书签项设置粗体和斜体样式;点击工具栏上调色板按钮旁边的倒三角形小按钮,可设置书签项的文本颜色。 - -如果书签文本内容为空,则该项目不生成书签。如果该项有子项,且子项文本不为空,则子项仍生成对应的书签。 - -**说明**:在添加文件到合并文件列表时,程序自动根据文件名设置其对应的书签文本。此行为可在合并文件选项中调整。 - -#### 裁剪源图片选项 - -双击文件列表的图片文件,将弹出源图片处理选项对话框,如下图所示。使用该对话框可指定在导入图片制作 PDF 文件时,先裁剪图片,再导入到文档。 - -![新的图片](media/image27.png) -
    图表 4--25:源图片处理选项对话框
    - -#### 筛选源PDF文件页面选项 - -双击文件列表的 PDF 文件,将弹出源 PDF 文件选项对话框,如下图所示。使用该对话框可指定仅导入源 PDF 文档的若干页面,或仅导入 PDF 文档内的图片。 - -导入及处理源 PDF 文件图片方式栏中的控件默认状态为禁用。只有选中仅导入源 PDF 文件的图片复选框后才可用。导入图片选项与[提取图片](#全局选项)功能的选项类似,请参见该章节的说明。 - -提示:页码范围支持逆序范围,如页码范围"10-1",将先插入源文件的第 10 页,再插入第 9 页,以此类推,最后插入第 1 页到输出文档。 - -![新的图片](media/image28.png) -
    图表 4--26:源PDF文件选项对话框
    - -### 已知问题 - -- 导入书签的尺寸要符合所选输出文件的尺寸,否则定位坐标可能不准确。 - -- 源 PDF 文件的文档属性及元数据不会输出到生成的目标文件,但可通过指定信息文件的方式将其导入到输出文件,或在PDF 文档选项指定文档信息。 - -## 合并文档选项 - -合并文档选项用于指定合并功能生成的 PDF 文档的选项。点击工具栏上的合并文档选项项目,或点击界面上的设置合并 PDF 文档选项链接,将打开合并文档选项对话框。 - -选项对话框以选项卡形式划分选项。界面分页面布局阅读方式书签文档杂项页码标签等选项卡。其中,阅读方式文档杂项页码标签的内容和功能与 PDF 文档选项基本一致,在此不在赘述。下文将介绍页面布局书签两个选项卡。 - -### 页面布局 - -页面布局选项卡界面如下图所示,该界面类似于 PDF 文档选项的页面尺寸对话框,但增加了如下选项。 - -![](media/image29.PNG) - -自动旋转页面适应原始内容纵横方向:选中此选项时,如图片纵横方向与页面不同,并且页面无法容纳图片时,程序将自动旋转页面以更好地适应图片。 - -例如,点击尺寸下拉列表,选择页面尺寸为 16 开页面(宽 184 毫米、高 260 毫米),是宽度小于高度的纵向页面。这时输入的源页面尺寸为 1024 像素宽、768 像素高,该图片为宽度大于高度的横向页面。如不选中本选项,则横向的图片直接放到纵向的页面上,会留下很多空白(下图左) - -选中本选项后,程序将自动把页面布局设为横向,适应源图片的方向,再将源图片的内容放到新页面上(下图右)。 - -![shot](media/image30.jpeg) - -1. 缩放原始内容适应页面:指定是否调整源图片尺寸以适合页面尺寸。选中无损缩小复选框,当页面小于原始内容尺寸时,将原始内容缩小到适合页面。选中无损放大复选框,则当原始内容小于页面尺寸时,将其放大到适合页面。 - - **提示**:调整缩放比例不会降低图片的质量(该操作仅用 PDF 内置缩放命令使图片呈现不同的尺寸)。 - -2. 源 PDF 页面调整:指定是否改变源 PDF 文件的页面放大比例,使之适合输出文档页面的尺寸。默认选中调整为页面尺寸,程序保持文档原内容不动,但更改页面尺寸,使之与页面设置的尺寸保持一致。这样可以扩大页面空白面积以便添加批注,或隐藏页面上不必要的空白方便阅读。如选中缩放内容适应页面,从源 PDF 文件导入的页面将拉伸到适合输出文档页面的尺寸。 - -3. 黑白图片设为透明:对于只有黑白两色的图片,将其设置为透明(在 PDF 阅读器中将不可选中并复制该图片)。 - -4. 优化压缩黑白图片:使用压缩率较高的 JBIG2 算法压缩黑白图片。 - -### 书签 - -书签选项卡包含控制 PDF 文件生成书签的选项,其界面如下。 - -![](media/image31.PNG) -
    图表 4--27:PDF文档选项(书签)
    - -添加项目时根据文件名自动生成书签文本:选中此项时,为每个源文件(图片或源 PDF 文件)对应的页面添加一个书签项,书签项的文本为源文件名(删除扩展名部分)。 - -忽略文件名的前导数字:在选中添加项目时根据文件名自动生成书签文本复选框时,此选项有效。选中此项时,书签项的文本为源文件名删除前面的数字后的部分。如删除数字后文件名为空,则不为该页添加书签。例如,用于生成 PDF 的文件列表有 4 个图像文件,其文件名分别为:"0001 封面.jpg"、"0002 目录.tif"、"0003.tif"和"0004 第一章.tif",则生成的书签有三项,名称为"封面"(跳转到第 1 页)、"目录"(跳转到第 2 页)和"第一章"(跳转到第 4 页)。 - -子文件夹排在文件前面:选中此选项时,在添加文件夹到文件列表时,文件夹包含的子文件将排在文件前面。不选中此选项时,按照文件的字母顺序排序文件。 - -文件名分别按数值和文本排序:选中此选项时,在添加文件夹到文件列表时,文件夹包含的文件将分别按数值和文本排序,例如以下序列是按数值和文本排序 1.pdf、2.pdf 和 10.pdf(排序时将"10"视为数值,排在"2"后面),而 1.pdf、10.pdf 和 2.pdf 是按文本排序(排序时将"10"视为文本,排在"2"前面)。 - -**说明**:更改上述各选项后,文件列表的书签文本不会刷新。如需刷新书签文本,可在文件列表删掉原来添加的文件,重新再向列表添加文件时,将按新的设置生成书签文本。 - -保留源 PDF 文件的书签:将源 PDF 文件的书签复制到合并后输出的文档。如源 PDF 文件的页面不在输出文档,则点击书签将不执行任何动作。 - -删除连接到无效页面的书签:在选中保留源 PDF 文件的书签复选框时此选项有效。选中此选项后,如源 PDF 文件的页面不在输出文档,则删除指向该页面的书签(如书签包含子书签,则子书签也将被删除)。例如源 PDF 文件有 100 页,仅将其中 1~50 页导入生成新的 PDF 文件,则源文件中指向原文档第 51~100 页的书签项将被删除。 - -## 自动生成书签 - -此功能可用于自动生成 PDF 文档的书签。其原理是:PDF 文档的文本有一定的格式规律,因此可按照页面文本、尺寸、所用字体等规则,筛选出符合规则的文字(往往是大字标题),从而利用这些文本生成 PDF 书签。本功能的界面如下图所示。 - -![新的图片](media/image32.png) -
    图表 4--28:自动生成书签功能
    - -**说明**:此功能是通过分析 PDF 文档内文本内容的字体尺寸,从而为 PDF 文档自动创建书签的,并不是执行光学字符识别(OCR)将图片识别为文本。 - -### 操作步骤 - -使用此功能生成文本 PDF 的书签文件,操作步骤如下。 - -1. 选择识别标题为书签功能。 - -2. 点击原始 PDF 文件右边的浏览按钮,指定需要识别标题为书签的 PDF 文件。 - -3. 点击PDF 信息文件右边的浏览按钮,指定保存识别后生成书签的信息文件。 - -4. 如有需要,可调整选项(特别是识别页码范围)。 - -5. 点击导出信息文件按钮。程序将分析识别原始 PDF 文件中指定页码范围页面内的文本,抽取尺寸大于标题文本尺寸微调框数值的文本,将其组织成书签,并保存为 XML 信息文件。在程序的处理过程中,日志窗口会输出识别为标题的文本、级别,及其所在页码。 - -6. 观察日志窗口的输出内容,可知输出书签的概貌。通常第一次分析得到的书签不太理想,可返回调整筛选选项,如调整标题文本尺寸以包含字体更小(或更大)的标题文本、指定过滤文本筛选不需要的文本、在高级筛选处理选项中添加筛选器剔除特定的字体等。 - - **提示**:可用文本编辑器打开此功能输出的信息文件,里面列出了标题文本的尺寸。此外,可在高级筛选处理选项中,点击从信息文件添加按钮。点击该按钮后,程序弹出一个对话框。用该对话框可从输出信息文件添加标题文本筛选器。 - -7. 重复步骤 5 和 6,直到获得比较满意的书签嵌套效果。 - -8. 完成后,转到处理、生成 PDF 文档功能的独立补丁处理模式,使用前述生成的信息文件补丁 PDF 文件,查看输出文件的书签效果。如效果不理想,可手工修改 XML 信息文件并重新补丁。 - -提示:详细的应用示例可参考本手册第 5.10 节。 - -### 标题识别选项 - -在本功能的选项卡中可指定分析过程的筛选参数。 - -1. 识别页码范围:指定需要分析文本的页码。 - -2. 标题文本尺寸:指定只有尺寸大于此数值的文本才可能被抽取为书签。 - -3. 定位位置向上偏移若干倍行距:当文本被抽取为书签项目后,点击书签项目将跳转到对应的文本,但会向上偏移一些位置,使定位后的文本不会贴到阅读器窗口顶端。 - -4. 自动组织标题层次:选中此选项时,程序根据文本的尺寸级别生成多级书签。 - -5. 合并连续出现的标题:如果两行文本都符合构成标题的条件,就将其视为一个标题(适应一个标题分两行显示的场合)。 - -6. 合并同一行内不同尺寸的标题:当标题文本字体尺寸不一,可选中此选项,使尺寸不一的文本合并为一个标题。 - -7. 合并不同字体的标题:当标题文本字体样式不一,可选中此选项,令使用不同字体的文本合并为一个标题。 - -8. 忽略重叠的文本:某些 PDF 制作程序会在同一个位置略错开一点的位置多次输出相同的文本,从而制作出仿粗体或阴影的效果,这样将导致出现重复文本。选中此选项,可让程序检测该技术手段,忽略在同一个位置重复出现的文本。 - -9. 文字排版方向:程序一般可自动检测文本的排版方向,但由于算法智能有限,可能推断错误,可使用此选项可人工指定文字的排版方向,提高程序组织文本布局的准确度。 - -10. 合并连续标题不大于若干倍行距:在选中合并连续出现的标题后,小于此指定行距的标题将被合并为一个标题。 - -11. 若干层标题定位到页首:默认情况下,点击识别后生成的书签将定位到书签所在的位置。选中此选项,则点击指定层数内的书签将定位到页面顶部,而不是书签所在的位置。 - -12. 为首页生成书签:选中此选项后,将生成一个书签项指向文档第一页,该书签项的文本为 PDF 文件名,此外,无论是否有文本满足标题的条件,不再为首页生成书签。不选中该选项,则按照普通的规则处理。 - -### 文本过滤选项 - -文本过滤选项指定用于过滤文本的列表(每行一个)。匹配指定模式的文本将被忽略。界面如下。 - -![新的图片](media/image33.png) -
    图表 4--29:自动生成书签功能的文本过滤选项
    - -忽略只有一个字符的标题:有些 PDF 文档有首字下沉的大字,可用此选项将其忽略。避免下沉字被认作标题(选中此选项时,不要选择合并同一行内不同尺寸的标题选项,否则下沉字会和普通文本合并到一起)。 - -忽略只有数字的标题:此选项通常可用于忽略页码数字。 - -在忽略内容列填入需要忽略的标题文本。当 PDF 文本匹配忽略内容时,程序就不会将其当成书签标题。 - -选中区分大小写列的复选框,则匹配忽略内容时区分英文大小写。 - -选中匹配全标题列的复选框,则只有整行 PDF 文本和忽略内容长度一致时才会忽略该行文本。 - -选中正则表达式列的复选框,则忽略内容为正则表达式。 - -如果需要删除已输入的忽略内容模式,可点击删除列下对应的按钮或点击清空列表按钮。 - -### 高级筛选处理选项 - -高级筛选处理选项可指定在特定的条件下忽略文本或更改匹配文本的标题级别。界面如下。 - -![新的图片](media/image34.png) -
    图表 4--30:自动生成书签功能的高级筛选处理选项
    - -在上述界面可添加用于筛选标题文本的筛选条件。已添加的筛选条件在列表中列出,每行是一组筛选条件和匹配该条件后调整级别的值。如果某段文本符合特定组别的筛选条件,则执行调整级别动作。调整级别时,如筛选条件对应相对调整列的复选框被选中,则匹配筛选条件的文本级别将增加或降低调整级别列指定的数值,否则文本的级别将更改为调整级别列指定的数值。 - -提示:调整级别为 0,且相对调整复选框未选中时,表示将过滤匹配条件匹配的文本。 - -如果调整后的数值小于标题识别选项中指定的标题文本尺寸参数,则该段文本就会被忽略,不会输出到生成的书签。如数值大于标题文本尺寸选项的值,则原来被该选项忽略的文本也可输出到生成的书签。 - -工具栏上有 5 个按钮:添加按钮用于手工添加筛选器,一般不使用该按钮,而是使用从信息文件添加按钮,从第一趟处理生成的信息文件中添加筛选器。删除按钮可删除列表内选中的筛选器。复制粘贴按钮可用于复制和粘贴筛选器。 - -关于高级筛选处理选项的使用方法,请参阅[应用示例](#应用示例)一章的相关介绍。 - -### 其它选项 - -选中完成识别后统计用于标题的字体复选框,则识别后将在日志窗口列出用于标题的字体。 - -如选中列出被忽略的字体复选框,则在统计信息中还包含已被筛选条件忽略掉的字体名称。 - -如选中导出文本位置信息复选框,则导出的信息文件中还将包含文本在页面内的位置信息。 - -## 编辑书签文件 - -此功能可编辑[简易文本书签文件](#简易书签文件参考)、[XML信息文件](#xml信息文件参考)或直接提取 PDF 文档书签,并保存为信息文件或向已有 PDF 文档添加书签。本功能的界面如下图所示。 - -![书签编辑器](media/image35.png) -
    图表 4--31:PDF书签编辑器界面
    - -界面上方是两排按钮,中间是以树型形式显示的书签列表。将鼠标移到工具栏的按钮上,停留片刻,将弹出提示信息,说明该按钮的用途,并显示键盘操作快捷键。第一排按钮按从左到右的顺序说明如下: - -1. 打开按钮打开需要编辑书签的信息文件或 PDF 文件。点击该按钮旁边的小三角形,将弹出一个菜单,上面列出了最近处理过的信息文件或 PDF 文件。点击菜单项,将打开对应文件的书签。 - -2. 撤销按钮用于撤销前一步修改操作,恢复书签到修改前的状态。点击撤销按钮旁边的小三角形,将弹出一个菜单,点击菜单的项目可一次撤销多步操作。 - -3. 复制按钮用于复制选中的书签。 - -4. 粘贴按钮用于将之前复制的书签粘贴到指定位置。 - -5. 删除按钮删除选中的书签。如果书签包含子书签,则子书签也会被删除。 - -6. 插入书签按钮插入一个新的书签项到当前书签后面。 - -7. 缩进书签按钮将选中的书签设置为上一个同级文档的子书签。 - -8. 粗体斜体按钮分别切换书签文本的粗体和斜体样式。 - -9. 颜色按钮设置书签文本的颜色。点击其旁边的小三角形,将弹出一个取色框,可在上面选择预定义的颜色,或使用调色板选择所需颜色。 - -10. 点击选择或标记书签按钮将弹出一个菜单,菜单包含如下命令: - -11. 全部选中:选中所有显示可见的书签。 - -12. 全部不选:取消所有书签的选中状态。 - -13. 反转选择状态:选中没有选择的书签,取消已选择书签的选中状态。 - -14. 标记书签:将选定的书签标记为指定颜色,以便后续处理;或取消选中书签的标记状态。 - -15. 选择已标记书签:选中使用标记书签功能标记的书签。 - -16. 全部折叠:隐藏所有书签的子书签。 - -17. 折叠子书签:隐藏当前选中书签的子书签。 - -18. 全部展开:展开所有书签的子书签,使所有书签全部显示出来。 - -19. 点击搜索或替换书签文本按钮将弹出一个对话框,可使用该对话框搜索或批量替换选中书签的文本。 - -20. 点击修改菜单按钮将弹出一个菜单,上面列出多个常用的修改书签命令,点击命令将修改选中的书签。所有修改命令列出如下。 - -21. 设置目标显示方式:设定点击书签后跳转到目标位置的显示方式。 - -22. 设置书签默认打开状态:设置书签在阅读器中是否默认打开。此命令仅可用于包含子书签的书签。 - -23. 清除书签目标定位偏移:清除横坐标偏移将禁止点击书签后更改阅读器的横向偏移位置;清除纵坐标偏移将使点击书签后跳转到该页面的顶端。 - -24. 更改目标页码:修改点击书签后的目标页面页码。 - -25. 更改书签文本大小写:设置书签文本的英文大小写形式。 - -26. 更改目标页面坐标:更改点击书签后的目标页面坐标,可以设置绝对值或偏移修改值。 - -27. 合并书签:将选中的书签合并为一个书签,保留最上方一个书签的属性,所有选中书签文本串联起来作为该书签的文本。 - -28. 强制设置为文件内链接:某些书签点击后将打开外部文件,用此命令强制将链接行为转换为转到当前 PDF 文件内的页面。某些 PDF 文档改名后书签失效,原因也是由于其书签使用外部文件方式指向页面,在没有改名前,外部文件的文件名和 PDF 文件名刚好一致;当 PDF 文档改名后,书签指向的外部文件就无效了,因此就无法打开指定页面了。使用此功能可修复这些失效的书签。 - -29. 点击保存按钮将修改后的书签保存为信息文件。 - -30. 点击补丁按钮将弹出一个对话框,在该对话框可直接用修改后的书签和原 PDF 文档组合成新的 PDF 文档。 - -选中修改操作包含未选中的内部书签复选框,则修改操作将影响选中书签的子书签。详见[编辑修改子书签](#编辑修改子书签)一节的讲解。 - -### 操作步骤概述 - -书签编辑器的操作方法简述如下: - -选择编辑书签文件功能。 - -点击打开按钮,指定需要编辑的书签文件或 PDF 文件。 - -加载文件后,书签将出现在树形列表中,使用工具栏的按钮或菜单可修改书签。 - -点击保存按钮可将书签保存为信息文件。(保存为信息文件后,可用高级补丁功能的导入信息文件功能或合并处理模式等将书签补丁到新文档;如不需保存信息文件,可跳过此步骤) - -点击补丁按钮,程序将弹出一个对话框供选择输出 PDF 文件的位置。\ -![新的图片](media/image36.png) - -选择目标 PDF 文件后,点击确认按钮,程序将复制原始 PDF 文件,生成带有书签的目标 PDF 文件。 - -提示:按住 Ctrl 键点击保存按钮可换名保存。打开的文档为 PDF 文件时,总是执行换名保存。 - -### 基本编辑功能 - -打开书签后,可使用编辑器界面修改书签的样式及属性。基本编辑操作分述如下。 - -#### 选择书签 - -使用鼠标点击书签项,项目颜色变成反白,表示书签被选中。 - -编辑器的命令通常只作用于被选中的书签。要使编辑命令作用于内部书签,可选中修改操作包含未选中的内部书签复选框。 - -如需要同时选中多个书签,可按住键盘的 Shift 键或 Ctrl 键,再用鼠标点击需要选择的书签(按住 Shift 键点击,选择一定范围内的所有书签;按住 Ctrl 键点击,逐个选择鼠标点击过的书签;当书签被选中时,按住 Ctrl 键再点击该书签将取消其选中状态)。 - -按键盘的 Ctrl+A 组合键,可选中所有显示的书签。 - -**注意**:按 Ctrl+A 组合键不会选中未被展开的子书签。 - -#### 在编辑器中展开或收拢书签 - -当打开书签文件时,书签默认处于折叠状态。例如加载某文档的书签后,书签编辑器如下图所示。从图中可看到,顶层书签有三个,点击书签的动作是转到 PDF 文档由页码栏列出的页面。 - -![新的图片](media/image37.png) -
    图表 4--32:加载某PDF书签后的编辑器界面
    - -文本为"书签 1"的书签项左方有一个加号,表示该书签包含子书签。点击该加号,收拢在书签内的子书签就会显示出来,然后加号会变成减号。如下图所示。从图中可见,"子书签 1"还包含子书签,而"子书签 2"和"子书签 3"则不包含子书签。 - -![新的图片](media/image38.png) -
    图表 4--33:展开书签以显示其子书签
    - -点击书签文本左方的减号,其子书签又会收拢回去,恢复展开前的状态。 - -#### 移动或复制书签 - -选中书签后,用鼠标点住需要移动书签的文本区域,然后拖动鼠标,就可以移动书签。将鼠标移到其它书签上面,释放鼠标按键,就可使选中的书签移到放开鼠标的位置。 - -例如,在下图中选中"孙书签 1"和"子书签 2"两个书签后,用鼠标将其拖动到"子书签 1"书签上。在"子书签 1"上将显示一个蓝色的矩形。 - -![新的图片](media/image39.png) -
    图表 4--34:移动或复制书签
    - -蓝色的矩形有四个区域,在不同区域放开鼠标有不同移动方式。以上图为例。 - -在①区域上放开鼠标,选中的书签将移动到"书签 1"的前面。 - -在②区域上放开鼠标,选中的书签将移动到"书签 1"的后面。 - -在③区域上放开鼠标,选中的书签将移动到"书签 1"的所有子书签的前面。 - -在④区域上放开鼠标,选中的书签将移动到"书签 1"的所有子书签的后面。 - -移动书签后的效果分别如下图各标记所示(被移动的两个书签已用颜色标记)。 - -![新的图片](media/image40.png) -
    图表 4--35:移动书签的效果
    - -**说明**:在拖动书签时,按键盘的 Esc 键可取消拖动操作。 - -在拖动书签放开鼠标时,按住键盘的 Ctrl 键可复制书签,即原选中书签将在原处保留,在新位置中创建选中书签的副本。按住键盘的 Ctrl 键和 Shift 键放开鼠标,复制的书签将包含选中书签的子书签。 - -#### 修改书签文本 - -方法一:选中需要修改的书签,然后用鼠标再点击该书签项(或按键盘的 F2 键),书签文本将进入编辑状态。完成编辑后,按回车键(或用鼠标点击其它书签项目)确认修改。如要取消编辑操作,可按键盘的 Esc 键退出编辑。 - -方法二:点击书签对应动作列的文本,将弹出一个属性框。在该属性框中修改书签文本文本框的文本,然后点击确定按钮关闭对话框。详见[修改书签属性](#修改书签属性)]小节。 - -#### 修改书签属性
    - -点击书签项对应动作列的蓝色文本,将弹出一个属性框。如下图所示。 - -![新的图片](media/image41.png) -
    图表 4--36:链接动作编辑器
    - -在该属性框中: - -修改名称文本框对应的文本可修改书签的文本。 - -在类型下拉框中可选择点击书签后执行的动作。 - -在目标分组框中可指定书签的目标位置(一般选择转到指定位置单选框)。横坐标为默认时,点击书签后保持横坐标偏移位置不变。纵坐标选择默认时,点击书签后默认转到页面顶部。如横坐标或纵坐标值为 0,则点击书签后保持阅读器原来的坐标偏移值不变。 - -点击确定按钮关闭对话框,确定修改。 - -点击取消按钮,则取消修改书签属性的操作。 - -#### 设置书签样式 - -书签的样式有粗体、斜体两种,还可以设置书签文本的颜色。在工具栏均有对应的按钮。 - -提示:在设置书签文本颜色时,如选择白色,则还原书签文本为默认颜色。 - -#### 设置书签的默认打开状态 - -书签默认的打开状态可通过修改打开列的复选框选中状态而设置。该复选框选中打钩时,书签在阅读器中默认打开(显示其子书签),不选中打开复选框时,书签在阅读器中默认折叠(子书签不可见)。 - -使用修改菜单的设置书签默认打开状态命令可修改多个书签的默认打开状态。 - -#### 插入书签 - -点击插入书签按钮,或按键盘的 Insert 键,可插入一个新的书签项。 - -提示:用按住 Ctrl 键拖放书签的方法,也可以复制创建新的书签。 - -#### 删除书签 - -选中书签后,点击删除按钮,或按键盘上的 Delete 键,可删除选中的书签。 - -删除书签时,如书签包含子书签,则子书签也会被删除。要避免删除子书签,请在删除前将子书签移出,再删除书签。 - -#### 编辑修改子书签 - -在一般场合下,修改书签操作不会影响其子书签或子书签包含的书签。按 Ctrl+A 组合键全选书签时也不会选中未展开的子书签。 - -如需修改子书签,一种方法是将书签展开,使子书签显示出来,然后再选中子书签进行修改。如下图同时选中"书签 1"和"子书签 2"两书签准备修改。 - -![新的图片](media/image42.png) -
    图表 4--37:选择被展开的子书签以备编辑
    - -另一种方法是选中"修改功能作用于未选中的内部书签"复选框。选中该复选框后,不论书签是否展开,编辑器的命令将既修改选中书签,又修改其包含的内部书签。如下图所示。 - -![修改子书签](media/image43.png) -
    图表 4--38:选中修改操作包含未选中的内部书签执行修改
    - -**注意**:按住 Shift 键再点击书签编辑器的命令,编辑命令会作用于书签的内部书签,相当于临时选择了修改功能作用于未选中的内部书签复选框。 - -#### 缩进书签层次 - -点击工具栏的按钮,或按键盘的 Tab 键,可将选中书签向内缩进一层。 - -除此之外,还可使用鼠标拖放的方式改变书签位置(见前文"[移动或复制书签](#移动或复制书签)"小节)。 - -#### 更改书签目标页码 - -点击书签列表页码列,可修改书签的目标页码。 - -如需一次修改多个书签的目标页码,可使用修改菜单下更改目标页码的指令,或按小键盘上的加号键或减号键,增减选定书签的页码。 - -此外,点击动作列的链接,在弹出的对话框中也可更改书签的目标页码。 - -### "修改"菜单功能 - -修改菜单包含了大量为编辑 PDF 书签而设的功能。在使用这些功能时,请留意修改功能作用于未选中的内部书签复选框是否选中。没有选中该复选框时,修改功能仅作用于选中的书签;选中该复选框时,修改功能还作用于选中书签的下级书签。此菜单若干功能在前文已有讲述,下文将介绍前文未讲述的命令。 - -#### 更改书签的显示方式 - -某些书签点击后会更改阅读器的显示比例。一般来说,这种行为并不是读者所需要的。如需去除书签对显示比例的影响,可使用更改书签的显示方式命令,将显示比例设置为保持不变。 - -使用此菜单命令,也可指定点击书签后缩放到指定的比例,如适合页面适合页宽等。 - -如果只需要更改某一个书签的显示方式,也可点击书签列表动作列的链接,在弹出的对话框中选择所需的缩放比例。 - -#### 清除坐标定位偏移 - -某些书签点击后会使阅读器视图偏移一定的方向,可使用此功能清除其影响。 - -#### 更改目标页面坐标 - -此功能可更改点击书签后转到目标页面后的定位坐标。命令界面如下所示。 - -![新的图片](media/image44.png) -
    图表 4--39:输入坐标调整值对话框
    - -对大部分书签而言,只需编辑方位为的坐标。相对调整是在原坐标基础上增加坐标调整量(调整量为负数则表示减少原坐标)。绝对调整是将坐标调整量设为坐标值。 - -如只需调整单一书签的坐标,可点击书签列表动作列的链接,在弹出的对话框中编辑书签目标坐标值。 - -#### 合并书签 - -此功能是将多个同级书签合并为一个书签。合并后书签的文本为原选定书签文本的串联。 - -如果被合并书签包含子书签,则所有子书签将变为合并后书签的子书签。 - -### 搜索及替换书签文本 - -书签编辑器的另一大特色是可以批量搜索并替换书签文本。点击搜索及替换书签文本按钮,将弹出如下图所示的对话框,使用该对话框可完成搜索替换书签文本任务。 - -![新的图片](media/image45.png) -
    图表 4--40:搜索及替换书签文本对话框
    - -在搜索文本框中,可输入需要搜索的文本。点击右侧的三角按钮,可选择之前用来搜索的文本。 - -默认搜索不区分英文大小写,如需区分,可选择区分大小写复选框。 - -默认搜索是模糊搜索,即只要书签文本有部分匹配搜索文本,就算是匹配。选择匹配整个书签的文本复选框后,只有书签文本完全匹配搜索文本时,才算是匹配。 - -搜索模式有三种。 - -第一种是普通模式,用来检索书签文本是否包含搜索文本。 - -第二种是正则表达式模式,搜索文本被视为一个正则表达式,当书签文本符合该表达式时,就算是匹配。 - -第三种是XPath模式。在该模式下,书签编辑器的书签被视为一个 XML 文档,每个书签是一个书签元素,书签的属性(如目标页码、动作等)则被视为 XML书签元素的属性。搜索文本被视为一个 XML 路径表达式,当书签元素匹配该表达式时,视为匹配。书签 XML 文档的结构可参考信息文件的[文档书签](#文档书签)一节。 - -在替换文本框中输入替换匹配搜索内容的文本。如果使用正则表达式搜索模式,并在搜索表达式中指定了分组匹配,在替换文本中可用`$1`、`$2`等方式替代匹配分组。 - -#### 正则表达式搜索示例 - -下面以数则示例说明正则表达式搜索的用途。设书签编辑器已加载的书签如下图所示。 - -![新的图片](media/image46.png) -
    图表 4--41:示例书签
    - -表格 4--5:正则表达式搜索示例 - -| 要匹配的书签 | 表达式 |搜索结果 |说明 | -|----------------------------------- |--------------------- -|-------------------------------- -|----------------------------------------------------------------------------------------------------------------------| -| 包含任意字符 | .\* |所有书签 |"."表示任意字符;"\*"表示前面的模式出现 0 或任意次,".\*"表示任意字符出现 0 或任意次 | -| 以"书签"开头 | \^书签 |书签 1、书签 2、书签 10、书签 11 |"\^"表示文本的开头 | -| 以"书签 1"结尾 | 书签 1\$ |书签 1、子书签 1、孙书签 1、书签 11 |"\$"表示文本的结尾 | -| 包含"子书签"或"孙书签" | \[子孙\]书签 |子书签 1、子书签 2、子书签 3、书签 2 |"\[\]"里面表示范围匹配,只要被匹配文本的字符符合范围里的任一个字符就是匹配了,该表达式相当于匹配"子书签"或"孙书签"文本| -| | 子书签\|孙书签 | |"\|"表示"逻辑或"的关系,此表达式的含义即"子书签"或"孙书签" | -| 书签文本完全匹配"书签 1"或"子书签 1" | \^子?书签 1\$ |书签 1、子书签 1 |"?"表示前面的内容不出现或出现 1 次 | -| | \^(书签 1\|子书签 1)\$ | |"()"表示里面的内容为一组 | -| "书签"后跟一个非 1 的数字 | 书签\[2-90\] |子书签 2、子书签 3、书签 2 |"\[\]"里面表示范围匹配,"2-9"表示匹配 2 到 9 的字符,后面的"0"匹配字符"0",在这个集合中不包含 1,所以就匹配了非 1 的数字 | -| "书签"后跟一个非 1 的字符 | 书签\[\^1\] |结果同上 |"\[\^\]"表示筛选范围匹配,被匹配文本不能是方括号里面的任一个字符,"\[\^1\]"表示不能是 1 的任意字符(可能是汉字或标点等)| -| 包含两个数字 | \[0-9\]{2} |书签 10、书签 11 |"{2}"表示匹配前面的模式两次,"\[0-9\]{2}"即匹配 2 位数字 | -| "书签"后跟若干个数字 | \^书签\[0-9\]+ |书签 1、书签 2、书签 10、书签 11 |"+"表示匹配前面的模式至少一次,"\[0-9\]+"表示匹配至少 1 个数字,又如".+"表示匹配至少 1 个任意的字符 | -| | \^书签\[0-9\]{1,} | |"{1,}"表示匹配前面的模式至少 1 次,相当于"+"号,又如"{2,}"表示最少匹配前面的模式两次,而"{2,3}"表示匹配 2 或 3 次 | - -如搜索表达式使用了圆括号`()`分组,替换时可使用`$1`、`$2`等替代符替代分组的内容。 - -例如,需要将"子书签 1"、"子书签 2"的形式转换为"1)子书签"、"2)子书签"的形式(将数字提到前面),可使用搜索表达式"子书签(\[0-9\]+)"定位书签,并用括号分组"(\[0-9\]+)"捕获数字,然后用"\$1)子书签"作为替换文本,其中"\$1"表示替代搜索表达式中括号内匹配的数字。 - -再如,将"子书签 1"、"孙书签 1"、"子书签 2"等的数字和文本互换位置,变成"1 子书签"、"1 孙书签"、"2 子书签"等形式,可使用搜索表达式"(\[子孙\]书签)(\[0-9\]+)",使用两对括号分组,第一组匹配"子书签"或"孙书签",第二组匹配后面的数字,然后用"\$2\$1"作为替换文本执行替换即可。 - -更多关于正则表达式的内容,请参阅有关教程和资料。 - -#### XML路径(XPath)搜索示例 - -XPath 搜索的原理是将书签信息文件看作一个 XML 文档,然后在其上面执行 XML 路径匹配。符合 XML 路径表达式的书签将被选中。使用 XML 路径搜索可完成普通搜索无法完成的搜索任务。 - -每个书签在 XML 文档中以`书签`元素表示,书签的属性(如页码、动作等)以 XML 属性表示,子书签被视为上级书签的子元素。 - -以上节插图所示的书签为例,举 XML 路径匹配数例如下表所示。 - -| 要匹配的书签 | 表达式 | 搜索结果 | 说明 | -| ----------------------------------- | ----------------------------------------- | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 文本为"书签1" | \@文本=\'书签1\' | 书签1 | "\@文本"表示书签的文本,需要匹配的文本字符串以英文单引号"\'"或双引号"\""括起;等号表示比较两边的值是否相等 | -| 目标页码范围为5到10 | \@页码 \>= 5 and \@页码 \<= 10 | 子书签3、书签2 | "\@页码"表示书签的目标页码,"and"表示"逻辑与"关系;"\>="表示大于或等于关系,而"\<="表示小于或等于关系 | -| 样式为粗体 | \@样式=\'粗体\' | 没有匹配的书签 | "\@样式"表示书签的粗体或斜体样式;本示例中没有样式为粗体的书签 | -| 有子书签的书签 | 书签 | 书签1、子书签1 | "书签"表示检查是否有名为"书签"的子书签 | -| 子书签内还有子书签的书签 | 书签/书签 | 书签1 | 第一个"书签"匹配有子书签的书签,"/"表示向内一层,第二个"书签"表示匹配上述已匹配书签内还有子书签的书签 | -| 和上层书签指向相同页码的书签 | ../\@页码 = \@页码 | 孙书签1 | "../"表示上层书签,"../\@页码"则表示获取上层书签的"页码"属性,第二个"\@页码"是当前书签页码;当上层书签的页码与当前书签页码相等时,等式成立("孙书签1"的页码和其上层书签"子书签1"指向的页码均为3) | -| 有文本以"孙书签"开头的子书签的书签 | 书签\[starts-with (\@文本, \'孙书签\')\] | 子书签1 | 首先"书签"筛选了拥有子书签的书签,然后"\[\]"表示其中的内容为这些子书签的判定条件,若条件成立,视为匹配;"starts-with"是函数,当第一个参数以第二个参数开始时,视为判定成立 | -| 文本包含"子书签" | contains(\@文本, \'子书签\') | 子书签1、子书签2、子书签3 | "contains"函数表示检查第一个文本参数是否包含第二个文本参数的内容 | -| 同级内的第一个书签 | position() = 1 | 封面、子书签1、孙书签1 | "position"函数返回当前书签的位置;只计算位置时,可用简化表达式"1" | -| | 1 | | | -| 同级内的最后一个书签 | last() | 孙书签1、子书签3、书签2 | "last"函数返回最后一个同级书签的位置,当书签是最后一个书签时,其位置等于该函数返回的值(本表达式相当于"position()=last()") | -| 位置不是同级书签内最后一个的书签 | following-sibling::书签 | 封面、书签1、子书签1、子书签2 | "following-sibling::书签"表示同级下一个书签;每层内最后一个书签是没有下一个同级书签的,因此本要求相当于匹配有下一个同级的书签 | -| 有3个子书签的书签 | count(书签)=3 | 书签1 | "count"函数返回匹配其括号中表达式的节点个数 | - -更多关于 XML 路径的内容,请参阅有关教程与资料。 - -## 识别图像文本 - -识别图像文本功能可将 PDF 文档内图片的文字识别出来,变成可编辑的文本文件,在编辑文件后,可将该文本写入 PDF 文档成为透明的文本层,使 PDF 文档的图像文本可被检索工具索引。 - -**注意**:本功能要求机器上安装微软 Office 2003 或 Office 2007 的 Document Imaging 组件及对应的语言识别模块。 - -本功能的界面如下图所示。 - -![新的图片](media/image47.png) -
    图表 4--42:识别图像文本功能
    - -### 识别图像文本操作步骤 - -1. 选择识别图像文本功能。 - -2. 点击原始 PDF 文件右边的浏览按钮,指定需要识别图片文字的 PDF 文件路径。 - -3. 如需将识别结果保存为文本文件,则点击识别结果文件右边的浏览按钮,指定保存文本文件的位置。如在识别过程不指定此文件路径,程序将把识别结果输出到日志窗口。 - -4. 在识别页码范围文本框中输入需识别图像文本的页码,如不输入,则识别所有页面的图片。 - -5. 点击识别图像文本按钮,开始识别。 - -**说明**:如识别结果文件的后缀为".xml",则输出的信息文件将包含所识别文本在页面中的坐标信息。 - -### 写入识别结果操作步骤 - -1. 选择识别图像文本功能。 - -2. 点击原始 PDF 文件右边的浏览按钮,指定生成识别结果文件的 PDF 文件路径。 - -3. 点击识别结果文件右边的浏览按钮,指定识别后保存的 XML 结果文件路径。 - -4. 点击输出 PDF 文件右边的浏览按钮,指定写入识别结果后生成的 PDF 文件路径。 - -5. 点击写入识别结果按钮,开始识别。 - -### 识别选项 - -如原文档图片中的文字是统一排版方向(即全是横排或全是竖排),建议在文字排版方向下拉框中选择对应的排版方式。 - -在文字识别语言下拉框中可选择识别语言,默认的是简体中文,此外可选繁体中文或英文。 - -**说明**:识别图像文本功能是通过调用微软 Office Document -Imaging 组件的识别引擎来识别文本的。因此,必须先安装对应的语言识别组件。如果只安装了简体中文识别引擎,显然是无法正确识别繁体中文的。 - -旋转校正拉伸校正复选框可让识别引擎尝试识别图像中文本的旋转方向和倾斜角度,以提高识别效果。为提高识别速度,默认不选择此二选项。 - -选中检测页面方向复选框,可让程序自动识别页面是横向还是纵向。 - -选中纠正倾斜页面复选框,可让程序自动纠正倾斜的页面,提高识别正确率。 - -**说明**:选中上述两个选项均需要执行更多的运算,如识别结果较理想,无需选择上述两选项,以便提高识别速度。 - -选择保存原始的识别结果复选框时,原样保存微软 Office 识别组件输出的识别结果。在需要将识别结果写入 PDF 文档时,建议选中该选项。不选中该复选框时,程序尝试将同一行的文本组合在一起,以便提取识别文本内容。 - -### 识别目录页为简易书签文件 - -识别图像文本的一个功能是将扫描 PDF 文档目录页识别成简易书签文件,用于快速制作 PDF 书签。 - -微软 Office 的识别引擎在识别目录页时效果不太好,识别引擎通常会将目录中的点号(即连续出现的省略号"......")误识别为一系列的句号或数字"0"等字符。建议选中"识别目录页的点(......)分隔符"复选框,这样程序会尝试纠正识别引擎的错误结果。 - -此外,建议选中压缩连续出现的空格复选框,必要时可再选中删除汉字间的空格复选框,并取消识别分栏排版复选框(当文字排版方向为自动检测时,无法切换此复选框的选择状态,需手工指定排版方向才能切换此复选框)。 - -识别之后输出的文本文件可直接用[书签编辑器](#编辑书签文件)打开。 - -使用书签编辑器的更改目标页码功能可修复目录页码与实际页码的对应关系。 - -## 提取图片 - -提取图片功能可将 PDF 文档的图片无损导出为图片文件。 - -本功能的界面如下图所示。 - -![新的图片](media/image48.png) -
    图表 4--43:提取图片功能
    - -### 操作步骤 - -1. 选择提取图片功能。 - -2. 点击原始 PDF 文件右边的浏览按钮,指定需要提取图片的 PDF 文件。 - -3. 点击输出位置右方的浏览按钮,将弹出一个目录浏览框。利用该对话框选择一个目录,导出的图片将存放到该目录。 - -4. 点击提取图片按钮。 - -5. 程序界面转到输出信息界面。程序将打开 PDF 文件,并将文件中的图片导出到之前指定的目录。在导出过程中,可随时点击输出信息界面中的返回按钮终止导出过程。 - -### 提取选项 - -1. 页码范围:指定导出特定范围页码的图片。如不指定页码范围,则导出 PDF 文件中可以找到的所有图片。 - -2. 尝试合并相同页面的图片:尝试将同一页内具有相同水平坐标、相同宽度和相同格式的图片合并为一副图片。提供这个功能的原因是有些 PDF 制作工具会将一副图片分割成多片,逐片写入 PDF 文件。这样,提取出来的图片将是零散的。使用此功能会将这些零散的图片重新整合为一个图片。 - -3. JPEG 图片无损合并为 PNG 图片:选择尝试合并相同页面的图片时,如合并前的图片为 JPEG 图片,则将这批图片无损合并为 PNG 图片。 - -4. 垂直翻转图片:将导出的图片垂直翻转。有些 PDF 制作工具将图片垂直翻转后写入 PDF 文件。这样,提取出来的图片将上下颠倒。使用此功能可将上下颠倒的图片还原回来。 - - **注意**:如果图片采用 JPEG 等有损格式压缩,垂直翻转图片可能导致提取图片的质量下降。 - -5. 反转黑白图片的颜色:将只有两种颜色的图片反转颜色。有些 PDF 制作工具会将图片黑白颠倒,然后在 PDF 的渲染指令中使用设定绘图颜色的方式将颜色在渲染时颠倒过来。这样会导致提取出来的图片黑色和白色相反。使用此功能可将相反的颜色还原回来。 - -6. 忽略指定宽度或高度的图片:某些 PDF 文件包含一些很小的图片。如不需要导出这些图片,可使用此选项将其忽略。 - -7. 导出批注内的图片:选中此选项后,导出批注内的图片。不选中此选项时仅导出 PDF 正文的图片。 - -### 文件命名规则 - -提取出来的图片文件名默认为页数编号的四位数文件名称(掩码为"0000"),如"0001.jpg"、"0002.tif"、"0010.tif"等。文件名的扩展名部分则根据 PDF 文档中图片采用的压缩方法自动生成。例如:图片是 JPEG 算法压缩的,扩展名为"jpg";黑白两色的(使用 CCITTFax 或 JBIG2 算法压缩),扩展名为"tif";彩色或灰度的(使用 Deflate 等算法压缩),扩展名为"png"。 - -提取图片文件扩展名前面的部分可以通过更改文件名掩码修改。 - -如不需用 0 填充位数,可输入掩码"0"或不输入掩码,程序将输出图片文件名如"1.jpg"、"2.tif"、"10.tif"等。 - -如果在掩码中填入汉字,则输出文件名包含汉字名称。如掩码"文档 000"将生成"文档 001.jpg"、"文档 002.tif"等图片文件。 - -如果文件名不变的部分包含"0",可用半角引号"\""将不变的部分括起来。如掩码"\"Windows 2008 参考大全\"0",将生成"Windows 2008 参考大全 1.jpg"、"Windows 2008 参考大全 2.png"等图片。 - -更改文件掩码时,"示例"标签将演示第 1、2、3、11、12、13 和 100 页的图片文件命名情况。 - -## 提取页面 - -提取页面内容功能可以将 PDF 文档指定范围的若干页面导出成一个单独的 PDF 文件。 - -本功能的界面如下图所示。 - -![新的图片](media/image49.png) -
    图表 4--44:提取页面功能
    - -提取页面的操作方法如下所示: - -1. 选择提取页面功能。 - -2. 点击原始 PDF 文件右边的浏览按钮,指定需要提取页面的 PDF 文件。 - -3. 点击输出位置右方的浏览按钮,将弹出一个保存文件浏览框。利用该对话框指定提取页面后制作 PDF 文件的保存位置。 - -4. 如仅需导出特定范围页码内的内容,可在页码范围右边的文本框中填入页码范围。如不指定页码范围,则导出 PDF 文件的所有页面。 - -5. 如有某些页码不需提取,也可在排除页码范围文本框中填入需剔除的页码范围。 - -6. 点击提取页面按钮。 - -7. 程序界面转到输出信息界面。程序将打开原始 PDF 文件,并将指定范围内的页面导出为一个新的 PDF 文件。在导出过程中,可随时点击输出信息界面中的返回按钮终止导出过程。 - -提示:页码范围支持逆序范围,如页码范围"10-1",将先插入源文件的第 10 页,再插入第 9 页,以此类推,最后插入第 1 页到输出文档。除使用本功能导出 PDF 文件的指定页面,还可以使用"[制作PDF文件](#全局选项)"功能,从已有 PDF 文件导出页面生成新 PDF 文件。 - -## 文档结构探查器 - -文档结构探查器为 PDF 开发人员、爱好者等提供了一个查看、修改 PDF 文档内部结构的工具。 - -本功能的界面如下图所示。 - -![新的图片](media/image50.png) -
    图表 4--45:文档结构探查器界面
    - -操作方法: - -1. 选择文档结构探查器功能。 - -2. 点击打开按钮,打开感兴趣的 PDF 文档。 - - **提示**:可以从"我的电脑"或资源管理器将 PDF 文档拖到功能界面以打开该文档。 - -3. 稍等片刻,待程序打开文档后,程序以树型列表展示 PDF 文档内部层次结构。 - -4. 列表第一列是节点的名称。某些节点(如字典、数组类型节点)包含内部节点,则该节点图标左方具有一个加号。点击加号可展开节点,查看内部节点的内容。某些指向字典或数组的引用节点,其图标左方也有加号。点击该加号可展开查看引用节点指向目标的内容。 - -5. 文档的根节点是文档编录(Trailer)节点。 - -6. 为方便使用,程序将文档的各个页面转换成单独的页面节点,独立显示在 Pages 节点下(该节点为虚拟节点,实际上是根据文档内部的页面树字典生成的)。 - -7. 列表第二列是节点的值,用鼠标点击对应的单元格,可修改其内容。 - -8. 列表下方是备注窗口,讲解所选节点的含义及其取值范围。程序内置数十个常见 PDF 节点的信息,可供 PDF 爱好者参考。 - -9. 点击删除按钮可删除选中的节点。有些节点在文档中是必须存在的,不能删除。选择该节点时,删除按钮将被禁用(显示成灰色按钮)。删除字典或数组节点时,字典或数组的内容节点也将被删除。删除引用节点时,仅删除该节点,不会删除该节点指向的目标节点。 - -10. 选中文档的数据流节点,按导出按钮,可将内容节点导出成二进制文件或文本文件供外部程序分析。 - -11. 选中文档内的图像数据流,按查看按钮,将弹出一个窗口显示数据流的图片。 - -12. 选中文档内的文本数据流,按查看按钮,在备注窗口可查看文本流的内容。 - -13. 在修改文档后,如需保存修改后的文档,可点击保存按钮。 - -警告:在使用文档结构探查器前,应准备一定的 PDF 知识。如果此工具使用不当,并将修改后的文档覆盖原始 PDF 文件,将可能导致丢失数据,造成无可挽回的损失。 - -## 全局选项 - -此选项指定程序各功能通用的工作方式。 - -![新的图片](media/image51.png) -
    图表 4--46:程序的全局工作选项
    - -访问 PDF 文档:指定程序读取 PDF 的策略。选中优化处理效率,则程序尽量将整个 PDF 文件加载到内存,方便提高处理效率。选中减少占用内存,则程序仅加载 PDF 的索引表,尽量减少使用内存的数量。如 PDF 文档较大,可使用此选项以免程序因加载文档而耗尽内存。 - -读取文档所用的编码:有些 PDF 文档采用了不规范的编码,导致无法正常阅读,导出的信息文件也为乱码。可使用此选项强制指定读取编码形式,尝试以不同的编码形式导出信息。详细使用方法请参见[修复文字为乱码的书签](#用独立补丁功能修改多个pdf文件的书签打开状态)。 - -## 输出信息 - -界面的日志内容文本框输出程序工作过程的信息和遇到的错误。程序开始执行任务后将转到此界面。 - -![新的图片](media/image52.png) -
    图表 4--47:输出信息界面
    - -在程序工作过程中,点击返回按钮将弹出一个确认对话框,在对话框中点击按钮将终止程序的工作。 - -在程序完成工作后,点击返回按钮将返回到之前的功能界面。 - -点击日志窗口带下划线的文件名或目录名可打开对应的文件或目录。 - -# 应用示例 - -为更好的讲解 PDF 补丁丁的使用方法,这里设立了几个情景示例,读者可举一反三,将程序用得更好。 - -## 取消书签及页面链接的显示比例 - -任务:有些 PDF 文档的书签或页面链接点击后会改变阅读器的显示比例,例如读者本来使用 135%的显示比例,点击书签后,显示比例变成了适合页面,字体变得很小。这为读者阅读造成了不便。使用 PDF 补丁丁可轻易地保持阅读器显示比例,不让其自由改变而影响阅读。 - -操作步骤如下: - -1. 选择PDF 文档选项功能。 - -2. 点击阅读方式选项卡,选中禁止书签及页面链接更改显示比例复选框。 - -3. 选择处理、制作 PDF 文档功能的独立补丁模式。 - -4. 向文件列表添加需要修改的 PDF 文档。 - -5. 指定输出 PDF 文件的路径。 - -6. 点击生成 PDF 文件按钮。在生成的新文件中,点击书签和页面链接都不会更改阅读器的显示比例了。 - -处理过程的示意图如下所示。 - -![新的图片](media/image53.png) -
    图表 5--1:补丁步骤1~2:选择补丁选项
    - -![新的图片](media/image54.png) -
    图表 5--2:补丁步骤3~6:选择文件执行补丁
    - -## 关闭默认展开状态的书签 - -任务:有些 PDF 文档具有书签,方便阅读。但书签数量和层数都很多,而且全部处于默认展开的状态,要翻动滚动条才能找到需要的项目。将书签默认状态改为关闭,在阅读时再手动打开,通常比默认打开所有书签要方便。使用 PDF 补丁丁可批量改变文档书签的打开状态。 - -### 用独立补丁功能修改多个PDF文件的书签打开状态 - -使用独立补丁功能修改书签打开状态的操作步骤如下: - -1. 选择PDF 文档选项功能。 - -2. 点击阅读方式选项卡,找到书签状态下拉框,选择全部关闭。 - -3. 选择处理、制作 PDF 文档功能的独立补丁模式。 - -4. 向文件列表添加需要修改的 PDF 文档。 - -5. 指定输出 PDF 文件的路径。 - -6. 点击生成 PDF 文件按钮。在生成的新文件中,书签都是关闭状态了。 - -### 用书签编辑器修改单个PDF文件的书签打开状态 - -使用书签编辑器修改 PDF 文档书签打开状态的操作步骤如下: - -1. 选择编辑书签功能。 - -2. 点击打开按钮,打开需要修改的 PDF 文件。 - -3. 批量选中需要修改打开状态的书签,然后选择修改菜单下设置书签默认打开状态子菜单相应命令。 - -4. 点击补丁按钮,保存修改后的 PDF 文件。 - -提示:如选中的书签内还有子书签,请选中修改操作包含未选中的内部书签复选框,以将修改命令应用到内层书签。 - -与独立补丁功能相比,此方法可按需令某些书签默认打开,但显然无法批量处理 PDF 文件。 - -## 统一页面的尺寸 - -任务:某 PDF 文件页面尺寸参差,希望能统一其页面尺寸方便阅读。使用 PDF 补丁丁的操作步骤如下。 - -1. 选择PDF 文档选项功能。 - -2. 在页面布局选项卡,默认状态下,尺寸下拉框为等同原始内容尺寸,可将其改为其它已定义好的尺寸,如A416 开等,或选择自定义,然后在处输入适当的数值。 - -3. 选择源 PDF 页面调整组内的缩放内容适应页面单选框。 - -4. 返回处理、制作 PDF 文档功能,选择独立补丁模式。 - -5. 添加需要统一页面尺寸的文件并指定输出 PDF 文件。 - -6. 点击输出 PDF 文件按钮。 - -操作过程所选择的选项如下图所示。 - -![新的图片](media/image55.png) -
    图表 5--3:补丁步骤2~3:为PDF文档选择统一尺寸
    - -提示:PDF 文档第一页的尺寸在文件列表上已列出。 - -## 调整竖排文档的双页阅读顺序 - -任务:现在流行宽屏显示器,有些较大的宽屏显示器可一次显示两页文档。切换到双页视图将可减少翻页次数,便于阅读。但双页显示的默认阅读方向是从左到右,对于竖排文档而言,则不便阅读:首先要从页面中间开始,读到页面左下角,再跳到页面右上角读下一页。如下图左所示。 - -如可改变阅读方向,改为从右到左,则阅读竖排文档将更为方便:从页面右上角开始阅读,到左下角读完两页,视线不需拐弯。如下图右所示。 - -![1](media/image56.png)   ![2](media/image57.png) - -操作步骤如下: - -1. 选择PDF 文档选项功能。 - -2. 点击阅读方式选项卡。 - -3. 在阅读方向下拉框中选择从右到左。 - -4. 返回处理、制作 PDF 文档功能,选择独立补丁模式。 - -5. 添加需要删除动作的 PDF 文件。 - -6. 指定输出 PDF 文件的路径。 - -7. 点击生成 PDF 文件按钮。用 PDF 阅读器打开生成的新 PDF 文件,切换到双页视图后,会发现阅读顺序已改为从右到左了。 - -## 禁止打开文档时自行设定"适合页面"显示的行为 - -任务:某些 PDF 文档在打开时自动将阅读器的显示比例设置为适合页面,导致显示字体过小,每次阅读时均需人工调节显示比例,颇为不便。用 PDF 补丁丁可以禁止文档的这种行为。 - -操作步骤如下: - -1. 选择PDF 文档选项功能。 - -2. 点击文档杂项选项卡。 - -3. 选中删除打开文档时自动执行动作复选框。 - -![新的图片](media/image58.png) -
    图表 5--4:选择禁止打开文档时自动执行动作选项
    - -4. 返回处理、制作 PDF 文档功能,选择独立补丁模式。 - -5. 添加需要删除动作的 PDF 文件。 - -6. 指定输出 PDF 文件的路径。 - -7. 点击生成 PDF 文件按钮,程序将读取原始 PDF 文件,删除文档的自动执行动作,并输出为新的 PDF 文件。 - -## 清除打开页面时弹出的网页 - -任务:某 PDF 文件在阅读到某一页时,自动打开浏览器访问特定的网站。这是由于该 PDF 文件在页面中执行了打开网页的动作。使用 PDF 补丁丁可以删除这些动作。 - -操作步骤如下: - -1. 选择PDF 文档选项功能。 - -2. 点击文档杂项选项卡。 - -3. 选中删除页面上自动执行动作复选框。 - -4. 如在打开文档时也有网页弹出,可选中删除打开文档时自动执行动作复选框。 - -5. 返回处理、制作 PDF 文档功能,选择独立补丁模式。 - -6. 添加需要删除动作的 PDF 文件。 - -7. 指定输出 PDF 文件的路径。 - -8. 点击生成 PDF 文件按钮,程序将读取原始 PDF 文件,删除页面中的自动执行动作,并输出为新的 PDF 文件。 - -## 导出文本形式的书签 - -任务:将 PDF 文件的书签导出成文本形式的目录。 - -操作步骤如下: - -1. 选择处理/制作 PDF 文件功能。 - -2. 选择独立补丁模式。 - -3. 在文件列表中添加需要导出目录的 PDF 文件。 - -4. 在PDF 信息文件处,指定一个后缀为"txt"的文本文件作为输出信息文件。 - -5. 点击导出信息文件按钮。导出的信息文件即为一个文本文件。 - -操作步骤如下图所示。 - -![新的图片](media/image59.png) -
    图表 5--5:导出文本书签信息文件
    - -## 使用书签编辑器修复书签 - -某些 PDF 文档在制作时由于工具的限制,书签不符合 PDF 规范,在新版本的 PDF 阅读器中无法正常使用,通常的问题有:书签文本乱码、PDF 文件改名后书签失效、书签指向的目标页码范围不正确。 - -使用 PDF 补丁丁的书签编辑器可以轻松修复此类 PDF 书签问题。 - -### 修复书签文本乱码 - -任务:某 PDF 文档的书签为乱码,无法阅读,如下图所示。 - -![新的图片](media/image60.png) -
    图表 5--6:乱码书签
    - -使用书签编辑器加载该文档,发现书签文本也为乱码。如下图所示。 - -![新的图片](media/image61.png) -
    图表 5--7:在书签编辑器中显示的乱码书签
    - -使用程序全局选项中的读取编码,可强制指定读取信息所用编码,然后重新打开书签。 - -操作步骤如下。 - -点击全局选项,转到程序的全局设置。 - -选择读取编码选项的选项卡。在书签文本编码中选择"UTF-16 Big Endian"。如下图所示。 -![新的图片](media/image62.png) - -返回书签编辑器,点击工具栏的打开按钮,重新加载有问题的 PDF 文档。这时可以看到,书签文本已经正常(如果不能正常显示,返回步骤 2 选择其它编码,再重复此步骤),如下图所示。\ -![新的图片](media/image63.png) - -### 修复PDF文件改名后失效的书签 - -上述 PDF 文档的书签貌似已经修复,但还有问题。一旦更改了 PDF 文件名,打开文档点击书签就会出现无法打开文档 j24.pdf之类的错误,如下图所示。只有将 PDF 文件名改回"j24.pdf",书签才能正常工作。 - -出现这种问题的原因是:PDF 文档书签使用了指定文件名的外部链接,而不是文档内部链接。 - -![新的图片](media/image64.png) - -为解决上述问题,书签编辑器提供强制将外部链接改为内部链接的功能。操作步骤如下: - -用书签编辑器打开书签(结果见上节图所示)。在编辑器中可看到,书签动作是打开外部 PDF 文档。展开书签,发现所有书签项的动作均为打开外部 PDF 文档。随便点击编辑器书签动作列上任何一个打开外部 PDF 文档链接,在弹出的对话框中可以发现,书签动作指向了一个名为"j24.pdf"的文档。如下图所示。\ -![新的图片](media/image65.png) - -这就是 PDF 文件改名之后链接失效的原因。只有当文件名为"j24.pdf"时,点击链接才能跳转到其指定的页面,否则由于不存在"j24.pdf"文件,PDF 阅读器就会报告找不到文件的错误。 - -点击取消按钮关闭上述对话框,返回书签编辑器。 - -由于所有书签均存在同样的问题,可以用修改菜单的命令,一并修复。按 Ctrl+A(或用鼠标选择)选中所有书签,选择修改操作包含未选中的内部书签复选框,使后续操作作用于隐藏在书签内部的子书签。 - -点击修改按钮,在弹出的菜单中选择"强制设置为文件内链接"命令。 - -完成后,从编辑器中可以看到,书签动作已经变为"转到页面"。如下图所示。 -![新的图片](media/image66.png) - -### 修改链接的目标页码 - -使用高级补丁功能将书签补丁回 PDF 文档后可以发现,书签指向的目标页面往前偏离了一页。本来应该指向第 2 页的,却跳转到第 1 页;应指向第 16 页的,却跳到第 15 页。使用书签编辑器可将所有页面的目标页码统一往后加一页。操作办法如下: - -用书签编辑器打开书签(结果见上节图所示)。从书签编辑器中可以看到,第一个有效页面"马克思恩格斯全集(39)上"的页码指向了 0。 - -选中修改操作包含未选中的内部书签复选框,使后续修改操作作用于隐藏在书签内部的子书签。 - -选中所有书签项。 - -点击修改按钮,在弹出的菜单中选择增加页码命令。 - -完成后,从编辑器中可以看到,页码均已增加了 1。如下图所示。\ -![新的图片](media/image67.png) - -另外,前面三个书签项没有必要保留,可用鼠标选中,然后点击工具栏的删除按钮将其删除。 - -### 将修改结果补丁回PDF文档 - -经过上面几步操作,书签已被成功修复了。最后一步是组合书签和原 PDF 文档,生成修复后的新文档。操作步骤如下: - -点击编辑器的保存按钮,将书签保存为".xml"后缀的信息文件。(如不需保存信息文件,可跳过此步骤) - -点击补丁按钮,将弹出一个对话框。该对话框列出了原始 PDF 文件和输出 PDF 文件。在输出 PDF 文件处指定补丁输出文件的位置。 - -点击确定按钮,稍等片刻,刚才的修改成果就保存到生成的新 PDF 文件中去了。 - -## 添加简易书签 - -### 例一:使用Excel制作简易书签 - -手头上有一本没有任何书签的影印版《黄帝内经》。从网上我们可以很轻易地找到这本书的目录文本。将其复制下来,稍作处理,成为类似如下形式的一行一行文本: - -``` -上古天真论第一 -四气调神大论第二 -生气通天论第三 -金匮真言论第四 -...... -``` - -再将这些文字复制到 Excel 工作表中,上面的文字成为 A 列(第 1 列)。 - -上述目录没有页码,因此,要加上页码,才能让书签跳转到指定页面。影印版的 PDF 通常都附有原书目录。用 -PDF -阅读器打开该文件,转到目录页,然后对着将页码输入到 Excel 的 B 列(第 2 列)。 - -输入完之后,由于目录页中的页码和 PDF 文件中的真实页码有一定的差距。在这个影印版的 PDF 文件中,第一章出现在文件的第 14 页。因此,在 Excel 表的第 1 行前面插入一行,输入"\#首页页码=14",表示下面的页码中第一页对应于 PDF 文件的第 -14 页。Excel 表看起来是如下的样子: - -![67609\_090429232530](media/image68.png) -
    图表 5--8:使用Excel制作简易书签(第1行的`#版本`指令可忽略不写)
    - -完成了书签的输入工作后,用 Excel 将其保存为"书签.txt"文本文件(不能保存为 XLS 文件)。 - -打开 PDF 补丁丁。选择处理、制作 PDF 文档功能的独立补丁模式。向文件列表添加《黄帝内经》的 PDF 文件。在PDF 信息文件处选择刚才保存的文本文件。在输出 PDF 文件处选择导入书签文件后所得的新 PDF 文件。 - -**提示**:操作前要关闭 Excel 程序,否则程序无法读取信息文件。 - -点击生成 PDF 文件按钮,程序将把简易书签和原始文件合并,生成一个新的 PDF 文件。 - -**说明**:除了使用独立补丁功能,也可以使用书签编辑器打开简易书签文件并执行补丁。 - -耐心等待程序处理完成。最后,我们就得到了一个具有书签的 PDF 文件。如下图所示。 - -![67609\_090429233022](media/image69.png) -
    图表 5--9:导入了简易书签的PDF文件
    - -### 例二:制作多级目录的简易书签 - -上一示例讲解了制作简易书签的一般步骤,本节介绍制作较复杂一点的多级书签。 - -首先,输入需要制作的简易书签文本。本示例部分目录如下所示: - -``` -第一章 中国气功概况 1 -一、 气功发展简史 1 -二、 什么是"气功" 3 -三、 练功的目的 5 -四、 气功有什么效果 7 -五、 气功功法分类及特点 9 -养生气功 11 -诊断气功 19 -...... -``` - -这个目录其实分三层,第一层是章,第二层是节,最后一层是小节。 - -将上面的文本复制到一个文本编辑器(如 AkelPad、PSPad、EditPlus 等)的编辑区中。选中上面"一、气功发展史"到"诊断气功"这几行,按一下键盘上的"Tab"键。这样,这几行前面就多了一个制表符,看起来就是缩了进去一层的样子。然后,在选中下面"养生气功"到"诊断气功"两行,再按一下"Tab"键,这两行又往内缩进了一层。成为如下形式: - -``` -第一章 中国气功概况 1 - 一、 气功发展简史 1 - 二、 什么是"气功" 3 - 三、 练功的目的 5 - 四、 气功有什么效果 7 - 五、 气功功法分类及特点 9 - 养生气功 11 - 诊断气功 19 - ...... -``` - -用类似的方式处理后面几章的目录。 - -打开 PDF 文件,看看第一章对应的实际页码是第几页(本示例为第 7 页)。因此,我们在书签文件中第一行前面插入一行,添加`#首页页码=7`指令,成为如下形式: - -``` -#首页页码=7 -第一章 中国气功概况 1 -一、 气功发展简史 1 -...... -``` - -`#首页页码=7`指令表示下面的页码第 1 页对应 PDF 文档中的第 7 页。 - -这本书前面还是有一个目录的。我们可以在书签文件中再加点东西,在书签中包含目录。在书签文件第一行前插入内容,成为如下形式: - -``` -目录 1 -#首页页码=7 -第一章 中国气功概况 1 -一、 气功发展简史 1 -...... -``` - -虽然"目录"和"第一章"的页码都是 1,但"目录"对应 PDF 文件的第 1 页,而由于第二行"\#首页页码"指定了页码的关系,"第一章"实际对应第 7 页。 - -完成后将书签文件保存为文本文件。然后用 PDF 补丁丁将其导入到原始 PDF 文档,即可生成带书签的 PDF 文件。如下图所示。 - -![67609\_090430143020](media/image70.png) -
    图表 5--10:带有多层目录的PDF书签
    - -### 例三:使用字符识别功能生成简易书签 - -为扫描 PDF 文档制作简易书签的又一种办法是使用字符识别功能识别目录页,用目录页的文本生成书签。基本操作步骤如下。 - -1. 在 PDF 阅读器中打开并观察文档,确定扫描 PDF 文档的目录页范围。 - -2. 转到识别图像文本功能,指定需识别的 PDF 文件,并选择适当的处理选项(建议选中识别目录页的点分隔符压缩连续出现的空格两选项;为提高识别效果,可人工指定文字排版方向选项为横向或纵向;如扫描页面倾斜,可选中旋转校正拉伸校正两选项)。 - -3. 在识别页码范围文本框中输入目录页的页码范围。 - -4. 指定识别文本后输出的文本文件,点击识别图像文本按钮,尝试识别目录页。 - -5. 编辑输出的文本文件,修正错误识别的字符。 - -6. 用书签编辑器打开该文本文件,制作成书签文件或直接补丁到 PDF 文档。 - -## 自动生成导航书签 - -自动生成导航书签是一个颇具实用价值的功能。该功能可为 PDF 文档自动生成书签,免却手工输入书签的不便。基本操作步骤有如下几步。 - -1. 观察文档,人工分析文档标题特征。 - -2. 尝试生成书签。 - -3. 调整标题识别选项以及增加筛选条件。 - -4. 在输出的日志窗口或书签编辑器查看输出的书签,如不满意,重复 2、3 两步。 - -5. 使用书签编辑器编辑、优化书签。 - -6. 生成 PDF 文件。 - -**说明**:自动生成 PDF 书签功能只能为文本 PDF 文档生成书签,无法处理扫描图片的 PDF 文档。 - -本参考手册 PDF 电子版的书签就是用自动生成书签功能生成的。本节将以本手册为例,讲述自动生成书签的详细操作步骤。 - -### 观察文档 - -自动生成书签的第一步是观察 PDF 文档,了解其排版特征。观察需要作为书签的文本具有何种特征。以本文档为例,文档标题有如下特征:①每个标题都使用较大尺寸的粗宋体或黑体,②字体尺寸随标题级别而渐次变小。③每个标题都是独占一行的。如下图所示: - -![新的图片](media/image71.png) -
    图表 5--11:本参考手册的标题样式
    - -### 尝试生成书签 - -由于 PDF 书籍的页数往往较多,处理一次需要一定的时间,首先使用程序的默认设置,尝试为某几个比较有代表性的页面------具有需要生成为书签的标题的页面,生成书签。观察这几页的标题是否能完全生成书签,并且没有引入正文的其它文本。 - -本示例中以默认配置尝试为使用文档第 2~20 页生成书签。选项配置如下图所示: - -![新的图片](media/image72.png) -
    图表 5--12:使用默认配置为示例文档2~20页生成书签
    - -点击导出信息文件按钮,程序将生成书签,并将文本显示到日志窗口,如下图所示。 - -![新的图片](media/image73.png) -
    图表 5--13:日志文件输出的书签文本内容
    - -### 观察输出结果并调整标题识别选项 - -观察日志窗口输出的内容可以发现,按照默认的标题尺寸,只能输出到标题 2,标题 3 和标题 4 的文本并没有包含到输出的书签中。 - -为将标题 3 和标题 4 的文本也输出为书签,可尝试调整标题识别选项,将标题文本尺寸参数从默认的 13 调整为较小的 12,然后再点击导出信息文件按钮。如下图所示。 - -![新的图片](media/image74.png) -
    图表 5--14:调整标题文本尺寸参数以输出更低级别的标题
    - -输出结果如下图所示。 - -![新的图片](media/image75.png) -
    图表 5--15:调整标题文本尺寸后输出的书签文本内容
    - -观察上面输出的文本可知,标题 3 和标题 4 的内容已被输出到书签。 - -但是,标题 3 和标题 4 由于其字体尺寸相同,因此输出到书签后级别相同(见上图中"4.3.2"、"4.3.2.1"两个标题),没有体现出标题之间的层次关系。 - -为使输出的书签体现出标题 3 和标题 4 的层次关系,可以在高级筛选处理选项中添加调整项,调整标题 3 的级别使其级别大于标题 4。操作办法如下: - -选择高级筛选处理选项卡。 - -由于之前已生成了信息文件,因此,可点击从信息文件添加按钮。 - -点击按钮后将弹出一个对话框,该对话框列出了文档标题所使用的字体及其尺寸,以及文档中首次使用此尺寸字体的文本内容。如下图所示: - -![新的图片](media/image76.png) -
    图表 5--16:添加字体筛选条件
    - -PDF 文档中一般使用英文的字体名称,在对话框中找到第一个标题 3(示例中为"4.2.1 文件列表")对应的字体,由于该标题混合使用了两种字体,因此有两个地方都出现了该标题文本,并且尺寸均为 12.00,第一个是"SimSun",有经验的读者可知其对应的字体是"宋体",即标题 3 文本中数字编号("4.2.1")所用的字体;下面一个"FZLanTingHei-DB-GBK",就是标题 3 的中文字体("文件列表")所用的字体。用鼠标右键点击该字体名称,然后在弹出的上下文菜单中选择"筛选名称为'FZLanTingHei-DB-GBK'的字体"菜单项。 - -点击上述命令后,在筛选条件列表中将可见已添加了一个项目。 - -点击确定按钮关闭该对话框。 - -返回到高级筛选处理选项界面时,可见已添加了一个新的筛选条件。选中该筛选条件,在调整级别列中输入"0.01",并选中相对调整列对应的复选框(这两个选项的含义是将符合筛选条件的文本的级别增加 0.01;如不选中选对调整复选框,则表示将匹配文本的级别降低到 0.01)。如下图所示。 - -![新的图片](media/image77.png) -
    图表 5--17:增大筛选条件匹配的标题级别
    - -从前面的分析可知,标题 3 和标题 4 的级别相同,现在标题 3 的级别增加了 0.01,则标题 3 将比标题 4 有较高的级别,在导出的书签中将把标题 4 包含在内。点击导出信息文件按钮,重新执行生成书签的操作。 - -观察输出,可见标题 3 已经包含了标题 4。输出结果基本令人满意。 - -返回自动生成书签的界面,修改页码范围,使之包含所有需要处理的页面。再执行导出信息文件操作,生成整个文档的书签。 - -### 使用书签编辑器修改输出的书签 - -生成信息文件后,可使用书签编辑器修改其中的文本,使书签更美观。具体过程在此从略,可参见前文内容。修改好书签后,可使用书签编辑器的补丁功能生成具有书签的新 PDF 文档。 - -## 批量删除文档首页及末页 - -任务:某网友得到一批 PDF 文件,每个文件的第一页和最后一页都是广告,想批量将其删除。使用 PDF 补丁丁的操作步骤如下。 - -1. 选择提取页面功能。 - -2. 将原 PDF 文件放在同一个目录(设该目录为"E:\\原始文件"),点击原始 PDF 文件右边的浏览按钮,转到上述目录选择该批文件。 - -3. 在输出 PDF 文件右方的组合编辑框中,指定输出位置,如"E:\\输出文件\\abc.pdf"。程序将把原始文件复制到"E:\\输出文件"目录(不用理会输出文件名"abc.pdf",程序自动将原始文件名替换为输出目录的文件名)。 - -4. 在页码范围文本框中不要输入任何内容,程序默认处理所有页面。在排除页码范围文本框中输入"1;-1",表示排除第 1 页和倒数第 1 页(负数表示从末尾起算的页码)。 - -5. 点击提取页面按钮即可。 - -## 批量倒排逆页序文档 - -任务:某网友下载了一批 PDF 文件。每个文档里的页面均为倒排。原书首页在 PDF 文件成了最后一页,书末页却在最前面。如果使用 PDF 编辑器逐个文档手工调整页数,将耗费大量时间。该网友尝试用 PDF 打印机的逆序打印功能重排页面,但逆序打印会降低文档质量,耗时更甚。 - -使用 PDF 补丁丁可以轻松批量调整页码顺序,操作步骤及屏幕截图如下。 - -1. 选择提取页面功能。 - -2. 点击原始 PDF 文件右边的浏览按钮,在弹出的打开文件对话框中,选择需要重排页面顺序的 PDF 文档(可多选)。 - -3. 在输出 PDF 文件处,输入输出路径(本示例中为M:\\),然后用鼠标右键点击该文本框,在弹出的上下文菜单中选择`<源文件名>`,插入源文件名替代符,表示按原始 PDF 文件的文件名输出到输出目录。 - -4. 在页码范围文本框中填入倒序的页码范围:"-1-1"(不带引号)。前一个"-1"表示文档最后一页,中间的"-"号表示页码范围,最后的"1"表示第一页。"-1-1"即文档的最后一页到第一页(如果需要从文档倒数第二页开始提取页面,则输入"-2-1")。 - -5. 点击提取页面按钮,即可将颠倒页码的原始 PDF 文件回复原状,保存到输出路径。 - -![新的图片](media/image78.png) -
    图表 5--18:重排逆序页面
    - -## 插图、合并文档并保留原文档书签 - -任务:将"小说(一).pdf"和"小说(二).pdf"合并为一个 PDF 文件,并且在合并后的 PDF 文件第 1 页前面插入"封面.jpg"图片文件。"小说(一)"和"小说(二)"这两个 PDF 文件本身有便于阅读的书签,希望合并后的 PDF 文档也带有原来的书签,以便阅读。 - -使用 PDF 补丁丁可以完成上述插入图片、合并 PDF 文档的任务。操作步骤如下。 - -### 添加文件 - -选择处理、制作 PDF 文档功能的合并文件模式。 - -点击添加文件按钮,从弹出的打开文件对话框中定位到"封面.jpg"、"小说(一).pdf"和"小说(二).pdf"文件所在的目录,选择这三个文件,点击确定按钮,将文件添加到文件列表。如果文件不在同一个目录,可重复此步骤多次,直至需要处理的文件都添加到文件列表位置。 - -提示:可以从"我的电脑"或"资源管理器"将需处理文件直接拖放到文件列表。 - -### 调整文件顺序 - -在列表顶部的文件将首先插入到输出 PDF 文件,如先后顺序不对,可使用程序界面上的按钮调整文件项目的顺序。 - -完成上述调整操作后,文件列表从上往下依次为:"封面.jpg"、"小说(上).pdf"和"小说(下).pdf"。"封面"将成为输出文件的第 1 页;"小说(上)"的页数有 2 页,处于输出文件的第 2、3 页;"小说(下)"则处于输出文件的第 4、5 页。 - -### 设定页面布局 - -由于上述图片和 PDF 文档的尺寸不一致。为美观起见,可以调整图片的页面尺寸,使图片所在页面的尺寸和两个 PDF 文件的页面尺寸一致。 - -选择PDF 文档选项功能。在页面尺寸下拉列表中找到A4(21 厘米\*29.7 厘米),选中该项。这时界面右方的数值调整框将自动改为相应的数值。 - -提示:如所需页面尺寸在列表框中找不到,可自行在调整框中输入。 - -### 保留源文件的书签 - -在本示例中,源 PDF 文件本身带有书签。在完成合并操作后,程序可以将源 PDF 文件的书签也带到新的文件中。 - -在PDF 文件选项的[书签设置选项卡](#页码标签)中选择信息文件无书签时自动生成书签单选框,以及保留源 PDF 文件的书签复选框,再生成文件。 - -### 生成文件 - -完成页面布局的调整操作后,返回处理 PDF 文档功能。 - -点击输出 PDF 文件右方的浏览按钮,指定输出 PDF 文件的位置。 - -点击生成 PDF 文件按钮。程序将把上述三个文件合并成一个 PDF 文件。 - -本示例生成的文件在 Adobe -Reader 的显示效果如下图所示(为方便展示,手动将文档的显示方式改成双页连续)。 - -![新的图片](media/image79.png) - -## 插页合并文档 - -任务:某网友用扫描仪扫描了一批双面打印的文件,得到两个 PDF 文件。一个包含纸面正面(单数页面)的内容,另一个包含纸面反面(双数页面)的内容,现在希望将两个 PDF 文件按实际正反面合并成一个 PDF 文件。 - -使用 PDF 补丁丁实现上述任务有两种方法。第一种方法是提取图片再生成文件;第二种方法是合并两个 PDF 文件为一个,然后重排页序。现分别介绍如下。 - -### 提取图片再生成文件 - -由于扫描生成的 PDF 文件是全图片的 PDF 文件,因此可以将两个 PDF 文件的图片全部提取出来,按文件名排序,然后重新生成一个新的 PDF 文件。操作步骤如下。 - -1. 选择提取图片功能。 - -2. 选择第一个 PDF 文件并指定输出目录,如"C:\\Documents\\图片"。 - -3. 在指定文件掩码为"0000A",使输出的文件形式为四位数字后面加一个"A"字,如"0001A.tif"、"0002A.tif"等等。 - -4. 点击提取图片按钮,将图片导出到输出目录。 - -5. 再选择第二个 PDF 文件,不要改变上面指定的输出目录,但更改文件掩码为"0000B",使输出文件名成为"0001B.tif"、"0002B.tif"的形式。这样,两个 PDF 文件输出的图片将存放在同一个目录下,而图片文件名根据页数编号和后面的"A"、"B"后缀,就可以自然排好序了。 - -6. 选择处理 PDF 文档功能的合并文件模式。 - -7. 将上述步骤生成的图片文件全部添加到文件列表。 - -8. 用排序功能排序文件列表中的图片文件,使顺序成为"0001A.tif"、"0001B.tif"、"0002A.tif"、"0002B.tif"等等。 - -9. 为生成的 PDF 文件指定文件名。 - -10. 点击生成 PDF 文件按钮,程序将按文件列表的顺序将图片合成为一个 PDF 文件。 - -### 合并文档后再排序 - -另一种方法是将两个 PDF 文件合并成一个 PDF 文件,然后用导出页面功能重排页面顺序。操作步骤如下。 - -1. 选择处理 PDF 文档功能的合并文件模式。 - -2. 将第一个 PDF 文件和第二个 PDF 文件拖放到文件列表,按先后顺序排序。 - -3. 指定输出文件位置。 - -4. 然后点击生成 PDF 文件按钮,生成文件。 - -5. 选择提取页面功能。 - -6. 在原始 PDF 文件处指定刚才生成的文件。 - -7. 指定输出位置。 - -8. 这里假定两原始文件页数相等,都是 100,则合并后的 PDF 文件有 200 页。重排页面后,页面顺序应该是 1、101、2、102、3、103......99、199、100、200。因此,应在页码范围处指定如下顺序:"1;101;2;102;3;103(中间的项目在此省略);99;199;100;200"。 - -9. 点击提取页面按钮,程序就会自动重排合并后的那个 PDF 文档的页面,生成一个新的文档。 - -提示:生成上述页码顺序的方法很简单,用电子表格程序(如 Excel、WPS 表格等)自动填充的方式做两行数,第 1 行是 1 到 100;第二行是 101 到 200。两行的数字各隔开一格交错排列,然后在第三行用公式将两行数加起来(如下图所示),就得到一个交错的数列。将该行内容复制出来,就是上述页码顺序了(从电子表格程序拷贝的第三行文本中有制表符,不用管,程序会自动忽略)。 - -![新的图片](media/image80.png) - -### 两种方法的对比 - -第一种方法简易快捷,但只适合完全为图片的 PDF 文件。 - -第二种方法保真度相对较高,适合包含文字和图片的 PDF 文件,但操作步骤较复杂一点。 - -**说明**:在上述第二种方法,实际上用合并文件模式也可以重排页码。先将两个文件合并生成一个新文件。将文件列表清空,将上述新文件添加到文件列表,双击文件列表的项目,在属性对话框中的页码顺序文本框中输入上述形式的页码顺序,再生成一个新文件亦可。 - -# XML信息文件参考 - -PDF 补丁丁使用的信息文件可从[导出文档信息](#导出信息文件)功能导出。信息文件是 XML 文件,可使用 XML 编辑器或文本编辑器打开编辑。 - -## 信息文件根元素 - -信息文件的根元素是PDF 信息。 - -### 属性 - -文件根元素可包含如下属性: - -程序名称属性(固定):取固定值PDFPatcher。 - -程序版本属性(必须):表示该文档可被 PDF 补丁丁正常打开处理的最低版本。 - -导出时间属性(可选):导出文档的日期及时间。 - -PDF 文件位置属性(可选):用于导出信息文档的原始 PDF 文件路径。书签编辑器使用此属性打开书签对应的 PDF 文档。 - -页数属性(可选):PDF 文档的页数。 - -### 子元素 - -根元素可包含如下各子元素。各子元素均是可选的。 - -[度量单位](#度量单位)元素:表示文档尺寸的度量单位。 - -[文档信息](#文档元数据文档信息元素)元素:包含文档的元数据信息。 - -[阅读器设定](#阅读器初始设定阅读器设定元素)元素:表示阅读器的初始设定。 - -[页码样式](#页码编号样式页码样式元素)元素:包含文档逻辑页码的编号方式。 - -[文档书签](#文档书签)元素:包含文档的导航书签。 - -[页面链接](#_Toc260694714)元素:包含文档页面内的跳转链接。 - -[命名位置](#命名位置)元素:包含文档内命名的跳转目标位置。 - -[页面设置](#页面设置)元素:包含页面尺寸及旋转角度等设置。 - -各元素的内容由下文详细叙述。 - -## 度量单位 - -信息文件中页面、位置尺寸的度量单位在度量单位元素中表示。 - -度量单位包含单位属性,其取值可为厘米毫米英寸。如不出现度量单位元素或单位属性,则单位为。1 英寸(约等于 2.54 厘米)等于 72 点。 - -是 PDF 文件内部使用的度量单位。 - -## 文档元数据("文档信息"元素) - -文档的元数据信息在根元素下以文档信息元素表示。 - -### 属性 - -各属性均为可选。如信息文件不指定属性,则保留原始 PDF 文件的对应数据。 - -PDF 版本属性:PDF 版本号,如 1.4、1.5、1.6 等。 - -标题属性:PDF 文档的标题。 - -作者属性 - -主题属性 - -关键字属性 - -创建程序属性:表示用于创建 PDF 文档的程序。 - -处理程序属性:表示最后一次处理 PDF 文档的程序。 - -创建日期属性:表示 PDF 文档的创建日期和时间。 - -最近修改日期属性:表示最近修改 PDF 文档的日期和时间。 - -导入信息文件时,标题、作者、主题和关键字可导入到文档。 - -### 示例 - -```xml -<文档信息 - 创建程序="WPS Office 个人版" - 关键字="PDF, PDFPatcher, 使用手册" - 作者="WMJ" - 标题="PDF补丁丁使用手册" - 主题="PDF补丁丁" - 创建日期="2010年04月28日 16:47:50" - 处理程序="PDFlib 7.0.3 (C++/Win32)" /> -``` - -## 阅读器初始设定("阅读器设定"元素) - -阅读器的初始设定在根元素下以阅读器设定元素表示,用于指定阅读器在打开文档时的界面布局。 - -### 属性 - -各属性均为可选,并非所有 PDF 阅读器都支持这些属性。如信息文件不指定属性,则保留原始 PDF 文件的对应数据。 - -页面布局属性:显示页面时的初始布局,有效取值可为:保持不变单页连续单页双页连续双页双页连续首页独置双页首页独置六者之一。其中,连续的布局允许阅读器跨页显示文档,双页布局时,首页(封面)可以独置成单独的一页。 - -初始模式属性:显示打开文档时显示的导航栏(如页面缩略图、文档书签等),有效取值为不显示边栏显示文档书签显示页面缩略图全屏显示显示可选内容组显示附件栏六者之一。比较常用的取值是显示文档书签全屏显示。 - -隐藏工具栏属性:表示是否隐藏阅读器界面的工具栏,有效值为(并非所有 PDF 阅读器都支持此属性)。 - -隐藏菜单属性:表示是否隐藏阅读器界面的菜单栏,有效值为(并非所有 PDF 阅读器都支持此属性)。 - -只显示文档内容属性:表示是否隐藏用户界面的其它内容,有效值为(并非所有 PDF 阅读器都支持此属性)。 - -窗口适合文档首页属性:表示是否调整阅读器的窗口使之适合文档的第一页内容,有效值为(并非所有 PDF 阅读器都支持此属性)。 - -窗口居中属性:有效值为(并非所有 PDF 阅读器都支持此属性)。 - -显示文档标题属性:表示是否在阅读器的窗口标题栏显示文档的标题,有效值为(并非所有 PDF 阅读器都支持此属性)。 - -阅读方向属性(仅在页面布局为双页时有效):表示双页布局下相邻两页的显示方式,有效取值为从左到右从右到左。如文档为传统竖向排版布局,可选择从右到左。 - -### 示例 - -例一:在打开阅读器显示文档时,显示文档书签。 - -```xml -<阅读器设定 初始模式="显示文档书签" /> -``` - -例二:使用从右到左的方式阅读文本,初始的页面布局是双页对开显示,连续滚动,其中文档第一页单独放置。 - -```xml -<阅读器设定 - 初始模式="显示文档书签" - 阅读方向="从右到左" - 页面布局="双页连续首页独置" /> -``` - -## 页码编号样式("页码样式"元素) - -PDF 文档的逻辑页码设置在根元素下以页码样式元素表示。该元素无属性。 - -### "样式"子元素 - -页码样式元素包含一系列的样式元素,指定从特定页码开始的逻辑页码编号样式。 - -每个样式表示一种页码编号规则,从文档对应实际页码的页面开始,到下一个样式指定的实际页码对应的页码结束。 - -样式元素可包含如下属性。 - -实际页码属性(数值型,必须):一个绝对页码编号,有效取值应为 1 到 PDF 文档页数之间的数值,表示从该页开始使用此样式元素指定的页码样式。 - -起始页码属性(数值型,可选):表示从实际页码开始使用的页码样式的起始编号,有效取值应为 1 到 PDF 文档结束页数之间的数值。默认从 1 开始。 - -页码前缀属性(可选):在页码编号前的一段文本,如页码样式为数字,而页码前缀为"P-",则在阅读器上看到的逻辑页码是"P-1"、"P-2"等等。默认无前缀。 - -样式属性(可选):指定用于页码编号的数字样式,有效取值可为数字小写罗马数字大写罗马数字小写英文字母大写英文字母五者之一。默认为阿拉伯数字。 - -### 示例 - -以下示例演示具有多种页码样式的文档。 - -第 1~4 页的页码编号样式是大写的罗马数字(I、II、III、IV)。 - -第 5~25 页的页码编号样式是以 P 为开头的数字(P1、P2......P21)。 - -第 26、27 页的页码是大写英文字母(A、B)。 - -第 28~21 页的页码是小写英文字母(a、b、c、d)。 - -第 32 页到文档结尾的页码是阿拉伯数字(1、2、3......)。 - -```xml -<页码样式> - <样式 实际页码="1" 样式="大写罗马数字" /> - <样式 实际页码="5" 页码前缀="P" 样式="数字" /> - <样式 实际页码="26" 样式="大写英文字母" /> - <样式 实际页码="28" 样式="小写英文字母" /> - <样式 实际页码="32" 样式="数字" /> - -``` - -## 文档书签 - -文档书签是 PDF 阅读器中的交互元素,点击文档书签后可跳转到文档的指定位置,打开一个外部 PDF 文档或执行外部的可执行文件。 - -PDF 文档书签在根元素下以文档书签元素表示。 - -### "书签"子元素 - -书签子元素表示阅读器中的一个书签。 - -1. `书签`元素可包含如下属性。 - -2. `文本`属性(必须):表示书签的文本。 - -3. `默认打开`属性(可选):表示是否默认打开书签。可选取值为`是`和`否`。默认值为`是`,表示书签默认处于打开状态。 - -4. `样式`属性(可选):表示书签文本的外观,可选的样式有`粗体`、`斜体`和`粗斜体`三种。 - -5. `颜色属性组(可选)`:表示书签文本的颜色。有`红`、`绿`和`蓝`3 个值的属性组,表示 RGB 的三个分量,取值为 0~1 之间的小数,则以 1 为满值。因此,`红="1" 绿="1" 蓝="1"`这个三个属性结合的属性组表示白色。除使用数值颜色外,也可使用.NET 框架命名的颜色,以`颜色`属性表示,如`颜色="Red"`表示红色、`颜色="Blue"`表示蓝色,`颜色="DarkGreen"`表示深绿色。此外,还可使用 Web 的`#RRGGBB`十六进制表示方式,如白色可表示为`颜色="#FFFFFF"`、红色为`颜色="#FF0000"`等。 - -6. `动作`属性(可选):表示点击书签后执行的动作。可选的动作有`转到页面`(跳转到当前 PDF 文档的指定位置)、`打开外部PDF文档`(打开外部 PDF 文档,并跳转到指定页面)、`打开网址`和`启动程序`四种。默认的动作是`转到页面`。如书签没有`动作`和`页码`属性,则点击书签不执行任何动作。 - -7. `页码`属性(正整数):表示点击书签后跳转到的页面。在`动作`属性为`转到页面`或`打开外部PDF文档`时有效。 - -8. `首页页码`(可选):表示页码偏移值。例如`首页页码`为 5,页码为 3,则实际跳转到第 5+3-1=7 页。 - -9. `显示方式`属性(可选):表示跳转到指定页面后的显示方式。在`动作`属性为`转到页面`时有效。显示方式有如下几种:`坐标缩放`(转到指定页面的坐标,并缩放到指定比例)、`适合页面`、`适合窗口`、`适合窗口宽度`、`适合窗口高度`、`适合页宽`、`适合页高`和`适合区域`(缩放到指定矩形区域的尺寸)。 - -10. `命名位置`属性(可选):表示跳转到指定名称的位置。`命名位置`由信息文件的`[命名位置](#命名位置)`元素指定。 - -11. `PDF名称`属性(可选):表示跳转到 PDF 文档名称表示的位置。 - -坐标属性组(可选,数值)有`上`、`左`、`下`、`右`和`比例`5 个属性,与`显示方式`属性结合使用。如下表所示。 - -| 属性 | 解释 | -|------------- |-----------------------------------------------------------------------------------------------------------------------| -| 显示方式 | 坐标 | -| 坐标缩放 | 由3个数值属性构成,`左`属性指定是横坐标的偏移值,`上`属性是纵坐标的偏移值,`比例`属性指定缩放比例(可选,1表示100%)。| -| 适合页面 | 不应有任何坐标。 | -| 适合窗口 | 不应有任何坐标。 | -| 适合窗口宽度 | 包含`上`属性,表示跳转后的纵坐标。 | -| 适合窗口高度 | 包含`左`属性,表示跳转后的横坐标。 | -| 适合页宽 | 包含`上`属性,表示跳转后的纵坐标。 | -| 适合页高 | 包含`左`属性,表示跳转后的横坐标。 | -| 适合区域 | 包含`上`、`左`、`下`、`右`4个数值,表示跳转后缩放到的矩形区域。 | - -**说明**:坐标以页面左下角(0,0)为最小值。坐标值的单位视乎文档的"[度量单位](#度量单位)"元素而定,如不存在该元素,则度量单位为`点`。当数值为 0 或`null`时,表示保持跳转前的偏移值或缩放比例不变。 - -`命名位置`、`PDF名称`和坐标属性是互斥的,只能指定其中一个。 - -`外部文件`属性:表示打开一个外部文件。在`动作`属性为`打开外部PDF文档`或`启动程序`时有效。 - -`URI`属性:表示打开的网址。在`动作`属性为`打开网址`时有效。 - -`新窗口`属性:表示是否在新窗口打开文档。在`动作`属性为`打开外部PDF文档`时有效。 - -`书签`元素可包含下级的`书签`元素,表示书签之间的嵌套关系。 - -### 示例 - -以下示例表示 PDF 文档中只有一个书签。 - -该书签的文本是`ABCDEF`,显示成粗体。点击之后,跳转到第 1 页。由于度量单位为厘米,则点击后,页面坐标的横坐标为 0,即保持当前阅读器水平位置不变,纵坐标为 29.7,即跳转到第 1 页纵坐标为 29.7 厘米处,缩放比为 0,表示不改变阅读器当前的显示缩放比例。 - -```xml -<度量单位 单位="厘米" /> -<文档书签> - <书签 文本="ABCDEF" 样式="粗体" 页码="1" 显示方式="坐标缩放" 左="0" 上="29.7" 比例="0" 动作="转到页面" /> - -``` - -提示:建议将缩放比例改为 0,避免点击书签时更改阅读器的显示缩放状态,以便阅读。此外,可在[导入信息文件](#导入信息文件)时通过[指定"取消链接目标的缩放比例"选项](#高级补丁功能导出导入信息文件)来强制将缩放比例置 0。 - -以下示例表示"ABC"书签包含"XYZ"书签,但不包含"DEF"书签。 - -"ABC"书签的颜色为蓝色,默认关闭。由于该书签没有"动作"和"页码"属性,因此,在阅读器中点击该书签将不会执行任何动作。 - -"XYZ"书签的动作为"转到页面",点击该书签后,阅读器的显示比例将改成"适合宽度",并且跳转到第 5 页,纵坐标离页面底端 5.24 厘米的位置。 - -"DEF"是一个空书签,点击后不执行任何动作。 - -```xml -<度量单位 单位="厘米" /> -<文档书签> -<书签 文本="ABC" 颜色="Blue" 默认打开="否"> - <书签 文本="XYZ" 页码="5" 显示方式="适合宽度" 上="5.24" 动作="转到页面" /> - -<书签 文本="DEF"/> - -``` - -**注意**:"ABC"书签最后一个属性后面是"\>",表示书签包含子书签,而"XYZ"书签最后一个属性后面是"/\>",表示不包含子书签。"XYZ"书签后的"\"与"ABC"书签对应,表示"ABC"书签的范围到此为止,"DEF"书签不嵌套在"ABC"书签之内。 - -提示:在[导入信息文件](#导入信息文件)前,可通过在 PDF 文档选项的"[阅读方式设置](#页面尺寸)"选项卡指定"书签状态"为"全部关闭",强制让所有书签处于默认关闭状态。 - -## 页面链接 - -表示 PDF 文档页面内的链接。在根元素下以"页面链接"元素表示。 - -`页面链接`元素下每个`链接`元素表示一个页面链接。链接元素可包含如下属性。 - -`页码`属性(必需,正整数):表示链接所在的页码。 - -坐标属性组(必需):有`左`、`下`、`上`和`右`4 个属性,表示链接所在的矩形区域。 - -`边框`属性(可选):包含三个数值组合而成的边框属性值。 - -`点击效果`属性:表示点击链接后的效果。 - -`文本`属性:表示链接的文本说明。 - -颜色属性组:表示链接标记的颜色,以`红`、`绿`和`蓝`三个属性组合的三原色分量组合。 - -`页面链接`元素可包含如下子元素: - -边框样式:表示边框的样式,可包含`样式`属性。 - -以动作命名的元素(如`转到页面`、`打开网址`等),参见`书签`元素的`动作`属性。元素可包含对应动作的属性。 - -## 命名位置 - -表示 PDF 文档中具有特定名称的位置。 - -## 页面设置 - -页面的尺寸、显示区域和旋转角度可使用`页面设置`元素表示。 - -### "页面"子元素 - -`页面`子元素表示页面的设置,包含如下属性。 - -1. `页码范围`属性(必须):表示此页面设置对应的绝对页码范围。 -2. `页码筛选`属性(可选):用于筛选页码范围,取值可为`单数页`(页码范围内的所有单数页面)或`双数页`(页码范围内的所有双数页面)。 -3. `页面边框`属性(必须):表示页面边框的坐标位置。边框包含由两对坐标值构成的矩形区域。前面一对是页面左下角的坐标(0,0),后面一对是页面右上角的坐标。坐标的度量单位由文档的"[度量单位](#度量单位)"元素决定。 -4. `截取边框`属性(必须):表示页面边框中那些内容可显示出来。截取边框的坐标不能落在页面边框所定义的矩形之外。 -5. `裁剪边框`属性(可选,见"[PDF页面的边界](#pdf页面的边界)"一节的示意图) -6. `出血边框`属性(可选) -7. `内容边框`属性(可选) -8. `旋转角度`属性(可选):表示页面旋转方向,必须为 0、90、180 或 270 度。默认为 0 度。 - -### PDF页面的边界 - -PDF 页面主要由`页面边框`给定的矩形范围指定。除截取边框外的其它的边框与页面边框的关系如下图所示。 - -![shot](media/image81.png) -
    图表 6--1:PDF边框示意图
    - -由于`截取边框`与除页面边框外的其它边框没有特定关系(截取边框必须落在页面边框内),因此在图中没有画出。 - -一般场合下,只需要定义页面边框和截取边框。 - -### 示例 - -以下示例表示从 1 到 517 页的页面尺寸是 21 厘米宽,29.7 厘米高。 - -```xml -<度量单位 单位="厘米" /> -<页面设置> - <页面 页码范围="1-517" - 页面边框="0 0 21 29.7" - 截取边框="0 0 21 29.7" /> - -``` - -配合使用截取边框和页面边框可以裁剪页面。以下示例表示第 1 到 517 页的双数页面,裁剪其左边 1 厘米的内容,实际页面宽度应该是 21-1=20 厘米。 - -```xml -<度量单位 单位="厘米" /> -<页面设置> - <页面 页码范围="1-517" 页码筛选="双数页" - 页面边框="0 0 21 29.7" - 截取边框="1 0 21 29.7" /> - -``` - -通过更改页面边框可以为原来没有多少空白的 PDF 页面留出额外的空白。例如下面的示例在页面下方留出了 3 厘米的额外空白。 - -```xml -<度量单位 单位="厘米" /> -<页面设置> - <页面 页码范围="1-517" - 页面边框="0 -3 21 29.7" - 截取边框="0 -3 21 29.7" /> - -``` - -对不同的页面可以指定不同的尺寸。如下面的示例分别定义第 1 页,以及 2 到 517 页间单数和双数页面的不同尺寸。 - -```xml -<度量单位 单位="厘米" /> -<页面设置> - <页面 页码范围="1" 旋转角度="90" - 页面边框="0 0 29.7 21" - 截取边框="0 0 29.7 21" /> - <页面 页码范围="2-517" 页码筛选="双数页" - 页面边框="0 0 21 29.7" - 截取边框="1 0 22 29.7" /> - <页面 页码范围="2-517" 页码筛选="单数页" - 页面边框="0 0 21 29.7" - 截取边框="0 0 21 29.7" /> - -``` - -# 简易书签文件参考 - -简易书签文件主要用于快速制作 PDF 书签。简易书签文件的功能有限,如需要更强的功能,可使用[转换书签文件](#_导入信息生成文件_)功能将其转换为 XML 信息文件。简易书签文件的格式介绍如下。 - -**注意**:如果将 PDF 文档原有的书签导出成简易文本书签文件,编辑后重新导入到文档,由于简易文本书签包含的信息量较少,可能导致原文档的书签丢失一些信息(如无法精确定位到页面的指定位置、指定书签文本为粗体等)。因此,一般场合下不要导出简易文本书签文件。 - -## 文件结构 - -简易书签文件包含文件头和书签两部分。 - -## 文件头 - -文件头包含版本、标题、主题、关键字、作者等信息。 - -`#版本`表示书签文件的版本号,必须出现在第一行。版本编号应与 PDF 补丁丁的版本相符。不使用这一行也可以,但在导入时会提示版本不符。高版本的程序一般兼容低版本的书签文件。 - -`#标题`、`#主题`、`#关键字`和`#作者`分别表示 PDF 文档属性的标题。 - -以下代码指定书签文件版本为 0.2.6 和相应元数据信息。 - -``` -#版本=0.2.6 -#标题=PDF补丁丁使用手册 -#主题=PDF补丁丁 -#关键字=PDF, PDFPatcher, 使用手册 -#作者=WMJ -``` - -## 书签内容 - -除了这一行之外,其他的就是书签内容了。每行正文表示一个书签。书签由如下四部分组成: - -缩进标记(默认为制表符)。 - -书签文本。 - -文本和页码之间的分隔符。 - -页码。 - -### 缩进标记 - -当一个书签具有比前面一个书签多一个缩进标记时,表示这个书签是前面书签的子级书签。第一个书签的文本前必须没有任何缩进标记。 - -默认的缩进标记是制表符。 - -### 书签文本 - -缩进标记字符串仅在起始位置有效,在书签文本中出现的缩进标记字符将被当成是书签文本。 - -### 分隔符 - -文本和页码之间的分隔符可以是一个以上的以下字符:制表符、半角或全角空格、点号`.`、省略号`...`、减号`-`、下划线`_`。 - -### 页码 - -以阿拉伯数字编号的页码。页码后面除了可以有多余的空白之外,不能有任何其它内容。 - -页码数字可以为半角数字,也可以为全角数字,但不能为中文或罗马数字。 - -如果页码部分为空,则表示一个不跳转到文档任何位置的书签。 - -### 示例 - -例如,以下内容定义了六个书签。 - -``` -顶级书签........... 1 - 次级书签 ______ 2 - 三级书签 3 -另一个顶级书签 - 次级书签2 ----- 7 - 次级书签3 …… 56 -``` - -请留意书签前使用制表符缩进所表示的嵌套关系:顶级书签包含次级书签,次级书签包含三级书签。 - -各书签的分隔符不同(任何一种均正确),页码分别是 1、2、3、7、56。第 4 个书签(另一个顶级书签)没有页码,在阅读器中点击该书签将不执行任何操作。 - -## 书签指令 - -### 首页页码(指定页码基准值) - -很多场合下,我们看到的正文页码都不是在 PDF -文档中的第一页开始的。往往是前面若干页为前言、目录等,很多页之后才是正文。而我们在输入简易书签文本时,通常是对着目录页输入的(如上面的多级书签所示),因此,简易书签文本中的页码在输入时是目录页上的页码,而不是 -PDF 文档中的页码。 - -在书签内容中,可以使用`#首页页码`指令指定下面出现的书签,对应首页页码的实际页码。 - -例如,以下内容定义的`正文`对应的页码为 1、`第一章`对应的页码为 2,但由于前面出现了`#首页页码=39`指令,因此`正文`实际上对应 PDF 文档中第 39 页,`第一章`对应第 40 页。 - -``` -#首页页码=39 -正文 1 - 第一章 2 - 第一节 3 - 第二章 14 -``` - -一个简易书签文件可以具有多个`#首页页码`指令,每个指令仅影响后面出现的书签页码与实际页码的对应关系,不影响前面的书签页码。 - -例如,以下示例出现了多个`#首页页码`指令。 - -``` -#首页页码=1 -封面 1 -#首页页码=3 -XX 序言 1 -自序 5 -#首页页码=11 -目录 1 -#首页页码=39 -正文 1 - 第一章 2 - 第一节 3 - 第二章 14 -``` - - - -### 缩进标记(自定义书签嵌套标记) - -程序默认使用制表符作为缩进标记,这在使用支持 Tab 键缩进内容的编辑器(如 AkelPad、EditPlus、PSPad 等)中很方便。但在某些场合下使用制表符不太方便(例如在 -Excel -中输入书签文件,不好输入制表符)。可以使用`#缩进标记`指令指定缩进标记,缩进标记为等号后的内容。 - -以下示例使用`。`作为缩进标记。 - -``` -#首页页码=39 -#缩进标记=。 -正文 1 -。第一章 2 -。。第一节 3 -。第二章 14 -``` - -可以使用超过一个字符作为缩进标记。 - -以下示例使用了`、、、`作为缩进标记。 - -``` -#首页页码=39 -#缩进标记=、、、 -正文 1 -、、、第一章 2 -、、、、、、第一节 3 -、、、第二章 14 -``` - -与`#首页页码`指令类似,`#缩进标记`可以在简易书签文件中出现多次,也只对出现在其后面的书签文本有效。 - -### 打开书签(指定默认打开状态) - -程序默认将书签设置为关闭状态。如需默认设置打开书签显示其子书签,可使用`#打开书签`指令。 - -以下示例指定`正文`书签为打开状态,而后续各书签为关闭状态。 - -``` -#打开书签=是 -正文 1 -#打开书签=否 - 第一章 2 - 第一节 3 - 第二章 14 -``` - -# 技术支持及联系方式 - -## 常见问题 - -### 文件列表自动清空,无法添加更多的文件 - -问:每次我添加文件到文件列表,它就自己清空了之前的文件,导致无法一次补丁多个文件。有办法解决吗? - -答:不要选中界面上的添加文件前清空列表复选框,就可以向文件列表添加多个文件。 - -### 无损提取图片功能的原理 - -问:PDF 补丁丁提取图片是使用虚拟设备打印成图片吗? - -答:PDF 补丁丁是通过解析 PDF 文件里面的数据,将数据无损还原为图片文件。 - -PDF 文件里的图片通常有几种编码方式:无压缩、Deflate、JPEG、JPEG2000、FAX 和 JBIG2。无压缩的图片和 Deflate 编码的可以保存成 PNG,JPEG 和 JPEG2000 一般直接将流保存出来就是图片文件了,FAX 编码的可以还原为 TIFF 文件,JBIG2 编码的将转换为 TIFF 文件。由于图片数据是从 PDF 文件抽取出来,解码后立即以直接保存或无损压缩的方式保存为图片文件的,所以不会存在二次压缩等降低图片质量的问题。 - -## 已知问题 - -如阁下在使用过程中遇到以下问题,请勿来函。 - -1. 无法导出、导入包含多重动作或多媒体动作的 PDF 书签或页面链接。 -2. 无法打开使用 Adobe Acrobat X 加密的 PDF 文档。 - -## 联系方式 - -如在使用过程中发现任何问题,请到 [Github 代码仓库](https://github.com/wmjordan/PDFPatcher/issues) 上提交 Issue。在提交的问题中,请提供如下信息: - -1. PDF 补丁丁的版本。 - -2. 操作系统版本及修订版本号。 - -3. 重现问题的条件及操作步骤。 - -请尽量详细描述导致出现问题的 PDF 文件。如果可能,可使用导出页面功能导出文档中有代表性的若干页面,将其作为附件随邮件发送。 - -