jung-kurt / gofpdf

A PDF document generator with high level support for text, drawing and images

Home Page:http://godoc.org/github.com/jung-kurt/gofpdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot parse SVG with <g> tags

nicholaspuglia opened this issue · comments

When parsing an svg before writing it to a pdf using SVGBasicParse(), if the svg contains tags then it does not appear on the pdf. My current workaround is to remove the tags from the svg manually however, it would be convenient to remove this extra step.

@nicholaspuglia -- can you provide a small example of an SVG file before and after the tags are removed?

Before the tag is removed:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="209" height="8"> <g stroke-linejoin="round" stroke-linecap="round" fill="none" stroke="black"> <path fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M 1 1 c 0.23 0.04 8.63 1.76 13 2 c 7.65 0.42 15.11 -0.35 23 0 c 23.02 1.02 43.97 3.11 67 4 c 12.35 0.48 23.88 0.46 36 0 c 5.76 -0.22 11.23 -1.83 17 -2 c 17.18 -0.51 51 0 51 0" /> </g> </svg>

After tag is removed:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="209" height="8"> <path fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M 1 1 c 0.23 0.04 8.63 1.76 13 2 c 7.65 0.42 15.11 -0.35 23 0 c 23.02 1.02 43.97 3.11 67 4 c 12.35 0.48 23.88 0.46 36 0 c 5.76 -0.22 11.23 -1.83 17 -2 c 17.18 -0.51 51 0 51 0" /> </svg>