Is PDFNet thread safe?

Q: Is PDFNet thread safe?
Yes, PDFNet is fully thread safe
( and is ideal match
for server based and concurrent applications.

Q: I read the following in the FAQ:

"Make sure that you initialized PDFNet using PDFNet.Initialize().
PDFNet.Initialize()/Terminate() should be called only once per process
session. You should not call PDFNet.Initialize()/Terminate() for each
PDFNet thread."

I do not quite understand what it really means. Does it have any
restrictions on how we need to program? Do you have any sample code
that utilizes PDFNet multi-thread?

A: PDFNet is suitable for use in multithreaded applications. Because it
is not directly related to the API, PDFNet SDK does not come with
samples of how to use .NET threads (or ASP.NET pages), but you could
extend any sample to run with multiple threads. For example,

static void Main(string[] args) {
  // This function needs to be called only once before any other PDFNet
  // Actually, it is a workaround for a bug in .NET framework and is
not used for
  // global variables.
  if (!PDFNet.Initialize())
    Console.WriteLine("PDFTron initialize error");
  if (!PDFNet.SetResourcesPath("C:/PDFNet/resources"))
    Console.WriteLine("PDFTron error setting resoure");

  for ( int i = 0; i < 5; i++ )
  (new Thread(new ThreadStart(this.MyThread))).Start();

private static int threadCount = 1;

public void MyThread() {
  int threadId = 0;
  lock (this) {
    // threadId = threadCount++;

  PDFDoc doc = null;
  try {
      PDFDoc doc = new PDFDoc("C:/MYDOCs/mydoc.pdf");
      int page_count= doc.GetPagesCount();
      ... do stuff with the document....
  catch (PDFNetException e) {
     Console.WriteLine("Exception opening PDF: " + e.Message);
    doc = null;

  if(doc != null) doc.Close();

Does it have any restrictions on how we need to program?

No, it does not pose any significant restriction. You can process
multiple documents in parallel. Multiple threads can even access the
same document at the same time (using doc.Lock()/Unlock() to serialize