Document Editing UI
The Document Editor is a PSPDFKit component that enables a whole host of document editing features. This includes new page creation, page duplication, copying and pasting, reordering, rotation, deletion, and the creation of new documents from a subset of selected pages.
This guide describes the built-in document editing user interface. If you would rather learn more about the document editing APIs, please check out the base Document Editor guide.
To switch into document editing mode, you need to invoke the Document Editor toolbar button, which is placed on the main navigation bar in thumbnail view mode by default.
Below you can see how to switch to thumbnail view mode.
Below you can see how to switch to the Document Editor view mode.
ℹ️ Note: The Document Editor button will automatically be hidden if document editing isn’t enabled in your license.
The Document Editor user interface is comprised of two main elements: the Document Editor toolbar, which is by default positioned on the very top, and the document view showing thumbnails of all pages in the document.
The Document Editor toolbar holds a set of buttons that can be used to perform document editing actions. Some of the buttons are context sensitive and are enabled only on demand based on factors such as the selection state in the document view. See the Actions section for a detailed description of all the actions you can perform with these buttons.
The toolbar can be moved to different positions onscreen using the drag handle on the right (or bottom) side of the toolbar.
The document view is a vertically scrollable grid that represents all pages in the edited document. Pages can be selected or deselected by single tapping the page thumbnail. It is possible to select more than one page at the same time. You can identify selected pages by paying attention to the checkmark symbol in the upper right corner.
Pages can also be rearranged. To do so, press and hold a page until it raises above the document view. Then simply move the page to a new position in the document.
In addition to the drag-and-drop action, which you can perform directly on the document view, there are many other actions you can perform using the Document Editor toolbar.
The following table lists all toolbar buttons:
|New||Shows the new page creation user interface|
|Remove||Removes the currently selected pages from the document|
|Duplicate||Creates copies of currently selected pages|
|Rotate||Rotates the selected page 90 degrees clockwise, and can be invoked multiple times|
|Export||Shows the export user interface that allows the selected pages to be saved as a new document|
|Select||Toggles between selecting and deselecting all pages|
|Copy||Puts the selected pages in the clipboard|
|Paste||Pastes pages from the clipboard, inserting them at the selected location or end of the document|
|Undo||Undoes the last document editing action|
|Redo||Redoes the last undone document editing action|
|Done||Exits document editing, prompting to save changes if needed|
The first toolbar button allows you to create new pages, which are inserted at the end of the document.
You can configure several properties for new pages, including the background, background color, and size. The page background can be blank, one of the predefined patterns, or a custom image from your Photo Library. The Page Color selector includes both a set of common colors and a full color picker to select any color you desire. To switch between the two selection modes, simply swipe left or right when picking colors. The page size can be either one of the standard paper sizes or a size that matches the main page size of the current document. You can also opt for the new page to be oriented vertically or horizontally.
The export toolbar action allows you to create a new document comprised of the pages selected in the document view. This action does not modify the current document in any way. When selected, you will be presented with a dialog where you can name the new PDF file and optionally select its location.
Document editing changes are not persisted until an explicit save is performed. This means you can easily exit your document editing session without modifying the document by selecting Done and opting to Discard Changes.
If you want to save your changes, you generally have two options. You can save the changes to the existing document by selecting Save, or you can save the changes to a new file using Save As… The Save option might not be available for some types of documents (e.g. read-only documents). In that case, only the Save As… option will be displayed.
If you decide to save the changes as a new document, you can select Save As…, and a new dialog will be displayed. This will allow you to name the new document and optionally select its location. Selecting Save will complete the save and create the new PDF file.
The Document Editor can also be used in a tabbed PSPDFKit UI. To enter document editing, simply follow the instructions in the Entering Document Editing Mode section. Once in document editing mode, all open documents will be available for document editing and accessible by switching pages. This feature is especially powerful when combined with the copy and paste actions, which allow you to copy pages across edited documents.
ℹ️ Note: The Document Editor will ask you to preserve your changes before switching tabs.