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

Article 60000721
Type Wish
Product Engine
Version 6014
Date Added 12/23/2008 12:00:00 AM
Fixed (1/4/2009 12:00:00 AM)
Submitted by Shay Lapid

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

Send comments on this topic.