Adobe Digital Editions, Ubuntu, and DRMs
Updated 2019-05-11: This post makes for an entertaining read (in my misguided opinion) but if you're looking for a technical solution to your problem, you should probably check out its more recent version.
So you've bought an eBook on, say, BooksOnBoard.
And you were told it was in PDF format.
Except that it was an Adobe Digital Editions (ADE) version of a PDF, which means that you actually received/downloaded a .acsm file and that you can only open it with ADE. Once you do that, ADE generates a PDF file, which it hides under "My Digital Editions" on my computer, and that .pdf is locked with DRMs and you cannot import it on your eBook reader. If you try to open it with anything that isn't ADE, it requires a password, which you don't have, because it's fucking embedded in ADE. As far as I understand it.
So you're starting to get a little bit pissed off at DRMs. And head off to the Internets again (not that you'd ever left the Internets, but, well).
The first interesting thing you find is Apprentice Alf's webpage. I don't know who you are, Apprentice Alf, but there's a special place in my heart for people like you. Apprentice Alf maintains a toolkit of all sorts of DRM removal tools, which you can download here.
So you download the tools, and install the calibre plugin that corresponds to what you want to do (de-DRM an ADE file), which is called Inept PDF De-DRM.
Well, try to install, because it turns out that you have the wrong calibre version. So remove your current calibre version (this does not delete the library, so have at it, people), and re-install it properly following the instructions (well, instruction, really, there's only one command if you're on linux) on the official calibre download page.
So you open your proper version of calibre, go to the Plugins section in the Preferences menu, click "Add a new plugin" and select the Inept PDF .zip plugin file you've downloaded, and install it.
Then you try to convert, open, remove then reimport your DRMized pdf and it still doesn't cut it.
So you realize you have to be a grown-up and run the standalone yourself. You locate "Adobe_PDF_tools" in the toolkit, head there, read the README, change the permissions so that everything that needs to be is executable, and run
./ineptkey_v5.4.pyw
And get a pretty dialog box that tells you you can only run this script under Mac OS X or Windows. And of course you're running Ubuntu.
As the will to live slowly starts to leave you, you think really hard about the $9.98 you've just spent on a fucking eBook you cannot read — it's 400 pages long and I am not reading 400 fucking pages on a fucking screen. Time to use wine. No, not the beverage, the windows emulator. Unfortunately. OK, so here's what you do.
Go to the Active Python download page, download the Windows MSI installer for version 2.6.6.18.
Install Active Python
wine msiexec /i ActivePython-2.6.6.18-win32-x86.msi
Go to this wonderful page and download pycrypto-2.0.1.win32-py2.6.exe
Install PyCrypto
wine pycrypto-2.0.1.win32-py2.6.exe
Go to the Adobe Digital Editions page and figure out how to download ADE for Windows. (I did that back in September, when I wanted to read one of their fucking protected pdf but was fine reading it on the computer, so I don't have the details on hand. Sowwy.) Open your .acsm file with ADE. Look for the corresponding PDF generated in ADE's digital library (under ~/My Digital Library as far as I am concerned).
Locate your Python 2.6 wine directory, most likely
~/.wine/drive_c/Python26
and the scripts directory under that, most likely
~/.wine/drive_c/Python26/Tools/scripts
copy the ineptkey_v5.4.pyw and ineptpdf_v7.9.pyw files to this directory.
run IneptKey as follows (do not ask questions, because it works, and at that point, do you really care why? I know I don't.)
wine explorer /desktop=name,1024x768 python.exe ineptkey_v5.4.pyw
It should generate a file called adeptkey.der (der, der, sorry, but is this really how I am spending my Sunday morning?), right here and there. If it doesn't work, resort to wine, the beverage sort, because this is where I cannot help you any longer.
run IneptPdf using the same recipe
wine explorer /desktop=name,1024x768 python.exe ineptpdf_v7.9.pyw
When prompted, pass it the name of adeptkey.der, the path to the PDF generated by ADE (see above), and the path to the de-DRMed PDF you want.
Open your de-DRMed PDF in Evince, Okular, and calibre, and cry tears of joy each time it works.
Write a blog post about it to let off the steam and never have to go through the motions of figuring that out ever again.
Wonder whether the two hours you spent doing that were really worth the $3.50 you spared by not blindly buying the same eBook on Amazon and blissfully upload it to your Kindle fully DRMed. (Of course it wasn't worth the money, but it was worth the fact that you now have DRM removal tools at your disposal.)
Note added 2013-07-10 For more up-to-date instructions, do read the comments below (including mine from today, #20 below. The links to individual comments are broken. This place is falling apart).