---
title: "Add PDF functionality with Flutter | Nutrient Web SDK"
canonical_url: "https://www.nutrient.io/sdk/web/getting-started/other-frameworks/flutter/"
md_url: "https://www.nutrient.io/sdk/web/getting-started/other-frameworks/flutter.md"
last_updated: "2026-06-08T09:14:14.525Z"
description: "Learn how to integrate Nutrient Web SDK into your Flutter application. Step-by-step guide for adding PDF viewing, editing, and annotation features."
---

# Add PDF functionality with Flutter

Nutrient Web SDK is a JavaScript PDF library for viewing, annotating, and editing PDFs directly in the browser. Use it to add PDF capabilities to any web app.

This guide walks you through the steps to integrate Nutrient Web SDK into your project. By the end, you’ll be able to render a PDF document in the user interface (UI).

**Test without installing**

You can test the SDK capabilities in our playground.

[Read more](https://www.nutrient.io/demo/sandbox)

**View examples**

Prefer to jump straight into code? View the example repo on GitHub.

[Read more](https://github.com/PSPDFKit/awesome-nutrient)

## Installing the Nutrient dependency

You can load Nutrient Web SDK directly from Nutrient’s content delivery network (CDN). Nutrient maintains the CDN for customers, and it’s our recommended way to get started. For more control and flexibility, use the local installation option.

#### Note: Creating a new project (optional)

If you don’t yet have a Flutter project set up, create one with:

```sh

flutter create nutrient-flutter-example

```

### CDN installation

**Steps:**

1. Add the following `script` tag to the `<head>` section of your `web/index.html` file:

   ```html

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

2. You’re now ready to use Nutrient Web SDK and reference `window.NutrientViewer` in the client-side code.

### Install via package manager

**Steps:**

1. Add the Nutrient Web SDK (`@nutrient-sdk/viewer`) dependency:

   ```bash

   npm install @nutrient-sdk/viewer
   # or

   yarn add @nutrient-sdk/viewer
   # or

   pnpm install @nutrient-sdk/viewer
   ```

2. If you tried CDN installation first, make sure to remove the script tag:

   ```html <!-- Lines deleted: [2] -->

   <!-- web/index.html -->

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

3. You’re now ready to use Nutrient Web SDK locally in your Flutter app.

## Rendering a PDF

### CDN installation

**Steps:**

1. Import the `PSPDFKit` package:

   ```dart

   import 'package:nutrient_flutter/nutrient_flutter.dart';
   ```

2. Display a PDF document inside your Flutter app:

   ```dart

   Scaffold(
     body: NutrientView(
       documentPath: 'https://www.nutrient.io/downloads/nutrient-web-demo.pdf',
     ),
   );
   ```

3. Run the app:

   ```sh

   flutter run
   ```

### Install via package manager

**Steps:**

1. Import the `PSPDFKit` package:

   ```dart

   import 'package:nutrient_flutter/nutrient_flutter.dart';
   ```

2. Display a PDF document inside your Flutter app:

   ```dart

   Scaffold(
     body: NutrientView(
       documentPath: 'https://www.nutrient.io/downloads/nutrient-web-demo.pdf',
     ),
   );
   ```

   **Optional**: If you decide to self-host the Nutrient Web SDK assets as [described in this guide](https://www.nutrient.io/guides/web/self-host-assets.md), you can configure the `baseUrl`. Refer to the [Flutter Web SDK integration documentation](https://pub.dev/packages/nutrient_flutter) for details on configuring the base URL in your Flutter web project.

   If you don’t set a `baseUrl`, the SDK will load assets from the CDN by default.

3. Run the app:

   ```sh

   flutter run
   ```

### Optimizing load performance

If your app doesn't open a PDF immediately — for example, the user navigates to a viewer on a different page — call [`NutrientViewer.preloadWorker()`](https://www.nutrient.io/api/web/functions/NutrientViewer.preloadWorker.html) early in your app to fetch and compile the WebAssembly artifacts in the background. When `NutrientViewer.load()` runs later, it can start rendering without waiting for them.

```js

// Call early — for example, on app init or after login.
NutrientViewer.preloadWorker();

```

Refer to the [performance best practices](https://www.nutrient.io/guides/web/best-practices/performance.md) guide for more optimization techniques.




## Troubleshooting

If you encounter issues, refer to the [common issues](https://www.nutrient.io/guides/web/troubleshooting/common-issues.md) guide.

> **Note for developers using AI coding assistants**: To get accurate troubleshooting help, copy the content from the [troubleshooting](https://www.nutrient.io/guides/web/troubleshooting/common-issues.md) guide and include it in your prompt, along with your specific error.

**Test without installing**

You can test the SDK capabilities in our playground.

[Read more](https://nutrient.io/demo/sandbox/)

**View examples**

Prefer to jump straight into code? View the example repo on GitHub.

[Read more](https://github.com/PSPDFKit/awesome-nutrient)
---

## Related pages

- [Add PDF functionality with PHP](/sdk/web/getting-started/other-frameworks/php.md)
- [Add PDF functionality with JavaScript + Vite](/sdk/web/getting-started/other-frameworks/javascript.md)
- [Add PDF functionality with Nuxt](/sdk/web/getting-started/other-frameworks/nuxt.md)
- [Add PDF functionality with ASP.NET](/sdk/web/getting-started/other-frameworks/aspnet.md)
- [Add PDF functionality with Laravel](/sdk/web/getting-started/other-frameworks/laravel.md)
- [Add PDF functionality with PWA](/sdk/web/getting-started/other-frameworks/pwa.md)
- [Add PDF functionality with Svelte](/sdk/web/getting-started/other-frameworks/svelte.md)
- [Add PDF functionality with jQuery](/sdk/web/getting-started/other-frameworks/jquery.md)
- [Add PDF functionality with Electron](/sdk/web/getting-started/other-frameworks/electron.md)
- [Add PDF functionality with Blazor](/sdk/web/getting-started/other-frameworks/blazor.md)
- [Add PDF functionality with Angular](/sdk/web/getting-started/other-frameworks/angular.md)
- [Add PDF viewing and editing to Vue applications](/sdk/web/getting-started/other-frameworks/vue.md)

