At my work I receive my payslip as a pdf file with a password. This is very nice, as it of cause prevents anybody from snooping into my salary. Though today I had the need for sending a copy of my payslip to my bank adviser, so I needed to create a version with the password protection removed. Luckily it was pretty simple, as I could just use ghostscript on my mac. XXX is the password, and the parameters outputFileName.pdf and inputFileName.pdf is self-evident.
gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite \ -sPDFPassword=XXX -sOutputFile=outputFileName.pdf \ -c .setpdfwrite -f inputFileName.pdf |