6 Replies Latest reply on Sep 29, 2011 6:21 AM by Czajka

    Hyperlink problem when exporting to PDF using Javascript

    vic_awesome

      From an INDD file, my script changes the Product Number texts to hyperlinks.  I find them using findTextPreferences then I add this url before the product numbers:

       

      "../products.jsp/prodnum=" + ProductNumber;

       

      Then I export it to PDF.  When a user mouses over a product number, they will be able to click it and go to the page above.

       

      The problem is when I export to PDF,there are spaces before and after the Product Number.  example:

       

      "../products.jsp/prodnum=%205674-897%20"

       

      To check where the spaces are coming from, I added alerts on my script, but there are no spaces on my alerts, only when it's exported will the spaces show on the Product numbers.

       

      Need to find a way to remove the spaces from the Product Numbers.  I tried a lot of things such as Replace, I created a trim function, arrays, concatenated all product numbers to 1 variable then used substring.  The expected result is:

       

      "../products.jsp/prodnum=5674-897"

       

      Thanks in advance guys, I hope you can help.

       

      Using Adobe InDesign CS5 and ExtendScript Toolkit CS5.