Forum rules DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Are you calling https://sdkhelp.pdf-xchange.com/view/PXV:IPXV_Inst_Shutdown ?
Note (from SDK help page):
"It is also essential when all tasks are completed and use of the SDK is no longer required that you call IPXV_Inst::Shutdown to release all used resource and correctly close all working threads, etc. "
private void RunPDFX(....)
{
Inst = new PDFXEdit.PXV_Inst();
Inst.Init(...)
// ... work with PDFX-API
Inst.Shutdown();
/////////////////////////////////////////////////////////////////////////////////////
// Forced release of all COM-objects that may still be captured by Garbage Collector.
// It is critical to release them before destroying Inst!
/////////////////////////////////////////////////////////////////////////////////////
GC.Collect();
GC.WaitForPendingFinalizers();
Inst = nullptr;
};
//////////////////////////////////////////////////////////////////////
for (...)
{
RunPDFX(....);
}
This code shoud work as well. But for sure - it's not effective to use Init/Shutdown too often. Ideally - just once per app lifetime.
Note: the PXV_Inst-object - is the true singleton. So if you try to create 2 different PXV_Inst-object at the same time - then technically you will get just two references to the same object instantiated at the first 'new' operator.
If you are using the "op.document.optimize" in a different thread - you will pass it an ipxc_document (for "Input") opened in that thread (IPXC_Inst::OpenDocumentFromFile) and all will run as expected.