When i call this procedure to print a bitmap loaded from a file(the bitmap is a desktop capture 1280x1024) the printed picture is much much smaller!(about 240x190)
a sample output(print to pdf):
Output Sample
any ideas ?Code:void PrintBitmap() { CPrintDialog printDlg(FALSE); printDlg.GetDefaults(); CDC dc; dc.Attach(printDlg.GetPrinterDC()); // Initialise print document details DOCINFO di; ::ZeroMemory (&di, sizeof (DOCINFO)); di.cbSize = sizeof (DOCINFO); BOOL bPrintingOK = dc.StartDoc(&di); // Begin a new print job dc.StartPage(); // begin new page // Get the bitmap from disk CBitmap bitmap; bitmap.Attach(::LoadImage( ::GetModuleHandle(NULL), "C:\\temp1.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION | LR_DEFAULTSIZE)); CDC memDC; memDC.CreateCompatibleDC(&dc); CBitmap *pBmp = memDC.SelectObject(&bitmap); BITMAP bm; bitmap.GetBitmap(&bm); // for width and height // copy to printDC dc.BitBlt(0, 0, bm.bmWidth, bm.bmHeight, &memDC, 0, 0, SRCCOPY); memDC.SelectObject(pBmp); if (bPrintingOK) dc.EndDoc(); // end a print job else dc.AbortDoc(); // abort job. }![]()




Reply With Quote