This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /sdk/document-authoring/getting-started/using-npm.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Integrate Document Authoring (WYSIWYG library) using npm

Install with npm

Add Document Authoring to your application with npm. The library is available through the npm registry(opens in a new tab).

Requirements

You need Node.js to complete this guide, but in general, Node.js isn’t a requirement for using the Document Authoring library.

Type definitions and module systems

The package includes type definitions and support for CommonJS, ESM, AMD, and a global DocAuth object. Your build tools resolve these automatically from its package.json file.

Adding to your project

Terminal window
npm i @nutrient-sdk/document-authoring

Integrating into your project

  1. Add an empty <div> element with a non-static position and a defined width and height. This is the target DOM element where the editor loads:

    <div id="editor" style="position: relative; width: 100%; height: 100vh;"></div>
  2. Import @nutrient-sdk/document-authoring into your application and initialize the editor:

    import DocAuth from '@nutrient-sdk/document-authoring';
    const system = await DocAuth.createDocAuthSystem();
    const editor = await system.createEditor(document.getElementById('editor'), {
    document: await system.createDocumentFromPlaintext('Hello, world!'),
    });

    For licensed deployments, pass your license key as the licenseKey property when you call createDocAuthSystem(). The key is optional for evaluation builds.

Next steps

How Document Authoring works
The system, editor, and document model.

Document data and formats
Open and save DOCX, PDF, and DocJSON.