LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-15-2014, 09:14 PM   #1
joanakin
LQ Newbie
 
Registered: Jan 2014
Posts: 5

Rep: Reputation: Disabled
cups print job and save PDF copy


Greetings
I want cups to print job at same time save a PDF copy. I have installed cups and can print to physical printer I have as well setup cups-pdf and I can print to it to generate the PDF under user directory's. the challenge is I want a script to trigger cups-pdf to save pdf under users directory each time I print to physical printer. pls help
 
Old 01-16-2014, 12:43 AM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,700

Rep: Reputation: 2658Reputation: 2658Reputation: 2658Reputation: 2658Reputation: 2658Reputation: 2658Reputation: 2658Reputation: 2658Reputation: 2658Reputation: 2658Reputation: 2658
if you need to do this in the terminal
then wright a print launcher script to make a shadow copy

but if you already have a pdf open in Ockluar then why not just "save copy as "
 
Old 01-16-2014, 02:30 AM   #3
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,575

Rep: Reputation: 2848Reputation: 2848Reputation: 2848Reputation: 2848Reputation: 2848Reputation: 2848Reputation: 2848Reputation: 2848Reputation: 2848Reputation: 2848Reputation: 2848
Quote:
the challenge is I want a script to trigger cups-pdf to save pdf under users directory each time I print to physical printer. pls help
There is some information here about a script to move a .pdf file to a user's directory. Should not be hard to add an output to the physical printer.http://slackwiki.com/PDF_Printing

Last edited by allend; 01-16-2014 at 09:27 AM.
 
Old 01-16-2014, 04:47 AM   #4
joanakin
LQ Newbie
 
Registered: Jan 2014
Posts: 5

Original Poster
Rep: Reputation: Disabled
Thank you for the reply. Let me be more explicit. The cups-pdf works perfectly when printed on it (stand-alone). the physical printer works well too(stand-alone).

What i want to achieve is to print to physical printer(on paper) and at the same time automatically generate pdf of the job printed.
 
Old 01-16-2014, 05:16 AM   #5
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,465

Rep: Reputation: Disabled
I'm not sure I understand what you want. What is the file type of the original document that you want to print? Usually the application that created it will have a print menu with a "print to file" option. But again I'm not really sure what you want to do exactly.
jdk
 
Old 01-16-2014, 05:41 AM   #6
joanakin
LQ Newbie
 
Registered: Jan 2014
Posts: 5

Original Poster
Rep: Reputation: Disabled
i have setup printer from cups and share it with samba.

the printers are as follows

Printer1
Printer2
Cups-PDF-Printer

samba users will print to Printer1 or Printer2 for paper works. I want to monitor the content of the printed jobs so I need to make Cups-PDF-Printer to automatically save/print copy of the job send to Printer1 or Printer2 as pdf.
 
Old 01-16-2014, 06:38 AM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,853

Rep: Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356
You can create a simple script along with a special samba printer share to print both to a physical and the cups-pdf printer.

http://www.linuxquestions.org/questi...-added-756040/
 
Old 01-16-2014, 08:14 AM   #8
joanakin
LQ Newbie
 
Registered: Jan 2014
Posts: 5

Original Poster
Rep: Reputation: Disabled
@michaelk that was a good link. However the script place the print request on Cups-PDF printer before printing the job.

In my case I needed the Printer to print the job first and then create PDF. reason being that i have two or more printers with group permission. So i need that script to work in reverse order. pls help.
 
Old 01-16-2014, 09:26 AM   #9
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,575

Rep: Reputation: 2848Reputation: 2848Reputation: 2848Reputation: 2848Reputation: 2848Reputation: 2848Reputation: 2848Reputation: 2848Reputation: 2848Reputation: 2848Reputation: 2848
You can set up a multiplex printing queue. e.g. http://aplawrence.com/Unixart/dual_print.html
 
1 members found this post helpful.
Old 01-16-2014, 09:29 AM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,853

Rep: Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356
This would be the printer1 print command script. I would guess that additional steps are required to save the pdf file in a specific directory.

Quote:
#!/bin/sh
# prints to physical printer
lpr -P printer1 $1

# prints to cups-pdf
lpr -P cups-pdf $1

#Delete spooled file, change path as necessary
rm /var/spool/samba/$1

Last edited by michaelk; 01-16-2014 at 09:34 AM.
 
Old 01-16-2014, 10:50 AM   #11
joanakin
LQ Newbie
 
Registered: Jan 2014
Posts: 5

Original Poster
Rep: Reputation: Disabled
@michaelk thank you once more. I must really be doing something wrong. when i run the script from shell and try printing it didn't work rather it gave rm: cannot remove `/var/spool/samba/': Is a directory. Pls guide me where to run the scrip.
 
Old 01-16-2014, 11:09 AM   #12
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,853

Rep: Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356Reputation: 6356
The $1 is a command line argument. When windows prints a document to samba it saves it in the /var/spool/samba/ directory, then passes the name of the spooled file as a command line argument to your print script. If you are not running the script without an argument like

myscript testfile

then you you should see this error. This spooled file is not automatically deleted which is why I added the line to delete. While you are testing your script I suggest commenting the line with a # so it is not executed.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] lp doesn't print file to pdf directory after installing cups-pdf using synaptic mrcj Debian 1 10-09-2013 07:18 PM
Firefox print to PDF (and CUPS) only saves the first 1 or 2 pages to PDF ziphem Linux - Software 1 05-08-2011 10:43 PM
How to wget a webpage, and save as PDF (like cups-pdf) ? frenchn00b Programming 3 11-18-2008 03:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:04 PM.

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