{"_id":"pdfium.js","_rev":"3-162794b16c3b0cfcbd1959662e61fe92","name":"pdfium.js","dist-tags":{"latest":"0.2.1-rc.1"},"versions":{"0.1.0-rc.0":{"name":"pdfium.js","version":"0.1.0-rc.0","description":"PDFium wrapper library for JavaScript","main":"./dist/cjs/index.js","types":"./dist/esm/index.d.ts","exports":{".":{"types":"./dist/esm/index.d.ts","import":"./dist/esm/index.mjs","require":"./dist/cjs/index.js"}},"repository":{"type":"git","url":"https://github.com/Jaewoook/pdfium.js.git"},"author":{"name":"Jaewook Ahn","email":"dev.jaewook@gmail.com"},"license":"MIT","scripts":{"type-check":"tsc","build":"rimraf dist && rollup -c","lint":"eslint . --ext ts,js","commitlint":"commitlint --edit"},"devDependencies":{"@commitlint/cli":"^17.6.6","@commitlint/config-conventional":"^17.6.6","@types/node":"^20.4.1","@typescript-eslint/eslint-plugin":"^5.61.0","@typescript-eslint/parser":"^5.61.0","esbuild":"^0.18.11","eslint":"^8.44.0","eslint-config-prettier":"8.8.0","eslint-plugin-prettier":"4.2.1","husky":"^8.0.3","prettier":"2.8.8","rimraf":"^5.0.1","rollup":"^3.26.2","rollup-plugin-copy":"^3.4.0","rollup-plugin-dts":"^5.3.0","rollup-plugin-esbuild":"^5.0.0","typescript":"^5.1.6"},"licenseText":"MIT License\n\nCopyright (c) 2023 Jaewook Ahn\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"pdfium.js@0.1.0-rc.0","dist":{"shasum":"577c9a63b2aeed73895759424873c0eb08ba4305","integrity":"sha512-euRM0C20EnV4uYQZXf73Ejx1irhadiA1GI9LbKWlanR5XRcUS0fJ6i+gYCMH+WDQlsEO4bsFdD5m0KrikEY1EQ==","tarball":"https://registry.npmjs.org/pdfium.js/-/pdfium.js-0.1.0-rc.0.tgz","fileCount":27,"unpackedSize":4085004,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDDwWcysZHC/eGsz0AwYZ+KzcB4Aqn65rXJ9sapeO2EdAiA5EzGdUhKoOrBh2vaUPcBlZ0thZN+Xph93Q78b85pqhA=="}]},"_npmUser":{"name":"jaewoook","email":"dev.jaewook@gmail.com"},"directories":{},"maintainers":[{"name":"jaewoook","email":"dev.jaewook@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pdfium.js_0.1.0-rc.0_1689182848235_0.5499938077498829"},"_hasShrinkwrap":false},"0.1.0-rc.1":{"name":"pdfium.js","version":"0.1.0-rc.1","description":"A PDFium wrapper library for JavaScript","main":"./dist/cjs/index.js","types":"./dist/esm/index.d.ts","exports":{".":{"types":"./dist/esm/index.d.ts","import":"./dist/esm/index.mjs","require":"./dist/cjs/index.js"}},"repository":{"type":"git","url":"https://github.com/Jaewoook/pdfium.js.git"},"author":{"name":"Jaewook Ahn","email":"dev.jaewook@gmail.com"},"license":"MIT","scripts":{"type-check":"tsc","build":"rimraf dist && rollup -c","lint":"eslint . --ext ts,js","commitlint":"commitlint --edit"},"devDependencies":{"@commitlint/cli":"^17.6.6","@commitlint/config-conventional":"^17.6.6","@types/node":"^20.4.1","@typescript-eslint/eslint-plugin":"^5.61.0","@typescript-eslint/parser":"^5.61.0","esbuild":"^0.18.11","eslint":"^8.44.0","eslint-config-prettier":"8.8.0","eslint-plugin-prettier":"4.2.1","husky":"^8.0.3","prettier":"2.8.8","rimraf":"^5.0.1","rollup":"^3.26.2","rollup-plugin-copy":"^3.4.0","rollup-plugin-dts":"^5.3.0","rollup-plugin-esbuild":"^5.0.0","typescript":"^5.1.6"},"licenseText":"MIT License\n\nCopyright (c) 2023 Jaewook Ahn\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"pdfium.js@0.1.0-rc.1","dist":{"shasum":"3e0c637bbe2b1c60174d0cbe7948f4290ba1bf1c","integrity":"sha512-dIcfILcCcH4D+G/nY1BgVMELC0lK+3vX2k+pDoETIOZyJ73soYQZtBKDTyfELLldVBhsqidVcjK0z7BaDY2RKA==","tarball":"https://registry.npmjs.org/pdfium.js/-/pdfium.js-0.1.0-rc.1.tgz","fileCount":11,"unpackedSize":4312870,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDNry6xkF0Y3ttvmsuCePSxzE9nJYZEW8lsIAFdXJvStQIgCA1I6ePlu5aCiY5lR9QoN2fOUoPLcsW6Sk66KjPIySs="}]},"_npmUser":{"name":"jaewoook","email":"dev.jaewook@gmail.com"},"directories":{},"maintainers":[{"name":"jaewoook","email":"dev.jaewook@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pdfium.js_0.1.0-rc.1_1689184671467_0.811163735732209"},"_hasShrinkwrap":false},"0.2.0-rc.1":{"name":"pdfium.js","version":"0.2.0-rc.1","description":"A PDFium wrapper library for browser-side JavaScript","main":"./dist/cjs/index.js","types":"./dist/esm/index.d.ts","exports":{".":{"types":"./dist/esm/index.d.ts","import":"./dist/esm/index.mjs","require":"./dist/cjs/index.js"}},"repository":{"type":"git","url":"https://github.com/Jaewoook/pdfium.js.git"},"bugs":{"email":"dev.jaewook@gmail.com","url":"https://github.com/Jaewoook/pdfium.js/issues"},"keywords":["pdfium","pdf","wrapper-library","webassembly"],"author":{"name":"Jaewook Ahn","email":"dev.jaewook@gmail.com","url":"https://jaewook.me"},"license":"MIT","scripts":{"type-check":"tsc","build":"rimraf dist && rollup -c","lint":"eslint . --ext ts,js","commitlint":"commitlint --edit","prepare":"husky install"},"devDependencies":{"@commitlint/cli":"^17.6.6","@commitlint/config-conventional":"^17.6.6","@types/node":"^20.4.1","@typescript-eslint/eslint-plugin":"^5.61.0","@typescript-eslint/parser":"^5.61.0","esbuild":"^0.18.11","eslint":"^8.44.0","eslint-config-prettier":"8.8.0","eslint-plugin-prettier":"4.2.1","husky":"^8.0.3","prettier":"2.8.8","rimraf":"^5.0.1","rollup":"^3.26.2","rollup-plugin-dts":"^5.3.0","rollup-plugin-esbuild":"^5.0.0","typescript":"^5.1.6"},"licenseText":"MIT License\n\nCopyright (c) 2023 Jaewook Ahn\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"pdfium.js@0.2.0-rc.1","dist":{"shasum":"77cef60b6786d19724b9357298ef0e9241a6b36b","integrity":"sha512-/z5YcjcpxdK9h83ri1VBEWKf3bLmfjmRm/KQYVvuMYnn0YNVLjTcF+06hBnsv9EJMrObfL3+1fdt4qmtu4xWsA==","tarball":"https://registry.npmjs.org/pdfium.js/-/pdfium.js-0.2.0-rc.1.tgz","fileCount":11,"unpackedSize":10597514,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID8rp2SV10AZR6/hwhll6Q/yN84zD3i8OiBwrY/35dRfAiEAutr3d+hAEoeqFPl0s+CIsDlN7qFVKmEdnYa48ISXMUA="}]},"_npmUser":{"name":"jaewoook","email":"dev.jaewook@gmail.com"},"directories":{},"maintainers":[{"name":"jaewoook","email":"dev.jaewook@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pdfium.js_0.2.0-rc.1_1705668312634_0.39849625973889924"},"_hasShrinkwrap":false},"0.2.1-rc.1":{"name":"pdfium.js","version":"0.2.1-rc.1","description":"A PDFium wrapper library for browser-side JavaScript","main":"./dist/cjs/index.js","types":"./dist/esm/index.d.ts","exports":{".":{"types":"./dist/esm/index.d.ts","import":"./dist/esm/index.mjs","require":"./dist/cjs/index.js"}},"repository":{"type":"git","url":"https://github.com/Jaewoook/pdfium.js.git"},"bugs":{"email":"dev.jaewook@gmail.com","url":"https://github.com/Jaewoook/pdfium.js/issues"},"keywords":["pdfium","pdf","wrapper-library","webassembly"],"author":{"name":"Jaewook Ahn","email":"dev.jaewook@gmail.com","url":"https://jaewook.me"},"license":"MIT","scripts":{"type-check":"tsc","build":"rimraf dist && rollup -c","lint":"eslint . --ext ts,js","commitlint":"commitlint --edit","prepare":"husky install"},"devDependencies":{"@commitlint/cli":"^17.6.6","@commitlint/config-conventional":"^17.6.6","@types/node":"^20.4.1","@typescript-eslint/eslint-plugin":"^5.61.0","@typescript-eslint/parser":"^5.61.0","esbuild":"^0.18.11","eslint":"^8.44.0","eslint-config-prettier":"8.8.0","eslint-plugin-prettier":"4.2.1","husky":"^8.0.3","prettier":"2.8.8","rimraf":"^5.0.1","rollup":"^3.26.2","rollup-plugin-dts":"^5.3.0","rollup-plugin-esbuild":"^5.0.0","typescript":"^5.1.6"},"licenseText":"MIT License\n\nCopyright (c) 2023 Jaewook Ahn\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"pdfium.js@0.2.1-rc.1","dist":{"shasum":"e6cc3178fd6e6548cf632a196c86c94acbfee65c","integrity":"sha512-fDHZl5yoMGvPDcqcNhv6kelZIdC1WKbstucvpgzVmCSrxou129ISi8sEDYKfH7yJZPFW1Wk4eJh1u/Z/gZdTRw==","tarball":"https://registry.npmjs.org/pdfium.js/-/pdfium.js-0.2.1-rc.1.tgz","fileCount":11,"unpackedSize":10600370,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDdR0ZdFaO7Hq+cJnegzFGIVEjLOmF5GsR0LVk8IcmBbgIgX3gVmqxMalvCbQ2OgDSB4OycmMpp35qQzq2BGISk0fI="}]},"_npmUser":{"name":"jaewoook","email":"dev.jaewook@gmail.com"},"directories":{},"maintainers":[{"name":"jaewoook","email":"dev.jaewook@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pdfium.js_0.2.1-rc.1_1705750567033_0.7437868855728635"},"_hasShrinkwrap":false}},"time":{"created":"2023-07-12T17:27:28.234Z","0.1.0-rc.0":"2023-07-12T17:27:28.460Z","modified":"2024-01-20T11:36:07.467Z","0.1.0-rc.1":"2023-07-12T17:57:51.688Z","0.2.0-rc.1":"2024-01-19T12:45:12.872Z","0.2.1-rc.1":"2024-01-20T11:36:07.274Z"},"maintainers":[{"name":"jaewoook","email":"dev.jaewook@gmail.com"}],"description":"A PDFium wrapper library for browser-side JavaScript","repository":{"type":"git","url":"https://github.com/Jaewoook/pdfium.js.git"},"author":{"name":"Jaewook Ahn","email":"dev.jaewook@gmail.com","url":"https://jaewook.me"},"license":"MIT","readme":"<h1 align=\"center\">PDFium.js</h1>\n\n<div align=\"center\">\n\nA PDFium wrapper library for browser-side JavaScript\n\n[![CI Status][github-action-image]][github-action-url] [![NPM Version][npm-version-image]][npm-version-url] [![PDFium Version][pdfium-version-image]][pdfium-version-url] [![License][license-image]][license-url]\n\n[github-action-image]: https://img.shields.io/github/actions/workflow/status/Jaewoook/pdfium.js/ci.yml?style=for-the-badge\n[github-action-url]: https://github.com/Jaewoook/pdfium.js/actions/workflows/ci.yml\n[npm-version-image]: https://img.shields.io/npm/v/pdfium.js?style=for-the-badge\n[npm-version-url]: https://www.npmjs.com/package/pdfium.js\n[pdfium-version-image]: https://img.shields.io/badge/dynamic/json?style=for-the-badge&url=https%3A%2F%2Fraw.githubusercontent.com%2FJaewoook%2Fpdfium.js%2Fmain%2Fpdfium-version.json&query=%24.pdfium&label=pdfium\n[pdfium-version-url]: https://github.com/Jaewoook/pdfium.js/blob/main/pdfium-version.json\n[license-image]: https://img.shields.io/github/license/Jaewoook/pdfium.js?style=for-the-badge\n[license-url]: https://github.com/Jaewoook/pdfium.js/blob/main/LICENSE\n\n</div>\n\n## Introduction\n\n[PDFium](https://pdfium.googlesource.com/pdfium/+/master/README.md) is a high performance open source PDF library used in chromium. However, its implementation in C/C++ makes it challenging to use in web development. **PDFium.js** provides a pre-built WebAssembly version of the PDFium binary and offers an interface that allows it to be used in JavaScript. It will be helpful when developing PDF-related features.\n\n## Getting Started\n\n### Installation\n\n```bash\nyarn add pdfium.js\n```\n\n```bash\nnpm install --save pdfium.js\n```\n\n## Usage\n\n> [!NOTE]\n> When you call `PDFium()`, this library will load and instantiate PDFium binary in browser environment. If your project is using SSR, such as Next.js, it should not be loaded in server-side environment. `\"use client\";` directive might be required.\n\n```ts\nimport { PDFium } from \"pdfium.js\";\n\nPDFium().then((PDFiumModule) => {\n  // library initialization\n  PDFiumModule._FPDF_InitLibrary();\n\n  // memory allocation\n  const byteArray: Uint8Array = <FILE BINARY DATA>;\n  const fileSize = byteArray.length;\n  const binaryAddress = PDFiumModule.asm.malloc(fileSize);\n  PDFiumModule.HEAPU8.set(byteArray, binaryAddress);\n\n  // document loading\n  const documentAddress = PDFiumModule._FPDF_LoadMemDocument(binaryAddress, fileSize, \"\");\n});\n```\n\n### WASM Memory Management\n\nHere is simple code snippets about memory management.\n\nThe WASM Memory can be found in `PDFiumModule.FPDF.HEAP*` properties.\n\n```ts\nimport { PDFium, memory } from \"pdfium.js\";\n\n// options parameter can be skipped after the module loaded\nPDFium().then((PDFiumModule) => {\n  const nBytes = 1024;\n\n  // allocate 1024 bytes in wasm memory\n  const memoryAddress = PDFiumModule.wasmExports.malloc(nBytes);\n\n  // you can also use calloc() to allocate 1024 bytes (array of 256 integers)\n  const memoryAddress2 = memory.calloc(256, 4);\n\n  // zero-fill allocated memory\n  memory.fill(PDFiumModule.FPDF.HEAPU8, memoryAddress, nBytes);\n\n  // free memory\n  PDFiumModule.wasmExports.free(memoryAddress);\n});\n```\n\n## PDFium API\n\nThis library doesn't provide full PDFium API yet. Check full version of defined PDFium API type list [here](./src/global.d.ts).\n\nYou can also find original API specification [here](https://pdfium.googlesource.com/pdfium/+/main/public/).\n\n### Supported API List\n\n- _FPDF_InitLibrary\n- _FPDF_InitLibraryWithConfig\n- _FPDF_DestroyLibrary\n- _FPDF_GetLastError\n- _FPDF_LoadDocument\n- _FPDF_LoadMemDocument\n- _FPDF_CloseDocument\n- _FPDF_GetPageCount\n- _FPDF_LoadPage\n- _FPDF_GetPageWidth\n- _FPDF_GetPageHeight\n- _FPDF_GetPageWidthF\n- _FPDF_GetPageHeightF\n- _FPDF_GetPageSizeByIndex\n- _FPDF_ClosePage\n- _FPDFPage_CountObjects\n- _FPDFPage_GetObject\n- _FPDFPage_GenerateContent\n- _FPDFPageObj_Destroy\n- _FPDFText_LoadPage\n- _FPDFText_CountChars\n- _FPDFText_GetCharBox\n- _FPDFText_ClosePage\n- _FPDFBitmap_Create\n- _FPDFBitmap_CreateEx\n- _FPDFBitmap_FillRect\n- _FPDF_RenderPageBitmap\n- _FPDFBitmap_Destroy\n- _FPDF_DeviceToPage\n- _FPDF_PageToDevice\n\n\n## Author\n\n- Jaewook Ahn\n\n## License\n\nThis project is licensed under the [MIT License](./LICENSE).\n","readmeFilename":"README.md","keywords":["pdfium","pdf","wrapper-library","webassembly"],"bugs":{"email":"dev.jaewook@gmail.com","url":"https://github.com/Jaewoook/pdfium.js/issues"}}