【发布时间】:2017-11-07 19:32:25
【问题描述】:
我正在使用 PDF 文档作为模板,其中包含一个表单,在我将值放入表单后,我想在展平表单之前删除字段边框。边框在编辑时很有用,但在“渲染”表单时它们很糟糕。我无法将边框的颜色更改为背景颜色,因为它不统一。
【问题讨论】:
我正在使用 PDF 文档作为模板,其中包含一个表单,在我将值放入表单后,我想在展平表单之前删除字段边框。边框在编辑时很有用,但在“渲染”表单时它们很糟糕。我无法将边框的颜色更改为背景颜色,因为它不统一。
【问题讨论】:
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