1

I built a latex document and compress it afterwards with Ghostscript (gs). While some links are retained, e.g. urls, the links in the TOC and links created with autoref are not retained.

Adding the option -dPrinted=false option as described in Local hyperlinks broken after PDF processing with Ghostscript or Set the print flag on links with hyperref to preserve them with Ghostscript >= 9.25 did not work for the autoref or TOC links.

Would really appreciate some help or hints how to solve this!

MWE

all:
    latexmk -pdf -halt-on-error -shell-escape main.tex

reduced:
    gs  -sDEVICE=pdfwrite \
        -dCompatibilityLevel=1.4 \
        -dNOPAUSE -dQUIET -dBATCH \
        -dPrinted=false \
        -dPDFSETTINGS=/prepress \
        -sOutputFile=main_reduced.pdf \
        main.pdf

\documentclass[a4paper, 12pt]{scrreprt}


\usepackage[]{hyperref}

\begin{document}
    \tableofcontents    
    
    \chapter{1}
    \label{chap:1}
    This is a reference to a figure \autoref{fig:figure} 
    
    \section{Test}
    \begin{figure}
        \centering
        Figure
        \caption{This is a figure}
        \label{fig:figure}
    \end{figure}
    \href{mailto:[email protected]}{[email protected]}
\end{document}

Ghostscript 9.56.1 (2022-04-04)

MacOS 12.4

6
  • -dPrinted=flase look false ;-) Commented Jul 24, 2022 at 7:58
  • Thanks for the hint. I checked again but it does not work either..
    – moschmdt
    Commented Jul 24, 2022 at 8:01
  • you are also missing the pdfa option, see tex.stackexchange.com/a/480700/2388 Commented Jul 24, 2022 at 8:13
  • I have already tried that before and href already works. My assumption is that there is a difference in the implementation of href and autoref because href works just fine.
    – moschmdt
    Commented Jul 24, 2022 at 9:06
  • hm yes, the destinations are gone. Ask on the ghostscript list. If they tell you what flag is needed one can perhaps activate it in hyperref. Commented Jul 24, 2022 at 9:46

0

You must log in to answer this question.

Browse other questions tagged .