LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-10-2014, 02:40 PM   #1
wpflum
LQ Newbie
 
Registered: Apr 2009
Posts: 25

Rep: Reputation: 0
Cups-pdf filename from printer


I'm trying to get cups-pdf to save the filename as the printer name so I can use the filename to determine how to handle the printjob in the postprocessing script. What I want to do is set up a bunch of cups-pdf printers like staffpdf, managerpdf, etc and then use the post processing script to determine the target email group by the printer name and then email the pdf to them. This way I can send reports generated by the server automatically to the intended recipients just by having them printed to a specific printer. My problem is that I do not see any way of getting the printer name into a variable and through cups-pdf/cups. Anyone done something like this or have any idea how I could do it? It doesn't have to be cups-pdf but right now I have that working and can run the reports to it and I have the post processing script working just to rename the file with the date/time so they don't overwrite each other when I print several at a time.

Thoughts???
 
Old 09-11-2014, 08:11 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
How many reports? Is this everyday, week or month?
Are they created on a windows or linux PC?
Are you using some batch process or just a GUI application?

For a small number of reports generated by a GUI application I might just use print to PDF file. Copy or save them to your specific directory then run your email post processing script.

If using some batch process using lpr then you can specify a user on the command line. Then cups-pdf will save that to that user directory as specified in the cups-pdf.conf file. You can then run your post processing script per specific directory.

There are various ways to create a cups filter/dummy printer or a samba printer via LPRNG. GUI apps will print as PS or PDF so writing a script is fairly easy and cups-pdf uses ghostscript to convert. Include your post processing and email.
 
Old 09-11-2014, 08:35 AM   #3
wpflum
LQ Newbie
 
Registered: Apr 2009
Posts: 25

Original Poster
Rep: Reputation: 0
The reports are monthly and quarterly and I generate them from an access database using wine to run a macro in access from the command line to just print the report while using a null screen for the graphics.

Unfortunately these go to different groups so dumping them all to a single user then running an email script wont work unless I can label the files like I want to anyway.

These reports are run from cron so they are automatically run each month and each quarter but right now they print to a printer and are then copied and distributed. What I want to do is be able to skip the physical part and just send an email with a pdf of each report.

The wine/access combo prints to the default printer of the server, currently a physical printer on the old server and right now the cups-pdf printer on the new. The reports are generated fine but without being able to tell them apart I can't write any kind of script to seperate them up and email them.
 
Old 09-11-2014, 09:51 AM   #4
wpflum
LQ Newbie
 
Registered: Apr 2009
Posts: 25

Original Poster
Rep: Reputation: 0
It looks like I can specify different cups-pdf.conf files per printer?? I found some documentation saying that I can change the cups-pdf.conf file to cups-pdf-whatever.pdf and change the uri of the printer to match but that isn't working.
Any idea what I might be missing? This would work in that I can assign different post processing scripts per printer if I can get this figured out.
 
Old 09-11-2014, 02:47 PM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
I have not found any documentation on multiple cups-pdf printers except by changing and recompiling the source code.
 
Old 09-12-2014, 07:32 AM   #6
wpflum
LQ Newbie
 
Registered: Apr 2009
Posts: 25

Original Poster
Rep: Reputation: 0
It's in the Readme file of the source code and looking at the code I see it in there but I'm just not sure why it wont work. There is a section of the code that looks at the uri of the printer and if it's not the default uri it uses the name for the config file. Normal file is cups-pdf.conf but if you change the backend name to cups-pdf-newprinter it sees the difference in length and looks for cups-pdf-newprinter.conf. It just doesn't seem to work for me though. I'm going to dig into it deeper today and see what I'm missing.
 
Old 09-12-2014, 09:51 AM   #7
wpflum
LQ Newbie
 
Registered: Apr 2009
Posts: 25

Original Poster
Rep: Reputation: 0
Figured it out!

When you create a printer the standard uri is cups-pdf:/ to make it look at another config file you add the additional name after the slash. If you want the config file to be cups-pdf-managers.conf you have to make the uri cups-pdf:/managers and then the program will use that config file.

I still have an issue with the file name so instead of having the different post processing scripts email to seperate email groups I'm going to make individual printers that print/email a specific report and then have the the backend of that printer rename the file to something appropriate and then email to a group. That way I get a pdf with a relevant name and get it sent to a group of people.
 
Old 09-12-2014, 11:06 AM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Thanks for the update.
 
Old 03-21-2024, 01:12 PM   #9
manuelfhp
LQ Newbie
 
Registered: Mar 2024
Posts: 1

Rep: Reputation: 0
Quote:
Originally Posted by wpflum View Post
Figured it out!

When you create a printer the standard uri is cups-pdf:/ to make it look at another config file you add the additional name after the slash. If you want the config file to be cups-pdf-managers.conf you have to make the uri cups-pdf:/managers and then the program will use that config file.

I still have an issue with the file name so instead of having the different post processing scripts email to seperate email groups I'm going to make individual printers that print/email a specific report and then have the the backend of that printer rename the file to something appropriate and then email to a group. That way I get a pdf with a relevant name and get it sent to a group of people.

Thank you man!
After 10 years this info is really amazing ...
I was trying to find a way to get the printer name to run distinct post processing ......
I create my account here just to post this reply and say thank you!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
My cups-pdf pdf printer is not working. sgsawant Linux - Software 1 03-16-2010 02:35 AM
CUPS PDF Printer that prompts for save location? MasterC Linux - General 3 01-11-2008 02:59 PM
CUPS - adding pdf printer satimis Fedora 2 06-29-2006 09:24 PM
Virtual Printer / CUPS-PDF Printer Issue in SuSE 10 jlstratton42 SUSE / openSUSE 0 12-21-2005 11:04 AM
Cups Pdf Printer Setup -- Samba treedstang Linux - General 0 07-03-2004 05:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration