PDFKit.SetPDFPageRotation
-------------------------

Sets the rotation angle for the page in degrees.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [PDFKit](component_PDFKit.md) | [2.9](newinversion29.md) | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ✅ Yes |

MBS( "PDFKit.SetPDFPageRotation"; PDF; Index; Rotation ) 

**MBS**( **"PDFKit.SetPDFPageRotation";** /\* Sets the rotation angle for the page in degrees. \*/  
**$PDF**; /\* A container value with the PDF content from a media field. Or a text with an URL. Or a PDF reference from [PDFKit.Open](PDFKitOpen.md). \*/   
**$Index**; /\* The index of the page. From zero to [PDFKit.GetPDFPageCount](PDFKitGetPDFPageCount.md)-1.e.g. 1 \*/   
**$Rotation**) /\* The new rotation value.e.g. 90 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| PDF | A container value with the PDF content from a media field. Or a text with an URL. Or a PDF reference from [PDFKit.Open](PDFKitOpen.md). |  |
| Index | The index of the page. From zero to [PDFKit.GetPDFPageCount](PDFKitGetPDFPageCount.md)-1. | 1 |
| Rotation | The new rotation value. | 90 |

### Result

Returns OK on success.

### Description

Sets the rotation angle for the page in degrees.  
The rotation must be a positive or negative multiple of 90 (negative angles are converted to their positive equivalents; for example, -90 is changed to 270).  
  
Your changes are only done in memory, so please remember to write modified pdf back to disk, e.g. by using [PDFKit.WriteToPath](PDFKitWriteToPath.md). Or use [PDFKit.GetPDFDocument](PDFKitGetPDFDocument.md) to get a PDF for storing in a container.  
### Examples

Rotate page and set title:

 # open PDF from container   
Set Variable \[$ref ; Value:MBS ("[PDFKit.OpenContainer](PDFKitOpenContainer.md)"; combine pdf::result )\]  
\# Set title for PDF   
Set Variable \[$result ; Value:MBS ("[PDFKit.SetPDFAttribute](PDFKitSetPDFAttribute.md)"; $ref ; "Title"; combine pdf::title )\]  
\# Rotate first page by 90°   
Set Variable \[$result ; Value:MBS ("PDFKit.SetPDFPageRotation"; $ref ; 0; 90)\]  
\# save document to container   
Set Field \[combine pdf::result ; MBS ("[PDFKit.GetPDFDocument](PDFKitGetPDFDocument.md)"; $ref ; "result.pdf")\]  
\# free memory   
Set Variable \[$result ; Value:MBS ("[PDFKit.Release](PDFKitRelease.md)"; $ref )\]  
### See also

- [PDFKit.GetPDFDocument](PDFKitGetPDFDocument.md)
- [PDFKit.GetPDFPageCount](PDFKitGetPDFPageCount.md)
- [PDFKit.GetPDFPageRotation](PDFKitGetPDFPageRotation.md)
- [PDFKit.Open](PDFKitOpen.md)
- [PDFKit.OpenContainer](PDFKitOpenContainer.md)
- [PDFKit.Release](PDFKitRelease.md)
- [PDFKit.SetPDFAttribute](PDFKitSetPDFAttribute.md)
- [PDFKit.WriteToPath](PDFKitWriteToPath.md)

### FileMaker Magazin

- [Ausgabe 1/2026, Seite 29](https://filemaker-magazin.de/neuigkeit/4312-Die-neue-Ausgabe-FMM_202601-steht-online)

This function checks for a license.

Created 18th August 2014 , last changed 25th April 2016

  
[PDFKit.SetPDFPageDisplayAnnotation](PDFKitSetPDFPageDisplayAnnotation.md) - [PDFKit.SetPrintOption](PDFKitSetPrintOption.md)

[HTML Version](PDFKitSetPDFPageRotation.shtml)