Editing pages and documents
Let users edit page text and organise pages (insert, merge, rotate, duplicate, extract, delete, reorder) in an Electron window with NexPDF.
License module
Page and content editing, including inserting pictures as pages, needs the editor module (Startup
tier and above).
Edit text: the Edit mode
The Edit mode (content) edits the text in the page itself. The user clicks an outlined text
block to edit it in place; the original font is kept when it has every character, otherwise the
closest standard font is used. Add text places a new text box by dragging on the page. Images on
the page can be moved, resized, replaced and deleted.
Organise pages: the Pages mode
The Pages mode (pages) shows every page as a thumbnail. The user selects pages (Ctrl or
Command-click to add, Shift-click for a range) and uses:
| Tool | What it does |
|---|---|
| Insert blank | Adds a blank page |
| Merge PDF | Appends the pages of another PDF |
| Insert image | Adds a picture as a page |
| Page labels | Sets the page numbering styles; see Document structure |
| Rotate left, Rotate right | Rotates the selected pages |
| Duplicate | Copies the selected pages |
| Extract | Saves the selected pages as a new PDF |
| Delete | Deletes the selected pages |
| Reverse | Reverses the page order |
| Optimize | Removes unused objects and recompresses streams; see Compare and optimise |
| Background | Sets a page background colour or picture |
Offer only some modes
{ "modeConfig": { "availableModes": ["viewer", "content", "pages"] } }Pass the configuration as the path of a JSON file; see
Viewing pages. To hide the page editor
completely, leave content and pages out, or set modeConfig.readOnly.
Keep the result
pdf.save(path) writes the edited document and pdf.bytes() returns it as a Buffer. To edit
pages in code, use the document API
(openDocumentFile, then the calls of the Node.js SDK).
Related
- Document structure: document properties, bookmarks, page labels, layers and attachments
- Compare and optimise: compare versions and make files smaller