SVG EXPORT TO PICTURE

4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next

version 11


SVG EXPORT TO PICTURE (elementRef; pictVar{; exportType})

ParameterTypeDescription
elementRefStringRoot XML element reference
pictVarPicturePicture variable to receive XML tree
(SVG picture)
exportTypeLongint0 = Do not store data source
1 = Copy data source
2 (default) = Own data source

Description

The SVG EXPORT TO PICTURE command can be used to save an SVG format picture contained in an XML tree in the picture field or variable indicated by the pictVar parameter.

Note: For more information about the SVG format, please refer to the Overview of XML Utilities Commands section.

Pass the root XML element reference that contains the SVG picture in elementRef.

Pass the name of the 4D picture field or variable that will contain the SVG picture in pictVar. The picture is exported in its native format (XML description) and is redrawn via the SVG rendering engine when it is displayed.

The optional exportType parameter can be used to define the way the XML data source is to be handled by the command. You can pass one of the following constants, found in the "XML" theme, in this parameter:

Get XML Data Source (0): 4D only reads the XML data source; it is not kept with the picture. This noticeably increases command execution speed; however, because the DOM tree is not kept, it is not possible to store or export the picture.

Copy XML Data Source (1): 4D keeps a copy of the DOM tree with the picture, which means the picture can be saved in a picture field of the database and then redisplayed or exported at any time.

Own XML Data Source (2): 4D exports the DOM tree with the picture. The picture can be stored or exported and command execution is fast. However, the elementRef XML reference can then no longer be used by other 4D commands. This is the default mode for exporting when the exportType parameter is omitted.

Example

The following example can be used to display "Hello World" in a 4D picture:

   C_PICTURE(vpict)
   $svg:=DOM Create XML Ref("svg";"http://www.w3.org/2000/svg")
   $ref:=DOM Create XML element($svg;"text";"font-size";26;"fill";"red")
   DOM SET XML ELEMENT VALUE($ref;"Hello World")
   SVG EXPORT TO PICTURE($svg;vpict;Copy XML Data Source)
   DOM CLOSE XML($svg)

See Also

DOM EXPORT TO FILE, DOM EXPORT TO VAR.


4D - Documentation   Français   English   German   Spanish   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next