Web Link Buttons with Variable URLs in InDesign

2019-07-17 13:05发布

问题:

My work assignment of late has been developing an interactive PDF catalog of our products that my superior can distribute digitally and let potential customers browse without accessing the website.

We have an Excel file that lists all the details of our products - name, description, title, image, category, etc. I have used Data Merge to create this 300 page document rather than hand-copy each product's information to a single page.

Unfortunately I am now stuck - I have designed the catalog in such a way that I have an image that I want to make a button which, if the person wishes to purchase a product, will take them directly the the product page online where he or she can add it to the shopping cart. This is great, but I cannot seem to find a way to make the image button's link a variable as the rest of the page content. Links to each product page are included in the CSV file, but without a variable web link method, I would have to create the unique links individually, which kinda defeats the purpose of using Data Merge anyway.

So my question is this - is there any way to make a URL button (an image) have a web link function that can read from a CSV file and change each page like other imported content? I've asked in the Adobe Forums and the one answer I received was for using JavaScript, so I came here. If not, is there another way to automate the individual link process without setting it up on each generated page?

Thanks in advance,

Asher

回答1:

  1. I didn't test it, but I think you first have to define HyperlinkPageItemSources with the add()-method. This method accepts an image-object, because it is an pageItem. (http://jongware.mit.edu/idcs4js/pc_HyperlinkPageItemSources.html)

  2. Then define HyperlinkURLDestinations with add()-method. The method accepts a URL as string. (http://jongware.mit.edu/idcs4js/pc_HyperlinkURLDestinations.html)

  3. Define Hyperlinks with add()-method. First argument is a hyperlinkSource – for this case a HyperlinkPageItemSource – and second is a hyperlinkDestination – for this case a HyperlinkURLDestination. (http://jongware.mit.edu/idcs4js/pc_Hyperlinks.html)

For reading a csv-file and bringing to an array look here for example (function parseCSV()…): http://forums.adobe.com/message/3404908#3404908

Hope that helps a bit!