mtx-context-trim.tex /size: 2178 b    last modification: 2020-07-01 14:35
1
%D \module
2
%D [ file=mtx-context-trim,
3
%D version=2016.03.04,
4
%D title=\CONTEXT\ Extra Trickry,
5
%D subtitle=Trimming Files,
6
%D author=Hans Hagen,
7
%D date=\currentdate,
8
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9
%C
10
%C This module is part of the \CONTEXT\ macro||package and is
11
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12
%C details.
13 14
%D This is a very old module based feature that has been moved to \MKIV.
15 16
% begin help
17
%
18
% usage: context --extra=trim [options] filename
19
%
20
% --paperwidth : target paperwidth
21
% --paperheight : target paperheight
22
% --file : processed file
23
% --x : page x offset
24
% --y : page y offset
25
% --hoffset : horizontal clip offset
26
% --voffset : vertical clip offset
27
% --width : clip width
28
% --height : clip height
29
%
30
% example: context --extra=trim --file=trimtest --hoffset=3.50cm --voffset=3.50cm --width=15cm --height=21cm
31
%
32
% end help
33 34
\input
mtx
-
context
-
common
.
tex
35 36
\setdocumentargumentdefault
{
paperwidth
}
{
2
1
cm
}
37
\setdocumentargumentdefault
{
paperheight
}
{
2
9
.
7
cm
}
38
\setdocumentargumentdefault
{
file
}
{
\getdocumentfilename
{
1
}}
39
\setdocumentargumentdefault
{
hoffset
}
{
0
cm
}
40
\setdocumentargumentdefault
{
voffset
}
{
0
cm
}
41
\setdocumentargumentdefault
{
width
}
{
1
7
cm
}
42
\setdocumentargumentdefault
{
height
}
{
2
4
cm
}
43
\setdocumentargumentdefault
{
x
}
{
0
cm
}
44
\setdocumentargumentdefault
{
y
}
{
0
cm
}
45 46
\doifnothing
{
\getdocumentargument
{
file
}}
{
\starttext
missing
filename
\stoptext
}
47
\doif
{
\getdocumentargument
{
file
}}{
\inputfilename
.
tex
}{
\starttext
missing
filename
\stoptext
}
48 49
\definepapersize
50
[
fuzzy
]
51
[
width
=
\getdocumentargument
{
paperwidth
}
,
52
height
=
\getdocumentargument
{
paperheight
}
]
53 54
\setuppapersize
55
[
fuzzy
]
56
[
fuzzy
]
57 58
\setuplayout
59
[
page
]
60 61
\starttext
62 63
\trimpages
64
[
file
=
\getdocumentargument
{
file
}
,
65
hoffset
=
\getdocumentargument
{
hoffset
}
,
66
voffset
=
\getdocumentargument
{
voffset
}
,
67
width
=
\getdocumentargument
{
width
}
,
68
height
=
\getdocumentargument
{
height
}
,
69
x
=
\getdocumentargument
{
x
}
,
70
y
=
\getdocumentargument
{
y
}
]
71 72
\stoptext
73