|
13 | 13 | // See the License for the specific language governing permissions and |
14 | 14 | // limitations under the License. |
15 | 15 |
|
| 16 | +using Gotenberg.Sharp.API.Client.Domain.Dimensions; |
| 17 | + |
16 | 18 | namespace Gotenberg.Sharp.API.Client.Domain.Builders.Faceted; |
17 | 19 |
|
18 | 20 | public sealed class PagePropertyBuilder(PageProperties pageProperties) |
@@ -56,83 +58,83 @@ public PagePropertyBuilder SetScale(double scale) |
56 | 58 | return this; |
57 | 59 | } |
58 | 60 |
|
| 61 | + #region Obsolete Helper Functions |
| 62 | + |
59 | 63 | [Obsolete("Use SetPaperWidth")] |
60 | | - public PagePropertyBuilder PaperWidth(double width) |
61 | | - { |
62 | | - this._pageProperties.PaperWidth = width; |
63 | | - return this; |
64 | | - } |
| 64 | + public PagePropertyBuilder PaperWidth(double width) => SetPaperWidth(width); |
65 | 65 |
|
66 | 66 | [Obsolete("Use SetPaperHeight")] |
67 | | - public PagePropertyBuilder PaperHeight(double height) |
68 | | - { |
69 | | - this._pageProperties.PaperHeight = height; |
70 | | - return this; |
71 | | - } |
| 67 | + public PagePropertyBuilder PaperHeight(double height) => SetPaperHeight(height); |
72 | 68 |
|
73 | 69 | [Obsolete("Use SetMarginTop")] |
74 | | - public PagePropertyBuilder MarginTop(double marginTop) |
75 | | - { |
76 | | - this._pageProperties.MarginTop = marginTop; |
77 | | - return this; |
78 | | - } |
| 70 | + public PagePropertyBuilder MarginTop(double marginTop) => SetMarginTop(marginTop); |
79 | 71 |
|
80 | 72 | [Obsolete("Use SetMarginBottom")] |
81 | | - public PagePropertyBuilder MarginBottom(double marginBottom) |
82 | | - { |
83 | | - this._pageProperties.MarginBottom = marginBottom; |
84 | | - return this; |
85 | | - } |
| 73 | + public PagePropertyBuilder MarginBottom(double marginBottom) => SetMarginBottom(marginBottom); |
86 | 74 |
|
87 | 75 | [Obsolete("Use SetMarginLeft")] |
88 | | - public PagePropertyBuilder MarginLeft(double marginLeft) |
89 | | - { |
90 | | - this._pageProperties.MarginLeft = marginLeft; |
91 | | - return this; |
92 | | - } |
| 76 | + public PagePropertyBuilder MarginLeft(double marginLeft) => SetMarginLeft(marginLeft); |
93 | 77 |
|
94 | 78 | [Obsolete("Use SetMarginRight")] |
95 | | - public PagePropertyBuilder MarginRight(double marginRight) |
96 | | - { |
97 | | - this._pageProperties.MarginRight = marginRight; |
98 | | - return this; |
99 | | - } |
| 79 | + public PagePropertyBuilder MarginRight(double marginRight) => SetMarginRight(marginRight); |
| 80 | + |
| 81 | + #endregion |
| 82 | + |
| 83 | + #region Dimension Helpers for Inches |
| 84 | + |
| 85 | + public PagePropertyBuilder SetPaperWidth(double widthInches) => SetPaperWidth(Dimension.FromInches(widthInches)); |
| 86 | + |
| 87 | + public PagePropertyBuilder SetPaperHeight(double heightInches) => SetPaperHeight(Dimension.FromInches(heightInches)); |
100 | 88 |
|
101 | | - public PagePropertyBuilder SetPaperWidth(double width) |
| 89 | + public PagePropertyBuilder SetMarginTop(double marginTopInches) => SetMarginTop(Dimension.FromInches(marginTopInches)); |
| 90 | + |
| 91 | + public PagePropertyBuilder SetMarginBottom(double marginBottomInches) => SetMarginBottom(Dimension.FromInches(marginBottomInches)); |
| 92 | + |
| 93 | + public PagePropertyBuilder SetMarginLeft(double marginLeftInches) => SetMarginLeft(Dimension.FromInches(marginLeftInches)); |
| 94 | + |
| 95 | + public PagePropertyBuilder SetMarginRight(double marginRightInches) => SetMarginRight(Dimension.FromInches(marginRightInches)); |
| 96 | + |
| 97 | + #endregion |
| 98 | + |
| 99 | + #region Dimension Helpers |
| 100 | + |
| 101 | + public PagePropertyBuilder SetPaperWidth(Dimension width) |
102 | 102 | { |
103 | 103 | this._pageProperties.PaperWidth = width; |
104 | 104 | return this; |
105 | 105 | } |
106 | 106 |
|
107 | | - public PagePropertyBuilder SetPaperHeight(double height) |
| 107 | + public PagePropertyBuilder SetPaperHeight(Dimension height) |
108 | 108 | { |
109 | 109 | this._pageProperties.PaperHeight = height; |
110 | 110 | return this; |
111 | 111 | } |
112 | 112 |
|
113 | | - public PagePropertyBuilder SetMarginTop(double marginTop) |
| 113 | + public PagePropertyBuilder SetMarginTop(Dimension marginTop) |
114 | 114 | { |
115 | 115 | this._pageProperties.MarginTop = marginTop; |
116 | 116 | return this; |
117 | 117 | } |
118 | 118 |
|
119 | | - public PagePropertyBuilder SetMarginBottom(double marginBottom) |
| 119 | + public PagePropertyBuilder SetMarginBottom(Dimension marginBottom) |
120 | 120 | { |
121 | 121 | this._pageProperties.MarginBottom = marginBottom; |
122 | 122 | return this; |
123 | 123 | } |
124 | 124 |
|
125 | | - public PagePropertyBuilder SetMarginLeft(double marginLeft) |
| 125 | + public PagePropertyBuilder SetMarginLeft(Dimension marginLeft) |
126 | 126 | { |
127 | 127 | this._pageProperties.MarginLeft = marginLeft; |
128 | 128 | return this; |
129 | 129 | } |
130 | 130 |
|
131 | | - public PagePropertyBuilder SetMarginRight(double marginRight) |
| 131 | + public PagePropertyBuilder SetMarginRight(Dimension marginRight) |
132 | 132 | { |
133 | 133 | this._pageProperties.MarginRight = marginRight; |
134 | 134 | return this; |
135 | | - } |
| 135 | + } |
| 136 | + |
| 137 | + #endregion |
136 | 138 |
|
137 | 139 | [Obsolete("Use SetLandscape()")] |
138 | 140 | public PagePropertyBuilder LandScape(bool landscape = true) |
|
0 commit comments