LinuxCommandLibrary

a2ping

Test reachability of Apache module configurations

TLDR

Convert an image to PDF (Note: Specifying an output filename is optional)

$ a2ping [path/to/image.ext] [path/to/output.pdf]
copy

Compress the document using the specified method
$ a2ping --nocompress [none|zip|best|flate] [path/to/file]
copy

Scan HiResBoundingBox if present (defaults to yes)
$ a2ping --nohires [path/to/file]
copy

Allow page content below and left of the origin (defaults to no)
$ a2ping --below [path/to/file]
copy

Pass extra arguments to gs
$ a2ping --gsextra [arguments] [path/to/file]
copy

Pass extra arguments to external program (i.e pdftops)
$ a2ping --extra [arguments] [path/to/file]
copy

Display help
$ a2ping [[-h|--help]]
copy

SYNOPSIS

a2ping [options] file...

PARAMETERS

-o, --output
    Specifies the output filename. This option is ignored if multiple input files are provided.

-f, --format
    Sets the output image format (png or jpeg). The default format is png.

-w, --width
    Defines the output image width in pixels. The height will be scaled proportionally to maintain aspect ratio.

-h, --height
    Defines the output image height in pixels. The width will be scaled proportionally to maintain aspect ratio.

-r, --resolution
    Sets the output resolution in Dots Per Inch (DPI). The default resolution is 72 DPI.

-p, --pages
    Specifies the page range(s) to convert (e.g., 1-5 for pages 1 through 5, 3 for page 3, or 1,4,7 for pages 1, 4, and 7).

-q, --quiet
    Suppresses output messages, making the command operate silently.

-v, --verbose
    Displays verbose information and progress details during processing.

--version
    Shows version information of the a2ping utility and then exits.

--help
    Displays a comprehensive help message detailing usage and options, and then exits.

DESCRIPTION

a2ping is a command-line utility that leverages the a2ps and ghostscript (gs) tools to convert a wide range of document types into raster image formats, primarily PNG and JPEG.

It first uses a2ps to transform the input file(s) into PostScript, then pipes this PostScript output to gs which renders it into the specified image format. This makes a2ping ideal for generating document thumbnails, previews, or for integrating document content into web pages or image galleries. It supports various options to control the output image's dimensions, resolution, format, and specific page ranges. It's a convenient wrapper for a common a2ps | gs workflow.

CAVEATS

a2ping relies on a2ps and ghostscript being installed and accessible in the system's PATH. Its capabilities are limited by the input formats supported by a2ps and the rendering quality of ghostscript. Converting large documents or generating images at very high resolutions can consume significant system memory and processing time.

TYPICAL USAGE EXAMPLE

A common use case for a2ping is to generate web-ready thumbnails of PDF or text documents. For instance, to create a 200-pixel wide JPEG thumbnail of the first page of document.pdf named doc_thumb.jpg, you would use: a2ping -w 200 -f jpeg -p 1 document.pdf -o doc_thumb.jpg

HISTORY

a2ping is part of the larger a2ps (Any to PostScript) project, which originated in the early 1990s as a robust tool to format various text and source code files into PostScript for printing. a2ping was developed later as a convenient wrapper to extend a2ps's capabilities by leveraging ghostscript to convert the PostScript output into common raster image formats like PNG and JPEG, directly addressing the growing need for document previews and thumbnails outside of a traditional printing context.

SEE ALSO

a2ps(1), gs(1), convert(1)

Copied to clipboard