Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install MuPDFCore in Blazor WebAssembly #18

Open
tzographos opened this issue Aug 3, 2022 · 4 comments
Open

Install MuPDFCore in Blazor WebAssembly #18

tzographos opened this issue Aug 3, 2022 · 4 comments

Comments

@tzographos
Copy link

tzographos commented Aug 3, 2022

Hello, I am trying to install the library to a Blazor WebAssembly project in .NET 6.0, and I am getting the error of a missing MuPDFWrapper dll.
Do you have any ideas?

edit: I need to mention that I even tried adding the library as a blazor native dependency (using NativeFileReference) but the error persisted.

@arklumpus
Copy link
Owner

Hi! That doesn't surprise me, as the library does not contain a native WASM assembly... To allow this, one would need to recompile everything (starting from MuPDF itself) targeting WASM. This should not be impossible, but I have never tried it; maybe I will get around to it in the future 😅

Let's leave this open until I have a chance to give it a go and see if it is feasible.

@tzographos
Copy link
Author

I used emscripten to produce the output in wasm. It worked, and I was able to add the native dependency. But I was still receiving the dll missing error. Yeah, I think it needs a little rework.

@arklumpus
Copy link
Owner

The thing is that MuPDFCore uses the MuPDFWrapper DLL, which uses the MuPDF library... I don't know if that's what you did, but I think you would need to compile both MuPDF and MuPDFWrapper using Emscripten.

I have never done this before though, so I'm not sure exactly what's needed... I will get experimenting if I have some time!

@arklumpus
Copy link
Owner

I have had a look at this, and I don't think this is likely to work easily... I have managed to compile a WASM MuPDF, but it seems that not all of the API are there; in fact, even their WASM/JavaScript version has a relatively limited number of functions (https://github.com/ArtifexSoftware/mupdf-wasm).

In particular, my call to fz_create_context fails; I'm not sure if there's something wrong on my end, but I don't really have time to investigate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants