Load a SVG with TfrxPictureView.LoadFromStream

I am working on my project and would like to load TfrxPictureView from a stream and Nothing shows ( In a different scenario using LoadFromFile all looks good.) Below is some of the code that I wrote. Any help would be appreciated.

item := TfrxPictureView.Create(reportTitle);

sl:=TStringList.Create();

sl.Text:=SVGText;

memStream:=TMemoryStream.Create();

sl.SaveToStream(memStream);

item.Picture.LoadFromStream(memStream);


Function SVGText():String;

 Begin

result:='

<svg viewBox="0 0 384 512"><defs><style>.fa-secondary{opacity:.4}</style></defs><path d="M192 0C79.7 101.33 0 220.92 0 300.55 0 425.05 79 512 192 512s192-86.95 192-211.45C384 220.6 303.78 100.86 192 0zm0 448c-70.58 0-128-52.89-128-117.89 0-44.11 25.84-71.51 34.34-79.76A8 8 0 0 1 112 256v40a56 56 0 0 0 112 0c0-72-112.64-64.77-39.43-164.33a9.37 9.37 0 0 1 10.58-3.17c1.62.53 5.38 2.24 5.38 6.78 0 33.55 25 55 51.57 77.63 33.38 28.54 67.9 58 67.9 117.21C320 395.11 262.58 448 192 448z" class="fa-secondary"/><path d="M252.09 212.92c33.38 28.54 67.9 58 67.9 117.21 0 65-57.41 117.87-128 117.87S64 395.11 64 330.11c0-44.11 25.84-71.51 34.34-79.76A8 8 0 0 1 112 256v40a56 56 0 0 0 112 0c0-72-112.64-64.77-39.43-164.33a9.37 9.37 0 0 1 10.58-3.17c1.62.53 5.38 2.24 5.38 6.78 0 33.56 25 55 51.56 77.64z" class="fa-primary"/></svg>

'

End;

Comments

  • The solution is:

    item := TfrxPictureView.Create(reportTitle);

    sl:=TStringList.Create();

    sl.Text:=SVGText;

    memStream:=TMemoryStream.Create();

    sl.SaveToStream(memStream);

    memStream.Position:=0;

    item.LoadPictureFromStream(memStream);

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.