Text selection issue with highlight, underline and strikeout

164 views
Skip to first unread message

Richard Dupont

unread,
Jan 28, 2015, 11:33:40 AM1/28/15
to pdfnet-w...@googlegroups.com
Hello,

I'm having some issue with the way the text is selected with the text oriented tools.

I've used the webviewer showcase to replicate it


When you try to select a complete row the selection go to the bottom of the page and back up to continue the selection.

In this screen shot the step are :

Highlight row 1

Underline row 2

Strike out row 5

Is there a way to fix it from the XOD file or it's in the webviewer control.

Thanks.

Richard
TextSelection.png

Matt Parizeau

unread,
Jan 28, 2015, 7:05:21 PM1/28/15
to pdfnet-w...@googlegroups.com
Hi Richard,

The selection is handled based on our best reconstruction of the structure of the document.

If you'd like to use rectangular text selection instead then you can put the following code in a config file:
Tools.TextTool.SELECTION_MODE = 'rectangular';

To switch back to the default mode you would set:
Tools.TextTool.SELECTION_MODE = 'structural';

Depending on how you want to do it, it might make sense to have a button in the UI that allows switching between the two selection modes. The property will apply to all text based tools.

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Devanshi Bhagat

unread,
Oct 14, 2016, 2:50:01 PM10/14/16
to PDFTron WebViewer
Hi Matt,

I am using 
Tools.TextTool.SELECTION_MODE = 'rectangular';

for Text selection.
And now I want the coordinates of the rectangle selected. How could I get that?

Previously when I was using 
Tools.TextTool.SELECTION_MODE = 'structural';
I used textSelected event to get the quad list.
But for rectangular what should I do?

Thanks,
Devanshi Bhagat

Matt Parizeau

unread,
Oct 19, 2016, 1:49:48 PM10/19/16
to PDFTron WebViewer
Hi Devanshi,

When using either rectangular or structural I am able to get the quads from the textSelected event. Are you not seeing them?

Here is the code I tested with:
Tools.TextTool.SELECTION_MODE = 'rectangular';

$
(document).on('documentLoaded', function() {
 
var docViewer = readerControl.docViewer;
  docViewer
.on('textSelected', function(e, quads) {
    console
.log(quads);
 
});
});

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Devanshi Bhagat

unread,
Oct 21, 2016, 1:19:11 PM10/21/16
to PDFTron WebViewer
Hi Matt,

I get the quads list, but the point is I want the top Left and bottom right coordinates of the selection.
Quad list works properly if I select any text from Top to Bottom, but if you select the text from Bottom to Top then the quads list that you get from this method is not useful.

My main purpose of all this is to get the selected text when rectangular mode is selected. 

Tools.TextTool['SELECTION_MODE'] = 'rectangular';


But the problem is once the text is selected using rectangle, and I get that text using 
var selectedText = readerControl.docViewer.getSelectedText();

I get whole selected text without any space or new line character.









And when I do the same thing using 
Tools.TextTool.SELECTION_MODE = 'structural';

It returns me: 

Could you please suggest me solution for this, how to get selected text with proper space and new line characters for rectangular selection?

Matt Parizeau

unread,
Nov 1, 2016, 7:50:35 PM11/1/16
to PDFTron WebViewer
Hi Devanshi,

Please try this build which should fix the issue: http://www.pdftron.com/ID-zJWLuhTffd3c/WebViewer/WebViewer_2.2.1.51449.zip

Matt Parizeau
Software Developer
PDFTron Systems Inc.
Reply all
Reply to author
Forward
0 new messages