Skip to content

Commit 13d2f41

Browse files
995120: UG Documentation for Extract Pages in Page Organizer
1 parent 79cb2aa commit 13d2f41

File tree

6 files changed

+117
-0
lines changed

6 files changed

+117
-0
lines changed

Document-Processing-toc.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,6 +1427,7 @@
14271427
<li><a href="/document-processing/pdf/pdf-viewer/javascript-es6/organize-pages/programmatic-support">Programmatic Support</a></li>
14281428
<li><a href="/document-processing/pdf/pdf-viewer/javascript-es6/organize-pages/ui-interactions">UI Interactions</a></li>
14291429
<li><a href="/document-processing/pdf/pdf-viewer/javascript-es6/organize-pages/toolbar">Toolbar</a></li>
1430+
<li><a href="/document-processing/pdf/pdf-viewer/javascript-es6/organize-pages/extract-pages">Extract Pages</a></li>
14301431
<li><a href="/document-processing/pdf/pdf-viewer/javascript-es6/organize-pages/mobile-view">Mobile View</a></li>
14311432
<li><a href="/document-processing/pdf/pdf-viewer/javascript-es6/organize-pages/events">Events</a></li>
14321433
</ul>
263 KB
Loading
260 KB
Loading
262 KB
Loading
285 KB
Loading
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
layout: post
3+
title: Extract Pages in TypeScript PDF Viewer | Syncfusion
4+
description: Learn here all about Extract Pages in Organize Pages in Syncfusion TypeScript PDF Viewer control of Syncfusion Essential JS 2 and more.
5+
platform: document-processing
6+
control: PDF Viewer
7+
documentation: ug
8+
domainurl: ##DomainURL##
9+
---
10+
11+
# Extract pages in TypeScript PDF Viewer
12+
13+
The PDF Viewer component lets you extract pages from a document using the Extract Pages option in the Organize Pages UI, and also control extraction programmatically.
14+
The Extract Pages tool is available by default in Organize Pages.
15+
16+
## Extract Pages in Organize Pages
17+
18+
- Open the Organize Pages panel in the PDF Viewer toolbar.
19+
- Locate and click the Extract Pages option.
20+
21+
![Extract Pages](../images/extract-page.png)
22+
23+
When selected, a secondary toolbar dedicated to extraction is displayed.
24+
25+
![Extract Pages secondary toolbar](../images/extract-page-secondary-toolbar.png)
26+
27+
## Extract pages using the UI
28+
29+
You can extract by typing page numbers/ranges or by selecting thumbnails.
30+
31+
1. Click Extract Pages in the Organize Pages panel.
32+
2. In the input box, enter the pages to extract. Supported formats include:
33+
- Single pages: 1,3,5
34+
- Ranges: 2-6
35+
- Combinations: 1,4,7-9
36+
3. Alternatively, select the page thumbnails you want instead of typing values.
37+
4. Click Extract to download the extracted pages as a new PDF. Click Cancel to close the tool.
38+
39+
![Extract Pages with selected thumbnails](../images/extract-page-selected-thumbnail.png)
40+
41+
N> Page numbers are 1-based (first page is 1). You can start anywhere—enter single pages or ranges like 2-3, 5, or 7-9. Invalid or out-of-range entries are ignored.
42+
43+
## Extraction options (checkboxes)
44+
45+
Two options appear in the secondary toolbar:
46+
47+
- **Delete Pages After Extracting:**
48+
- When enabled, the selected/entered pages are removed from the document opened in the viewer after the extraction completes. The extracted pages are still downloaded as a new file.
49+
- Example: If you enter 1,2 and extract, a PDF containing pages 1 and 2 is downloaded, and pages 1 and 2 are removed from the currently loaded document in the viewer.
50+
51+
- **Extract Pages As Separate Files:**
52+
- When enabled, every selected page is exported as an individual PDF file.
53+
- Example: If you select pages 3, 5, and 6, three separate PDFs are downloaded (3.pdf, 5.pdf, and 6.pdf). If you enter a range (e.g., 2-4), pages 2, 3, and 4 are each downloaded as separate PDFs.
54+
55+
![Checkboxes for extract options](../images/extract-page-checkboxes.png)
56+
57+
## Programmatic options and APIs
58+
59+
You can control the Extract Pages experience via settings and invoke extraction through code.
60+
61+
### Enable/disable Extract Pages
62+
63+
Use the `canExtractPages` API to enable or disable the Extract Pages option. When set to `false`, the Extract Pages tool is disabled in the toolbar. The default value is `true`.
64+
65+
Use the following code snippet to enable or disable the Extract Pages option:
66+
67+
```ts
68+
// Enable the Extract Pages Tool
69+
viewer.pageOrganizerSettings = { canExtractPages: true };
70+
```
71+
72+
```ts
73+
// Disable the Extract Pages Tool
74+
viewer.pageOrganizerSettings = { canExtractPages: false };
75+
```
76+
77+
Use the `showExtractPagesOption` API to show or hide the Extract Pages option. When set to `false`, the Extract Pages tool is removed from the toolbar. The default value is `true`.
78+
79+
Use the following code snippet to remove the Extract Pages option:
80+
```ts
81+
// Remove the Extract Pages option entirely from the UI (redacted example as provided)
82+
viewer.pageOrganizerSettings = { showExtractPagesOption: false }
83+
```
84+
85+
### Extract pages and load the result programmatically
86+
87+
You can extract pages programmatically using the `extractPages` method.
88+
The following example extracts pages 1 and 2, then immediately loads the extracted pages back into the viewer. The returned value is a byte array (e.g., Uint8Array) representing the PDF file contents.
89+
90+
```html
91+
<button id="extractPage">Extract Pages</button>
92+
```
93+
94+
```ts
95+
document.getElementById('extractPage').addEventListener('click', function () {
96+
// Extract pages 1 and 2
97+
var array = viewer.extractPages("1,2");
98+
99+
// Load the extracted pages back into the viewer
100+
viewer.load(array);
101+
102+
// Inspect the result if needed
103+
console.log(array);
104+
});
105+
```
106+
107+
[View sample in GitHub](https://github.com/SyncfusionExamples/typescript-pdf-viewer-examples/tree/master/How%20to)
108+
109+
## See also
110+
111+
- [Overview](../overview)
112+
- [UI interactions](../ui-interactions)
113+
- [Programmatic support](../programmatic-support)
114+
- [Toolbar](../toolbar)
115+
- [Events](../events)
116+
- [Mobile view](../mobile-view)

0 commit comments

Comments
 (0)