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

It takes too long time from clicking OK button on alert message box to the alert closed.

Explorer ,
Mar 11, 2021 Mar 11, 2021

Copy link to clipboard

Copied

I have a javascript to search text on PDF and then highlight it.

When it works over, an alert message box will be shown that it is over.
My script works well on Acrobat XI, but on Acrobat DC, when clicking the OK button on the alert message box,
Acrobat DC will be falled into a state of not responding,
and this state lasts for about 10 minutes and then the alert message box is closed.
In my script code, no code is executed after the app.alert().

 

The 10 minutes is too long, what should I check about this?
My PDF file is created from some html files using "Get entire site" setting,

and there are some kangxi radicals in it.
Could these character be affecting the problem?

 

Thanks.

TOPICS
Acrobat SDK and JavaScript , Windows

Views

422

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 ,
Mar 11, 2021 Mar 11, 2021

Copy link to clipboard

Copied

10 minutes is too long? 10 seconds is too long! The alert should close the moment you press the button...

Can you share the file, or code, with us?

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
Explorer ,
Mar 12, 2021 Mar 12, 2021

Copy link to clipboard

Copied

Sorry I can't show you the full code and create the sample file right away.
I wrote a simple code that only output the text on each page.
It took about 2 minutes.

//----------------------------------------------------
app.addMenuItem({ cName: "Test", cParent: "Edit",
	cExec: "process();",
	cEnable: "event.rc = (event.target != null);"
});

trustedActiveDocs = app.trustedFunction(function ()
                                        {
                                            app.beginPriv();
                                            var d = app.activeDocs;
                                            app.endPriv();
                                            return d;
                                        }
                                       )

function process()
{
	var d, i;
	
	d = trustedActiveDocs() ;
	if(d.length < 1)
	{
		return 0;
	}

	for (i=0; i < d.length; i++)
	{
		GetPageTextOnEachDoc(d[i]);
	}
	
	app.alert({nIcon:3, cTitle:"TEST", cMsg:"Done"});
}

//----------------------------------------------------
function GetPageTextOnEachDoc(acd)
{
	var PageNum, WdCnt;
	var i, j;
	var wd;
	var pageText;
	

	console.println("--------------------------------------");
	console.println("File Name = " + acd.documentFileName);
	console.println("--------------------------------------");

	PageNum = acd.numPages;
	for (i=0; i<PageNum; i++)
	{
		WdCnt = acd.getPageNumWords(i);
		pageText = "";
		
		if (WdCnt > 0)
		{
		    for (j=0; j<WdCnt; j++)
		    {
			    wd = acd.getPageNthWord(i, j, false);    			
			    pageText = pageText.concat(wd);
		    }
			console.println("Page " + i + " text = " + pageText);
			console.println("--------------------------------------");
		}	
	}		
}

I am sorry that there was a mistake in what I wrote.
The followings are what I have known now.

 

1. I have written that it takes 10 minutes clicking OK button on alert message box to the alert closed.
But, after the alert message box is shown, and after a short time,
Acribat falls into the state of not responding without clicking the OK button.
When the state of not responding is over, if I click the OK button, the alert message box closed soon.

 

2. The html file I used is a html file that there are 60 links to other html files in it.
This phenomenon can only be seen with the PDF file created from the html file using "Get entire site" setting at the moment.
If not using the "Get entire site" setting, the script works OK.

 

3. If I write the code in the console of javascript debugger and execute from the console, it works OK.

 

4. Kangxi radicals were irrelevant. This phenomenon occurs without this.

 

So... I think useing the "Get entire site" setting to create PDF is affecting.
Acrobat DC are doing something in the background??

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
Explorer ,
Mar 12, 2021 Mar 12, 2021

Copy link to clipboard

Copied

If I delete the links from the html file and make only 3 or 4 links in it, the script works OK.

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
Community Expert ,
Mar 12, 2021 Mar 12, 2021

Copy link to clipboard

Copied

Are you counting the time from the moment you click the Test menu item to the moment the Done message appears, or from the moment you click OK in that message to the moment the application completes the process? If the former, that's not ideal, but it's also not out of the question, as processing files in this way is a very complex process, especially if you're doing other things in the middle like adding links to them. It would depend a lot on how many files there are, and how much text there is in each one.

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
Explorer ,
Mar 14, 2021 Mar 14, 2021

Copy link to clipboard

Copied

LATEST

It donn't take long time from clicking [Test] menu to the moment the Done message appears.
This message was displayed immediately.
It's been taking long time since the message was displayed.

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