News for hackers. Stuff that matters.
Re:Getting a full PDF from a DRM-encumbered online textbook by pdw on Wednesday October 21, 2015 @05:06PM (#10428704)
Watermarks and such are easy to remove with PDFtk, the swiss army knife of PDF files. Convert the input files to a plain-text representation, find the code that implements the watermark (it will be the only code that's identical on every page), delete it and convert back. Easy as pie. It will also concatenate the partial files.
Re:Getting a full PDF from a DRM-encumbered online textbook by userbinator on Wednesday October 21, 2015 @11:07PM (#10430195)
I agree; it's a fun and inspiring story, and the automation is great, but IMHO getting a PDF of a DRM'd book which consists entirely of bitmap images of each page is near the bottom of my list of options if I were in the same situation; it's probably somewhat above the "analogue hole" option of taking a picture of each page with a camera pointed at the monitor. Unless that's what the downloaded PDF consisted of, it would be far better to work with the PDF directly since it is intrinsically a vector format and removing the watermarks from the page content stream that way (it's a PostScript-like language) would be superior in terms of filesize and quality.

A few years ago I was involved in a project that required capturing content from an online document viewer site that used a SWF for each page, and our product basically did a vector-vector conversion from SWF to PDF. One of our competitor's product did the "render each page as an image, and combine the images into a PDF" and the output difference was amazing. IIRC it was around 2 orders of magnitude in size, and 4 in speed of generation. (They used Java, and we used C, which might account for some of that too, so it's not a totally fair comparison.)

Re:Getting a full PDF from a DRM-encumbered online textbook by semi-extrinsic on Wednesday October 21, 2015 @05:19PM (#10428779)
How does that preserve things like layout or equations?

I've done similar (though usually less effort) textbook trickery a few times. The Adobe Inept hack is very handy. Oh, and a recent one was stupidly easy: you could view the ebook in your browser, and save excerpts as a pdf, but only 100 pages in total per book. Problem was it stored how many pages you had saved in a cookie, so "Clear the last 5 minutes of browsing history" and you could get another 100 pages, rinse and repeat for all the book and then staple the files together with pdftk.

Re:Getting a full PDF from a DRM-encumbered online textbook by function_seven on Wednesday October 21, 2015 @09:43PM (#10429960)
I think the "plain text representation" parent is referring to is the PostScript that defines the page. If the equations are rendered in PS, or are inline images, they might survive the roundtrip conversion?
Re:Getting a full PDF from a DRM-encumbered online textbook by pdw on Thursday October 22, 2015 @02:10AM (#10430651)
Yes, it's a jumble of PostScript fragments, base64-encoded images and PDF metadata. Everything that's needed to reconstruct the original PDF, but in a form that's safe to edit in a text editor.
Re:Getting a full PDF from a DRM-encumbered online textbook by scintill76 on Thursday October 22, 2015 @08:55AM (#10431896)
You might want to compress the PDF again when you're done (my understanding is that part of what makes PDFs non-plain-text is binary compression encodings within the PDF container.)
Re:Getting a full PDF from a DRM-encumbered online textbook by SomeCallMeTim on Wednesday October 21, 2015 @06:04PM (#10429077)
Yeah, that was what I was thinking.

PDFs typically are full of Postscript (except if they're just scanned images), which is just a text rendering language. As long as you keep the Postscript format valid, you could remove the watermark by just deleting that text.

I didn't know about PDFtk, but Ghostscript can take a PDF and turn it into text Postscript, and it can reverse the process.

Re:Getting a full PDF from a DRM-encumbered online textbook by aidenn0 on Wednesday October 21, 2015 @11:54PM (#10430325)
ghostscript has always either rasterized or converted to individual strokes embedded fonts when I try that, but there's like 50 options for pdf->ps so perhaps I've got it wrong.
Re:Getting a full PDF from a DRM-encumbered online textbook by sosuke on Wednesday October 21, 2015 @07:19PM (#10429517)
PDFtk won't work with some of the more modern PDFs. Adobe added in another layer, kept the same extension and blocked out most of the 3rd party readers. Some tool called LiveCycle I think.

But for normal PDFs PDFtk is incredibly useful!

Re:Getting a full PDF from a DRM-encumbered online textbook by jimjimjim on Thursday October 22, 2015 @02:11AM (#10430653)
livecycle is only really used for interactive forms and it's not part of the pdf spec.