So here's something: I had to buy an ebook textbook for my kid (we've moved him to online schooling, long story).
So I find a site selling them and they are in PDF format, no problem, I'll buy it and get it printed (reading textbooks on a PC is a horrible experience).
So I find a site selling them and they are in PDF format, no problem, I'll buy it and get it printed (reading textbooks on a PC is a horrible experience).
So I buy it. Only to find that you can only view it in their "special viewer". This sounds like a challenge. I install the viewer (skipping several steps here where I nearly borked my windows install, another long story). Then I d/l the PDF.
Hmm... not too bad an experience, but I can't print the damn thing. What to do? I vaguely recall a Sysinternals app from my past. Filemon or something. Turns out this is gone but there is a replacement called Process Monitor.
OK, let's go.
OK, let's go.
Install process monitor, do appropriate filtering for file access and get the logs. Look for "pdf". Hey look there! The pdf is on the drive! Great! Not... the PDF is password protected. Fek.
So let's take a look at the application and see what it's doing.... Hey that looks familiar, seems there are a lot of Chrome related files... This thing is pretty much a Chrome host. Do some searching... oooh what is this: pdf.js!!!
Dig into it and after a bit of testing (I can alter HTML / js and there is no sig check or anything), I finally find what looks like where the password get passed in.
alert(password); what are the chances?...
BOOYAH!!! So I now have the password. All good? Again not. Printing is restricted. So usual thing: search the Googles and get presented with all sorts of dodgy PDF decrypters etc. until... There is a fantastic blog on the powers of Ghostscript.
Ghostscript strips all the bullshit out and we're sorted! W0000000t! Dancing for joy here. :)
Lastly: Fuck DRM. I don't want to pirate this, share it or anything else. I paid for the book and I want to print it.