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.
✨ Feature requests & feedback
Section titled “✨ Feature requests & feedback”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!
💻 Installation
Section titled “💻 Installation”The package is available on npm, and can be installed with your package manager of choice. The package name is @nutrient-sdk/document-authoring.
npm install @nutrient-sdk/document-authoring⚡️ Quickstart
Section titled “⚡️ Quickstart”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)
// 2. create a documentconst doc = await docAuthSystem.createDocumentFromPlaintext('Hi there!');
// 3. create an editor and attach it to the DOMconst editor = await docAuthSystem.createEditor(document.getElementById('editor'), { document: doc,});That’s it! You now have a fully functional document editor running in your page.
⚙️ Core concepts
Section titled “⚙️ Core concepts”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.
🗺️ Next steps
Section titled “🗺️ Next steps”- API Reference – Explore DocAuthSystem, DocAuthEditor, and DocAuthDocument for complete API details
- Guides pages – Learn about DocJSON format, PDF/DOCX workflows, and various features
- Product page – Try the live demo and see what’s possible
For questions or issues, reach out to support@nutrient.io.