Skip to content

Commit b555adc

Browse files
committed
improved README
1 parent 742e18f commit b555adc

1 file changed

Lines changed: 39 additions & 1 deletion

File tree

README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,37 @@
22

33
This is a work in progress for a PDF generation micro-service.
44

5-
## Getting started
5+
## Getting started using this microservice in your project
6+
7+
If you use Docker Compose (hopefully with [`kool`](https://github.com/kool-dev/kool) to make things simpler) you can get PDF generation on your project with a few simple steps:
8+
9+
- Add the service to your `docker-compose.yml` file:
10+
11+
```yml
12+
pdf:
13+
image: "kooldev/pdf:latest"
14+
expose:
15+
- 3000
16+
```
17+
18+
- After starting the service containers (with either `kool start` or `docker-compose up -d`), you can already start using the microservice to make PDFs! Example using PHP:
19+
20+
```php
21+
use GuzzleHttp\Client;
22+
23+
$pdf = (new Client())->post('http://pdf/from-html', [
24+
'form_params' => [
25+
'html' => '<h1>This is my super kool HTML that I want to turn into an awesome PDF file!</h1> <p> This is a very silly example, but you get the idea of how powerful this is <b>:)</b> </p>',
26+
],
27+
])->getBody();
28+
29+
file_put_contents('path/to/my/super-kool.pdf', $pdf);
30+
```
31+
32+
* Important to notice, the code above assumes you are running it from within another container in the same Docker Compose application so the `pdf` domain resolves to our microservice.
33+
34+
## Getting started on developing locally this microservice
35+
636
To get started with development locally (using [`kool`](https://github.com/kool-dev/kool), of course!):
737

838
- Fork the repo.
@@ -13,6 +43,14 @@ To get started with development locally (using [`kool`](https://github.com/kool-
1343

1444
In order to manage dependencies and run commands, please remind of using `kool run yarn` to stick with one single yarn version.
1545

46+
## Roadmap
47+
48+
Soon to be added wishes:
49+
50+
- Parameters to better control Javascript execution/wait condition.
51+
- Conversion to images also.
52+
- Got some _kool_ feature you are not seeing? Please open a ticket to suggest it!
53+
1654
## API
1755

1856
The API will provide endpoints for generating PDFs on the fly and returning them right away.

0 commit comments

Comments
 (0)