summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/pdf14/pdf14.dtx
blob: 9f94d912e4eaffd7c1e3864366f607394545d4aa (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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
% \iffalse meta-comment
%
% pdf14.dtx
%
% Written in 2010 by Manuel P\'egouri\'e-Gonnard <mpg@elzevir.fr>.
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Manuel P\'egouri\'e-Gonnard.
%
% This work consists of the source file pdf14.dtx
% and the derived files pdf14.sy, pdf14.pdf, test-pdf14.tex.
%
% Unpacking:
%    tex pdf14.dtx
% Documentation:
%    pdflatex pdf14.dtx
%
%<*ignore>
\begingroup
  \def\x{LaTeX2e}%
\expandafter\endgroup
\ifcase 0\ifx\install y1\fi\expandafter
         \ifx\csname processbatchFile\endcsname\relax\else1\fi
         \ifx\fmtname\x\else 1\fi\relax
\else\csname fi\endcsname
%</ignore>
%<*install>
\input docstrip.tex

\keepsilent
\askforoverwritefalse

\preamble

Written in 2010 by Manuel P\string\'egouri\string\'e-Gonnard <mpg@elzevir.fr>.

This work can be distributed and/or modified under the terms of the LPPL.
This is a generated file, see source file \inFileName for more details.

\endpreamble

\generate{%
  \file{pdf14.sty}{\from{pdf14.dtx}{package}}%
  \file{test-pdf14.tex}{\from{pdf14.dtx}{testfile}}%
}

\obeyspaces
\Msg{************************************************************************}
\Msg{*}
\Msg{* To finish the installation you have to move the following}
\Msg{* file into a directory searched by TeX:}
\Msg{*}
\Msg{*     pdf14.sty}
\Msg{*}
\Msg{* Happy TeXing!}
\Msg{*}
\Msg{************************************************************************}

\endbatchfile
%</install>
%<*ignore>
\fi
%</ignore>
%<*driver>
\documentclass{ltxdoc}
\usepackage[ascii]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[a4paper]{geometry}
\usepackage{xspace}
\usepackage[babel=true, expansion=false]{microtype}
\usepackage[english]{babel}
\usepackage{hyperref}
\usepackage{bookmark}

\newcommand\pf{\textsf}
\newcommand\mailto[1]{\href{mailto:#1}{<#1>}}
\newcommand\texlive{\TeX\,Live\xspace}

\begin{document}
\DocInput{pdf14.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{0}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \title{The \pf{pdf14} \LaTeX\ package}
% \date{2010/03/26 v0.1}
% \author{Manuel P\'egouri\'e-Gonnard \mailto{mpg@elzevir.fr}}
%
% \maketitle
%
% \begin{abstract}
% Starting with \texlive 2010, the various formats that directly generate PDF
% default to PDF 1.5. While this allows for more compact documents thanks to
% objects compression, it can also lead to compatibility issues with some
% older PDF viewers.\footnote{For reference, Adobe Reader 6.0, released in
% 2003, was the first reader to handle PDF 1.5.} This package changes back the
% version of generated PDF to 1.4 with formats based on pdf\TeX{} or Lua\TeX\
% in PDF mode, for documents that need to achieve maximal compatibility with
% old viewers.
%
% If you need to generate maximally compatible documents, you may also be
% interested in the \pf{pdfx} package.
% \end{abstract}
%
% \section{Documentation}
%
% Just load this package, preferably right after the \verb+\documentclass+
% command. That's it. The rest of this documentation describes possible
% problems that may arise under particular circumstances.
%
% The \pf{pdf14} package should be loaded as early as possible in order to
% avoid problems. If you run into an error like:
% \begin{verbatim}
% ! pdfTeX error (setup): \pdfminorversion cannot be changed after data is
% written to the PDF file.
% \end{verbatim}
% it probably means that some package loaded before \pf{pdf14} did write data
% to the PDF file. In case the document class is (indirectly) doing it, you'll
% need to load \pf{pdf14} even before the \verb+\documentclass+ command, using
% \verb+\RequirePackage{pdf14}+ as the first line of your source file.
%
% Also, another package might try to set the PDF version itself, likely because
% it is going to use some advanced PDF features. Currently, no check for this
% is done by \pf{pdf14} to guard against this. So, it is your responsibility
% to check that the document produced are actually PDF 1.4.\footnote{You may
% do so using \texttt{pdfinfo} from the Xpdf distribution, or the
% File$\to$Properties menu of Acrobat Reader.} Future versions of \pf{pdf14}
% may include such a check, but it could only guarantee that the
% \emph{declared} PDF version has not been changed, not that the file produced
% is actually correct PDF 1.4.\footnote{Unfortunately, some packages are known
% to use features available only in PDF 1.5 and greater without properly
% setting the declared PDF version.}
%
%    \section{Implementation}
%
%    \begin{macrocode}
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{pdf14}[2010/03/26 v0.1  Generate PDF 1.4 documents (mpg)]
%    \end{macrocode}
%
%    Check if we are running pdf\TeX\ or Lua\TeX\ in PDF mode. If not, issue
%    an information message and exit. Since we address only \LaTeX-based
%    formats in \texlive, we can assume that \verb|\pdfoutput| is available.
%    (We don't load \pf{ifpdf} in order to avoid loading too many packages
%    before \verb+\documentclass+.)
%
%    \begin{macrocode}
\begingroup
\def\x{%
  \PackageInfo{pdf14}{%
    You are not running pdfTeX (or LuaTeX) in PDF mode.\MessageBreak
    Package pdf14 is useless in this case. Skipping.}%
  \endinput}
\expandafter\ifx\csname pdfoutput\endcsname\relax \else
  \ifnum\pdfoutput<1 \else
    \def\x{}%
  \fi
\fi
\expandafter\endgroup
\x
%    \end{macrocode}
%
%    Actually set the values if the corresponding primitives are available.
%
%    \begin{macrocode}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname pdfminorversion\endcsname\relax \else
  \pdfminorversion4\relax
\fi
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname pdfobjcompresslevel\endcsname\relax \else
  \pdfobjcompresslevel0\relax
\fi
%    \end{macrocode}
%
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%
%    \section{Test}
%
%    Minimal \LaTeX\ file actually producing some output, just to check that
%    the package loads correctly, and that the produced file is actually PDF
%    1.4 (see the Makefile).
%
%    \begin{macrocode}
%<*testfile>
\documentclass{minimal}
\usepackage{pdf14}
\begin{document}
Bla.
\end{document}
%</testfile>
%    \end{macrocode}
%
%
% \Finale
\endinput