A PDF processor written in Go.

View the Project on GitHub pdfcpu/pdfcpu


Extract Attachments

This command extracts attachments from a PDF document. If you want to remove an extracted document you can do this using attach remove. Have a look at some examples.


pdfcpu attachments extract inFile outDir [file...]

Common Flags

name description values
v(erbose) turn on logging  
vv verbose logging  
q(uiet) quiet mode  
u(nit) display unit po(ints),in(ches),cm,mm
c(onf) config dir $path, disable
upw user password  
opw owner password  


name description required
inFile PDF input file yes
outDir output directory yes
file… one or more attachments to be extracted no


Extract a specific attachment from ledger.pdf into out:

$ pdfcpu attach extract ledger.pdf out invoice1.pdf
writing out/invoice.pdf

Extract all attachments of ledger.pdf into out:

$ pdfcpu attach extract ledger.pdf out
writing out/invoice1.pdf
writing out/invoice2.pdf
writing out/invoice3.pdf