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="p5b p8b"
>
<img class="p-b" src="/assets/images/icons/infoLightBg.svg" alt="Information">
<p class="pdc">
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]: /support/request
[pspdfkit instant]: /guides/web/instant-synchronization/
[blog]: /blog/
[twitter]: https://twitter.com/PSPDFKit
[pspdfkit trial]: /try


[asm.js]: http://asmjs.org/faq.html
[webassembly]: http://webassembly.org/
[`layoutmode.auto`]: /api/web/PSPDFKit.html#.LayoutMode
[`layoutmode.double`]: /api/web/PSPDFKit.html#.LayoutMode
[`layoutmode.single`]: /api/web/PSPDFKit.html#.LayoutMode
[`scrollmode.continuous`]: /api/web/PSPDFKit.html#.ScrollMode
[`scrollmode.per_spread`]: /api/web/PSPDFKit.html#.ScrollMode
[`viewstate#keepfirstspreadassinglepage`]: /api/web/PSPDFKit.ViewState.html#keepFirstSpreadAsSinglePage
[`viewstate#layoutmode`]: /api/web/PSPDFKit.ViewState.html#layoutMode
[`viewstate#pagespacing`]: /api/web/PSPDFKit.ViewState.html#pageSpacing
[`viewstate#scrollmode`]: /api/web/PSPDFKit.ViewState.html#scrollMode
[`viewstate#spreadspacing`]: /api/web/PSPDFKit.ViewState.html#spreadSpacing
[`viewstate#sidebarmode`]: /api/web/PSPDFKit.ViewState.html#sidebarMode
[`viewstate#viewmode`]: /api/web/PSPDFKit.ViewState.html#viewMode
[`viewstate#formdesignmode`]: /api/web/PSPDFKit.ViewState.html#formDesignMode
[`viewstate`]: /api/web/PSPDFKit.ViewState.html
[`zoommode.fit_to_viewport`]: /api/web/PSPDFKit.html#.ZoomMode
[`zoommode.fit_to_width`]: /api/web/PSPDFKit.html#.ZoomMode
[`zoommode.page_fit`]: /api/web/PSPDFKit.html#.ZoomMode
[`zoommode.page_width`]: /api/web/PSPDFKit.html#.ZoomMode
[`instance#create`]: /api/web/PSPDFKit.Instance.html#create
[`instance.create`]: /api/web/PSPDFKit.Instance.html#create
[`instance#update`]: /api/web/PSPDFKit.Instance.html#update
[`instance.update`]: /api/web/PSPDFKit.Instance.html#update
[`instance.update()`]: /api/web/PSPDFKit.Instance.html#update
[`instance#delete`]: /api/web/PSPDFKit.Instance.html#delete
[`instance.delete`]: /api/web/PSPDFKit.Instance.html#delete
[`instance.delete()`]: /api/web/PSPDFKit.Instance.html#delete
[`instance#save`]: /api/web/PSPDFKit.Instance.html#save
[`instance.save`]: /api/web/PSPDFKit.Instance.html#save
[`instance#ensurechangessaved`]: /api/web/PSPDFKit.Instance.html#ensureChangesSaved
[`instance.ensurechangessaved`]: /api/web/PSPDFKit.Instance.html#ensureChangesSaved
[`instance#hasunsavedchanges`]: /api/web/PSPDFKit.Instance.html#hasUnsavedChanges
[`instance.hasunsavedchanges`]: /api/web/PSPDFKit.Instance.html#hasUnsavedChanges
[`instance.exportpdf()`]: /api/web/PSPDFKit.Instance.html#exportPDF
[`instance#exportpdf()`]: /api/web/PSPDFKit.Instance.html#exportPDF
[`pspdfkit.sidebarmode`]: /api/web/PSPDFKit.html#.SidebarMode
[`instance#setviewstate`]: /api/web/PSPDFKit.Instance.html#setViewState
[`pspdfkit.load()`]: /api/web/PSPDFKit.html#.load
[`pspdfkit.viewstate`]: /api/web/PSPDFKit.ViewState.html
[`pspdfkit.configuration`]: /api/web/PSPDFKit.Configuration.html
[`pspdfkit.configuration#initialviewstate`]: /api/web/PSPDFKit.Configuration.html#initialViewState
[`pspdfkit.configuration.initialviewstate`]: /api/web/PSPDFKit.Configuration.html#initialViewState
[`instance#createattachment`]: /api/web/PSPDFKit.Instance.html#createAttachment
[`instance#getattachment`]: /api/web/PSPDFKit.Instance.html#getAttachment
[`instance#addeventlistener`]: /api/web/PSPDFKit.Instance.html#addEventListener
[`pspdfkit.viewstate#sidebarplacement`]: /api/web/PSPDFKit.ViewState.html#sidebarPlacement
[`pspdfkit.viewstate#zoom`]: /api/web/PSPDFKit.ViewState.html#zoom
[`instance.currentzoomlevel`]: /api/web/PSPDFKit.Instance.html#currentZoomLevel
[`instance.minimumzoomlevel`]: /api/web/PSPDFKit.Instance.html#minimumZoomLevel
[`instance.maximumzoomlevel`]: /api/web/PSPDFKit.Instance.html#maximumZoomLevel
[`pspdfkit.viewstate#zoomin()`]: /api/web/PSPDFKit.ViewState.html#zoomIn
[`pspdfkit.viewstate#zoomout()`]: /api/web/PSPDFKit.ViewState.html#zoomOut
[`instance.jumpandzoomtorect()`]: /api/web/PSPDFKit.Instance.html#jumpAndZoomToRect
[`pspdfkit.zoommode`]: /api/web/PSPDFKit.html#.ZoomMode
[`instance.settoolbaritems()`]: /api/web/PSPDFKit.Instance.html#setToolbarItems
[`viewstate#showtoolbar`]: /api/web/PSPDFKit.ViewState.html#showToolbar
[`instance.setviewstate()`]: /api/web/PSPDFKit.Instance.html#setViewState
[`pspdfkit.toolbaritem`]: /api/web/PSPDFKit.ToolbarItem.html
[`pspdfkit.defaulttoolbaritems`]: /api/web/PSPDFKit.html#.defaultToolbarItems
[`pspdfkit.toolbaritem#responsivegroup`]: /api/web/PSPDFKit.ToolbarItem.html#responsiveGroup
[`pspdfkit.toolbaritem#dropdowngroup`]: /api/web/PSPDFKit.ToolbarItem.html#dropdownGroup
[`pspdfkit.viewstate#zoom`]: /api/web/PSPDFKit.ViewState.html#zoom
[`instance.currentzoomlevel`]: /api/web/PSPDFKit.Instance.html#currentZoomLevel
[`instance.minimumzoomlevel`]: /api/web/PSPDFKit.Instance.html#minimumZoomLevel
[`instance.maximumzoomlevel`]: /api/web/PSPDFKit.Instance.html#maximumZoomLevel
[`pspdfkit.viewstate#zoomin()`]: /api/web/PSPDFKit.ViewState.html#zoomIn
[`pspdfkit.viewstate#zoomout()`]: /api/web/PSPDFKit.ViewState.html#zoomOut
[`instance.jumpandzoomtorect()`]: /api/web/PSPDFKit.Instance.html#jumpAndZoomToRect
[`pspdfkit.zoommode`]: /api/web/PSPDFKit.html#.ZoomMode
[`pspdfkit.viewstate.showsignaturevalidationstatus`]: /api/web/PSPDFKit.ViewState.html#showSignatureValidationStatus
[`instance.exportpdfwithoperations()`]: /api/web/PSPDFKit.Instance.html#exportPDFWithOperations
[`instance.renderpageasimageurl()`]: /api/web/PSPDFKit.Instance.html#renderPageAsImageURL
[`instance.exportxfdf`]: /api/web/PSPDFKit.Instance.html#exportXFDF
[`instance#exportxfdf`]: /api/web/PSPDFKit.Instance.html#exportXFDF
[`pspdfkit.autosavemode`]: /api/web/PSPDFKit.html#.AutoSaveMode
[`pspdfkit.configuration#instantjson`]: /api/web/PSPDFKit.Configuration.html#instantJSON
[`instance.applyoperations()`]: /api/web/PSPDFKit.Instance.html#applyOperations
[`pspdfkit.annotations.fromserializableobject()`]: /api/web/PSPDFKit.Annotations.html#.fromSerializableObject
[`pspdfkit.annotations.toserializableobject()`]: /api/web/PSPDFKit.Annotations.html#.toSerializableObject
[`instance.exportinstantjson()`]: /api/web/PSPDFKit.Instance.html#exportInstantJSON
[`instance.save()`]: /api/web/PSPDFKit.Instance.html#save
[`instance#pageinfoforindex`]: /api/web/PSPDFKit.Instance.html#pageInfoForIndex
[`pspdfkit.pageinfo`]: /api/web/PSPDFKit.PageInfo.html
[`instance#textlinesforpageindex`]: /api/web/PSPDFKit.Instance.html#textLinesForPageIndex
[`pspdfkit.immutable.list`]: /api/web/PSPDFKit.Immutable.List.html
[`pspdfkit.textline`]: /api/web/PSPDFKit.TextLine.html
[`instance#getformfields`]: /api/web/PSPDFKit.Instance.html#getFormFields
[`instance#getformfieldvalues`]: /api/web/PSPDFKit.Instance.html#getFormFieldValues
[`instance#getmarkupannotationtext`]: /api/web/PSPDFKit.Instance.html#getMarkupAnnotationText
[`instance#gettextfromrects`]: /api/web/PSPDFKit.Instance.html#getTextFromRects
[`instancel#getbookmarks`]: /api/web/PSPDFKit.Instance.html#getBookmarks
[`instance#getsignaturesinfo`]: /api/web/PSPDFKit.Instance.html#getSignaturesInfo
[`pspdfkit.signaturesinfo`]: /api/web/PSPDFKit.SignaturesInfo.html
[`pspdfkit.signatureinfo`]: /api/web/PSPDFKit.SignatureInfo.html
[`instance.applyoperations`]: /api/web/PSPDFKit.Instance.html#applyOperations