Showing
4 changed files
with
9 additions
and
9 deletions
@@ -15,7 +15,7 @@ The coordinate system is using the internal Pdf system: | @@ -15,7 +15,7 @@ The coordinate system is using the internal Pdf system: | ||
15 | Example: | 15 | Example: |
16 | ```dart | 16 | ```dart |
17 | final pdf = new PDFDocument(); | 17 | final pdf = new PDFDocument(); |
18 | -final page = new PDFPage(pdf, pageFormat: PDFPageFormat.LETTER); | 18 | +final page = new PDFPage(pdf, pageFormat: PDFPageFormat.letter); |
19 | final g = page.getGraphics(); | 19 | final g = page.getGraphics(); |
20 | final font = new PDFFont(pdf); | 20 | final font = new PDFFont(pdf); |
21 | 21 | ||
@@ -24,7 +24,7 @@ g.drawRect(50.0, 30.0, 100.0, 50.0); | @@ -24,7 +24,7 @@ g.drawRect(50.0, 30.0, 100.0, 50.0); | ||
24 | g.fillPath(); | 24 | g.fillPath(); |
25 | 25 | ||
26 | g.setColor(new PDFColor(0.3, 0.3, 0.3)); | 26 | g.setColor(new PDFColor(0.3, 0.3, 0.3)); |
27 | -g.drawString(font, 12.0, "Hello World!", 5.0 * PDFPageFormat.MM, 300.0); | 27 | +g.drawString(font, 12.0, "Hello World!", 5.0 * PDFPageFormat.mm, 300.0); |
28 | 28 | ||
29 | var file = new File('file.pdf'); | 29 | var file = new File('file.pdf'); |
30 | file.writeAsBytesSync(pdf.save()); | 30 | file.writeAsBytesSync(pdf.save()); |
@@ -4,19 +4,19 @@ import 'package:pdf/pdf.dart'; | @@ -4,19 +4,19 @@ import 'package:pdf/pdf.dart'; | ||
4 | 4 | ||
5 | void main() { | 5 | void main() { |
6 | final pdf = new PDFDocument(deflate: zlib.encode); | 6 | final pdf = new PDFDocument(deflate: zlib.encode); |
7 | - final page = new PDFPage(pdf, pageFormat: PDFPageFormat.LETTER); | 7 | + final page = new PDFPage(pdf, pageFormat: PDFPageFormat.letter); |
8 | final g = page.getGraphics(); | 8 | final g = page.getGraphics(); |
9 | final font = new PDFFont(pdf); | 9 | final font = new PDFFont(pdf); |
10 | final top = page.pageFormat.height; | 10 | final top = page.pageFormat.height; |
11 | 11 | ||
12 | g.setColor(new PDFColor(0.0, 1.0, 1.0)); | 12 | g.setColor(new PDFColor(0.0, 1.0, 1.0)); |
13 | - g.drawRect(50.0 * PDFPageFormat.MM, top - 80.0 * PDFPageFormat.MM, | ||
14 | - 100.0 * PDFPageFormat.MM, 50.0 * PDFPageFormat.MM); | 13 | + g.drawRect(50.0 * PDFPageFormat.mm, top - 80.0 * PDFPageFormat.mm, |
14 | + 100.0 * PDFPageFormat.mm, 50.0 * PDFPageFormat.mm); | ||
15 | g.fillPath(); | 15 | g.fillPath(); |
16 | 16 | ||
17 | g.setColor(new PDFColor(0.3, 0.3, 0.3)); | 17 | g.setColor(new PDFColor(0.3, 0.3, 0.3)); |
18 | - g.drawString(font, 12.0, "Hello World!", 10.0 * PDFPageFormat.MM, | ||
19 | - top - 10.0 * PDFPageFormat.MM); | 18 | + g.drawString(font, 12.0, "Hello World!", 10.0 * PDFPageFormat.mm, |
19 | + top - 10.0 * PDFPageFormat.mm); | ||
20 | 20 | ||
21 | var file = new File('example.pdf'); | 21 | var file = new File('example.pdf'); |
22 | file.writeAsBytesSync(pdf.save()); | 22 | file.writeAsBytesSync(pdf.save()); |
@@ -51,7 +51,7 @@ class PDFPage extends PDFObject { | @@ -51,7 +51,7 @@ class PDFPage extends PDFObject { | ||
51 | PDFPage(PDFDocument pdfDocument, {this.pageFormat}) | 51 | PDFPage(PDFDocument pdfDocument, {this.pageFormat}) |
52 | : super(pdfDocument, "/Page") { | 52 | : super(pdfDocument, "/Page") { |
53 | pdfDocument.pdfPageList.pages.add(this); | 53 | pdfDocument.pdfPageList.pages.add(this); |
54 | - if (pageFormat == null) pageFormat = PDFPageFormat.A4; | 54 | + if (pageFormat == null) pageFormat = PDFPageFormat.a4; |
55 | } | 55 | } |
56 | 56 | ||
57 | /// This returns a PDFGraphics object, which can then be used to render | 57 | /// This returns a PDFGraphics object, which can then be used to render |
@@ -6,7 +6,7 @@ import "package:test/test.dart"; | @@ -6,7 +6,7 @@ import "package:test/test.dart"; | ||
6 | void main() { | 6 | void main() { |
7 | test('Pdf1', () { | 7 | test('Pdf1', () { |
8 | var pdf = new PDFDocument(); | 8 | var pdf = new PDFDocument(); |
9 | - var page = new PDFPage(pdf, pageFormat: PDFPageFormat.A4); | 9 | + var page = new PDFPage(pdf, pageFormat: PDFPageFormat.a4); |
10 | 10 | ||
11 | var g = page.getGraphics(); | 11 | var g = page.getGraphics(); |
12 | g.drawLine(30.0, 30.0, 200.0, 200.0); | 12 | g.drawLine(30.0, 30.0, 200.0, 200.0); |
-
Please register or login to post a comment