Re: Printing in GTK+



* Roger Leigh (rleigh whinlatter ukfsn org) wrote:
> "Carl B. Constantine" <duckwing duckwing ca> writes:
> 
> > I have some data I want to print out in my application. How do I do it?
> > To make things a little different, I *might* print to one of those POS
> > type printers (USB) not a regular printer.
> >
> > Pointers? Which classes do I need to use?
> 
> GTK+ itself doesn't currently offer any printing support, so the
> question doesn't really involve GTK+ directly.  You need to either
> 
> 1) Open the printer device (e.g. /dev/usb/lp0) and write data to it.
> 2) Open a pipe to the printer spooler (e.g. lpr -P queuename)
>    and then write the job data and close the connection.

Thanks for clearing this up.

> By a POS printer, I take that to mean a 40 col receipt printer sort of
> thing.  These are basic devices which are basically ASCII thermal
> printers plus some additional control codes and possibly some extra
> bitmap raster graphics mode.  For these you just send the control
> codes inline with the text you're printing to either (1) or (2) above.
> Your program is entirely responsible for the formatting, layout and
> cutting etc.

yes, that's pretty much what I mean. What do I use to do layout and
formatting before dumping to the printer?

Where would I find information on the extra control codes? I'm sure not
all printer manufactureres publish this sort of thing. How does that
work with CUPS?


> For the work I do, I send jobs to a receipt printer via CUPS.  After
> completion of a transaction, the receipt gets printed after a barely
> noticeable delay (< 0.5s).
> 
> 
> Your best bet is to use a spooler.  This also makes networked
> operation totally transparent, and is far more flexible.  You can use
> libcups, lpc or lpstat etc. to get a list of all available printers if
> the user needs to choose one.

Ok, so I probably will use a print spooler (CUPS), what do I need to do?
I'll look at the CUPS docs, but some fast direct pointers are nice.

Thanks in advance.


-- 
 .''`.      Carl B. Constantine
: :' :     duckwing duckwing ca
`. `'    GnuPG: 135F FC30 7A02 B0EB 61DB  34E3 3AF1 DC6C 9F7A 3FF8
  `-  Debian GNU/Linux -- The power of freedom
  "Claiming that your operating system is the best in the world because more
  people use it is like saying McDonalds makes the best food in the world."



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]