Hello again ! Today’s quick tip concerns a software package called Dia, which is an open source tool (available for both Windows and Linux, as it goes) used to make diagrams, flowcharts, network maps, and so forth. It has its own file format (.dia), which is (obviously?) useful for saving the projects you’re working on, but less useful if you need to give the diagram to anybody else, either in print or electronic form.
Dia can export to a variety of formats including SVG, PNG, and EPS, but one export format that it lacks native support for is the venerable PDF, which has become a de facto standard for transmitting documents between diverse environments. There are many advantages and interesting aspects of the PDF format, not the least of which being that what you see on your screen is what you get when it’s printed. It is unfortunate, then, that Dia won’t spit out a PDF (even if you ask very nicely).
Of course, being that it’s so easy to print directly to PDF (via CUPS, for example) these days, having native support for PDF may not, at first, seem all that useful. Well, as it turns out, printing directly to PDF might not give you quite what you were looking for. In practice, you do get a PDF, but what appeared to be a modestly-sized diagram in Dia will turn out to be a multi-page monster in (virtually) printed form. As a general rule, this is not what you want.
In order to get a usable PDF we need to use an intermediate step between Dia and the final file. The idea, quite simply, is to export the diagram as one of the supported formats, then convert that file into a PDF. There are a number of options here, but for our purposes we’ll save the diagram as an EPS file, then use a quick little command-line tool called « epstopdf » to perform the conversion.
There’s a good chance that you don’t have epstopdf on your machine. If you’re using Ubuntu, you used to be able to install it easily via the APT packager, but these days the little conversion tool comes as part of a larger suite of tools called « texlive-extra-utils ». This suite is dependant on a number of other packages, so go ahead and install them all :
$ sudo apt-get install texlive-extra-tools
EDIT : In Ubuntu 10.04, the package is named « texlive-font-utils ».
Among many, many little items of interest, our target application will be installed. To use it, simply feed it the name of the EPS file as an argument :
$ epstopdf somediagram.eps
It will automatically output a PDF file of the same name. There you go – a nice, shiny PDF of your Dia diagram.
11 thoughts on “getting Dia to give you a pdf”
recent versions of Dia support PDF export. Look for the export format “Cairo Portable Document Format (*.pdf)”
Right you are ; this blog post was written well over a year ago, and since then DIA has implemented PDF exporting.
Recent versions of Dia still don’t support PDF the right way. When exporting to PDF, you get your diagram fit to an A4 paper for example, but the page is not nicely fit to your content, like eps does.
I still have to use the method described above to export my diagrams to PDF.
“…but less useful if you need to give the diagram to anybody else, either in print or electronic form.”
Why? why is it not that useful in this case?
Because not everybody has Dia, whereas pretty much anybody can deal with a PDF (or a piece of paper).
Very useful my friend, thanx.
Export as a SVG File – Scalable Vector Graphic. Open Inkscape and either print directly to the desired size paper or export as a PDF
I have just experimented with DIA’s export to pdf using Cairo.
It’s not very good, especially if part of the image is a bitmap: then everything becomes a big bitmap (while exporting to eps/svg first gives good results).
This works much better than Dias built in pdf export. Dia has a few kerning and font problems when exporting in general. However, the pdf export does not work well at all.
On Ubuntu 13.10.
Exporting to almost any graphic format does not work in Dia because of shitty broken Cairo that should die and never come back. Fuck GNOME.