PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Dec 13, 2024 4:27 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Mon Nov 25, 2024 12:05 pm 
Offline

Joined: Mon Nov 25, 2024 11:22 am
Posts: 2
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).


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 27, 2024 8:30 am 
Offline
PDFsharp Guru
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 1021
Location: CCAA
Some time ago we removed MD5 from the ImageSelector class. Change will come later this year with 6.2.0 Preview 2.

I hope Blazor supports SHA1. Do you know?

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 28, 2024 7:00 am 
Offline

Joined: Mon Nov 25, 2024 11:22 am
Posts: 2
Thank you very much. That is excellent.

Yes, I have tested System.Security.Cryptography.SHA1 with Blazor Web Assembly .NET 8 and it works, while MD5 gives error message.

I look forward to test 6.2.0 Preview 2 when it arrives.
The coming PDF/A feature is also valued.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 60 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group