[TriLUG] Shared printer that prints to a PostScript file, how do I do that?

Greg Brown via TriLUG trilug at trilug.org
Wed Sep 23 23:11:16 EDT 2020


It has been many a year since I have messed with printing on Linux and I
found there was a hard way and a much less hard way to do something like
this.  The good news is printing has matured so I'm sure it is easier (I
hope).  What I ended up doing was attaching a USB printer (HP 1200) which
more or less configured itself.  The back-end used the Common UNIX Printing
System, or CUPS, which had a nifty web interface running on the loopback on
port 631 if I remember correctly.  Using the web interface you could, I
thought at least, more easily clear out stale jobs and perform other admin
tasks.

At some point I had plugged a Brother USB printer into my
computer because CUPS is running.  I stepped through the
administration pages via the web interface but did not see a 'redirect to
postscript' (or PDF or anything) job.  Ok, I think we can do this.  Beyond
regular CUPS I needed to install the following:;

sudo apt install pyppd printer-driver-cups-pdf

Go back to the CUPS admin page (http://127.0.0.1:631 (on the machine
running the CUPS service obviously... or get crafty with a ssh tunnel)) and
go to Administration then Printer then Add Printer.  I now have an option
for 'CUPS-PDF (Virtual PDF Printer)' so I selected that  then accepted the
defaults for a printer named "Virtual_PDF_Printer" (and I clicked
'Share').  I did not see anything for PostScript so we are forging ahead
with PDF.  On the following screen for printer manufacturer/type I selected
"Generic".  On the following screen I selected "Generic CUPS PDF Printer
with Options".  On the following page I selected all the generic options
(DPI, version, etc,... still no path where these are going to be saved
though...)  As a test I can going to print this email as it is now...

I found the Generic printer in the list and..

It says it is printed somewhere.  Let's go find it.  CUPS has regular logs
(as in they are in /var/log where you would expect them to be) and if I cat
the file for the virtual printer I created (using 'sudo' of course) there
is the job:
/home/88f1d5689a8d9868/PDF/TriLUG__Shared_printer_that_prints_to_..._do_that__-_88f1d5689a8d9868_gm-job_1.pdf.
If I look in that file.... volia.  There is the PDF created by the virtual
printer.  You wanted postscritpt though (and this is sick and gross and
there has to be a better way) but I ran convert against the job and got the
standard error that says I can't do anything with PDF files that makes
changing the system to allow convert to convert PDF files to PS.

Anyway, if I had to create PDFs that would be one way to do it.

So, for my next trick I went back to CUPS admin, shared the printer, and
hopped on my Mac via a VNC session and added a printer.  Right there,
shared by Bonjor, was the generic PDF printer I had created and I just sent
a 30 page job to it and
(drumroll...............................................)  OMG.. there it
is.

Thanks!  Your question helped me just solve a nagging old problem I have
keeping PDF print jobs for bills and whatnot stored centrally.  A simple
CRON job would apply passwords to the file (as easily as it can be broken
but.. whatever) and another CRON job could tar, zip, and archive the saved
print jobs for each month.  Sweet.

Greg







On Wed, Sep 23, 2020 at 4:11 PM Charles Fischer via TriLUG <
trilug at trilug.org> wrote:

> Hello All;
>
> I am running Ubuntu 18.04.4 LTS.  I want to set up a shared printer that
> will send the PostScript (Level 2 or 3 color) intended for a physical
> printer to a file, without user intervention and with a unique file name
> for each print job.  I don't really care about the file name.  I do care
> about where the file goes.  I need it to go to a shared directory.
>
> I have played with Linux in embedded systems in the past.  I have never set
> up a printer.
>
> Thanks,
> Charles Fischer
> --
> This message was sent to: Greg Brown <gwbrown1 at gmail.com>
> To unsubscribe, send a blank message to trilug-leave at trilug.org from that
> address.
> TriLUG mailing list : https://www.trilug.org/mailman/listinfo/trilug
> Unsubscribe or edit options on the web  :
> https://www.trilug.org/mailman/options/trilug/gwbrown1%40gmail.com
> Welcome to TriLUG: https://trilug.org/welcome


More information about the TriLUG mailing list