gpt4 book ai didi

java - PDFBox 2 - 如何在展平之前删除表单字段的边框?

转载 作者:行者123 更新时间:2023-12-02 12:02:10 27 4
gpt4 key购买 nike

我使用 PDF 文档作为模板,其中有一个表单,在将值放入表单后,我想在展平表单之前删除字段边框。边框在编辑时很有用,但在“渲染”表单时它们很糟糕。我无法将边框的颜色更改为背景颜色,因为它不统一。

最佳答案

下面的代码是从AddBorderToField.java修改而来的示例源码下载:

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(appearanceCharacteristics);
acroForm.refreshAppearances(); // alternatively, set the value of the field

关于java - PDFBox 2 - 如何在展平之前删除表单字段的边框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47166067/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com