Async IO should be supported
Reporting an Issue Here
Expected Behavior
PDFSharp supports async API
Actual Behavior
PDFSharp does not support async API
Example
PdfReader.Open vs PdfReader.OpenAsync
PdfDocument.Save vs PdfDocument.SaveAsync
Why is it important?
Look at implementation of PdfDocument OpenFromStream it calls stream.Read(array, 0, 1024); which is blocking.
Blocking on IO can lead to threadpool starvation.
There is PdfDocument.SaveAsync.
You can read the PDF file into a MemoryStream and use that with PdfReader.Open.
@ThomasHoevel Unfortunately it looks like PdfDocument.SaveAsync() is only available in the prerelease version, not in the latest stable. Before that, the method is only defined for UWP builds.
@ThomasHoevel Is there any plan to add async IO ?
@molinch There is since it is present in the prerelease version. As far as I am concerned, I am currently using the prelease version in production since it is stable for my use case and I haven't hit any problem. Hope this helps.
Actually, it looks like SaveAsync() is now supported as the stable version has been published, no need to use the prerelease. I guess this issue can be closed.
Edit: Yes i have just upgraded to the latest stable version and i can confirm that SaveAsync() is present and that everything works like a charm.
Thanks @nkosi23 you're right it's in 6.2.3 :) We can definitely close this