[lazarus] Printers unit
Michael Van Canneyt
michael.vancanneyt at wisa.be
Tue Nov 5 09:41:10 EST 2002
On 5 Nov 2002, andrew johnson wrote:
> On Tue, 2002-11-05 at 01:38, Tony Maro wrote:
> > 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.
> Are you certain? I was fairly sure that Postscript supported multiple
> pages from the same file... with %%Page
AFAIK the showpage command takes care of this.
%%PAGE is for structured documents, so Ghostview and other PSUtils
can 'see' the different pages.
> It's a start. Portions of this would be much easier on the interface
> side of things, but that would make things harder for Cross-Platform
> support. My Suggestion would be to write a third object. A TPostscript
> object encapsulating the Postscript calls. Not a translation, not
> anything. Pure Postscript calls. This way it would be easier later on to
> separate the Postscript code from your canvas and move it to the
> back-end of things.
I also think this is the way to go; I would put this object in the
FCL instead of the LCL, since it is OS-independent, and has nothing
visual about it.
If you can output the postscript to a stream, then everything should run
on any platform we support.
> > How can I (in Linux) stream the stringlist holding the postscript into
> > LPR directly? Or must I go through a temp file?
> I would suggest for now a temp file, but you could probably find a way
> to do it via stdin/stdout.
Use the TProcess object of the FCL:
With TProcess.Create(Self) do
With InputStream do
// Write postscript to stream.
There is a process.txt which describes the object. The object will work
As far as I know, lazarus uses this to call the compiler.
More information about the Lazarus