summaryrefslogtreecommitdiff
path: root/obsolete/support/png2pdf/DOCU/usage.html
blob: 15bd3916ff9a2d02a2e3dcf9b186d720630085df (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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<html>
<head>
<title>png2pdf - Convert PNG images to PDF</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="header">
<p>
<table width="100%" class="headertable">
<tr class="headertr">
<td class="headertdleft" rowspan="2"><img src="./png2pdf-logo.png"></td>
<td class="headertdleft"><h1>png2pdf</h1></td>
<td class="headertdright" rowspan="2">
<a target="_blank" href="http://sourceforge.net/"><img src="sflogo.png" width="210" height="62" border="0" alt="SourceForge.net Logo"/></a>
</td>
</tr>
<td class="headertdleft"><span class="subtitle">Convert <u>PNG</u> images <u>to</u> <u>PDF</u></span></td>
</tr>
</table>
<table width="100%" class="navimenutable">
<tr class="navimenutr">
<td class="navimenutd">
<a class="navimenulink" href="index.html">Overview</a>&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;<a class="navimenulink" href="install.html">Installation</a>&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;<span class="navimenucurrent">Usage</span>&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;<a class="navimenulink" href="ppgui.html">GUI</a>&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;<a class="navimenulink" href="faq.html">FAQ</a>&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;<a class="navimenulink" href="changes.html">Change&nbsp;Log</a>&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;<a class="navimenulink" href="projects.html">Other&nbsp;Projects</a>
</td>
</tr>
</table>
</p>
</div>
<div class="text">

<table width="100%">
<tr>
<td class="h2tdleft"><h2>Usage</h2></td>
<td class="h2tdright"><a class="smallotherlink" href="png2pdf.pdf">PDF manual "png2pdf.pdf" available</a></td>
</tr>
</table>

<table width="100%" class="toctable">
<tr class="tocrow">
<td width="5%"></td>
<td class="toctd" colspan="6"><a class="toclink" href="#h301">Overview</a></td>
</tr>
<tr class="tocrow">
<td width="5%"></td>
<td class="toctd" colspan="6"><a class="toclink" href="#h302">Options</a></td>
</tr>
<tr class="tocrow">
<td width="5%"></td>
<td class="toctd" colspan="6"><a class="toclink" href="#h303">Example</a></td>
</tr>
<tr class="tocrow">
<td width="5%"></td>
<td width="5%"></td>
<td class="toctd" colspan="5"><a class="toclink" href="#h401">Original image and pdfLaTeX source</a></td>
</tr>
<tr class="tocrow">
<td width="5%"></td>
<td width="5%"></td>
<td class="toctd" colspan="5"><a class="toclink" href="#h402">PDF image, white background</a></td>
</tr>
<tr class="tocrow">
<td width="5%"></td>
<td width="5%"></td>
<td class="toctd" colspan="5"><a class="toclink" href="#h403">Background color</a></td>
</tr>
<tr class="tocrow">
<td width="5%"></td>
<td width="5%"></td>
<td class="toctd" colspan="5"><a class="toclink" href="#h404">Background effects</a></td>
</tr>
</table>

<a name="h301"><h3>Overview</h3></a>
<p>
The program can be invoked by typing
<pre>
  png2pdf [&lt;options&gt;]
  png2pdf [&lt;options&gt;] &lt;input-file&gt; &lt;output-file&gt;
  png2pdf [&lt;options&gt;] &lt;directory&gt;
</pre>
If no file name is specified the program runs on the current directory.
When running on a directory the program checks the directory for
PNG file and converts all PNG files to PDF.<br>
</p>
<a name="h302"><h3>Options</h3></a>
<p>
The following options can be used:
<ul>
<li>-p <it>pdf-level</it><br>
--pdf=<it>pdf-level</it><br>
specifies the PDF level to use (may be "1.2", "1.3" or "1.4"). By default
PDF&nbsp;1.4 is produced.
</li>
<li>-a<br>
-a-<br>
--transparency=<it>boolean</it><br>
specifies whether or not to transfer an alpha channel from the PNG
file into the PDF file.
</li>
<li>-i<br>
-i-<br>
--image-mask=<it>boolean</it><br>
specifies whether or not to convert the PNG alpha channel into a
PDF image mask.<br>Note: alpha channel transfer and image mask creation
can not be used at same time.
</li>
<li>-m <it>RGB-triple</it><br>
--mix-background=<it>RGB-triple</it><br>
mixes all pixels against the background color specified in the PNG
file's background chunk. If there is no background chunk the <it>RGB-triple</it>
is used.<br>Note: Mixing and alpha channel transfer (-a) can not be used
at same time.
</li>
<li>-s<br>
-s-<br>
--mix-specified=<it>boolean</it><br>
sets priority for -m <it>RGB-triple</it> higher than PNG file background chunk.
The -m <it>RGB-triple</it> is used always.
</li>
<li>-l<br>
-l-<br>
--invert-levels=<it>boolean</it><br>
inverts the trigger level used for image mask creation. By default only
opacity=0 pixels are masked, inverting results in masking all pixels except
those having full opacity.
</li>
<li>-t<br>
-t-<br>
--alpha-transparency=<it>boolean</it><br>
interprets alpha channel data as transparency instead of opacity.
</li>
<li>-n<br>
--interpolation<br>
adds an entry to the image dictionary indicating that viewers should
attempt an image interpolation on the picture (see
<a class="linkinternal" href="interpolate.html">example</a>).<br>
Use with care. Different software may use different algorithms.
The representation of the image may vary depending on the software
and output device you use.
</li>
<li>-f<br>
-f-<br>
--file-time-check=<it>boolean</it><br>
enables/disables file time check when running on a directory.
If file time check is enabled, a conversion is only started for PNGs
which have have no corresponding PDF file or a PDF file older than
the PNG file.
</li>
<li>-h<br>
--help<br>
prints a help text.
</li>
<li>-v<br>
--version<br>
prints version information.
</li>
<li>-c &lt;options&gt;<br>
--configure &lt;options&gt;<br>
sets <it>options</it> as permanent options, stored in the preferences system.
</li>
<li>-C<br>
--show-configuration<br>
prints a summary information about permanent options.
</li>
<li>-r &lt;options&gt;<br>
--reset &lt;options&gt;<br>
overrides (ignores) the permanent options for this one program invokation.
The program starts based on compiled-in defaults and processes options
given explicitely on the command line. This is intended for program usage
in scripts where we want to have a well-defined startup.
</li>
<li>-u<br>
--unconfigure<br>
removes all permanent options.
</li>
</ul>
</p>
<a name="h303"><h3>Examples</h3></a>
<a name="h401"><h4>Original image and pdfLaTeX source</h4></a>
<p>
In the examples the image stefan_255_rgba.png from the PNG web site
is used.<br>
<img width="162" height="150" src="stefan_255_rgba.png"/>
<br>&nbsp;<br>
If the image is included into a pdfLaTeX source
<pre>
  \documentclass[12pt,a4paper,titlepage]{article}
  \usepackage{ifpdf}        % LaTeX or pdfLaTeX
  \usepackage{color}        % we want to use background color
  \usepackage{graphicx}
  \ifpdf
  \usepackage{background}   % for the background effects, PPower4 necessary
  \fi
  \definecolor{bgred}{rgb}{1.0,0.501961,0.501961}
  ...
  \begin{document}
  ...
  \begin{figure}
  {\centering
  \includegraphics[width=5cm]{stefan_255_rgba.png}
  \caption{Some caption}
  \label{fig:some-label}
  }
  \end{figure}
  ...
  \end{document}
</pre>
the result looks like shown in image 1:<br>&nbsp;<br>
<img width="489" height="253" src="capa01.png"/>
<br>&nbsp;<br>
</p>
<a name="h402"><h4>PDF image, white background</h4></a>
<p>
If we create a PDF file using
<pre>
  png2pdf -m 255,255,255 -s stefan_255_rgba.png x1.pdf
</pre>
and change the pdfLaTeX source to
<pre>
  ...
  \begin{figure}
  {\centering
  \includegraphics[width=5cm]{x1.pdf}
  \caption{Some caption}
  \label{fig:some-label}
  }
  \end{figure}
  ...
</pre>
the result looks like shown in image 2:<br>&nbsp;<br>
<img width="489" height="253" src="capa02.png"/>
</p>
<a name="h403"><h4>Background color</h4></a>
<p>
To obtain a colored background we add
<pre>
  \pagecolor{bgred}
</pre>
to the pdfLaTeX source and run the conversion
<pre>
  png2pdf -m 255,128,128 -s stefan_255_rgba.png x1.pdf
</pre>
The result is shown in image 3:<br>&nbsp;<br>
<img width="489" height="253" src="capa03.png"/>
</p>
<a name="h404"><h4>Background effects</h4></a>
<p>
Now we use
<pre>
  \vpagecolor{bgred}
</pre>
to produce a background effect. Note: Post-processing using PPower4
is necessary to make the effect visible.<br>
Using the existing image x1.pdf produces output as shown in
figure 4:<br>&nbsp;<br>
<img width="490" height="253" src="capa04.png"/>
<br>&nbsp;<br>A red rectangle shows the extents of the image.<br>
Toe remove the rectange we create an image mask while converting
the picture using
<pre>
  png2pdf -m 255,128,128 -s -i stefan_255_rgba.png x1.pdf
</pre>
Output is shown in image 5. There is still some kind of border
around the shadow.<br>&nbsp;<br>
<img width="489" height="253" src="capa05.png"/>
<br>&nbsp;<br>So we decide to transfer the alpha channel from
the PNG file into the PDF file using
<pre>
  png2pdf -m 255,128,128 -s -a stefan_255_rgba.png x1.pdf
</pre>
Output is now as expected (image 6).<br>&nbsp;<br>
<img width="489" height="253" src="capa06.png"/>
</p>
</div>
<div class="footer">
<p>
<table width="100%" class="footertable">
<tr class="footertr">
<td class="footertdleft">Dirk Krause</td>
<td class="footertdcenter">http://png2pdf.sourceforge.net</td>
<td class="footertdright">2005/02/01</td>
</tr>
</table>
</p>
</div>
</body>
</html>