Browse Source

Updated PageSizes to use integer values, which is more consistent with other software

Marcin Ziąbek 1 year ago
parent
commit
a15453abc2
1 changed files with 49 additions and 34 deletions
  1. 49 34
      Source/QuestPDF/Helpers/PageSizes.cs

+ 49 - 34
Source/QuestPDF/Helpers/PageSizes.cs

@@ -35,47 +35,62 @@ namespace QuestPDF.Helpers
     public static class PageSizes
     {
         public const int PointsPerInch = 72;
+        
+        public static PageSize A0 => new PageSize(2384, 3370);
+        public static PageSize A1 => new PageSize(1684, 2384);
+        public static PageSize A2 => new PageSize(1191, 1684);
+        public static PageSize A3 => new PageSize(842, 1191);
+        public static PageSize A4 => new PageSize(595, 842);
+        public static PageSize A5 => new PageSize(420, 595);
+        public static PageSize A6 => new PageSize(298, 420);
+        public static PageSize A7 => new PageSize(210, 298);
+        public static PageSize A8 => new PageSize(147, 210);
+        public static PageSize A9 => new PageSize(105, 147);
+        public static PageSize A10 => new PageSize(74, 105);
 
-        public static PageSize A0 => new PageSize(2384.2f, 3370.8f);
-        public static PageSize A1 => new PageSize(1684, 2384.2f);
-        public static PageSize A2 => new PageSize(1190.7f, 1684);
-        public static PageSize A3 => new PageSize(842, 1190.7f);
-        public static PageSize A4 => new PageSize(595.4f, 842);
-        public static PageSize A5 => new PageSize(419.6f, 595.4f);
-        public static PageSize A6 => new PageSize(297.7f, 419.6f);
-        public static PageSize A7 => new PageSize(209.8f, 297.7f);
-        public static PageSize A8 => new PageSize(147.4f, 209.8f);
-        public static PageSize A9 => new PageSize(104.9f, 147.4f);
-        public static PageSize A10 => new PageSize(73.7f, 104.9f);
+        public static PageSize B0 => new PageSize(2835, 4008);
+        public static PageSize B1 => new PageSize(2004, 2835);
+        public static PageSize B2 => new PageSize(1417, 2004);
+        public static PageSize B3 => new PageSize(1001, 1417);
+        public static PageSize B4 => new PageSize(709, 1001);
+        public static PageSize B5 => new PageSize(499, 709);
+        public static PageSize B6 => new PageSize(354, 499);
+        public static PageSize B7 => new PageSize(249, 354);
+        public static PageSize B8 => new PageSize(176, 249);
+        public static PageSize B9 => new PageSize(125, 176);
+        public static PageSize B10 => new PageSize(88, 125);
 
-        public static PageSize B0 => new PageSize(2835, 4008.7f);
-        public static PageSize B1 => new PageSize(2004.3f, 2835);
-        public static PageSize B2 => new PageSize(1417.5f, 2004.3f);
-        public static PageSize B3 => new PageSize(1000.8f, 1417.5f);
-        public static PageSize B4 => new PageSize(708.8f, 1000.8f);
-        public static PageSize B5 => new PageSize(499, 708.8f);
-        public static PageSize B6 => new PageSize(354.4f, 499);
-        public static PageSize B7 => new PageSize(249.5f, 354.4f);
-        public static PageSize B8 => new PageSize(175.8f, 249.5f);
-        public static PageSize B9 => new PageSize(124.7f, 175.8f);
-        public static PageSize B10 => new PageSize(87.9f, 124.7f);
+        public static PageSize C0 => new PageSize(2599, 3677);
+        public static PageSize C1 => new PageSize(1837, 2599);
+        public static PageSize C2 => new PageSize(1298, 1837);
+        public static PageSize C3 => new PageSize(918, 1298);
+        public static PageSize C4 => new PageSize(649, 918);
+        public static PageSize C5 => new PageSize(459, 649);
+        public static PageSize C6 => new PageSize(323, 459);
+        public static PageSize C7 => new PageSize(230, 323);
+        public static PageSize C8 => new PageSize(162, 230);
+        public static PageSize C9 => new PageSize(113, 162);
+        public static PageSize C10 => new PageSize(79, 113);
 
-        public static PageSize Env10 => new PageSize(683.2f, 294.8f);
-        public static PageSize EnvC4 => new PageSize(649.2f, 918.5f);
-        public static PageSize EnvDL => new PageSize(311.9f, 623.7f);
+        public static PageSize Env10 => new PageSize(297, 684);
+        public static PageSize EnvC4 => new PageSize(649, 918);
+        public static PageSize EnvDL => new PageSize(312, 624);
 
+        public static PageSize Postcard => new PageSize(284, 419);
         public static PageSize Executive => new PageSize(522, 756);
-        public static PageSize Legal => new PageSize(612, 1008);
         public static PageSize Letter => new PageSize(612, 792);
+        public static PageSize Legal => new PageSize(612, 1008);
+        public static PageSize Ledger => new PageSize(792, 1224);
+        public static PageSize Tabloid => new PageSize(1224, 792);
 
-        public static PageSize ARCH_A => new PageSize(649.2f, 864.7f);
-        public static PageSize ARCH_B => new PageSize(864.7f, 1295.6f);
-        public static PageSize ARCH_C => new PageSize(1295.6f, 1729.3f);
-        public static PageSize ARCH_D => new PageSize(1729.3f, 2591.2f);
-        public static PageSize ARCH_E => new PageSize(2591.2f, 3455.9f);
-        public static PageSize ARCH_E1 => new PageSize(2160.3f, 3024.9f);
-        public static PageSize ARCH_E2 => new PageSize(1871.1f, 2735.8f);
-        public static PageSize ARCH_E3 => new PageSize(1944.8f, 2809.5f);
+        public static PageSize ARCH_A => new PageSize(648, 864);
+        public static PageSize ARCH_B => new PageSize(864, 1296);
+        public static PageSize ARCH_C => new PageSize(1296, 1728);
+        public static PageSize ARCH_D => new PageSize(1728, 2592);
+        public static PageSize ARCH_E => new PageSize(2592, 3456);
+        public static PageSize ARCH_E1 => new PageSize(2160, 3024);
+        public static PageSize ARCH_E2 => new PageSize(1872, 2736);
+        public static PageSize ARCH_E3 => new PageSize(1944, 2808);
     }
 
     public static class PageSizeExtensions