+1 800 256 3608 (toll-free in North America) or +49 7531 90 60 10| service@combit.com

Implement a designer function like DrawSVG(<svg-string>)

I suggest to implement the following feature:

Implement a designer function like DrawSVG()

A typical use case might be:

You already must have an internal function which creates a bitmap of a SVG-file. As SVG files could be really dynamic it would be great to have a function to Draw a picture of a given SVG-string. Depending on my variables I could change the SVG-string. I know I already could do this with multiple file based SVG files, and putting some conditioned display magic. But I think the SVG-string to Drawing/Bitmap opens a lot of new opportunities:

For example when my SVG-string contains a name and I replace the name before printing with the value of a current variable. To get this done I could use ReplaceRegEx$() to find my name-placeholder inside the SVG-string and replace it with a variable.

Even better would be a DOM for SVG files/strings :slight_smile:

PS: If you consider implementing this function, please be aware of: https://forum.combit.net/t/handle-svg-internally-as-vector-and-not-bitmap-graphics/6698

As I said - I like this idea. On the backlog for LL27.

I just want to add, if implementing this feature to support SVG as a native LlFieldType. In this case I could directly assign SVG in my custom data provider.

Actually, it will not be a separate field type. The current prototype looks like this:

LL.Variables.Add("ImageFromSVG", 
    @"<?xml version=""1.0"" standalone=""no""?>
    < svg width = ""5cm"" height = ""4cm"" version = ""1.1""
    xmlns = ""http://www.w3.org/2000/svg"" >
    < desc > Four separate rectangles
    </ desc >
    < rect x = ""0.5cm"" y = ""0.5cm"" width = ""2cm"" height = ""1cm"" />
    < rect x = ""0.5cm"" y = ""2cm"" width = ""1cm"" height = ""1.5cm"" />
    < rect x = ""3cm"" y = ""0.5cm"" width = ""1.5cm"" height = ""2cm"" />
    < rect x = ""3.5cm"" y = ""3cm"" width = ""1cm"" height = ""0.5cm"" />
    < rect x = "".01cm"" y = "".01cm"" width = ""4.98cm"" height = ""3.98cm""
    fill = ""none"" stroke = ""blue"" stroke - width = "".02cm"" />
    </ svg >", LlFieldType.Drawing);

and gives this result:

image

It will still be a bitmap graphic, though - converting SVG to the internally used format would be tough if not impossible :innocent:

Yes this looks good for the beginning. :slight_smile:

And I wanted to mention https://github.com/vdmeer/svg2vector, for the part of bitmap/vector subject. Maybe you could use vector when exporting to PDF?

┬ę combit GmbH