Hiya
On 10/27/17 14:31, Ingo Schwarze wrote:
[ sending this particular one back to the list
because it contains something useful for everyone and nothing private ]
Replying to list to archive comments even if not acted on.
Hi Jan,
Jan Stary wrote on Fri, Oct 27, 2017 at 12:46:00PM +0200:
I produced a PS output with "man -Tps rm > rm.ps",
with output paper set to a3, a4, and a5 in man.conf.
This results, respectively, in
%%DocumentMedia: Default 841 1190 0 () ()
%%DocumentMedia: Default 595 841 0 () ()
%%DocumentMedia: Default 419 595 0 () ()
which apparently are the right dimensions. However,
the Minolta will print all of them on A4 paper,
although it does have a stash of A3 and A5 too.
That's where I thought it might take a hint from the DSC comment,
if I changed the "Default" to "A3" or "A4" or "A5", or if mandoc(1)
itself put that in the DSC comments. I rewrote it manually before
each printing, but the Minolta still prints them all on an A4:
That's interesting, but anecdotal. It is neither surprising that
a specific printer selects paper as configured (in whichever way),
as opposed to inspecting fikes it is sent; nor would it be surprising
if other printers, or even the same one, or printer drivers on the
print server, could be configured to inspect the contents of
PostScript files to select paper.
The trouble is, i just don't know what firmwares and softwares do,
what they should do according to standards, and where to look for
standards in this respect.
Does anybody else know?
The DSC comments are not part of the PS specification (the reference
manual quoted earlier) and a PS interpreter would not normally take
notice of the them. The comments are aimed at document printing systems
which can just look for the comments and manage the printing of the file
amongst other files and a range of available printers - such as queuing
for a printer which supports/has the media listed by the DSC comment.
Some PS interpreters may look for and act on the comments, but this
would not be "standard" behaviour. For the %%DocumentMedia: comment the
name used is for human consumption, it is the numeric values that are
used for any media handling decisions. The %%DocumentMedia: comment
lists all media sizes used by the document but does not say which page
uses which size of media so could not be used to select media for any
particular page. If the media size is important for a page then there
should be a PS setpagedevice call like the following:
<</PageSize [595 842]>>setpagedevice
The PS interpreter will perform media selection based on the values -
use matching media, next largest, scale/rotate content, ask operator,
etc. - see section 6.2.1 of the PS reference manual for way more detail.
This is what is needed for the Minolta printer to use the other media
sizes it has available. A quick edit of the PS file to add the above
line with the appropriate media sizes for A3 or A5 should prove that.
Basically don't rely on DSC comments to do media selection.
I don't know gv but it will be working as a virtual printer with some
standard media sizes to use when rendering a file. It sounds like it
adds the list of media from any %%DocumentMedia: comments to provide
additional media sizes it may not have by default. Ah, in the State
menu there is the option "Respect document structure". If I unselect
this the page size used by gv changes from the letter used in the -Tps
output to the default A4 used by gv.
It may be useful to use a media name such as man-A4, man-letter, etc.
(to indicate the source of the file and media size used) for any systems
that do process the DCS comments. That will avoid duplicates appearing
in generated media lists.
As for PDF, no there is no way to name the media size being used. There
is no equivalent of the DSC comments for PDF. Media selection is always
done based the dimensions in the /MediaBox array, the same way as the
/PageSize array in PS, and it is up to the processor to decide how to
handle the media size request.
Finally, the -Tpdf output is not a valid PDF. It is missing the endobj
keyword from several of the object definitions. This will cause
warnings or errors when processing. I haven't updated to 6.2 yet so
that may have been fixed by now, apologies if it has.
Hm, so I can remove man.conf altogether,
because even the default "letter" manpages
will get printed on A4, which is what I want.
That's a bad idea. The purpose of the -Opaper= option is not to
select paper, but to adjust the width and height that the document
content will require, and the primary purpose of the DocumentMedia
DSC instruction isn't selecting paper either. but to inform how
the content was arranged. If you use -Opaper=letter, margins will
be reasonable for letter size paper, but ugly for A4: Since letter
paper is wider than A4 but not as tall, printing on A4 without
-Opaper=a4 will usually result in an awkwardly narrow right margin
and in wasted space at the bottom.
Yours,
Ingo
Cheers.
--
Mike