New Forum | Previous | Next | (P-PDF) Developers
Topic: Bitmap Transparency and Adobe's Printer Driver
Conf: (P-PDF) Developers, Msg: 117748
Date: 8/24/2004 04:14 AM
Have any of you successfully used Adobe's PDF Windows printer driver to create PDF documents containing transparent bitmaps (such that only the foreground pixels of a photo are displayed/printed)? The following technique described below has worked for me for years when printing to a real printer using the Win32 GDI API but results in black background pixels when printing to a PDF file via Adobe's PDF Windows printer driver:
1. Create a DIB version of a photo (bitmapped) image.
2. Create a monochrome mask DIB of the same width and height such that the black pixels in the mask define which pixels in the photo are foreground pixels and the white pixels in the mask define which pixels in the photo are background pixels.
3. Clear the photo DIB's background pixels to black by bitwise AND'ing the photo DIB with the inverse of the mask DIB.
4. Clear the pixels in the printer DC that are to be replaced by the photo's foreground pixels by printing the monochrome mask DIB to the printer DC via StretchDIBits with a raster operation of SRCAND.
5. Finally, print just the photo's foreground pixels by sending the photo DIB to the printer DC via StretchDIBits with a raster operation of SRCOR.
(This is being done under Windows 2000 and Windows XP.)
Any help with this would be greatly appreciated.