Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Search and Bookmark Javascript for Acrobat

Posted on 2009-07-15
3
Medium Priority
?
463 Views
Last Modified: 2012-08-13
I need a Javascript to wok in Acrobat that will search through a searchable pdf documents for specific phrases and create a bookmark with the phrases name when if finds them.

This is a static lists of phrases eg. "PATIENT PROFILE", "COLONOSCOPY" ...

I will need to do this in a folder of approximately 1200 documents.
0
Comment
Question by:scsoil
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 15

Accepted Solution

by:
mohan_sekar earned 500 total points
ID: 24859644
If you want to search PDF documents for phrases in a folder and create bookmarks, you got to use some PDF library like iText. Visit http://www.lowagie.com/iText/ for more info
0
 
LVL 1

Expert Comment

by:ForLoop5
ID: 37745487
I was able to do this with just java script.  I also create a new file for each page and give it the name of my bookmark.


var root = this.bookmarkRoot;
var RegularExpression  =  new RegExp(/\n|\r|\t|\s/);

for (var i = 0; i < this.numPages; i++)
    {
        numWords = this.getPageNumWords(i);
        var PageText = "";
            var FoundSASID = 0;
       
            for (var j = 0; j < numWords; j++) {
            var word = this.getPageNthWord(i,j,false);
                  PageText += word;

                  var strMatches = PageText.match('SASID:');
              if (strMatches != null) {
                        // Found text SASID: So reset the PageText to nothing and set the FOundSASID to 1
                        FoundSASID = 1;
                        PageText = "";
                        }

                  var newWord = PageText.match(RegularExpression);
                  var foundSpace = PageText.match(' ');
                  if (newWord != null || foundSpace != null) {
                        if (FoundSASID==1) {                                                                          
                          this.extractPages({nStart:i, cPath: PageText + ".pdf"});
                              root.createChild(PageText,"this.pageNum=" + i, i);
                                     
                              FoundSASID = 0;
                        }
                        if (FoundSASID==0) {
                              PageText = "";
                        }

                        }
            }
    }
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Adobe PDF proprietary file format is recognized as secure and formulated. But these PDF files are also prone to corruption and any external threat like virus attacks, improper storage can hit PDF file integrity.This type of damages can make cruc…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question