AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

1998.10.26 00:00 "PRB W95 VC MFC: printing TIFFs using StretchBlt or StretchDIBits.", by Daniel Luna
1998.10.26 14:40 "RE: PRB W95 VC MFC: printing TIFFs using StretchBlt or StretchDIB its.", by Geoff Vandegrift
1998.10.26 16:14 "printing TIFFs using StretchBlt or StretchDIB", by Dan Tatut

1998.10.26 14:40 "RE: PRB W95 VC MFC: printing TIFFs using StretchBlt or StretchDIB its.", by Geoff Vandegrift

Printing raster in Windows tends to be problematic. To find out what that error code means try the following code (taken from the online help):

    LPVOID lpMsgBuf;

    FormatMessage( 
        FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
        NULL,
        GetLastError(),
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
        (LPTSTR) &lpMsgBuf,
        0,
        NULL 
    );

    // Display the string.
    MessageBox( NULL, lpMsgBuf, "GetLastError", MB_OK|MB_ICONINFORMATION
);

    // Free the buffer.
    LocalFree( lpMsgBuf );

In my experience, a failed return from any of the Windows BitBlt related routines is not necessarily a failure. My habit is to always check return codes, and I had to remove the code that was checking returns from my BitBlt calls. It appeared that everything was going through okay, and the extended error information was useless.

Have you gotten reasonable output on any other printers? It is very possible that the drivers for those printers are not all that they should be: we had an HP in our office that couldn't handle masked blting.

Are you checking to see if the devices really support raster bitblts:

    if (!(dc.GetDeviceCaps(RASTERCAPS) & RC_BITBLT)) {
        // Device doesn't support raster bitblt
    }

I hope this helps a little. I would be very interested to hear how things go.

Geoff Vandegrift
Applications Engineer
Hitachi Software Global Technology, Ltd.