These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Annotation richContents

Falc
Registered: Jan 19 2009
Posts: 13

hiho!

i´ve got the error "Not implemented" at this line "annot.richContents = spans;" if i try the example from the "JavaScript for Acrobat API Reference" V 8.1.

var annot = this.addAnnot({
page: 0,
type: "Text",
point: [72,500],
popupRect: [72, 500,6*72,500-2*72],
popupOpen: true,
noteIcon: "Help"
});
var spans = new Array();
spans[0] = new Object();
spans[0].text = "Attention:\r";
spans[0].textColor = color.blue;
spans[0].textSize = 18;
spans[1] = new Object();
spans[1].text = "Adobe Acrobat 6.0\r";
spans[1].textColor = color.red;
spans[1].textSize = 20;
spans[1].alignment = "center";
spans[2] = new Object();
spans[2].text = "will soon be here!";
spans[2].textColor = color.green;
spans[2].fontStyle = "italic";
spans[2].underline = true;
spans[2].alignment = "right";
// Now give the rich field a rich value
annot.richContents = spans;

anybody knows how to implement this feature?

thx.

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
What version and variation of Acrobat are you using, and how are you executing this script? I've tried it on Acrobat Pro 8 and 9 without a problem, running it from the Console Window.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Falc
Registered: Jan 19 2009
Posts: 13
thx for your help.

i use acrobat 9 pro extended and use it in a 3d script (just modified the "this.").

now i tested it in a page lvl script and it works.

why it doesn´t work with a 3d script???
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Ahh, now it makes sense, I was wonder where that error message came from. It's not an Acrobat JavaScript message.

So there are a couple of issues. First, the 3d JavaScript model is a completely different world from Acrobat JavaScript. They just happen to be connected though the Annot3D Context property. Which brings us to the second issue, the meaning of "this". I'm supprised you didn't get an error on the first line of code. "this" is a Core JavaScript keyword that points to the current object. The code above assumes that "this" is at the top level of an Acrobat event script. In which case "this" is a pointer to the current document. Not true in a 3D script. You have to acquire the "doc" object to make this work.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Falc
Registered: Jan 19 2009
Posts: 13
i used the doc object on my 3D script... ;-)
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Do you mean that you used the Acrobat doc object in the script and it didn't work? So, using the doc object, can the 3D script perform any other document operations, for example, getting and changing the current page number? If that works then try this. Put the code in a document level function. Then call the function from the 3D script.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script