Showing
29 changed files
with
158 additions
and
162 deletions
@@ -14,27 +14,27 @@ The coordinate system is using the internal Pdf system: | @@ -14,27 +14,27 @@ The coordinate system is using the internal Pdf system: | ||
14 | 14 | ||
15 | Example: | 15 | Example: |
16 | ```dart | 16 | ```dart |
17 | -final pdf = new PdfDocument(); | ||
18 | -final page = new PdfPage(pdf, pageFormat: PdfPageFormat.letter); | 17 | +final pdf = PdfDocument(); |
18 | +final page = PdfPage(pdf, pageFormat: PdfPageFormat.letter); | ||
19 | final g = page.getGraphics(); | 19 | final g = page.getGraphics(); |
20 | -final font = new PdfFont(pdf); | 20 | +final font = PdfFont(pdf); |
21 | 21 | ||
22 | -g.setColor(new PdfColor(0.0, 1.0, 1.0)); | 22 | +g.setColor(PdfColor(0.0, 1.0, 1.0)); |
23 | g.drawRect(50.0, 30.0, 100.0, 50.0); | 23 | 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(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 = File('file.pdf'); |
30 | file.writeAsBytesSync(pdf.save()); | 30 | file.writeAsBytesSync(pdf.save()); |
31 | ``` | 31 | ``` |
32 | 32 | ||
33 | To load an image it is possible to use the dart library [image](https://pub.dartlang.org/packages/image): | 33 | To load an image it is possible to use the dart library [image](https://pub.dartlang.org/packages/image): |
34 | 34 | ||
35 | ```dart | 35 | ```dart |
36 | -Image image = decodeImage(new Io.File('test.webp').readAsBytesSync()); | ||
37 | -PdfImage image = new PdfImage( | 36 | +Image image = decodeImage(Io.File('test.webp').readAsBytesSync()); |
37 | +PdfImage image = PdfImage( | ||
38 | pdf, | 38 | pdf, |
39 | image: img.data.buffer.asUint8List(), | 39 | image: img.data.buffer.asUint8List(), |
40 | width: img.width, | 40 | width: img.width, |
@@ -45,9 +45,9 @@ g.drawImage(image, 100.0, 100.0, 80.0); | @@ -45,9 +45,9 @@ g.drawImage(image, 100.0, 100.0, 80.0); | ||
45 | To use a TrueType font: | 45 | To use a TrueType font: |
46 | 46 | ||
47 | ```dart | 47 | ```dart |
48 | -PdfTtfFont ttf = new PdfTtfFont( | 48 | +PdfTtfFont ttf = PdfTtfFont( |
49 | pdf, | 49 | pdf, |
50 | - (new File("open-sans.ttf").readAsBytesSync() as Uint8List).buffer.asByteData()); | ||
51 | -g.setColor(new PdfColor(0.3, 0.3, 0.3)); | 50 | + (File("open-sans.ttf").readAsBytesSync() as Uint8List).buffer.asByteData()); |
51 | +g.setColor(PdfColor(0.3, 0.3, 0.3)); | ||
52 | g.drawString(ttf, 20.0, "Dart is awesome", 50.0, 30.0); | 52 | g.drawString(ttf, 20.0, "Dart is awesome", 50.0, 30.0); |
53 | ``` | 53 | ``` |
@@ -3,21 +3,21 @@ import 'dart:io'; | @@ -3,21 +3,21 @@ import 'dart:io'; | ||
3 | import 'package:pdf/pdf.dart'; | 3 | import 'package:pdf/pdf.dart'; |
4 | 4 | ||
5 | void main() { | 5 | void main() { |
6 | - final pdf = new PdfDocument(deflate: zlib.encode); | ||
7 | - final page = new PdfPage(pdf, pageFormat: PdfPageFormat.letter); | 6 | + final pdf = PdfDocument(deflate: zlib.encode); |
7 | + final page = PdfPage(pdf, pageFormat: PdfPageFormat.letter); | ||
8 | final g = page.getGraphics(); | 8 | final g = page.getGraphics(); |
9 | - final font = new PdfFont(pdf); | 9 | + final font = 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(PdfColor(0.0, 1.0, 1.0)); |
13 | g.drawRect(50.0 * PdfPageFormat.mm, top - 80.0 * PdfPageFormat.mm, | 13 | g.drawRect(50.0 * PdfPageFormat.mm, top - 80.0 * PdfPageFormat.mm, |
14 | 100.0 * PdfPageFormat.mm, 50.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(PdfColor(0.3, 0.3, 0.3)); |
18 | g.drawString(font, 12.0, "Hello World!", 10.0 * PdfPageFormat.mm, | 18 | g.drawString(font, 12.0, "Hello World!", 10.0 * PdfPageFormat.mm, |
19 | top - 10.0 * PdfPageFormat.mm); | 19 | top - 10.0 * PdfPageFormat.mm); |
20 | 20 | ||
21 | - var file = new File('example.pdf'); | 21 | + var file = File('example.pdf'); |
22 | file.writeAsBytesSync(pdf.save()); | 22 | file.writeAsBytesSync(pdf.save()); |
23 | } | 23 | } |
@@ -53,13 +53,13 @@ class PdfAnnot extends PdfObject { | @@ -53,13 +53,13 @@ class PdfAnnot extends PdfObject { | ||
53 | /// @param s Subtype for this annotation | 53 | /// @param s Subtype for this annotation |
54 | /// @param rect coordinates | 54 | /// @param rect coordinates |
55 | factory PdfAnnot.annotation(PdfPage pdfPage, String s, PdfRect rect) => | 55 | factory PdfAnnot.annotation(PdfPage pdfPage, String s, PdfRect rect) => |
56 | - new PdfAnnot(pdfPage, type: "/Annot", s: s, srcRect: rect); | 56 | + PdfAnnot(pdfPage, type: "/Annot", s: s, srcRect: rect); |
57 | 57 | ||
58 | /// Creates a text annotation | 58 | /// Creates a text annotation |
59 | /// @param rect coordinates | 59 | /// @param rect coordinates |
60 | /// @param s Text for this annotation | 60 | /// @param s Text for this annotation |
61 | factory PdfAnnot.text(PdfPage pdfPage, PdfRect rect, String s) => | 61 | factory PdfAnnot.text(PdfPage pdfPage, PdfRect rect, String s) => |
62 | - new PdfAnnot(pdfPage, type: "/Text", srcRect: rect, s: s); | 62 | + PdfAnnot(pdfPage, type: "/Text", srcRect: rect, s: s); |
63 | 63 | ||
64 | /// Creates a link annotation | 64 | /// Creates a link annotation |
65 | /// @param srcRect coordinates | 65 | /// @param srcRect coordinates |
@@ -68,7 +68,7 @@ class PdfAnnot extends PdfObject { | @@ -68,7 +68,7 @@ class PdfAnnot extends PdfObject { | ||
68 | /// (must be in User Coordinates) | 68 | /// (must be in User Coordinates) |
69 | factory PdfAnnot.link(PdfPage pdfPage, PdfRect srcRect, PdfObject dest, | 69 | factory PdfAnnot.link(PdfPage pdfPage, PdfRect srcRect, PdfObject dest, |
70 | [PdfRect destRect]) => | 70 | [PdfRect destRect]) => |
71 | - new PdfAnnot(pdfPage, | 71 | + PdfAnnot(pdfPage, |
72 | type: "/Link", srcRect: srcRect, dest: dest, destRect: destRect); | 72 | type: "/Link", srcRect: srcRect, dest: dest, destRect: destRect); |
73 | 73 | ||
74 | /// Sets the border for the annotation. By default, no border is defined. | 74 | /// Sets the border for the annotation. By default, no border is defined. |
@@ -86,7 +86,7 @@ class PdfAnnot extends PdfObject { | @@ -86,7 +86,7 @@ class PdfAnnot extends PdfObject { | ||
86 | /// is null, then the default of {3} is used. | 86 | /// is null, then the default of {3} is used. |
87 | void setBorder(double width, | 87 | void setBorder(double width, |
88 | {PdfBorderStyle style = PdfBorderStyle.solid, List<double> dash}) { | 88 | {PdfBorderStyle style = PdfBorderStyle.solid, List<double> dash}) { |
89 | - border = new PdfBorder(pdfDocument, width, style: style, dash: dash); | 89 | + border = PdfBorder(pdfDocument, width, style: style, dash: dash); |
90 | } | 90 | } |
91 | 91 | ||
92 | /// Output the annotation | 92 | /// Output the annotation |
@@ -111,7 +111,7 @@ class PdfAnnot extends PdfObject { | @@ -111,7 +111,7 @@ class PdfAnnot extends PdfObject { | ||
111 | if (subtype == "/Text") { | 111 | if (subtype == "/Text") { |
112 | params["/Contents"] = PdfStream.string(s); | 112 | params["/Contents"] = PdfStream.string(s); |
113 | } else if (subtype == "/Link") { | 113 | } else if (subtype == "/Link") { |
114 | - var dests = new List<PdfStream>(); | 114 | + var dests = List<PdfStream>(); |
115 | dests.add(dest.ref()); | 115 | dests.add(dest.ref()); |
116 | if (destRect == null) | 116 | if (destRect == null) |
117 | dests.add(PdfStream.string("/Fit")); | 117 | dests.add(PdfStream.string("/Fit")); |
@@ -20,7 +20,7 @@ part of pdf; | @@ -20,7 +20,7 @@ part of pdf; | ||
20 | 20 | ||
21 | class Ascii85Encoder extends Converter<List<int>, List<int>> { | 21 | class Ascii85Encoder extends Converter<List<int>, List<int>> { |
22 | List<int> convert(List<int> input) { | 22 | List<int> convert(List<int> input) { |
23 | - Uint8List buffer = new Uint8List(_maxEncodedLen(input.length) + 2); | 23 | + Uint8List buffer = Uint8List(_maxEncodedLen(input.length) + 2); |
24 | 24 | ||
25 | var b = 0; | 25 | var b = 0; |
26 | var s = 0; | 26 | var s = 0; |
@@ -64,7 +64,7 @@ class PdfBorder extends PdfObject { | @@ -64,7 +64,7 @@ class PdfBorder extends PdfObject { | ||
64 | void writeContent(PdfStream os) { | 64 | void writeContent(PdfStream os) { |
65 | super.writeContent(os); | 65 | super.writeContent(os); |
66 | 66 | ||
67 | - var data = new List<PdfStream>(); | 67 | + var data = List<PdfStream>(); |
68 | data.add(PdfStream.string("/S")); | 68 | data.add(PdfStream.string("/S")); |
69 | data.add(PdfStream.string( | 69 | data.add(PdfStream.string( |
70 | "/" + "SDBIU".substring(style.index, style.index + 1))); | 70 | "/" + "SDBIU".substring(style.index, style.index + 1))); |
@@ -24,20 +24,17 @@ class PdfColor { | @@ -24,20 +24,17 @@ class PdfColor { | ||
24 | final double g; | 24 | final double g; |
25 | final double b; | 25 | final double b; |
26 | 26 | ||
27 | - static var black = new PdfColor(0.0, 0.0, 0.0); | 27 | + static var black = PdfColor(0.0, 0.0, 0.0); |
28 | 28 | ||
29 | const PdfColor(this.r, this.g, this.b, [this.a = 1.0]); | 29 | const PdfColor(this.r, this.g, this.b, [this.a = 1.0]); |
30 | 30 | ||
31 | factory PdfColor.fromInt(int color) { | 31 | factory PdfColor.fromInt(int color) { |
32 | - return new PdfColor( | ||
33 | - (color >> 16 & 0xff) / 255.0, | ||
34 | - (color >> 8 & 0xff) / 255.0, | ||
35 | - (color & 0xff) / 255.0, | ||
36 | - (color >> 24 & 0xff) / 255.0); | 32 | + return PdfColor((color >> 16 & 0xff) / 255.0, (color >> 8 & 0xff) / 255.0, |
33 | + (color & 0xff) / 255.0, (color >> 24 & 0xff) / 255.0); | ||
37 | } | 34 | } |
38 | 35 | ||
39 | factory PdfColor.fromHex(String color) { | 36 | factory PdfColor.fromHex(String color) { |
40 | - return new PdfColor( | 37 | + return PdfColor( |
41 | (int.parse(color.substring(0, 1), radix: 16) >> 16 & 0xff) / 255.0, | 38 | (int.parse(color.substring(0, 1), radix: 16) >> 16 & 0xff) / 255.0, |
42 | (int.parse(color.substring(2, 3), radix: 16) >> 8 & 0xff) / 255.0, | 39 | (int.parse(color.substring(2, 3), radix: 16) >> 8 & 0xff) / 255.0, |
43 | (int.parse(color.substring(4, 5), radix: 16) & 0xff) / 255.0, | 40 | (int.parse(color.substring(4, 5), radix: 16) & 0xff) / 255.0, |
@@ -50,11 +50,11 @@ class PDFAnnot extends PdfAnnot { | @@ -50,11 +50,11 @@ class PDFAnnot extends PdfAnnot { | ||
50 | 50 | ||
51 | factory PDFAnnot.annotation( | 51 | factory PDFAnnot.annotation( |
52 | PdfPage pdfPage, String s, double l, double b, double r, double t) => | 52 | PdfPage pdfPage, String s, double l, double b, double r, double t) => |
53 | - new PDFAnnot(pdfPage, type: "/Annot", s: s, l: l, b: b, r: r, t: t); | 53 | + PDFAnnot(pdfPage, type: "/Annot", s: s, l: l, b: b, r: r, t: t); |
54 | 54 | ||
55 | factory PDFAnnot.text( | 55 | factory PDFAnnot.text( |
56 | PdfPage pdfPage, double l, double b, double r, double t, String s) => | 56 | PdfPage pdfPage, double l, double b, double r, double t, String s) => |
57 | - new PDFAnnot(pdfPage, type: "/Text", l: l, b: b, r: r, t: t, s: s); | 57 | + PDFAnnot(pdfPage, type: "/Text", l: l, b: b, r: r, t: t, s: s); |
58 | 58 | ||
59 | factory PDFAnnot.link(PdfPage pdfPage, double l, double b, double r, double t, | 59 | factory PDFAnnot.link(PdfPage pdfPage, double l, double b, double r, double t, |
60 | PdfObject dest, | 60 | PdfObject dest, |
@@ -62,7 +62,7 @@ class PDFAnnot extends PdfAnnot { | @@ -62,7 +62,7 @@ class PDFAnnot extends PdfAnnot { | ||
62 | double fb = FULL_PAGE, | 62 | double fb = FULL_PAGE, |
63 | double fr = FULL_PAGE, | 63 | double fr = FULL_PAGE, |
64 | double ft = FULL_PAGE]) => | 64 | double ft = FULL_PAGE]) => |
65 | - new PDFAnnot(pdfPage, | 65 | + PDFAnnot(pdfPage, |
66 | type: "/Link", | 66 | type: "/Link", |
67 | l: l, | 67 | l: l, |
68 | b: b, | 68 | b: b, |
@@ -249,7 +249,7 @@ class PDFPage extends PdfPage { | @@ -249,7 +249,7 @@ class PDFPage extends PdfPage { | ||
249 | /// @return a Dimension object containing the width and height of the page. | 249 | /// @return a Dimension object containing the width and height of the page. |
250 | /// use pageFormat.dimension | 250 | /// use pageFormat.dimension |
251 | @deprecated | 251 | @deprecated |
252 | - PdfPoint getDimension() => new PdfPoint(pageFormat.width, pageFormat.height); | 252 | + PdfPoint getDimension() => PdfPoint(pageFormat.width, pageFormat.height); |
253 | 253 | ||
254 | /// This method adds a text note to the document. | 254 | /// This method adds a text note to the document. |
255 | /// @param note Text of the note | 255 | /// @param note Text of the note |
@@ -262,8 +262,8 @@ class PDFPage extends PdfPage { | @@ -262,8 +262,8 @@ class PDFPage extends PdfPage { | ||
262 | PdfAnnot addNote(String note, double x, y, w, h) { | 262 | PdfAnnot addNote(String note, double x, y, w, h) { |
263 | var xy1 = cxy(x, y + h); | 263 | var xy1 = cxy(x, y + h); |
264 | var xy2 = cxy(x + w, y); | 264 | var xy2 = cxy(x + w, y); |
265 | - PdfAnnot ob = new PdfAnnot.text( | ||
266 | - this, PdfRect.fromLTRB(xy1.x, xy1.y, xy2.x, xy2.y), note); | 265 | + PdfAnnot ob = |
266 | + PdfAnnot.text(this, PdfRect.fromLTRB(xy1.x, xy1.y, xy2.x, xy2.y), note); | ||
267 | return ob; | 267 | return ob; |
268 | } | 268 | } |
269 | 269 | ||
@@ -289,7 +289,7 @@ class PDFPage extends PdfPage { | @@ -289,7 +289,7 @@ class PDFPage extends PdfPage { | ||
289 | var xy2 = cxy(x + w, y); | 289 | var xy2 = cxy(x + w, y); |
290 | var xy3 = cxy(vx, vy + vh); | 290 | var xy3 = cxy(vx, vy + vh); |
291 | var xy4 = cxy(vx + vw, vy); | 291 | var xy4 = cxy(vx + vw, vy); |
292 | - PdfAnnot ob = new PdfAnnot.link( | 292 | + PdfAnnot ob = PdfAnnot.link( |
293 | this, | 293 | this, |
294 | PdfRect.fromLTRB(xy1.x, xy1.y, xy2.x, xy2.y), | 294 | PdfRect.fromLTRB(xy1.x, xy1.y, xy2.x, xy2.y), |
295 | dest, | 295 | dest, |
@@ -310,7 +310,7 @@ class PDFPage extends PdfPage { | @@ -310,7 +310,7 @@ class PDFPage extends PdfPage { | ||
310 | {double x, double y, double w, double h}) { | 310 | {double x, double y, double w, double h}) { |
311 | PdfPoint xy1 = cxy(x, y + h); | 311 | PdfPoint xy1 = cxy(x, y + h); |
312 | PdfPoint xy2 = cxy(x + w, y); | 312 | PdfPoint xy2 = cxy(x + w, y); |
313 | - PdfOutline outline = new PdfOutline(pdfDocument, | 313 | + PdfOutline outline = PdfOutline(pdfDocument, |
314 | title: title, | 314 | title: title, |
315 | dest: this, | 315 | dest: this, |
316 | rect: PdfRect.fromLTRB(xy1.x, xy2.y, xy2.x, xy1.y)); | 316 | rect: PdfRect.fromLTRB(xy1.x, xy2.y, xy2.x, xy1.y)); |
@@ -340,7 +340,7 @@ class PDFPage extends PdfPage { | @@ -340,7 +340,7 @@ class PDFPage extends PdfPage { | ||
340 | /// @param y Coordinate in User space | 340 | /// @param y Coordinate in User space |
341 | /// @return array containing the x & y Coordinate in User space | 341 | /// @return array containing the x & y Coordinate in User space |
342 | @deprecated | 342 | @deprecated |
343 | - PdfPoint cxy(double x, double y) => new PdfPoint(x, pageFormat.height - y); | 343 | + PdfPoint cxy(double x, double y) => PdfPoint(x, pageFormat.height - y); |
344 | } | 344 | } |
345 | 345 | ||
346 | @deprecated | 346 | @deprecated |
@@ -49,7 +49,7 @@ class PdfDocument { | @@ -49,7 +49,7 @@ class PdfDocument { | ||
49 | int _objser; | 49 | int _objser; |
50 | 50 | ||
51 | /// This vector contains each indirect object within the document. | 51 | /// This vector contains each indirect object within the document. |
52 | - final Set<PdfObject> objects = new Set<PdfObject>(); | 52 | + final Set<PdfObject> objects = Set<PdfObject>(); |
53 | 53 | ||
54 | /// This is the Catalog object, which is required by each Pdf Document | 54 | /// This is the Catalog object, which is required by each Pdf Document |
55 | PdfCatalog catalog; | 55 | PdfCatalog catalog; |
@@ -82,7 +82,7 @@ class PdfDocument { | @@ -82,7 +82,7 @@ class PdfDocument { | ||
82 | ]; | 82 | ]; |
83 | 83 | ||
84 | /// This holds the current fonts | 84 | /// This holds the current fonts |
85 | - final Set<PdfFont> fonts = new Set<PdfFont>(); | 85 | + final Set<PdfFont> fonts = Set<PdfFont>(); |
86 | 86 | ||
87 | /// Creates a new serial number | 87 | /// Creates a new serial number |
88 | int _genSerial() => _objser++; | 88 | int _genSerial() => _objser++; |
@@ -94,9 +94,9 @@ class PdfDocument { | @@ -94,9 +94,9 @@ class PdfDocument { | ||
94 | _objser = 1; | 94 | _objser = 1; |
95 | 95 | ||
96 | // Now create some standard objects | 96 | // Now create some standard objects |
97 | - pdfPageList = new PdfPageList(this); | ||
98 | - catalog = new PdfCatalog(this, pdfPageList, pageMode); | ||
99 | - info = new PdfInfo(this); | 97 | + pdfPageList = PdfPageList(this); |
98 | + catalog = PdfCatalog(this, pdfPageList, pageMode); | ||
99 | + info = PdfInfo(this); | ||
100 | } | 100 | } |
101 | 101 | ||
102 | /// This returns a specific page. It's used mainly when using a | 102 | /// This returns a specific page. It's used mainly when using a |
@@ -113,7 +113,7 @@ class PdfDocument { | @@ -113,7 +113,7 @@ class PdfDocument { | ||
113 | /// @return the root outline | 113 | /// @return the root outline |
114 | PdfOutline get outline { | 114 | PdfOutline get outline { |
115 | if (_outline == null) { | 115 | if (_outline == null) { |
116 | - _outline = new PdfOutline(this); | 116 | + _outline = PdfOutline(this); |
117 | catalog.outlines = _outline; | 117 | catalog.outlines = _outline; |
118 | } | 118 | } |
119 | return _outline; | 119 | return _outline; |
@@ -131,7 +131,7 @@ class PdfDocument { | @@ -131,7 +131,7 @@ class PdfDocument { | ||
131 | /// | 131 | /// |
132 | /// @param os OutputStream to write the document to | 132 | /// @param os OutputStream to write the document to |
133 | void write(PdfStream os) { | 133 | void write(PdfStream os) { |
134 | - PdfOutput pos = new PdfOutput(os); | 134 | + PdfOutput pos = PdfOutput(os); |
135 | 135 | ||
136 | // Write each object to the [PdfStream]. We call via the output | 136 | // Write each object to the [PdfStream]. We call via the output |
137 | // as that builds the xref table | 137 | // as that builds the xref table |
@@ -144,7 +144,7 @@ class PdfDocument { | @@ -144,7 +144,7 @@ class PdfDocument { | ||
144 | } | 144 | } |
145 | 145 | ||
146 | List<int> save() { | 146 | List<int> save() { |
147 | - PdfStream os = new PdfStream(); | 147 | + PdfStream os = PdfStream(); |
148 | write(os); | 148 | write(os); |
149 | return os.output(); | 149 | return os.output(); |
150 | } | 150 | } |
@@ -79,7 +79,7 @@ class PdfFont extends PdfObject { | @@ -79,7 +79,7 @@ class PdfFont extends PdfObject { | ||
79 | w += n == chars.length - 1 ? r.w : glyphAdvance(c); | 79 | w += n == chars.length - 1 ? r.w : glyphAdvance(c); |
80 | } | 80 | } |
81 | 81 | ||
82 | - return new PdfRect(x, y, w, h); | 82 | + return PdfRect(x, y, w, h); |
83 | } | 83 | } |
84 | 84 | ||
85 | PdfPoint stringSize(String s) { | 85 | PdfPoint stringSize(String s) { |
@@ -94,6 +94,6 @@ class PdfFont extends PdfObject { | @@ -94,6 +94,6 @@ class PdfFont extends PdfObject { | ||
94 | w += glyphAdvance(c); | 94 | w += glyphAdvance(c); |
95 | } | 95 | } |
96 | 96 | ||
97 | - return new PdfPoint(w, h); | 97 | + return PdfPoint(w, h); |
98 | } | 98 | } |
99 | } | 99 | } |
@@ -32,7 +32,7 @@ class PdfFontDescriptor extends PdfObject { | @@ -32,7 +32,7 @@ class PdfFontDescriptor extends PdfObject { | ||
32 | params["/FontName"] = PdfStream.string(ttfFont.baseFont); | 32 | params["/FontName"] = PdfStream.string(ttfFont.baseFont); |
33 | params["/FontFile2"] = file.ref(); | 33 | params["/FontFile2"] = file.ref(); |
34 | params["/Flags"] = PdfStream.intNum(32); | 34 | params["/Flags"] = PdfStream.intNum(32); |
35 | - params["/FontBBox"] = new PdfStream() | 35 | + params["/FontBBox"] = PdfStream() |
36 | ..putStringArray([ | 36 | ..putStringArray([ |
37 | ttfFont.font.xMin, | 37 | ttfFont.font.xMin, |
38 | ttfFont.font.yMin, | 38 | ttfFont.font.yMin, |
@@ -20,10 +20,10 @@ part of pdf; | @@ -20,10 +20,10 @@ part of pdf; | ||
20 | 20 | ||
21 | class PdfFormXObject extends PdfXObject { | 21 | class PdfFormXObject extends PdfXObject { |
22 | /// The fonts associated with this page | 22 | /// The fonts associated with this page |
23 | - final fonts = new Map<String, PdfFont>(); | 23 | + final fonts = Map<String, PdfFont>(); |
24 | 24 | ||
25 | /// The xobjects or other images in the pdf | 25 | /// The xobjects or other images in the pdf |
26 | - final xobjects = new Map<String, PdfXObject>(); | 26 | + final xobjects = Map<String, PdfXObject>(); |
27 | 27 | ||
28 | PdfFormXObject(PdfDocument pdfDocument) : super(pdfDocument, '/Form') { | 28 | PdfFormXObject(PdfDocument pdfDocument) : super(pdfDocument, '/Form') { |
29 | params["/FormType"] = PdfStream.string("1"); | 29 | params["/FormType"] = PdfStream.string("1"); |
@@ -43,16 +43,16 @@ class PdfFormXObject extends PdfXObject { | @@ -43,16 +43,16 @@ class PdfFormXObject extends PdfXObject { | ||
43 | 43 | ||
44 | // Now the resources | 44 | // Now the resources |
45 | /// This holds any resources for this FormXObject | 45 | /// This holds any resources for this FormXObject |
46 | - final resources = new Map<String, PdfStream>(); | 46 | + final resources = Map<String, PdfStream>(); |
47 | 47 | ||
48 | // fonts | 48 | // fonts |
49 | if (fonts.length > 0) { | 49 | if (fonts.length > 0) { |
50 | - resources["/Font"] = new PdfStream()..putObjectDictionary(fonts); | 50 | + resources["/Font"] = PdfStream()..putObjectDictionary(fonts); |
51 | } | 51 | } |
52 | 52 | ||
53 | // Now the XObjects | 53 | // Now the XObjects |
54 | if (xobjects.length > 0) { | 54 | if (xobjects.length > 0) { |
55 | - resources["/XObject"] = new PdfStream()..putObjectDictionary(xobjects); | 55 | + resources["/XObject"] = PdfStream()..putObjectDictionary(xobjects); |
56 | } | 56 | } |
57 | 57 | ||
58 | if (resources.length > 0) { | 58 | if (resources.length > 0) { |
@@ -32,7 +32,7 @@ class PdfGraphics { | @@ -32,7 +32,7 @@ class PdfGraphics { | ||
32 | 32 | ||
33 | PdfFont get defaultFont { | 33 | PdfFont get defaultFont { |
34 | if (page.pdfDocument.fonts.length == 0) { | 34 | if (page.pdfDocument.fonts.length == 0) { |
35 | - new PdfFont(page.pdfDocument); | 35 | + PdfFont(page.pdfDocument); |
36 | } | 36 | } |
37 | 37 | ||
38 | return page.pdfDocument.fonts.elementAt(0); | 38 | return page.pdfDocument.fonts.elementAt(0); |
@@ -200,9 +200,9 @@ class PdfGraphics { | @@ -200,9 +200,9 @@ class PdfGraphics { | ||
200 | } | 200 | } |
201 | 201 | ||
202 | void drawShape(String d) { | 202 | void drawShape(String d) { |
203 | - var sb = new StringBuffer(); | 203 | + var sb = StringBuffer(); |
204 | 204 | ||
205 | - RegExp exp = new RegExp(r"([MmZzLlHhVvCcSsQqTtAa])|(-[\.0-9]+)|([\.0-9]+)"); | 205 | + RegExp exp = RegExp(r"([MmZzLlHhVvCcSsQqTtAa])|(-[\.0-9]+)|([\.0-9]+)"); |
206 | var matches = exp.allMatches(d); | 206 | var matches = exp.allMatches(d); |
207 | var action; | 207 | var action; |
208 | for (var m in matches) { | 208 | for (var m in matches) { |
@@ -60,7 +60,7 @@ class PdfImage extends PdfXObject { | @@ -60,7 +60,7 @@ class PdfImage extends PdfXObject { | ||
60 | params['/Name'] = PdfStream.string(_name); | 60 | params['/Name'] = PdfStream.string(_name); |
61 | 61 | ||
62 | if (alphaChannel == false && alpha) { | 62 | if (alphaChannel == false && alpha) { |
63 | - var _sMask = new PdfImage(pdfDocument, | 63 | + var _sMask = PdfImage(pdfDocument, |
64 | image: image, | 64 | image: image, |
65 | width: width, | 65 | width: width, |
66 | height: height, | 66 | height: height, |
@@ -85,7 +85,7 @@ class PdfImage extends PdfXObject { | @@ -85,7 +85,7 @@ class PdfImage extends PdfXObject { | ||
85 | int h = height; | 85 | int h = height; |
86 | int s = w * h; | 86 | int s = w * h; |
87 | 87 | ||
88 | - Uint8List out = new Uint8List(alphaChannel ? s : s * 3); | 88 | + Uint8List out = Uint8List(alphaChannel ? s : s * 3); |
89 | 89 | ||
90 | if (alphaChannel) { | 90 | if (alphaChannel) { |
91 | for (int i = 0; i < s; i++) { | 91 | for (int i = 0; i < s; i++) { |
@@ -20,7 +20,7 @@ part of pdf; | @@ -20,7 +20,7 @@ part of pdf; | ||
20 | 20 | ||
21 | class PdfObject { | 21 | class PdfObject { |
22 | /// This is the object parameters. | 22 | /// This is the object parameters. |
23 | - final params = new Map<String, PdfStream>(); | 23 | + final params = Map<String, PdfStream>(); |
24 | 24 | ||
25 | /// This is the unique serial number for this object. | 25 | /// This is the unique serial number for this object. |
26 | final int objser; | 26 | final int objser; |
@@ -20,7 +20,7 @@ part of pdf; | @@ -20,7 +20,7 @@ part of pdf; | ||
20 | 20 | ||
21 | class PdfObjectStream extends PdfObject { | 21 | class PdfObjectStream extends PdfObject { |
22 | /// This holds the stream's content. | 22 | /// This holds the stream's content. |
23 | - final PdfStream buf = new PdfStream(); | 23 | + final PdfStream buf = PdfStream(); |
24 | 24 | ||
25 | /// defines if the stream needs to be converted to ascii85 | 25 | /// defines if the stream needs to be converted to ascii85 |
26 | final bool isBinary; | 26 | final bool isBinary; |
@@ -46,7 +46,7 @@ class PdfObjectStream extends PdfObject { | @@ -46,7 +46,7 @@ class PdfObjectStream extends PdfObject { | ||
46 | params["/Filter"] = PdfStream.string("/FlateDecode"); | 46 | params["/Filter"] = PdfStream.string("/FlateDecode"); |
47 | } else if (isBinary) { | 47 | } else if (isBinary) { |
48 | // This is a Ascii85 stream | 48 | // This is a Ascii85 stream |
49 | - var e = new Ascii85Encoder(); | 49 | + var e = Ascii85Encoder(); |
50 | _data = e.convert(buf.output()); | 50 | _data = e.convert(buf.output()); |
51 | params["/Filter"] = PdfStream.string("/ASCII85Decode"); | 51 | params["/Filter"] = PdfStream.string("/ASCII85Decode"); |
52 | } else { | 52 | } else { |
@@ -74,7 +74,7 @@ class PdfOutline extends PdfObject { | @@ -74,7 +74,7 @@ class PdfOutline extends PdfObject { | ||
74 | /// @return [PdfOutline] object created, for creating sub-outlines | 74 | /// @return [PdfOutline] object created, for creating sub-outlines |
75 | PdfOutline add({String title, PdfPage dest, PdfRect rect}) { | 75 | PdfOutline add({String title, PdfPage dest, PdfRect rect}) { |
76 | PdfOutline outline = | 76 | PdfOutline outline = |
77 | - new PdfOutline(pdfDocument, title: title, dest: dest, rect: rect); | 77 | + PdfOutline(pdfDocument, title: title, dest: dest, rect: rect); |
78 | // Tell the outline of ourselves | 78 | // Tell the outline of ourselves |
79 | outline.parent = this; | 79 | outline.parent = this; |
80 | return outline; | 80 | return outline; |
@@ -88,7 +88,7 @@ class PdfOutline extends PdfObject { | @@ -88,7 +88,7 @@ class PdfOutline extends PdfObject { | ||
88 | // These are for kids only | 88 | // These are for kids only |
89 | if (parent != null) { | 89 | if (parent != null) { |
90 | params["/Title"] = PdfStream.string(title); | 90 | params["/Title"] = PdfStream.string(title); |
91 | - var dests = new List<PdfStream>(); | 91 | + var dests = List<PdfStream>(); |
92 | dests.add(dest.ref()); | 92 | dests.add(dest.ref()); |
93 | 93 | ||
94 | if (destMode == PdfOutlineMode.fitpage) { | 94 | if (destMode == PdfOutlineMode.fitpage) { |
@@ -48,7 +48,7 @@ class PdfOutput { | @@ -48,7 +48,7 @@ class PdfOutput { | ||
48 | if (ob is PdfCatalog) rootID = ob; | 48 | if (ob is PdfCatalog) rootID = ob; |
49 | if (ob is PdfInfo) infoID = ob; | 49 | if (ob is PdfInfo) infoID = ob; |
50 | 50 | ||
51 | - offsets.add(new PdfXref(ob.objser, os.offset)); | 51 | + offsets.add(PdfXref(ob.objser, os.offset)); |
52 | ob.write(os); | 52 | ob.write(os); |
53 | } | 53 | } |
54 | 54 | ||
@@ -72,7 +72,7 @@ class PdfOutput { | @@ -72,7 +72,7 @@ class PdfOutput { | ||
72 | var block = []; // xrefs in this block | 72 | var block = []; // xrefs in this block |
73 | 73 | ||
74 | // We need block 0 to exist | 74 | // We need block 0 to exist |
75 | - block.add(new PdfXref(0, 0, generation: 65535)); | 75 | + block.add(PdfXref(0, 0, generation: 65535)); |
76 | 76 | ||
77 | for (PdfXref x in offsets) { | 77 | for (PdfXref x in offsets) { |
78 | if (firstid == -1) firstid = x.id; | 78 | if (firstid == -1) firstid = x.id; |
@@ -107,7 +107,7 @@ class PdfOutput { | @@ -107,7 +107,7 @@ class PdfOutput { | ||
107 | os.putStream(rootID.ref()); | 107 | os.putStream(rootID.ref()); |
108 | os.putString("\n"); | 108 | os.putString("\n"); |
109 | } else | 109 | } else |
110 | - throw new Exception("Root object is not present in document"); | 110 | + throw Exception("Root object is not present in document"); |
111 | 111 | ||
112 | // the /Info reference (OPTIONAL) | 112 | // the /Info reference (OPTIONAL) |
113 | if (infoID != null) { | 113 | if (infoID != null) { |
@@ -33,10 +33,10 @@ class PdfPage extends PdfObject { | @@ -33,10 +33,10 @@ class PdfPage extends PdfObject { | ||
33 | List<PdfAnnot> annotations = []; | 33 | List<PdfAnnot> annotations = []; |
34 | 34 | ||
35 | /// The fonts associated with this page | 35 | /// The fonts associated with this page |
36 | - final fonts = new Map<String, PdfFont>(); | 36 | + final fonts = Map<String, PdfFont>(); |
37 | 37 | ||
38 | /// The xobjects or other images in the pdf | 38 | /// The xobjects or other images in the pdf |
39 | - final xObjects = new Map<String, PdfXObject>(); | 39 | + final xObjects = Map<String, PdfXObject>(); |
40 | 40 | ||
41 | /// This constructs a Page object, which will hold any contents for this | 41 | /// This constructs a Page object, which will hold any contents for this |
42 | /// page. | 42 | /// page. |
@@ -58,8 +58,8 @@ class PdfPage extends PdfObject { | @@ -58,8 +58,8 @@ class PdfPage extends PdfObject { | ||
58 | /// | 58 | /// |
59 | /// @return a new [PdfGraphics] object to be used to draw this page. | 59 | /// @return a new [PdfGraphics] object to be used to draw this page. |
60 | PdfGraphics getGraphics() { | 60 | PdfGraphics getGraphics() { |
61 | - var stream = new PdfObjectStream(pdfDocument); | ||
62 | - var g = new PdfGraphics(this, stream.buf); | 61 | + var stream = PdfObjectStream(pdfDocument); |
62 | + var g = PdfGraphics(this, stream.buf); | ||
63 | contents.add(stream); | 63 | contents.add(stream); |
64 | return g; | 64 | return g; |
65 | } | 65 | } |
@@ -83,7 +83,7 @@ class PdfPage extends PdfObject { | @@ -83,7 +83,7 @@ class PdfPage extends PdfObject { | ||
83 | params["/Parent"] = pdfDocument.pdfPageList.ref(); | 83 | params["/Parent"] = pdfDocument.pdfPageList.ref(); |
84 | 84 | ||
85 | // the /MediaBox for the page size | 85 | // the /MediaBox for the page size |
86 | - params["/MediaBox"] = new PdfStream() | 86 | + params["/MediaBox"] = PdfStream() |
87 | ..putStringArray([0, 0, pageFormat.width, pageFormat.height]); | 87 | ..putStringArray([0, 0, pageFormat.width, pageFormat.height]); |
88 | 88 | ||
89 | // Rotation (if not zero) | 89 | // Rotation (if not zero) |
@@ -98,22 +98,22 @@ class PdfPage extends PdfObject { | @@ -98,22 +98,22 @@ class PdfPage extends PdfObject { | ||
98 | if (contents.length == 1) { | 98 | if (contents.length == 1) { |
99 | params["/Contents"] = contents[0].ref(); | 99 | params["/Contents"] = contents[0].ref(); |
100 | } else { | 100 | } else { |
101 | - params["/Contents"] = new PdfStream()..putObjectArray(contents); | 101 | + params["/Contents"] = PdfStream()..putObjectArray(contents); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | // Now the resources | 105 | // Now the resources |
106 | /// This holds any resources for this page | 106 | /// This holds any resources for this page |
107 | - final resources = new Map<String, PdfStream>(); | 107 | + final resources = Map<String, PdfStream>(); |
108 | 108 | ||
109 | // fonts | 109 | // fonts |
110 | if (fonts.length > 0) { | 110 | if (fonts.length > 0) { |
111 | - resources["/Font"] = new PdfStream()..putObjectDictionary(fonts); | 111 | + resources["/Font"] = PdfStream()..putObjectDictionary(fonts); |
112 | } | 112 | } |
113 | 113 | ||
114 | // Now the XObjects | 114 | // Now the XObjects |
115 | if (xObjects.length > 0) { | 115 | if (xObjects.length > 0) { |
116 | - resources["/XObject"] = new PdfStream()..putObjectDictionary(xObjects); | 116 | + resources["/XObject"] = PdfStream()..putObjectDictionary(xObjects); |
117 | } | 117 | } |
118 | 118 | ||
119 | params["/Resources"] = PdfStream.dictionary(resources); | 119 | params["/Resources"] = PdfStream.dictionary(resources); |
@@ -125,7 +125,7 @@ class PdfPage extends PdfObject { | @@ -125,7 +125,7 @@ class PdfPage extends PdfObject { | ||
125 | 125 | ||
126 | // The /Annots object | 126 | // The /Annots object |
127 | if (annotations.length > 0) { | 127 | if (annotations.length > 0) { |
128 | - params["/Annots"] = new PdfStream()..putObjectArray(annotations); | 128 | + params["/Annots"] = PdfStream()..putObjectArray(annotations); |
129 | } | 129 | } |
130 | } | 130 | } |
131 | } | 131 | } |
@@ -35,7 +35,7 @@ class PdfPageFormat { | @@ -35,7 +35,7 @@ class PdfPageFormat { | ||
35 | 35 | ||
36 | const PdfPageFormat(this.width, this.height); | 36 | const PdfPageFormat(this.width, this.height); |
37 | 37 | ||
38 | - PdfPoint get dimension => new PdfPoint(width, height); | 38 | + PdfPoint get dimension => PdfPoint(width, height); |
39 | 39 | ||
40 | PdfPageFormat get landscape => | 40 | PdfPageFormat get landscape => |
41 | width >= height ? this : PdfPageFormat(height, width); | 41 | width >= height ? this : PdfPageFormat(height, width); |
@@ -34,7 +34,7 @@ class PdfPageList extends PdfObject { | @@ -34,7 +34,7 @@ class PdfPageList extends PdfObject { | ||
34 | void prepare() { | 34 | void prepare() { |
35 | super.prepare(); | 35 | super.prepare(); |
36 | 36 | ||
37 | - params["/Kids"] = new PdfStream()..putObjectArray(pages); | 37 | + params["/Kids"] = PdfStream()..putObjectArray(pages); |
38 | params["/Count"] = PdfStream.intNum(pages.length); | 38 | params["/Count"] = PdfStream.intNum(pages.length); |
39 | } | 39 | } |
40 | } | 40 | } |
@@ -35,7 +35,7 @@ class PdfStream { | @@ -35,7 +35,7 @@ class PdfStream { | ||
35 | } | 35 | } |
36 | } | 36 | } |
37 | 37 | ||
38 | - static PdfStream string(String s) => new PdfStream()..putString(s); | 38 | + static PdfStream string(String s) => PdfStream()..putString(s); |
39 | 39 | ||
40 | void putStringUtf16(String s) { | 40 | void putStringUtf16(String s) { |
41 | for (int codeUnit in s.codeUnits) { | 41 | for (int codeUnit in s.codeUnits) { |
@@ -52,8 +52,8 @@ class PdfStream { | @@ -52,8 +52,8 @@ class PdfStream { | ||
52 | putString(d.toString()); | 52 | putString(d.toString()); |
53 | } | 53 | } |
54 | 54 | ||
55 | - static PdfStream num(double d) => new PdfStream()..putNum(d); | ||
56 | - static PdfStream intNum(int i) => new PdfStream()..putString(i.toString()); | 55 | + static PdfStream num(double d) => PdfStream()..putNum(d); |
56 | + static PdfStream intNum(int i) => PdfStream()..putString(i.toString()); | ||
57 | 57 | ||
58 | void putText(String s) { | 58 | void putText(String s) { |
59 | // Escape special characters | 59 | // Escape special characters |
@@ -79,7 +79,7 @@ class PdfStream { | @@ -79,7 +79,7 @@ class PdfStream { | ||
79 | putBytes(latin1.encode('(' + s + ')')); | 79 | putBytes(latin1.encode('(' + s + ')')); |
80 | } | 80 | } |
81 | 81 | ||
82 | - static PdfStream text(String s) => new PdfStream()..putText(s); | 82 | + static PdfStream text(String s) => PdfStream()..putText(s); |
83 | 83 | ||
84 | void putBool(bool value) { | 84 | void putBool(bool value) { |
85 | putString(value ? "true" : "false"); | 85 | putString(value ? "true" : "false"); |
@@ -108,7 +108,7 @@ class PdfStream { | @@ -108,7 +108,7 @@ class PdfStream { | ||
108 | } | 108 | } |
109 | 109 | ||
110 | static PdfStream array(List<PdfStream> values) => | 110 | static PdfStream array(List<PdfStream> values) => |
111 | - new PdfStream()..putArray(values); | 111 | + PdfStream()..putArray(values); |
112 | 112 | ||
113 | void putDictionary(Map<String, PdfStream> values) { | 113 | void putDictionary(Map<String, PdfStream> values) { |
114 | putString("<< "); | 114 | putString("<< "); |
@@ -121,7 +121,7 @@ class PdfStream { | @@ -121,7 +121,7 @@ class PdfStream { | ||
121 | } | 121 | } |
122 | 122 | ||
123 | static PdfStream dictionary(Map<String, PdfStream> values) => | 123 | static PdfStream dictionary(Map<String, PdfStream> values) => |
124 | - new PdfStream()..putDictionary(values); | 124 | + PdfStream()..putDictionary(values); |
125 | 125 | ||
126 | void putObjectDictionary(Map<String, PdfObject> values) { | 126 | void putObjectDictionary(Map<String, PdfObject> values) { |
127 | putString("<< "); | 127 | putString("<< "); |
@@ -29,12 +29,12 @@ class TtfParser { | @@ -29,12 +29,12 @@ class TtfParser { | ||
29 | static const _GLYF = "glyf"; | 29 | static const _GLYF = "glyf"; |
30 | 30 | ||
31 | final ByteData bytes; | 31 | final ByteData bytes; |
32 | - final _tableOffsets = new Map<String, int>(); | 32 | + final _tableOffsets = Map<String, int>(); |
33 | String _fontName; | 33 | String _fontName; |
34 | - final advanceWidth = new List<double>(); | ||
35 | - final charToGlyphIndexMap = new Map<int, int>(); | ||
36 | - final glyphOffsets = new List<int>(); | ||
37 | - final glyphInfoMap = new Map<int, PdfRect>(); | 34 | + final advanceWidth = List<double>(); |
35 | + final charToGlyphIndexMap = Map<int, int>(); | ||
36 | + final glyphOffsets = List<int>(); | ||
37 | + final glyphInfoMap = Map<int, PdfRect>(); | ||
38 | 38 | ||
39 | TtfParser(this.bytes) { | 39 | TtfParser(this.bytes) { |
40 | final numTables = bytes.getUint16(4); | 40 | final numTables = bytes.getUint16(4); |
@@ -138,20 +138,20 @@ class TtfParser { | @@ -138,20 +138,20 @@ class TtfParser { | ||
138 | 138 | ||
139 | void _parseCMapFormat4(int basePosition, int length) { | 139 | void _parseCMapFormat4(int basePosition, int length) { |
140 | final segCount = bytes.getUint16(basePosition + 2) ~/ 2; | 140 | final segCount = bytes.getUint16(basePosition + 2) ~/ 2; |
141 | - final endCodes = new List<int>(); | 141 | + final endCodes = List<int>(); |
142 | for (var i = 0; i < segCount; i++) { | 142 | for (var i = 0; i < segCount; i++) { |
143 | endCodes.add(bytes.getUint16(basePosition + i * 2 + 10)); | 143 | endCodes.add(bytes.getUint16(basePosition + i * 2 + 10)); |
144 | } | 144 | } |
145 | - final startCodes = new List<int>(); | 145 | + final startCodes = List<int>(); |
146 | for (var i = 0; i < segCount; i++) { | 146 | for (var i = 0; i < segCount; i++) { |
147 | startCodes.add(bytes.getUint16(basePosition + (segCount + i) * 2 + 12)); | 147 | startCodes.add(bytes.getUint16(basePosition + (segCount + i) * 2 + 12)); |
148 | } | 148 | } |
149 | - final idDeltas = new List<int>(); | 149 | + final idDeltas = List<int>(); |
150 | for (var i = 0; i < segCount; i++) { | 150 | for (var i = 0; i < segCount; i++) { |
151 | idDeltas.add(bytes.getUint16(basePosition + (segCount * 2 + i) * 2 + 12)); | 151 | idDeltas.add(bytes.getUint16(basePosition + (segCount * 2 + i) * 2 + 12)); |
152 | } | 152 | } |
153 | final idRangeOffsetBasePos = basePosition + segCount * 6 + 12; | 153 | final idRangeOffsetBasePos = basePosition + segCount * 6 + 12; |
154 | - final idRangeOffsets = new List<int>(); | 154 | + final idRangeOffsets = List<int>(); |
155 | for (var i = 0; i < segCount; i++) { | 155 | for (var i = 0; i < segCount; i++) { |
156 | idRangeOffsets.add(bytes.getUint16(idRangeOffsetBasePos + i * 2)); | 156 | idRangeOffsets.add(bytes.getUint16(idRangeOffsetBasePos + i * 2)); |
157 | } | 157 | } |
@@ -210,7 +210,7 @@ class TtfParser { | @@ -210,7 +210,7 @@ class TtfParser { | ||
210 | final yMin = bytes.getInt16(baseOffset + offset + 4); // 4 | 210 | final yMin = bytes.getInt16(baseOffset + offset + 4); // 4 |
211 | final xMax = bytes.getInt16(baseOffset + offset + 6); // 6 | 211 | final xMax = bytes.getInt16(baseOffset + offset + 6); // 6 |
212 | final yMax = bytes.getInt16(baseOffset + offset + 8); // 8 | 212 | final yMax = bytes.getInt16(baseOffset + offset + 8); // 8 |
213 | - glyphInfoMap[glyphIndex] = new PdfRect( | 213 | + glyphInfoMap[glyphIndex] = PdfRect( |
214 | xMin.toDouble() / unitsPerEm, | 214 | xMin.toDouble() / unitsPerEm, |
215 | yMin.toDouble() / unitsPerEm, | 215 | yMin.toDouble() / unitsPerEm, |
216 | xMax.toDouble() / unitsPerEm, | 216 | xMax.toDouble() / unitsPerEm, |
@@ -22,18 +22,18 @@ class PdfTtfFont extends PdfFont { | @@ -22,18 +22,18 @@ class PdfTtfFont extends PdfFont { | ||
22 | PdfObject unicodeCMap; | 22 | PdfObject unicodeCMap; |
23 | PdfFontDescriptor descriptor; | 23 | PdfFontDescriptor descriptor; |
24 | PdfArrayObject widthsObject; | 24 | PdfArrayObject widthsObject; |
25 | - final widths = new List<String>(); | 25 | + final widths = List<String>(); |
26 | final TtfParser font; | 26 | final TtfParser font; |
27 | int _charMin; | 27 | int _charMin; |
28 | int _charMax; | 28 | int _charMax; |
29 | 29 | ||
30 | /// Constructs a [PdfTtfFont] | 30 | /// Constructs a [PdfTtfFont] |
31 | PdfTtfFont(PdfDocument pdfDocument, ByteData bytes) | 31 | PdfTtfFont(PdfDocument pdfDocument, ByteData bytes) |
32 | - : font = new TtfParser(bytes), | 32 | + : font = TtfParser(bytes), |
33 | super(pdfDocument, subtype: "/TrueType") { | 33 | super(pdfDocument, subtype: "/TrueType") { |
34 | baseFont = "/" + font.fontName.replaceAll(" ", ""); | 34 | baseFont = "/" + font.fontName.replaceAll(" ", ""); |
35 | 35 | ||
36 | - PdfObjectStream file = new PdfObjectStream(pdfDocument, isBinary: true); | 36 | + PdfObjectStream file = PdfObjectStream(pdfDocument, isBinary: true); |
37 | final data = bytes.buffer.asUint8List(); | 37 | final data = bytes.buffer.asUint8List(); |
38 | file.buf.putBytes(data); | 38 | file.buf.putBytes(data); |
39 | file.params["/Length1"] = PdfStream.intNum(data.length); | 39 | file.params["/Length1"] = PdfStream.intNum(data.length); |
@@ -45,9 +45,9 @@ class PdfTtfFont extends PdfFont { | @@ -45,9 +45,9 @@ class PdfTtfFont extends PdfFont { | ||
45 | widths.add((glyphAdvance(i) * 1000.0).toString()); | 45 | widths.add((glyphAdvance(i) * 1000.0).toString()); |
46 | } | 46 | } |
47 | 47 | ||
48 | - unicodeCMap = new PdfObject(pdfDocument); | ||
49 | - descriptor = new PdfFontDescriptor(this, file); | ||
50 | - widthsObject = new PdfArrayObject(pdfDocument, widths); | 48 | + unicodeCMap = PdfObject(pdfDocument); |
49 | + descriptor = PdfFontDescriptor(this, file); | ||
50 | + widthsObject = PdfArrayObject(pdfDocument, widths); | ||
51 | } | 51 | } |
52 | 52 | ||
53 | @override | 53 | @override |
@@ -8,53 +8,53 @@ import 'package:vector_math/vector_math_64.dart'; | @@ -8,53 +8,53 @@ import 'package:vector_math/vector_math_64.dart'; | ||
8 | 8 | ||
9 | void main() { | 9 | void main() { |
10 | test('Pdf', () { | 10 | test('Pdf', () { |
11 | - var img = new Uint32List(10 * 10); | 11 | + var img = Uint32List(10 * 10); |
12 | img.fillRange(0, img.length - 1, 0x12345678); | 12 | img.fillRange(0, img.length - 1, 0x12345678); |
13 | 13 | ||
14 | - var pdf = new PdfDocument(deflate: zlib.encode); | 14 | + var pdf = PdfDocument(deflate: zlib.encode); |
15 | var i = pdf.info; | 15 | var i = pdf.info; |
16 | i.author = "David PHAM-VAN"; | 16 | i.author = "David PHAM-VAN"; |
17 | i.creator = i.author; | 17 | i.creator = i.author; |
18 | i.title = "My Title"; | 18 | i.title = "My Title"; |
19 | i.subject = "My Subject"; | 19 | i.subject = "My Subject"; |
20 | - var page = new PdfPage(pdf, pageFormat: const PdfPageFormat(500.0, 300.0)); | 20 | + var page = PdfPage(pdf, pageFormat: const PdfPageFormat(500.0, 300.0)); |
21 | 21 | ||
22 | var g = page.getGraphics(); | 22 | var g = page.getGraphics(); |
23 | g.saveContext(); | 23 | g.saveContext(); |
24 | - var tm = new Matrix4.identity(); | 24 | + var tm = Matrix4.identity(); |
25 | tm.translate(100.0, 700.0); | 25 | tm.translate(100.0, 700.0); |
26 | g.setTransform(tm); | 26 | g.setTransform(tm); |
27 | // g.drawShape("M37 0H9C6.24 0 4 2.24 4 5v38c0 2.76 2.24 5 5 5h28c2.76 0 5-2.24 5-5V5c0-2.76-2.24-5-5-5zM23 46c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm15-8H8V6h30v32z"); | 27 | // g.drawShape("M37 0H9C6.24 0 4 2.24 4 5v38c0 2.76 2.24 5 5 5h28c2.76 0 5-2.24 5-5V5c0-2.76-2.24-5-5-5zM23 46c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm15-8H8V6h30v32z"); |
28 | g.restoreContext(); | 28 | g.restoreContext(); |
29 | - var font1 = new PdfFont(pdf); | 29 | + var font1 = PdfFont(pdf); |
30 | 30 | ||
31 | - var font2 = new PdfTtfFont( | 31 | + var font2 = PdfTtfFont( |
32 | pdf, | 32 | pdf, |
33 | - (new File("open-sans.ttf").readAsBytesSync() as Uint8List) | 33 | + (File("open-sans.ttf").readAsBytesSync() as Uint8List) |
34 | .buffer | 34 | .buffer |
35 | .asByteData()); | 35 | .asByteData()); |
36 | var s = "Hello World!"; | 36 | var s = "Hello World!"; |
37 | var r = font2.stringBounds(s); | 37 | var r = font2.stringBounds(s); |
38 | const FS = 20.0; | 38 | const FS = 20.0; |
39 | - g.setColor(new PdfColor(0.0, 1.0, 1.0)); | 39 | + g.setColor(PdfColor(0.0, 1.0, 1.0)); |
40 | g.drawRect(50.0 + r.x * FS, 30.0 + r.y * FS, r.w * FS, r.h * FS); | 40 | g.drawRect(50.0 + r.x * FS, 30.0 + r.y * FS, r.w * FS, r.h * FS); |
41 | g.fillPath(); | 41 | g.fillPath(); |
42 | - g.setColor(new PdfColor(0.3, 0.3, 0.3)); | 42 | + g.setColor(PdfColor(0.3, 0.3, 0.3)); |
43 | g.drawString(font2, FS, s, 50.0, 30.0); | 43 | g.drawString(font2, FS, s, 50.0, 30.0); |
44 | 44 | ||
45 | - g.setColor(new PdfColor(1.0, 0.0, 0.0)); | 45 | + g.setColor(PdfColor(1.0, 0.0, 0.0)); |
46 | g.drawString(font2, 20.0, "Hé (Olà)", 50.0, 10.0); | 46 | g.drawString(font2, 20.0, "Hé (Olà)", 50.0, 10.0); |
47 | g.drawLine(30.0, 30.0, 200.0, 200.0); | 47 | g.drawLine(30.0, 30.0, 200.0, 200.0); |
48 | g.strokePath(); | 48 | g.strokePath(); |
49 | - g.setColor(new PdfColor(1.0, 0.0, 0.0)); | 49 | + g.setColor(PdfColor(1.0, 0.0, 0.0)); |
50 | g.drawRect(300.0, 150.0, 50.0, 50.0); | 50 | g.drawRect(300.0, 150.0, 50.0, 50.0); |
51 | g.fillPath(); | 51 | g.fillPath(); |
52 | - g.setColor(new PdfColor(0.0, 0.5, 0.0)); | ||
53 | - var image = new PdfImage(pdf, | ||
54 | - image: img.buffer.asUint8List(), width: 10, height: 10); | 52 | + g.setColor(PdfColor(0.0, 0.5, 0.0)); |
53 | + var image = | ||
54 | + PdfImage(pdf, image: img.buffer.asUint8List(), width: 10, height: 10); | ||
55 | for (var i = 10.0; i < 90.0; i += 5.0) { | 55 | for (var i = 10.0; i < 90.0; i += 5.0) { |
56 | g.saveContext(); | 56 | g.saveContext(); |
57 | - var tm = new Matrix4.identity(); | 57 | + var tm = Matrix4.identity(); |
58 | tm.rotateZ(i * pi / 360.0); | 58 | tm.rotateZ(i * pi / 360.0); |
59 | tm.translate(300.0, -100.0); | 59 | tm.translate(300.0, -100.0); |
60 | g.setTransform(tm); | 60 | g.setTransform(tm); |
@@ -63,7 +63,7 @@ void main() { | @@ -63,7 +63,7 @@ void main() { | ||
63 | g.restoreContext(); | 63 | g.restoreContext(); |
64 | } | 64 | } |
65 | 65 | ||
66 | - var file = new File('file.pdf'); | 66 | + var file = File('file.pdf'); |
67 | file.writeAsBytesSync(pdf.save()); | 67 | file.writeAsBytesSync(pdf.save()); |
68 | }); | 68 | }); |
69 | } | 69 | } |
@@ -5,14 +5,14 @@ import "package:test/test.dart"; | @@ -5,14 +5,14 @@ import "package:test/test.dart"; | ||
5 | 5 | ||
6 | void main() { | 6 | void main() { |
7 | test('Pdf1', () { | 7 | test('Pdf1', () { |
8 | - var pdf = new PdfDocument(); | ||
9 | - var page = new PdfPage(pdf, pageFormat: PdfPageFormat.a4); | 8 | + var pdf = PdfDocument(); |
9 | + var page = 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); |
13 | g.strokePath(); | 13 | g.strokePath(); |
14 | 14 | ||
15 | - var file = new File('file1.pdf'); | 15 | + var file = File('file1.pdf'); |
16 | file.writeAsBytesSync(pdf.save()); | 16 | file.writeAsBytesSync(pdf.save()); |
17 | }); | 17 | }); |
18 | } | 18 | } |
@@ -6,43 +6,43 @@ import 'package:test/test.dart'; | @@ -6,43 +6,43 @@ import 'package:test/test.dart'; | ||
6 | 6 | ||
7 | void main() { | 7 | void main() { |
8 | test('Pdf', () { | 8 | test('Pdf', () { |
9 | - var pdf = new PdfDocument(); | 9 | + var pdf = PdfDocument(); |
10 | var i = pdf.info; | 10 | var i = pdf.info; |
11 | i.author = "David PHAM-VAN"; | 11 | i.author = "David PHAM-VAN"; |
12 | i.creator = i.author; | 12 | i.creator = i.author; |
13 | i.title = "My Title"; | 13 | i.title = "My Title"; |
14 | i.subject = "My Subject"; | 14 | i.subject = "My Subject"; |
15 | - var page = new PdfPage(pdf, pageFormat: const PdfPageFormat(500.0, 300.0)); | 15 | + var page = PdfPage(pdf, pageFormat: const PdfPageFormat(500.0, 300.0)); |
16 | 16 | ||
17 | var g = page.getGraphics(); | 17 | var g = page.getGraphics(); |
18 | - var ttf = new PdfTtfFont( | 18 | + var ttf = PdfTtfFont( |
19 | pdf, | 19 | pdf, |
20 | - (new File("open-sans.ttf").readAsBytesSync() as Uint8List) | 20 | + (File("open-sans.ttf").readAsBytesSync() as Uint8List) |
21 | .buffer | 21 | .buffer |
22 | .asByteData()); | 22 | .asByteData()); |
23 | var s = "Hello World!"; | 23 | var s = "Hello World!"; |
24 | var r = ttf.stringBounds(s); | 24 | var r = ttf.stringBounds(s); |
25 | const FS = 20.0; | 25 | const FS = 20.0; |
26 | - g.setColor(new PdfColor(0.0, 1.0, 1.0)); | 26 | + g.setColor(PdfColor(0.0, 1.0, 1.0)); |
27 | g.drawRect(50.0 + r.x * FS, 30.0 + r.y * FS, r.w * FS, r.h * FS); | 27 | g.drawRect(50.0 + r.x * FS, 30.0 + r.y * FS, r.w * FS, r.h * FS); |
28 | g.fillPath(); | 28 | g.fillPath(); |
29 | - g.setColor(new PdfColor(0.3, 0.3, 0.3)); | 29 | + g.setColor(PdfColor(0.3, 0.3, 0.3)); |
30 | g.drawString(ttf, FS, s, 50.0, 30.0); | 30 | g.drawString(ttf, FS, s, 50.0, 30.0); |
31 | 31 | ||
32 | - var roboto = new PdfTtfFont( | 32 | + var roboto = PdfTtfFont( |
33 | pdf, | 33 | pdf, |
34 | - (new File("roboto.ttf").readAsBytesSync() as Uint8List) | 34 | + (File("roboto.ttf").readAsBytesSync() as Uint8List) |
35 | .buffer | 35 | .buffer |
36 | .asByteData()); | 36 | .asByteData()); |
37 | 37 | ||
38 | r = roboto.stringBounds(s); | 38 | r = roboto.stringBounds(s); |
39 | - g.setColor(new PdfColor(0.0, 1.0, 1.0)); | 39 | + g.setColor(PdfColor(0.0, 1.0, 1.0)); |
40 | g.drawRect(50.0 + r.x * FS, 130.0 + r.y * FS, r.w * FS, r.h * FS); | 40 | g.drawRect(50.0 + r.x * FS, 130.0 + r.y * FS, r.w * FS, r.h * FS); |
41 | g.fillPath(); | 41 | g.fillPath(); |
42 | - g.setColor(new PdfColor(0.3, 0.3, 0.3)); | 42 | + g.setColor(PdfColor(0.3, 0.3, 0.3)); |
43 | g.drawString(roboto, FS, s, 50.0, 130.0); | 43 | g.drawString(roboto, FS, s, 50.0, 130.0); |
44 | 44 | ||
45 | - var file = new File('file2.pdf'); | 45 | + var file = File('file2.pdf'); |
46 | file.writeAsBytesSync(pdf.save()); | 46 | file.writeAsBytesSync(pdf.save()); |
47 | }); | 47 | }); |
48 | } | 48 | } |
@@ -28,7 +28,7 @@ To use a TrueType font from a flutter bundle: | @@ -28,7 +28,7 @@ To use a TrueType font from a flutter bundle: | ||
28 | 28 | ||
29 | ```dart | 29 | ```dart |
30 | var font = await rootBundle.load("assets/open-sans.ttf"); | 30 | var font = await rootBundle.load("assets/open-sans.ttf"); |
31 | -PdfTtfFont ttf = new PdfTtfFont(pdf, font); | ||
32 | -g.setColor(new PdfColor(0.3, 0.3, 0.3)); | 31 | +PdfTtfFont ttf = PdfTtfFont(pdf, font); |
32 | +g.setColor(PdfColor(0.3, 0.3, 0.3)); | ||
33 | g.drawString(ttf, 20.0, "Dart is awesome", 50.0, 30.0); | 33 | g.drawString(ttf, 20.0, "Dart is awesome", 50.0, 30.0); |
34 | ``` | 34 | ``` |
@@ -6,32 +6,32 @@ import 'package:flutter/rendering.dart'; | @@ -6,32 +6,32 @@ import 'package:flutter/rendering.dart'; | ||
6 | import 'package:pdf/pdf.dart'; | 6 | import 'package:pdf/pdf.dart'; |
7 | import 'package:printing/printing.dart'; | 7 | import 'package:printing/printing.dart'; |
8 | 8 | ||
9 | -void main() => runApp(new MaterialApp(home: new MyApp())); | 9 | +void main() => runApp(MaterialApp(home: MyApp())); |
10 | 10 | ||
11 | class MyApp extends StatefulWidget { | 11 | class MyApp extends StatefulWidget { |
12 | @override | 12 | @override |
13 | MyAppState createState() { | 13 | MyAppState createState() { |
14 | - return new MyAppState(); | 14 | + return MyAppState(); |
15 | } | 15 | } |
16 | } | 16 | } |
17 | 17 | ||
18 | class MyAppState extends State<MyApp> { | 18 | class MyAppState extends State<MyApp> { |
19 | - final shareWidget = new GlobalKey(); | ||
20 | - final previewContainer = new GlobalKey(); | 19 | + final shareWidget = GlobalKey(); |
20 | + final previewContainer = GlobalKey(); | ||
21 | 21 | ||
22 | PdfDocument _generateDocument() { | 22 | PdfDocument _generateDocument() { |
23 | - final pdf = new PdfDocument(deflate: zlib.encode); | ||
24 | - final page = new PdfPage(pdf, pageFormat: PdfPageFormat.a4); | 23 | + final pdf = PdfDocument(deflate: zlib.encode); |
24 | + final page = PdfPage(pdf, pageFormat: PdfPageFormat.a4); | ||
25 | final g = page.getGraphics(); | 25 | final g = page.getGraphics(); |
26 | - final font = new PdfFont(pdf); | 26 | + final font = PdfFont(pdf); |
27 | final top = page.pageFormat.height; | 27 | final top = page.pageFormat.height; |
28 | 28 | ||
29 | - g.setColor(new PdfColor(0.0, 1.0, 1.0)); | 29 | + g.setColor(PdfColor(0.0, 1.0, 1.0)); |
30 | g.drawRect(50.0 * PdfPageFormat.mm, top - 80.0 * PdfPageFormat.mm, | 30 | g.drawRect(50.0 * PdfPageFormat.mm, top - 80.0 * PdfPageFormat.mm, |
31 | 100.0 * PdfPageFormat.mm, 50.0 * PdfPageFormat.mm); | 31 | 100.0 * PdfPageFormat.mm, 50.0 * PdfPageFormat.mm); |
32 | g.fillPath(); | 32 | g.fillPath(); |
33 | 33 | ||
34 | - g.setColor(new PdfColor(0.3, 0.3, 0.3)); | 34 | + g.setColor(PdfColor(0.3, 0.3, 0.3)); |
35 | g.drawString(font, 12.0, "Hello World!", 10.0 * PdfPageFormat.mm, | 35 | g.drawString(font, 12.0, "Hello World!", 10.0 * PdfPageFormat.mm, |
36 | top - 10.0 * PdfPageFormat.mm); | 36 | top - 10.0 * PdfPageFormat.mm); |
37 | 37 | ||
@@ -55,15 +55,15 @@ class MyAppState extends State<MyApp> { | @@ -55,15 +55,15 @@ class MyAppState extends State<MyApp> { | ||
55 | referenceBox.localToGlobal(referenceBox.paintBounds.topLeft); | 55 | referenceBox.localToGlobal(referenceBox.paintBounds.topLeft); |
56 | final bottomRight = | 56 | final bottomRight = |
57 | referenceBox.localToGlobal(referenceBox.paintBounds.bottomRight); | 57 | referenceBox.localToGlobal(referenceBox.paintBounds.bottomRight); |
58 | - final bounds = new Rect.fromPoints(topLeft, bottomRight); | 58 | + final bounds = Rect.fromPoints(topLeft, bottomRight); |
59 | 59 | ||
60 | Printing.sharePdf(document: pdf, bounds: bounds); | 60 | Printing.sharePdf(document: pdf, bounds: bounds); |
61 | } | 61 | } |
62 | 62 | ||
63 | Future<void> _printScreen() async { | 63 | Future<void> _printScreen() async { |
64 | const margin = 10.0 * PdfPageFormat.mm; | 64 | const margin = 10.0 * PdfPageFormat.mm; |
65 | - final pdf = new PdfDocument(deflate: zlib.encode); | ||
66 | - final page = new PdfPage(pdf, pageFormat: PdfPageFormat.a4); | 65 | + final pdf = PdfDocument(deflate: zlib.encode); |
66 | + final page = PdfPage(pdf, pageFormat: PdfPageFormat.a4); | ||
67 | final g = page.getGraphics(); | 67 | final g = page.getGraphics(); |
68 | 68 | ||
69 | RenderRepaintBoundary boundary = | 69 | RenderRepaintBoundary boundary = |
@@ -94,25 +94,24 @@ class MyAppState extends State<MyApp> { | @@ -94,25 +94,24 @@ class MyAppState extends State<MyApp> { | ||
94 | 94 | ||
95 | @override | 95 | @override |
96 | Widget build(BuildContext context) { | 96 | Widget build(BuildContext context) { |
97 | - return new RepaintBoundary( | 97 | + return RepaintBoundary( |
98 | key: previewContainer, | 98 | key: previewContainer, |
99 | - child: new Scaffold( | ||
100 | - appBar: new AppBar( | 99 | + child: Scaffold( |
100 | + appBar: AppBar( | ||
101 | title: const Text('Pdf Printing Example'), | 101 | title: const Text('Pdf Printing Example'), |
102 | ), | 102 | ), |
103 | - body: new Center( | ||
104 | - child: new Column( | 103 | + body: Center( |
104 | + child: Column( | ||
105 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, | 105 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
106 | children: <Widget>[ | 106 | children: <Widget>[ |
107 | - new RaisedButton( | ||
108 | - child: new Text('Print Document'), onPressed: _printPdf), | ||
109 | - new RaisedButton( | 107 | + RaisedButton( |
108 | + child: Text('Print Document'), onPressed: _printPdf), | ||
109 | + RaisedButton( | ||
110 | key: shareWidget, | 110 | key: shareWidget, |
111 | - child: new Text('Share Document'), | 111 | + child: Text('Share Document'), |
112 | onPressed: _sharePdf), | 112 | onPressed: _sharePdf), |
113 | - new RaisedButton( | ||
114 | - child: new Text('Print Screenshot'), | ||
115 | - onPressed: _printScreen), | 113 | + RaisedButton( |
114 | + child: Text('Print Screenshot'), onPressed: _printScreen), | ||
116 | ], | 115 | ], |
117 | ), | 116 | ), |
118 | ), | 117 | ), |
@@ -34,7 +34,7 @@ class Printing { | @@ -34,7 +34,7 @@ class Printing { | ||
34 | if (document != null) bytes = document.save(); | 34 | if (document != null) bytes = document.save(); |
35 | 35 | ||
36 | final Map<String, dynamic> params = <String, dynamic>{ | 36 | final Map<String, dynamic> params = <String, dynamic>{ |
37 | - 'doc': new Uint8List.fromList(bytes), | 37 | + 'doc': Uint8List.fromList(bytes), |
38 | }; | 38 | }; |
39 | 39 | ||
40 | await _channel.invokeMethod('printPdf', params); | 40 | await _channel.invokeMethod('printPdf', params); |
@@ -48,11 +48,11 @@ class Printing { | @@ -48,11 +48,11 @@ class Printing { | ||
48 | if (document != null) bytes = document.save(); | 48 | if (document != null) bytes = document.save(); |
49 | 49 | ||
50 | if (bounds == null) { | 50 | if (bounds == null) { |
51 | - bounds = new Rect.fromCircle(center: Offset.zero, radius: 10.0); | 51 | + bounds = Rect.fromCircle(center: Offset.zero, radius: 10.0); |
52 | } | 52 | } |
53 | 53 | ||
54 | final Map<String, dynamic> params = <String, dynamic>{ | 54 | final Map<String, dynamic> params = <String, dynamic>{ |
55 | - 'doc': new Uint8List.fromList(bytes), | 55 | + 'doc': Uint8List.fromList(bytes), |
56 | 'x': bounds.left, | 56 | 'x': bounds.left, |
57 | 'y': bounds.top, | 57 | 'y': bounds.top, |
58 | 'w': bounds.width, | 58 | 'w': bounds.width, |
-
Please register or login to post a comment