[Tool] Sychronize view of documents (pan, zoom, etc)  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: 573
Joined: Thu Jun 19, 2014 7:30 pm

[Tool] Sychronize view of documents (pan, zoom, etc)  SOLVED

Post by Mathew »

There's a built-in tool in the works, but until then: This tool allows you to select two (or more) documents and set their view/zoom/page/etc to synchronize between them. This is a rewrite of a tool originally written by @benep at viewtopic.php?t=39797 and then updated by me at viewtopic.php?t=42070

Usage
The tool will add a "Sync Views" button to the Add-ons toolbar, and also a menu item to the View ribbon (or the View menu):
image.png
With at least two documents open, start the tool. It will give a dialog:
image(1).png
Documents
  • Select the documents you want to view. The menu adds the number of pages in the document at the end.
    The Show button brings the selected document to the front.
    If the dialog has more than 2 documents listed, there will be a [-] button to remove this document from the sync.
    Starting page can be adjusted if the option to sync page numbers is not active.
[+] Add documents to the sync
  • The tool can sync more than two documents, if desired. If there are more than 2 documents open, select the [+] to add another document picker.
    image(2).png
Settings
  • Pick which aspects you want to synchronize between the documents.
View
  • If you want the tool to set up split views, pick vertical or horizontal split views
    If page sizes differ between the documents, the "Scale view" option will move the pages relative to the page borders, rather than the same absolute distance
Prompts
  • If you selected "Do not show this again" in any of the pop-up dialogs, you can reset them here.
To Cancel the sync, either select the tool again, or close one of the documents. If you select the tool again, it will give a dialog with three options:
  • image(3).png
    Stop Sync just cancels the sync (and returns the documents to one tab group if the vertical/horizontal split was used).
    Edit Sync re-opens the Sync Views dialog box to change which documents, the pages, the sync options, etc.
    Cancel returns to they synchronized documents.
    There's also a checkbox to hide this pop-up dialog and go to the option you select (except cancel) without asking next time.

Installation
Unzip and save in JavaScripts folder, then restart PDF XChange. You may need to make the folder. Either in
C:\Users\[USERNAME]\AppData\Roaming\Tracker Software\PDFXEditor\3.0\Javascripts
OR
C:\Program Files\Tracker Software\PDF Editor\Javascripts
scrollsync v1.3.zip

If you are using PDF-XChange before build 393 you'll also need xutils downloadable from here:
viewtopic.php?t=44731

Translations
This tool can be translated using 1ang.js. Save the translation file into the Javascripts folder also, and the tool will pick up and use the translation for your currently selected language in PDF-XChange. I've attached the template translation file below and the tool at viewtopic.php?p=186101#p186101 will help editing the file to add translations. I added a machine translation (Google translate) to simplified Chinese "CHS" and Ukrainian "UKR" (I have no idea how accurate it is!)
translationData.scrollSync.json.zip
image(4).png


tl;dr
I re-wrote the tool to address issues with security settings, as well as rounding problems with page coordinates. It also uses the updated app.setInterval() method that allows functions to be assigned directly. This eliminated the need for a global variable to hold the interval, and let me enclose all its data inside the function. I added options to allow splitting horizontally or vertically, and which aspects of the view should be synchronized.

Limitations/known bugs
  • If using the ribbon (horizontal) continuous views, and documents have differing page sizes, there will be some weird results: While scrolling in large pages, the page number in other synchronized document(s) will jump around wildly. Small pages may get stuck off-screen. This, I think, is because the script is trying to set the scroll position past the edge of a smaller page -- I've spent way too much time trying to figure it out and so far haven't succeeded. Workaround is: don't use ribbon continuous views with this tool if the document pages differ from one another.
If you see bugs, or can add translations, please post!
You do not have the required permissions to view the files attached to this post.
Last edited by Mathew on Mon Apr 14, 2025 9:55 pm, edited 14 times in total.
Mathew
User
Posts: 573
Joined: Thu Jun 19, 2014 7:30 pm

Re: [Tool] Sychronize view of documents (pan, zoom, etc)

Post by Mathew »

I updated to v1.1 above, fixing some bugs and adding the ability to sync more than two documents.

Changes since v1.0
  • Sync more than 2 docs;
  • Don't disable the page number input for doc1;
  • add alert if sync cancelled by too few docs (uses menu cMarked to run the check),
  • misc dialog cleanup,
  • save page number delta instead of looking at change (for different sized pages, but ribbon view will still be weird)
This is the superceded v1.0 version:
scrollsync v1.0.zip
You do not have the required permissions to view the files attached to this post.
Last edited by Mathew on Mon Mar 24, 2025 6:54 pm, edited 1 time in total.
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 11033
Joined: Wed Jan 03, 2018 6:52 pm

[Tool] Sychronize view of documents (pan, zoom, etc)

Post by Daniel - PDF-XChange »

:)
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Mathew
User
Posts: 573
Joined: Thu Jun 19, 2014 7:30 pm

Re: [Tool] Sychronize view of documents (pan, zoom, etc)

Post by Mathew »

v1.2 uploaded above. Tool seems to be working OK for me now, at last!

Changes since v1.1
  • fix bug introduced in v1.1 with page changing backwards;
  • try to handle scrolling in ribbon/continuous view when page sizes don't match (still doesn't work well in ribbon view when page sizes differ);
  • add option to scale scroll by page size so that two different pages move proportionally
User avatar
Dimitar - PDF-XChange
Site Admin
Posts: 2208
Joined: Mon Jan 15, 2018 9:01 am

Re: [Tool] Sychronize view of documents (pan, zoom, etc)

Post by Dimitar - PDF-XChange »

Great Job, Mathew. :-)

Thank you.
Mo_Yous
User
Posts: 2
Joined: Sun Apr 13, 2025 8:37 pm

Re: [Tool] Sychronize view of documents (pan, zoom, etc)

Post by Mo_Yous »

Hello Mathew,

Thanks for the great work!

For some reason the tool v1.0 and v1.2 are not working for me, but older versions like v0.6.1 is working!
I'm on build number 395
image.png
You do not have the required permissions to view the files attached to this post.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

[Tool] Sychronize view of documents (pan, zoom, etc)

Post by Stefan - PDF-XChange »

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

Re: [Tool] Sychronize view of documents (pan, zoom, etc)

Post by Mathew »

Mo_Yous wrote: Sun Apr 13, 2025 8:42 pm For some reason the tool v1.0 and v1.2 are not working for me, but older versions like v0.6.1 is working!
I'm on build number 395
Hi @Mo_Yous,
Could you help me figure this out: What does v1.2 do? Do you get any error message in the JavaScript console?
Thanks,
Mathew.
Mo_Yous
User
Posts: 2
Joined: Sun Apr 13, 2025 8:37 pm

Re: [Tool] Sychronize view of documents (pan, zoom, etc)

Post by Mo_Yous »

Mathew wrote: Mon Apr 14, 2025 2:47 pm
Hi @Mo_Yous,
Could you help me figure this out: What does v1.2 do? Do you get any error message in the JavaScript console?
Thanks,
Mathew.
Hi @Mathew,

I get this error
"Mozilla JavaScript Engine is initialized (ES2017+)
App:Init:214: TypeError: docID is not a function"

Changing the "findIndex" to "indexOf" in line 214 solved the error. :D

Regards,
Mohamed
Mathew
User
Posts: 573
Joined: Thu Jun 19, 2014 7:30 pm

Re: [Tool] Sychronize view of documents (pan, zoom, etc)

Post by Mathew »

Mo_Yous wrote: Mon Apr 14, 2025 7:26 pm Hi @Mathew,

I get this error
"Mozilla JavaScript Engine is initialized (ES2017+)
App:Init:214: TypeError: docID is not a function"

Changing the "findIndex" to "indexOf" in line 214 solved the error. :D

Regards,
Mohamed
Thank you Mohamed! I'll upload a revised version 1.3. Much appreciated.
Mathew.
scrollsync v1.3.zip
You do not have the required permissions to view the files attached to this post.
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 11033
Joined: Wed Jan 03, 2018 6:52 pm

[Tool] Sychronize view of documents (pan, zoom, etc)

Post by Daniel - PDF-XChange »

:)
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com