Closed tjim closed 8 years ago
You have access to the io.Writer, so you can use it to place your comments:
package main
import (
"fmt"
"io"
"os"
"github.com/ajstarks/svgo"
)
func comment(w io.Writer, s string) {
fmt.Fprintf(w, "<!-- %s -->\n", s)
}
func main() {
f, err := os.Create("foo.svg")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
canvas := svg.New(f)
canvas.Start(100, 100)
comment(f, "This is a comment")
canvas.Rect(50, 50, 20, 30)
canvas.End()
}
I'd like to able to place comments in the generated SVG.