
% Patch to hyperref to cause it not to emit:
%   Package hyperref Warning: Invalid page number (0)
%   (hyperref)                for remote PDF file.
%   (hyperref)                Using page 1 on input line ...
% https://github.com/latex3/hyperref/issues/107
% Ulrich-Diez

\makeatletter
% \hyper@linkfil as in hdvipdfm.def [2019/09/28 v7.00a Hyperref driver for dvipdfm]
% , but surrounding group added:
\def\hyper@linkfile#1#2#3{%
  \begingroup %----\begingroup added
  \leavevmode
  \Hy@BeginAnnot{%
    \def\Hy@pstringF{#2}%
    \Hy@CleanupFile\Hy@pstringF
    \Hy@pstringdef\Hy@pstringF\Hy@pstringF
    \Hy@pstringdef\Hy@pstringD{#3}%
    \Hy@MakeRemoteAction %----Without the group the effects of \Hy@MakeRemoteAction are global.
    \@pdfm@mark{%
      bann<<%
        /Type/Annot%
        /Subtype/Link%
        \ifHy@pdfa /F 4\fi
        \Hy@setpdfborder
        \Hy@setpdfhighlight
        \ifx\@filebordercolor\relax
        \else
          /C[\@filebordercolor]%
        \fi
        /A<<%
          /S/GoToR%
          /F(\Hy@pstringF)%
          /D%
          \ifx\\#3\\%
            [\Hy@href@page\@pdfremotestartview]%
          \else
            (\Hy@pstringD)%
          \fi
          \Hy@SetNewWindow
          \Hy@href@nextactionraw
        >>%
      >>%
    }%
    \Hy@colorlink\@filecolor
  }%
  #1\Hy@xspace@end
  \Hy@EndAnnot
  \endgroup %----\endgroup added
}%
\makeatother

