Missing Demo in RvHtmlViewImporter v1.15.2

General TRichView support forum. Please post your questions here
Post Reply
max.beliy
Posts: 26
Joined: Tue Jul 12, 2016 11:35 pm

Missing Demo in RvHtmlViewImporter v1.15.2

Post by max.beliy »

I'm trying to import to RV data with images from html, but can't do this. Text importing is ok, but fail with images. :(

May be demo will be helpful but the package "RvHtmlViewImporter v1.15.2"
has no demo :cry:
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

The code for loading from file is very simple:

Code: Select all

if OpenDialog1.Execute then begin
    HTMLViewer1.LoadFromFile(OpenDialog1.FileName);
    RVHTMLViewImporter1.ImportHtmlViewer(HTMLViewer1, RichViewEdit1,
      ExtractFilePath(OpenDialog1.FileName));
    NormalizeRichView(RichViewEdit1.RVData);
    RichViewEdit1.Format;
end;
The last parameter defines the base path for images and links. Probably, pictures were not loaded because it was not specified.
Note that the importer can automatically import only local images. If they are in the Internet (http-links), you need to import them yourself. You can do it in TRichView.OnImportPicture event.

If you use the importer in RichViewActions, and also activate support for Indy or CleverComponents, they can download images from http automatically.
max.beliy
Posts: 26
Joined: Tue Jul 12, 2016 11:35 pm

Post by max.beliy »

Thank, I also made as you have an example, but in my case the pictures were in base64 format inside html imgage tag, so the import of pictures doesn't work.

Do you plan to add support for base64 stored images in future ?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, but not in very near future.
However, you can decode it yourself in OnImportPicture event.

Currently, we have an example only for encoding base64 when saving HTML: http://www.trichview.com/forums/viewtopic.php?t=7191
But decoding is similar.
Write a decoded image in a stream, then load it to a graphic class using RVGraphicHandler.LoadFromStream method (RVGraphicHandler is a global variable defined in RVGrHandler unit) . This method autodetects graphic format by content. This method was added in TRichView v16.4.
If you use a trial of 16.0, you will be able to update it tomorrow, we are uploading the update.
max.beliy
Posts: 26
Joined: Tue Jul 12, 2016 11:35 pm

Post by max.beliy »

Thanks
Post Reply