%%PageItemTitle%%

VectorDraw Web Library

JsPropertiesExtractor Send comments on this topic.
SetDocument Method
See Also  Example
vdWebLibrary Namespace > vdrawObj Class : SetDocument Method
documentObject
Select a document object that previous was store into a variable by the GetDocument

Syntax

JScript 
public function SetDocument( 
   documentObject : Object
) : boolean;

Parameters

documentObject

Return Value

True is the passed documentObject was successfully selected.

Example

C#Copy Code
  
//A document that selected in vectordraw canvas using the  vdcanvas.SelectDocument(filename) can be stored in memory and loaded later as follow 
 
            var vdcanvas = vdmanager.vdrawObject('canvas'); 
            vdcanvas.SelectDocument('PathFilename.vds'); 
            vdcanvas.vdAfterOpenDocument = _vdAfterOpenDocument; 
 
            var documentdata = null;//global variable that reference to a selected document 
            function _vdAfterOpenDocument(vdcanvas)  
            { 
     //WARNING you can access the document only in the vdAfterOpenDocument event 
     documentdata  = vdcanvas.GetDocument();//set active selected document to a global variable 
 
     var documentPathName = document.pathname;//return the full path name of the selected document 
            } 
 
            function LoadFromDocumentReference() 
            { 
      //fast select a document that already is in memory 
      vdcanvas.SetDocument(documentdata);  
      setTimeout(vdcanvas.redraw, 0);//post redraw for new selected document 
            }

See Also