Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
cd2b623
refactor: project restructure
sashamilenkovic Sep 24, 2025
6e401a7
reactor: embed examples in frameworks and fix typing issues
sashamilenkovic Sep 24, 2025
e7f36b4
fix: adds missing custom-overlay examples
sashamilenkovic Sep 24, 2025
96791e9
refactor: adds back removed examples
sashamilenkovic Sep 24, 2025
cf84038
chore: formatting
sashamilenkovic Sep 24, 2025
01929c1
refactor: removes examples covered in frameworks
sashamilenkovic Sep 24, 2025
49ab949
refactor: adds loader module for normalization purposes
sashamilenkovic Sep 25, 2025
52e9629
refactor: adds angular and svelte examples to frameworks
sashamilenkovic Sep 25, 2025
710b2e6
style: changes inline styles to css classes in react
sashamilenkovic Sep 25, 2025
2bbed1b
fix: fixes container not unmounted error in react example, fixes some…
sashamilenkovic Sep 25, 2025
1535563
fix: removes unnecessary unload from react example
sashamilenkovic Sep 25, 2025
2694598
style: fixes grid layout vertical stack issue on example cards
sashamilenkovic Sep 25, 2025
6b87622
refactor: gets react js example working with custom overlay example a…
sashamilenkovic Sep 25, 2025
7a819b3
style: more styling updates for react examples
sashamilenkovic Sep 25, 2025
bc921f4
refactor: applies updates to next, ts and js
sashamilenkovic Sep 25, 2025
825f451
refactor: updates vue examples
sashamilenkovic Sep 25, 2025
02a25e0
fix: typing issue involving custom toolbar items
sashamilenkovic Sep 25, 2025
f679d9c
refactor: adds nuxt js
sashamilenkovic Sep 25, 2025
ed08fb8
refactor: adds svelte examples
sashamilenkovic Sep 25, 2025
d3af35c
refactor: adds angular, wip on sveltekit
sashamilenkovic Sep 25, 2025
a1a7db0
fix: takes care of type error in angular
sashamilenkovic Sep 25, 2025
6b0cfa0
refactor: adds sveltekit
sashamilenkovic Sep 25, 2025
63a6b00
fix: adds use client for react pages
sashamilenkovic Sep 26, 2025
782c836
fix: remove .svelte-kit from git tracking
sashamilenkovic Sep 26, 2025
b6b71a2
fix: adjusts import of nutrient sdk in vue example
sashamilenkovic Sep 26, 2025
21fbac4
chore: adds nuxt logo
sashamilenkovic Sep 26, 2025
bdd804a
refactor: removes now deprecated angular and svelte-kit examples
sashamilenkovic Sep 26, 2025
3f70b52
fix: next js wrong export
sashamilenkovic Sep 26, 2025
1d26a54
refactor: adds configuration for each examples directory for base url…
sashamilenkovic Sep 26, 2025
1bde84a
refactor: renames examples directories to nutrient, moves utils into it
sashamilenkovic Sep 26, 2025
61d4ed2
fix: updates all examples to use async mount to async load nutrient v…
sashamilenkovic Sep 26, 2025
e5d20b1
refactor: updates react js and ts examples
sashamilenkovic Sep 26, 2025
e38693e
fix: removes excludes from vite config
sashamilenkovic Sep 26, 2025
0918289
fix: small correction in react js
sashamilenkovic Sep 26, 2025
1f4bc89
fix: small update for specific react js page
sashamilenkovic Sep 26, 2025
d9a68c2
fix: removes latest tag from nuxt dev tools
sashamilenkovic Sep 29, 2025
ca21301
fix: next and nuxt configurations
sashamilenkovic Sep 29, 2025
aae015f
fix: upgrade svelte, fixes ts in js issue in vue
sashamilenkovic Sep 30, 2025
1d83753
fix: wrong import path for nutrient viewer type in vue
sashamilenkovic Sep 30, 2025
e8caa52
fix: uses same unload method, does not reference window object
sashamilenkovic Sep 30, 2025
53fe832
bypassing
sashamilenkovic Sep 30, 2025
36f8341
fix: svelte issue, reverts package.json downgrade in angular
sashamilenkovic Sep 30, 2025
5a9614b
fix: update svelte to use let, not const for template
sashamilenkovic Sep 30, 2025
b10cb50
fix: changes const to let in sveltekit
sashamilenkovic Sep 30, 2025
4c5373c
fix: changes const to let in sveltekit
sashamilenkovic Sep 30, 2025
d1bcd56
fix: addresses sveltekit async issue
sashamilenkovic Sep 30, 2025
9603927
fix: adds postinstall script for sveltekit
sashamilenkovic Sep 30, 2025
6b26bd5
fix: fixes type issue in angular
sashamilenkovic Oct 1, 2025
8d3ccb0
fix: angular, changes base url
sashamilenkovic Oct 1, 2025
a042cbf
feat: adds support solid, solidstart, and vanilla
sashamilenkovic Oct 1, 2025
53f726d
fix: adjust biome.json for solid, makes fixes to implementation in so…
sashamilenkovic Oct 1, 2025
992dc02
feat: adds watermarks page
sashamilenkovic Oct 1, 2025
098f44b
fix: cleans up new vanilla template bugs
sashamilenkovic Oct 1, 2025
cd3c6e7
style: updates ts svg
sashamilenkovic Oct 1, 2025
061e43b
fix: removes misplaced nutrient directory in next framework
sashamilenkovic Oct 1, 2025
c530922
fix: let const issue in svelte, fixes pathing in angular
sashamilenkovic Oct 1, 2025
b2159a8
fix: another let const issue in svelte
sashamilenkovic Oct 1, 2025
354ec0b
fix: angular, svelte and sveltekit nutrient directory issues
sashamilenkovic Oct 1, 2025
5e75f13
fix: sets const to let in sveltekit
sashamilenkovic Oct 1, 2025
42e174e
fix: another let const svelte issue
sashamilenkovic Oct 1, 2025
01389bf
fix: another let const svelte issue
sashamilenkovic Oct 1, 2025
d396a71
fix: moves misplaced angular nutrient directory
sashamilenkovic Oct 1, 2025
c63f62d
fix: removes solidstart for now, fixes let const in ts sveltekit
sashamilenkovic Oct 1, 2025
0466dfb
fix: disable useConst rule for Svelte files (bind:this requires let)
sashamilenkovic Oct 1, 2025
7995e06
docs: updates readme and scripts for refactor with frameworks
sashamilenkovic Oct 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ pspdfkit-lib/
open-iconic
.next/
.nuxt/
.angular/
.svelte-kit/
dist/
analytics.js
.DS_Store
198 changes: 190 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,201 @@
# Nutrient Web SDK Examples

This repository contains various examples of the usage of [Nutrient Web SDK](https://www.nutrient.io/sdk/web).
This repository contains framework integration examples for the [Nutrient Web SDK](https://www.nutrient.io/sdk/web).

- **Demo**: https://www.nutrient.io/demo/
- **Guides**: https://www.nutrient.io/guides/web/
- **API**: https://www.nutrient.io/guides/web/api/

## Development
## 📁 Repository Structure

### Biome Version Check
```
nutrient-web-examples/
├── frameworks/ # Frontend framework examples with JS and TS variants
│ ├── react/
│ │ ├── JS/ # React + JavaScript + Vite
│ │ └── TS/ # React + TypeScript + Vite
│ ├── vue/
│ │ ├── JS/ # Vue + JavaScript + Vite
│ │ └── TS/ # Vue + TypeScript + Vite
│ ├── svelte/
│ │ ├── JS/ # Svelte + JavaScript + Vite
│ │ └── TS/ # Svelte + TypeScript + Vite
│ ├── solid/
│ │ ├── js/ # SolidJS + JavaScript + Vite
│ │ └── ts/ # SolidJS + TypeScript + Vite
│ ├── angular/
│ │ └── TS/ # Angular (TypeScript only)
│ ├── next/
│ │ ├── JS/ # Next.js + JavaScript
│ │ └── TS/ # Next.js + TypeScript
│ ├── nuxt/
│ │ ├── JS/ # Nuxt + JavaScript
│ │ └── TS/ # Nuxt + TypeScript
│ ├── sveltekit/
│ │ ├── js/ # SvelteKit + JavaScript
│ │ └── ts/ # SvelteKit + TypeScript
│ └── vanilla/
│ ├── js/ # Vanilla JS + Vite
│ └── ts/ # Vanilla TS + Vite
└── examples/ # Specialized examples and legacy integrations
├── webpack/ # Webpack-based example
├── electron/ # Electron desktop app
├── pwa/ # Progressive Web App
├── laravel/ # Laravel PHP integration
├── salesforce/ # Salesforce integration
└── ... # Other specialized examples
```

This repository includes a check to ensure that the Biome version in `package.json` matches the version in `.github/workflows/biome.yml`. This check is run:
## 🚀 Framework Examples

- During CI/CD in the GitHub workflow
- As a pre-commit hook to prevent commits with mismatched versions
- Manually using `npm run check-biome-version`
Each framework example demonstrates Nutrient Web SDK integration with **4 feature examples**:

If you update the Biome version in `package.json`, make sure to update it in `.github/workflows/biome.yml` as well.
### Available Examples in Each Framework

| Example | Description | Key Features |
| ------------------- | ------------------------- | ---------------------------------------------- |
| **Basic Viewer** | Simple PDF viewing | Document loading, basic navigation |
| **Magazine Mode** | Magazine-style reader | Double-page layout, custom toolbar, fullscreen |
| **Custom Overlays** | Interactive page overlays | Click handlers, custom UI elements on pages |
| **Watermarks** | Document watermarking | Adding text/image watermarks to PDFs |

### Supported Frameworks

| Framework | JavaScript | TypeScript | Build Tool | Meta-Framework |
| --------- | ---------- | ---------- | ----------- | -------------- |
| React | ✅ | ✅ | Vite | - |
| Vue | ✅ | ✅ | Vite | - |
| Svelte | ✅ | ✅ | Vite | - |
| SolidJS | ✅ | ✅ | Vite | - |
| Vanilla | ✅ | ✅ | Vite | - |
| Angular | - | ✅ | Angular CLI | - |
| Next.js | ✅ | ✅ | - | React |
| Nuxt | ✅ | ✅ | - | Vue |
| SvelteKit | ✅ | ✅ | - | Svelte |

## 🛠️ Development

Each framework example can be run independently:

```bash
# React JavaScript
cd frameworks/react/JS
npm install
npm run dev

# Vue TypeScript
cd frameworks/vue/TS
npm install
npm run dev

# SolidJS TypeScript
cd frameworks/solid/ts
npm install
npm run dev

# Next.js JavaScript
cd frameworks/next/JS
npm install
npm run dev
```

## 📦 Installation Methods

### Frameworks Directory (CDN Installation)

All examples in `frameworks/` use **CDN installation** of Nutrient Web SDK:

```html
<script src="https://cdn.cloud.pspdfkit.com/pspdfkit-web@{VERSION}/nutrient-viewer.js"></script>
```

This approach:

- ✅ No build configuration needed
- ✅ Faster initial setup
- ✅ Automatic updates (if using `@latest`)
- ✅ Works in any framework

### Examples Directory (Various Methods)

Examples in `examples/` may use different installation methods:

- Package installation (`npm install`)
- CDN installation
- Framework-specific integrations

## 🔧 Scripts

The repository includes maintenance scripts:

```bash
# Install dependencies in all examples and frameworks
./scripts/install-dependencies.sh

# Run e2e tests
./scripts/e2e-tests.sh

# Update Nutrient SDK versions
./scripts/update-nutrient-in-examples.sh
```

## 🎯 Example Structure

Each framework example follows a consistent pattern:

```
frameworks/{framework}/{JS|TS}/
├── src/
│ ├── nutrient/
│ │ ├── nutrient-config.{js|ts} # Shared config
│ │ ├── loadNutrientViewer.{js|ts} # CDN loader
│ │ ├── basic-viewer/
│ │ │ └── implementation.{js|ts} # Basic viewer logic
│ │ ├── magazine-mode/
│ │ │ └── implementation.{js|ts} # Magazine mode logic
│ │ ├── custom-overlays/
│ │ │ └── implementation.{js|ts} # Custom overlays logic
│ │ └── watermarks/
│ │ └── implementation.{js|ts} # Watermarks logic
│ ├── pages/
│ │ ├── HomePage.{jsx|tsx|vue|svelte} # Landing page with links
│ │ ├── BasicViewerPage.{jsx|tsx|vue|svelte}
│ │ ├── MagazineModePage.{jsx|tsx|vue|svelte}
│ │ ├── CustomOverlaysPage.{jsx|tsx|vue|svelte}
│ │ └── WatermarksPage.{jsx|tsx|vue|svelte}
│ └── components/
│ └── logos/ # Framework logos
├── package.json
└── vite.config.{js|ts} # Build configuration
```

## 🤝 Contributing

When adding new framework examples:

1. **Follow the naming convention**:

- Use `{framework}/{JS|TS}/` for Vite-based frameworks
- Use `{framework}/{js|ts}/` for framework CLIs (lowercase)

2. **Include all 4 examples**: Basic Viewer, Magazine Mode, Custom Overlays, Watermarks

3. **Use CDN installation**: Keep examples simple and framework-focused

4. **Maintain consistency**:

- Same file structure across all frameworks
- Same implementation logic (just adapted to framework patterns)
- Same styling and UI

5. **Add both JS and TS variants** (where applicable)

## 📚 Additional Resources

- [Nutrient Web SDK Documentation](https://www.nutrient.io/guides/web/)
- [Nutrient Web SDK API Reference](https://www.nutrient.io/guides/web/api/)
- [Nutrient Support](https://www.nutrient.io/support/)

## 📄 License

Examples are provided for demonstration purposes. Check individual example directories for specific license information.
27 changes: 25 additions & 2 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"./examples/wasm-benchmark/*",
"./examples/asp-net/*",
"./examples/svelte-kit",
"./examples/salesforce/*"
"./examples/salesforce/*",
"**/frameworks/sveltekit/**/.svelte-kit/**"
],
"ignoreUnknown": true
},
Expand All @@ -20,5 +21,27 @@
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
}
},
"overrides": [
{
"include": ["frameworks/solid/**", "frameworks/solidstart/**"],
"linter": {
"rules": {
"correctness": {
"useJsxKeyInIterable": "off"
}
}
}
},
{
"include": ["frameworks/svelte/**", "frameworks/sveltekit/**"],
"linter": {
"rules": {
"style": {
"useConst": "off"
}
}
}
}
]
}
17 changes: 0 additions & 17 deletions examples/angular/.editorconfig

This file was deleted.

42 changes: 0 additions & 42 deletions examples/angular/.gitignore

This file was deleted.

46 changes: 0 additions & 46 deletions examples/angular/README.md

This file was deleted.

Loading