Extract attached file from encrypted PDF
I received an email with an attached pdf. This pdf was password-protected (encrypted). Atril thankfully can read those, but I didn't know how to view the file attached to the pdf. (Yes, I know, attached inside an attachment; I wasn't in control of the sender.)
Besides, who wants to use a graphical environment when a cli will do?
qpdf input.pdf output.pdf --decrypt --password='passphrasehere' mkdir -p outdir pdftk output.pdf unpack_files output outdir
Old research
My old solution involved pdftk
and pdfdetach
and for some reason I was failing to read the pdf correctly with pdftk.
pdftk inputfile.pdf input_pw 'passphrasehere' outputfile.pdf pdfdetach -upw 'passphrasehere' -saveall inputfile.pdf
Comments