[tool] Save and Revert Views  SOLVED

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

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

Mathew
User
Posts: 725
Joined: Thu Jun 19, 2014 7:30 pm

[tool] Save and Revert Views  SOLVED

Post by Mathew »

This tool allows one to save the current view before going to other views, then easily jump back to the saved view.
I'm often working with technical PDFs where I need to refer to other pages, then jump back to where I was. I usually use a vertical split to do this, but it requires me to keep track of which split is active every time I go to a link or bookmark. There's a built-in "navigate back/forward" feature, but it's not possible to manually set a point that you are navigating back to; or to determine/configure what the steps are that it's navigating to. For me, this means many clicks to get back to where I was, and if I was working in a split-view setup in which I was changing the view often in one side of the split, there may be a huge history to step back just to get the view I wanted.
Usage
The tool adds three buttons to the View menu, with keyboard shortcuts:
image.png
Save View
  • This adds the current view to the list of saved views
Back
  • This jumps back to the last saved view. It shows how many views are saved, and also deletes the view from the list.
Select…
  • This opens a dialog listing all the currently saved views.

    The dropdown allows you to select between any of the currently loaded documents.

    Selecting one of the saved views loads that view. (For older versions of PXCE (before build 393) there will also be a button [►] to load the currently selected view.):
    image(1).png
    Across the top, the buttons:
    [… ] dropdown menu with options:
    • image(2).png
      Select one of the dropdown items to change it.
      Avoid Duplicate Views checks if zoom, position, and page match another view before adding it
      Automatically Add Views adds a view if page number changes more than Page Threshold, or Zoom increases or decreases by a factor of more than Zoom Threshold
    [+] adds the current view to the list
    [▲] moves the currently selected view up the list
    [▼] moves the currently selected view down the list
    [‒] deletes the currently selected view.

Installation
Installation instructions here: viewtopic.php?p=196006#p196006
viewNavigator v1.1.zip

Translation
The tool is translatable with 1ang.js. Here are the translation strings:

Code: Select all

# Translation file (requires 1ang v1.0 or later)
# Domain for this translation file is "viewNavigator"
# Filename must be "translationData.viewNavigator.json" and saved in the JavaScripts folder

# It is not necessary for all strings to be included in every language,
#   but don't put an empty string "" for the translation, because that's what will be shown!
# This must be formatted as a JSON file except that:
#   lines starting with # and empty lines are stripped out before processing

# "Language" is three letter code as output from app.language
# "Original Text" is case sensitive!
#   Notice that the last item in a list does not allow a comma after it.
# Format:
#  "Language 1": {
#    "Original Text": "Translated Text in Language 1",
#    "Original Text 2": ["Translated Text 2 singular", "Translated Text 2 plural"]
#   },
#  "Language 2": {
#    "Original Text": "Translated Text in Language 2"
#   }

{
 "": {
     "Saved Views": "",
     "Select…": "",
     "List of Saved Views\n────────────────────────\nShows a list of the currently saved views so they can be selected, viewed, or deleted.": "",
     "Save View": "",
     "Save Current View\n────────────────────────\nSaves the current document view to a list so it can be restored later.": "",
     "Back %1": "",
     "Go Back to Saved View\n────────────────────────\nRestores the last saved view for this document.": "",
     "Settings": "",
     "Automatically adding views cannot be started while documents are open.\nIt will be enabled after the application is restarted.": "",
     "Enter 0 or leave blank to not use this trigger": "",
     "Untitled%1": "",
     "%1 saved views ◦ %2 selected": "",
     "p.%1": "",
     "%1 @ %2%": "",
     "Avoid Duplicate Views": "",
     "Automatically Add Views": "",
     "Page Threshold: %1": "",
     "Zoom Threshold: %1": "",
     "Number of pages to trigger a view save:": "",
     "Change in zoom to trigger a view save:": ""
 }
}
The idea for the tool came from this topic viewtopic.php?t=47935

Limitations:
  • I think the tool would be a lot more useful if the dialog could be non-modal (ie it could stay open while interacting with the document), or if the list of saved views were a pane (built-in similar to bookmarks, etc). Both of these are rather major development issues I think, so not something that happens in the near future.
  • It saves views per document (not per view or tab because javascript can't get information about the tabs). Currently it only saves the views in the current session. I'm thinking it may be useful to actually save the views to the document. LMK if you think that's a smart idea or not.
  • BUG: If you switch documents, the back button won't list the correct number of saved views until a view is saved. I've thought of a way to fix this, but it means constantly checking if the active document has changed which seems like a lot of background stuff just for a minor annoyance. I try to avoid having intervals running in the background unless they are doing something useful. If you think it's annoying enough that it's worth fixing, LMK.
  • Older versions of PXCE don't show the number of views saved. Before build 393 it adds buttons to the add-ons toolbar.
  • If you can think of a better label than "Back" please suggest it.
You do not have the required permissions to view the files attached to this post.
Last edited by Mathew on Fri Oct 31, 2025 10:06 pm, edited 10 times in total.
User avatar
Dimitar - PDF-XChange
Site Admin
Posts: 2629
Joined: Mon Jan 15, 2018 9:01 am

Re: [tool] Save and revert views without adding bookmarks

Post by Dimitar - PDF-XChange »

Good job, Mathew.

Thank you.
Mathew
User
Posts: 725
Joined: Thu Jun 19, 2014 7:30 pm

Re: [tool] Save and revert views without adding bookmarks

Post by Mathew »

A minor improvement to add the option to automatically save views if page or zoom changes more than a configurable option. Also an option to not add duplicate saved views. The translation strings are also changed.
viewNavigator v1.1.zip
Changes v1.1
  • option to automatically add when zoom/page changed by certain amount;
  • add dropdown for options;
  • fix some dialog issues;
  • avoid adding duplicate views
You do not have the required permissions to view the files attached to this post.
User avatar
Dimitar - PDF-XChange
Site Admin
Posts: 2629
Joined: Mon Jan 15, 2018 9:01 am

Re: [tool] Save and Revert Views without adding bookmarks

Post by Dimitar - PDF-XChange »

Thanks again.