Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

How to print LANDSCAPE? (without Report Form)Helpful Member!(2) 

dbMark (Programmer) (OP)
29 Apr 04 14:09
I've just tried running a custom landscape report in dBase 5 for DOS which I created with lots of custom loops, ifs, dos, etc.  So this time I did not use CREATE REPORT, MODIFY REPORT, or REPORT FORM.  All the printer codes worked except landscape!  Even if the only printer code command I give is the one shown below without any other printer codes, it still fails to print landscape.   When I went back to my code library, I noticed that all of my prior reports ran landscape successfully but I had always used REPORT FORM.  Since I can't use a report form in this case, is there something I'm missing?  Why will REPORT FORM do it but not my hand-written custom code using simple "?" and "??" commands (no "@ SAY")?  Here's what I've researched so far and I'll post more when and if I determine a successful landscape fix.

[b]??? CHR(27) + "&l#O"[b]  && traditional landscape command

(I also tried using ?? instead of ???.  No differnece.)

Page Orientation Code # where:
0 = Portrait
1 = Landscape
2 = Reverse Portrait
3 = Reverse Landscape

Additional references I found:
Thread290-247779
Thread290-2358
Thread697-676105 must put different families of printer codes in separate Esc sequences
Thread697-677170 HP doc: can fail in mixed OS environment
1oldfoxman (IS/IT--Management)
29 Apr 04 14:44
Is the text wrapping or just truncating in your output?  If the _wrap system variable = .T. and _rmargin = 80 (the default) then I think your output would wrap at column 80.  I'm looking at dBaseIV, not 5 ,but suspect the system variables are still applicable.  

Maybe I'm being too simplistic.

hth. Dennis
Helpful Member!  dbMark (Programmer) (OP)
29 Apr 04 16:28
When I print (using HP LaserJet printers) the text does not wrap.  I can set the other printer codes and I see them modify the text appropriately.  I'm not talking about size, wrapping or fonts, just page orientation.  It's just that LANDSCAPE doesn't do a thing, even by itself.  I'm mystified why it will work for REPORT FORM on the same printers but not in other code.  

??? CHR(27) + "&l#O"  && traditional landscape command

I already know not to concatenate this printer code with other types of printer codes.  They have "families" and so I usually precede each family with its own Esc code.  So when I tested it, I commented out all other printer codes and it still failed.

Is this Microsoft telling me to hurry up already and convert it to OOP?  The language is "only" 9 years old!
dbMark (Programmer) (OP)
29 Apr 04 19:04
I noticed another unexpected issue, and it's with the same "family group" of printer codes (Esc+&l...) where I'm trying to control the line spacing.  It prints about 6.5 LPI but I'm trying for 8 LPI.  I'm going home and maybe tommorow I can think straight.

??? CHR(27) + "&l8D"  && traditional landscape command

dbMark
dbMark (Programmer) (OP)
30 Apr 04 10:59
After a good night's sleep, I concluded that the real issue was that the "REPORT FORM myReport TO PRINT" command was handling and sending the text output to the printer differently than my manual method.

A quick test proved successful.  I had been mixing in the use of ? and ?? but actually in order for landscape and line spacing to remain set to my custom settings, I must use ??? in all printing.  So now I'll remember that in order for all of the printer codes to remain in effect, I cannot use ? or ?? but instead must consistently use ??? when sending output to the printer.

Why did some printer settings (the ones in the "&l" PCL group) reset back to default when others didn't?  Yet another of life's unknowns.

dbMark
Helpful Member!  tviman (Programmer)
30 Apr 04 11:48
dbMark - been there, done that, and drank a lot figuring it all out!!!  Assuming an HP Laser Printer, the proper code for landscape printing is:

Esc + "&l1O"

an explanation:

Esc - the necessary escape code
&   - signifies start of control sequence
l   - lower case L
1   - signifies landscape orientation
O   - Upper case O - signifies end of escape code

Personally, I use the following:

chr(027)+chr(038)+chr(108)+chr(049)+chr(079)

Also, it's best to set up your page codes in a logical manner.  I start by sending a reset command followed by page orientation, anything to do with font type, size, color, and orientation, and then line spacing.  I also use @,say commands to issue the codes.  Why?  Don't know really - I guess it's because that's the way I've always done it.

If you don't already have a copy of HP's PCL codes, you can download a PDF from their site.

Hope this helps....  

There's always a better way.  The fun is trying to find it!

dbMark (Programmer) (OP)
3 May 04 10:53
I also determined that I could not set both landscape and line spacing in the same sequence and have both work on my HP LaserJets.  This group or family of PCL codes is very finicky.  I had to separate them so each had their own Esc code.

??? CHR(27)+"&l1O"+CHR(27)+"&l8D"  && landscape and 8 LPI
new2db (TechnicalUser)
10 Jun 04 11:19
I am also having the same problem printing to landscape using DB III Plus.  I am not to familiar with dBASE, but have picked a lot up in the last week.  I am able to print at least one report in Landscape, but if I exit the application and come back later to print the report again, it defaults back to printing in Portrait.
I've set dBASE up on WINXP using an HP Laserjet 5.
I used the codes posted by tviman.
Main question being, how do I get dbase to keep the landscape as the default.
dbMark (Programmer) (OP)
10 Jun 04 11:53
I don't know if your printer has a setting to make landscape its default orientation.  Either check your printer manual or search/ask on a printers forum such as Forum697

I'd recommend resetting the printer before every print job.

??? CHR(27)+"E"

Then set the page orientation.

??? CHR(27)+"&l1O"

You can also set other printer codes but be forewarned that some settings may void the landscape setting if not sent to the printer exactly right.
new2db (TechnicalUser)
10 Jun 04 15:05
Thank you for the quick response.  I apologize for not considering mentioning that I have the default for the printer set to Landscape.
I was hoping to avoid having to retype the code in prior to every report, due to the fact that I am just setting this up for the Primary user (Data Entry) and I am trying to ensure that the menu.prg is extremely friendly. (I do not have any of the source code)
All the Posts for this thread have been extremely helpful and have allowed me to get further than I thought, thank once again.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close