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. Getting Page Size and then Printing Text.

Getting Page Size and then Printing Text.

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

    Hey all, I am trying to get the page size of the page and then printing certain words on the page. This is what I have so far. //// Create a printer DC CPrintDialog dlg(FALSE); CDC dc; #if 0 //Show print dialog. if (dlg.DoModal() == IDCANCEL) return; dc.Attach(dlg.GetPrinterDC()); #else //Don't show print dialog. PRINTDLG prtDlg; AfxGetApp()->GetPrinterDeviceDefaults(&prtDlg); //Should check for error. dlg.m_pd.hDevMode = prtDlg.hDevMode; dlg.m_pd.hDevNames = prtDlg.hDevNames; dc.Attach(dlg.CreatePrinterDC()); #endif dc.m_bPrinting = TRUE; //// Now use the DC. //Get the page size. dc.GetDeviceCaps(LOGPIXELSX/LOGPIXELSY); CRect printArea; printArea.SetRect(LOGPIXELSX/3, LOGPIXELSY/3, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES)); CString str("Delayed Entry"); dc.DrawText(str, printArea, DT_NOPREFIX | DT_WORDBREAK); It is printing, but not where I need it to print. Am I doing it wrong or is there something I am missing? Thanks

    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