double __stdcall pdfGetPageWidth(PPDF IPDF);
double __stdcall pdfGetPageHeight(PPDF IPDF);
BOOL32 __stdcall pdfSetPageWidth(PPDF IPDF, double Value);
BOOL32 __stdcall pdfSetPageHeight(PPDF IPDF, double Value);
function pdfGetPageWidth(const IPDF: PPDF): Double; stdcall;
function pdfGetPageHeight(const IPDF: PPDF): Double; stdcall;
function pdfSetPageWidth(const IPDF: PPDF; Value: Double): LongBool; stdcall;
function pdfSetPageHeight(const IPDF: PPDF; Value: Double): LongBool; stdcall;
Purpose. Get/set the current page's width/height — and, for the setters, also stage the size for pages not yet created.
Description. The getters read the currently-open page's actual Width/Height. The setters have a real dual effect, per an explicit source comment documenting a past bug fix: they update the FPendingWidth/FPendingHeight values used to size the next page created via pdfAppend, and — if a page is currently open — resize that open page immediately too (Value <= 0 is silently rejected in both cases, leaving the prior size unchanged). Earlier engine behavior only staged the pending size and silently ignored an in-progress resize; this was fixed so calling pdfSetPageWidth/Height mid-page now takes effect immediately, matching the classic API's documented behavior.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
Value | New width/height; <= 0 is silently ignored (no change). |
Return value. Getters: the value in points; 0.0 if IPDF invalid or no page open. Setters: True if IPDF is valid (regardless of whether Value passed the > 0 check).
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Setters
pdfSetPageWidth
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.