UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

  • Index
  • » C
  • » Printing In Linux Form A C Program

#1 2010-04-12 09:26 AM

jpourian
Member
From: Tehran
Registered: 2010-02-01
Posts: 14

Re: Printing In Linux Form A C Program

I need to do negotiation with a printer from my program in Linux. I develop a C application. Is there any sample code In C to negotiate with a standard printer?
I also need some help for declaring a printer in Linux. Any help.


Thanks a lot

Offline

#2 2010-04-12 11:49 AM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,234

Re: Printing In Linux Form A C Program

You probably want to use CUPS. See:
http://www.cups.org/documentation.php/api-cups.html

Offline

#3 2010-04-17 09:01 PM

jpourian
Member
From: Tehran
Registered: 2010-02-01
Posts: 14

Re: Printing In Linux Form A C Program

So Thank You i3839

I m going to write a lib for sending commands to a card printing system. I not try to print a general data in a printer. I need some sample to see how we could send the printing data and commands to the card printer.
Any Idea??

Offline

#4 2010-04-17 11:32 PM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,234

Re: Printing In Linux Form A C Program

It either works like a regular printer, but with a small "paper size", or it's
special and has its own commands, in which case you need to read the
card printer's data sheet.

Offline

#5 2010-04-18 09:14 AM

jpourian
Member
From: Tehran
Registered: 2010-02-01
Posts: 14

Re: Printing In Linux Form A C Program

It is a simple printer with some extra features. I know its special commands, but my problem is finding a way to send them to it. I have to finish this job in a short period of time and I have no time to check a complete and complicated source like CUP. I only need a simple sample with sending one of the general commands to printer so I could use it for my own purpose.
The worse part is that I have not used any printer in Linux environment (for general purpose). So I think my first challenge might be installing the printer in Linux env. (I will make our System Admin to do it for me :evil:)

Offline

#6 2010-04-18 09:17 AM

jpourian
Member
From: Tehran
Registered: 2010-02-01
Posts: 14

Re: Printing In Linux Form A C Program

Again, thanks for your cooperation.

It is a simple printer with some extra features. I know its special commands, but my problem is finding a way to send them to it. I have to finish this job in a short period of time and I have no time to check a complete and complicated source like CUP. I only need a simple sample with sending one of the general commands to printer so I could use it for my own purpose.
The worse part is that I have not used any printer in Linux environment (for general purpose). So I think my first challenge might be installing the printer in Linux env. (I will make our System Admin to do it for me :D )

Thanks

Offline

#7 2010-04-18 12:39 PM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,234

Re: Printing In Linux Form A C Program

If there is a cups printer driver then it should be very easy. Just use that via the
cups API (see previous link), or extend the driver to also support the special
commands.

If there is no existing printer driver for it then you either have to write it, or
you can skip the whole CUPS and standard printing stuff and use libusb to
directly communicate with the thing (assuming it's a USB printer).

Offline

  • Index
  • » C
  • » Printing In Linux Form A C Program

Board footer

Powered by FluxBB