As I understood your question, you have two pages next to each other, one on the right where you include a page from some PDF file, and one on the left where you want to state annotations. Then, you want to draw lines going from the left to the right, crossing the page boundaries.
With the following approach that works a bit like tikzmark
s, you can use the macro \annotline
to define the coordinate on the next page (the upper left corner of the page is the origin, unit is centimeters) where you want to draw a line to. The macro will then draw a line starting where you placed the macro that goes towards the right margin of the page where it turns up or down until it reaches the height of the coordinate on the next page where it turns to the right again. You can use the macro \annotlinebreakdist
to define the distance from the right margin of the page to the vertical part of the line.
On the next page, you can use the macro \printannotlines
to draw the remaining part of the lines that start form the left margin of the page and go to the relevant coordinate. The macro automatically draws all the lines that haven't been finished until then.
You can style the line using TikZ styles. In case the lines overlap, you can use the second optional argument to shift the vertical part of the line to the right or left. Using the first optional parameter, you can shift the starting point of the line to the left or right.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\tikzset{
annotline/.style={
very thick, red
},
annotline start/.style={
},
annotline end/.style={
->
}
}
\ExplSyntaxOn
\dim_new:N \l_annotline_breakdist_dim
\dim_set:Nn \l_annotline_breakdist_dim { 1cm }
\NewDocumentCommand{\annotlinebreakdist}{ m }{
\dim_set:Nn \l_annotline_breakdist_dim { #1 }
}
\clist_new:N \l_annotline_allxpos_clist
\clist_new:N \l_annotline_allypos_clist
\int_new:N \l_annotline_currid_int
\int_new:N \l_annotline_lastid_int
\NewDocumentCommand{\annotline}{ O{0pt} O{0pt} m m }{%
\clist_put_right:Nn \l_annotline_allxpos_clist { #3 }
\clist_put_right:Nn \l_annotline_allypos_clist { #4 }
\int_incr:N \l_annotline_currid_int
\begin{tikzpicture}[remember~picture, overlay]
\coordinate (annotline-\int_use:N\l_annotline_currid_int -start) at
([xshift=#1,yshift=.5ex]0,0);
\coordinate (annotline-\int_use:N\l_annotline_currid_int -start-break) at
([xshift={-1*\dim_use:N\l_annotline_breakdist_dim+#2}]current~page.east);
\coordinate (annotline-\int_use:N\l_annotline_currid_int -start-margin) at
([shift={(0,-1*#4)}]current~page.north~east);
\draw[annotline, annotline~start]
(annotline-\int_use:N\l_annotline_currid_int -start) --
(annotline-\int_use:N\l_annotline_currid_int -start -| annotline-\int_use:N\l_annotline_currid_int -start-break) |-
(annotline-\int_use:N\l_annotline_currid_int -start-margin);
\end{tikzpicture}
}
\dim_new:N \l_annotline_currxpos_dim
\dim_new:N \l_annotline_currypos_dim
\NewDocumentCommand{\annotlineend}{ m }{%
\dim_set:Nn \l_annotline_currxpos_dim { \clist_item:Nn \l_annotline_allxpos_clist #1 cm }
\dim_set:Nn \l_annotline_currypos_dim { \clist_item:Nn \l_annotline_allypos_clist #1 cm }
\begin{tikzpicture}[remember~picture, overlay]
\coordinate (annotline-#1-end-margin) at
([shift={(0,-1*\int_use:N\l_annotline_currypos_dim)}]current~page.north~west);
\coordinate (annotline-#1-end) at
([shift={(\dim_use:N\l_annotline_currxpos_dim,-1*\dim_use:N\l_annotline_currypos_dim)}]current~page.north~west);
\draw[annotline, annotline~end]
(annotline-#1-end-margin) --
(annotline-#1-end);
\end{tikzpicture}
}
\NewDocumentCommand{\printannotlines}{}{%
\int_incr:N \l_annotline_lastid_int
\foreach \i in {\int_use:N\l_annotline_lastid_int,...,\int_use:N\l_annotline_currid_int} {
\annotlineend{\i}
}
\int_set:Nn \l_annotline_lastid_int \l_annotline_currid_int
}
\ExplSyntaxOff
\begin{document}
\annotlinebreakdist{2cm}
Some very interesting thing \annotline[0pt][10pt]{8}{5}
Some other interesting thing \annotline[0pt][-10pt]{12}{10}
\vspace{10cm}
Yet another interesting thing \annotline{16}{7.5}
\newpage
\noindent
\includegraphics[width=\textwidth]{example-image-a}
\printannotlines
\newpage
Again some very interesting thing \annotline{10}{10}
\newpage
\noindent
\includegraphics[width=\textwidth]{example-image-a}
\printannotlines
\end{document}
