Background Color after RTF

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

Background Color after RTF

Postby starzen » Thu Mar 27, 2014 3:27 pm

running into some strange issue

after printing some simple RTF text any subsequent regular text (VpeWrite) now prints with a grey background color. Background mode is transparent and even changing the background mode and color doesn't make any difference. if I don't print the rtf text it works fine

Any idea what to look for?

thanks

Mike
starzen
 
Posts: 30
Joined: Tue Feb 01, 2005 12:23 am
Location: Miami, FL

Re: Background Color after RTF

Postby starzen » Thu Mar 27, 2014 4:01 pm

some more testing. as long as I send text to the WriteRTF it happens. Even if it is plain text without any RTF control characters such as 'TEST'. if I don't call it or send a blank text it is fine
starzen
 
Posts: 30
Joined: Tue Feb 01, 2005 12:23 am
Location: Miami, FL

Re: Background Color after RTF

Postby starzen » Thu Mar 27, 2014 6:38 pm

looks like I may have found whats wrong.

there seems to be a bug with how background colors are handled

the following pseudo code

VpeNoPen
VpeSetBkgMode VBKG_SOLID
VpeSetBkgColor color
VpeBox ...
VpeSetBkgMode VBKG_TRANSPARENT
VpeWrite text

works fine and produces what you would think. one box in color with some text on top. The whole document is fine

now change it as follows

VpeNoPen
VpeSetBkgMode VBKG_SOLID
VpeSetBkgColor color
VpeBox ...
VpeSetBkgMode VBKG_TRANSPARENT
VpeWrite text
VpeWriteRTF rtftext
VpeWrite text

this code works fine until the RTF. The RTF text is printed with the background color set with VpeSetBkgColor (I don't think this should happen)
After the RTF all the VpeWrite's are also using the background color even though the mode is set to transparent. Even changing the mode or color doesn't do anything.
The only thing that seems to fix it is to do a page break

if I change the color after printing the box to white the problem goes away at least visually as you cant see the white background. Not sure if it actually paints the white background
starzen
 
Posts: 30
Joined: Tue Feb 01, 2005 12:23 am
Location: Miami, FL

Re: Background Color after RTF

Postby starzen » Thu Mar 27, 2014 7:17 pm

ok I confirmed this issue but also was able to confirm that this has already been fixed in newer versions of VPE

looks like the fact that RTF text is using the background color is the way it is meant to be.

Mike
starzen
 
Posts: 30
Joined: Tue Feb 01, 2005 12:23 am
Location: Miami, FL

Re: Background Color after RTF

Postby IDEAL Software Support » Fri Mar 28, 2014 7:42 am

Yes, the RTF instruction-set itself has no instruction for tranparency.
But RTF allows to specify a solid background color for each text character.

This is written in the Reference Manual in the remarks section of the method SetRTFColor():
RTF offers no way to set a transparent background mode, like VPE does. So we decided to
set the background mode to transparent, in case you use COLOR_WHITE = RGB(255,
255, 255) as background color.

Here, we are talking about the background color assigned to characters within the RTF stream.
You specify the per-character background color directly in the RTF stream using the
appropriate RTF instructions. In case "white" is used, VPE will make it transparent.

The color of the whole background of the rectangular RTF object can then be specified using
BkgColor and BkgMode. For transparent RTF characters, i.e. with a white background, the BkgColor
of the object will also be the background of these characters.
IDEAL Software Support
 
Posts: 1621
Joined: Thu Nov 18, 2004 4:03 pm


Return to VPE Open Forum

Who is online

Users browsing this forum: No registered users and 4 guests

cron