QLPreviewRequestCreatePDFContext(_:_:_:_:)
Creates a PDF context suitable to draw a multi-page preview.
Declaration
func QLPreviewRequestCreatePDFContext(_ preview: QLPreviewRequest!, _ mediaBox: UnsafePointer<CGRect>!, _ auxiliaryInfo: CFDictionary!, _ properties: CFDictionary!) -> Unmanaged<CGContext>!Parameters
- preview:
The preview request object.
- mediaBox:
A pointer to the media box of the context.
A media box is a rectangle that defines the size and location of the PDF page. The origin of the rectangle should typically be (0,0). If you pass NULL, Quartz uses a default page size of 8.5 by 11 inches (612 by 792 points). For information see the description for Init(consumer:mediabox:_:).
- auxiliaryInfo:
A dictionary containing PDF auxiliary information. See the description of the auxiliary dictionary keys in Auxiliary Dictionary Keys for more information about the keys and values of this dictionary.
- properties:
A dictionary containing additional properties for the preview response. For information on acceptable keys and values, see
Preview Properties.
Return Value
A reference to a Core Graphics context object that is used to display a PDF version of the preview. You should explicitly release this object when it is no longer needed.
Discussion
Be sure to bracket each PDF page written to the context with beginPDFPage(_:) and endPDFPage() calls. After calling this function, you should flush the context with QLPreviewRequestFlushContext(_:_:).
Special Considerations
Thread-safety: This function should be called in the same thread as the preview request is made in; generally, this is the same thread in which the GeneratePreviewForURL callback was invoked.
See Also
Requesting previews
QLPreviewRequestCopyContentUTI(_:)QLPreviewRequestCopyOptions(_:)QLPreviewRequestCopyURL(_:)QLPreviewRequestCreateContext(_:_:_:_:)QLPreviewRequestFlushContext(_:_:)QLPreviewRequestGetDocumentObject(_:)QLPreviewRequestSetDocumentObject(_:_:_:)QLPreviewRequestGetGeneratorBundle(_:)QLPreviewRequestGetTypeID()QLPreviewRequestIsCancelled(_:)QLPreviewRequestSetDataRepresentation(_:_:_:_:)QLPreviewRequestSetURLRepresentation(_:_:_:_:)