Showing
1 changed file
with
34 additions
and
9 deletions
| @@ -19,16 +19,35 @@ | @@ -19,16 +19,35 @@ | ||
| 19 | part of pdf; | 19 | part of pdf; |
| 20 | 20 | ||
| 21 | class PDFPageFormat { | 21 | class PDFPageFormat { |
| 22 | - static const A4 = const PDFPageFormat(595.28, 841.89); | ||
| 23 | - static const A3 = const PDFPageFormat(841.89, 1190.55); | ||
| 24 | - static const A5 = const PDFPageFormat(420.94, 595.28); | ||
| 25 | - static const LETTER = const PDFPageFormat(612.0, 792.0); | ||
| 26 | - static const LEGAL = const PDFPageFormat(612.0, 1008.0); | 22 | + static const a4 = const PDFPageFormat(595.28, 841.89); |
| 23 | + static const a3 = const PDFPageFormat(841.89, 1190.55); | ||
| 24 | + static const a5 = const PDFPageFormat(420.94, 595.28); | ||
| 25 | + static const letter = const PDFPageFormat(612.0, 792.0); | ||
| 26 | + static const legal = const PDFPageFormat(612.0, 1008.0); | ||
| 27 | 27 | ||
| 28 | - static const PT = 1.0; | ||
| 29 | - static const IN = 72.0; | ||
| 30 | - static const CM = IN / 2.54; | ||
| 31 | - static const MM = IN / 25.4; | 28 | + static const point = 1.0; |
| 29 | + static const inch = 72.0; | ||
| 30 | + static const cm = inch / 2.54; | ||
| 31 | + static const mm = inch / 25.4; | ||
| 32 | + | ||
| 33 | + @deprecated | ||
| 34 | + static const A4 = a4; | ||
| 35 | + @deprecated | ||
| 36 | + static const A3 = a3; | ||
| 37 | + @deprecated | ||
| 38 | + static const A5 = a5; | ||
| 39 | + @deprecated | ||
| 40 | + static const LETTER = letter; | ||
| 41 | + @deprecated | ||
| 42 | + static const LEGAL = legal; | ||
| 43 | + @deprecated | ||
| 44 | + static const PT = point; | ||
| 45 | + @deprecated | ||
| 46 | + static const IN = inch; | ||
| 47 | + @deprecated | ||
| 48 | + static const CM = cm; | ||
| 49 | + @deprecated | ||
| 50 | + static const MM = mm; | ||
| 32 | 51 | ||
| 33 | final double width; | 52 | final double width; |
| 34 | final double height; | 53 | final double height; |
| @@ -36,4 +55,10 @@ class PDFPageFormat { | @@ -36,4 +55,10 @@ class PDFPageFormat { | ||
| 36 | const PDFPageFormat(this.width, this.height); | 55 | const PDFPageFormat(this.width, this.height); |
| 37 | 56 | ||
| 38 | PDFPoint get dimension => new PDFPoint(width, height); | 57 | PDFPoint get dimension => new PDFPoint(width, height); |
| 58 | + | ||
| 59 | + PDFPageFormat get landscape => | ||
| 60 | + width >= height ? this : PDFPageFormat(height, width); | ||
| 61 | + | ||
| 62 | + PDFPageFormat get portrait => | ||
| 63 | + height >= width ? this : PDFPageFormat(height, width); | ||
| 39 | } | 64 | } |
-
Please register or login to post a comment