Link to home
Start Free TrialLog in
Avatar of Rick_S
Rick_S

asked on

Converting RTF (Contents of RichEdit) to Bitmap

How can I convert the contents of RichEdit to a Bitmap in an efficient manner? The ideal situation would be to read a rich text file from memory and then convert to a Bitmap.
Avatar of kangadru
kangadru

Though I haven't tried this, I imagine the easiest way would be to print the RTF to a TBitmap.Canvas manually using TextOut and manually setting the properties.  I don't think there is a way to just designate the RTF Print Canvas short of rewriting your own TRichEdit based on the TcustomRichEdit and overriding the Print routine there to output to a TBitmap.Canvas instead of the Default PRinter DC (if you have the VCL Source, lookup TRichEdit.Print to see how they do it). I know it's an ugly solution but it is the only way I am aware of to do a bitmap from a RichEdit as the PainTo call does nothing more than display a bitmap of the control itself not the contents therofAndy
ASKER CERTIFIED SOLUTION
Avatar of erajoj
erajoj
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rick_S

ASKER

That works good but maybe is wasn't very clear...  I need to do this without the RichEdit component visable the example above didn't work when the 'RichEdit1.Visible := False' for obvious reasons.