{"id":25515573,"url":"https://github.com/pwcong/how-transform-html-into-multipage-pdf","last_synced_at":"2025-04-10T19:43:26.739Z","repository":{"id":84264543,"uuid":"87891779","full_name":"pwcong/how-transform-html-into-multipage-pdf","owner":"pwcong","description":"An example about how to transform HTML into Multipage PDF","archived":false,"fork":false,"pushed_at":"2019-04-10T01:05:20.000Z","size":583,"stargazers_count":37,"open_issues_count":3,"forks_count":17,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T17:21:25.404Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pwcong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-04-11T05:22:23.000Z","updated_at":"2024-08-01T01:32:31.000Z","dependencies_parsed_at":"2023-05-24T04:30:10.053Z","dependency_job_id":null,"html_url":"https://github.com/pwcong/how-transform-html-into-multipage-pdf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwcong%2Fhow-transform-html-into-multipage-pdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwcong%2Fhow-transform-html-into-multipage-pdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwcong%2Fhow-transform-html-into-multipage-pdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwcong%2Fhow-transform-html-into-multipage-pdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pwcong","download_url":"https://codeload.github.com/pwcong/how-transform-html-into-multipage-pdf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248281424,"owners_count":21077423,"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":[],"created_at":"2025-02-19T13:31:26.444Z","updated_at":"2025-04-10T19:43:26.732Z","avatar_url":"https://github.com/pwcong.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# How-Transform-HTML-INTO-Multipage-PDF\nA example about how to transform HTML into Multipage PDF.\n\n[Preview Demo](https://pwcong.github.io/how-transform-html-into-multipage-pdf/)\n\n# Support Browser\n* IE10+\n* Chrome\n* Firefox\n* 360\n\n# Usage\n## First Step.\nimport these js file like this:\n```\n        \u003cscript src=\"/jspdf.debug.js\"\u003e\u003c/script\u003e\n        \u003cscript src=\"/html2canvas.js\"\u003e\u003c/script\u003e\n        \u003cscript src=\"/renderPDF.js\"\u003e\u003c/script\u003e\n\n```\n\n## Last Step.\nexecute the method `renderPDF` that require one parameter (3 optional parameters) like this:\n```\n    renderPDF(document.getElementById(\"content\"));\n\n    // or\n\n    renderPDF(document.getElementById(\"content\"), \"pdfName\", \"a4\", function(){\n        console.log(\"success\");\n    })\n\n```\n\n# API\n\n* renderPDF(content: Element, pdfName: string, format: string, onSuccess: function )\n    * content[Required]: the html element will be transfromed\n    * pdfName[Optional]: the filename of PDF, default is \"content\"\n    * format[Optional]: decide the page format of final PDF, default is \"a4\"\n    * onSuccess[Optional]: execute the function when generate PDF successfully \n\n# Others\n## About PDF Format\n\nThe width and height of content decided by the Format of PDF\n\n```\n    'a0': [2383.94, 3370.39], 'a1': [1683.78, 2383.94],\n    'a2': [1190.55, 1683.78], 'a3': [841.89, 1190.55],\n    'a4': [595.28, 841.89], 'a5': [419.53, 595.28],\n    'a6': [297.64, 419.53], 'a7': [209.76, 297.64],\n    'a8': [147.40, 209.76], 'a9': [104.88, 147.40],\n    'a10': [73.70, 104.88], 'b0': [2834.65, 4008.19],\n    'b1': [2004.09, 2834.65], 'b2': [1417.32, 2004.09],\n    'b3': [1000.63, 1417.32], 'b4': [708.66, 1000.63],\n    'b5': [498.90, 708.66], 'b6': [354.33, 498.90],\n    'b7': [249.45, 354.33], 'b8': [175.75, 249.45],\n    'b9': [124.72, 175.75], 'b10': [87.87, 124.72],\n    'c0': [2599.37, 3676.54], 'c1': [1836.85, 2599.37],\n    'c2': [1298.27, 1836.85], 'c3': [918.43, 1298.27],\n    'c4': [649.13, 918.43], 'c5': [459.21, 649.13],\n    'c6': [323.15, 459.21], 'c7': [229.61, 323.15],\n    'c8': [161.57, 229.61], 'c9': [113.39, 161.57],\n    'c10': [79.37, 113.39], 'dl': [311.81, 623.62],\n    'letter': [612, 792],\n    'government-letter': [576, 756],\n    'legal': [612, 1008],\n    'junior-legal': [576, 360],\n    'ledger': [1224, 792],\n    'tabloid': [792, 1224]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpwcong%2Fhow-transform-html-into-multipage-pdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpwcong%2Fhow-transform-html-into-multipage-pdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpwcong%2Fhow-transform-html-into-multipage-pdf/lists"}