forked from ArthurHub/HTML-Renderer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPdfGenerateConfig.cs
More file actions
123 lines (108 loc) · 3.05 KB
/
Copy pathPdfGenerateConfig.cs
File metadata and controls
123 lines (108 loc) · 3.05 KB
1
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// "Therefore those skilled at the unorthodox
// are infinite as heaven and earth,
// inexhaustible as the great rivers.
// When they come to an end,
// they begin again,
// like the days and months;
// they die and are reborn,
// like the four seasons."
//
// - Sun Tsu,
// "The Art of War"
using PdfSharp;
namespace TheArtOfDev.HtmlRenderer.PdfSharp
{
/// <summary>
/// The settings for generating PDF using <see cref="PdfGenerator"/>
/// </summary>
public sealed class PdfGenerateConfig
{
#region Fields/Consts
/// <summary>
/// the page size to use for each page in the generated pdf
/// </summary>
private PageSize _pageSize;
/// <summary>
/// the top margin between the page start and the text
/// </summary>
private int _marginTop;
/// <summary>
/// the bottom margin between the page end and the text
/// </summary>
private int _marginBottom;
/// <summary>
/// the left margin between the page start and the text
/// </summary>
private int _marginLeft;
/// <summary>
/// the right margin between the page end and the text
/// </summary>
private int _marginRight;
#endregion
/// <summary>
/// the page size to use for each page in the generated pdf
/// </summary>
public PageSize PageSize
{
get { return _pageSize; }
set { _pageSize = value; }
}
/// <summary>
/// the top margin between the page start and the text
/// </summary>
public int MarginTop
{
get { return _marginTop; }
set
{
if (value > -1)
_marginTop = value;
}
}
/// <summary>
/// the bottom margin between the page end and the text
/// </summary>
public int MarginBottom
{
get { return _marginBottom; }
set
{
if (value > -1)
_marginBottom = value;
}
}
/// <summary>
/// the left margin between the page start and the text
/// </summary>
public int MarginLeft
{
get { return _marginLeft; }
set
{
if (value > -1)
_marginLeft = value;
}
}
/// <summary>
/// the right margin between the page end and the text
/// </summary>
public int MarginRight
{
get { return _marginRight; }
set
{
if (value > -1)
_marginRight = value;
}
}
/// <summary>
/// Set all 4 margins to the given value.
/// </summary>
/// <param name="value"></param>
public void SetMargins(int value)
{
if (value > -1)
_marginBottom = _marginLeft = _marginTop = _marginRight = value;
}
}
}