Page 1 of 1

Hide button in standard DocInfoBar / Get notified when doc info bar is displayed

Posted: Fri Mar 20, 2020 10:22 am
by zarkogajic
Hi Support,

When opening documents in read-only mode (for the pure viewing functionality, forced by PermF_All), if a document is a PDF/A, the DocInfoBar will display:

image.png

I need to hide/remove the "Enable Editing" button.

I should be able to do so via IPXV_DocInfoBar::RemoveButton, but I do not know the nSpanID parameter for the call.

So, what are the spanID values for default info bar panes ?

Finally, how do I get notified when an info bar is to be displayed - so to remove the button at that moment (if needed)?

p.s.
Btw, I think this button should be hidden/removed by default if PermF_All is used when opening a document.


-žarko

Re: Hide button in standard DocInfoBar / Get notified when doc info bar is displayed

Posted: Fri Mar 20, 2020 10:44 am
by zarkogajic
Hi support,

Seems like the IDs of spans can be get from this list

docInfoBarSpan.ProFeaturesUsed
docInfoBarSpan.ViewSignVer
docInfoBarSpan.PDFA
docInfoBarSpan.DigiSig
docInfoBarSpan.Form
docInfoBarSpan.ApplyRedact
docInfoBarSpan.ApplySign
docInfoBarSpan.BrokenFlags
docInfoBarSpan.FlashAvail
docInfoBarSpan.UR3

I think the list is not complete - as the are more default bars, so please update the list here...

I've tried:

Code: Select all

  
  Document : IPXV_Document;
  id : integer;
...  
  id := Inst.Str2ID('docInfoBarSpan.PDFA', false);
  Document.InfoBar.RemoveAllButtons(id);
But the button is still displayed.

UPDATE: I've been calling the above code to early (tried in e.document.viewingStarted and e.pagesView.ready) - so when is it "late enough" to call this?

Update 2: Seems like e.document.activated is the correct moment, please confirm?

How do I get the button id on a particular span?

If possible: how to get notified when an info bar is to be displayed - as probably this is when I need to remove the button?


Re: Hide button in standard DocInfoBar / Get notified when doc info bar is displayed

Posted: Thu Mar 26, 2020 10:02 am
by Sasha - Tracker Dev Team
Hello zarkogajic,

The e_documentView_ready event is an OK part. The Update of the InfoBar that shows or hides it comes before it.
And here's how you can hide that command button:

Code: Select all

if (e.nEventID == nIDS[(int)IDS.e_documentView_ready])
{
	uiInst.CmdManager.Cmds.Find("cmd.document.discardPDFA").Hidden = true;
}
Cheers,
Alex

Re: Hide button in standard DocInfoBar / Get notified when doc info bar is displayed

Posted: Thu Mar 26, 2020 10:52 am
by zarkogajic
Hi Alex,

That will make the command hidden globally (everywhere) - that's not what I can use.

I need to remove that button for a particular document.

I should be using the RemoveButton method of the InfoBar - but I do not know the ID of it.

Also, in the e_documentView_ready the HasSpan (for 'docInfoBarSpan.PDFA') will return false for a PDFA document - so I guess the InfoBar gets displayed at a later stage?

Also, what is the ID of the "Save As" button that appears on the docInfoBarSpan.BrokenFlags bar ?

p.s.
Or, those are added as commands to the InfoBar and I need to custom handle them - but how to hide a command item (if one exists here) in the OnGetItemState when there's no "hidden" state ...



Re: Hide button in standard DocInfoBar / Get notified when doc info bar is displayed

Posted: Thu Mar 26, 2020 12:18 pm
by zarkogajic
Support,

Ok, I've done a few more tests and here's my final take on this ( until some answer from you with a possible better approach :) )

For a PDFA document ('docInfoBarSpan.PDFA' span):

The Document.InfoBar.HasSpan returns true in e.document.activated.

I've also tried in e.document.viewingStarted, e.documentView.ready and e.pagesView.ready - in all those the HasSpan returns false.

I'm then using the ActiveView of a document to find a command bar named "cmdbar.docInfo" in the CmdPaneTop of ActiveView.

Once found, I'm using FindFirstItemByCmdID to find the command item (in this case "cmd.document.discardPDFA").

Then I can do Show (false) - to hide it. This does it.

BUT, I do not like where this all happens - as e.document.activated will be called everytime I have multiple documents open and activate each document's tab.

So, the final question: when to catch the first appearance of the InfoBar?

-žarko

Re: Hide button in standard DocInfoBar / Get notified when doc info bar is displayed

Posted: Thu Mar 26, 2020 12:44 pm
by Sasha - Tracker Dev Team
Hello zarkogajic,

Here's an OK place for your case (the Button exists there already) and the code piece to do that:

Code: Select all

if (e.nEventID == nIDS[(int)IDS.e_document_activated])
{
	IPXV_Document pv = (PDFXEdit.IPXV_Document)e.pFrom;
	int nSpanID = pdfCtl.Inst.Str2ID("docInfoBarSpan.PDFA", false);
	int nButtonID = pdfCtl.Inst.Str2ID("cmd.document.discardPDFA", false);
	pv.InfoBar.RemoveButton(nSpanID, nButtonID);
}
Cheers,
Alex

Re: Hide button in standard DocInfoBar / Get notified when doc info bar is displayed

Posted: Thu Mar 26, 2020 1:22 pm
by zarkogajic
Hi Alex,

Thanks.

Note my previous post.

Is "e.document.activated" really the correct (read "best") place (due to it being fired every-time the document gets active)?


Re: Hide button in standard DocInfoBar / Get notified when doc info bar is displayed

Posted: Thu Mar 26, 2020 2:08 pm
by Sasha - Tracker Dev Team
Hello zarkogajic,

Well I think so - the thing is that the event that I proposed earlier does happen when the button was already added. Basically the event e.document.activated happens when everything is ready for modification. Even if you call this method again for the removed button - nothing will happen.

Cheers,
Alex

Re: Hide button in standard DocInfoBar / Get notified when doc info bar is displayed

Posted: Thu Mar 26, 2020 2:26 pm
by zarkogajic
Hi Alex,

ok. Case closed.


Re: Hide button in standard DocInfoBar / Get notified when doc info bar is displayed

Posted: Fri Mar 27, 2020 8:00 am
by Sasha - Tracker Dev Team
:)

Re: Hide button in standard DocInfoBar / Get notified when doc info bar is displayed

Posted: Wed Apr 08, 2020 12:13 pm
by zarkogajic
Hi support,

I forgot about this one: can you please update this list:

docInfoBarSpan.ProFeaturesUsed
docInfoBarSpan.ViewSignVer
docInfoBarSpan.PDFA
docInfoBarSpan.DigiSig
docInfoBarSpan.Form
docInfoBarSpan.ApplyRedact
docInfoBarSpan.ApplySign
docInfoBarSpan.BrokenFlags
docInfoBarSpan.FlashAvail
docInfoBarSpan.UR3

and also please let me know which of the available spans include something like "save as" (or alike) option. Even better: please specify by-default added commands (or button) IDs for each.

Example: I was just hit with "...extended features in Adobe Reader..." - and it is not in the list - and I need to hide the "save as" button on it.

p.s.
If in the future new default spans are added - where can I get the IDs?


Re: Hide button in standard DocInfoBar / Get notified when doc info bar is displayed

Posted: Tue Apr 14, 2020 11:33 am
by Sasha - Tracker Dev Team
Hello zarkogajic,

You can run though all of the IDs and search for the docInfoBarSpan string in the ID string - that's the fastest way.
Then by having all of the SpanID, you can call the RemoveAllButtons(spanID) method - that will clear all of the possible buttons.

Cheers,
Alex

Re: Hide button in standard DocInfoBar / Get notified when doc info bar is displayed

Posted: Tue Apr 14, 2020 11:44 am
by zarkogajic
Hi Alex,

Thanks, but that is not what I need / what I asked.

I do not want to remove all buttons.


Re: Hide button in standard DocInfoBar / Get notified when doc info bar is displayed

Posted: Fri Apr 17, 2020 11:06 am
by Sasha - Tracker Dev Team
Hello zarkogajic,

The id_docInfoBarSpan_ViewSignVer, id_docInfoBarSpan_BrokenFlags, id_docInfoBarSpan_UR3 has a save as command.
And the id_docInfoBarSpan_FlashAvail has the "Install Flash" command.


Cheers,
Alex

Re: Hide button in standard DocInfoBar / Get notified when doc info bar is displayed

Posted: Fri Apr 17, 2020 12:23 pm
by zarkogajic
Thanks Alex.

Still, can you please update this list:

I forgot about this one: can you please update this list:

docInfoBarSpan.ProFeaturesUsed
docInfoBarSpan.ViewSignVer
docInfoBarSpan.PDFA
docInfoBarSpan.DigiSig
docInfoBarSpan.Form
docInfoBarSpan.ApplyRedact
docInfoBarSpan.ApplySign
docInfoBarSpan.BrokenFlags
docInfoBarSpan.FlashAvail
docInfoBarSpan.UR3

as at least "...extended features in Adobe Reader..." is missing...


Re: Hide button in standard DocInfoBar / Get notified when doc info bar is displayed

Posted: Fri Apr 17, 2020 12:39 pm
by Sasha - Tracker Dev Team
Hello zarkogajic,

I think I've mentioned all of them that have such buttons.

Cheers,
Alex

Re: Hide button in standard DocInfoBar / Get notified when doc info bar is displayed

Posted: Fri Apr 17, 2020 12:54 pm
by zarkogajic
Alex,

Yes, thanks for that part.

The remaining question is: what are the string IDs of the rest of standard docinfobars? There are more than in "my" list.

I've specifically asked about the one displaying "...extended features in Adobe Reader...", this one

image.png
There are 12 possible bars in (335 version) and "my" list only has 10.



Re: Hide button in standard DocInfoBar / Get notified when doc info bar is displayed

Posted: Mon Apr 27, 2020 6:59 am
by Sasha - Tracker Dev Team
Sasha - Tracker Dev Team wrote: Tue Apr 14, 2020 11:33 am You can run though all of the IDs and search for the docInfoBarSpan string in the ID string - that's the fastest way.
Then by having all of the SpanID, you can call the RemoveAllButtons(spanID) method - that will clear all of the possible buttons.
Have you done this part?

Cheers,
Alex

Re: Hide button in standard DocInfoBar / Get notified when doc info bar is displayed

Posted: Mon Apr 27, 2020 7:52 am
by zarkogajic
Hi Alex,

I do not know how to run through all the IDs.

Should I iterate Inst.ID2Str from 0 to what number?

Even if I do so and find all the InfoBar ID's - still the question is what standard commands are on a particular info bar.

As, again, I do not want to remove all buttons from an info bar.


Re: Hide button in standard DocInfoBar / Get notified when doc info bar is displayed  SOLVED

Posted: Tue May 05, 2020 11:51 am
by Sasha - Tracker Dev Team
Hello zarkogajic,

docInfoBarSpan.UR3 - that's the one that holds that Acrobat Reader Protection.
As for the IDs - any large number will suffice - for example 100000.

Cheers,
Alex

Re: Hide button in standard DocInfoBar / Get notified when doc info bar is displayed

Posted: Tue May 05, 2020 3:19 pm
by zarkogajic
Hi Alex,

Thanks. that'll do it.



Hide button in standard DocInfoBar / Get notified when doc info bar is displayed

Posted: Tue May 05, 2020 3:21 pm
by Sasha - Tracker Dev Team
:)