}
}
// replace the existing attributes by a PrintField attribute
PdfDictionary attribute = new PdfDictionary();
attribute.put(PdfName.O, PdfName.PRINTFIELD);
PdfString description = dict.getAsString(PdfName.TU);
if (description == null)
description = dict.getAsString(PdfName.T);
if (PdfName.BTN.equals(dict.get(PdfName.FT))) {
PdfNumber fflags = dict.getAsNumber(PdfName.FF);
if (fflags != null) {
int ff = fflags.intValue();
if ((ff & PdfFormField.FF_PUSHBUTTON) != 0)
attribute.put(PdfName.ROLE, PdfName.PB);
// I don't think the condition below will ever be true
if ((ff & PdfFormField.FF_RADIO) != 0)
attribute.put(PdfName.ROLE, PdfName.rb);
else
attribute.put(PdfName.ROLE, PdfName.CB);
}
}
else {
attribute.put(PdfName.ROLE, PdfName.TV);
}
attribute.put(PdfName.DESC, description);
// Updating the values of the StructElem dictionary
PdfString t = structElem.getAsString(PdfName.T);
if (t == null || t.toString().trim().length() == 0)
structElem.put(PdfName.T, dict.getAsString(PdfName.T));
structElem.put(PdfName.A, attribute);
structElem.put(PdfName.S, PdfName.P);
structElem.put(PdfName.PG, pageref);
// Defining a new MCID