KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Export SVG to file
PRODUCT: 4D | VERSION: 14.0 | PLATFORM: Mac & Win
Published On: March 7, 2014
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

Scalable Vector Graphics (SVG) is a picture format where the graphics are defined in an XML format. To see the xml source of the picture, you can use the svg component commands, or use DOM XML commands.

Here is an example using the svg component to get the xml code of an svg picture:

C_PICTURE($1;$vSVG) // Picture variable
C_TEXT($2;$ref;$path)
$vSVG:=$1
$path:=$2

$ref:=SVG_Open_picture ($vSVG)
SVG_SAVE_AS_TEXT ($ref;$path)
SVG_CLEAR($ref)


Here is an example of using XML DOM commands:

C_PICTURE($1;$vSVG) // Picture variable
C_TEXT($2;$ref;$path)
C_BLOB($vBlob)
$vSVG:=$1
$path:=$2

PICTURE TO BLOB($vSVG;$vBlob;".svg")
$ref:=DOM Parse XML variable($vBlob;False)
DOM EXPORT TO FILE($ref;$path)
DOM CLOSE XML($ref)