Solved

Search and Bookmark Javascript for Acrobat

Posted on 2009-07-15
3
456 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
3 Comments
 
LVL 15

Accepted Solution

by:
mohan_sekar earned 125 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Inserting page numbers in Portable Document Files not only enhances manageability but also makes them look professional. With numbered pages, the file appears more organized and it becomes easier to search for a particular page. The size and the vol…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
We often encounter PDF files that are pure images, that is, they do not have text characters, but instead contain only raster graphics. The most common causes of this are document scanning software and faxing software/services that create image-only…

776 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