laser sword

22 06 2011

If you ever wanted to print colored text with a monochrome laser printer, you might have encountered the same problem I had: You just can’t read the light blue letters.
The following script can resolve the problem. It converts the pdf to a ps file and (as far as I understand) sets the font color to black (completeley black, not greyscale, halftonig etc.). The output file is a pdf again.
$ pdf_uncolor filename.pdf

#!/bin/bash
# adapted from http://superuser.com/questions/200378/converting-a-pdf-to-black-white-with-ghostscript
tempfile=/tmp/pdf_uncolor_temp.ps
rm $tempfile 
pdf2ps $1 $tempfile
gs -o bw_$1 -sDEVICE=pdfwrite -c "/setrgbcolor{0 mul 3 1 roll 0 mul 3 1 roll 0 mul 3 1 roll 0 mul add add setgray }def" -f $tempfile
rm $tempfile


Thanks to superuser.com for the template. Though I don’t completely understand the ps operations, I was able to adapt them to my needs.

Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: