Page 1 of 1
Text Box Opacity
Posted: Wed Jan 13, 2021 4:50 pm
by AlexD
Hello,
• What is the way to set Opacity for a Text Box field?
I tried to get the Text Box IPXC_Annotation widget and then set Opacity value on Annotation Data, but it does not work.
• Is there a way to make a Text Box' text transparent? Annotation Data has FColor and SColor properties of IColor type, but the interface does not have any opacity settings.
Any code snippets in C# will be appreciated.
Thank you
Re: Text Box Opacity
Posted: Wed Jan 13, 2021 5:48 pm
by AlexD
There is another option to add text using IPXC_ContentCreator which allows to set opacity, but there is something strange with color displayed.
SetFillColorRGB accepts parameter of uint type.
The following is standard conversion from html color to uint:
Color color = System.Drawing.ColorTranslator.FromHtml("#FF0000");
uint uintColor = (uint)((color.A << 24) | (color.R << 16) |
(color.G <<

| (color.B << 0));
So CC.SetFillColorRGB(uintColor), where CC is IPXC_ContentCreator instance, should produce red fill color, but it the color is blue.
Any ideas?
Re: Text Box Opacity
Posted: Wed Jan 13, 2021 5:50 pm
by AlexD
(color.G << 8)
Re: Text Box Opacity
Posted: Thu Jan 14, 2021 10:21 am
by Sasha - PDF-XChange
Hello AlexD,
Check out the CoreAPIDemo project - it holds many samples:
https://github.com/tracker-software/PDF ... oreAPIDemo
Cheers,
Alex
Re: Text Box Opacity
Posted: Thu Jan 14, 2021 2:05 pm
by AlexD
The CoreApi project does not work with the following code modification
Convert from html color to uint:
Color color = System.Drawing.ColorTranslator.FromHtml("#FF0000");
Get uint color value:
uint uintColor = (uint)((color.A << 24) | (color.R << 16) |
(color.G << 8) | (color.B << 0));
CC.SetFillColorRGB(uintColor), where CC is IPXC_ContentCreator instance, should produce red fill color, but it the color is blue.
Re: Text Box Opacity
Posted: Thu Jan 14, 2021 2:34 pm
by Sasha - PDF-XChange
Hello AlexD,
That's because the construction of color looks like this:
Code: Select all
#define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16)))
Cheers,
Alex
Re: Text Box Opacity
Posted: Thu Jan 14, 2021 5:21 pm
by AlexD
...so it is ignoring 'Alpha'. Thanks
Re: Text Box Opacity
Posted: Fri Jan 15, 2021 2:04 pm
by Sasha - PDF-XChange
Hello AlexD,
Not only that - you have specified color components in reverse. You can use the SetFillAlpha method to specify the Alpha value if needed.
Cheers,
Alex
Re: Text Box Opacity
Posted: Sun Jan 17, 2021 4:16 pm
by AlexD
Thanks
Text Box Opacity
Posted: Mon Jan 18, 2021 11:01 am
by Sasha - PDF-XChange