Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 222965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:10:36+00:00 2026-05-11T19:10:36+00:00

When I print the CDC for a report control that I’ve created it appears

  • 0

When I print the CDC for a report control that I’ve created it appears tiny (less than 1 square inch on paper). How can I get the report to be printed to occupy the entire page ?
Or in other words, how can I make the entire report to appear in one printed page.


CPrintDialog printDialog(FALSE);
printDialog.DoModal();

CDC dcPrint;
if(dcPrint.Attach(printDialog.GetPrinterDC()))
{
    int iHorzRes = dcPrint.GetDeviceCaps(HORZRES);
    int iVertRes = dcPrint.GetDeviceCaps(VERTRES);

    int iHorzResCDC = m_CDC.GetDeviceCaps(HORZRES);
    int iVertResCDC = m_CDC.GetDeviceCaps(VERTRES);

    dcPrint.m_bPrinting = TRUE;
            dcPrint.BitBlt(0,0, iHorzRes, iVertRes, &m_CDC, iHorzResCDC, iVertResCDC, SRCCOPY);
    CFont* pOldFont = dcPrint.SelectObject(&m_HeaderFont);
    dcPrint.TextOut(0,0,"HelloWorld")       ;
    dcPrint.SelectObject(pOldFont);

    CPrintInfo printInfo;
    printInfo.m_rectDraw.SetRect(0,0, iHorzRes, iVertRes);
    dcPrint.StartDoc("Report Print");       
    dcPrint.StartPage();
    if(dcPrint.EndPage())
        dcPrint.EndDoc();
    else
        dcPrint.AbortDoc();     
}

dcPrint.DeleteDC();

m_CDC is the memory DC that I use to buffer and display the entire report on screen.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T19:10:36+00:00Added an answer on May 11, 2026 at 7:10 pm

    As others have said, this is because, in general, the display resolution of printers is a lot higher than displays. Displays are usually 96 to 120DPI: at 96DPI this means that an image of 96 pixels (dots) by 96 pixels occupies approximately 1 square inch on the display. However, if you just take that image and print it out on a 600DPI printer, the size of the image will be about 1/6″ by 1/6″ – much smaller. This is a bane of the publishing world – images that look fine on displays often look either tiny or terrible when printed.

    You could, as has been suggested, use StretchBlt rather than BitBlt to scale up your image. Depending on the difference between your display and printer, this will either look a bit blocky, or utterly hideously blocky.

    A much better option is to rewrite your code that does the drawing of the control so that you’ve got a method that takes a device context (and some co-ordinates) and draws into it. Your normal window painting code can pass the memory DC to this routine and then BitBlt the result to the window, and your painting code can call this method with the printer DC and some suitable co-ordinates.

    When writing this routine you’ll have to worry about scaling: for example, you’ll need to create fonts for the given device context, and with a scaling-indepdendant size (that is, specify the font size in points, not pixels), rather than relying on a pre-created font.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to print the first 10000 prime numbers. Can anyone give me the
Can i print out a url /admin/manage/products/add of a certain view in a template?
How can I elegantly print the date in RFC822 format in Perl?
When I print "\[\e[34m\]sometext" I get some text in blue, but can I specify
print OBJECT calls OBJECT.__str__() , then when OBJECT.__repr__() is called? I see that print
How do I print the html tag, including '<' and '>'? How can I
Print all 12 verses of the popular holiday song . By 12 verses I
The print functionality of Excel (using VBA) is extremely slow. I'm hoping someone has
Consider: print $foo, AAAAAAAA, $foo, BBBBBBBB; Let's say I want to use this code
When I try to print a string in a Windows console, sometimes I get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.