{"id":21566389,"url":"https://github.com/navjotdhanawat/dynamic-html-pdf","last_synced_at":"2025-10-29T06:46:26.916Z","repository":{"id":57217654,"uuid":"99097081","full_name":"navjotdhanawat/dynamic-html-pdf","owner":"navjotdhanawat","description":"Create dynamic PDF from HTML template using handlebars","archived":false,"fork":false,"pushed_at":"2021-05-16T05:11:40.000Z","size":13,"stargazers_count":36,"open_issues_count":9,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-05T14:05:38.065Z","etag":null,"topics":["content","dynamic","dynamic-html-pdf","handlebar-template","html","pdf","render"],"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/navjotdhanawat.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":"2017-08-02T09:17:50.000Z","updated_at":"2025-09-06T11:22:17.000Z","dependencies_parsed_at":"2022-08-28T21:00:42.312Z","dependency_job_id":null,"html_url":"https://github.com/navjotdhanawat/dynamic-html-pdf","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/navjotdhanawat/dynamic-html-pdf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navjotdhanawat%2Fdynamic-html-pdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navjotdhanawat%2Fdynamic-html-pdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navjotdhanawat%2Fdynamic-html-pdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navjotdhanawat%2Fdynamic-html-pdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/navjotdhanawat","download_url":"https://codeload.github.com/navjotdhanawat/dynamic-html-pdf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navjotdhanawat%2Fdynamic-html-pdf/sbom","scorecard":{"id":676636,"data":{"date":"2025-08-11","repo":{"name":"github.com/navjotdhanawat/dynamic-html-pdf","commit":"08801ce42dcfcced7253ad117af644f583064e0b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":0,"reason":"Found 1/17 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 4 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T21:42:40.612Z","repository_id":57217654,"created_at":"2025-08-21T21:42:40.612Z","updated_at":"2025-08-21T21:42:40.612Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281577705,"owners_count":26524886,"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","status":"online","status_checked_at":"2025-10-29T02:00:06.901Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["content","dynamic","dynamic-html-pdf","handlebar-template","html","pdf","render"],"created_at":"2024-11-24T10:24:51.321Z","updated_at":"2025-10-29T06:46:26.900Z","avatar_url":"https://github.com/navjotdhanawat.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## How to Setup: Dynamic handlebars html pdf to create dynamic content html to pdf.\n\n#### Installation\n\n```\nnpm install dynamic-html-pdf --save\n\n```\n#### Create template.html\n\n```\n\u003chtml\u003e\n    \u003chead\u003e\n        Dynamic HTML to PDF\n    \u003c/head\u003e\n    \u003cbody\u003e\n        \u003ch1\u003eHi {{users.0.name}}\u003c/h1\u003e\n        \u003cdiv\u003e\n            template\n            {{#ifCond 'v1' 'v2'}}\n                {{v1}} is equals to {{v2}}\n            {{else}}\n                Variables are not similar\n            {{/ifCond}}\n        \u003c/div\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n\n```\n#### Feel free to use handlebar syntax: [Handlebar builtin helpers](http://handlebarsjs.com/builtin_helpers.html)\n\nFor example:\n```\n\u003cul\u003e\n  {{#each users}}\n    \u003cli\u003eName: {{this.name}}\u003c/li\u003e\n    \u003cli\u003eAge: {{this.age}}\u003c/li\u003e\n    \u003cli\u003eDOB: {{this.dob}}\u003c/li\u003e\n  {{/each}}\n\u003c/ul\u003e\n```\n\n#### [Custom handlebar helpers](https://handlebarsjs.com/block_helpers.html)\nFor example:\nRegister helper inside js file:\n```\n// Custom If condition inside handlebar(JS file)\nvar pdf = require('dynamic-html-pdf');\npdf.registerHelper('ifCond', function (v1, v2, options) {\n    if (v1 === v2) {\n        return options.fn(this);\n    }\n    return options.inverse(this);\n})\n```\n\nUtilize registered helper inside handlebar template:\n```\n{{#ifCond v1 v2}}\n    {{v1}} is equals to {{v2}}\n{{else}}\n    Variables are not similar\n{{/ifCond}}\n```\n\n\n#### How to use Dynamic HTML to PDF\n\n```\nvar fs = require('fs');\nvar pdf = require('dynamic-html-pdf');\nvar html = fs.readFileSync('template.html', 'utf8');\n\n// Custom handlebar helper\npdf.registerHelper('ifCond', function (v1, v2, options) {\n    if (v1 === v2) {\n        return options.fn(this);\n    }\n    return options.inverse(this);\n})\n\nvar options = {\n    format: \"A3\",\n    orientation: \"portrait\",\n    border: \"10mm\"\n};\n\nvar users = [\n    {\n        name: 'aaa',\n        age: 24,\n        dob: '1/1/1991'\n    },\n    {\n        name: 'bbb',\n        age: 25,\n        dob: '1/1/1995'\n    },\n    {\n        name: 'ccc',\n        age: 24,\n        dob: '1/1/1994'\n    }\n];\n\nvar document = {\n    type: 'buffer',     // 'file' or 'buffer'\n    template: html,\n    context: {\n        users: users\n    },\n    path: \"./output.pdf\"    // it is not required if type is buffer\n};\n\npdf.create(document, options)\n    .then(res =\u003e {\n        console.log(res)\n    })\n    .catch(error =\u003e {\n        console.error(error)\n    });\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnavjotdhanawat%2Fdynamic-html-pdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnavjotdhanawat%2Fdynamic-html-pdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnavjotdhanawat%2Fdynamic-html-pdf/lists"}