[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] PDF_IMAGE and MOM
From: |
Ralph Corderoy |
Subject: |
Re: [Groff] PDF_IMAGE and MOM |
Date: |
Mon, 03 Nov 2014 16:36:04 +0000 |
Hi Mikkel,
> I use sam2p to convert PNM image to PDF (I can highly recommend the
> small program sam2p). When I later try to find the image bounding box
> using this command
>
> gs -q -dBATCH -dNOPAUSE -sDEVICE=bbox <image file>.pdf 2>&1 \ | grep
> "%%BoundingBox" | cut -d " " -f4,5
>
> Could I see the image bounding box was set to:
>
> 1866 x 1866 points
I tend to use pnmtops(1) and then ps2pdf(1), e.g.
w=1866 h=1866
dpi=200
win=$(bc -l <<<"$w / $dpi")
hin=$(bc -l <<<"$h / $dpi")
wpt=$(bc -l <<<"$win * 72")
hpt=$(bc -l <<<"$hin * 72")
testpnm() {
pbmpage 1 |
pnmcut -l $(((5100 - w) / 2)) -w $w -t $(((6600 - $h) / 2)) -h $h
}
testpnm |
pnmtops -dpi $dpi -equalpixels -width $win -height $hin |
ps2pdf -dDEVICEWIDTHPOINTS=$wpt -dDEVICEHEIGHTPOINTS=$hpt - foo.pdf
I expect ps2pdf can produce EPS with the right settings if that's
preferred.
BTW, your mombog.mom had a blank line at the start and the comments were
lines starting `\#' rather than `.\#'. One or the other might have an
affect on your attempt at A3 in mom, I don't know.
Cheers, Ralph.