DynaPDF.MovePage
----------------

The function moves a page to another position in the document.

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

MBS( "DynaPDF.MovePage"; PDF; SourcePage; DestPage ) 

**MBS**( **"DynaPDF.MovePage";** /\* The function moves a page to another position in the document. \*/  
**$PDF**; /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/   
**$SourcePage**; /\* Source page number. From 1 to DynaPDF.PageCount.e.g. 1 \*/   
**$DestPage**) /\* Destination page number. From 1 to DynaPDF.PageCount.e.g. 2 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $pdf |
| SourcePage | Source page number. From 1 to DynaPDF.PageCount. | 1 |
| DestPage | Destination page number. From 1 to DynaPDF.PageCount. | 2 |

### Result

Returns OK or error.

### Description

The function moves a page to another position in the document.   
Moving a page requires some processing time if the document contains many bookmarks or page links because the destinations of all links and bookmarks must be modified so that they refer still to the correct page. For example, if the first page of a document should be moved to the last page, all pages of the document must be reordered. If the document is large and if it contains a few thousands page links as well as bookmarks, this action can take a while.  
The parameter Source must be a valid page number in the document. Page numbering starts at one. If the destination page is larger than the source page, the page number can be greater than the number of pages currently available in the document. The document is then filled with empty pages until the destination page becomes valid.  
If the destination page is smaller than the source page number, both page numbers must already exist in the document.  
  
It is also possible to exchange two pages with DynaPDF.ExchangePage.  
You can combine [DynaPDF.AppendPage](DynaPDFAppendPage.md) and DynaPDF.MovePage to make an insert page function.  
See also [MovePage](https://www.monkeybreadsoftware.com/DynaPDF-Manual/MovePage.shtml) function in DynaPDF manual.

### See also

- [DynaPDF.EditPage](DynaPDFEditPage.md)
- [DynaPDF.EndPage](DynaPDFEndPage.md)
- [DynaPDF.ExchangePages](DynaPDFExchangePages.md)
- [DynaPDF.MoveTo](DynaPDFMoveTo.md)
- [DynaPDF.New](DynaPDFNew.md)

This function checks for a license.

Created 2nd September 2014 , last changed 7th June 2024

  
[DynaPDF.MarkTemplateAsWatermark](DynaPDFMarkTemplateAsWatermark.md) - [DynaPDF.MoveTo](DynaPDFMoveTo.md)

[HTML Version](DynaPDFMovePage.shtml)