From 25f7ba3ee6c82d70164f98a98650fc99fc0b571a Mon Sep 17 00:00:00 2001
From: Julien Neuhart You may start it with:$ docker run --rm -p 3000:3000 thecodingmachine/gotenberg:3
+
$ docker run --rm -p 3000:3000 thecodingmachine/gotenberg:4
@@ -119,7 +127,7 @@
# your others services
gotenberg:
- image: thecodingmachine/gotenberg:3
+ image: thecodingmachine/gotenberg:4
@@ -354,7 +362,7 @@ are on the same level as the
index.html file.
If you want to install fonts directly in the Gotenberg Docker image, -see to the fonts section.
+see to the fonts section.
Gotenberg provides the endpoint /convert/url for remote URL conversions.
It accepts POST requests with a multipart/form-data Content-Type.
This endpoint does not accept an index.html file nor assets files but a form field
+named remoteURL instead. Otherwise, URL conversions work the same as HTML conversions.
++ +Attention: when converting a website to PDF, you should remove all margins. +If not, some of the content of the page might be hidden.
+
$ curl --request POST \ + --url http://localhost:3000/convert/url \ + --header 'Content-Type: multipart/form-data' \ + --form remoteURL=https://google.com + --form marginTop=0 \ + --form marginBottom=0 \ + --form marginLeft=0 \ + --form marginRight=0 \ + -o result.pdf ++ +
import "github.com/thecodingmachine/gotenberg/pkg" + +func main() { + c := &gotenberg.Client{Hostname: "http://localhost:3000"} + req := gotenberg.NewURLRequest("https://google.com") + req.SetMargins(gotenberg.NoMargins) + dest := "result.pdf" + c.Store(req, dest) +} ++ +
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->setMargins(Request::NO_MARGINS);
+$dest = "result.pdf";
+$filename = $client->store($request, $dest);
index.html. This function will convert a given markdown
func main() {
c := &gotenberg.Client{Hostname: "http://localhost:3000"}
- req, _ := gotenberg.NewMarkdownRequest("index.html", []string{"file.md"})
+ req, _ := gotenberg.NewMarkdownRequest("index.html", "file.md")
dest := "result.pdf"
c.Store(req, dest)
}
@@ -551,8 +621,8 @@ $markdowns = [
DocumentFactory::makeFromPath('file.md', 'file.md'),
];
$request = new MarkdownRequest($index, $markdowns);
-$dirPath = "/foo";
-$filename = $client->store($request, $dirPath);
+$dest = "result.pdf";
+$filename = $client->store($request, $dest);
@@ -613,7 +683,7 @@ See the scalability section to find how to mitigate t
func main() {
c := &gotenberg.Client{Hostname: "http://localhost:3000"}
- req, _ := gotenberg.NewOfficeRequest([]string{"document.docx", "document2.docx"})
+ req, _ := gotenberg.NewOfficeRequest("document.docx", "document2.docx")
dest := "result.pdf"
c.Store(req, dest)
}
@@ -633,8 +703,8 @@ $files = [
DocumentFactory::makeFromPath('document2.docx', 'document2.docx'),
];
$request = new OfficeRequest($files);
-$dirPath = "/foo";
-$filename = $client->store($request, $dirPath);
+$dest = "result.pdf";
+$filename = $client->store($request, $dest);
By default, only ttf-mscorefonts fonts are installed.
If you wish to use more fonts, you will have to create your own image:
- -FROM thecodingmachine/gotenberg:3 - -RUN apt-get -y install yourfonts --
You may now launch your services using:
@@ -868,6 +925,21 @@ a simpleGET request.
+ By default, a handful of fonts are installed. Asian characters are also supported out of the box.
+ +If you wish to use more fonts, you will have to create your own image:
+ +FROM thecodingmachine/gotenberg:4 + +RUN apt-get -y install yourfonts ++ +