惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
CXSECURITY Database RSS Feed - CXSecurity.com
L
LINUX DO - 热门话题
S
Secure Thoughts
TaoSecurity Blog
TaoSecurity Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
T
Threat Research - Cisco Blogs
AI
AI
B
Blog RSS Feed
S
Schneier on Security
雷峰网
雷峰网
Schneier on Security
Schneier on Security
Help Net Security
Help Net Security
Cloudbric
Cloudbric
L
LINUX DO - 最新话题
罗磊的独立博客
有赞技术团队
有赞技术团队
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Apple Machine Learning Research
Apple Machine Learning Research
P
Proofpoint News Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
The Hacker News
The Hacker News
博客园 - Franky
Attack and Defense Labs
Attack and Defense Labs
The Cloudflare Blog
Webroot Blog
Webroot Blog
Last Week in AI
Last Week in AI
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
博客园 - 叶小钗
美团技术团队
L
Lohrmann on Cybersecurity
T
The Blog of Author Tim Ferriss
The Last Watchdog
The Last Watchdog
T
Troy Hunt's Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Vercel News
Vercel News
Know Your Adversary
Know Your Adversary
O
OpenAI News
博客园 - 【当耐特】
Hacker News - Newest:
Hacker News - Newest: "LLM"
C
Cybersecurity and Infrastructure Security Agency CISA
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
www.infosecurity-magazine.com
www.infosecurity-magazine.com
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
PCI Perspectives
PCI Perspectives
H
Heimdal Security Blog
I
InfoQ
GbyAI
GbyAI
T
Threatpost
C
Cisco Blogs

Inside Nutrient

A guide to the invisible work behind documents Introducing Nutrient Documents for Salesforce: Native document generation and signing Document AI vs. traditional OCR: Choosing between OCR, AI, and hybrid pipelines PDF SDK compliance and security evaluation checklist for enterprise teams (2026) Invariant Corp replaces paper processes with Nutrient Workflow and scales without limits What is process mapping? A complete guide Nutrient vs. Conga Composer for Salesforce document generation (2026) Document routing: How to automate document distribution The CTO’s AI playbook: Why accountability architecture beats orchestration Compliance workflow automation: Why built-in compliance is table stakes Workflow diagrams: Examples, symbols, and how to build one that actually runs Digital forms: Replace paper forms with automated workflows Approval workflow software: How to automate approvals Why document-centric automation is different The CEO’s AI playbook: Why decision architecture beats model selection Nutrient SDK product updates for Q1 2026 PDF redaction verification: How to prove sensitive data is permanently removed What is a VPAT? The complete guide to accessibility conformance reports What is PDF/UA? The accessible PDF standard explained Salesforce eSignatures: Generate, sign, and track documents in one flow Online document viewer: Options, tradeoffs, and how to embed one Document viewer for web apps: React, Vue, Angular (2026) Best document viewers in 2026: A buyer’s guide How to edit a PDF in Python: Add text, images, and annotations Nutrient advances Workflow platform with agentic AI for enterprise-grade speed and consistency in document-heavy operations How to create a Salesforce quote template from opportunity data The business case for accessibility: Five ways it drives enterprise value Python PDF library comparison (2026): 7 libraries for developers Why your AI agent hallucinates PDF table data PDF.js limitations: When to upgrade to a commercial PDF SDK How Subject scaled 5× with Nutrient’s PDF SDK without rebuilding its document layer I replaced our sales training with an AI coach that runs in Slack — here’s what broke Redirecting to: https://securitybuzz.com/cybersecurity-news/why-enterprise-permissions-are-ais-most-dangerous-inheritance/ Nutrient .NET SDK vs. iText Core: Complete comparison for .NET developers DocuVieware: Support’s most frequently asked setup questions Introducing Nutrient Workflow How to convert PDF to Word in C# (.NET) When email and spreadsheets stop working: Work order approval workflows for field teams on the move Compliance with confidence: Why document-centric automation is the foundation of your mission Nutrient expands AI Assistant, automating multistep document workflows inside any application What is document generation? A developer’s guide to PDF generation Document Converter data flow and how real-time watermarks skip the queue PDF/UA compliance guide: Requirements, standards, and best practices Computers still can’t understand you How Athena Intelligence built AI agents for regulated enterprises with Nutrient’s document infrastructure How to convert HTML to PDF (2026): 4 methods from browser print to SDK How to build a document extraction pipeline with Nutrient Vision API OCR vs. intelligent document processing: Choosing the right document extraction engine Beyond OCR: How document intelligence eliminates manual processing in regulated industries Nutrient vs. IronPDF: Complete comparison for .NET developers Nutrient vs. Aspose.PDF: Complete comparison for .NET developers Redirecting to: https://fortune.com/2026/02/19/openclaw-who-is-peter-steinberger-openai-sam-altman-anthropic-moltbook/ Lufthansa Systems uses Nutrient to deliver reliable, scalable PDF rendering for pilots worldwide Nutrient vs. Syncfusion: Complete comparison for .NET developers React’s useTransition: The hook you’re probably using wrong First City Monument Bank streamlines banking processes with Nutrient Workflow Redirecting to: https://www.sdcexec.com/warehousing/automation/article/22957364/nutrient-workflow-automation-the-missing-link-in-supply-chain-efficiency The complete guide to digital signatures: PAdES, CAdES, and XAdES explained Nutrient Python SDK: Production-grade document processing for Python Introducing agentic document editing for web applications with AI Assistant Nutrient vs. QuestPDF: Complete comparison for .NET developers How we fixed the GdPicture license expiration (and what to do if you’re affected) Red team security testing with agentic AI The future of healthcare document automation Best healthcare workflow software compared Nutrient SDK product updates for Q4 2025 How Harvey scaled legal document workflows 50 percent MoM without rebuilding infrastructure HIPAA-compliant document management in hospitals How we optimized rendering performance while handling thousands of annotations in React — Part 2 Automated PII removal with Nutrient API Redirecting to: https://www.devopsdigest.com/2026-low-code-no-code-predictions Redirecting to: https://www.kmworld.com/Articles/Editorial/ViewPoints/Leaders-predict-AI-to-continue-permeating-all-aspects-of-KM-in-2026-172594.aspx What are deep agents and how do they solve complex problems? Whipping up document magic: Your easy-bake recipe for Vue and Nutrient Web SDK 🧁 What I’ve learned about product iteration planning while building SDKs Passwordless document signing: Three-layer security guide New zip folder functionality streamlines file management in Document Automation Server The keyboard shortcuts playbook: Taking control of keyboard events in Nutrient Web SDK From experienced engineer to AI beginner: My unexpected journey AI-assisted manual testing: Handling Safari’s PDF rendering and UI quirks How to keep a 20-year-old SDK up to date How we optimized rendering performance while handling thousands of annotations in React — Part 1 Nutrient announces new executive hires to accelerate next phase of growth High performance UI using web workers Automate document conversion at scale with Python and Nutrient DCS From curiosity to PLG (and AI): My journey to understanding product-led growth Prost to progress: One year as Nutrient Pigeon usage at Nutrient: Bridging native SDKs to Flutter Modernizing CI build servers: How to migrate from Chef to Ansible Unix man pages: AI-friendly documentation since 1971 Consistent hashing for even load distribution Best AI redaction APIs: Complete comparison guide for 2025 Why AI document redaction matters for modern security From coding to coordinating: How AI transformed my workflow What is intelligent document processing (IDP)? A complete guide Enterprise PDF SDKs: Best PSPDFKit (now Nutrient) alternatives Nutrient SDK product updates for Q3 2025 GdPicture support best practices Redacting sensitive data with Nutrient AI redaction API How AI is transforming the customer experience at Nutrient: From instant answers to intelligent support
Build a powerful JavaScript document viewer and editor
Hulya Masharipov · 2024-09-10 · via Inside Nutrient

Managing documents within web applications is essential for organizations across various industries, including healthcare, engineering, and finance. This tutorial guides you through setting up a robust JavaScript-based document viewer and editor using the Nutrient Document Authoring SDK. You’ll learn how to handle Microsoft Word (DOCX) files directly in your browser, without the need for external software.

Introducing the Nutrient Document Authoring SDK

Nutrient’s Document Authoring SDK offers a comprehensive solution for building an advanced document viewer and editor within your web application. With a familiar WYSIWYG (what you see is what you get) interface, similar to Google Docs or Microsoft Word, the SDK allows users to open, edit, and export complex documents, maintaining perfect fidelity across browsers and when exported to PDF or DOCX. This makes it an ideal tool for handling documents accurately and efficiently.

Key benefits of using the Document Authoring SDK

Below, we’ve outlined a few key benefits of using the Document Authoring SDK.

A familiar and intuitive editing experience

The SDK provides a page-based layout for rich text editing that resembles the interfaces of popular document editing tools. This familiarity helps users quickly adapt to the editor, enhancing productivity and user satisfaction. With advanced features like complex tables, floating images, headers, footers, and sophisticated numbering, it goes beyond the capabilities of standard text areas and other rich text libraries.

Perfect fidelity and consistency across platforms

One of the standout features of the Document Authoring SDK is its ability to ensure documents look exactly the same across all browsers and when exported in PDF or DOCX formats. This is particularly important for industries that require precision, such as legal, finance, and publishing. The SDK is the only product on the market that guarantees 100 percent WYSIWYG fidelity in PDF exports, streamlining workflows and reducing errors caused by document inconsistencies.

Seamless integration and customization

The SDK is designed with our fully customizable Baseline UI, allowing developers to easily integrate it into any web application and customize it to fit their specific needs. This flexibility ensures that the document viewer and editor align with the overall design and functionality of your platform, providing a consistent user experience.

Getting started with the Document Authoring SDK

In this tutorial, you’ll learn how to set up the Nutrient Document Authoring SDK to create a powerful JavaScript-based document viewer and editor that supports DOCX files. You’ll use Vite(opens in a new tab) as your development environment to ensure a fast and efficient setup.

Step 1 — Creating a new Vite project

First, create a new Vite project. Vite offers a modern development experience with fast project setup:

npm create vite@latest my-document-app

cd my-document-app

Select vanilla for the framework and JavaScript for the variant. This command sets up a new Vite project in the specified directory.

Step 2 — Installing the Nutrient Document Authoring SDK

Next, install the Nutrient Document Authoring SDK, which provides the tools needed to implement the document editor and viewer:

npm install @nutrient-sdk/document-authoring

The SDK leverages WebAssembly (Wasm) to deliver high performance, enabling in-browser document editing without the need for server-side processing.

Step 3 — Integrating the document editor and viewer

To integrate the editor and viewer into your project, follow the steps outlined below.

  1. In index.html, create a <div> element where the editor will be rendered:

<div

id="editor"

style="position: relative; width: 100%; height: 100vh; border: 1px solid #dcdcdc;"

></div>

  1. In main.js, add the following JavaScript code to import the Nutrient library and set up the editor:

import { createDocAuthSystem } from "@nutrient-sdk/document-authoring";

(async () => {

const docAuthSystem = await createDocAuthSystem();

const editor = await docAuthSystem.createEditor(

document.getElementById("editor"),

{

document: await docAuthSystem.createDocumentFromPlaintext("Hello world!"),

},

);

})();

This code initializes the document authoring system, creates an editor instance, and loads a sample document.

Step 4 — Running the Vite development server

Start the Vite development server to view your editor in action:

Open your browser and go to the provided local URL to see the JavaScript document editor and viewer in operation.

Working with DOCX files

The Nutrient Document Authoring SDK supports importing and exporting DOCX files, allowing for seamless document handling.

Importing DOCX files

To load a DOCX file into your editor, use the importDOCX method:

// Assuming the `docAuthSystem` instance is initialized.

const document = await docAuthSystem.importDOCX(await fetch("/document.docx"));

const editor = await docAuthSystem.createEditor(

document.getElementById("editor"),

{ document },

);

This code fetches a DOCX file from the specified URL and loads it into the editor.

To see this in action, you can try out the demo to experience the document loading and editing functionality directly.

Explore Demo

Exporting DOCX files

To export the current document as a DOCX file, use the exportDOCX method:

// Assuming the `editor` instance is initialized.

const currentDoc = editor.currentDocument();

const doc = await currentDoc.exportDOCX();

The exported DOCX file is returned as an ArrayBuffer, which you can then save or use as needed.

Working with PDF files

The Nutrient Document Authoring SDK also supports exporting documents to PDF without additional setup. Use the exportPDF method:

// Assuming the `editor` instance is initialized.

const currentDoc = editor.currentDocument();

const doc = await currentDoc.exportPDF();

This method returns the PDF file as an ArrayBuffer, allowing you to handle it as required.

First-class JSON support with DocJSON

DocJSON is the internal format used by the Nutrient Document Authoring SDK for high portability and integration with modern web technologies. It retains key features of existing formats while being more compatible with JSON-based workflows.

Working with DocJSON in the editor

DocJSON is used when loading and saving documents. It’s designed for easy customization and integration.

Loading DocJSON:

// Assuming the `docAuthSystem` instance is initialized.

const document = await docAuthSystem.loadDocument(

await fetch("./document.json").then((response) => response.json()),

);

const editor = await docAuthSystem.createEditor(

document.getElementById("editor"),

{ document },

);

Saving DocJSON:

// Assuming the `editor` instance is initialized.

const currentDoc = editor.currentDocument();

const docObj = await currentDoc.saveDocument();

console.log("JS object", docObj);

const docJSON = await currentDoc.saveDocumentJSONString();

console.log("JSON string", docJSON);

Here, the document is saved as both a JavaScript object and a JSON string.

Example DocJSON format

Here’s a simple example of a DocJSON document:

{

"type": "https://www.nutrient.io/document-authoring/persistence/container",

"version": 1,

"container": {

"document": {

"body": {

"sections": [

{

"elements": [

{

"type": "p",

"elements": [

{

"type": "r",

"text": "Hello world!"

}

]

}

]

}

]

}

}

}

}

The example illustrates the basic structure of a DocJSON document. This JSON format is designed to represent documents in a straightforward manner, with formatting styles and page setups being optional and defaulting to standard settings if not specified.

In this example, the JSON format is version 1 and organizes documents as a body containing sections. Each section includes various elements, which can be of different types and include inline content.

Specifically, this document consists of a single paragraph with one text run displaying “Hello world!”. Unlike HTML, where elements can be nested, DocJSON represents inline elements like text runs as a flat sequence.

Conclusion

Setting up a JavaScript-based DOCX editor and viewer with the Nutrient Document Authoring SDK and Vite is efficient and effective. This solution enables seamless handling of DOCX files directly in the browser, eliminating the need for external tools.

The SDK supports DocJSON for easy integration and customization, making it a versatile choice for web development needs.

To explore more features or discuss how the SDK can fit your specific requirements, contact our Sales team for further assistance. Try the demo(opens in a new tab) to see the SDK in action and get started with your document editing and viewing solution today!

FAQ

The Nutrient Document Authoring SDK is a comprehensive toolkit for building a document viewer and editor directly within web applications. It offers a WYSIWYG (what you see is what you get) interface, similar to popular tools like Google Docs and Microsoft Word, allowing users to open, edit, and export DOCX documents with perfect fidelity. Key features include support for complex tables, floating images, headers, footers, sophisticated numbering, and 100 percent accurate PDF exports.

The SDK guarantees perfect fidelity by rendering documents exactly the same way across all browsers and when exporting to DOCX or PDF. It uses advanced rendering algorithms and internal document representations to maintain accurate formatting, layout, and styles, ensuring the exported documents look identical to their in-browser versions.

The SDK supports importing DOCX files and exporting documents in both DOCX and PDF formats. This makes it versatile for various use cases where you need to handle DOCX input and PDF output.

DocJSON is the internal format used by the Nutrient Document Authoring SDK for document editing and storage. It offers high portability and is designed for easy integration with modern web technologies. DocJSON retains key features of traditional document formats while allowing seamless integration with JSON-based workflows.