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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - QuckPDF in a thread
  FAQ FAQ  Forum Search   Register Register  Login Login

QuckPDF in a thread

 Post Reply Post Reply
Author
Message
Chopinke View Drop Down
Team Player
Team Player


Joined: 29 Apr 14
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote Chopinke Quote  Post ReplyReply Direct Link To This Post Topic: QuckPDF in a thread
    Posted: 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
Back to Top
tfrost View Drop Down
Senior Member
Senior Member


Joined: 06 Sep 10
Location: UK
Status: Offline
Points: 437
Post Options Post Options   Thanks (0) Thanks(0)   Quote tfrost Quote  Post ReplyReply Direct Link To This Post Posted: 30 Apr 14 at 10:19AM
Have you tried CoInitializeEx?
Back to Top
Chopinke View Drop Down
Team Player
Team Player


Joined: 29 Apr 14
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote Chopinke Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
tfrost View Drop Down
Senior Member
Senior Member


Joined: 06 Sep 10
Location: UK
Status: Offline
Points: 437
Post Options Post Options   Thanks (0) Thanks(0)   Quote tfrost Quote  Post ReplyReply Direct Link To This Post Posted: 30 Apr 14 at 12:16PM
Which type of the Debenu library are you using (static Delphi, DLL, ActiveX)?
Back to Top
Chopinke View Drop Down
Team Player
Team Player


Joined: 29 Apr 14
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote Chopinke Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
Chopinke View Drop Down
Team Player
Team Player


Joined: 29 Apr 14
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote Chopinke Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store