# pdfroff - construct files in Portable Document Format using groff - man(1) - [phpMan]

[_pdfroff_(1)](https://www.chedong.com/phpMan.php/man/pdfroff/1/markdown)                             General Commands Manual                            [_pdfroff_(1)](https://www.chedong.com/phpMan.php/man/pdfroff/1/markdown)

## Name
       pdfroff - construct files in Portable Document Format using _groff_

## Synopsis
       **pdfroff **[_groff-option_] [**--emit-ps**] [**--no-toc-relocation**] [**--no-kill-null-pages**]
               [**--stylesheet=_**name_] [**--no-pdf-output**] [**--pdf-output=_**name_] [**--no-reference-dictionary**]
               [**--reference-dictionary=_**name_] [**--report-progress**] [**--keep-temporary-files**] [_file_ ...]

### pdfroff -h
### pdfroff --help

       **pdfroff -v **[_groff-option_ ...]
       **pdfroff --version **[_groff-option_ ...]

       _groff-option_ is any short option supported by [_groff_(1)](https://www.chedong.com/phpMan.php/man/groff/1/markdown) except for **-h**, **-T**, and **-v**; see section
       “Usage” below.

## Description
       _pdfroff_  is  a  wrapper  program for the GNU text processing system, _groff_.  It transparently
       handles the mechanics of multiple pass _groff_ processing, when applied to suitably  marked  up
       _groff_  source files, such that tables of contents and body text are formatted separately, and
       are subsequently combined in the correct order, for final publication as a single  PDF  docu‐
       ment.   A  further optional “style sheet” capability is provided; this allows for the defini‐
       tion of content which is required to precede the table of contents, in  the  published  docu‐
       ment.

       For  each  invocation  of  _pdfroff_, the ultimate _groff_ output stream is post-processed by the
       Ghostscript [_gs_(1)](https://www.chedong.com/phpMan.php/man/gs/1/markdown) interpreter to produce a finished PDF document.

       _pdfroff_ makes no assumptions about, and imposes no restrictions on,  the  use  of  any  _groff_
       macro  packages  which  the user may choose to employ, in order to achieve a desired document
       format; however, it _does_ include specific built in support for  the  _pdfmark_  macro  package,
       should  the  user  choose  to  employ it.  Specifically, if the _pdfhref_ macro, defined in the
       _pdfmark.tmac_ package, is used to define public reference marks, or dynamic links to such ref‐
       erence marks, then _pdfroff_ performs as many preformatting _groff_ passes as required, up  to  a
       maximum limit of _four_, in order to compile a document reference dictionary, to resolve refer‐
       ences, and to expand the dynamically defined content of links.

## Usage
       The command line is parsed in accordance with normal GNU conventions, but with one exception—
       when specifying any short form option (i.e., a single character option introduced by a single
       hyphen),  and  if  that  option  expects an argument, then it _must_ be specified independently
       (i.e., it may _not_ be appended to any group of other single character short form options).

       Long form option names (i.e., those introduced by a double  hyphen)  may  be  abbreviated  to
       their minimum length unambiguous initial substring.

       Otherwise, _pdfroff_ usage closely mirrors that of _groff_ itself.  Indeed, with the exception of
       the **-h**, **-v**, and **-T _**dev_ short form options, and all long form options, which are parsed inter‐
       nally  by  _pdfroff_,  all  options  and  file name arguments specified on the command line are
       passed on to _groff_, to control the formatting of the PDF document.  Consequently, _pdfroff_ ac‐
       cepts all options and arguments, as specified in [_groff_(1)](https://www.chedong.com/phpMan.php/man/groff/1/markdown), which may also  be  considered  as
       the definitive reference for all standard _pdfroff_ options and argument usage.

## Options
       _pdfroff_  accepts  all  of the short form options (i.e., those introduced by a single hyphen),
       which are available with _groff_ itself.  In most cases, these are simply passed  transparently
       to _groff_; the following, however, are handled specially by _pdfroff_.

### -h      --help

### -i     
              parently to _groff_, but, if grouped with other options, it _must_ be  the  first  in  the
              group.   Hiding  it  within a group breaks standard input processing, in the multiple-
              pass _groff_ processing context of _pdfroff_.

### -T _ -T ps 
              _pdfroff_ to abort.

### -v      --version

       See  [_groff_(1)](https://www.chedong.com/phpMan.php/man/groff/1/markdown)  for  a  description  of  all other short form options, which are transparently
       passed through _pdfroff_ to _groff_.

       All long form options (i.e., those introduced by a double hyphen) are interpreted locally  by
       _pdfroff_; they are _not_ passed on to _groff_, unless otherwise stated below.

       **--help **Causes  _pdfroff_  to  display a summary of the its usage syntax, and supported options,
              and then exit.

### --emit-ps
              Suppresses the final output conversion step, causing _pdfroff_ to emit PostScript output
              instead of PDF.  This may be useful to capture intermediate PostScript output when us‐
              ing a specialised postprocessor, such as _gpresent_ for example, in place of the default
              Ghostscript PDF writer.

### --keep-temporary-files
              Suppresses the deletion of temporary files, which normally occurs  after  _pdfroff_  has
              completed  PDF document formatting; this may be useful when debugging formatting prob‐
              lems.

              See section “Files” below for a description of the temporary files used by _pdfroff_.

### --no-pdf-output
              May be used with the **--reference-dictionary=_**name_ option (described below) to eliminate
              the overhead of PDF formatting when running _pdfroff_ to create a  reference  dictionary
              for use in a different document.

### --no-reference-dictionary
              May  be  used to eliminate the overhead of creating a reference dictionary, when it is
              known that the target PDF document contains  no  public  references,  created  by  the
              **pdfhref **macro.

### --no-toc-relocation
              May  be used to eliminate the extra _groff_ processing pass, which is required to gener‐
              ate a table of contents, and relocate it to the start of the PDF document,  when  pro‐
              cessing any document which lacks an automatically generated table of contents.

### --no-kill-null-pages
              While  preparing  for  simulation of the manual collation step, which is traditionally
              required to relocate a _table_ _of_ _contents_ to the start of a document,  _pdfroff_  accumu‐
              lates  a  number  of  empty  page descriptions into the intermediate PostScript output
              stream.  During the final collation step, these empty  pages  are  normally  discarded
              from the finished document; this option forces _pdfroff_ to leave them in place.

       **--pdf-output=_**name_
              Specifies  the name to be used for the resultant PDF document; if unspecified, the PDF
              output is written to standard output.  A future version of _pdfroff_ may  use  this  op‐
              tion, to encode the document name in a generated reference dictionary.

       **--reference-dictionary=_**name_
              Specifies the name to be used for the generated reference dictionary file; if unspeci‐
              fied,  the  reference dictionary is created in a temporary file, which is deleted when
              _pdfroff_ completes processing of the current document.  This option _must_ be  specified,
              if  it  is  desired  to save the reference dictionary, for use in references placed in
              other PDF documents.

### --report-progress
              Causes _pdfroff_ to display an informational message on standard error, at the start  of
              each _groff_ processing pass.

       **--stylesheet=_**name_
              Specifies  the  name  of  an _input_ _file_, to be used as a style sheet for formatting of
              content, which is to be placed _before_ the table of contents, in the formatted PDF doc‐
              ument.

### --version
              Causes _pdfroff_ to display a version identification message.  The entire  command  line
              is  then passed transparently to _groff_, in a _one_ pass operation _only_, in order to dis‐
              play the associated _groff_ version information, before exiting.

## Environment
       The following environment variables may be set, and exported,  to  modify  the  behaviour  of
       _pdfroff_.

       _PDFROFF_COLLATE_
              Specifies the program to be used for collation of the finished PDF document.

              This  collation  step  may  be required to move _tables_ _of_ _contents_ to the start of the
              finished PDF document, when formatting with traditional macro  packages,  which  print
              them  at the end.  However, users should not normally need to specify _PDFROFF_COLLATE_,
              (and indeed, are not encouraged to do so).  If unspecified, _pdfroff_ uses [_sed_(1)](https://www.chedong.com/phpMan.php/man/sed/1/markdown) by de‐
              fault, which normally suffices.

              If _PDFROFF_COLLATE_ _is_ specified, then it must act as a filter,  accepting  a  list  of
              file  name arguments, and write its output to the standard output stream, whence it is
              piped to the _PDFROFF_POSTPROCESSOR_COMMAND_, to produce the finished PDF output.

              When  specifying  _PDFROFF_COLLATE_,  it  is  normally   necessary   to   also   specify
              _PDFROFF_KILL_NULL_PAGES_.

              _PDFROFF_COLLATE_  is  ignored,  if _pdfroff_ is invoked with the **--no-kill-null-pages **op‐
              tion.

       _PDFROFF_KILL_NULL_PAGES_
              Specifies options to be passed to the _PDFROFF_COLLATE_ program.

              It should not normally be necessary to specify _PDFROFF_KILL_NULL_PAGES_.  The  internal
              default  is  a  [_sed_(1)](https://www.chedong.com/phpMan.php/man/sed/1/markdown) script, which is intended to remove completely blank pages from
              the collated output stream, and which should be appropriate in  most  applications  of
              _pdfroff_.  However, if any alternative to [_sed_(1)](https://www.chedong.com/phpMan.php/man/sed/1/markdown) is specified for _PDFROFF_COLLATE_, then
              it    is    likely    that    a    corresponding    alternative    specification   for
              _PDFROFF_KILL_NULL_PAGES_ is required.

              As in the case of _PDFROFF_COLLATE_, _PDFROFF_KILL_NULL_PAGES_ is ignored, if  _pdfroff_  is
              invoked with the **--no-kill-null-pages **option.

       _PDFROFF_POSTPROCESSOR_COMMAND_
              Specifies the command to be used for the final document conversion from PostScript in‐
              termediate output to PDF.  It must behave as a filter, writing its output to the stan‐
              dard  output  stream, and must accept an arbitrary number of _files_ _..._ arguments, with
              the special case of “**-**” representing the standard input stream.

              If unspecified, _PDFROFF_POSTPROCESSOR_COMMAND_ defaults to
                   gs -dBATCH -dQUIET -dNOPAUSE -dSAFER -sDEVICE=pdfwrite \
                        -sOutputFile=-

       _GROFF_TMPDIR_
              Identifies  the  directory  in  which  _pdfroff_  should  create  temporary  files.   If
              _GROFF_TMPDIR_  is _not_ specified, then the variables _TMPDIR_, _TMP_ and _TEMP_ are considered
              in turn as possible temporary file repositories.  If none of these are set, then  tem‐
              porary files are created in the current directory.

       _GROFF_GHOSTSCRIPT_INTERPRETER_
              Specifies  the  program to be invoked when _pdfroff_ converts _groff_ PostScript output to
              PDF.  If _PDFROFF_POSTPROCESSOR_COMMAND_ is specified, then the command name  it  speci‐
              fies  is _implicitly_ assigned to _GROFF_GHOSTSCRIPT_INTERPRETER_, overriding any explicit
              setting specified in the environment.  If _GROFF_GHOSTSCRIPT_INTERPRETER_ is not  speci‐
              fied,  then  _pdfroff_  searches the process _PATH_, looking for a program with any of the
              well known names for the Ghostscript interpreter; if no Ghostscript interpreter can be
              found, _pdfroff_ aborts.

       _GROFF_AWK_INTERPRETER_
              Specifies the program to be invoked when _pdfroff_ is  extracting  reference  dictionary
              entries  from  a  _groff_  intermediate message stream.  If _GROFF_AWK_INTERPRETER_ is not
              specified, then _pdfroff_ searches the process _PATH_, looking for any  of  the  preferred
              programs,  _gawk_,  _mawk_,  _nawk_,  and  _awk_,  in  that order; if none of these are found,
              _pdfroff_ issues a warning message, and continue processing; however, in this  case,  no
              reference dictionary is created.

       _OSTYPE_ Typically  defined  automatically by the operating system, _OSTYPE_ is used on Microsoft
              Win32/MS-DOS platforms _only_, to infer the default _PATH_SEPARATOR_ character,  which  is
              used when parsing the process _PATH_ to search for external helper programs.

       _PATH_SEPARATOR_
              If  set,  _PATH_SEPARATOR_ overrides the default separator character, (‘:’ on POSIX/Unix
              systems, inferred from _OSTYPE_ on Microsoft Win32/MS-DOS), which is used  when  parsing
              the process _PATH_ to search for external helper programs.

       _SHOW_PROGRESS_
              If  this  is  set  to  a  non-empty  value,  then  _pdfroff_  always  behaves  as if the
              **--report-progress **option is specified on the command line.

## Files
       Input and output files for _pdfroff_ may be named according to any  convention  of  the  user's
       choice.  Typically, input files may be named according to the choice of the principal normat‐
       ting  macro  package, e.g., file_.ms_ might be an input file for formatting using the _ms_ macros
       (_s.tmac_); normally, the final output file should be named file_.pdf_.

       Temporary files created by _pdfroff_ are placed in the file system hierarchy, in or  below  the
       directory specified by environment variables (see section “Environment” above).  If [_mktemp_(1)](https://www.chedong.com/phpMan.php/man/mktemp/1/markdown)
       is available, it is invoked to create a private subdirectory of the nominated temporary files
       directory,  (with  subdirectory  name  derived from the template _pdfroff-XXXXXXXXXX_); if this
       subdirectory is successfully created, the temporary files will be placed within it, otherwise
       they will be placed directly in the directory nominated in the environment.

       All temporary files themselves are named according to the convention _pdf_$$_._*, where _$$_ is the
       standard shell variable representing the process identifier of the  _pdfroff_  process  itself,
       and  _*_  represents  any of the extensions used by _pdfroff_ to identify the following temporary
       and intermediate files.

       _pdf_$$_.tmp_
              A scratch pad file, used to capture reference data emitted by _groff_, during the _refer‐_
              _ence_ _dictionary_ compilation phase.

       _pdf_$$_.ref_
              The _reference_ _dictionary_, as compiled in the last but one pass of the  _reference_  _dic‐_
              _tionary_  compilation  phase;  (at  the  start  of the first pass, this file is created
              empty; in successive passes, it contains the _reference_  _dictionary_  entries,  as  col‐
              lected in the preceding pass).

              If the **--reference-dictionary**=_name_ option is specified, this intermediate file becomes
              permanent, and is named _name_, rather than _pdf_$$_.ref_.

       _pdf_$$_.cmp_
              Used  to  collect _reference_ _dictionary_ entries during the active pass of the _reference_
              _dictionary_ compilation phase.  At the end of any pass, when the content  of  _pdf_$$_.cmp_
              compares  as  identical  to  _pdf_$$_.ref_,  (or  the  corresponding  file  named  by  the
              **--reference-dictionary**=_name_ option), then _reference_ _dictionary_ compilation  is  termi‐
              nated,  and  the _document_ _reference_ _map_ is appended to this intermediate file, for in‐
              clusion in the final formatting passes.

       _pdf_$$_.tc_
              An intermediate _PostScript_ file, in which “Table of Contents” entries  are  collected,
              to  facilitate  relocation before the body text, on ultimate output to the _Ghostscript_
              postprocessor.

       _pdf_$$_.ps_
              An intermediate _PostScript_ file, in which the body text is collected prior to ultimate
              output to the _Ghostscript_ postprocessor, in the proper sequence, _after_ _pdf_$$_.tc_.

## Authors
       _pdfroff_ was written by  [Keith Marshall](mailto:<keith.d.marshall@ntlworld.com>),  who  maintains  it  at  [his _groff-pdfmark_ OSDN site](<https://osdn.net/users/keith/pf/groff-pdfmark/wiki/FrontPage>).
       _groff_'s version may be withdrawn in a future release.

**See also**
       _Groff:_ _The_ _GNU_ _Implementation_ _of_ _troff_, by Trent A. Fisher and Werner Lemberg, is the primary
       _groff_ manual.  You can browse it interactively with “info groff”.

       Since  _pdfroff_ provides a superset of all _groff_ capabilities, the above manual, or its terser
       reference page, [_groff_(7)](https://www.chedong.com/phpMan.php/man/groff/7/markdown) may also be considered definitive references to all  _standard_  capa‐
       bilities  of  _pdfroff_,  with this document providing the reference to _pdfroff_'s extended fea‐
       tures.

       While _pdfroff_ imposes neither any restriction on, nor any requirement for,  the  use  of  any
       specific  _groff_  macro  package, a number of supplied macro packages, and in particular those
       associated with the package _pdfmark.tmac_, are best suited for use with _pdfroff_  as  the  pre‐
       ferred formatter.

       _/usr/share/doc/groff-base/pdf/pdfmark.pdf.gz_
              “Portable  Document  Format  Publishing with GNU _Troff_”, by Keith Marshall, offers de‐
              tailed documentation on the use of these  packages.   This  file,  together  with  its
              source, _pdfmark.ms_, is part of the _groff_ distribution.

groff 1.23.0                                31 March 2024                                 [_pdfroff_(1)](https://www.chedong.com/phpMan.php/man/pdfroff/1/markdown)
