Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rocketbase-io/pdfmaker
docker service of pdfmake - with pdf merge feature
https://github.com/rocketbase-io/pdfmaker
docker docker-image pdf pdf-generation
Last synced: 2 months ago
JSON representation
docker service of pdfmake - with pdf merge feature
- Host: GitHub
- URL: https://github.com/rocketbase-io/pdfmaker
- Owner: rocketbase-io
- License: mit
- Created: 2019-06-24T09:08:36.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-04-07T21:21:52.000Z (almost 2 years ago)
- Last Synced: 2024-05-07T18:16:12.851Z (9 months ago)
- Topics: docker, docker-image, pdf, pdf-generation
- Language: TypeScript
- Size: 4.02 MB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pdfmaker
![logo](./assets/pdf-maker.svg)
[![Docker](https://badgen.net/badge/icon/docker?icon=docker&label)](https://hub.docker.com/repository/docker/rocketbaseio/pdfmaker)
Docker service of [pdfmake](http://pdfmake.org/) - with pdf merge feature by use of [pdf-merger-js](https://www.npmjs.com/package/pdf-merger-js).
# API
There are two API endpoints:
- [POST] /pdf/file requires a JSON object
- [POST] /pdf/files requires an array of JSON objectsFor documentation to the JSON objects which are describe the content of the PDFs, [look here at the pdfmake documentation](https://pdfmake.github.io/docs/).
## Fonts
Beside the default fonts: Times, Helvetica, Courier, Symbol the follow list of fonts is installed too:
- Roboto
- JosefinSans
- Lato
- OpenSans
- Poppins
- Merriweather## Image URLs
Also fallback URLs are supported. These urls can either be given per image or global on the object. Example:```json
{
"content": [
{
"image": "https://example.com/img/logo.png",
"fallback": "https://example.com/img/logo-placeholder.png"
}
],
"fallbackImage": "https://example.com/img/placeholder.png"
}
```**Note:** Only PNGs and JPGs are supported.
**Note:** When the download of an image + fallback fails the service will fallback to 1x1 purple png## SVG URLs
Downloading SVGs from urls is supported. It is nearly the same as Image URLs expect that it is also possible to give the SVG as string. Example:
```json
{
"content": [
{
"svg": "https://example.com/img/logo.svg"
},
{
"svg": "Example Image"
}
]
}
```**Note:** Fallbacks are not supported.
**Note:** When the download of an SVG fails, the service will fallback to 1x1 purple png## Page numbers
To add a page number on at the footer of each page, you can use this property. This property accepts an element for pdfmake.**Note:** this property will override the `footer` property!
Example:
```json
{
"pageNumber": {
"text": "Page $currentPage$ of $pageCount$ pages",
"alignment": "center"
}
}
```In all strings found in the element all $currentPage$ and $pageCount$ occurrences will be replaced.
## Merging PDFS
To merge multiple PDFs, an array of pdfmake json-objects have to be used as an input.```json
[
{
"content":
[
{"text": "Thats the content of the first page."}
]
},
{
"content":
[
{
"text": "Thats the content of the second page."
}
]
}
]
```**Note:** When merging multiple pdfs with each having separate ```pageNumber``` options. Each pdf will determine its page count independently.