SVG EXPORT TO PICTURE
SVG EXPORT TO PICTURE ( elementRef ; pictVar {; exportType} )
Parameter | Type | Description | |
---|---|---|---|
elementRef | Text | → | Root XML element reference |
pictVar | Picture | → | Picture variable to receive XML tree (SVG picture) |
exportType | Integer | → | 0 = 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.
Note: 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:
Constant | Type | Value | Comment |
---|---|---|---|
Copy XML data source | Longint | 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. This is the default mode for exporting when the exportType parameter is omitted. |
Get XML data source | Longint | 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. |
Own XML data source | Longint | 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. |
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)