-
Notifications
You must be signed in to change notification settings - Fork 1
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
Impossible to run the squeezing of the PDF documents from Java due to JRE fatal issue in the cPDF library #1
Comments
example of the PDF document, which I used can be found here |
Jcpdf is not suitable for parallel or concurrent use. You would have to put your own lock around it, or use multiple java processes with such locks - each process would then have its own copy of libcpdf.dll / libjcpdf.dll. Alternatively, you could use the cpdf command line tools, simply calling out to them. (The command line tool is the original, upon which the APIs are based - which explains the single-threaded heritage.) |
In any event, don't call |
Thank you for the quick reply @johnwhitington ! May I ask you, is this limitation being mentioned somewhere in the library doc? |
@johnwhitington a small question on top: would that be possible to use the cPDF version for JS environment with async/await? Does the library have any limitations for async engines? I can consider re-writing the business logic in Node JS as well |
We can leave this open, as a not to fix the documentation for jcpdf for the next release. My understanding of JavaScript async/await is that it is not actually parallel. Now, cpdf.js is pure javascript - so you should be ok, so long as calls to cpdf.js are, in the end, only happening one at a time, and in a sensible order. There is an example of a "web worker" style in the cpdf.js repository - though this example never queues up more than one job at a time. Of course, you should expect cpdf.js to be a lot slower - squeeze is a complex operation - and you may need to configure node.js to use a bigger stack to deal with big PDFs. |
I see, thank you for the insights @johnwhitington ! |
I'm playing with the library right now with one of my test experiments, but I keep bumping my head into this issue:
The code which I have integrated so far is very simple (following the examples from the project documentation):
I would expect the library to work nicely in the concurrent environment, because unfortunately it is a blocker for me.
Please, let me know, if you need any further details
The text was updated successfully, but these errors were encountered: