DeselectAll seems not work if selected by code!

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

Dorwol
User
Posts: 275
Joined: Mon Aug 04, 2008 5:04 pm

DeselectAll seems not work if selected by code!

Post by Dorwol »

Hi,

I'm not shure, but it looks like a bug.

If I select some text by code, it is not possible to call "DeselectAll".

The 2nd question is, how can I select a range of text (e.g. Char 200 - 220) without to know the page No?

...PLEASE see my attachment for a better understanding!
You do not have the required permissions to view the files attached to this post.
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: DeselectAll seems not work if selected by code!

Post by Corwin - Tracker Sup »

If I select some text by code, it is not possible to call "DeselectAll".
I'm afraid that this is really bug. Anyway it will be fixed in new build.
how can I select a range of text (e.g. Char 200 - 220) without to know the page No?
You can try to count characters on the document pages to get information which page content specific range. For example please look at the attached sample. But for what exactly do you need such functionality?
You do not have the required permissions to view the files attached to this post.
Dorwol
User
Posts: 275
Joined: Mon Aug 04, 2008 5:04 pm

Re: DeselectAll seems not work if selected by code!

Post by Dorwol »

Thank you. The same way I was already try out. But it is a little bit slowly, if they are PDF's with realy much pages.
Corwin wrote:
But for what exactly do you need such functionality?
It is for some protocol. On First step all Text will grab from pdf (with Command "GetAllText") to database. Later, the user searches this "extracted" text - and not the pdf. If he has a hit, the pdf will loaded and showing. But now I have this problem. Because I know the word-position, but I dont know the page-no.

But there is another problem:

If I grab all Text with Command "GetAllText". It will give me the complete text incl. all "carriage returns" (vbCrLf). That's realy good - perfect! But if I'want now select some text in the pdf, the textpositions are different - because the viewer seems dont count carriage returns. :(

For Example:

Content of my PDF is:

"This is Line1
This is Line2"

...the (absolute correct) Result of "GetAllText" is now:
This is Line1<CR>This is Line2
= 27 Chars! (because incl. <CR>!)

...if I want to select now the word "Line2", the correct startposition is 23. But not realy in the viewer-control! The Viewer will start on position 22 - because the viewer will "see the text without CR's", like this: "This is Line1This is Line2"

Hope U and the Tracker-team will understand my bad english! ;-)
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2449
Joined: Thu Jun 30, 2005 4:11 pm

Re: DeselectAll seems not work if selected by code!

Post by Vasyl - PDF-XChange »

For this case you should setup for GetAllText the second argument to 1(true, means exclude CR/LF symbols from output text, default value is 0), please look 75 page of AX help.
The more PDF's do not contains these symbols(CR/LF) in content, i.e. object ..Pages::<Item>.Text.Chars represents original characters set from PDF, but GetAllText function adds CR/LF automatically into output text (by default, optional).
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Dorwol
User
Posts: 275
Joined: Mon Aug 04, 2008 5:04 pm

Re: DeselectAll seems not work if selected by code!

Post by Dorwol »

Thank you, but can/do you fix the DeselectAll-Bug please? OR Do I anything wrong?
BTW - There are more problems, if seleted text by code:

e.g. The command "GetSelectionState" or "GetAllSelectedText" will also not works...

Please try this to see what I mean:

vDataIn(0) = 2: vDataIn(1) = 5: vDataIn(2) = 0 ' Select some text...
DoVerb "Documents[0].Pages[0].Text", "Select", vDataIn, Nothing ' ...on first page.

DoVerb "Documents[0]", "GetSelectionState", Nothing, vDataOut1, 0 ' Check SelectionState-Status
DoVerb "Documents[0]", "GetAllSelectedText", Nothing, vDataOut2, 0 ' Get Selected Text

MsgBox vDataOut1, "SelectionState" ' ...and U'll see it does not work! :(
MsgBox vDataOut2, "SelectedText"
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: DeselectAll seems not work if selected by code!

Post by Corwin - Tracker Sup »

But it is a little bit slowly, if they are PDF's with realy much pages.
The first way to improve performance is to extract text from PDF by pages, and mark from which page text was extracted. This information can be used when you want to highlight needed offset on some page.
The second way is to create additional file with information about characters count on every page of PDF document. Note: getting characters count on some page is much more faster right after document (or page) text extraction.
For VB6 examples please look at the attached sample.
You do not have the required permissions to view the files attached to this post.
Dorwol
User
Posts: 275
Joined: Mon Aug 04, 2008 5:04 pm

Re: DeselectAll seems not work if selected by code!

Post by Dorwol »

Thx Corwin, meanwhile it works for me with a little Array.

Thank you VERY MUCH - and I like this control more and more... :)
User avatar
John - Tracker Supp
Site Admin
Posts: 5223
Joined: Tue Jun 29, 2004 10:34 am

Re: DeselectAll seems not work if selected by code!

Post by John - Tracker Supp »

Pleasure :)
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com