With the later versions of Visio (I use Visio Professional 2002now), it seems that setting the "Include AI format" checkbox (includeAdobe Illustrator code) allows direct saving of .eps files that LyX andLaTeX can read most of the time. The files have errors (e.g. "Thenumberof Begin and End comments do not match"), but (at least) that errordoesn‘t usually appear to be fatal. You may need the latest .epsviewingtools, e.g. gsview32.exe version 4.0 or later.
However, I found that using "save as .eps", curved lines still come outawful, and others have reported problems with fonts and rotated text.Also, sometimes there are fatal errors, such as "unrecoverable error:undefined in XR". (That one I fixed by searching for the one occurrenceof XR, commented out the line, and the error went away!") Doug Kayesuggested to save the file to Acrobat Distiller, then save as EPS.Well,I found that this gave errors (this is likely because I use a Windowsserver, and don‘t have permissions to the temporary files it seems touse), but I was able to use another facility to save the file as PDF(itemails me with a place to download the PDF from). I then use AdobeAcrobat (note: not the free AcroRead) to save the .pdf as .eps. Thisworks, but you need to crop the page (you could use "eliminatewhitespace" in Acrobat, but sometimes it shaves off a little too much.In this case, use something like GSview to crop it, manually ifneeded.)
Doug recently came back with another suggestion (thanks again,Doug!):
I just discovered that when printing to Acrobat Distiller inorder to make a PDF (the trick I‘ve been using), Visio 2002Professionalcan‘t handle rotated text. The resulting PDF is a mess. I‘ve foundanother workaround, however:
1. In Visio, Save As... a Windows MetaFile
2. Import the MetaFile into a program that can handle it, such as AdobeInDesign or PageMaker.
3. Save as (or export to) a PDF.
4. Use Acrobat (not Acrobat Reader) to export as an EPS.
5. Use GSView to clean-up the bounding box (although Acrobat can dothis too, just not as accurately).
If all of the above fails for you, I have reproduced my originalsolution to this problem. See also the end of this page for morecorrespondents‘ suggestions.
I find that when editing at home using LyX for Cygwin, the least painless way is tonot use .eps files at all, but instead to use .pdf files.I print to a postscript file using the distiller, and include the .pdffile directly into the LyX document. This works fine, except that there is nobounding box. I add a bounding box manually using LyX‘s "clip to bounding box"option. The preview updates immediately, allowing a sort of trial and errorapproach. Hopefully, the size of the figure won‘t change very often, so youdon‘t have to do this step very often.
This solution would not be suitable for LaTeX, only LyX. Also, it doesn‘t seemto be possible for GSview32 to convert the resultant .pdf file toa .eps either; a shame. However, ImageMagick does a great job (seenotes from a correspondant below).
Since I tried that, I‘ve found some versions of LyX don‘t convert from PDFvery well at all, and when you export to LaTeX, it tries to overwrite anyexisting .eps files in your image directory. For these reasons, I‘ve switchedto exporting to .pdf using the Adobe distiller, then converting to.eps with ImageMagick. This actually saves some time, as otherwiseyou have to do the bounding box by hand, and also the LaTeX subsystem convertsfrom pdf to eps for you every time you view the output, and throws away the results.If you have Lyx installed, you probably already have ImageMagick installed as well.
From Igor Dotlic:
I tried almost all approaches described at your site. However, neitherof them provided good results. So I experimented a little, and here iswhat I came up with:
1. Add a box to your Visio drawing and send it to back. Otherwise, LaTeXwon‘t be able to know size of your drawing and it will come up ugly. Ifyou don‘t want for box to be visible, simply use white line color.
2. Group all: Ctrl-A Ctrl-G
3. Save it as wmf or emf
4. Import in Open Office Draw
5. Select your drawing - otherwise whole page will be exported and wedon‘t want that.
6. Export to eps - all possible export options worked fine for me.
I‘ve found no trouble till now in this method. Exported graphic is invector format and can be resized in LaTex. I use TeXnicCenter as LaTeXeditor and MiKTeX as compiler if it has any meaning.
I hope this will help someone.
From Tim West:
export as WMF from Visio, then use wmf2eps(http://www.wmf2eps.de.vu/) to convert to EPS.(Many Linux and Unix machines have a wmf2eps installed by default).Thanks, Tim, this sounds like the easiest way!
However, I‘ve found errors with the wmf2eps tool. It often seems to just dropsome letters from text strings for no apparent reason. Sometimes, I‘ve beenable to just add a space to the end of the string, and that has fixed it.At other times, this doesn‘t work. I‘ve eneded up importing the WMF fileinto the Open Office Draw package. Alas, this tool doesn‘t crop its .epsoutput automatically, so move the drawing to the top left hand corner anduse Format Page to set the size of the drawing.Sometimes I find it easier to start a diagram in Visio, then fine tune it in Draw.
You can save the document in Visio as wmf file and then with theprogramm TpX (http://tpx.sourceforge.net/)it is possible to open that wmf file and save it as eps file. (Windows only)
From Humberto Nicolas Castejon Martinez:
To make the conversion of Visio diagrams or any other Microsoft/OLE-baseddiagram into EPS figures I use the OLETeX program. It is a free program thatcan be downloaded from www.sourceforge.net/projects/oletex. It is rather simpleto install and to use. Assuming that you have this program installed, this arethe steps to make the conversion:
1- Select the diagram in Visio, Powerpoint, etc
2- Copy it into the OTEditor
3- Choose "EPS properties" and select the size of the figure
4- Choose "Convert.." and that‘s it!
The generated EPS has, not only a correct bounding box, but also a correctsize!
Well, one more thing. In order to determine the size I wanted for a figure,this is what I did: Create a Word document with appropriate margins, paste thediagram in that document (resize it if needed) and take a look to the desiredsize at "Format->Object->Size"
Second mistake: I didn‘t realise that when in Options/ConversionSettings you select a printer driver and adjust the Properties, it throws awaythe changes. You need to go to the *system* Printers and Faxes control panel,select the driver in there, and make the changes he describes (in particular,you must if nothing else select EPS output in the Postscript Output Option)and make them stick. It would be nice to get the program to make those changes,but I don‘t have the time to fiddle with it.
I found that I didn‘t need to do anything to choose the figure size - that‘s prettymuch the point of this program, to do that step. Otherwise, you could print to athe generic printer driver and use gsview32‘s PS to EPS option. That also works,but it‘s another step.- 25/Jan/2006 Mike Van Emmerik
When the printer is set up, make sure that the options are setcorrectly; in particular, use Settings/Printers and right click on thenew printer. (These instructions are for Windows NT; it may differ forWindows 95/98/etc). Under "Document Defaults" choose the "Advanced"tab, and under "Document Options" expand "Postscript Options". Under"Postscript Output Option" select "Encapsulated Postscript (EPS)". Inmay as well also change some Properties (on the popup menu), "Ports"tab, and choose the "FILE:" port. In fact, this is just in case youforget to check the "print to file" option when printing; this allowsyou to choose the path more sensibly. Save the file as ".ps", since youstill have to modify the bounding box (see below) to make a true .epsfile.
When this is all set up, then you can output anything (includingbutnot limited to Visio drawings) to an EPS file by printing to thatspecial "printer". (Just ignore the "Save as" option in Visio).
To use the EPS file as saved above with Latex, you still need tochange the bounding box of the EPS file (Visio always seems to printthewhole page, so the bounding box is set to whatever page you set up inVisio). That means that diagrams will wipe out all the other text onthe LaTeX page. This can be done most readily by using gsview forWindows. (Note: you also need ghostscript, fonts, and another file;readthe notes on those pages carefully). It has the facility forcalculating a tight bounding box and saving the file with the newbounding box (under File PS->EPS). (The file still has to be EPSsuitable, so it is still important to use the right printer driver togenerate good EPS).
You can also do this manually; you will find it easier if you putyour diagram in the bottom left corner of the page, about a centimeterfrom the edges. Then just edit the EPS file; about the fifth lineshould read something like
%%BoundingBox: 17 22 578 820These dimensions are in points (approx. 1/72"), and represent the x andy co-ordinates of the bottom left and top right corners of the drawing.I measure with a ruler, add 10% or so, and put in the appropriatefigures in the third and fourth numbers, then use Ghostscript to checkthat I have not cut off too much or too little. For example, supposethe diagram is 75mm wide by 100mm high; that‘s about 3" x 4". You couldstart with 225 and 300 for the second and third numbers. Leave thefirsttwo numbers alone.
I should add that Visio is otherewise a very good product, and Ireally hope that the EPS exporting is fixed in the next version(version5 still has the problem).
Here‘s what I did:
In Visio (2000), Save as, and use following options:
Color Translation: Normal
Line cap: device
Background Rectangle on
Include AI 3
All other options off.
Then it writes the file, which I can‘t view with GhostView 4.2
without errors. When I looked at the PS file, I found out it forgets
to insert a header:
%%BeginResource: procset Adobe_cmykcolor 1.1 0
just above the line saying:
%%Title: (CMYK Color Operators)
When I inserted that line, I could view the file in GhostView 4.2
without problems.
I guessed the line by looking at other BeginResource lines, and from
the lines at the top:
%%DocumentSuppliedResources: procset Adobe_packedarray 2.0 0M
%%+ procset Adobe_cmykcolor 1.1 0M
%%+ procset Adobe_cshow 1.1 0M
%%+ procset Adobe_customcolor 1.0 0M
Hip-hip-hurrah for the individuals that coded the exporter, and never
bothered to check whether the output actually worked.
Regards,
Frank de Jong
Thanks, Frank!
I‘ve tried this; sometimes it works, other times not. When itdoesn‘t work, I use the second printing via PDFoption. Here is the sed script I used to perform the insertionautomatically:
/%%Title: (CMYK Color Operators)/ {
i\
%%BeginResource: procset Adobe_cmykcolor 1.1 0
}
联系客服