Removing pages from PDF using JavaScript

Pages can be removed from the PDF document using the removePages function.

1WebViewer(...)
2 .then(instance => {
3 const { documentViewer } = instance.Core;
4
5 documentViewer.addEventListener('documentLoaded', async () => {
6 const doc = documentViewer.getDocument();
7 const page1 = 1, page2 = 2, page3 = 3;
8
9 documentViewer.getPageCount(); // 3
10
11 await doc.removePages([page2]);
12 documentViewer.getPageCount(); // 2
13 })
14 });

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales