int32_t __stdcall pdfDeletePage(PPDF IPDF, uint32_t PageNum);
BOOL32 __stdcall pdfMovePage(PPDF IPDF, uint32_t Source, uint32_t Dest);
int32_t __stdcall pdfClonePages(PPDF IPDF, int32_t FirstPage, int32_t LastPage, int32_t DestPage);
BOOL32 __stdcall pdfExchangePages(PPDF IPDF, uint32_t First, uint32_t Second);
function pdfDeletePage(const IPDF: PPDF; PageNum: Cardinal): Integer; stdcall;
function pdfMovePage(const IPDF: PPDF; Source, Dest: Cardinal): LongBool; stdcall;
function pdfClonePages(const IPDF: PPDF; FirstPage, LastPage, DestPage: Integer): Integer; stdcall;
function pdfExchangePages(const IPDF: PPDF; First, Second: Cardinal): LongBool; stdcall;
Purpose. Page-tree structural edits: remove a page, reorder one, duplicate a range, or swap two pages' positions.
Description. All four are real page-tree mutations (DeletePageH/ MovePage/ClonePagesH/ExchangePagesH). pdfClonePages reports the range as a per-content-stream page-model operation — per a source comment on the underlying ClonePagesH, actual page-tree duplication in this single-content-stream-per-page engine model returns the count of pages that would be/were cloned within the given range.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
PageNum | *(Delete only)* 1-based page to remove. |
Source, Dest | *(Move only)* 1-based source/destination positions. |
FirstPage, LastPage, DestPage | *(Clone only)* Source range and insertion point. |
First, Second | *(Exchange only)* The two 1-based positions to swap. |
Return value. pdfDeletePage: non-zero on success. pdfMovePage/ pdfExchangePages: True on success. pdfClonePages: the number of pages cloned; 0 on failure.
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Core
pdfExchangePages
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.