usePageMove
Returns functions that move pages to a new position, such as for a drag-to-reorder sidebar.
const { moveAfter, moveBefore } = usePageMove()
moveAfter(pageIdOrPageIds, afterPageId?)
moveBefore(pageIdOrPageIds, beforePageId?)moveAfterinserts the pages afterafterPageId; without it, at the end of the document.moveBeforeinserts the pages beforebeforePageId; without it, at the start of the document.- Several pages move together in the given order, as a single undo step.
- Every id must identify an existing page, or the call throws
InvalidInputError; with no document loaded, it throwsDocumentNotLoadedError.
Example
import { usePageMove } from '@sdk-pdf/react'
function useMovePageToStart() {
const { moveBefore } = usePageMove()
return (pageId: string) => moveBefore(pageId)
}