ScalePage
Page Manipulation
Description
Scales the content and page boxes of the current page. Every content layer is wrapped in a scaling transformation so existing content stretches by ScaleX and ScaleY, and the MediaBox and CropBox are updated to the scaled dimensions
Syntax
Delphi
Function TPDFlib.ScalePage(ScaleX, ScaleY: Double; Anchor: Integer): Integer;Parameters
| ScaleX | Horizontal scale factor, must be greater than 0 |
|---|---|
| ScaleY | Vertical scale factor, must be greater than 0 |
| Anchor | 0 keeps the lower-left corner fixed, 1 centers the scaled content within the original page area, 2 keeps the top-left corner fixed |
Return values
| 0 | No document is selected or one of the scale factors is zero, negative or not a finite number |
|---|---|
| 1 | The page was scaled successfully; factors of 1 and 1 are a successful no-op |
Remarks
The transformation is applied inside the content stream, so annotations, bookmarks, and other page-level structures keep their positions. Scaling one page does not affect other pages; call it after SelectPage for each page that should change
Example
PDF.SelectPage(1);
PDF.ScalePage(0.5, 0.5, 1);