This commit is contained in:
u80864958
2025-06-13 11:29:09 +02:00
commit 9a30b61931
10 changed files with 498 additions and 0 deletions

17
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/main.go",
"args": ["/Users/u80864958/go/src/git.schreifuchs.ch/schreifuchs/svg-tmpl/drawing.svg"]
}
]
}

47
cmd/main.go Normal file
View File

@ -0,0 +1,47 @@
package main
import (
"encoding/xml"
"fmt"
"os"
"git.schreifuchs.ch/schreifuchs/svg-tmpl/pkg"
"github.com/antchfx/xmlquery"
)
func main() {
file, err := os.Open(os.Args[1])
if err != nil {
panic(err)
}
res, err := pkg.Fill(file, map[string]xmlquery.Node{
"name": {
Data: "Jhon Peter Muster-Doe",
Type: xmlquery.TextNode,
},
"country": {
Data: "EN",
Type: xmlquery.TextNode,
},
"function_1": {
Data: "VIP",
Type: xmlquery.TextNode,
},
"function_2": {
Data: "Chairman",
Type: xmlquery.TextNode,
},
"functions": {
Data: "VIP\nChairman\nSomething Else",
Type: xmlquery.TextNode,
},
"image": {
Data: "image",
Attr: []xmlquery.Attr{{Name: xml.Name{Local: "href"}, Value: "data:image/gif;base64,R0lGODlhPQBEAPeoAJosM//AwO/AwHVYZ/z595kzAP/s7P+goOXMv8+fhw/v739/f+8PD98fH/8mJl+fn/9ZWb8/PzWlwv///6wWGbImAPgTEMImIN9gUFCEm/gDALULDN8PAD6atYdCTX9gUNKlj8wZAKUsAOzZz+UMAOsJAP/Z2ccMDA8PD/95eX5NWvsJCOVNQPtfX/8zM8+QePLl38MGBr8JCP+zs9myn/8GBqwpAP/GxgwJCPny78lzYLgjAJ8vAP9fX/+MjMUcAN8zM/9wcM8ZGcATEL+QePdZWf/29uc/P9cmJu9MTDImIN+/r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IxYJIUXFUxNwoIkEKPAgCBZSQHQ1A2EWDfDEUVLyADj5AChSIQW6gu10bE/JG2VnCZGfo4R4d0sdQoBAHhPjhIB94v/wRoRKQWGRHgrhGSQJxCS+0pCZbEhAAOw=="}},
},
})
if err != nil {
panic(err)
}
fmt.Println(res)
}

BIN
drawing.pdf Normal file

Binary file not shown.

269
drawing.svg Normal file
View File

@ -0,0 +1,269 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="210mm"
height="297mm"
viewBox="0 0 210 297"
version="1.1"
id="svg1"
inkscape:version="1.4.2 (ebf0e940, 2025-05-08)"
sodipodi:docname="drawing.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
inkscape:zoom="1.0011791"
inkscape:cx="450.96825"
inkscape:cy="562.83634"
inkscape:window-width="2560"
inkscape:window-height="1412"
inkscape:window-x="2560"
inkscape:window-y="28"
inkscape:window-maximized="0"
inkscape:current-layer="g23" />
<defs
id="defs1">
<rect
x="157.81392"
y="593.30042"
width="504.40524"
height="157.81392"
id="rect21" />
<rect
x="245.01181"
y="284.4193"
width="844.69107"
height="118.22248"
id="rect20" />
<rect
x="142.20965"
y="65.108033"
width="531.14447"
height="174.76366"
id="rect16" />
<rect
x="257.00539"
y="371.80114"
width="342.67386"
height="113.08237"
id="rect15" />
<rect
x="243.29844"
y="394.07494"
width="373.5145"
height="63.394664"
id="rect13" />
<rect
x="370.08777"
y="279.27919"
width="104.51553"
height="71.96151"
id="rect12" />
<rect
x="238.15833"
y="176.47704"
width="358.09418"
height="71.96151"
id="rect11" />
<rect
x="229.59148"
y="94.235311"
width="364.94766"
height="51.401074"
id="rect10" />
<rect
x="-712.76162"
y="-164.48345"
width="1730.503"
height="575.69208"
id="rect9" />
<rect
x="44.547601"
y="191.89736"
width="712.76162"
height="94.235311"
id="rect8" />
<rect
x="561.98513"
y="54.827817"
width="198.75084"
height="113.08237"
id="rect7" />
<rect
x="149.06313"
y="94.235311"
width="291.27278"
height="46.260971"
id="rect5" />
<rect
x="517.43752"
y="394.07494"
width="205.60431"
height="543.13806"
id="rect3" />
<rect
x="44.547601"
y="433.48243"
width="370.08777"
height="258.71876"
id="rect2" />
<rect
x="412.922"
y="75.388249"
width="340.96049"
height="212.45779"
id="rect1" />
<rect
x="142.20966"
y="870.3916"
width="407.78189"
height="66.821404"
id="rect6-1" />
<rect
x="142.20966"
y="870.3916"
width="407.78189"
height="66.821404"
id="rect6" />
<rect
x="142.20966"
y="870.3916"
width="407.78189"
height="66.821404"
id="rect6-1-2" />
<rect
x="142.20966"
y="870.3916"
width="407.78189"
height="66.821404"
id="rect6-9" />
<rect
x="142.20966"
y="870.3916"
width="407.78189"
height="66.821404"
id="rect6-4" />
<rect
x="142.20966"
y="870.3916"
width="407.78189"
height="66.821404"
id="rect6-1-4" />
</defs>
<g
inkscape:groupmode="layer"
id="layer4"
inkscape:label="background">
<rect
style="fill:#acdbff;fill-opacity:1;stroke-width:0.264999"
id="rect4"
width="159.11847"
height="62.559395"
x="27.451284"
y="219.74734"
ry="13.599869" />
<rect
style="fill:#acdbff;fill-opacity:1;stroke-width:0.264999"
id="rect4-2"
width="159.11847"
height="62.559395"
x="28.943972"
y="145.27618"
ry="13.599869" />
<text
xml:space="preserve"
transform="matrix(0.26458333,0,0,0.26458333,-5.4462307,0)"
id="text16"
style="font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42.6667px;font-family:Zapfino;-inkscape-font-specification:'Zapfino Italic';text-align:center;writing-mode:lr-tb;direction:ltr;white-space:pre;shape-inside:url(#rect16);display:inline;fill:#1a1a1a;stroke-width:1.00157"><tspan
x="294.55448"
y="94.693786"
id="tspan3">Welcome
</tspan><tspan
x="407.78125"
y="148.02716"
id="tspan4">
</tspan><tspan
x="292.4211"
y="201.36053"
id="tspan5">To Event
</tspan></text>
</g>
<g
inkscape:label="fill"
inkscape:groupmode="layer"
id="layer1">
<text
xml:space="preserve"
transform="matrix(0.26458333,0,0,0.26458333,-74.055198,-5.4399475)"
id="text20"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42.6667px;font-family:Zapfino;-inkscape-font-specification:Zapfino;text-align:center;writing-mode:lr-tb;direction:ltr;white-space:pre;shape-inside:url(#rect20);display:inline;fill:#1a1a1a;stroke-width:1.00157"
inkscape:label="name"><tspan
x="593.81074"
y="314.00629"
id="tspan6">Name</tspan></text>
<text
xml:space="preserve"
transform="matrix(0.26458333,0,0,0.26458333,2.536039,19.706834)"
id="text4-7"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42.6667px;font-family:sans-serif;-inkscape-font-specification:sans-serif;text-align:start;writing-mode:lr-tb;direction:ltr;white-space:pre;shape-inside:url(#rect6-1);display:inline;fill:#1a1a1a;fill-opacity:1;stroke-width:1.00157"
x="-104.40633"
y="0"
inkscape:label="function_2"><tspan
x="142.20898"
y="909.31675"
id="tspan7">function 2</tspan></text>
<text
xml:space="preserve"
transform="matrix(0.26458333,0,0,0.26458333,2.9715206,4.8694356)"
id="text4"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42.6667px;font-family:sans-serif;-inkscape-font-specification:sans-serif;text-align:start;writing-mode:lr-tb;direction:ltr;white-space:pre;shape-inside:url(#rect6);display:inline;fill:#1a1a1a;fill-opacity:1;stroke-width:1.00157"
x="-104.40633"
y="0"
inkscape:label="function_1"><tspan
x="142.20898"
y="909.31675"
id="tspan8">function 1</tspan></text>
<text
xml:space="preserve"
transform="scale(0.26458333)"
id="text21"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42.6667px;font-family:Sans;-inkscape-font-specification:Sans;text-align:start;writing-mode:lr-tb;direction:ltr;white-space:pre;shape-inside:url(#rect21);display:inline;fill:#1a1a1a;stroke-width:1.00157"
x="-95.85424"
y="0"
inkscape:label="functions"><tspan
x="157.81445"
y="632.2269"
id="tspan9">functions</tspan></text>
<g
id="g23"
inkscape:label="image">
<rect
style="fill:#1a1a1a;stroke-width:0.264999"
id="rect22"
width="1.849902"
height="0.52854347"
x="18.234749"
y="97.516258"
ry="0.26427174" />
<rect
style="fill:#1a1a1a;stroke-width:0.264999"
id="rect23"
width="1.0570869"
height="1.5856304"
x="53.647156"
y="98.573349"
ry="0.26427174" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.8 KiB

47
drawing2.svg Normal file
View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg width="210mm" height="297mm" viewBox="0 0 210 297" version="1.1" id="svg1" inkscape:version="1.4.2 (ebf0e940, 2025-05-08)" sodipodi:docname="drawing.svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview id="namedview1" pagecolor="#ffffff" bordercolor="#000000" borderopacity="0.25" inkscape:showpageshadow="2" inkscape:pageopacity="0.0" inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" inkscape:document-units="mm" inkscape:zoom="1.0011791" inkscape:cx="450.96825" inkscape:cy="562.83634" inkscape:window-width="2560" inkscape:window-height="1412" inkscape:window-x="2560" inkscape:window-y="28" inkscape:window-maximized="0" inkscape:current-layer="g23"></sodipodi:namedview>
<defs id="defs1">
<rect x="157.81392" y="593.30042" width="504.40524" height="157.81392" id="rect21"></rect>
<rect x="245.01181" y="284.4193" width="844.69107" height="118.22248" id="rect20"></rect>
<rect x="142.20965" y="65.108033" width="531.14447" height="174.76366" id="rect16"></rect>
<rect x="257.00539" y="371.80114" width="342.67386" height="113.08237" id="rect15"></rect>
<rect x="243.29844" y="394.07494" width="373.5145" height="63.394664" id="rect13"></rect>
<rect x="370.08777" y="279.27919" width="104.51553" height="71.96151" id="rect12"></rect>
<rect x="238.15833" y="176.47704" width="358.09418" height="71.96151" id="rect11"></rect>
<rect x="229.59148" y="94.235311" width="364.94766" height="51.401074" id="rect10"></rect>
<rect x="-712.76162" y="-164.48345" width="1730.503" height="575.69208" id="rect9"></rect>
<rect x="44.547601" y="191.89736" width="712.76162" height="94.235311" id="rect8"></rect>
<rect x="561.98513" y="54.827817" width="198.75084" height="113.08237" id="rect7"></rect>
<rect x="149.06313" y="94.235311" width="291.27278" height="46.260971" id="rect5"></rect>
<rect x="517.43752" y="394.07494" width="205.60431" height="543.13806" id="rect3"></rect>
<rect x="44.547601" y="433.48243" width="370.08777" height="258.71876" id="rect2"></rect>
<rect x="412.922" y="75.388249" width="340.96049" height="212.45779" id="rect1"></rect>
<rect x="142.20966" y="870.3916" width="407.78189" height="66.821404" id="rect6-1"></rect>
<rect x="142.20966" y="870.3916" width="407.78189" height="66.821404" id="rect6"></rect>
<rect x="142.20966" y="870.3916" width="407.78189" height="66.821404" id="rect6-1-2"></rect>
<rect x="142.20966" y="870.3916" width="407.78189" height="66.821404" id="rect6-9"></rect>
<rect x="142.20966" y="870.3916" width="407.78189" height="66.821404" id="rect6-4"></rect>
<rect x="142.20966" y="870.3916" width="407.78189" height="66.821404" id="rect6-1-4"></rect>
</defs>
<g inkscape:groupmode="layer" id="layer4" inkscape:label="background">
<rect style="fill:#acdbff;fill-opacity:1;stroke-width:0.264999" id="rect4" width="159.11847" height="62.559395" x="27.451284" y="219.74734" ry="13.599869"></rect>
<rect style="fill:#acdbff;fill-opacity:1;stroke-width:0.264999" id="rect4-2" width="159.11847" height="62.559395" x="28.943972" y="145.27618" ry="13.599869"></rect>
<text xml:space="preserve" transform="matrix(0.26458333,0,0,0.26458333,-5.4462307,0)" id="text16" style="font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42.6667px;font-family:Zapfino;-inkscape-font-specification:&#39;Zapfino Italic&#39;;text-align:center;writing-mode:lr-tb;direction:ltr;white-space:pre;shape-inside:url(#rect16);display:inline;fill:#1a1a1a;stroke-width:1.00157"><tspan x="294.55448" y="94.693786" id="tspan3">Welcome
</tspan><tspan x="407.78125" y="148.02716" id="tspan4">
</tspan><tspan x="292.4211" y="201.36053" id="tspan5">To Event
</tspan></text>
</g>
<g inkscape:label="fill" inkscape:groupmode="layer" id="layer1">
<text xml:space="preserve" transform="matrix(0.26458333,0,0,0.26458333,-74.055198,-5.4399475)" id="text20" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42.6667px;font-family:Zapfino;-inkscape-font-specification:Zapfino;text-align:center;writing-mode:lr-tb;direction:ltr;white-space:pre;shape-inside:url(#rect20);display:inline;fill:#1a1a1a;stroke-width:1.00157" inkscape:label="name">Jhon Peter Muster-Doe</text>
<text xml:space="preserve" transform="matrix(0.26458333,0,0,0.26458333,2.536039,19.706834)" id="text4-7" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42.6667px;font-family:sans-serif;-inkscape-font-specification:sans-serif;text-align:start;writing-mode:lr-tb;direction:ltr;white-space:pre;shape-inside:url(#rect6-1);display:inline;fill:#1a1a1a;fill-opacity:1;stroke-width:1.00157" x="-104.40633" y="0" inkscape:label="function_2">Chairman</text>
<text xml:space="preserve" transform="matrix(0.26458333,0,0,0.26458333,2.9715206,4.8694356)" id="text4" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42.6667px;font-family:sans-serif;-inkscape-font-specification:sans-serif;text-align:start;writing-mode:lr-tb;direction:ltr;white-space:pre;shape-inside:url(#rect6);display:inline;fill:#1a1a1a;fill-opacity:1;stroke-width:1.00157" x="-104.40633" y="0" inkscape:label="function_1">VIP</text>
<text xml:space="preserve" transform="scale(0.26458333)" id="text21" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42.6667px;font-family:Sans;-inkscape-font-specification:Sans;text-align:start;writing-mode:lr-tb;direction:ltr;white-space:pre;shape-inside:url(#rect21);display:inline;fill:#1a1a1a;stroke-width:1.00157" x="-95.85424" y="0" inkscape:label="functions">VIP
Chairman
Something Else</text>
<g id="g23" inkscape:label="image"><image href="data:image/gif;base64,R0lGODlhPQBEAPeoAJosM//AwO/AwHVYZ/z595kzAP/s7P+goOXMv8+fhw/v739/f+8PD98fH/8mJl+fn/9ZWb8/PzWlwv///6wWGbImAPgTEMImIN9gUFCEm/gDALULDN8PAD6atYdCTX9gUNKlj8wZAKUsAOzZz+UMAOsJAP/Z2ccMDA8PD/95eX5NWvsJCOVNQPtfX/8zM8+QePLl38MGBr8JCP+zs9myn/8GBqwpAP/GxgwJCPny78lzYLgjAJ8vAP9fX/+MjMUcAN8zM/9wcM8ZGcATEL+QePdZWf/29uc/P9cmJu9MTDImIN+/r7+/vz8/P8VNQGNugV8AAF9fX8swMNgTAFlDOICAgPNSUnNWSMQ5MBAQEJE3QPIGAM9AQMqGcG9vb6MhJsEdGM8vLx8fH98AANIWAMuQeL8fABkTEPPQ0OM5OSYdGFl5jo+Pj/+pqcsTE78wMFNGQLYmID4dGPvd3UBAQJmTkP+8vH9QUK+vr8ZWSHpzcJMmILdwcLOGcHRQUHxwcK9PT9DQ0O/v70w5MLypoG8wKOuwsP/g4P/Q0IcwKEswKMl8aJ9fX2xjdOtGRs/Pz+Dg4GImIP8gIH0sKEAwKKmTiKZ8aB/f39Wsl+LFt8dgUE9PT5x5aHBwcP+AgP+WltdgYMyZfyywz78AAAAAAAD///8AAP9mZv///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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uqKB1keqwUhoCSK374wbujvOSu4QG6UvxBRydcpKsav++Ca6G8A6Pr1x2kVMyHwsVxUALDq/krnrhPSOzXG1lUTIoffqGR7Goi2MAxbv6O2kEG56I7CSlRsEFKFVyovDJoIRTg7sugNRDGqCJzJgcKE0ywc0ELm6KBCCJo8DIPFeCWNGcyqNFE06ToAfV0HBRgxsvLThHn1oddQMrXj5DyAQgjEHSAJMWZwS3HPxT/QMbabI/iBCliMLEJKX2EEkomBAUCxRi42VDADxyTYDVogV+wSChqmKxEKCDAYFDFj4OmwbY7bDGdBhtrnTQYOigeChUmc1K3QTnAUfEgGFgAWt88hKA6aCRIXhxnQ1yg3BCayK44EWdkUQcBByEQChFXfCB776aQsG0BIlQgQgE8qO26X1h8cEUep8ngRBnOy74E9QgRgEAC8SvOfQkh7FDBDmS43PmGoIiKUUEGkMEC/PJHgxw0xH74yx/3XnaYRJgMB8obxQW6kL9QYEJ0FIFgByfIL7/IQAlvQwEpnAC7DtLNJCKUoO/w45c44GwCXiAFB/OXAATQryUxdN4LfFiwgjCNYg+kYMIEFkCKDs6PKAIJouyGWMS1FSKJOMRB/BoIxYJIUXFUxNwoIkEKPAgCBZSQHQ1A2EWDfDEUVLyADj5AChSIQW6gu10bE/JG2VnCZGfo4R4d0sdQoBAHhPjhIB94v/wRoRKQWGRHgrhGSQJxCS+0pCZbEhAAOw=="></image></g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.5 KiB

15
go.mod Normal file
View File

@ -0,0 +1,15 @@
module git.schreifuchs.ch/schreifuchs/svg-tmpl
go 1.24.2
require (
codeberg.org/go-pdf/fpdf v0.11.1
github.com/antchfx/xmlquery v1.4.4
)
require (
github.com/antchfx/xpath v1.3.3 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/text v0.21.0 // indirect
)

75
go.sum Normal file
View File

@ -0,0 +1,75 @@
codeberg.org/go-pdf/fpdf v0.11.1 h1:U8+coOTDVLxHIXZgGvkfQEi/q0hYHYvEHFuGNX2GzGs=
codeberg.org/go-pdf/fpdf v0.11.1/go.mod h1:Y0DGRAdZ0OmnZPvjbMp/1bYxmIPxm0ws4tfoPOc4LjU=
github.com/antchfx/xmlquery v1.4.4 h1:mxMEkdYP3pjKSftxss4nUHfjBhnMk4imGoR96FRY2dg=
github.com/antchfx/xmlquery v1.4.4/go.mod h1:AEPEEPYE9GnA2mj5Ur2L5Q5/2PycJ0N9Fusrx9b12fc=
github.com/antchfx/xpath v1.3.3 h1:tmuPQa1Uye0Ym1Zn65vxPgfltWb/Lxu2jeqIGteJSRs=
github.com/antchfx/xpath v1.3.3/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

BIN
pdf.pdf Normal file

Binary file not shown.

28
pkg/filler.go Normal file
View File

@ -0,0 +1,28 @@
package pkg
import (
"io"
"github.com/antchfx/xmlquery"
)
func Fill(svg io.Reader, data map[string]xmlquery.Node) (filledSvg string, err error) {
doc, err := xmlquery.Parse(svg)
defer func() { filledSvg = doc.OutputXML(true) }()
if err != nil {
return
}
for key, value := range data {
nodes := xmlquery.Find(doc, "//*/g[@inkscape:label='fill']/*[@inkscape:label='"+key+"']")
if err != nil {
return filledSvg, err
}
for _, node := range nodes {
node.FirstChild = &value
}
}
return
}

BIN
svg-fill Executable file

Binary file not shown.