'Specifying printer tray via MediaPosition does not honor the paper tray settings

Working with a Konica Minolta, I am sending PostScript commands to it. Most of the time everything works correctly and I am able to switch trays using the MediaPosition command. The printer has 4 trays and the Paper Tray Settings from the printer display are set to "Letterhead", "Letterhead", "Letterhead" and "Plain".

I am successfully switching between trays using this:

<</ManualFeed false /MediaPosition 0>> setpagedevice

One of the ps files creates a job which prints from the from the third tray, the forth tray and then tries print from the first tray. However, at this point the printer freezes and asks you to put "Plain" paper in Tray 1. I am assuming this happens because the last print came from a "Plain" paper tray but I am just guessing. Going from 3 to 4 works but then to 1 does not.

I have tried to use /MediaType (letterhead) but it seems that this command is ignored as it comes along with some settings of Duplex which are incompatible with it:

<</Duplex true /Tumble false>> setpagedevice

Any idea what is actually causing this problem and even more so, how to fix it so the printer continues without freezing and asking to change the tray paper setting?



Solution 1:[1]

I cannot see what this has to do with Ghostscript, where is Ghostscript used in the described process ?

Page device parameters are, to some extent, device dependent and are usually treated as requests. For example you can set /Duplex, and the device will generally ignore it if it does not have a duplexer. (ie the request is ignored).

However, certain page device requests can have other effects, these are documented in Section 6.2.7 Unsatisfied Parameter Requests of the 3rd Edition PostScript Language Reference Manual (p446 in my copy).

The interpreter can respond to such an unsatisfied parameter request in a variety of ways, such as by ignoring it, raising a PostScript error, or displaying a message on the front panel of the device requesting intervention by the human operator.

Without seeing the exact PostScript program, it's not possible to tell exactly what's going on, but I would guess that the interpreter thinks, for whatever reason, that it cannot satisfy the request for tray 1 because it's MediaType does not match (it wants Plain and you have defined it as Letterhead). It's likely that switching tray the way you are doing changes the current MediaType (or possibly some other parameter but MediaType makes sense). I imagine that initially the MediaType is not present in the dictionary, so you can change to any other tray. When you change the tray, because you've defined the media type on the control panel, it picks up the new MediaType. When you try to switch back the current MediaType doesn't match the MediaType of the tray you are trying to switch to.

Most likely the reason that adding /MediaType (letterhead) doesn't work is because you say you've defined the tray as containing Letterhead. PostScript is case-sensitive so letterhead is not the same as Letterhead.

Or it could be that the paper tray setting simply isn't the same as the MediaType. I'm afraid that this sort of device-dependency is highly specific to each manufacturer, the only people who can probably tell you what you need to send for certain are the printer manufacturers' own engineers.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 halfer