Skip to content

Commit 453501a

Browse files
aaroncadriankblok
authored andcommitted
Paper Format Accessibility Changes (#1062)
* Make constructor public for custom configuration * Make width and height readonly * Update comments to include dimensions * Reference full namespace * - Revert reference in comment back to original state. - Add getters and setters back to Width and Height. - Make static properties getters instead of readonly properties. * Fix spacing
1 parent e9f1ecd commit 453501a

File tree

1 file changed

+38
-24
lines changed

1 file changed

+38
-24
lines changed

lib/PuppeteerSharp/Media/PaperFormat.cs

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ namespace PuppeteerSharp.Media
99
/// <seealso cref="PdfOptions.Format"/>
1010
public class PaperFormat : IEquatable<PaperFormat>
1111
{
12-
private PaperFormat() { }
13-
private PaperFormat(decimal width, decimal height)
12+
/// <summary>
13+
/// Page width and height in inches.
14+
/// </summary>
15+
/// <param name="width">Page width in inches</param>
16+
/// <param name="height">Page height in inches</param>
17+
public PaperFormat(decimal width, decimal height)
1418
{
1519
Width = width;
1620
Height = height;
@@ -29,49 +33,59 @@ private PaperFormat(decimal width, decimal height)
2933
public decimal Height { get; set; }
3034

3135
/// <summary>
32-
/// Letter.
36+
/// Letter: 8.5 inches x 11 inches.
3337
/// </summary>
34-
public static readonly PaperFormat Letter = new PaperFormat(8.5m, 11);
38+
public static PaperFormat Letter => new PaperFormat(8.5m, 11);
39+
3540
/// <summary>
36-
/// Legal.
41+
/// Legal: 8.5 inches by 14 inches.
3742
/// </summary>
38-
public static readonly PaperFormat Legal = new PaperFormat(8.5m, 14);
43+
public static PaperFormat Legal => new PaperFormat(8.5m, 14);
44+
3945
/// <summary>
40-
/// Tabloid.
46+
/// Tabloid: 11 inches by 17 inches.
4147
/// </summary>
42-
public static readonly PaperFormat Tabloid = new PaperFormat(11, 17);
48+
public static PaperFormat Tabloid => new PaperFormat(11, 17);
49+
4350
/// <summary>
44-
/// Ledger.
51+
/// Ledger: 17 inches by 11 inches.
4552
/// </summary>
46-
public static readonly PaperFormat Ledger = new PaperFormat(17, 11);
53+
public static PaperFormat Ledger => new PaperFormat(17, 11);
54+
4755
/// <summary>
48-
/// A0.
56+
/// A0: 33.1 inches by 46.8 inches.
4957
/// </summary>
50-
public static readonly PaperFormat A0 = new PaperFormat(33.1m, 46.8m);
58+
public static PaperFormat A0 => new PaperFormat(33.1m, 46.8m);
59+
5160
/// <summary>
52-
/// A1.
61+
/// A1: 23.4 inches by 33.1 inches
5362
/// </summary>
54-
public static readonly PaperFormat A1 = new PaperFormat(23.4m, 33.1m);
63+
public static PaperFormat A1 => new PaperFormat(23.4m, 33.1m);
64+
5565
/// <summary>
56-
/// A2.
66+
/// A2: 16.5 inches by 23.4 inches
5767
/// </summary>
58-
public static readonly PaperFormat A2 = new PaperFormat(16.5m, 23.4m);
68+
public static PaperFormat A2 => new PaperFormat(16.5m, 23.4m);
69+
5970
/// <summary>
60-
/// A3.
71+
/// A3: 11.7 inches by 16.5 inches
6172
/// </summary>
62-
public static readonly PaperFormat A3 = new PaperFormat(11.7m, 16.5m);
73+
public static PaperFormat A3 => new PaperFormat(11.7m, 16.5m);
74+
6375
/// <summary>
64-
/// A4.
76+
/// A4: 8.27 inches by 11.7 inches
6577
/// </summary>
66-
public static readonly PaperFormat A4 = new PaperFormat(8.27m, 11.7m);
78+
public static PaperFormat A4 => new PaperFormat(8.27m, 11.7m);
79+
6780
/// <summary>
68-
/// A5.
81+
/// A5: 5.83 inches by 8.27 inches
6982
/// </summary>
70-
public static readonly PaperFormat A5 = new PaperFormat(5.83m, 8.27m);
83+
public static PaperFormat A5 => new PaperFormat(5.83m, 8.27m);
84+
7185
/// <summary>
72-
/// A6.
86+
/// A6: 4.13 inches by 5.83 inches
7387
/// </summary>
74-
public static readonly PaperFormat A6 = new PaperFormat(4.13m, 5.83m);
88+
public static PaperFormat A6 => new PaperFormat(4.13m, 5.83m);
7589

7690
/// <inheritdoc/>
7791
public override bool Equals(object obj)

0 commit comments

Comments
 (0)