Question: Does Qoppa’s PDF library jPDFImages make use of parallelism, using multiple cores instead of just one?
Answer: Content in a PDF page is serial, it consists of a list of drawing commands that have to be executed in order. This is because content elements can overlap and can build on each other, so it is important that they are rendered in the order that they are stored to produce correct renderings.
Even so, there are some opportunities when rendering single pages can make use parallelism, and we do. For instance, anytime that we process images, gradients and some color conversions, we use multiple cores.
However, more useful for parallelism is the fact that our PDF SDKs are designed to be thread safe, so that they can be called in parallel from your application both within a document and across documents:
- Your application can convert different pages with the same PDFImages object. In your application, you would want to load the document only once, into a single PDFImages object. Once loaded, you can start different threads to convert the different pages in the document.
- Your application can also process multiple documents concurrently. You can create multiple instances of the PDFImages class in different threads and have them convert different documents at the same time, using as many cores as you have.