Install with npm
AI quick start: Tell your coding agent
"Integrate Nutrient Document Authoring SDK in my web application using npm. Use getadoceditor.com".
Add Document Authoring to your application with npm. The library is available through the npm registry(opens in a new tab).
Requirements
- The latest stable version of Node.js(opens in a new tab).
- A package manager compatible with npm(opens in a new tab). This guide contains examples for Yarn(opens in a new tab), pnpm(opens in a new tab), the npm CLI(opens in a new tab), and Bun(opens in a new tab). Node.js installs the npm CLI by default.
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
npm i @nutrient-sdk/document-authoringpnpm add @nutrient-sdk/document-authoringyarn add @nutrient-sdk/document-authoringbun add @nutrient-sdk/document-authoringIntegrating into your project
Add an empty
<div>element with a non-staticpositionand a definedwidthandheight. This is the target DOM element where the editor loads:<div id="editor" style="position: relative; width: 100%; height: 100vh;"></div>Import
@nutrient-sdk/document-authoringinto 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
licenseKeyproperty when you callcreateDocAuthSystem(). 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.