Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"files": {
"ignore": [
"examples/angular/.angular/cache/*",
"./examples/*/public/*",
"./examples/blazor/wasm/wwwroot/css/*",
"./examples/wasm-benchmark/*",
"./examples/asp-net/*",
"./examples/svelte-kit",
"./examples/salesforce/*"
"examples/*/public/*",
"examples/blazor/wasm/wwwroot/css/*",
"examples/wasm-benchmark/*",
"examples/asp-net/*",
"examples/svelte-kit",
"examples/salesforce/*"
],
"ignoreUnknown": true
},
Expand Down
5 changes: 5 additions & 0 deletions examples/javascript-vite/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dist
node_modules
.DS_Store
*.log
.vite
42 changes: 42 additions & 0 deletions examples/javascript-vite/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
The Nutrient sample applications are licensed with a modified BSD
license. In plain language: you're allowed to do whatever you wish
with the code, modify, redistribute, embed in your products (free or
commercial), but you must include copyright, terms of usage and
disclaimer as stated in the license.

You will require a commercial Nutrient License to run these examples
in non-demo mode. Please refer to [email protected] for details.

Copyright © 2017-present PSPDFKit GmbH d/b/a Nutrient.
All rights reserved.

Redistribution and use in source or binary forms,
with or without modification, are permitted provided
that the following conditions are met:

- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the
distribution.

- Redistributions of Nutrient samples must include attribution to
Nutrient, either in documentation or other appropriate media.

- Neither the name of the Nutrient, PSPDFKit GmbH, nor its developers
may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
74 changes: 74 additions & 0 deletions examples/javascript-vite/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Nutrient Web SDK - JavaScript + Vite example

This example demonstrates how to integrate Nutrient Web SDK into a JavaScript application using Vite as the build tool.

## Prerequisites

- Node.js 16 or higher
- npm or yarn package manager

## Getting started

1. Clone the repository:
```bash
git clone https://github.com/PSPDFKit/nutrient-web-examples.git
cd nutrient-web-examples/examples/javascript-vite
```

2. Install dependencies:
```bash
npm install
```

## Usage

### CDN installation (recommended)

The example uses CDN by default, loading Nutrient Web SDK from Nutrient’s Content Delivery Network (CDN).

#### Development mode:
```bash
npm run dev
```

#### Production build:
```bash
npm run build
npm run preview
```

### Local npm package installation

To use the locally installed npm package instead of CDN:

#### Development mode:
```bash
npm run dev:npm
```

#### Production build:
```bash
npm run build:npm
npm run preview:npm
```

### Differences between approaches

- **CDN** (default): Loads SDK from external CDN, smaller bundle size, requires internet connection
- **npm package**: Bundles Nutrient SDK with your application, larger bundle size, works offline

For more information, refer to our [JavaScript getting started](https://www.nutrient.io/sdk/web/getting-started/other-frameworks/javascript/) guide.

## License

This software is licensed under a [modified BSD license](LICENSE).

## Support, issues and license questions

Nutrient offers support for customers with an active SDK license. Submit your query at — https://www.nutrient.io/support/request/

Are you [evaluating our SDK](https://www.nutrient.io/sdk/try)? That’s great, we’re happy to help out! To make sure this is fast, please use a work email and have someone from your company fill out our sales form: https://www.nutrient.io/contact-sales

## Contributing

Please ensure [you’ve signed our CLA](https://www.nutrient.io/guides/web/miscellaneous/contributing/) so we can accept your contributions.
30 changes: 30 additions & 0 deletions examples/javascript-vite/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Nutrient Web SDK - JavaScript + Vite Example</title>
<link rel="stylesheet" href="/src/style.css" />
<!-- Load Nutrient Web SDK from CDN (comment out or remove when using npm package) -->
<script src="https://cdn.cloud.pspdfkit.com/[email protected]/nutrient-viewer.js"></script>
</head>
<body>
<header>
<div class="info-text">
<span>📄 Sample PDF loaded by default</span> &nbsp;•&nbsp;
<span class="upload-options">
<span class="drag-text">
<b>Drag and Drop your own PDF</b> &nbsp; or &nbsp;
</span>
<div class="upload-btn-wrapper">
<button class="btn">Upload a file</button>
<input id="selectFile" type="file" accept="application/pdf" />
</div>
</span>
</div>
</header>
<div id="app" class="App"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

Loading
Loading