1GROPDF(1) General Commands Manual GROPDF(1)
2
3
4
6 gropdf - PDF driver for groff
7
9 gropdf [-delvs] [-F dir] [-p papersize] [-y foundry] [-u [cmapfile]]
10 [files ...]
11
12 It is possible to have whitespace between a command line option and its
13 parameter.
14
16 gropdf translates the output of GNU troff to PDF. Normally gropdf
17 should be invoked by using the groff command with a -Tpdf option. If
18 no files are given, gropdf reads the standard input. A filename of -
19 also causes gropdf to read the standard input. PDF output is written
20 to the standard output. When gropdf is run by groff options can be
21 passed to gropdf using groff's -P option.
22
23 See section FONT INSTALLATION below for a guide how to install fonts
24 for gropdf.
25
27 -d Include debug information as comments within the PDF. Also pro‐
28 duces an uncompressed PDF.
29
30 -e Force all fonts to be embedded in the PDF.
31
32 -Fdir Prepend directory dir/devname to the search path for font, and
33 device description files; name is the name of the device, usu‐
34 ally pdf.
35
36 -l Print the document in landscape format.
37
38 -ppaper-size
39 Set physical dimension of output medium. This overrides the
40 papersize, paperlength, and paperwidth commands in the DESC
41 file; it accepts the same arguments as the papersize command.
42 See groff_font (5) for details.
43
44 -v Print the version number.
45
46 -yfoundry
47 Set the foundry to use for selecting fonts of the same name.
48
49 -e Forces gropdf to embed ALL fonts (even the 14 base PDF fonts).
50
51 -s Append a comment line to end of PDF showing statistics, i.e.
52 number of pages in document. Ghostscript's ps2pdf complains
53 about this line if it is included, but works anyway.
54
55 -u
56 -ucmapfilename
57 Gropdf normally includes a ToUnicode CMap with any font created
58 using text.enc as the encoding file, this makes it easier to
59 search for words which contain ligatures. You can include your
60 own CMap by specifying a cmapfilename or have no CMap at all by
61 omitting the argument.
62
64 The input to gropdf must be in the format output by troff(1). This is
65 described in groff_out(5).
66
67 In addition, the device and font description files for the device used
68 must meet certain requirements: The resolution must be an integer mul‐
69 tiple of 72 times the sizescale. The pdf device uses a resolution of
70 72000 and a sizescale of 1000.
71
72 The device description file must contain a valid paper size; see
73 groff_font(5) for more information. gropdf uses the same Type 1 Adobe
74 postscript fonts as the grops device driver. Although the PDF Standard
75 allows the use of other font types (like TrueType) this implementation
76 only accepts the Type 1 postscript font. Fewer Type 1 fonts are sup‐
77 ported natively in PDF documents than the standard 35 fonts supported
78 by grops and all postscript printers, but all the fonts are available
79 since any which aren't supported natively are automatically embedded in
80 the PDF.
81
82 gropdf supports the concept of foundries, that is different versions of
83 basically the same font. During install a Foundry file controls where
84 fonts are found and builds groff fonts from the files it discovers on
85 your system.
86
87 Each font description file must contain a command
88
89 internalname psname
90
91 which says that the PostScript name of the font is psname. Lines
92 starting with # and blank lines are ignored. The code for each charac‐
93 ter given in the font file must correspond to the code in the default
94 encoding for the font. This code can be used with the \N escape
95 sequence in troff to select the character, even if the character does
96 not have a groff name. Every character in the font file must exist in
97 the PostScript font, and the widths given in the font file must match
98 the widths used in the PostScript font.
99
100 Note that gropdf is currently only able to display the first 256 glyphs
101 in any font. This restriction will be lifted in a later version.
102
103 gropdf can automatically include the downloadable fonts necessary to
104 print the document. Fonts may be in PFA or PFB format.
105
106 Any downloadable fonts which should, when required, be included by
107 gropdf must be listed in the file
108 /usr/share/groff/1.22.3/font/devpdf/download; this should consist of
109 lines of the form
110
111 foundry font filename
112
113 where foundry is the foundry name or blank for the default foundry.
114 font is the PostScript name of the font, and filename is the name of
115 the file containing the font; lines beginning with # and blank lines
116 are ignored; fields must be separated by tabs (spaces are not allowed);
117 filename is searched for using the same mechanism that is used for
118 groff font metric files. The download file itself is also searched for
119 using this mechanism; currently, only the first found file in the font
120 path is used. Foundry names are usually a single character (such as
121 ‘U’ for the URW Foundry) or blank for the default foundry. This
122 default uses the same fonts as ghostscript uses when it embeds fonts in
123 a PDF file.
124
125 In the default setup there are styles called R, I, B, and BI mounted at
126 font positions 1 to 4. The fonts are grouped into families A, BM, C,
127 H, HN, N, P, and T having members in each of these styles:
128
129 AR AvantGarde-Book
130 AI AvantGarde-BookOblique
131 AB AvantGarde-Demi
132 ABI AvantGarde-DemiOblique
133 BMR Bookman-Light
134 BMI Bookman-LightItalic
135 BMB Bookman-Demi
136 BMBI Bookman-DemiItalic
137 CR Courier
138 CI Courier-Oblique
139 CB Courier-Bold
140 CBI Courier-BoldOblique
141 HR Helvetica
142 HI Helvetica-Oblique
143 HB Helvetica-Bold
144 HBI Helvetica-BoldOblique
145 HNR Helvetica-Narrow
146 HNI Helvetica-Narrow-Oblique
147 HNB Helvetica-Narrow-Bold
148 HNBI Helvetica-Narrow-BoldOblique
149 NR NewCenturySchlbk-Roman
150 NI NewCenturySchlbk-Italic
151 NB NewCenturySchlbk-Bold
152 NBI NewCenturySchlbk-BoldItalic
153 PR Palatino-Roman
154 PI Palatino-Italic
155 PB Palatino-Bold
156 PBI Palatino-BoldItalic
157 TR Times-Roman
158 TI Times-Italic
159 TB Times-Bold
160 TBI Times-BoldItalic
161
162 There is also the following font which is not a member of a family:
163
164 ZCMI ZapfChancery-MediumItalic
165
166 There are also some special fonts called S for the PS Symbol font. The
167 lower case greek characters are automatically slanted (to match the
168 SymbolSlanted font (SS) available to postscript). Zapf Dingbats is
169 available as ZD, the "hand pointing left" glyph (\[lh]) is available
170 since it has been defined using the \X'pdf: xrev' extension which
171 reverses the direction of letters within words.
172
173 The default color for \m and \M is black; for colors defined in the
174 ‘rgb’ color space setrgbcolor is used, for ‘cmy’ and ‘cmyk’ setcmyk‐
175 color, and for ‘gray’ setgray. Note that setcmykcolor is a PostScript
176 LanguageLevel 2 command and thus not available on some older printers.
177
178 gropdf understands some of the X commands produced using the \X escape
179 sequences supported by grops. Specifically, the following is sup‐
180 ported.
181
182 \X'ps: invis'
183 Suppress output.
184
185 \X'ps: endinvis'
186 Stop suppressing output.
187
188 \X'ps: exec gsave currentpoint 2 copy translate n rotate neg exch neg
189 exch translate'
190 where n is the angle of rotation. This is to support the align
191 command in gpic.
192
193 \X'ps: exec grestore'
194 Again used by gpic to restore after rotation.
195
196 \X'ps: exec n setlinejoin'
197 where n can be one of the following values.
198
199 0 = Miter join
200 1 = Round join
201 2 = Bevel join
202
203 \X'ps: exec n setlinecap'
204 where n can be one of the following values.
205
206 0 = Butt cap
207 1 = Round cap, and
208 2 = Projecting square cap
209
210 \X'ps: ... pdfmark'
211 All the pdfmark macros installed by using -m pdfmark or -m mspdf
212 (see documentation in ‘pdfmark.pdf’). A subset of these macros
213 are installed automatically when you use -Tpdf so you should not
214 need to use ‘-m pdfmark’ for using most of the PDF functional‐
215 ity.
216
217 All other ps: tags are silently ignored.
218
219 One \X special used by the DVI driver is also recognised:
220
221 \X'papersize=paper-size'
222 where the paper-size parameter is the same as the papersize com‐
223 mand. See groff_font(5) for details. This means that you can
224 alter the page size at will within the PDF file being created by
225 gropdf. If you do want to change the paper size, it must be
226 done before you start creating the page.
227
228 In addition, gropdf supports its own suite of pdf: tags. The following
229 tags are supported:
230
231 \X'pdf: pdfpic file alignment width height line-length'
232 Place an image of the specified width containing the PDF drawing
233 from file file of desired width and height (if height is missing
234 or zero then it is scaled proportionally). If alignment is -L
235 the drawing is left aligned. If it is -C or -R a linelength
236 greater than the width of the drawing is required as well. If
237 width is specified as zero then the width is scaled in propor‐
238 tion to the height.
239
240 \X'pdf: xrev'
241 This toggles a flag which reverses the direction of printing
242 letter by letter, i.e., each separate letter is reversed, not
243 the entire word. This is useful for reversing the direction of
244 glyphs in the Dingbats font. To return to normal printing
245 repeat the command again.
246
247 \X'pdf: markstart /ANN definition'
248 The macros which support PDF Bookmarks use this call internally
249 to start the definition of bookmark hotspot (user will have
250 called ‘.pdfhref L’ with the text which will become the ‘hot
251 spot’ region). Normally this is never used except from within
252 the pdfmark macros.
253
254 \X'pdf: markend'
255 The macros which support PDF Bookmarks use this call internally
256 to stop the definition of bookmark hotspot (user will have
257 called ‘.pdfhref L’ with the text which will become the ‘hot
258 spot’ region). Normally this is never used except from within
259 the pdfmark macros.
260
261 \X'pdf: marksuspend'
262 \X'pdf: markrestart'
263 If you are using page traps to produce headings, footings, etc.,
264 you need to use these in case a ‘hot spot’ crosses a page bound‐
265 ary, otherwise any text output by the heading or footing macro
266 will be marked as part of the ‘hot spot’. To stop this happen‐
267 ing just place ‘.pdfmarksuspend’ and ‘.pdfmarkrestart’ at the
268 start and end of the page trap macro, respectively. (These are
269 just convenience macros which emit the \X code. These macros
270 must only be used within page traps.)
271
272 Importing graphics
273 gropdf only supports importing other PDF files as graphics. But that
274 PDF file may contain any of the graphic formats supported by the PDF
275 standard (such as JPEG, PNG, GIF, etc.). So any application which out‐
276 puts PDF can be used as an embedded file in gropdf. The PDF file you
277 wish to insert must be a single page and the drawing must just fit
278 inside the media size of the PDF file. So, in inkscape(1) or gimp(1)
279 (for example) make sure the canvas size just fits the image.
280
281 The PDF parser used in gropdf has not been rigorously tested with all
282 possible applications which produce PDFs. If you find a single page
283 PDF which fails to import properly, it is worth running it through the
284 pdftk(1) program by issuing the command:
285
286 pdftk oldfile.pdf output newfile.pdf
287
288 You may find that newfile.pdf will now load successfully.
289
290 TrueType and other font formats
291 gropdf does not support any other fonts except Adobe Type 1 (PFA or
292 PFB).
293
295 This section gives a summary of the above explanations; it can serve as
296 a step-by-step font installation guide for gropdf.
297
298 · Convert your font to something groff understands. This is either a
299 PostScript Type 1 font in either PFA or PFB, together with an AFM
300 file.
301
302 The very first line in a PFA/PFB file contains this:
303
304 %!PS-AdobeFont-1.0:
305
306 A PFB file has this also in the first line, but the string is pre‐
307 ceded with some binary bytes.
308
309 · Convert the AFM file to a groff font description file with the
310 afmtodit(1) program. An example call is
311
312 afmtodit Foo-Bar-Bold.afm map/textmap FBB
313
314 which converts the metric file ‘Foo-Bar-Bold.afm’ to the groff font
315 ‘FBB’. If you have a font family which comes with normal, bold,
316 italic, and bold italic faces, it is recommended to use the letters
317 R, B, I, and BI, respectively, as postfixes in the groff font names
318 to make groff's ‘.fam’ request work. An example is groff's built-
319 in Times-Roman font: The font family name is T, and the groff font
320 names are TR, TB, TI, and TBI.
321
322 · Install both the groff font description files and the fonts in a
323 ‘devpdf’ subdirectory of the font path which groff finds. See the
324 ENVIRONMENT section in the troff(1) man page which lists the actual
325 value of the font path. Note that groff doesn't use the AFM files
326 (but it is a good idea to store them anyway).
327
328 · Register all fonts which must be downloaded to the printer in the
329 ‘devpdf/download’ file. Only the first occurrence of this file in
330 the font path is read. This means that you should copy the default
331 ‘download’ file to the first directory in your font path and add
332 your fonts there. To continue the above example we assume that the
333 PS font name for Foo-Bar-Bold.pfa is ‘XY-Foo-Bar-Bold’ (the PS font
334 name is stored in the internalname field in the ‘FBB’ file) and
335 belongs to foundry ‘Fcq] thus the following line should be added to
336 ‘download’:
337
338 F XY-Foo-Bar-Bold Foo-Bar-Bold.pfa
339
340 Use a tab character to separate the fields, and the ‘foundry’ field
341 should be null for the default foundry.
342
344 GROFF_FONT_PATH
345 A list of directories in which to search for the devname direc‐
346 tory in addition to the default ones. If, in the ‘download’
347 file, the font file has been specified with a full path, no
348 directories are searched. See troff(1) and groff_font(5) for
349 more details.
350
352 /usr/share/groff/1.22.3/font/devpdf/DESC
353 Device description file.
354
355 /usr/share/groff/1.22.3/font/devpdf/F
356 Font description file for font F.
357
358 /usr/share/groff/1.22.3/font/devpdf/U-F
359 Font description file for font F (using foundry U rather than
360 the default foundry).
361
362 /usr/share/groff/1.22.3/font/devpdf/download
363 List of downloadable fonts.
364
365 /usr/share/groff/1.22.3/font/devpdf/Foundry
366 A Perl script used during install to locate suitable fonts.
367
368 /usr/share/groff/1.22.3/font/devpdf/enc/text.enc
369 Encoding used for text fonts.
370
371 /usr/share/groff/1.22.3/tmac/pdf.tmac
372 Macros for use with gropdf; automatically loaded by troffrc.
373
375 afmtodit(1), groff(1), grops(1), troff(1), grops(1), pfbtops(1),
376 groff_out(5), groff_font(5), groff_char(7), groff_tmac(5)
377
379 Copyright © 2011-2014 Free Software Foundation, Inc.
380
381 Permission is granted to make and distribute verbatim copies of this
382 manual provided the copyright notice and this permission notice are
383 preserved on all copies.
384
385 Permission is granted to copy and distribute modified versions of this
386 manual under the conditions for verbatim copying, provided that the
387 entire resulting derived work is distributed under the terms of a per‐
388 mission notice identical to this one.
389
390 Permission is granted to copy and distribute translations of this man‐
391 ual into another language, under the above conditions for modified ver‐
392 sions, except that this permission notice may be included in transla‐
393 tions approved by the Free Software Foundation instead of in the origi‐
394 nal English.
395
396
397
398Groff Version 1.22.3 4 November 2014 GROPDF(1)