PDF Printing in Ubuntu

Monday, October 16, 2006

This week I took printing to another level! Well...ok, maybe not another level, more like a side level. Oh alright, its not a whole level, its more like a side step. Whatever it is I thought it was useful. I setup a PDF printer on my Ubuntu laptop without using Adobe Acrobat and I let you in on the whole thing on my podcast. You can download the episode below:

Freshubuntu Episode 13

But first the news items:

1. Possible Artwork reversal On Edgy

2. Portland project

Installing Cups-pdf printer method #1

a. Install cups-pdf by running sudo apt-get install cups-pdf
b. Edit the configuration file by running sudo gedit /etc/cups/cupsd.conf
c. Change "RunAsUser Yes" to "RunAsUser No"
d. restart cups by running sudo /etc/init.d/cupsys restart
e. Goto the menu System>>Administration>>Printing and add a printer
f. Select the detected printer "PDF Printer"
g. Select the Generic, Postscript Color Printer (Rev 3b)
h. Give it a name, like PDF Printer
i. Right click on the newly created printer, and select Properties
j. Click "Print a Test Page"
k. The file should be in your Home folder, under the PDF folder

Note - in some cases this method will not work because as soon as you try to add aprinter it has not detected a pdf printer. Also, when I tried to edit the configuration file there was not a line that referenced RunAsUser so I eventually added that line but it still did not work. In come the Ubuntu forums to the rescue! I got further instructions and they are outlined below:

a. Install the cups-pdf package (I used version 2.2.0-1)
b. Go to System -> Administration -> Printing
c. Doubleclick "New Pinter"
d. Notice that there is no mention of a CUPS PDF printer
e. Open a terminal and tpe "sudo nautilus" and then your password
f. Go to Filesystem -> usr -> lib -> cups -> backend
g. Rightclick "cups-pdf" and select Properties
h. Go to the Permissions tab and click the "Set user ID" special flag
i. Again try to add a new printer
j. There is now a "PDF Printer" detected, select it
k. Select the Generic, Postscript Color Printer (Rev 3b)
l. Give it a name, like PDF Printer
m. Right click on the newly created printer, and select Properties
n. Click "Print a Test Page"
o. The file should be in your Home folder, under the PDF folder

This got the printer to show up and working;) Yes!

CLCOTW - Command line command of the week: shred
shred - delete a file securely, first overwriting it to hide its contents

shred [OPTIONS] FILE [...]

Overwrite the specified FILE(s) repeatedly, in order to make it harder for even very expensive hardware probing to recover the data. Mandatory arguments to long options are mandatory for short options too.

-f, --force
change permissions to allow writing if necessary

-n, --iterations=N
Overwrite N times instead of the default (25)

-s, --size=N
shred this many bytes (suffixes like K, M, G accepted)

-u, --remove
truncate and remove file after overwriting

-v, --verbose
show progress

-x, --exact
do not round file sizes up to the next full block

-z, --zero
add a final overwrite with zeros to hide shredding

Here is the out put of my experiment with shred when I executed the command

shred -fvu freshubuntu.txt

harlem@freshubuntu:~/Desktop$ shred -fvu freshubuntu.txt
shred: freshubuntu.txt: pass 1/25 (random)...
shred: freshubuntu.txt: pass 2/25 (999999)...
shred: freshubuntu.txt: pass 3/25 (924924)...
shred: freshubuntu.txt: pass 4/25 (ffffff)...
shred: freshubuntu.txt: pass 5/25 (dddddd)...
shred: freshubuntu.txt: pass 6/25 (555555)...
shred: freshubuntu.txt: pass 7/25 (bbbbbb)...
shred: freshubuntu.txt: pass 8/25 (888888)...
shred: freshubuntu.txt: pass 9/25 (444444)...
shred: freshubuntu.txt: pass 10/25 (492492)...
shred: freshubuntu.txt: pass 11/25 (aaaaaa)...
shred: freshubuntu.txt: pass 12/25 (db6db6)...
shred: freshubuntu.txt: pass 13/25 (random)...
shred: freshubuntu.txt: pass 14/25 (6db6db)...
shred: freshubuntu.txt: pass 15/25 (000000)...
shred: freshubuntu.txt: pass 16/25 (222222)...
shred: freshubuntu.txt: pass 17/25 (333333)...
shred: freshubuntu.txt: pass 18/25 (b6db6d)...
shred: freshubuntu.txt: pass 19/25 (cccccc)...
shred: freshubuntu.txt: pass 20/25 (111111)...
shred: freshubuntu.txt: pass 21/25 (eeeeee)...
shred: freshubuntu.txt: pass 22/25 (666666)...
shred: freshubuntu.txt: pass 23/25 (777777)...
shred: freshubuntu.txt: pass 24/25 (249249)...
shred: freshubuntu.txt: pass 25/25 (random)...
shred: freshubuntu.txt: removing
shred: freshubuntu.txt: renamed to 000000000000000
shred: 000000000000000: renamed to 00000000000000
shred: 00000000000000: renamed to 0000000000000
shred: 0000000000000: renamed to 000000000000
shred: 000000000000: renamed to 00000000000
shred: 00000000000: renamed to 0000000000
shred: 0000000000: renamed to 000000000
shred: 000000000: renamed to 00000000
shred: 00000000: renamed to 0000000
shred: 0000000: renamed to 000000
shred: 000000: renamed to 00000
shred: 00000: renamed to 0000
shred: 0000: renamed to 000
shred: 000: renamed to 00
shred: 00: renamed to 0
shred: freshubuntu.txt: removed

See you next week.

Posted by harlem at 4:12 PM  


Per the shred man page:

CAUTION: Note that shred relies on a very important assumption:
that the filesystem overwrites data in place. This is the tradi-
tional way to do things, but many modern filesystem designs do not
satisfy this assumption. The following are examples of filesystems
on which shred is not effective:

* log-structured or journaled filesystems, such as those supplied

AIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.

I do not know what filesystem ubuntu uses as defualt but most likely ext3 or reiserFS.

Just wanted to make sure this was pointed out.

Anonymous said...
4:52 AM  

Thanks for the info! Worked like a charm.

Anonymous said...
2:25 PM  

Post a Comment