• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

search/query function passes back page number, automatically set bookmarks

New Here ,
Apr 02, 2016 Apr 02, 2016

Copy link to clipboard

Copied

Dear all,

I have got three questions concerning the implementation of a java script.

1) Is there a function in JavaScript that passes back the page numbers where the search tag has been matched in the document? The result should be an array that can be used in a for-loop, not a search result by the Acorbat application.

2) Is there a function that automatically (without an input by the user) generates bookmarks on certain pages (using a for-loop through the array, question no. 1)?

3) Is there a function that deletes certain pages (identified by the array) after the bookmarks being generated?

Thank you for your help.

Best regards

Ralf

TOPICS
Acrobat SDK and JavaScript , Windows

Views

277

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 02, 2016 Apr 02, 2016

Copy link to clipboard

Copied

LATEST

You can do all of it, but you'll need to write the code for it, of course. You can't use the search object for it, though, as it doesn't return any values.

The way to so it is to use the getPageNthWord method in combination with the getPageNumWords method. Using these two methods you can write a loop that iterates over all the pages in the file, and then another loop that iterates over all the words in each page. Doing so will allow you to know on which page(s) a match was found on your search term and you could then do what you want with that information (export it, delete the pages, etc.).

However, it is important to keep in mind that this method is much slower than the built-in query command and might cause the application to stall or even freeze entirely if used on a large file with a lot of words in it, so it's important to write your code as efficiently as possible when performing this kind of task.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines