I need to print some vector data (or to be more exact: some dots and polylines) using Linux. When I ask Google for that it shows me many tutorials and documentations – but all for end users, no programming examples.
So does anybody know a good programmers HOWTO/tutorial that shows printing under Linux?
Thanks!
CUPS doesn’t have its own document description API. It doesn’t need one: formats like PostScript, PDF, and JPEG are first-class citizens of CUPS. You use whatever program or API you like to create a such a file, and you then send it to CUPS (with
lpror with the CUPS API) and CUPS will transform it to the appropriate internal format and send it to the printer.So, for your case, you might use a vector graphics library like Cairo to author PostScript, and then you send that off to CUPS for printing. Here’s a simple C example:
Strictly you don’t need that temporary file: the CUPS API allows you to construct a stream and you can emit the page data into that (but a file is handy for debugging).