# Span a tikz chain over multiple pages

I wanna create a flowchart as a chain. What I want to achieve is a chain spanned over multiple pages on top of every page (see picture):

For the example picture I created it manually (copied the code from texample.net, made a standalone chaine, cropped it manually in half and used eso-pic to place it on top of the page). Is there a way to do something like this "automatically"?

A further question:

Could anybody give some suggestions of how to handle this, if no rimless printer is available? Should I look for a different solution?

-
–  Werner Dec 13 '12 at 20:20
Not a duplicate. A chain could span over more than two pages. –  schmendrich Dec 13 '12 at 20:22
I would still use Martin's answer with a couple of added (perhaps nested) \afterpage commands. It would still require producing the image as a standalone one to be included piece-by-piece using \includegraphics. –  Werner Dec 13 '12 at 20:58
Thanks for the hint, I will see, if I understand the \afterpage thing. Spanning over two pages works. Do you have a suggestion what to do (let's say "how to present") a chain like above, if the printer can't print without borders (I don't know the right english word - the "non printing area")? –  schmendrich Dec 13 '12 at 22:27
That's called bleed. You would have to trim the page (or stock) to accommodate for this. That how it's done in regular publication as well since there will be some border remaining. –  Werner Dec 13 '12 at 22:33

Once again, this was agood opportunity to use Gonzalo Medina's excellent background package. So far it works quite well, except for an unexpected error: if there is a TikZ cooordinate bigger than 90cm, it throws ! Dimension too large and I can't work with sizes bigger than about 19 feet. This is odd, as 19 feet x 12 inch per foot x 2.54 cm per inch = 579cm. So as it stands now, the chains are restricted to a width of 4 pages in A4 (and 6cm on the fifth), whereas it should be up to 27 in my opinion. Anyway, here's what I have so far, you need to complie three times to get it right:

## Code

\documentclass[parskip]{scrartcl}
\usepackage[left=15mm,right=15mm,bottom=25mm,top=50mm]{geometry}
\usepackage[scale=1,angle=0,opacity=1,color=black]{background}
\usetikzlibrary{calc}
\usepackage{xifthen}
\usepackage{lipsum}

\pgfmathsetmacro{\topheightreservedforpicture}{4}

\backgroundsetup%
{ contents={
\multipagetikz{1}{4}{\tpone}
\multipagetikz{6}{5}{\tptwo}
}
}

\newcommand{\multipagetikz}[3]% start page, num pages, picture code
{   \pgfmathtruncatemacro{\currentpage}{\value{page}}
\pgfmathtruncatemacro{\maxpage}{#1+#2}
\pgfmathtruncatemacro{\minpage}{#1-1}
\pgfmathsetmacro{\paperwidthcm}{\paperwidth/28.453}
\ifthenelse{\currentpage < \maxpage \AND \currentpage > \minpage}
{ \begin{tikzpicture}[overlay,remember picture,rounded corners=5mm,shift={($(current page.north west)+(0,-\topheightreservedforpicture)+(\additionalxshift,0)$)}]
#3
\end{tikzpicture}
}{}
}

\newcommand{\tpone}
{   \fill[left color=red,right color=blue!50!cyan] (0,0) -- (60,0) to[out=0,in=270,looseness=0.2] (84,3) -- cycle;
}

\newcommand{\tptwo}
{   \fill[top color=orange,bottom color=violet] (0,1) -- (55,0) to[out=0,in=270,looseness=0.2] (90,3) -- (10,3.5) -- cycle;
}

\begin{document}

\lipsum[1-60]

\end{document}


-