Debian Codegraph @

texmf-dist/tex/latex/postage/postage.sty

raw
1 %%
2 %% This is file `postage.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% postage.dtx (with options: `package')
8 %% ----------------------------------------------------------------
9 %% postage --- Franking letters with »Deutsche Post«'s online postage service »Internetmarke«
10 %% E-mail: [email protected]
11 %% Released under the LaTeX Project Public License v1.3c or later
12 %% See http://www.latex-project.org/lppl.txt
13 %% ----------------------------------------------------------------
14 %%
15 \NeedsTeXFormat{LaTeX2e}
16 \ProvidesPackage{postage}[2018/05/29 v1.0 Franking letters with »Deutsche Post«'s online postage service »Internetmarke«]
17
18 \RequirePackage{graphicx}
19 \RequirePackage{tikz}
20 \RequirePackage{calc}
21 \RequirePackage{keyval}
22 \def\postage@stamp@style@normal{normal}
23 \def\postage@stamp@style@compact{compact}
24 \let\postage@current@stamp@style\postage@stamp@style@normal
25 \define@key{postage}{style}{%
26 \def\postage@current@stamp@style{#1}%
27 }
28 \define@key{postage}{compact}[true]{%
29 \let\postage@current@stamp@style\postage@stamp@style@compact%
30 }
31 \define@key{postage}{normal}[true]{%
32 \let\postage@current@stamp@style\postage@stamp@style@compact%
33 }
34 \def\postage@current@stamp@page{1}
35 \def\postage@current@stamp@row{1}
36 \def\postage@current@stamp@column{1}
37 \define@key{postage}{page}{%
38 \def\postage@current@stamp@page{#1}%
39 }
40 \define@key{postage}{row}{%
41 \def\postage@current@stamp@row{#1}%
42 }
43 \define@key{postage}{column}{%
44 \def\postage@current@stamp@column{#1}%
45 }
46 \newlength{\postage@page@width}
47 \newlength{\postage@page@height}
48 \newlength{\postage@grid@width}
49 \newlength{\postage@grid@height}
50 \newlength{\postage@grid@x}
51 \newlength{\postage@grid@y}
52 \newlength{\postage@stamp@content@width}
53 \newlength{\postage@stamp@content@height}
54 \newlength{\postage@stamp@content@x}
55 \newlength{\postage@stamp@content@y}
56 \newlength{\postage@stamp@barcode@width}
57 \newlength{\postage@stamp@barcode@height}
58 \newlength{\postage@stamp@barcode@x}
59 \newlength{\postage@stamp@barcode@y}
60 \newlength{\postage@stamp@barcode@text@width}
61 \newlength{\postage@stamp@logo@width}
62 \newlength{\postage@stamp@logo@height}
63 \newlength{\postage@stamp@logo@x}
64 \newlength{\postage@stamp@logo@y}
65 \setlength{\postage@page@width}{209.99979mm}
66 \setlength{\postage@page@height}{296.99973mm}
67 \setlength{\postage@grid@width}{40mm}
68 \setlength{\postage@grid@height}{32.999mm}
69 \setlength{\postage@grid@x}{22.5mm}
70 \setlength{\postage@grid@y}{14.05473mm}
71 \setlength{\postage@stamp@content@width}{31.639mm}
72 \setlength{\postage@stamp@content@height}{22.473mm}
73 \setlength{\postage@stamp@content@x}{3.024mm}
74 \setlength{\postage@stamp@content@y}{2.855mm}
75 \setlength{\postage@stamp@barcode@width}{30.862mm}
76 \setlength{\postage@stamp@barcode@height}{11.01mm}
77 \setlength{\postage@stamp@barcode@x}{3.009mm}
78 \setlength{\postage@stamp@barcode@y}{11.029mm}
79 \setlength{\postage@stamp@barcode@text@width}{15.732mm}
80 \setlength{\postage@stamp@logo@width}{31.639mm}
81 \setlength{\postage@stamp@logo@height}{5.282mm}
82 \setlength{\postage@stamp@logo@x}{3.024mm}
83 \setlength{\postage@stamp@logo@y}{2.855mm}
84 \newlength{\postage@current@stamp@x}
85 \newlength{\postage@current@stamp@y}
86 \newlength{\postage@current@stamp@trim@left}
87 \newlength{\postage@current@stamp@trim@bottom}
88 \newlength{\postage@current@stamp@trim@right}
89 \newlength{\postage@current@stamp@trim@top}
90 \newcommand{\postage@calculate@current@stamp@position}{
91 \setlength{\postage@current@stamp@x}{
92 \postage@grid@x +
93 \postage@grid@width *
94 (\postage@current@stamp@column - 1)
95 }%
96 \setlength{\postage@current@stamp@y}{
97 \postage@grid@y +
98 \postage@grid@height *
99 (\postage@current@stamp@row - 1)
100 }%
101 }
102 \newcommand{\postage@draw@current@stamp@part}[1][]{%
103 \includegraphics[page=\postage@current@stamp@page, trim={
104 {1\postage@current@stamp@trim@left}
105 {1\postage@current@stamp@trim@bottom}
106 {1\postage@current@stamp@trim@right}
107 {1\postage@current@stamp@trim@top}
108 }, clip, #1]{\postage@current@stamp@file}%
109 }
110 \newcommand{\postage@draw@current@stamp@content}{%
111 \setlength{\postage@current@stamp@trim@top}{
112 \postage@current@stamp@y +
113 \postage@stamp@content@y
114 }%
115 \setlength{\postage@current@stamp@trim@left}{
116 \postage@current@stamp@x +
117 \postage@stamp@content@x
118 }%
119 \setlength{\postage@current@stamp@trim@bottom}{
120 \postage@page@height -
121 \postage@current@stamp@trim@top -
122 \postage@stamp@content@height
123 }%
124 \setlength{\postage@current@stamp@trim@right}{
125 \postage@page@width -
126 \postage@current@stamp@trim@left -
127 \postage@stamp@content@width
128 }%
129 \postage@draw@current@stamp@part%
130 }
131 \newcommand{\postage@draw@current@stamp@barcode}{%
132 \setlength{\postage@current@stamp@trim@top}{
133 \postage@current@stamp@y +
134 \postage@stamp@barcode@y
135 }%
136 \setlength{\postage@current@stamp@trim@left}{
137 \postage@current@stamp@x +
138 \postage@stamp@barcode@x
139 }%
140 \setlength{\postage@current@stamp@trim@bottom}{
141 \postage@page@height -
142 \postage@current@stamp@trim@top -
143 \postage@stamp@barcode@height}%
144 \setlength{\postage@current@stamp@trim@right}{
145 \postage@page@width -
146 \postage@current@stamp@trim@left -
147 \postage@stamp@barcode@width
148 }%
149 \postage@draw@current@stamp@part%
150 }
151 \newcommand{\postage@draw@current@stamp@logo}{%
152 \setlength{\postage@current@stamp@trim@top}{
153 \postage@current@stamp@y +
154 \postage@stamp@logo@y
155 }%
156 \setlength{\postage@current@stamp@trim@left}{
157 \postage@current@stamp@x +
158 \postage@stamp@logo@x
159 }%
160 \setlength{\postage@current@stamp@trim@bottom}{
161 \postage@page@height -
162 \postage@current@stamp@trim@top -
163 \postage@stamp@logo@height
164 }%
165 \setlength{\postage@current@stamp@trim@right}{
166 \postage@page@width -
167 \postage@current@stamp@trim@left -
168 \postage@stamp@logo@width
169 }%
170 \postage@draw@current@stamp@part[%
171 width={1\postage@stamp@barcode@text@width}
172 ]%
173 }
174 \newcommand{\postage@draw@current@stamp@style@compact}{%
175 \begin{tikzpicture}
176 \node[anchor=north east, inner sep=0] at (0,0)
177 {\postage@draw@current@stamp@barcode};
178 \node[anchor=north east, inner sep=0] at (0,0)
179 {\postage@draw@current@stamp@logo};
180 \end{tikzpicture}%
181 }
182 \newcommand{\postage@draw@current@stamp@style@normal}{%
183 \postage@draw@current@stamp@content%
184 }
185 \newcommand{\includestamp}[2][]{%
186 \setkeys{postage}{#1}%
187 \def\postage@current@stamp@file{#2}%
188 \postage@calculate@current@stamp@position%
189 %
190 \ifx\postage@current@stamp@style\postage@stamp@style@compact%
191 \postage@draw@current@stamp@style@compact%
192 \else%
193 \postage@draw@current@stamp@style@normal%
194 \fi%
195 }
196 %%
197 %% Copyright (C) 2018 by Jan Heinrich Reimer <[email protected]>
198 %%
199 %% This work may be distributed and/or modified under the
200 %% conditions of the LaTeX Project Public License (LPPL), either
201 %% version 1.3c of this license or (at your option) any later
202 %% version. The latest version of this license is in the file:
203 %%
204 %% http://www.latex-project.org/lppl.txt
205 %%
206 %% This work is "maintained" (as per LPPL maintenance status) by
207 %% Jan Heinrich Reimer.
208 %%
209 %% This work consists of the file postage.dtx
210 %% and the derived files postage.ins,
211 %% postage.pdf and
212 %% postage.sty.
213 %%
214 %%
215 %% End of file `postage.sty'.