Originally reported by: lpd@users.sourceforge.net When sent to the ljet4 device, this file should automatically rotate the page by 90 degrees. Instead, it simply translates the image in the +Y direction by about 3.5". Sending the file directly to a PostScript printer produces the correct (rotated) result. %! << /PageSize [792 612] >> setpagedevice 100 100 moveto /Times-Roman 16 selectfont (Lower left) show showpage Ghostscript version: AFPL Ghostscript BETA RELEASE 7.31 (2002-10-17) I suspect this bug is present in many other versions and for many other printers as well.
Comment originally by rayjj@users.sourceforge.net Logged In: YES user_id=11206 This problem stems from the 'fake' InputAttributes in gs_setpd.ps that has a page size range that matches without rotation. We are working on a change to populate the InputAttributes dictionary with all of the page sizes that are defined in statusdict, which would resolve this problem, although running to specific printers or devices with unsupported page sizes will still be a problem. For example, sending a 11x17 page to a laserjet that only has letter size trays. The workaround for a site that has a specific printer with known page sizes is to set the InputAttributes correctly for that printer. For example, insert the following on the command line before the files to be processed: -c "<< /InputAttributes << 0 << /PageSize [ 612 792 ] >> >> >> setpagedevice " Note that this option must be followed by "-f" if the next command line argument is a file to be processed.
The InputAttributes dictionary is now populated, but since it includes the four element array entry that matches ANY page size without rotation, the "out-of-the-box" behaviour of ghostscript remains the same. This is needed for backward compatibility. The comment in zmedia2.c describes this intentional behaviour of the media selection: /* Fudge matches from a non-standard page size match (4 element array) */ /* as worse than an exact match from a standard (2 element array), but */ /* better than for a rotated match to a standard pagesize. This should */ /* prevent rotation unless we have to (particularly for raster file */ /* formats like TIFF, JPEG, PNG, PCX, BMP, etc. and also should allow */ /* exact page size specification when there is a range PageSize entry. */ The last entry in the InputAtributes dictionary is the 'range', so if that is not included matches to rotated fixed page sizes such as 'letter' will work as expected. I've implemented an optional command line parameter that will suppress the range type PageSize InputAttributes entry -dNORANGEPAGESIZE. The patch and documentation will be committed to the HEAD rev. The patch is applicable to 8.14 and 8.30 or later. With older versions of ghostscript, the only method is to define a proper InputAttributes dictionary. The patch diff is: diff -c -r1.20 gs_setpd.ps *** lib/gs_setpd.ps 17 Dec 2003 09:12:03 -0000 1.20 --- lib/gs_setpd.ps 18 Feb 2004 16:22:37 -0000 *************** *** 200,210 **** % see note above about pagetype executable array contents. load dup 0 get exch 1 get 2 array astore .dicttomark } forall ! % Add one last entry which is the 4 element range array (non-standard) ! counttomark 2 idiv % PageSize with either dimension 0 will be detected in % match_page_size, so we can allow it here ! mark /PageSize [0 dup 16#7ffff dup] .dicttomark .dicttomark } (%MediaSource) 0 --- 200,214 ---- % see note above about pagetype executable array contents. load dup 0 get exch 1 get 2 array astore .dicttomark } forall ! % If NORANGEPAGESIZE is defined, (-dNORANGEPAGESIZE), then don't add ! % the 'match any' PageSize entry ! systemdict /NORANGEPAGESIZE known not { ! % Add one last entry which is the 4 element range array (non-standard) ! counttomark 2 idiv % PageSize with either dimension 0 will be detected in % match_page_size, so we can allow it here ! mark /PageSize [0 dup 16#7ffff dup] .dicttomark ! } if .dicttomark } (%MediaSource) 0