Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

PDFKit.SetPDFPageRotation

Sets the rotation angle for the page in degrees.

Component Version macOS Windows Linux Server iOS SDK
PDFKit 2.9 ✅ Yes ❌ No ❌ No ✅ Yes, on macOS ✅ Yes
MBS( "PDFKit.SetPDFPageRotation"; PDF; index; rotation )   More

Parameters

Parameter Description Example
PDF A container value with the PDF content from a media field. Or a text with an URL. Or a PDF reference from PDFKit.Open.
index The index of the page. From zero to PDFKit.GetPDFPageCount-1. 1
rotation The new rotation value. 90

Result

Returns OK on success.

Description

Sets the rotation angle for the page in degrees.
The rotation must be a positive or negative multiple of 90 (negative angles are converted to their positive equivalents; for example, -90 is changed to 270).

Your changes are only done in memory, so please remember to write modified pdf back to disk, e.g. by using PDFKit.WriteToPath. Or use PDFKit.GetPDFDocument to get a PDF for storing in a container.

Examples

Rotate page and set title:

# open PDF from container
Set Variable [$ref; Value:MBS("PDFKit.OpenContainer"; combine pdf::result)]
# Set title for PDF
Set Variable [$result; Value:MBS("PDFKit.SetPDFAttribute"; $ref; "Title"; combine pdf::title)]
# Rotate first page by 90°
Set Variable [$result; Value:MBS("PDFKit.SetPDFPageRotation"; $ref; 0; 90)]
# save document to container
Set Field [combine pdf::result; MBS("PDFKit.GetPDFDocument"; $ref; "result.pdf")]
# free memory
Set Variable [$result; Value:MBS("PDFKit.Release"; $ref)]

See also

This function checks for a license.

Created 18th August 2014, last changed 25th April 2016


PDFKit.SetPDFPageDisplayAnnotation - PDFKit.SetPrintOption