Skip to main content
Participating Frequently
May 17, 2011
Question

specify target in URLs for buttons or hyperlink settings

  • May 17, 2011
  • 2 replies
  • 43103 views

I've been searching for hours on this simple question. How can you specify target="_blank" on a URL?

I have an InDesign CS5 document with many hyperlinks in it. Actually they have been formatted as buttons with a "go to URL' action.

When converting to a PDF file, some browsers open the file in Acrobat Reader, but others open directly in the browser via a plugin. In the latter case, I want the links to open in a new window (or tab) rather than overtaking the window containing the PDF.

I can't believe there isn't an option in InDesign to specify a target on URLs. I don't mind converting all of the buttons to hyperlinks, but neither panel has this option.

I know it can be done via Acrobat, (see http://acrobatusers.com/blogs/tedpadova/opening-pdfs-new-browser-windows) but obviously this means redoing every one of them after having to make any change to the InDesign file.

Can any of you scripting gurus tell me how to do this?

This topic has been closed for replies.

2 replies

Braniac
May 18, 2011

Maureen,

it should be possible to send over the Acrobat JavaScript code for the postprocessing phase in Acrobat Pro through pdfmarks embedded in EPS files on the InDesign page. Downside is that you need Acrobat Distiller to generate the PDF.

EPS files could be simple text files generated by ExtendScript and placed according to your URLs.
Just a thought…
Not tested.

For code samples of pdfmarks and the whole process look for the PostScript & PDF Bible by Thomas Merz and Olaf Drümmer.
Especially see chapter 11.8 JavaScript with pdfmarks.

Uwe

Braniac
May 18, 2011

Here a follow-up: indeed it's possible.

The Code for the EPS file would be something like this:

%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 100 100
%%EndProlog

[ /Rect [ 0 0 100 100 ]
/Action << /Subtype /JavaScript /JS (app.launchURL\("PLACE-YOUR-URL-HERE", true\);) >>
/Subtype /Link

/ANN pdfmark

%%EOF

Of course, BoundingBox and Rect coordinates should be adapted to fit the url text in InDesign. The EPS could be placed as an inline object above etc., etc.
I hope you get the idea.

Uwe

John Hawkinson
Inspiring
May 18, 2011

It's kind of sick though. And Adobe PDF Library (what InDesign uses) doesn't support pdfmark?

I'm still having trouble getting over the idea that with all this interactive support in ID, there isn't direct support for embedding Javascript. I guess Adobe made a strategic decision to favor Flash? [Except it looks like you can't embed arbitrary swf code either?] Yikes...

Jongware
Braniac
May 17, 2011

Sorry to disappoint you, but you are looking for something that cannot be scripted. The only thing you can set in InDesign is the URL -- nothing else. "target" is something else, hence you cannot set its value.

(Uh. In more technical detail: the text you enter in InDesign as 'the link' of a hyperlink, whether it is with scripting or in the UI dialog, appears in the 'href' attribute in the hyperlink. You cannot set any value for the 'target' attribute, and you cannot add any attribute/value pair you want either. So it's a limitation of what you can and cannot do with InDesign. It's not so much a "simple question", believe it or not, it's more that ID is not designed to handle any random HTML coding.)

MaureenDAuthor
Participating Frequently
May 17, 2011

Wow. Well, thanks for the answer.

It's hard to believe that there is not a way around this. I was hoping there might be a javascript snippet that ID would parse to accomplish this.