Showing
7 changed files
with
42 additions
and
7 deletions
@@ -29,8 +29,22 @@ class Document { | @@ -29,8 +29,22 @@ class Document { | ||
29 | Document( | 29 | Document( |
30 | {PdfPageMode pageMode = PdfPageMode.none, | 30 | {PdfPageMode pageMode = PdfPageMode.none, |
31 | DeflateCallback deflate, | 31 | DeflateCallback deflate, |
32 | - this.theme}) | ||
33 | - : document = PdfDocument(pageMode: pageMode, deflate: deflate); | 32 | + this.theme, |
33 | + String title, | ||
34 | + String author, | ||
35 | + String creator, | ||
36 | + String subject, | ||
37 | + String keywords, | ||
38 | + String producer}) | ||
39 | + : document = PdfDocument(pageMode: pageMode, deflate: deflate) { | ||
40 | + document.info = PdfInfo(document, | ||
41 | + title: title, | ||
42 | + author: author, | ||
43 | + creator: creator, | ||
44 | + subject: subject, | ||
45 | + keywords: keywords, | ||
46 | + producer: producer); | ||
47 | + } | ||
34 | 48 | ||
35 | static bool debug = false; | 49 | static bool debug = false; |
36 | 50 |
@@ -25,7 +25,7 @@ void main() { | @@ -25,7 +25,7 @@ void main() { | ||
25 | test('Pdf', () { | 25 | test('Pdf', () { |
26 | Document.debug = true; | 26 | Document.debug = true; |
27 | 27 | ||
28 | - final Document pdf = Document(); | 28 | + final Document pdf = Document(title: 'Widgets Test'); |
29 | 29 | ||
30 | final TextStyle symbol = TextStyle(font: Font.zapfDingbats()); | 30 | final TextStyle symbol = TextStyle(font: Font.zapfDingbats()); |
31 | 31 |
@@ -104,7 +104,7 @@ class Category extends StatelessWidget { | @@ -104,7 +104,7 @@ class Category extends StatelessWidget { | ||
104 | } | 104 | } |
105 | 105 | ||
106 | Future<PdfDocument> generateDocument(PdfPageFormat format) async { | 106 | Future<PdfDocument> generateDocument(PdfPageFormat format) async { |
107 | - final PdfDoc pdf = PdfDoc(); | 107 | + final PdfDoc pdf = PdfDoc(title: 'My Résumé', author: 'David PHAM-VAN'); |
108 | 108 | ||
109 | final PdfImage profileImage = await pdfImageFromImageProvider( | 109 | final PdfImage profileImage = await pdfImageFromImageProvider( |
110 | pdf: pdf.document, | 110 | pdf: pdf.document, |
@@ -18,8 +18,27 @@ part of printing; | @@ -18,8 +18,27 @@ part of printing; | ||
18 | 18 | ||
19 | class PdfDoc extends Document { | 19 | class PdfDoc extends Document { |
20 | /// Wrapper for a [Document] with zlib compression enabled by default | 20 | /// Wrapper for a [Document] with zlib compression enabled by default |
21 | - PdfDoc({bool compress = true}) | ||
22 | - : super(deflate: compress ? zlib.encode : null) { | 21 | + PdfDoc( |
22 | + {bool compress = true, | ||
23 | + PdfPageMode pageMode = PdfPageMode.none, | ||
24 | + Theme theme, | ||
25 | + String title, | ||
26 | + String author, | ||
27 | + String creator, | ||
28 | + String subject, | ||
29 | + String keywords, | ||
30 | + String producer}) | ||
31 | + : super( | ||
32 | + deflate: compress ? zlib.encode : null, | ||
33 | + pageMode: pageMode, | ||
34 | + theme: theme, | ||
35 | + title: title, | ||
36 | + author: author, | ||
37 | + creator: creator, | ||
38 | + subject: subject, | ||
39 | + keywords: keywords, | ||
40 | + producer: producer, | ||
41 | + ) { | ||
23 | Document.debug = debugPaintSizeEnabled; | 42 | Document.debug = debugPaintSizeEnabled; |
24 | } | 43 | } |
25 | } | 44 | } |
-
Please register or login to post a comment