{"id":15045159,"url":"https://github.com/diomalta/html-pdf","last_synced_at":"2025-10-25T03:30:55.057Z","repository":{"id":214102465,"uuid":"735606418","full_name":"diomalta/html-pdf","owner":"diomalta","description":"This repository hosts a project that offers a streamlined method for converting HTML to PDF using Google Chrome.","archived":false,"fork":false,"pushed_at":"2025-01-15T23:48:48.000Z","size":98,"stargazers_count":2,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-31T05:33:05.629Z","etag":null,"topics":["chrome","html","pdf","pdf-generation"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/diomalta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-25T14:18:57.000Z","updated_at":"2024-01-25T15:14:08.000Z","dependencies_parsed_at":"2024-04-26T06:43:46.023Z","dependency_job_id":"a9fdf05e-eab4-408d-aa0a-ddea9c58aae1","html_url":"https://github.com/diomalta/html-pdf","commit_stats":null,"previous_names":["diomalta/html-pdf"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diomalta%2Fhtml-pdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diomalta%2Fhtml-pdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diomalta%2Fhtml-pdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diomalta%2Fhtml-pdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/diomalta","download_url":"https://codeload.github.com/diomalta/html-pdf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238071157,"owners_count":19411600,"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":["chrome","html","pdf","pdf-generation"],"created_at":"2024-09-24T20:51:31.612Z","updated_at":"2025-10-25T03:30:49.689Z","avatar_url":"https://github.com/diomalta.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HTML to PDF\n\nThis project provides an easy way to convert HTML to PDF using Google Chrome. It is designed to be used in a Docker environment. It is fast because it reuses the same instance of Chrome.\n\n## Prerequisites\n\n[Google Chrome installed on the Docker image](#notes)\n\n## Installation\n\n```bash\npnpm add @diomalta/html-pdf\n```\n\n## Usage\n\nFirst, import the `init` functions when initializing your application:\n\n```javascript\nimport { init, convertHtmlToPdf } from '@diomalta/html-pdf';\nimport Application from '@diomalta/http-server';\n\n// Initialize the HTML to PDF service\ninit({ port: 39489 });\n\n// Create a new Application instance\nconst app = new Application({ port: 3000 });\n\n// Define a GET route to convert HTML to PDF\napp.get('/html-to-pdf', (req, res) =\u003e {\n  const html = '\u003ch1\u003eHello, world!\u003c/h1\u003e';\n\n  const outputOptions = {\n    type: 'base64',\n  };\n\n  const base64Pdf = await convertHtmlToPdf({ html, outputOptions });\n\n  res.status(200).send(base64Pdf);\n});\n\n// Start the server on port 3000\napp.listen({ port: 3000 });\n```\n\n## Notes\n\nMake sure that Google Chrome is installed on your Docker image. If it is not, you can install it by adding the following lines to your Dockerfile:\n\n```dockerfile\nRUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -\nRUN sh -c 'echo \"deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main\" \u003e\u003e /etc/apt/sources.list.d/google.list'\nRUN apt-get update \u0026\u0026 apt-get install -y google-chrome-stable\n```\n\nThis will add the Google Chrome repository to the APT sources list, update the package list, and install Google Chrome.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](MIT-LICENSE.txt) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiomalta%2Fhtml-pdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiomalta%2Fhtml-pdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiomalta%2Fhtml-pdf/lists"}