Showing
12 changed files
with
17 additions
and
14 deletions
@@ -5,6 +5,7 @@ | @@ -5,6 +5,7 @@ | ||
5 | - A borderRadius can only be given for a uniform Border | 5 | - A borderRadius can only be given for a uniform Border |
6 | - Add LayoutWidgetBuilder | 6 | - Add LayoutWidgetBuilder |
7 | - Add GridPaper widget | 7 | - Add GridPaper widget |
8 | +- Improve internal sructure | ||
8 | 9 | ||
9 | ## 1.13.0 | 10 | ## 1.13.0 |
10 | 11 |
@@ -33,7 +33,7 @@ import 'stream.dart'; | @@ -33,7 +33,7 @@ import 'stream.dart'; | ||
33 | class PdfAnnot extends PdfObject { | 33 | class PdfAnnot extends PdfObject { |
34 | PdfAnnot(this.pdfPage, this.annot) | 34 | PdfAnnot(this.pdfPage, this.annot) |
35 | : assert(annot != null), | 35 | : assert(annot != null), |
36 | - super(pdfPage.pdfDocument, '/Annot') { | 36 | + super(pdfPage.pdfDocument, type: '/Annot') { |
37 | pdfPage.annotations.add(this); | 37 | pdfPage.annotations.add(this); |
38 | } | 38 | } |
39 | 39 |
@@ -33,7 +33,7 @@ class PdfCatalog extends PdfObject { | @@ -33,7 +33,7 @@ class PdfCatalog extends PdfObject { | ||
33 | ) : assert(pdfPageList != null), | 33 | ) : assert(pdfPageList != null), |
34 | assert(pageMode != null), | 34 | assert(pageMode != null), |
35 | assert(names != null), | 35 | assert(names != null), |
36 | - super(pdfDocument, '/Catalog'); | 36 | + super(pdfDocument, type: '/Catalog'); |
37 | 37 | ||
38 | /// The pages of the document | 38 | /// The pages of the document |
39 | final PdfPageList pdfPageList; | 39 | final PdfPageList pdfPageList; |
@@ -22,7 +22,7 @@ import 'object.dart'; | @@ -22,7 +22,7 @@ import 'object.dart'; | ||
22 | /// Encryption object | 22 | /// Encryption object |
23 | abstract class PdfEncryption extends PdfObject { | 23 | abstract class PdfEncryption extends PdfObject { |
24 | /// Creates an encryption object | 24 | /// Creates an encryption object |
25 | - PdfEncryption(PdfDocument pdfDocument) : super(pdfDocument, null); | 25 | + PdfEncryption(PdfDocument pdfDocument) : super(pdfDocument); |
26 | 26 | ||
27 | /// Encrypt some data | 27 | /// Encrypt some data |
28 | Uint8List encrypt(Uint8List input, PdfObject object); | 28 | Uint8List encrypt(Uint8List input, PdfObject object); |
@@ -34,7 +34,7 @@ abstract class PdfFont extends PdfObject { | @@ -34,7 +34,7 @@ abstract class PdfFont extends PdfObject { | ||
34 | /// font name to that in Pdf, defaulting to Helvetica if not possible. | 34 | /// font name to that in Pdf, defaulting to Helvetica if not possible. |
35 | PdfFont.create(PdfDocument pdfDocument, {@required this.subtype}) | 35 | PdfFont.create(PdfDocument pdfDocument, {@required this.subtype}) |
36 | : assert(subtype != null), | 36 | : assert(subtype != null), |
37 | - super(pdfDocument, '/Font') { | 37 | + super(pdfDocument, type: '/Font') { |
38 | pdfDocument.fonts.add(this); | 38 | pdfDocument.fonts.add(this); |
39 | } | 39 | } |
40 | 40 |
@@ -27,7 +27,7 @@ class PdfFontDescriptor extends PdfObject { | @@ -27,7 +27,7 @@ class PdfFontDescriptor extends PdfObject { | ||
27 | this.file, | 27 | this.file, |
28 | ) : assert(ttfFont != null), | 28 | ) : assert(ttfFont != null), |
29 | assert(file != null), | 29 | assert(file != null), |
30 | - super(ttfFont.pdfDocument, '/FontDescriptor'); | 30 | + super(ttfFont.pdfDocument, type: '/FontDescriptor'); |
31 | 31 | ||
32 | /// File data | 32 | /// File data |
33 | final PdfObjectStream file; | 33 | final PdfObjectStream file; |
@@ -28,7 +28,7 @@ class PdfInfo extends PdfObject { | @@ -28,7 +28,7 @@ class PdfInfo extends PdfObject { | ||
28 | this.subject, | 28 | this.subject, |
29 | this.keywords, | 29 | this.keywords, |
30 | this.producer}) | 30 | this.producer}) |
31 | - : super(pdfDocument, null) { | 31 | + : super(pdfDocument) { |
32 | if (author != null) { | 32 | if (author != null) { |
33 | params['/Author'] = PdfSecString.fromString(this, author); | 33 | params['/Author'] = PdfSecString.fromString(this, author); |
34 | } | 34 | } |
@@ -25,10 +25,12 @@ class PdfObject { | @@ -25,10 +25,12 @@ class PdfObject { | ||
25 | /// This is usually called by extensors to this class, and sets the | 25 | /// This is usually called by extensors to this class, and sets the |
26 | /// Pdf Object Type | 26 | /// Pdf Object Type |
27 | PdfObject( | 27 | PdfObject( |
28 | - this.pdfDocument, [ | 28 | + this.pdfDocument, { |
29 | String type, | 29 | String type, |
30 | - ]) : assert(pdfDocument != null), | ||
31 | - objser = pdfDocument.genSerial() { | 30 | + this.objgen = 0, |
31 | + int objser, | ||
32 | + }) : assert(pdfDocument != null), | ||
33 | + objser = objser ?? pdfDocument.genSerial() { | ||
32 | if (type != null) { | 34 | if (type != null) { |
33 | params['/Type'] = PdfName(type); | 35 | params['/Type'] = PdfName(type); |
34 | } | 36 | } |
@@ -43,7 +45,7 @@ class PdfObject { | @@ -43,7 +45,7 @@ class PdfObject { | ||
43 | final int objser; | 45 | final int objser; |
44 | 46 | ||
45 | /// This is the generation number for this object. | 47 | /// This is the generation number for this object. |
46 | - final int objgen = 0; | 48 | + final int objgen; |
47 | 49 | ||
48 | /// This allows any Pdf object to refer to the document being constructed. | 50 | /// This allows any Pdf object to refer to the document being constructed. |
49 | final PdfDocument pdfDocument; | 51 | final PdfDocument pdfDocument; |
@@ -29,7 +29,7 @@ class PdfObjectStream extends PdfObject { | @@ -29,7 +29,7 @@ class PdfObjectStream extends PdfObject { | ||
29 | PdfDocument pdfDocument, { | 29 | PdfDocument pdfDocument, { |
30 | String type, | 30 | String type, |
31 | this.isBinary = false, | 31 | this.isBinary = false, |
32 | - }) : super(pdfDocument, type); | 32 | + }) : super(pdfDocument, type: type); |
33 | 33 | ||
34 | /// This holds the stream's content. | 34 | /// This holds the stream's content. |
35 | final PdfStream buf = PdfStream(); | 35 | final PdfStream buf = PdfStream(); |
@@ -28,7 +28,7 @@ class PdfPage extends PdfObject with PdfGraphicStream { | @@ -28,7 +28,7 @@ class PdfPage extends PdfObject with PdfGraphicStream { | ||
28 | /// This constructs a Page object, which will hold any contents for this | 28 | /// This constructs a Page object, which will hold any contents for this |
29 | /// page. | 29 | /// page. |
30 | PdfPage(PdfDocument pdfDocument, {this.pageFormat = PdfPageFormat.standard}) | 30 | PdfPage(PdfDocument pdfDocument, {this.pageFormat = PdfPageFormat.standard}) |
31 | - : super(pdfDocument, '/Page') { | 31 | + : super(pdfDocument, type: '/Page') { |
32 | pdfDocument.pdfPageList.pages.add(this); | 32 | pdfDocument.pdfPageList.pages.add(this); |
33 | } | 33 | } |
34 | 34 |
@@ -22,7 +22,7 @@ import 'page.dart'; | @@ -22,7 +22,7 @@ import 'page.dart'; | ||
22 | /// PdfPageList object | 22 | /// PdfPageList object |
23 | class PdfPageList extends PdfObject { | 23 | class PdfPageList extends PdfObject { |
24 | /// This constructs a [PdfPageList] object. | 24 | /// This constructs a [PdfPageList] object. |
25 | - PdfPageList(PdfDocument pdfDocument) : super(pdfDocument, '/Pages'); | 25 | + PdfPageList(PdfDocument pdfDocument) : super(pdfDocument, type: '/Pages'); |
26 | 26 | ||
27 | /// This holds the pages | 27 | /// This holds the pages |
28 | final List<PdfPage> pages = <PdfPage>[]; | 28 | final List<PdfPage> pages = <PdfPage>[]; |
@@ -30,7 +30,7 @@ class PdfSignature extends PdfObject { | @@ -30,7 +30,7 @@ class PdfSignature extends PdfObject { | ||
30 | Set<PdfSigFlags> flags, | 30 | Set<PdfSigFlags> flags, |
31 | }) : assert(crypto != null), | 31 | }) : assert(crypto != null), |
32 | flags = flags ?? const <PdfSigFlags>{PdfSigFlags.signaturesExist}, | 32 | flags = flags ?? const <PdfSigFlags>{PdfSigFlags.signaturesExist}, |
33 | - super(pdfDocument, '/Sig'); | 33 | + super(pdfDocument, type: '/Sig'); |
34 | 34 | ||
35 | final Set<PdfSigFlags> flags; | 35 | final Set<PdfSigFlags> flags; |
36 | 36 |
-
Please register or login to post a comment