PdfPig: The type initializer for 'UglyToad.PdfPig.Fonts.SystemFonts.SystemFontFinder' threw an exception
Hi,
I am using .NET MAUI Blazor (Hybrid) to make Windows and OSx (MacCatalyst) apps. On Windows it works well, but on Mac it fails with:
The type initializer for 'UglyToad.PdfPig.Fonts.SystemFonts.SystemFontFinder' threw an exception. System.IO.FileLoadException: The type initializer for 'UglyToad.PdfPig.Fonts.SystemFonts.SystemFontFinder' threw an exception.
It fails for every PDF file.
I did a try with
new ParsingOptions { SkipMissingFonts = true, UseLenientParsing = true, }
but without success.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (1 by maintainers)
I’ll check out your repo and the app.
For rendering PDFs, I use Mozilla’s pdf.js, but I ran into trouble trying to display the first page as an image(book thumbnail) on macOS. Luckily, PdfPig and the Skia library have been a huge help in getting around that.
My app is all about managing and reading e-books (EPUB and PDF). It’s been publicly available for over a year now, so feel free to check it out https://pickandroll.dev/bookerei
It works like a charm. Thanks @BobLd
Makes a lot of sense, thanks both. I’ll push some changes shortly
Does ‘RuntimeInformation.IsOSPlatform(OSPlatform.OSX)’ return true or false on a MacCatalyst app? I don’t have a mac to hand to test, just wondering as the newer OperatingSystem.IsXXX functions seem to treat ‘MacOS’ and ‘MacCatalyst’ as different things