Core Api OpenDocument Error  SOLVED

A forum for questions or concerns related to the PDF-XChange Core API SDK

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

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.
Post Reply
edvschu
User
Posts: 127
Joined: Fri Jun 25, 2010 6:54 am

Core Api OpenDocument Error

Post 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
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Core Api OpenDocument Error

Post 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?
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
edvschu
User
Posts: 127
Joined: Fri Jun 25, 2010 6:54 am

Re: Core Api OpenDocument Error

Post 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.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Core Api OpenDocument Error

Post by Sasha - Tracker Dev Team »

IPXC_Inst::Init() should be called once per program's workflow. Launching it from several threads is prohibited.
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
edvschu
User
Posts: 127
Joined: Fri Jun 25, 2010 6:54 am

Re: Core Api OpenDocument Error

Post by edvschu »

OK, I understand. So i must change this. Thanks a lot, Sasha :wink: .
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Core Api OpenDocument Error

Post by Sasha - Tracker Dev Team »

For starters, try improving your code like that and then we'll continue to look into your problem further.
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
edvschu
User
Posts: 127
Joined: Fri Jun 25, 2010 6:54 am

Re: Core Api OpenDocument Error

Post by edvschu »

Now IPXC_Inst::Init() is be called on start, but get error -2147467262. Wha'ts wrong?
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: Core Api OpenDocument Error

Post by Lzcat - Tracker Supp »

Can you provide complete sample to reproduce problem?
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
edvschu
User
Posts: 127
Joined: Fri Jun 25, 2010 6:54 am

Re: Core Api OpenDocument Error

Post 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?
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: Core Api OpenDocument Error

Post 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
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
edvschu
User
Posts: 127
Joined: Fri Jun 25, 2010 6:54 am

Re: Core Api OpenDocument Error

Post 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.
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: Core Api OpenDocument Error

Post 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.
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
edvschu
User
Posts: 127
Joined: Fri Jun 25, 2010 6:54 am

Re: Core Api OpenDocument Error

Post 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.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17820
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Core Api OpenDocument Error

Post 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
edvschu
User
Posts: 127
Joined: Fri Jun 25, 2010 6:54 am

Re: Core Api OpenDocument Error

Post 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
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17820
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Core Api OpenDocument Error  SOLVED

Post 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
Post Reply