How to decrypt a PDF file on Linux

Sometimes, I receive digital invoices in PDF format with a password. That way I shouldn't be able to modify them and commit fraud. Unfortunately, this also makes it impossible to perform normal operations on them, such as removing unneeded specifications or merging all invoices into one single file.

Luckily, most Linux distributions come with a tool that can be used to remove these passwords: ghostscript.

In order to remove the password, simply run:

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=unencrypted.pdf -c .setpdfwrite -f encrypted.pdf

While this does remove the password, I'm not sure if it does not degrade the quality of the file a little (I don't notice any quality difference, but if you use highres files, you may lose quality).

© GeekLabInfo How to decrypt a PDF file on Linux is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 4.67 out of 5)
Loading...

PCL to PDF conversion on CentOS 5.5

yum -y install libXt-devel libXext libXext-devel gcc
cd /usr/src
wget http://mirror.cs.wisc.edu/pub/mirrors/ghost/GPL/ghostpdl/ghostpdl-8.71.tar.bz2 http://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/GhostPCL/urwfonts-8.71.tar.bz2
for i in ghostpdl* urwfonts* ; do otar jxvf $i;done
mkdir -p /usr/share/ghostpdl/fonts
mv urwfonts-8.7.1/*.ttf /usr/share/ghostpdl/fonts
cd ghostpdl-8.71
sed -i "s|/windows/fonts/;/win95/fonts/;/winnt/fonts/|/usr/share/ghostpdl/fonts|g" pl/pjparse.c
make

It's all pretty much the default stuff, except for the required libs and the fonts. If you don't have the -devel packages, you get weird errors while compiling that don't show exactly what is missing.

To generate A4 output, add @PJL SET PAPER=A4 to the pcl input file.

© GeekLabInfo PCL to PDF conversion on CentOS 5.5 is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...