{"id":20756834,"url":"https://github.com/jesusbmx/react-native-pdf-page-image","last_synced_at":"2025-08-18T21:16:38.272Z","repository":{"id":194293318,"uuid":"690697622","full_name":"jesusbmx/react-native-pdf-page-image","owner":"jesusbmx","description":"Library to obtain the pages of a pdf in image format","archived":false,"fork":false,"pushed_at":"2024-09-30T17:42:09.000Z","size":767,"stargazers_count":11,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-21T08:09:32.371Z","etag":null,"topics":["android","image","ios","page","pdf","react-native","thumbnail"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/jesusbmx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":"jesusbmx"}},"created_at":"2023-09-12T17:32:58.000Z","updated_at":"2025-04-15T11:43:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"25d1cc6a-4855-4850-aa5b-88f44426fbe8","html_url":"https://github.com/jesusbmx/react-native-pdf-page-image","commit_stats":{"total_commits":23,"total_committers":3,"mean_commits":7.666666666666667,"dds":0.4347826086956522,"last_synced_commit":"524e7e6eceb3baed6b21e867825e3779ec9426be"},"previous_names":["jesusbmx/react-native-pdf-page-image"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusbmx%2Freact-native-pdf-page-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusbmx%2Freact-native-pdf-page-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusbmx%2Freact-native-pdf-page-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusbmx%2Freact-native-pdf-page-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jesusbmx","download_url":"https://codeload.github.com/jesusbmx/react-native-pdf-page-image/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251385066,"owners_count":21581159,"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":["android","image","ios","page","pdf","react-native","thumbnail"],"created_at":"2024-11-17T09:35:32.769Z","updated_at":"2025-04-28T20:39:33.755Z","avatar_url":"https://github.com/jesusbmx.png","language":"Swift","funding_links":["https://github.com/sponsors/jesusbmx"],"categories":[],"sub_categories":[],"readme":"# react-native-pdf-page-image\n\nThis module enables React Native applications to generate images from PDF document pages. It uses PDFKit on iOS and PdfRenderer on Android to render PDF pages as images.\n\n## Installation\n```sh\nnpm install react-native-pdf-page-image\n```\n#### iOS\n`$ cd ios \u0026 pod install`\n\n## Usage\n\nImporting the Module\n```js\nimport PdfPageImage from 'react-native-pdf-page-image';\n```\n\n\n### Generating Images for All PDF Pages\n\nYou can generate images for all pages in a PDF document with the following method:\n```js\nconst uri = \"https://pdfobject.com/pdf/sample.pdf\";\nconst scale = 1.0;\n\n// Generate images from all pages\nPdfPageImage.generateAllPages(uri, scale)\n  .then(images =\u003e images.forEach((image, index) =\u003e console.log(`Page ${index+1}: ${image.uri}, Width: ${image.width}, Height: ${image.height}`)))\n  .catch(error =\u003e console.error('Error generating images:', error));\n\n```\n\n\n### Generating an Image for a Specific Page\n\nIf you only need to generate an image for a single page, use the generate method:\n```js\nconst uri = \"https://pdfobject.com/pdf/sample.pdf\";\nconst scale = 1.0;\n\n// Generate an image from a specific page\nPdfPageImage.generate(uri, 1, scale)  // Example uses page number 1\n  .then(image =\u003e console.log(`Generated image: ${image.uri}, Width: ${image.width}, Height: ${image.height}`))\n  .catch(error =\u003e console.error('Error generating image:', error));\n```\n\n\n### Optional: Getting PDF Information\n\nTo open a PDF document and retrieve its information, use the open method:\n```js\nPdfPageImage.open(uri)\n  .then(info =\u003e console.log(`PDF opened with URI: ${info.uri}, Page count: ${info.pageCount}`))\n  .catch(error =\u003e console.error('Error opening PDF:', error));\n```\n\n\n### Optional: Closing the PDF Document\n\nAfter processing, you can close the PDF document and delete any temporary files that were generated. Use the close method:\n```js\nPdfPageImage.close(uri)\n  .then(() =\u003e console.log('PDF closed successfully.'))\n  .catch(error =\u003e console.error('Error closing PDF:', error));\n```\n\n# API\n\n`open(uri: string): Promise\u003cPdfInfo\u003e`\n\n  Opens a PDF document and returns its basic information.\n  - uri: Path to the PDF file.\n\n`generate(uri: string, page: number, scale?: number): Promise\u003cPageImage\u003e`\n\n  Generates an image from a specific PDF page.\n  - uri: Path to the PDF file.\n  - page: Page number to render.\n  - scale: Scale of the generated image, optional\n\n`generateAllPages(uri: string, scale?: number): Promise\u003cPageImage[]\u003e`\n\n  Generates images from all pages of the PDF document.\n  - uri: Path to the PDF file.\n  - scale: Scale of the generated images, optional.\n\n`close(uri: string): Promise\u003cvoid\u003e`\n\n  Clean up resources, deleting temporary files and closing connections..\n  - uri: Path to the PDF file that is currently open.\n\n# Types\n\n```typescript\ntype PdfInfo = {\n  uri: string;\n  pageCount: number;\n};\n\ntype PageImage = {\n  uri: string;\n  width: number;\n  height: number;\n};\n```\n\n## Contributing\n\nSee the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.\n\n## License\n\nMIT\n\n---\n\nMade with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjesusbmx%2Freact-native-pdf-page-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjesusbmx%2Freact-native-pdf-page-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjesusbmx%2Freact-native-pdf-page-image/lists"}