Print Page | Close Window

QuickPDF with TPL

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1811
Printed Date: 10 Jun 25 at 2:35AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: QuickPDF with TPL
Posted By: i.collodoro
Subject: QuickPDF with TPL
Date Posted: 20 Apr 11 at 4:11PM
Hello,
i'm trying to read a huge file with almost 12000 pages and i need to performe text search on it. i've tried reading page by page but it tooks about 15 minutes. I tried to use
 
Parallel.For(0,pageCount,(i)=>{ qp.SelectPage(i);
s = qp.GetPageText(3)});
 
public string GetPageText(int ExtractOptions)
{
   if (dll == null) return "";
   else
   {
         IntPtr data = dll.QuickPDFGetPageText(instanceID, ExtractOptions);
         int size = dll.QuickPDFStringResultLength(instanceID);
         byte[] result = new byte[size];
         Marshal.Copy(data, result, 0, size);
         return Encoding.UTF8.GetString(result);
   }
}
 
but i receive a Corrupted Memory Exception
          IntPtr data = dll.QuickPDFGetPageText(instanceID, ExtractOptions);
 
Is QuickPDF tread safe?
Thanks!



Replies:
Posted By: Rowan
Date Posted: 21 Apr 11 at 2:29PM
Usually when the phrase "thread safe" is used it means that the same instance of the library can be accessed by different threads at the same time.

This means that Quick PDF Library is not thread safe because a single instance of Quick PDF Library can only be accessed by the thread that created the instance.

However, Quick PDF Library can be used in a multithreaded environment so long as a separate instance of the library is created by each thread.

For users of the ActiveX edition of the library, please note that this version has been compiled with the threading mode set to "single threaded apartment".



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk