Hi Jan, Jan Stary wrote on Thu, Oct 26, 2017 at 10:39:20AM +0200:
> This is -current/amd64. My /etc/man.conf in its entirety is 'output > paper a4'. The A4 paper size is what we mostly use around these > parts; otherwise I would not even have a man.conf of course. > > I am not sure whether man -Tpdf and man -Tps honour the paper size. As discussed, it does. > man -Tpdf sox > man.pdf > man -Tps sox > man.ps > > Viewing the PDF file in gv(1), it says "y841x595" in the size box. > Viewing the PS file, it says "Default" in the size box. > > I don't know the PDF or PS syntax so I can't tell from the files > themselves, but other PDF and PS files that I know have A4 pages > show as "A4" in gv(1). For PostScript files, gv(1) simply trusts a comment in the file, even if it is in blatant disagreement with the actual size specified in the file - see /usr/ports/pobj/gv-3.7.4/gv-3.7.4/src/misc.c function misc_buildPagemediaMenu(): pagemediaEntry[i] = XtCreateManagedWidget(doc->media[i].name, smeBSBObjectClass, pagemediaMenu,NULL,(Cardinal)0); and /usr/ports/pobj/gv-3.7.4/gv-3.7.4/src/ps.c function psscan(): doc->media[0].name = ps_gettext(line+length("%%DocumentMedia:"), &next_char); Take any file that starts with %!PS-Adobe-3.0 and change the second word in the line %%DocumentMedia: A4 595 841 0 () () to "foobar" (or something more evil, like "A5"), as in: %%DocumentMedia: foobar 595 841 0 () () Gv will happily show the document size as "foobar", but it will still display the document with the correct size of 595 841. If you click on "foobar" in the menu bar, you will also see the "foobar" menu entry. In the more evil case that you put "A5" there, gv will show "A5" in the menu bar, and when you click on it, you will see *two* "A5" menu entries. If you click on the lower one, it will actually crop the document to A5 (according to its built-in notion of what A5 is); with the upper one, it will show the whole document again, according to your personal redefinition of "A5". Are you really sure that you also see "A4" for some PDF documents? Judging from /usr/ports/pobj/gv-3.7.4/gv-3.7.4/src/ps.c psscan() gv(1) gets the DocumentMedia name by converting the PDF with /usr/local/share/ghostscript/9.07/lib/pdf2dsc.ps which, as far as i can see, always writes yNNNxNNN for that. Also, i was unable to find anything similar to the first argument of "%%DocumentMedia:" in the PDF-1.7 standard; in particular, "/MediaBox" only supports four numbers, but i didn't find anything elsewhere either. Does anyone know how to specify a name for a page format in PDF? If there is no way to do that, then probably it isn't worth doing for only PostScript either... > I can always override it with tools; but occassionaly a printer > will choke on a file with "unknown" page size. I don't understand what you mean by "unknown page size". Can you provide an example of such a file to me privately - if possible generated by mandoc(1), otherwise any such file? Yours, Ingo