0

Aim:

Open a PNG image externally by clicking on its image in a PDF.

Motivation:

I would like to have, say, four tiny images on my PDF side by side. If I want to examine one of them, I would like to click on the image, so that it can pop out in a new window for my close inspections.

Problem:

We can open a web-page or an external PDF by clicking on an image, as exemplified in the following threads:

How to insert an image that also acts as a link

Link to local (PDF) file

Does hyperref work between two files?

Make hyperref links open in new browser window for easier navigation

Could you please tell me if it is possible to open a PNG externally (say in a new window popping out) by modifying one of the above approaches, or with another approach?

Attempts:

\documentclass{article}
\usepackage{hyperref}
\usepackage{graphicx}

\begin{document}
\begin{figure}
  \href{run:./local/path/boat.png}{\includegraphics[width=\linewidth]{boat.png}}
  \caption{A boat.}
\end{figure}
\end{document}

Yet Unable to open external link error is thrown every time even though I have tried various combinations.

3
  • 1
    Are you sure you have the correct path? The above code works for me if I adjust the file path. If boat.png is in the same directory as article.tex, have you tried \href{run:./boat.png}{\includegraphics[width=\linewidth]{boat.png}} ? – Fintan Dec 6 '19 at 15:09
  • Wow, it worked! I feel dumb! Please post an answer, so that I can accept it. Many thanks. – Herpes Free Engineer Dec 6 '19 at 15:13
  • You might want to use \href[pdfnewwindow]{...} It works with Acrobat, but not with every PDF reader. – John Kormylo Dec 6 '19 at 17:14
1

Are you sure you have the correct path? The above code works for me if I adjust the file path. If boat.png is in the same directory as article.tex, have you tried \href{run:./boat.png}{\includegraphics[width=\linewidth]{boat.png}} ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.