Page 1 of 1

RvHtmlImporter doesn't download the images

Posted: Sat Sep 17, 2022 7:40 pm
by Ajaz
When importing a html document with images from a file or from a string, the images are not downloaded to show them in the Trichviewedit.
I use D11.1 on W10 and Richview 20.3

Re: RvHtmlImporter doesn't download the images

Posted: Sat Sep 17, 2022 7:53 pm
by Ajaz
The images are urls, not base64 embedded images

Re: RvHtmlImporter doesn't download the images

Posted: Sun Sep 18, 2022 8:42 am
by Ajaz
Problem solved

procedure TForm1.RVImportPicture(Sender: TCustomRichView;
const Location: TRVUnicodeString; Width, Height: Integer;
var Graphic: TGraphic);
var Stream: TMemoryStream;
begin
if Pos('http://', AnsiLowerCase(Location))=1 then
begin
Stream := TMemoryStream.Create;
try
IdHTTP1.Get(Location, Stream);
Stream.Position := 0;
Graphic := RVGraphicHandler .LoadFromStream(Stream);
except
Graphic := nil;
end;
Stream.Free;
end;
end;