bug-ghostscript
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Ghostscript


From: Mirkin Mirksta
Subject: Ghostscript
Date: Wed, 11 Jul 2007 10:29:49 +1000


Hi guys,

Has anyone used the ghost script API with the wswinpr2 device with the setup.ps as described below ?. I can't get it to work. Is their a way to combine this postscript into a normal postscript job to set its print options?

Mirkin

-------------- mswinpr2 docs from manual below -------------------
The 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:

-sDEVICE=mswinpr2
Selects the MS Windows printer device. If Ghostscript was not compiled with this device as the default output device, you have to specify it on the command line.
-dNoCancel
Hides the progress dialog, which shows the percent of the document page already processed and also provides a cancel button. This option is useful if GS is intended to print pages in the background, without any user intervention.
-sOutputFile="%printer%printer_name"
Specifies which printer should be used. The printer_name should be typed exactly as it appears in the Printers control panel, including spaces.
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:

/NoCancel boolean
Disables (hides) the progress dialog when set to true or show the progress dialog if not set or set to false.
/OutputFile string
Specifies which printer should be used. The string should be of the form %printer%printer_name, where the printer_name should be typed exactly as it appears in the Printers control panel, including spaces.
/QueryUser integer
Shows the standard printer dialog (1 or any other value), shows the printer setup dialog (2) or selects the default Windows printer without any user interaction (3).
/BitsPerPixel integer
Sets the device depth to the specified bits per pixel. Currently supported values are 1 (monochrome), 4 (CMYK with screening handled by Ghostscript) and 24 (True Color, dithering handled by the Windows printer driver; this option can produce huge print jobs).
/UserSettings dict
Sets additional options, defined in a dictionary. The following properties can be set:
/DocumentName string
Defines the user friendly document name which will be displayed by the Windows spooler.
/DocumentRange [n1 n2]
Defines the range of pages contained in the document. This information can be used by the printer dialog, in conjunction with the following property.
/SelectedRange [n1 n2]
Defines the selected range of pages. This information will be displayed in the printer dialog and will be updated after the user interaction. A PostScript program could check these values and print only the selected page range.
/MaxResolution dpi
Specifies the maximum tolerated output resolution. If the selected printer has a higher resolution than dpi, then Ghostscript will render the document with a submultiple of the printer resolution. For example, if MaxResolution is set to 360 and the output printer supports up to 1200 dpi, then Ghostscript renders the document with an internal resolution of 1200/4=300 dpi. This can be very useful to reduce the memory requirements when printing in True Color on some high resolution ink-jet color printers. 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. informations (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 informations 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 printing
If 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 propery 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]