Library to parse WMF and convert to SVG (WIP).
wmf-core
parser
module ... Parsing according to MS-WMF specifications.converter
module ... Converting parsed records to SVG.
wmf-cli
... An example runner forwmf-core
.
- Rust 1.82.0+ (For Development)
- wasm-pack
- Yarn 1.22.22+ (To run example)
- Docker
- cargo-machete
- cargo-udeps
[dependencies]
wmf-core = { git = "https://github.com/mythrnr/wmf-rs.git", tag = "0.0.1", package = "wmf-core" }
More details, see wmf-cli
crate.
$ cargo run --package wmf-cli -- --help
Usage: wmf-cli [OPTIONS] --input <INPUT>
Options:
-i, --input <INPUT> The WMF 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, { convertWmf2Svg, setLogLevel } from './wmf_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 = convertWmf2Svg(bytes);
document.getElementById('output').innerHTML = output;
};
fileReader.readAsArrayBuffer(files[0]);
});
}
run();
</script>