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

Should Update Example #59

Closed
DanielKeeley opened this issue Nov 3, 2021 · 5 comments
Closed

Should Update Example #59

DanielKeeley opened this issue Nov 3, 2021 · 5 comments

Comments

@DanielKeeley
Copy link

DanielKeeley commented Nov 3, 2021

Hi,

Thanks for this nuget.
Just wanted to let you know if you try to convert two documents to pdf in the same call it will hang on the 2nd conversion, with no error.
You need to Dispose() the converter after it has been used.

        `var converter = new BasicConverter(new PdfTools());
        var bytes = converter.Convert(doc);
        converter.Dispose();
        return bytes;`
@HakanL
Copy link
Owner

HakanL commented Nov 3, 2021

Thanks for your input. The examples came from the original repo, but I'm happy to accept a PR to fix anything you see!

@DanielKeeley
Copy link
Author

ah ok i'm just still trying to see why this is happening, might just be me actually

@HakanL
Copy link
Owner

HakanL commented Nov 3, 2021

Ok, could it be that you're trying to do something concurrently (multi-threaded)? The native library requires all calls to be single-threaded, so you need to use the SynchronizedConverted.

@DanielKeeley
Copy link
Author

yep that was it, it's all working now, but I also had to put the converter as static outside of the method to have both pdfs convert properly:
image

@HakanL
Copy link
Owner

HakanL commented Nov 3, 2021

Yep, the converter shouldn't be re-created for each request.

@HakanL HakanL closed this as completed Nov 3, 2021
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

2 participants