Ab2d.ReaderWmf - metafile importer

Ab2d.ReaderWmf is a class library that can be used to read Windows metafiles (wmf) and also Enhanced Metafiles (emf) in runtime and import its elements into WPF's Viewbox.

Note that Ab2d.ReaderWmf cannot be used in Silverlight applications - but can be used in XBAP Web Browser application. For Silverlight use Paste2Xaml and select export as Silverlight xaml in the export options.

The library is used by Paste2Xaml application. It can also be used in any other application which is using metafile cliparts. With ReaderWmf library there is no need to convert them into xaml - metafiles can be simple imported at runtime when needed.


Read Windows metafiles (wmf) or Enhanced Metafiles (emf) file in XAML:

  • In project add reference to Ab2d.ReaderWmf
  • Add namespace definition into root xaml element (for example Window):
    xmlns:ab2d="clr-namespace:Ab2d.Controls;assembly=Ab2d.ReaderWmf"
  • Use Ab2d.Controls.WmfViewbox to read a metafile file as Shapes - set Source property to metafile location.
  • Use Ab2d.Controls.WmfDrawing to read a metafile file as Drawings - set Source property to metafile location.

Source property can be uses just as Source of the Image control. Depending on the location and metafile build action use of the following patterns to load the file. The following examples show how to read matafile (as Shapes) from various resources.

Location: samples folder in project, Build Action: Content
<ab2d:WmfViewbox Source="samples/myClipart.emf"/>

Location: samples folder in project, Build Action: Resource - embedded into assembly
<ab2d:WmfViewbox Source="samples/myClipart.emf"/>

Location: internet, Build Action: not included in project
<ab2d:WmfViewbox Source="http://www.myweb.com/images/myClipart.emf"/>

Location: loose emf file on the local disk, Build Action: not included in the project
<ab2d:WmfViewbox Source="c:\temp\myClipart.emf"/>

Location: loose emf file in the application directory, Build Action: not included in the project
<ab2d:WmfViewbox Source="pack://siteoforigin:,,,/myClipart.emf"/>


Related Blog posts
To see the development history of Ab2d.ReaderWmf and Paset2Xaml, check out the related blog posts.


Version history

New in version 5.0

  • Improved reading detailed images from EMF+ records.
  • Optimizing gradients defined in metafiles.
  • Reading character spacing information.
  • Controlling the size of read metafile with CustomContentWidth, CustomContentHeight properties.
  • Added workaround for displaying Paths for Silverlight xaml.
  • PathGeometry is now written in xaml as collection of PathFigures instead of data string.
  • Each PathGeometry is analyzed and if possible it is converted into RectangleGeometry.
  • Fixed problems when running on 64-bit OS.
  • Fixed reading images that have width or height value defined as negative numbers.
  • Added IsClipboardMetafileAvailable, GetFromClipboard, GetGeometryFromClipboard methods.
  • Added RemoveEmptyTextBlocks property.
  • Added ProgressChanged event.
  • Improved ResourceDictionaryWriter class.

New in version 4.0

  • Greatly improved performance when reading metafiles.
  • Greatly improved reading and pasting objects from MS Office - images are now read from EMF+ part of the matafile and are much better quality than images stored in EMF part of the metafile.
  • Added support for Pie and Chord elements.
  • Added support for stretched text (condensed, widened).
  • fixed licensing issues on 64 bit Windows.
  • Fixed importing text rotated by 180 degrees.
  • Added ReadGeometry methods without geometry settings parameters that use default NoOptimization geometry settings (simplified use of ReadGeometry).
  • Improved support for clipping.
  • Changed calculation of MinLineWidthFactor (see help for more info).
  • Imporved GetXaml - now know colors are by default displayed by their name (Black, Red, ect.). This can be turned off by setting UseColorNames property on XamlWriterSettings.
  • Separate evaluation and commercial version.

New in version 3.0

  • Implemented export as Drawings.
  • Added options for optimizing geometry.
  • Added ReadGeometry class.
  • Added GetXaml class.
  • Added ResourceDictionaryWriter class.
  • Improved licensing with added evaluation support

New in version 2.0

  • Integrated licensing system - first commercial version.

New in version 1.4

  • Added support for pen's LineJoin, LineCap and Dash Style.
  • Added support for Arc.
  • Improved placing text in some metafiles.
  • Corrected the width of the lines.
  • Correctly use Polyline and Polygon.

New in version 1.3

  • fixed problems with some wmf files that were imported with some anomalies (lost details).

New in version 1.2

  • Fixed reading some wmf files - especially files exported from Autocad are converted properly now.
  • Added MinLineWidthFactor property - useful for metafiles with lots of lines. With the property it is possible to adjust thickness of the lines.
  • Added EmbeddedBitmapImages property that replaced the obsolete MetafileImages (because of misunderstanding of the property)
  • Added support for reading pixels (individual points) from metafiles - they are converted to Ellipse elements with the specified radius.

New in version 1.1

  • Added WmfViewbox control.
  • Added support for PenStyle (solid, dash, dashDot, dashDotDot, null)
  • Added EmbeddedBitmapImages property that replaced the obsolete MetafileImages (because of misunderstanding the property)
  • Fixed StrokeEndLineCap and StrokeStartLineCap when none (set to round) or only LineJoin is defined (set to the same as LineJoin)

 

Information about changes:
 Subscribe to RSS feed to all Blog posts.
 Subscribe to RSS feed to Blog posts related to Ab2d.ReaderWmf and Paste2Xaml.
 Follow me on twitter.
 Subscribe to newsletter - enter your email into Newsletter box on my Blog.
|  Home  |  Blog  |  Users Forum  |  Contact Us  |  Terms and Conditions  |  Privacy Policy |
Copyright © 2006-2010 Andrej Benedik s.p. All Rights Reserved.