LinuxCommandLibrary

gvpack

Pack Graphviz graphs into single file

TLDR

Combine several graph layouts (that already have layout information)

$ gvpack [path/to/layout1.gv path/to/layout2.gv ...] > [path/to/output.gv]
copy

Combine several graph layouts at the graph level, keeping graphs separate
$ gvpack -g [path/to/layout1.gv path/to/layout2.gv ...] > [path/to/output.gv]
copy

Combine several graph layouts at the node level, ignoring clusters
$ gvpack -n [path/to/layout1.gv path/to/layout2.gv ...] > [path/to/output.gv]
copy

Combine several graph layouts without packing
$ gvpack -u [path/to/layout1.gv path/to/layout2.gv ...] > [path/to/output.gv]
copy

Display help
$ gvpack -?
copy

SYNOPSIS

gvpack [-l label] [-p pages] [-n npages] [-o orientation] [-s size] [-d] [-q] [-v] [file ...]

PARAMETERS

-l label
    Insert label page every label pages (default: 0, no labels)

-p pages
    Arrange pages per sheet (default: 1)

-n npages
    Process max npages per input file (default: unlimited)

-o orientation
    Page orientation: portrait, landscape, seascape, upsidedown (default: portrait)

-s size
    Page size: letter, legal, a4, a3, tabloid, etc. (default: letter)

-d
    Enable debug output

-q
    Quiet mode, suppress non-error messages

-v
    Print version information and exit

DESCRIPTION

gvpack is a utility from the Ghostview (GV) suite designed to concatenate multiple PostScript files into a single, DSC-conformant (Document Structuring Conventions) output file. This is particularly useful for printing workflows where several PS documents need to be combined without disrupting page ordering, bounding boxes, or printer-specific handling.

It processes input files (or stdin if none specified), rearranging pages according to options like pages-per-sheet or orientation, and inserts label pages if requested. The output is suitable for direct printing with tools like lpr or viewing in Ghostscript-based viewers.

Key benefits include preserving document structure for prolog/epilog separation, handling multi-page inputs efficiently, and supporting common page sizes/orientations. It's lightweight, relies on standard PS syntax, and integrates well with Ghostscript ecosystem.

Primarily used in Unix/Linux environments for batch printing or archiving PS documents. While modern workflows favor PDF, gvpack remains relevant for legacy PS handling or embedded systems.

CAVEATS

Assumes DSC-compliant inputs; non-standard PS may cause issues. No stdin/stdout piping if files specified. Limited to basic PS features; complex graphics may require Ghostscript preprocessing.

INPUT/OUTPUT

Reads PS files from args or stdin; writes single PS to stdout. Redirect for saving: gvpack *.ps > output.ps

EXAMPLES

gvpack -p 2 -o landscape file1.ps file2.ps > combined.ps
Packs 2-up landscape sheets.
cat doc.ps | gvpack -l 10 > labeled.ps
Labels every 10 pages.

HISTORY

Developed in the early 1990s as part of the Ghostview project by Tim Theisen, enhancing PostScript handling with Ghostscript. Integrated into GV viewer suite (version 3.x+). Widely used in pre-PDF Unix printing until 2000s; maintained sporadically for legacy support.

SEE ALSO

gv(1), gs(1), psnup(1), ps2pdf(1)

Copied to clipboard