version 11
DOM EXPORT TO PICTURE (elementRef; pictVar{; exportType})
| Parameter | Type | Description | |
| elementRef | String | Root XML element reference | |
| pictVar | Picture | Picture variable to receive XML tree | |
| (SVG picture) | |||
| exportType | Longint | 0 = Do not store data source | |
| 1 = Copy data source | |||
| 2 (default) = Own data source |
Description
The DOM 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.
SVG (Scalable Vector Graphics) is a file format used to describe vector graphics (extension .svg) in XML. These files can be viewed in Web browsers either natively, or via plug-ins. 4D v11 includes an SVG rendering engine that lets you view SVG files in picture fields or variables. The most common use of SVG is the publication of statistical or mapping data. For more information about this format, please refer to the following address: http://www.w3.org/Graphics/SVG/.
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")
DOM EXPORT TO PICTURE($svg;vpict;Copy XML Data Source)
DOM CLOSE XML($svg)
See Also
DOM EXPORT TO FILE, DOM EXPORT TO VAR.