writableDictionary method
PdfDict<PdfDataType> ?
writableDictionary()
The /AcroForm dictionary ready for writing, or null if there is none.
Implementation
PdfDict<PdfDataType>? writableDictionary() {
final value = document.catalog.params[PdfNameTokens.acroForm];
if (value is PdfDict<PdfDataType>) return value;
if (value is PdfIndirect) return mutator.dictFor(value);
if (value is PdfDict) {
// Direct dictionary with a narrower type: copy it so that any value can
// be written into it.
final copy = PdfDict<PdfDataType>.values(
Map<String, PdfDataType>.of(value.values));
document.catalog.params[PdfNameTokens.acroForm] = copy;
return copy;
}
return null;
}