DynaPDF.SetOrientationEx
------------------------

Changes the orientation of the page.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [DynaPDF](component_DynaPDF.md) | [3.5](newinversion35.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "DynaPDF.SetOrientationEx"; PDF; Value ) 

**MBS**( **"DynaPDF.SetOrientationEx";** /\* Changes the orientation of the page. \*/  
**$PDF**; /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/   
**$Value**) /\* The new roatation value. From -360 to 360 in 90 degree steps.e.g. 90 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $pdf |
| Value | The new roatation value. From -360 to 360 in 90 degree steps. | 90 |

### Result

Returns OK or error message.

### Description

Changes the orientation of the page.  
The function changes the orientation of a page, incl. important page properties such as the width and height, and the coordinate system. The parameter Value must be a multiple of 90 or 0. Positive values rotate the page clockwise, negative values counter clockwise.  
The zero point of the coordinate system is set to the upper left or down left point depending on the current page coordinate system (top down or bottom up).  
When using a landscape paper format the functions [DynaPDF.GetPageWidth](DynaPDFGetPageWidth.md) and [DynaPDF.GetPageHeight](DynaPDFGetPageHeight.md) return the logical width and height of the page. While the real paper format is not changed the functions return the paper format as if the page would have a landscape paper format (the width and height are exchanged).  
The coordinate system is also changed so that you can work with the page as if it were not rotated. Form fields and annotations are automatically rotated with the page; there is no need to rotate them manually.  
Pages which are rotated with this function appear in a viewer application always in the right orientation. Also if the page is rotated, e.g. by 180 degrees the page is shown as if it were not rotated.  
Notice:  
Since landscape or rotated paper formats require a changed coordinate system, care must be taken into account if further coordinate transformations must be applied. DynaPDF makes sure that one transformation can be applied without causing errors, e.g. rotating or translating the coordinate system, but coordinate transformations must not be nested.  
See also [DynaPDF.SetOrientation](DynaPDFSetOrientation.md).  
See also [SetOrientationEx](https://www.monkeybreadsoftware.com/DynaPDF-Manual/SetOrientationEx.shtml) function in DynaPDF manual.

### Examples

Rotate page 1 of current PDF:

 Set Variable \[$r ; Value:MBS ("[DynaPDF.EditPage](DynaPDFEditPage.md)"; $pdf ; 1)\]  
Set Variable \[$r ; Value:MBS ("DynaPDF.SetOrientationEx"; $pdf ; 180)\]  
Set Variable \[$r ; Value:MBS ("[DynaPDF.EndPage](DynaPDFEndPage.md)"; $pdf )\]  
Rotate a PDF to 90°:

 Let (\[   
\# start new PDF   
PDF = MBS ("[DynaPDF.New](DynaPDFNew.md)");  
\# read in existing PDF   
OpenResult = MBS ("[DynaPDF.OpenPDFFromContainer](DynaPDFOpenPDFFromContainer.md)"; PDF; Test::InputPDF );  
OpenError = MBS ("IsError");  
ImportResult = MBS ("[DynaPDF.ImportPDFFile](DynaPDFImportPDFFile.md)"; PDF );  
ImportError = MBS ("IsError");  
  
\# edit page and rotate   
r = MBS ("[DynaPDF.EditPage](DynaPDFEditPage.md)"; PDF; 1) ;  
r = MBS ("DynaPDF.SetOrientationEx"; PDF; 90) ;  
r = MBS ("[DynaPDF.EndPage](DynaPDFEndPage.md)"; PDF) ;  
  
\# save PDF   
OutputPDF = MBS ("[DynaPDF.Save](DynaPDFSave.md)"; PDF; GetAsText(Test::InputPDF ));  
SaveError = MBS ("IsError");  
ReleaseError = MBS ("[DynaPDF.Release](DynaPDFRelease.md)"; PDF);  
  
Result = If(   
 // all okay?  
 OpenError = 0 and ImportError = 0 and /\*rotateError = 0 UND\*/ SaveError = 0 and MBS ( "[Container.GetSize](ContainerGetSize.md)"; OutputPDF; "PDF " ) &gt; 0;   
 // than return new PDF  
 OutputPDF;  
 // return old PDF  
 Test::InputPDF )  
   
\];  
result )  
Rotate coordinate system as needed:

 Set Variable \[ $r ; Value:MBS ("DynaPDF.SetOrientationEx"; $pdf ; MBS ("[DynaPDF.GetOrientation](DynaPDFGetOrientation.md)"; $pdf )) \]  
Import a PDF and rotate first page:

 Set Variable \[ $pdf ; Value: MBS ( "[DynaPDF.New](DynaPDFNew.md)" ) \]  
\# import PDF   
Set Variable \[ $r ; Value: MBS ( "[DynaPDF.OpenPDFFromContainer](DynaPDFOpenPDFFromContainer.md)" ; $pdf ; Render Page::Input PDF ) \]  
Set Variable \[ $rotation ; Value: MBS ( "[DynaPDF.ImportPDFFile](DynaPDFImportPDFFile.md)" ; $pdf ) \]  
\# now rotate page 1   
Set Variable \[ $r ; Value: MBS ("[DynaPDF.EditPage](DynaPDFEditPage.md)"; $pdf ; 1 ) \]  
Set Variable \[ $angle ; Value: MBS ("[DynaPDF.GetOrientation](DynaPDFGetOrientation.md)"; $pdf ) \]  
Set Variable \[ $r ; Value: MBS ("DynaPDF.SetOrientationEx"; $pdf ; $angle + 90) \]  
Set Variable \[ $r ; Value: MBS ( "[DynaPDF.EndPage](DynaPDFEndPage.md)" ; $pdf ) \]  
\# now save   
Set Field \[ Render Page::Output Image ; MBS ( "[DynaPDF.Save](DynaPDFSave.md)" ; $pdf ; "out.pdf" ) \]  
Set Variable \[ $r ; Value: MBS ( "[DynaPDF.Release](DynaPDFRelease.md)" ; $pdf ) \]  
### See also

- [DynaPDF.EndPage](DynaPDFEndPage.md)
- [DynaPDF.GetPageHeight](DynaPDFGetPageHeight.md)
- [DynaPDF.GetPageWidth](DynaPDFGetPageWidth.md)
- [DynaPDF.New](DynaPDFNew.md)
- [DynaPDF.OpenPDFFromContainer](DynaPDFOpenPDFFromContainer.md)
- [DynaPDF.RotateTemplate](DynaPDFRotateTemplate.md)
- [DynaPDF.Save](DynaPDFSave.md)
- [DynaPDF.SetFieldOrientation](DynaPDFSetFieldOrientation.md)
- [DynaPDF.SetOrientation](DynaPDFSetOrientation.md)
- [IsError](IsError.md)

### Example Databases

- [DynaPDF/Find and Replace Text](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Find%20and%20Replace%20Text.shtml#9ScriptAnchor_)

### Blog Entries

- [Retract text from a PDF with DynaPDF](https://www.mbsplugins.de/archive/2025-11-01/Retract_text_from_a_PDF_with_D/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 26th April 2026

  
[DynaPDF.SetOrientation](DynaPDFSetOrientation.md) - [DynaPDF.SetPDFVersion](DynaPDFSetPDFVersion.md)

[HTML Version](DynaPDFSetOrientationEx.shtml)