{
// TODO: handle appearance generation for other field types
if (field instanceof PDVariableText)
{
PDAppearanceString pdAppearance = new PDAppearanceString(field.getAcroForm(),
(PDVariableText) field);
Object fieldValue = field.getValue();
// in case there is no value being set generate the visual
// appearance with an empty String
if (fieldValue == null)
{
fieldValue = "";
}
// TODO: implement the handling for additional values.
if (fieldValue instanceof COSString)
{
try
{
pdAppearance.setAppearanceValue(((COSString) fieldValue).getString());
}
catch (IOException e)
{
LOG.debug("Unable to generate the field appearance.", e);
}