PDF 生成模板编辑器
开源可视化 PDF 生成引擎,支持自定义模板,并提供面向开发者的 API,灵活构建文档生成流程。
CPDFConfiguration.creationConfig 控制通过阅读器界面创建注释和表单后的工具状态与选中状态。该配置不影响通过文档 API 创建对象。
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
continuousCreation | boolean | true | 创建完成后保留当前创建工具;设为 false 时,创建一次后返回对应模式的默认工具 |
autoSelectCreatedAnnotation | boolean | true | 自动选中新创建的注释或表单;设为 false 时不自动选中 |
两项配置独立生效。例如,关闭连续创建并保留自动选中,可在创建一个对象后直接调整其属性。
将以下配置加入自定义配置文件,再按 配置概述 加载:
{
"creationConfig": {
"continuousCreation": false,
"autoSelectCreatedAnnotation": true
}
}省略 creationConfig 或其中任一字段时,对应配置使用默认值。
在创建 CPDFDocumentFragment 或启动文档 Activity 前设置:
import com.compdfkit.tools.common.pdf.config.CreationConfig;
configuration.creationConfig = new CreationConfig();
configuration.creationConfig.continuousCreation = false;
configuration.creationConfig.autoSelectCreatedAnnotation = true;import com.compdfkit.tools.common.pdf.config.CreationConfig
configuration.creationConfig = CreationConfig().apply {
continuousCreation = false
autoSelectCreatedAnnotation = true
}如需在当前阅读界面中修改策略,直接设置内部 CPDFReaderView,在主线程调用:
CPDFReaderView readerView = pdfView.getCPdfReaderView();
readerView.setContinuousCreation(false);
readerView.setAutoSelectCreatedAnnotation(true);val readerView = pdfView.getCPdfReaderView()
readerView.setContinuousCreation(false)
readerView.setAutoSelectCreatedAnnotation(true)其中 pdfView 为 Tools 阅读视图。以上设置影响后续交互式创建;不会重新选中已有对象,也不会修改 PDF 中已保存的内容。