{"id":13578223,"url":"https://github.com/danielwestendorf/breezy-pdf-lite","last_synced_at":"2025-04-05T16:32:04.065Z","repository":{"id":36699130,"uuid":"137251026","full_name":"danielwestendorf/breezy-pdf-lite","owner":"danielwestendorf","description":"HTML/CSS/JS in, PDF out, via Chrome","archived":false,"fork":false,"pushed_at":"2023-09-11T12:47:42.000Z","size":858,"stargazers_count":394,"open_issues_count":13,"forks_count":22,"subscribers_count":11,"default_branch":"main","last_synced_at":"2024-11-05T15:49:36.906Z","etag":null,"topics":["headless-chrome","pdf-generation","pdf-rendering"],"latest_commit_sha":null,"homepage":"https://breezypdf.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielwestendorf.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-06-13T17:48:34.000Z","updated_at":"2024-10-02T14:01:46.000Z","dependencies_parsed_at":"2024-01-14T10:19:43.274Z","dependency_job_id":"35d0d2fb-bdf6-45c6-9a3d-2a39fc098d6b","html_url":"https://github.com/danielwestendorf/breezy-pdf-lite","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielwestendorf%2Fbreezy-pdf-lite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielwestendorf%2Fbreezy-pdf-lite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielwestendorf%2Fbreezy-pdf-lite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielwestendorf%2Fbreezy-pdf-lite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielwestendorf","download_url":"https://codeload.github.com/danielwestendorf/breezy-pdf-lite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247366462,"owners_count":20927517,"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":["headless-chrome","pdf-generation","pdf-rendering"],"created_at":"2024-08-01T15:01:28.542Z","updated_at":"2025-04-05T16:32:03.558Z","avatar_url":"https://github.com/danielwestendorf.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# BreezyPDF Lite: HTML to PDF generation as a Service\n### Submit a slug of HTML, get a Google Chrome rendered PDF back.\n[![Build Status](https://travis-ci.org/danielwestendorf/breezy-pdf-lite.svg?branch=master)](https://travis-ci.org/danielwestendorf/breezy-pdf-lite) [![Open Source Helpers](https://www.codetriage.com/danielwestendorf/breezy-pdf-lite/badges/users.svg)](https://www.codetriage.com/danielwestendorf/breezy-pdf-lite)\n\n[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)\n\nA quick to stand up HTML to PDF service powered by headless Google Chrome. Deploy with one click and start generating PDF's from your web application or command line.\n\n### Getting Started\n\n##### 1. Submit HTML to be converted\nThis is done with a `POST` request the the web server. We'll use some example HTML for this example.\n```sh\n  curl -X POST -H 'Authorization: Bearer PRIVATE_TOKEN_DEFINED_IN_SERVER_ENVIRONMENT' \\\n    http://url-of-your-breezy-pdf-lite-server/render/html \\\n    -d \"`curl https://raw.githubusercontent.com/danielwestendorf/breezy-pdf-lite/master/sample.html`\" \\\n    -o example.pdf\n```\n\nThis will create the PDF in the current directory by the name of `example.pdf`.\n\n##### 2. Configure with `meta` tags (optional)\nAll configuration for the rendering of your PDF can be configured by meta tags within the HTML you submit. Simply insert the needed meta tag into the head or body of the HTML.\n\n```html\n  \u003cmeta name=\"breezy-pdf-width\" content=\"10\"\u003e\n```\n\n| Tag name                    | Default Value      | Description                                                |\n| -------------               |:-------------:     | -----                                                      |\n| breezy-pdf-filename         | output.pdf         | Name of the pdf                                            |\n| breezy-pdf-width            | 8.5                | PDF page width in inches                                   |\n| breezy-pdf-height           | 11                 | PDF page height in inches                                  |\n| breezy-pdf-cssPageSize      | false              | Use page size defined by CSS                               |\n| breezy-pdf-marginTop        | 0.4                | Top margin                                                 |\n| breezy-pdf-marginRight      | 0.4                | Right margin                                               |\n| breezy-pdf-marginBottom     | 0.4                | Bottom margin                                              |\n| breezy-pdf-marginLeft       | 0.4                | Left margin                                                |\n| breezy-pdf-landscape        | false              | Print in landscape mode                                    |\n| breezy-pdf-scale            | 1                  | Scale the viewport before converting to pdf                |\n| breezy-pdf-displayBackground| false              | Render the background in the HTML is included in the PDF   |\n\nView the all the configuration options and their documentation [here](https://docs.breezypdf.com/metadata).\n\n##### 2.a Header and Footer Templates\nConfigure the HTML template to be included at the top and bottom of every page. Include elements with the classes of date, title, pageNumber, and totalPages to have values inserted at render time. At this time, any images must be DataURI encoded and styles must be specified within the template. Defaults to no HTML.\n\n| CSS class | Description |\n| --------- | ----------- |\n| date      | Formatted render date displayed in UTC |\n| title     | Title of the document specified by the title tag |\n| pageNumber| The count of the current page in the PDF |\n| totalPages| The total count of pages in the PDF |\n\n##### 2.b Completion Triggers\nNotify the rendering engine when your rich content has completed loading and the PDF is ready to be rendered. Most typically used when complex JavaScript needs to be evaluated. The default completion trigger is a timer of 5000ms. If multiple completion triggers, the first trigger used will be adopted based on the order in which they're specified here.\n\n###### Callback\nA JavaScript function in the global namespace which will be defined by the renderer. Your code will be invoke this callback when the document is ready for PDF rendering. Optional timeout can be specified in ms, defaulting to 5000ms.\n\n```html\n\u003cmeta name=\"breezy-pdf-callback\" content=\"myWorkHereIsDoneCallback\"\u003e\n\u003cmeta name=\"breezy-pdf-timeout\" content=\"3000\"\u003e\n```\n```js\nfunction() {\n    // My hard working JS here\n    window.myWorkHereIsDoneCallback();\n}\n```\n\n###### Event\nA JavaScript event which will be dispatched on an element when the document is ready for PDF rendering. Optional CSS element selector can be specified, defaulting to document. Optional timeout can be specified in ms, defaulting to 5000ms.\n\n```html\n\u003cmeta name=\"breezy-pdf-event\" content=\"myCustomEvent\"\u003e\n\u003cmeta name=\"breezy-pdf-element\" content=\"#myContainer\"\u003e\n\u003cmeta name=\"breezy-pdf-timeout\" content=\"3000\"\u003e\n```\n\n```js\nvar event = new CustomEvent('myCustomEvent');\nvar element = document.getElementBydId('myContainer');\n\nelement.dispatchEvent(event);\n```\n\n###### Element\nThe CSS selector of an element which will be inserted into the document when the document is ready for PDF rendering. Optional timeout can be specified in ms, defaulting to 5000ms.\n\n```html\n\u003cmeta name=\"breezy-pdf-element\" content=\"#last-page \u003e #last-element\"\u003e\n\u003cmeta name=\"breezy-pdf-timeout\" content=\"3000\"\u003e\n```\n\n```js\nfunction() {\n    // My hard working JS here\n    var lastPage    = document.getElementById('#last-page');\n    var lastElement = document.createElement('div');\n    \n    lastElement.id = 'last-element';\n    \n    lastPage.appendChild(lastElement);\n}\n```\n\n###### Variable\nThe variable in the global namespace which will be defined when the document is ready for PDF rendering. Optional timeout can be specified in ms, defaulting to 5000ms.\n\n```html\n\u003cmeta name=\"breezy-pdf-variable\" content=\"myWorkHereIsDoneVariable\"\u003e\n```\n\n```js\nfunction() {\n    // My hard working JS here\n    window.myWorkHereIsDoneVariable = true;\n}\n```\n\n###### Timer\nThe predefined amount of time to wait before the document is rendered to PDF. Timer should be specified in ms, defaulting to 5000ms.\n\n```html\n\u003cmeta name=\"breezy-pdf-timer\" content=\"10000\"\u003e\n```\n\n\n### Deployment\n\n#### Heroku\n[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)\n\n1. Deploy to Heroku with one-click.\n\n### Clients\n\n- [Ruby/Rack/Rails](https://github.com/danielwestendorf/breezy_pdf_lite-ruby)\n- [PHP](https://github.com/jitendra-1217/breezy-pdf-lite-php)\n- [Node.js](https://github.com/danielwestendorf/breezy-pdf-lite-client-js)\n- [Browserside JS](https://github.com/danielwestendorf/breezy-pdf-lite/issues/5)\n- [Java](https://github.com/danielwestendorf/breezy-pdf-lite/issues/6)\n- [Swift](https://github.com/danielwestendorf/breezy-pdf-lite/issues/7)\n- [Python](https://github.com/danielwestendorf/breezy-pdf-lite/issues/8)\n- [Go](https://github.com/danielwestendorf/breezy-pdf-lite/issues/10)\n\n#### Docker\n\n`docker run -it -p 5002:5002 -e \"DEBUG=breezy-pdf-lite:*\" -e \"PORT=5002\" -e \"PRIVATE_TOKEN=YOURSUPERSECRETTOKEN\" danielwestendorf/breezy-pdf-lite:latest`\n\n#### Non-Heroku\n\n1. Install node \u0026 yarn\n2. `yarn install`\n4. Set the Environment variables specified below\n5. Start the web process `node index.js`\n\n### Configuration\nSet the Environment/Heroku Config Vars\n\n| ENV Variable               | Default Value      | Description                                                |\n| -------------              |:-------------:     | -----                                                      |\n| PRIVATE_TOKEN              | generated secret   | A private key for accessing the API.                       |\n\n\n\nSet `DEBUG` Config var to `breezy-pdf-lite:*` to get debugged output.\n\n\n### Run Tests\n\n`$ /Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --interpreter none --headless   --disable-gpu   --disable-translate   --disable-extensions   --disable-background-networking   --safebrowsing-disable-auto-update   --disable-sync   --metrics-recording-only   --disable-default-apps   --no-first-run   --mute-audio   --hide-scrollbars   --remote-debugging-port=9222`\n\n`$ npm test`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielwestendorf%2Fbreezy-pdf-lite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielwestendorf%2Fbreezy-pdf-lite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielwestendorf%2Fbreezy-pdf-lite/lists"}