Home > Tips > [EN] Visio 2007 – Convert diagrams to .eps format

[EN] Visio 2007 – Convert diagrams to .eps format

February 16, 2010 Leave a comment Go to comments

Well, It’s time to write my M.Sc. Before this I have to recall how to use LaTeX. Well, I must draw some diagrams and I have to use .eps format. Of course You can use .jpg files, but I’m not. Very good program, where I can create diagrams, is Visio. I have version 2007 installed (now there is an 2010 beta). With this program I created some diagrams. I like it’s diagrams, because they are very nice :) and clear but the program does not include exporting to .eps format. I decided (tried) to use an open source Dia drawing program which supports exporting to .eps but, the diagrams are not so nice :/, what is more, I have some problems with latin chars, and the exported image is exported in fragments, pages etc. (probably I have done something wrong, but I have no time to thinking about it). I searched the Web for conversions from vsd2eps, but the solution is very ‘expen$ive’ for me. Fortunately I founded some pages that explains how to convert an Visio diagram to eps file.

The first one How to save your drawings to EPS in a perfect way, describes how to export Your diagram with a post script printer, but this is to much work for me :) What is more I saw words like: cygwin, perl – this is not for me! :)

A very interesting solution for my problem is described on http://www.raymeskhoury.com/blog/export-eps-from-visio/. To make live easier, I’ve created a PowerShell script that automates the conversion for me. Unfortunately not directly from .vsd format, but from an exportable – .emf format.

What to do?

1. Use Windows PowerShell. If You don’t have it download it from http://technet.microsoft.com/en-us/scriptcenter/dd742419.aspx. PowerShell will be useful in the future – I’ll try to write more interesting posts, It’s very useful to automate some process without Visual Basic scripts. If You have Windows 7 – PowerShell should be already there. In Windows XP a long time ago, there was an Update, which should install this component.

2. Install http://wiki.lyx.org/Windows/MetafileToEPSConverter – this free and small program converts .ems files to .eps files

3. Write or use mine script – save it on disk

    1 # *.emf file list in emf directory

    2 $emf = dir emf\*.emf

    3 

    4 # Destination path, where we save converted files

    5 $destPath = "$(get-location)\images"

    6 

    7 foreach ($item in $emf) {

    8     # file full name (incude path)

    9     $fullName = $item.FullName

   10     # converted file full name (include path)

   11     $destName = "$destPath\" +($item.BaseName) + ".eps"

   12     write-host $fullName ">>>" $destName

   13     & ‘C:\Program Files (x86)\Metafile to EPS Converter\metafile2eps.exe’ $fullName $destName

   14 }

4. If You are using an 32bit version of Windows 7 You must change the line 13 (selected in Yellow) to remove the (x86) from the path.

Convert2EPS 5. Probably as You can see I’m using two directories emf and images. The emf directory contains all my .emf files, and the images –images that I’m using in my work. The only thing that I have to do is to save the Visio as .emf file to emf folder and run the script. How it works You can see on the screen.

 

Tip. Probably You can not run the scipt, because of restrictions. I opened Powershell as and administrator and entered this command:

Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser

Sources: http://cid-e2eed297c7a63060.skydrive.live.com/self.aspx/Publiczny/Pub/Visio2EPS.zip

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: