Troubleshooting: Watermark still appearing with license key

If you’ve added a license key to your Nutrient Web SDK configuration but the watermark still appears, this guide covers specific scenarios that commonly cause this issue.

Quick troubleshooting checklist

Before diving into specific solutions, verify these common issues first:

  1. Check the console — Open your browser’s developer console (press F12) and look for license-related error messages.
  2. Verify your domain — Ensure the domain in your browser matches exactly what’s registered in the Nutrient Portal(opens in a new tab).
  3. Review the comprehensive guide — Many license issues are covered in our license troubleshooting guide.
  4. Check if the watermark is embedded in the document — Doublecheck that the document doesn’t contain the watermark by opening it directly in the browser or in other viewers, like Adobe.

If you’ve verified the basics above and still see a watermark, continue with the solutions below.

Scenario 1: Environment variable issues

When using environment variables to store your license key, deployment platforms may cause issues that result in an empty or undefined license key.

Issue 1: License key trimmed during deployment

Some deployment platforms (Vercel, Netlify, AWS) may trim whitespace or line breaks from environment variables. Verify your license key wasn’t truncated:

// Debug: Check if license key is complete.
const licenseKey = process.env.NUTRIENT_LICENSE_KEY;
console.log("License key length:", licenseKey?.length);
console.log("License key (first 50 chars):", licenseKey?.substring(0, 50));
if (!licenseKey || licenseKey.length < 100) {
console.error("License key appears to be missing or incomplete!");
}

Common deployment issue: Always verify the full license key is present in your deployment platform’s environment variable settings. Some platforms have character limits or may trim values when pasting.

Issue 2: Next.js on Vercel requires the NEXT_PUBLIC_ prefix

If you’re using Next.js and deploying to Vercel (or similar platforms), environment variables must be prefixed with NEXT_PUBLIC_ to be accessible in the browser:

// ❌ INCORRECT: This won't work in Next.js browser code.
NutrientViewer.load({
container: "#pspdfkit",
document: "document.pdf",
licenseKey: process.env.NUTRIENT_LICENSE_KEY, // Returns undefined in browser.
});
// ✅ CORRECT: Use the `NEXT_PUBLIC_` prefix for Next.js.
NutrientViewer.load({
container: "#pspdfkit",
document: "document.pdf",
licenseKey: process.env.NEXT_PUBLIC_NUTRIENT_LICENSE_KEY,
});

Your .env file should look like the following:

Terminal window
# ❌ INCORRECT: Missing `NEXT_PUBLIC_` prefix.
NUTRIENT_LICENSE_KEY=nX5NbnzGFzYhuWTje1LqC8hWYX...
# ✅ CORRECT: With `NEXT_PUBLIC_` prefix.
NEXT_PUBLIC_NUTRIENT_LICENSE_KEY=nX5NbnzGFzYhuWTje1LqC8hWYX...

Next.js deployment note: Environment variables without the NEXT_PUBLIC_ prefix aren’t available in the browser, causing the license key to be undefined and triggering trial mode. Learn more in the Next.js environment variables documentation(opens in a new tab).

Issue 3: Conditional logic returning empty string

Check if your code has conditional logic that might return an empty string:

// ❌ INCORRECT: Falls back to empty string (trial mode).
NutrientViewer.load({
container: "#pspdfkit",
document: "document.pdf",
licenseKey: process.env.NEXT_PUBLIC_NUTRIENT_LICENSE_KEY || "", // Empty string = trial mode
});
// ✅ CORRECT: Throw error if license key is missing.
const licenseKey = process.env.NEXT_PUBLIC_NUTRIENT_LICENSE_KEY;
if (!licenseKey) {
throw new Error(
"License key is not configured. Please set NEXT_PUBLIC_NUTRIENT_LICENSE_KEY environment variable.",
);
}
NutrientViewer.load({
container: "#pspdfkit",
document: "document.pdf",
licenseKey: licenseKey,
});
// Also applies to other methods that accept configuration:
NutrientViewer.convertToPDF({
document: "document.docx",
licenseKey: licenseKey, // Don't forget this!
});
NutrientViewer.loadTextComparison({
container: "#comparison-container",
documentA: "original.pdf",
documentB: "modified.pdf",
licenseKey: licenseKey, // Required here too!
});

Remember: All Nutrient methods that accept a configuration object require the licenseKey property. See the API documentation for complete details.

Scenario 2: Missing license features for specific functionality

Having a valid licenseKey isn’t enough on its own; your license must also include the appropriate features for the functionality you’re using. The SDK will display a watermark, even with a valid license key, if your license doesn’t include the required features.

Methods and file types that require specific license features:

To resolve this issue:

  1. Check the browser console for error messages that look like: "The API you’re trying to use requires a license that includes the 'X' feature" (where X is the specific feature name).
  2. Verify your license features in the Nutrient Portal(opens in a new tab):
    • Log in and navigate to your Manage Licenses page.
    • Locate the license for the generated license key.
    • Check the Features list to see which features are enabled in your license.
  3. If the required feature is missing — Contact our Sales team to add Office Files, Image Documents, or other features to your existing license.
  4. If the required feature is already enabled — Copy the license key again from the portal for your domain/bundle ID. Your current license key might have been generated before the feature was added to your license, so you need a fresh key that includes the new feature.

Scenario 3: Clear browser cache

Browser caching can sometimes cause the old (unlicensed) version of your application to load.

Hard refresh methods by browser:

  • Chrome/Edge — Press Control-Shift-R (Windows/Linux) or Command-Shift-R (Mac)
  • Firefox — Press Control-F5 (Windows/Linux) or Command-Shift-R (Mac)
  • Safari — Press Command-Option-R (Mac)

Alternative: Open your application in an incognito/private browsing window to bypass the cache entirely.

Additional common issues

For other license-related issues, refer to our comprehensive license troubleshooting guide, which covers:

  • Domain mismatch and subdomain configuration
  • License key expiration and renewal
  • Standalone vs. Document Engine licensing
  • Beta license key requests for localhost, development, QA and staging environments
  • License validation errors and their meanings
  • Copy/paste issues with license keys

Still having issues?

If you’ve tried all the solutions above and the watermark still appears:

  1. Review the comprehensive license troubleshooting guide for additional scenarios.
  2. Check the browser console for specific error messages.
  3. Contact our Support team with the following information:
    • The license key for your registered domain
    • The SDK version you’re using
    • Any error messages from the browser console
    • Screenshots of the issue

Additional resources