DIN lang folder

From ConTeXt wiki

This is a template to print DIN lang folders.

%% This is a template for a Din lang Folder.
%% The folded page of such a flyer is shorter (97mm) than the other pages (100mm)

%% This measure shows how much shorter the folded page is.
\definemeasure
    [shortfold]
    [3mm]

%% The bleed measure is necessary if you have colored page backgrounds 
%% or images in the bleed.
%% Different print shops need different bleeds.
\definemeasure
    [bleed]
    [1mm]

%% This is the pagesize of the final PDF.
%% The bleed size is added two times to width and height.
\definepapersize
    [A4-flyer]
    [width=\dimexpr297mm+2\measured{bleed}\relax,
     height=\dimexpr210mm+2\measured{bleed}\relax]

%% The size of a normal page.
\definepapersize
    [flyer-page]
    [width=100mm,
     height=210mm]

%% The size of the folded page.
\definepapersize
    [flyer-page-small]
    [width=\dimexpr100mm-\measure{shortfold}\relax,
     height=210mm]

%% Imposition: With the following two commands we arrange the six pages
%% on the final PDF print sheet.

%% The flyerpages are imposed on the printed sheet.
\setuppapersize
    [flyer-page]
    [A4-flyer]

%% The pages are arranged as a tryptichon.
\setuparranging
    [TRYPTICHON]

%% Because of the shorter folded page and the bleed the pages has
%% to be shifted horizontally on the printed sheet.
%% The values are calculated here.
\definepageshift
    [flyer]
    [horizontal]
    [\dimexpr\measure{bleed}-\measured{shortfold}\relax,
    \measure{bleed},
     \measure{bleed},
     \dimexpr2\measured{shortfold}+\measured{bleed}\relax,
     \measure{bleed},
    \dimexpr\measure{bleed}-\measured{shortfold}\relax
    ]


%% The vertical pageshift is simple.
\definepageshift
    [flyer]
    [vertical]
    [\measure{bleed}]

\setuppageshift
    [paper]
    [flyer]

%% We define some measures to construct the page layout.
\definemeasure
    [small]
    [3mm]

\definemeasure
    [big]
    [\measure{small}*2]

%% Each page has a slightly different page layout.
%% The named layouts (1. bracket) inherit values from other layouts
%% which are assigned in the second bracket.
\definelayout
    [first]
    [page]
    [page=flyer-page,
     topspace=2\measured{big},
     backspace=2\measured{small},
     width=\dimexpr\paperwidth-4\measured{small}\relax,
     height=\dimexpr\paperheight-4\measured{big}\relax]

\definelayout
    [second]
    [first]
    [topspace=2\measured{big},
     backspace=2\measured{big},
     width=\dimexpr\paperwidth-3\measured{big}\relax]

\definelayout
    [thirdandfourth]
    [second]
    [backspace=\measure{big},
     width=\dimexpr\paperwidth-2\measured{big}\relax]

\definelayout
    [fifthandsixth]
    [first]
    [backspace=\measure{big},
     width=\dimexpr\paperwidth-2\measured{big}\relax]

%% We assign the layouts to the pages.
\definelayout [1] [first]
\definelayout [2] [second]
\definelayout [3] [thirdandfourth]
\definelayout [4] [thirdandfourth]
\definelayout [5] [fifthandsixth]
\definelayout [6] [fifthandsixth]


%% Some setups
\setupmakeup [doublesided=no]
\setupbodyfont  [mainface,10pt]
\setuptolerance [verytolerant]


%% We want to see page and layout borders.
%% COMMENT THIS OUT BEFORE YOU PRINT!
\showframe


\starttext
    \starttitle[title={First page},marking{ }]
    \input lorem
  \stoptitle 
  \starttitle[title={Second page},marking{ }]
    \input lorem

  \stoptitle 
  \starttitle[title={Third page},marking{ }]
    \input lorem

  \stoptitle

  \starttitle[title={Fourth page},marking{ }]
    \setuppapersize [flyer-page-small] [A4-flyer]
    \input lorem

  \stoptitle

  \starttitle[title={Fifth page},marking{ }]
    \input lorem

  \stoptitle

  \starttitle[title={Sixth page},marking{ }]
  \setuppapersize [flyer-page] [A4-flyer]
    \input lorem

  \stoptitle

\stoptext