Planet PDF Forum Archive

Planet PDF ForumWowsers! This is page is old, head to the LIVE Planet PDF Forum. It features more than 10 conferences, covering everything from beginner to in-depth developer and pre-press discussions. If you wish to continue... one & two archive covers 1999-2011 (160,000 pages).


New Forum | Previous | Next | (P-PDF) Beginners


Topic: JavaScript and templates
Conf: (P-PDF) Beginners, Msg: 93779
From: l323jeff
Date: 8/6/2003 09:56 AM

This is probably pretty simple for the experts, but I'm stuck. I'm using Acrobat 6 Pro and utilizing templates to spawn buttons and text onto a main page where they made visible (or hidden) when the users chooses different selections from a pop up menu. The following script is from a button that is hidden from user that I use for adding or modifying buttons that exist on templates.

var a = app.popUpMenu("Show TMPL Buttons", "Hide TMPL Buttons", "Show TMPL Text", "Hide TMPL Text", "Show Templates", "Hide Templates", "Insert Pages", "Spawn");

var page2Template = this.getTemplate("USPS HM");
var page3Template = this.getTemplate("NAT DOCS");
var page4Template = this.getTemplate("GRV FORMS");


if (a=="Show TMPL Buttons") {
this.getField("Button").hidden=false;

}

else if (a=="Hide TMPL Buttons") {
this.getField("Button").hidden=true;
this.getField("Button.1").hidden=false;

}

else if (a=="Show TMPL Text") {
this.getField("Text").hidden=false;

}

else if (a=="Hide TMPL Text") {
this.getField("Text").hidden=true;

}

else if (a=="Insert Pages") {
app.execMenuItem("InsertPages");

}

else if (a=="Show Templates") {
page2Template.hidden=false;
page3Template.hidden=false;
page4Template.hidden=false;

}

else if (a=="Hide Templates") {
page2Template.hidden=true;
page3Template.hidden=true;
page4Template.hidden=true;

}

else if (a=="Spawn") {
if (this.numPages == 1) {
page2Template.spawn(0, false, true);
page3Template.spawn(0, false, true);
page4Template.spawn(0, false, true);

}
}

You can probably tell which books I've read from the script and the script does work fine. Actually, I've shortened the script for the purpose of posting it and the document really contains 21 templates (so far). What I'm trying to do is manipulate the templates using the this.templates method. My attempt so far looks like this:


var a = app.popUpMenu("Show TMPL Buttons", "Hide TMPL Buttons", "Show TMPL Text", "Hide TMPL Text", "Show Templates", "Hide Templates", "Insert Pages", "Spawn");

var t = this.templates;


if (a=="Show TMPL Buttons") {
this.getField("Button").hidden=false;

}

else if (a=="Hide TMPL Buttons") {
this.getField("Button").hidden=true;
this.getField("Button.1").hidden=false;

}

else if (a=="Show TMPL Text") {
this.getField("Text").hidden=false;

}

else if (a=="Hide TMPL Text") {
this.getField("Text").hidden=true;

}

else if (a=="Insert Pages") {
app.execMenuItem("InsertPages");

}

else if (a=="Show Templates") {
t.hidden=false;


}

else if (a=="Hide Templates") {
t.hidden=true;


}

else if (a=="Spawn") {
if (this.numPages == 1) {
t.spawn(0, false, true);


}
}

Problem is that it doesn't work. I've read everything I can find on templates, but can't figure this one out (I don't want to embarass myself by saying how many days I've been working on this). Any suggestions would be greatly appreciated.


PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link...

Download free demo

Debenu PDF Tools Pro

It's simple to use and will let you preview and edit PDF files, it's a Windows application that makes...

Download free demo

Back to the past, 15 years ago! Open Publish 2002

Looking back to 2002, it's amazing how much of the prediction became a reality. Take a read and see what you think!

September 14, 2017
Platinum Sponsor





Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.

Features

Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.