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