Hello,
I am using the PDFCreator Active X controls and am trying to overlay two bitmap images on a pdf document with the top bitmap being transparent. I have tried making the bitmap itself transparent but the background still is covering up the bottom bitmap. Is there a way to set the top bitmap as transparent with the PDF Creator so that the bottom bitmap can be seen?
Transparent bitmaps
If you only need one color transparent:
If you only need to have one color transparent (have all the black on your image be transparent instead), you can set the RGBMask property of the image. I create such an image in code like this:
//Create the object
CString csName = GetNextTickMarkName();
pView->PDF.CreateObject(CPDFCreactiveX::acObjectTypePicture, csName);
//Get a handle to the object
CacObject o = pView->PDF.GetObjectByName(csName);
//Move it into position:
o.put_Attribute("Left", COleVariant(lLeft));
o.put_Attribute("Top", COleVariant(lTop));
o.put_Attribute("Right", COleVariant(lRight));
o.put_Attribute("Bottom", COleVariant(lBottom));
//Load the image:
o.put_Attribute("FileName", COleVariant(csTemp));
//Make white be transparent (color is in ARGB format):
o.put_Attribute("RGBMask", COleVariant((long)0x00ffffff));
//And make sure the image is redrawn with the new mask:
pView->PDF.RedrawRect(lLeft, lTop, lRight, lBottom);
Works for me.
Ben Dilts
//Create the object
CString csName = GetNextTickMarkName();
pView->PDF.CreateObject(CPDFCreactiveX::acObjectTypePicture, csName);
//Get a handle to the object
CacObject o = pView->PDF.GetObjectByName(csName);
//Move it into position:
o.put_Attribute("Left", COleVariant(lLeft));
o.put_Attribute("Top", COleVariant(lTop));
o.put_Attribute("Right", COleVariant(lRight));
o.put_Attribute("Bottom", COleVariant(lBottom));
//Load the image:
o.put_Attribute("FileName", COleVariant(csTemp));
//Make white be transparent (color is in ARGB format):
o.put_Attribute("RGBMask", COleVariant((long)0x00ffffff));
//And make sure the image is redrawn with the new mask:
pView->PDF.RedrawRect(lLeft, lTop, lRight, lBottom);
Works for me.
Ben Dilts