i have a problem printing layout windows into jpgs in batchmode.
First i open a wor.
Then i want to print the Layout window into a jpg. (A3 format)
Save windows as
close wor
open next wor
My problem is to determine if the layout is landscape or portrait.
The variables ( fltWinheight, fltWinwidth) always lead to the result
its landscape:
Does anybody know whats wrong?
Does anybody have an idea if theres abetter way?
I am using:
Mapinfo 7.8
Mapbasic 7.0
(can upgrade to 8.0)
Heres my code:
Run Application " ***.WOR"
If Not FrontWindow() Then
Note "open Layout"
Exit Sub
ElseIf WindowInfo(FrontWindow(),WIN_INFO_TYPE) <> WIN_LAYOUT Then
Note "Layout window must be Front"
Exit Sub
End If
ifrontwin = FrontWindow()
fltWinheight = WindowInfo(ifrontwin, WIN_INFO_HEIGHT)
fltWinwidth = WindowInfo(ifrontwin, WIN_INFO_WIDTH)
Print "fltWinheight "+ fltWinheight
print "fltWinwidth "+ fltWinwidth
'Now this does
If fltWinheight >fltWinwidth then
Save Window ifrontwin
As "***.jpg"
Type "JPEG"
Width 29.69 Units "cm"
Height 41.28 Units "cm"
Resolution 150
Else
Save Window ifrontwin
As "***.jpg"
Type "JPEG"
Width 41.28 Units "cm"
Height 29.69 Units "cm"
Resolution 150
End If
Thanks in Advance.
Hendrik
The WIN_INFO_HEIGHT and WIN_INFO_WIDTH give the dimensions of the
layout window, not the paper - which is what you want.
To work out if it's landscape or portrait, use
WindowInfo(iFrontWin, WIN_INFO_PRINTER_ORIENT)
which returns WIN_PRINTER_PORTRAIT (1) for portrait, and
WIN_PRINTER_LANDSCAPE (2) for landscape.
Tim Mashford.