I am using:
NuGet package PDFsharp, Version= 6.2.0-preview-1
Blazor Web Assembly, .NET 8 (net8.0)
When i try to draw an image from stream to PDF from a blazor Web Assemly application I get the following error: 'MD5' is not a known hash algorithm.
The code is following:
Code:
var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(imagePath);
if (stream is null)
{
var message = $"Could not find image ({imagePath}).";
throw new FileNotFoundException(message);
}
var xImage = XImage.FromStream(stream);
page.DrawImage(xImage, xPosition, yPosition, width, height);
I can run the exact same code from a Win form application (.NET 8) and it works flawless including the image (our company logo).
I can create the exact same PDF with the blazor webassembly application, if dont draw the image (the company logo is a png file).