I have a couple of reports that are designed in landscape mode which work fine when previewing and printing via the VB6 Crystal control.
I was recently asked to allow the printer to be changed so added code to enumerate the printers, and set the control's PrinterDriver
, PrinterName
and PrinterPort
properties.
While this works well for the portrait reports, specifying anything other than the default printer causes the report viewer to force the report into the default orientation for the selected printer.
Setting Printer.Orientation
to vbPRORLandscape
has no effect on crystal as it uses its own printing surface.
The Crystal viewer also has no way to specify an orientation (it's set to landscape in the designer)
Microsoft KB198901 has sample code to change the default orientation (after changing to use PRINTER_ACCESS_USE
) but this effects anything else that would access that printer until it's changed back again.
Is there any way to print to a specific printer AND keep the report's landscape orientation without temporarily changing the printer's system wide configuration to landscape for the duration of the control's use?
The reports are designed in Crystal 4.6 and is printed by the Crystal 8.0 viewer control.