PDFImage

public class PDFImage : PDFDocumentObject

Image element for the PDF document.

Contains all information about an image, including the caption.

  • The actual image

    Declaration

    Swift

    public var image: Image
  • An instance of a PDFText subclass. Use PDFSimpleText for a simple, container-based styled caption and PDFAttributedText for advanced styling.

    Declaration

    Swift

    public var caption: PDFText?
  • The size of the image in the PDF document

    Declaration

    Swift

    public var size: CGSize
  • Defines how the image will fit if not enough space is given

    Declaration

    Swift

    public var sizeFit: PDFImageSizeFit
  • JPEG quality of image.

    Value ranges between 0.0 and 1.0, maximum quality equals 1.0

    Declaration

    Swift

    public var quality: CGFloat
  • Options used for changing the image before drawing

    Declaration

    Swift

    public var options: PDFImageOptions
  • Optional corner radius, is used if the options are set.

    Declaration

    Swift

    public var cornerRadius: CGFloat?
  • Initializer to create a PDF image element.

    Declaration

    Swift

    public init(
        image: Image,
        caption: PDFText? = nil,
        size: CGSize = .zero,
        sizeFit: PDFImageSizeFit = .widthHeight,
        quality: CGFloat = 0.85,
        options: PDFImageOptions = [.resize, .compress],
        cornerRadius: CGFloat? = nil
    )

    Parameters

    image

    Image which will be drawn

    caption

    Optional instance of a PDFText subclass, defaults to nil

    size

    Size of image, defaults to zero size

    sizeFit

    Defines how the image will fit if not enough space is given, defaults to PDFImageSizeFit.widthHeight

    quality

    JPEG quality between 0.0 and 1.0, defaults to 0.85

    options

    Defines if the image will be modified before rendering

    cornerRadius

    Defines the radius of the corners

  • Creates a new PDFImage with the same properties

    Declaration

    Swift

    public var copy: PDFImage { get }

Equatable

Hashable

  • nodoc

    Declaration

    Swift

    override public func hash(into hasher: inout Hasher)