[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] Get margin of a Postscript file
From: |
Ralph Corderoy |
Subject: |
Re: [Groff] Get margin of a Postscript file |
Date: |
Sun, 09 Dec 2012 12:35:10 +0000 |
Hi Jérôme,
Please reply to the list, not just me. :-)
> Here is the context : I'm student in Law and next year I will have to
> write a memorandum. Nevertheless, this memorandum must be in MS Word
> format which displease me greatly. This format is imposed to verify
> if we respect the instructions, and especially the margins.
>
> In this situation, I wonder if there is a solution to obtain this
> information from another format, like Postscript, so I can propose an
> alternative to the use of MS Word format.
Ghostscript can report the bounding-box for the ink laid on each page.
http://ghostscript.com/doc/7.07/Use.htm#Bounding_box_output
$ for n in 5 271 3141; do
> echo $n
> seq $n | groff | gs -q -dNOPAUSE -dBATCH -sDEVICE=bbox -
> done
5
%%BoundingBox: 73 829 107 837
%%HiResBoundingBox: 73.025998 829.745975 106.379997 836.765974
271
%%BoundingBox: 72 719 540 837
%%HiResBoundingBox: 72.017998 719.045978 539.747984 836.765974
3141
%%BoundingBox: 72 47 540 837
%%HiResBoundingBox: 72.017998 47.051999 539.747984 836.765974
%%BoundingBox: 72 47 540 837
%%HiResBoundingBox: 72.305998 47.051999 539.675984 836.765974
%%BoundingBox: 72 683 540 837
%%HiResBoundingBox: 72.305998 683.045979 539.675984 836.765974
$
Note how the left margin varies slightly, 72 or 73, depending I suspect
on the curvuture of the glyphs at the start of the line. The first
document has the smallest height, just one line of text, from 829 to
837; origin is bottom-left. The two full pages of the 3141 document
have the same low-res box.
Perhaps this helps.
Cheers, Ralph.