When Word 2007 exports PDFs, it creates borders around all the hyperlinks. I have Acrobat 9 on my Mac, and I'm trying to create a JavaScript for Acrobat that will fix these links.
I've got as far as the following folder script:
app.addMenuItem({ cName:"Make links invisible", cParent:"Tools", cExec:"makeLinksInvisible();" }); function makeLinksInvisible() { for ( var p = 0; p < this.numPages; p++) { var box = this.getPageBox("Crop", p); var links = this.getLinks(p, box); for each (l in links) { for (var att in l) { console.println("Link property: " + att); } console.println(l.borderColor); l.borderColor = color.white; console.println(l.borderWidth); l.borderWidth = 1; } } }
When I run this against a simple PDF with one link, I can see that borderColor and borderWidth are both properties of that link. And I can get and set borderColor. But attempting to either get or set borderWidth results in an error:
Acrobat EScript Built-in Functions Version 9.0 Acrobat Annotations / Collaboration Built-in Functions Version 9.0 Acrobat Annotations / Collaboration Built-in Wizard Functions Version 9.0 Acrobat SOAP 9.0 Link property: borderColor Link property: rect Link property: highlightMode Link property: borderWidth Link property: setAction RGB,1,1,1 InvalidGetError: Get not possible, invalid or unknown. Link.borderWidth:21:Menu Make links invisible:Exec
What am I doing wrong? I'm running Acrobat Pro 9.2.0. A Google finds only [url=http://www.planetpdf.com/developer/article.asp?ContentID=ModifyinglinkpropertiesusingJavaScript]this script[/url], which makes me think either (a) this property used to work or (b) this property still works, but only on Windows...
See if this chokes on the borderWidth.
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]
Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script