summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/mtx-context-trim.tex
blob: 46d0c31886b36d998361e547d30291a60737ddaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
%D \module
%D   [       file=mtx-context-trim,
%D        version=2016.03.04,
%D          title=\CONTEXT\ Extra Trickry,
%D       subtitle=Trimming Files,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D This is a very old module based feature that has been moved to \MKIV.

% begin help
%
% usage: context --extra=trim [options] filename
%
% --paperwidth  : target paperwidth
% --paperheight : target paperheight
% --file        : processed file
% --x           : page x offset
% --y           : page y offset
% --hoffset     : horizontal clip offset
% --voffset     : vertical clip offset
% --width       : clip width
% --height      : clip height
%
% example: context --extra=trim --file=trimtest --hoffset=3.50cm --voffset=3.50cm --width=15cm --height=21cm
%
% end help

\input mtx-context-common.tex

\setdocumentargumentdefault {paperwidth}  {21cm}
\setdocumentargumentdefault {paperheight} {29.7cm}
\setdocumentargumentdefault {file}        {\getdocumentfilename{1}}
\setdocumentargumentdefault {hoffset}     {0cm}
\setdocumentargumentdefault {voffset}     {0cm}
\setdocumentargumentdefault {width}       {17cm}
\setdocumentargumentdefault {height}      {24cm}
\setdocumentargumentdefault {x}           {0cm}
\setdocumentargumentdefault {y}           {0cm}

\doifnothing{\getdocumentargument{file}}                    {\starttext missing filename \stoptext}
\doif       {\getdocumentargument{file}}{\inputfilename.tex}{\starttext missing filename \stoptext}

\definepapersize
  [fuzzy]
  [width=\getdocumentargument{paperwidth},
   height=\getdocumentargument{paperheight}]

\setuppapersize
  [fuzzy]
  [fuzzy]

\setuplayout
  [page]

\starttext

    \trimpages
      [file=\getdocumentargument{file},
       hoffset=\getdocumentargument{hoffset},
       voffset=\getdocumentargument{voffset},
       width=\getdocumentargument{width},
       height=\getdocumentargument{height},
       x=\getdocumentargument{x},
       y=\getdocumentargument{y}]

\stoptext