PSPDFRenderRequest
Objective-C
@interface PSPDFRenderRequest : NSObject <NSCopying, NSMutableCopying>
Swift
class RenderRequest : NSObject, NSCopying, NSMutableCopying
A render request specifies the exact parameters of how an image should be rendered.
You use it in order to configure a PSPDFRenderTask
which can then be passend
to a PSPDFRenderQueue
in order to fulfill the task.
To create a new render request you usually create a PSPDFMutableRenderRequest
and set the properties you need.
Thread safety
PSPDFRenderRequest is not thread safe, you should never modify a mutable render request from multiple threads nor should you modify a mutable render request while reading data from it on a different thread.
As soon as you hand over ownership of a render request to the render engine, it is copied, so that you do not need to worry about thread safety between your render requests and the ones the render engine holds.
See
PSPDFRenderTaskSee
PSPDFMutableRenderRequest-
Unavailable
Not the designated initializer
Undocumented
Declaration
Objective-C
PSPDF_EMPTY_INIT_UNAVAILABLE
-
Unavailable
Not the designated initializer
Undocumented
Declaration
Objective-C
PSPDF_EMPTY_INIT_UNAVAILABLE
-
Initializes a new render request for rendering images of pages from the passed in document.
Declaration
Objective-C
- (nonnull instancetype)initWithDocument:(nonnull PSPDFDocument *)document;
Swift
init(document: PSPDFDocument)
Parameters
document
The document this request should render images from.
Return Value
A newly initialized render request.
-
The document that this object is requesting an image rendering from.
Declaration
Objective-C
@property (nonatomic, readonly) PSPDFDocument *_Nonnull document;
Swift
var document: PSPDFDocument { get }
-
The index of the page that should be rendered from the document.
This defaults to the first page.
Declaration
Objective-C
@property (nonatomic, readonly) PSPDFPageIndex pageIndex;
Swift
var pageIndex: PageIndex { get }
-
The requested size of the rendered image.
Note
The actual image might be of a different size as the rendered image will have the aspect ratio ofpdfRect
or the full pdf page, in case you don’t specify apdfRect
. The resulting image will be rendered aspect-fit inside the requestedimageSize
, meaning in the resulting image at least one axis will be equal to the requested one and the other might be smaller.Declaration
Objective-C
@property (nonatomic, readonly) CGSize imageSize;
Swift
var imageSize: CGSize { get }
-
The rectangle in PDF coordinates defining the area of the page that should be rendered.
The rectangle that is described here is rendered into the given
renderSize
.Defaults to
CGRectNull
, which means the full page is rendered.Declaration
Objective-C
@property (nonatomic, readonly) CGRect pdfRect;
Swift
var pdfRect: CGRect { get }
-
The scale factor the image should be rendered in.
Defaults to 0.0 which will use the main screen’s scale factor on iOS and on macOS will always use 1.0.
Declaration
Objective-C
@property (nonatomic, readonly) CGFloat imageScale;
Swift
var imageScale: CGFloat { get }
-
Contains the annotations to be rendered in the image.
If this property contains an empty array, no annotations will be rendered in the image. If this property is nil, all annotations will be rendered in the image (the default).
Declaration
Objective-C
@property (nonatomic, copy, readonly, nullable) NSArray<__kindof PSPDFAnnotation *> *annotations;
Swift
var annotations: [PSPDFAnnotation]? { get }
-
Contains additional render options that should be used when rendering the image.
Note
The image will rendered by combining those options with the render options from the source document. Querying this property will not reflect the document options.Declaration
Objective-C
@property (nonatomic, copy, readonly) PSPDFRenderOptions *_Nonnull options;
Swift
@NSCopying var options: RenderOptions { get }
-
The user info dictionary can contain any arbitrary user info that is just passed through. Content in this dictionary is not touched at all and has no impact on the render result.
Note
Two render requests with different user info content can still be equal.Declaration
Objective-C
@property (nonatomic, copy, readonly) NSDictionary *_Nonnull userInfo;
Swift
var userInfo: [AnyHashable : Any] { get }
-
Determines the cache policy that is used to fullfill the request. If the policy is set to
PSPDFRenderRequestCachePolicyDefault
(the default value) the request will try to fullfill the request as efficient as possible.Declaration
Objective-C
@property (nonatomic, readonly) PSPDFRenderRequestCachePolicy cachePolicy;
Swift
var cachePolicy: RenderRequest.CachePolicy { get }
-
Compares the receiver and the passed in render request for equality.
Declaration
Objective-C
- (BOOL)isEqualRenderRequest:(nonnull PSPDFRenderRequest *)renderRequest;
Swift
func isEqualRenderRequest(_ renderRequest: RenderRequest) -> Bool
Parameters
renderRequest
The request to compare the receiver to.
Return Value
true
if both requests are equal,false
otherwise.