Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Changing Printer Settings to ensure Landscape print [modified]

Changing Printer Settings to ensure Landscape print [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    maycockt
    wrote on last edited by
    #1

    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

    D I 2 Replies Last reply
    0
    • M maycockt

      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

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      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 the hDevNames member of the PRINTDLG 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

      1 Reply Last reply
      0
      • M maycockt

        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

        I Offline
        I Offline
        Intersect
        wrote on last edited by
        #3

        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...

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups