From Electron Cloud
Jump to: navigation, search
(New page: This came up when I was doing a lot of testing of some code that does printing; I wanted to print to PDF and then repeatedly view the output. But the CUPS PDF printer writes to /var/spool...)
 
 
Line 1: Line 1:
This came up when I was doing a lot of testing of some code that does printing; I wanted to print to PDF and then repeatedly view the output.  But the CUPS PDF printer writes to /var/spool/cups-pdf/<username> by default, and I was naming the print jobs so they were different every time.
+
This came up when I was doing a lot of testing of some code that does printing; I wanted to repeatedly print to PDF and view the output.  But the CUPS PDF printer writes to /var/spool/cups-pdf/<username> by default, and I was naming the print jobs so they were different every time.
  
 
<pre>
 
<pre>
Line 13: Line 13:
  
 
The script should work whether you give it a directory as an argument, or if there is no argument, it will use the CWD.
 
The script should work whether you give it a directory as an argument, or if there is no argument, it will use the CWD.
 +
 +
An improvement would be a FUSE filesystem that "mounts" the output of any script like this onto a directory, e.g. /var/spool/cups-pdf/last.  It would be useful in other ways too (a kind of "smart folders").

Latest revision as of 14:43, 7 February 2008

This came up when I was doing a lot of testing of some code that does printing; I wanted to repeatedly print to PDF and view the output. But the CUPS PDF printer writes to /var/spool/cups-pdf/<username> by default, and I was naming the print jobs so they were different every time.

#!/bin/sh
echo -n $1
ls -t $1 | head -1

Usage:

xpdf `lsnewest /var/spool/cups-pdf/srutledge/`

The script should work whether you give it a directory as an argument, or if there is no argument, it will use the CWD.

An improvement would be a FUSE filesystem that "mounts" the output of any script like this onto a directory, e.g. /var/spool/cups-pdf/last. It would be useful in other ways too (a kind of "smart folders").