I provide a simple method to control page breaks in the standalone
class.
All pictures in the same page
As a MWE I take the following code, based on the question, where three pictures are generated in the same page.
\documentclass[a4paper,class=article,border=0pt]{standalone}
\usepackage{tikz}
\begin{document}
%
\begin{tikzpicture}
\clip (0,0) rectangle (21,29.7);
\draw[red] (0,0) -- (21,29.7);
\draw[red] (1,0) -- (0,1);
\draw[blue] (0,0) rectangle (21,29.7);
\draw[green] (1,1) rectangle (20,28.7);
\end{tikzpicture}
%
\begin{tikzpicture}
\clip (0,0) rectangle (21,29.7);
\draw[blue] (1,1) rectangle (20,28.7);
\end{tikzpicture}
%
\begin{tikzpicture}
\clip (0,0) rectangle (21,29.7);
\draw[red] (1,1) rectangle (20,28.7);
\end{tikzpicture}
%
\end{document}
Each picture in a different page
Taking @Ulrike Fischer's solution, which is just adding the option tikz
to the document class, i.e., changing the line \documentclass[a4paper,class=article,border=0pt]{standalone}
by \documentclass[a4paper,class=article,border=0pt,tikz]{standalone}
each picture appears in a different page.
Total Control of Page Breaks
If we want to arbitrarily insert page breaks between the pictures. For example, to put one picture in the first page and two pictures together in the last page. We can generate a dummy environment, e.g., standalonepage
and group the pictures that belong to the same page. As in the example before.
\documentclass[a4paper,class=article,border=0pt]{standalone}
\usepackage{tikz}
%
\newenvironment{standalonepage}{}{} %Dummy environment that contains pictures in the same page
\standaloneenv{standalonepage} %The dummy environment is make known to the stand alone class
\begin{document}
%First Page
\begin{standalonepage}
\begin{tikzpicture}
\clip (0,0) rectangle (21,29.7);
\draw[red] (0,0) -- (21,29.7);
\draw[red] (1,0) -- (0,1);
\draw[blue] (0,0) rectangle (21,29.7);
\draw[green] (1,1) rectangle (20,28.7);
\end{tikzpicture}
\end{standalonepage}
%Second Page
\begin{standalonepage}
\begin{tikzpicture}
\clip (0,0) rectangle (21,29.7);
\draw[blue] (1,1) rectangle (20,28.7);
\end{tikzpicture}
\begin{tikzpicture}
\clip (0,0) rectangle (21,29.7);
\draw[red] (1,1) rectangle (20,28.7);
\end{tikzpicture}
\end{standalonepage}
\end{document}
\documentclass[a4paper,class=article,border=0pt,tikz]{standalone}
tikz
pictures are automatically appearing in separated pages, which means the command\newpage
is not needed.