# How to color hyperref links so that it works in Chrome/Chromium?

The actual usecase: I'm writing a resume in LaTeX, so I defintely want the reader to know that the hyperlinks are there and there are just too many people using Chrome. In my real usecase I'm using underline instead of the box.

See the following minimal example

\documentclass[]{article}

%opening
\title{}
\author{}
\usepackage{hyperref}

\begin{document}

\maketitle

\end{document}


This correctly renders in PDF.js on Firefox and in Evince on Linux:

But Chromium doesn't render the link border at all:

What should I do so that people using Chrome/Chromium will know that the hyperlinks are there?

• \usepackage[colorlinks]{hyperref} could be an option. (Plus that avoids the borders, which some people may find a nice side-effect.) – moewe Jan 30 '19 at 9:16
• @moewe However, that is really printer unfriendly if you have an otherwise monochrome document. – Henri Menke Jan 30 '19 at 9:18
• @HenriMenke Very true. tex.stackexchange.com/q/4425/35864 might be able to help, though comments there suggest that one might need a compatible PDF viewer. Last resort is to provide one print version and one online version. – moewe Jan 30 '19 at 9:22
• @HenriMenke: \usepackage{hyperref}\usepackage[ocgcolorlinks]{ocgx2} prints monochrome links from within Chrome. – AlexG Jan 30 '19 at 9:23
• @AlexG then the underline is gone in other viewers. – marmistrz Jan 30 '19 at 9:31

It is possible to combine underlined and OCG-coloured links to satisfy more Browser-embedded PDF readers. OCG-coloured links are printed monochrome, if the PDF reader adheres to the PDF specification, such as Chrome:

\documentclass{article}

\usepackage{hyperref,xcolor}

\begin{document}\Huge
\hypersetup{allcolors=blue,allbordercolors=blue,pdfborderstyle={/S/U/W 1}}

Visit: \href{https://www.ctan.org}{CTAN}!

\end{document}


(For some obscure reason, hyperref defines different default colours for border and link text. Therefore the use of allcolors and allbordercolors in \hypersetup.)

What you are observing is an unfixed and abandoned bug in the Chromium PDF Viewer.

https://bugs.chromium.org/p/chromium/issues/detail?id=237527

There are alternatives, like \usepackage[ocgcolorlinks]{ocgx2} (mentioned in a comment by AlexG) but link borders are just broken.