I studied the documentation up and down, but what is described there does not work in my project
I want to make an automatic replacement of text in a PDF file, for this I tried to follow the documentation, this is what I got
export const OnlyOffice = () => {
const config = ...
function onDocumentReady(event: any) {
console.log("Document is loaded");
const documentEditor = window.DocEditor.instances["pdfEditor2"]
const connector = documentEditor.createConnector();
console.log(window?.Asc?.plugin) // undefined
console.log(connector?.executeMethod("GetCurrentWord")); // undefined
connector?.executeMethod("ShowError", ["test", 0], (r: any) => {
console.log(r); // not executed
});
connector?.executeMethod("GetCurrentWord", [], (word: any) => {
console.log(`[METHOD] GetCurrentWord: ${word}`) // not executed
});
connector?.executeMethod("GetDocument", [], (returnValue: any) => {
console.log(returnValue) // not executed
});
window?.Asc?.plugin.executeMethod("ShowError", ["test", 0], (r: any) => {
console.log(r); // not executed
});
}
return (
<div className={styles.wrapper}>
<DocumentEditor
id="pdfEditor2"
documentServerUrl="..."
config={config}
events_onDocumentReady={onDocumentReady}
/>
</div>
)
}
The result is that all the methods from the documentation are undefined and are not called, the question is, what should I do to get access to the API methods?
In particular, I want to repeat this example from the documentation, thanks in advance