Multithreaded processing on the same PDF file.


I have a large PDF document (5,000 pages) and I’m using the PDFnet SDK in an ASP.NET web site to extract a subset of pages to render to the user. Multiple users can access the document at the same time, and request different page ranges. Since this is read-only access, do I need to call the document Lock/Unlock for each request?

Probably the best thing would be that you open multiple PDFDoc-s pointing to a same physical file. In this case you can serve multiple processing requests in parallel. PDFNet is loading file on demand so having multiple PDFDoc instances does not mean that you would load multiple instances of the same file in memory. In this case there is no need to lock anything.

Alternatively you can have a single PDFDoc instance and have multiple requests access the same object instance. In this case you would need to lock the document (pdfdoc.Lock()) which would effectively serialize all requests.