PDFImage

public class PDFImage : PDFJSONSerializable

Image element for the PDF document. Contains all information about an image, including the caption.

  • The actual image

    Declaration

    Swift

    public var image: UIImage
  • 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
  • Declaration

    Swift

    public var options: PDFImageOptions
  • Initializer to create a PDF image element.

    Declaration

    Swift

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

    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

  • Declaration

    Swift

    public static func == (lhs: PDFImage, rhs: PDFImage) -> Bool