https://github.com/galihrivanto/go-inkscape
a proxy for inkscape --shell mode
https://github.com/galihrivanto/go-inkscape
inkspace svg2pdf wrapper-library
Last synced: 5 months ago
JSON representation
a proxy for inkscape --shell mode
- Host: GitHub
- URL: https://github.com/galihrivanto/go-inkscape
- Owner: galihrivanto
- License: mit
- Created: 2021-01-31T09:24:29.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-06-18T10:11:07.000Z (almost 5 years ago)
- Last Synced: 2024-06-21T18:14:21.297Z (almost 2 years ago)
- Topics: inkspace, svg2pdf, wrapper-library
- Language: Go
- Homepage:
- Size: 113 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
go-inkscape
[](https://pkg.go.dev/github.com/galihrivanto/go-inkscape)
a proxy to interfacing with inkscape `--shell` mode
# **motivation**
while golang have some great pdf libraries but currently there's no one support complete svg conversion to pdf. this library attempt to provide interfacing with wellknown **inkscape** to manipulate svg, pdf and other supported formats using `--shell` mode and `action-command`
# **install**
```bash
go get github.com/galihrivanto/go-inkscape
```
# **simple usage**
```go
package main
import (
"flag"
"fmt"
"github.com/galihrivanto/go-inkscape"
"os"
)
var (
svgInput string
pdfOutput string
)
func handleErr(err error) {
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}
func main() {
flag.StringVar(&svgInput, "input", "", "svg input")
flag.StringVar(&pdfOutput, "output", "result.pdf", "pdf output")
flag.Parse()
if svgInput == "" {
fmt.Println("svg input is missing")
os.Exit(1)
}
proxy := inkscape.NewProxy(inkscape.Verbose(true))
err := proxy.Run()
handleErr(err)
defer proxy.Close()
err = proxy.Svg2Pdf(svgInput, pdfOutput)
handleErr(err)
fmt.Println("done!!")
}
```
# **advanced usage**
```go
...
proxy.RawCommands(
"file-open:test.svg",
"export-filename:out.pdf",
"export-do",
)
...
```
# license
[MIT](https://choosealicense.com/licenses/mit/)