Link to home
Start Free TrialLog in
Avatar of Chuckbuchan
Chuckbuchan

asked on

customizing fonts in Dbase/Clipper

I would like to know how to choose font sizes when printing using Dbase code compiled with Clipper in DOS environment.

 thanks
ASKER CERTIFIED SOLUTION
Avatar of JesterToo
JesterToo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You have to know the Printer you will print to and the Control Code sequences to send to that printer which allows you to send numerous combinations where you can change fonts, change the pitch, do subscript, superscript, bolding, change page orientation from portrait to landscape and back, etc.

One example of an Escape code sequence to produce landscape orientation on standard HP PCL printers:

SET PRINT ON
?? CHR(27)+"&l1O"      &&  OR @ 0,0 SAY CHR(27)+"&l1O"
SET PRINT OFF

To set it back to portrait mode:

SET PRINT ON
?? CHR(27)+"&l0O"
SET PRINT OFF

Here is a pretty extensive link to HP PCL Commands:

HP LaserJet Series Printers - PCL Commands, Basic Page Formatting, and Font Selecti
http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=bpl02705

Obvious or not, if you have different printers and they don't support Hp PCL escape commands, you will have to hunt down similar codes specific to those printers at the printer manufacturer's web site.
Avatar of Chuckbuchan
Chuckbuchan

ASKER

- AS far as I understood, clipper program depends on the Print device you are using, that means the commands may change from one type of printer to another.
- I noticed also you used chr(27) +
could you tell me what that means? does it have to be in front of every printing command?


Let's say I want the following sentence to be printed  in courrier type, font size 14, bold, Italic, and printed out in a landscape form.


" This is a font test"


thank you
CHR(27) is the equivalient of Escape (Esc).  That is why they call these the Escape commands.

Many non-HP printers still seem to support the HP PCL escape commands in their printer emulation mode.  But, there is no guarantee which printers have that and how compatible they are if they do.  You would have to check the non-HP printers you want to use.  Before laser printers came along, dot matrix printers were in wide use and Epson had the de facto standard for printer control commands.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In additon to the PCL command sets (there are more than one... PCL4, PCL5, PCL6, etc) there was/is also a couple of other polular printer command languages... Epson (again, multiple models) and IBM Proprinter.  Less common (except in the business environment) is the Xerox command language.  Many printers are capabile of emulating multiple command languages, often being able to do it "on the fly" such that they can be mixed within the same document being printed.

DOS apps (run from within a Windows Command window) will write their output to the PRN (lpt1) logical device by default.  They do not use the "Windows default printer" setting.  Instead, you need to issue the "NET USE  lpt1 \\server\printername /persistent:yes" command at the command prompt (one time... windows will retain the setting until you change it).

You can also specify more LPTx mappings so that multiple printers can be defined on multiple ports.  This gives you a bit more flexibility since you can "set printer to lptx" where x is 1, 2, or 3.  Even though Windows supports more lpt ports I don't think Clipper recognizes any above 3.

However, I always wrote my Clipper apps to capture the print commands to a file as the reports were being produced.  Then, when the "report" was totally built I simply copied the file to the printer.  In a network environment this avoids the posibility of the print queue "timing out" due to long pauses in the app as it finds/builds the next piece of data to be printed and causing the printer to produce incomplete pages (with the possibility of other user's output interspersed between the pages of your own report).  Also, you can archive the file if desired and use it to print more copies, or partial copies, if needed.

Another possibility I've seen used is to simulate how Windows programs deal with printing... instead of using actual printer codes make up a set of "pseudo" codes for each of the real codes shared by any of the printers you're targeting.  Capture the report data with the pseudo codes to a file.  Then, instead of a simple "copy file to prn" (or any of its equivalents) process the file through another program that finds each pseudo code and substitutes the correct "real" code for whichever printer the user chooses (from a menu) and print the line normally.

Finally, you can avoid the entire problem with DOS printing in Windows environment by switching from Clipper to a Win32 equivalent compiler such as xHarbour ( free from http://www.xharbour.org/ ).

HTH,
Lynn
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
BTW. With my suggestion, you will need Windows to print them (with Internet Explorer or Worpad applications, respectively)
though you said somewhere above that:
- CHR(27) is the equivalient of Escape (Esc), but Ijust wonder what 's the  functionality of it.
- As for Clipper programmer, are the last version fo Clipper has web application capability? and is it a client/server application?  I know that foxpro uses DBase/Clipper language, but I don't know which of them(Clipper Or Foxpro) is more powerfull in the modern world.


The escape part is just a trigger to the printer to tell the printer what follows are specific instructions.

I personally use Visual FoxPro 9 at this moment.  This particular version was released in December of 2004 and is really a nice piece of work.  I currently am using what is called Web Connection to do web work on the cheap where I can query .dbf data right on a live server to actively populate web page requests.

Visual FoxPro Home Page
http://msdn.microsoft.com/vfoxpro/

Microsoft® Visual FoxPro 9.0 Professional (from FoxToolBox.com)
http://www.foxtoolbox.com/itemgroup.dbx?sku=340-01230

West Wind Web Connection
http://www.west-wind.com/

Web Connection
http://www.west-wind.com/webconnection/

Internet enabling Visual FoxPro applications
http://www.west-wind.com/presentations/internetenabling/InternetEnabling.htm