As you correctly pointed out, the document is not effectively encrypted - it's kind of a DRM, i.e. it is obfuscated/encrypted with a known key and they hope that every software able to read it will apply the restrictions. (Likely applying an army of lawyers to software that doesn't.)
That said, the iTextPDF library (download here) has a public static boolean
called unethicalreading
with the documentation stating "The iText developers are not responsible if you decide to change the value of this static parameter."
I'm not sure if iTextPDF supports PDF 1.7 (that's the reason your password removal programs don't work - they only support older formats), but if it does, the following software will parse an unprotected PDF file or one for which you provide a password, and write a new one. I am not responsible if you decide to change a certain assignment of a certain parameter in the first line of the main()
method...
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;
public class PDFOpener {
/**
* @param args
* @throws IOException
* @throws DocumentException
*/
public static void main(String[] args) throws IOException, DocumentException {
PdfReader.unethicalreading = false;
if (args.length == 0 || args.length > 3 || !args[0].endsWith(".pdf")) {
usage();
}
String infile = args[0];
String outfile = args.length >= 2 ?
args[1] : infile.substring(0, infile.length()-4) + ".open.pdf";
System.err.println("Reading: " +infile);
System.err.println("Writing: " +outfile);
PdfReader reader = null;
if (args.length == 3) {
reader = new PdfReader(args[0], args[2].getBytes(Charset.forName("UTF-8")));
} else {
reader = new PdfReader(args[0]);
}
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(outfile));
stamper.close();
}
private static void usage() {
System.err.println("Usage: pdfopener infile.pdf [outfile.pdf] [password]");
System.exit(1);
}
}
You will need to download both iText and the "extra jars" and put them somewhere on your classpath.