Skip to content

Commit b37d0e9

Browse files
committed
nutrify nextjs example
1 parent b205229 commit b37d0e9

File tree

7 files changed

+22
-38
lines changed

7 files changed

+22
-38
lines changed

examples/nextjs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ node_modules
33
public/pspdfkit-lib
44
.next
55
.tool-versions
6+
public/nutrient-viewer

examples/nextjs/Readme.md

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This example shows how to integrate [Nutrient Web SDK](https://www.nutrient.io/w
88

99
## Support, Issues and License Questions
1010

11-
PSPDFKit offers support for customers with an active SDK license via https://www.nutrient.io/support/request/
11+
Nutrient offers support for customers with an active SDK license via https://www.nutrient.io/support/request/
1212

1313
Are you [evaluating our SDK](https://www.nutrient.io/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/sales/
1414

@@ -17,20 +17,12 @@ Are you [evaluating our SDK](https://www.nutrient.io/try/)? That's great, we're
1717
Clone the repo:
1818

1919
```bash
20-
git clone https://github.com/PSPDFKit/pspdfkit-web-example-nextjs.git
21-
cd pspdfkit-web-example-nextjs
20+
git clone https://github.com/PSPDFKit/nutrient-web-examples
21+
cd nutrient-web-examples/examples/nextjs
2222
```
2323

2424
Install the project dependencies:
2525

26-
yarn:
27-
28-
```bash
29-
yarn
30-
```
31-
32-
npm:
33-
3426
```shell script
3527
npm install
3628
```
@@ -39,14 +31,6 @@ npm install
3931

4032
We are ready to launch the app! 🎉
4133

42-
yarn:
43-
44-
```bash
45-
yarn dev
46-
```
47-
48-
npm:
49-
5034
```shell script
5135
npm run dev
5236
```

examples/nextjs/app/layout.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ const RootLayout = ({ children }) => {
99
return (
1010
<html lang="en">
1111
<head>
12-
{/* Load PSPDFKit script using Next.js Script component */}
12+
{/* Load Nutrient script using Next.js Script component */}
1313
<Script
14-
src="/pspdfkit-lib/pspdfkit.js"
15-
strategy="beforeInteractive" // Load before the page becomes interactive to reference window.PSPDFKit in the client
14+
src="/nutrient-viewer/nutrient-viewer.js"
15+
strategy="beforeInteractive" // Load before the page becomes interactive to reference window.NutrientViewer in the client
1616
/>
1717
</head>
1818
<body>{children}</body>

examples/nextjs/app/page.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function App() {
1717
PSPDFKit.load({
1818
container,
1919
document: "/example.pdf",
20-
baseUrl: `${window.location.protocol}//${window.location.host}/`,
20+
// baseUrl: `${window.location.protocol}//${window.location.host}/`,
2121
});
2222
}
2323

examples/nextjs/next.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// Exclude pspdfkit from the client-side bundle to optimize performance
1+
// Exclude @nutrient-sdk/viewer from the client-side bundle to optimize performance
22
// and avoid potential conflicts with the script loaded in layout.js
33
const nextConfig = {
44
webpack: (config, { isServer }) => {
55
if (!isServer) {
66
config.externals = config.externals || [];
77
config.externals.push({
8-
pspdfkit: "pspdfkit",
8+
"@nutrient-sdk/viewer": "@nutrient-sdk/viewer",
99
});
1010
}
1111

@@ -14,7 +14,7 @@ const nextConfig = {
1414
experimental: {
1515
turbo: {
1616
resolveAlias: {
17-
pspdfkit: "pspdfkit",
17+
"@nutrient-sdk/viewer": "@nutrient-sdk/viewer",
1818
},
1919
},
2020
},

examples/nextjs/package-lock.json

Lines changed: 9 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/nextjs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"main": "index.js",
55
"license": "SEE LICENSE IN https://www.nutrient.io/legal/Nutrient_SDK_User_Evaluation_Subscription_Agreement",
66
"dependencies": {
7+
"@nutrient-sdk/viewer": "^1.0.0",
78
"next": "^15.1.3",
8-
"pspdfkit": "2024.8.1",
99
"react": "^19.0.0",
1010
"react-dom": "^19.0.0"
1111
},
1212
"scripts": {
13-
"copy-assets": "cp -R ./node_modules/pspdfkit/dist/pspdfkit-lib ./public/ && cp -R ./node_modules/pspdfkit/dist/pspdfkit.js ./public/pspdfkit-lib/pspdfkit.js",
13+
"copy-assets": "cp -R ./node_modules/@nutrient-sdk/viewer/dist/ ./public/nutrient-viewer",
1414
"dev": "npm run copy-assets && next dev --turbo",
1515
"build": "npm run copy-assets && next build",
1616
"start": "next start",

0 commit comments

Comments
 (0)