Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
![]()  | 
 
QuckPDF in a thread | 
 
    Post Reply  
   | 
  
| Author | |
   
   Chopinke  
   
   Team Player  
   Joined: 29 Apr 14 Status: Offline Points: 24  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Topic: QuckPDF in a threadPosted: 29 Apr 14 at 6:07PM  | 
 
| 
   
    
   Hi, 
   
  I am evaluating QuckPDF library with Delphi7. I am using threads. constructor TMyThread.Create(CreateSuspended: Boolean); begin   inherited Create(CreateSuspended);   Priority := tpNormal;   FreeOnTerminate := false; //  CoInitialize(nil);   DPL := TDebenuPDFLibrary1014.Create;   DPL.UnlockKey('blabla'); end; destructor TMyThread.Destroy; begin   DPL.Free;   DPL := nil; //  CoUnInitialize;   inherited Destroy; end; procedure TMyThread.Execute; begin while not Terminated do   if not Suspended then   begin       PDFDocument := DPL.NewDocument;   end; end; I am getting 'CoInitialize has not been called' exception at the NewDocument() call, even if I uncomment the CoInitilalize in the code above. What the problem may be? Thanks! 
Edited by Chopinke - 29 Apr 14 at 6:08PM  | 
 |
![]()  | 
 |
   
   tfrost  
   
   Senior Member  
   Joined: 06 Sep 10 Location: UK Status: Offline Points: 437  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 30 Apr 14 at 10:19AM | 
 
| 
   
    
   Have you tried CoInitializeEx?
    
   
   | 
 |
![]()  | 
 |
   
   Chopinke  
   
   Team Player  
   Joined: 29 Apr 14 Status: Offline Points: 24  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 30 Apr 14 at 10:24AM | 
 
| 
   
    
   I changed my solution that I do the .create and .free inside the thread running. I am not sure why would I even have to call CoInitialize, because 
   
  1) They already fixed that issue in much earlier version 2) They claim free of Adobe Reader, so why do they need any OLE stuff? But I will try the CoInitializeEx() and let you know the result. 
    | 
 |
![]()  | 
 |
   
   tfrost  
   
   Senior Member  
   Joined: 06 Sep 10 Location: UK Status: Offline Points: 437  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 30 Apr 14 at 12:16PM | 
 
| 
   
    
   Which type of the Debenu library are you using (static Delphi, DLL, ActiveX)?
    
   
   | 
 |
![]()  | 
 |
   
   Chopinke  
   
   Team Player  
   Joined: 29 Apr 14 Status: Offline Points: 24  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 05 May 14 at 11:21AM | 
 
| 
   
    
   Sorry for the late reply, I was out of town. Currently Delphi 7, and will also try with Delphi XE4 (or XE5)
    
   
   | 
 |
![]()  | 
 |
   
   Chopinke  
   
   Team Player  
   Joined: 29 Apr 14 Status: Offline Points: 24  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 12 May 14 at 9:01PM | 
 
| 
   
    
   I checked the CoInitializeEx and getting RPC_E_CHANGED_MODE for COINIT_MULTITHREADED. 
   
  If I use COINIT_APARTMENTTHREADED, then I get S_FALSE back, meaning that the COM library is already initialized. I believe I move on now for always DPL.Create ... DPL.Free, for each execution of the tread, and will check later how is it behaving in XE4 or later. 
    | 
 |
![]()  | 
 |
    Post Reply  
   | 
  |
|       
  
  Tweet   	
    | 
 
| Forum Jump | Forum Permissions  ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum  | 
 
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store