Javascript command to find setences spread over multiple lines

Forum for the PDF-XChange Editor - Free and Licensed Versions

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

Vinny
User
Posts: 7
Joined: Wed Sep 25, 2024 11:23 am

Javascript command to find setences spread over multiple lines

Post by Vinny »

Hi,

I am currently using the search functions using javascript commands to find sentences accros lenghy documents.

Originaly I was looking only for one sentence only

The script looks like this:
search.query("my search","ActiveDoc")


then I found out that I could enter multiple sentences to search using the advanced search criteria:

The script looks like this:

search.wordMatching = "MatchAnyWord";
search.query("\"my first search\" \"my second search\" \"my third search\"","ActiveDoc");


The second one is a better option for me since for the tasks I have to do (research on law documents).

However I face a problem withg the second script which I didn't have with the first: if the sentence I am looking for is spread over several lines the "simple" search query will find it but not the advanced search.
image.png
Am I missing anything?

Thank you.
Vincent
You do not have the required permissions to view the files attached to this post.
User avatar
Paul - PDF-XChange
Site Admin
Posts: 7361
Joined: Wed Mar 25, 2009 10:37 pm

Re: Javascript command to find setences spread over multiple lines

Post by Paul - PDF-XChange »

Hi, Vinny

I am not the one to answer your JavaScript question, but I do ask if the "Advanced Search" that we offer is failing you that yo need to write a script for this?

One should be able to search for "this exact phrase"
image(1).png
image.png
You do not have the required permissions to view the files attached to this post.
Best regards

Paul O'Rorke
PDF-XChange Support
http://www.pdf-xchange.com
Vinny
User
Posts: 7
Joined: Wed Sep 25, 2024 11:23 am

Re: Javascript command to find setences spread over multiple lines

Post by Vinny »

Hi Paul,

Thanks for the reply. The advance search tool and the script is great for me and I will explain into more detail how I use it:

I am using the import bookmark function to find the data that I am looking for. For each bookmark, there will be a different data point I will be searching.

Bookmark 1: Data search 1
Bookmark 2: Data search 2
Bookmark 3: Data search 3

Etc...

Since on my day to day job I will have to go through different papers (all month) but always looking for the same data. So what I want is that every time I open a new document, I import the bookmarks with the data search linked to them if that make sense.

However in all the documents, they label the data points differently.

So the advanced search script comes in handy because it allows me to enter multiple possible sentences to find the data rapidely.
omg.png
I am not expert in Java or with PDF XChange but I can get around the fact that if the sentence is not on the same line it won't be recognised. I tried to play around with the proximity setting without success.

Ence my question to see if there was a script that would help me get around this?


Edit
Am I posting in the wrong forum space? should I go in the develloper section?
You do not have the required permissions to view the files attached to this post.
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 11046
Joined: Wed Jan 03, 2018 6:52 pm

Re: Javascript command to find setences spread over multiple lines

Post by Daniel - PDF-XChange »

Hello, Vinny

Thank you for the explanation, I can see the use case there a bit better now.

There is also no need to worry, you have posted in the correct area, its just that JavaScript is not a strong suit of anyone on our support team, so while some of us can help with basic troubleshooting some scripts, we do not offer services to create new ones, and cannot do much for complex actions.
If you are lucky, one of the other users here (who are more experienced with JS than we are) will see this thread, possibly be interested by the prospect of it, and pop in with a script they are happy with, or offer some advice. Most of what we offer is trying to find out if your script could be accomplished by another feature we already offer through the UI, bypassing the JS side of things entirely.

I wish we could offer more, but At the moment the best resource I can present for self learning is a link to the JS API reference for PDF: https://opensource.adobe.com/dc-acrobat ... croJS.html

Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com