Staplr包现在支持此get_fields功能set_fields。请注意,要使其工作,必须安装pdftk 服务器并位于您的路径中
get_fields从 pdf 中返回您可以修改的字段及其类型的列表
set_fields允许您根据您的修改填写表格。请参阅下面的代码示例
pdfFile = system.file('testForm.pdf',package = 'staplr')
fields = get_fields(pdfFile)
# You'll get a list of fields that the pdf contains
# along with some additional information about the fields.
# You make modifications in any of the fields by
fields$TextField1$value = 'this is text'
# and apply the changes you have made in a new file
set_fields(pdfFile, 'newFile.pdf', fields)
Run Code Online (Sandbox Code Playgroud)
注意:目前 staplr 的 github 版本有尚未纳入 CRAN 的修复,这些修复会影响 staplr 用非英语字母书写的能力。为了获得最佳体验,您可能需要通过执行以下操作来安装它
devtools::install_github('pridiltal/staplr')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3184 次 |
| 最近记录: |