{"id":21436786,"url":"https://github.com/modfin/betterpress","last_synced_at":"2025-07-21T23:32:10.731Z","repository":{"id":47567817,"uuid":"188240892","full_name":"modfin/betterpress","owner":"modfin","description":"html to pdf microservice","archived":false,"fork":false,"pushed_at":"2023-11-15T12:21:20.000Z","size":18,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-08T10:23:47.285Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/modfin/betterpress","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/modfin.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-23T13:35:34.000Z","updated_at":"2024-09-05T13:48:29.000Z","dependencies_parsed_at":"2022-09-02T20:52:37.794Z","dependency_job_id":null,"html_url":"https://github.com/modfin/betterpress","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/modfin/betterpress","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modfin%2Fbetterpress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modfin%2Fbetterpress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modfin%2Fbetterpress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modfin%2Fbetterpress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/modfin","download_url":"https://codeload.github.com/modfin/betterpress/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/modfin%2Fbetterpress/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265305747,"owners_count":23743894,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-23T00:15:35.143Z","updated_at":"2025-07-21T23:32:10.670Z","avatar_url":"https://github.com/modfin.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Betterpress\n\nBetterpress wraps [openhtmltopdf](https://github.com/danfickle/openhtmltopdf) in a Spark server inside a docker container. This makes for a convenient pdf generation service over http.\n\n### User Guide\n\n1. Download/run the docker image:\n    ```bash\n    docker run -p 7357:8080 modfin/betterpress\n    ```\n\n1. Send files over http as multipart form data where the index file/entry point must have `name` property `index.html`. This looks something like the following:\n    ```\n    POST /\n    User-Agent: myagent\n    Accept: */*\n    Host: localhost:7357\n    accept-encoding: gzip, deflate\n    content-type: multipart/form-data; boundary=myboundary\n    content-length: 192668\n    \n    --myboundary\n    Content-Disposition: form-data; name=\"index.html\"; filename=\"myindexfile.html\"\n    \n    [index.html binary]\n    --myboundary\n    Content-Disposition: form-data; name=\"styles.css\"; filename=\"styles.css\"\n    \n    [styles.css binary]\n    --myboundary\n    Content-Disposition: form-data; name=\"font.ttf\"; filename=\"font.ttf\"\n    \n    [font.ttf binary]\n    --myboundary--\n    ```\n    :information_source: tip - don't write this by hand, use a http library :)\n\n1. Betterpress will reply with the generated pdf file\n\n### Notes\n\nBetterpress always uses `W3CDom().fromJsoup(indexDoc)` mentioned in [the openhtmltopdf integration guide](https://github.com/danfickle/openhtmltopdf/wiki/Integration-Guide#html5-parser-support). I.e. make sure to send `index.html` in html5 format. Note that css2.1 still is a limit so e.g. for fonts we must use `@font-face` instead of `@import`.\n\n### Dev\n\nRelease new versions of the docker image unto [dockerhub](https://hub.docker.com/r/modfin/betterpress):\n\n```bash\ndocker login --username=yourhubusername # then enter pass \n./docker-build-push.sh\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodfin%2Fbetterpress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmodfin%2Fbetterpress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodfin%2Fbetterpress/lists"}