Hi Fafi
That's good but if you want more control over your printer (like graphics, controlling fonts) you'll need a more sophisticated approach.
If you have a postscript printer you might want something like this in cFilePrint:
- Code: Select all Expand view
%! sample postscript file
Helvetica-Bold findfont
12 scalefont
setfont
50 500 moveto
(This is an example) show
% draw a box
newpath
50 400 moveto
50 300 lineto
150 300 lineto
150 400 lineto
closepath
stroke
showpage
I need to output some pretty fancy forms amongst other things. I am hiding some of the ways postscript works that run counter to how we expect them in xBase such as:
postscript measures up from the bottom of the page
in postscript you put data on the stack which is then pulled off by operators as required. In xBase we would expect something like:
- Code: Select all Expand view
moveto( 50, 500 )
whereas in postscript you have:
- Code: Select all Expand view
50 500 moveto
Of course an xBase class can hide that so you can call:
- Code: Select all Expand view
oPostscriptDocument:moveto( 50, 500 )
which would add the corresponding moveto command to the postscript document being built.
In fact rather than use moveto and show you can define an "atsay" method so that you can code:
- Code: Select all Expand view
oPostscriptDocument:atSay( 500, 50, "Example" )
Interestingly you don't have to directly generate a moveto and a show, because you can define functions in postscript such as this:
- Code: Select all Expand view
/atsay @ (...) x y
{ moveto show } def
Also rather than have to work vertically from the bottom by setting a page height and top margin in the class instance you can work from the top down (in xBase), the object doing the coordinate conversions for you.
That's where I'm currently headed.
Regards
Doug
(xProgrammer)