PDF 生成模板编辑器
开源可视化 PDF 生成引擎,支持自定义模板,并提供面向开发者的 API,灵活构建文档生成流程。
ComPDF SDK 支持以 XFDF 格式导入和导出表单数据,以方便管理 PDF 文档中的数据。
从指定的 XFDF 文件导入表单数据到当前 PDF 文档。
该 API 仅导入表单数据,并通过对应的表单名称修改表单内容。
const pdfReaderRef = useRef<CPDFReaderView>(null);
<CPDFReaderView
ref={pdfReaderRef}
document={samplePDF}
configuration={ComPDFKit.getDefaultConfig({
})}/>
const xfdfFile = '/data/user/0/com.compdfkit.reactnative.example/xxx/xxx.xfdf';
// 或在 Android 平台上使用 Uri
const xfdfFile = 'content://xxxx';
const result = await pdfReaderRef.current.importWidgets(xfdfFile);将当前 PDF 文档的表单数据导出到 XFDF 文件。
const pdfReaderRef = useRef<CPDFReaderView>(null);
<CPDFReaderView
ref={pdfReaderRef}
document={samplePDF}
configuration={ComPDFKit.getDefaultConfig({})}
/>
const exportXfdfFilePath = await pdfReaderRef.current?.exportWidgets();