Bookmark tree's contracted (expand/collapse or open/close) state

Forum for the PDF-XChange Editor - Free and Licensed Versions

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

Post Reply
User avatar
rakunavi
User
Posts: 870
Joined: Sat Sep 11, 2021 5:04 am

Bookmark tree's contracted (expand/collapse or open/close) state

Post by rakunavi »

Hello all,

Please imagine bookmarks in a tree structure organized at the part, chapter, section, and subsection levels. If there are a large number of bookmark items, you can improve the overall view by collapsing items below a certain level.

For now, the bookmark tree's contracted (expand/collapse or open/close) state is saved exactly as it is when the file is saved. Even if a bookmark is only temporarily expanded for browsing purposes, if a comment is added and then saved, the bookmark tree is saved exactly as it was at that time.

For example, if both of the following bookmark pane options are enabled, bookmarks will be automatically expanded after a page is moved, even if the bookmark pane is not operated at all. This is completely intentional up to this point, since that is what these settings are for.

  • Ensure Visibility of Corresponding Bookmark
  • Automatically Expand Bookmarks
However, if you add a comment and save here, the bookmarks are saved in a partially expanded state. This is not intentional for me. I have attached a captured video for your reference. The corresponding time code is also listed at the beginning of each verification procedure. ([MM:SS] "MM" stands for minutes and "SS" for seconds).

  • [00:00]-[00:09] Open the sample file with bookmarks for each part, chapter, section, and subsection and go to page 24.
  • [00:09]-[00:19] Save the file after adding comments.
  • [00:19]-[00:24] Reopen the file after closing the application.
  • [00:24]-[00:31] Activate the above two options in the bookmarks pane.
  • [00:31]-[00:36] When you navigate to page 24, the bookmarks in the subsection corresponding to the page you passed will automatically expand.
  • [00:36]-[00:46] Save after adding a comment.
  • [00:46]-[00:53] When you close the application and reopen it, you will see that the bookmark is partially expanded.
In the above verification, we focused on two options to make the issue easier to understand, but these options themselves are not the issue, of course. The essence of the issue is that the the bookmark tree's contracted state is preserved when the file is saved. It would be nice to have two modes, an "edit mode" where bookmark tree's contracted state is saved and a "view mode" where it is not saved, and to be able to switch between the two.

This kind of usage does not seem to be possible with PDF-XChange Editor or Acrobat at the moment, but if anyone knows of any settings, I would appreciate it if you could let us know. If it does not exist, I hope you will consider this feature.

Thank you for taking the time to read this message.

Best regards,
rakunavi

- PDF-XChange Editor Plus Version:9.3 build 361.0
- OS Version: Windows 10 Home/Pro 21H2 Build 19044.1826
- PC Model: Lenovo IdeaPad C340-15IWL / HP ProDesk 600G1
TOP desires for PDFXCE
forum.pdf-xchange.com/viewtopic.php?t=39665 LassoTool
forum.pdf-xchange.com/viewtopic.php?t=38554 CmtGarbled
forum.pdf-xchange.com/viewtopic.php?t=37353 FulScrMultiMon
forum.pdf-xchange.com/viewtopic.php?t=41002 DisableTouchSelect
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8436
Joined: Wed Jan 03, 2018 6:52 pm

Re: Bookmark tree's contracted (expand/collapse or open/close) state

Post by TrackerSupp-Daniel »

Hello, rakunavi

At the moment, what you are seeing is intended and there are no current plans to change it. We tend to shy away from having separate toggleable modes that work independently of other editing features (due to the confusion that can be caused by them if someone forgets they are enabled), but we will review your suggestions and see if there is anything that we can do.
If you saw how often we get very angry email bug reports because someone has accidentally enabled the "accessibility color override" (Ctrl+Shift+6 [an odd combination to hit accidentally, I know]), you would understand why we want to avoid adding more features like this.

I expect that this request will be rejected however, in which case the solution you will need to use is manually closing the tree's which you do not wish to be saved as open. "Collapse all" is an excellent tool for this task.

Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
User avatar
rakunavi
User
Posts: 870
Joined: Sat Sep 11, 2021 5:04 am

Re: Bookmark tree's contracted (expand/collapse or open/close) state

Post by rakunavi »

Hi Daniel, Thank you for taking the time to reply.

I see what you mean. It is easy to imagine how difficult it would be to balance functionality and user interface.

For now, I will use the following JavaScript code to organize the bookmark's contracted state. A video is attached for your reference. This variety of uses is one of the attractions of the PDF-XChange Editor.

Code: Select all

var TargetLevel = 1;

function CollapseLevel(bkm, nLevel) {
	if (bkm.children != null)
		for (var i = 0; i < bkm.children.length; i++) {
			if (nLevel == TargetLevel)
				bkm.children[i].open = false;
			else
				bkm.children[i].open = true;
			CollapseLevel(bkm.children[i], nLevel + 1);
		}
}
CollapseLevel(this.bookmarkRoot, 0);
Thank you so much for your continued support.

Best regards,
rakunavi
Last edited by rakunavi on Sat Jul 23, 2022 4:05 am, edited 1 time in total.
TOP desires for PDFXCE
forum.pdf-xchange.com/viewtopic.php?t=39665 LassoTool
forum.pdf-xchange.com/viewtopic.php?t=38554 CmtGarbled
forum.pdf-xchange.com/viewtopic.php?t=37353 FulScrMultiMon
forum.pdf-xchange.com/viewtopic.php?t=41002 DisableTouchSelect
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8436
Joined: Wed Jan 03, 2018 6:52 pm

Bookmark tree's contracted (expand/collapse or open/close) state

Post by TrackerSupp-Daniel »

:)
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
User avatar
rakunavi
User
Posts: 870
Joined: Sat Sep 11, 2021 5:04 am

Re: Bookmark tree's contracted (expand/collapse or open/close) state

Post by rakunavi »

Hello all,

I leave a comment for those who will find this topic in a future archive search.

When using the JavaScript code above, it is recommended to add it to "Before Document Saving" in the "Actions" category of the "Document properties". If you are interested in JavaScript, you probably know this setting, but I comment it for your reference.

screenshot.png

Incidentally, in the online manual of the HTML version of PDF-XChange Editor, all bookmarks above the first level are closed. If you want the exact same condition in the PDF version, simply change the conditional part of the if clause on line 6 to "nLevel >= TargetLevel".

TrackerSupp-Daniel wrote: Fri Jul 22, 2022 3:28 pm "Collapse all" is an excellent tool for this task.
Unfortunately, the "Collapse All" command does not achieve the same goal as the above script.

I hope that the above information will be helpful to someone someday.

Best regards,
rakunavi
TOP desires for PDFXCE
forum.pdf-xchange.com/viewtopic.php?t=39665 LassoTool
forum.pdf-xchange.com/viewtopic.php?t=38554 CmtGarbled
forum.pdf-xchange.com/viewtopic.php?t=37353 FulScrMultiMon
forum.pdf-xchange.com/viewtopic.php?t=41002 DisableTouchSelect
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8436
Joined: Wed Jan 03, 2018 6:52 pm

Bookmark tree's contracted (expand/collapse or open/close) state

Post by TrackerSupp-Daniel »

:)
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
User avatar
rakunavi
User
Posts: 870
Joined: Sat Sep 11, 2021 5:04 am

Re: Bookmark tree's contracted (expand/collapse or open/close) state

Post by rakunavi »

Hello all,

The above script also sets bookmark items without children to closed, which is the same behavior as "Collapse All" in build 366. For more information, see the following topics.

  • When Collapse All is executed in Bookmarks pane, bookmarks with no children are unintentionally set to closed
    https://forum.pdf-xchange.com/viewtopic.php?t=39806
The following is a modified script that sets only bookmark items with children to closed and bookmark items without children to open.

Code: Select all

var TargetLevel = 1;

function CollapseLevel(bkm, nLevel) {
	if (bkm.children != null)
		for (var i = 0; i < bkm.children.length; i++) {
			if (bkm.children[i].children == null)
				bkm.children[i].open = true;
			else {
				if (nLevel == TargetLevel)
					bkm.children[i].open = false;
				else
					bkm.children[i].open = true;
				CollapseLevel(bkm.children[i], nLevel + 1);
			}
		}
}
CollapseLevel(this.bookmarkRoot, 0);
Best regards,
rakunavi
TOP desires for PDFXCE
forum.pdf-xchange.com/viewtopic.php?t=39665 LassoTool
forum.pdf-xchange.com/viewtopic.php?t=38554 CmtGarbled
forum.pdf-xchange.com/viewtopic.php?t=37353 FulScrMultiMon
forum.pdf-xchange.com/viewtopic.php?t=41002 DisableTouchSelect
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6829
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: Bookmark tree's contracted (expand/collapse or open/close) state

Post by Paul - Tracker Supp »

Love it! :D
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Post Reply