How to set the page orientation in MapBasic® when Save Image As output not in correct orientation

Products affected: MapInfo Professional®, MapInfo Pro™, MapBasic®
In MapBasic®, when using the "Save Window As" function to save an image of a layout in the Layout Designer, you may notice that the resulting image output is being cut off at the side (typically the right hand side).

This may be due to the Page Setup and orientation. For example, in your MapBasic® application you may have scripted the creation of the layout but not specified the Orientation of the page which is configured in the Printer Drivers settings. It may be set to Portrait and obscuring the output of the image.

The following line of code will set the page orientation to Landscape (example used is for MapInfo Pro™ v16 64-bit):
Set Window FrontWindow() Printer Name "MapInfo PDF Printer Version 16.0 x64" Orientation Landscape

UPDATED:  July 21, 2020