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

DocAuthDocumentInput

DocAuthDocumentInput = string | object | Blob | Response | Promise<string | object | Blob | Response>

A string will be treated as a document authoring document in JSON format and loaded. An object will be treated as a JavaScript representation of a Document Authoring document (e.g. the result of JSON.parse on a Document Authoring JSON string).

// Load from JSON
const docString = '{"version":"7.0","content":[...]}';
const docFromString = await system.loadDocument(docString);
// Load from a JavaScript object
const docObject = { version: '7.0', content: [...] };
const docFromObject = await system.loadDocument(docObject);
// Load from a Blob (e.g. from a file input)
const fileInput = document.querySelector('input[type="file"]');
const blob = fileInput.files[0];
const docFromBlob = await system.loadDocument(blob);
// Load from a fetch Response
const response = await fetch('/api/document.json');
const docFromResponse = await system.loadDocument(response);
// Load from a Promise (fetch is automatically awaited)
const docFromPromise = await system.loadDocument(fetch('/api/document.json'));
// Load from a Promise that resolves to a Blob
const blobPromise = fetch('/api/document.json').then((r) => r.blob());
const docFromBlobPromise = await system.loadDocument(blobPromise);