From: an anonymous contributor
To: dst@cs.cmu.edu
Subject: PDF discovery
Date: Fri, 30 Aug 2002
Thanks for the great webpage on PDF's. I made a discovery that helped me
out. I thought I would tell you about it anonymously.
I found a way to get an Adobe eBook (that you can print) into unsecured PDF.
First, I printed to a PS printer with device set to FILE. This gave me a
.ps file. Then I attempted to use ps2pdf in the Ghostscript package (7.04)
to convert it, but it dumped at me "This PostScript file was created from an
encrypted PDF file." whenever I tried to use it. Perhaps another revision
to pdf_sec.ps is in order.
I learned that the PS file was carring encrypted code ("% Removing the
following eight lines is illegal, subject to the Digital Copyright Act of
1998.") that checked for the PS file being executed in the context of a
distiller and dumps the above error message if so.
Specifically, the code checks for the definition of currentdistillerparams
and pdfmark and if it finds either, it barfs. Now I don't know PS and I
don't know Ghostscript, so you will no doubt cringe at this kludgy hack. In
gs_pdfwr.ps of the Ghostscript package find the section titled:
% Patch 'where' so that the distillerparams operators are only visible
% if the pdfwrite device is the current one, for the benefit of badly
% designed PostScript files that "know" they have to do something different
% if a distiller is processing them.
in this section change:
currentdevice .devicename /pdfwrite eq {
to
currentdevice .devicename /pdfwritexxx eq {
This change compels Ghostscript to not define currentdistillerparams for a
pdf conversion which is enough to bypass the check in the PS file and allow
a successful conversion to unprotected PDF using ps2pdf.
Cheers