How to distribute rendering of PDF pages across server cores?

Q:

We use PDFTron on an ASP.NET application for previewing some pages from various PDF documents using PDFNet SDK 6.2.

Everything works fine, but would like to improve the performance - the IIS app runs on a 8 core VM and during a concurrent rendering of different PDF’s (different isolated PDF objects) the CPU does not get to 100%, but it remains cca. 25% which is 2 cores.

Before we will start to investigate this via some profiling tools i’d like to be sure that PDFNet support concurrent rendering of PDF pages and if there is any concurrency penalty in your library for this scenario.

A:

You should be able to run multiple concurrent PDFDraw (or PDFRasterizer) threads on the same document. So if you have 8 cores and you document has 8 pages you could split processing on those 8 cores …. as shown in ‘MultiThreaded’ sample project:

https://www.pdftron.com/pdfnet/samplecode/MultiThreadedTest.cs.html

Although PDFNet supports concurrent rendering of pages from the same input document, it does not do that by default (i.e. PDFDraw/PDFRasterizer renders one page at a time). So you would need to write code that creates and manages thread pool etc.