From 70dfea5876f29329789d1a097460dc3867a54136 Mon Sep 17 00:00:00 2001
From: Julien Neuhart You may specify the page ranges to convert. The format is the same as the one from the print options
+of Google Chrome, e.g. You may specify the page ranges to convert. The format is the same as the one from the print options
+of LibreOffice, e.g. This feature does not work in there is more
+than one document to convert.Page ranges
+
+1-5,8,11-13.cURL
+
+$ curl --request POST \
+ --url http://localhost:3000/convert/html \
+ --header 'Content-Type: multipart/form-data' \
+ --form files=@index.html \
+ --form pageRanges='1-3,5' \
+ -o result.pdf
+
+
+Go
+
+import "github.com/thecodingmachine/gotenberg-go-client/v6"
+
+func main() {
+ c := &gotenberg.Client{Hostname: "http://localhost:3000"}
+ req, _ := gotenberg.NewHTMLRequest("index.html")
+ req.PageRanges("1-3,5")
+ dest := "result.pdf"
+ c.Store(req, dest)
+}
+
+
+PHP
+
+use TheCodingMachine\Gotenberg\Client;
+use TheCodingMachine\Gotenberg\DocumentFactory;
+use TheCodingMachine\Gotenberg\HTMLRequest;
+use TheCodingMachine\Gotenberg\Request;
+
+$client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client());
+$index = DocumentFactory::makeFromPath('index.html', 'index.html');
+$request = new HTMLRequest($index);
+$request->setPageRanges("1-3,5");
+$dest = "result.pdf";
+$client->store($request, $dest);
@@ -1001,6 +1054,65 @@ $request = new OfficeRequest($files);
$request->setLandscape(true);
$dest = "result.pdf";
$client->store($request, $dest);
+
+
+Page ranges
+
+1-1 or 1-4.
+
+
+cURL
+
+$ curl --request POST \
+ --url http://localhost:3000/convert/office \
+ --header 'Content-Type: multipart/form-data' \
+ --form files=@document.docx \
+ --form pageRanges='1-3' \
+ -o result.pdf
+
+
+Go
+
+import "github.com/thecodingmachine/gotenberg-go-client/v6"
+
+func main() {
+ c := &gotenberg.Client{Hostname: "http://localhost:3000"}
+ req, _ := gotenberg.NewOfficeRequest("document.docx")
+ req.PageRanges("1-3")
+ dest := "result.pdf"
+ c.Store(req, dest)
+}
+
+
+PHP
+
+use TheCodingMachine\Gotenberg\Client;
+use TheCodingMachine\Gotenberg\DocumentFactory;
+use TheCodingMachine\Gotenberg\OfficeRequest;
+
+$client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client());
+$files = [
+ DocumentFactory::makeFromPath('document.docx', 'document.docx'),
+];
+$request = new OfficeRequest($files);
+$request->setPageRanges("1-3");
+$dest = "result.pdf";
+$client->store($request, $dest);
From 827060b6cec5c5a290b88222b71cf8f65ff477f6 Mon Sep 17 00:00:00 2001
From: Julien Neuhart 1-1 or 1-4.
-From ca0784fa594f7883400a47edd5dc0ecef118a26f Mon Sep 17 00:00:00 2001 From: Julien NeuhartThis feature does not work in there is more +
Attention: this feature does not work in there is more than one document to convert.
1-1 or 1-4.
-Attention: this feature does not work in there is more -than one document to convert.
+Attention: if more than one document, the page ranges will be +applied for each document.
You may send your own HTTP headers to the remoteURL.
For instance, by adding the HTTP header Gotenberg-Remoteurl-Your-Header to your request,
+the API will send a request to the remoteURL with the HTTP header Your-Header.
++ +Attention: the API uses a canonical format for the HTTP headers: +it transforms the first +letter and any letter following a hyphen to upper case; +the rest are converted to lowercase. For example, the +canonical key for
+accept-encodingisAccept-Encoding.
$ curl --request POST \ + --url http://localhost:3000/convert/url \ + --header 'Content-Type: multipart/form-data' \ + --header 'Gotenberg-Remoteurl-Your-Header: Foo' \ + --form remoteURL=https://google.com \ + -o result.pdf ++ +
// TODO
+ +// TODO
+You may also define this value globally: see the environment variables section.
-$ curl --request POST \ --url http://localhost:3000/convert/html \ @@ -1310,9 +1347,9 @@ $resp = $client->post($request); --form webhookURLTimeout=2.5-
import "github.com/thecodingmachine/gotenberg-go-client/v6" @@ -1325,9 +1362,9 @@ $resp = $client->post($request); }-
use TheCodingMachine\Gotenberg\Client; use TheCodingMachine\Gotenberg\DocumentFactory; @@ -1341,6 +1378,47 @@ $request->setWebhookURLTimeout(2.5); $resp = $client->post($request);+
You may send your own HTTP headers to the webhookURL.
For instance, by adding the HTTP header Gotenberg-Webhookurl-Your-Header to your request,
+the API will send a request to the webhookURL with the HTTP header Your-Header.
++ +Attention: the API uses a canonical format for the HTTP headers: +it transforms the first +letter and any letter following a hyphen to upper case; +the rest are converted to lowercase. For example, the +canonical key for
+accept-encodingisAccept-Encoding.
$ curl --request POST \ + --url http://localhost:3000/convert/html \ + --header 'Content-Type: multipart/form-data' \ + --header 'Gotenberg-Webhookurl-Your-Header: Foo' \ + --form files=@index.html \ + --form webhookURL='http://myapp.com/webhook/' ++ +
// TODO
+ +// TODO
+This environment variable accepts any string that can be turned into a port number.
+By default, the API root path is /.
You may customize this value with the environment variable ROOT_PATH.
This environment variable accepts a string starting and ending with /.
For instance, /gotenberg/ is a valid value while gotenberg is not.
++This is useful if you wish to do service discovery via URL paths.
+
Gotenberg is shipped within a Docker image.
---It uses a dedicated non-root user called
-gotenbergwith uid and gid1001.
You may start it with:
-$ docker run --rm -p 3000:3000 thecodingmachine/gotenberg:6 +$ docker run --rm -p 3000:3000 thecodingmachine/gotenberg:6+The API will be available at http://localhost:3000.
The image uses a dedicated non-root user called
+ +gotenbergwith uid and gid1001.If you wish to change those uid and gid, you will have to:
+ +
For instance:
+ +$ git clone https://github.com/thecodingmachine/gotenberg.git +$ make publish GOTENBERG_USER_GID=your_custom_gid GOTENBERG_USER_UID=your_custom_uid DOCKER_REGISTRY=your_registry DOCKER_USER=registry_user DOCKER_PASSWORD=registry_password VERSION=6.1.0 ++ +
+++
masterbranch is always up-to-date with the latest version of the API.
You may also add it in your Docker Compose stack:
-version: '3' +@@ -1189,7 +1205,7 @@ If unsucessful, it returns aversion: '3' -services: +services: # your others services - gotenberg: - image: thecodingmachine/gotenberg:6 + gotenberg: + image: thecodingmachine/gotenberg:6@@ -177,7 +193,7 @@-The more resources are granted, the quicker will be the conversions.
In the deployment specification of the pod, also specify the uid
+1001of the usergotenberg:In the deployment specification of the pod, also specify the uid of the user
gotenberg:securityContext: privileged: false @@ -657,8 +673,8 @@ $client->store($request, $dest);--url http://localhost:3000/convert/html \ --header 'Content-Type: multipart/form-data' \ --form files=@index.html \ - --form paperWidth=8.27 \ - --form paperHeight=11.69 \ + --form paperWidth=8.27 \ + --form paperHeight=11.69 \ --form marginTop=0 \ --form marginBottom=0 \ --form marginLeft=0 \ @@ -723,7 +739,7 @@ a lot on JavaScript for rendering. --url http://localhost:3000/convert/html \ --header 'Content-Type: multipart/form-data' \ --form files=@index.html \ - --form waitDelay=5.5 \ + --form waitDelay=5.5 \ -o result.pdf
504 HTTP code.
--url http://localhost:3000/convert/html \
--header 'Content-Type: multipart/form-data' \
--form files=@index.html \
- --form waitTimeout=2.5
+ --form waitTimeout=2.5
// TODO
+use TheCodingMachine\Gotenberg\Client;
+use TheCodingMachine\Gotenberg\URLRequest;
+
+$client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client());
+$request = new URLRequest('https://google.com');
+$request->addRemoteURLHTTPHeader('Your-Header', 'Foo')
+$dest = 'result.pdf';
+$client->store($request, $dest);
+
accept-encoding is Accept-Encoding.<
// TODO
+use TheCodingMachine\Gotenberg\Client;
+use TheCodingMachine\Gotenberg\DocumentFactory;
+use TheCodingMachine\Gotenberg\HTMLRequest;
+
+$client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client());
+$index = DocumentFactory::makeFromPath('index.html', 'index.html');
+$request = new HTMLRequest($index);
+$request->setWebhookURL('http://myapp.com/webhook/');
+$request->addWebhookURLHTTPHeader('Your-Header', 'Foo');
+$resp = $client->post($request);
+
diff --git a/internal/app/xhttp/handler.go b/internal/app/xhttp/handler.go
index 07959870..e15f6443 100644
--- a/internal/app/xhttp/handler.go
+++ b/internal/app/xhttp/handler.go
@@ -138,7 +138,7 @@ func urlHandler(c echo.Context) error {
if err != nil {
return err
}
- opts.CustomHeaders = resource.RemoteURLCustomHeaders(r)
+ opts.CustomHTTPHeaders = resource.RemoteURLCustomHTTPHeaders(r)
if !r.HasArg(resource.RemoteURLArgKey) {
return xerror.Invalid(
op,
@@ -338,14 +338,14 @@ func convertAsync(ctx context.Context, p printer.Printer, filename, fpath string
}
req.Header.Set(echo.HeaderContentType, "application/pdf")
// set custom headers (if any).
- customHeaders := resource.WebhookURLCustomHeaders(r)
+ customHeaders := resource.WebhookURLCustomHTTPHeaders(r)
if len(customHeaders) > 0 {
for key, value := range customHeaders {
req.Header.Set(key, value)
- logger.DebugfOp(op, "set '%s' to custom header '%s'", value, key)
+ logger.DebugfOp(op, "set '%s' to custom HTTP header '%s'", value, key)
}
} else {
- logger.DebugOp(op, "skipping custom headers as none have been provided...")
+ logger.DebugOp(op, "skipping custom HTTP headers as none have been provided...")
}
// send the result file.
logger.DebugfOp(
diff --git a/internal/app/xhttp/handler_test.go b/internal/app/xhttp/handler_test.go
index 792569ad..7e141d53 100644
--- a/internal/app/xhttp/handler_test.go
+++ b/internal/app/xhttp/handler_test.go
@@ -582,7 +582,7 @@ func TestOfficeHandler(t *testing.T) {
func TestWebhook(t *testing.T) {
customHeaderRealKey := http.CanonicalHeaderKey("MyCustomHeader")
- customHeaderKey := fmt.Sprintf("%s%s", resource.WebhookURLCustomHeaderCanonicalBaseKey, customHeaderRealKey)
+ customHeaderKey := fmt.Sprintf("%s%s", resource.WebhookURLCustomHTTPHeaderCanonicalBaseKey, customHeaderRealKey)
customHeaderValue := "foo"
status := make(chan error, 2)
rcv := echo.New()
diff --git a/internal/app/xhttp/pkg/context/context.go b/internal/app/xhttp/pkg/context/context.go
index 41f430fb..b8e0b892 100644
--- a/internal/app/xhttp/pkg/context/context.go
+++ b/internal/app/xhttp/pkg/context/context.go
@@ -80,7 +80,7 @@ func (ctx *Context) WithResource(directoryName string) error {
}
// retrieve custom headers from request.
for key, value := range ctx.Request().Header {
- r.WithCustomHeader(key, value[0])
+ r.WithCustomHTTPHeader(key, value[0])
}
// retrieve form values from request.
for _, key := range resource.ArgKeys() {
diff --git a/internal/app/xhttp/pkg/resource/header.go b/internal/app/xhttp/pkg/resource/header.go
index 9a9745d7..fa4c8814 100644
--- a/internal/app/xhttp/pkg/resource/header.go
+++ b/internal/app/xhttp/pkg/resource/header.go
@@ -5,15 +5,15 @@ import (
)
const (
- // RemoteURLCustomHeaderCanonicalBaseKey is the base key
+ // RemoteURLCustomHTTPHeaderCanonicalBaseKey is the base key
// of custom headers send to the remote URL.
- RemoteURLCustomHeaderCanonicalBaseKey string = "Gotenberg-Remoteurl-"
- // WebhookURLCustomHeaderCanonicalBaseKey is the base key
+ RemoteURLCustomHTTPHeaderCanonicalBaseKey string = "Gotenberg-Remoteurl-"
+ // WebhookURLCustomHTTPHeaderCanonicalBaseKey is the base key
// of custom headers send to the webhook URL.
- WebhookURLCustomHeaderCanonicalBaseKey string = "Gotenberg-Webhookurl-"
+ WebhookURLCustomHTTPHeaderCanonicalBaseKey string = "Gotenberg-Webhookurl-"
)
-func fetchCustomHeaders(r Resource, baseKey string) map[string]string {
+func fetchCustomHTTPHeaders(r Resource, baseKey string) map[string]string {
customHeaders := make(map[string]string)
for key, value := range r.customHeaders {
if strings.Contains(key, baseKey) {
@@ -24,14 +24,14 @@ func fetchCustomHeaders(r Resource, baseKey string) map[string]string {
return customHeaders
}
-// RemoteURLCustomHeaders is a helper for retrieving
+// RemoteURLCustomHTTPHeaders is a helper for retrieving
// the custom headers for the URL conversion.
-func RemoteURLCustomHeaders(r Resource) map[string]string {
- return fetchCustomHeaders(r, RemoteURLCustomHeaderCanonicalBaseKey)
+func RemoteURLCustomHTTPHeaders(r Resource) map[string]string {
+ return fetchCustomHTTPHeaders(r, RemoteURLCustomHTTPHeaderCanonicalBaseKey)
}
-// WebhookURLCustomHeaders is a helper for retrieving
+// WebhookURLCustomHTTPHeaders is a helper for retrieving
// the custom headers for the webhook URL.
-func WebhookURLCustomHeaders(r Resource) map[string]string {
- return fetchCustomHeaders(r, WebhookURLCustomHeaderCanonicalBaseKey)
+func WebhookURLCustomHTTPHeaders(r Resource) map[string]string {
+ return fetchCustomHTTPHeaders(r, WebhookURLCustomHTTPHeaderCanonicalBaseKey)
}
diff --git a/internal/app/xhttp/pkg/resource/header_test.go b/internal/app/xhttp/pkg/resource/header_test.go
index 5f9856ee..35a944f8 100644
--- a/internal/app/xhttp/pkg/resource/header_test.go
+++ b/internal/app/xhttp/pkg/resource/header_test.go
@@ -17,16 +17,16 @@ func TestRemoteURLCustomHeaders(t *testing.T) {
// should find the custom header.
customHeaderValue := "bar"
customHeaderCanonicalRealKey := "Foo"
- customHeaderCanonicalKey := http.CanonicalHeaderKey(fmt.Sprintf("%s%s", RemoteURLCustomHeaderCanonicalBaseKey, customHeaderCanonicalRealKey))
- r.WithCustomHeader(customHeaderCanonicalKey, customHeaderValue)
- r.WithCustomHeader("Bar", "Bar")
+ customHeaderCanonicalKey := http.CanonicalHeaderKey(fmt.Sprintf("%s%s", RemoteURLCustomHTTPHeaderCanonicalBaseKey, customHeaderCanonicalRealKey))
+ r.WithCustomHTTPHeader(customHeaderCanonicalKey, customHeaderValue)
+ r.WithCustomHTTPHeader("Bar", "Bar")
expected := map[string]string{
customHeaderCanonicalRealKey: customHeaderValue,
}
notExpected := map[string]string{
customHeaderCanonicalKey: customHeaderValue,
}
- v := RemoteURLCustomHeaders(r)
+ v := RemoteURLCustomHTTPHeaders(r)
assert.Equal(t, expected, v)
assert.NotEqual(t, notExpected, v)
}
@@ -39,16 +39,16 @@ func TestWebhookURLCustomHeaders(t *testing.T) {
// should find the custom header.
customHeaderValue := "bar"
customHeaderCanonicalRealKey := "Foo"
- customHeaderCanonicalKey := http.CanonicalHeaderKey(fmt.Sprintf("%s%s", WebhookURLCustomHeaderCanonicalBaseKey, customHeaderCanonicalRealKey))
- r.WithCustomHeader(customHeaderCanonicalKey, customHeaderValue)
- r.WithCustomHeader("Bar", "Bar")
+ customHeaderCanonicalKey := http.CanonicalHeaderKey(fmt.Sprintf("%s%s", WebhookURLCustomHTTPHeaderCanonicalBaseKey, customHeaderCanonicalRealKey))
+ r.WithCustomHTTPHeader(customHeaderCanonicalKey, customHeaderValue)
+ r.WithCustomHTTPHeader("Bar", "Bar")
expected := map[string]string{
customHeaderCanonicalRealKey: customHeaderValue,
}
notExpected := map[string]string{
customHeaderCanonicalKey: customHeaderValue,
}
- v := WebhookURLCustomHeaders(r)
+ v := WebhookURLCustomHTTPHeaders(r)
assert.Equal(t, expected, v)
assert.NotEqual(t, notExpected, v)
}
diff --git a/internal/app/xhttp/pkg/resource/resource.go b/internal/app/xhttp/pkg/resource/resource.go
index 29d1241d..3a983f18 100644
--- a/internal/app/xhttp/pkg/resource/resource.go
+++ b/internal/app/xhttp/pkg/resource/resource.go
@@ -75,19 +75,19 @@ func (r Resource) Close() error {
return nil
}
-// WithCustomHeader add a new custom header to the Resource.
+// WithCustomHTTPHeader add a new custom header to the Resource.
// Given key should be in canonical format.
-func (r *Resource) WithCustomHeader(key string, value string) {
- const op string = "resource.Resource.WithCustomHeader"
+func (r *Resource) WithCustomHTTPHeader(key string, value string) {
+ const op string = "resource.Resource.WithCustomHTTPHeader"
// should already be in canonical format.
canonicalKey := http.CanonicalHeaderKey(key)
- if strings.Contains(canonicalKey, RemoteURLCustomHeaderCanonicalBaseKey) ||
- strings.Contains(canonicalKey, WebhookURLCustomHeaderCanonicalBaseKey) {
+ if strings.Contains(canonicalKey, RemoteURLCustomHTTPHeaderCanonicalBaseKey) ||
+ strings.Contains(canonicalKey, WebhookURLCustomHTTPHeaderCanonicalBaseKey) {
r.customHeaders[canonicalKey] = value
- r.logger.DebugfOp(op, "added '%s' with value '%s' to resource custom headers", canonicalKey, value)
+ r.logger.DebugfOp(op, "added '%s' with value '%s' to resource custom HTTP headers", canonicalKey, value)
return
}
- r.logger.DebugfOp(op, "skipping '%s' as it is not a custom header...", canonicalKey)
+ r.logger.DebugfOp(op, "skipping '%s' as it is not a custom HTTP header...", canonicalKey)
}
// WithArg add a new argument to the Resource.
diff --git a/internal/pkg/printer/chrome.go b/internal/pkg/printer/chrome.go
index dce45a05..71e16b32 100644
--- a/internal/pkg/printer/chrome.go
+++ b/internal/pkg/printer/chrome.go
@@ -31,19 +31,19 @@ type chromePrinter struct {
// ChromePrinterOptions helps customizing the
// Google Chrome Printer behaviour.
type ChromePrinterOptions struct {
- WaitTimeout float64
- WaitDelay float64
- HeaderHTML string
- FooterHTML string
- PaperWidth float64
- PaperHeight float64
- MarginTop float64
- MarginBottom float64
- MarginLeft float64
- MarginRight float64
- Landscape bool
- RpccBufferSize int64
- CustomHeaders map[string]string
+ WaitTimeout float64
+ WaitDelay float64
+ HeaderHTML string
+ FooterHTML string
+ PaperWidth float64
+ PaperHeight float64
+ MarginTop float64
+ MarginBottom float64
+ MarginLeft float64
+ MarginRight float64
+ Landscape bool
+ RpccBufferSize int64
+ CustomHTTPHeaders map[string]string
}
// DefaultChromePrinterOptions returns the default
@@ -51,19 +51,19 @@ type ChromePrinterOptions struct {
func DefaultChromePrinterOptions(config conf.Config) ChromePrinterOptions {
const defaultHeaderFooterHTML string = ""
return ChromePrinterOptions{
- WaitTimeout: config.DefaultWaitTimeout(),
- WaitDelay: 0.0,
- HeaderHTML: defaultHeaderFooterHTML,
- FooterHTML: defaultHeaderFooterHTML,
- PaperWidth: 8.27,
- PaperHeight: 11.7,
- MarginTop: 1.0,
- MarginBottom: 1.0,
- MarginLeft: 1.0,
- MarginRight: 1.0,
- Landscape: false,
- RpccBufferSize: config.DefaultGoogleChromeRpccBufferSize(),
- CustomHeaders: make(map[string]string),
+ WaitTimeout: config.DefaultWaitTimeout(),
+ WaitDelay: 0.0,
+ HeaderHTML: defaultHeaderFooterHTML,
+ FooterHTML: defaultHeaderFooterHTML,
+ PaperWidth: 8.27,
+ PaperHeight: 11.7,
+ MarginTop: 1.0,
+ MarginBottom: 1.0,
+ MarginLeft: 1.0,
+ MarginRight: 1.0,
+ Landscape: false,
+ RpccBufferSize: config.DefaultGoogleChromeRpccBufferSize(),
+ CustomHTTPHeaders: make(map[string]string),
}
}
@@ -148,7 +148,7 @@ func (p chromePrinter) Print(destination string) error {
return err
}
// add custom headers (if any).
- if err := p.setCustomHeaders(ctx, targetClient); err != nil {
+ if err := p.setCustomHTTPHeaders(ctx, targetClient); err != nil {
return err
}
// listen for all events.
@@ -254,18 +254,18 @@ func (p chromePrinter) enableEvents(ctx context.Context, client *cdp.Client) err
return nil
}
-func (p chromePrinter) setCustomHeaders(ctx context.Context, client *cdp.Client) error {
- const op string = "printer.chromePrinter.setCustomHeaders"
+func (p chromePrinter) setCustomHTTPHeaders(ctx context.Context, client *cdp.Client) error {
+ const op string = "printer.chromePrinter.setCustomHTTPHeaders"
resolver := func() error {
- if len(p.opts.CustomHeaders) == 0 {
- p.logger.DebugOp(op, "skipping custom headers as none have been provided...")
+ if len(p.opts.CustomHTTPHeaders) == 0 {
+ p.logger.DebugOp(op, "skipping custom HTTP headers as none have been provided...")
return nil
}
customHeaders := make(map[string]string)
// useless but for the logs.
- for key, value := range p.opts.CustomHeaders {
+ for key, value := range p.opts.CustomHTTPHeaders {
customHeaders[key] = value
- p.logger.DebugfOp(op, "set '%s' to custom header '%s'", value, key)
+ p.logger.DebugfOp(op, "set '%s' to custom HTTP header '%s'", value, key)
}
b, err := json.Marshal(customHeaders)
if err != nil {
From 1eeb5fc2b0c0aec6281d4d4bf6a21f2a5e649cc5 Mon Sep 17 00:00:00 2001
From: Julien Neuhart accept-encoding is Accept-Encoding.<
Go
-// TODO
+import "github.com/thecodingmachine/gotenberg-go-client/v6" + +func main() { + c := &gotenberg.Client{Hostname: "http://localhost:3000"} + req := gotenberg.NewURLRequest("https://google.com") + req.AddRemoteURLHTTPHeader("Your-Header", "Foo") + dest := "result.pdf" + c.Store(req, dest) +} +
accept-encoding is Accept-Encoding.<
Go// TODO
+import "github.com/thecodingmachine/gotenberg-go-client/v6" + +func main() { + c := &gotenberg.Client{Hostname: "http://localhost:3000"} + req, _ := gotenberg.NewHTMLRequest("index.html") + req.WebhookURL("http://myapp.com/webhook/") + req.AddWebhookURLHTTPHeader("Your-Header", "Foo") + resp, _ := c.Post(req) +} +
$ go get -u github.com/thecodingmachine/gotenberg-go-client/v6 +$ go get -u github.com/thecodingmachine/gotenberg-go-client/v7+See also the example from the README.
+PHP client
@@ -238,6 +240,8 @@ Gotenberg API is available at http://localhost:3$ composer require thecodingmachine/gotenberg-php-client+See also the example from the README.
+Community clients
@@ -453,14 +457,13 @@ which will be converted to PDF. Go
import "github.com/thecodingmachine/gotenberg-go-client/v6" +import "github.com/thecodingmachine/gotenberg-go-client/v7" -func main() { - c := &gotenberg.Client{Hostname: "http://localhost:3000"} - req, _ := gotenberg.NewHTMLRequest("index.html") - dest := "result.pdf" - c.Store(req, dest) -} +c := &gotenberg.Client{Hostname: "http://localhost:3000"} +index, _ := gotenberg.NewDocumentFromPath("index.html", "/path/to/file") +req := gotenberg.NewHTMLRequest(index) +dest := "result.pdf" +c.Store(req, dest)@@ -472,7 +475,7 @@ use TheCodingMachine\Gotenberg\DocumentFactory; use TheCodingMachine\Gotenberg\HTMLRequest; $client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client()); -$index = DocumentFactory::makeFromPath('index.html', 'index.html'); +$index = DocumentFactory::makeFromPath('index.html', '/path/to/file'); $request = new HTMLRequest($index); $dest = 'result.pdf'; $client->store($request, $dest); @@ -542,16 +545,17 @@ Respectively, a file named
-header.htmlandfooter.htmlGoimport "github.com/thecodingmachine/gotenberg-go-client/v6" +import "github.com/thecodingmachine/gotenberg-go-client/v7" -func main() { - c := &gotenberg.Client{Hostname: "http://localhost:3000"} - req, _ := gotenberg.NewHTMLRequest("index.html") - req.Header("header.html") - req.Footer("footer.html") - dest := "result.pdf" - c.Store(req, dest) -} +c := &gotenberg.Client{Hostname: "http://localhost:3000"} +index, _ := gotenberg.NewDocumentFromPath("index.html", "/path/to/file") +header, _ := gotenberg.NewDocumentFromPath("header.html", "/path/to/file") +footer, _ := gotenberg.NewDocumentFromPath("footer.html", "/path/to/file") +req := gotenberg.NewHTMLRequest(index) +req.Header(header) +req.Footer(footer) +dest := "result.pdf" +c.Store(req, dest)@@ -563,9 +567,9 @@ use TheCodingMachine\Gotenberg\DocumentFactory; use TheCodingMachine\Gotenberg\HTMLRequest; $client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client()); -$index = DocumentFactory::makeFromPath('index.html', 'index.html'); -$header = DocumentFactory::makeFromPath('header.html', 'header.html'); -$footer = DocumentFactory::makeFromPath('footer.html', 'footer.html'); +$index = DocumentFactory::makeFromPath('index.html', '/path/to/file'); +$header = DocumentFactory::makeFromPath('header.html', '/path/to/file'); +$footer = DocumentFactory::makeFromPath('footer.html', '/path/to/file'); $request = new HTMLRequest($index); $request->setHeader($header); $request->setFooter($footer); @@ -637,15 +641,17 @@ see to the fonts section. Go
-import "github.com/thecodingmachine/gotenberg-go-client/v6" +import "github.com/thecodingmachine/gotenberg-go-client/v7" -func main() { - c := &gotenberg.Client{Hostname: "http://localhost:3000"} - req, _ := gotenberg.NewHTMLRequest("index.html") - req.Assets("font.woff", "img.gif", "style.css") - dest := "result.pdf" - c.Store(req, dest) -} +c := &gotenberg.Client{Hostname: "http://localhost:3000"} +index, _ := gotenberg.NewDocumentFromPath("index.html", "/path/to/file") +style, _ := gotenberg.NewDocumentFromPath("style.css", "/path/to/file") +img, _ := gotenberg.NewDocumentFromPath("img.png", "/path/to/file") +font, _ := gotenberg.NewDocumentFromPath("font.woff", "/path/to/file") +req := gotenberg.NewHTMLRequest(index) +req.Assets(style, img, font) +dest := "result.pdf" +c.Store(req, dest)@@ -657,11 +663,11 @@ use TheCodingMachine\Gotenberg\DocumentFactory; use TheCodingMachine\Gotenberg\HTMLRequest; $client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client()); -$index = DocumentFactory::makeFromPath('index.html', 'index.html'); +$index = DocumentFactory::makeFromPath('index.html', '/path/to/file'); $assets = [ - DocumentFactory::makeFromPath('style.css', 'style.css'), - DocumentFactory::makeFromPath('img.png', 'img.png'), - DocumentFactory::makeFromPath('font.woff', 'font.woff'), + DocumentFactory::makeFromPath('style.css', '/path/to/file'), + DocumentFactory::makeFromPath('img.png', '/path/to/file'), + DocumentFactory::makeFromPath('font.woff', '/path/to/file'), ]; $request = new HTMLRequest($index); $request->setAssets($assets); @@ -703,17 +709,16 @@ $client->store($request, $dest); Go
-import "github.com/thecodingmachine/gotenberg-go-client/v6" +import "github.com/thecodingmachine/gotenberg-go-client/v7" -func main() { - c := &gotenberg.Client{Hostname: "http://localhost:3000"} - req, _ := gotenberg.NewHTMLRequest("index.html") - req.PaperSize(gotenberg.A4) - req.Margins(gotenberg.NoMargins) - req.Landscape(true) - dest := "result.pdf" - c.Store(req, dest) -} +c := &gotenberg.Client{Hostname: "http://localhost:3000"} +index, _ := gotenberg.NewDocumentFromPath("index.html", "/path/to/file") +req := gotenberg.NewHTMLRequest(index) +req.PaperSize(gotenberg.A4) +req.Margins(gotenberg.NoMargins) +req.Landscape(true) +dest := "result.pdf" +c.Store(req, dest)@@ -726,7 +731,7 @@ use TheCodingMachine\Gotenberg\HTMLRequest; use TheCodingMachine\Gotenberg\Request; $client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client()); -$index = DocumentFactory::makeFromPath('index.html', 'index.html'); +$index = DocumentFactory::makeFromPath('index.html', '/path/to/file'); $request = new HTMLRequest($index); $request->setPaperSize(Request::A4); $request->setMargins(Request::NO_MARGINS); @@ -763,15 +768,14 @@ a lot on JavaScript for rendering. Go
-import "github.com/thecodingmachine/gotenberg-go-client/v6" +import "github.com/thecodingmachine/gotenberg-go-client/v7" -func main() { - c := &gotenberg.Client{Hostname: "http://localhost:3000"} - req, _ := gotenberg.NewHTMLRequest("index.html") - req.WaitDelay(5.5) - dest := "result.pdf" - c.Store(req, dest) -} +c := &gotenberg.Client{Hostname: "http://localhost:3000"} +index, _ := gotenberg.NewDocumentFromPath("index.html", "/path/to/file") +req := gotenberg.NewHTMLRequest(index) +req.WaitDelay(5.5) +dest := "result.pdf" +c.Store(req, dest)@@ -784,7 +788,7 @@ use TheCodingMachine\Gotenberg\HTMLRequest; use TheCodingMachine\Gotenberg\Request; $client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client()); -$index = DocumentFactory::makeFromPath('index.html', 'index.html'); +$index = DocumentFactory::makeFromPath('index.html', '/path/to/file'); $request = new HTMLRequest($index); $request->setWaitDelay(5.5); $dest = 'result.pdf'; @@ -822,15 +826,14 @@ The hard limit is 100 MB and is defined by Google Chrome itself. Go
-import "github.com/thecodingmachine/gotenberg-go-client/v6" +import "github.com/thecodingmachine/gotenberg-go-client/v7" -func main() { - c := &gotenberg.Client{Hostname: "http://localhost:3000"} - req, _ := gotenberg.NewHTMLRequest("index.html") - req.GoogleChromeRpccBufferSize(1048576) - dest := "result.pdf" - c.Store(req, dest) -} +c := &gotenberg.Client{Hostname: "http://localhost:3000"} +index, _ := gotenberg.NewDocumentFromPath("index.html", "/path/to/file") +req := gotenberg.NewHTMLRequest(index) +req.GoogleChromeRpccBufferSize(1048576) +dest := "result.pdf" +c.Store(req, dest)@@ -843,7 +846,7 @@ use TheCodingMachine\Gotenberg\HTMLRequest; use TheCodingMachine\Gotenberg\Request; $client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client()); -$index = DocumentFactory::makeFromPath('index.html', 'index.html'); +$index = DocumentFactory::makeFromPath('index.html', '/path/to/file'); $request = new HTMLRequest($index); $request->setGoogleChromeRpccBufferSize(1048576); $dest = 'result.pdf'; @@ -891,15 +894,13 @@ If not, some of the content of the page might be hidden. Go
-import "github.com/thecodingmachine/gotenberg-go-client/v6" +import "github.com/thecodingmachine/gotenberg-go-client/v7" -func main() { - c := &gotenberg.Client{Hostname: "http://localhost:3000"} - req := gotenberg.NewURLRequest("https://google.com") - req.Margins(gotenberg.NoMargins) - dest := "result.pdf" - c.Store(req, dest) -} +c := &gotenberg.Client{Hostname: "http://localhost:3000"} +req := gotenberg.NewURLRequest("https://google.com") +req.Margins(gotenberg.NoMargins) +dest := "result.pdf" +c.Store(req, dest)@@ -949,15 +950,13 @@ canonical key for
-accept-encodingisAccept-Encoding.< Goimport "github.com/thecodingmachine/gotenberg-go-client/v6" +import "github.com/thecodingmachine/gotenberg-go-client/v7" -func main() { - c := &gotenberg.Client{Hostname: "http://localhost:3000"} - req := gotenberg.NewURLRequest("https://google.com") - req.AddRemoteURLHTTPHeader("Your-Header", "Foo") - dest := "result.pdf" - c.Store(req, dest) -} +c := &gotenberg.Client{Hostname: "http://localhost:3000"} +req := gotenberg.NewURLRequest("https://google.com") +req.AddRemoteURLHTTPHeader("Your-Header", "Foo") +dest := "result.pdf" +c.Store(req, dest)@@ -1023,14 +1022,14 @@ in the file
-index.html. This function will convert a given markdown Goimport "github.com/thecodingmachine/gotenberg-go-client/v6" +import "github.com/thecodingmachine/gotenberg-go-client/v7" -func main() { - c := &gotenberg.Client{Hostname: "http://localhost:3000"} - req, _ := gotenberg.NewMarkdownRequest("index.html", "file.md") - dest := "result.pdf" - c.Store(req, dest) -} +c := &gotenberg.Client{Hostname: "http://localhost:3000"} +index, _ := gotenberg.NewDocumentFromPath("index.html", "/path/to/file") +markdown, _ := gotenberg.NewDocumentFromPath("file.md", "/path/to/file") +req := gotenberg.NewMarkdownRequest(index, markdown) +dest := "result.pdf" +c.Store(req, dest)@@ -1042,9 +1041,9 @@ use TheCodingMachine\Gotenberg\DocumentFactory; use TheCodingMachine\Gotenberg\MarkdownRequest; $client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client()); -$index = DocumentFactory::makeFromPath('index.html', 'index.html'); +$index = DocumentFactory::makeFromPath('index.html', '/path/to/file'); $markdowns = [ - DocumentFactory::makeFromPath('file.md', 'file.md'), + DocumentFactory::makeFromPath('file.md', '/path/to/file'), ]; $request = new MarkdownRequest($index, $markdowns); $dest = 'result.pdf'; @@ -1104,14 +1103,14 @@ $client->store($request, $dest); Go
-import "github.com/thecodingmachine/gotenberg-go-client/v6" +import "github.com/thecodingmachine/gotenberg-go-client/v7" -func main() { - c := &gotenberg.Client{Hostname: "http://localhost:3000"} - req, _ := gotenberg.NewOfficeRequest("document.docx", "document2.docx") - dest := "result.pdf" - c.Store(req, dest) -} +c := &gotenberg.Client{Hostname: "http://localhost:3000"} +doc, _ := gotenberg.NewDocumentFromPath("document.docx", "/path/to/file") +doc2, _ := gotenberg.NewDocumentFromPath("document2.docx", "/path/to/file") +req := gotenberg.NewOfficeRequest(doc, doc2) +dest := "result.pdf" +c.Store(req, dest)@@ -1124,8 +1123,8 @@ use TheCodingMachine\Gotenberg\OfficeRequest; $client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client()); $files = [ - DocumentFactory::makeFromPath('document.docx', 'document.docx'), - DocumentFactory::makeFromPath('document2.docx', 'document2.docx'), + DocumentFactory::makeFromPath('document.docx', '/path/to/file'), + DocumentFactory::makeFromPath('document2.docx', '/path/to/file'), ]; $request = new OfficeRequest($files); $dest = 'result.pdf'; @@ -1156,15 +1155,14 @@ $client->store($request, $dest); Go
-import "github.com/thecodingmachine/gotenberg-go-client/v6" +import "github.com/thecodingmachine/gotenberg-go-client/v7" -func main() { - c := &gotenberg.Client{Hostname: "http://localhost:3000"} - req, _ := gotenberg.NewOfficeRequest("document.docx") - req.Landscape(true) - dest := "result.pdf" - c.Store(req, dest) -} +c := &gotenberg.Client{Hostname: "http://localhost:3000"} +doc, _ := gotenberg.NewDocumentFromPath("document.docx", "/path/to/file") +req := gotenberg.NewOfficeRequest(doc) +req.Landscape(true) +dest := "result.pdf" +c.Store(req, dest)@@ -1177,7 +1175,7 @@ use TheCodingMachine\Gotenberg\OfficeRequest; $client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client()); $files = [ - DocumentFactory::makeFromPath('document.docx', 'document.docx'), + DocumentFactory::makeFromPath('document.docx', '/path/to/file'), ]; $request = new OfficeRequest($files); $request->setLandscape(true); @@ -1222,14 +1220,14 @@ will merge them and return the resulting PDF file. Go
-import "github.com/thecodingmachine/gotenberg-go-client/v6" +import "github.com/thecodingmachine/gotenberg-go-client/v7" -func main() { - c := &gotenberg.Client{Hostname: "http://localhost:3000"} - req, _ := gotenberg.NewMergeRequest("file.pdf", "file2.pdf") - dest := "result.pdf" - c.Store(req, dest) -} +c := &gotenberg.Client{Hostname: "http://localhost:3000"} +pdf, _ := gotenberg.NewDocumentFromPath("file.pdf", "/path/to/file") +pdf2, _ := gotenberg.NewDocumentFromPath("file2.pdf", "/path/to/file") +req := gotenberg.NewMergeRequest(pdf, pdf2) +dest := "result.pdf" +c.Store(req, dest)@@ -1242,8 +1240,8 @@ use TheCodingMachine\Gotenberg\MergeRequest; $client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client()); $files = [ - DocumentFactory::makeFromPath('file.pdf', 'file.pdf'), - DocumentFactory::makeFromPath('file2.pdf', 'file2.pdf'), + DocumentFactory::makeFromPath('file.pdf', '/path/to/file'), + DocumentFactory::makeFromPath('file2.pdf', '/path/to/file'), ]; $request = new MergeRequest($files); $dest = 'result.pdf'; @@ -1286,14 +1284,13 @@ If unsucessful, it returns a
-504HTTP code. Goimport "github.com/thecodingmachine/gotenberg-go-client/v6" +import "github.com/thecodingmachine/gotenberg-go-client/v7" -func main() { - c := &gotenberg.Client{Hostname: "http://localhost:3000"} - req, _ := gotenberg.NewHTMLRequest("index.html") - req.WaitTimeout(2.5) - resp, _ := c.Post(req) -} +c := &gotenberg.Client{Hostname: "http://localhost:3000"} +index, _ := gotenberg.NewDocumentFromPath("index.html", "/path/to/file") +req := gotenberg.NewHTMLRequest(index) +req.WaitTimeout(2.5) +resp, _ := c.Post(req)@@ -1306,7 +1303,7 @@ use TheCodingMachine\Gotenberg\HTMLRequest; use TheCodingMachine\Gotenberg\Request; $client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client()); -$index = DocumentFactory::makeFromPath('index.html', 'index.html'); +$index = DocumentFactory::makeFromPath('index.html', '/path/to/file'); $request = new HTMLRequest($index); $request->setWaitTimeout(2.5); $dest = 'result.pdf'; @@ -1345,14 +1342,13 @@ to given URL. Go
-import "github.com/thecodingmachine/gotenberg-go-client/v6" +import "github.com/thecodingmachine/gotenberg-go-client/v7" -func main() { - c := &gotenberg.Client{Hostname: "http://localhost:3000"} - req, _ := gotenberg.NewHTMLRequest("index.html") - req.WebhookURL("http://myapp.com/webhook/") - resp, _ := c.Post(req) -} +c := &gotenberg.Client{Hostname: "http://localhost:3000"} +index, _ := gotenberg.NewDocumentFromPath("index.html", "/path/to/file") +req := gotenberg.NewHTMLRequest(index) +req.WebhookURL("http://myapp.com/webhook/") +resp, _ := c.Post(req)@@ -1364,7 +1360,7 @@ use TheCodingMachine\Gotenberg\DocumentFactory; use TheCodingMachine\Gotenberg\HTMLRequest; $client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client()); -$index = DocumentFactory::makeFromPath('index.html', 'index.html'); +$index = DocumentFactory::makeFromPath('index.html', '/path/to/file'); $request = new HTMLRequest($index); $request->setWebhookURL('http://myapp.com/webhook/'); $resp = $client->post($request); @@ -1400,15 +1396,14 @@ $resp = $client->post($request); Go
-import "github.com/thecodingmachine/gotenberg-go-client/v6" +import "github.com/thecodingmachine/gotenberg-go-client/v7" -func main() { - c := &gotenberg.Client{Hostname: "http://localhost:3000"} - req, _ := gotenberg.NewHTMLRequest("index.html") - req.WebhookURL("http://myapp.com/webhook/") - req.WebhookURLTimeout(2.5) - resp, _ := c.Post(req) -} +c := &gotenberg.Client{Hostname: "http://localhost:3000"} +index, _ := gotenberg.NewDocumentFromPath("index.html", "/path/to/file") +req := gotenberg.NewHTMLRequest(index) +req.WebhookURL("http://myapp.com/webhook/") +req.WebhookURLTimeout(2.5) +resp, _ := c.Post(req)@@ -1420,7 +1415,7 @@ use TheCodingMachine\Gotenberg\DocumentFactory; use TheCodingMachine\Gotenberg\HTMLRequest; $client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client()); -$index = DocumentFactory::makeFromPath('index.html', 'index.html'); +$index = DocumentFactory::makeFromPath('index.html', '/path/to/file'); $request = new HTMLRequest($index); $request->setWebhookURL('http://myapp.com/webhook/'); $request->setWebhookURLTimeout(2.5); @@ -1460,15 +1455,14 @@ canonical key for
-accept-encodingisAccept-Encoding.< Goimport "github.com/thecodingmachine/gotenberg-go-client/v6" +From a60d7976f5029213dabac6ad2f991d600b414d16 Mon Sep 17 00:00:00 2001 From: Julien Neuhartimport "github.com/thecodingmachine/gotenberg-go-client/v7" -func main() { - c := &gotenberg.Client{Hostname: "http://localhost:3000"} - req, _ := gotenberg.NewHTMLRequest("index.html") - req.WebhookURL("http://myapp.com/webhook/") - req.AddWebhookURLHTTPHeader("Your-Header", "Foo") - resp, _ := c.Post(req) -} +c := &gotenberg.Client{Hostname: "http://localhost:3000"} +index, _ := gotenberg.NewDocumentFromPath("index.html", "/path/to/file") +req := gotenberg.NewHTMLRequest(index) +req.WebhookURL("http://myapp.com/webhook/") +req.AddWebhookURLHTTPHeader("Your-Header", "Foo") +resp, _ := c.Post(req)@@ -1480,7 +1474,7 @@ use TheCodingMachine\Gotenberg\DocumentFactory; use TheCodingMachine\Gotenberg\HTMLRequest; $client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client()); -$index = DocumentFactory::makeFromPath('index.html', 'index.html'); +$index = DocumentFactory::makeFromPath('index.html', '/path/to/file'); $request = new HTMLRequest($index); $request->setWebhookURL('http://myapp.com/webhook/'); $request->addWebhookURLHTTPHeader('Your-Header', 'Foo'); @@ -1521,14 +1515,13 @@ Otherwise a random filename is used. Go
-import "github.com/thecodingmachine/gotenberg-go-client/v6" +@@ -1288,8 +1288,8 @@ $files = [ DocumentFactory::makeFromPath('document.docx', '/path/to/file'), ]; $request = new OfficeRequest($files); -$request->setPageRanges("1-3"); -$dest = "result.pdf"; +$request->setPageRanges('1-3'); +$dest = 'result.pdf'; $client->store($request, $dest);import "github.com/thecodingmachine/gotenberg-go-client/v7" -func main() { - c := &gotenberg.Client{Hostname: "http://localhost:3000"} - req, _ := gotenberg.NewHTMLRequest("index.html") - req.ResultFilename("foo.pdf") - resp, _ := c.Post(req) -} +c := &gotenberg.Client{Hostname: "http://localhost:3000"} +index, _ := gotenberg.NewDocumentFromPath("index.html", "/path/to/file") +req := gotenberg.NewHTMLRequest(index) +req.ResultFilename("foo.pdf") +resp, _ := c.Post(req)@@ -1541,7 +1534,7 @@ use TheCodingMachine\Gotenberg\HTMLRequest; use TheCodingMachine\Gotenberg\Request; $client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client()); -$index = DocumentFactory::makeFromPath('index.html', 'index.html'); +$index = DocumentFactory::makeFromPath('index.html', '/path/to/file'); $request = new HTMLRequest($index); $request->setResultFilename('foo.pdf'); $resp = $client->post($request); From 099079b9621f74ee3e2911894ec7857224acfe0b Mon Sep 17 00:00:00 2001 From: Julien Neuhart
Date: Tue, 10 Dec 2019 15:25:56 +0100 Subject: [PATCH 17/18] fixing typo --- build/docs/content/04-html.md | 4 ++-- build/docs/content/07-office.md | 4 ++-- docs/index.html | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build/docs/content/04-html.md b/build/docs/content/04-html.md index 7ff5532f..85c426d5 100644 --- a/build/docs/content/04-html.md +++ b/build/docs/content/04-html.md @@ -343,8 +343,8 @@ use TheCodingMachine\Gotenberg\Request; $client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client()); $index = DocumentFactory::makeFromPath('index.html', '/path/to/file'); $request = new HTMLRequest($index); -$request->setPageRanges("1-3,5"); -$dest = "result.pdf"; +$request->setPageRanges('1-3,5'); +$dest = 'result.pdf'; $client->store($request, $dest); ``` diff --git a/build/docs/content/07-office.md b/build/docs/content/07-office.md index a6ec46e0..a024b236 100644 --- a/build/docs/content/07-office.md +++ b/build/docs/content/07-office.md @@ -161,7 +161,7 @@ $files = [ DocumentFactory::makeFromPath('document.docx', '/path/to/file'), ]; $request = new OfficeRequest($files); -$request->setPageRanges("1-3"); -$dest = "result.pdf"; +$request->setPageRanges('1-3'); +$dest = 'result.pdf'; $client->store($request, $dest); ``` diff --git a/docs/index.html b/docs/index.html index d2ec8df3..6769a751 100755 --- a/docs/index.html +++ b/docs/index.html @@ -787,8 +787,8 @@ use TheCodingMachine\Gotenberg\Request; $client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client()); $index = DocumentFactory::makeFromPath('index.html', '/path/to/file'); $request = new HTMLRequest($index); -$request->setPageRanges("1-3,5"); -$dest = "result.pdf"; +$request->setPageRanges('1-3,5'); +$dest = 'result.pdf'; $client->store($request, $dest); Date: Tue, 10 Dec 2019 15:58:21 +0100 Subject: [PATCH 18/18] fixing typo in go client version --- build/docs/content/07-office.md | 2 +- docs/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/docs/content/07-office.md b/build/docs/content/07-office.md index a024b236..1dbae793 100644 --- a/build/docs/content/07-office.md +++ b/build/docs/content/07-office.md @@ -139,7 +139,7 @@ $ curl --request POST \ ### Go ```golang -import "github.com/thecodingmachine/gotenberg-go-client/v6" +import "github.com/thecodingmachine/gotenberg-go-client/v7" c := &gotenberg.Client{Hostname: "http://localhost:3000"} doc, _ := gotenberg.NewDocumentFromPath("document.docx", "/path/to/file") diff --git a/docs/index.html b/docs/index.html index 6769a751..4853baa6 100755 --- a/docs/index.html +++ b/docs/index.html @@ -1265,7 +1265,7 @@ applied for each document. Go - import "github.com/thecodingmachine/gotenberg-go-client/v6" +import "github.com/thecodingmachine/gotenberg-go-client/v7" c := &gotenberg.Client{Hostname: "http://localhost:3000"} doc, _ := gotenberg.NewDocumentFromPath("document.docx", "/path/to/file")