Golang (Go) client library to use the PdfTurtle service
See a working example in examples/main.go.
Get the package and than you are ready to go.
go get github.com/lucas-gaitzsch/pdf-turtle-client-golang// create your client
c := pdfturtleclient.NewPdfTurtleClient("https://pdfturtle.gaitzsch.dev")Go to 🐢PdfTurtle-Playground, put an example model as JSON and design your PDF. Download the bundle as ZIP file and put it in your resources/assets.
Call RenderBundle to render the pdf to a io.Reader.
pdf := c.RenderBundle([]io.Reader{ BUNDLE_AS_READER }, MODEL_AS_OBJECT)Done.
If you want to have the same header for all documents, you can create a ZIP file with only the header.html file.
Now you can call the Service with multiple bundle files. The service will assemble the files together.
pdf := c.RenderBundle(
    []io.Reader{ BUNDLE_WITHOUT_HEADER_AS_READER, HEADER_BUNDLE_AS_READER },
    MODEL_AS_OBJECT,
)If the described way does not match your expectations, you can use a template engine of your choice (for example html/template) and render HTML directly with PdfTurtle.
pdf := c.Render(RenderData{
    ...
})If you want to render a HTML template without any images or assets, you can use the RenderTemplate function.
pdf := c.RenderTemplateAsync(RenderTemplateData{
    ...
})- Working examples for all methods
 - Add documentation as comments
 - Tests