[Sugar-devel] Print Support proposal (need input) Beta

Albert Cahalan acahalan at gmail.com
Fri Mar 20 06:46:42 EDT 2009


2009/3/19 Benjamin M. Schwartz <bmschwar at fas.harvard.edu>:

> Specifically, there are at least 3 different use cases you may choose to
> support:
>
> 1. USB printer connected directly to the Sugar machine.

This is likely, even in a classroom environment. The printer
may sit next to the teacher, who gives approval to connect.
Students show their work to the teacher, get approval, plug
in the cable, and print. Plugging in the cable might prompt
the user for printing, either to select things or to confirm jobs
that are already queued.

> 2. Networked printer, no server. Sugar prints directly over the network.

This is somewhat likely. It's very simple. You can get a tiny
box that will convert any printer into a network printer.
Networked printers tend to be reliable and cheap when you
don't ignore server costs.

> 3. All printing passes through a server.
>   a. networked printer with restricted access
>   b. USB printer connected directly the server
>      and also
>   1. the server may print every submission immediately
>   2. apply automatic quotas, or
>   3. require manual approval

This is getting complicated. Real IT support will be needed.
The server, including all the extra cabling, is a failure point.
Usability drops; now one must boot the server and muck with
the permissions.

> I think you should focus on #3 and ignore #1 and #2.  I say this because
> #3 does not require CUPS, or _any_ printing stuff, in Sugar.  You don't
> even need to include the "print to PDF" functionality in Sugar.  All you
> need to do is send the file you want to print to the server, over the
> network.  The server (running CUPS) can take the file (png for Paint, jpg
> for Record, odt for Write) and convert it to postscript for printing.

Lots of useful software prints roughly like so:

fp=fopen("/tmp/4wiP9r.ps","w");
fwrite(printout,1,nbytes,fp);
fclose(fp);
system("lpr /tmp/4wiP9r.ps");

Sometimes PDF is used instead of PS. Sometimes popen() is used
instead of a tmp file. Sometimes lp is run instead of lpr.
Sometimes bare system calls (open,write,close,pipe,execve) are
used instead of stdio.

For example, Tux Paint normally sends PS into popen("lpr").

CUPS is among the many ways to support this. It's certainly
not the only game in town.


More information about the Sugar-devel mailing list