Print Page | Close Window

Using QuickPDF in Multi-Thread app

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=3931
Printed Date: 30 Apr 24 at 10:29AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Using QuickPDF in Multi-Thread app
Posted By: RedOctober2018
Subject: Using QuickPDF in Multi-Thread app
Date Posted: 04 Jul 21 at 10:45PM
Platform: Windows 2016 Server  Lazarus 2.0.10, FreePascal 3.2.0
Web App:  Brook 5 Framework  QuickPDF Library 10.13
Uses clause contains:  ComObj, ActiveX,  DebenuPDFLibrary64AX1013_10_13_TLB;                           

I need use the QuickPDF library in a non-main thread of my web app.  However, when I run the code to create a library object:

...
var
   qpdfDCL: TAxcPDFLibrary;
begin
    qpdfDCL := TAxcPDFLibrary.Create(frmMain);
...


I always get this error message:
  CheckSynchronize called from non-main thread

What is the correct, thread-safe way, to .Create, use and .Free, the QuickPDFLibrary in a non-main thread?

Thanks in advance.





Replies:
Posted By: Ingo
Date Posted: 04 Jul 21 at 10:50PM
Hi,

think this haven't to do with QuickPDF itself.
Try Google with CheckSynchronize...
Think you'll get the solution of your issue in the www ;-)



-------------
Cheers,
Ingo



Posted By: RedOctober2018
Date Posted: 04 Jul 21 at 11:22PM
Hi Ingo, Yes,  I researched this problem and found CoInitialize and CoUnitialize, but no matter where I call these in relation to the call to create a QuickPDFLibrary object, I get an error message.  I suspect there is a call to CheckSynchronize inside the QuickPDFLibrary which means it always needs to be in the main thread.  But it can't be, because I'm using QPDF Lib in the non-main thread.

CoInitialize must be called within the non-main thread.  UnCoInitialize must not be called in the non-main thread, it must be called in the main thread.

That's why I just asked the open ended question  "what is the correct way to do this" which usually elicits a broader and more complete answer than asking a more narrowly focused question.


Posted By: Ingo
Date Posted: 05 Jul 21 at 10:51PM
Hi,

i've made a complete scan through all source elements of version 18.11 ...
There isn't a single Synchronize... Nothing.
CoInitialize i've found - but i didn't found UnCoInitialize.
 



-------------
Cheers,
Ingo




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