Is there a way to use PSPDFKit APIs to inject text into an existing annotation?

149 Views Asked by At

Could a Chrome Extension add a script to an existing annotation created by PSPDFKit in order to add a string to an existing annotation instance/bubble?

PSPDFKit APIs are here: https://pspdfkit.com/guides/web/samples/javascript-pdf-annotations/

Example annotation / uploaded doc is here: https://pspdfkit.com/demo/hello

Here's a visual on where the Chrome Extension would ideally place text: enter image description here

TinyMCE and other advanced editors can be reached (see example below) but this one is more obscure. Any ideas or direction from the Extension gurus?

Example TinyMCE:

var script = document.createElement('script');
script.textContent = "console.log('AP talks to tinyMCE1...'); tinymce.activeEditor.execCommand('mceInsertContent', false, " + JSON.stringify(request.sValue) + ");tinymce.activeEditor.execCommand('mceInsertContent', false, ' - just more.')";
(document.head||document.documentElement).appendChild(script);
script.remove();
0

There are 0 best solutions below