set_fields {staplr} | R Documentation |
Set fields of a pdf form
Description
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
.
Usage
set_fields(
input_filepath = NULL,
output_filepath = NULL,
fields,
overwrite = TRUE,
convert_field_names = FALSE,
flatten = 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 |
overwrite |
If a file exists in |
convert_field_names |
If you set convert_field_names when using |
flatten |
If TRUE, the form fields will be flattened and turned into plain text. |
Value
TRUE if the operation was succesfful. FALSE if the operation fails.
Author(s)
Ogan Mancarci
References
https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/
See Also
Examples
pdfFile = system.file('simpleForm.pdf',package = 'staplr')
fields = get_fields(pdfFile)
fields$TextField$value = 'this is text'
fields$TextField2$value = 'more text'
fields$Checkbox$value = 'Yes'
output <- tempfile(fileext = '.pdf')
set_fields(pdfFile,output,fields)