[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] encapsulated postscript from pic
From: |
Ralph Corderoy |
Subject: |
Re: [Groff] encapsulated postscript from pic |
Date: |
Sat, 27 Apr 2013 12:29:53 +0100 |
Hi Doug,
> Is there a tool or trick for getting encapsulated postscript from pic?
> What I want is that the bounding box should have origin 0 0 and be
> just big enough to cover the picture.
As James wrote, I'd use ps2epsi(1) from GhostScript. Moving to (0, 0)
in troff helps with the bounding box but it goes slightly negative then
so further adjustment is needed.
$ cat t.tr
.po 0
.sp |0
.PS
box
arrow
circle
arrow
box
.PE
$
$ pic t.tr | groff >t.ps
$ ps2epsi t.ps t.eps
$
$ tr \\r \\n <t.eps | g Box
%%BoundingBox: -1 793 217 831
%%HiResBoundingBox: -0.008930 793.690007 216.199962 830.107943
<< /PageSize [ 595 842 ] /ImagingBBox null >> setpagedevice
$
gs(1), which is the workhorse behind ps2epsi, can also deliver the
bounding box of a PostScript, PDF, ... file.
$ gs -q -dNOPAUSE -dBATCH -sDEVICE=bbox t.ps
%%BoundingBox: -1 793 217 831
%%HiResBoundingBox: -0.008930 793.690007 216.199962 830.107943
$
That might be useful to translate the source by an amount to move
towards the origin.
Cheers, Ralph.