Sharing graphics

From ConTeXt wiki

< Graphics

Some lucky people will be able to produce all their documents in MetaPost and ConTeXt and never have to worry about the ugly world of MS Word, PowerPoint and Visio. Unfortunately, most of us will, at some point, have to share our graphics with colleagues who are unenlightened.

This page includes methods of sharing graphics/figures with co-workers who do not use ConTeXt. This includes importing to and exporting from ConTeXt.


Exporting MetaPost drawings as PDF files

PDF can be generated from MetaPost code using MPtoPDF or texexec --mptex. But where a drawing uses ConTeXt to generate formatted text or labels, it is necessary to generate a document which contains the graphic.

This can be achieved, with the page cropped to the size of the graphic, using the following construct:

\starttext
 \startMPpage
  draw fullcircle scaled 10cm ;
 \stopMPPage
\stoptext

See also \startMPpage.

Importing MetaPost drawings into MS Word or PowerPoint

MS Word can import pictures in many graphics formats, but not PDF. Two of the available options are:

  • Use encapsulated postscript (EPS). This provides graphics which print perfectly (on a PS printer) but which look blocky on screen, so are unsuitable for PowerPoint presentations.
  • Use scalable vector graphics (SVG) as an intermediate format between PDF and the MS Visio tool.

Converting to EPS

MetaPost drawings can be converted to encapsulated postscript as follows:

  • Create a PDF drawing (see "Exporting MetaPost drawing as PDF files" above).
  • From the command line, convert to EPS using pdftops:

pdftops -eps -pagecrop myfile.pdf

  • Import the EPS file as a picture into Word.

Note that the preview on-screen in Word is of poor quality, but when printed it should have the full quality of the original.

Converting to Visio via SVG

Visio is another Microsoft product whose .VSD files can be imported directly into Word or PowerPoint, giving good reproduction on screen and (usually) in print. Luckily, Visio will import SVG files. The steps to achieve this are:

  • Create a SVG file directly by running metapost 1.2 with -soutputformat="svg"

or

  • Create an SVG file by conversion via
    • MP to PDF (see above).
    • MPtoSVG to convert to SVG.
  • Load SVG into Visio.
  • Save as VSD file from Visio.
  • Import VSD into Word or PowerPoint.

Phew!