PDF.js Express Version
“6.3.3” Evaluation
Detailed description of issue
I am trying to work with text selection on pdf’s and I want to see if pdf.js express is a good fit for my project. To be more exact, I am trying to set a selection on a texteditor (either input or an annotation) to select a specific word, replace it and/or move the selection to a new word.
For the input[type=text] part I tried to get the html by using
this.instance.docViewer.on('documentLoaded', () => {
this.instance.docViewer.getAnnotationsLoadedPromise().then(() => {
// setTimeout here
this.instance.annotManager
.getFieldManager()
.forEachField((fields) => {
fields.widgets.forEach((field) => {
if (field.element.type === 'input') {
...
but I found that some times it comes back as null, other times it comes back as the div that encloses the input, etc. Adding a setTimeout seems to fix this and it’s a bit more reliable, but I wanted to ask here if there is a proper
way to achieve this.
In short I need to get access to the html input element (or textarea) so I can manipulate the selections with getSelection()
and ranges
.
Another issue that I couldn’t get around is how do I get access to the texteditor in the textTool annotation tool?
Any support would be apreciated.