Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
PDFPatcher
提交
81941de0
P
PDFPatcher
项目概览
jobily
/
PDFPatcher
9 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PDFPatcher
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
81941de0
编写于
3月 30, 2023
作者:
W
WMJ
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
-更正代码中的拼写错误
上级
77b7072a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
32 addition
and
33 deletion
+32
-33
App/Constants.cs
App/Constants.cs
+1
-1
App/Functions/AutoBookmark/FontFilterForm.cs
App/Functions/AutoBookmark/FontFilterForm.cs
+3
-3
App/Functions/AutoBookmarkControl.Designer.cs
App/Functions/AutoBookmarkControl.Designer.cs
+11
-11
App/Functions/AutoBookmarkControl.cs
App/Functions/AutoBookmarkControl.cs
+3
-3
App/Processor/AutoBookmarkCreator.cs
App/Processor/AutoBookmarkCreator.cs
+14
-15
未找到文件。
App/Constants.cs
浏览文件 @
81941de0
...
...
@@ -449,7 +449,7 @@ namespace PDFPatcher
internal
const
string
Name
=
"名称"
;
internal
const
string
Size
=
"文本尺寸"
;
}
internal
static
class
FontOccur
a
nce
internal
static
class
FontOccur
re
nce
{
internal
const
string
Count
=
"出现次数"
;
internal
const
string
FirstText
=
"首次出现文本"
;
...
...
App/Functions/AutoBookmark/FontFilterForm.cs
浏览文件 @
81941de0
...
...
@@ -61,21 +61,21 @@ namespace PDFPatcher.Functions
}
else
if
(
f
.
ParentNode
?.
Name
==
Constants
.
Font
.
ThisName
)
{
f
.
GetAttribute
(
Constants
.
Font
.
Size
).
TryParse
(
out
float
p
);
var
t
=
f
.
GetAttribute
(
Constants
.
FontOccur
a
nce
.
FirstText
);
var
t
=
f
.
GetAttribute
(
Constants
.
FontOccur
re
nce
.
FirstText
);
return
String
.
Concat
(
p
.
ToText
(),
"("
,
t
,
")"
);
}
return
null
;
};
_CountColumn
.
AspectGetter
=
(
object
o
)
=>
{
if
(
o
is
XmlElement
f
)
{
f
.
GetAttribute
(
Constants
.
FontOccur
a
nce
.
Count
).
TryParse
(
out
int
p
);
f
.
GetAttribute
(
Constants
.
FontOccur
re
nce
.
Count
).
TryParse
(
out
int
p
);
return
p
;
}
return
null
;
};
_FirstPageColumn
.
AspectGetter
=
(
object
o
)
=>
{
if
(
o
is
XmlElement
f
)
{
f
.
GetAttribute
(
Constants
.
FontOccur
a
nce
.
FirstPage
).
TryParse
(
out
int
p
);
f
.
GetAttribute
(
Constants
.
FontOccur
re
nce
.
FirstPage
).
TryParse
(
out
int
p
);
return
p
;
}
return
null
;
...
...
App/Functions/AutoBookmarkControl.Designer.cs
浏览文件 @
81941de0
...
...
@@ -44,7 +44,7 @@
this
.
label6
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label5
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
_WritingDirectionBox
=
new
System
.
Windows
.
Forms
.
ComboBox
();
this
.
_AutoHierarchic
le
ArrangementBox
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
_AutoHierarchic
al
ArrangementBox
=
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
();
...
...
@@ -198,7 +198,7 @@
this
.
tabPage1
.
Controls
.
Add
(
this
.
label6
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
label5
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
_WritingDirectionBox
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
_AutoHierarchic
le
ArrangementBox
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
_AutoHierarchic
al
ArrangementBox
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
label11
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
_MaxDistanceBetweenLinesBox
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
_GoToPageTopLevelBox
);
...
...
@@ -283,15 +283,15 @@
this
.
_WritingDirectionBox
.
Size
=
new
System
.
Drawing
.
Size
(
76
,
20
);
this
.
_WritingDirectionBox
.
TabIndex
=
9
;
//
// _AutoHierarchic
le
ArrangementBox
// _AutoHierarchic
al
ArrangementBox
//
this
.
_AutoHierarchic
le
ArrangementBox
.
AutoSize
=
true
;
this
.
_AutoHierarchic
le
ArrangementBox
.
Location
=
new
System
.
Drawing
.
Point
(
6
,
63
);
this
.
_AutoHierarchic
leArrangementBox
.
Name
=
"_AutoHierarchicle
ArrangementBox"
;
this
.
_AutoHierarchic
le
ArrangementBox
.
Size
=
new
System
.
Drawing
.
Size
(
120
,
16
);
this
.
_AutoHierarchic
le
ArrangementBox
.
TabIndex
=
7
;
this
.
_AutoHierarchic
le
ArrangementBox
.
Text
=
"自动组织标题层次"
;
this
.
_AutoHierarchic
le
ArrangementBox
.
UseVisualStyleBackColor
=
true
;
this
.
_AutoHierarchic
al
ArrangementBox
.
AutoSize
=
true
;
this
.
_AutoHierarchic
al
ArrangementBox
.
Location
=
new
System
.
Drawing
.
Point
(
6
,
63
);
this
.
_AutoHierarchic
alArrangementBox
.
Name
=
"_AutoHierarchical
ArrangementBox"
;
this
.
_AutoHierarchic
al
ArrangementBox
.
Size
=
new
System
.
Drawing
.
Size
(
120
,
16
);
this
.
_AutoHierarchic
al
ArrangementBox
.
TabIndex
=
7
;
this
.
_AutoHierarchic
al
ArrangementBox
.
Text
=
"自动组织标题层次"
;
this
.
_AutoHierarchic
al
ArrangementBox
.
UseVisualStyleBackColor
=
true
;
//
// label11
//
...
...
@@ -817,7 +817,7 @@
private
System
.
Windows
.
Forms
.
TabPage
tabPage3
;
private
System
.
Windows
.
Forms
.
Label
label12
;
private
System
.
Windows
.
Forms
.
Button
_ClearTextFiltersButton
;
private
System
.
Windows
.
Forms
.
CheckBox
_AutoHierarchic
le
ArrangementBox
;
private
System
.
Windows
.
Forms
.
CheckBox
_AutoHierarchic
al
ArrangementBox
;
private
BrightIdeasSoftware
.
ObjectListView
_LevelAdjustmentBox
;
private
BrightIdeasSoftware
.
OLVColumn
_AdvancedFilterColumn
;
private
BrightIdeasSoftware
.
OLVColumn
_AdjustmentLevelColumn
;
...
...
App/Functions/AutoBookmarkControl.cs
浏览文件 @
81941de0
...
...
@@ -31,7 +31,7 @@ namespace PDFPatcher.Functions
AppContext
.
MainForm
.
SetTooltip
(
_BookmarkControl
.
FileList
,
"指定识别书签后生成的信息文件或简易文本书签文件路径"
);
AppContext
.
MainForm
.
SetTooltip
(
_ExportBookmarkButton
,
"点击此按钮识别 PDF 文件的标题为信息文件"
);
AppContext
.
MainForm
.
SetTooltip
(
_TitleSizeThresholdBox
,
"指定标题文本的最小尺寸,小于此尺寸的文本将被忽略"
);
AppContext
.
MainForm
.
SetTooltip
(
_AutoHierarchic
le
ArrangementBox
,
"根据标题文本的尺寸级别生成多层次的书签"
);
AppContext
.
MainForm
.
SetTooltip
(
_AutoHierarchic
al
ArrangementBox
,
"根据标题文本的尺寸级别生成多层次的书签"
);
AppContext
.
MainForm
.
SetTooltip
(
_YOffsetBox
,
"将标题的定位位置向上偏移的行距"
);
AppContext
.
MainForm
.
SetTooltip
(
_MergeAdjacentTitlesBox
,
"将连续出现的标题合并为一个标题"
);
AppContext
.
MainForm
.
SetTooltip
(
_MergeDifferentSizeTitlesBox
,
"合并不同尺寸的相邻标题"
);
...
...
@@ -106,7 +106,7 @@ namespace PDFPatcher.Functions
_CreateBookmarkForFirstPageBox
.
Checked
=
_options
.
CreateBookmarkForFirstPage
;
_MergeAdjacentTitlesBox
.
Checked
=
_options
.
MergeAdjacentTitles
;
_MergeDifferentSizeTitlesBox
.
Checked
=
_options
.
MergeDifferentSizeTitles
;
_AutoHierarchic
le
ArrangementBox
.
Checked
=
_options
.
AutoHierarchicalArrangement
;
_AutoHierarchic
al
ArrangementBox
.
Checked
=
_options
.
AutoHierarchicalArrangement
;
_IgnoreNumericTitleBox
.
Checked
=
_options
.
IgnoreNumericTitle
;
_IgnoreOverlappedTextBox
.
Checked
=
_options
.
IgnoreOverlappedText
;
_IgnoreSingleCharacterTitleBox
.
Checked
=
_options
.
IgnoreSingleCharacterTitle
;
...
...
@@ -174,7 +174,7 @@ namespace PDFPatcher.Functions
_options
.
YOffset
=
(
float
)
_YOffsetBox
.
Value
;
_options
.
ExportTextCoordinates
=
_ExportTextCoordinateBox
.
Checked
;
_options
.
PageTopForLevel
=
(
int
)
_GoToPageTopLevelBox
.
Value
;
_options
.
AutoHierarchicalArrangement
=
_AutoHierarchic
le
ArrangementBox
.
Checked
;
_options
.
AutoHierarchicalArrangement
=
_AutoHierarchic
al
ArrangementBox
.
Checked
;
_options
.
DisplayFontStatistics
=
_DisplayFontStatisticsBox
.
Checked
;
_options
.
DisplayAllFonts
=
_ShowAllFontsBox
.
Checked
;
_options
.
WritingDirection
=
(
WritingDirection
)
_WritingDirectionBox
.
SelectedIndex
;
...
...
App/Processor/AutoBookmarkCreator.cs
浏览文件 @
81941de0
...
...
@@ -24,14 +24,14 @@ namespace PDFPatcher.Processor
FirstInstance
=
instance
.
Length
>
50
?
instance
.
Substring
(
0
,
50
)
:
instance
;
}
}
sealed
class
FontOccur
a
nce
sealed
class
FontOccur
re
nce
{
readonly
Dictionary
<
string
,
List
<
SizeOccurrence
>>
oc
=
new
Dictionary
<
string
,
List
<
SizeOccurrence
>>();
internal
List
<
SizeOccurrence
>
GetOccur
a
nce
(
string
fontName
)
{
internal
List
<
SizeOccurrence
>
GetOccur
re
nce
(
string
fontName
)
{
return
oc
.
TryGetValue
(
fontName
,
out
List
<
SizeOccurrence
>
s
)
?
s
:
null
;
}
internal
void
AddOccur
a
nce
(
string
fontName
,
float
size
,
int
page
,
string
instance
)
{
internal
void
AddOccur
re
nce
(
string
fontName
,
float
size
,
int
page
,
string
instance
)
{
if
(
oc
.
ContainsKey
(
fontName
)
==
false
)
{
oc
.
Add
(
fontName
,
new
List
<
SizeOccurrence
>()
{
new
SizeOccurrence
(
size
,
page
,
instance
)
});
}
...
...
@@ -86,7 +86,7 @@ namespace PDFPatcher.Processor
int
level
=
0
;
const
string
indentString
=
" "
;
List
<
MatchPattern
.
IMatcher
>
ig
;
var
fontOccur
ances
=
new
FontOccura
nce
();
var
fontOccur
rences
=
new
FontOccurre
nce
();
if
(
options
.
IgnorePatterns
.
Count
==
0
)
{
ig
=
null
;
}
...
...
@@ -232,9 +232,8 @@ namespace PDFPatcher.Processor
be
.
SetAttribute
(
Constants
.
Font
.
Size
,
s
.
ToText
());
if
(
f
!=
null
)
{
be
.
SetAttribute
(
Constants
.
Font
.
ThisName
,
f
.
FontID
.
ToText
());
//fontOccurances.AddOccurance (f.FontID, s, i, t);
}
CountFontOccur
anceInRegion
(
fontOccura
nces
,
i
,
item
);
CountFontOccur
renceInRegion
(
fontOccurre
nces
,
i
,
item
);
#if DEBUG
Tracker
.
TraceMessage
(
String
.
Concat
(
item
.
Direction
.
ToString
()[
0
],
':'
,
level
<
11
?
indentString
.
Substring
(
0
,
level
)
:
indentString
,
t
,
" .... "
,
i
.
ToText
()));
#else
...
...
@@ -251,7 +250,7 @@ namespace PDFPatcher.Processor
writer
=
oldWriter
;
}
WriteDocumentFontOccur
ances
(
writer
,
options
,
p
,
fontOccura
nces
);
WriteDocumentFontOccur
rences
(
writer
,
options
,
p
,
fontOccurre
nces
);
SetGoToTop
(
options
,
doc
);
writer
.
WriteStartElement
(
Constants
.
DocumentBookmark
);
if
(
options
.
CreateBookmarkForFirstPage
&&
String
.
IsNullOrEmpty
(
options
.
FirstPageTitle
)
==
false
)
{
...
...
@@ -274,13 +273,13 @@ namespace PDFPatcher.Processor
}
}
static
void
WriteDocumentFontOccur
ances
(
XmlWriter
writer
,
AutoBookmarkOptions
options
,
TextToBookmarkProcessor
p
,
FontOccurance
fontOccura
nces
)
{
static
void
WriteDocumentFontOccur
rences
(
XmlWriter
writer
,
AutoBookmarkOptions
options
,
TextToBookmarkProcessor
p
,
FontOccurrence
fontOccurre
nces
)
{
writer
.
WriteStartElement
(
Constants
.
Font
.
DocumentFont
);
Tracker
.
TraceMessage
(
"\n文档所用的字体"
);
var
dl
=
new
List
<
String
>();
foreach
(
var
item
in
p
.
FontList
)
{
var
fo
=
"0"
;
var
sl
=
fontOccur
ances
.
GetOccura
nce
(
item
.
Value
);
var
sl
=
fontOccur
rences
.
GetOccurre
nce
(
item
.
Value
);
if
(
sl
!=
null
)
{
if
(
dl
.
Contains
(
item
.
Value
)
==
false
)
{
int
o
=
0
;
...
...
@@ -300,14 +299,14 @@ namespace PDFPatcher.Processor
writer
.
WriteStartElement
(
Constants
.
Font
.
ThisName
);
writer
.
WriteAttributeString
(
Constants
.
Font
.
ID
,
item
.
Key
.
ToText
());
writer
.
WriteAttributeString
(
Constants
.
Font
.
Name
,
item
.
Value
);
writer
.
WriteAttributeString
(
Constants
.
FontOccur
a
nce
.
Count
,
fo
);
writer
.
WriteAttributeString
(
Constants
.
FontOccur
re
nce
.
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
.
FontOccur
a
nce
.
Count
,
s
.
Occurrence
.
ToText
());
writer
.
WriteAttributeString
(
Constants
.
FontOccur
a
nce
.
FirstText
,
s
.
FirstInstance
);
writer
.
WriteAttributeString
(
Constants
.
FontOccur
a
nce
.
FirstPage
,
s
.
FirstPage
.
ToText
());
writer
.
WriteAttributeString
(
Constants
.
FontOccur
re
nce
.
Count
,
s
.
Occurrence
.
ToText
());
writer
.
WriteAttributeString
(
Constants
.
FontOccur
re
nce
.
FirstText
,
s
.
FirstInstance
);
writer
.
WriteAttributeString
(
Constants
.
FontOccur
re
nce
.
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
,
")"
));
}
...
...
@@ -319,12 +318,12 @@ namespace PDFPatcher.Processor
writer
.
WriteEndElement
();
}
static
void
CountFontOccur
anceInRegion
(
FontOccurance
fontOccura
nces
,
int
i
,
TextRegion
item
)
{
static
void
CountFontOccur
renceInRegion
(
FontOccurrence
fontOccurre
nces
,
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
))
{
fontOccur
ances
.
AddOccura
nce
(
ii
.
Font
.
FontName
,
ii
.
Size
,
i
,
il
.
Text
);
fontOccur
rences
.
AddOccurre
nce
(
ii
.
Font
.
FontName
,
ii
.
Size
,
i
,
il
.
Text
);
f
=
ii
.
Font
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录