https://github.com/rocketbase-io/pdfmaker
3.6K
docker service of pdfmake - with pdf merge feature by use of node-pdftk.
source-code could be found on github rocketbase-io/pdfmaker
There are two api-endpoints:
For documentation to the JSON objects which are describe the content of the PDFs, look here at the pdfmake documentation.
In order to secure the services we only allow posting jsons. Therefor we added some extensions to the common pdfmake json-structure to provide similar features like page-numbers or custom-fonts.
| Configuration | Default | Description |
|---|---|---|
| DOCUMENT_SIZE_LIMIT | 5mb | for parsing we use body-parser that has a limit in parsing the jsons |
Images with urls are supported. Example:
{
"content": [
{
"image": "https://example.com/img/logo.png"
}
]
}
Note: Only PNGs and JPGs are supported.
Note: When the download of an image fails, the service will break with a 400 error.
Note: Data URLs are not supported since they can cause a 413 error.
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:
{
"content": [
{
"svg": "https://example.com/img/logo.svg"
},
{
"svg": "<svg width=\"300\" height=\"200\" viewBox=\"0 0 300 200\"><text x=\"0\" y=\"50\">Example Image</text></svg>"
}
]
}
Note: Only HTTPS urls are supported!
Note: When the download of a SVG fails, the service will break with a 400 error.
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:
{
"pageNumber": {
"text": "Page $currentPage$ of $pageCount$ pages",
"alignment": "center",
"bold": true
}
}
In all strings found in the element all $currentPage$ and $pageCount$ occurrences will be replaced except in image urls.
To custom/own fonts, you can use this property. Example:
{
"fonts": {
"Exo": "google-fonts:Exo",
"Exo 2": {
"normal": "https://example.com/fonts/exo-2-regular.ttf",
"italics": "https://example.com/fonts/exo-2-italics.ttf",
"bold": "https://example.com/fonts/exo-2-bold.ttf",
"bolditalics": "https://example.com/fonts/exo-2-bold-italics.ttf"
}
}
}
You can either add a Google Fonts service url or an object urls to the font.
Note: Only TrueType Fonts (TTF) are supported.
Note: When the download of a font fails, the service will break with a 400 error.
Note: When the fonts property is not given, the default fonts Roboto, OpenSans and Exo will be included into the document.
A Google Fonts service url can look like something like that:
google-fonts:Exogoogle-fonts:Exo 2:Regular,Boldgoogle-fonts:Exo:Regular,Italics,Bold,BoldItalics
Schema:google-fonts:[font-name]google-fonts:[font-name]:[regular variant],[bold variant]google-fonts:[font-name]:[regular variant],[bold variant],[italic variant],[bold italic variant]The variant is the suffix in the filename when downloading the zip archive with all fonts from the google fonts page. It must be one of theses:
Note: Not in all fonts, all variants are available. When a variant is not available the service will break with a 400 error.
ThinThinItalicLightLightItalicRegularItalicMediumMediumItalicSemiBoldSemiBoldItalicBoldBoldItalicExtraBoldExtraBoldItalicBlackBlackItalicI've you run it locally the host needs pdfpk installed.
WARNING: for mac users take a look here
npm run build && npm run start
Copyright (c) 2020 rocketbase.io
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Content type
Image
Digest
sha256:7d4bed02c…
Size
466.6 MB
Last updated
almost 4 years ago
docker pull rocketbaseio/pdfmaker