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

Re: [OT] Printing hardcopy from an application



David wrote:
I know this has nothing to do with Debian, but, really, I don't know
exactly where to ask this question anyway.

I have a program for my personal use,  written in C. It's a
records-keeping application.  So far, for my hardcopy, I simply fopen
/dev/lp0 and talk straight to the printer.  My output is just a few
reports, all with a tabular output, and about the only printer
manipulations I need is to change the character size in an instance or
two.  For some level of versatility, I store the code definitions for
the fontsize and whatever else in a configuration file.  This has
worked rather well, but I'd like now to make it "neater".  I'd like to
let the program do a generic output and let the Linux drivers handle the
details, but I'm not sure as to the best method to accomplish this.
I've examined several real applications and googled the best I know how,
but haven't come up with anything definitive.

The solution I've come up with is to rely upon Latex.  That is, generate
the output text, insert any tex formatting and send this to a temporary
file, let "dvips" convert to postscript and pipe this to "lp" or "lpr".

Could someone indicate whether this is reasonable, or is there a more
straightforward approach?  At this time, I cannot think of one...
Again, I realize that this is entirely off-topic, but any hints would be
appreciated.



I use Qt from Trolltech for that sort of stuff. Granted that means C++. If that is no problem, everything becomes easier because you use its classes for everything, including printing. What I do is mostly graphics, so maybe that changes things. Anyway I have an example:

http://esquipulas.homeunix.com/index.php?p=46

If the server is up that shows you what I do with Qt and then you print it using its classes, giving you a .ps file, shown there too, or going straight to the printer.

HTH

Hugo



Reply to: