Chapter 9. Integration

Table of Contents

9.1. Integration by URL
9.2. Integration by API
9.2.1. Function setDocumentMenu
9.2.2. Function loadStringSVG
9.2.3. Function loadUrlSVG
9.2.4. Callback saveService
9.2.5. Function getSVG
9.2.6. Function addLayer
9.2.7. Function setInputLayerId

DRAW-SVG can be used to edit svg documents within a web application.

There is two ways to integrate DRAW-SVG :

  1. By URL and REST services

  2. By API with jsChannel

DRAW-SVG website has several entry points to be called from another site.

Each entry point can have parameters. The general syntax of the URL for calling an entry point is :

9.1. Integration by URL

This solution can only be used if your svg documents can be edited and updated by URL with a service (REST) to read (HTTP GET) documents and update them (HTTP PUT).

This use case is done with the 'svgrurl' entry with two parameters:

  1. the url parameter to specify the encoded url of the document to be edited.

  2. the save parameter with true or false value, If true, when saving the document, DRAWSVG will send a put request to the url with the document contents to save it (see save document ).

The general syntax is :

To call DRAW-SVG with the svgurl entry, use an HTML 'a' element or an iframe element :

<a href=''>edit with drawsvg</a>