3

I Want to print the borders of hyperref package in LaTeX. Using the package \usepackage{hyperref}, in the pdf file, some borders (red, green, etc) appears. When the document is printed the borders does not appear (which is logical).

Happens that I want to print those borders. Is it possible ?

Rico
  • 6,097
PVaz
  • 33
  • 2

1 Answers1

2

Your PDF reader decides whether these borders are shown and/or printed. If you want to make sure these are printed, you can use normal frames instead:

\documentclass{article}

\usepackage[hidelinks]{hyperref}

\begin{document}
This is a \href{http://tex.stackexchange.com/}{\framebox{link}}.
\end{document}

framebox creates a (black) frame, the hidelinks option to hyperref prevents the normal (non-printable) frame from showing up.


A macro to replace \href:

\newcommand{\framedhref}[2]{\href{#1}{\framebox{#2}}}
fefrei
  • 1,339
  • 2
    I have more than 100 hyper references in my document so I'm looking for an automatic solution. Is it possible to change the definition in the pdf reader or use another one to print the borders ? – PVaz Jul 30 '13 at 17:29
  • I don't know any PDF reader which will print these borders. Add the hidelinks, define a command for framed links (see my updated answer), and replace each occurrence of \href{ with the new macro. – fefrei Jul 30 '13 at 17:35
  • 2
    This will have problems if the linked text happens to be over two lines. For instance, try adding the following to the MWE: To get to your favorite site you need to click on the following \href{http://tex.stackexchange.com/}{\framebox{link to the \TeX{} Stackexchange site}}. with the \usepackage{showframe} to see. – Peter Grill Jul 30 '13 at 18:42