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

Using Zpl.Viewer in the browser using WASM #275

Open
Fabrizz opened this issue Dec 28, 2024 · 0 comments
Open

Using Zpl.Viewer in the browser using WASM #275

Fabrizz opened this issue Dec 28, 2024 · 0 comments

Comments

@Fabrizz
Copy link

Fabrizz commented Dec 28, 2024

Hi, this library is amazing and the docker viewer really helped me on a internal project!

Im trying to pack the viewer inside a WASM module using wasm-tools (from blazor) It was fairly easy to create a module that can be used in the browser directly, but at the moment of actually generating the label a SkiaSharp error is raised (even though the correct SkiaSharp.wasm packages are used)

As im running this behind the WASM packager, the only error that is shown is Uncaught (in promise) ManagedError: TypeInitialization_Type, SkiaSharp.SKObject, I cannot view the full trace.

https://github.com/Fabrizz/ZPLwasm/blob/master/ZPLwasm/Program.cs (Very basic stuff, it just exposes the package in the JS side. It works as the error is while using the Skia renderer)

I dont have much C# experience really, I tried adding: (https://github.com/Fabrizz/ZPLwasm/blob/master/ZPLwasm/ZPLwasm.csproj)

	<ItemGroup>
		<TrimmerRootAssembly Include="SixLabors.ImageSharp" />
		<LinkerDescriptor Include="ILLink.xml" />
	</ItemGroup>

To maybe solve the Skia error, but It did nothing.

For testing I load the /bin/release/net8.0/browser-wasm/AppBundle/_framework folder in a vite app, but using the included main.js is enough to test the integration.

Any help appreciated!

Relevant:

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

1 participant