Andrey
Andrey

Reputation: 101

graphviz: Nodes of SVG images do not get inserted if output is SVG

I created a small SVG image. It renders just fine in Firefox. Then I created a graphviz file which contained (among other things):

  mynote [label="", image="mybox.svg"];

Then I ran this on that:

  $ dot -Tsvg:svg:core infile.dot -o outfile.svg

I get the following:

Warning: "mybox.svg" was not found as a file or as a shape library member
Warning: No or improper shapefile="mybox.svg" for node "mynote"

PS: with png files work normally.

Upvotes: 10

Views: 2859

Answers (2)

mafu
mafu

Reputation: 32650

I had the same issue. The svg file was properly constructed, but caused these errors.

The svg was stored in UTF-8 with BOM. The error disappeared when storing it without BOM. No other changes were required.

Upvotes: 1

Morten
Morten

Reputation: 4607

I've been struggling with this exact problem for a day or so, thought I'd share the solution I found.

I was trying to use fontawesome icons inside my graphviz graph.

The svgs you get form fontawesome are not propperly formated according to the xml standard. They are lacking the xml declaration.

Making sure the svg you are trying to import starts with the following line resolved the issue for me.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

Upvotes: 8

Related Questions