[RESOLVED] Where does cups-pdf put files by default on Centos 6?

General support questions
Post Reply
Rocksockdoc
Posts: 414
Joined: 2012/03/29 20:12:28

[RESOLVED] Where does cups-pdf put files by default on Centos 6?

Post by Rocksockdoc » 2012/12/10 22:49:02

When I print to cups-pdf, I get no options dialog and no error messages - but I can't find the resultant PDF file.

If I knew the name of the file, I could find it with the updatedb/locate command but I don't even know what the default name is.

Looking in /etc/cups/cups-pdf.conf, it implies the file goes to my desktop; but it doesn't show up there:
[code]
### Key: Out
## CUPS-PDF output directory
## special qualifiers:
## ${HOME} will be expanded to the user's home directory
## ${USER} will be expanded to the user name
## Add for Fedora (~/.config/user-dirs.dirs)
## ${DESKTOP} will be expanded to the user's desktop directory
## in case it is an NFS export make sure it is exported without
## root_squash!
### Default: /var/spool/cups-pdf/${USER}

#Out /var/spool/cups-pdf/${USER}
Out ${DESKTOP}
[/code]

What's the best way to locate where cups-pdf put the resulting pdf file?
[img]http://www2.picturepush.com/photo/a/11664095/640/11664095.png[/img]

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

[RESOLVED] Where does cups-pdf put files by default on Cento

Post by gerald_clark » 2012/12/10 22:56:45

Don't you get a save file popup when you click 'Print" ?

Rocksockdoc
Posts: 414
Joined: 2012/03/29 20:12:28

Re: Where does cups-pdf put files by default on Centos 6?

Post by Rocksockdoc » 2012/12/11 00:39:05

[quote]
gerald_clark wrote:
Don't you get a save file popup when you click 'Print" ?[/quote]

I wish I'd get 'any' popup!

When I hit 'print', the form just goes away and a dialog box pops up (as shown below when I printed this page).

Then that dialog box goes away. And that's it.

[img]http://www1.picturepush.com/photo/a/11664369/640/11664369.png[/img]

Rocksockdoc
Posts: 414
Joined: 2012/03/29 20:12:28

Re: Where does cups-pdf put files by default on Centos 6?

Post by Rocksockdoc » 2012/12/11 04:35:05

The plot thickens.

If I print to cups-pdf from LibreOffice Writer, the LibreOffice printing form has two fields: one to choose the printer cups-pdf, and the other to choose the file name (which defaults to the users' home directory).

However, if I print from a web page or from a different application, there is absolutely no dialog box allowing you to see where the file will go.

Digging deeper and running repeated 'ls' commands in the /var/spool/cups-pdf/SPOOL/ directory, I see an ephemeral file of the name "cups2pdf-6071" when I print a file of any name and title.

Running a "ps -elfww | grep 6071" while that ephemeral file is being created, we find the following processes running:

[quote]
4 S root 6071 2234 0 80 0 - 1032 wait 20:25 ? 00:00:00 cups-pdf:/ 51 user1 Document_Title 1 Resolution=1200dpi number-up=1 PageSize=Letter job-uuid=urn:uuid:7f626606-4932-327b-7123-e28227053f84 job-originating-host-name=localhost

5 S user1 6072 6071 0 80 0 - 1032 wait 20:25 ? 00:00:00 cups-pdf:/ 51 user1 Document_Title 1 Resolution=1200dpi number-up=1 PageSize=Letter job-uuid=urn:uuid:7f626606-4932-327b-7123-e28227053f84 job-originating-host-name=localhost

0 R user1 6073 6072 70 80 0 - 35350 - 20:25 ? 00:00:02 /usr/bin/gs -q -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile=/home/user1/Desktop/Document_Title.pdf -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f /var/spool/cups-pdf/SPOOL/cups2pdf-6071
[/quote]

Rocksockdoc
Posts: 414
Joined: 2012/03/29 20:12:28

Re: Where does cups-pdf put files by default on Centos 6?

Post by Rocksockdoc » 2012/12/11 05:49:29

I think I'm narrowing down the problem.

When cups actually works - the resulting PDF file "does" go to the user's desktop!

But, it's when cups fails that the file seems to just disappear.

Rocksockdoc
Posts: 414
Joined: 2012/03/29 20:12:28

Re: Where does cups-pdf put files by default on Centos 6?

Post by Rocksockdoc » 2012/12/11 17:21:41

To get to the bottom of this, I looked in the /var/log/cups directory and found plenty to mull through:

[code]
$ ls -ltr /var/log/cups
total 108
-rw-------. 1 root lp 248 Nov 10 22:03 cups-pdf_log-20121111
-rw-------. 1 root lp 676 Nov 12 13:00 page_log-20121113
-rw-------. 1 root lp 716 Nov 14 09:01 access_log-20121118
-rw-------. 1 root lp 1232 Nov 14 09:01 page_log-20121118
-rw-------. 1 root lp 78 Nov 14 09:01 cups-pdf_log-20121118
-rw-------. 1 root lp 368 Nov 22 09:55 access_log-20121125
-rw-------. 1 root lp 6560 Nov 22 09:57 error_log-20121125
-rw-------. 1 root lp 0 Nov 25 03:36 error_log
-rw-------. 1 root lp 62 Nov 28 10:15 cups-pdf_log-20121129
-rw-------. 1 root lp 86 Nov 28 10:18 page_log-20121129
-rw-------. 1 root lp 2985 Nov 28 10:30 access_log-20121202
-rw-------. 1 root lp 2542 Dec 10 21:50 access_log-20121211
-rw-------. 1 root lp 50509 Dec 10 21:50 page_log-20121211
-rw-------. 1 root lp 1326 Dec 10 21:50 cups-pdf_log-20121211
-rw-------. 1 root lp 0 Dec 11 03:35 cups-pdf_log
-rw-------. 1 root lp 0 Dec 11 03:35 access_log
-rw-------. 1 root lp 0 Dec 11 03:35 page_log
[/code]

Those logs are interesting as they contain a history of all the files you've printed (could be a security hole, of sorts).

Since the files didn't contain much debugging information, I'll modify the /etc/cups/cups-pdf.conf logging option to obtain more details:
[code]
### Key: Log
## CUPS-PDF log directory
## set this to an empty value to disable all logging
### Default: /var/log/cups

#Log /var/log/cups

### Key: LogType
## log-mode
## 1: errors
## 2: status (i.e. activity)
## 4: debug - this will generate a lot of log-output!
## add up values to combine options, i.e. 7 is full logging
## if logging is disabled these setting have no effect
### Default: 3

#LogType 3
[/code]

Rocksockdoc
Posts: 414
Joined: 2012/03/29 20:12:28

Re: Where does cups-pdf put files by default on Centos 6?

Post by Rocksockdoc » 2012/12/13 00:50:22

UPDATE:

Turning on full logging in the /etc/cups/cups-pdf.conf file provided some detail:
[code]
#LogType 3
LogType 7[/code]

Mostly that detail is in the /var/log/cups/cups-pdf_log file:
[quote]
Wed Dec 12 16:39:55 2012 [DEBUG] output directory name generated (/home/user1/Desktop)
Wed Dec 12 16:39:55 2012 [DEBUG] spoolfile name created (/var/spool/cups-pdf/SPOOL/cups2pdf-18562)
Wed Dec 12 16:39:55 2012 [DEBUG] found title in ps code ((www.centos.org - The Community ENTerprise Operating System))
Wed Dec 12 16:39:55 2012 [DEBUG] all data written to spoolfile (/var/spool/cups-pdf/SPOOL/cups2pdf-18562)
Wed Dec 12 16:39:55 2012 [DEBUG] trying to use PS title ((www.centos.org - The Community ENTerprise Operating System))
Wed Dec 12 16:39:55 2012 [DEBUG] removing trailing newlines from title ((www.centos.org - The Community ENTerprise Operating System))
Wed Dec 12 16:39:55 2012 [DEBUG] removing enclosing parentheses () from full title ((www.centos.org - The Community ENTerprise Operating System))
Wed Dec 12 16:39:55 2012 [DEBUG] removing special characters from title (www.centos.org - The Community ENTerprise Operating System)
Wed Dec 12 16:39:55 2012 [DEBUG] title successfully retrieved (www_centos_org_-_The_Community_ENTerprise_Operating_System)
Wed Dec 12 16:39:55 2012 [DEBUG] output filename created (/home/user1/Desktop/www_centos_org_-_The_Community_ENTerprise_Operating_System.pdf)
Wed Dec 12 16:39:55 2012 [DEBUG] ghostscript commandline built (/usr/bin/gs -q -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile="/home/user1/Desktop/www_centos_org_-_The_Community_ENTerprise_Operating_System.pdf" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f /var/spool/cups-pdf/SPOOL/cups2pdf-18562)
[/quote]
What's interesting is that the file name is actually reasonably intelligently ascertained from the content of the item being printed.
In the example above, the web page viewed was a Centos web page - but in other examples, I was viewing various files of different formats.

So, the answer to what the file name Cups uses is that it diligently tries to ascertain a decent file name, based on properties of the file itself!
I had printed, for example, a PDF with a file name and an internal title property - the resulting file name was based on the internal title property.

Who would have known!

I think we can now mark this topic resolved!

User avatar
AlanBartlett
Forum Moderator
Posts: 9345
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk
Contact:

Re: [RESOLVED] Where does cups-pdf put files by default on Centos 6?

Post by AlanBartlett » 2012/12/13 04:02:45

[quote]
I think we can now mark this topic resolved!
[/quote]
Thank you.

On your behalf and for posterity, this thread is now marked [RESOLVED].

Post Reply