Section:

Removing pages from PDF using JavaScript

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

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

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales