mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-08 00:22:14 +01:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ef21c6ed6 | ||
|
|
6ee1932cbf | ||
|
|
83cf43a314 | ||
|
|
52c14a79a1 | ||
|
|
152db0551d | ||
|
|
3a2467ccfe | ||
|
|
5a28f3597c | ||
|
|
9ce179f91b | ||
|
|
7aeb072cc3 | ||
|
|
8a652761a3 | ||
|
|
be667575d5 | ||
|
|
59ca8a44a0 | ||
|
|
c9f0d3bfd8 |
@@ -11,13 +11,15 @@ env:
|
|||||||
- secure: CmLh169xwt3OC7l19lDUwdZYfw+l/+XXKjTGxnuJiXHa9hAH+nc4mEUSmqHMHwjquyYE6LnSVGZ94LH8sCaGed/TMm0Lj3DZtZ0VsjYu3sKsNrVJn5WdYEah+GvNJ8i8uzvHnGk1L2fAagLpXFUB2K9UraA1CFiHs1fF5Fua7Ra0mE7lMz0MFvyvzcmc9u8nMz71K2YVsXqn+I/rv8onJCTtc/Ds0hVrBXwG5Fh0T3xHqjOhME9ZI2hRHnnQVdBojSY3USifQ//qAKowfBVc0pebEtgFpyXx/I17A6xCm0KVtnA2tNqu1+XFkjWaBzryaLE9ujhJcTRC/YK0JUZ+QxfYbD5C7jVy9Jlx1lOEjJ42B/ImNxPP+9p3wi2MWNbcbZJPxIe635fnT17lI7CLK2Qg1xjfTQ4WTEKW5IhnYMiyfRKiripFh4PCkDm8cJlTbpntsX1n0uheydbsgf/11vS7o1WGhVQ8+Jelc4DvIbBHCqienQEOLJDBwm7FiK5JbwZJ6ZAGeDM/IhGU1h9PNjVbHUyJhUxYoPYUE9QsZFT7ENCrRQpq49KOzXBRfffyJNJRh+Ep9X5YoW0dUp0MNu5B7z2+6w9X9n/C+loa11xF42bFzniCvvbSOQ37J+EngDinVxJkNPeyivR4fye2ENhIAjAEjouTJLOSXL9nAOU=
|
- secure: CmLh169xwt3OC7l19lDUwdZYfw+l/+XXKjTGxnuJiXHa9hAH+nc4mEUSmqHMHwjquyYE6LnSVGZ94LH8sCaGed/TMm0Lj3DZtZ0VsjYu3sKsNrVJn5WdYEah+GvNJ8i8uzvHnGk1L2fAagLpXFUB2K9UraA1CFiHs1fF5Fua7Ra0mE7lMz0MFvyvzcmc9u8nMz71K2YVsXqn+I/rv8onJCTtc/Ds0hVrBXwG5Fh0T3xHqjOhME9ZI2hRHnnQVdBojSY3USifQ//qAKowfBVc0pebEtgFpyXx/I17A6xCm0KVtnA2tNqu1+XFkjWaBzryaLE9ujhJcTRC/YK0JUZ+QxfYbD5C7jVy9Jlx1lOEjJ42B/ImNxPP+9p3wi2MWNbcbZJPxIe635fnT17lI7CLK2Qg1xjfTQ4WTEKW5IhnYMiyfRKiripFh4PCkDm8cJlTbpntsX1n0uheydbsgf/11vS7o1WGhVQ8+Jelc4DvIbBHCqienQEOLJDBwm7FiK5JbwZJ6ZAGeDM/IhGU1h9PNjVbHUyJhUxYoPYUE9QsZFT7ENCrRQpq49KOzXBRfffyJNJRh+Ep9X5YoW0dUp0MNu5B7z2+6w9X9n/C+loa11xF42bFzniCvvbSOQ37J+EngDinVxJkNPeyivR4fye2ENhIAjAEjouTJLOSXL9nAOU=
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- lint
|
- tests
|
||||||
- publish
|
- publish
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
- stage: lint
|
- stage: tests
|
||||||
script: make lint
|
script: make lint
|
||||||
|
- stage: tests
|
||||||
|
script: make tests
|
||||||
- stage: publish
|
- stage: publish
|
||||||
if: tag IS present
|
if: tag IS present
|
||||||
script: make image VERSION=$TRAVIS_TAG && ./scripts/publish.sh $TRAVIS_TAG $DOCKER_USER $DOCKER_PASS
|
script: ./scripts/publish.sh $TRAVIS_TAG $DOCKER_USER $DOCKER_PASS
|
||||||
@@ -34,7 +34,7 @@ to learn how to interact with it!
|
|||||||
|
|
||||||
[](https://microbadger.com/images/thecodingmachine/gotenberg:3)
|
[](https://microbadger.com/images/thecodingmachine/gotenberg:3)
|
||||||
[](https://travis-ci.org/thecodingmachine/gotenberg)
|
[](https://travis-ci.org/thecodingmachine/gotenberg)
|
||||||
[](https://godoc.org/github.com/thecodingmachine/gotenberg?status.svg)
|
[](https://godoc.org/github.com/thecodingmachine/gotenberg)
|
||||||
[](https://goreportcard.com/report/thecodingmachine/gotenberg)
|
[](https://goreportcard.com/report/thecodingmachine/gotenberg)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ For instance:
|
|||||||
</html>
|
</html>
|
||||||
```
|
```
|
||||||
|
|
||||||
### Guzzle
|
### cURL
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ curl --request POST \
|
$ curl --request POST \
|
||||||
--url http://localhost:3000/convert/html \
|
--url http://localhost:3000/convert/html \
|
||||||
--header 'Content-Type: multipart/form-data' \
|
--header 'Content-Type: multipart/form-data' \
|
||||||
--form files=@index.html
|
--form files=@index.html \
|
||||||
> result.pdf
|
> result.pdf
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -53,7 +53,17 @@ func main() {
|
|||||||
|
|
||||||
### PHP
|
### PHP
|
||||||
|
|
||||||
TODO
|
```php
|
||||||
|
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);
|
||||||
|
$dirPath = "/foo";
|
||||||
|
$filename = $client->store($request, $dirPath);
|
||||||
|
```
|
||||||
|
|
||||||
## Header and footer
|
## Header and footer
|
||||||
|
|
||||||
@@ -90,15 +100,15 @@ The following classes allow you to inject printing values:
|
|||||||
> **Attention:** the CSS properties are independant of the ones used in the `index.html` file.
|
> **Attention:** the CSS properties are independant of the ones used in the `index.html` file.
|
||||||
> Also, `footer.html` CSS properties override the ones from `header.html`.
|
> Also, `footer.html` CSS properties override the ones from `header.html`.
|
||||||
|
|
||||||
### Guzzle
|
### cURL
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ curl --request POST \
|
$ curl --request POST \
|
||||||
--url http://localhost:3000/convert/html \
|
--url http://localhost:3000/convert/html \
|
||||||
--header 'Content-Type: multipart/form-data' \
|
--header 'Content-Type: multipart/form-data' \
|
||||||
--form files=@index.html
|
--form files=@index.html \
|
||||||
--form files=@header.html
|
--form files=@header.html \
|
||||||
--form files=@footer.html
|
--form files=@footer.html \
|
||||||
> result.pdf
|
> result.pdf
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -123,11 +133,25 @@ func main() {
|
|||||||
|
|
||||||
### PHP
|
### PHP
|
||||||
|
|
||||||
TODO
|
```php
|
||||||
|
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');
|
||||||
|
$header = DocumentFactory::makeFromPath('header.html', 'header.html');
|
||||||
|
$footer = DocumentFactory::makeFromPath('footer.html', 'footer.html');
|
||||||
|
$request = new HTMLRequest($index);
|
||||||
|
$request->setHeader($header);
|
||||||
|
$request->setFooter($footer);
|
||||||
|
$dirPath = "/foo";
|
||||||
|
$filename = $client->store($request, $dirPath);
|
||||||
|
```
|
||||||
|
|
||||||
## Assets
|
## Assets
|
||||||
|
|
||||||
You may also send additional files. For instance, images, fonts, stylesheets and so on.
|
You may also send additional files. For instance: images, fonts, stylesheets and so on.
|
||||||
|
|
||||||
The only requirement is to make sure that their paths
|
The only requirement is to make sure that their paths
|
||||||
are on the same level as the `index.html` file.
|
are on the same level as the `index.html` file.
|
||||||
@@ -169,16 +193,16 @@ You may also use *remote* paths for Google fonts, images and so on.
|
|||||||
> If you want to install fonts directly in the Gotenberg Docker image,
|
> If you want to install fonts directly in the Gotenberg Docker image,
|
||||||
> see to the [fonts section](#office.fonts).
|
> see to the [fonts section](#office.fonts).
|
||||||
|
|
||||||
### Guzzle
|
### cURL
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ curl --request POST \
|
$ curl --request POST \
|
||||||
--url http://localhost:3000/convert/html \
|
--url http://localhost:3000/convert/html \
|
||||||
--header 'Content-Type: multipart/form-data' \
|
--header 'Content-Type: multipart/form-data' \
|
||||||
--form files=@index.html
|
--form files=@index.html \
|
||||||
--form files=@style.css
|
--form files=@style.css \
|
||||||
--form files=@img.png
|
--form files=@img.png \
|
||||||
--form files=@font.woff
|
--form files=@font.woff \
|
||||||
> result.pdf
|
> result.pdf
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -204,31 +228,47 @@ func main() {
|
|||||||
|
|
||||||
### PHP
|
### PHP
|
||||||
|
|
||||||
TODO
|
```php
|
||||||
|
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');
|
||||||
|
$assets = [
|
||||||
|
DocumentFactory::makeFromPath('style.css', 'style.css'),
|
||||||
|
DocumentFactory::makeFromPath('img.png', 'img.png'),
|
||||||
|
DocumentFactory::makeFromPath('font.woff', 'font.woff'),
|
||||||
|
];
|
||||||
|
$request = new HTMLRequest($index);
|
||||||
|
$request->setAssets($assets);
|
||||||
|
$dirPath = "/foo";
|
||||||
|
$filename = $client->store($request, $dirPath);
|
||||||
|
```
|
||||||
|
|
||||||
## Paper size, margins, orientation
|
## Paper size, margins, orientation
|
||||||
|
|
||||||
You may also customize the resulting PDF paper.
|
You may also customize the resulting PDF format.
|
||||||
|
|
||||||
By default, it will be rendered in `A4` size with `1 inch` margins and `portrait` orientation.
|
By default, it will be rendered with `A4` size, `1 inch` margins and `portrait` orientation.
|
||||||
|
|
||||||
> Paper size and margins have to be provided in `inches`.
|
> Paper size and margins have to be provided in `inches`.
|
||||||
> Also, you have to set both `paperWidth` and `paperHeight`. Same for margins.
|
> Also, you have to set both `paperWidth` and `paperHeight`. Same for margins.
|
||||||
|
|
||||||
### Guzzle
|
### cURL
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ curl --request POST \
|
$ curl --request POST \
|
||||||
--url http://localhost:3000/convert/html \
|
--url http://localhost:3000/convert/html \
|
||||||
--header 'Content-Type: multipart/form-data' \
|
--header 'Content-Type: multipart/form-data' \
|
||||||
--form files=@index.html
|
--form files=@index.html \
|
||||||
--form paperWidth=8.27
|
--form paperWidth=8.27 \
|
||||||
--form paperHeight=11.27
|
--form paperHeight=11.27 \
|
||||||
--form marginTop=0
|
--form marginTop=0 \
|
||||||
--form marginBottom=0
|
--form marginBottom=0 \
|
||||||
--form marginLeft=0
|
--form marginLeft=0 \
|
||||||
--form marginRight=0
|
--form marginRight=0 \
|
||||||
--form landscape=true
|
--form landscape=true \
|
||||||
> result.pdf
|
> result.pdf
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -254,4 +294,18 @@ func main() {
|
|||||||
|
|
||||||
### PHP
|
### PHP
|
||||||
|
|
||||||
TODO
|
```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->setPaperSize(Request::A4);
|
||||||
|
$request->setMargins(Request::NO_MARGINS);
|
||||||
|
$request->setLandscape(true);
|
||||||
|
$dirPath = "/foo";
|
||||||
|
$filename = $client->store($request, $dirPath);
|
||||||
|
```
|
||||||
@@ -11,7 +11,7 @@ It accepts `POST` requests with a `multipart/form-data` Content-Type.
|
|||||||
Markdown conversions work the same as HTML conversions.
|
Markdown conversions work the same as HTML conversions.
|
||||||
|
|
||||||
Only difference is that you have access to the Go template function `toHTML`
|
Only difference is that you have access to the Go template function `toHTML`
|
||||||
in the file `index.html` which will convert a given markdown file to HTML.
|
in the file `index.html`. This function will convert a given markdown file to HTML.
|
||||||
|
|
||||||
For instance:
|
For instance:
|
||||||
|
|
||||||
@@ -28,14 +28,14 @@ For instance:
|
|||||||
</html>
|
</html>
|
||||||
```
|
```
|
||||||
|
|
||||||
### Guzzle
|
### cURL
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ curl --request POST \
|
$ curl --request POST \
|
||||||
--url http://localhost:3000/convert/markdown \
|
--url http://localhost:3000/convert/markdown \
|
||||||
--header 'Content-Type: multipart/form-data' \
|
--header 'Content-Type: multipart/form-data' \
|
||||||
--form files=@index.html
|
--form files=@index.html \
|
||||||
--form files=@file.md
|
--form files=@file.md \
|
||||||
> result.pdf
|
> result.pdf
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -59,4 +59,17 @@ func main() {
|
|||||||
|
|
||||||
### PHP
|
### PHP
|
||||||
|
|
||||||
TODO
|
```php
|
||||||
|
use TheCodingMachine\Gotenberg\Client;
|
||||||
|
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');
|
||||||
|
$markdowns = [
|
||||||
|
DocumentFactory::makeFromPath('file.md', 'file.md'),
|
||||||
|
];
|
||||||
|
$request = new MarkdownRequest($index, $markdowns);
|
||||||
|
$dirPath = "/foo";
|
||||||
|
$filename = $client->store($request, $dirPath);
|
||||||
|
```
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
title: Office
|
title: Office
|
||||||
---
|
---
|
||||||
|
|
||||||
Gotenberg provides the endpoint `/convert/office` for Office documents conversions.
|
Gotenberg provides the endpoint `/convert/office` for Office document conversions.
|
||||||
|
|
||||||
It accepts `POST` requests with a `multipart/form-data` Content-Type.
|
It accepts `POST` requests with a `multipart/form-data` Content-Type.
|
||||||
|
|
||||||
@@ -26,14 +26,14 @@ All files will be merged into a single resulting PDF.
|
|||||||
> That's why for Office conversions, the API does only one conversion at a time.
|
> That's why for Office conversions, the API does only one conversion at a time.
|
||||||
> See the [scalability section](#scalability) to find how to mitigate this issue.
|
> See the [scalability section](#scalability) to find how to mitigate this issue.
|
||||||
|
|
||||||
### Guzzle
|
### cURL
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ curl --request POST \
|
$ curl --request POST \
|
||||||
--url http://localhost:3000/convert/office \
|
--url http://localhost:3000/convert/office \
|
||||||
--header 'Content-Type: multipart/form-data' \
|
--header 'Content-Type: multipart/form-data' \
|
||||||
--form files=@document.docx
|
--form files=@document.docx \
|
||||||
--form files=@document2.docx
|
--form files=@document2.docx \
|
||||||
> result.pdf
|
> result.pdf
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -57,7 +57,20 @@ func main() {
|
|||||||
|
|
||||||
### PHP
|
### PHP
|
||||||
|
|
||||||
TODO
|
```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'),
|
||||||
|
DocumentFactory::makeFromPath('document2.docx', 'document2.docx'),
|
||||||
|
];
|
||||||
|
$request = new OfficeRequest($files);
|
||||||
|
$dirPath = "/foo";
|
||||||
|
$filename = $client->store($request, $dirPath);
|
||||||
|
```
|
||||||
|
|
||||||
## Fonts
|
## Fonts
|
||||||
|
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ It accepts `POST` requests with a `multipart/form-data` Content-Type.
|
|||||||
Nothing special here: you may send one or more PDF files and the API
|
Nothing special here: you may send one or more PDF files and the API
|
||||||
will merge them and return the resulting PDF file.
|
will merge them and return the resulting PDF file.
|
||||||
|
|
||||||
### Guzzle
|
### cURL
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ curl --request POST \
|
$ curl --request POST \
|
||||||
--url http://localhost:3000/merge \
|
--url http://localhost:3000/merge \
|
||||||
--header 'Content-Type: multipart/form-data' \
|
--header 'Content-Type: multipart/form-data' \
|
||||||
--form files=@file.pdf
|
--form files=@file.pdf \
|
||||||
--form files=@file2.pdf
|
--form files=@file2.pdf \
|
||||||
> result.pdf
|
> result.pdf
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -42,4 +42,17 @@ func main() {
|
|||||||
|
|
||||||
### PHP
|
### PHP
|
||||||
|
|
||||||
TODO
|
```php
|
||||||
|
use TheCodingMachine\Gotenberg\Client;
|
||||||
|
use TheCodingMachine\Gotenberg\DocumentFactory;
|
||||||
|
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'),
|
||||||
|
];
|
||||||
|
$request = new MergeRequest($files);
|
||||||
|
$dirPath = "/foo";
|
||||||
|
$filename = $client->store($request, $dirPath);
|
||||||
|
```
|
||||||
@@ -7,19 +7,18 @@ All endpoints accept a form field named `webhookURL`.
|
|||||||
If provided, the API will send the resulting PDF file in a `POST` request with the `application/pdf` Content-Type
|
If provided, the API will send the resulting PDF file in a `POST` request with the `application/pdf` Content-Type
|
||||||
to given URL.
|
to given URL.
|
||||||
|
|
||||||
By doing so, your requests to the API will be done before the conversions are actually done!
|
By doing so, your requests to the API will be over before the conversions are actually done!
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
### Guzzle
|
### cURL
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ curl --request POST \
|
$ curl --request POST \
|
||||||
--url http://localhost:3000/convert/html \
|
--url http://localhost:3000/convert/html \
|
||||||
--header 'Content-Type: multipart/form-data' \
|
--header 'Content-Type: multipart/form-data' \
|
||||||
--form files=@index.html
|
--form files=@index.html \
|
||||||
--form webhookURL='http://myapp.com/webhook/'
|
--form webhookURL='http://myapp.com/webhook/'
|
||||||
> result.pdf
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Go
|
### Go
|
||||||
@@ -42,4 +41,14 @@ func main() {
|
|||||||
|
|
||||||
### PHP
|
### PHP
|
||||||
|
|
||||||
TODO
|
```php
|
||||||
|
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/');
|
||||||
|
$resp = $client->post($request);
|
||||||
|
```
|
||||||
218
docs/index.html
218
docs/index.html
@@ -168,15 +168,15 @@ which will be converted to PDF.</p>
|
|||||||
<span class="p"><</span><span class="p">/</span><span class="nt">html</span><span class="p">></span>
|
<span class="p"><</span><span class="p">/</span><span class="nt">html</span><span class="p">></span>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="html.basic.guzzle" href="#html.basic.guzzle">
|
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="html.basic.c_url" href="#html.basic.c_url">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
</a>Guzzle</h3>
|
</a>cURL</h3>
|
||||||
|
|
||||||
<pre class="chroma">$ curl --request POST <span class="se">\
|
<pre class="chroma">$ curl --request POST <span class="se">\
|
||||||
</span><span class="se"></span> --url http://localhost:3000/convert/html <span class="se">\
|
</span><span class="se"></span> --url http://localhost:3000/convert/html <span class="se">\
|
||||||
</span><span class="se"></span> --header <span class="s1">'Content-Type: multipart/form-data'</span> <span class="se">\
|
</span><span class="se"></span> --header <span class="s1">'Content-Type: multipart/form-data'</span> <span class="se">\
|
||||||
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@index.html
|
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@index.html <span class="se">\
|
||||||
> result.pdf
|
</span><span class="se"></span> > result.pdf
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="html.basic.go" href="#html.basic.go">
|
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="html.basic.go" href="#html.basic.go">
|
||||||
@@ -199,7 +199,16 @@ which will be converted to PDF.</p>
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
</a>PHP</h3>
|
</a>PHP</h3>
|
||||||
|
|
||||||
<p>TODO</p>
|
<pre class="chroma"><span class="x">use TheCodingMachine\Gotenberg\Client;
|
||||||
|
</span><span class="x">use TheCodingMachine\Gotenberg\DocumentFactory;
|
||||||
|
</span><span class="x">use TheCodingMachine\Gotenberg\HTMLRequest;
|
||||||
|
</span><span class="x">
|
||||||
|
</span><span class="x">$client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client());
|
||||||
|
</span><span class="x">$index = DocumentFactory::makeFromPath('index.html', 'index.html');
|
||||||
|
</span><span class="x">$request = new HTMLRequest($index);
|
||||||
|
</span><span class="x">$dirPath = "/foo";
|
||||||
|
</span><span class="x">$filename = $client->store($request, $dirPath);
|
||||||
|
</span><span class="x"></span></pre>
|
||||||
|
|
||||||
<h2 class="Heading"><a class="Anchor" aria-hidden="true" id="html.header_and_footer" href="#html.header_and_footer">
|
<h2 class="Heading"><a class="Anchor" aria-hidden="true" id="html.header_and_footer" href="#html.header_and_footer">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
@@ -241,17 +250,17 @@ Respectively, a file named <code>header.html</code> and <code>footer.html</code>
|
|||||||
Also, <code>footer.html</code> CSS properties override the ones from <code>header.html</code>.</p>
|
Also, <code>footer.html</code> CSS properties override the ones from <code>header.html</code>.</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="html.header_and_footer.guzzle" href="#html.header_and_footer.guzzle">
|
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="html.header_and_footer.c_url" href="#html.header_and_footer.c_url">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
</a>Guzzle</h3>
|
</a>cURL</h3>
|
||||||
|
|
||||||
<pre class="chroma">$ curl --request POST <span class="se">\
|
<pre class="chroma">$ curl --request POST <span class="se">\
|
||||||
</span><span class="se"></span> --url http://localhost:3000/convert/html <span class="se">\
|
</span><span class="se"></span> --url http://localhost:3000/convert/html <span class="se">\
|
||||||
</span><span class="se"></span> --header <span class="s1">'Content-Type: multipart/form-data'</span> <span class="se">\
|
</span><span class="se"></span> --header <span class="s1">'Content-Type: multipart/form-data'</span> <span class="se">\
|
||||||
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@index.html
|
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@index.html <span class="se">\
|
||||||
--form <span class="nv">files</span><span class="o">=</span>@header.html
|
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@header.html <span class="se">\
|
||||||
--form <span class="nv">files</span><span class="o">=</span>@footer.html
|
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@footer.html <span class="se">\
|
||||||
> result.pdf
|
</span><span class="se"></span> > result.pdf
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="html.header_and_footer.go" href="#html.header_and_footer.go">
|
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="html.header_and_footer.go" href="#html.header_and_footer.go">
|
||||||
@@ -278,13 +287,26 @@ Also, <code>footer.html</code> CSS properties override the ones from <code>heade
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
</a>PHP</h3>
|
</a>PHP</h3>
|
||||||
|
|
||||||
<p>TODO</p>
|
<pre class="chroma"><span class="x">use TheCodingMachine\Gotenberg\Client;
|
||||||
|
</span><span class="x">use TheCodingMachine\Gotenberg\DocumentFactory;
|
||||||
|
</span><span class="x">use TheCodingMachine\Gotenberg\HTMLRequest;
|
||||||
|
</span><span class="x">
|
||||||
|
</span><span class="x">$client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client());
|
||||||
|
</span><span class="x">$index = DocumentFactory::makeFromPath('index.html', 'index.html');
|
||||||
|
</span><span class="x">$header = DocumentFactory::makeFromPath('header.html', 'header.html');
|
||||||
|
</span><span class="x">$footer = DocumentFactory::makeFromPath('footer.html', 'footer.html');
|
||||||
|
</span><span class="x">$request = new HTMLRequest($index);
|
||||||
|
</span><span class="x">$request->setHeader($header);
|
||||||
|
</span><span class="x">$request->setFooter($footer);
|
||||||
|
</span><span class="x">$dirPath = "/foo";
|
||||||
|
</span><span class="x">$filename = $client->store($request, $dirPath);
|
||||||
|
</span><span class="x"></span></pre>
|
||||||
|
|
||||||
<h2 class="Heading"><a class="Anchor" aria-hidden="true" id="html.assets" href="#html.assets">
|
<h2 class="Heading"><a class="Anchor" aria-hidden="true" id="html.assets" href="#html.assets">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
</a>Assets</h2>
|
</a>Assets</h2>
|
||||||
|
|
||||||
<p>You may also send additional files. For instance, images, fonts, stylesheets and so on.</p>
|
<p>You may also send additional files. For instance: images, fonts, stylesheets and so on.</p>
|
||||||
|
|
||||||
<p>The only requirement is to make sure that their paths
|
<p>The only requirement is to make sure that their paths
|
||||||
are on the same level as the <code>index.html</code> file.</p>
|
are on the same level as the <code>index.html</code> file.</p>
|
||||||
@@ -326,18 +348,18 @@ are on the same level as the <code>index.html</code> file.</p>
|
|||||||
see to the <a href="#office.fonts">fonts section</a>.</p>
|
see to the <a href="#office.fonts">fonts section</a>.</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="html.assets.guzzle" href="#html.assets.guzzle">
|
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="html.assets.c_url" href="#html.assets.c_url">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
</a>Guzzle</h3>
|
</a>cURL</h3>
|
||||||
|
|
||||||
<pre class="chroma">$ curl --request POST <span class="se">\
|
<pre class="chroma">$ curl --request POST <span class="se">\
|
||||||
</span><span class="se"></span> --url http://localhost:3000/convert/html <span class="se">\
|
</span><span class="se"></span> --url http://localhost:3000/convert/html <span class="se">\
|
||||||
</span><span class="se"></span> --header <span class="s1">'Content-Type: multipart/form-data'</span> <span class="se">\
|
</span><span class="se"></span> --header <span class="s1">'Content-Type: multipart/form-data'</span> <span class="se">\
|
||||||
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@index.html
|
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@index.html <span class="se">\
|
||||||
--form <span class="nv">files</span><span class="o">=</span>@style.css
|
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@style.css <span class="se">\
|
||||||
--form <span class="nv">files</span><span class="o">=</span>@img.png
|
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@img.png <span class="se">\
|
||||||
--form <span class="nv">files</span><span class="o">=</span>@font.woff
|
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@font.woff <span class="se">\
|
||||||
> result.pdf
|
</span><span class="se"></span> > result.pdf
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="html.assets.go" href="#html.assets.go">
|
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="html.assets.go" href="#html.assets.go">
|
||||||
@@ -365,37 +387,52 @@ see to the <a href="#office.fonts">fonts section</a>.</p>
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
</a>PHP</h3>
|
</a>PHP</h3>
|
||||||
|
|
||||||
<p>TODO</p>
|
<pre class="chroma"><span class="x">use TheCodingMachine\Gotenberg\Client;
|
||||||
|
</span><span class="x">use TheCodingMachine\Gotenberg\DocumentFactory;
|
||||||
|
</span><span class="x">use TheCodingMachine\Gotenberg\HTMLRequest;
|
||||||
|
</span><span class="x">
|
||||||
|
</span><span class="x">$client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client());
|
||||||
|
</span><span class="x">$index = DocumentFactory::makeFromPath('index.html', 'index.html');
|
||||||
|
</span><span class="x">$assets = [
|
||||||
|
</span><span class="x"> DocumentFactory::makeFromPath('style.css', 'style.css'),
|
||||||
|
</span><span class="x"> DocumentFactory::makeFromPath('img.png', 'img.png'),
|
||||||
|
</span><span class="x"> DocumentFactory::makeFromPath('font.woff', 'font.woff'),
|
||||||
|
</span><span class="x">];
|
||||||
|
</span><span class="x">$request = new HTMLRequest($index);
|
||||||
|
</span><span class="x">$request->setAssets($assets);
|
||||||
|
</span><span class="x">$dirPath = "/foo";
|
||||||
|
</span><span class="x">$filename = $client->store($request, $dirPath);
|
||||||
|
</span><span class="x"></span></pre>
|
||||||
|
|
||||||
<h2 class="Heading"><a class="Anchor" aria-hidden="true" id="html.paper_size_margins_orientation" href="#html.paper_size_margins_orientation">
|
<h2 class="Heading"><a class="Anchor" aria-hidden="true" id="html.paper_size_margins_orientation" href="#html.paper_size_margins_orientation">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
</a>Paper size, margins, orientation</h2>
|
</a>Paper size, margins, orientation</h2>
|
||||||
|
|
||||||
<p>You may also customize the resulting PDF paper.</p>
|
<p>You may also customize the resulting PDF format.</p>
|
||||||
|
|
||||||
<p>By default, it will be rendered in <code>A4</code> size with <code>1 inch</code> margins and <code>portrait</code> orientation.</p>
|
<p>By default, it will be rendered with <code>A4</code> size, <code>1 inch</code> margins and <code>portrait</code> orientation.</p>
|
||||||
|
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p>Paper size and margins have to be provided in <code>inches</code>.
|
<p>Paper size and margins have to be provided in <code>inches</code>.
|
||||||
Also, you have to set both <code>paperWidth</code> and <code>paperHeight</code>. Same for margins.</p>
|
Also, you have to set both <code>paperWidth</code> and <code>paperHeight</code>. Same for margins.</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="html.paper_size_margins_orientation.guzzle" href="#html.paper_size_margins_orientation.guzzle">
|
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="html.paper_size_margins_orientation.c_url" href="#html.paper_size_margins_orientation.c_url">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
</a>Guzzle</h3>
|
</a>cURL</h3>
|
||||||
|
|
||||||
<pre class="chroma">$ curl --request POST <span class="se">\
|
<pre class="chroma">$ curl --request POST <span class="se">\
|
||||||
</span><span class="se"></span> --url http://localhost:3000/convert/html <span class="se">\
|
</span><span class="se"></span> --url http://localhost:3000/convert/html <span class="se">\
|
||||||
</span><span class="se"></span> --header <span class="s1">'Content-Type: multipart/form-data'</span> <span class="se">\
|
</span><span class="se"></span> --header <span class="s1">'Content-Type: multipart/form-data'</span> <span class="se">\
|
||||||
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@index.html
|
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@index.html <span class="se">\
|
||||||
--form <span class="nv">paperWidth</span><span class="o">=</span><span class="m">8</span>.27
|
</span><span class="se"></span> --form <span class="nv">paperWidth</span><span class="o">=</span><span class="m">8</span>.27 <span class="se">\
|
||||||
--form <span class="nv">paperHeight</span><span class="o">=</span><span class="m">11</span>.27
|
</span><span class="se"></span> --form <span class="nv">paperHeight</span><span class="o">=</span><span class="m">11</span>.27 <span class="se">\
|
||||||
--form <span class="nv">marginTop</span><span class="o">=</span><span class="m">0</span>
|
</span><span class="se"></span> --form <span class="nv">marginTop</span><span class="o">=</span><span class="m">0</span> <span class="se">\
|
||||||
--form <span class="nv">marginBottom</span><span class="o">=</span><span class="m">0</span>
|
</span><span class="se"></span> --form <span class="nv">marginBottom</span><span class="o">=</span><span class="m">0</span> <span class="se">\
|
||||||
--form <span class="nv">marginLeft</span><span class="o">=</span><span class="m">0</span>
|
</span><span class="se"></span> --form <span class="nv">marginLeft</span><span class="o">=</span><span class="m">0</span> <span class="se">\
|
||||||
--form <span class="nv">marginRight</span><span class="o">=</span><span class="m">0</span>
|
</span><span class="se"></span> --form <span class="nv">marginRight</span><span class="o">=</span><span class="m">0</span> <span class="se">\
|
||||||
--form <span class="nv">landscape</span><span class="o">=</span><span class="nb">true</span>
|
</span><span class="se"></span> --form <span class="nv">landscape</span><span class="o">=</span><span class="nb">true</span> <span class="se">\
|
||||||
> result.pdf
|
</span><span class="se"></span> > result.pdf
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="html.paper_size_margins_orientation.go" href="#html.paper_size_margins_orientation.go">
|
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="html.paper_size_margins_orientation.go" href="#html.paper_size_margins_orientation.go">
|
||||||
@@ -423,7 +460,20 @@ Also, you have to set both <code>paperWidth</code> and <code>paperHeight</code>.
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
</a>PHP</h3>
|
</a>PHP</h3>
|
||||||
|
|
||||||
<p>TODO</p>
|
<pre class="chroma"><span class="x">use TheCodingMachine\Gotenberg\Client;
|
||||||
|
</span><span class="x">use TheCodingMachine\Gotenberg\DocumentFactory;
|
||||||
|
</span><span class="x">use TheCodingMachine\Gotenberg\HTMLRequest;
|
||||||
|
</span><span class="x">use TheCodingMachine\Gotenberg\Request;
|
||||||
|
</span><span class="x">
|
||||||
|
</span><span class="x">$client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client());
|
||||||
|
</span><span class="x">$index = DocumentFactory::makeFromPath('index.html', 'index.html');
|
||||||
|
</span><span class="x">$request = new HTMLRequest($index);
|
||||||
|
</span><span class="x">$request->setPaperSize(Request::A4);
|
||||||
|
</span><span class="x">$request->setMargins(Request::NO_MARGINS);
|
||||||
|
</span><span class="x">$request->setLandscape(true);
|
||||||
|
</span><span class="x">$dirPath = "/foo";
|
||||||
|
</span><span class="x">$filename = $client->store($request, $dirPath);
|
||||||
|
</span><span class="x"></span></pre>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -442,7 +492,7 @@ Also, you have to set both <code>paperWidth</code> and <code>paperHeight</code>.
|
|||||||
<p>Markdown conversions work the same as HTML conversions.</p>
|
<p>Markdown conversions work the same as HTML conversions.</p>
|
||||||
|
|
||||||
<p>Only difference is that you have access to the Go template function <code>toHTML</code>
|
<p>Only difference is that you have access to the Go template function <code>toHTML</code>
|
||||||
in the file <code>index.html</code> which will convert a given markdown file to HTML.</p>
|
in the file <code>index.html</code>. This function will convert a given markdown file to HTML.</p>
|
||||||
|
|
||||||
<p>For instance:</p>
|
<p>For instance:</p>
|
||||||
|
|
||||||
@@ -458,16 +508,16 @@ in the file <code>index.html</code> which will convert a given markdown file to
|
|||||||
<span class="p"><</span><span class="p">/</span><span class="nt">html</span><span class="p">></span>
|
<span class="p"><</span><span class="p">/</span><span class="nt">html</span><span class="p">></span>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="markdown.basic.guzzle" href="#markdown.basic.guzzle">
|
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="markdown.basic.c_url" href="#markdown.basic.c_url">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
</a>Guzzle</h3>
|
</a>cURL</h3>
|
||||||
|
|
||||||
<pre class="chroma">$ curl --request POST <span class="se">\
|
<pre class="chroma">$ curl --request POST <span class="se">\
|
||||||
</span><span class="se"></span> --url http://localhost:3000/convert/markdown <span class="se">\
|
</span><span class="se"></span> --url http://localhost:3000/convert/markdown <span class="se">\
|
||||||
</span><span class="se"></span> --header <span class="s1">'Content-Type: multipart/form-data'</span> <span class="se">\
|
</span><span class="se"></span> --header <span class="s1">'Content-Type: multipart/form-data'</span> <span class="se">\
|
||||||
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@index.html
|
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@index.html <span class="se">\
|
||||||
--form <span class="nv">files</span><span class="o">=</span>@file.md
|
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@file.md <span class="se">\
|
||||||
> result.pdf
|
</span><span class="se"></span> > result.pdf
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="markdown.basic.go" href="#markdown.basic.go">
|
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="markdown.basic.go" href="#markdown.basic.go">
|
||||||
@@ -493,7 +543,19 @@ in the file <code>index.html</code> which will convert a given markdown file to
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
</a>PHP</h3>
|
</a>PHP</h3>
|
||||||
|
|
||||||
<p>TODO</p>
|
<pre class="chroma"><span class="x">use TheCodingMachine\Gotenberg\Client;
|
||||||
|
</span><span class="x">use TheCodingMachine\Gotenberg\DocumentFactory;
|
||||||
|
</span><span class="x">use TheCodingMachine\Gotenberg\MarkdownRequest;
|
||||||
|
</span><span class="x">
|
||||||
|
</span><span class="x">$client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client());
|
||||||
|
</span><span class="x">$index = DocumentFactory::makeFromPath('index.html', 'index.html');
|
||||||
|
</span><span class="x">$markdowns = [
|
||||||
|
</span><span class="x"> DocumentFactory::makeFromPath('file.md', 'file.md'),
|
||||||
|
</span><span class="x">];
|
||||||
|
</span><span class="x">$request = new MarkdownRequest($index, $markdowns);
|
||||||
|
</span><span class="x">$dirPath = "/foo";
|
||||||
|
</span><span class="x">$filename = $client->store($request, $dirPath);
|
||||||
|
</span><span class="x"></span></pre>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -501,7 +563,7 @@ in the file <code>index.html</code> which will convert a given markdown file to
|
|||||||
<h1 class="Heading"><a class="Anchor" aria-hidden="true" id="office" href="#office">
|
<h1 class="Heading"><a class="Anchor" aria-hidden="true" id="office" href="#office">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
</a>Office</h1>
|
</a>Office</h1>
|
||||||
<p>Gotenberg provides the endpoint <code>/convert/office</code> for Office documents conversions.</p>
|
<p>Gotenberg provides the endpoint <code>/convert/office</code> for Office document conversions.</p>
|
||||||
|
|
||||||
<p>It accepts <code>POST</code> requests with a <code>multipart/form-data</code> Content-Type.</p>
|
<p>It accepts <code>POST</code> requests with a <code>multipart/form-data</code> Content-Type.</p>
|
||||||
|
|
||||||
@@ -531,16 +593,16 @@ That’s why for Office conversions, the API does only one conversion at a time.
|
|||||||
See the <a href="#scalability">scalability section</a> to find how to mitigate this issue.</p>
|
See the <a href="#scalability">scalability section</a> to find how to mitigate this issue.</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="office.basic.guzzle" href="#office.basic.guzzle">
|
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="office.basic.c_url" href="#office.basic.c_url">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
</a>Guzzle</h3>
|
</a>cURL</h3>
|
||||||
|
|
||||||
<pre class="chroma">$ curl --request POST <span class="se">\
|
<pre class="chroma">$ curl --request POST <span class="se">\
|
||||||
</span><span class="se"></span> --url http://localhost:3000/convert/office <span class="se">\
|
</span><span class="se"></span> --url http://localhost:3000/convert/office <span class="se">\
|
||||||
</span><span class="se"></span> --header <span class="s1">'Content-Type: multipart/form-data'</span> <span class="se">\
|
</span><span class="se"></span> --header <span class="s1">'Content-Type: multipart/form-data'</span> <span class="se">\
|
||||||
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@document.docx
|
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@document.docx <span class="se">\
|
||||||
--form <span class="nv">files</span><span class="o">=</span>@document2.docx
|
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@document2.docx <span class="se">\
|
||||||
> result.pdf
|
</span><span class="se"></span> > result.pdf
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="office.basic.go" href="#office.basic.go">
|
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="office.basic.go" href="#office.basic.go">
|
||||||
@@ -566,7 +628,19 @@ See the <a href="#scalability">scalability section</a> to find how to mitigate t
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
</a>PHP</h3>
|
</a>PHP</h3>
|
||||||
|
|
||||||
<p>TODO</p>
|
<pre class="chroma"><span class="x">use TheCodingMachine\Gotenberg\Client;
|
||||||
|
</span><span class="x">use TheCodingMachine\Gotenberg\DocumentFactory;
|
||||||
|
</span><span class="x">use TheCodingMachine\Gotenberg\OfficeRequest;
|
||||||
|
</span><span class="x">
|
||||||
|
</span><span class="x">$client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client());
|
||||||
|
</span><span class="x">$files = [
|
||||||
|
</span><span class="x"> DocumentFactory::makeFromPath('document.docx', 'document.docx'),
|
||||||
|
</span><span class="x"> DocumentFactory::makeFromPath('document2.docx', 'document2.docx'),
|
||||||
|
</span><span class="x">];
|
||||||
|
</span><span class="x">$request = new OfficeRequest($files);
|
||||||
|
</span><span class="x">$dirPath = "/foo";
|
||||||
|
</span><span class="x">$filename = $client->store($request, $dirPath);
|
||||||
|
</span><span class="x"></span></pre>
|
||||||
|
|
||||||
<h2 class="Heading"><a class="Anchor" aria-hidden="true" id="office.fonts" href="#office.fonts">
|
<h2 class="Heading"><a class="Anchor" aria-hidden="true" id="office.fonts" href="#office.fonts">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
@@ -598,16 +672,16 @@ See the <a href="#scalability">scalability section</a> to find how to mitigate t
|
|||||||
<p>Nothing special here: you may send one or more PDF files and the API
|
<p>Nothing special here: you may send one or more PDF files and the API
|
||||||
will merge them and return the resulting PDF file.</p>
|
will merge them and return the resulting PDF file.</p>
|
||||||
|
|
||||||
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="merge.basic.guzzle" href="#merge.basic.guzzle">
|
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="merge.basic.c_url" href="#merge.basic.c_url">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
</a>Guzzle</h3>
|
</a>cURL</h3>
|
||||||
|
|
||||||
<pre class="chroma">$ curl --request POST <span class="se">\
|
<pre class="chroma">$ curl --request POST <span class="se">\
|
||||||
</span><span class="se"></span> --url http://localhost:3000/merge <span class="se">\
|
</span><span class="se"></span> --url http://localhost:3000/merge <span class="se">\
|
||||||
</span><span class="se"></span> --header <span class="s1">'Content-Type: multipart/form-data'</span> <span class="se">\
|
</span><span class="se"></span> --header <span class="s1">'Content-Type: multipart/form-data'</span> <span class="se">\
|
||||||
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@file.pdf
|
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@file.pdf <span class="se">\
|
||||||
--form <span class="nv">files</span><span class="o">=</span>@file2.pdf
|
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@file2.pdf <span class="se">\
|
||||||
> result.pdf
|
</span><span class="se"></span> > result.pdf
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="merge.basic.go" href="#merge.basic.go">
|
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="merge.basic.go" href="#merge.basic.go">
|
||||||
@@ -633,7 +707,19 @@ will merge them and return the resulting PDF file.</p>
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
</a>PHP</h3>
|
</a>PHP</h3>
|
||||||
|
|
||||||
<p>TODO</p>
|
<pre class="chroma"><span class="x">use TheCodingMachine\Gotenberg\Client;
|
||||||
|
</span><span class="x">use TheCodingMachine\Gotenberg\DocumentFactory;
|
||||||
|
</span><span class="x">use TheCodingMachine\Gotenberg\MergeRequest;
|
||||||
|
</span><span class="x">
|
||||||
|
</span><span class="x">$client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client());
|
||||||
|
</span><span class="x">$files = [
|
||||||
|
</span><span class="x"> DocumentFactory::makeFromPath('file.pdf', 'file.pdf'),
|
||||||
|
</span><span class="x"> DocumentFactory::makeFromPath('file2.pdf', 'file2.pdf'),
|
||||||
|
</span><span class="x">];
|
||||||
|
</span><span class="x">$request = new MergeRequest($files);
|
||||||
|
</span><span class="x">$dirPath = "/foo";
|
||||||
|
</span><span class="x">$filename = $client->store($request, $dirPath);
|
||||||
|
</span><span class="x"></span></pre>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -646,22 +732,21 @@ will merge them and return the resulting PDF file.</p>
|
|||||||
<p>If provided, the API will send the resulting PDF file in a <code>POST</code> request with the <code>application/pdf</code> Content-Type
|
<p>If provided, the API will send the resulting PDF file in a <code>POST</code> request with the <code>application/pdf</code> Content-Type
|
||||||
to given URL.</p>
|
to given URL.</p>
|
||||||
|
|
||||||
<p>By doing so, your requests to the API will be done before the conversions are actually done!</p>
|
<p>By doing so, your requests to the API will be over before the conversions are actually done!</p>
|
||||||
|
|
||||||
<h2 class="Heading"><a class="Anchor" aria-hidden="true" id="webhook.examples" href="#webhook.examples">
|
<h2 class="Heading"><a class="Anchor" aria-hidden="true" id="webhook.examples" href="#webhook.examples">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
</a>Examples</h2>
|
</a>Examples</h2>
|
||||||
|
|
||||||
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="webhook.examples.guzzle" href="#webhook.examples.guzzle">
|
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="webhook.examples.c_url" href="#webhook.examples.c_url">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
</a>Guzzle</h3>
|
</a>cURL</h3>
|
||||||
|
|
||||||
<pre class="chroma">$ curl --request POST <span class="se">\
|
<pre class="chroma">$ curl --request POST <span class="se">\
|
||||||
</span><span class="se"></span> --url http://localhost:3000/convert/html <span class="se">\
|
</span><span class="se"></span> --url http://localhost:3000/convert/html <span class="se">\
|
||||||
</span><span class="se"></span> --header <span class="s1">'Content-Type: multipart/form-data'</span> <span class="se">\
|
</span><span class="se"></span> --header <span class="s1">'Content-Type: multipart/form-data'</span> <span class="se">\
|
||||||
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@index.html
|
</span><span class="se"></span> --form <span class="nv">files</span><span class="o">=</span>@index.html <span class="se">\
|
||||||
--form <span class="nv">webhookURL</span><span class="o">=</span><span class="s1">'http://myapp.com/webhook/'</span>
|
</span><span class="se"></span> --form <span class="nv">webhookURL</span><span class="o">=</span><span class="s1">'http://myapp.com/webhook/'</span>
|
||||||
> result.pdf
|
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="webhook.examples.go" href="#webhook.examples.go">
|
<h3 class="Heading"><a class="Anchor" aria-hidden="true" id="webhook.examples.go" href="#webhook.examples.go">
|
||||||
@@ -687,7 +772,16 @@ to given URL.</p>
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
||||||
</a>PHP</h3>
|
</a>PHP</h3>
|
||||||
|
|
||||||
<p>TODO</p>
|
<pre class="chroma"><span class="x">use TheCodingMachine\Gotenberg\Client;
|
||||||
|
</span><span class="x">use TheCodingMachine\Gotenberg\DocumentFactory;
|
||||||
|
</span><span class="x">use TheCodingMachine\Gotenberg\HTMLRequest;
|
||||||
|
</span><span class="x">
|
||||||
|
</span><span class="x">$client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client());
|
||||||
|
</span><span class="x">$index = DocumentFactory::makeFromPath('index.html', 'index.html');
|
||||||
|
</span><span class="x">$request = new HTMLRequest($index);
|
||||||
|
</span><span class="x">$request->setWebhookURL('http://myapp.com/webhook/');
|
||||||
|
</span><span class="x">$resp = $client->post($request);
|
||||||
|
</span><span class="x"></span></pre>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestHTML(t *testing.T) {
|
func TestHTML(t *testing.T) {
|
||||||
body, contentType := test.HTMLMultipartForm(t)
|
body, contentType := test.HTMLTestMultipartForm(t)
|
||||||
req := httptest.NewRequest(http.MethodPost, "/convert/html", body)
|
req := httptest.NewRequest(http.MethodPost, "/convert/html", body)
|
||||||
req.Header.Set(echo.HeaderContentType, contentType)
|
req.Header.Set(echo.HeaderContentType, contentType)
|
||||||
rec := httptest.NewRecorder()
|
rec := httptest.NewRecorder()
|
||||||
e := echo.New()
|
e := echo.New()
|
||||||
c := e.NewContext(req, rec)
|
c := e.NewContext(req, rec)
|
||||||
assert.NoError(t, convertHTML(c))
|
if assert.NoError(t, convertHTML(c)) {
|
||||||
|
assert.Equal(t, http.StatusOK, rec.Code)
|
||||||
|
assert.Equal(t, "application/pdf", rec.Header().Get(echo.HeaderContentType))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,11 +11,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestMarkdown(t *testing.T) {
|
func TestMarkdown(t *testing.T) {
|
||||||
body, contentType := test.MarkdownMultipartForm(t)
|
body, contentType := test.MarkdownTestMultipartForm(t)
|
||||||
req := httptest.NewRequest(http.MethodPost, "/convert/markdown", body)
|
req := httptest.NewRequest(http.MethodPost, "/convert/markdown", body)
|
||||||
req.Header.Set(echo.HeaderContentType, contentType)
|
req.Header.Set(echo.HeaderContentType, contentType)
|
||||||
rec := httptest.NewRecorder()
|
rec := httptest.NewRecorder()
|
||||||
e := echo.New()
|
e := echo.New()
|
||||||
c := e.NewContext(req, rec)
|
c := e.NewContext(req, rec)
|
||||||
assert.NoError(t, convertMarkdown(c))
|
if assert.NoError(t, convertMarkdown(c)) {
|
||||||
|
assert.Equal(t, http.StatusOK, rec.Code)
|
||||||
|
assert.Equal(t, "application/pdf", rec.Header().Get(echo.HeaderContentType))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,22 +25,25 @@ func merge(c echo.Context) error {
|
|||||||
return fmt.Errorf("getting result file name: %v", err)
|
return fmt.Errorf("getting result file name: %v", err)
|
||||||
}
|
}
|
||||||
filename := fmt.Sprintf("%s.pdf", baseFilename)
|
filename := fmt.Sprintf("%s.pdf", baseFilename)
|
||||||
dest := fmt.Sprintf("%s/%s", r.dirPath, filename)
|
fpath := fmt.Sprintf("%s/%s", r.dirPath, filename)
|
||||||
if r.webhookURL() == "" {
|
if r.webhookURL() == "" {
|
||||||
// if no webhook URL given, run merge
|
// if no webhook URL given, run merge
|
||||||
// and directly return the resulting PDF file
|
// and directly return the resulting PDF file
|
||||||
// or and error.
|
// or and error.
|
||||||
return printer.Merge(fpaths, dest)
|
if err := printer.Merge(fpaths, fpath); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return c.Attachment(fpath, filename)
|
||||||
}
|
}
|
||||||
// as a webhook URL has been given, we
|
// as a webhook URL has been given, we
|
||||||
// run the following lines in a goroutine so that
|
// run the following lines in a goroutine so that
|
||||||
// it doesn't block.
|
// it doesn't block.
|
||||||
go func() {
|
go func() {
|
||||||
if err := printer.Merge(fpaths, dest); err != nil {
|
if err := printer.Merge(fpaths, fpath); err != nil {
|
||||||
c.Logger().Errorf("%v", err)
|
c.Logger().Errorf("%v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
f, err := os.Open(dest)
|
f, err := os.Open(fpath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Logger().Errorf("%v", err)
|
c.Logger().Errorf("%v", err)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -11,11 +11,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestMerge(t *testing.T) {
|
func TestMerge(t *testing.T) {
|
||||||
body, contentType := test.PDFMultipartForm(t)
|
body, contentType := test.PDFTestMultipartForm(t)
|
||||||
req := httptest.NewRequest(http.MethodPost, "/merge", body)
|
req := httptest.NewRequest(http.MethodPost, "/merge", body)
|
||||||
req.Header.Set(echo.HeaderContentType, contentType)
|
req.Header.Set(echo.HeaderContentType, contentType)
|
||||||
rec := httptest.NewRecorder()
|
rec := httptest.NewRecorder()
|
||||||
e := echo.New()
|
e := echo.New()
|
||||||
c := e.NewContext(req, rec)
|
c := e.NewContext(req, rec)
|
||||||
assert.NoError(t, merge(c))
|
if assert.NoError(t, merge(c)) {
|
||||||
|
assert.Equal(t, http.StatusOK, rec.Code)
|
||||||
|
assert.Equal(t, "application/pdf", rec.Header().Get(echo.HeaderContentType))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,11 +11,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestOffice(t *testing.T) {
|
func TestOffice(t *testing.T) {
|
||||||
body, contentType := test.OfficeMultipartForm(t)
|
body, contentType := test.OfficeTestMultipartForm(t)
|
||||||
req := httptest.NewRequest(http.MethodPost, "/convert/office", body)
|
req := httptest.NewRequest(http.MethodPost, "/convert/office", body)
|
||||||
req.Header.Set(echo.HeaderContentType, contentType)
|
req.Header.Set(echo.HeaderContentType, contentType)
|
||||||
rec := httptest.NewRecorder()
|
rec := httptest.NewRecorder()
|
||||||
e := echo.New()
|
e := echo.New()
|
||||||
c := e.NewContext(req, rec)
|
c := e.NewContext(req, rec)
|
||||||
assert.NoError(t, convertOffice(c))
|
if assert.NoError(t, convertOffice(c)) {
|
||||||
|
assert.Equal(t, http.StatusOK, rec.Code)
|
||||||
|
assert.Equal(t, "application/pdf", rec.Header().Get(echo.HeaderContentType))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,8 +54,9 @@ func (c *Chrome) getFullname() string {
|
|||||||
|
|
||||||
func (c *Chrome) isViable() bool {
|
func (c *Chrome) isViable() bool {
|
||||||
// check if Chrome is correctly running.
|
// check if Chrome is correctly running.
|
||||||
devt := devtool.New("http://127.0.0.1:9222")
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
_, err := devt.Create(context.TODO())
|
defer cancel()
|
||||||
|
_, err := devtool.New("http://localhost:9222").Version(ctx)
|
||||||
return err == nil
|
return err == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,14 +36,15 @@ const defaultHeaderFooterHTML string = "<html><head></head><body></body></html>"
|
|||||||
// Print converts HTML to PDF.
|
// Print converts HTML to PDF.
|
||||||
// Credits: https://medium.com/compass-true-north/go-service-to-convert-web-pages-to-pdf-using-headless-chrome-5fd9ffbae1af
|
// Credits: https://medium.com/compass-true-north/go-service-to-convert-web-pages-to-pdf-using-headless-chrome-5fd9ffbae1af
|
||||||
func (html *HTML) Print(destination string) error {
|
func (html *HTML) Print(destination string) error {
|
||||||
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
defer cancel()
|
||||||
// use the DevTools HTTP/JSON API to manage targets (e.g. pages, webworkers).
|
// use the DevTools HTTP/JSON API to manage targets (e.g. pages, webworkers).
|
||||||
devt := devtool.New("http://127.0.0.1:9222")
|
devt, err := devtool.New("http://localhost:9222").Version(ctx)
|
||||||
pt, err := devt.Create(html.Context)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("creating DevTools target: %v", err)
|
return fmt.Errorf("creating DevTools target: %v", err)
|
||||||
}
|
}
|
||||||
// open a new RPC connection to the Chrome Debugging Protocol target.
|
// open a new RPC connection to the Chrome Debugging Protocol target.
|
||||||
conn, err := rpcc.DialContext(html.Context, pt.WebSocketDebuggerURL)
|
conn, err := rpcc.DialContext(html.Context, devt.WebSocketDebuggerURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("creating RPC connection: %v", err)
|
return fmt.Errorf("creating RPC connection: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ func Merge(fpaths []string, destination string) error {
|
|||||||
|
|
||||||
func writeBytesToFile(dst string, b []byte) error {
|
func writeBytesToFile(dst string, b []byte) error {
|
||||||
if err := ioutil.WriteFile(dst, b, 0644); err != nil {
|
if err := ioutil.WriteFile(dst, b, 0644); err != nil {
|
||||||
return fmt.Errorf("%s: writting file: %v", dst, err)
|
return fmt.Errorf("%s: writing file: %v", dst, err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ func multipartForm(req Request) (*bytes.Buffer, string, error) {
|
|||||||
}
|
}
|
||||||
for name, value := range req.getFormValues() {
|
for name, value := range req.getFormValues() {
|
||||||
if err := writer.WriteField(name, value); err != nil {
|
if err := writer.WriteField(name, value); err != nil {
|
||||||
return nil, "", fmt.Errorf("%s: writting form field: %v", name, err)
|
return nil, "", fmt.Errorf("%s: writing form field: %v", name, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return body, writer.FormDataContentType(), nil
|
return body, writer.FormDataContentType(), nil
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ For instance, if you want to convert HTML:
|
|||||||
},
|
},
|
||||||
Options: &gotenberg.HTMLOptions{
|
Options: &gotenberg.HTMLOptions{
|
||||||
HeaderFilePath: "header.html",
|
HeaderFilePath: "header.html",
|
||||||
FooterFilePath: "footer.html",
|
FooterFilePath: "footer.html",
|
||||||
PaperSize: gotenberg.A4,
|
PaperSize: gotenberg.A4,
|
||||||
PaperMargins: gotenberg.NormalMargins,
|
PaperMargins: gotenberg.NormalMargins,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
dest := "foo.pdf"
|
dest := "foo.pdf"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
GOLANG_VERSION=1.11.2
|
||||||
VERSION="$1"
|
VERSION="$1"
|
||||||
DOCKER_USER="$2"
|
DOCKER_USER="$2"
|
||||||
DOCKER_PASSWORD="$3"
|
DOCKER_PASSWORD="$3"
|
||||||
@@ -16,6 +17,15 @@ if [ $VERSION_LENGTH -ne 3 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker push thecodingmachine/gotenberg:${SEMVER[0]}
|
docker build -t thecodingmachine/gotenberg:base -f build/base/Dockerfile .
|
||||||
docker push thecodingmachine/gotenberg:${SEMVER[0]}.${SEMVER[1]}
|
docker build \
|
||||||
docker push thecodingmachine/gotenberg:${SEMVER[0]}.${SEMVER[1]}.${SEMVER[2]}
|
--build-arg GOLANG_VERSION=${GOLANG_VERSION} \
|
||||||
|
--build-arg VERSION=${VERSION} \
|
||||||
|
-t thecodingmachine/gotenberg:${SEMVER[0]} \
|
||||||
|
-t thecodingmachine/gotenberg:${SEMVER[0]}.${SEMVER[1]} \
|
||||||
|
-t thecodingmachine/gotenberg:${SEMVER[0]}.${SEMVER[1]}.${SEMVER[2]} \
|
||||||
|
-f build/package/Dockerfile .
|
||||||
|
|
||||||
|
docker push "thecodingmachine/gotenberg:${SEMVER[0]}"
|
||||||
|
docker push "thecodingmachine/gotenberg:${SEMVER[0]}.${SEMVER[1]}"
|
||||||
|
docker push "thecodingmachine/gotenberg:${SEMVER[0]}.${SEMVER[1]}.${SEMVER[2]}"
|
||||||
@@ -16,31 +16,31 @@ import (
|
|||||||
"github.com/thecodingmachine/gotenberg/internal/pkg/rand"
|
"github.com/thecodingmachine/gotenberg/internal/pkg/rand"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HTMLMultipartForm returns the body
|
// HTMLTestMultipartForm returns the body
|
||||||
// for a multipate/form-data request with all
|
// for a multipate/form-data request with all
|
||||||
// files under "html" folder.
|
// files under "html" folder.
|
||||||
func HTMLMultipartForm(t *testing.T) (*bytes.Buffer, string) {
|
func HTMLTestMultipartForm(t *testing.T) (*bytes.Buffer, string) {
|
||||||
return multipartForm(t, "html")
|
return multipartForm(t, "html")
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarkdownMultipartForm returns the body
|
// MarkdownTestMultipartForm returns the body
|
||||||
// for a multipate/form-data request with all
|
// for a multipate/form-data request with all
|
||||||
// files under "markdown" folder.
|
// files under "markdown" folder.
|
||||||
func MarkdownMultipartForm(t *testing.T) (*bytes.Buffer, string) {
|
func MarkdownTestMultipartForm(t *testing.T) (*bytes.Buffer, string) {
|
||||||
return multipartForm(t, "markdown")
|
return multipartForm(t, "markdown")
|
||||||
}
|
}
|
||||||
|
|
||||||
// OfficeMultipartForm returns the body
|
// OfficeTestMultipartForm returns the body
|
||||||
// for a multipate/form-data request with all
|
// for a multipate/form-data request with all
|
||||||
// files under "office" folder.
|
// files under "office" folder.
|
||||||
func OfficeMultipartForm(t *testing.T) (*bytes.Buffer, string) {
|
func OfficeTestMultipartForm(t *testing.T) (*bytes.Buffer, string) {
|
||||||
return multipartForm(t, "office")
|
return multipartForm(t, "office")
|
||||||
}
|
}
|
||||||
|
|
||||||
// PDFMultipartForm returns the body
|
// PDFTestMultipartForm returns the body
|
||||||
// for a multipate/form-data request with all
|
// for a multipate/form-data request with all
|
||||||
// files under "pdf" folder.
|
// files under "pdf" folder.
|
||||||
func PDFMultipartForm(t *testing.T) (*bytes.Buffer, string) {
|
func PDFTestMultipartForm(t *testing.T) (*bytes.Buffer, string) {
|
||||||
return multipartForm(t, "pdf")
|
return multipartForm(t, "pdf")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user