{"id":21672158,"url":"https://github.com/cesarvr/react-native-pdf-generator","last_synced_at":"2025-04-12T03:33:56.472Z","repository":{"id":33939205,"uuid":"163697033","full_name":"cesarvr/react-native-pdf-generator","owner":"cesarvr","description":"react-native-pdf-generator, porting the cordova-pdf-generator to react native. ","archived":false,"fork":false,"pushed_at":"2023-01-05T16:28:58.000Z","size":980,"stargazers_count":4,"open_issues_count":18,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T23:12:05.226Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","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/cesarvr.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":"2018-12-31T20:57:01.000Z","updated_at":"2021-03-29T20:20:44.000Z","dependencies_parsed_at":"2023-01-15T03:28:58.390Z","dependency_job_id":null,"html_url":"https://github.com/cesarvr/react-native-pdf-generator","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/cesarvr%2Freact-native-pdf-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cesarvr%2Freact-native-pdf-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cesarvr%2Freact-native-pdf-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cesarvr%2Freact-native-pdf-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cesarvr","download_url":"https://codeload.github.com/cesarvr/react-native-pdf-generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248513210,"owners_count":21116774,"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":"2024-11-25T13:18:51.847Z","updated_at":"2025-04-12T03:33:56.443Z","avatar_url":"https://github.com/cesarvr.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n## PDF Generator for React Native.\n\nIs a light weight native library that transform HTML to PDF, or even better transform the content of a URL like ```https://google.com``` into a PDF.\n\nThe PDF is returned in base64 format so you can use more specialized modules to mail, sharing, visualizing, etc.\n\n### How it works\n\nBasically this library takes HTML as string or remote and loads the xml into an internal iOS/Android WebKit, then it traverse the web page generating a WYSIWYG PDF document.\n\nThis plugin uses a very light weight iOS library for this called [ BNHtmlPdfKit](https://github.com/brentnycum/BNHtmlPdfKit).\n\nFor Android it just use [WebView](https://developer.android.com/reference/android/webkit/WebView).\n\n#### Changelog\n\n**1.6.4:** Adding React Native ``0.6x`` compatibility.\n**1.6.1:** Removed deprecated UIWebView.\n\n\n### Supported Devices\n\n* iOS \u003e=8\n* Android \u003e=19\n\n\n\n\n## Getting started\n\nTo install the library:\n\n### Easy Way\n\n```sh\n  npm i rn-pdf-generator --save\n  react-native link\n```\n\n### Hard Way\n\n[hard way...](https://facebook.github.io/react-native/docs/linking-libraries-ios)\n\n\n### Usage\n\nTo transform raw HTML into PDF:\n\n```javascript\nimport PDF  from 'rn-pdf-generator';\n\nPDF.fromHTML(`\u003cP\u003eHELLO WORLD\u003c/P\u003e`, `http://localhost`)\n   .then(  data =\u003e console.log(data)) // WFuIGlzIGRpc3Rpbm....\n   .catch( err  =\u003e  console.log('error-\u003e', err) )\n```\n\n\u003e In case you this HTML fetch resources from external servers you can specify the location using the second parameter ``\u003cbase-url\u003e``.\n\nTransforming a remote webpage:\n\n```javascript\n\nimport PDF  from 'rn-pdf-generator';\n\nPDF.fromURL('https://www.google.com/')\n   .then(  data =\u003e console.log(data)) // WFuIGlzIGRpc3Rpbm....\n   .catch( err  =\u003e  console.log('error-\u003e', err) )\n\n```\n\n### Demo \n\n\n[This demo](https://github.com/cesarvr/react-native-pdf-generator-demo) that generates a PDF and then display it using [react-native-pdf plugin](https://www.npmjs.com/package/react-native-pdf). \n\n![Demo](https://github.com/cesarvr/react-native-pdf-generator-demo/blob/master/demo-img/pdf_document.gif?raw=true)\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcesarvr%2Freact-native-pdf-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcesarvr%2Freact-native-pdf-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcesarvr%2Freact-native-pdf-generator/lists"}