Page 1 of 1

Core Api OpenDocument Error

Posted: Thu Oct 08, 2015 8:37 am
by edvschu
Hello,

open 2nd Time a pdf i get error -2147024809. After each open i close document and finalized Core Api by calling the IPXC_Inst::Finalize method.

Code: Select all

Private Function OpenDocumentFromFile(sFilePath As String, pInst As LIBNAME.IPXC_Inst) As LIBNAME.IPXC_Document
    Dim pDoc As LIBNAME.IPXC_Document = Nothing
    Try
        pDoc = pInst.OpenDocumentFromFile(sFilePath, Nothing, Nothing, 0, 0)
    Catch ex As Exception
        Dim hr As Integer = Marshal.GetHRForException(ex)
        ShowErrMsg(hr)
        Return Nothing
    End Try

    Return pDoc
End Function
What's going wrong?

Regards,
edvschu

Re: Core Api OpenDocument Error

Posted: Thu Oct 08, 2015 9:08 am
by Sasha - Tracker Dev Team
Hi, edvschu.

You mean you do something like this?

Code: Select all

IPXC_Inst::Init();
IPXC_Document pDoc;
pDoc = OpenDocumentFromFile();
pDoc->Close();
pDoc = null;
IPXC_Inst::Finalize();

IPXC_Inst::Init();
pDoc = OpenDocumentFromFile();
pDoc->Close();
pDoc = null;
IPXC_Inst::Finalize();
With the same document and file path?

Re: Core Api OpenDocument Error

Posted: Thu Oct 08, 2015 9:58 am
by edvschu
Hi Sasha,

i tested now with two different PDFs. Same error. What i do with the pdf, is implemented in a class. For each Task i create a new instance of this.

Re: Core Api OpenDocument Error

Posted: Thu Oct 08, 2015 11:08 am
by Sasha - Tracker Dev Team
IPXC_Inst::Init() should be called once per program's workflow. Launching it from several threads is prohibited.

Re: Core Api OpenDocument Error

Posted: Thu Oct 08, 2015 11:19 am
by edvschu
OK, I understand. So i must change this. Thanks a lot, Sasha :wink: .

Re: Core Api OpenDocument Error

Posted: Thu Oct 08, 2015 11:21 am
by Sasha - Tracker Dev Team
For starters, try improving your code like that and then we'll continue to look into your problem further.

Re: Core Api OpenDocument Error

Posted: Thu Oct 08, 2015 2:52 pm
by edvschu
Now IPXC_Inst::Init() is be called on start, but get error -2147467262. Wha'ts wrong?

Re: Core Api OpenDocument Error

Posted: Fri Oct 09, 2015 5:21 am
by Lzcat - Tracker Supp
Can you provide complete sample to reproduce problem?

Re: Core Api OpenDocument Error

Posted: Fri Oct 09, 2015 5:57 am
by edvschu
Before I present an example available, I will describe the program sequence. A console application is started. The console application is waiting to process a PDF. With the launch IPXC_Inst::Init() is called, before exiting the console application IPXC_Inst::Finalize() runs.

The console application receives a message, processes the PDF and waits for the next request to process a PDF.
The PDF processing is implemented as a class from which an object is created. With this object, the PDF is processed.

Can I do it that way or do I need to outsource the processing of PDF in seperate program?

Re: Core Api OpenDocument Error

Posted: Fri Oct 09, 2015 6:40 am
by Lzcat - Tracker Supp
Is your console apllication a service?
Anyway we will need a complete sample to reproduce a problem. If you don't want to post it here you may send it to lazycat@tracker-software.com or support@pdf-xchange.com

Re: Core Api OpenDocument Error

Posted: Fri Oct 09, 2015 11:42 am
by edvschu
It's not a service, but it runs all time. Sample is difficult because console application works with iSeries data queues.
Meantime i have outsource PDF processing in a separate program and there are no problems.

Re: Core Api OpenDocument Error

Posted: Fri Oct 09, 2015 12:29 pm
by Lzcat - Tracker Supp
I'm affraid that we will need a way to reproduce problem to be able to help, so sample or remote debug session is required.

Re: Core Api OpenDocument Error

Posted: Mon Oct 12, 2015 10:26 am
by edvschu
I was able to narrow the problem further. Before the PDF is processed with the Core API, that PDF is converted to PDF/A3 with the Driver API. I drop off the conversion, there are no problems.

Re: Core Api OpenDocument Error

Posted: Mon Oct 12, 2015 11:00 am
by Tracker Supp-Stefan
Hello edvschu,

Just spoke with Lzcat and he suspect that the problem could be several things - e.g. you are not waiting for the drivers API to finish it's work, but without seeing an actual example we can only guess.
In any case - we would not recommend you to do this - as even if the driver creates a PDF/A file - most Core API operations after that will break the compliance with the PDF/A format, and you will need to resave the file after modifying it with the Core API in the needed PDF sub-specification.

Regards,
Stefan

Re: Core Api OpenDocument Error

Posted: Mon Oct 12, 2015 11:15 am
by edvschu
Hello Stefan,


it's possible to create with Core Api a PDF/A3 or is only the way over Driver Api?

Regards,
edvschu

Re: Core Api OpenDocument Error  SOLVED

Posted: Mon Oct 12, 2015 11:51 am
by Tracker Supp-Stefan
Hello edvschu

For now - only Drivers API, later this will be possible using Editor SDK (maybe the CoreAPI as well, but Lzcat is not sure when).

Regards,
Stefan