pdfcpu

Logo

PDF tooling for Go and the command line.

View the Project on GitHub pdfcpu/pdfcpu


Changelog
Future Directions

Remove form fields

This command removes form fields by their id or name taken from the output of pdfcpu form list.

Although the optional field label is an attribute of the JSON form field element, this command removes the field only.

Have a look at some examples.

Usage

pdfcpu form remove inFile [ outFile ] < fieldID | fieldName >... [flags]

Common Flags


Arguments

namedescriptionrequired
inFilePDF input file containing form, use - to read from stdinyes
outFilePDF output file, use - to write to stdoutno
fieldIDform field ideither
fieldNameform field nameor

Examples

Remove the field with id 32:

$ pdfcpu form list english.pdf

english.pdf
Pg L Field     │ Id | Name       │ Default          │ Value                    │ Options
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 1   Textfield │ 30 | firstName1 │ Joe              │ Jackie                   │
     Textfield │ 31 | lastName1  │ Doeby            │ Doe                      │
   * Datefield │ 32 | dob1       │ 01.01.2000       │ 31.12.1999               │
     RadioBGr. │ 33 | gender1    │ male             │ non-binary               │ female,male,non-binary
     ListBox   │ 34 | city11     │ Vienna,São Paulo │ San Francisco,Vienna     │ San Francisco,São Paulo,Vienna
     ComboBox  │ 35 | city12     │ San Francisco    │ Sidney                   │ London,San Francisco,Sidney
     CheckBox  │ 36 | cb11       │                  │ Yes                      │
     Textfield │ 37 | note1      │                  │ This is a sample text.\n │

$ pdfcpu form remove english.pdf 32
writing english.pdf...

$ pdfcpu form list english.pdf

english.pdf
Pg L Field     │ Id | Name       │ Default          │ Value                    │ Options
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 1   Textfield │ 30 | firstName1 │ Joe              │ Jackie                   │
     Textfield │ 31 | lastName1  │ Doeby            │ Doe                      │
     RadioBGr. │ 33 | gender1    │ male             │ non-binary               │ female,male,non-binary
     ListBox   │ 34 | city11     │ Vienna,São Paulo │ San Francisco,Vienna     │ San Francisco,São Paulo,Vienna
     ComboBox  │ 35 | city12     │ San Francisco    │ Sidney                   │ London,San Francisco,Sidney
     CheckBox  │ 36 | cb11       │                  │ Yes                      │
     Textfield │ 37 | note1      │                  │ This is a sample text.\n │

Remove form fields while reading and writing the PDF through pipes:

$ aws s3 cp s3://acme-forms/application.pdf - \
   | pdfcpu form remove - - legacyField \
   | aws s3 cp - s3://acme-forms/application-pruned.pdf