{"id":22179978,"url":"https://github.com/pspdfkit/pspdfkit-flutter","last_synced_at":"2025-04-04T08:08:21.328Z","repository":{"id":40633298,"uuid":"141403334","full_name":"PSPDFKit/pspdfkit-flutter","owner":"PSPDFKit","description":"PSPDFKit library for Flutter. Flutter is Google's mobile UI framework for crafting high-quality native experiences on iOS and Android in record time.","archived":false,"fork":false,"pushed_at":"2025-03-25T15:16:20.000Z","size":22500,"stargazers_count":102,"open_issues_count":6,"forks_count":65,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-04-04T08:08:07.392Z","etag":null,"topics":["android","flutter","flutter-plugin","ios","pspdfkit","wrapper"],"latest_commit_sha":null,"homepage":"https://pspdfkit.com/blog/2018/starting-with-flutter/","language":"Dart","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PSPDFKit.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2018-07-18T08:15:08.000Z","updated_at":"2025-03-25T15:16:25.000Z","dependencies_parsed_at":"2024-05-03T16:51:30.833Z","dependency_job_id":"d0a2e326-47a9-4926-b85e-6c66ca38091f","html_url":"https://github.com/PSPDFKit/pspdfkit-flutter","commit_stats":{"total_commits":291,"total_committers":12,"mean_commits":24.25,"dds":0.5292096219931272,"last_synced_commit":"cd7600dedf7d0973557302b4c3c4dacdc94413bd"},"previous_names":[],"tags_count":50,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PSPDFKit%2Fpspdfkit-flutter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PSPDFKit%2Fpspdfkit-flutter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PSPDFKit%2Fpspdfkit-flutter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PSPDFKit%2Fpspdfkit-flutter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PSPDFKit","download_url":"https://codeload.github.com/PSPDFKit/pspdfkit-flutter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247142066,"owners_count":20890652,"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","flutter","flutter-plugin","ios","pspdfkit","wrapper"],"created_at":"2024-12-02T09:16:22.339Z","updated_at":"2025-04-04T08:08:21.287Z","avatar_url":"https://github.com/PSPDFKit.png","language":"Dart","readme":"# Flutter Document SDK by Nutrient\n\nAdd powerful PDF functionality to your Flutter apps with the Nutrient Flutter SDK. View, annotate, and edit PDFs seamlessly across Android, iOS, and Web platforms.\n\n## Requirements\n\n- Flutter SDK (latest stable version)\n- For Android:\n  - Android Studio (latest stable version)\n  - Android NDK\n  - Android Virtual Device or physical device\n- For iOS:\n  - Xcode 16 or later\n  - iOS 16.0 or later\n- For Web:\n  - Modern web browser with WebAssembly support\n\n## Installation\n\n1. Add the Nutrient Flutter SDK to your `pubspec.yaml`:\n\n```yaml\ndependencies:\n  pspdfkit_flutter: any\n```\n\n2. Run the following command:\n\n```bash\nflutter pub get\n```\n\n## Platform Setup\n\n### Android Setup\n\n1. Update your Android configuration in `android/app/build.gradle`:\n\n```gradle\nandroid {\n    compileSdkVersion 35\n    \n    defaultConfig {\n        minSdkVersion 21\n    }\n    \n    compileOptions {\n        sourceCompatibility JavaVersion.VERSION_17\n        targetCompatibility JavaVersion.VERSION_17\n    }\n\n    kotlinOptions {\n        jvmTarget = '17'\n    }\n}\n\ndependencies {\n    implementation 'androidx.appcompat:appcompat:\u003cversion\u003e'\n}\n```\n\n2. Update your theme in `android/app/src/main/res/values/styles.xml`:\n\n```diff\n- \u003cstyle name=\"NormalTheme\" parent=\"Theme.AppCompat.Light.NoActionBar\"\u003e\n+ \u003cstyle name=\"NormalTheme\" parent=\"PSPDFKit.Theme.Default\"\u003e\n```\n\n3. Update your main activity to use `FlutterAppCompatActivity`:\n\n```kotlin\nimport io.flutter.embedding.android.FlutterAppCompatActivity\n\nclass MainActivity: FlutterAppCompatActivity() {\n}\n```\n\n### iOS Setup\n\nMake sure to set the minimum iOS version to 16.0 in your `ios/Podfile`:\n\n```ruby\nplatform :ios, '16.0'\n```\n\n### Web Setup\n\nThe Nutrient Web SDK files are distributed as an archive that needs to be extracted manually:\n\n1. [Download Nutrient Web SDK][download web sdk]. The download will start immediately and save a `.tar.gz` archive like `PSPDFKit-Web-binary-\u003cversion\u003e.tar.gz` to your computer.\n\n2. Once downloaded, extract the archive and copy the **entire** contents of its `dist` folder to your project's `web/assets` folder.\n\n3. Verify your `assets` folder contains:\n   - `pspdfkit.js` file\n   - `pspdfkit-lib` directory with library assets\n\n4. Add the Nutrient library to your `web/index.html`:\n\n```html\n\u003cscript src=\"assets/pspdfkit.js\"\u003e\u003c/script\u003e\n```\n\nNote: Your server must have the `Content-Type: application/wasm` MIME type configured for WebAssembly files.\n\n## Sample Document Setup\n\n1. Create a `PDFs` directory in your project root:\n```bash\nmkdir PDFs\n```\n\n2. Download our [sample PDF document][sample document] and save it as `Document.pdf` in the `PDFs` directory.\n\n3. Add the assets directory to your `pubspec.yaml`:\n```yaml\nflutter:\n  assets:\n    - PDFs/\n```\n\n## Usage\n\nCreate a new file `lib/main.dart` with the following content:\n\n```dart\nimport 'package:flutter/material.dart';\nimport 'package:pspdfkit_flutter/pspdfkit_flutter.dart';\nimport 'dart:io';\nimport 'package:flutter/foundation.dart';\n\nconst String documentPath = 'PDFs/Document.pdf';\n\nvoid main() async {\n  WidgetsFlutterBinding.ensureInitialized();\n\n  // Initialize the Nutrient SDK with your license key\n  await Pspdfkit.initialize(\n    androidLicenseKey: 'YOUR_ANDROID_LICENSE_KEY',\n    iosLicenseKey: 'YOUR_IOS_LICENSE_KEY',\n    webLicenseKey: 'YOUR_WEB_LICENSE_KEY',\n  );\n\n   runApp(const MaterialApp(\n    home: MyApp(),\n  ));\n}\n\nclass MyApp extends StatelessWidget {\n  const MyApp({super.key});\n\n  Future\u003cString\u003e extractAsset(BuildContext context, String assetPath) async {\n\n    if (kIsWeb) {\n      return assetPath;\n    }\n\n    final bytes = await DefaultAssetBundle.of(context).load(assetPath);\n    final list = bytes.buffer.asUint8List();\n    final tempDir = await Pspdfkit.getTemporaryDirectory();\n    final tempDocumentPath = '${tempDir.path}/$assetPath';\n    final file = File(tempDocumentPath);\n\n    await file.create(recursive: true);\n    file.writeAsBytesSync(list);\n    return file.path;\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      body: FutureBuilder\u003cString\u003e(\n          future: extractAsset(context, documentPath),\n          builder: (context, snapshot) {\n            if (snapshot.hasData) {\n              /// PspdfkitWidget is a widget that displays a PDF document.\n              return PspdfkitWidget(\n                documentPath: snapshot.data!,\n              );\n            } else if (snapshot.hasError) {\n              return Center(\n                child: Text('${snapshot.error}'),\n              );\n            } else {\n              return const Center(\n                child: CircularProgressIndicator(),\n              );\n            }\n          }),\n    );\n  }\n}\n```\n\n**Note:** Replace `'YOUR_ANDROID_LICENSE_KEY'`, `'YOUR_IOS_LICENSE_KEY'`, and `'YOUR_WEB_LICENSE_KEY'` with your actual license keys. Do not pass any license keys if you want to run the SDK in demo mode, the SDK will run in demo mode with a watermark.\n\n## Learn More\n\n- [Documentation][documentation]\n- [Example Projects][example project]\n- [Release Notes][release notes]\n- [Customization][customization]\n- [Migration Guide][migration guide]\n\n## Support\n\nVisit our [Support Center][support] for help with the SDK.\n\n## License\n\nThis project is licensed under the Nutrient Commercial License. See [LICENSE](LICENSE) for details.\n\n[documentation]: https://www.nutrient.io/guides/flutter/\n[example project]: https://github.com/PSPDFKit/pspdfkit-flutter\n[release notes]: https://www.nutrient.io/changelog/flutter\n[customization]: https://www.nutrient.io/guides/flutter/customize/\n[migration guide]: https://nutrient.io/guides/flutter/upgrade/\n[support]: https://support.nutrient.io\n[license]: https://github.com/PSPDFKit/pspdfkit-flutter/blob/main/LICENSE\n[download web sdk]: https://my.nutrient.io/download/web/latest\n[sample document]: https://www.nutrient.io/downloads/pspdfkit-web-demo.pdf","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpspdfkit%2Fpspdfkit-flutter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpspdfkit%2Fpspdfkit-flutter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpspdfkit%2Fpspdfkit-flutter/lists"}