[lazarus] Printers unit

Tony Maro tony at maro.net
Tue Nov 5 01:30:22 EST 2002

I've got a basic working printers unit.

I've tried to make it as ready for real printer support as possible. 
What I've done is added a TPostScriptCanvas object that handles most of
the Postscript work - not that there's a lot to do.  Unfortunately part
of it must be handled at the Printer object level (page separation, etc)
so I can't encapsulate all of the postscript generation in that object.

The plan is to have anything that I can't handle in postscript code to
pass through to a regular TCanvas object that holds a bitmap.  Then,
once I figure out how... I can encapsulate the remaining graphics from
the bitmap into the postscript code.  So, any paint or drawing routines
the user calls that doesn't directly translate to postscript can still
be used.

Attached is the printers.pas unit and a sample application for testing
purposes.  I have no font support in it yet, and the only things that
work on the canvas are moveto, lineto and TextOut.

I wouldn't bother adding this to the LCL just yet... but I wanted
feedback to see if anyone thinks I'm headed down the wrong path with
this.  If I get a green light I'll delve into it deeper.

My questions are these: 

What is the proper way to tell the Printer object to print to file using

How can I (in Linux) stream the stringlist holding the postscript into
LPR directly?  Or must I go through a temp file?

Another thing I need to do is query lpstat to find out what printers are
available.  How can I best issue the shell command and grab the output? 
I know I could output it to a temp file, read that file then delete it. 
Is there a better way?

Tony Maro
tony at maro.net

A serious problem has been detected in your Windows operating system! 
Please insert Linux-Mandrake Installation CD and click REBOOT to resolve
this problem.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gz00001.gz
Type: application/octet-stream
Size: 6325 bytes
Desc: "printer.tgz"
Url : http://localhost/pipermail/lazarus/attachments/20021105/26fa3227/gz00001.obj

More information about the Lazarus mailing list