hi IdeasVacuum ,
i found this PB Code , i think it was from SROD ?
its nice and short amount of Code !
it will Print Portrait then Landscape
Code: Select all
STDPrinterName$ = Space(260)
GetPrivateProfileString_("WINDOWS","DEVICE","", @STDPrintername$, 260, "Win.Ini")
STDPrintername$ = StringField(STDPrintername$, 1,",")
PrinterHandle.l = 0
OpenPrinter_(StdPrintername$,@PrinterHandle.l,0)
t1 = DocumentProperties_(0,printerHandle, printerName$, 0,0, 0)
*dm.DEVMODE = AllocateMemory(t1)
If *dm
DocumentProperties_(0,printerHandle, StdPrintername$, *dm, 0, #DM_OUT_BUFFER)
ClosePrinter_(PrinterHandle)
*dm\dmOrientation = 2; Landscape.
PrinterDC.l = CreateDC_("WINSPOOL",StdPrintername$,0,0)
DocInf.DOCINFO
DocInf\cbSize = SizeOf(DOCINFO)
DocInf\lpszDocName = @"Portrait to Landcsape"
DocInf\lpszOutput = #Null
If StartDoc_(PrinterDC,@DocInf) > 0
If StartPage_(PrinterDC) > 0
TextOut_(PrinterDC,300,0,"Tally bally ho (portrait!)",26)
EndPage_(PrinterDC)
EndIf
ResetDC_(PrinterDC, *dm) ;Switch to landscape.
If StartPage_(PrinterDC) > 0
;~~~~~TextOut hdc, CurrentX, CurrentY, Txt, Len(Txt)
TextOut_(PrinterDC,300,0,"Tally bally ho (landscape!)",27)
EndPage_(PrinterDC)
EndIf
EndDoc_(PrinterDC)
EndIf
FreeMemory(*dm)
Else
ClosePrinter_(PrinterHandle)
EndIf
here's 1 problem i found out with the above Code :
suppose i have "previously" set Printer to Landscape with another Program
then both Pages will Print out as Landscape (instead of first one at Portrait and second one at Landscape)
How can i reset or set Printer to initially Print in Portrait mode
regardless if any other Program or any other part of my Program has let the User Print something in Landscape ???
or how can i set the Printer back to Portrait mode when User exits my Program ??
.... preferbly without calling or showing the PrintRequester Window's Dialog .