我使用PDF文档作为模板,其中包含一个表单,在将值放入表单后,我想删除字段边框,然后展平表单。边框在编辑时很有用,但是当表格被渲染时它们很可怕#34;我不能将边框的颜色更改为背景颜色,因为它不均匀。
答案 0 :(得分:1)
PDAnnotationWidget widget = textBox.getWidgets().get(0); // only the first widget for simplicity
PDAppearanceCharacteristicsDictionary appearanceCharacteristics = widget.getAppearanceCharacteristics();
if (appearanceCharacteristics == null)
{
// if it doesn't exist, create it
appearanceCharacteristics = new PDAppearanceCharacteristicsDictionary(new COSDictionary());
}
appearanceCharacteristics.setBorderColour(new PDColor(new float[]{}, PDDeviceRGB.INSTANCE)); // empty array = invisible color
widget.setAppearanceCharacteristics(fieldAppearance);
acroForm.refreshAppearances(); // alternatively, set the value of the field