Imported Upstream version 1.22.3
[platform/upstream/groff.git] / contrib / pdfmark / pdfroff.man
1 .TH PDFROFF @MAN1EXT@ "@MDATE@" "Groff Version @VERSION@"
2 .SH NAME
3 pdfroff \- create PDF documents using groff
4 .
5 .
6 .\" pdfroff.1
7 .\" File position: <groff-source>/contrib/pdfmark/pdfroff.man
8 .
9 .\" --------------------------------------------------------------------
10 .\" Legal Matters
11 .\" --------------------------------------------------------------------
12 .
13 .de co
14 Copyright \[co] 2005-2014 Free Software Foundation, Inc.
15
16 This file is part of groff, the free GNU roff type-setting system.
17
18 Permission is granted to copy, distribute and/or modify this document
19 under the terms of the GNU Free Documentation License (FDL), Version
20 1.3 or any later version published by the Free Software Foundation;
21 with no Front-Cover Texts, no Back-Cover Texts, and the following
22 Invariant Sections:--
23
24     a)  This "Legal Matters" section, extending from the definition of
25         .co to the end of the enclosing .au definition.
26
27     b) The entire sections bearing the heading "COPYING" and
28        "AUTHORS".
29
30 A copy of the Free Documentation License is included as a file called
31 FDL in the main directory of the groff source package, it is also
32 available in the internet at
33 .UR http://\:www.gnu.org/\:copyleft/\:fdl.html
34 the GNU copyleft site
35 .UE .
36 ..
37 .
38 .de au
39 It was originally written by
40 .MT keith.d.marshall@\:ntlworld.com
41 Keith Marshall
42 .ME ,
43 who also wrote the implementation of the
44 .I pdfroff
45 program, to which it relates.
46 ..
47 .
48 .\" --------------------------------------------------------------------
49 .\" Local macro definitions
50 .
51 .hw pdfmark
52 .
53 .de NH
54 .  hy 0
55 \&\\$*
56 .  hy
57 ..
58 .
59 .
60 .\" --------------------------------------------------------------------
61 .
62 .
63 .
64 .\" --------------------------------------------------------------------
65 .SH SYNOPSIS
66 .\" --------------------------------------------------------------------
67 .
68 .SY pdfroff
69 .OP \-abcegilpstzCEGNRSUVXZ
70 .OP \-d cs
71 .OP \-f fam
72 .OP \-F dir
73 .OP \-I dir
74 .OP \-L arg
75 .OP \-m name
76 .OP \-M dir
77 .OP \-n num
78 .OP \-o list
79 .OP \-P arg
80 .OP \-r cn
81 .OP \-T dev
82 .OP \-w name
83 .OP \-W name
84 .OP \-\-emit\-ps
85 .OP \-\-no\-toc\-relocation
86 .OP \-\-no-kill\-null\-pages
87 .OP \-\-stylesheet=\fIname\fP
88 .OP \-\-no\-pdf\-output
89 .OP \-\-pdf\-output=\fIname\fP
90 .OP \-\-no\-reference\-dictionary
91 .OP \-\-reference\-dictionary=\fIname\fP
92 .OP \-\-report\-progress
93 .OP \-\-keep\-temporary\-files
94 .I file .\|.\|.
95 .
96 .SY pdfroff
97 .B \-h
98 |
99 .B \-\-help
100 .
101 .SY pdfroff
102 .B \-v
103 |
104 .B \-\-version
105 .RI [ option\ .\|.\|. ]
106 .YS
107 .
108 .
109 .\" --------------------------------------------------------------------
110 .SH DESCRIPTION
111 .\" --------------------------------------------------------------------
112 .
113 .B pdfroff
114 is a wrapper program for the GNU text processing system,
115 .BR  groff .
116 .
117 It transparently handles the mechanics of multiple pass
118 .B groff
119 processing, when applied to suitably marked up
120 .B groff
121 source files,
122 such that tables of contents and body text are formatted separately,
123 and are subsequently combined in the correct order, for final publication
124 as a single PDF document.
125 .
126 A further optional
127 \*(lqstyle sheet\*(rq
128 capability is provided;
129 this allows for the definition of content which is required to precede the
130 table of contents, in the published document.
131 .
132 .P
133 For each invocation of
134 .BR pdfroff ,
135 the ultimate
136 .B groff
137 output stream is post-processed by the GhostScript interpreter,
138 to produce a finished PDF document.
139 .
140 .P
141 .B pdfroff
142 makes no assumptions about, and imposes no restrictions on, the use of
143 any
144 .B groff
145 macro packages which the user may choose to employ,
146 in order to achieve a desired document format;
147 however, it
148 .I does
149 include specific built in support for the
150 .B pdfmark
151 macro package, should the user choose to employ it.
152 .
153 Specifically, if the
154 .I pdfhref
155 macro, defined in the
156 .B pdfmark.tmac
157 package, is used to define public reference marks, or dynamic links to
158 such reference marks, then
159 .B pdfroff
160 performs as many preformatting
161 .B groff
162 passes as required, up to a maximum limit of
163 .IR four ,
164 in order to compile a document reference dictionary, to resolve
165 references, and to expand the dynamically defined content of links.
166 .
167 .
168 .\" --------------------------------------------------------------------
169 .SH USAGE
170 .\" --------------------------------------------------------------------
171 .
172 The command line is parsed in accordance with normal GNU conventions,
173 but with one exception \(em when specifying any short form option
174 (i.e., a single character option introduced by a single hyphen),
175 and if that option expects an argument, then it
176 .I must
177 be specified independently (i.e., it may
178 .I not
179 be appended to any group of other single character short form options).
180 .
181 .
182 .P
183 Long form option names (i.e., those introduced by a double hyphen) may
184 be abbreviated to their minimum length unambiguous initial substring.
185 .
186 .
187 .P
188 Otherwise,
189 .B pdfroff
190 usage closely mirrors that of
191 .B groff
192 itself.
193 .
194 Indeed, with the exception of the
195 .BR \-h ,
196 .BR \-v ,
197 and
198 .BI \-T \ dev
199 short form options, and all long form options, which are parsed
200 internally by
201 .BR pdfroff ,
202 all options and file name arguments specified on the command line are
203 passed on to
204 .BR groff ,
205 to control the formatting of the PDF document.
206 .
207 Consequently,
208 .B pdfroff
209 accepts all options and arguments, as specified in
210 .BR groff (@MAN1EXT@),
211 which may also be considered as the definitive reference for all standard
212 .BR pdfroff
213 options and argument usage.
214 .
215 .
216 .\" --------------------------------------------------------------------
217 .SH OPTIONS
218 .\" --------------------------------------------------------------------
219 .
220 .B pdfroff
221 accepts all of the short form options (i.e., those introduced by a
222 single hyphen), which are available with
223 .B groff
224 itself.
225 .
226 In most cases, these are simply passed transparently to
227 .BR groff ;
228 the following, however, are handled specially by
229 .BR pdfroff .
230 .
231 .TP
232 .B \-h
233 Same as
234 .BR \-\-help ;
235 see below.
236 .
237 .TP
238 .B \-i
239 Process standard input, after all other specified input files.
240 .
241 This is passed transparently to
242 .BR groff ,
243 but, if grouped with other options, it
244 .I must
245 be the first in the group.
246 .
247 Hiding it within a group breaks standard input processing, in the
248 multiple pass
249 .B groff
250 processing context of
251 .BR pdfroff .
252 .
253 .TP
254 .BI \-T \ dev
255 Only
256 .B \-T\ ps
257 is supported by
258 .BR pdfroff .
259 .
260 Attempting to specify any other device causes
261 .B pdfroff
262 to abort.
263 .
264 .TP
265 .B \-v
266 Same as
267 .BR \-\-version ;
268 see below.
269 .
270 .
271 .P
272 See
273 .BR groff (@MAN1EXT@)
274 for a description of all other short form options, which are
275 transparently passed through
276 .BR pdfroff
277 to
278 .BR groff .
279 .
280 .
281 .P
282 All long form options (i.e., those introduced by a double hyphen) are
283 interpreted locally by
284 .BR pdfroff ;
285 they are
286 .B not
287 passed on to
288 .BR groff ,
289 unless otherwise stated below.
290 .
291 .TP
292 .B \-\-help
293 Causes
294 .B pdfroff
295 to display a summary of the its usage syntax, and supported options,
296 and then exit.
297 .
298 .TP
299 .B \-\-emit\-ps
300 Suppresses the final output conversion step, causing
301 .B pdfroff
302 to emit PostScript output instead of PDF.
303 .
304 This may be useful, to capture intermediate PostScript output, when
305 using a specialised postprocessor, such as
306 .I gpresent
307 for example,
308 in place of the default
309 .I GhostScript
310 PDF writer.
311 .
312 .TP
313 .B \-\-keep\-temporary\-files
314 Suppresses the deletion of temporary files, which normally occurs
315 after
316 .B pdfroff
317 has completed PDF document formatting; this may be useful, when
318 debugging formatting problems.
319 .
320 .IP
321 See section
322 .BR FILES ,
323 for a description of the temporary files used by
324 .BR pdfroff .
325 .
326 .TP
327 .B \-\-no\-pdf\-output
328 May be used with the
329 .BI \%\-\-reference\-dictionary= name
330 option (described below) to eliminate the overhead of PDF formatting,
331 when running
332 .B pdfroff
333 to create a reference dictionary, for use in a different document.
334 .
335 .TP
336 .B \-\-no\-reference\-dictionary
337 May be used to eliminate the overhead of creating a reference dictionary,
338 when it is known that the target PDF document contains no public
339 references, created by the
340 .I pdfhref
341 macro.
342 .
343 .TP
344 .B \-\-no\-toc\-relocation
345 May be used to eliminate the extra
346 .B groff
347 processing pass,
348 which is required to generate a table of contents,
349 and relocate it to the start of the PDF document,
350 when processing any document which lacks an automatically
351 generated table of contents.
352 .
353 .TP
354 .B \-\-no\-kill\-null\-pages
355 While preparing for simulation of the manual collation step,
356 which is traditionally required to relocate of a
357 .I "table of contents"
358 to the start of a document,
359 .B pdfroff
360 accumulates a number of empty page descriptions
361 into the intermediate
362 .I PostScript
363 output stream.
364 During the final collation step,
365 these empty pages are normally discarded from the finished document;
366 this option forces
367 .B pdfroff
368 to leave them in place.
369 .
370 .TP
371 .BI \-\-pdf\-output= name
372 Specifies the name to be used for the resultant PDF document;
373 if unspecified, the PDF output is written to standard output.
374 A future version of
375 .B pdfroff
376 may use this option,
377 to encode the document name in a generated reference dictionary.
378 .
379 .TP
380 .BI \-\-reference\-dictionary= name
381 Specifies the name to be used for the generated reference dictionary file;
382 if unspecified, the reference dictionary is created in a temporary file,
383 which is deleted when
384 .B pdfroff
385 completes processing of the current document.
386 .
387 This option
388 .I must
389 be specified, if it is desired to save the reference dictionary,
390 for use in references placed in other PDF documents.
391 .
392 .TP
393 .B \-\-report\-progress
394 Causes
395 .B pdfroff
396 to display an informational message on standard error,
397 at the start of each
398 .B groff
399 processing pass.
400 .
401 .TP
402 .BI \-\-stylesheet= name
403 Specifies the name of an
404 .IR "input file" ,
405 to be used as a style sheet for formatting of content,
406 which is to be placed
407 .I before
408 the table of contents,
409 in the formatted PDF document.
410 .
411 .TP
412 .B \-\-version
413 Causes
414 .B pdfroff
415 to display a version identification message.
416 .
417 The entire command line is then passed transparently to
418 .BR groff ,
419 in a
420 .I one
421 pass operation
422 .IR only ,
423 in order to display the associated
424 .B groff
425 version information, before exiting.
426 .
427 .
428 .\" --------------------------------------------------------------------
429 .SH ENVIRONMENT
430 .\" --------------------------------------------------------------------
431 .
432 The following environment variables may be set, and exported,
433 to modify the behaviour of
434 .BR pdfroff .
435 .
436 .TP
437 .B PDFROFF_COLLATE
438 Specifies the program to be used
439 for collation of the finished PDF document.
440 .
441 .IP
442 This collation step may be required to move
443 .I tables of contents
444 to the start of the finished PDF document,
445 when formatting with traditional macro packages,
446 which print them at the end.
447 .
448 However, users should not normally need to specify
449 .BR \%PDFROFF_COLLATE ,
450 (and indeed, are not encouraged to do so).  If unspecified,
451 .B pdfroff
452 uses
453 .BR sed (@MAN1EXT@)
454 by default,
455 which normally suffices.
456 .
457 .IP
458 If
459 .B \%PDFROFF_COLLATE
460 .I is
461 specified,
462 then it must act as a filter,
463 accepting a list of file name arguments,
464 and write its output to the
465 .I stdout
466 stream,
467 whence it is piped to the
468 .BR \%PDFROFF_POSTPROCESSOR_COMMAND ,
469 to produce the finished PDF output.
470 .
471 .IP
472 When specifying
473 .BR \%PDFROFF_COLLATE ,
474 it is normally necessary to also specify
475 .BR \%PDFROFF_KILL_NULL_PAGES .
476 .
477 .IP
478 .B \%PDFROFF_COLLATE
479 is ignored,
480 if
481 .B pdfroff
482 is invoked with the
483 .I \%\-\-no\-kill\-null\-pages
484 option.
485 .
486 .TP
487 .B PDFROFF_KILL_NULL_PAGES
488 Specifies options to be passed to the
489 .B \%PDFROFF_COLLATE
490 program.
491 .
492 .IP
493 It should not normally be necessary to specify
494 .BR \%PDFROFF_KILL_NULL_PAGES .
495 .
496 The internal default is a
497 .BR sed (@MAN1EXT@)
498 script,
499 which is intended to remove completely blank pages
500 from the collated output stream,
501 and which should be appropriate in most applications of
502 .BR pdfroff .
503 .
504 However,
505 if any alternative to
506 .BR sed (@MAN1EXT@)
507 is specified for
508 .BR \%PDFROFF_COLLATE ,
509 then it is likely that a corresponding alternative specification for
510 .B \%PDFROFF_KILL_NULL_PAGES
511 is required.
512 .
513 .IP
514 As in the case of
515 .BR \%PDFROFF_COLLATE ,
516 .B \%PDFROFF_KILL_NULL_PAGES
517 is ignored, if
518 .B pdfroff
519 is invoked with the
520 .I \%\-\-no\-kill\-null\-pages
521 option.
522 .
523 .TP
524 .B PDFROFF_POSTPROCESSOR_COMMAND
525 Specifies the command to be used for the final document conversion
526 from PostScript intermediate output to PDF.
527 .
528 It must behave as a filter,
529 writing its output to the
530 .I stdout
531 stream,
532 and must accept an arbitrary number of
533 .I files .\|.\|.\&
534 arguments,
535 with the special case of
536 .I \-
537 representing the
538 .I stdin
539 stream.
540 .
541 .IP
542 If unspecified,
543 .B \%PDFROFF_POSTPROCESSOR_COMMAND
544 defaults to
545 .
546 .RS 2
547 .IP
548 .I
549 .ad l
550 .NH gs \-dBATCH \-dQUIET \-dNOPAUSE \-dSAFER \-sDEVICE=pdfwrite \-sOutputFile=\-
551 .ad
552 .RE
553 .
554 .TP
555 .B GROFF_TMPDIR
556 Identifies the directory in which
557 .B pdfroff
558 should create temporary files.
559 .
560 If
561 .B \%GROFF_TMPDIR
562 is
563 .I not
564 specified, then the variables
565 .BR TMPDIR ,
566 .B TMP
567 and
568 .B TEMP
569 are considered in turn, as possible temporary file repositories.
570 If none of these are set, then temporary files are created
571 in the current directory.
572 .
573 .TP
574 .B GROFF_GHOSTSCRIPT_INTERPRETER
575 Specifies the program to be invoked, when
576 .B pdfroff
577 converts
578 .B groff
579 PostScript output to PDF.
580 .
581 If
582 .B \%PDFROFF_POSTPROCESSOR_COMMAND
583 is specified,
584 then the command name it specifies is
585 .I implicitly
586 assigned to
587 .BR \%GROFF_GHOSTSCRIPT_INTERPRETER ,
588 overriding any explicit setting specified in the environment.
589 .
590 If
591 .B \%GROFF_GHOSTSCRIPT_INTERPRETER
592 is not specified, then
593 .B pdfroff
594 searches the process
595 .BR PATH ,
596 looking for a program with any of the well known names
597 for the GhostScript interpreter;
598 if no GhostScript interpreter can be found,
599 .B pdfroff
600 aborts.
601 .
602 .TP
603 .B GROFF_AWK_INTERPRETER
604 Specifies the program to be invoked, when
605 .B pdfroff
606 is extracting reference dictionary entries from a
607 .B groff
608 intermediate message stream.
609 .
610 If
611 .B \%GROFF_AWK_INTERPRETER
612 is not specified, then
613 .B pdfroff
614 searches the process
615 .BR PATH ,
616 looking for any of the preferred programs, \[oq]gawk\[cq],
617 \[oq]mawk\[cq], \[oq]nawk\[cq], and \[ok]awk\[cq], in this order; if
618 none of these are found,
619 .B pdfroff
620 issues a warning message, and continue processing;
621 however, in this case, no reference dictionary is created.
622 .
623 .TP
624 .B OSTYPE
625 Typically defined automatically by the operating system,
626 .B OSTYPE
627 is used on Microsoft Win32/MS-DOS platforms
628 .IR only ,
629 to infer the default
630 .B \%PATH_SEPARATOR
631 character,
632 which is used when parsing the process
633 .B PATH
634 to search for external helper programs.
635 .
636 .TP
637 .B PATH_SEPARATOR
638 If set,
639 .B \%PATH_SEPARATOR
640 overrides the default separator character,
641 (\[oq]:\[cq] on POSIX/UNIX systems,
642 inferred from
643 .B OSTYPE
644 on Microsoft Win32/MS-DOS),
645 which is used when parsing the process
646 .B PATH
647 to search for external helper programs.
648 .
649 .TP
650 .B SHOW_PROGRESS
651 If this is set to a non-empty value, then
652 .B pdfroff
653 always behaves as if the
654 .B \%\-\-report\-progress
655 option is specified, on the command line.
656 .
657 .
658 .\" --------------------------------------------------------------------
659 .SH FILES
660 .\" --------------------------------------------------------------------
661 .
662 Input and output files for
663 .B pdfroff
664 may be named according to any convention of the user\[aq]s choice.
665 Typically, input files may be named according to the choice of the
666 principal formatting macro package, e.g.,
667 .IB file .ms
668 might be an input file for formatting using the
669 .B ms
670 macros
671 .RB ( s.tmac );
672 normally, the final output file should be named
673 .IB file .pdf\c
674 \&.
675 .
676 .
677 .P
678 Temporary files, created by
679 .BR pdfroff ,
680 are placed in the file system hierarchy,
681 in or below the directory specified by environment variables
682 (see section
683 .BR ENVIRONMENT ).
684 .
685 If
686 .BR mktemp (@MAN1EXT@)
687 is available,
688 it is invoked to create a private subdirectory of
689 the nominated temporary files directory,
690 (with subdirectory name derived from the template
691 .BR pdfroff-XXXXXXXXXX );
692 if this subdirectory is successfully created,
693 the temporary files will be placed within it,
694 otherwise they will be placed directly in the directory
695 nominated in the environment.
696 .P
697 All temporary files themselves
698 are named according to the convention
699 .BI pdf $$ .*\c
700 \&, where
701 .I $$
702 is the standard shell variable representing the process ID of the
703 .B pdfroff
704 process itself, and
705 .I *
706 represents any of the extensions used by
707 .B pdfroff
708 to identify the following temporary and intermediate files.
709 .
710 .TP
711 .BI pdf $$ .tmp
712 A scratch pad file,
713 used to capture reference data emitted by
714 .BR groff ,
715 during the
716 .I reference dictionary
717 compilation phase.
718 .
719 .TP
720 .BI pdf $$ .ref
721 The
722 .IR "reference dictionary" ,
723 as compiled in the last but one pass of the
724 .I reference dictionary
725 compilation phase;
726 (at the start of the first pass,
727 this file is created empty;
728 in successive passes,
729 it contains the
730 .I reference dictionary
731 entries,
732 as collected in the preceding pass).
733 .
734 .IP
735 If the
736 .BR \%\-\-reference\-dictionary =\c
737 .I name
738 option is specified,
739 this intermediate file becomes permanent,
740 and is named
741 .IR name ,
742 rather than
743 .BI pdf $$ .ref\c
744 \&.
745 .
746 .TP
747 .BI pdf $$ .cmp
748 Used to collect
749 .I reference dictionary
750 entries during the active pass of the
751 .I reference dictionary
752 compilation phase.
753 .
754 At the end of any pass,
755 when the content of
756 .BI pdf $$ .cmp
757 compares as identical to
758 .BI pdf $$ .ref\c
759 \&,
760 (or the corresponding file named by the
761 .BR \%\-\-reference\-dictionary =\c
762 .I name
763 option),
764 then
765 .I reference dictionary
766 compilation is terminated,
767 and the
768 .I document reference map
769 is appended to this intermediate file,
770 for inclusion in the final formatting passes.
771 .
772 .TP
773 .BI pdf $$ .tc
774 An intermediate
775 .I PostScript
776 file,
777 in which \*[lq]Table of Contents\*[rq] entries are collected,
778 to facilitate relocation before the body text,
779 on ultimate output to the
780 .I GhostScript
781 postprocessor.
782 .
783 .TP
784 .BI pdf $$ .ps
785 An intermediate
786 .I PostScript
787 file,
788 in which the body text is collected prior to ultimate output to the
789 .I GhostScript
790 postprocessor,
791 in the proper sequence,
792 .I after
793 .BI pdf $$ .tc\c
794 \&.
795 .
796 .
797 .\" --------------------------------------------------------------------
798 .SH SEE ALSO
799 .\" --------------------------------------------------------------------
800 .
801 See
802 .BR groff (@MAN1EXT@)
803 for the definitive reference to document formatting with
804 .BR groff .
805 .
806 Since
807 .B pdfroff
808 provides a superset of all
809 .B groff
810 capabilities,
811 .BR groff (@MAN1EXT@)
812 may also be considered to be the definitive reference to all
813 .I standard
814 capabilities of
815 .BR pdfroff ,
816 with this document providing the reference to
817 .BR pdfroff \[aq]s
818 extended features.
819 .
820 .
821 .P
822 While
823 .B pdfroff
824 imposes neither any restriction on, nor any requirement for,
825 the use of any specific
826 .B groff
827 macro package, a number of supplied macro packages,
828 and in particular those associated with the package
829 .BR pdfmark.tmac ,
830 are best suited for use with
831 .BR pdfroff
832 as the preferred formatter.
833 .
834 Detailed documentation on the use of these packages may be found,
835 in PDF format, in the reference guide
836 .BR "\*(lqPortable Document Format Publishing with GNU Troff\*(rq" ,
837 included in the installed documentation set as
838 .BR \%@PDFDOCDIR@/pdfmark.pdf .
839 .
840 .
841 .\" --------------------------------------------------------------------
842 .SH COPYING
843 .\" --------------------------------------------------------------------
844 .co
845 .\" --------------------------------------------------------------------
846 .SH AUTHORS
847 .\" --------------------------------------------------------------------
848 .au
849 .
850 .
851 .\" --------------------------------------------------------------------
852 .\" EOF / vim: ft=groff / -*- nroff -*-