Want to implement the compare sync functionality of side-by-side default on opening the side-by-side

Product: Web viewer

Product Version: 10.12.0

Please give a brief summary of your issue:Want to implement the compare sync functionality of side-by-side default on opening the side-by-side. I also tried setMultiViewerSyncScrollingMode but not working.
(Think of this as an email subject)

const setupSideBySideCompare = async (instance, selectedFile) => {
if (isLayover) {
await loadDocumentWithCleanup(instance, fileUrl);
}
isSideBySide = true;
Apryse.disableUIElements(instance);
UI.enableFeatures([UI.Feature.MultiViewerMode]);
const [documentViewer1, documentViewer2] = instance.Core.getDocumentViewers();
documentViewer2.loadDocument(selectedFile);
instance.UI.setHeaderItems((header) => {
const defaultHeader = header.headers?.default;
const updatedHeader = defaultHeader.filter(
(item) => ![‘Compare’, ‘Save’, ‘Side-by-Side’].includes(item.title)
);
header.headers.default = updatedHeader;
});
instance.UI.setMultiViewerSyncScrollingMode(‘SYNC’);
const startCompare = async () => {
const doc1 = documentViewer1.getDocument();
const doc2 = documentViewer2.getDocument();
if (doc1 && doc2) {
const beforeColor = new Color(21, 205, 131, 0.4);
const afterColor = new Color(255, 73, 73, 0.4);
const options = { beforeColor, afterColor };
await documentViewer1.startSemanticDiff(documentViewer2, options);
}
};

documentViewer1.addEventListener('documentLoaded', startCompare);
documentViewer2.addEventListener('documentLoaded', startCompare);

};

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)

Please provide a link to a minimal sample where the issue is reproducible:

1 Like

Hello, I’m AiRon, an automated tech support bot :robot:
While you wait for one of our customer support representatives, I can help you with your question.


It seems like you’re trying to set up a side-by-side comparison with synchronized scrolling in Apryse’s WebViewer but encountering difficulties, particularly with the setMultiViewerSyncScrollingMode function. Let’s walk through the setup to ensure all necessary steps are covered.

Some things you can try:

  • Ensure that the Multi-Viewer Mode is enabled using UI.enableFeatures([UI.Feature.MultiViewerMode]).

  • Verify that both DocumentViewers are correctly initialized and loading the documents as expected.

  • Ensure that setMultiViewerSyncScrollingMode('SYNC') is called after both documents are loaded into the viewers.

  • Check if the synchronization mode is correctly set to SYNC by confirming through debugging or console logging.

  • Make sure the documents are loaded completely before attempting to start the semantic comparison.



Here are some resources that might help you:


Hopefully, this helps you solve your problem while you wait for a human to get back to you.

1 Like

Hi there,

The usage of the setMultiViewerSyncScrollingMode API is to change how the sync behaviour works, when you click on the sync button:
https://sdk.apryse.com/api/web/UI.html#.setMultiViewerSyncScrollingMode

What you are looking for should be the enableMultiViewerSync API:
https://sdk.apryse.com/api/web/UI.html#.enableMultiViewerSync__anchor

Best regards,
Kevin

1 Like