3 %% This is file 'pdfdraftcopy.sty',
4 %% generated with the docstrip utility.
6 %% The original source files were:
9 %% pdfdraftcopy.dtx (with options: 'package')
11 %% File: pdfdraftcopy.dtx Copyright (c) 2003, C. V. Radhakrishnan
13 %% River Valley Technologies, Floor III, SJP Buildings
14 %% Cotton Hills, Trivandrum, India 695014
15 %% http://www.river-valley.com
17 %% This package may be distributed under the terms of the LaTeX Project
18 %% Public License, as described in lppl.txt in the base LaTeX distribution.
19 %% Either version 1.0 or, at your option, any later version.
21 %% $Id: pdfdraftcopy.sty,v 1.2 2003/08/11 20:31:07 cvr Exp cvr $
23 \NeedsTeXFormat{LaTeX2e
}
24 \def\Fileversion$
#1:
#2 $
{\gdef\fileversion{#2}}
25 \def\Filedate$
#1:
#2 #3 $
{\gdef\filedate{#2}}
26 \Fileversion$Revision:
1.2 $
27 \Filedate$Date:
2003/
08/
11 20:
31:
07 $
28 \ProvidesPackage{pdfdraftcopy
}
29 [\filedate\space\fileversion\space Draft copy in PDF (CVR)
]
30 \PackageWarningNoLine{pdfdraftcopy
}
31 {****************************************
\MessageBreak
32 Package pdfdraftcopy v,
\fileversion\space loaded
\MessageBreak
33 [Draft copy in PDF (CVR)
]\MessageBreak
34 ****************************************
}
35 \DeclareOption{watermark
}{\AtBeginDocument{%
36 \begingroup\watermark\endgroup}}
37 \DeclareOption{draft
}{\AtBeginDocument{%
38 \begingroup\draftcopy\endgroup}}
39 \ExecuteOptions{draft
}
42 \RequirePackage{color,
graphicx}
44 \let\@DRAFTout@Hook\@empty
45 \newcommand{\DRAFTout}{\g@addto@macro\@DRAFTout@Hook
}
46 \newcommand{\@DRAFTout@Out
}{%
47 \afterassignment\@DRAFTout@Test
48 \global\setbox\@cclv=
%
50 \newcommand{\@DRAFTout@Test
}{%
52 \aftergroup\@DRAFTout@Output
57 \newcommand{\@DRAFTout@Output
}{%
59 \@DRAFTout@Org@Out
\box\@cclv
%
61 \newcommand{\@DRAFTout@Org@Out
}{}
62 \newcommand*
{\@DRAFTout@Init
}{%
63 \let\@DRAFTout@Org@Out
\shipout
64 \let\shipout\@DRAFTout@Out
66 \AtBeginDocument{\@DRAFTout@Init
}
67 \newcommand{\@DraftOverlay@Hook
}{}
68 \newcommand{\AddToDraftOverlay}{\g@addto@macro\@DraftOverlay@Hook
}
69 \newcommand{\ClearDraftOverlay}{\let\@DraftOverlay@Hook\@empty
}
70 \newcommand{\@DraftOverlay
}{%
71 \ifx\@DraftOverlay@Hook\@empty
76 \@tempcntb=-\@tempdima
77 \advance\@tempcntb
\paperheight
78 \global\setbox\@cclv
\vbox{%
79 \vbox{\let\protect\relax%
81 \pictur@(
0,
0)(\@tempcnta,\@tempcntb)
%
90 \definecolor{gray30
}{gray
}{.7}
91 \definecolor{gray20
}{gray
}{.8}
92 \definecolor{gray10
}{gray
}{.9}
94 \DRAFTout{\@DraftOverlay
}
100 \newdimen\bottommargin
101 \def\@printdimen
{%\ifthenelse{\equal{\@debug}{true}}%
102 {\PackageWarningNoLine{PDFdraftcopy
}%
103 {\LLX::::::::::::=
\the\LLX\MessageBreak
104 \LLY::::::::::::=
\the\LLY\MessageBreak
105 \URX::::::::::::=
\the\URX\MessageBreak
106 \URY::::::::::::=
\the\URY\MessageBreak
107 \oddsidemargin::=
\the\oddsidemargin\MessageBreak
108 \evensidemargin:=
\the\evensidemargin\MessageBreak
109 \textheight:::::=
\the\textheight\MessageBreak
110 \textwidth::::::=
\the\textwidth\MessageBreak
111 \paperwidth:::::=
\the\paperwidth\MessageBreak
112 \paperheight::::=
\the\paperheight\MessageBreak
113 \topmargin::::::=
\the\topmargin\MessageBreak
114 \headheight:::::=
\the\headheight\MessageBreak
115 \headsep::::::::=
\the\headsep\MessageBreak
116 \footskip:::::::=
\the\footskip\MessageBreak
117 \topskip::::::::=
\the\topskip\MessageBreak
118 Now fixing the overlay in place
122 \setlength\LLY{\paperheight}
123 \addtolength\LLY{-
\textheight}
124 \addtolength\LLY{-
\headheight}
125 \addtolength\LLY{-
\headsep}
126 \addtolength\LLY{-
1in
}
127 \addtolength\LLY{-
3pt
}
130 \addtolength\LLX{\oddsidemargin}\else
131 \addtolength\LLX{\evensidemargin}\fi
132 \setlength\URX{\textwidth}
133 \setlength\URY{\textheight}
135 \def\LoadWaterMark{\watermark}
136 \def\watermark{\AddToDraftOverlay{%
137 \@DRAFTdimen
%\@printdimen%
138 \setlength{\@tempdima
}{0pt
}
139 \setlength{\@tempdimb
}{\paperwidth}
140 \addtolength{\@tempdimb
}{-\@tempdima
}
141 \addtolength{\@tempdimb
}{-\@tempdima
}
142 \setlength{\@tempdimc
}{\paperheight}
143 \addtolength{\@tempdimc
}{-\@tempdima
}
144 \addtolength{\@tempdimc
}{-\@tempdima
}
145 \setlength{\unitlength}{1pt
}\thinlines%
147 \put(
0,
\strip@pt
\paperheight)
{\fboxrule0pt\fboxsep0pt%
148 %\fcolorbox{white}{red}%
149 {\begin{minipage
}[t
][\paperheight][c
]{\paperwidth}
151 \ifx\@@watermark\@empty
\relax\else
152 \includegraphics%[width=\paperwidth,height=\paperheight]%
156 \let\@@watermark\@empty
157 \def\watermarkgraphic#1{\gdef\@@watermark
{#1}}
159 \def\draftcopy{\AddToDraftOverlay{%
160 \@DRAFTdimen
%\@printdimen%
161 \setlength{\@tempdima
}{0pt
}
162 \setlength{\@tempdimb
}{\paperwidth}
163 \addtolength{\@tempdimb
}{-\@tempdima
}
164 \addtolength{\@tempdimb
}{-\@tempdima
}
165 \setlength{\@tempdimc
}{\paperheight}
166 \addtolength{\@tempdimc
}{-\@tempdima
}
167 \addtolength{\@tempdimc
}{-\@tempdima
}
168 \setlength{\unitlength}{1pt
}\thinlines%
170 \put(
0,
\strip@pt
\paperheight)
{\fboxrule0pt\fboxsep0pt%
171 %\fcolorbox{white}{red}%
172 {\begin{minipage
}[t
][\paperheight][c
]{\paperwidth}
175 \rotatebox{\@draftangle
}{\color{\@draftcolor
}
176 \fontfamily{\@draftfontfamily
}%
177 \fontsize{\@draftfontsize
}{\@draftfontsize
}\selectfont
178 {\@draftfontattrib\@draftstring
}
183 \def\@draftstring
{DRAFT COPY
}
184 \def\@draftcolor
{gray10
}
185 \def\@draftfontfamily
{ptm
}
186 \def\@draftfontsize
{80}
187 \def\@draftfontattrib
{\upshape}
188 \def\draftstring#1{\gdef\@draftstring
{#1}}
189 \def\draftcolor#1{\gdef\@draftcolor
{#1}}
190 \def\draftfontfamily#1{\gdef\@draftfontfamily
{#1}}
191 \def\draftfontsize#1{\gdef\@draftfontsize
{#1}}
192 \def\draftfontattrib#1{\gdef\@draftfontattrib
{#1}}
193 \def\draftangle#1{\gdef\@draftangle
{#1}}
197 %% End of package 'pdfdraftcopy.sty'