打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Converting Visio files to .eps for embedding in LaTeX

Converting Visio files to .eps for embedding in LaTeX

See below for othercorrespondents‘ ideas!

Anyone who has used Visio will know that the EPS (EncapsulatedPostscript) export facility is broken in many ways. In the olderversions, the image would very often come out completely black, andeven when this is corrected, the image often had pieces missing, or wasjust plain wrong, and the file was not viewable with GhostScript.

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.-Done

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.


From Sabine Piana:

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"


I found this to work as well, but you need to have an application thatcan copy the document to the clipboard.Do follow the instructions carefully; it works for Windows XP as well(even though the Adobe Universal Printer Driver doesn‘t mention XP on the webpage at all). In particular, I made two mistakes. Firstly, I accepted too many defaultsand installed a generic postcript printer driver; you want to create a printerfrom the supplied PPD (Postscript Printer Description) file.

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


The best workaround that I have found is to print to a suitable printerdriver that has an EPS option, and then hack the bounding box manually.The trick is to find the right postscript printer driver; many don‘thave an EPS option, and EPS is NOT just Postscript with a specialheader. (See the FAQs from sites like Internet resources for Postscript & Ghostscript" for details).Agood driver is available from Adobe.It is most unlikely that typical drivers (like HP laserjet drivers)will work!  The Adobe download page (at present!) is http://www.adobe.com/support/downloads/main.html;look for Printer Drivers then Macintosh or Windowsas appropriate, and look for a driver with a name like AdobeUniversal PostScript Windows Driver Installer 1.0.6 (for Windows 95,98,Me, NT 4.0, and 2000) - English. As of June 2002, the direct link(for Windows) is this,but it can change very quickly.

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 820
These 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).

What about converting to .gif?

Later versions of Visio can save directly to .gif format. For the olderversions, converting to .gif‘s (e.g. for web pages) isstraightfgorward.Just use File/SaveAs and save as a .bmp file, choose 96x96 DPI, 16colours, then use any paint program to convert from .bmp to .gif (Iuse progressive mode for web images, though at about 12k for a largediagram, it‘s not even necessary.)

Converting eps files for use in PowerPoint

Surprisingly, Visio is very good at reading some .eps files, and PowerPointis very bad at displaying all .eps files. (PowerPoint seems to get thetextespecially bad). All Windows programs seem to cope with WindowsMetafileFormat (.wmf) however. So if you have some .eps files that want toembed into PowerPoint presentations, this is the best way (that Ifound).

Start with a blank Visio page. Use Insert / Picture / From file, toinsert the .eps file. If all goes well, you can just use File / Saveas,select .wmf format, and save the file. You can just press the deletekeyto restore the blank page, and repeat for as many .eps files as need tobe converted.

Things can go wrong, however. Often, the problem is a non standardcharacter in the .eps file. To correct these problems, you need toungroup (control shift U) the parts of the drawing. This unleashes itsown set of bugs with Visio - now some of the text may be split intopieces, often overlapping. The only way to fix this is manually. Istay in pointer mode; switching continually betweeen pointer and textmode is most vexatious. It does mean that when selecting text, it willall be selected, so you need to be careful and press the end key to addtext at the end. You‘ll see what I mean when you try it. I find that ifyou left justify the text, it will end up in just the right position(soyou may as well stretch the text box nice and large, so it won‘toverflow as you add text).

You can use the character map tool (comes with Windows; usually underPrograms / Accessories / System Tools) to add any special symbols intheWindows way, which should work with other Windows programs. Beforesaving, group the components with control shift G; then File / Save aswill save the whole drawing.

Printing via PDF

If you have the full version of acrobat (not just acroread), it has theability to convert from PDF to EPS. You can print from Visio as PDF (Iuse a PDF Creator pseudo printer that emails me a URL to download thefile from), open the result in Acrobat, crop the image, save as EPS,then import that into other documents. This has been known to work forimporting into MS Word.
Another route: Print to pdf as above, use the Unix "pdf2ps" converter,open the result in GSView, and use the "PS->EPS" option. Check theresult by loading the eps into GSView.


Another thing to try

Here is a suggestion from a correspondent.

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
}

From another correspondent,Thomas Dellsperger:
The easiest way I have found:

  • install a HP postscript printer that comes along with Windows XP (or 2000)
  • print a postscript (.ps) file from Visio to that printer
  • use ImageMagick‘s convert program to convert to eps (command line tool, you just say: convert myfile.ps myfile.eps, windows version from http://www.imagemagick.org/www/windows.html,linux version also available, of course)

Especially fonts are very well handelded that way (had some problemswhen
using Adobe‘s EPS printer or exporting from Acrobat). And by the way:there
is no hassle with the bounding box because Imagemagick automaticallyadjusts
it to fit the eps-image.


From Michael J. Hyatt:

My solution requires a PC (I‘m running Win 2000) and a Mac (OS 9.2.2),
as well as a bunch of expensive DTP software. I received a gaggle ofVisio files,
which I needed to import in EPS format into FrameMaker documents
(Mac format). The procedure:

In Windows:
1. Save Visio file as WMF.
2. Import WMF file into FrameMaker (6.0 in this case) or other app witha
save-as-PDF option. (WMF opened in FrameMaker on Mac is not a prettysight.)
3. Save as PDF.

In Mac OS:
4. Open PDF in Acrobat (5.0 in this case). (Not really necessary, but I
convert to Mac format out of habit.)
5. Save as Mac-format PDF.
6. Open PDF in Illustrator (10).
7. Save as Mac-format EPS with following options selected:
-- Version 10 (other versions no doubt work as well)
-- Mac 8-bit Color
-- Include Doc Thumbnails
-- Include Doc Fonts
-- CMYK PostScript
-- PostScript Level 2
8. Import into FrameMaker (5.5.6).

The resulting image in FrameMaker in Mac OS is identical in all respects
(lines, geometric shapes, shading, font sizes in general) to theoriginal
Visio diagram in Windows. The only apparent differences are thatcircles are
not quite as perfect as in Visio, and font point sizes are smaller by a
microscopic difference but still visually the same. There is the normal
cross-platform font substitution (Arial to Helvetica, but Helvetica is
desired, anyhow).


Vehemann Ferenc reports that exporting the drawing to wmf in Visio and thenopening it in Windows Illustrator works pretty well. So you don‘t need a Macfor the above solution if you have Illustrator for Windows. Thanks!


From Daniel Klose:

Here is my way, which has been done with free tools exclusivly, itmight help other people too:

-Get a printing tool that creates pdf files(e.g. pdf995)
        http://www.pdf995.com(freeware/adware)
-After installing it, choose that new printer (pdf995) to create a pdffile from your image (or whatever)
   (Make sure that you just have ONE page!)
-After, use ghostview to convert the pdf file to a eps file
        -Open the pdf file withghostview
        -Go to file/convert, andchoose epswriter as the device
        -The boundary box has beenfixed automatically
-Now you should able to include that newly created eps file into latex
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
科研技巧】如何将Visio图形转换成EPS格式
关于Latex中pdf和eps图片的处理
图片格式傻傻分不清?JPG、TIF、PNG,不同格式区别到底在哪里?
Visio文件转EPS文件
Photoshop: image name_檔案類型簡介
三角板论坛
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服