{"id":18482630,"url":"https://github.com/kdcio/serverless-html-to-pdf","last_synced_at":"2025-09-12T19:33:41.399Z","repository":{"id":38426108,"uuid":"340229157","full_name":"kdcio/serverless-html-to-pdf","owner":"kdcio","description":"Serverless API that converts HTML pages to PDF documents","archived":false,"fork":false,"pushed_at":"2022-11-10T20:22:09.000Z","size":18179,"stargazers_count":3,"open_issues_count":11,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-08T05:44:43.228Z","etag":null,"topics":["aws","convert","html","html-to-pdf","lambda","pdf","pdf-generation","serverless"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kdcio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-19T01:48:53.000Z","updated_at":"2023-07-22T23:16:05.000Z","dependencies_parsed_at":"2023-01-21T08:15:18.576Z","dependency_job_id":null,"html_url":"https://github.com/kdcio/serverless-html-to-pdf","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/kdcio/serverless-html-to-pdf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdcio%2Fserverless-html-to-pdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdcio%2Fserverless-html-to-pdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdcio%2Fserverless-html-to-pdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdcio%2Fserverless-html-to-pdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kdcio","download_url":"https://codeload.github.com/kdcio/serverless-html-to-pdf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdcio%2Fserverless-html-to-pdf/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260933092,"owners_count":23084933,"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":["aws","convert","html","html-to-pdf","lambda","pdf","pdf-generation","serverless"],"created_at":"2024-11-06T12:29:23.928Z","updated_at":"2025-06-20T11:04:43.910Z","avatar_url":"https://github.com/kdcio.png","language":"JavaScript","funding_links":["https://www.buymeacoffee.com/o4f0WYV"],"categories":[],"sub_categories":[],"readme":"# Serverless HTML to PDF API\n\nThis creates an API (AWS API Gateway and lambda) that converts HTML pages to PDF documents using [wkhtmltopdf](https://wkhtmltopdf.org/) (0.12.4). It implements a simple interface to read an HTML input and output PDF content.\n\nThis project is a fork of [zeplin/zeplin-html-to-pdf](https://github.com/zeplin/zeplin-html-to-pdf).\n\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/kdcio/serverless-html-to-pdf) [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/kdcio/serverless-html-to-pdf/Build%20and%20Test)](https://github.com/kdcio/serverless-html-to-pdf/actions/workflows/push.yml)\n\n## Setup\n\n```bash\ngit clone https://github.com/kdcio/serverless-html-to-pdf.git\ncd serverless-html-to-pdf\nnpm install\n```\n\n## Run in local environment\n\nRequires docker to simulate lambda environment.\n\n```bash\nnpm start\n```\n\n## Usage\n\n### API POST\n\n```http\nPOST http://localhost:3000\nContent-Type: application/json\n\n{\n  \"html\": \"\u003c!DOCTYPE html\u003e\u003chtml\u003e\u003chead\u003e\u003ctitle\u003eHTML doc\u003c/title\u003e\u003c/head\u003e\u003cbody\u003eContent\u003c/body\u003e\u003c/html\u003e\"\n}\n```\n\nSee [tests/api.http](tests/api.http) to try. You'll need to open this project on [VS Code](https://code.visualstudio.com/https://code.visualstudio.com/) with [REST Client](https://marketplace.visualstudio.com/items?itemName=humao.rest-client) extension for it to work.\n\n### API Output\n\nIt yields a response in the following format:\n\n```json\n{\n  \"data\": \"JVBERi0xLjQKMSAwIG9iago8PAovVGl0bGUgKP7...\"\n}\n```\n\n`data` is base64 encoding of the converted PDF file.\n\n### Example\n\nRun example API client code in [example/client.js](example/client.js):\n\n```bash\nnpm run client\n```\n\nThis will generate `base64.pdf` file.\n\n## Deploying to AWS\n\nDeploy using your `default` AWS profile in `ap-southeast-1` region and `Asia/Manila` timezone.\n\n```bash\nnpm run deploy\n```\n\nCustomize the parameters by creating a config for your stage. For example, create the file `config.prod.yml` in the project root with the contents below.\n\n```yml\nREGION: us-east-1\nPROFILE: production\nTZ: America/New_York\n```\n\nTo use that config file, run the command below:\n\n```bash\nnpm run deploy prod\n```\n\n## Star Me\n\nIf you find this project useful, please consider giving a star. I would really appreciate it.\n\nYou can also:\n\n[![Buy Me A Coffee](https://cdn.buymeacoffee.com/buttons/default-yellow.png)](https://www.buymeacoffee.com/o4f0WYV)\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdcio%2Fserverless-html-to-pdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkdcio%2Fserverless-html-to-pdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdcio%2Fserverless-html-to-pdf/lists"}