diff --git a/README.md b/README.md index 5b0b53b..bd8d5c8 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,21 @@ # txPDF -txPDF is an HTML to PDF microservice by [txn2] +[txPDF] is an HTML to PDF microservice by [txn2]. [txPDF] is built on top of the [n2pdf] container exposing an API endpoint that returns a PDF document from web based **POST** request. + +Example Post Body: +```json +{ + "options": { + "print_media_type": true + }, + "pages": [ + { + "Location": "https://www.example.com" + } + ] +} +``` ## Docker Use @@ -14,6 +28,11 @@ Run the [txPDF Docker container] on your local workstation for testing. Forward docker run --rm -p 8080:8080 -e DEBUG=true txn2/txpdf ``` +## Curl Test +```bash +curl -d "@examples/days.json" -X POST http://localhost:8080/getPdf --output test.pdf +``` + [txPDF] can be configured with the following environment variables: | Variable | Default | Purpose | @@ -29,6 +48,7 @@ docker run --rm -p 8080:8080 -e DEBUG=true txn2/txpdf curl -d "@examples/multi-site.json" -X POST http://localhost:8080/getPdf --output test.pdf ``` +[n2pdf]:https://github.com/txn2/n2pdf [txPDF]:https://github.com/txn2/txpdf [txn2]:https://github.com/txn2 [txPDF Docker container]:https://hub.docker.com/r/txn2/txpdf/ \ No newline at end of file diff --git a/examples/simple.json b/examples/simple.json new file mode 100644 index 0000000..80466b2 --- /dev/null +++ b/examples/simple.json @@ -0,0 +1,10 @@ +{ + "options": { + "print_media_type": true + }, + "pages": [ + { + "Location": "https://www.example.com" + } + ] +} \ No newline at end of file