Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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.
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.
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.
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!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.