RvHtmlImporter doesn't download the images

General TRichView support forum. Please post your questions here
Post Reply
Ajaz
Posts: 12
Joined: Wed Jun 15, 2022 7:35 am

RvHtmlImporter doesn't download the images

Post 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
Ajaz
Posts: 12
Joined: Wed Jun 15, 2022 7:35 am

Re: RvHtmlImporter doesn't download the images

Post by Ajaz »

The images are urls, not base64 embedded images
Ajaz
Posts: 12
Joined: Wed Jun 15, 2022 7:35 am

Re: RvHtmlImporter doesn't download the images

Post 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;
Post Reply