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

PDF-XChange Editor SDK for Developers

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

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: 648
Joined: Thu Sep 05, 2019 12:35 pm

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

Post by zarkogajic » Mon Dec 02, 2019 3:56 pm

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

User avatar
Sasha - Tracker Dev Team
User
Posts: 4885
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 » Tue Dec 03, 2019 8:50 am

Hello žarko,

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

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

zarkogajic
User
Posts: 648
Joined: Thu Sep 05, 2019 12:35 pm

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

Post by zarkogajic » Tue Dec 03, 2019 9:07 am

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?


User avatar
Sasha - Tracker Dev Team
User
Posts: 4885
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 » Fri Dec 06, 2019 4:07 pm

Hello žarko,

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

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 1983
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 » Thu Dec 12, 2019 7:32 pm

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: 648
Joined: Thu Sep 05, 2019 12:35 pm

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

Post by zarkogajic » Fri Dec 13, 2019 9:01 am

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#?


User avatar
Sasha - Tracker Dev Team
User
Posts: 4885
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 » Fri Dec 13, 2019 9:08 am

Hello žarko,

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

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

zarkogajic
User
Posts: 648
Joined: Thu Sep 05, 2019 12:35 pm

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

Post by zarkogajic » Fri Dec 13, 2019 9:11 am

Hi Alex,

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



User avatar
Sasha - Tracker Dev Team
User
Posts: 4885
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 » Fri Dec 13, 2019 9:57 am

:)
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

zarkogajic
User
Posts: 648
Joined: Thu Sep 05, 2019 12:35 pm

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

Post by zarkogajic » Fri Dec 13, 2019 2:44 pm

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

User avatar
Sasha - Tracker Dev Team
User
Posts: 4885
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 » Wed Dec 18, 2019 3:20 pm

Hello žarko,

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

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 1983
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 » Wed Dec 18, 2019 10:10 pm

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: 648
Joined: Thu Sep 05, 2019 12:35 pm

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

Post by zarkogajic » Thu Dec 19, 2019 9:41 am

Thanks Vasyl,

Case closed :)


User avatar
Sasha - Tracker Dev Team
User
Posts: 4885
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 » Thu Dec 19, 2019 10:03 am

:)
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Post Reply