Solved

Changing Printer orientation

Posted on 1997-03-24
4
491 Views
Last Modified: 2006-11-17
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
Comment
Question by:jbeane
  • 3
4 Comments
 

Author Comment

by:jbeane
ID: 1162433
Edited text of question
0
 

Author Comment

by:jbeane
ID: 1162434
Adjusted points to 100
0
 
LVL 4

Accepted Solution

by:
marko020397 earned 100 total points
ID: 1162435
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
 

Author Comment

by:jbeane
ID: 1162436
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
maze travler 6 55
Best book to learn C++ 4 80
c++ using a LPCOLESTR * and adding a string varaible to the Pointer 2 61
Copy output image from TWindowsMediaPlayer 6 43
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question