Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Printer Orientation

Status
Not open for further replies.

michel392

Programmer
Dec 17, 2001
54
BR
Dear colleagues:

I want to send some data to the printer using the Landscape orientation. I use a program (with commands, not a Report form) to print the data.
Is there a direct command to change the printer orientation to Landscape, without opening any printer setup window on screen ? Also, after printing,I want to restore the printer orientation to Portrait mode.
Thanks,
michel392
 
Keyword Search "Landscape" in this forum and you'll find answers to similar to your question.

Peping
 
This will do it for you:
Code:
DO CHANGEORIENTATION WITH "C:\hours\reports\absenteeism.FRX", 2 && OR WHATEVER TRAY YOU WANT

FUNCTION CHANGEORIENTATION
LPARAMETER lcFRX, lnOrient
LOCAL lcNewExpr, lnStartCopiesLine, lcStartAtCopiesLine, lnEndCopiesLine,lnLenCopiesLine, lcTop, lcBottom
#DEFINE vfCRLF CHR(13) + CHR(10)

IF !(UPPER(RIGHT(lcFRX, 4)) = ".FRX")
    lcFRX = lcFRX + ".FRX"
ENDIF
USE (lcFRX)
LOCATE FOR objType = 1 AND objCode = 53

IF EMPTY(EXPR)

    lcNewExpr = "ORIENTATION=" + ALLT(STR(lnTray)) + vfCRLF
ELSE

    lnStartCopiesLine = ATC("ORIENTATION", EXPR)
    lcStartAtCopiesLine = SUBSTR(EXPR, lnStartCopiesLine)
    lnEndCopiesLine = ATC(vfCRLF, lcStartAtCopiesLine)
    lnLenCopiesLine = LEN(SUBSTR(lcStartAtCopiesLine, 1, lnEndCopiesLine))
    lcTop = SUBSTR(EXPR, 1, lnStartCopiesLine - 1)
    lcBottom = SUBSTR(EXPR, (LEN(lcTop) + lnLenCopiesLine))
    lcNewExpr  = lcTop + "ORIENTATION=" + ALLT(STR(lnOrient)) + lcBottom

ENDIF

REPLACE EXPR WITH lcNewExpr
USE IN (lcFRX)
ENDFUNC
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
HI michel,

I understand, you want to set the printer to landscape by code and not use report form or preview prompt.

Method 1:
*********
YOu can create through the windows system.. Printer Folder.. Add Printer... and setup VFPLscapePrinter(Landscape Printer) and another VFPptPrinter (Portrait Printer) for the printer that is used on the system.
Set up these printers for Landscape or Portrait as the default printign mode.

In your prg code...
SET PRINTER TO VFPLscapePrinter
code.. to ptint your reports..

or SET PRINTER TO VFPptPrinter
code to output your report...

This way, the windows default printer is not changed. But the VFP scessions, default printer is only changed. YOu can set that back also to whatever you want.

The advantage is that, any printer you change on a later date.. only needs a windows printer setup with the above names for printer. You dont have to change your application code.

Method 2:
*********
Look in your printer manual for the relevant escape code and send the escape code sequence.

Hope this helps you :) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top