PSPDFRenderRequest


@interface PSPDFRenderRequest : 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

PSPDFRenderTask

See

PSPDFMutableRenderRequest
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFRenderRequest : NSObject <NSCopying, NSMutableCopying>
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFRenderRequest : NSObject <NSCopying, NSMutableCopying>
  • 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 (readonly, nonatomic) 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 (readonly, nonatomic) NSUInteger pageIndex;

    Swift

    var pageIndex: UInt { 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 of pdfRect or the full pdf page, in case you don’t specify a pdfRect. The resulting image will be rendered aspect-fit inside the requested imageSize, 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 (readonly, nonatomic) CGSize imageSize;

    Swift

    var imageSize: CGSize { get }
  • The rect in pdf coordinates defining the area of the page that should be rendered.

    The rect that is described here is rendered into the given renderSize.

    Defaults to CGRectNull, which means the full page is rendered.

    Declaration

    Objective-C

    @property (readonly, nonatomic) 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 (readonly, nonatomic) 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 (readonly, copy, nonatomic, nullable)
        NSArray<__kindof PSPDFAnnotation *> *annotations;

    Swift

    var annotations: [PSPDFAnnotation]? { get }
  • Contains additional render options that should be used when rendering the image.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic)
        NSDictionary<PSPDFRenderOption, id> *_Nonnull options;

    Swift

    var options: [PSPDFRenderOption : Any] { get }
  • The user info dictionary can contain any arbitraty 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 (readonly, copy, nonatomic) 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 (readonly, nonatomic) PSPDFRenderRequestCachePolicy cachePolicy;

    Swift

    var cachePolicy: PSPDFRenderRequestCachePolicy { get }
  • Compares the receiver and the passed in render request for equality.

    Declaration

    Objective-C

    - (BOOL)isEqualRenderRequest:(nonnull PSPDFRenderRequest *)renderRequest;

    Swift

    func isEqualRenderRequest(_ renderRequest: PSPDFRenderRequest) -> Bool

    Parameters

    renderRequest

    The request to compare the receiver to.

    Return Value

    YES if both requests are equal, NO otherwise.