Viewing multiple documents with synchronize pan and zoom?
Moderators: Daniel - PDF-XChange, PDF-XChange Support, Vasyl - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange
Viewing multiple documents with synchronize pan and zoom?
Hi to all,
I'm wondering how simultaneously pan and zoom in two opened document?
I have two same size pdf and I like to pan and zoom in first document and automatically perform the same function (pan and zoom) in the second document.
If not yet implemented it will be awesome feature for reviewing graphical documents.
I'm wondering how simultaneously pan and zoom in two opened document?
I have two same size pdf and I like to pan and zoom in first document and automatically perform the same function (pan and zoom) in the second document.
If not yet implemented it will be awesome feature for reviewing graphical documents.
-
- User
- Posts: 2726
- Joined: Wed Jan 18, 2006 12:10 pm
Re: Viewing multiple documents with synchronize pan and zoom?
Hi,
I suppose you like to pan and zoom on the same page and the same place in both documents at the same time ?
Then I think about the "Compare Documents" feature in the Review-tab, as a possible "work-around":
Launch PDF-XChange Editor and click the Compare Documents icon in the Review tab.
Open one document in the left pane (Old Document) and the other in the right pane (New Document).
Click OK and wait until the compare has finished. At that time, you will see both documents side by side.
Via the "Show"-icon, in the toolbar on top of both documents, un-check active items one by one.
Now when you scroll the pages from top to bottom or vice-versa, they will keep aligned.
Finally, click the "Pan and Zoom" icon in the View-tab.
In the "Pan and Zoom"-dialog-box, indicate the zone you like to see and then scroll through the document.
Does that help ?
Maybe there are other (and better) methods, but this is the first one I think of.
Regards.
I suppose you like to pan and zoom on the same page and the same place in both documents at the same time ?
Then I think about the "Compare Documents" feature in the Review-tab, as a possible "work-around":
Launch PDF-XChange Editor and click the Compare Documents icon in the Review tab.
Open one document in the left pane (Old Document) and the other in the right pane (New Document).
Click OK and wait until the compare has finished. At that time, you will see both documents side by side.
Via the "Show"-icon, in the toolbar on top of both documents, un-check active items one by one.
Now when you scroll the pages from top to bottom or vice-versa, they will keep aligned.
Finally, click the "Pan and Zoom" icon in the View-tab.
In the "Pan and Zoom"-dialog-box, indicate the zone you like to see and then scroll through the document.
Does that help ?
Maybe there are other (and better) methods, but this is the first one I think of.
Regards.
- Stefan - PDF-XChange
- Site Admin
- Posts: 19780
- Joined: Mon Jan 12, 2009 8:07 am
- Contact:
Re: Viewing multiple documents with synchronize pan and zoom?
This is similar to another topic in which a javascript tool was posted by @benep at viewtopic.php?t=39797
[EDIT Mar 11, 2025] Major update to the way viewStates are compared. Much smoother, less (or eliminated?) drifting.
[EDIT Nov 27,2024] I updated to the most recent version of this script.
I fiddled their script a bit to make it work with trusted functions, so here's a slightly modified version. It adds a toolbar button 'Sync ' To use it, open the two documents, then select the tool. It will give a dialog to select the documents to synchronize, then should put those two documents in side-by-side view. To stop the sync, select the tool again.
This is the script file zipped. Unzip and save the javascript file as described below: Unzip and save in JavaScripts folder. 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
OR: copy, paste the script below and save as a text file scrollSync.js in the JavaScripts folder.
[EDIT Mar 11, 2025] Major update to the way viewStates are compared. Much smoother, less (or eliminated?) drifting.
[EDIT Nov 27,2024] I updated to the most recent version of this script.
I fiddled their script a bit to make it work with trusted functions, so here's a slightly modified version. It adds a toolbar button 'Sync ' To use it, open the two documents, then select the tool. It will give a dialog to select the documents to synchronize, then should put those two documents in side-by-side view. To stop the sync, select the tool again.
This is the script file zipped. Unzip and save the javascript file as described below: Unzip and save in JavaScripts folder. 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
OR: copy, paste the script below and save as a text file scrollSync.js in the JavaScripts folder.
Code: Select all
/** Script to synchronize two windows
* Original script by benep and posted https://forum.pdf-xchange.com/viewtopic.php?p=167809#p167809
*
* v0.6.1 if changes don't stick, save that to the state, so it doesn't get pushed back
* v0.6 2025-03-04 Update in preparation for rewrite to individually set zoom, pan, etc. Resolve drifting issue.
* v0.5.1 2024-08-15 Use documentFileName for case where no docID was assigned, add question for sync cancel, fix some JSlint
* v0.5 2024-08-15 Different alert if documents have same ID, checkbox option for vert split
* v0.4 2024-04-18 Changed icon to 40x40, set cMarked while tool is active
* v0.3 2024-04-09 applied menu item to show side by side
* v0.2 2024-04-09 changed global to xutil, added trusted function for documents, added menu item
*
* @todo: add options, use globals and xutils for timeout
*/
var myIcon = {count:0, width:40, height:40, read:function(nBytes=this.data.length/2){return this.data.slice(this.count,this.count+=2*nBytes);}, data:(a=>{let[b,c]=a.split(":");c=c?.match(/.{8}/g);let d=(a,b)=>a.replace(/./g,a=>parseInt(a,10+b)-b);return b.replace(/([g-p]+)([0-9a-f]+|[q-z]+)/gi,(a,b,e)=>(/[q-z]/.test(e)?c[d(e,26)]:e).repeat(d(b,16)));})("pqiuhoqiuhnqhuirhuhmqhuirhuhlqhukrhuhkqhukrhuhjqhumrhuhiqhumrhuhhqhuirhvirhqirhuhgqhuirhqirhqirhupqhuiriqiriqirhuoqhuiriqiriqirhupqhrjqirjqhrhgqhrjqirjqhrhkqirhoqirpqhsxhrvnvirhthsyh80D3D3D3mqhsxhrvnvirhthsyhFFB0B0B0mqhrvovirhszhtqhtrmqhrvnvhrrirhszhtqhtrmqivnsirhtsixhttlqivnsirhtsixhttlqivnsirjxhrwlqivnsirjxhrwlqivishFFE7F1DDisrhtuhsirkxhtvkqivnsirkxhtvkqivishsrhFF9CC671htwhsshshrxhtxkxhryh40F1F1F1jqivnshrxhtxkxhrykqivishsrhtwhFF7CB342hsshshyhtylxhtzjqiviskwhshyhtylxhtzjqivishtuisshFFDFECD1hsirhuqkxhurhusiqivislwirhuqkxhurhusiqivnsirhshzhryjxhutiqivnsirhshzhryjxhutiqivnsiyishuuhuvhrzhxhuwh80D6D6D6hqivnsiyishuuhuvhrzhxhuwh40D6D6D6hqhvhrrislwirshwjshuxhrwhxhuyhqhvhrrislwirsiwhzhshuxhrwhxhuyhqhrrhtislwirhwhzhFFFCFCFChsthshsthuzhrzhqhrrhtislwirjwhzhshsthuzhrzhqitnsirlrtishFF7D7D7DhqitnsirnshthqitnshyhrxlrthruhshthqitnsiyhrumshthqitislwirslwhFFF8F8F8hshthqitislwhrshFFA1BFE6hshFFEED17DhFFECC34EhFFF2D688hFFFEFCF7ishthqitislwirlwishthqitislwirhFFF3F2EFhvqhsuhsqhvrishthqitmshruirjrtkshthqitnsirhvqhsuhsqhsvhswishthqitnsirxjrtkshthqitnshyhFFB4BCC5hsuhsqisvhswishthqitislwirslwishthqitiskwhzhFFBDD6F8hFFB6BFC8hsqjsvhvsishthqitislwirlwishthqitislwirhvriswhvshFFFEFDFAishthqitnsirkrthshruhshthqitlshruhsirnshthqitnsiynshthqitnsiynshthqhrqotivtothqhrqotivtothqhvuhrqntirnthrqh20D9D9D9hvuhrqntirnthFF858585hgqirhoqirhkqhrjqirjqhrhgqhrjqirjqhrpqhuiriqiriqirhuoqhuiriqiriqirhupqhuirhqirhqirhuhgqhuirhqirhqirhuhhqhumrhuhiqhumrhuhjqhukrhuhkqhukrhuhlqhuirhuhmqhuirhuhnqiuhoqiupq:00000000FF42A5F5FFFFFFFFFF8080808042A5F5FF9F9F9FFF9E9E9EFF616161FFC0D8FAFFD5D5D580898989FF909090FF7BA2D0FFFEFEFEFFFBFBFB80A3A3A3FF848484FFBFD7FAFF767676FF636363FFE8B629FFA4CA7CFF86B951FFFDFDFDFFEBC047FFE5AC0AFFE6B01740DBDBDBFF737373FF7C7C7CFF626262FF787878FF8F8F8F80D5D5D5FFE3EFD780C7C7C7FF8CBC5AFF578BC0FF779FCE80B8B8B8FF9B9B9BFF6B6B6B40EBEBEB80A7A7A7FFF9F9F9FFACACACFF656565FFE3E3E3FF7A7A7AFFBEBEBEFFEECE74FFF0CF74FFF0D075FF6794C640D9D9D9")};
app.addToolButton({
cName: "syncDocs",
oIcon: myIcon,
cLabel: "Sync",
cExec: 'xutil.scrollSync.toggleSyncState();',
cTooltext: "Toggle syncronizing the view of two documents. Select tool again to cancel sync.",
cEnable: "event.rc = (event.target != null)", // at least one document
cMarked: "event.rc = xutil.scrollSync.isActive", // hilight tool button while the tool is running
//nPos: -1
});
if ('undefined' === typeof xutil) {
Object.defineProperty( globalThis, 'xutil', { value: {}, writable: false });
}
xutil.scrollSync = {
//////////////////////////////
// SETTINGS
//////////////////////////////
interval: 50, // milliseconds to check for moved doc
ckPan: true, // check panning (position)
ckZoom: true, // check zoom
ckRotation: true, // check page view rotation
ckPage: true, // check page changes
ckPageNo: false, // check page number
//////////////////////////////
// SETTINGS
//////////////////////////////
//activeDocs: [],
isActive: false,
docs: [],
//doc1: null,
//doc2: null,
doc1ID: '',
doc2ID: '',
states: [],
//state1: '',
//state2: '',
timer: null,
data:{stpv: true}, // default check box
checkSync: function() {
let cnt = 0;
for (let d of this.activeDocs) {
const docIDs = this.getID( d ); //.docID.join('');
if (docIDs === this.doc1ID || docIDs === this.doc2ID) {
cnt++;
}
}
if (cnt < 2) {
xutil.scrollSync.isActive = false;
app.clearInterval(xutil.scrollSync.timer);
app.alert('Synchronisation of views canceled because of missing document.',1);
}
},
// added for case where docID has not been assigned by pdf creator
// uses file name as proxy
getID( doc ) {
return doc.docID.join('') || doc.documentFileName;
},
// set up states to current values
setStates() {
const me = this;
for (let i in me.docs) {
me.states[i] = Object.assign({}, me.docs[i].viewState);
}
},
doSync: function() {
const me = xutil.scrollSync;
me.checkSync();
try {
if (me.isActive) {
const docs = me.docs; //['doc1','doc2'];
const states = me.states; //['state1','state2'];
let updateDoc;
const precise = 3;
const vsCheck = [];
// check pan
if (me.ckPan) {
vsCheck.push( 'pageViewY', 'pageViewX');
}
// check zoom
if (me.ckZoom) {
vsCheck.push( 'pageViewZoom', 'pageViewZoomType'); // maybe remove zoomType
}
// check rotation
if (me.ckRotation) {
vsCheck.push( 'pageViewRotation');
}
// check page change
if (me.ckPage) {
vsCheck.push( 'pageViewPageNum', 'pageViewRow');
}
for (let i in docs) {
// Properties of viewState (build 394):
// pageViewLayoutMode, pageViewZoom, pageViewZoomType, pageViewRow, pageViewX, pageViewY, pageViewBX, pageViewBY, pageViewPageNum, pageViewRotation, ocgStates, overViewPos
// check and update
for (let p of vsCheck) {
// this viewstate property value
let vs = docs[i].viewState[p];
// for page position, the comparison needs to be less precise
let precision = ('pageViewY' === p || 'pageViewX' === p) ? 1 / docs[i].viewState.pageViewZoom : 0.001;
let compare = Math.abs( vs - states[i][p] );
if ( precision < compare ) {
//console.println([p, compare, vs]);
//console.println(p + ":" + states[i][p] + ' - ' + vs)
//console.println(JSON.stringify(docs[i].viewState))
updateDoc = true;
// save page difference
const pgDiff = vs - states[i][p];
// update all document saved viewstates
for (let j in docs) {
// save state
let val = vs;
switch (p) {
// check page number
case 'pageViewPageNum':
case 'pageViewRow':
if (!me.ckPageNo && i !== j ) {
val = states[j][p] + pgDiff;
}
//console.println([i,j,vs,val,- states[i][p] + vs])
break;
case 'pageViewX':
states[j]['pageViewBX'] = docs[i].viewState['pageViewBX'];
break;
case 'pageViewY':
states[j]['pageViewBY'] = docs[i].viewState['pageViewBY'];
break;
}
states[j][p] = val;
}
}
}
// don't check the other document if this one was already changed
if (updateDoc) {
// update the document viewstates
for (let j in docs) {
if ( i !== j) {
docs[j].viewState = states[j];
// the new viewState may not stick (ie view is out of page range)
// save back to states so that it doesn't push the changed document back at next interval
for (let p of vsCheck) {
// this viewstate property value
const precision = 3;
if (states[j][p].toPrecision(precision) !== docs[j].viewState[p].toPrecision(precision)) {
states[j][p] = docs[j].viewState[p];
}
}
}
}
break;
}
//const curState = JSON.stringify(me[docs[i]].viewState);
//if (curState != me[states[i]]) {
// me[states[i]] = curState;
// me[docs[1-i]].viewState = JSON.parse(curState);
//}
}
}
} catch (err) {
app.clearInterval(me.timer);
me.isActive = false;
console.println(JSON.stringify(err));
app.alert('There was an unexpexted error! See JS-console for more information.');
}
},
toggleSyncState: function() {
const me = xutil.scrollSync;
if (me.isActive) {
if (4 === app.alert( {cMsg:'Cancel Synchronisation?', nIcon:2, nType:2} )) {
me.isActive = false;
app.clearInterval(me.timer);
if (me.data?.stpv) app.execMenuItem('cmd.window.allDocsToOneTabGroup');
}
//app.alert('Synchronisation canceled.',3);
return;
}
if (me.activeDocs.length < 2) {
app.alert('There need to be at least two opened documents.',1);
} else {
const dialog = {
docList: {},
initialize: function(dlg) {
const lst1 = {}, lst2 = {};
this.docList = {};
for (let i = 0; i < me.activeDocs.length; i++) {
const doc = me.activeDocs[i];
const key = (i+1) + ' - ' + (doc.documentFileName.length ? doc.documentFileName : 'New Document*');
lst1[key] = (i === 0 ? 1 : -1) * (i+1);
lst2[key] = (i === 1 ? 1 : -1) * (i+1);
this.docList[key] = doc;
}
dlg.load({ lst1, lst2, stpv: me.data?.stpv });
},
commit: function(dlg) {
me.data = dlg.store();
const s1 = this.getSelectedEntry(me.data.lst1);
const s2 = this.getSelectedEntry(me.data.lst2);
//me.doc1 = this.docList[s1.key];
//me.doc2 = this.docList[s2.key];
me.docs = [ this.docList[s1.key], this.docList[s2.key]];
me.doc1ID = this.getID( this.docList[s1.key] ); //.docID.join('');
me.doc2ID = this.getID( this.docList[s2.key] ); //.docID.join('');
me.isActive = true;
me.docs.forEach( d => {d.bringToFront();});
//me.doc1.bringToFront();
//me.doc2.bringToFront();
if (me.data.stpv) app.execMenuItem('cmd.window.activeDocToNewVertTabGroup');
// set up current states
me.setStates();
me.timer = app.setInterval('xutil.scrollSync.doSync()', me.interval);
// return 'ok'
},
validate: function(dlg) {
const data = dlg.store();
const s1 = this.getSelectedEntry(data.lst1);
const s2 = this.getSelectedEntry(data.lst2);
const id1 = this.getID( this.docList[s1.key] ); //.docID.join('');
const id2 = this.getID( this.docList[s2.key] ); //.docID.join('');
if (s1.val === s2.val) {
app.alert('Choose different files.',1);
return false;
} else if (id1 !== '' && id1 === id2) { // some documents are created without docID
console.println('The documents may be identical because the document IDs are the same.',3);
//return false;
}
return true;
},
// added for case where docID has not been assigned by pdf creator
// uses file name as proxy
getID( doc ) {
return doc.docID.join('') || doc.documentFileName;
},
getSelectedEntry: function(lst) {
for (const key in lst) {
if (Object.hasOwnProperty.call(lst, key)) {
const val = +lst[key];
if ( val >= 0) return {key, val};
}
}
},
description: { name: 'Sync views', align_children: 'align_left', elements: [
{ type: 'static_text', name: 'Choose which documents to sync:', bold: true },
{ type: 'cluster', name: 'Doc 1', align_children: 'align_left', elements: [
{ type: 'popup', item_id: 'lst1', width: 240 }
]},
{ type: 'cluster', name: 'Doc 2', align_children: 'align_left', elements: [
{ type: 'popup', item_id: 'lst2', width: 240 }
]},
{ type: 'cluster', name: 'Settings', align_children: 'align_left', elements: [
{ type: 'check_box', item_id: 'stpv', name: 'Open vertical split view' },
]},
{ type: 'ok_cancel', ok_name: 'sync' }
]}
};
if (app.execDialog(dialog) !== 'ok' && me.isActive) {
me.isActive = false;
app.clearInterval(me.timer);
app.alert('Synchronisation canceled.',3);
}
}
}
};
{
// add priveliged function to get active docs with closure
let aD = app.trustedFunction(() => {
app.beginPriv();
return app.activeDocs;
});
Object.defineProperty(xutil.scrollSync,'activeDocs', {
get() {return aD();},
});
}
Last edited by Mathew on Tue Mar 11, 2025 11:16 pm, edited 11 times in total.
Re: Viewing multiple documents with synchronize pan and zoom?
Hello Mathew,
Thanks to Mathew and benep for their great contribution.
I am very happy because I was using the portable version of build 368 to use the original script. I am doubly happy to see that the original scripts require two runs to open the dialog, but now I only need to press once to open the dialog. I also learned a lot about the use of trusted functions, and the series of JavaScripts you has posted are very informative examples of JavaScript usage in the PDF-XChange Editor. Thank you again.
Best regards,
rakunavi
Thanks to Mathew and benep for their great contribution.
I am very happy because I was using the portable version of build 368 to use the original script. I am doubly happy to see that the original scripts require two runs to open the dialog, but now I only need to press once to open the dialog. I also learned a lot about the use of trusted functions, and the series of JavaScripts you has posted are very informative examples of JavaScript usage in the PDF-XChange Editor. Thank you again.
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
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
Re: Viewing multiple documents with synchronize pan and zoom?
I edited the script above to add an icon and also it puts the two synced documents side by side when it starts now, so you don't have to do that manually. I also reduced the frequency it checks, so it only checks every tenth of a second. Was making things run a bit slowly on my old computer
You can change on line 22.
Not sure I love that it forces the page numbers to be the same, but that's for another time! I think it could be made to have the option to just sync the scrolling, page changes, zoom, etc without too much difficulty.
I do think something like this should be built-in though. Could be just an option on Compare Documents to Synchronize only so it doesn't take an age waiting for it to compare the content.

Not sure I love that it forces the page numbers to be the same, but that's for another time! I think it could be made to have the option to just sync the scrolling, page changes, zoom, etc without too much difficulty.
I do think something like this should be built-in though. Could be just an option on Compare Documents to Synchronize only so it doesn't take an age waiting for it to compare the content.
- Daniel - PDF-XChange
- Site Admin
- Posts: 10872
- Joined: Wed Jan 03, 2018 6:52 pm
Re: Viewing multiple documents with synchronize pan and zoom?
Hello, Mathew
While this is not something we currently plan to offer for regular use of the editor, the Document comparison function does also offer such relative positioning, the key difference there being that it tries to sync the location of the content on the page in situations where is has moved, instead of simply moving "1:1" per notch on the scrollwheel.
Since compared documents may not always be the same number of pages, or may have different sized pages, and it is possible to change the zoom scale on one or the other, or perhaps click a link which forced such.. For those reasons,1:1 actions/scaleing/positioning are not necessarily practical to implement. It is something we have seen numerous requests for however, So I will prod the Dev team again to reconsider it.
Kind regards,
While this is not something we currently plan to offer for regular use of the editor, the Document comparison function does also offer such relative positioning, the key difference there being that it tries to sync the location of the content on the page in situations where is has moved, instead of simply moving "1:1" per notch on the scrollwheel.
Since compared documents may not always be the same number of pages, or may have different sized pages, and it is possible to change the zoom scale on one or the other, or perhaps click a link which forced such.. For those reasons,1:1 actions/scaleing/positioning are not necessarily practical to implement. It is something we have seen numerous requests for however, So I will prod the Dev team again to reconsider it.
Kind regards,
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
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
Re: Viewing multiple documents with synchronize pan and zoom?
I made a slight change to the script in the post above to try to indicate whether the tool is running by highlighting the toolbar button. Also added a link to a zipped copy of the same script at the end.
- Dimitar - PDF-XChange
- Site Admin
- Posts: 2193
- Joined: Mon Jan 15, 2018 9:01 am
Re: Viewing multiple documents with synchronize pan and zoom?
Thank you for your effort, Mathew.
We appreciate it.
Regards.
We appreciate it.
Regards.
Re: Viewing multiple documents with synchronize pan and zoom?
Mathew,
Thanks for your work on this tool. Its exactly what I have been looking for. Still cant believe it isn't part of the app itself.
I am running into a couple of small issues that I hope you can help me with.
1. I quite often get the following error after selecting the files and pressing sync. "Choose different files."
What is this all about?, I have a redline markup PDF I need to compare with the revised PDF from drafting department.
But when I try to Sync it wont let me. Doesn't happen with all PDF's but often enough that its an issue.
2. Drift. When I do manage to get a pair of PDFs sync'ed, after zooming in it starts to pan drift to the right at a slow pace.
This happens on multiple computers, so its not machine specific.
Thanks again.
Thanks for your work on this tool. Its exactly what I have been looking for. Still cant believe it isn't part of the app itself.
I am running into a couple of small issues that I hope you can help me with.
1. I quite often get the following error after selecting the files and pressing sync. "Choose different files."
What is this all about?, I have a redline markup PDF I need to compare with the revised PDF from drafting department.
But when I try to Sync it wont let me. Doesn't happen with all PDF's but often enough that its an issue.
2. Drift. When I do manage to get a pair of PDFs sync'ed, after zooming in it starts to pan drift to the right at a slow pace.
This happens on multiple computers, so its not machine specific.
Thanks again.
Re: Viewing multiple documents with synchronize pan and zoom?
Hi Kirkup,kirkup wrote: ↑Thu Aug 15, 2024 2:22 am 1. I quite often get the following error after selecting the files and pressing sync. "Choose different files."
2. Drift. When I do manage to get a pair of PDFs sync'ed, after zooming in it starts to pan drift to the right at a slow pace.
This happens on multiple computers, so its not machine specific.
1. The tool compares document IDs and based on the API they are supposed to be unique to each document, but doesn't seem to always be so. I think some pdf printers don't add an ID. Try the attached version 0.5.1 - I added a workaround that works for me.
2. I'm also getting this. It usually only happens at one zoom level (66% ??) so I think it's a rounding error. Because of how the original author compares the two documents, it's a bit more work to get around this one. There are a number of other glitches that will require a total rewrite, so until then: The workaround right now I use is to change the zoom a tiny bit.
- Mathew.
Last edited by Mathew on Fri Oct 18, 2024 12:32 am, edited 1 time in total.
Re: Viewing multiple documents with synchronize pan and zoom?
Mathew,Mathew wrote: ↑Thu Aug 15, 2024 5:19 pmHi Kirkup,kirkup wrote: ↑Thu Aug 15, 2024 2:22 am 1. I quite often get the following error after selecting the files and pressing sync. "Choose different files."
2. Drift. When I do manage to get a pair of PDFs sync'ed, after zooming in it starts to pan drift to the right at a slow pace.
This happens on multiple computers, so its not machine specific.
1. The tool compares document IDs and based on the API they are supposed to be unique to each document, but doesn't seem to always be so. I think some pdf printers don't add an ID. Try the attached version 0.5.1 - I added a workaround that works for me.
2. I'm also getting this. It usually only happens at one zoom level (66% ??) so I think it's a rounding error. Because of how the original author compares the two documents, it's a bit more work to get around this one. There are a number of other glitches that will require a total rewrite, so until then: The workaround right now I use is to change the zoom a tiny bit.
- Mathew.
scrollsync v0.5.1.zip
Thanks for the quick reply and solution. It's now working as expected.
- Dimitar - PDF-XChange
- Site Admin
- Posts: 2193
- Joined: Mon Jan 15, 2018 9:01 am
-
- User
- Posts: 5
- Joined: Fri Oct 04, 2024 3:46 am
Re: Viewing multiple documents with synchronize pan and zoom?
I just want to thank the developer of this javascript. It was exactly what I was looking for. Thanks so much!
- Stefan - PDF-XChange
- Site Admin
- Posts: 19780
- Joined: Mon Jan 12, 2009 8:07 am
- Contact:
-
- User
- Posts: 15
- Joined: Thu Jan 19, 2023 11:45 am
Re: Viewing multiple documents with synchronize pan and zoom?
When the page is at 125%, 200%, and 800%, the two windows will automatically move horizontally, while other % ratios can be used normally. What is the problem?
scrollsync v0.5.1.zip
scrollsync v0.5.1.zip
- Stefan - PDF-XChange
- Site Admin
- Posts: 19780
- Joined: Mon Jan 12, 2009 8:07 am
- Contact:
Re: Viewing multiple documents with synchronize pan and zoom?
Hello softschool,
I just downloaded the current version of Mathew's sync script and am not sure I managed to reproduce what you reported.
Can you please share some screenshots illustrating the difference between e.g. 125 and 150% so that we can better understand what you mean?
Kind regards,
Stefan
I just downloaded the current version of Mathew's sync script and am not sure I managed to reproduce what you reported.
Can you please share some screenshots illustrating the difference between e.g. 125 and 150% so that we can better understand what you mean?
Kind regards,
Stefan
-
- User
- Posts: 15
- Joined: Thu Jan 19, 2023 11:45 am
Re: Viewing multiple documents with synchronize pan and zoom?
When I use Ctrl + scroll wheel to zoom the drawing, if it is exactly 125%, 200%, 800%, the two windows will drift automatically.
-
- User
- Posts: 15
- Joined: Thu Jan 19, 2023 11:45 am
Re: Viewing multiple documents with synchronize pan and zoom?
Through DeepSeek, the drift problem of 0.51 was solved. Attached is my updated version 0.52. Please try it out. However, I have changed the operation interface to Chinese version. If possible, you can also translate it back to English version.
- Daniel - PDF-XChange
- Site Admin
- Posts: 10872
- Joined: Wed Jan 03, 2018 6:52 pm
Viewing multiple documents with synchronize pan and zoom?

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
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
Re: Viewing multiple documents with synchronize pan and zoom?
Thanks @softschool: It looks like the proposed revision aims to get a ratio to limit updates to scrolling. I'm surprised it's working for you, though, because it tries to access some properties of viewState that don't exist in my version 10.5.1 of PXCE (viewState.zoom, viewState.viewBox, viewState.scrollX ...)softschool wrote: ↑Tue Mar 04, 2025 3:45 pm Through DeepSeek, the drift problem of 0.51 was solved. Attached is my updated version 0.52. Please try it out. However, I have changed the operation interface to Chinese version. If possible, you can also translate it back to English version.
I'm working on an update that I'll post, just been a bit busy lately.
- Stefan - PDF-XChange
- Site Admin
- Posts: 19780
- Joined: Mon Jan 12, 2009 8:07 am
- Contact:
Re: Viewing multiple documents with synchronize pan and zoom?
Hello Mathew,
I presume you are deliberately not using the latest build? (V10.5.2 build 395)
Kind regards,
Stefan
I presume you are deliberately not using the latest build? (V10.5.2 build 395)
Kind regards,
Stefan
Re: Viewing multiple documents with synchronize pan and zoom?
Stefan - PDF-XChange wrote: ↑Thu Mar 06, 2025 1:58 pm I presume you are deliberately not using the latest build? (V10.5.2 build 395)

I've made a revised version of the tool that (I think) resolves the drifting issue, but haven't had time to test it, so if anyone has time that would be great. Hang on to the previous version just in case this isn't working for you: There are definitely some new bugs I've introduced (if the documents start at different zooms, they are not updated until one of the document zooms gets changed):
I added some options that can be changed on lines 31-39. I've set "ckPageNo" to false because often the documents I'm comparing have a different number of cover pages, so I set both documents to the page I want to compare on each before running the tool. Then it updates page changes, but doesn't force both documents to the same page number.
Code: Select all
//////////////////////////////
// SETTINGS
//////////////////////////////
interval: 50, // milliseconds to check for moved doc
ckPan: true, // check panning (position)
ckZoom: true, // check zoom
ckRotation: true, // check page view rotation
ckPage: true, // check page changes
ckPageNo: false, // check page number
- Daniel - PDF-XChange
- Site Admin
- Posts: 10872
- Joined: Wed Jan 03, 2018 6:52 pm
Re: Viewing multiple documents with synchronize pan and zoom?
Hello, Mathew
Thank you for the update, I have just heard from the Dev team that this is a project we are finally looking into the implementation of. As you have found in your own creation/use of this, it will likely need a number of configuration options for various methods of use, so I cannot offer a timeline, but we do have a ticket for it (Finally)!
#7359: FR: "Synchronized split view" mode
Kind regards,
Thank you for the update, I have just heard from the Dev team that this is a project we are finally looking into the implementation of. As you have found in your own creation/use of this, it will likely need a number of configuration options for various methods of use, so I cannot offer a timeline, but we do have a ticket for it (Finally)!
#7359: FR: "Synchronized split view" mode
Kind regards,
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
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
Re: Viewing multiple documents with synchronize pan and zoom?

Here's an incremental update that is working much better for me.
- Stefan - PDF-XChange
- Site Admin
- Posts: 19780
- Joined: Mon Jan 12, 2009 8:07 am
- Contact:
Re: Viewing multiple documents with synchronize pan and zoom?
Hello Mathew,
Thanks for the update! I've downloaded and tested it briefly, and it does seem to work well for me!
Kind regards,
Stefan
Thanks for the update! I've downloaded and tested it briefly, and it does seem to work well for me!
Kind regards,
Stefan
-
- User
- Posts: 15
- Joined: Thu Jan 19, 2023 11:45 am
Re: Viewing multiple documents with synchronize pan and zoom?
Tested 0.61, no drift issues found.
Hope to add a mutually exclusive single option.
Hope to add a mutually exclusive single option.
- Stefan - PDF-XChange
- Site Admin
- Posts: 19780
- Joined: Mon Jan 12, 2009 8:07 am
- Contact:
Re: Viewing multiple documents with synchronize pan and zoom?
Good timing! I just made a new version that adds quite a few options. I added the horizontal split. Please let me know if you see problems. viewtopic.php?p=191507#p191507softschool wrote: ↑Sat Mar 15, 2025 4:31 am Tested 0.61, no drift issues found.
Hope to add a mutually exclusive single option.
无标题.png
Also if you can fix the translation too, that would be fantastic.
- Daniel - PDF-XChange
- Site Admin
- Posts: 10872
- Joined: Wed Jan 03, 2018 6:52 pm
Viewing multiple documents with synchronize pan and zoom?

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