PSPDFRotatable
Objective-C
@protocol PSPDFRotatable <NSObject>
Swift
protocol Rotatable : NSObjectProtocol
Annotations that can be rotated conform to this protocol.
Rotation is supported by these annotation types:
Free text annotations:
- Rotating is supported in all saving configurations.
Stamps:
- Only supported by standard text stamps (Acrobat stamps) and vector stamps (stamps that make use of
AppearanceStreamGenerating
).- These stamp types can only be rotated if the PDF document embeds the annotation into the document itself.
I.e. the
.embedded
annotation save mode or.embeddedWithExternalFileAsFallback
if the file is writable. - Rotation is not supported if the annotations are saved to an external file using the
.externalFile
save mode. - Rotation is also not supported when using XFDF (
XFDFAnnotationProvider
) to save annotations.
- These stamp types can only be rotated if the PDF document embeds the annotation into the document itself.
I.e. the
- Rotation is not supported for image stamps or custom text stamps.
-
The counterclockwise angle of the annotation relative to the page, in degrees. The angle should be between 0 and 359. Defaults to 0.
To set the rotation, use
setRotation(_:updateBoundingBox:)
.As with all annotation properties, post a
.PSPDFAnnotationChanged
notification to propagate changes.Declaration
Objective-C
@property (readonly) NSUInteger rotation;
Swift
var rotation: UInt { get }
-
Sets the
rotation
property, optionally updating theboundingBox
to preserve the content size.Updating the
boundingBox
of the annotation will ensure it encloses the content while preserving the content size and center, without distorting the annotation.Not updating the
boundingBox
would in general distort the annotation, but in some cases it is required to get the correct results, such as during setup.As with all annotation properties, post a
.PSPDFAnnotationChanged
notification to propagate changes.Declaration
Objective-C
- (void)setRotation:(NSUInteger)rotation updateBoundingBox:(BOOL)shouldUpdateBoundingBoxToMaintainContentSize;
Swift
func setRotation(_ rotation: UInt, updateBoundingBox shouldUpdateBoundingBoxToMaintainContentSize: Bool)
Parameters
rotation
The new value for the
rotation
property. This should be between 0 and 359.shouldUpdateBoundingBoxToMaintainContentSize
If true the
boundingBox
will be updated to preserve the content size.