Filling PDF forms in R?

I am looking for a way to automate the filling of a PDF form in R. I cannot find a package written for this. Is there an option there?

Alternative solutions that I can think of:

  • Use R to overlay a PDF file containing text on an empty PDF template.
  • Using R to create an FDF file that can be read by other software or code in another language.

All of these things seem doable in Python. However, my organization is heavily inclined toward R, and in the past relied on software developers to write C # to fill out forms. I hope to use R to skip this step.

Thank!

+4
source share
1 answer

staplr set_fields get_fields set_fields. , pdftk

get_fields PDF- get_fields

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)

. github- staplr , CRAN, staplr . ,

devtools::install_github('pridiltal/staplr')
+2

Source: https://habr.com/ru/post/1692649/


All Articles