This is a very simple webservice, that uses the amazing OpenHTML2PDF to convert HTML to PDF.
Currently there are two client implementations available:
To build the JAR file, run:
mvn clean packageBuild the docker image with:
docker build -t webservice-htmlpdf .Run the container with:
docker run -p 8080:8080 webservice-htmlpdf
This project includes the following open source fonts as replacements for the PDF base 14 fonts:
| Font Family | Font Files (TTF) | License |
|---|---|---|
| Nimbus Roman | NimbusRoman-Regular, -Bold, -Italic, | GPL or AFPL (URW++) |
| -BoldItalic | ||
| Nimbus Sans | NimbusSans-Regular, -Bold, -Italic, | GPL or AFPL (URW++) |
| -BoldItalic | ||
| Nimbus Mono PS | NimbusMonoPS-Regular, -Bold, -Italic, | GPL or AFPL (URW++) |
| -BoldItalic | ||
| Standard Symbols PS | StandardSymbolsPS | GPL or AFPL (URW++) |
| D050000L | D050000L | LaTeX Project Public License (LPPL) |
Font sources: URW++ Core 35 Fonts, D050000L
Please refer to the respective repositories for full license texts.
To test the service manually, run:
cd manual-testing
composer update
php test.php data/doc1/To check if the service is responsive one can execute a HTTP request against the servlet.context-path (default /Html2PDF/v1/)
Example:
curl http://localhost:8080/Html2PDF/v1/will return somthing like:
{"msg":"Service is running","success":true,"version":"1.1.3"}
The old "bshtml2pdf" service ran servlets on a Tomcat server and hat /BShtml2PDF as the base URL. This service runs standalone and therefore lacks the /BShtml2PDF base URL. The client implementation must be adjusted accordingly.
If that can not be done easily, one can start the service with the server.servlet.context-path parameter:
java -jar \
-Dserver.servlet.context-path=/BShtml2PDF \
htmlpdf-1.0.0-SNAPSHOT.jaror using the Docker image:
docker run -p 8080:8080 -e APP_PATH=/BShtml2PDF webservice-htmlpdf- Implement proper support for custom fonts (e.g. from inline CSS)