Adobe Acrobat 5: addWeblinks()

Posted on 2004-11-12
Last Modified: 2013-12-16
I added the method addWeblinks() to a text field (as JavaScript):
var numWebLinks = this.addWeblinks();
When moving to another field (onBlur), Adobe messages 'Creating weblinks' in the status bar.
Unfortunately, weblink is not created (at least not visible and functional). The content of the field is "".
How to get it run?
Question by:go4java
    LVL 44

    Expert Comment

    by:Karl Heinz Kremer
    The Doc.addWeblinks() method works only on "real" PDF content, and not form fields. What are you trying to accomplish (be as specific as posible)?
    You may be able to use a different methanism to create the same effect (e.g. create a button that opens the selected URL).

    Author Comment

    I've a form with various input fields. One is a TEXT field to keep a specific URL, entered (copied) by the user.
    After leaving the field, it should automatically convert to a hyperlink, so that following users can simply click on the URL.
    LVL 44

    Expert Comment

    by:Karl Heinz Kremer
    It's not possible to do this in a one-step solution. First of all, this would only work with the full version of Acrobat (you need to modify the document and save it again, which is not possible in the free Reader). YOu also need to convert your field from a text input field to a link, which would mean that you can not update the link anymore once you've converted it to a link.
    How about using two different form fields: One for the input, and one for the actual link? This way you can modify the document, and still modify the link if that's necessary.

    Can you provide more information about what you want to accomplish with this? It sounds like you have two different user types for your document. There may be other ways to accomplish this, please provide as much inofrmation as possible.

    Author Comment

    We are working with Acrobat 5, not the reader. Reader is for end-users only.
    Soon, we'll get Acrobat 6...
    If I follow the steps mentioned on top, the function seems to process (but the field will not be converted to a link - as it should).
    The field with the link will be submitted and some other users will add more information to the form (each of them will submit accordingly).
    Can't use 2 fields, one is a must...
    LVL 44

    Accepted Solution

    Your assumptions are wrong: The function is not supposed to convert a text field content to a web link.

    Use this script as OnBlur action handler for your text field (you need to change the field names Text1 and potentially Button1 if you already use a field named "Button1"):

    var f1 = this.getField("Text1");

    // get the size and coordinates for Text1
    var r = f1.rect;
    var url = f1.value;

    if (typeof == "number")
        var page =;
        var page =[0];

    // set the text color to blue (to mark it as a link)
    f1.textColor =;

    // create a new button
    f2 = this.addField("Button1", "button", page, r);

    // set the action of the button to "go to URL"
    f2.setAction("MouseUp", "this.getURL('" + url + "', false);");

    // end of script

    This will create a new button with an action of "getURL()" right on top of the original text field. This way, the button will be clicked when the user clicks on the text field. I'm also changing the color of the text in the text field to blue so that it looks more like a link.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Suggested Solutions

    Power PDF ( is the newest product from the Document Imaging division of Nuance Communications ( It is available in two editions — …
    When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure ( It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
    The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be Log into your Hosting account. IPage will be used for demonstration : Locat…
    The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now