I am preparing a PDF file which will be put on the web. People will access it and should be able to open other pdf files from my PDF.

My commands works well for local pdf:


This is no brainer and it works.

However, when I publish my pdf file and have all the additional files in the presentations directory, this command does not work online.

If I use the absolute link as below


it works. However, I need to be able to produce the pdf and then to store it onto a website with a relative link to the file. I am not able to "guess" the exact link that I will have to give.

I have tryed many usual short cuts:


but none of them works.

Is there a way to have a relative link which will open?

  • 2
    When you open the PDF from the web, it is first stored offline and then opened in your PDF reader. So it knows nothing about its origin on the web site. Unless you download all linked PDFs, the link wouldn't work. To make it work, you have to tell the PDF its origin, either with a server-side automatism or hard-coded by hand.
    – Chris
    Commented Dec 5, 2012 at 11:38
  • 1
    Did you try the attachfile package? Commented Dec 5, 2012 at 12:45
  • Did you try file://? Commented Dec 6, 2012 at 8:01
  • I tried many options. If I read Chris comment correctly, there is no way to use the relative link as you would do on html, due to the fact that the pdf is loaded onto your own computer and does not just run "online". I will use the absolute link on my last compiling and will work with it. thanks for the suggestions.
    – France
    Commented Dec 7, 2012 at 8:48

1 Answer 1


AFAIK this is not possible. What you can do is to create a special \href Command and use a switch to switch from the online to the local version. The ifthen package would be a good starting point.






You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .