groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] Get margin of a Postscript file


From: James K. Lowden
Subject: Re: [Groff] Get margin of a Postscript file
Date: Mon, 10 Dec 2012 18:23:26 -0500

On Mon, 10 Dec 2012 20:30:38 +0000 (GMT)
Jérôme Frgacic <address@hidden> wrote:

> Our university ask us to give them our memorandum in MS Word format.
> This format is imposed, inter alia, to ensure respect of their
> instructions, including precise margins.  

I would guess they're using software -- or something cheaper, perhaps
grad students -- to automatically verify the settings were chosen per
specification.  Of course, that does nothing to prevent you from, say,
adding a space to the left edge of every line, or using any number of
other settings to achieve a similar result.  But there's no need on
this mailing list to belabor the difference between input and output.  

> My wish is to propose to them to use portable format only, especially
> pdf or postscript.  

The question is, can a PDF file be checked programmatically to make
sure the instructions are obeyed?   Unfortunately, though, the answer
may well be No.  

The notion of a "margin" is afaik meaningless to Postscript.  Grabbing
one PDF at random from my machine:

$ identify -verbose ../matar-paneer.pdf | grep x[0-9]
  Geometry: 612x792+0+0
  Resolution: 72x72
  Print size: 8.5x11
  Page geometry: 612x792+0+0
    pdf:HiResBoundingBox: 612x792+0+0

612 = 72 * 8.5.  From Postscript's point of view (at least according to
ImageMagick) the data fill the page edge to edge.  That
means you can't verify a margin; you have to infer one heuristically.

I would think with a little work you could use ImageMagick to extract
the margin regions from each page, and check each one for the presence
of pixels.  Or check inside the margin, to make sure the text
reaches the edges.  You see, it's not clear what to check for.  I'm
afraid you'll discover that "to ensure respect of their
instructions" will be impossible, because there will be no consistent
understanding of what those instructions mean outside the context of MS
Word.  

Hopefully, though, I'm wrong and reasonable heads will prevail.  In
which case, what you want to do looks technically feasible from a
distance.  

--jkl



reply via email to

[Prev in Thread] Current Thread [Next in Thread]