-
Notifications
You must be signed in to change notification settings - Fork 33
Help supporting v7 #31
Comments
Hello @mnavarrocarter, thanks for your interest in Gotenberg 😄 The API primarily consists of Honestly, I'm not sure that using an SDK is required to interact with Gotenberg; it helps a bit, but you might have more flexibility by directly creating "native" Anyway, if an SDK makes sense in your case, you may either:
IMO the key will be to mimic the module's organization from Gotenberg (i.e., endpoints per module). |
Hi @gulien, thanks for your reply! I'm mid way of coding our own implementation of the |
Your call 😄 but I think it might help others indeed. |
It is morally important to support v7 👯♀️ |
Raw HTML example: package main
import (
"bytes"
"fmt"
"io"
"mime/multipart"
"net/http"
"os"
"strings"
)
func main() {
reader := strings.NewReader("<h1>hi</h1>")
buf := new(bytes.Buffer)
writer := multipart.NewWriter(buf)
part, err := writer.CreateFormFile("file", "index.html")
if err != nil {
panic(err)
}
_, err = io.Copy(part, reader)
if err != nil {
panic(err)
}
fmt.Println(buf.String())
writer.Close()
req, err := http.NewRequest("POST", "http://localhost:3000/forms/chromium/convert/html", buf)
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", writer.FormDataContentType())
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
if res.StatusCode != http.StatusOK {
panic(fmt.Errorf("bad status: %s", res.Status))
}
defer res.Body.Close()
out, err := os.Create("index.pdf")
if err != nil {
panic(err)
}
defer out.Close()
io.Copy(out, res.Body)
return
} |
Hey, at my company we are in dire need for this SDK to support
v7
.I'm willing to contribute to make support happen, but I don't know where to start.
If you could point me to what does need to be done in order to support
v7
then I'll be more than happy to submit a PR.How does that sound? 😃
The text was updated successfully, but these errors were encountered: