I was wondering if there is an easier (and better) way of embedding Visio diagrams into a LaTeX document.

As far as I know there a two ways:

  1. Save Visio Diagram as PNG and use \includegraphics
  2. Save Visio Diagram as SVG and convert it via Inkscape to a PDF and include the PDF

No. 1 has the big downside that the graphics are not scalable without producing artefacts.

No. 2 has an unfavourable work-flow.

  • (I'd love to get rid of visio but unfortunately that's not an option) – kventil Aug 25 '11 at 8:34
  • related/duplicate question for No. 2: tex.stackexchange.com/questions/2099/… – doncherry Aug 25 '11 at 8:41
  • Reduced to the svg-export function of visio I'd say yes. (but I was rather counting on a direct-import solution) – kventil Aug 25 '11 at 9:24

I don't have MS Visio myself, but all the other MS Office 2010 (and 2007 as well, methinks) programs are able to export to/save as PDF natively:

  1. Click the File tab.
  2. Click Save As.
  3. In the File Name box, enter a name for the file, if you haven't already.
  4. In the Save as type list, click PDF (*.pdf).

    • If you want the file to open in the selected format after saving, select the Open file after publishing check box.
    • If the document requires high print quality, click Standard (publishing online and printing).
    • If file size is more important than print quality, click Minimum size (publishing online).
  5. Click Options to set the page to be printed, to choose whether markup should be printed and to select output options. Click OK. Click Save.

(applies to Viso 2010, http://office.microsoft.com/en-us/visio-help/save-as-pdf-HA010354239.aspx#BM10)

Here's the guide for Visio 2007.

You might have to run pdfcrop afterwards, as Martin suggested.

| improve this answer | |
  • 2
    In the past I had problems with visio-generated pdfs (the exportation process messed the position of boxes and lines). So my route was: in Visio, set a paper size which matched the size of the drawing, and then "print to pdf" using PDF Creator. I don't know if those problems are fixed. I don't unse Visio since I discovered Tikz. – JLDiaz Mar 12 '13 at 9:44

I wouldn't go with PNG for vector graphics. I had a few Visio-Diagrams as well in my LaTeX documents and then used the following way: Install a PDF printer which allows you to create PDF using the print function of any software. For Windows I can recommend the free pdfcreator which is based on Ghostscript. Then print the Diagram to a single PDF page. Unfortunately it is not possible to tightly crop it, so you need to run it through pdfcrop afterwards. Then include it using \includegraphics. This should give you good results. Make sure that the fonts are included.

Also note that Inkscape has a command line mode which allows you to convert SVG to PDF very simply:

inkscape --export-pdf file.pdf file.svg

I didn't tested this under Windows, however, only under Linux.

| improve this answer | |
  • I second Martin! =) – Paulo Cereda Aug 25 '11 at 9:28
  • Visio 2007 and 2010 can save the graphics as pdf format directly. – Leo Liu Aug 25 '11 at 13:51
  • @Leo: Agreed, this is unnecessarily complicated, unless you have Visio 2003. See my answer. – doncherry Aug 25 '11 at 13:57
  • @Doncherry: If the PDF export mechanism doesn't result in a cropped PDF than this isn't more complicated. Printing should be as easy as exporting. Ok, you need to install the PDF printer once. – Martin Scharrer Aug 25 '11 at 14:09
  • @Martin: It might be cropped already, I don't know. But I'd assume Visio's own PDF mechanism would yield better results than an all-purpose PDF printer. – doncherry Aug 25 '11 at 14:13

I've tried converting to a non vector graphic (png etc), this never works out properly, it will look ugly in your clean LaTeX document. The SVG option creates images that don't look like the Visio image at all (different font and object sizes).

I've come up with the following procedure (for Visio 2010):

  1. Go to Design -> Size -> Fit to Drawing (in previous versions this can be found in the Page Setup)
  2. File -> Save as...
  3. Select PDF.
| improve this answer | |

Tikz can do a lot of nice diagrams, too.

That said, if you really can't do without visio, I'd go for the SVG->PDF option. At least it's scalable.

| improve this answer | |
  • I looked at tikz and it's definitly the way of doing it. But atm i'm writing my thesis and have not enough time to dive into tikz :) – kventil Aug 25 '11 at 8:45
  • I managed to convert an svg to tikz code using inkscape. However, the resulting code is not very friendly. – Dror Aug 25 '11 at 9:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.