Solved

Changing Printer orientation

Posted on 1997-03-24
4
477 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now