2

I would like to use a Raspberry Pi as a virtual pdf printer.

I ran sudo apt-get install printer-driver-cups-pdf and logged into 192.168.1.225:631 which is the static IP of my Pi. Afterwards I created a virtual printer with the name pdf_wydruk. (I check in Share printer during the create process). I opened a random picture and clicked print, chose pdf-wydruk to use and nothing.

I cannot find this file anywhere! I created /home/pi/PDF because I read this is the default path. I checked another default folder /var/spool/cups-pds/ANONYMOUS. I found 0.pdf with the actual time of editing but that file is empty - I don't have any picture or text from my desktop.

The version of Raspbian I am using is:

pi@raspberrypi:/var/log/cups $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Logs for cups:

/var/log/cups/cups-pdf-pdf_wydruk_log

pi@raspberrypi:/var/log/cups $ sudo cat cups-pdf-pdf_wydruk_log 
Tue Nov  9 14:55:40 2021  [STATUS] ***Experimental Option: DecodeHexStrings
Tue Nov  9 14:55:41 2021  [STATUS] PDF creation successfully finished for nobody
Tue Nov  9 15:08:00 2021  [STATUS] ***Experimental Option: DecodeHexStrings
Tue Nov  9 15:08:00 2021  [STATUS] PDF creation successfully finished for nobody
Tue Nov  9 15:20:50 2021  [STATUS] ***Experimental Option: DecodeHexStrings
Tue Nov  9 15:20:50 2021  [STATUS] PDF creation successfully finished for nobody
Tue Nov  9 15:21:33 2021  [STATUS] ***Experimental Option: DecodeHexStrings
Tue Nov  9 15:21:33 2021  [STATUS] PDF creation successfully finished for nobody
Tue Nov  9 15:22:02 2021  [STATUS] ***Experimental Option: DecodeHexStrings
Tue Nov  9 15:22:02 2021  [STATUS] PDF creation successfully finished for nobody
Tue Nov  9 15:25:58 2021  [STATUS] ***Experimental Option: DecodeHexStrings
Tue Nov  9 15:25:59 2021  [STATUS] PDF creation successfully finished for nobody
Tue Nov  9 15:31:52 2021  [STATUS] ***Experimental Option: DecodeHexStrings
Tue Nov  9 15:31:52 2021  [STATUS] PDF creation successfully finished for nobody
Tue Nov  9 15:32:56 2021  [STATUS] ***Experimental Option: DecodeHexStrings
Tue Nov  9 15:32:56 2021  [STATUS] PDF creation successfully finished for nobody
Tue Nov  9 15:36:35 2021  [STATUS] ***Experimental Option: DecodeHexStrings
Tue Nov  9 15:36:35 2021  [STATUS] PDF creation successfully finished for nobody
Tue Nov  9 15:46:41 2021  [STATUS] ***Experimental Option: DecodeHexStrings
Tue Nov  9 15:46:41 2021  [STATUS] PDF creation successfully finished for nobody
Tue Nov  9 15:52:16 2021  [STATUS] ***Experimental Option: DecodeHexStrings
Tue Nov  9 15:52:16 2021  [STATUS] PDF creation successfully finished for nobody
Tue Nov  9 16:13:08 2021  [STATUS] ***Experimental Option: DecodeHexStrings
Tue Nov  9 16:13:08 2021  [STATUS] PDF creation successfully finished for nobody
Tue Nov  9 16:29:22 2021  [STATUS] ***Experimental Option: DecodeHexStrings
Tue Nov  9 16:29:22 2021  [STATUS] PDF creation successfully finished for nobody
Tue Nov  9 16:48:14 2021  [STATUS] ***Experimental Option: DecodeHexStrings
Tue Nov  9 16:48:14 2021  [STATUS] PDF creation successfully finished for nobody
Tue Nov  9 16:48:23 2021  [STATUS] ***Experimental Option: DecodeHexStrings
Tue Nov  9 16:48:23 2021  [STATUS] PDF creation successfully finished for nobody
Tue Nov  9 16:49:10 2021  [STATUS] ***Experimental Option: DecodeHexStrings
Tue Nov  9 16:49:11 2021  [STATUS] PDF creation successfully finished for nobody

/var/log/cups/access_log

pi@raspberrypi:/var/log/cups $ cat access_log
localhost - - [09/Nov/2021:14:55:05 +0100] "POST / HTTP/1.1" 200 349 Create-Printer-Subscriptions successful-ok
localhost - - [09/Nov/2021:14:55:05 +0100] "POST / HTTP/1.1" 200 176 Create-Printer-Subscriptions successful-ok
192.168.1.116 - - [09/Nov/2021:14:55:37 +0100] "POST /printers/pdf_wydruk HTTP/1.1" 200 2499 Print-Job successful-ok
192.168.1.116 - - [09/Nov/2021:15:05:35 +0100] "POST /admin/ HTTP/1.1" 200 87 - -
localhost - - [09/Nov/2021:15:05:35 +0100] "POST / HTTP/1.1" 401 88 CUPS-Get-Devices successful-ok
192.168.1.116 - - [09/Nov/2021:15:05:35 +0100] "POST /admin/ HTTP/1.1" 401 87 - -
192.168.1.116 - - [09/Nov/2021:15:05:35 +0100] "POST /admin/ HTTP/1.1" 200 87 - -
192.168.1.116 - pi [09/Nov/2021:15:05:37 +0100] "POST /admin/ HTTP/1.1" 200 87 - -
localhost - - [09/Nov/2021:15:05:37 +0100] "POST / HTTP/1.1" 401 88 CUPS-Get-Devices successful-ok
localhost - pi [09/Nov/2021:15:05:37 +0100] "POST / HTTP/1.1" 200 2161 CUPS-Get-Devices -
192.168.1.116 - pi [09/Nov/2021:15:05:37 +0100] "POST /admin/ HTTP/1.1" 200 3639 - -
192.168.1.116 - pi [09/Nov/2021:15:05:50 +0100] "POST /admin/ HTTP/1.1" 200 87 - -
localhost - - [09/Nov/2021:15:05:50 +0100] "POST / HTTP/1.1" 401 88 CUPS-Get-Devices successful-ok
localhost - pi [09/Nov/2021:15:05:50 +0100] "POST / HTTP/1.1" 200 2161 CUPS-Get-Devices -
192.168.1.116 - pi [09/Nov/2021:15:05:50 +0100] "POST /admin/ HTTP/1.1" 200 3639 - -
192.168.1.116 - - [09/Nov/2021:15:05:56 +0100] "POST /admin HTTP/1.1" 200 113 - -
192.168.1.116 - - [09/Nov/2021:15:05:56 +0100] "POST /admin HTTP/1.1" 200 3090 - -
192.168.1.116 - - [09/Nov/2021:15:05:58 +0100] "POST /admin HTTP/1.1" 200 225 - -
localhost - - [09/Nov/2021:15:05:58 +0100] "POST / HTTP/1.1" 200 7469 CUPS-Get-PPDs -
192.168.1.116 - - [09/Nov/2021:15:05:58 +0100] "POST /admin HTTP/1.1" 200 6021 - -
192.168.1.116 - - [09/Nov/2021:15:06:07 +0100] "POST /admin HTTP/1.1" 200 1818 - -
localhost - - [09/Nov/2021:15:06:07 +0100] "POST /admin/ HTTP/1.1" 401 292 CUPS-Add-Modify-Printer successful-ok
192.168.1.116 - - [09/Nov/2021:15:06:07 +0100] "POST /admin HTTP/1.1" 401 1818 - -
192.168.1.116 - - [09/Nov/2021:15:06:07 +0100] "POST /admin HTTP/1.1" 200 1818 - -
192.168.1.116 - pi [09/Nov/2021:15:06:07 +0100] "POST /admin HTTP/1.1" 200 1818 - -
localhost - - [09/Nov/2021:15:06:07 +0100] "POST /admin/ HTTP/1.1" 401 292 CUPS-Add-Modify-Printer successful-ok
localhost - pi [09/Nov/2021:15:06:07 +0100] "POST /admin/ HTTP/1.1" 200 292 CUPS-Add-Modify-Printer successful-ok
192.168.1.116 - pi [09/Nov/2021:15:06:07 +0100] "POST /admin HTTP/1.1" 200 3776 - -
192.168.1.116 - pi [09/Nov/2021:15:06:36 +0100] "POST /admin HTTP/1.1" 200 141 - -
localhost - - [09/Nov/2021:15:06:36 +0100] "PUT /admin/conf/cupsd.conf HTTP/1.1" 401 0 - -
localhost - pi [09/Nov/2021:15:06:36 +0100] "PUT /admin/conf/cupsd.conf HTTP/1.1" 201 4827 - -
192.168.1.116 - pi [09/Nov/2021:15:06:36 +0100] "POST /admin HTTP/1.1" 200 4542 - -
localhost - - [09/Nov/2021:15:06:54 +0100] "POST / HTTP/1.1" 200 349 Create-Printer-Subscriptions successful-ok
localhost - - [09/Nov/2021:15:06:54 +0100] "POST / HTTP/1.1" 200 176 Create-Printer-Subscriptions successful-ok
192.168.1.116 - - [09/Nov/2021:15:07:56 +0100] "POST /printers/pdf_wydruk HTTP/1.1" 200 39730 Print-Job successful-ok
localhost - - [09/Nov/2021:15:08:06 +0100] "POST / HTTP/1.1" 401 123 Cancel-Subscription successful-ok
localhost - root [09/Nov/2021:15:08:06 +0100] "POST / HTTP/1.1" 200 123 Cancel-Subscription successful-ok
localhost - - [09/Nov/2021:15:08:06 +0100] "POST / HTTP/1.1" 200 152 Cancel-Subscription successful-ok
localhost - - [09/Nov/2021:15:08:14 +0100] "POST / HTTP/1.1" 200 349 Create-Printer-Subscriptions successful-ok
localhost - - [09/Nov/2021:15:08:14 +0100] "POST / HTTP/1.1" 200 176 Create-Printer-Subscriptions successful-ok
localhost - - [09/Nov/2021:15:19:19 +0100] "POST / HTTP/1.1" 401 123 Cancel-Subscription successful-ok
localhost - root [09/Nov/2021:15:19:19 +0100] "POST / HTTP/1.1" 200 123 Cancel-Subscription successful-ok
localhost - - [09/Nov/2021:15:19:19 +0100] "POST / HTTP/1.1" 200 152 Cancel-Subscription successful-ok
localhost - - [09/Nov/2021:15:19:27 +0100] "POST / HTTP/1.1" 200 349 Create-Printer-Subscriptions successful-ok
localhost - - [09/Nov/2021:15:19:27 +0100] "POST / HTTP/1.1" 200 176 Create-Printer-Subscriptions successful-ok
192.168.1.116 - - [09/Nov/2021:15:20:47 +0100] "POST /printers/pdf_wydruk HTTP/1.1" 200 39730 Print-Job successful-ok
192.168.1.116 - - [09/Nov/2021:15:21:30 +0100] "POST /printers/pdf_wydruk HTTP/1.1" 200 39730 Print-Job successful-ok
192.168.1.116 - - [09/Nov/2021:15:21:59 +0100] "POST /printers/pdf_wydruk HTTP/1.1" 200 39730 Print-Job successful-ok
192.168.1.116 - - [09/Nov/2021:15:25:30 +0100] "POST /admin/ HTTP/1.1" 200 90 - -
192.168.1.116 - - [09/Nov/2021:15:25:30 +0100] "POST /admin/ HTTP/1.1" 200 4702 - -
192.168.1.116 - - [09/Nov/2021:15:25:46 +0100] "POST /admin HTTP/1.1" 200 141 - -
192.168.1.116 - - [09/Nov/2021:15:25:46 +0100] "POST /admin HTTP/1.1" 200 4753 - -
192.168.1.116 - - [09/Nov/2021:15:25:56 +0100] "POST /printers/pdf_wydruk HTTP/1.1" 200 2500 Print-Job successful-ok
192.168.1.116 - - [09/Nov/2021:15:31:49 +0100] "POST /printers/pdf_wydruk HTTP/1.1" 200 2500 Print-Job successful-ok
192.168.1.116 - - [09/Nov/2021:15:32:54 +0100] "POST /printers/pdf_wydruk HTTP/1.1" 200 431788 Print-Job successful-ok
localhost - - [09/Nov/2021:15:34:23 +0100] "POST / HTTP/1.1" 401 123 Cancel-Subscription successful-ok
localhost - root [09/Nov/2021:15:34:23 +0100] "POST / HTTP/1.1" 200 123 Cancel-Subscription successful-ok
localhost - - [09/Nov/2021:15:34:23 +0100] "POST / HTTP/1.1" 200 152 Cancel-Subscription successful-ok
localhost - - [09/Nov/2021:15:34:30 +0100] "POST / HTTP/1.1" 200 349 Create-Printer-Subscriptions successful-ok
localhost - - [09/Nov/2021:15:34:30 +0100] "POST / HTTP/1.1" 200 176 Create-Printer-Subscriptions successful-ok
192.168.1.116 - - [09/Nov/2021:15:36:33 +0100] "POST /printers/pdf_wydruk HTTP/1.1" 200 431788 Print-Job successful-ok
localhost - - [09/Nov/2021:15:45:09 +0100] "POST / HTTP/1.1" 401 123 Cancel-Subscription successful-ok
localhost - root [09/Nov/2021:15:45:09 +0100] "POST / HTTP/1.1" 200 123 Cancel-Subscription successful-ok
localhost - - [09/Nov/2021:15:45:09 +0100] "POST / HTTP/1.1" 200 152 Cancel-Subscription successful-ok
localhost - - [09/Nov/2021:15:45:16 +0100] "POST / HTTP/1.1" 200 349 Create-Printer-Subscriptions successful-ok
localhost - - [09/Nov/2021:15:45:16 +0100] "POST / HTTP/1.1" 200 176 Create-Printer-Subscriptions successful-ok
192.168.1.116 - - [09/Nov/2021:15:46:39 +0100] "POST /printers/pdf_wydruk HTTP/1.1" 200 431788 Print-Job successful-ok
192.168.1.116 - - [09/Nov/2021:15:52:14 +0100] "POST /printers/pdf_wydruk HTTP/1.1" 200 380526 Print-Job successful-ok
192.168.1.116 - - [09/Nov/2021:16:13:06 +0100] "POST /printers/pdf_wydruk HTTP/1.1" 200 133421 Print-Job successful-ok
localhost - - [09/Nov/2021:16:27:40 +0100] "POST / HTTP/1.1" 401 123 Cancel-Subscription successful-ok
localhost - root [09/Nov/2021:16:27:40 +0100] "POST / HTTP/1.1" 200 123 Cancel-Subscription successful-ok
localhost - - [09/Nov/2021:16:27:40 +0100] "POST / HTTP/1.1" 200 152 Cancel-Subscription successful-ok
localhost - - [09/Nov/2021:16:27:48 +0100] "POST / HTTP/1.1" 200 349 Create-Printer-Subscriptions successful-ok
localhost - - [09/Nov/2021:16:27:48 +0100] "POST / HTTP/1.1" 200 176 Create-Printer-Subscriptions successful-ok
localhost - - [09/Nov/2021:16:27:58 +0100] "POST /admin/ HTTP/1.1" 401 24354 CUPS-Add-Modify-Printer successful-ok
localhost - root [09/Nov/2021:16:27:58 +0100] "POST /admin/ HTTP/1.1" 200 24354 CUPS-Add-Modify-Printer successful-ok
localhost - root [09/Nov/2021:16:27:58 +0100] "POST /admin/ HTTP/1.1" 200 204 CUPS-Add-Modify-Printer client-error-bad-request
192.168.1.116 - - [09/Nov/2021:16:29:20 +0100] "POST /printers/pdf_wydruk HTTP/1.1" 200 380526 Print-Job successful-ok
192.168.1.116 - - [09/Nov/2021:16:48:12 +0100] "POST /printers/pdf_wydruk HTTP/1.1" 200 380526 Print-Job successful-ok
192.168.1.116 - - [09/Nov/2021:16:48:21 +0100] "POST /printers/pdf_wydruk HTTP/1.1" 200 380526 Print-Job successful-ok
192.168.1.116 - - [09/Nov/2021:16:49:08 +0100] "POST /printers/pdf_wydruk HTTP/1.1" 200 93213 Print-Job successful-ok

Maybe somebody has an idea as to what I should do?

1 Answer 1

0

Ok i installed at the fresh image of raspberry pi and that works. Probably i had have something bad set in privillege.

  1. installed only cups for first sudo apt install cups

  2. i check my ip at ethernet/wifi via ifconfig

  3. I open configuration file for cups

    sudo vim /etc/cups/cupsd.conf

i find them line Listen localhost:631 and change them to Port 631

next - i added Allow @local in three places - result below

<Location />
  Order allow,deny
  Allow @local
</Location>

# Restrict access to the admin pages...
<Location /admin>
  Order allow,deny
  Allow @local
</Location>

# Restrict access to configuration files...
<Location /admin/conf>
  AuthType Default
  Require user @SYSTEM
  Order allow,deny
  Allow @local
</Location>
  1. I restarted services - sudo service cups restart now i should access at my desktop to raspberry cups by url 192.168.1.225:631 ( i get that ip from ifconfig command )

  2. i added usermod for pi

    sudo usermod -a -G lpadmin pi

  3. I installed cups-pdf -- now they have new name 'printer-driver-cups-pdf`

    sudo apt-get install printer-driver-cups-pdf

  4. I added printer generic --> generic-cups-pdf like guy at that spanish movie

https://www.youtube.com/watch?v=ZHQuCkrqTS4 administration -> add printer -> cups-pdf -> i called printer-pdf polish pdf-wydruk

8) i created folder at raspberry pi /home/pi/PDF

At ip_raspberry_pi:631 in browser click Printers -> Maintenance --> Print test page --- and ... i should have test pdf file at my raspberry /home/pi/PDF if you don't find - check /var/spool/cups-pdf folder and should be folder pi or ANONYMOUS and looking for that pdf file.

  1. In my project i have wanted share that file for other computer in network so i install samba

sudo apt install samba i said no to window with ask, because i don't need settings WINS with DHCP - I set static ip for raspberry pi

I created folder /samba/wydruki

sudo mkdir -p /samba/wydruki
sudo chmod -R 777 /samba/wydruki
sudo chmod -R nobody.nogroup /samba/wydruki
sudo chmod -R 777 /samba
  1. I changed to settings file using sudo vim /etc/samba/smb.conf
[Publiczny]
    path = /samba/wydruki
    browseable = yes
    guest ok = yes
    read only = no
    create_mask = 777
  1. I restarted services samba
    sudo service smbd restart
    sudo service nmbd restart
  1. I changed file conf cups-pdf
    sudo vim /etc/cups/cups-pdf.conf

and i comment two old line and added new with path to /samba/wydruki

##  CUPS-PDF output directory 
##  special qualifiers: 
##     ${HOME} will be expanded to the user's home directory
##     ${USER} will be expanded to the user name
##  in case it is an NFS export make sure it is exported without
##  root_squash!
##  on Ubuntu, the cupsd AppArmor profile needs to be updated
##  to match the output path as per instructions in LP:147551
### Default: /var/spool/cups-pdf/${USER}

#Out ${HOME}/PDF
Out /samba/wydruki

### Key: AnonDirName (config)
##  ABSOLUTE path for anonymously created PDF files
##  if anonymous access is disabled this setting has no effect
### Default: /var/spool/cups-pdf/ANONYMOUS

#AnonDirName /var/spool/cups-pdf/ANONYMOUS
AnonDirName /samba/wydruki

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.