Core Api OpenDocument Error  SOLVED

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

Moderators: Tracker Support, TrackerSupp-Daniel, Chris - Tracker Supp, Vasyl-Tracker Dev Team, 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: 122
Joined: Fri Jun 25, 2010 6:54 am

Core Api OpenDocument Error

Post by edvschu » Thu Oct 08, 2015 8:37 am

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

User avatar
Sasha - Tracker Dev Team
User
Posts: 4075
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Core Api OpenDocument Error

Post by Sasha - Tracker Dev Team » Thu Oct 08, 2015 9:08 am

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?
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

edvschu
User
Posts: 122
Joined: Fri Jun 25, 2010 6:54 am

Re: Core Api OpenDocument Error

Post by edvschu » Thu Oct 08, 2015 9:58 am

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.

User avatar
Sasha - Tracker Dev Team
User
Posts: 4075
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Core Api OpenDocument Error

Post by Sasha - Tracker Dev Team » Thu Oct 08, 2015 11:08 am

IPXC_Inst::Init() should be called once per program's workflow. Launching it from several threads is prohibited.
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

edvschu
User
Posts: 122
Joined: Fri Jun 25, 2010 6:54 am

Re: Core Api OpenDocument Error

Post by edvschu » Thu Oct 08, 2015 11:19 am

OK, I understand. So i must change this. Thanks a lot, Sasha :wink: .

User avatar
Sasha - Tracker Dev Team
User
Posts: 4075
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Core Api OpenDocument Error

Post by Sasha - Tracker Dev Team » Thu Oct 08, 2015 11:21 am

For starters, try improving your code like that and then we'll continue to look into your problem further.
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

edvschu
User
Posts: 122
Joined: Fri Jun 25, 2010 6:54 am

Re: Core Api OpenDocument Error

Post by edvschu » Thu Oct 08, 2015 2:52 pm

Now IPXC_Inst::Init() is be called on start, but get error -2147467262. Wha'ts wrong?

Lzcat - Tracker Supp
Site Admin
Posts: 711
Joined: Thu Jun 28, 2007 8:42 am

Re: Core Api OpenDocument Error

Post by Lzcat - Tracker Supp » Fri Oct 09, 2015 5:21 am

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: 122
Joined: Fri Jun 25, 2010 6:54 am

Re: Core Api OpenDocument Error

Post by edvschu » Fri Oct 09, 2015 5:57 am

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?

Lzcat - Tracker Supp
Site Admin
Posts: 711
Joined: Thu Jun 28, 2007 8:42 am

Re: Core Api OpenDocument Error

Post by Lzcat - Tracker Supp » Fri Oct 09, 2015 6:40 am

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@tracker-software.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: 122
Joined: Fri Jun 25, 2010 6:54 am

Re: Core Api OpenDocument Error

Post by edvschu » Fri Oct 09, 2015 11:42 am

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.

Lzcat - Tracker Supp
Site Admin
Posts: 711
Joined: Thu Jun 28, 2007 8:42 am

Re: Core Api OpenDocument Error

Post by Lzcat - Tracker Supp » Fri Oct 09, 2015 12:29 pm

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: 122
Joined: Fri Jun 25, 2010 6:54 am

Re: Core Api OpenDocument Error

Post by edvschu » Mon Oct 12, 2015 10:26 am

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: 13312
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Core Api OpenDocument Error

Post by Tracker Supp-Stefan » Mon Oct 12, 2015 11:00 am

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: 122
Joined: Fri Jun 25, 2010 6:54 am

Re: Core Api OpenDocument Error

Post by edvschu » Mon Oct 12, 2015 11:15 am

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: 13312
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Core Api OpenDocument Error  SOLVED

Post by Tracker Supp-Stefan » Mon Oct 12, 2015 11:51 am

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