Solved

Search and Bookmark Javascript for Acrobat

Posted on 2009-07-15
3
448 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Power PDF (http://www.nuance.com/for-business/document-imaging-and-scanning/power-pdf-converter/index.htm) is the newest product from the Document Imaging division of Nuance Communications (http://www.nuance.com/). It is available in two editions — …
In a previous article published here at Experts Exchange, Signature Image with Transparent Background (http://www.experts-exchange.com/Web_Development/Document_Imaging/A_12380-Signature-Image-with-Transparent-Background.html), I explained how to cre…
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

759 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now