[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] embedding pictures or images?
From: |
Deri James |
Subject: |
Re: [Groff] embedding pictures or images? |
Date: |
Sat, 24 Apr 2010 00:25:23 +0100 |
User-agent: |
KMail/1.13.2 (Linux/2.6.31.12-desktop-3mnb; KDE/4.4.2; x86_64; ; ) |
On Friday 23 April 2010 22:29:20 Werner LEMBERG wrote:
> > Is there a way to include a jpeg or png image in a groff file? No
> > hack too cheap!
>
> Basically, the answer is no. Assuming that you want to create a PDF
> file, you have to convert everything to PostScript first, including
> images.
>
> On the other hand, Deri James has written a PDF driver (gropdf) for
> troff, so following his route you should be able to embed such images
> into a PDF directly. However, I don't know whether his driver is
> mature enough to support such images formats natively.
>
> http://groff.ffii.org/groff/gropdf/
> http://www.chuzzlewit.demon.co.uk/gropdf/ (for an improved binary)
>
>
> Werner
If you want to embed a graphic into postscript output you have to convert the
format to EPS (Encapsulated PostScript) and then you can use the .PSPIC macro
to embed the .eps.
See 'man groff_tmac'.
Alternatively if you want to try the direct PDF driver, I've just uploaded an
"experimental" version which supports embedding an external pdf file within
troff. So, to embed a png or jpg you need to include the graphic within its
own pdf file (called say 'my.pdf'), then include this in your troff file:-
\X'pdf: pdfpic my.pdf -L 3i'
and call groff as:-
groff -Tpdf my.trf > mynew.pdf
Currently the flag '-L' (left aligned) is ignored, but must be there. The
'3i' scales the PDF to have a width of 3 inches.
Note: Using this PDF driver allows you to use transparency and masks whereas
.eps does not support transparency at all. Also, ths part of 'gropdf' is new,
not well tested, but using 'inkscape' to create the included pdf seems to work
ok.
Cheers
Deri
PS Other new things in this version of 'gropdf' are:-
a) It supports the PIC rotation code that Ted's Xmas card demoed (using
'align')
b) Really experimental!!It supports embedding a flash file (.swf) in troff!!
Don't ask - oh ok, a client wanted to know if it was possible to do animated
graphs within a "Valuation Booklet"!!!
Cheers
Deri