Print Page | Close Window

Weird AcroJS problem!

Printed From: Foxit's Planet PDF Forum
Category: Lets Talk PDF
Forum Name: JavaScript
Forum Description: Discussions relating to the use of JavaScript within PDF.
URL: http://forums.planetpdf.com/forum_posts.asp?TID=878
Printed Date: 16 Sep 2019 at 11:33pm
Software Version: Web Wiz Forums 11.10 - http://www.webwizforums.com


Topic: Weird AcroJS problem!
Posted By: hadesp
Subject: Weird AcroJS problem!
Date Posted: 30 Jun 2013 at 3:32am

Hi Guys!

 

I made this simple spell check script last week so that I could spell check some documents properly but while tinkering with it yesterday, I accidently introduced an error in it. Now, whenever I execute it, the thermometer shows up but does not progress. If I press the button again, the thermometer starts progressing and the script executes but then the thermometer does not close. It was working perfectly earlier and I cannot locate the source of this error. The code is almost the same as before to my eyes. I've been trying for hours to fix this issue but without success. The code is as below:

 

---------------------------------------------------------------

app.addToolButton({cName: "Spell Check", cExec: "spellcheck();", cTooltext: "Spell Check", nPos: 0 });

function spellcheck()

var numWords, ckWord;

var t = app.thermometer;

t.duration = this.numPages;

t.begin();

        for (var i = 0; i < this.numPages; i++ )

        { 

            numWords = this.getPageNumWords(i);

            t.value = i;

            t.text = "Processing page " + (i+1) + " of " + (this.numPages);   

            for (var j = 0; j < numWords; j++)

            {

                ckWord = spell.checkWord(this.getPageNthWord(i,j));

                    if (ckWord != null)

                        { this.addAnnot({ page: i, type: "Squiggly", quads: this.getPageNthWordQuads(i,j), author: "script", contents: this.getPageNthWord(i,j) + ": " + ckWord.toString() });}   

            }   

                if (t.cancelled){ break;}

        }

t.end();

  app.alert ("Spell check done.",3);

--------------------------------------------------------------

 

I really need to make it work properly again. Any help would be much appreciated!

 

I also needed to know as to how do I force the use of a specific dictionary for this spell check. It currently uses all the available dictionaries even when I am passing a subset of spell.dictionaryNames to the spell.checkWord method. The acrobat object reference guide mentions that we also have the following dictionaries available in acrobat :

 

English USA Medical

English USA Legal

English USA Sci/Tech

English USA Geo/Bio

 

Could any one point me as to where to find these dictionaries as they are not installed in the default package.Only English USA is there.

 

I am using Acrobat 9 pro and X pro.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.10 - http://www.webwizforums.com
Copyright ©2001-2017 Web Wiz Ltd. - https://www.webwiz.net