Prod.: Engine, ver.: 6014, ID: 60000721, Wish : We need method to save/load a document to/from a string that represents a Compress memory stream

Wish : We need method to save/load a document to/from a string that represents a Compress memory stream

Article60000721
TypeWish
ProductEngine
Version6014
Date Added12/23/2008
FixedYes [1/4/2009]
Submitted byShay Lapid
Keywords

Subject

We need method to save/load a document to/from a string that represents a Compress memory stream

Summary


We need method to save/load a document to/from a string that represents a Compress memory stream

This method are highly needed for dealing with drawings across client internet explorer and iis  web services on server.

Solution


Example in C#

object ByteArray = null;
System.IO.
MemoryStream memorystream = vdFramedControl.BaseControl.ActiveDocument.ToStream(true);
if (memorystream == null) return ;
ByteArray = memorystream.ToArray();
int size = (int)memorystream.Length;
memorystream.Close();
string doc_str = Convert.ToBase64String((byte[])ByteArray);


// Read the Bytes from string BASE64 and store it in the ByteArray and then :
System.IO.MemoryStream memorystream2 = new System.IO.MemoryStream(Convert.FromBase64String(doc_str));
memorystream2.Position = 0;
vdFramedControl.BaseControl.ActiveDocument.LoadFromMemory(memorystream2,
true);
memorystream2.Close();



In  6015 version new methods was added in Wrapper vdDocument object

SaveToMemoryString  : save a comprees stream into a base64 string

and

CreateFromMemoryString :load a compress stream document from a base64 string

Example in VB6:

Dim globstring As String

''saves the document
globstring = VDraw1.ActiveDocument.SaveToMemoryString(64)

'''''......................

''load the previous saved document.

VDraw1.ActiveDocument.CreateFromMemoryString globstring, 64
VDraw1.Redraw