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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Adjust paper size

Adjust paper size

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
2 Posts 2 Posters 1 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.
  • E Offline
    E Offline
    Erich Ruth
    wrote on last edited by
    #1

    I have this code

    BOOL CFormOptions::OnPreparePrinting(CPrintInfo* pInfo)
    {
    tagPDA pPrintDlg;
    AfxGetApp()->GetPrinterDeviceDefaults (&pPrintDlg);
    pInfo->m_pPD->m_pd.hDevMode = pPrintDlg.hDevMode;
    LPDEVMODE devMode = pInfo->m_pPD->GetDevMode();
    if (devMode)
    {
    if (m_legal)
    devMode->dmPaperSize = 45; // DMPAPER_10X11; // DMPAPER_LEGAL;
    else
    devMode->dmPaperSize = DMPAPER_LEGAL; // _LETTER

       devMode->dmPaperWidth = 2000;
    
    
       //devMode->dmPaperSize = DMPAPER\_10X11;
    
       GlobalUnlock(devMode);
    }
    	
    if ( pInfo->m\_bPreview )        // normal print preview
         return DoPreparePrinting(pInfo);
    
    return DoPreparePrinting(pInfo);
    

    }

    and I can adjust the paper size from letter to legal. But if I try to adjust the paper size to DMPAPER_10X11 or any other size, the software ignores it and just uses letter size. How can I adjust the paper size to be something like DMPAPER_10X11? I tried adjust the PaperWidth as well and that is ignored as well. So Im not sure what Im doing wrong. Any help, any direction any one can provide will be greatly appreciated.

    K 1 Reply Last reply
    0
    • E Erich Ruth

      I have this code

      BOOL CFormOptions::OnPreparePrinting(CPrintInfo* pInfo)
      {
      tagPDA pPrintDlg;
      AfxGetApp()->GetPrinterDeviceDefaults (&pPrintDlg);
      pInfo->m_pPD->m_pd.hDevMode = pPrintDlg.hDevMode;
      LPDEVMODE devMode = pInfo->m_pPD->GetDevMode();
      if (devMode)
      {
      if (m_legal)
      devMode->dmPaperSize = 45; // DMPAPER_10X11; // DMPAPER_LEGAL;
      else
      devMode->dmPaperSize = DMPAPER_LEGAL; // _LETTER

         devMode->dmPaperWidth = 2000;
      
      
         //devMode->dmPaperSize = DMPAPER\_10X11;
      
         GlobalUnlock(devMode);
      }
      	
      if ( pInfo->m\_bPreview )        // normal print preview
           return DoPreparePrinting(pInfo);
      
      return DoPreparePrinting(pInfo);
      

      }

      and I can adjust the paper size from letter to legal. But if I try to adjust the paper size to DMPAPER_10X11 or any other size, the software ignores it and just uses letter size. How can I adjust the paper size to be something like DMPAPER_10X11? I tried adjust the PaperWidth as well and that is ignored as well. So Im not sure what Im doing wrong. Any help, any direction any one can provide will be greatly appreciated.

      K Offline
      K Offline
      Kenneth Walters
      wrote on last edited by
      #2

      I think you might need to tell the devMode which fields are being initialized by setting the dmFields member example of setting landscape orientation:

      devMode->dmOrientation = DMORIENT_LANDSCAPE;
      devMode->dmFields |= DM_ORIENTATION;

      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