Changing Printer Settings to ensure Landscape print [modified]
-
Hi, My application requires printing of data on different printers. Is it possible to ensure that after a printer has been chosen (that may not be the default printer), the print layout is in Landscape mode? I have looked at examples from MSDN, mfcdvmdvcnet.exe (I can't remember the Q number), but that seems oriented to using the default printer, whereas I want to ensure that after printer selection the print format is landscape using the DEVMODE structure. EDITTED TO ADD - is there also anyway to detect the name of the chosen printer after it has been selected if it is not the default printer? EDITTED TO CLARIFY - I have two printers, printer1 - the default A4 printer, and printer2 - my A3 printer. When I print I want to select printer2 and set it to be Landscape. How do I, using EnumPrinters or an alternative, get the name of the now selected printer, printer2, and change the DEVMODE to ensure that Landscape is used? If anyone has a pointer to some code, or an article, that would be great. TIA Tony
modified on Wednesday, April 14, 2010 6:06 AM
-
Hi, My application requires printing of data on different printers. Is it possible to ensure that after a printer has been chosen (that may not be the default printer), the print layout is in Landscape mode? I have looked at examples from MSDN, mfcdvmdvcnet.exe (I can't remember the Q number), but that seems oriented to using the default printer, whereas I want to ensure that after printer selection the print format is landscape using the DEVMODE structure. EDITTED TO ADD - is there also anyway to detect the name of the chosen printer after it has been selected if it is not the default printer? EDITTED TO CLARIFY - I have two printers, printer1 - the default A4 printer, and printer2 - my A3 printer. When I print I want to select printer2 and set it to be Landscape. How do I, using EnumPrinters or an alternative, get the name of the now selected printer, printer2, and change the DEVMODE to ensure that Landscape is used? If anyone has a pointer to some code, or an article, that would be great. TIA Tony
modified on Wednesday, April 14, 2010 6:06 AM
maycockt wrote:
EDITTED TO ADD - is there also anyway to detect the name of the chosen printer after it has been selected if it is not the default printer?
Are you using
PrintDlg()
for this? If so, look at thehDevNames
member of thePRINTDLG
structure."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
-
Hi, My application requires printing of data on different printers. Is it possible to ensure that after a printer has been chosen (that may not be the default printer), the print layout is in Landscape mode? I have looked at examples from MSDN, mfcdvmdvcnet.exe (I can't remember the Q number), but that seems oriented to using the default printer, whereas I want to ensure that after printer selection the print format is landscape using the DEVMODE structure. EDITTED TO ADD - is there also anyway to detect the name of the chosen printer after it has been selected if it is not the default printer? EDITTED TO CLARIFY - I have two printers, printer1 - the default A4 printer, and printer2 - my A3 printer. When I print I want to select printer2 and set it to be Landscape. How do I, using EnumPrinters or an alternative, get the name of the now selected printer, printer2, and change the DEVMODE to ensure that Landscape is used? If anyone has a pointer to some code, or an article, that would be great. TIA Tony
modified on Wednesday, April 14, 2010 6:06 AM
This might help you I guess : void CYourApp::SetupDefaultPrinter() { UpdatePrinterSelection(FALSE); if (m_hDevMode == NULL) DEVMODE* pDevMode = (LPDEVMODE)::GlobalLock(m_hDevMode); if(pDevMode) { pDevMode->dmFields |= DM_ORIENTATION; pDevMode->dmOrientation = DMORIENT_LANDSCAPE ::GlobalUnlock(m_hDevMode); } } Njoy...