4D v13.4

SVG EXPORT TO PICTURE

Home

 
4D v13.4
SVG
SVG EXPORT TO PICTURE

SVG EXPORT TO PICTURE 


 

SVG EXPORT TO PICTURE ( elementRef ; pictVar {; exportType} ) 
Parameter Type   Description
elementRef  String in Root XML element reference
pictVar  Picture in Picture variable to receive XML tree (SVG picture)
exportType  Longint in 0 = Do not store data source, 1 = Copy data source, 2 = Own data source (default)

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.
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. 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 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)

 
PROPERTIES 

Product: 4D
Theme: SVG
Number: 1017

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: 4D v11 SQL

 
SEE ALSO 

DOM EXPORT TO FILE
DOM EXPORT TO VAR