How Do I Rotate a Page?
To rotate a page in a document, use the [DocumentOperation
][] API. For example, if you want to rotate the first page of your document 90 degrees clockwise, use the following code:
// Rotate the first page of the document 90 degrees clockwise. instance.applyOperations([ { type: "rotatePages", pageIndexes: [0], rotateBy: 90 } ]); <!-- prettier-ignore-start --> <blockquote class="pEb pGb" > <img class="pKb" src="/assets/images/icons/infoLightBg.svg" alt="Information"> <p class="pNb"> This requires the Document Editing component. </p> </blockquote> <!-- prettier-ignore-end --> [`documentoperation`]: https://pspdfkit.com/api/web/PSPDFKit.DocumentOperation.html [customer portal]: https://my.pspdfkit.com [pspdfkit portal]: https://my.pspdfkit.com [pspdfkit support]: https://pspdfkit.com/support/request [pspdfkit instant]: https://pspdfkit.com/instant [blog]: https://pspdfkit.com/blog/ [twitter]: https://twitter.com/PSPDFKit [pspdfkit trial]: https://pspdfkit.com/try/ [asm.js]: http://asmjs.org/faq.html [webassembly]: http://webassembly.org/ [`layoutmode.auto`]: https://pspdfkit.com/api/web/PSPDFKit.html#.LayoutMode [`layoutmode.double`]: https://pspdfkit.com/api/web/PSPDFKit.html#.LayoutMode [`layoutmode.single`]: https://pspdfkit.com/api/web/PSPDFKit.html#.LayoutMode [`scrollmode.continuous`]: https://pspdfkit.com/api/web/PSPDFKit.html#.ScrollMode [`scrollmode.per_spread`]: https://pspdfkit.com/api/web/PSPDFKit.html#.ScrollMode [`viewstate#keepfirstspreadassinglepage`]: https://pspdfkit.com/api/web/PSPDFKit.ViewState.html#keepFirstSpreadAsSinglePage [`viewstate#layoutmode`]: https://pspdfkit.com/api/web/PSPDFKit.ViewState.html#layoutMode [`viewstate#pagespacing`]: https://pspdfkit.com/api/web/PSPDFKit.ViewState.html#pageSpacing [`viewstate#scrollmode`]: https://pspdfkit.com/api/web/PSPDFKit.ViewState.html#scrollMode [`viewstate#spreadspacing`]: https://pspdfkit.com/api/web/PSPDFKit.ViewState.html#spreadSpacing [`viewstate#sidebarmode`]: https://pspdfkit.com/api/web/PSPDFKit.ViewState.html#sidebarMode [`viewstate#viewmode`]: https://pspdfkit.com/api/web/PSPDFKit.ViewState.html#viewMode [`viewstate#formdesignmode`]: https://pspdfkit.com/api/web/PSPDFKit.ViewState.html#formDesignMode [`viewstate`]: https://pspdfkit.com/api/web/PSPDFKit.ViewState.html [`zoommode.fit_to_viewport`]: https://pspdfkit.com/api/web/PSPDFKit.html#.ZoomMode [`zoommode.fit_to_width`]: https://pspdfkit.com/api/web/PSPDFKit.html#.ZoomMode [`zoommode.page_fit`]: https://pspdfkit.com/api/web/PSPDFKit.html#.ZoomMode [`zoommode.page_width`]: https://pspdfkit.com/api/web/PSPDFKit.html#.ZoomMode [`instance#create`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#create [`instance.create`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#create [`instance#update`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#update [`instance.update`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#update [`instance.update()`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#update [`instance#delete`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#delete [`instance.delete`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#delete [`instance.delete()`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#delete [`instance#save`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#save [`instance.save`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#save [`instance#ensurechangessaved`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#ensureChangesSaved [`instance.ensurechangessaved`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#ensureChangesSaved [`instance#hasunsavedchanges`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#hasUnsavedChanges [`instance.hasunsavedchanges`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#hasUnsavedChanges [`instance.exportpdf()`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#exportPDF [`instance#exportpdf()`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#exportPDF [`pspdfkit.sidebarmode`]: https://pspdfkit.com/api/web/PSPDFKit.html#.SidebarMode [`instance#setviewstate`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#setViewState [`pspdfkit.load()`]: https://pspdfkit.com/api/web/PSPDFKit.html#.load [`pspdfkit.viewstate`]: https://pspdfkit.com/api/web/PSPDFKit.ViewState.html [`pspdfkit.configuration`]: https://pspdfkit.com/api/web/PSPDFKit.Configuration.html [`pspdfkit.configuration#initialviewstate`]: https://pspdfkit.com/api/web/PSPDFKit.Configuration.html#initialViewState [`pspdfkit.configuration.initialviewstate`]: https://pspdfkit.com/api/web/PSPDFKit.Configuration.html#initialViewState [`instance#createattachment`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#createAttachment [`instance#getattachment`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#getAttachment [`instance#addeventlistener`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#addEventListener [`pspdfkit.viewstate#sidebarplacement`]: https://pspdfkit.com/api/web/PSPDFKit.ViewState.html#sidebarPlacement [`pspdfkit.viewstate#zoom`]: https://pspdfkit.com/api/web/PSPDFKit.ViewState.html#zoom [`instance.currentzoomlevel`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#currentZoomLevel [`instance.minimumzoomlevel`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#minimumZoomLevel [`instance.maximumzoomlevel`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#maximumZoomLevel [`pspdfkit.viewstate#zoomin()`]: https://pspdfkit.com/api/web/PSPDFKit.ViewState.html#zoomIn [`pspdfkit.viewstate#zoomout()`]: https://pspdfkit.com/api/web/PSPDFKit.ViewState.html#zoomOut [`instance.jumpandzoomtorect()`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#jumpAndZoomToRect [`pspdfkit.zoommode`]: https://pspdfkit.com/api/web/PSPDFKit.html#.ZoomMode [`instance.settoolbaritems()`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#setToolbarItems [`viewstate#showtoolbar`]: https://pspdfkit.com/api/web/PSPDFKit.ViewState.html#showToolbar [`instance.setviewstate()`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#setViewState [`pspdfkit.toolbaritem`]: https://pspdfkit.com/api/web/PSPDFKit.ToolbarItem.html [`pspdfkit.defaulttoolbaritems`]: https://pspdfkit.com/api/web/PSPDFKit.html#.defaultToolbarItems [`pspdfkit.toolbaritem#responsivegroup`]: https://pspdfkit.com/api/web/PSPDFKit.ToolbarItem.html#responsiveGroup [`pspdfkit.toolbaritem#dropdowngroup`]: https://pspdfkit.com/api/web/PSPDFKit.ToolbarItem.html#dropdownGroup [`PSPDFKit.ViewState#zoom`]: https://pspdfkit.com/api/web/PSPDFKit.ViewState.html#zoom [`instance.currentZoomLevel`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#currentZoomLevel [`instance.minimumZoomLevel`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#minimumZoomLevel [`instance.maximumZoomLevel`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#maximumZoomLevel [`PSPDFKit.ViewState#zoomIn()`]: https://pspdfkit.com/api/web/PSPDFKit.ViewState.html#zoomIn [`PSPDFKit.ViewState#zoomOut()`]: https://pspdfkit.com/api/web/PSPDFKit.ViewState.html#zoomOut [`instance.jumpAndZoomToRect()`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#jumpAndZoomToRect [`PSPDFKit.ZoomMode`]: https://pspdfkit.com/api/web/PSPDFKit.html#.ZoomMode [`PSPDFKit.ViewState.showSignatureValidationStatus`]: https://pspdfkit.com/api/web/PSPDFKit.ViewState.html#showSignatureValidationStatus [`instance.exportPDFWithOperations()`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#exportPDFWithOperations [`instance.renderPageAsImageURL()`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#renderPageAsImageURL [`instance.exportXFDF`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#exportXFDF [`instance#exportXFDF`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#exportXFDF [`pspdfkit.autosavemode`]: https://pspdfkit.com/api/web/PSPDFKit.html#.AutoSaveMode [`PSPDFKit.Configuration#instantJSON`]: https://pspdfkit.com/api/web/PSPDFKit.Configuration.html#instantJSON [`instance.applyOperations()`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#applyOperations [`PSPDFKit.Annotations.fromSerializableObject()`]: https://pspdfkit.com/api/web/PSPDFKit.Annotations.html#.fromSerializableObject [`PSPDFKit.Annotations.toSerializableObject()`]: https://pspdfkit.com/api/web/PSPDFKit.Annotations.html#.toSerializableObject [`instance.exportInstantJSON()`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#exportInstantJSON [`instance.save()`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#save [`Instance#pageInfoForIndex`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#pageInfoForIndex [`PSPDFKit.PageInfo`]: https://pspdfkit.com/api/web/PSPDFKit.PageInfo.html [`Instance#textLinesForPageIndex`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#textLinesForPageIndex [`PSPDFKit.Immutable.List`]: https://pspdfkit.com/api/web/PSPDFKit.Immutable.List.html [`PSPDFKit.TextLine`]: https://pspdfkit.com/api/web/PSPDFKit.TextLine.html [`Instance#getFormFields`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#getFormFields [`Instance#getFormFieldValues`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#getFormFieldValues [`Instance#getMarkupAnnotationText`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#getMarkupAnnotationText [`Instance#getTextFromRects`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#getTextFromRects [`Instancel#getBookmarks`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#getBookmarks [`Instance#getSignaturesInfo`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#getSignaturesInfo [`PSPDFKit.SignaturesInfo`]: https://pspdfkit.com/api/web/PSPDFKit.SignaturesInfo.html [`PSPDFKit.SignatureInfo`]: https://pspdfkit.com/api/web/PSPDFKit.SignatureInfo.html [`Instance.applyOperations`]: https://pspdfkit.com/api/web/PSPDFKit.Instance.html#applyOperations