public class FormProcessor extends AbstractProcessor
Copyright (c) 2020 xsx All Rights Reserved. x-easypdf-pdfbox is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the Mulan PSL v2 for more details.
Modifier and Type | Field and Description |
---|---|
protected Color |
fontColor
字体颜色
|
protected String |
fontName
字体名称
|
protected Float |
fontSize
字体大小
|
protected org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm |
form
表单
|
document, log
Constructor and Description |
---|
FormProcessor(Document document)
有参构造
|
FormProcessor(Document document,
boolean isFixForm,
boolean isNeedAppearance)
有参构造
|
Modifier and Type | Method and Description |
---|---|
void |
addField(AbstractFormFieldBuilder... builders)
添加字段
|
protected String |
createDefaultAppearance(PDFont font)
创建默认样式字符串
|
void |
fillCheckBox(Map<String,Boolean> formMap)
填写多选
|
void |
fillImage(Map<String,BufferedImage> formMap)
填写图像
|
void |
fillRadio(String key,
int index)
填写单选
|
void |
fillText(Map<String,String> formMap)
填写文本
|
void |
flatten(boolean refreshAppearances,
String... keys)
扁平化表单
|
List<org.apache.pdfbox.pdmodel.interactive.form.PDField> |
getFields()
获取字段
|
protected org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm |
initForm(PDDocument document,
boolean isFixForm,
boolean isNeedAppearance)
初始化表单
|
protected boolean |
isAddAppearance()
是否添加外观
|
void |
readOnly(String... keys)
只读
|
void |
remove(String... keys)
移除字段
|
void |
replaceKey(Map<String,String> keyMap)
替换关键字
|
protected void |
reset()
重置表单
|
void |
setFont(String fontName,
float fontSize,
Color fontColor)
设置字体
|
getDocument
protected org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm form
protected String fontName
protected Float fontSize
protected Color fontColor
public FormProcessor(Document document)
document
- 文档public FormProcessor(Document document, boolean isFixForm, boolean isNeedAppearance)
document
- 文档public List<org.apache.pdfbox.pdmodel.interactive.form.PDField> getFields()
public void setFont(String fontName, float fontSize, Color fontColor)
fontName
- 字体名称fontSize
- 字体大小fontColor
- 字体颜色public void addField(AbstractFormFieldBuilder... builders)
builders
- 构建器public void remove(String... keys)
keys
- 字段关键字public void fillImage(Map<String,BufferedImage> formMap)
formMap
- 表单字典public void fillRadio(String key, int index)
key
- 字段键index
- 选项索引public void flatten(boolean refreshAppearances, String... keys)
refreshAppearances
- 是否刷新外观keys
- 字段关键字public void readOnly(String... keys)
keys
- 关键字protected org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm initForm(PDDocument document, boolean isFixForm, boolean isNeedAppearance)
document
- pdfbox文档isFixForm
- 是否修复表单isNeedAppearance
- 是否启用外观protected boolean isAddAppearance()
protected String createDefaultAppearance(PDFont font)
font
- 字体protected void reset()
Copyright © 2024. All rights reserved.