I have some PDF files which I want to merge into one. I typically use pdfunite
from the Poppler PDF toolkit to do this.
However now I'm getting this error:
Could not merge encrypted files ('foo.pdf')
When I run exiftool foo.pdf
to see its properties, it does mention this:
Encryption : Standard V1.2 (40-bit)
I don't fully understand how encryption in PDF files work or what it's supposed to do, but I can open and read this particular file without entering any password. I can open the file in macOS Preview, no problem. I can convert the PDF into a PNG image using Poppler's own pdftoppm
tool, no problem.
How do I override or remove this encryption, so I can merge this PDF file with other PDFs using Poppler's pdfunite
?
In case this encryption is just a metadata property, I already tried removing all metadata using exiftool
like this:
exiftool -all= -overwrite_original foo.pdf
And exiftool
has no problem removing the metadata. But the resulting file is still encrypted and pdfunite
can't process it.
xargs
to the rescue:ls *.pdf | xargs -I '{}' qpdf --decrypt {} --replace-input
– Erase