Not sure if this is a bug as PDFKit is in Beta on iOS, but when I create a PDFDocument based on an array of images (using PDFPage(image:), it flips the image vertically.
One (bad) solution to this bug (?) is to flip the image vertically in advance so it gets flipped back:
let img = arrayOfImages[i] let image = UIImage(cgImage: img.cgImage!, scale: img.scale, orientation: .downMirrored) let pdfpage = PDFPage(image: image)