forked from 6tudent/pyemf
-
Notifications
You must be signed in to change notification settings - Fork 1
bjodah/pyemf
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is a fork of a forked version of pyemf. But I wouldn't bother, just do: > fig.savefig('myfig.svg') $ inkscape --file myfig.svg --export-emf myfig.emf /Björn ---------------------------------------------------------------------------- This is a forked version of pyemf with support for Python 3.3+. It should also run under Python 2.6 and 2.7. Patches are welcome. It would be nice to clean up the file layout. ABSTRACT ======== pyemf is a pure python module that provides bindings for an ECMA-234 compliant vector graphics library. ECMA-234 is the published interface for the Windows GDI used in the Microsoft windows environment and, more importantly, natively supported by the OpenOffice suite of tools. http://www.ecma-international.org/publications/standards/Ecma-234.htm PREREQUISITES ============= Python (2.6, 2.7 or 3.3+) QUICK INSTALL ============= python setup.py install Yep, that's pretty much it. FEATURES ======== Most of the drawing methods of ECMA-234 are supported by pyemf. Supported --------- Drawing parameters: GetStockObject, SelectObject, DeleteObject, CreatePen, CreateSolidBrush, CreateHatchBrush, SetBkColor, SetBkMode, SetPolyFillMode Drawing primitives: SetPixel, Polyline, Polygon, Rectangle, RoundRect, Ellipse, Arc, Chord, Pie, PolyBezier Path primitives: BeginPath, EndPath, MoveTo, LineTo, PolylineTo, ArcTo, PolyBezierTo, CloseFigure, FillPath, StrokePath, StrokeAndFillPath Clipping: SelectClipPath Text: CreateFont, SetTextAlign, SetTextColor, TextOut Coordinate system transformation: SaveDC, RestoreDC, SetWorldTransform, ModifyWorldTransform Experimental ------------ Window/Viewport commands: SetMapMode, SetViewportOrgEx, GetViewportOrgEx, SetViewportExtEx, ScaleViewportExtEx, GetViewportExtEx, SetWindowOrgEx, GetWindowOrgEx, SetWindowExtEx, ScaleWindowExtEx, GetWindowExtEx Unsupported ----------- Palettes Bitmaps Text metrics DOCUMENTATION ============= The most current documentation is always available on the web at $url/api/index.html Or, in the source distribution, the directory website/api/ contains a copy of the api documentation for version $version. Simply point your web browser at the index.html within that directory. EXAMPLES ======== Creating an EMF --------------- Here's a simple program (available as test-1.py in the distribution) that connects opposite corners of an 8in by 6in rectangle with lines: #!/usr/bin/env python import pyemf width=8 height=6 dpi=300 emf=pyemf.EMF(width,height,dpi) thin=emf.CreatePen(pyemf.PS_SOLID,1,(0x01,0x02,0x03)) emf.SelectObject(thin) emf.Polyline([(0,0),(width*dpi,height*dpi)]) emf.Polyline([(0,height*dpi),(width*dpi,0)]) emf.save("test-1.emf") Examining an EMF ---------------- pyemf, when run as a standalone program, has the ability to read an EMF and print out the contents. Run: $ pyemf.py -v test-1.emf and it will print out a text summary of all the metafile records in the file. Other tests ----------- There are many other tests included in the examples/ directory in the source distribution. After installing the pyemf library, you should be able to run them like this: $ cd examples $ python test-drawing1.py and examine the output file 'test-drawing1.emf' by loading it in OpenOffice Impress. Also included in the examples directory is the program 'test--run-all.py' that will run all the tests. SUPPORT AND DEVELOPMENT ======================= To request support or to further development, please go to https://github.com/jeremysanders/pyemf DISCLAIMER ========== $prog, Copyright (c) $yearrange $author ($author_email) $prog comes with ABSOLUTELY NO WARRANTY; for details see the file COPYING included in the source distribution, or see the web site http://www.gnu.org/copyleft/lesser.html for more information.
About
Never mind, use savefig('myfig.svg'), and then $ inkscape --file myfig.svg --export-emf myfig.emf
Resources
Stars
Watchers
Forks
Packages 0
No packages published
Languages
- Python 100.0%