패키지, 저장소 및 앱 카테고리 검색

패키지 상세v6.0.0

nutrient_flutter

강력한 Nutrient PDF SDK를 활용하여 사용자에게 기능이 풍부한 PDF 보기 및 편집 경험을 제공하는 Flutter 플러그인입니다.

AndroidiOS
30일 다운로드
8.8천
좋아요
6
Pub 점수
130

패키지 설치

flutter pub add nutrient_flutter

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Nutrient Flutter는 Flutter 애플리케이션에 Nutrient PDF SDK를 통합하여 풍부한 PDF 보기 및 편집 기능을 가능하게 하는 강력한 플러그인입니다. Android 및 iOS 플랫폼에서 고성능으로 PDF 렌더링, 주석 달기, 서명, 조작을 지원합니다. 원활하고 기능이 완전한 PDF 경험을 원하는 개발자를 위해 설계되었으며, 사용자 정의 가능한 도구와 견고한 문서 처리 기능을 갖춘 네이티브처럼 보이는 인터페이스를 제공합니다. 복잡한 PDF 워크플로우를 단순화하여 고급 문서 상호작용이 필요한 앱에 이상적입니다.

사용 사례

  • 문서 관리 앱
  • 전자 서명 워크플로우
  • 교육 플랫폼
  • PDF 주석 도구
  • 협업 편집 환경

주요 기능

  • 고성능 PDF 렌더링
  • 인터랙티브 주석
  • 디지털 서명 지원
  • 사용자 정의 가능한 UI 구성 요소
  • 크로스 플랫폼 호환성

적합한 대상

  • 문서 중심 앱을 개발하는 개발자
  • 안전한 PDF 처리가 필요한 팀
  • 문서 협업이 필요한 앱
  • 기업용 PDF 통합

고려 사항

  • nutrient.io에서 라이선스가 필요합니다
  • SDK 포함으로 인해 앱 크기가 증가할 수 있습니다
  • 고급 구성 없이 제한된 사용자 정의
  • 외부 SDK 업데이트에 의존
  • 새 사용자를 위한 학습 곡선

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Flutter Document SDK by Nutrient

Add powerful PDF functionality to your Flutter apps with the Nutrient Flutter SDK. View, annotate, and edit PDFs seamlessly across Android, iOS, and Web platforms.

Nutrient Flutter SDK

Requirements

  • Flutter SDK (latest stable version)
  • For Android:
    • Android Studio (latest stable version)
    • Android NDK
    • Android Virtual Device or physical device
  • For iOS:
    • Xcode 16 or later
    • iOS 17.0 or later
  • For Web:
    • Modern web browser with WebAssembly support

Installation

  1. Add the Nutrient Flutter SDK to your pubspec.yaml:
dependencies:
  nutrient_flutter: any
  1. Run the following command:
flutter pub get

Platform Setup

Android Setup
  1. Update your Android configuration in android/app/build.gradle:
android {
    compileSdkVersion 35
    
    defaultConfig {
        minSdkVersion 21
    }
    
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = '17'
    }
}

dependencies {
    implementation 'androidx.appcompat:appcompat:<version>'
}
  1. Update your theme in android/app/src/main/res/values/styles.xml:
- <style name="NormalTheme" parent="Theme.AppCompat.Light.NoActionBar">
+ <style name="NormalTheme" parent="PSPDFKit.Theme.Default">
  1. Update your main activity to use FlutterAppCompatActivity:
import io.flutter.embedding.android.FlutterAppCompatActivity

class MainActivity: FlutterAppCompatActivity() {
}
iOS Setup

Make sure to set the minimum iOS version to 17.0 in your ios/Podfile:

platform :ios, '17.0'
Web Setup

You can include the Nutrient Web SDK using either CDN or local installation:

Option 1: CDN (Recommended)

Add the following script to your web/index.html file:

<script src="https://cdn.cloud.nutrient.io/pspdfkit-web@1.13.0/nutrient-viewer.js"></script>

Note: Replace 1.13.0 with the latest version of Nutrient Web SDK. Check the latest releases for the current version.

Option 2: Local Installation
  1. Download Nutrient Web SDK. The download will start immediately and save a .tar.gz archive like PSPDFKit-Web-binary-<version>.tar.gz to your computer.

  2. Once downloaded, extract the archive and copy the entire contents of its dist folder to your project's web/assets folder.

  3. Verify your assets folder contains:

    • nutrient-viewer.js file
    • nutrient-viewer-lib directory with library assets
  4. Add the Nutrient library to your web/index.html:

<script src="assets/nutrient-viewer.js"></script>

Note: Your server must have the Content-Type: application/wasm MIME type configured for WebAssembly files.

Sample Document Setup

  1. Create a PDFs directory in your project root:
mkdir PDFs
  1. Download our sample PDF document and save it as Document.pdf in the PDFs directory.

  2. Add the assets directory to your pubspec.yaml:

flutter:
  assets:
    - PDFs/

Usage

Create a new file lib/main.dart with the following content:

import 'package:flutter/material.dart';
import 'package:nutrient_flutter/nutrient_flutter.dart';
import 'dart:io';
import 'package:flutter/foundation.dart';

const String documentPath = 'PDFs/Document.pdf';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // Initialize the Nutrient SDK with your license key
  await Nutrient.initialize(
    androidLicenseKey: 'YOUR_ANDROID_LICENSE_KEY',
    iosLicenseKey: 'YOUR_IOS_LICENSE_KEY',
    webLicenseKey: 'YOUR_WEB_LICENSE_KEY',
  );

   runApp(const MaterialApp(
    home: MyApp(),
  ));
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  Future<String> extractAsset(BuildContext context, String assetPath) async {

    if (kIsWeb) {
      return assetPath;
    }

    final bytes = await DefaultAssetBundle.of(context).load(assetPath);
    final list = bytes.buffer.asUint8List();
    final tempDir = await Nutrient.getTemporaryDirectory();
    final tempDocumentPath = '${tempDir.path}/$assetPath';
    final file = File(tempDocumentPath);

    await file.create(recursive: true);
    file.writeAsBytesSync(list);
    return file.path;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: FutureBuilder<String>(
          future: extractAsset(context, documentPath),
          builder: (context, snapshot) {
            if (snapshot.hasData) {
              /// NutrientView is a widget that displays a PDF document.
              return NutrientView(
                documentPath: snapshot.data!,
              );
            } else if (snapshot.hasError) {
              return Center(
                child: Text('${snapshot.error}'),
              );
            } else {
              return const Center(
                child: CircularProgressIndicator(),
              );
            }
          }),
    );
  }
}

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.

Learn More

Support

Visit our Support Center for help with the SDK.

License

This project is licensed under the Nutrient Commercial License. See LICENSE for details.

카테고리

의존성

의존성 목록 6 개

  • nutrient_flutter_android^2.0.0
  • nutrient_flutter_ios^2.0.0
  • nutrient_flutter_platform_interface^2.0.0
  • nutrient_flutter_web^2.0.0
  • path_provider^2.1.5
  • plugin_platform_interface^2.0.2

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.