-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Describe the bug
Trying to convert --from a supported input type such as odt odt-test.odt --to the pdf type causes a WASI Error: [WASI stderr] pdflatex: runInteractiveProcess: unsupported operation (Operation is not supported)
To Reproduce
Building on the example vanilla JS code, if you add a temp directory for pandoc to put latex and whatever intermediaries it wants,
const tmp_dir = new PreopenDirectory("/tmp", []); // Create /tmp directory
const fds = [
new OpenFile(new File(new Uint8Array(), { readonly: true })),
ConsoleStdout.lineBuffered((msg) => console.log(`[WASI stdout] ${msg}`)),
ConsoleStdout.lineBuffered((msg) => console.warn(`[WASI stderr] ${msg}`)),
new PreopenDirectory("/", [
["in", in_file],
["out", out_file],
]),
tmp_dir, // provide a temp directory for intermediary files
];And then in the pandoc function you set the input file's data from a file upload rather than a text encoder,
in_file.data = new Uint8Array(await web_file.arrayBuffer());Pandoc seems to have trouble even looking for a pdflatex executable, which it typically depends on for pdf conversions on the desktop app. I am wondering if the WASI issue were worked out, maybe it could use a latex like SwiftLaTeX's pdftex.wasm or busytex inside the WASI sandbox and get a successful PDF output.
Expected behavior
runInteractiveProcess would look for a binary in the WASI sandbox called pdflatex, which the developer would be expected to provide. At a minimum, maybe latex-involving conversions are added to the list of not supported for the WASM target (e.g. as with lua filters).
Environment
- Windows 11 Home, Chrome 135.0.7023.0 (Official Build) dev (64-bit) (cohort: Dev)
- Version of the code: https://tweag.github.io/pandoc-wasm/pandoc.wasm linked from the README on 2/26/25
Additional context
I suppose this might be a WASM/WASI issue or maybe a @bjorn3/browser_wasi_shim issue.