{"id":21214402,"url":"https://github.com/oberonamsterdam/docker-wkhtmltopdf","last_synced_at":"2025-07-10T10:30:21.195Z","repository":{"id":45346203,"uuid":"129765615","full_name":"oberonamsterdam/docker-wkhtmltopdf","owner":"oberonamsterdam","description":null,"archived":false,"fork":false,"pushed_at":"2021-12-19T13:34:52.000Z","size":11,"stargazers_count":18,"open_issues_count":5,"forks_count":11,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-04-16T22:29:01.319Z","etag":null,"topics":["dockerfile","wkhtmltopdf"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oberonamsterdam.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":"2018-04-16T15:30:28.000Z","updated_at":"2023-08-22T04:17:16.000Z","dependencies_parsed_at":"2022-08-04T14:02:50.015Z","dependency_job_id":null,"html_url":"https://github.com/oberonamsterdam/docker-wkhtmltopdf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oberonamsterdam%2Fdocker-wkhtmltopdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oberonamsterdam%2Fdocker-wkhtmltopdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oberonamsterdam%2Fdocker-wkhtmltopdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oberonamsterdam%2Fdocker-wkhtmltopdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oberonamsterdam","download_url":"https://codeload.github.com/oberonamsterdam/docker-wkhtmltopdf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225632181,"owners_count":17499742,"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":["dockerfile","wkhtmltopdf"],"created_at":"2024-11-20T21:27:44.481Z","updated_at":"2024-11-20T21:27:45.133Z","avatar_url":"https://github.com/oberonamsterdam.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"// 2020-08-31: Merged PR from \"bonashen\" https://github.com/bonashen, adding example code for using options\n// 2019-10-02: Reverting back to python2 due to errors, no time for fixing these\n// 2019-09-02: Build using v0.12.5-1 from DEB-package, updated to Ubuntu 18.04, updated to python3 due to end-of-support python2\n// 2018-03-08: Build using v0.12.4 from binary instead of 0.12.2 using apt-get\n// 2018-04-16: Moved to https://hub.docker.com/r/oberonamsterdam/wkhtmltopdf/, adding github repo for Dockerfile\n\nBased on https://hub.docker.com/r/openlabs/docker-wkhtmltopdf-aas/\n\nChanges:\n\n* Using Ubuntu 18.04 instead of 14.04\n* Adding XVFB/libfontconfig to correctly render external fonts\n* Updated WKHTMLTOPDF to 0.12.5-1\n* Updated to Python3\n\n# Running the container\nThis will create a service on port \u003cport\u003e (only advised for testing-purpose)\n\n`docker run -d -p \u003cport\u003e:80 oberonamsterdam/wkhtmltopdf`\n\nOn production it's advised to run container as a service and expose to your own containers only.\n\n# Using the webservice\n\nThere are multiple ways to generate a PDF of HTML using the\nservice: uploading a HTML file\n\nThis is a convenient way to use the service from command line\nutilities like curl.\n\n`curl -X POST -vv -F 'file=@path/to/local/file.html' http://\u003cdocker-host\u003e:\u003cport\u003e/ -o path/to/output/file.pdf`\n\nwhere:\n\n    docker-host is the hostname or address of the docker host running the container\n    port is the public port to which the container is bound to.\n\n# Example PHP code using options\n\n```$options = [\n\t'margin-top' =\u003e '25',\n\t'margin-left' =\u003e '25',\n\t'margin-right' =\u003e '25',\n\t'margin-bottom' =\u003e '25',\n\t'page-size' =\u003e 'A4',\n\t'footer-spacing' =\u003e '5',\n\t'footer-font-size' =\u003e 6,\n\t'footer-right' =\u003e 'Page [page] of [topage]',\n];\n\n$html = file_gets_content('test.html');\n$data = json_encode([\n   'contents' =\u003e base64_encode($html),\n   'options' =\u003e $options,\n]);\n\n$ch = curl_init();\ncurl_setopt_array($ch, [\n   CURLOPT_URL =\u003e 'http://\u003cdocker-host\u003e:\u003cport\u003e',\n   CURLOPT_POST =\u003e true,\n   CURLOPT_RETURNTRANSFER =\u003e true,\n   CURLOPT_HTTPHEADER =\u003e ['Content-Type: application/json'],\n   CURLOPT_POSTFIELDS =\u003e $data,\n]);\n\n$result = curl_exec($ch);\n```\n\n$result will contain the binary PDF output.\n\n# Using images in your HTML\n\n1. Use absolute URLs to your images and make sure these URLs are accessible for the wkhtmltopdf-container\n2. Mount your files into the wkhtmltopdf-container and use local images: https://stackoverflow.com/questions/16627310/wkhtmltopdf-not-loading-local-css-and-images\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foberonamsterdam%2Fdocker-wkhtmltopdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foberonamsterdam%2Fdocker-wkhtmltopdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foberonamsterdam%2Fdocker-wkhtmltopdf/lists"}