Link to home
Start Free TrialLog in
Avatar of philsmicronet
philsmicronetFlag for Australia

asked on

Printing Bitmaps

I have a xerox postscript laser. I am using the Loading a bitmap using the NViewLib functions that have been recommended before at this site. When I try to print them, I am not getting any output.

The following code is used
                                        lpProc=GetProcAddress(hLib "NViewLibLoad);
hBitmap = (HBITMAP)lpProc("BitMap.bmp", FALSE);
GetObject(hBitmap, sizeof(BITMAP),&bitmap);
hDCMemory = CreateCompatibleDC(hPrinterDC);
hOldBitmap = SelectObject(hDCMemory,hBitmap);               StretchBlt(hPrinterDC, X, Y, l, h, hDCMemory, 0, 0, bitmap.bmWidth, bitmap.bmHeight, SRCCOPY);

SelectObject(hDCMemory,hOldBitmap);
DeleteObject(hBitmap);               DeleteDC(hDCMemory);
Avatar of pjknibbs
pjknibbs

I'm not familiar with the NViewLib stuff, but personally I'd load the bitmap file directly as a device-independent bitmap, then call StretchDIBits() to print it. Having come across printer drivers which claimed to support certain functions but manifestly didn't, I think this is probably the safest way to go.
What's your bitmap's width and height? Please notice the printer DC has much higher resolution than the normal window DC. So if you destination bitmap on printer DC is too large, it may be failed in the StretchBlt function for insuffient memory to create the bitmap.
Avatar of philsmicronet

ASKER

How do I make it a device independent bitmap. The nviewlib stuff just loads any type of picture from a file (gif, jpg, bmp, dib). You get a handle to it.

How can I use StretchDIBits()
If the file on disk is a BMP, it's already a device-independent bitmap. If it's some other format, you'd have to convert it yourself. I assumed you were using BMPs--if I was wrong, I apologise.
ASKER CERTIFIED SOLUTION
Avatar of chensu
chensu
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial