@mlightcad/emf-converter
v1.15.1
Published
Fork of [email protected] with Excel OLE EMF clip / LOGFONT fixes for RealDWG-Web
Maintainers
Readme
@mlightcad/emf-converter
Source fork of [email protected]
(Apache-2.0, ChristopherVR/emf-converter)
used by @mlightcad/data-model to rasterize OLE2FRAME WMF/EMF previews.
Upstream tag: v2.0.2 (460b4fc).
Fork changes (vs upstream 2.0.2)
EMR_EXTSELECTCLIPRGN(src/emf-gdi-draw-text-bitmap.ts) — clip rects use device/page space instead of the GDI world transform, so Excel OLEExtTextOutglyphs are not clipped away.EMR_EXTCREATEFONTINDIRECTW(src/emf-gdi-object-handlers.ts) —LOGFONTW.lfFaceNameis read at byte offset 32 (not 28), matching the Windows structure so CJK face remapping works.
Install
pnpm add @mlightcad/emf-converterAPI
Same public API as upstream 2.0.2:
import {
convertEmfToDataUrl,
convertWmfToDataUrl
} from '@mlightcad/emf-converter'
const pngDataUrl = await convertEmfToDataUrl(arrayBuffer, {
maxWidth: 4096,
maxHeight: 4096,
dpiScale: 1,
fontFamilyMap: { simsun: '"Microsoft YaHei", sans-serif' }
})@mlightcad/data-model statically imports this package and inlines it into
its published CJS bundle.
Develop
pnpm --filter @mlightcad/emf-converter build
pnpm --filter @mlightcad/emf-converter test