LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   How to print a PDF without xorg/x11 using console? (https://www.linuxquestions.org/questions/debian-26/how-to-print-a-pdf-without-xorg-x11-using-console-775285/)

frenchn00b 12-13-2009 02:16 AM

How to print a PDF without xorg/x11 using console?
 
Hello,

There is a printer on a distant server, and I have quite some lot of pdf to print. Is there any ways to print a PDF without X11?

Usually I print with evince, rather than acroread ; but in this case, no X.

thanks
Greetings to Debian, the best distro on earth :) :)

rikijpn 12-13-2009 04:05 AM

no need for X while u have the shell
 
Code:

pdf2ps
try the man page first.
You can do something like pdf2ps somefile.pdf|lpr -P printer_name
or just print it to post script files like pdf2ps file.pdf file.ps, etc.

EricTRA 12-13-2009 04:19 AM

Hi,

Do you know how the printer is configured on the remote system, what the queue name is and if it's accepting jobs from the internet/external source? If so you could set up CUPS with the config files in /etc/cups, create the printer (ipp or http) and print directly to the queue using:
Code:

lp -d <document> <queuename>
Even without CUPS it should be possible with lp using the -h parameter:
Code:

lp -h hostname:port -d <documentname>
That is of course if the printer/server on the other side is accepting print jobs.

Kind regards,

Eric

knudfl 12-13-2009 04:19 AM

.

lp file.pdf

frenchn00b 12-13-2009 07:10 AM

Quote:

Originally Posted by EricTRA (Post 3789524)
Hi,

Do you know how the printer is configured on the remote system, what the queue name is and if it's accepting jobs from the internet/external source? If so you could set up CUPS with the config files in /etc/cups, create the printer (ipp or http) and print directly to the queue using:
Code:

lp -d <document> <queuename>
Even without CUPS it should be possible with lp using the -h parameter:
Code:

lp -h hostname:port -d <documentname>
That is of course if the printer/server on the other side is accepting print jobs.

Kind regards,

Eric

thank you Eric. A question, the printer is USB, and I would like to install it and share it for linux boxes. Any idea how to do that without KDE or any X11 installed (server). I installed printconf and it seems that printconf (usb print manager) is compatible with it.


I found this howto but http://www.linuxquestions.org/linux/...ter_using_CUPS

but my printer is an USB and has no IP number (network cable).

EricTRA 12-13-2009 07:28 AM

Hello,

The easiest way is to have it configured and shared with CUPS in my opinion. You can either do all configuration using the configuration files of CUPS (/etc/cups/) or use the web interface. I know you said you don't have a GUI but if you have lynx installed it works as well. Basically you install your usb connected printer under CUPS, configure CUPS to share the connected printer and connect from the other boxes using lp. If you have CUPS installed on the other boxes the shared printer will be instantly available on those boxes too, with the same queue name.

I have my USB printer connected to my laptop, share it and can print from another linux laptop to that printer without any problems.

Kind regards,

Eric

frenchn00b 12-13-2009 08:13 AM

wow it worked, for the moment

Code:

apt-get install printconf cups lynx
wait installation

get the PPD file here
http://www.linuxprinting.org/

then go into :
as user
lynx localhost:631
Quote:

This will start the cups server. Next, you'll need to add a printer by using the web interface. To do this, open a web browser and type in localhost:631. If your server is started, a page should load with links to various tasks. Click the first link Do Administration Tasks. A dialog will pop up asking for username and password. You need to log in as root and use your root password to access the administration menu.
Once logged in, click add printers and follow the prompts to set up your printer. When the printer is added, click on the "Configure Printer" to set page size and printing quality. Finally, click "Print Test Page". If a test page prints, you're almost ready to go on to Step 2.
and finally active it as server
[X] Share published printers connected to this
I have made change in cupsd.conf
as
i
Code:

[X] Share published printers connected to this  # Show troubleshooting information in error_log.
LogLevel debug
SystemGroup lpadmin
# Allow remote access
Port 631
Listen /var/run/cups/cups.sock
# Enable printer sharing and shared printers.
Browsing On
BrowseOrder allow,deny
BrowseAllow all
BrowseAddress @LOCAL
DefaultAuthType Basic
<Location />
  AuthType None
  Deny From None
  Allow From All
  # Allow shared printing...
  Order allow,deny
  Allow @LOCAL
</Location>
<Location /admin>
  # Restrict access to the admin pages...
  Order allow,deny
</Location>
<Location /admin/conf>
  AuthType Default
  Require user @SYSTEM
  # Restrict access to the configuration files...
  Order allow,deny
</Location>

Code:

Administration

    Home      Administration      Classes      Documentation/Help      Jobs      Printers

  Printers

      Add Printer Find New Printers Manage Printers

  Classes

      Add Class Manage Classes

  Jobs

      Manage Jobs


                                                            Server

                                                                Edit Configuration File View Access Log View Error Log View Page Log

                                                                Basic Server Settings:

                                                                [X] Show printers shared by other systems
                                                                [X] Share published printers connected to this system
                                                                        [ ] Allow printing from the Internet
                                                                [ ] Allow remote administration
(NORMAL LINK) Use right-arrow or <return> to activate.
  Arrow keys: Up and Down to move.  Right to follow a link; Left to go back.
 H)elp O)ptions P)rint G)o M)ain screen Q)uit /=search [delete]=history list

now seeking

EricTRA 12-13-2009 08:16 AM

Hi,

Looking good!!! Also if you make CUPS listen on a network IP, you can administer the whole thing from another computer that has GUI, if you feel more at ease with that.

Kind regards,

Eric

frenchn00b 12-13-2009 08:20 AM

I could print using kdeprinter configurator. Lets try to make it purely command line, client side.
print server works now, or almost using cups.(I tested used another client with gui)


The client side without X11:

I get an error :(


Code:

lp -h 10.1.1.10:631 -d test.txt
lp: The printer or class was not found.

nmap 10.1.1.10
Code:

PORT    STATE SERVICE
111/tcp  open  rpcbind
139/tcp  open  netbios-ssn
445/tcp  open  microsoft-ds
544/tcp  open  kshell
631/tcp  open  ipp

10.1.1.10:631 is the printer server

EricTRA 12-13-2009 08:24 AM

Hello,

Where are you stating the queue name? (lp -h <host : port> -d <document> <queuename>)
Type
Code:

lpstat -a
to check if you can see the printerqueue and the status of it.

Kind regards,

Eric

frenchn00b 12-13-2009 08:34 AM

Quote:

Originally Posted by EricTRA (Post 3789676)
Hello,

Where are you stating the queue name? (lp -h <host : port> -d <document> <queuename>)
Type
Code:

lpstat -a
to check if you can see the printerqueue and the status of it.

Kind regards,

Eric

seems that I got something, from the pc that has used kdeprinting
Code:

$ lpstat -a
Lexmark-Lexmark-Z55 accepting requests since

i will try on another one.

So the next step to print or to add this printer without X to the user printing configuration, shoudl be possible?

frenchn00b 12-13-2009 08:44 AM

Quote:

~$ export PRINTER=Lexmark-Lexmark-Z55 ; lp text.txt
request id is (1 file(s))
but nothing come out


I tried with :
lp -PLexmark-Lexmark-Z55 text.txt

but nothing come out

I played with lprm to delete the evn. bugigng pages. but nothing ...


howto:
https://kb.iu.edu/data/adzr.html

EricTRA 12-13-2009 08:53 AM

Hi,

I don't know exactly how you configure a printer, commandline only for a user to set it as default. I'd have to look it up. If the queue is available to them then they can print, but how to set that up as default per user basis is unclear to me.

Kind regards,

Eric

EricTRA 12-13-2009 08:56 AM

Hi,

Just got this from the CUPS user manual.

Quote:

Setting the Default Printer

The administrator normally will set a system-wide default printer that is normally used as the default printer by everyone. Use the -d printer option to set your own default printer:

lpoptions -d deskjet ENTER

The printer can be local (deskjet) or remote ( deskjet@server).
Would this be sufficient?

Kind regards,

Eric

frenchn00b 12-13-2009 08:56 AM

Quote:

Originally Posted by EricTRA (Post 3789707)
Hi,

I don't know exactly how you configure a printer, commandline only for a user to set it as default. I'd have to look it up. If the queue is available to them then they can print, but how to set that up as default per user basis is unclear to me.

Kind regards,

Eric

for default I know:
normally you have to add the export PRINTER=LEXMARK

PRINTER can be set in .bashrc

lpstat -v gives all the possible printers.

but well, I know that, can print with evince/acroread, but it cannot from command line for no idea which reason.


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