Ghostscript options file




















The PostScript setdistillerparams and currentdistillerparams operators are also recognized when the input is PostScript, and provide an equivalent way to set these parameters from within a PostScript input file.

Although the name implies that these parameters are for controlling PDF output, in fact the whole family of devices use these same parameters to control the conversion into PostScript and EPS as well. The pdfwrite family of devices recognize all of the Acrobat Distiller 5 parameters defined in the DistillerParameters version 5 document available from the Adobe web site. UseFlateCompression is treated as always on, but the switch CompressPages can be set to false to turn off page level stream compression.

Now that the patent has expired, we could change this should it become worthwhile. Note; if a non-integer downsample factor is used the code will clamp to the nearest integer if the difference is less than 0. PDF 2. The new Ghostscript-specific value Gray converts all colors to DeviceGray.

With the introduction of new color conversion code in version 9. NeverEmbed should always specify the original CID font name.

To specify these, you must use PostScript, either by including it in the PostScript source or by passing the -c command-line parameter to ghostscript as described in Limitations below. For example, including the PostScript string in your file in. This prevents the multiplication of JPEG artefacts caused by lossy compression. In addition this parameter will be ignored if the pdfwrite device needs to modify the source data.

This can happen if the image is being downsampled, changing colour space or having transfer functions applied. It has no effect on JPEG encoded images see above or masked images. Color Conversion and Management As of the 9. This considerably improves the color handling in both pdfwrite and ps2write, particularly in the areas of Separation and DeviceN color spaces, and Indexed color spaces with images. The colour management code has no effect at all unless either ColorConversionStrategy or ConvertCMYKImagesToRGB is set, or content has to be rendered to an image this is rare and usually required only when converting a PDF file with transparency to a version Options based on object type image, text, linework are not used, all objects are converted using the same scheme.

All other color spaces are converted appropriately. Separation and DeviceN spaces will be preserved if possible ps2write cannot preserve DeviceN or Lab and if the alternate space is not appropriate a new alternate space will be created.

By default Ghostscript determines viewing page orientation based on the dominant text orientation on the page. Sometimes, when the page has text in several orientations or has no text at all, wrong orientation can be selected. Acrobat Distiller parameter AutoRotatePages controls the automatic orientation selection algorithm. On Ghostscript, besides input stream, Distiller parameters can be given as command line arguments.

Valid values are: 0 portrait , 3 landscape , 2 upside down , and 1 seascape. See Limitations below. Ghostscript passes the orientation values from DSC comments to the pdfwrite driver, and these are compared with the auto-rotate heuristic.

If they are different then the DSC value will be used preferentially. The precise value for each control is listed in the table above. Many of the controls used for distiller parameters can be used on the command line with the -d or -s switches, and these will work correctly with PCL or PXL input. When the input is PostScript or PDF we can use the -c and -f switches to send PostScript through the interpreter to control these parameters, but clearly this is not possible when the interpreter does not understand PostScript.

In addition some features are controlled using the PostScript pdfmark operator and again that clearly is not possible unless we are using a PostScript interpreter to read the input. However it is important to realise that these are not processed by a full PostScript interpreter, and there are syntactic rules which must be followed carefully when using these parameters. This is done for the pdfmark case only by defining a special non-standard pdfmark name PUTFILE , this simply takes the preceding string, and uses it as a fully qualified path to a file.

Any further pdfmark operations can then use the named object holding the file to access it. The easiest way to use these parameters is to create a 'settings' file, put all the commands in it, and then put it on the command line immediately before the real input file.

For example:. The line breaks between "" below should be replaced with space characters, the double quote charcters " are required. In particular any pdfmark operations which rely on page numbers, such as Link or Outline annotations will not work correctly with this flag.

If it is a duplicate then instead of writing a new image into the PDF file, the PDF will reuse the reference to the earlier image. This can considerably reduce the size of the output PDF file, but increases the time taken to process the file. This time grows exponentially as more images are added, and on large input files with numerous images can be prohibitively slow. Setting this to false will improve performance at the cost of final file size.

Note that this will cause the conversion to PDF to be slightly slower and will usually result in a slightly larger PDF file. This option is incompatible with producing an encrypted password protected PDF file. There are a few annotation types which are not preserved, most notably Link and Widget annotations. However, should you wish to revert to the old behaviour, or find that the new behaviour leads to problems, you can set this switch to false which will cause all annotations to be inserted into the page content stream, instead of preserved as annotations.

Annotation types listed in this array will be preserved, whilst those not listed will be drawn according to the setting os ShowAnnots and ShowAnnotTypes. By using the controls PreserveAnnots, PreserveAnnotTypes, ShowAnnots and ShowAnnotTypes it is possible to select by annotation type whether annotations are preserved as annotations, drawn into the page, or simply dropped.

This control also requires the PDF interpreter to pass the marked content to the pdfwrite device, this is only done with the new C-based PDF interpreter. THe old PostScript-based interpreter does not support this feature and will not pass marked content to the pdfwrite device. Some old viewers, such as Ghostscript 3.

Setting this option to false, one can get more compatibility, but the mask interpolation is lost. Default value is false.

If the clipping path exceeds the specified size, the masked image and the clipping path is decomposed into smaller images. The value of the option counts straight path segments curved segments are not used for representing a mask. Default value is If a shading exceeds this value, the resolution of the output bitmap is reduced to fit into the specified number of bytes. Note that the number of bytes depends on the number of color components in ProcessColorModel or ColorConversionStrategy , assumes 8 bits per sample, and doesn't consider image compression or downsampling.

The image is rendered at the current resolution as specified by -r or the default of dpi. In general larger values will result in higher quality, but the output file size may increase dramatically, particularly with shadings which cover large areas. Shadings should generally only be rendered to images if CompatibilityLevel is 1. Note that large text at higher resolutions results in very large bitmaps which are likely to defeat caching in many printers.

As a result the text is emitted as simple images rather than as a type 3 bitmap font. Default value is true. The following options are useful for creating PDF 1.

If not, the page is converted into a single plain image with all transparency flattened. The easiest way is to provide it in the DefaultRGB file in the resource directory. DeviceRGB color values are passed unchanged. If a user needs a non trivial color adjustment, a non trivial DefaultRGB color space must be defined. Transfer functions and halftone phases are skipped. TrimBox and BleedBox entries are generated in page descriptions.

If empty, the document can be opened with no password, but the owner password is required to edit it. Negative values are allowed to represent unsigned integers with the highest bit set. The initial shape alpha value is 1.

The initial stroke alpha value is 1. The initial fill alpha value is 1. The initial value of the AIS flag is false. The initial value of the text knockout flag is true. Rendering stack operators The interpreter state is extended to include a per-context rendering stack for handling transparency groups and masks generically, "layers".

Groups accumulate a full value for each pixel paint plus transparency ; masks accumulate only a coverage value. Layers must be properly nested, i. Beginning and ending groups must nest properly with respect to save and restore : save and restore do not save and restore the layer stack. Currently, layers are not required to nest with respect to gsave and grestore , except that the device that is current in the graphics state when ending a layer must be the same as the device that was current when beginning the layer.

The mask parameter indicates whether the mask should be treated as as opacity mask 0 or shape 1. Ghostscript also supports the following IODevice in addition to a subset of those defined in the Adobe documentation:.

The files will be stored in the specified directory with arbitrary names. Since v. In earlier versions after calling. Note that most tracing output is only produced if the Ghostscript interpreter was built with the DEBUG preprocessor symbol defined. The zsetdebug C function, which implements this operator, is a useful breakpoint for debuggers.

Inserting ' true. A malicious file with an unbalanced restore could potentially restore back to a point where SAFER was not in operation.

Note: This uses setpagedevice to change. LockSafetyParams, so the page will be erased as a side effect of this operator. For example, to enable reading everywhere, but disallow writing and file control deleting and renaming files , the following can be used:. In the above example, use of stopped will allow the use of this sequence on older versions of Ghostscript where. See also. LockSafetyParams and User Parameters. NOTE: Any attempt to call this operator after.

Once activated, these access controls remain in place until the interpreter shuts down. This operator creates an ordered dither screening pattern with the parameters from the dictionary, returning by default a PostScript HalftoneType 3 threshold array based dictionary suitable for use with sethalftone or as a component Halftone of a HalftoneType 5 Halftone dictionary.

A larger value will allow more levels to be attained. SuperCellSize may need to be specified large enough to achieve the requested number of gray levels. This information can be used to construct a threshold array with a transfer function "pickled into" the threshold array, which is useful if the turn-on-sequence has more than pairs. Relies on Ghostscript being called with the "--" command line option - see Input Control See examples in lib for more information. The copy is writable and installable.

The instance is created in global VM. If finddevice is called more than once with the same device name, it creates the default instance the first time, and returns the same instance thereafter.

A prototype can be used with getdeviceprops or other parameter-reading operators, but it is read-only and cannot be set with setdevice : it must be copied first. Each element is interpreted as a gray value, or as RGB values, multiplied by At present, the palette must contain exactly 2, 4, 16, or entries, and must contain an entry for black and an entry for white; if it contains any entries that aren't black, white, or gray, it must contain at least the six primary colors red, green, blue, and their complements cyan, magenta, and yellow ; aside from this, its contents are arbitrary.

Alternatively, palette can be 16, 24, 32, or null equivalent to These are interpreted as:. Note that one can also make an image device with the same palette as an existing image device by copying a device using the copydevice operator. Sets the current device to the specified device. Also resets the transformation and clipping path to the initial values for the device. Signals an invalidaccess error if the device is a prototype or if. LockSafetyParams is true for the current device.

Some device properties may need to be set with putdeviceprops before setdevice is called. For example, the pdfwrite device will try to open its output file, causing an undefinedfilename error if OutputFile hasn't been set to a valid filename. In its usual configuration, Ghostscript supports all the standard PostScript LanguageLevel 3 filters, both encoding and decoding, except that it does not currently support:. Ghostscript also supports additional keys in the optional dictionary operands for some filters.

For the LZWDecode filter:. In addition to the standard PostScript LanguageLevel 3 filters, Ghostscript supports the following non-standard filters. Many of these filters are used internally to implement standard filters or facilities; they are almost certain to remain, in their present form or a backward-compatible one, in future Ghostscript releases. Recognized keys are:. For more details see the PNG specification. Some versions of Ghostscript may also support other non-standard filters for experimental purposes.

The current version includes the following such filters, which are not documented further. No code should assume that these filters will exist in compatible form, or at all, in future versions.

If this parameter is true for the current device, attempt to set a new device that has. LockSafetyParams false will signal an invalidaccess error. Because this feature relies upon rendering the input it is incompatible, and will generate an error on attempted use, with any of the vector output devices.

Ghostscript also supports the following read-only parameter that is not a true device parameter:. In addition, the following are defined per Adobe's documentation for the setpagedevice operator:. The null device ignores attempts to set PageSize ; its size is always [0 0].

It should be noted that calling setpagedevice with one of the above keys may reset the effects of any pdfmark commands up to that point. This value includes the space for padding raster lines and for an array of pointers for each raster line, thus the MaxBitmap value to allow a given PageSize of a specific number of bits per pixel to be rendered in a full page buffer may be somewhat larger than the bitmap size alone.

If MaxBitmap above forces banding mode, and if BufferSpace is large enough, the display list clist will consist of a single band. Note that the background printing thread will allocate a band buffer size determined by the BufferSpace or BandBufferSpace values in addition to the band buffer in the 'main' parsing thread.

The background printing thread will perform any processing of the raster data delivered by the rendering threads. Note that BGPrint is disabled for vector devices such as pdfwrite and NumRenderingThreads has no effect on these devices eitehr.

Since the determination of whether or not the page uses colors is determined before the conversion to device colors, this information is independent of the device output profile. Changing this value requires rebuilding. Also, the 'pageneutralcolor' status can be interrogated as a device parameter of the same name. Using PostScript there are several methods:. Note that the pageneutralcolor state is reset to false after the page is output, so this parameter is only valid immediately before showpage is executed, although the setpagedevice EndPage procedure can be used to check the state just prior to the actual output of the page that resets pagenuetralcolor.

For example:. The number of threads should generally be set to the number of available processor cores for best throughput. Note that each thread will allocate a band buffer size determined by the BufferSpace or BandBufferSpace values in addition to the band buffer in the 'main' thread.

Additoinally note that ths parameter has no effect with devices which do not generally render to a bitmap output, such as the vector devices eg pdfwrite and has no effect when rendering, but not using a clist. Attempts to set this parameter if. LockSafetyParams is true will signal an invalidaccess error. The following parameters are for use only by very specialized applications that separate band construction from band rasterization. Improper use may cause unpredictable errors. In particular, if you only want to allocate more memory for banding, to increase band size and improve performance, use the BufferSpace parameter, not BandBufferSpace.

Several different important kinds of measures appear throughout this document: inches, centimeters and millimeters, points, and bits per pixel. Ghostscript 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. This is a general option telling Ghostscript what to name the output. It can either be a single filename ' tiger. This option sets the resolution of the output file in dots per inch.

The default value if you don't specify this options is usually 72 dpi. These options control the use of subsample antialiasing. Their use is highly recommended for producing high quality rasterizations of the input files.

The size of the subsampling box n should be 4 for optimum output, but smaller values can be used for faster rendering. Antialiasing is enabled separately for text and graphics content. Because this feature relies upon rendering the input it is incompatible, and will generate an error on attempted use, with any of the vector output devices. 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 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 PNG output varying by bit depth. For normal use we recommend png16m for bit RGB color, or pnggray for grayscale. The png , png16 and pngmono devices respectively provide 8-bit color, 4-bit color and black-and-white for special needs. The pngmonod device is also a black-and-white device, but the output is formed from an internal 8 bit grayscale rendering which is then error diffused and converted down to 1bpp.

The pngalpha device is bit RGBA color with transparency indicating pixel coverage. The background is transparent unless it has been explicitly filled. PDF 1. Text and graphics anti-aliasing are enabled by default.

The pngmonod , png16m , pnggray and pngalpha devices all respond to the following:. Ghostscript includes output drivers that can produce jpeg files from postscript or pdf images. These are the jpeg and jpeggray devices. 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. The 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 is a loose collection of formats, now largely superceded by PNG except in applications where backward compatibility or special compression is required. Writing to stdout, pipes or other similar stream is not supported.

Attempting to do so will generate an error. There are two unrelated sets of TIFF drivers. There are five color TIFF drivers that produce uncompressed output:. The equivalent CMYK color for each spot color is determined using the alternate tint transform function specified in the Separation and DeviceN color spaces. Since this file is created based upon having color planes for each colorant, the file will correctly represent the appearance of overprinting with spot colors.

File names for the separations for the CMYK colorants are created by appending '. File names for the spot color separation files are created by appending the Spot color name in ' ' and '. Note that, while the name of the ink is case-sensitive, the filename may not be depending on the Operating System , so if a spot name matches one of the process ink names, it will have the spot number included as part of the name eg YELLOW0.

If desired the file names for the spot color separation files can be created by appending '. This change is a compile time edit. The tiffsep device will automatically recognize spot colors. In this case their order is determined by when they are found in the input file.

The names of spot colors may be specified via the SeparationColorNames device parameters. Internally each spot color is assigned a spot color number. These numbers start with 0 for the first spot color. The spot color numbers are assigned in the same order as the names are printed to stderr see below. This order also matches the ordering in the SeparationColorNames list, if this parameter is specified.

The spot color numbers are not affected by the SeparationOrder parameter. If only a subset of the colorants for a file is desired, then the separations to be output can be selected via the SeparationOrder device parameter. The tiffsep device also prints the names of any spot colors detected within a document to stderr.

This provides a simple mechanism for users and external applications to be informed about the names of spot colors within a document. Generally Ghostscript will support a maximum of 64 process and spot colors.

That is there can be up to 64 colorants accurately handled with overprint on a single page. If more than 64 colorants are encountered, those beyond 64 will be mapped to CMYK using the alternate tint transform. When rendering a PDF document, Ghostscript can deteremine prior to rendering how many colorants occur on a particular page. With Postscript, this is not possible in general. For example, 60 or less for a CMYK device such as tiffsep. If you specify more than is needed, the document will render more slowly.

The ideal case is to use the same number as the maximum number of spot colorants that occur on a single page of the document. If more spot colorants are encountered than is specified by -dMaxSpots, then a warning will be printed indicating that some spot colorants will be mapped to CMYK using the alternate tint transform.

In 1bpp mode, the device renders each component internally in 8 bits, but then converts down to 1bpp with error diffusion before output as described below in the tiffscaled device. No composite file is produced in 1bpp mode, only individual separations. The tiffscaled and tiffscaled4 devices can optionally use Even Toned Screening, rather than simple Floyd Steinberg error diffusion.

This patented technique gives better quality at the expense of some speed. While the code used has many quality tuning options, none of these are currently exposed. Any device author interested in trying these options should contact Artifex for more information. The file specified via the OutputFile command line parameter will not be created it is opened, but deleted prior to finishing each page.

If the file name specified via the OutputFile parameter ends with the suffix '. See the AdjustWidth option documentation below for important information about these devices. All 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. The MaxStripSize parameter controls the strip size:.

The TIFF 6. 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.

Since v. According to the TIFF 6. Unfortunately, due the unpredictable size of compressed output, we cannot automate the selection of BigTIFF, using it only when the output file grows large enough to warrant it. For the tiffsep device, it changes the compression scheme of the separation files and composite cmyk file which is lzw by default. It defaults to g4 for the tiffsep1 device. The tiffscaled , tiffscaled4 , tiffscaled8 , tiffscaled24 and tiffscaled32 TIFF drivers also provide the following two parameters:.

This is useful when the file uses overprint to separately paint to some subset of the C, M, Y, and K colorants, but the final CMYK is to be color corrected for printing or display. The tiffsep device along with the tiffscaled32 and psdcmyk devices can perform rudimentary automatic bitmap 'trapping' on the final rendered bitmap. This code is disabled by default; see the note below as to why.

Trapping is a process whereby the output is adjusted to minimise the visual impact of offsets between each printed plane. Typically this involves slightly extending abutting regions that are rendered in different inks. The intent of this is to avoid the unsightly gaps that might be otherwise be revealed in the final printout if the different color plates do not exactly line up.

This trapping is controlled by 3 device parameters. The final control is to inform the trapping process in what order inks should be processed, from darkest to lightest. This is the default. Trapping is an technology area encumbered by many patents.

We believe that the last of these has now lapsed, and so have enabled the code by default. Ghostscript supports a variety of fax encodings, both encapsulated in TIFF see above and as raw files. The later case is described here. It is supported by the devices bmpmono bmpgray bmpsep1 bmpsep8 bmp16 bmp bmp16m bmp32b. 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 pcx pcx24b pcxcmyk series of devices. PSD is the image format used by Adobe Photoshop. It is supported by the psdcmyk , psdrgb psdcmyk16 and psdrgb16 devices. Of special interest with the psdcmyk and psdcmyk16 devices is that they support spot colors. See the comments under the tiffsep and tiffsep1 device about the maximum number of spot colors supported by Ghostscript.

The psdcmyk16 and psdrgb16 devices are essentially the same as the psdcmyk and psdrgb devices except they provide 16 bit output. The psdcmyk device supports the same trapping options as tiffsep but see this note. An attempt to output multiple pages to a single PSD file i. These devices render input to a bitmap or in the case of PCLm multiple bitmaps then wraps the bitmap s up as the content of a PDF file.

For PCLm there are some additional rules regarding headers, extra content and the order in which the content is written in the PDF file. There are four devices named pdfimage8, pdfimage24, pdfimage32 and PCLm. These are all implemented as 'downscale' devices, which means they can implement page level anti-aliasing using the -dDownScaleFactor switch. The type of compression used for the image data can also be selected using the -sCompression switch.

In addition, the PCLm device supports some other parameters. Firstly, the -dStripHeight switch to set the vertical height of the strips of image content, as required by the specification.

Secondly, the standard postscript -dDuplex and -dTumble switches are supported, in that if both are set to true, every verso page i. As an extension to this, a -dTumble2 parameter is also supported that will add an additional X-axis flip for every verso page. In 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.

These devices render internally in 8 bit greyscale, and then feed the resultant image into an OCR engine. Currently, we are using the Tesseract engine. These "traineddata" files are available in different forms, including fast and best variants. Alternatively, people can train their own data using the standard Tesseract tools.

Please note, this pattern of directory searching differs from the original release of the OCR devices. By default, the OCR process defaults to looking for English text, using "eng. The first device is named ocr.



0コメント

  • 1000 / 1000