GNU Ghostscript
Viewing images on-screen is only a little more difficult. Ghostscript for Linux comes with both X11 and SVGALib support. The executables for both versions should be in the /usr/bin directory: gs-with-X11 and gs-without-X11. You can run either version using its actual file name, but the more common implementation uses a soft link of the actual executable to the gs command. In either case, the executable's permissions should be setuid root so it can access the display. We'll describe how to use Ghostscript as a PostScript previewer with both the X Window System and SVGALib.
The X Window System provides a lot of the display support that Ghostscript would need to provide otherwise. As a result, it is by far the way to use Ghostscript as a previewer. As with the above example, we want to pass letter.tex through LaTeX and then convert the output to PostScript with the command line:
pslatex letter.tex; \
dvips -f <letter.dvi >letter.ps
Again, we need to specify the DEVICE string to gs, which is simply X11 for the X display. Ghostscript treats an X11 display frame as the standard output, and the X display services provide the geometry to display an entire page. A virtual window manager like FVWM already provides the facilities to scroll the view over the entire page. The ghostscript command, then, is simply:
gs -r72 -sDEVICE=X11 letter.psThis will provide us with an actual-size page on the screen, because we've overridden the default resolution with the -r switch.
A VGA display provides about 72 dots per inch resolution, so a legible, actual-size full U.S. letter page will not fit on the screen. This is why we rely on FVWM or another virtual window manager to scroll the view across the entire page. Ghostscript draws a page-high window on your X display. About half of the page is visible at a time. You can, of course, view the full page at twice its actual size by specifying your output resolution as 36dpi.
The simplest way to execute the Ghostscript command is in an xterm window. The page appears in a window which displays the child process of the Ghostscript command. Ghostscript writes its messages to standard error, which here is the xterm. Pressing enter in the xterm window tells showpage to display each successive page of Ghostscript output. You can set the default resolution in your ~/.Xdefaults file by adding the lines:
Ghostscript*xResolution: 72 Ghostscript*yResolution: 72
and then merge the defaults with the other X server defaults:
xrdb -merge ~/.XdefaultsIf the resolution isn't specified, the page is displayed on the screen at 300dpi, about one-quarter its actual size, which is visible in a 640x480 view without scrolling.
Things get a little more difficult when using a VGA display without X11 support. A standard Linux tty device provides no ready-made provision for paging over a full, U.S. letter-size image. Also, Ghostscript's SVGALib routines must be provided with geometry and resolution information to preview images. The following information is specific to my Compaq laptop, Chanel3, which has a 16 color, 640x480 standard VGA display, GNU Ghostscript Version 3.33 and SVGALib version libvga.so.1.2.10. You'll need to adjust the parameters to suit your hardware, but the basic procedure should be similar.
The settings that Ghostscript recognizes for various hardware configurations are listed in use.doc file and the gs man page. The DEVICE string is “linux” for a Linux virtual console; that is:
/dev/tty1 - /dev/tty9
This string corresponds to the virtual console's /etc/termcap entries. The -r resolution, parameter is one of several dozen VGA modes that SVGALib recognizes. Ghostscript defines single-digit mode numbers which correspond to standard width-by-height notation. There is a complete list in the Ghostscript man page. In this case, Mode 4 is 16-color, 640x480 VGA. Much of the following information depends on whether SVGALib provides information on display geometry for your particular display. Ghostscript requires this information to display anything. It must be provided, for one thing, with the aspect ratio of the display (the ratio of the display's width to its height) in order to scale the fonts correctly.
The geometry parameter (-g) tells Ghostscript the display dimensions. Ghostscript scales the output page to the geometry we specify. We'll address this problem in a moment. With these parameters set, our Ghostscript command is:
gs -sDEVICE=linux -r4 -g640x480 letter.ps
Remember that gs is really a link to the executable file /usr/bin/gs-without-X11. Here, we tell Ghostscript to display a full page by specifying a display geometry that's twice the size of the actual screen. This gives us a page that is slightly more than twice as large as the video display. To double the size of the virtual display—the “device space” in PostScript jargon—we use the command line:
gs -sDEVICE=linux -r4 -g640x960 letter.pswhich gives us an actual-size view of the top half of the printed page. To view the bottom half of the page, we can specify an offset of the image's Y origin as half of a U.S. letter-size page:
gs -sDEVICE=linux -r4 -g640x960 -dYO=5.5 letter.psThe default units are inches. The image's X origin can be shifted similarly.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- Linux Systems Administrator
- New Products
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Web & UI Developer (JavaScript & j Query)
- Designing Electronics with Linux
- Dynamic DNS—an Object Lesson in Problem Solving
- Using Salt Stack and Vagrant for Drupal Development
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Have you tried Boxen? It's a
3 hours 4 min ago - seo services in india
7 hours 36 min ago - For KDE install kio-mtp
7 hours 36 min ago - Evernote is much more...
9 hours 36 min ago - Reply to comment | Linux Journal
18 hours 22 min ago - Dynamic DNS
18 hours 56 min ago - Reply to comment | Linux Journal
19 hours 54 min ago - Reply to comment | Linux Journal
20 hours 45 min ago - Not free anymore
1 day 46 min ago - Great
1 day 4 hours ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




Comments
Emacs Tex mode printing via Ghostscript shell scripts
The section "Ghostscript as a Document Post-Processor and Previewer" of this article sounds very interesting but doesn't work. More explanation would be nice.
Alex.
Re: Emacs TeX mode printing via Ghostscript shell scripts
Try to isolate the problem. Do the individual utilities run correctly from the shell prompt? Then, do the shell scripts run correctly from the shell? If they don't, then try to include the error messages. If they do, then try to include the debug output from the Emacs interpreter. Also include the version of each utility, so I can duplicate the errors produced by newer versions. Or, you can follow these procedures, and submit a patch.
Robert Kiesling