GNU gv Manual


Next: , Previous: (dir), Up: (dir)

GNU gv

GNU gv - View PostScript and PDF documents using ghostscript.

This is the First edition of the GNU gv Manual, updated for gv version 3.6.1.

Copyright © 1995, 1996, 1997 Johannes Plass

Copyright © 2004 José E. Marchesi

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 or any later version published by the Free Software Foundation.

Table of Contents


Next: , Previous: Top, Up: Top

1 Introduction

GNU gv allows to view and navigate through PostScript and PDF documents on an X display by providing a user interface for the ghostscript interpreter.

Please note that gv is derived from Tim Theisen's ghostview.


Next: , Previous: Introduction, Up: Top

2 Invoking gv

Usage: gv [OPTION]... [FILE]
PostScript and PDF viewer.
  --monochrome               display document using only black and white
  --grayscale                display document without colors
  --color                    display document as usual
  --safer                    start ghostscript in safe mode
  --nosafer                  do not start ghostscript in safe mode
  --quiet                    start ghostscript with the -dQUIET option
  --noquiet                  do not start ghostscript with the -dQUIET option
  --arguments=ARGS           start ghostscript with additional options as specified
                             by the string ARGS
  --page=LABEL               display the page with label LABEL first
  --center                   the page should be centered automatically
  --nocenter                 the page should not be centered automatically
  --media=MEDIA              selects the paper size to be used
  --orientation=ORIENTATION  sets the orientation of the page
  --scale=N                  selects the scale N
  --scalebase=N              selects the scale base N
  --swap                     interchange the meaning of the orientations landscape
                             and seascape
  --noswap                   do not interchange the meaning of the orientation
                             landscape and seascape
  --antialias                use antialiasing
  --noantialias              do not use antialiasing
  --dsc                      dsc comments are respected
  --nodsc                    dsc comments are not respected
  --eof                      ignore the postscript EOF comment while scanning
                             documents
  --noeof                    do not ignore the postscript EOF comment while
                             scanning documents
  --pixmap                   use backing pixmap
  --nopixmap                 do not use backing pixmap
  --watch                    watch the document file for changes
  --nowatch                  do not watch the document file for changes
  --help                     print a help message and exit
  --usage                    print a usage message and exit
  --resize                   fit the size of the window to the size of the page
  --noresize                 do not fit the size of the window to the size of the page
  -geometry [<width>][x<height>][{+-}<xoffset>{+-}<yoffset>]
  --ad=FILE                  read and use additional resources from FILE
  --style=FILE               read and use additional resources from FILE. These resources
                             have lower priority than those provided on the context of --ad
  --spartan                  shortcut for --style=gv_spartan.dat
  --version                  show gv version and exit
file
The name of the file to be displayed. The file ending .ps may be omitted. file may point to a compressed file (gzipped, bzipped, zipped or compressed). Viewing PDF files requires at least ghostscript version 4.x.
--ad=file
Read and use additional resources from the file file. These resources have higher priority than those provided in the context of the --style option.
--antialias, --noantialias
Whether to use antialiasing.
--arguments=args
Start ghostscrip with additional options as specified by the string args.
--center, --nocenter
Whether the page should be centered automatically.
--dsc, --nodsc
Determines if document structuring convention (DSC) comments should be respected or ignored. If --nodsc is used gv will not attempt to examine the structure of the document but will pass the file to the ghostscript interpreter as a whole. In this case no page numbers are shown and freely moving around in the document is not possible. This option may help when viewing files not conforming to the document structuring conventions.
--eof, --noeof
Defines the behaviour of the postscript scanner used to examine the structure of the document. If --noeof is used the scanner will ignore end of file (EOF) comments. This may help when viewing documents which import other documents without enclosing them within the proper "BeginDocument" and "EndDocument" comments. If --eof is used, the scanner treats an EOF comment as marking the end of the file.
--pixmap, --nopixmap
If --pixmap is used gv tries to maintain off-screen regions of the displayed page by allocating a sufficiently large pixmap. If --nopixmap is used the X Server is responsible for maintaining obscured portions of the displayed page (see also the useBackingPixmap resource).
--version
Print the version number of gv to standard output and exit.
--help, --usage
Display a short help message and exit.
--scale=n
Selects the scale entry n relative to the scale 1.0. n must be an integer.
--scalebase n
Selects the scale base n.
--monochrome, --grayscale, --color
Sets the color palette to be used.
--media=media
Selects the paper size to be used. Valid values are names of paper sizes that appear in the list of page medias as given by the medias resource.
--page=label
Display the page with label label first.
--orientation=orientation
Sets the orientation. Valid values for orientation are portrait, landscape, seascape and upsidedown.
--quiet, --noquiet
Whether to start ghostscript with the -dQUIET option.
--resize, --noresize
Whether ghostscrip is allowed to automatically fit the size of its window to the size of the displayed page.
--safer, --nosafer
Whether to start ghostscript with the -dSAFER option.
--spartan
This is a shortcut for --style=gv_spartan.dat.
--style=file
Read and use additional resources from the file file. These resources have lower priority than those provided in the context of the --ad option.
--swap, --noswap
Whether to interchange the meaning of the orientations landscape and seascape.
--watch, --nowatch
The --watch option causes gv to check the document periodically. If changes are detected gv will automatically display the newer version of the file. The document is by default checked once every second. This can be changed via the watchFileFrequency resource. Note that sending gv the SIGHUP signal also causes an update of the displayed document. This method may be used by document creators to trigger gv remotely.


Next: , Previous: Invoking gv, Up: Top

3 Resources


Next: , Previous: Resources, Up: Resources

3.1 Resource files

In general gv does not depend on any external resource files. However, when starting gv, preferences are read from

a system specific resource file.
The name of this file is GV and is installed on as part of gv's architecture independent library. Usually the library files are installed on /usr/local/lib/gv.

Administrators may want to modify this file in order to set up gv according to the local needs of their system.

a user specific resource file.
The name of this file is either ~/.gv or as described by the XUSERFILESEARCHPATH environment variable.

The files gv_user.ad and gv_system.ad (located in the library directory of gv, which is most probably either /usr/local/lib/gv/ or /usr/lib/gv/ may serve as a basis for constructing the user and system specific resource files.

Note that the user and system specific resource files are not the only sources of preferences taken into account when gv is started. However, in practice these are the most important.


Previous: Resource files, Up: Resources

3.2 Resources of gv

The following describes some of the resources of gv. The precise syntax of some of the resource values may be inferred from the appended default system specific resource file.

antialias
Whether antialiasing should be used. Valid values are True and False.

It defaults to True.

autoCenter
Whether the displayed page should automatically be centered (for instance when opening a new file). Valid values are True and False.

It defaults to True.

autoResize
Whether gv is allowed to resize the main window according to the size of the current page. Valid values are True and False.

It defaults to True.

confirmPrint
Whether printing requires an extra confirmation. Valid values are True and False.

It defaults to True.

confirmQuit
Whether leaving gv requires extra confirmation. Valid values are 0 (Never), 1 (When processing) and 2 (Always). The default value is 1, which causes a confirmation request when trying to leave gv in the presence of pending PDF to Postscript conversions.
scrollingEyeGuide
If this resource is True scrolling via the keyboard causes a temporary border to be drawn around the previously visible area of the page. Allowed values are True and False.

It defaults to True.

ignoreEOF
Defines the behaviour of the postscript scanner as described in the Options section. Valid values are True and False.

It defaults to True.

respectDSC
Determines whether gv should attempt to respect document structuring comments. Valid values are True and False.

It defaults to True.

reverseScrolling
Defines the interpretation of directions when scrolling with the mouse. Valid values are True and False.

It defaults to False.

swapLandscape
Whether the meaning of landscape and seacape should be interchanged. Valid values are True and False.

It defaults to False.

scratchDir
Specifies a directory used to store temporary data.

It defaults to the invocation directory.

defaultSaveDir
Specifies the default destination directory for files to be saved.

It defaults to the home directory, ~/.

useBackingPixmap
If the value of this resource is False the X Server is advised that saving off-screen pixels of the displayed page would be beneficial (maintaining backing store). In this case gv does not actively maintain the contents of the page but relies on the X Server. The server is, however, always free to stop maintaining backing backing store. If the value of this resource is True the X Server is advised that maintaining backing store is not useful. In this case gv attempts to allocate a sufficiently large pixmap to store the contents of the displayed page.

It defaults to True.

watchFile
Whether the document should be checked periodically and updated automatically if changes are detected. Valid values are True and False.

It defaults to False.

watchFileFrequency
Defines the time in milliseconds elapsing between successive checks of the document when watchFile is set to True. Allowed values must be larger than 500.

It defaults to 1000.

printCommand
The command used for printing a file. The command may contain multiple %s wildcards which will be replaced by the name of the file to be printed.

It defaults to lpr.

gsInterpreter
The command used to start the ghostscript interpreter.

It defaults to gv.

gsCmdScanPDF
The command used to extract document structuring comments from a PDF file.

It defaults to gs -dNODISPLAY -dQUIET -sPDFname=%s -sDSCname=%s pdf2dsc.ps -c quit

gsCmdConvPDF
The command used to convert a PDF file to PostScript.

It defaults to gs -dNODISPLAY -dQUIET -dNOPAUSE -sPSFile=%s %s -c quit

gsX11Device
The ghostscript command line option which activates the X11 device.

It defaults to -sDEVICE=x11

gsX11AlphaDevice
The ghostscript command line option which activates the X11 device with antialiasing enabled.

It defaults to -dNOPLATFONTS -sDEVICE=x11alpha

gsSafer
Determines whether ghostscript should be started with the -dSAFER command line option.

It defaults to True.

gsQuiet
Determines whether ghostscript should be started with the -dQUIET command line option.

It defaults to True.

gsArguments
May be used to provide additional command line options for the ghostscript interpreter. Starting gv with the -arguments arguments option will override this resource setting.

It defaults to the empty string.

magMenu
Describes the menu that pops up when preparing to to zoom an area of the displayed page.
dirs
Defines a list of directories accessible via the Directories menu in the file selection window. The special value Home corresponds to the users home directory, the value Tmp corresponds to the scratch directory as defined by the scratchDir resource.

It defaults to Home Tmp /usr/doc /usr/local/doc

filter
Defines the default filter to be used when displaying a directory contents in the file selection window. A filter is specified according to the syntax
     
        <filter>    := [<filespecs>] [no <filespecs>]
        <filespecs> := <filespec> [<filespecs>]
        <filespec>  := filename possibly including wildcards '*'
                       which match any character.

Example: The filter

     
        GV*filter: *.ps *.pdf no .*

screens out all files with names starting with a dot and keeps of the remaining ones only those which end on .ps or .pdf.

It defaults to no .*

filters
Defines a list of filters offered in the Filters menu of the file selection window. The filter None has a special meaning causing all files to be displayed when the corresponding menu entry is selected.
miscMenuEntries
Describes the menu that pops up when clicking with the third mouse button on the displayed page. The value of this resource is a list of menu entries.

Allowed entries are


showTitle
Whether the name of the displayed document should be shown in the title bar of the window. The name of gv's icon will also change accordingly if this resource is set to True.

It defaults to True.

maximumWidth, maximumHeight
When resizing gv will not attempt to exceed the size specified by these resources. These resources may be specified as a positive integer or as screen, optionally combined with a positive or negative offset. The default values listed above provide examples for this syntax. screen will automatically be replaced by the size of the screen.

maximumWidth defaults to screen-20. maximumHeight defaults to screen-44.

minimumWidth, minimumHeight
Defines a minimum size for the main window. Valid values for both resources are positive integers larger than 200.

minimumWidth defaults to 400. minimumHeight defaults to 430.

scale
Sets the initial scale. The value of this resource is the offset of the scale to be selected relative to the scale 1.0 in the the Scale menu.

It defaults to 0.

scaleBase
Selects the initial scale base. The value of this resource should be a positive integer.

It defaults to 1.

scales
Defines the available scales bases and scales in the Scale menu.
orientation
Sets the initial orientation. Valid values are

automatic causes gv to attempt to derive the correct orientation from document structuring comments.

It defaults to automatic.

fallbackOrientation
Defines the paper-size to be used when automatic orientation detetction fails. Valid values are portrait, landscape, seascape and upside-down.

It defaults to portrait.

medias
A list describing the page medias known to gv. List entries starting with ! or # will not appear in the Media menu but will still be used for automatic paper size detection.
pagemedia
Sets the paper size. Allowd values are as given in the above list of paper-sizes. Specifying automatic causes gv to attempt to derive the correct paper-size from document structuring comments.

It defaults to automatic.

fallbackPageMedia
Defines the paper-size to be used when automatic paper-size detetction fails. Valid values are as given in the above list of paper-sizes.

It defaults to a4.


Next: , Previous: Resources, Up: Top

4 Mouse and key bindings


Next: , Previous: Mouse and key bindings, Up: Mouse and key bindings

4.1 Mouse bindings in the Main and the Zoom window

The following mouse events are defined when the mouse pointer is either on the displayed page or on a zoomed area:

press button 1, move mouse, release button 1
Scrolls the displayed page 'proportionally'.
press button 3, move mouse, release button 3
Scrolls the displayed page 'absolutely'.
double-click with button 1
In the main window this displays the previous/next page if the double-click occured in the left/right half of the window. In a zoom window it does nothing.
press button 2, release button 2
Pops up a small menu which allows to choose a magnification for a certain area around the current mouse position. After selecting a magnification a zoom window pops up displaying the area at the chosen scale.
press button 2, move mouse, release button 2
This draws and thereby defines a rectangular region which can be displayed in a zoom window. The magnification for the area can be selected by means of a popup menu which appears after releasing button 2.
press button 1, press button 2
Reload the current page. This event sequence works only in the main window.
press button 3, release button 3
Pops up a small menu which offers a few standard actions like 'Reload', 'Mark Page', etc.


Next: , Previous: Mouse bindings in the Main and the Zoom window, Up: Mouse and key bindings

4.2 Mouse bindings in the File Selection popup

The following mouse events are defined when the mouse pointer is in the window of either a file or a directory list:

press button 1, move mouse, release button 1
Scrolls a file or directory list 'proportionally'.
press button 2, move mouse, release button 2
Scrolls a file or directory list 'absolutely'.
press button 2, release button 2
Scrolls a file or directory list one page up/down if the button was pressed in the upper/lower half of the list.
double-click with button 1 on a filename
Selects the file and closes the File Selection popup.
click with button 1 on a directory name
Causes the contents of this directory to be displayed.


Next: , Previous: Mouse bindings in the File Selection popup, Up: Mouse and key bindings

4.3 Mouse bindings in the Table of Contents

The following mouse events are defined when the mouse pointer is in the window showing a list of page numbers of the current file (table of contents):

press button 1, move mouse, release button 1
Scrolls the table of contents.
press button 1 on a page number
Go to this page.
press button 2 on a page number
Mark this page if it is unmarked, but unmark it if it is marked.
press button 2, move mouse, release button 2
Marks/unmarks all unmarked/marked pages in the region crossed by the mouse pointer during the movement.


Next: , Previous: Mouse bindings in the Table of Contents, Up: Mouse and key bindings

4.4 Mouse bindings in the Panner widget

The Panner widget is the rectangular region located close to the left edge of the main window. It indicates the size and the position of the visible area of the current page relative to the total page.

The following mouse events are defined when the mouse pointer is in this region:

press button 1, move mouse
Scrolls the displayed page.
press button 2
Display the previous page.
press button 3
Display the next page.


Next: , Previous: Mouse bindings in the Panner widget, Up: Mouse and key bindings

4.5 Mouse bindings in the << and >> button windows

The << and >> buttons are used to move to another page. The following mouse events are defined:

press button 1
Move 1 page forward/backwards.
press button 2
Move 5 pages forward/backwards.
press button 3
Move 10 pages forward/backwards.


Previous: Mouse bindings in the << and >> button windows, Up: Mouse and key bindings

4.6 Key Bindings

The following key events are defined in the main window. Those bindings scrolling the page are also defined in zoom popups.


Next: , Previous: Key Bindings, Up: Key Bindings

4.6.1 Notation

<S-X>
means press <Shift> and key <X>
<C-X>
means press <Ctrl> and key <X>
<SC-X>
means press <Shift> or <Ctrl> and key <X>


Next: , Previous: Notation, Up: Key Bindings

4.6.2 Miscellaneous keys:

<A>
Toggle antialiasing on and off
<O>
Open a new file
<Q>
Quit gv
<R>
Toggle gv's resizing behaviour
<I>
Respect/Ignore document structuring
<W>
Watch file / Don't watch file
<S>
Save the marked pages
<SC-S>
Save the current file
<P>
Print the marked pages
<SC-P>
Print the current file
<c-L>
Reload the current page
<.>
Reload the current page
<SC-.>
Reopen the current file
<M>
Mark the current page
<N>
Unmark the current page


Next: , Previous: Miscellaneous keys, Up: Key Bindings

4.6.3 Orientation

<7>
Orientation portrait
<8>
Orientation landscape
<9>
Orientation upside-down
<0>
Orientation seascape


Next: , Previous: Orientation, Up: Key Bindings

4.6.4 Magnification

<SC-6>
Select the scale entry -6 relative to the scale 1.0
<SC-5>
Select the scale entry -5 relative to the scale 1.0
<SC-4>
Select the scale entry -4 relative to the scale 1.0
<SC-3>
Select the scale entry -3 relative to the scale 1.0
<SC-2>
Select the scale entry -2 relative to the scale 1.0
<SC-1>
Select the scale entry -1 relative to the scale 1.0
<^>
Select the scale 1.0 (for german keyboard layout)
<`>
Select the scale 1.0
<1>
Select the scale entry 1 relative to the scale 1.0
<2>
Select the scale entry 2 relative to the scale 1.0
<3>
Select the scale entry 3 relative to the scale 1.0
<4>
Select the scale entry 4 relative to the scale 1.0
<5>
Select the scale entry 5 relative to the scale 1.0
<6>
Select the scale entry 6 relative to the scale 1.0
<+>
Select the next scale entry
<=>
Select the next scale entry
<->
Select the previous scale entry


Previous: Magnification, Up: Key Bindings

4.6.5 Navigating

<Arrow>
Scroll in the direction of the arrow
<S-Up>
Scroll columns up or jump -1 pages
<S-Down>
Scroll columns down or jump 1 pages
<S-Left>
Scroll rows left or jump -1 pages
<S-Right>
Scroll rows right or jump 1 pages
<C-Up>
Jump -1 pages (to top/left corner)
<C-Down>
Jump 1 pages (to top/left corner)
<C-Left>
Jump -5 pages (to top/left corner)
<C-Right>
Jump 5 pages (to top/left corner)
<D>
Identical to arrow up
<X>
Identical to arrow down
<Z>
Identical to arrow left
<Y>
Identical to arrow left
<C>
Identical to arrow right
<V>
Center the page
<SC-Space>
Scroll columns up or jump -1 pages
<Space>
Scroll columns down or jump 1 pages
<BackSpace>
Scroll columns up or jump -1 pages
<Insert>
Jump -5 pages
<Delete>
Jump 5 pages
<Home>
Go to the first page
<End>
Go to the last page
<Prior>
Jump -1 pages
<Next>
Jump 1 pages
<Keypad 0-9>
Highlight a page number
<Keypad ->
Highlight previous page number
<Keypad +>
Highlight next page number
<Keypad Enter>
Jump to the highlighted page
<C-Enter>
Jump -1 pages
<S-Enter>
Jump -1 pages
<Enter>
Jump 1 pages
<B>
Jump -1 pages
<F>
Jump 1 pages


Next: , Previous: Mouse and key bindings, Up: Top

5 Comments about the user interface


Next: , Previous: Comments about the user interface, Up: Comments about the user interface

5.1 Scales

The Scale menu which allows to view the document at different sizes is divided into two parts. The first part shows a list of available scale bases, the second part, separated by a line, lists the relative scales which are applied with respect to the selected scale base.

By default two scales bases are available, the Natural size and the Pixel based base. When choosing the Pixel based scale base a relative scale of 1.0 causes one postscript point to correspond to one pixel on the screen.

When viewing a document at a relative scale of 1.0 using the Natural size base the page should appear in its real size, as if printed on paper. For the Natural size base to work properly gv has to know the correct size of the root window. Automatic detection of this size unfortunately only provides approximate results, therefore it is best if it is provided by the user. To do so the resource

   GV.screenSize:  <width> x <height>

should be added to the SCREEN_RESOURCES property of the screen the document is viewed on, with width and height describing the width and height of the root window in units of millimeters. For instance by using the command

   echo "GV.screenSize: 396 x 291" | xrdb -override -screen

a width of 346 mm and a height of 291 mm will be used for the Natural size scale base. Alternatively the resource

   GV.screenSize_<machine>_<disp>_<scr>:  <width> x <height>

may be added to a resource file read by gv. Here machine ,disp and ANGLED describe the display on which gv displays the document. For instance, if the display is set to tic.tac.toe.wo:0.1 the resource should be specified as

   GV.screenSize_tic_0_1: 396 x 291

Note that this method doesn't work on VMS. As a last alternative the resource

   GV.screenSize:  <width> x <height>

may be added to one of the resource files. However, for obvious reasons this method should be used only on single user machines.


Next: , Previous: Scales, Up: Comments about the user interface

5.2 Scrolling

It is probably a de facto standard for user interfaces that windows are supposed to be scrolled by means of scrollbars attached to their sides. However, for various reasons the use of scrollbars has been minimized in gv.

Instead, in all windows with obscured data, scrolling may be performed by

pressing button1, moving the mouse, then releasing button1

directly in the window. This includes the displayed page, zoom popups, the table of contents and the file and directory lists displayed in the file selection popup.


Previous: Scrolling, Up: Comments about the user interface

5.3 Displaying new versions of a document

During document creation it is usually desirable to always display the newest version of the document in work.

Instead of explicitly loading it via the file selection popup the most recent version can be displayed by pressing the Reload button in the main window (VMS users should use the Update File entry in the File menu). Choosing the Reload entry in the menu that pops up when clicking with the third mouse button anywhere on the displayed page certainly has the same effect.

More comfortable is the "Watch File" feature which may be switched on by selecting the corresponding entry in the State menu. If activated gv will check every now and then if a new version of the displayed file exists. If so it will be displayed automatically. By default the file is checked about once every second.

Finally it may also be left to the document creating program to trigger gv to update its display. To do so the program should send the SIGHUP signal to gv. For instance at the end of a shell script generating a postscript file from latex sources the line

   kill -SIGHUP <gv_pid>

may be added (here gv_pid is the process id of gv). Executing the script and thereby creating a new version of the document will then also cause the result to be displayed instantaneously. Please note that this feature is available only on X11 R6 based systems.


Next: , Previous: Comments about the user interface, Up: Top

6 Frequently asked questions


Next: , Previous: Frequently asked questions, Up: Frequently asked questions

6.1 What happened to the scroll bars?

They have been removed in order to make more room for the image. The displayed portion of the image may be moved by dragging the image or the paner (panel between the "Save Marked" and << >> buttons) with the mouse. Alternatively, the cursor arrow keys can be used.


Next: , Previous: What happened to the scroll bars?, Up: Frequently asked questions

6.2 How can I make even more room for the image?

Use the "spartan" style by starting gv with the command

         gv -spartan

This removes the "Open", "Print", "Save", "Reload", and page marking buttons (they are still available from the "File" and "Page" menus) and replaces them with the document attribute controls, which are normally along the top.


Next: , Previous: How can I make even more room for the image?, Up: Frequently asked questions

6.3 Small characters are not very clear

Antialiasing can improve the display of bitmapped fonts (eg. from TeX) when displayed on a colour or greyscale screen. The same technique is used by xdvi. Note that antialiasing requires at least Ghostscript version 4.x.

Antialiasing can be turned on from the "State" menu, and can be made default by saving the setting in State | gv Options....


Previous: Small characters are not very clear, Up: Frequently asked questions

6.4 The output is not refreshed automatically

There are two methods that can be used to save the contents of the window when it's not currently displayed: backing store and backing pixmap. Some X-servers seem to support only backing store (eg. VAXstations) and some only backing pixmap (eg. some X-terminals, including EWS).

In order to force gv to use one method or the other, use the State | Setup Options ... menu and toggle the "Backing Pixmap" button. When selected/highlighted (normally the default), gv will use backing pixmap; otherwise it will use backing store. Select "Apply" to use a new setting and "Save" to make it the new default.


Next: , Previous: Frequently asked questions, Up: Top

7 gv internals


Next: , Previous: gv internals, Up: gv internals

7.1 Interface with ghostscript


Next: , Previous: Interface with ghostscript, Up: Interface with ghostscript

7.1.1 Ghostview interface to ghostscript

When the GHOSTVIEW environment variable is set, ghostscript draws on an existing drawable rather than creating its own window. Ghostscript can be directed to draw on either a window or a pixmap.


Next: , Previous: Ghostview interface to ghostscript, Up: Interface with ghostscript

7.1.2 Drawing on a Window

The GHOSTVIEW environment variable contains the window id of the target window. The window id is an integer. Ghostscript will use the attributes of the window to obtain the width, height, colormap, screen, and visual of the window. The remainder of the information is gotten from the GHOSTVIEW property on that window.


Next: , Previous: Drawing on a Window, Up: Interface with ghostscript

7.1.3 Drawing on a Pixmap

The GHOSTVIEW environment variable contains a window id and a pixmap id. They are integers separated by white space. Ghostscript will use the attributes of the window to obtain the colormap, screen, and visual to use. The width and height will be obtained from the pixmap. The remainder of the information, is gotten from the GHOSTVIEW property on the window. In this case, the property is deleted when read.


Next: , Previous: Drawing on a Pixmap, Up: Interface with ghostscript

7.1.4 The GHOSTVIEW environment variable

parameters
window-id [pixmap-id]
scanf format
"%d %d"

Explanation of parameters:

window-id
tells ghostscript where to If pixmap-id is not present, ghostscript will draw on this window.
pixmap-id
If present, tells ghostscript that a pixmap will be used as the final destination for drawing. The window will not be touched for drawing purposes.


Next: , Previous: The GHOSTVIEW environment variable, Up: Interface with ghostscript

7.1.5 The GHOSTVIEW property

type
STRING
parameters
bpixmap orient llx lly urx ury xdpi ydpi [left bottom top right]
scanf format
"%d %d %d %d %d %d %f %f %d %d %d %d"

Explanation of parameters:

pixmap
pixmap id of the backing pixmap for the window. If no pixmap is to be used, this parameter should be zero. This parameter must be zero when drawing on a pixmap.
orient
orientation of the page. The number represents clockwise rotation of the paper in degrees. Permitted values are 0, 90, 180, 270.
llx, lly, urx, ury
Bounding box of the drawable. The bounding box is specified in PostScript points in default user coordinates.
xdpi, ydpi
Resolution of window. (This can be derived from the other parameters, but not without roundoff error. These values are included to avoid this error.)
left, bottom, top, right (optional)
Margins around the window. The margins extend the imageable area beyond the boundaries of the window. This is primarily used for popup zoom windows. I have encountered several instances of PostScript programs that position themselves with respect to the imageable area. The margins are specified in PostScript points. If omitted, the margins are assumed to be 0.


Previous: The GHOSTVIEW property, Up: Interface with ghostscript

7.1.6 Events from ghostscript

If the final destination is a pixmap, the client will get a property notify event when ghostscript reads the GHOSTVIEW property causing it to be deleted.

Ghostscript sends events to the window where it read the GHOSTVIEW property. These events are of type ClientMessage. The message_type is set to either PAGE or DONE. The first long data value gives the window to be used to send replies to ghostscript. The second long data value gives the primary drawable. If rendering to a pixmap, it is the primary drawable. If rendering to a window, the backing pixmap is the primary drawable. If no backing pixmap is employed, then the window is the primary drawable. This field is necessary to distinguish multiple ghostscripts rendering to separate pixmaps where the GHOSTVIEW property was placed on the same window.

The PAGE message indicates that a "page" has completed. Ghostscript will wait until it receives a ClientMessage whose message_type is NEXT before continuing.

The DONE message indicates that ghostscript has finished processing.


Next: , Previous: Interface with ghostscript, Up: gv internals

7.2 Comments recognized by ghostview

%!PS-Adobe-<real> [EPSF-<real>]
%%BoundingBox: <int> <int> <int> <int>|(atend)
%%CreationDate: <textline>
%%Orientation: Portrait|Landscape|(atend)
%%Pages: <uint>|(atend)
%%PageOrder: Ascend|Descend|Special|(atend)
%%Title: <textline>
%%DocumentMedia: <text> <real> <real> <real> <text> <text>
%%DocumentPageSizes: <text>
%%EndComments

Preview section:

%%BeginPreview
%%EndPreview

Defaults section:

%%BeginDefaults
%%PageBoundingBox: <int> <int> <int> <int>|(atend)
%%PageOrientation: Portrait|Landscape
%%PageMedia: <text>
%%EndDefaults

Prolog section:

%%BeginProlog
%%EndProlog

Setup section:

%%BeginSetup
%%PageBoundingBox: <int> <int> <int> <int>|(atend)
%%PageOrientation: Portrait|Landscape
%%PaperSize: <text>
%%EndSetup

Page properties:

%%Page: <text> <uint>
%%PageBoundingBox: <int> <int> <int> <int>|(atend)
%%PageOrientation: Portrait|Landscape
%%PageMedia: <text>
%%PaperSize: <text>
%%Trailer
%%EOF

Document section:

%%BeginDocument: <text> [<real>[<text>]]
%%EndDocument

Binary section:

%%BeginBinary: <uint>
%%EndBinary

Data section:

%%BeginData: <uint> [Hex|Binary|ASCII[Bytes|Lines]]
%%EndData


Previous: Comments recognized by ghostview, Up: gv internals

7.3 Paper Keywords and paper size in points

Letter		 612x792
LetterSmall	 612x792
Tabloid		 792x1224
Ledger		1224x792
Legal		 612x1008
Statement	 396x612
Executive	 540x720
A0               2384x3371
A1              1685x2384
A2		1190x1684
A3		 842x1190
A4		 595x842
A4Small		 595x842
A5		 420x595
B4		 729x1032
B5		 516x729
Envelope	 ???x???
Folio		 612x936
Quarto		 610x780
10x14		 720x1008


Previous: gv internals, Up: Top

Appendix A GNU General Public License

Version 2, June 1991
     Copyright © 1989, 1991 Free Software Foundation, Inc.
     59 Temple Place, Suite 330, Boston, MA 02111, USA
     
     Everyone is permitted to copy and distribute verbatim copies
     of this license document, but changing it is not allowed.

Preamble

The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software—to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.

When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.

For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.

Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.

Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.

The precise terms and conditions for copying, distribution and modification follow.

  1. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The “Program”, below, refers to any such program or work, and a “work based on the Program” means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term “modification”.) Each licensee is addressed as “you”.

    Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.

  2. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.

    You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

  3. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
    1. You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
    2. You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
    3. If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)

    These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

    Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.

    In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

  4. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
    1. Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
    2. Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
    3. Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)

    The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

    If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.

  5. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
  6. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
  7. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
  8. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.

    If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.

    It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

    This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

  9. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
  10. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

    Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and “any later version”, you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.

  11. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
  12. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
  13. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

How to Apply These Terms to Your New Programs

If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.

To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.

     one line to give the program's name and an idea of what it does.
     Copyright (C) year  name of author
     
     This program is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
     as published by the Free Software Foundation; either version 2
     of the License, or (at your option) any later version.
     
     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.
     
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.

Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this when it starts in an interactive mode:

     Gnomovision version 69, Copyright (C) year name of author
     Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
     type `show w'.  This is free software, and you are welcome
     to redistribute it under certain conditions; type `show c'
     for details.

The hypothetical commands show w and show c should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than show w and show c; they could even be mouse-clicks or menu items—whatever suits your program.

You should also get your employer (if you work as a programmer) or your school, if any, to sign a “copyright disclaimer” for the program, if necessary. Here is a sample; alter the names:

     Yoyodyne, Inc., hereby disclaims all copyright
     interest in the program `Gnomovision'
     (which makes passes at compilers) written
     by James Hacker.
     
     signature of Ty Coon, 1 April 1989
     Ty Coon, President of Vice

This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.