-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmp-pdfcrop-725865.tex
127 lines (127 loc) · 3.12 KB
/
tmp-pdfcrop-725865.tex
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
\catcode37 14 % percent
\catcode33 12 % exclam
\catcode34 12 % quote
\catcode35 6 % hash
\catcode39 12 % apostrophe
\catcode40 12 % left parenthesis
\catcode41 12 % right parenthesis
\catcode45 12 % minus
\catcode46 12 % period
\catcode60 12 % less
\catcode61 12 % equals
\catcode62 12 % greater
\catcode64 12 % at
\catcode91 12 % left square
\catcode93 12 % right square
\catcode96 12 % back tick
\catcode123 1 % left curly brace
\catcode125 2 % right curly brace
\catcode126 12 % tilde
\catcode`\#=6 %
\escapechar=92 %
\def\IfUndefined#1#2#3{%
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname#1\endcsname\relax
#2%
\else
#3%
\fi
}
\def\pdffilehex{5F6D61696E5F66696C65732F6669677572652D6C617465782F4669677572654131322D312E706466}
\IfUndefined{pdfunescapehex}{%
\begingroup
\gdef\pdffile{}%
\def\do#1#2{%
\ifx\relax#2\relax
\ifx\relax#1\relax
\else
\errmessage{Invalid hex string, should not happen!}%
\fi
\else
\lccode`0="#1#2\relax
\lowercase{%
\xdef\pdffile{\pdffile0}%
}%
\expandafter\do
\fi
}%
\expandafter\do\pdffilehex\relax\relax
\endgroup
}{%
\edef\pdffile{\pdfunescapehex{\pdffilehex}}%
}
\immediate\write-1{Input file: \pdffile}
\pdfoutput=1 %
\pdfcompresslevel=9 %
\csname pdfmapfile\endcsname{}
\def\setpdfversion#1{%
\IfUndefined{pdfobjcompresslevel}{%
}{%
\ifnum#1<5 %
\pdfobjcompresslevel=0 %
\else
\pdfobjcompresslevel=2 %
\fi
}%
\IfUndefined{pdfminorversion}{%
\IfUndefined{pdfoptionpdfminorversion}{%
}{%
\pdfoptionpdfminorversion=#1\relax
}%
}{%
\pdfminorversion=#1\relax
}%
}
\def\page #1 [#2 #3 #4 #5]{%
\count0=#1\relax
\setbox0=\hbox{%
\pdfximage page #1 mediabox{\pdffile}%
\pdfrefximage\pdflastximage
}%
\pdfhorigin=-#2bp\relax
\pdfvorigin=#3bp\relax
\pdfpagewidth=#4bp\relax
\advance\pdfpagewidth by -#2bp\relax
\pdfpageheight=#5bp\relax
\advance\pdfpageheight by -#3bp\relax
\ht0=\pdfpageheight
\shipout\box0\relax
}
\def\pageclip #1 [#2 #3 #4 #5][#6 #7 #8 #9]{%
\count0=#1\relax
\dimen0=#4bp\relax \advance\dimen0 by -#2bp\relax
\edef\imagewidth{\the\dimen0}%
\dimen0=#5bp\relax \advance\dimen0 by -#3bp\relax
\edef\imageheight{\the\dimen0}%
\pdfximage page #1 mediabox{\pdffile}%
\setbox0=\hbox{%
\kern -#2bp\relax
\lower #3bp\hbox{\pdfrefximage\pdflastximage}%
}%
\wd0=\imagewidth\relax
\ht0=\imageheight\relax
\dp0=0pt\relax
\pdfhorigin=#6pt\relax
\pdfvorigin=#7bp\relax
\pdfpagewidth=\imagewidth
\advance\pdfpagewidth by #6bp\relax
\advance\pdfpagewidth by #8bp\relax
\pdfpageheight=\imageheight\relax
\advance\pdfpageheight by #7bp\relax
\advance\pdfpageheight by #9bp\relax
\pdfxform0\relax
\shipout\hbox{\pdfrefxform\pdflastxform}%
}%
\def\pageinclude#1{%
\pdfhorigin=0pt\relax
\pdfvorigin=0pt\relax
\pdfximage page #1 mediabox{\pdffile}%
\setbox0=\hbox{\pdfrefximage\pdflastximage}%
\pdfpagewidth=\wd0\relax
\pdfpageheight=\ht0\relax
\advance\pdfpageheight by \dp0\relax
\shipout\hbox{%
\raise\dp0\box0\relax
}%
}
\setpdfversion{4}