2008-04-14

gdt: Kangaroo road sign (Default)

Dia cannot export directly to Adobe's Portable Document Format. It can export to the Encapsulated PostScript vector format. As EPS is an Adobe specification it shares a lot of concepts with PDF, giving a pleasing accuracy in the PDF file.

The utility which does the magic is epstopdf, which is part of the TeTeX TeX distribution. This Perl script sets the bounding box and calls GhostScript to do the heavy lifting of the conversion.

Here is a GNU Make file for batch conversion of Dia diagrams in the current directory to PDF. It's a nice skeleton for people who have long-running batched file tasks, as Make takes care of a lot of details which are a real pain in shell scripts (such cleaning up after a Ctrl-C).

#!/usr/bin/gmake -f

DIA=dia
DIAFLAGS=--log-to-stderr --nosplash
EPSTOPDF=epstopdf
EPSTOPDFFLAGS=

%.eps : %.dia
        $(DIA) $(DIAFLAGS) --filter=eps --export=$@ $<

%.pdf : %.eps
        $(EPSTOPDF) $(EPSTOPDFFLAGS) --outfile=$@ $<

SRC=$(wildcard *.dia)
DST=$(SRC:.dia=.pdf)

all: $(DST)

.PHONY: clean
clean:
        $(RM) $(RMFLAGS) $(DST)
        $(RM) $(RMFLAGS) $(SRC:.dia=.eps)

For the record, this is on Fedora 8:

$ rpm --query --file `which epstopdf`
tetex-3.0-44.8.fc8
$ rpm --query --file `which dia`
dia-0.96.1-6.fc8

Profile

gdt: Kangaroo road sign (Default)
Glen Turner

September 2021

S M T W T F S
   1234
567891011
121314151617 18
19202122232425
2627282930  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated 2025-06-17 20:35
Powered by Dreamwidth Studios