{"id":13439600,"url":"https://github.com/jussiniinikoski/wasm-pdf","last_synced_at":"2025-03-20T08:31:38.351Z","repository":{"id":41203530,"uuid":"189615490","full_name":"jussiniinikoski/wasm-pdf","owner":"jussiniinikoski","description":"Generate PDF files with JavaScript and WASM (WebAssembly)","archived":true,"fork":false,"pushed_at":"2023-06-09T09:01:00.000Z","size":627,"stargazers_count":491,"open_issues_count":9,"forks_count":53,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-02-28T23:38:34.474Z","etag":null,"topics":["javascript","pdf","pdf-generation","rust","rust-wasm","wasm","wasm-bindgen","webassembly"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jussiniinikoski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2019-05-31T15:16:15.000Z","updated_at":"2025-02-28T03:40:33.000Z","dependencies_parsed_at":"2024-10-27T23:11:28.725Z","dependency_job_id":null,"html_url":"https://github.com/jussiniinikoski/wasm-pdf","commit_stats":{"total_commits":129,"total_committers":3,"mean_commits":43.0,"dds":"0.17829457364341084","last_synced_commit":"467eef02a67250c61956d94c58dc2419cfe19ecc"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jussiniinikoski%2Fwasm-pdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jussiniinikoski%2Fwasm-pdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jussiniinikoski%2Fwasm-pdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jussiniinikoski%2Fwasm-pdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jussiniinikoski","download_url":"https://codeload.github.com/jussiniinikoski/wasm-pdf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244577858,"owners_count":20475375,"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":["javascript","pdf","pdf-generation","rust","rust-wasm","wasm","wasm-bindgen","webassembly"],"created_at":"2024-07-31T03:01:15.454Z","updated_at":"2025-03-20T08:31:37.917Z","avatar_url":"https://github.com/jussiniinikoski.png","language":"Rust","funding_links":[],"categories":["Libraries","库 Libraries","Projects","库","PDF"],"sub_categories":["Graphics","图形 Graphics","Others","图像","Video","图像 Graphics"],"readme":"# WASM-PDF\n## Generates PDF files directly in the browser with JavaScript and WASM (WebAssembly).\n\n[![Build Status](https://travis-ci.org/jussiniinikoski/wasm-pdf.svg?branch=master)](https://travis-ci.org/jussiniinikoski/wasm-pdf)\n\nIdea here is to push all the work involved in creating a PDF to the browser side, instead of using precious server resources.\n\n## Demos\n\n[Example that generates a sample PDF document from JSON file.](https://jussiniinikoski.github.io/wasm-pdf-demo/) Title in PDF is changed dynamically (in JavaScript) to show current date. **Note:** this example routes directly to the PDF data blob, so 2 backsteps are needed to return to this page.\n\n[Another example that generates 400 paragraphs of Lorem Ipsum](https://jussiniinikoski.github.io/wasm-pdf-demo/example2.html) and shows a download link when document has been generated (which is instantly 🙂). Also shows page numbers.\n\n[This example creates a task calendar.](https://jussiniinikoski.github.io/wasm-pdf-demo/example3.html)\n\n## Features\n\n* PDF contents are described as a JavaScript object and that gets passed to WASM-module, which generates the output\n* Customizable output handler (e.g. load blob URL to a link or directly to window)\n* Currently supported elements include:\n  * Paragraphs/text elements with basic fonts (Helvetica, Times, Courier)\n  * Images loaded from URL (converted automatically to bytes)\n  * Tables with rows and cells\n  * Spacers (they just eat space)\n  * Paths with points, strokes, fills and alignment\n  * Basic styling (all styling parameters are optional)\n  * Custom template size (defaults to A4 portrait with 50 px margins)\n  * Page numbers and stationary text can be included in template\n  * Inline links and bold text (a and b tags) inside paragraph text\n* [The generator crate](./crates/wasm-pdf-gen/) can also be used standalone in a non-browser environment\n\n## Example input (JSON)\n\n```json\n{\n    \"title\": \"Example Document\",\n    \"contents\": [{\n            \"obj_type\": \"Paragraph\",\n            \"params\": {\n                \"text\": \"Hello World!\",\n                \"font_size\": 18,\n                \"leading\": 24,\n                \"align\": \"center\",\n                \"font_name\": \"Helvetica-Bold\"\n            }\n        }\n    ]\n}\n```\n\n## How to generate an example PDF\n\n### Option 1 (with Rust)\n* First install [the Rust compiler](https://www.rust-lang.org)\n* Clone this repo:```git clone https://github.com/jussiniinikoski/wasm-pdf.git```\n* Change to directory: ```cd wasm-pdf```\n* Install JavaScript libraries: ```npm install```\n* Launch the local development server: ```npm run serve```\n* Open your browser and visit the url provided by the server, usually ```http://localhost:8080```\n\n### Option 2 (with JavaScript only / npm package)\n* Go to [starter template repo](https://github.com/jussiniinikoski/wasm-pdf-app/)\n\n## Special Thanks\n\n* [rustwasm/wasm-bindgen](https://github.com/rustwasm/wasm-bindgen)\n* [kaj/rust-pdf](https://github.com/kaj/rust-pdf)\n* [emreyaren/zero85](https://github.com/emreyaren/zero85)\n\n## License\n\nThis project is licensed under either of\n\n * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or\n   http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or\n   http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjussiniinikoski%2Fwasm-pdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjussiniinikoski%2Fwasm-pdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjussiniinikoski%2Fwasm-pdf/lists"}