xpdf(1) General Commands Manual xpdf(1)

xpdf - Portable Document Format (PDF) file viewer for X (xpopple)

xpdf [options] [PDF-file [page | +dest]]

xpopple is a viewer for Portable Document Format (PDF) files. (These are also sometimes also called 'Acrobat' files, from the name of Adobe's PDF software.) xpopple runs under the X Window System on UNIX.

xpopple uses the Poppler library to process PDF files. Poppler was originally derived from version 3 of Glyph & Cog, LLC's Xpdf suite, but Poppler doesn't include the Xpdf viewer program itself. xpopple is the Xpdf program, modified to use Poppler.

To run xpopple, simply type:

xpdf file.pdf

where file.pdf is your PDF file. The file name can be followed by a number specifying the page which should be displayed first, e.g.:

xpdf file.pdf 18

You can also give a named destination, prefixed with '+' in place of the page number. (This is only useful with PDF files that provide named destination targets.)

You can also start xpdf without opening any files:

xpdf

Various compressed formats (gz, bz2, xz, and Z) are also supported, for example::

xpdf file.pdf.gz

Xpdf reads a configuration file at startup. It first tries to find the user's private config file, ~/.xpdfrc. If that doesn't exist, it looks for a system-wide config file, /etc/xpdf/xpdfrc. See the xpdfrc(5) man page for details.

Many of the following options can be set with configuration file commands or X resources. These are listed in square brackets with the description of the corresponding command line option.

Set the initial window geometry. (-geometry is equivalent.) [X resource: Xpdf.geometry]
Set the window title. By default, the title will be "xpdf: foo.pdf". [X resource: Xpdf.title]
Install a private colormap. This is ignored on TrueColor visuals. [X resource: Xpdf.installCmap]
Set the size of largest RGB cube xpdf will try to allocate. The default is 5 (for a 5x5x5 cube); set to a smaller number to conserve color table entries. This is ignored with private colormaps and on TrueColor visuals. [X resource: Xpdf.rgbCubeSize]
Set reverse video mode. This reverses the colors of everything except images. It may not always produce great results for PDF files which do weird things with color. This also causes the paper color to default to black. [X resource: Xpdf.reverseVideo]
Set the "paper color", i.e., the background of the page display. This will not work too well with PDF files that do things like filling in white behind the text. [X resource: Xpdf.paperColor]
Set the matte color, i.e., the color used for background outside the actual page area. (There is a separate setting, Xpdf.fullScreenMatteColor, for full-screen mode.) [X resource: Xpdf.matteColor]
Set the initial zoom factor. A number specifies a zoom percentage, where 100 means 72 dpi. You may also specify 'page', to fit the page to the window size, or 'width', to fit the page width to the window width, or 'height', to fit the page height to the window height [config file: initialZoom; or X resource: Xpdf.initialZoom]
Start in continuous view mode, i.e., with one vertical scroll bar for the whole document. [config file: continuousView]
Set the default file name for PostScript output (i.e., the name which will appear in the print dialog). This can also be of the form '| command' to pipe the PostScript through a command. [config file: psFile]
Set the paper size to one of "letter", "legal", "A4", or "A3". This can also be set to "match", which will set the paper size to match the size specified in the PDF file. [config file: psPaperSize]
Set the paper width, in points. [config file: psPaperSize]
Set the paper height, in points. [config file: psPaperSize]
Generate Level 1 PostScript. The resulting PostScript files will be significantly larger (if they contain images), but will print on Level 1 printers. This also converts all images to black and white. [config file: psLevel]
Sets the encoding to use for text output. The encoding-name must be defined with the unicodeMap command (see xpdfrc(5)). This defaults to "Latin1" (which is a built-in encoding). [config file: textEncoding]
Specify the owner password for the PDF file. Providing this will bypass all security restrictions.
Specify the user password for the PDF file.
Open xpdf in full-screen mode, useful for presentations.
Run a shell command each time a new page is displayed, with the page number as an argument. This can be used for presentation recording. [config file: pageCommand]
Start/contact xpdf remote server with specified name (see the REMOTE SERVER MODE section below).
Execute a command (see the COMMANDS section below) in an xpdf remote server window (with -remote only).
Reload xpdf remote server window (with -remote only).
Raise xpdf remote server window (with -remote only).
Kill xpdf remote server (with -remote only).
Print commands as they're executed (useful for debugging). [config file: printCommands]
Don't print any messages or errors. [config file: errQuiet]
Read config-file in place of ~/.xpdfrc or the system-wide config file.
Print copyright and version information.
Print usage information. (-help, --help and -? are equivalent.)
Open multiple pdf files: file1 file2 ... etc. NOTE: The list of files is terminated once an argument starting with a dash is encountered. In order to view file names starting with a dash, simply prepend "./". -m may be used multiple times.

Several other standard X options and resources will work as expected:

[X resource: Xpdf.display]
(-foreground is equivalent.) [X resource: xpdf*Foreground]
(-background is equivalent.) [X resource: xpdf*Background]
Override the fonts used for the user interface. This uses a single X core font for all user interface elements, which is not ideal; see the USER INTERFACE FONTS section below for better approaches. (-fn is equivalent.) [X resource: xpdf*font]

The color and font options only affect the user interface elements, not the PDF display (the 'paper').

The following X resources do not have command line option equivalents:

Enables (if set to true) or disables (if set to false) the tool-tips on the toolbar buttons.
Sets the matte color to be used in full-screen mode. The default setting is "black".

The following command line options were accepted by earlier versions of Xpdf but are no longer allowed. In most cases, this is because they control rendering options that Poppler does not support.

Obsolete. Controlled the use of font anti-aliasing in the PDF rasterizer.
Obsolete. Controlled the use of vector anti-aliasing in the PDF rasterizer.
Obsolete. Set the end-of-line convention to use for text output.
Obsolete. Controlled whether FreeType was used for font rasterization.
Obsolete. Controlled whether t1lib was used for font rasterization.

Move to the previous/next page.
Move backward or forward by ten pages.
Move backward or forward along the history path.
'Page' entry box
Move to a specific page number. Click in the box to activate it, type the page number, then hit return.
Change the zoom factor (see the description of the -z option above).
Find a text string.
print button
Bring up a dialog for generating a PostScript file. The dialog has options to set the pages to be printed and the PostScript file name. The file name can be '-' for stdout or '| command' to pipe the PostScript through a command, e.g., '| lpr'.
'?' button
Bring up the 'about xpdf' window.
The space between the '?' and 'Quit' buttons is used to show the URL or external file name when the mouse is over a link.
'Quit' button
Quit xpdf.

Pressing the right mouse button will post a popup menu with the following commands:

Open a new PDF file via a file requester.
Create a new window and open a new PDF file via a file requester.
Reload the current PDF file. Note that Xpdf will reload the file automatically (on a page change or redraw) if it has changed since it was last loaded.
Save the current file via a file requester.
Toggles between single page and continuous view modes.
Rotate the page 90 degrees counterclockwise.
Rotate the page 90 degrees clockwise. The two rotate commands are intended primarily for PDF files where the rotation isn't correctly specified in the file.
Zoom in to the currently selected rectangle.
Close the current window. If this is the only open window, the document is closed, but the window is left open (i.e., this menu command won't quit xpdf).
Quit xpdf.

If the PDF contains an outline (a.k.a., bookmarks), there will be an outline pane on the left side of the window. The width of the outline pane is adjustable with a vertical split bar via the knob near its bottom end.

Dragging the mouse with the left button held down will highlight an arbitrary rectangle. Any text inside this rectangle will be copied to the X selection buffer.

Clicking on a hyperlink will jump to the link's destination. A link to another PDF document will make xpdf load that document. A 'launch' link to an executable program will display a dialog, and if you click 'ok', execute the program. URL links call an external command (see the WEB BROWSERS section below).

Dragging the mouse with the middle button held down pans the window.

Open a new PDF file via a file requester.
Reload the current PDF file. Note that Xpdf will reload the file automatically (on a page change or redraw) if it has changed since it was last loaded.
Save the current PDF file via a file requester.
Redraw the current page.
Close the current window.
Find a text string.
Find next occurrence.
Find previous occurrence.
Print.
Move to the next page. Scrolls to the top of the page, unless scroll lock is turned on.
Move to the previous page. Scrolls to the top of the page, unless scroll lock is turned on.
<Space> or <PageDown>
Scroll down on the current page; if already at bottom, move to next page.
<Backspace> or <Delete> or <PageUp>
Scroll up on the current page; if already at top, move to previous page.
Move forward along the history path.
Move backward along the history path.
<Home>
Scroll to top of current page.
<End>
Scroll to bottom of current page.
Scroll to first page of document.
Scroll to last page of document.
Scroll the current page.
[
Rotate the page 90 degrees counterclockwise.
]
Rotate the page 90 degrees clockwise.
Activate the page number text field ("goto page").
0
Set the zoom factor to 125% (ready for increment and decrement).
+
Zoom in (increment the zoom factor by 1).
-
Zoom out (decrement the zoom factor by 1).
Set the zoom factor to 'page' (fit page to window).
Set the zoom factor to 'width' (fit page width to window).
Set the zoom factor to 'height' (fit page height to window).
Toggle full-screen mode.
?
Open the 'about' dialog.
Quit xpdf.

If you want to run xpdf automatically from netscape or mosaic (and probably other browsers) when you click on a link to a PDF file, you need to edit (or create) the files .mime.types and .mailcap in your home directory. In .mime.types add the line:

application/pdf pdf

In .mailcap add the lines:

# Use xpdf to view PDF files.
application/pdf; xpdf -q %s

Make sure that xpdf is on your executable search path.

When you click on a URL link in a PDF file, xpdf will execute the command specified by the urlCommand config file option, replacing an occurrence of '%s' with the URL. For example, to call netscape with the URL, add this line to your config file:

urlCommand "netscape -remote 'openURL(%s)'"

Xpdf's key and mouse bindings are user-configurable, using the bind and unbind options in the config file (see xpdfrc(5)). The bind command allows you to bind a key or mouse button to a sequence of one or more commands.

The following commands are supported:

Go to the specified page.
Go to the specified page, with the current relative scroll position.
Go to a named destination.
Go to the last page in the PDF file.
Go to the last page in the PDF file, with the current relative scroll position.
Go to the next page.
Go to the next page, with the current relative scroll position.
Go to the previous page.
Go to the previous page, with the current relative scroll position.
Scroll up by one screenful.
Scroll down by one screenful.
Scroll left by n pixels.
Scroll right by n pixels.
Scroll up by n pixels.
Scroll down by n pixels.
Scroll up by n pixels, moving to the previous page if appropriate.
Scroll down by n pixels, moving to the next page if appropriate.
Scroll to the top edge of the current page, with no horizontal movement.
Scroll to the bottom edge of the current page, with no horizontal movement.
Scroll to the left edge of the current page, with no vertical movement.
Scroll to the right edge of the current page, with no vertical movement.
Scroll to the top-left corner of the current page.
Scroll to the bottom-right corner of the current page.
Move forward along the history path.
Move backward along the history path.
Set the zoom factor to z%.
Set the zoom factor to fit-page.
Set the zoom factor to fit-width.
Set the zoom factor to fit-height.
Zoom in - go to the next higher zoom factor.
Zoom out - go the next lower zoom factor.
Zoom in to the currently selected rectangle, if there is one.
Rotate the page 90 degrees clockwise.
Rotate the page 90 degrees counterclockwise.
Set the selection to the specified coordinates on the specified page.
Go to continuous view mode.
Go to single-page view mode.
Toggle between continuous and single page view modes.
Go to full-screen mode.
Go to window (non-full-screen) mode.
Toggle between full-screen and window modes.
Open a PDF file in this window, using the open dialog.
Open a PDF file in a new window, using the open dialog.
Open a specified PDF file in this window.
Open a specified PDF file in a new window.
Open a specified PDF file in this window and go to a named destination.
Open a specified PDF file in a new window and go to a named destination.
Open a specified PDF file in this window and go to a page.
Open a specified PDF file in a new window and go to a page.
Reload the current PDF file.
Save the PDF file, using the 'save as' dialog.
Redraw the window.
Raise the window to the front.
Close the window. If this was the last open window, clear the window, but don't quit from Xpdf.
Close the window. If this was the last open window, quit from Xpdf.
Run an external command. The following escapes are allowed in the command string:
    %f => PDF file name (or an empty string if no
          file is open)
    %b => PDF file base name, i.e., file name minus
          the extension (or an empty string if no
          file is open)
    %u => link URL (or an empty string if not over
          a URL link)
    %p => current page number (or an empty string if
          no file is open)
    %x => selection upper-left x coordinate
          (or 0 if there is no selection)
    %y => selection upper-left y coordinate
          (or 0 if there is no selection)
    %X => selection lower-right x coordinate
          (or 0 if there is no selection)
    %Y => selection lower-right y coordinate
          (or 0 if there is no selection)
    %i => page containing the mouse pointer
    %j => x coordinate of the mouse pointer
    %k => y coordinate of the mouse pointer
    %% => %
    
The external command string will often contain spaces, so the whole command must be quoted in the xpdfrc file:
    bind x "run(ls -l)"
    
Open the outline pane.
Close the outline pane.
Toggle the outline pane between open and closed.
Scroll the outline down by n increments.
Scroll the outline up by n increments.
Set the keyboard focus to the main document window.
Set the keyboard focus to the page number text box.
Open the 'find' dialog.
Search for the string key as if it had been entered in the 'find' dialog.
Finds the next occurrence of the search string (no dialog).
Finds the previous occurrence of the search string (no dialog).
Open the 'print' dialog.
Open the 'about' dialog.
Quit from xpdf.

The following commands depend on the current mouse position:

Start a selection, which will be extended as the mouse moves.
End a selection.
Start a pan, which will scroll the document as the mouse moves
End a pan.
Display the popup menu.
Follow a hyperlink (does nothing if the mouse is not over a link).
Follow a hyperlink, opening PDF files in a new window (does nothing if the mouse is not over a link). For links to non-PDF files, this command is identical to followLink.
Same as followLink, but does nothing if there is a non-empty selection. (This is useful as a mouse button binding.)
Same as followLinkInNewWin, but does nothing if there is a non-empty selection. (This is useful as a mouse button binding.)

The default mouse bindings are as follows:

    bind mousePress1    any         startSelection
    bind mouseRelease1  any         endSelection followLinkNoSel
    bind mousePress2    any         startPan
    bind mouseRelease2  any         endPan
    bind mousePress3    any         postPopupMenu
    bind mousePress4    any         scrollUpPrevPage(16)
    bind mousePress5    any         scrollDownNextPage(16)
    bind mousePress6    any         scrollLeft(16)
    bind mousePress7    any         scrollRight(16)

The default key bindings are as follows:

    bind ctrl-home      any         gotoPage(1)
    bind home           any         scrollToTopLeft
    bind ctrl-end       any         gotoLastPage
    bind end            any         scrollToBottomRight
    bind pgup           any         pageUp
    bind backspace      any         pageUp
    bind delete         any         pageUp
    bind pgdn           any         pageDown
    bind space          any         pageDown
    bind left           any         scrollLeft(16)
    bind right          any         scrollRight(16)
    bind up             any         scrollUp(16)
    bind down           any         scrollDown(16)
    bind [              any         rotateCCW
    bind ]              any         rotateCW
    bind o              any         open
    bind O              any         open
    bind r              any         reload
    bind R              any         reload
    bind s              any         saveAs
    bind S              any         saveAs
    bind f              any         find
    bind F              any         find
    bind ctrl-f         any         find
    bind /              any         find
    bind ctrl-g         any         findNext
    bind ctrl-G         any         findPrev
    bind ctrl-p         any         print
    bind n              scrLockOff  nextPage
    bind N              scrLockOff  nextPage
    bind n              scrLockOn   nextPageNoScroll
    bind N              scrLockOn   nextPageNoScroll
    bind p              scrLockOff  prevPage
    bind P              scrLockOff  prevPage
    bind p              scrLockOn   prevPageNoScroll
    bind P              scrLockOn   prevPageNoScroll
    bind v              any         goForward
    bind V              any         goForward
    bind b              any         goBackward
    bind B              any         goBackward
    bind g              any         focusToPageNum
    bind G              any         focusToPageNum
    bind 0              any         zoomPercent(125)
    bind +              any         zoomIn
    bind -              any         zoomOut
    bind z              any         zoomFitPage
    bind Z              any         zoomFitPage
    bind w              any         zoomFitWidth
    bind W              any         zoomFitWidth
    bind h              any         zoomFitHeight
    bind H              any         zoomFitHeight
    bind alt-f          any         toggleFullScreenMode
    bind ctrl-l         any         redraw
    bind ctrl-w         any         closeWindowOrQuit
    bind ?              any         about
    bind q              any         quit
    bind Q              any         quit
    bind escape         any         quit

Previous versions of xpdf included a "viKeys" X resource. It is no longer available, but the following bindings are equivalent:

    bind h any scrollLeft(16)
    bind l any scrollRight(16)
    bind k any scrollUp(16)
    bind j any scrollDown(16)

Xpdf can be started in remote server mode by specifying a server name (in addition to the file name and page number). For example:

xpdf -remote myServer file.pdf

If there is currently no xpdf running in server mode with the name 'myServer', a new xpdf window will be opened. If another command:

xpdf -remote myServer another.pdf 9

is issued, a new copy of xpdf will not be started. Instead, the first xpdf (the server) will load another.pdf and display page nine. If the file name is the same:

xpdf -remote myServer another.pdf 4

the xpdf server will simply display the specified page.

The -raise option tells the server to raise its window; it can be specified with or without a file name and page number.

The -quit option tells the server to close its window and exit.

In order to support international text in user interface elements, xpdf uses the support for UTF-8 and Xft fonts that was introduced in OpenMotif 2.3.

The user interface makes use of four fonts which are specified using Motif Render Tables: default for most text, mono for text in a monospaced font, and helpHuge and helpBig for headings in the About dialog. The fonts used can be customised using X resources. By default, they are configured as follows:

    Xpdf*renderTable.default.fontType: FONT_IS_XFT
    Xpdf*renderTable.default.fontName: Sans-Serif
    Xpdf*renderTable.default.fontSize: 12
    Xpdf*renderTable.default.fontEncoding: iso10646-1
    Xpdf*renderTable.helpHuge.fontType: FONT_IS_XFT
    Xpdf*renderTable.helpHuge.fontName: Serif
    Xpdf*renderTable.helpHuge.fontStyle: bold
    Xpdf*renderTable.helpHuge.fontSize: 20
    Xpdf*renderTable.helpHuge.fontEncoding: iso10646-1
    Xpdf*renderTable.helpBig.fontType: FONT_IS_XFT
    Xpdf*renderTable.helpBig.fontName: Serif
    Xpdf*renderTable.helpBig.fontSize: 16
    Xpdf*renderTable.helpBig.fontEncoding: iso10646-1
    Xpdf*renderTable.mono.fontType: FONT_IS_XFT
    Xpdf*renderTable.mono.fontName: Monospace
    Xpdf*renderTable.mono.fontSize: 12
    Xpdf*renderTable.mono.fontEncoding: iso10646-1
If you prefer to use X core fonts, as in earlier versions of xpdf, you can specify these using conventional resources, provided that you use fonts with the "iso10646-1" Unicode charset:
    Xpdf*font: -*-helvetica-medium-r-normal-*-12-*-*-*-*-*-iso10646-1
    Xpdf*XmTextField.font: -*-courier-medium-r-normal-*-12-*-*-*-*-*-iso10646-1

Xpdf uses the following exit codes:

0
No error.
1
Error opening a PDF file.
99
Other error.

The original Xpdf software and documentation are copyright 1996–2014 Glyph & Cog, LLC. Modifications for Poppler support and further development were done by the Debian and Gentoo Xpdf maintainers, and by xpopple contributors.

pdftops(1), pdftotext(1), pdftohtml(1), pdfinfo(1), pdffonts(1), pdfdetach(1), pdftoppm(1), pdftopng(1), pdfimages(1), xpdfrc(5)

01 Dec 2021