Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tecnospeed/pastor
A RESTful API to generate PDF converting from HTML
https://github.com/tecnospeed/pastor
docker headless-chrome nodejs pdf restful-api web
Last synced: 3 months ago
JSON representation
A RESTful API to generate PDF converting from HTML
- Host: GitHub
- URL: https://github.com/tecnospeed/pastor
- Owner: tecnospeed
- License: mit
- Archived: true
- Created: 2017-07-25T19:16:09.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-04-16T12:44:27.000Z (over 4 years ago)
- Last Synced: 2024-07-21T00:34:48.546Z (4 months ago)
- Topics: docker, headless-chrome, nodejs, pdf, restful-api, web
- Language: JavaScript
- Homepage:
- Size: 148 KB
- Stars: 66
- Watchers: 7
- Forks: 13
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Pastor
A RESTful API to generate Portable Document Format (PDF) converting from Hypertext Markup Language (HTML).
## API Usage
### Sending an URL
It's possible to request by GET for an URL (at the query string) to be converted:
```
http://localhost:8080?url=http%3A%2F%2Faddress
```
The URL can also be informed as **multipart/form-data**, an example of `curl` command:
```bash
curl -X POST \
http://localhost:8080/ \
-H 'cache-control: no-cache' \
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
-F url=http://address
```
Or as JSON (`content-type: application/json`):
```json
{
"url": "http://address"
}
```### Sending a HTML file
The way to send the HTML to be converted is send it as **multipart/form-data**, follows an example of `curl` command:
```bash
curl -X POST \
http://localhost:8080/ \
-H 'cache-control: no-cache' \
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
-F 'html=@/example'
```## Docker
It can be found at the Docker Hub as [tecnospeed/pastor](https://hub.docker.com/r/tecnospeed/pastor/).
More details can be found at the [pastor's Wiki](https://github.com/tecnospeed/pastor/wiki/Docker).
## Demo
The project is running under the name TecnoSpeed Printer at:
```
https://api.tecnospeed.com.br/printer/v1
```
For demonstration, feel free to use the token below:
```
x-api-key: xbVP99TsPA5ZvVTjg41BI9YNfYfxKB549wfZI3FC
```
Just here is necessary to explicitly request for a pdf:
```
Accept: application/pdf
```