#1 2017-08-24 07:20:19

looseleaf
Member
Registered: 2017-08-24
Posts: 4

AppendRichEdit and background images

Hi!

I just downloaded the latest version of the synpdf package and was trying to create background images for RTF output. The RichEdit in question renders fine using AppendRichEdit. The only problem is that the text is not rendered transparently, thus overwriting the background image.

I also tried modifying the TGDIPages.AppendRichEdit method th set the bkmode right before rendering the RichEdit.
        SetBkMode(hdc, TRANSPARENT);
        LastChar := SendMessage(RichEditHandle, EM_FORMATRANGE, 1, Integer(@Range));

Sadly, this fails. This is with Windows 10 and Delphi 10.2 Tokyo.

Any pointers or solutions?
Stefan

Last edited by looseleaf (2017-08-24 07:20:30)

Offline

#2 2017-08-24 07:22:34

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,570
Website

Re: AppendRichEdit and background images

Transparency is currently not handled by SynPDF, since it is a very complex matter in the pdf standard, far away from what you expect for GDI screen display.

Any contribution is welcome.

Online

#3 2017-08-24 08:40:24

looseleaf
Member
Registered: 2017-08-24
Posts: 4

Re: AppendRichEdit and background images

Hm, you mean transparency when rendering RTF controls? Because using Canvas.TextOut in a OnNewPage event handler works fine.

An alternative would be rendering the RTF to a TBitmap and then painting it to the PDF canvas. Of course, losing the plain text information...

I am currently fooling around with TRichView (not freeware) and its report helper. I am currently in the middle of the process, but the RTF is transparent with it (using synpdf as PDF-canvas). So I'll probably use RichView instead of the methods built around TRichEdit.

Thanks anyway, Stefan

Last edited by looseleaf (2017-08-24 09:01:40)

Offline

#4 2017-08-24 09:25:07

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,570
Website

Re: AppendRichEdit and background images

TRichView is certainly a better alternative: it is a great component set.

Online

Board footer

Powered by FluxBB