`import { DocumentEditor } from "@onlyoffice/document-editor-react";
import React from "react";
function DocumentViewer() {
const onDocumentReady = () => {
console.log("Document is ready to view");
};
const onLoadComponentError = function (errorCode, errorDescription) {
switch (errorCode) {
case -1: // Unknown error loading component
console.log(errorDescription);
break;
case -2: // Error load DocsAPI from http://documentserver/
console.log(errorDescription);
break;
case -3: // DocsAPI is not defined
console.log(errorDescription);
break;
}
};
debugger;
return (
<>
<DocumentEditor
id="docxEditor"
documentServerUrl="http://confidential.com/example/"
config={{
document: {
fileType: "pdf",
key: "my_only_office_jwt_secret",
title:
"Screenshot and Functionalities od e-Tappal and e-File(SRS).pdf",
url: "http://122.176.109.190:8080/server/api/core/bitstreams/10e76505-5ebb-4812-933d-36ddf82798b0/content",
},
documentType: "word",
editorConfig: {
callbackUrl: "http://localhost:3000/",
},
}}
events_onDocumentReady={onDocumentReady}
onLoadComponentError={onLoadComponentError}
/>
</>
);
}
export default DocumentViewer;
`
You need to define the link to your document server installed without '/example' part at the end. The '/example' is the example service of the Document Server which exists merely to check the operation of the Document Server and it shouldn't be used here. Thus, if you have your Document Server available at
https://documentserver.com- this is the address you need to define indocumentServerUrlas per this reference.