{"id":25853664,"url":"https://github.com/frfhrts/pdfweaver","last_synced_at":"2026-03-01T17:02:32.748Z","repository":{"id":268424318,"uuid":"904314854","full_name":"frfhrts/pdfweaver","owner":"frfhrts","description":"Simple HTML To PDF NodeJS package based on puppeteer","archived":false,"fork":false,"pushed_at":"2025-05-05T21:10:01.000Z","size":65,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-27T18:52:05.128Z","etag":null,"topics":["html","html-pdf","html-pdf-converter","html-pdf-node","html-to-pdf","html-to-pdf-converter","htmltopdf","nodejs","pdf","puppeteer"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/frfhrts.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-16T16:45:35.000Z","updated_at":"2025-02-01T20:50:11.000Z","dependencies_parsed_at":"2025-02-28T11:55:04.854Z","dependency_job_id":"ff81474b-0e8f-42e8-a068-ee8eacb245f8","html_url":"https://github.com/frfhrts/pdfweaver","commit_stats":null,"previous_names":["nika380/pdfweaver","frfhrts/pdfweaver"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/frfhrts/pdfweaver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frfhrts%2Fpdfweaver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frfhrts%2Fpdfweaver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frfhrts%2Fpdfweaver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frfhrts%2Fpdfweaver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frfhrts","download_url":"https://codeload.github.com/frfhrts/pdfweaver/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frfhrts%2Fpdfweaver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29976272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T16:35:47.903Z","status":"ssl_error","status_checked_at":"2026-03-01T16:35:44.899Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["html","html-pdf","html-pdf-converter","html-pdf-node","html-to-pdf","html-to-pdf-converter","htmltopdf","nodejs","pdf","puppeteer"],"created_at":"2025-03-01T15:18:57.904Z","updated_at":"2026-03-01T17:02:32.726Z","avatar_url":"https://github.com/frfhrts.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pdfweaver\n\n## Simple HTML To PDF NodeJS package based on puppeteer\n\n## Installation\n\n```sh\nnpm install pdfweaver\n```\n\n## Usage\n\nTo convert `HTML` content to `PDF` use htmlToPdf function:\n\n```js\nconst { htmlToPdf } = require(\"pdfweaver\");\n\nconst options = {\n  format: \"A4\",\n  displayHeaderFooter: true,\n  headerTemplate: `\u003ch1 style=\"font-size: 12px\"\u003e This Is Header \u003c/h1\u003e`,\n  footerTemplate: `\u003cdiv style=\"font-size: 12px; text-align: center; width: 100%\"\u003e\u003cspan class=\"pageNumber\"\u003e\u003c/span\u003e / \u003cspan class=\"totalPages\"\u003e\u003c/span\u003e\u003c/div\u003e`,\n  margin: {\n    top: 40,\n    bottom: 20,\n    left: 10,\n    right: 10,\n  },\n};\n\nconst content = \"\u003ch1\u003e This Is Content HTML\u003c/h1\u003e\";\n\n// logs PDF Buffer\nhtmlToPdf({ content }, options).then((res) =\u003e {\n  console.log(\"PDF Buffer: \", res);\n});\n\n// Returns PDF Buffer\nasync function returnPDFBuffer() {\n  const pdfBuffer = await htmlToPdf({ content }, options);\n  return pdfBuffer;\n}\n```\n\n## Parameters\n\n- **`file`** (Type: `Object`)   \nshould contain one of this properties\n  \n  - **`url`** (Type: `String`)  \n  URL of page you want to generate PDF from\n  \n  - **`content`** (Type: `String`)  \n  HTML code to generate PDF\n\n- **`options`** (Type: `Object`)  \n PDFOptions type coming from puppeteer, declares PDF generation rules\n  - **`path`** (Type: `String`)  \n  The file path to save the generated PDF. If not specified, the PDF is returned as a buffer.\n\n  - **`scale`** (Type: `Number`)  \n    The scale of the webpage rendering. Must be between 0.1 and 2.  \n    **Default:** `1`\n\n  - **`displayHeaderFooter`** (Type: `Boolean`)  \n    Whether to include headers and footers.  \n    **Default:** `false`\n\n  - **`headerTemplate`** (Type: `String`)  \n    The HTML template for the header. Requires `displayHeaderFooter: true`.\n\n  - **`footerTemplate`** (Type: `String`)  \n    The HTML template for the footer. Requires `displayHeaderFooter: true`.\n\n  - **`printBackground`** (Type: `Boolean`)  \n    Whether to include the background graphics.  \n    **Default:** `false`\n\n  - **`landscape`** (Type: `Boolean`)  \n    Whether to generate the PDF in landscape orientation.  \n    **Default:** `false`\n\n  - **`pageRanges`** (Type: `String`)  \n    The page ranges to print, e.g., `\"1-5, 8, 11-13\"`.  \n    **Default:** `\"all\"`\n\n  - **`format`** (Type: `String`)  \n    The paper format (e.g., `\"A4\"`, `\"Letter\"`). If set, overrides `width` and `height`.\n\n  - **`width`** (Type: `String`)  \n    Paper width, accepts values like `\"8.5in\"`, `\"21cm\"`.\n\n  - **`height`** (Type: `String`)  \n    Paper height, accepts values like `\"11in\"`, `\"29.7cm\"`.\n\n  - **`margin`** (Type: `Object`)  \n    Margins for the PDF. Object properties include:\n    - **`top`** (Type: `String`) | Margin for the top of the page.\n    - **`right`** (Type: `String`) | Margin for the right of the page.\n    - **`bottom`** (Type: `String`) | Margin for the bottom of the page.\n    - **`left`** (Type: `String`) | Margin for the left of the page.\n\n  - **`preferCSSPageSize`** (Type: `Boolean`)  \n    Whether to prefer CSS-defined page size over the `width`/`height` or `format`.  \n    **Default:** `false`\n\n  - **`omitBackground`** (Type: `Boolean`)  \n    Hides the default white background.  \n    **Default:** `false`\n\n  - **`timeout`** (Type: `Number`)  \n    Maximum time (in milliseconds) to wait for the PDF generation.  \n    **Default:** `30000` (30 seconds)\n\n- **`laungOptions`** (Type: `Object`)   \n  puppeteer browser configuration options\n  - **`headless`** (Type: `Boolean` or `String`)  \n  Whether to run the browser in headless mode.  \n  **Default:** `true`  \n  Can also be set to `\"new\"` for new headless mode.\n\n  - **`executablePath`** (Type: `String`)  \n    Path to a specific browser executable to use.\n\n  - **`args`** (Type: `Array\u003cString\u003e`)  \n    Additional arguments to pass to the browser instance.\n    example: \n    ```js\n    args: ['--no-sandbox', '--disable-setuid-sandbox'] \n    ```\n\n  - **`ignoreDefaultArgs`** (Type: `Boolean` or `Array\u003cString\u003e`)  \n    If `true`, Puppeteer won't use its default arguments.  \n    If an array is provided, it filters out specific default arguments.\n\n  - **`timeout`** (Type: `Number`)  \n    Maximum time (in milliseconds) to wait for the browser to start.  \n    **Default:** `30000` (30 seconds)\n\n  - **`dumpio`** (Type: `Boolean`)  \n    Whether to pipe the browser process stdout and stderr into the parent process.  \n    **Default:** `false`\n\n  - **`env`** (Type: `Object`)  \n    Environment variables to pass to the browser instance.\n\n  - **`pipe`** (Type: `Boolean`)  \n    Connects to the browser over a pipe instead of a WebSocket.  \n    **Default:** `false`\n\n  - **`product`** (Type: `String`)  \n    Specifies which browser to use. Options are `\"chrome\"` or `\"firefox\"`.  \n    **Default:** `\"chrome\"`\n\n  - **`extraPrefsFirefox`** (Type: `Object`)  \n    Additional preferences to configure for Firefox. Only applicable when using Firefox.\n\n  - **`waitForInitialPage`** (Type: `Boolean`)  \n    Whether to wait for the initial page to load after launching.  \n    **Default:** `true`\n\n  - **`userDataDir`** (Type: `String`)  \n    Path to a user data directory to use for the browser session.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrfhrts%2Fpdfweaver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrfhrts%2Fpdfweaver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrfhrts%2Fpdfweaver/lists"}