emf-converter 1.4.0 โ 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# emf-converter
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/emf-converter)
|
|
4
|
-
[](https://github.com/ChristopherVR/emf-converter/actions/workflows/ci.yml)
|
|
5
|
+
[](LICENSE)
|
|
5
6
|
|
|
6
|
-
A zero-dependency TypeScript library that converts **EMF** (Enhanced Metafile) and **WMF** (Windows Metafile) binary buffers into **PNG data URLs** by parsing their record streams and replaying drawing commands onto an HTML Canvas.
|
|
7
|
+
A zero-dependency TypeScript library that converts **EMF** (Enhanced Metafile) and **WMF** (Windows Metafile) binary buffers into **PNG data URLs** by parsing their record streams and replaying the drawing commands onto an HTML Canvas.
|
|
7
8
|
|
|
8
|
-
Windows Metafiles store a sequence of GDI drawing commands and are commonly embedded inside Office documents (
|
|
9
|
+
Windows Metafiles store a sequence of GDI drawing commands and are commonly embedded inside Office documents (Word, PowerPoint) and Windows clipboard data. This converter reads the raw binary, interprets each record, and replays the drawing operations onto a Canvas to produce a rasterised PNG. It handles three formats:
|
|
9
10
|
|
|
10
11
|
| Format | Description | Coordinate system |
|
|
11
12
|
| -------- | ------------------------------ | ----------------------- |
|
|
@@ -13,10 +14,16 @@ Windows Metafiles store a sequence of GDI drawing commands and are commonly embe
|
|
|
13
14
|
| **EMF** | Enhanced Metafile (32-bit GDI) | Bounds-based scaling |
|
|
14
15
|
| **EMF+** | GDI+ extension embedded in EMF | World transform matrix |
|
|
15
16
|
|
|
16
|
-
<samp>**[
|
|
17
|
+
<samp>**[โถ๏ธ Live demo](https://christophervr.github.io/emf-converter/)** ยท **[๐ฆ npm](https://www.npmjs.com/package/emf-converter)**</samp>
|
|
17
18
|
|
|
18
19
|
---
|
|
19
20
|
|
|
21
|
+
## Demo
|
|
22
|
+
|
|
23
|
+
Try it right in your browser โ drop in an `.emf` or `.wmf` file and see the rendered PNG, conversion time, and output size:
|
|
24
|
+
|
|
25
|
+
**https://christophervr.github.io/emf-converter/**
|
|
26
|
+
|
|
20
27
|
## Install
|
|
21
28
|
|
|
22
29
|
```bash
|
|
@@ -57,7 +64,7 @@ Both functions return `Promise<string | null>` โ `null` if the buffer is inval
|
|
|
57
64
|
|
|
58
65
|
A three-phase pipeline: **parse โ replay โ export**. The header parser extracts the drawing bounds, a Canvas is created and clamped to 4096ร4096, then records are scanned sequentially and dispatched to GDI, EMF+, or WMF handlers that drive the Canvas 2D context. Embedded bitmaps (DIB and GDI+ pixel formats) and recursively embedded metafiles are resolved asynchronously after the synchronous replay completes.
|
|
59
66
|
|
|
60
|
-
It supports 300+ EMF GDI record types, the EMF+ (GDI+) record set, and legacy WMF records, including state, transforms, objects, shapes, poly/path operations, text, bitmaps, and clipping.
|
|
67
|
+
It supports 300+ EMF GDI record types, the EMF+ (GDI+) record set, and legacy WMF records, including state, transforms, objects, shapes, poly/path operations, text, bitmaps, and clipping.
|
|
61
68
|
|
|
62
69
|
## Limitations
|
|
63
70
|
|
|
@@ -70,4 +77,4 @@ It supports 300+ EMF GDI record types, the EMF+ (GDI+) record set, and legacy WM
|
|
|
70
77
|
|
|
71
78
|
## License
|
|
72
79
|
|
|
73
|
-
[Apache-2.0](LICENSE)
|
|
80
|
+
[Apache-2.0](LICENSE) โ free for commercial and closed-source use, with an explicit patent grant.
|