Display text comparison on 2 pages


I am using the Javascript Web Viewer and I would like to display my PDF comparison with pages displayed two by two, so that each page is next to its sibling and not under it.

Let’s say I have a PDF document which contains 5 pages. If I open my document directly using the “initialDoc” flag, it works fine, the displaying shows Page 1 and Page 2 next to each other, then 3 and 4, then 5. But if instead I try to compare two PDF files :

						await PDFNet.initialize();

						const newDoc = await PDFNet.PDFDoc.create();
						await newDoc.lock();

						const doc1 = await PDFNet.PDFDoc.createFromURL(url1);
						const doc2 = await PDFNet.PDFDoc.createFromURL(url2);
							await newDoc.appendTextDiffDoc(doc1, doc2);

						await newDoc.unlock();


The displaying changes, pages are displayed one under the other.

Any idea on how to fix that ? Thank you!

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:


Thank you for reporting this issue.

We will investigate and let you know when we have further information.


I just tried with your code, and it looks working fine for me with the ‘Page Layout’ set to ‘Double Page’. Please check the attached screenshot.



You are right, the layout was not set correctly. By setting the property

> instance.UI.setLayoutMode(instance.UI.LayoutMode.FacingContinuous);

it works fine.

Thank you!

No problem. Glad to know it works for you now.