cancel
Showing results for 
Search instead for 
Did you mean: 

Scripting for Table of Contents

Former Member
0 Kudos

Hello

I need to create a table of content on a separate body page. This TOC shows the page numbers of materials listed in the document. The document has its own body page.

Since I have to use Designer 7.0 I have created the following script in the layout:ready event of the following material field of the catalog page:

ZMAT_KATALOG.Catalog.IT_KATALOG.DATA.Table1.Row1.MATNR::ready:layout

function SetPageNum(pMatNr,pPageNum) {

// get all recurring DATA nodes of TOC

var aData[] = xfa.resolveNodes

("xfa.form.ZMAT_KATALOG.TableOfContent.IT_MAT4TOC.DATA");

for ( i=0; i < aData.length; i++ ) {
//set page number if material number matches the TOC line
if ( aData.Table1.Row1.MATNR.rawValue == pMatNr ) {
aData
.Table1.Row1.PagNum.rawValue = pPageNum;
}
}
}

try {
//copy page number of current material to TOC
var vPageNum = xfa.layout.page(this);
var vMatNr = this.rawValue;
SetPageNum( vMatNr, vPageNum );
} catch (e) {

}

ZMAT_KATALOG -> form
TableOfContent -> body page of TOC
Catalog -> body page of document

Could anybody evaluate my script and give me a hint what might be wrong? Thanks in advance.

René Morel

Accepted Solutions (1)

Accepted Solutions (1)

nol_hendrikx
Active Contributor
0 Kudos

Hi Rene,

1) Does xfa.resolveNodes

("xfa.form.ZMAT_KATALOG.TableOfContent.IT_MAT4TOC.DATA"); resolve?

2) maybe you can add a alert box in your script to debug your code.

3) you can also use the debugger.

4) in your catch block, also add an alert box to see if the script runs there as well.

cheers,

Noë

Answers (3)

Answers (3)

Former Member
0 Kudos

Rane,

Can you pls tell me how did you solve your problem..It will be helpful for me..i have same issue.

BM

Former Member
0 Kudos

Hi Rene,

JavaScript debugger is integrated into Acrobat Professional. Procedure is described on the page 68 http://www.adobe.com/devnet/livecycle/articles/lc_designer_scripting_basics/lc_designer_scripting_ba...

You can use debugger with Adobe Reader but it isn't such easy. Page 45 in

http://partners.adobe.com/public/developer/en/acrobat/sdk/pdf/javascript/AcroJSGuide.pdf

You will need debugger.js : http://partners.adobe.com/public/developer/en/pdf/debugger.js

Debugger doesn't use ADS.

In your code, you can use command: debugger;

and command: console.println("YOUR MESSAGE");

Michal

Former Member
0 Kudos

Hi Noel

Thank you for responding. I tried the alert message before but didn't obtain any result. I' going to try again tomorrow.

Do you think that my script is syntactically correct?

How can I invoke the Debugger in ALD 7.0?

Can I use it in the preview modus (with sample XML data) or only in conjunction with ADS?

Regards

René