Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 508
  • Last Modified:

Changing Printer orientation

Accessing a TPrinter object thru a TPrintDC object, I need to be able to change the printer orientation based on real-time information.  What command / function is it that allows this?  I believe I could get the the orientation using the GetDeviceCaps(DC_ORIENTATION) function, but I have no idea to get it!
0
jbeane
Asked:
jbeane
  • 3
1 Solution
 
jbeaneAuthor Commented:
Edited text of question
0
 
jbeaneAuthor Commented:
Adjusted points to 100
0
 
marko020397Commented:
Try this:

  TPrinter printer;
  TPrintDialog::TData *dlgData = &printer.GetSetup ();
  DEVMODE *dataIn = (DEVMODE *)dlgData->GetDevMode ();
  dataIn->dmFields |= DM_ORIENTATION;
  dataIn->dmOrientation = DMORIENT_LANDSCAPE;
  printer.Print (this, printout, TRUE);

0
 
jbeaneAuthor Commented:
My actual implementation was as follows:

DEVMODE *devMode = (DEVMODE *)Printer->GetSetup().GetDevMode();
devMode->dmOrientation = Orientation;

//Initialize Printer Dc
DC = new TPrintDC(      Printer->GetSetup().GetDriverName(),
      Printer->GetSetup().GetDeviceName(),
                Printer->GetSetup().GetOutputName(),
      devMode);


Thanks for the help
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now