NIKOLA Computing User Documentation
Home
User Docs and FAQ
FAQ
Tutorials
About NIKOLA
Links

Converting Files to PS

This key step in printing anything in UNIX is converting it to postscript. Postscript is the de facto standard format for almost all printers in the UNIX environment, so no matter what the original file, a printing job will succeed. So with this in mind we begin the task of conversion.

Converting Plain Text Files

There are two ways of converting and printing plain text files. Both methods can be used to directly send the file to the printer, so you do not need to use a seperate command to print the generated file for either method. Both of the commands enscript and a2ps are nearly identical when used to simply print a text file with no extra formatting. However, looking through both of these commands' man pages will reveal a large and wide-ranging list of options that is worth looking into.

For simply converting a plain text file to a PostScript file you may use the command:

enscript -o output.ps inputfile
OR
a2ps -o output.ps inputfile

where "output.ps" is the PostScript file generated and "inputfile" is your source file that you'd like to convert. This will create a PostScipt file in your current directory that is suitable for printing. Now, if you'd like to send the PostScript files directly to a printer, you may use the command:

enscript -P printer inputfile
OR
a2ps -P printer inputfile

Both of these commands will send "inputfile" directly to the printer of your choosing.

Converting Image Files

There are two ways of converting images to PS files. The first is fairly simple. The standard utility here to view images is display, whose command syntax is as follows:

display filename

where filename is the name of our image. This will bring up a window that displays the image. If we right click on this image, a drop down menu appears which has a save option. Select the save option and it will bring up another window. To the left of Save at the bottom of the window is a button labeled Format. Click this and scroll through the options until you see PS. Highlight PS and click Select. Choose a filename ending in .ps, and click Save. You will then be presented with a list of page formatting options. Choose whichever format you'd like and click Select. You now have a postscript file suitable for printing.

The second method involves a tool called convert. Convert is part of the ImageMagick suite of tools, and is very powerful, supporting many more image types than display, but is completely commandline. Convert has a wide-ranging and comprehensive set of options for modifying the image during the process of conversion. Feel free to look through these by referencing the man page of convert. For simple conversions, however, convert is rather straight-forward. The command syntax is simply:

convert sourcefile output.ps

where sourcefile is simply the full file name of whatever image you are trying to convert (e.g. graph2.jpeg). You may choose any name for "output" but make sure you do not forget to append .ps to the name. This tells convert that you are trying to create a PostScript file, and as long as you include that, it will dump a PostScript file suitable for printing in your current directory.

Converting PDF Files

For multiple methods on creating PDF files, see Creating PDF Files.

A number of printers in Nikola support direct PDF printing. This means you may use lpr directly with a PDF file and the printer will have no issues. However, this is not always the case. So, if neccesary, one simple method to convert PDF files into PostScript files for printing is by using the command:

pdf2ps input.pdf output.ps

This will generate a PostScript file in your current directory that is suitable for printing.

For further details, see: