Recent

Author Topic: [SOLVED] RichMemo and display of embedded images in an rtf file  (Read 1155 times)

petevick

  • Full Member
  • ***
  • Posts: 152
Am I correct in saying that RichMemo cannot display embedded images in an rtf file ??. I've tried it in Linux and Windows and neither display any images. Font formatting seems fine.
« Last Edit: March 01, 2022, 06:13:31 pm by petevick »
Pete Vickerstaff
Linux Mint 20.3 Cinnamon, Lazarus 2.2.0, FPC 3.2.2

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2761
    • havefunsoft.com
Re: RichMemo and display of embedded images in an rtf file
« Reply #1 on: March 01, 2022, 04:57:20 pm »
Windows can (but it might depend on the type of the image). The easiest test is to open the file in "WordPad". If you see Icons there, then RichMemo should be able to show it as well.

Linux Gtk2 unlikely. Qt5 might be able to do it.


petevick

  • Full Member
  • ***
  • Posts: 152
Re: RichMemo and display of embedded images in an rtf file
« Reply #2 on: March 01, 2022, 05:26:10 pm »
Windows can (but it might depend on the type of the image). The easiest test is to open the file in "WordPad". If you see Icons there, then RichMemo should be able to show it as well.

Linux Gtk2 unlikely. Qt5 might be able to do it.
Yeah, Wordpad opens with a message saying some content is blocked, but you can unblock.

I tried GTK3 but unsurprisingly that didn't even display any text  %)
Pete Vickerstaff
Linux Mint 20.3 Cinnamon, Lazarus 2.2.0, FPC 3.2.2

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2761
    • havefunsoft.com
Re: RichMemo and display of embedded images in an rtf file
« Reply #3 on: March 01, 2022, 05:43:36 pm »
Yeah, Wordpad opens with a message saying some content is blocked, but you can unblock.
The Windows security reasons now. Well, RichMemo is not ready for that.
A few things to try - try to resave RTF file with inserting images in another way.

However, if you're looking to have images working with Gtk (2 or 3) it's unlikely to happen.

I tried GTK3 but unsurprisingly that didn't even display any text  %)
this is probably due to a missing RTF loader.
and the support for Gtk3 by richmemo
https://wiki.freepascal.org/RichMemo#Gtk3
« Last Edit: March 01, 2022, 05:48:34 pm by skalogryz »

petevick

  • Full Member
  • ***
  • Posts: 152
Re: RichMemo and display of embedded images in an rtf file
« Reply #4 on: March 01, 2022, 05:58:36 pm »
However, if you're looking to have images working with Gtk (2 or 3) it's unlikely to happen.
Yes, i need to see images in Win and Linux.

I've come across KControls, their TKMemo control does actually display images in both Win and Linux, without any security issues in Win. The only small issue is a higher compiled size than using RichMemo, around 0.9MB in the project it's in, but hey, it works !!  ;D

Thanks for help skalogryz, I appreciate it  ;)
Pete Vickerstaff
Linux Mint 20.3 Cinnamon, Lazarus 2.2.0, FPC 3.2.2

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2761
    • havefunsoft.com
Re: RichMemo and display of embedded images in an rtf file
« Reply #5 on: March 01, 2022, 06:09:22 pm »
no problems
I've come across KControls, their TKMemo control does actually display images in both Win and Linux, without any security issues in Win. The only small issue is a higher compiled size than using RichMemo, around 0.9MB in the project it's in, but hey, it works !!  ;D
KMemo is the best choice for you right now

dbannon

  • Hero Member
  • *****
  • Posts: 2045
    • tomboy-ng, a rewrite of the classic Tomboy
Re: [SOLVED] RichMemo and display of embedded images in an rtf file
« Reply #6 on: March 02, 2022, 02:18:10 am »
When I first started using KMemo in my app, I made a lot of notes at https://wiki.freepascal.org/KControls/KmemoNotes

Not been updated for some time, feel free to share you experience.

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

petevick

  • Full Member
  • ***
  • Posts: 152
Re: [SOLVED] RichMemo and display of embedded images in an rtf file
« Reply #7 on: March 02, 2022, 07:31:51 am »
When I first started using KMemo in my app, I made a lot of notes at https://wiki.freepascal.org/KControls/KmemoNotes

Not been updated for some time, feel free to share you experience.

Davo
I did actually come across that page when I was Googling for an rtf control.
I'm simply displaying an rtf file, and the only thing I've come across so far is that....
Code: Pascal  [Select][+][-]
  1.   KMemo.LoadFromRTF(Application.Location+'Help.rtf');
....only works in the Laz environment not when compiled, whereas.....
Code: Pascal  [Select][+][-]
  1.   FS := TFileStream.Create(Utf8ToAnsi(Application.Location+'Help.rtf'), fmOpenRead or fmShareDenyNone);
  2.   KMemo.LoadFromRTFStream(FS);
....works in both situations.

Pete Vickerstaff
Linux Mint 20.3 Cinnamon, Lazarus 2.2.0, FPC 3.2.2

 

TinyPortal © 2005-2018