Skip to content
Document Authoring DA  API Docs v1.9.0
npmGitHub

Document Authoring API Docs

Document Authoring provides a way to seamlessly embed document authoring capabilities into your web app. It’s a WYSIWYG editor that provides features traditionally found only in desktop word processors. You can read more and try a demo on our dedicated product page.

To help us shape this new authoring experience, we highly value your feedback! Please submit any feature requests or bug reports to support@nutrient.io with the subject line “Document Authoring: Feature Request/Bug Report”. We appreciate your contributions and are excited to hear your thoughts!

The package is available on npm, and can be installed with your package manager of choice. The package name is @nutrient-sdk/document-authoring.

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

The visual editor needs a suitable target DOM element:

<!--
Make sure `position` is set to a value other than the default or `static`!
If unsure use `relative`.
-->
<div id="editor" style="position: relative; width: 1024px; height: 600px;"></div>

Then import the SDK and create your editor:

import DocAuth from '@nutrient-sdk/document-authoring';
// 1. create the system (loads Wasm for font loading etc)
const docAuthSystem = await DocAuth.createDocAuthSystem();
// 2. create a document
const doc = await docAuthSystem.createDocumentFromPlaintext('Hi there!');
// 3. create an editor and attach it to the DOM
const editor = await docAuthSystem.createEditor(document.getElementById('editor'), {
document: doc,
});

That’s it! You now have a fully functional document editor running in your page.

The library is built around three main parts:

  • DocAuthSystem – The core engine for anything that requires WebAssembly, like managing fonts, licensing and PDF binary generation. You typically create one instance that is shared across multiple editors or documents.

  • DocAuthEditor – The visual editor UI. Binds to a DOM element and lets users edit documents. You can create multiple editors from a single system.

  • DocAuthDocument – A document instance. Holds the content and provides methods for saving, exporting to PDF/DOCX, and more.

The system can create editors or documents. You can either load/import documents or attach them to editors.

For questions or issues, reach out to support@nutrient.io.