Page 1 of 1

Saving Extra Data (binary) in rvf document?

Posted: Tue Nov 08, 2005 7:14 am
by softtouch
Is there any way to store binary data, for example audio files or whatever, inside a rvf document?

Posted: Tue Nov 08, 2005 9:21 am
by Sergey Tkachenko
It's possible to save additional text data using DocProperties property.
And any binary data can be converted to a text form.
The simplest way - to represent each byte of data as 2 hexadecimal characters. Functions for encoding/decoding can be found in RVFuncs unit:
binary -> text
function RVFStream2TextString(Stream: TMemoryStream): String;
text -> binary
function RVFTextString2Stream(const str: String; Stream: TMemoryStream): Boolean;

More sophisticated way - using Base64 encoding. The resulting string will be not so large as if you use the first method. Functions for encoding/decoding can be found here: http://www.zeitungsjunge.de/delphi/mime/index.htm