Showing
4 changed files
with
17 additions
and
1 deletions
@@ -47,6 +47,8 @@ class PdfInfo extends PdfObject { | @@ -47,6 +47,8 @@ class PdfInfo extends PdfObject { | ||
47 | } else { | 47 | } else { |
48 | params['/Producer'] = PdfStream()..putLiteral(_libraryName); | 48 | params['/Producer'] = PdfStream()..putLiteral(_libraryName); |
49 | } | 49 | } |
50 | + | ||
51 | + params['/CreationDate'] = PdfStream()..putDate(DateTime.now()); | ||
50 | } | 52 | } |
51 | 53 | ||
52 | static const String _libraryName = 'https://github.com/DavBfr/dart_pdf'; | 54 | static const String _libraryName = 'https://github.com/DavBfr/dart_pdf'; |
@@ -144,6 +144,17 @@ class PdfStream { | @@ -144,6 +144,17 @@ class PdfStream { | ||
144 | putString('[' + values.join(' ') + ']'); | 144 | putString('[' + values.join(' ') + ']'); |
145 | } | 145 | } |
146 | 146 | ||
147 | + void putDate(DateTime date) { | ||
148 | + final DateTime utcDate = date.toUtc(); | ||
149 | + final String year = utcDate.year.toString().padLeft(4, '0'); | ||
150 | + final String month = utcDate.month.toString().padLeft(2, '0'); | ||
151 | + final String day = utcDate.day.toString().padLeft(2, '0'); | ||
152 | + final String hour = utcDate.hour.toString().padLeft(2, '0'); | ||
153 | + final String minute = utcDate.minute.toString().padLeft(2, '0'); | ||
154 | + final String second = utcDate.second.toString().padLeft(2, '0'); | ||
155 | + putText("D:${year}${month}${day}${hour}${minute}${second}Z"); | ||
156 | + } | ||
157 | + | ||
147 | void putNumArray(List<double> values) { | 158 | void putNumArray(List<double> values) { |
148 | putString('['); | 159 | putString('['); |
149 | putNumList(values); | 160 | putNumList(values); |
@@ -4,7 +4,7 @@ description: A pdf producer for Dart. It can create pdf files for both web or fl | @@ -4,7 +4,7 @@ description: A pdf producer for Dart. It can create pdf files for both web or fl | ||
4 | homepage: https://github.com/DavBfr/dart_pdf/tree/master/pdf | 4 | homepage: https://github.com/DavBfr/dart_pdf/tree/master/pdf |
5 | repository: https://github.com/DavBfr/dart_pdf | 5 | repository: https://github.com/DavBfr/dart_pdf |
6 | issue_tracker: https://github.com/DavBfr/dart_pdf/issues | 6 | issue_tracker: https://github.com/DavBfr/dart_pdf/issues |
7 | -version: 1.3.6 | 7 | +version: 1.3.7 |
8 | 8 | ||
9 | environment: | 9 | environment: |
10 | sdk: ">=2.1.0 <3.0.0" | 10 | sdk: ">=2.1.0 <3.0.0" |
-
Please register or login to post a comment