# X-4 option of PDFX does not show hyperlink color with the PDF/X option (x-4)

It is indicated in the pdfx manual

To produce a validating PDF/X document,pdfx overrides internal macros while keeping colors associated with link anchors.

I can see the same claim in the answer here: pdfx - package leads to non-working hyperref links

But my minimal example (Luatex 2018) shows that any link is printed only in the surrounding colors.

\documentclass{article}
\usepackage[x-4]{pdfx} %option x-4 for print, a-1b for archive (also display)

%\usepackage{hyperref}, it is already included by pdfx

\begin{document}

\section{First}\label{first_section}

Check \ref{second_section} (it should be in {\color{blue}blue}).\\{\color{blue} Check \ref{second_section} (it just follows the surrounding color)}.

\section{Second}\label{second_section}

\end{document}


If I change

\usepackage[x-4]{pdfx}


to

\usepackage[a-1b]{pdfx}


the blue link color (in the first line) appears again.

I have also used a CMYK color instead of blue, but no success:

\definecolor{amGrayCMYK}{cmyk}{0.45,0.34,0.34,0}


Any idea how to keep hyperref link colors (not the functionality) in PDF/X output?

pdfx with x-a loads hyperref with the option draft and this disables the link colors. There is no user level setting to get them back. You will either have to redefine \ref to add the colors, or redefine internal hyperref commands:

\documentclass{article}
\usepackage[x-4]{pdfx} %option x-4 for print, a-1b for archive (also display)
\makeatletter
\AtBeginDocument{%
}

\begin{document}

\section{First}\label{first_section}

Check \ref{second_section} (it should be in {\color{blue}blue}).\\{\color{blue} Check \ref{second_section} (it just follows the surrounding color)}.

\section{Second}\label{second_section}

\end{document}


• Thanks a lot Ulrike! May I ask you to expand your answer to cover how to restore citecolor also? I have also problem with citecolor which I guessed should be the same as linkcolor (which seems is not). FYI: at the same time, considering your answer, I tried to use \hypersetup{draft=false} to trick pdfx. It worked for my minimal example but created problems with citations in the real-world document. Mar 28, 2019 at 14:58