David PHAM-VAN

Add Document properties

1 # 1.3.4 1 # 1.3.4
2 * Add available dimensions for PdfPageFormat 2 * Add available dimensions for PdfPageFormat
  3 +* Add Document properties
3 4
4 # 1.3.3 5 # 1.3.3
5 * Fix a bug with the RichText Widget 6 * Fix a bug with the RichText Widget
@@ -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
1 # 2.0.0 1 # 2.0.0
2 * Breaking change: Switch libraries to AndroidX 2 * Breaking change: Switch libraries to AndroidX
  3 +* Add Page information to PdfDoc object
3 4
4 # 1.3.5 5 # 1.3.5
5 * Restore compatibility with Flutter 1.0.0 6 * Restore compatibility with Flutter 1.0.0
@@ -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 }
@@ -13,7 +13,7 @@ environment: @@ -13,7 +13,7 @@ environment:
13 dependencies: 13 dependencies:
14 flutter: 14 flutter:
15 sdk: flutter 15 sdk: flutter
16 - pdf: "^1.3.3" 16 + pdf: "^1.3.4"
17 17
18 dev_dependencies: 18 dev_dependencies:
19 flutter_test: 19 flutter_test: