Library to parse EMF and convert to SVG (WIP).
emf-core
parser
module ... Parsing according to MS-EMF specifications.converter
module ... Converting parsed records to SVG.
emf-cli
... An example runner foremf-core
.
- Rust 1.82.0+ (For Development)
- wasm-pack
- Yarn 1.22.22+ (To run example)
- Docker
- cargo-machete
- cargo-udeps
[dependencies]
emf-core = { git = "https://github.com/mythrnr/emf-rs.git", tag = "0.0.1", package = "emf-core" }
More details, see emf-cli
crate.
$ cargo run --package emf-cli -- --help
Usage: emf-cli [OPTIONS] --input <INPUT>
Options:
-i, --input <INPUT> The EMF file path to convert to SVG
-o, --output <OUTPUT> The destination file path to save converted SVG [default: output.svg]
-q, --quiet Omit logs except error log
--verbose Print debug logs
-h, --help Print help
-V, --version Print version
- Run example in http://localhost:8080
make serve
- Enable to set log level by running
setLogLevel(level: "trace" | "debug" | "info" | "warn" | "error")
- Default is
info
level. - NOTE: trace and debug levels are very slow to execute.
- Default is
- If you want more small WASM, disable
tracing
feature. But no logs will be out in console.- Running
setLogLevel
has no effect.
- Running
<script type="module">
import init, { convertEmf2Svg, setLogLevel } from './emf_wasm.js';
async function run() {
await init();
setLogLevel('debug');
document.getElementById('input').addEventListener('change', () => {
const input = document.getElementById('input');
const files = input.files;
if (files === null || files.length === 0) {
return;
}
const fileReader = new FileReader();
fileReader.onload = function (e) {
const bytes = new Uint8Array(e.target.result);
const output = convertEmf2Svg(bytes);
document.getElementById('output').innerHTML = output;
};
fileReader.readAsArrayBuffer(files[0]);
});
}
run();
</script>