LinuxCommandLibrary

roff2pdf

Convert roff/man pages to PDF format

SYNOPSIS

roff2pdf [options] [file...]

PARAMETERS

-a
    Automatically generate PDF/A compliant output.

-c
    Specify a CSS file for use when converting to HTML.

-d
    Debug mode (keep intermediate files).

-e
    Specify the output encoding (e.g., UTF-8).

-f
    Force overwrite of existing output file.

-g
    Use grog to guess the input format and options.

-i
    Specify the input encoding (e.g., latin1).

-m
    Specify the roff macro package (e.g., man, md).

-n
    No table processing (disable tbl).

-o
    Specify the output PDF file name.

-p
    Specify the paper size (e.g., a4, letter).

-r
    Specify the PDF resolution in DPI.

-t
    Use troff instead of groff.

-u
    Convert URLs to clickable links.

-v
    Verbose output.

-w
    Generate a warning if any errors occur

--help
    Display help message and exit.

--version
    Display version information and exit.

[file...]
    Input roff files. If none specified, reads from standard input.

DESCRIPTION

roff2pdf converts roff or man page source files into PDF format. It simplifies the process of creating PDF documents from traditional Unix documentation formats. It's particularly useful for generating printable or shareable versions of man pages. The command internally utilizes tools like groff to format the input and then transforms the output (usually PostScript) into PDF. The user can specify the input file, customize formatting using groff options, and control the PDF output.

This command is a convenient front-end script that automates the series of steps needed to format a roff source using groff and then convert it to PDF.It takes input files, typically in roff format, and produces a PDF file as output. It helps to achieve the task in just a single command.

The script handles the necessary formatting, including applying appropriate macro packages for man pages (man or md), and then pipes the resulting PostScript output to a PDF conversion tool. This allows for straightforward PDF generation from roff sources.

CAVEATS

Requires groff and a PDF conversion tool (e.g., ps2pdf, ghostscript) to be installed. The quality of the PDF output depends on the quality of the roff source and the capabilities of the PDF conversion tool. Complex roff layouts might not be perfectly rendered in PDF.

EXAMPLES

roff2pdf manpage.roff: Converts manpage.roff to manpage.pdf.
roff2pdf -m man manpage.1: Converts manpage.1 using the man macro package.
man ls | roff2pdf -o ls.pdf: Converts the man page for ls to ls.pdf.

SEE ALSO

groff(1), man(1), ps2pdf(1), ghostscript(1)

Copied to clipboard