If the toolkit Pdftk is available in the system, it will be called to fill a pdf form with given a list of fields. List of fields can be acquired by get_fields function.

See the reference for detailed usage of pdftk.

set_fields(
  input_filepath = NULL,
  output_filepath = NULL,
  fields,
  overwrite = TRUE,
  convert_field_names = FALSE
)

Arguments

input_filepath

the path of the input PDF file. The default is set to NULL. IF NULL, it prompt the user to select the folder interactively.

output_filepath

the path of the output PDF file. The default is set to NULL. IF NULL, it prompt the user to select the folder interactively.

fields

Fields returned from get_fields function. To make changes in a PDF, edit the values component of an element within this list

overwrite

If a file exists in output_filepath, should it be overwritten.

convert_field_names

If you set convert_field_names when using get_fields you should set this to TRUE as well so the fields can be matched correctly.

References

https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/

See also

Author

Ogan Mancarci

Examples

if (FALSE) { pdfFile = system.file('testForm.pdf',package = 'staplr') fields = get_fields(pdfFile) fields$TextField1$value = 'this is text' fields$TextField2$value = 'more text' fields$RadioGroup$value = 2 fields$checkBox$value = 'Yes' set_fields(pdfFile,'filledPdf.pdf',fields) }