【发布时间】:2016-01-02 21:25:11
【问题描述】:
我想填写一份 PDF 表格。我为此使用库 Pdfclow。
我在更改TextField 的颜色时遇到问题。我可以毫无问题地更改字体大小,但不能更改文本的颜色。
我将代码放在我设法在 PDF 表单中设置值的位置:
public void setPDF(String Valor, String aField) {
Form form = document.getForm();
for (Field field : form.getFields().values()) {
if (aField.equals(field.getName())) {
DefaultStyle style = new DefaultStyle();
style.setForeColor(DeviceRGBColor.get(Color.red));
String newValue = Valor;
field.setValue(newValue);
style.apply(field);
}
}
}
【问题讨论】: