PDF Doesn’t Have the Option to Print

A friend of mine purchased a “textbook” in PDF format. He had the option to pay extra for a printed copy, but figured he could just print the relevant sections of the PDF if he actually wanted the hard copy. To his surprise the DRM in the PDF prevented him from doing that.

The printer icon is grayed out

DRM, or Digital Rights Management is one of those terms whose constituent parts are seemingly contrary to the underlying meaning. Like how the “USA PATRIOT Act” on face value would seem like something a patriot of the United States would be in favor of, but I digress… The tricky bit here is that the “rights” referred to aren’t your rights, but those of some other entity who would like to maintain control over the thing you purchased. For example they might restrict your ability to print the document you purchased, or look at a video you rented on a television set instead of a computer monitor. If that kind of thing gets under your skin you might be interested in taking a look at Defective by Design.

Looking at the PDF properties, our suspicions are confirmed. The reason we can’t print this PDF document isn’t because of some printer malfunction, but because the PDF viewer application doesn’t allow us to do that.

Several items are restricted, including printing

Disclaimer:
The information presented here is for educational purposes only and is not intended for use in aiding violations of copyright law (regardless of how perversely the laws have been twisted to serve corporate interests). You shouldn’t actually do any of this. The “friend” I was talking about earlier is merely a fabrication of artistic license, and not an admission of guilt. I have no real friends after all, I keep scaring them away with disclaimers.

In the case of PDF files with restrictions on printing within Adobe’s PDF viewer, these restrictions are not honored by all PDF file viewers. Some PDF viewers are not aware of the extended DRM attributes added into the PDF file. It is sufficient enough of a method to circumvent those protection mechanisms by simply opening the file in software that does not implement those optional features of the standard which restrict a user’s access to the file.

One such popular PDF viewer common on Linux platforms, but also available for Windows is Evince. You can download Evince from https://wiki.gnome.org/Apps/Evince/Downloads

The installation is pretty straight forward, download the file, run it, accept the GPL license, click next, finish and done.

Evince installs quickly
Evince doesn't honor those stupid DRM attributes

If you’d like to make a version of the PDF without DRM restrictions, installing a “PDF Printer” application which allows you to print files to PDF instead of a physical printer will let you save a clean PDF from evince to a new DRM free PDF. One freeware PDF printer for Windows that I’ve been more or less happy with is CutePDF. Be careful during installation to not install the unnecessary bundled software (usually a web browser toolbar).

print to pdf
Pick a new filename

Now when we open it back up in Adobe Reader, we can print

Can print now

Win.

What about converting lots of files in batch? Ghostscript is an application for Windows or Linux that can process PDF files. It’s also the library that gives CutePDF its rendering power.

Download Ghostscript here:
http://www.ghostscript.com/download/gsdnld.html

Have a PDF with a password that needs removing, but forgot what you set it to? If you have a linux box and a large word list this script could help. Install pdftops, then cat your giant word list piped to this script.

#!/bin/bash

if [ -z "$1" ]; then
        echo "Usage $0 <PDF filename>" >&2
        exit 1
fi
if ! [ -f "$1" ]; then
        echo "Couldn't find PDF file: $1" >&2
        exit 1
fi
while [ 1 ];
do
        read pass
        results="`pdftops -upw "$pass" "$1" 2>&1`"
        if [ "${results}" != "${results/'ncorrect password'//}" ]; then
                # This will run faster if you comment out the next 2 lines
                echo "Wrong password: $pass"
        else
                echo "Right password: $pass"
                break
        fi
done
This entry was posted in Helpful Tools, Rants. Bookmark the permalink.

2 Responses to PDF Doesn’t Have the Option to Print

  1. sigh says:

    “Evince doesn’t honor those stupid DRM attributes”

    Yes it does. It just makes it optional, and is off by default.

    https://bugzilla.gnome.org/show_bug.cgi?id=305818

    Okular makes it optional, but is on by default.

    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=531221

    Sumatra PDF has DRM and refuses to even make it optional:

    https://code.google.com/p/sumatrapdf/issues/detail?id=2003

    Why are PDF reader developers so boneheaded about DRM? It’s obviously an antifeature that does nothing but harm users. Why do they waste time writing this functionality into their software in the first place? Why do they then defend it when people complain? I don’t understand how people who understand the value of open source and interoperability and reuse are incapable of understanding why PDF protections are bad.

  2. Chris says:

    Well said, and thanks for the correction.

Leave a Reply

Your email address will not be published. Required fields are marked *