Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async IO should be supported #177

Open
cfauchere opened this issue Oct 1, 2024 · 2 comments
Open

Async IO should be supported #177

cfauchere opened this issue Oct 1, 2024 · 2 comments

Comments

@cfauchere
Copy link

cfauchere commented Oct 1, 2024

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.

@ThomasHoevel
Copy link
Member

There is PdfDocument.SaveAsync.

You can read the PDF file into a MemoryStream and use that with PdfReader.Open.

@nkosi23
Copy link

nkosi23 commented Oct 9, 2024

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants