QuestPDF / QuestPDF

QuestPDF is a modern open-source .NET library for PDF document generation. Offering comprehensive layout engine powered by concise and discoverable C# Fluent API. Easily generate PDF reports, invoices, exports, etc.
https://www.questpdf.com
Other
11.65k stars 604 forks source link

FontManager.RegisterFontFromEmbeddedResource doesn't load the supplied resource #450

Closed jeroenwalter closed 1 year ago

jeroenwalter commented 1 year ago

Describe the bug FontManager.RegisterFontFromEmbeddedResource doesn't load the supplied resource for resources in projects other than the QuestPDF assembly itself. Instead an exception is thrown.

To Reproduce Call FontManager.RegisterFontFromEmbeddedResource from a custom project with the resource name of an embedded resource font in that custom project

Expected behavior The embedded resource font from the custom project is registered in the FontManager.

Screenshots

Additional context FontManager.RegisterFontFromEmbeddedResource calls Assembly.GetExecutingAssembly(). This will return the QuestPDF assembly itself instead of the calling assembly, which of course doesn't find the supplied resource in its resource manifest. I think this can be fixed by calling Assembly.GetCallingAssembly instead.

MarcinZiabek commented 1 year ago

This is fixed in the 2022.12.1 release. Please test 😁

jeroenwalter commented 1 year ago

I just tested it in our project. It's working, thnx!