Skip to main content
Version: 20 R7 BETA

SVG EXPORT TO PICTURE

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

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

Description

The SVG EXPORT TO PICTURE command saves an SVG format picture contained in an XML tree in the picture field or variable indicated by the pictVar parameter.For more information about the SVG format, 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 specifies 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:

ConstantTypeValueComment
Copy XML data sourceInteger14D 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. This is the default mode for exporting when the exportType parameter is omitted.
Get XML data sourceInteger04D 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.
Own XML data sourceInteger24D 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.

Example

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

 var vpict : Picture
 $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 ATTRIBUTE($ref;"y";"1em")
 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

Properties

Command number1017
Thread safe