David PHAM-VAN

Import already defined form

@@ -6,6 +6,8 @@ @@ -6,6 +6,8 @@
6 - Fix Color.toHex() 6 - Fix Color.toHex()
7 - Improve Annotations placement 7 - Improve Annotations placement
8 - Improve documentation strings 8 - Improve documentation strings
  9 +- Improve verbose output
  10 +- Import already defined form
9 11
10 ## 3.9.0 12 ## 3.9.0
11 13
@@ -114,6 +114,10 @@ class PdfNum extends PdfDataType { @@ -114,6 +114,10 @@ class PdfNum extends PdfDataType {
114 return false; 114 return false;
115 } 115 }
116 116
  117 + PdfNum operator |(PdfNum other) {
  118 + return PdfNum(value.toInt() | other.value.toInt());
  119 + }
  120 +
117 @override 121 @override
118 int get hashCode => value.hashCode; 122 int get hashCode => value.hashCode;
119 } 123 }
@@ -123,17 +123,13 @@ class PdfCatalog extends PdfObjectDict { @@ -123,17 +123,13 @@ class PdfCatalog extends PdfObjectDict {
123 } 123 }
124 124
125 if (widgets.isNotEmpty) { 125 if (widgets.isNotEmpty) {
126 - params['/AcroForm'] = PdfDict({  
127 - '/SigFlags': PdfNum(pdfDocument.sign?.flagsValue ?? 0),  
128 - '/Fields': PdfArray.fromObjects(widgets),  
129 - });  
130 -  
131 - // final acroForm = (params['/AcroForm'] ??= PdfDict()) as PdfDict;  
132 - // acroForm['/SigFlags'] = PdfNum(pdfDocument.sign?.flagsValue ?? 0);  
133 - // final fields = (acroForm['/Fields'] ??= PdfArray()) as PdfArray;  
134 - // for (final w in widgets) {  
135 - // fields.add(w.ref());  
136 - // } 126 + final acroForm = (params['/AcroForm'] ??= PdfDict()) as PdfDict;
  127 + acroForm['/SigFlags'] = PdfNum(pdfDocument.sign?.flagsValue ?? 0) |
  128 + (acroForm['/SigFlags'] as PdfNum? ?? const PdfNum(0));
  129 + final fields = (acroForm['/Fields'] ??= PdfArray()) as PdfArray;
  130 + for (final w in widgets) {
  131 + fields.add(w.ref());
  132 + }
137 } 133 }
138 } 134 }
139 } 135 }