LoadUserSettings/SaveUserSetting and History and "Invalid ZIP-format value"  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, 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
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

LoadUserSettings/SaveUserSetting and History and "Invalid ZIP-format value"

Post by zarkogajic »

Hi support,

At the moment of IPXV_Inst::Init call I do not have access to the file for pUserSettingsSrc or pHistorySrc, so I'm using LoadUserSettings at a later stage. LoadUserSettings accepts only one file (for settings, not for history?).

While the instance is alive, opening documents places them in the history, closing and reopening the controls' host form - and the history is there without me calling for "SaveUserSettings" - so history is automagically maintained during Inst's life. I'm calling SaveUserSettings at app shutdown.

The next time I run the application, the history is lost (other settings are here).

I've tried manually using SaveHistory and this does create the file.

However it seems the history is not picked by LoadUserSettings ?

So, I've tried executing "op.settings.import" right after LoadUserSettings (only "History" set to true) - but I get "AFSLib: Invalid ZIP-format value" on op.Do() call. What's this error about?

I know there's no LoadHistory (yet).

So, should LoadUserSettings load the history as well or not, or ?

How to load the history if I cannot use pHistorySrc in Init ?

-žarko
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: LoadUserSettings/SaveUserSetting and History and "Invalid ZIP-format value"

Post by Sasha - Tracker Dev Team »

Hello žarko,

This topic should help:
viewtopic.php?f=66&t=33499#p138508

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: LoadUserSettings/SaveUserSetting and History and "Invalid ZIP-format value"

Post by zarkogajic »

Hi Alex,

That is the topic I have followed.

Note:
So, I've tried executing "op.settings.import" right after LoadUserSettings (only "History" set to true) - but I get "AFSLib: Invalid ZIP-format value" on op.Do() call. What's this error about?

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

Re: LoadUserSettings/SaveUserSetting and History and "Invalid ZIP-format value"

Post by Sasha - Tracker Dev Team »

Hello žarko,

Can you please create a small project that we can debug and find out why is this happening.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2353
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: LoadUserSettings/SaveUserSetting and History and "Invalid ZIP-format value"

Post by Vasyl-Tracker Dev Team »

Hi žarko.

In the upcoming new 335 build you will be able to use new function:

Code: Select all

IPXV_Inst::LoadHistory(IUnknown* pHistorySrc, LONG nFlags = 0);

pHistorySrc - it can be pointer to IString(full path to the file or to the registry key), or pointer to the IAFS_Name|IAFS_File|IStream
nFlags - is zero by default, but you can specify the PXV_LoadHistory_Merge flag to merge existing history and new one.
Cheers.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: LoadUserSettings/SaveUserSetting and History and "Invalid ZIP-format value"

Post by zarkogajic »

Hi Vasyl,

Thanks, sounds great.

Do I still have to provide a sample app for this issue "Invalid ZIP-format value"? I guess you would prefer C#?

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

Re: LoadUserSettings/SaveUserSetting and History and "Invalid ZIP-format value"

Post by Sasha - Tracker Dev Team »

Hello žarko,

Yes, we will need a C# project for investigation - it's not urgent though.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: LoadUserSettings/SaveUserSetting and History and "Invalid ZIP-format value"

Post by zarkogajic »

Hi Alex,

Ok, will try to prepare it in the coming days ....


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

Re: LoadUserSettings/SaveUserSetting and History and "Invalid ZIP-format value"

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: LoadUserSettings/SaveUserSetting and History and "Invalid ZIP-format value"

Post by zarkogajic »

Hi Alex,

In the FullDemo, MainFrm constructor, you do "CustomInitSDK" if fLoadPrefs or fLoadHist are set ...

Make sure those are, and have the next code for and after the call to Init :

Code: Select all

    //Inst.Init(null, licKey, prefsPathStr, histFileStr, histThumbsFileStr);
  
    // so we do "plain" init ..
    Inst.Init(null, licKey, null, null, null);
   
   //then we load user settings 
    Inst.LoadUserSettings(prefsPathStr);

    //then we try to load/import the history only
    PDFXEdit.IOperation op = Inst.CreateOp(Inst.Str2ID("op.settings.import"));
    PDFXEdit.ICabNode opts = op.Params.Root["Options"];
    op.Params.Root["Input"].v = histFileStr;
    opts["History"].v = true;
    opts["Settings"].v = false;
    opts["Presets"].v = false;
    opts["TrustedList"].v = false;
    opts["Prompts"].v = false;
    opts["UILang"].v = false;

    try
    {
        op.Do();
    }
    catch (Exception ex)
    {
        PDFXEdit.IAUX_Inst aux = (PDFXEdit.IAUX_Inst)Inst.GetExtension("AUX");
        var error = aux.FormatHRESULT(System.Runtime.InteropServices.Marshal.GetHRForException(ex), 0);
        throw new Exception(error);
        //AV here ...
    }
So, the Init method is called without specifying pUserSettingsSrc, pHistorySrc and pHistoryThumbsSrc.
Then I use LoadUserSettings to load settings from (the same) prefsPathStr and then "op.settings.import" to import only the history from histFileStr.

Op.Do() would raise the mentioned exception "Invalid ZIP-format value".

HTH.

-žarko
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: LoadUserSettings/SaveUserSetting and History and "Invalid ZIP-format value"

Post by Sasha - Tracker Dev Team »

Hello žarko,

Thanks, I will take a look when I have time.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2353
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: LoadUserSettings/SaveUserSetting and History and "Invalid ZIP-format value"  SOLVED

Post by Vasyl-Tracker Dev Team »

Hi -žarko.

Code: Select all

op.Params.Root["Input"].v = histFileStr;
This will not work definitely because here you need to specify the file that you may get only by using the "op.settings.export" operation.

Cheers.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: LoadUserSettings/SaveUserSetting and History and "Invalid ZIP-format value"

Post by zarkogajic »

Thanks Vasyl,

Case closed :)

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

Re: LoadUserSettings/SaveUserSetting and History and "Invalid ZIP-format value"

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply