1
votes

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.

1
I'd be interested in a better answer than "cache the settings and restore after use" myself. However I believe these settings are stored and used at the print spooler level, which is global (one set per printer for the entire PC). I'd be glad to be shown this is incorrect though!Bob77

1 Answers

0
votes

I guess you are setting CRAXDRT.Report's PrinterDriver, PrinterName and PrinterPort properties. The same object has PaperSize and PaperOrientation properties. Did you try to set them ?